[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.35.2.
From: |
Ralf Becker <address@hidden> |
Subject: |
[Phpgroupware-cvs] CVS: etemplate/inc class.boetemplate.inc.php, 1.35.2.1, 1.35.2.2 class.soetemplate.inc.php, 1.28.2.1, 1.28.2.2 class.uietemplate.inc.php, 1.62.2.3, 1.62.2.4 |
Date: |
Sun, 24 Aug 2003 18:11:15 -0400 |
Update of /cvsroot/phpgroupware/etemplate/inc
In directory subversions:/tmp/cvs-serv29548/inc
Modified Files:
Tag: Version-0_9_16-branch
class.boetemplate.inc.php class.soetemplate.inc.php
class.uietemplate.inc.php
Log Message:
some small improvments:
- soetemplate: new_cell function to create new cells and rows
- boetempalte: set_{column|row]_attribute
- uietemplate: extracted java_script to separate file js/etemplate.js and added
no_lang==2 to not translate a lable or helpmessage
Index: class.boetemplate.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/etemplate/inc/class.boetemplate.inc.php,v
retrieving revision 1.35.2.1
retrieving revision 1.35.2.2
diff -C2 -r1.35.2.1 -r1.35.2.2
*** class.boetemplate.inc.php 20 Aug 2003 00:35:24 -0000 1.35.2.1
--- class.boetemplate.inc.php 24 Aug 2003 22:11:12 -0000 1.35.2.2
***************
*** 57,60 ****
--- 57,64 ----
{
$this->public_functions += array(
+ 'set_row_attribute' => True,
+ 'disable_row' => True,
+ 'set_column_attribute' => True,
+ 'disable_column' => True,
'disable_cells' => True,
'set_cell_attribute' => True,
***************
*** 366,374 ****
//echo "<p>set_cell_attribute(tpl->name=$this->name,
name='$name', attr='$attr',val='$val')</p>\n";
- reset($this->data);
$n = 0;
! while(list($row,$cols) = each($this->data))
{
! while(list($col,$cell) = each($cols))
{
if ($cell['name'] == $name)
--- 370,377 ----
//echo "<p>set_cell_attribute(tpl->name=$this->name,
name='$name', attr='$attr',val='$val')</p>\n";
$n = 0;
! foreach($this->data as $row => $cols)
{
! foreach($cols as $col => $cell)
{
if ($cell['name'] == $name)
***************
*** 387,391 ****
}
}
- reset($this->data);
return $n;
--- 390,393 ----
***************
*** 404,418 ****
/*!
@function disable_row
@syntax disable_row( $n,$enable=False )
@author ralfbecker
@abstract disables row $n
! @param $n is numerical row-number starting with 1 (!)
@param $enable can be used to re-enable a row if set to True
*/
function disable_row($n,$enable=False)
{
! list($height) = explode(',',$this->data[0]["h$n"]);
! $this->data[0]["h$n"] = $height.($enable?'':',1');
}
--- 406,465 ----
/*!
+ @function set_row_attributes
+ @syntax set_row_attibutes(
$n,$height=0,$class=0,$valign=0,$disabled=0 )
+ @author ralfbecker
+ @abstract set one or more attibutes for row $n
+ @param $n is numerical row-number starting with 1 (!)
+ @param $height in percent or pixel or '' for no height
+ @param $class name of css class (without the leading '.') or ''
for no class
+ @param $valign alignment (top,middle,bottom) or '' for none
+ @param $disabled True or expression or False to disable or
enable the row
+ @param Only the number 0 means dont change the attribute !!!
+ */
+ function
set_row_attributes($n,$height=0,$class=0,$valign=0,$disabled=0)
+ {
+ list($old_height,$old_disabled) =
explode(',',$this->data[0]["h$n"]);
+ $disabled = $disabled !== 0 ? $disabled : $old_disabled;
+ $this->data[0]["h$n"] = ($height !== 0 ? $height :
$old_height).
+ ($disabled ? ','.$disabled : '');
+ list($old_class,$old_valign) =
explode(',',$this->data[0]["c$n"]);
+ $valign = $valign !== 0 ? $valign : $old_valign;
+ $this->data[0]["c$n"] = ($class !== 0 ? $class :
$old_class).
+ ($valign ? ','.$valign : '');
+ }
+
+ /*!
@function disable_row
@syntax disable_row( $n,$enable=False )
@author ralfbecker
@abstract disables row $n
! @param $n is numerical row-number starting with 1 (!)
@param $enable can be used to re-enable a row if set to True
*/
function disable_row($n,$enable=False)
{
! $this->set_row_attributes($n,0,0,0,!$enable);
! }
!
! /*!
! @function set_column_attributes
! @syntax set_column_attibutes( $n,$width=0,$disabled=0 )
! @author ralfbecker
! @abstract set one or more attibutes for column $c
! @param $c is numerical column-number starting with 0 (!), or
the char-code starting with 'A'
! @param $width in percent or pixel or '' for no height
! @param $disabled True or expression or False to disable or
enable the column
! @param Only the number 0 means dont change the attribute !!!
! */
! function set_column_attributes($c,$width=0,$disabled=0)
! {
! if (is_numeric($c))
! {
! $c = $this->num2chrs($c);
! }
! list($old_width,$old_disabled) =
explode(',',$this->data[0][$c]);
! $disabled = $disabled !== 0 ? $disabled : $old_disabled;
! $this->data[0][$c] = ($width !== 0 ? $width :
$old_width).
! ($disabled ? ','.$disabled : '');
}
***************
*** 422,436 ****
@author ralfbecker
@abstract disables column $c
! @param $c is numerical column-number starting with 1 (!), or
the char-code starting with 'A'
@param $enable can be used to re-enable a column if set to True
*/
function disable_column($c,$enable=False)
{
! if (is_numeric($c))
! {
! $c = $this->num2chars($c);
! }
! list($height) = explode(',',$this->data[0][$c]);
! $this->data[0][$c] = $height.($enable?'':',1');
}
--- 469,478 ----
@author ralfbecker
@abstract disables column $c
! @param $c is numerical column-number starting with 0 (!), or
the char-code starting with 'A'
@param $enable can be used to re-enable a column if set to True
*/
function disable_column($c,$enable=False)
{
! $this->set_column_attributes($c,0,!$enable);
}
Index: class.soetemplate.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/etemplate/inc/class.soetemplate.inc.php,v
retrieving revision 1.28.2.1
retrieving revision 1.28.2.2
diff -C2 -r1.28.2.1 -r1.28.2.2
*** class.soetemplate.inc.php 20 Aug 2003 00:35:24 -0000 1.28.2.1
--- class.soetemplate.inc.php 24 Aug 2003 22:11:13 -0000 1.28.2.2
***************
*** 35,38 ****
--- 35,40 ----
var $public_functions = array(
'init' => True,
+ 'empty_cell' => True,
+ 'new_cell' => True,
'read' => True,
'search' => True,
***************
*** 114,120 ****
@result the cell
*/
! function empty_cell()
{
! return array('type' => 'label', 'name' => '');
}
--- 116,171 ----
@result the cell
*/
! function empty_cell($type='label',$name='')
{
! return array(
! 'type' => $type,
! 'name' => $name,
! );
! }
!
! /*!
! @function new_cell
! @abstract constructs a new cell in a give row or the last row,
not existing rows will be created
! @syntax new_cell( $row=False )
! @param int $row row-number starting with 1 (!)
! @param string $type type of the cell
! @param string $label label for the cell
! @param string $name name of the cell (index in the
content-array)
! @param array $attributes other attributes for the cell
! @returns a reference to the new cell, use $new_cell =
&$tpl->new_cell(); (!)
! */
! function
&new_cell($row=False,$type='label',$label='',$name='',$attributes=False)
! {
! $row = $row >= 0 ? intval($row) : 0;
! if ($row && !isset($this->data[$row]) ||
!isset($this->data[1])) // new row ?
! {
! if (!$row) $row = 1;
!
! $this->data[$row] = array();
! }
! if (!$row) // use last row
! {
! $row = count($this->data);
! while (!isset($this->data[$row]))
! {
! --$row;
! }
! }
! $row = &$this->data[$row];
! $col = $this->num2chrs(count($row));
! $cell = &$row[$col];
! $cell = $this->empty_cell($type,$name);
! if ($label !== '')
! {
! $attributes['label'] = $label;
! }
! if (is_array($attributes))
! {
! foreach($attributes as $name => $value)
! {
! $cell[$name] = $value;
! }
! }
! return $cell;
}
***************
*** 161,165 ****
}
$this->size = $this->style = '';
! $this->data = array();
$this->rows = $rows < 0 ? 1 : $rows;
$this->cols = $cols < 0 ? 1 : $cols;
--- 212,216 ----
}
$this->size = $this->style = '';
! $this->data = array(0 => array());
$this->rows = $rows < 0 ? 1 : $rows;
$this->cols = $cols < 0 ? 1 : $cols;
***************
*** 642,655 ****
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;
}
}
--- 693,716 ----
function getToTranslateCell($cell,&$to_trans)
{
+ $strings = explode('|',$cell['help']);
+
+ if ($cell['type'] != 'image')
+ {
+ $strings += explode('|',$cell['label']);
+ }
list($extra_row) = explode(',',$cell['size']);
! if (substr($cell['type'],0,6) == 'select' &&
!empty($extra_row) && !intval($extra_row))
! {
! $strings[] = $extra_row;
! }
! if (!empty($cell['blur']))
! {
! $strings[] = $cell['blur'];
! }
! foreach($strings as $str)
{
if (strlen($str) > 1 && $str[0] != '@')
{
! $to_trans[trim(strtolower($str))] =
$str;
}
}
***************
*** 670,674 ****
while (list($row,$cols) = each($this->data))
{
! while (list($col,$cell) = each($cols))
{
$this->getToTranslateCell($cell,$to_trans);
--- 731,735 ----
while (list($row,$cols) = each($this->data))
{
! foreach($cols as $col => $cell)
{
$this->getToTranslateCell($cell,$to_trans);
***************
*** 746,763 ****
$langarr = array();
}
$to_trans = $this->getToTranslateApp($app);
if (is_array($additional))
{
//echo "writeLangFile: additional =";
_debug_array($additional);
! reset($additional);
! while (list($nul,$msg) = each($additional))
{
! $to_trans[strtolower($msg)] = $msg;
}
}
unset($to_trans['']);
! for ($new = $n = 0; list($message_id,$content) =
each($to_trans); ++$n) {
! if (!isset($langarr[$message_id]))
{
if (@isset($langarr[$content])) //
caused by not lowercased-message_id's
--- 807,826 ----
$langarr = array();
}
+ $commonarr = $solangfile->load_app('phpgwapi',$lang) +
$solangfile->load_app('etemplate',$lang);
+
$to_trans = $this->getToTranslateApp($app);
if (is_array($additional))
{
//echo "writeLangFile: additional =";
_debug_array($additional);
! foreach($additional as $msg)
{
! $to_trans[trim(strtolower($msg))] =
$msg;
}
}
unset($to_trans['']);
! for ($new = $n = 0; list($message_id,$content) =
each($to_trans); ++$n)
! {
! if (!isset($langarr[$message_id]) &&
!isset($commonarr[$message_id]))
{
if (@isset($langarr[$content])) //
caused by not lowercased-message_id's
***************
*** 767,772 ****
$langarr[$message_id] = array(
'message_id' => $message_id,
! 'app_name' => $app,
! 'content' => $content
);
++$new;
--- 830,835 ----
$langarr[$message_id] = array(
'message_id' => $message_id,
! 'app_name' => $app,
! 'content' => $content
);
++$new;
Index: class.uietemplate.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/etemplate/inc/class.uietemplate.inc.php,v
retrieving revision 1.62.2.3
retrieving revision 1.62.2.4
diff -C2 -r1.62.2.3 -r1.62.2.4
*** class.uietemplate.inc.php 22 Aug 2003 12:51:10 -0000 1.62.2.3
--- class.uietemplate.inc.php 24 Aug 2003 22:11:13 -0000 1.62.2.4
***************
*** 148,151 ****
--- 148,152 ----
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('java_script' =>
$GLOBALS['phpgw_info']['flags']['java_script'].$this->include_java_script(2)));
}
+ /* is in show now for every template
list($width,$height,,,,,$overflow) =
explode(',',$this->size);
if ($overflow)
***************
*** 153,156 ****
--- 154,158 ----
$html =
$this->html->div($html,'STYLE="'.($width?"width: $width;
":'').($height?"height: $height; ":'')."overflow: $overflow;\"");
}
+ */
$id = $this->save_appsession($this->as_array(1) + array(
'readonlys' => $readonlys,
***************
*** 178,182 ****
echo
$GLOBALS['phpgw_info']['etemplate']['hook_content'].$html;
! if
(address@hidden'phpgw_info']['etemplate']['hooked'] &&
!isset($_GET['menuaction']))
{
$GLOBALS['phpgw']->common->phpgw_footer();
--- 180,185 ----
echo
$GLOBALS['phpgw_info']['etemplate']['hook_content'].$html;
! if
(address@hidden'phpgw_info']['etemplate']['hooked'] &&
! (!isset($_GET['menuaction']) ||
strstr($_SERVER['PHP_SELF'],'process_exec.php')))
{
$GLOBALS['phpgw']->common->phpgw_footer();
***************
*** 417,421 ****
if ($colspan > 1)
{
! $row_data[".$col"] .= "
COLSPAN=$colspan";
for ($i = 1; $i < $colspan;
++$i,++$c)
{
--- 420,424 ----
if ($colspan > 1)
{
! $row_data[".$col"] .= "
COLSPAN=\"$colspan\"";
for ($i = 1; $i < $colspan;
++$i,++$c)
{
***************
*** 447,456 ****
$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
list($width,$height,,,,,$overflow) =
explode(',',$this->size);
if (!empty($overflow)) {
$div_style=' STYLE="'.($width?"width: $width;
":'').($height ? "height: $height; ":'')."overflow: $overflow\"";
$html = $this->html->div($html,$div_style);
! }*/
return "\n\n<!-- BEGIN $this->name
-->\n$style\n".$html."<!-- END $this->name -->\n\n";
}
--- 450,458 ----
$html =
$this->html->table($rows,$this->html->formatOptions($this->size,'WIDTH,HEIGHT,BORDER,CLASS,CELLSPACING,CELLPADDING'),$no_table_tr);
list($width,$height,,,,,$overflow) =
explode(',',$this->size);
if (!empty($overflow)) {
$div_style=' STYLE="'.($width?"width: $width;
":'').($height ? "height: $height; ":'')."overflow: $overflow\"";
$html = $this->html->div($html,$div_style);
! }
return "\n\n<!-- BEGIN $this->name
-->\n$style\n".$html."<!-- END $this->name -->\n\n";
}
***************
*** 540,548 ****
if ($help)
{
! $onFocus .=
"self.status='".addslashes(htmlspecialchars(lang($help)))."'; return true;";
$onBlur .= "self.status=''; return
true;";
if ($cell['type'] == 'button' ||
$cell['type'] == 'file') // for button additionally when mouse over button
{
! $options .= "
onMouseOver=\"self.status='".addslashes(htmlspecialchars(lang($help)))."';
return true;\"";
$options .= "
onMouseOut=\"self.status=''; return true;\"";
}
--- 542,554 ----
if ($help)
{
! if ($cell['no_lang'] < 2)
! {
! $help = lang($help);
! }
! $onFocus .=
"self.status='".addslashes(htmlspecialchars($help))."'; return true;";
$onBlur .= "self.status=''; return
true;";
if ($cell['type'] == 'button' ||
$cell['type'] == 'file') // for button additionally when mouse over button
{
! $options .= "
onMouseOver=\"self.status='".addslashes(htmlspecialchars($help))."'; return
true;\"";
$options .= "
onMouseOut=\"self.status=''; return true;\"";
}
***************
*** 903,907 ****
if ($extra_label && ($label != '' || $html == ''))
{
! if (strlen($label) > 1 && !($cell['no_lang'] &&
$cell['label'] != $label))
{
$label = lang($label);
--- 909,913 ----
if ($extra_label && ($label != '' || $html == ''))
{
! if (strlen($label) > 1 && !($cell['no_lang'] &&
$cell['label'] != $label || $cell['no_lang'] == 2))
{
$label = lang($label);
***************
*** 1096,1154 ****
if ($what & 2 && $this->java_script(True))
{
! $js .= "<script language=\"JavaScript\">
! function set_element(form,name,value)
! {
! ". /* " alert('set_element: '+name+'='+value);". */ "
! for (i = 0; i < form.length; i++)
! {
! if (form.elements[i].name == name)
! {
! form.elements[i].value = value;
! }
! }
! }
!
! function set_element2(form,name,vname)
! {
! ". /* " alert('set_element2: '+name+'='+vname);". */ "
! for (i = 0; i < form.length; i++)
! {
! if (form.elements[i].name == vname)
! {
! value = form.elements[i].value;
! }
! }
! ". /* " alert('set_element2: '+name+'='+value);". */ "
! for (i = 0; i < form.length; i++)
! {
! if (form.elements[i].name == name)
! {
! form.elements[i].value = value;
! }
! }
! }
!
! function activate_tab(tab,all_tabs,name)
! {
! var tabs = all_tabs.split('|');
! var parts = tab.split('.');
! var last_part = parts.length-1;
!
! for (n = 0; n < tabs.length; n++)
! {
! var t = tabs[n];
!
! if (t.indexOf('.') < 0 && parts.length > 1)
! {
! parts[last_part] = t;
! t = parts.join('.');
! }
! document.getElementById(t).style.visibility = t == tab ?
'visible' : 'hidden';
! document.getElementById(t+'-tab').className =
'etemplate_tab'+(t == tab ? '_active th' : ' row_on');
! }
! document.getElementByName(name).value = tab;
! }
! </script>
! ";
}
return $js;
--- 1102,1107 ----
if ($what & 2 && $this->java_script(True))
{
! $js .= '<script type="text/javascript" src="'.
!
$GLOBALS['phpgw_info']['server']['webserver_url'].'/etemplate/js/etemplate.js"></script>';
}
return $js;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] CVS: etemplate/inc class.boetemplate.inc.php, 1.35.2.1, 1.35.2.2 class.soetemplate.inc.php, 1.28.2.1, 1.28.2.2 class.uietemplate.inc.php, 1.62.2.3, 1.62.2.4,
Ralf Becker <address@hidden> <=
- Prev by Date:
[Phpgroupware-cvs] CVS: setup manageheader.php,1.45.2.8,1.45.2.9
- Next by Date:
[Phpgroupware-cvs] CVS: infolog/inc class.customfields_widget.inc.php, NONE, 1.1.2.1 class.uicustomfields.inc.php, NONE, 1.1.2.1 class.boinfolog.inc.php, 1.14.2.3.2.8, 1.14.2.3.2.9 class.soinfolog.inc.php, 1.10.2.1.2.4, 1.10.2.1.2.5 class.uiinfolog.inc.php, 1.30.2.12.2.5, 1.30.2.12.2.6 hook_admin.inc.php, 1.4.4.2, 1.4.4.3
- Previous by thread:
[Phpgroupware-cvs] CVS: setup manageheader.php,1.45.2.8,1.45.2.9
- Next by thread:
[Phpgroupware-cvs] CVS: infolog/inc class.customfields_widget.inc.php, NONE, 1.1.2.1 class.uicustomfields.inc.php, NONE, 1.1.2.1 class.boinfolog.inc.php, 1.14.2.3.2.8, 1.14.2.3.2.9 class.soinfolog.inc.php, 1.10.2.1.2.4, 1.10.2.1.2.5 class.uiinfolog.inc.php, 1.30.2.12.2.5, 1.30.2.12.2.6 hook_admin.inc.php, 1.4.4.2, 1.4.4.3
- Index(es):