[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] CVS: etemplate/inc class.boetemplate.inc.php,1.29,1.3
From: |
Ralf Becker <address@hidden> |
Subject: |
[Phpgroupware-cvs] CVS: etemplate/inc class.boetemplate.inc.php,1.29,1.30 class.editor.inc.php,1.26,1.27 class.html.inc.php,1.12,1.13 class.soetemplate.inc.php,1.20,1.21 class.uietemplate.inc.php,1.41,1.42 |
Date: |
Sat, 12 Oct 2002 12:34:45 -0400 |
Update of /cvsroot/phpgroupware/etemplate/inc
In directory subversions:/tmp/cvs-serv29533
Modified Files:
class.boetemplate.inc.php class.editor.inc.php
class.html.inc.php class.soetemplate.inc.php
class.uietemplate.inc.php
Log Message:
Many new stuff for the eTemplates:
- added vbox and hbox support: container to put widgets in one row or column
- complete rows and column can now be disabled (even with a simple comparison
with a variable in content, eg. disabled if the var is empty)
- labels and helptexts from tpls with 'test' in there name, get no longer
written to the lang-file
- update the documentation
Index: class.boetemplate.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/etemplate/inc/class.boetemplate.inc.php,v
retrieving revision 1.29
retrieving revision 1.30
diff -C2 -r1.29 -r1.30
*** class.boetemplate.inc.php 9 Oct 2002 00:31:01 -0000 1.29
--- class.boetemplate.inc.php 12 Oct 2002 16:34:43 -0000 1.30
***************
*** 42,46 ****
// if size > 1 then multiple selections, size lines showed
'html' => 'Html', // Raw html in
$content[$cell['name']]
! 'file' => 'FileUpload' // show an input type='file',
set the local name as ${name}_path
);
/*!
--- 42,48 ----
// if size > 1 then multiple selections, size lines showed
'html' => 'Html', // Raw html in
$content[$cell['name']]
! 'file' => 'FileUpload', // show an input
type='file', set the local name as ${name}_path
! 'vbox' => 'VBox', // a (vertical)
box to contain widgets in rows, size = # of rows
! 'hbox' => 'HBox' // a
(horizontal) box to contain widgets in cols, size = # of cols
);
/*!
***************
*** 112,115 ****
--- 114,118 ----
$col_ = $this->num2chrs($c_-1);
$row_cont = $cont[$row];
+ $col_row_cont = $cont[$col.$row];
eval('$name = "'.$name.'";');
***************
*** 167,171 ****
else
{
! $Ok = $pat[0] == 'r' &&
!(substr($pat,0,2) == 'r_' || substr($pat,0,4) == 'row_');
}
}
--- 170,175 ----
else
{
! $Ok = $pat[0] == 'r' &&
!(substr($pat,0,2) == 'r_' ||
! substr($pat,0,4) == 'row_' &&
substr($pat,0,8) != 'row_cont');
}
}
***************
*** 439,442 ****
--- 443,450 ----
while (list($n,$idx) = each($idxs))
{
+ if (!is_array($pos))
+ {
+ return $pos = '';
+ }
$pos = &$pos[$idx];
}
Index: class.editor.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/etemplate/inc/class.editor.inc.php,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -r1.26 -r1.27
*** class.editor.inc.php 6 Oct 2002 00:21:52 -0000 1.26
--- class.editor.inc.php 12 Oct 2002 16:34:43 -0000 1.27
***************
*** 160,163 ****
--- 160,186 ----
{
$spanned = $cell['span'] ==
'all' ? $this->etemplate->cols-$c : 0+$cell['span'];
+
+ switch($cell['type']) // load
a cell-type-specific tpl
+ {
+ case 'vbox':
+ case 'hbox':
+
$cell['cell_tpl'] = '.vbox';
+ if
($cell['size'] < 2)
+ {
+
$cell['size'] = 2;
+ }
+ for ($n = 1; $n
<= $cell['size']; ++$n) // create new rows
+ {
+ if
(!isset($cell[$n]) || !is_array($cell[$n]))
+ {
+
$cell[$n] = $this->etemplate->empty_cell();
+ }
+ }
+ while
(isset($cell[$n])) // unset not longer used rows
+ {
+
unset($cell[$n++]);
+ }
+ break;
+ }
$content[$col.$row] = $cell;
}
Index: class.html.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/etemplate/inc/class.html.inc.php,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -r1.12 -r1.13
*** class.html.inc.php 9 Oct 2002 00:31:01 -0000 1.12
--- class.html.inc.php 12 Oct 2002 16:34:43 -0000 1.13
***************
*** 114,119 ****
if ($image != '')
{
if (!($path =
$GLOBALS['phpgw']->common->image($app,$image)))
! $path = $image; // name may already
contain absolut path
$image = ' SRC="'.$path.'"';
}
--- 114,125 ----
if ($image != '')
{
+ if (strstr($image,'.') === False)
+ {
+ $image .= '.gif';
+ }
if (!($path =
$GLOBALS['phpgw']->common->image($app,$image)))
! {
! $path = $image; // name may already
contain absolut path
! }
$image = ' SRC="'.$path.'"';
}
***************
*** 210,229 ****
@result string with html-code of the table
*/
! function table($rows,$options = '')
{
! $html = "<TABLE $options>\n";
while (list($key,$row) = each($rows)) {
if (!is_array($row))
continue;
// parameter
! $html .= "\t<TR ".$rows['.'.$key].">\n";
while (list($key,$cell) = each($row)) {
if ($key[0] == '.')
continue;
// parameter
! $html .= "\t\t<TD
".$row['.'.$key].">$cell</TD>\n";
}
$html .= "\t</TR>\n";
}
$html .= "</TABLE>\n";
return $html;
--- 216,242 ----
@result string with html-code of the table
*/
! function table($rows,$options = '',$no_table_tr=False)
{
! $html = $no_table_tr ? '' : "<TABLE $options>\n";
while (list($key,$row) = each($rows)) {
if (!is_array($row))
continue;
// parameter
! $html .= $no_table_tr && $key == 1 ? '' : "\t<TR
".$rows['.'.$key].">\n";
while (list($key,$cell) = each($row)) {
if ($key[0] == '.')
continue;
// parameter
! $table_pos = strpos($cell,'<TABLE');
! $td_pos = strpos($cell,'<TD');
! if ($td_pos !== False && ($table_pos === False
|| $td_pos < $table_pos))
! $html .= $cell;
! else
! $html .= "\t\t<TD
".$row['.'.$key].">$cell</TD>\n";
}
$html .= "\t</TR>\n";
}
$html .= "</TABLE>\n";
+ if ($no_table_tr)
+ $html = substr($html,0,-16);
return $html;
***************
*** 243,249 ****
function image( $app,$name,$title='',$options='' )
{
if (!($path = $GLOBALS['phpgw']->common->image($app,$name)))
$path = $name; // name may already contain
absolut path
!
if ($title)
{
--- 256,267 ----
function image( $app,$name,$title='',$options='' )
{
+ if (strstr($name,'.') === False)
+ {
+ $name .= '.gif';
+ }
if (!($path = $GLOBALS['phpgw']->common->image($app,$name)))
+ {
$path = $name; // name may already contain
absolut path
! }
if ($title)
{
Index: class.soetemplate.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/etemplate/inc/class.soetemplate.inc.php,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -r1.20 -r1.21
*** class.soetemplate.inc.php 3 Oct 2002 19:53:47 -0000 1.20
--- class.soetemplate.inc.php 12 Oct 2002 16:34:43 -0000 1.21
***************
*** 614,617 ****
--- 614,633 ----
}
+ function getToTranslateCell($cell,&$to_trans)
+ {
+ list($extra_row) = explode(',',$cell['size']);
+ if (substr($cell['type'],0,6) != 'select' ||
!empty($extra_row) && $extra_row > 0)
+ $extra_row = '';
+ $all = explode('|',$cell['help'].($cell['type'] !=
'image'?'|'.$cell['label']:'').
+ (!empty($extra_row) ? '|'.$extra_row : ''));
+ while (list(,$str) = each($all))
+ {
+ if (strlen($str) > 1 && $str[0] != '@')
+ {
+ $to_trans[strtolower($str)] = $str;
+ }
+ }
+ }
+
/*!
@function getToTranslate
***************
*** 624,627 ****
--- 640,647 ----
$to_trans = array();
+ if (stristr($this->name,'test')) // dont write
all test-tpls
+ {
+ return $to_trans;
+ }
reset($this->data); each($this->data); // skip width
while (list($row,$cols) = each($this->data))
***************
*** 629,642 ****
while (list($col,$cell) = each($cols))
{
! list($extra_row) =
explode(',',$cell['size']);
! if (substr($cell['type'],0,6) !=
'select' || !empty($extra_row) && $extra_row > 0)
! $extra_row = '';
! $all =
explode('|',$cell['help'].($cell['type'] != 'image'?'|'.$cell['label']:'').
! (!empty($extra_row) ?
'|'.$extra_row : ''));
! while (list(,$str) = each($all))
{
! if (strlen($str) > 1 && $str[0]
!= '@')
{
!
$to_trans[strtolower($str)] = $str;
}
}
--- 649,659 ----
while (list($col,$cell) = each($cols))
{
!
$this->getToTranslateCell($cell,$to_trans);
!
! if ($cell['type'] == 'vbox' ||
$cell['type'] == 'hbox')
{
! for ($n = 1; $n <=
$cell['size']; ++$n)
{
!
$this->getToTranslateCell($cell[$n],$to_trans);
}
}
***************
*** 702,705 ****
--- 719,724 ----
}
}
+ unset($to_trans['']);
+
for ($new = $n = 0; list($message_id,$content) =
each($to_trans); ++$n) {
if (!isset($langarr[$content]) &&
!isset($langarr[$message_id]))
Index: class.uietemplate.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/etemplate/inc/class.uietemplate.inc.php,v
retrieving revision 1.41
retrieving revision 1.42
diff -C2 -r1.41 -r1.42
*** class.uietemplate.inc.php 10 Oct 2002 11:28:39 -0000 1.41
--- class.uietemplate.inc.php 12 Oct 2002 16:34:43 -0000 1.42
***************
*** 226,230 ****
@result the generated HTML
*/
! function
show($content,$sel_options='',$readonlys='',$cname='',$show_c=0,$show_row=0)
{
if (!$sel_options)
--- 226,231 ----
@result the generated HTML
*/
! function
show($content,$sel_options='',$readonlys='',$cname='',$show_c=0,$show_row=0,
! $no_table_tr=False,$tr_class='')
{
if (!$sel_options)
***************
*** 273,277 ****
$cols = &$this->data[$r_key];
list($height,$disabled) =
explode(',',$opts["h$row"]);
! $class = $opts["c$row"];
}
if ($disabled != '' &&
$this->check_disabled($disabled,$content))
--- 274,278 ----
$cols = &$this->data[$r_key];
list($height,$disabled) =
explode(',',$opts["h$row"]);
! $class = $no_table_tr ? $tr_class :
$opts["c$row"];
}
if ($disabled != '' &&
$this->check_disabled($disabled,$content))
***************
*** 279,282 ****
--- 280,293 ----
continue; // row is disabled
}
+ $rows[".$row"] .=
$this->html->formatOptions($height,'HEIGHT');
+ list($cl) = explode(',',$class);
+ if ($cl == 'nmr' || $cl == 'row')
+ {
+ $cl = 'row_'.($nmr_alternate++ & 1 ?
'off' : 'on'); // alternate color
+ }
+ $cl = isset($this->class_conf[$cl]) ?
$this->class_conf[$cl] : $cl;
+ $rows[".$row"] .=
$this->html->formatOptions($cl,'CLASS');
+ $rows[".$row"] .=
$this->html->formatOptions($class,',VALIGN');
+
reset ($cols);
$row_data = array();
***************
*** 297,300 ****
--- 308,315 ----
list(,$col_disabled) =
explode(',',$opts[$col]);
}
+ if ($cell['type'] == 'template' &&
$cell['onchange'])
+ {
+ $cell['tr_class'] = $cl;
+ }
if ($col_disabled != '' &&
$this->check_disabled($col_disabled,$content))
{
***************
*** 328,341 ****
}
$rows[$row] = $row_data;
-
- $rows[".$row"] .=
$this->html->formatOptions($height,'HEIGHT');
- list($cl) = explode(',',$class);
- if ($cl == 'nmr' || $cl == 'row')
- {
- $cl = 'row_'.($nmr_alternate++ & 1 ?
'off' : 'on'); // alternate color
- }
- $cl = isset($this->class_conf[$cl]) ?
$this->class_conf[$cl] : $cl;
- $rows[".$row"] .=
$this->html->formatOptions($cl,'CLASS');
- $rows[".$row"] .=
$this->html->formatOptions($class,',VALIGN');
}
if
(!$GLOBALS['phpgw_info']['etemplate']['styles_included'][$this->name])
--- 343,346 ----
***************
*** 344,348 ****
$GLOBALS['phpgw_info']['etemplate']['styles_included'][$this->name] = True;
}
! $html =
$this->html->table($rows,$this->html->formatOptions($this->size,'WIDTH,HEIGHT,BORDER,CLASS,CELLSPACING,CELLPADDING'));
/* does NOT work with mozilla: shows nothing if a div
is inside a form
--- 349,353 ----
$GLOBALS['phpgw_info']['etemplate']['styles_included'][$this->name] = True;
}
! $html =
$this->html->table($rows,$this->html->formatOptions($this->size,'WIDTH,HEIGHT,BORDER,CLASS,CELLSPACING,CELLPADDING'),$no_table_tr);
/* does NOT work with mozilla: shows nothing if a div
is inside a form
***************
*** 411,415 ****
$this->set_array($content,$name,$value);
}
! $label = $cell['label'];
if ($label[0] == '@')
{
--- 416,420 ----
$this->set_array($content,$name,$value);
}
! $label =
$this->expand_name($cell['label'],$show_c,$show_row,$content['.c'],$content['.row'],$content);
if ($label[0] == '@')
{
***************
*** 573,577 ****
else
{ $obj_read = 'obj read';
! $cell['obj'] = new
etemplate($cell['name'],$this->as_array());
}
}
--- 578,582 ----
else
{ $obj_read = 'obj read';
! $cell['obj'] = new
etemplate(/*** TESTWEISE ***$cell['name']*/$name,$this->as_array());
}
}
***************
*** 602,606 ****
$readonlys['__ALL__'] = True;
}
! $html .=
$cell['obj']->show($content,$sel_options,$readonlys,$cname,$show_c,$show_row);
break;
case 'select': // size:[linesOnMultiselect]
--- 607,611 ----
$readonlys['__ALL__'] = True;
}
! $html =
$cell['obj']->show($content,$sel_options,$readonlys,$cname,$show_c,$show_row,$cell['onchange'],$cell['tr_class']);
break;
case 'select': // size:[linesOnMultiselect]
***************
*** 656,662 ****
break;
case 'image':
$image =
$this->html->image(substr($this->name,0,strpos($this->name,'.')),
! $label,lang($help),'BORDER=0');
! $html .= $name == '' ? $image :
$this->html->a_href($image,$name);
$extra_label = False;
break;
--- 661,668 ----
break;
case 'image':
+ $image = $value != '' ? $value : $name;
$image =
$this->html->image(substr($this->name,0,strpos($this->name,'.')),
! $image,strlen($label) > 1 &&
!$cell['no_lang'] ? lang($label) : $label,'BORDER="0"');
! $html .= $cell['size'] == '' ? $image :
$this->html->a_href($image,$cell['size']);
$extra_label = False;
break;
***************
*** 668,671 ****
--- 674,709 ----
$GLOBALS['phpgw_info']['etemplate']['to_process'][$form_name] = $cell['type'];
$GLOBALS['phpgw_info']['etemplate']['to_process'][$path] = 'file-path';
+ break;
+ case 'vbox':
+ case 'hbox':
+ $rows = array();
+ $box_row = 1;
+ $box_col = 'A';
+ $box_anz = 0;
+ for ($n = 1; $n <= $cell['size']; ++$n)
+ {
+ $h =
$this->show_cell($cell[$n],$content,$sel_options,$readonlys,$cname,$show_c,$show_row,$nul);
+ if ($h != '' && $h != ' ')
+ {
+ if ($cell['type'] ==
'vbox')
+ {
+ $box_row = $n;
+ }
+ else
+ {
+ $box_col =
$this->num2chrs($n);
+ }
+
$rows[$box_row][$box_col] = $html = $h;
+ $box_anz++;
+ if ($cell[$n]['align'])
+ {
+
$rows[$box_row]['.'.$box_col] =
$this->html->formatOptions($cell[$n]['align'],'ALIGN');
+ }
+ }
+ }
+ if ($box_anz > 1) // a single
cell is NOT placed into a table
+ {
+ $html = "\n\n<!-- BEGIN
$cell[type] -->\n\n".$this->html->table($rows)."\n\n<!-- END $cell[type]
-->\n\n";
+ }
break;
default:
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] CVS: etemplate/inc class.boetemplate.inc.php,1.29,1.30 class.editor.inc.php,1.26,1.27 class.html.inc.php,1.12,1.13 class.soetemplate.inc.php,1.20,1.21 class.uietemplate.inc.php,1.41,1.42,
Ralf Becker <address@hidden> <=
- Prev by Date:
[Phpgroupware-cvs] CVS: etemplate/setup etemplates.inc.php,1.24,1.25 phpgw_en.lang,1.17,1.18
- Next by Date:
[Phpgroupware-cvs] CVS: etemplate/inc class.xul_io.inc.php,1.19,1.20
- Previous by thread:
[Phpgroupware-cvs] CVS: etemplate/setup etemplates.inc.php,1.24,1.25 phpgw_en.lang,1.17,1.18
- Next by thread:
[Phpgroupware-cvs] CVS: etemplate/inc class.xul_io.inc.php,1.19,1.20
- Index(es):