Changeset 44
- Timestamp:
- 01/17/06 00:16:46 (3 years ago)
- Files:
-
- trunk/lib/jelix-scripts/templates/config.classic.ini.php.tpl (modified) (1 diff)
- trunk/lib/jelix/core/jCoordinator.class.php (modified) (4 diffs)
- trunk/lib/jelix/core/jSelector.class.php (modified) (1 diff)
- trunk/lib/jelix/core/response/jResponseHtml.class.php (modified) (1 diff)
- trunk/lib/jelix/core/url/jUrl.class.php (modified) (10 diffs)
- trunk/lib/jelix/db/drivers/mysql/jDbConnection.mysql.class.php (modified) (1 diff)
- trunk/lib/jelix/tpl_plugins/html/function.jurl.php (added)
- trunk/lib/jelix/tpl_plugins/text (added)
- trunk/lib/jelix/tpl_plugins/text/function.jurl.php (added)
- trunk/lib/jelix/tpl_plugins/xul (added)
- trunk/lib/jelix/tpl_plugins/xul/function.jurl.php (added)
- trunk/lib/jelix/utils/jTplCompiler.class.php (modified) (2 diffs)
- trunk/lib/jelix/utils/jZone.class.php (modified) (1 diff)
- trunk/myapp/var/config/dbprofils.ini.php.dist (modified) (1 diff)
- trunk/testapp/modules/testapp/templates/testzone.tpl (modified) (1 diff)
- trunk/testapp/responses/myHtmlResponse.class.php (modified) (1 diff)
- trunk/testapp/var/config/dbprofils.ini.php.dist (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/lib/jelix-scripts/templates/config.classic.ini.php.tpl
r18 r44 69 69 70 70 [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" 73 76 77 index = "@classic" 78 xmlrpc = "@xmlrpc" 79 jsonrpc = "@jsonrpc" trunk/lib/jelix/core/jCoordinator.class.php
r36 r44 42 42 * @var string 43 43 */ 44 p rivate$moduleName;44 public $moduleName; 45 45 /** 46 46 * @var string 47 47 */ 48 p rivate$actionName;48 public $actionName; 49 49 50 50 /** … … 100 100 public function process ($request){ 101 101 global $gJConfig; 102 102 103 $this->request = $request; 103 104 session_start(); … … 169 170 170 171 if(!isset($gJConfig->responses[$type])){ 171 trigger_error(jLocale::get('jelix~errors.default.response.type.unknow',array($t ype)),E_USER_ERROR);172 trigger_error(jLocale::get('jelix~errors.default.response.type.unknow',array($this->moduleName.'~'.$this->actionName,$type)),E_USER_ERROR); 172 173 return null; 173 174 } … … 179 180 require_once ($path); 180 181 }else{ 181 trigger_error(jLocale::get('jelix~errors.default.re ponse.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); 182 183 return null; 183 184 } trunk/lib/jelix/core/jSelector.class.php
r39 r44 144 144 $this->_compilerPath=JELIX_LIB_CORE_PATH.'jActionsCompiler.class.php'; 145 145 $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)){ 149 148 $this->_valid = true; 150 if($m[1]!='' && $m[2]!=''){151 if($m[ 2] == '#')149 if($m[1]!=''){ 150 if($m[1] == '#') 152 151 $this->module = $gJCoord->moduleName; 153 152 else 154 $this->module = $m[ 2];153 $this->module = $m[1]; 155 154 }else{ 156 155 $this->module = jContext::get (); 157 //$this->module = $GLOBALS['gJConfig']->defaultModule;158 156 } 159 if($m[ 3] == '#')157 if($m[2] == '#') 160 158 $this->resource = $gJCoord->actionName; 161 159 else 162 $this->resource = $m[ 3];163 164 if(isset($m[ 4]) && $m[4] != '') // test �irer apr�activation de la nouvelle regexp165 $this->request = $m[ 4];160 $this->resource = $m[2]; 161 162 if(isset($m[3]) && $m[3] != '') 163 $this->request = $m[3]; 166 164 else 167 165 $this->request = $gJCoord->request->type; 168 166 169 167 $this->_createPath(); 170 168 }else{ trunk/lib/jelix/core/response/jResponseHtml.class.php
r43 r44 127 127 echo '<div id="jelixerror" style="position:absolute;left:0px;top:0px;border:3px solid red; background-color:#f39999;color:black;">'; 128 128 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>'; 130 130 } 131 131 echo implode("\n",$this->_bodyBottom); trunk/lib/jelix/core/url/jUrl.class.php
r41 r44 67 67 public $pathInfo = ''; 68 68 69 69 70 70 public $requestType =''; 71 71 /** … … 123 123 * @return string l'url form� */ 124 124 public function toString ($forxml = false, $isUrlForApp=true){ 125 125 global $gJCoord; 126 126 $urlobj=$this; 127 127 if($isUrlForApp){ … … 133 133 $urlobj->requestType = $gJCoord->request->type; 134 134 } 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')); 136 137 $engine = & self::getEngine(); 137 138 $engine->create($urlobj); // set path info … … 198 199 */ 199 200 static function get ($actSel = null, $params = array (), $forxml = false) { 201 200 202 if ($actSel === null){ 201 203 return '/'.$GLOBALS['gJCoord']->request->url_script_path; … … 206 208 $sel = new JSelectorAct($actSel); 207 209 $params['module'] = $sel->module; 208 $params['action'] = $sel->resource; 210 $params['action'] = $sel->resource; 209 211 $url = new jUrl('',$params); 210 212 $url->requestType= $sel->request; … … 261 263 } 262 264 $sel = new JSelectorAct($actionSelector); 263 if($sel->isValid()){ 265 if($sel->isValid()){ 264 266 return array('module'=>$sel->module, 'action'=>$sel->ressource, 'request'=>$sel->request); 265 267 }else{ … … 268 270 } 269 271 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; 271 274 global $gJConfig; 272 static $urlspe = null; 273 $script = $gJConfig->urlengine ->default_entrypoint;275 276 $script = $gJConfig->urlengine['default_entrypoint']; 274 277 275 278 if(count($gJConfig->urlengine_specific_entrypoints)){ … … 279 282 $selectors = preg_split("/[\s,]+/", $sel); 280 283 foreach($selectors as $sel){ 281 $urlspe[$sel]= $entrypoint; 284 $urlspe[$sel]= $entrypoint; 282 285 } 283 286 } … … 285 288 286 289 $found = false; 287 290 288 291 if($action && $action !='' && isset($sep[$module.'~'.$action.'@'.$requestType])){ 289 292 $script = $sep[$module.'~'.$action.'@'.$requestType]; 290 293 $found = true; 291 294 } 292 295 293 296 if($module && $module !='' && !$found && isset($sep[$module.'~*@'.$requestType])){ 294 297 $script = $sep[$module.'~*@'.$requestType]; 295 298 $found = true; 296 299 } 297 300 298 301 if(!$found && isset($sep['@'.$requestType])){ 299 302 $script = $sep['@'.$requestType]; … … 302 305 } 303 306 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']; 306 309 } 307 310 return $script; trunk/lib/jelix/db/drivers/mysql/jDbConnection.mysql.class.php
r4 r44 77 77 78 78 // 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)){ 80 80 throw new JException('jelix~db.error.database.unknow',$this->profil['database']); 81 } 81 82 82 83 if ($qI = mysql_query ($query, $this->_connection)){ trunk/lib/jelix/utils/jTplCompiler.class.php
r36 r44 310 310 311 311 private function _getPlugin($type, $name){ 312 global $gJCoord ;312 global $gJCoord, $gJConfig; 313 313 $treq = $gJCoord->response->getType(); 314 314 315 315 $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){ 318 319 $foundPath=$path.$type.'.'.$name.'.php'; 320 319 321 if(file_exists($foundPath)){ 320 322 return $foundPath; … … 322 324 } 323 325 } 324 if(isset($gJCo ord->tplpluginPathList['common'])){325 foreach($gJCo ord->tplpluginPathList['common'] as $path){326 if(isset($gJConfig->tplpluginsPathList['common'])){ 327 foreach($gJConfig->tplpluginsPathList['common'] as $path){ 326 328 $foundPath=$path.$type.'.'.$name.'.php'; 327 329 if(file_exists($foundPath)){ trunk/lib/jelix/utils/jZone.class.php
r31 r44 85 85 * @param array $params un tableau a passer a la fonction processZone de l'objet zone. 86 86 */ 87 function _callZone($name,$method, &$params){87 protected static function _callZone($name,$method, &$params){ 88 88 89 89 $sel = new jSelectorZone($name); trunk/myapp/var/config/dbprofils.ini.php.dist
r1 r44 15 15 password= 16 16 persistent= on 17 shared= on18 schema=19 17 20 18 19 trunk/testapp/modules/testapp/templates/testzone.tpl
r38 r44 9 9 10 10 <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 17 17 18 18 19 public $bodyTpl = ' myapp~main';20 public $bodyErrorTpl = ' myapp~error';19 public $bodyTpl = 'testapp~main'; 20 public $bodyErrorTpl = 'testapp~error'; 21 21 22 22 trunk/testapp/var/config/dbprofils.ini.php.dist
r38 r44 15 15 password= 16 16 persistent= on 17 shared= on18 schema=19 17 20 18
