[ Index ] |
|
Code source de eGroupWare 1.2.106-2 |
1 <?php 2 /**************************************************************************\ 3 * eGroupWare - eTemplate Extension - XSLT Widget * 4 * http://www.egroupware.org * 5 * Written by Ralf Becker <RalfBecker@outdoor-training.de> * 6 * -------------------------------------------- * 7 * This program is free software; you can redistribute it and/or modify it * 8 * under the terms of the GNU General Public License as published by the * 9 * Free Software Foundation; either version 2 of the License, or (at your * 10 * option) any later version. * 11 \**************************************************************************/ 12 13 /* $Id: class.xslt_widget.inc.php 19711 2005-11-09 20:50:45Z ralfbecker $ */ 14 15 /** 16 * @author ralfbecker 17 * widget that generates its html-output via a xslt file with its in $options and the content as xml 18 * 19 * The following data is placed in the xml: value,name,label(translated),statustext(translated),readonly 20 * and all widget-attributes as descript in the referenz, using there xml-names. 21 * This widget is generating html, so it does not work (without an extra implementation) in an other UI 22 */ 23 class xslt_widget 24 { 25 var $public_functions = array( 26 'pre_process' => True, 27 'render' => True, 28 'post_process' => True 29 ); 30 var $human_name = 'XSLT Template'; // this is the name for the editor 31 32 function xslt_widget($ui='') 33 { 34 $this->xslttemplates =& CreateObject('phpgwapi.xslttemplates',EGW_INCLUDE_ROOT); 35 36 switch($ui) 37 { 38 case '': 39 case 'html': 40 $this->ui = 'html'; 41 break; 42 default: 43 echo "UI='$ui' not implemented"; 44 } 45 return 0; 46 } 47 48 function pre_process($name,&$value,&$cell,&$readonlys,&$extension_data,&$tmpl) 49 { 50 return False; // no extra label 51 } 52 53 function render(&$cell,$form_name,&$value,$readonly,&$extension_data,&$tmpl) 54 { 55 //echo "<p>xslt_widget::render: name='$cell[name]', name='$form_name', value='$value'</p>"; 56 $func = 'render_'.$this->ui; 57 58 if (!method_exists($this,$func)) 59 return False; 60 61 return $this->$func($cell,$form_name,$value,$readonly,$tmpl); 62 } 63 64 function render_html($cell,$form_name,$value,$readonly,&$tmpl) 65 { 66 list($app,$file) = split('\\.',$cell['size'],2); 67 $pref_templ = $GLOBALS['egw_info']['server']['template_set']; 68 $path = "$app/templates/$pref_templ/$file"; 69 if (!file_exists(EGW_SERVER_ROOT.'/'.$path.'.xsl')) 70 { 71 $path = "$app/templates/default/$file"; 72 } 73 $this->xslttemplates->add_file($path); 74 75 $this->xslttemplates->set_var('value',$value); 76 $this->xslttemplates->set_var('name',$form_name); 77 $this->xslttemplates->set_var('readonly',$readonly); 78 $this->xslttemplates->set_var('label',$cell['no_lang'] ? $cell['label'] : lang($cell['label'])); 79 $this->xslttemplates->set_var('statustext',lang($cell['help'])); 80 list($span,$class) = explode(',',$cell['span']); 81 list($src,$options) = explode(',',$cell['size']); 82 $this->xslttemplates->set_var('attr',array( 83 'id' => $cell['name'], 84 'label' => $cell['label'], 85 'statustext' => $cell['help'], 86 'no_lang' => $cell['no_lang'], 87 'needed' => $cell['needed'], 88 'readonly' => $cell['readonly'], 89 'onchange' => $cell['onchange'], 90 'span' => $span, 91 'class' => $class, 92 'src' => $src, 93 'options' => $options, 94 'align' => $cell['align'] 95 )); 96 return $this->xslttemplates->parse(); 97 } 98 99 function post_process($name,&$value,&$extension_data,&$loop,&$tmpl,$value_in) 100 { 101 //echo "<p>xslt_widget.post_process: $name = "; _debug_array($value_in); 102 103 $value = $value_in; 104 } 105 }
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 17:20:01 2007 | par Balluche grâce à PHPXref 0.7 |