Changeset 44

Show
Ignore:
Timestamp:
01/17/06 00:16:46 (3 years ago)
Author:
laurentj
Message:

corrections de bugs divers et ajout de plugin de template pour jUrl

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lib/jelix-scripts/templates/config.classic.ini.php.tpl

    r18 r44  
    6969 
    7070[urlengine_specific_entrypoints] 
    71 ;/foo/index.php = "mymodule" 
    72 ;foo.php = "*~myaction" 
     71; nom_script_sans_suffix = "liste de selecteur d'action s�r�ar un espace" 
     72; selecteurs : 
     73;   m~a@r    -> pour action "a" du module "m" r�ndant au type de requete "r" 
     74;   m~*@r    -> pour toute action du module "m" r�ndant au type de requete "r" 
     75;   @r       -> toute action de tout module r�ndant au type de requete "r" 
    7376 
     77index = "@classic" 
     78xmlrpc = "@xmlrpc" 
     79jsonrpc = "@jsonrpc" 
  • trunk/lib/jelix/core/jCoordinator.class.php

    r36 r44  
    4242     * @var string 
    4343     */ 
    44     private $moduleName; 
     44    public $moduleName; 
    4545    /** 
    4646     * @var string 
    4747     */ 
    48     private $actionName; 
     48    public $actionName; 
    4949 
    5050    /** 
     
    100100    public function process ($request){ 
    101101        global $gJConfig; 
     102 
    102103        $this->request = $request; 
    103104                  session_start(); 
     
    169170 
    170171        if(!isset($gJConfig->responses[$type])){ 
    171             trigger_error(jLocale::get('jelix~errors.default.response.type.unknow',array($type)),E_USER_ERROR); 
     172            trigger_error(jLocale::get('jelix~errors.default.response.type.unknow',array($this->moduleName.'~'.$this->actionName,$type)),E_USER_ERROR); 
    172173            return null; 
    173174        } 
     
    179180           require_once ($path); 
    180181        }else{ 
    181            trigger_error(jLocale::get('jelix~errors.default.reponse.not.loaded',array($type)),E_USER_ERROR); 
     182           trigger_error(jLocale::get('jelix~errors.default.response.not.loaded',array($this->moduleName.'~'.$this->actionName,$type)),E_USER_ERROR); 
    182183           return null; 
    183184        } 
  • trunk/lib/jelix/core/jSelector.class.php

    r39 r44  
    144144        $this->_compilerPath=JELIX_LIB_CORE_PATH.'jActionsCompiler.class.php'; 
    145145        $this->request = $gJCoord->request->type; 
    146          
    147         if(preg_match("/^(([\w\.]+)~)?([\w\.]+)$/", $sel, $m)){ 
    148         //"/^(([\w\.]+|\#)~)?([\w\.]+|\#)(@([\w\.]+))?$/"    �ester avant... 
     146 
     147        if(preg_match("/^(?:([\w\.]+|\#)~)?([\w\.]+|\#)(?:@([\w\.]+))?$/", $sel, $m)){ 
    149148            $this->_valid = true; 
    150             if($m[1]!='' && $m[2]!=''){ 
    151               if($m[2] == '#') 
     149            if($m[1]!=''){ 
     150              if($m[1] == '#') 
    152151                $this->module = $gJCoord->moduleName; 
    153152              else 
    154                 $this->module = $m[2]; 
     153                $this->module = $m[1]; 
    155154            }else{ 
    156155                $this->module = jContext::get (); 
    157                 //$this->module = $GLOBALS['gJConfig']->defaultModule; 
    158156            } 
    159             if($m[3] == '#') 
     157            if($m[2] == '#') 
    160158               $this->resource = $gJCoord->actionName; 
    161159            else 
    162                $this->resource = $m[3]; 
    163                 
    164             if(isset($m[4]) && $m[4] != '') // test �irer apr�activation de la nouvelle regexp 
    165               $this->request = $m[4]; 
     160               $this->resource = $m[2]; 
     161 
     162            if(isset($m[3]) && $m[3] != '') 
     163              $this->request = $m[3]; 
    166164            else 
    167165              $this->request = $gJCoord->request->type; 
    168              
     166 
    169167            $this->_createPath(); 
    170168        }else{ 
  • trunk/lib/jelix/core/response/jResponseHtml.class.php

    r43 r44  
    127127            echo '<div id="jelixerror" style="position:absolute;left:0px;top:0px;border:3px solid red; background-color:#f39999;color:black;">'; 
    128128            echo implode("\n",$this->_errorMessages); 
    129             echo '</div>'; 
     129            echo '<p><a href="#" onclick="document.getElementById(\'jelixerror\').style.display=\'none\';return false;">fermer</a></div>'; 
    130130        } 
    131131        echo implode("\n",$this->_bodyBottom); 
  • trunk/lib/jelix/core/url/jUrl.class.php

    r41 r44  
    6767    public $pathInfo = ''; 
    6868 
    69      
     69 
    7070    public $requestType =''; 
    7171    /** 
     
    123123    * @return    string    l'url form�    */ 
    124124    public function toString ($forxml = false, $isUrlForApp=true){ 
    125  
     125        global $gJCoord; 
    126126        $urlobj=$this; 
    127127        if($isUrlForApp){ 
     
    133133               $urlobj->requestType = $gJCoord->request->type; 
    134134            } 
    135             $urlobj->scriptName =  self::getScript($urlobj->requestType, $urlobj->getParam('module'),$urlobj->getParam('action')); 
     135 
     136            $urlobj->scriptName =  $this->getScript($urlobj->requestType, $urlobj->getParam('module'),$urlobj->getParam('action')); 
    136137            $engine = & self::getEngine(); 
    137138            $engine->create($urlobj); // set path info 
     
    198199    */ 
    199200    static function get ($actSel = null, $params = array (), $forxml = false) { 
     201 
    200202        if ($actSel === null){ 
    201203            return '/'.$GLOBALS['gJCoord']->request->url_script_path; 
     
    206208            $sel = new JSelectorAct($actSel); 
    207209            $params['module'] = $sel->module; 
    208             $params['action'] = $sel->resource;             
     210            $params['action'] = $sel->resource; 
    209211            $url = new jUrl('',$params); 
    210212            $url->requestType= $sel->request; 
     
    261263        } 
    262264        $sel = new JSelectorAct($actionSelector); 
    263         if($sel->isValid()){         
     265        if($sel->isValid()){ 
    264266           return array('module'=>$sel->module, 'action'=>$sel->ressource, 'request'=>$sel->request); 
    265267        }else{ 
     
    268270    } 
    269271 
    270     static function getScript($requestType, $module=null, $action=null, $nosuffix=false){ 
     272     function getScript($requestType, $module=null, $action=null, $nosuffix=false){ 
     273        static $urlspe = null; 
    271274        global $gJConfig; 
    272         static $urlspe = null; 
    273         $script = $gJConfig->urlengine->default_entrypoint
     275 
     276        $script = $gJConfig->urlengine['default_entrypoint']
    274277 
    275278        if(count($gJConfig->urlengine_specific_entrypoints)){ 
     
    279282                 $selectors = preg_split("/[\s,]+/", $sel); 
    280283                 foreach($selectors as $sel){ 
    281                      $urlspe[$sel]= $entrypoint;                  
     284                     $urlspe[$sel]= $entrypoint; 
    282285                 } 
    283286               } 
     
    285288 
    286289           $found = false; 
    287            
     290 
    288291           if($action && $action !='' && isset($sep[$module.'~'.$action.'@'.$requestType])){ 
    289292                $script = $sep[$module.'~'.$action.'@'.$requestType]; 
    290293                $found = true; 
    291294           } 
    292                        
     295 
    293296           if($module && $module !='' && !$found &&  isset($sep[$module.'~*@'.$requestType])){ 
    294297                $script = $sep[$module.'~*@'.$requestType]; 
    295298                $found = true; 
    296299           } 
    297             
     300 
    298301           if(!$found && isset($sep['@'.$requestType])){ 
    299302               $script = $sep['@'.$requestType]; 
     
    302305        } 
    303306 
    304         if(!$nosuffix && !$gJConfig->urlengine->multiview_on){ 
    305             $script.=$gJConfig->urlengine->entrypoint_extension
     307        if(!$nosuffix && !$gJConfig->urlengine['multiview_on']){ 
     308            $script.=$gJConfig->urlengine['entrypoint_extension']
    306309        } 
    307310        return $script; 
  • trunk/lib/jelix/db/drivers/mysql/jDbConnection.mysql.class.php

    r4 r44  
    7777 
    7878       // ici et non lors du connect, pour le cas o�y a plusieurs connexion active 
    79       if(!mysql_select_db ($this->profil['database'], $this->_connection)) 
     79      if(!mysql_select_db ($this->profil['database'], $this->_connection)){ 
    8080         throw new JException('jelix~db.error.database.unknow',$this->profil['database']); 
     81      } 
    8182 
    8283      if ($qI = mysql_query ($query, $this->_connection)){ 
  • trunk/lib/jelix/utils/jTplCompiler.class.php

    r36 r44  
    310310 
    311311    private function _getPlugin($type, $name){ 
    312        global $gJCoord
     312       global $gJCoord, $gJConfig
    313313       $treq = $gJCoord->response->getType(); 
    314314 
    315315       $foundPath=''; 
    316        if(isset($gJCoord->tplpluginPathList[$treq])){ 
    317          foreach($gJCoord->tplpluginPathList[$treq] as $path){ 
     316 
     317       if(isset($gJConfig->tplpluginsPathList[$treq])){ 
     318         foreach($gJConfig->tplpluginsPathList[$treq] as $path){ 
    318319           $foundPath=$path.$type.'.'.$name.'.php'; 
     320 
    319321           if(file_exists($foundPath)){ 
    320322              return $foundPath; 
     
    322324         } 
    323325       } 
    324        if(isset($gJCoord->tplpluginPathList['common'])){ 
    325          foreach($gJCoord->tplpluginPathList['common'] as $path){ 
     326       if(isset($gJConfig->tplpluginsPathList['common'])){ 
     327         foreach($gJConfig->tplpluginsPathList['common'] as $path){ 
    326328            $foundPath=$path.$type.'.'.$name.'.php'; 
    327329           if(file_exists($foundPath)){ 
  • trunk/lib/jelix/utils/jZone.class.php

    r31 r44  
    8585    * @param array   $params un tableau a passer a la fonction processZone de l'objet zone. 
    8686    */ 
    87     function  _callZone($name,$method, &$params){ 
     87    protected static function  _callZone($name,$method, &$params){ 
    8888 
    8989        $sel = new jSelectorZone($name); 
  • trunk/myapp/var/config/dbprofils.ini.php.dist

    r1 r44  
    1515password= 
    1616persistent= on 
    17 shared= on 
    18 schema= 
    1917 
    2018 
     19 
  • trunk/testapp/modules/testapp/templates/testzone.tpl

    r38 r44  
    99 
    1010<p>one conf key={$oneconf->ckey} value={$oneconf->cvalue}</p> 
     11<p>Link to actions:</p> 
     12<ul> 
     13<li> "testapp~default@classic" : {jurl "testapp~default@classic"}</li> 
     14<li> "default@classic": {jurl "default@classic"}</li> 
     15<li> "default" : {jurl "default"}</li> 
     16<li> "testapp~default" : {jurl "testapp~default"}</li> 
     17<li> "testapp~#" : {jurl "testapp~#"}</li> 
     18<li> "#~#" : {jurl "#~#"}</li> 
     19<li> "@" : {jurl "@"}</li> 
     20</ul> 
  • trunk/testapp/responses/myHtmlResponse.class.php

    r38 r44  
    1717 
    1818 
    19         public $bodyTpl = 'myapp~main'; 
    20     public $bodyErrorTpl = 'myapp~error'; 
     19        public $bodyTpl = 'testapp~main'; 
     20    public $bodyErrorTpl = 'testapp~error'; 
    2121 
    2222 
  • trunk/testapp/var/config/dbprofils.ini.php.dist

    r38 r44  
    1515password= 
    1616persistent= on 
    17 shared= on 
    18 schema= 
    1917 
    2018 
Download in other formats: Unified Diff Zip Archive