Changeset 320
- Timestamp:
- 11/29/06 11:48:18 (2 years ago)
- Files:
-
- trunk/build/manifests/testapp.mn (modified) (1 diff)
- trunk/lib/jelix/core/url/jUrlCompiler.significant.class.php (modified) (4 diffs)
- trunk/lib/jelix/core/url/jUrlEngine.significant.class.php (modified) (4 diffs)
- trunk/testapp/modules/unittest/classes/urlsig.urlhandler.php (modified) (2 diffs)
- trunk/testapp/modules/unittest/classes/utcreateurls.class.php (modified) (7 diffs)
- trunk/testapp/modules/unittest/controllers/urlsig.classic.php (modified) (1 diff)
- trunk/testapp/modules/unittest/templates/menu.tpl (modified) (3 diffs)
- trunk/testapp/responses/myHtmlResponse.class.php (modified) (1 diff)
- trunk/testapp/responses/testUnitResponse.class.php (modified) (1 diff)
- trunk/testapp/var/config/dbprofils.ini.php.dist (modified) (1 diff)
- trunk/testapp/www/foo (added)
- trunk/testapp/www/foo/bar.php (added)
- trunk/testapp/www/testnews.php (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/build/manifests/testapp.mn
r310 r320 14 14 xmlrpc.php 15 15 index.php 16 testnews.php 17 cd testapp/www/foo 18 bar.php 16 19 cd testapp/www/design 17 20 screen.css trunk/lib/jelix/core/url/jUrlCompiler.significant.class.php
r267 r320 50 50 o� $isDefault : indique si c'est un point d'entr�par d�ut, et donc si le parser ne trouve rien, si il ignore ou fait une erreur 51 51 52 $infoparser = array('module','action',' nomhandler')52 $infoparser = array('module','action','selecteur handler') 53 53 ou 54 54 $infoparser = array( 'module','action', 'regexp_pathinfo', … … 63 63 $CREATE_URL = array( 64 64 'news~show@classic' => 65 array(0,'entrypoint', https true/false, entrypoint true/false, ' handler')65 array(0,'entrypoint', https true/false, entrypoint true/false, 'selecteur handler') 66 66 ou 67 67 array(1,'entrypoint', https true/false, entrypoint true/false, … … 134 134 if(isset($url['handler'])){ 135 135 $class = (string)$url['handler']; 136 $s= new jSelectorUrlHandler($module.'~'.$class); 136 // il faut absolument un nom de module dans le selecteur, car lors de l'analyse de l'url 137 // dans le request, il n'y a pas de module connu dans le context (normal...) 138 $p= strpos($class,'~'); 139 if($p === false) 140 $selclass = $module.'~'.$class; 141 elseif( $p == 0) 142 $selclass = $module.$class; 143 else 144 $selclass = $class; 145 $s= new jSelectorUrlHandler($selclass); 137 146 $createUrlContent.="include_once('".$s->getPath()."');\n"; 138 $parseInfos[]=array($module, $action, $ class, $actionOverride );139 $createUrlInfos[$module.'~'.$action.'@'.$requestType] = array(0,$urlep, $urlhttps, $ class);147 $parseInfos[]=array($module, $action, $selclass, $actionOverride ); 148 $createUrlInfos[$module.'~'.$action.'@'.$requestType] = array(0,$urlep, $urlhttps, $selclass); 140 149 if($actionOverride){ 141 150 foreach($actionOverride as $ao){ 142 $createUrlInfos[$module.'~'.$ao.'@'.$requestType] = array(0,$urlep,$urlhttps, $ class);151 $createUrlInfos[$module.'~'.$ao.'@'.$requestType] = array(0,$urlep,$urlhttps, $selclass); 143 152 } 144 153 } … … 201 210 } 202 211 $parseInfos[]=array($module, $action, '!^'.$regexppath.'$!', $listparam, $escapes, $liststatics, $actionOverride ); 203 $createUrlInfos[$module.'~'.$action.'@'.$requestType] = array(1,$urlep, $urlhttps, $listparam, $escapes,$path );212 $createUrlInfos[$module.'~'.$action.'@'.$requestType] = array(1,$urlep, $urlhttps, $listparam, $escapes,$path, false); 204 213 if($actionOverride){ 205 214 foreach($actionOverride as $ao){ 206 $createUrlInfos[$module.'~'.$ao.'@'.$requestType] = array(1,$urlep, $urlhttps, $listparam, $escapes,$path );215 $createUrlInfos[$module.'~'.$ao.'@'.$requestType] = array(1,$urlep, $urlhttps, $listparam, $escapes,$path, true); 207 216 } 208 217 } trunk/lib/jelix/core/url/jUrlEngine.significant.class.php
r318 r320 155 155 if(count($infoparsing) < 5){ 156 156 // on a un tableau du style 157 // array( 0=> 'module', 1=>'action', 2=>' handler', 3=>array('actions','secondaires'))157 // array( 0=> 'module', 1=>'action', 2=>'selecteur handler', 3=>array('actions','secondaires')) 158 158 $s = new jSelectorUrlHandler($infoparsing[2]); 159 159 #ifdef ENABLE_OLD_CLASS_NAMING … … 292 292 /* 293 293 urlinfo = 294 array(0,'entrypoint', https true/false, entrypoint true/false,' handler')294 array(0,'entrypoint', https true/false, entrypoint true/false,'selecteur handler') 295 295 ou 296 296 array(1,'entrypoint', https true/false, entrypoint true/false … … 298 298 array(true, false..), // valeur des escapes 299 299 "/news/%1/%2/%3/%4-%5", // forme de l'url 300 false, //indique si c'est une action surchargeante 300 301 ) 301 302 ou … … 347 348 else 348 349 $url->pathInfo = substr($result,1); 350 if($urlinfo[6]) 351 $url->setParam('action',$action); 349 352 350 353 }elseif($urlinfo[0]==3){ trunk/testapp/modules/unittest/classes/urlsig.urlhandler.php
r314 r320 12 12 if(preg_match("/^\/withhandler\/(.*)\/(.*)$/",$url->pathInfo,$match)){ 13 13 $urlact = new jUrlAction($url->params); 14 $urlact->setParam('first', $match[1]);15 $urlact->setParam('second', $match[2]);14 $urlact->setParam('first',jUrl::unescape($match[1])); 15 $urlact->setParam('second',jUrl::unescape($match[2])); 16 16 return $urlact; 17 17 }else … … 21 21 function create($urlact, $url){ 22 22 23 $f= $url->getParam('first');24 $s= $url->getParam('second');23 $f=jUrl::escape($url->getParam('first')); 24 $s=jUrl::escape($url->getParam('second')); 25 25 26 26 $url->pathInfo = "/withhandler/$f/$s"; trunk/testapp/modules/unittest/classes/utcreateurls.class.php
r318 r320 111 111 );*/ 112 112 113 113 jUrl::getEngine(true); // on recharge le nouveau moteur d'url 114 114 $urlList=array(); 115 115 $urlList[]= array('urlsig_url1', array('mois'=>'10', 'annee'=>'2005', 'id'=>'35')); … … 138 138 139 139 $gJConfig->urlengine['multiview']=true; 140 jUrl::getEngine(true); // on recharge le nouveau moteur d'url 140 141 $trueResult=array( 141 142 "/index?mois=10&annee=2005&id=35&module=unittest&action=urlsig_url1", … … 218 219 219 220 $urlList=array(); 220 $urlList[]= array('urlsig_url1', array('mois'=>'10', 'annee'=>'2005', 'id'=>'35')); 221 $urlList[]= array('urlsig_url1', array('mois'=>'10', 'annee'=>'2005', 'id'=>'01')); 222 $urlList[]= array('urlsig_url9', array('mois'=>'10', 'annee'=>'2005', 'id'=>'09')); 223 $urlList[]= array('urlsig_url10', array('mois'=>'10', 'annee'=>'2005', 'id'=>'10')); 221 224 $urlList[]= array('urlsig_url2', array('mois'=>'05', 'annee'=>'2004')); 222 225 $urlList[]= array('unittest~urlsig_url3', array('rubrique'=>'actualite', 'id_art'=>'65', 'article'=>'c\'est la f� au village')); … … 230 233 231 234 $trueResult=array( 232 "/index.php/test/news/2005/10/35", 235 "/index.php/test/news/2005/10/01", 236 "/index.php/test/news/2005/10/09?action=urlsig_url9", 237 "/index.php/test/news/2005/10/10?action=urlsig_url10", 233 238 "/testnews.php/2004/05", 234 239 "/index.php/test/cms/actualite/65-c-est-la-fete-au-village", … … 242 247 ); 243 248 244 $trueResult[ 8]='https://'.$_SERVER['HTTP_HOST'].$trueResult[8];249 $trueResult[10]='https://'.$_SERVER['HTTP_HOST'].$trueResult[10]; 245 250 $this->_doCompareUrl("significant, multiview = false", $urlList,$trueResult); 246 251 … … 248 253 $gJConfig->urlengine['multiview']=true; 249 254 $trueResult=array( 250 "/index/test/news/2005/10/35", 255 "/index/test/news/2005/10/01", 256 "/index/test/news/2005/10/09?action=urlsig_url9", 257 "/index/test/news/2005/10/10?action=urlsig_url10", 251 258 "/testnews/2004/05", 252 259 "/index/test/cms/actualite/65-c-est-la-fete-au-village", … … 258 265 "/index/shop/vetements/98" 259 266 ); 260 $trueResult[ 8]='https://'.$_SERVER['HTTP_HOST'].$trueResult[8];267 $trueResult[10]='https://'.$_SERVER['HTTP_HOST'].$trueResult[10]; 261 268 $this->_doCompareUrl("significant, multiview = true", $urlList,$trueResult); 262 269 trunk/testapp/modules/unittest/controllers/urlsig.classic.php
r314 r320 14 14 class urlsigCtrl extends jController { 15 15 16 function url1() { 17 return $this->getResponse('testunit'); 16 function url1($type='url1') { 17 $rep = $this->getResponse('unittest'); 18 $content='<h1>test url : news '.$type.'</h1>'; 19 $content.='<ul><li>annee='.$this->param('annee').'</li>'; 20 $content.='<li>mois='.$this->param('mois').'</li>'; 21 $content.='<li>id='.$this->param('id').'</li></ul>'; 22 $rep->body->assign('MAIN',$content); 23 return $rep; 18 24 } 19 25 function url2() { 20 return $this->getResponse('testunit'); 26 $rep = $this->getResponse('unittest'); 27 $content='<h1>test url : testnews (url2)</h1>'; 28 $content.='<ul><li>annee='.$this->param('annee').'</li>'; 29 $content.='<li>mois='.$this->param('mois').'</li>'; 30 $content.='<li>mystatic='.$this->param('mystatic').'</li></ul>'; 31 $rep->body->assign('MAIN',$content); 32 return $rep; 21 33 } 22 34 function url3() { 23 return $this->getResponse('testunit'); 35 $rep = $this->getResponse('unittest'); 36 $content='<h1>test url : cms (url3)</h1>'; 37 $content.='<ul><li>rubrique='.$this->param('rubrique').'</li>'; 38 $content.='<li>id_art='.$this->param('id_art').'</li>'; 39 $content.='<li>article='.$this->param('article').'</li></ul>'; 40 $rep->body->assign('MAIN',$content); 41 return $rep; 24 42 } 25 43 function url4() { 26 return $this->getResponse('testunit'); 44 $rep = $this->getResponse('unittest'); 45 $content='<h1>test url handler (url4)</h1>'; 46 $content.='<ul><li>first='.$this->param('first').'</li>'; 47 $content.='<li>second='.$this->param('second').'</li></ul>'; 48 $rep->body->assign('MAIN',$content); 49 return $rep; 27 50 } 28 51 function url5() { 29 return $this->getResponse('testunit'); 52 return $this->getResponse('unittest'); 53 } 54 function url6() { 55 $rep = $this->getResponse('testunit'); 56 $content='<h1>test url : cms2 (url6)</h1>'; 57 $content.='<ul><li>rubrique='.$this->param('rubrique').'</li>'; 58 $content.='<li>id_art='.$this->param('id_art').'</li></ul>'; 59 $rep->body->assign('MAIN',$content); 60 return $rep; 61 } 62 function url7() { 63 return $this->getResponse('unittest'); 64 } 65 function url8() { 66 return $this->url1('url8'); 67 } 68 function url9() { 69 return $this->url1('url9'); 70 } 71 function url10() { 72 return $this->url1('url10'); 30 73 } 31 74 } trunk/testapp/modules/unittest/templates/menu.tpl
r289 r320 2 2 Version php : {$versionphp}<br/> 3 3 Version Jelix: {$versionjelix}<br/> 4 5 <p><a href="?">Retour �'accueil</a></p> 4 6 <h3>Core</h3> 5 7 <ul> 6 <li><a href=" ?module=unittest&action=testselectoract">selecteurs d'action</a></li>8 <li><a href="{jurl 'unittest~testselectoract'}">selecteurs d'action</a></li> <!--?module=unittest&action=testselectoract--> 7 9 </ul> 8 10 <h3>jEvent</h3> … … 16 18 <li><a href="?module=unittest&action=testurlparse">Tester l'analyse d'url</a></li> 17 19 </ul> 18 20 {if $isurlsig} 21 <p>test urls : 22 <a href="{jurl 'unittest~urlsig_url1',array('annee'=>'2006','mois'=>'10','id'=>'01')}">url1</a> 23 <a href="{jurl 'unittest~urlsig_url9',array('annee'=>'2006','mois'=>'10','id'=>'09')}">url9</a> 24 <a href="{jurl 'unittest~urlsig_url10',array('annee'=>'2006','mois'=>'10','id'=>'10')}">url10</a> 25 <a href="{jurl 'unittest~urlsig_url3',array('rubrique'=>'voiture','id_art'=>'54','article'=>'dodge viper')}">url3</a> 26 <a href="{jurl 'unittest~urlsig_url2',array('annee'=>'2005','mois'=>'7')}">url2</a> 27 <a href="{jurl 'unittest~urlsig_url4',array('first'=>'premier parametre','second'=>'toto le rigolo')}">url4</a> 28 </p>{/if} 19 29 <h3>jDao</h3> 20 30 <ul> … … 28 38 <li><a href="?module=unittest&action=testfilter">jFilter</a></li> 29 39 </ul> 30 31 32 <p><a href="?">Retour �'accueil</a></p>trunk/testapp/responses/myHtmlResponse.class.php
r127 r320 26 26 $this->body->assignIfNone('MAIN','<p>No content</p>'); 27 27 $this->body->assignIfNone('page_title','Test App'); 28 $this->addCSSLink( 'design/screen.css');28 $this->addCSSLink($GLOBALS['gJConfig']->urlengine['basePath'].'design/screen.css'); 29 29 } 30 30 } trunk/testapp/responses/testUnitResponse.class.php
r273 r320 25 25 $tpl->assign('versionphp',phpversion()); 26 26 $tpl->assign('versionjelix',JELIX_VERSION); 27 $tpl->assign('isurlsig', $GLOBALS['gJConfig']->urlengine['engine'] == 'significant'); 27 28 $this->body->assign('menu',$tpl->fetch('unittest~menu')); 28 29 $this->body->assignIfNone('MAIN','<p></p>'); 29 30 $this->body->assign('page_title', 'Test unitaires sur Jelix'); 30 $this->addCSSLink( 'design/screen.css');31 $this->addCSSLink($GLOBALS['gJConfig']->urlengine['basePath'].'design/screen.css'); 31 32 } 32 33 trunk/testapp/var/config/dbprofils.ini.php.dist
r57 r320 17 17 18 18 19 [testapppdo] 19 20 ; pour pdo : 20 ;driver=pdo21 ;dsn=mysql:host=localhost;dbname=test 22 ;user= 23 ;password=21 driver=pdo 22 dsn= "mysql:host=localhost;dbname=testapp" 23 user=root 24 password=
