Changeset 127
- Timestamp:
- 04/04/06 00:13:48 (3 years ago)
- Files:
-
- trunk/build/manifests/testapp.mn (modified) (4 diffs)
- trunk/lib/jelix/core/jController.class.php (modified) (1 diff)
- trunk/lib/jelix/core/jRequest.class.php (modified) (2 diffs)
- trunk/testapp/modules/testapp/controllers/forms.classic.php (modified) (2 diffs)
- trunk/testapp/modules/testapp/controllers/main.classic.php (modified) (3 diffs)
- trunk/testapp/modules/testapp/templates/hello2.tpl (added)
- trunk/testapp/modules/testapp/templates/main.tpl (modified) (1 diff)
- trunk/testapp/modules/testapp/templates/sampleformresult.tpl (modified) (1 diff)
- trunk/testapp/modules/testapp/templates/sommaire.tpl (modified) (1 diff)
- trunk/testapp/modules/unittest/templates/accueil.tpl (deleted)
- trunk/testapp/modules/unittest/templates/menu.tpl (added)
- trunk/testapp/responses/myHtmlResponse.class.php (modified) (1 diff)
- trunk/testapp/responses/testUnitResponse.class.php (modified) (1 diff)
- trunk/testapp/var/themes/default/testapp/hello2.tpl (moved) (moved from trunk/testapp/var/themes/default/testapp/main.tpl) (1 diff)
- trunk/testapp/www/design (added)
- trunk/testapp/www/design/screen.css (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/build/manifests/testapp.mn
r126 r127 14 14 xmlrpc.php 15 15 index.php 16 cd testapp/www/design 17 screen.css 16 18 cd testapp/www/jelix 17 19 json.js … … 36 38 cd testapp/modules/testapp/templates 37 39 hello.tpl 40 hello2.tpl 38 41 main.tpl 39 42 error.tpl … … 63 66 testunit.ISO-8859-1.properties 64 67 cd testapp/modules/unittest/templates 65 accueil.tpl68 menu.tpl 66 69 cd testapp/modules/unittest/controllers 67 70 default.classic.php … … 75 78 urls.xml 76 79 cd testapp/var/themes/default/testapp 77 main.tpl80 hello2.tpl 78 81 cd testapp/var/overloads/testapp/daos 79 82 cd testapp/var/overloads/testapp/locales trunk/lib/jelix/core/jController.class.php
r125 r127 48 48 } 49 49 50 protected function getResponse($name ){51 return $this->request->getResponse($name );50 protected function getResponse($name, $useOriginal=false){ 51 return $this->request->getResponse($name, $useOriginal); 52 52 } 53 53 trunk/lib/jelix/core/jRequest.class.php
r121 r127 42 42 $this->_initParams(); 43 43 } 44 45 44 45 46 46 abstract protected function _initParams(); 47 47 … … 101 101 } 102 102 103 public function getResponse($type='' ){104 global $gJCoord, $gJConfig ;103 public function getResponse($type='', $useOriginal = false){ 104 global $gJCoord, $gJConfig, $gDefaultConfig; 105 105 if($type == ''){ 106 106 $type = $this->defaultResponseType; 107 107 } 108 108 109 if(!isset($gJConfig->responses[$type])){ 110 trigger_error(jLocale::get('jelix~errors.ad.response.type.unknow',array($gJCoord->action->resource,$type,$gJCoord->action->getPath())),E_USER_ERROR); 111 return null; 109 if($useOriginal){ 110 if(!isset($gDefaultConfig->responses[$type])){ 111 trigger_error(jLocale::get('jelix~errors.ad.response.type.unknow',array($gJCoord->action->resource,$type,$gJCoord->action->getPath())),E_USER_ERROR); 112 return null; 113 } 114 $respclass = $gDefaultConfig->responses[$type]; 115 }else{ 116 if(!isset($gJConfig->responses[$type])){ 117 trigger_error(jLocale::get('jelix~errors.ad.response.type.unknow',array($gJCoord->action->resource,$type,$gJCoord->action->getPath())),E_USER_ERROR); 118 return null; 119 } 120 $respclass = $gJConfig->responses[$type]; 112 121 } 113 $respclass = $gJConfig->responses[$type];114 122 if(file_exists($path=JELIX_LIB_RESPONSE_PATH.$respclass.'.class.php')){ 115 123 require_once ($path); trunk/testapp/modules/testapp/controllers/forms.classic.php
r126 r127 50 50 $tpl->assign('form', $form->getContainer()); 51 51 $rep->body->assign('MAIN',$tpl->fetch('sampleform')); 52 $rep->body->assign('page_title','formulaires'); 52 53 53 54 return $rep; … … 74 75 $tpl->assign('prenom', $datas['prenom']); 75 76 76 77 77 $rep->body->assign('page_title','formulaires'); 78 78 $rep->body->assign('MAIN',$tpl->fetch('sampleformresult')); 79 79 return $rep; trunk/testapp/modules/testapp/controllers/main.classic.php
r126 r127 17 17 $rep = $this->getResponse('html'); 18 18 $rep->title = 'Accueil de TestApp'; 19 $rep->body->assignZone('MAIN','sommaire'); 19 $rep->body->assign('page_title','Test App'); 20 $rep->body->assign('MAIN','<p>Bienvenue sur cette application de test</p>'); 20 21 return $rep; 21 22 } … … 24 25 25 26 if($this->param('output') == 'text'){ 26 $rep = $this->getResponse('text' );27 $rep = $this->getResponse('text', true); 27 28 $rep->content = 'Hello World !'; 28 29 }else{ 29 30 $rep = $this->getResponse('html'); 30 $rep = $this->getResponse('html',true); 31 31 $rep->title = 'Hello From Jelix !'; 32 32 $rep->bodyTpl = 'testapp~hello'; … … 38 38 } 39 39 40 function hello2(){ 41 42 $rep = $this->getResponse('html',true); 43 $rep->title = 'Hello 2 From Jelix !'; 44 $rep->bodyTpl = 'testapp~hello2'; 45 46 return $rep; 47 } 40 48 41 49 function testdao(){ trunk/testapp/modules/testapp/templates/main.tpl
r60 r127 1 <h1>Hello {$person|upper} !</h1> 2 <p>Ceci est une page HTML g�r�par {@jelix~jelix.framework.name@}</p> 1 <div id="header"> 2 {$page_title} 3 </div> 4 5 <div id="main"> 3 6 {$MAIN} 7 </div> 8 9 <div id="sidemenu"> 10 {$menu} 11 </div> 12 13 <div id="footer"> 14 page HTML g�r�par {@jelix~jelix.framework.name@} 15 </div> trunk/testapp/modules/testapp/templates/sampleformresult.tpl
r126 r127 7 7 <dd>{$prenom}</dd> 8 8 </dl> 9 <a href="{jurl ''}"></a> trunk/testapp/modules/testapp/templates/sommaire.tpl
r126 r127 4 4 <li><a href="{jurl 'main_hello'}">Hello world en html</a></li> 5 5 <li><a href="{jurl 'main_hello', array('output'=>'text')}">Hello world en texte</a></li> 6 <li><a href="{jurl 'main_hello2'}">Template Hello world surcharg�a></li> 6 7 <li><a href="{jurl 'unittest~default_index'}">Tests unitaires</a></li> 7 8 </ul> trunk/testapp/responses/myHtmlResponse.class.php
r126 r127 18 18 19 19 public $bodyTpl = 'testapp~main'; 20 public $bodyErrorTpl = 'testapp~error';21 20 22 21 // modifications communes aux actions utilisant cette reponses 23 22 protected function _commonProcess(){ 24 $this->title .= ($this->title !=''?' - ':'').' My Test App !';23 $this->title .= ($this->title !=''?' - ':'').' Test App'; 25 24 26 $this->body->assign IfNone('person','you');25 $this->body->assignZone('menu','testapp~sommaire'); 27 26 $this->body->assignIfNone('MAIN','<p>No content</p>'); 27 $this->body->assignIfNone('page_title','Test App'); 28 $this->addCSSLink('design/screen.css'); 28 29 } 29 30 } trunk/testapp/responses/testUnitResponse.class.php
r67 r127 17 17 18 18 19 public $bodyTpl = ' unittest~accueil';19 public $bodyTpl = 'testapp~main'; 20 20 21 21 protected function _commonProcess(){ 22 22 $this->title .= ($this->title !=''?' - ':'').' Test unitaires'; 23 $this->addCSSLink('/unittest.css'); 24 } 23 24 $tpl = new jTpl(); 25 $this->body->assign('menu',$tpl->fetch('unittest~menu')); 26 $this->body->assignIfNone('MAIN','<p></p>'); 27 $this->body->assign('page_title', 'Test unitaires sur Jelix'); 28 $this->addCSSLink('design/screen.css'); 29 } 30 25 31 26 32 trunk/testapp/var/themes/default/testapp/hello2.tpl
r60 r127 1 <h1>Hello {$person|upper} !</h1>1 <h1>Hello world</h1> 2 2 <p>Ceci est un template surcharg�/p> 3 3 <p>Il s'agit d'un template situ�ans var/themes/testapp/, et qui 4 redefinit le template main.tpl du module testapp.</p>4 redefinit le template hello2.tpl du module testapp.</p> 5 5 6 {$MAIN} 6 7 <p><a href="{jurl 'main_index'}">Retour au sommaire</a></p>
