Ticket #501: testapp.diff
| File testapp.diff, 5.0 kB (added by sylvain261, 9 months ago) |
|---|
-
build/manifests/testapp.mn
old new 51 51 syndication.classic.php 52 52 samplecrud.classic.php 53 53 default.cmdline.php 54 htmlfragment.classic.php 54 55 cd testapp/modules/testapp/templates 55 56 hello.tpl 56 57 hello2.tpl … … 63 64 forms_edit.tpl 64 65 forms_liste.tpl 65 66 forms_view.tpl 67 htmlfragment.tpl 68 part_htmlfragment.tpl 66 69 cd testapp/modules/testapp/zones 67 70 test.zone.php 68 71 sommaire.zone.php -
testapp/modules/testapp/controllers/htmlfragment.classic.php
old new 1 <?php 2 /** 3 * @package testapp 4 * @subpackage testapp module 5 * @version $Id$ 6 * @author Tahina Ramaroson 7 * @contributor Sylvain de vathaire 8 * @copyright 2008 Tahina Ramaroson, Sylvain de vathaire 9 * @link http://www.jelix.org 10 * @licence GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html 11 */ 12 13 class htmlfragmentCtrl extends jController { 14 /** 15 * display the main html 16 */ 17 function perform() { 18 global $gJConfig; 19 $rep = $this->getResponse('html'); 20 $rep->addJSLink($gJConfig->urlengine['jelixWWWPath'].'jquery/jquery.js'); 21 $rep->addJSCode("j_basepath = '".$gJConfig->urlengine['basePath']."';"); 22 $tpl = new jTpl(); 23 $rep->body->assign('MAIN',$tpl->fetch('testapp~htmlfragment')); 24 return $rep; 25 } 26 /** 27 * function to retrieve a html part 28 */ 29 function ajax() { 30 $rep = $this->getResponse('htmlfragment',true); 31 $rep->tplname='testapp~part_htmlfragment'; 32 $rep->tpl->assign('display','<h4>Résultat</h4>'); 33 return $rep; 34 } 35 } 36 ?> -
testapp/modules/testapp/templates/htmlfragment.tpl
old new 1 <script type="text/javascript"> 2 {literal} 3 $(document).ready(function() { 4 $('input[@type=button]').click(function(){ 5 $.ajax({ 6 type:'POST', 7 url:j_basepath+'index.php', 8 data:'module=testapp&action=htmlfragment:ajax', 9 dataType:'html', 10 async:true, 11 success:function(result){ 12 $('#ajax').html(result); 13 } 14 }); 15 }); 16 }); 17 {/literal} 18 </script> 19 <div> 20 <p>Cliquer le bouton <input type="button" value="Test"></p> 21 </div> 22 <div id="ajax"> 23 </div> -
testapp/modules/testapp/templates/sommaire.tpl
old new 39 39 <li><a href="{jurl 'syndication:rss'}">Rss 2.0</a></li> 40 40 <li><a href="{jurl 'syndication:atom'}">Atom 1.0</a></li> 41 41 </ul> 42 43 <h3>jResponseHtmlFragment</h3> 44 <ul> 45 <li><a href="{jurl 'htmlfragment:perform'}">Sample</a></li> 46 </ul> 47 -
testapp/modules/testapp/templates/part_htmlfragment.tpl
old new 1 <p> 2 {$display} 3 <br> 4 Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Mauris vitae velit. Ut sit amet ligula. Ut suscipit, augue vitae venenatis vestibulum, metus nulla vehicula leo, a tempus arcu orci ut ipsum. 5 Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Mauris vitae velit. Ut sit amet ligula. Ut suscipit, augue vitae venenatis vestibulum, metus nulla vehicula leo, a tempus arcu orci ut ipsum. 6 Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Mauris vitae velit. Ut sit amet ligula. Ut suscipit, augue vitae venenatis vestibulum, metus nulla vehicula leo, a tempus arcu orci ut ipsum. 7 Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Mauris vitae velit. Ut sit amet ligula. Ut suscipit, augue vitae venenatis vestibulum, metus nulla vehicula leo, a tempus arcu orci ut ipsum. 8 Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Mauris vitae velit. Ut sit amet ligula. Ut suscipit, augue vitae venenatis vestibulum, metus nulla vehicula leo, a tempus arcu orci ut ipsum. 9 Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Mauris vitae velit. Ut sit amet ligula. Ut suscipit, augue vitae venenatis vestibulum, metus nulla vehicula leo, a tempus arcu orci ut ipsum. 10 Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Mauris vitae velit. Ut sit amet ligula. Ut suscipit, augue vitae venenatis vestibulum, metus nulla vehicula leo, a tempus arcu orci ut ipsum. 11 </p>
