[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.6,1.7
From: |
Ralf Becker <address@hidden> |
Subject: |
[Phpgroupware-cvs] CVS: etemplate/inc class.boetemplate.inc.php,1.6,1.7 class.uietemplate.inc.php,1.6,1.7 class.uietemplate_gtk.inc.php,1.3,1.4 |
Date: |
Sun, 02 Jun 2002 17:10:27 -0400 |
Update of /cvsroot/phpgroupware/etemplate/inc
In directory subversions:/tmp/cvs-serv3805
Modified Files:
class.boetemplate.inc.php class.uietemplate.inc.php
class.uietemplate_gtk.inc.php
Log Message:
gtk-ui handls know buttons like the html-ui
Index: class.boetemplate.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/etemplate/inc/class.boetemplate.inc.php,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** class.boetemplate.inc.php 13 May 2002 21:30:46 -0000 1.6
--- class.boetemplate.inc.php 2 Jun 2002 21:10:24 -0000 1.7
***************
*** 256,258 ****
--- 256,308 ----
return $this->extension[$name];
}
+
+ /*!
+ @function isset_array($idx,$arr)
+ @abstract checks if idx, which may contain ONE subindex is set
in array
+ */
+ function isset_array($idx,$arr)
+ {
+ if (ereg('^([^[]*)\\[(.*)\\]$',$idx,$regs))
+ {
+ return $regs[2] &&
isset($arr[$regs[1]][$regs[2]]);
+ }
+ return isset($arr[$idx]);
+ }
+
+ function set_array(&$arr,$idx,$val,$set=True)
+ {
+ if (ereg('^([^[]*)(\\[.*\\])$',$idx,$regs)) // idx
contains array-index
+ {
+ $arr_idx = '['.$regs[1].']'.$regs[2];
+ }
+ else
+ {
+ $arr_idx = "[$idx]";
+ }
+ if ($set)
+ {
+ $code = '$arr'.$arr_idx.' = $val;';
+ }
+ else
+ {
+ $code = 'unset($arr'.$arr_idx.');';
+ }
+ eval($code =
str_replace(']',"']",str_replace('[',"['",$code)));
+
+ //echo "set_array: $code = '$val'\n";
+ }
+
+ function get_array(&$arr,$idx)
+ {
+ if (ereg('^([^[]*)(\\[.*\\])$',$idx,$regs)) // idx
contains array-index
+ {
+ eval($code =
str_replace(']',"']",str_replace('[',"['",'$val =
$arr['.$regs[1].']'.$regs[2].';')));
+ //echo "get_array: $code = '$val'\n";
+ }
+ else
+ {
+ $val = $arr[$idx];
+ }
+ return $val;
+ }
};
Index: class.uietemplate.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/etemplate/inc/class.uietemplate.inc.php,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** class.uietemplate.inc.php 1 Jun 2002 12:38:51 -0000 1.6
--- class.uietemplate.inc.php 2 Jun 2002 21:10:24 -0000 1.7
***************
*** 140,156 ****
/*!
- @function isset_array($idx,$arr)
- @abstract checks if idx, which may contain ONE subindex is set
in array
- */
- function isset_array($idx,$arr)
- {
- if (ereg('^([^[]*)\\[(.*)\\]$',$idx,$regs))
- {
- return $regs[2] &&
isset($arr[$regs[1]][$regs[2]]);
- }
- return isset($arr[$idx]);
- }
-
- /*!
@function show
@abstract creates HTML from an eTemplate
--- 140,143 ----
***************
*** 299,316 ****
$value = $content[$name];
! $org_name = $name;
! if ($cname == '') // building the form-field-name
depending on prefix $cname and possibl. Array-subscript in name
! {
! $form_name = $name;
! }
! elseif (ereg('^([^[]*)\\[(.*)\\]$',$name,$regs))
// name contains array-index
{
! $form_name =
$cname.'['.$regs[1].']['.$regs[2].']';
! $value = $content[$regs[1]][$regs[2]];
! $org_name = $regs[2];
}
else
{
! $form_name = $cname.'['.$name.']';
}
if ($readonly = $cell['readonly'] || $readonlys[$name]
|| $readonlys['__ALL__'])
--- 286,300 ----
$value = $content[$name];
! if (ereg('^([^[]*)(\\[.*\\])$',$name,$regs)) // name
contains array-index
{
! $form_name = $cname == '' ? $name :
$cname.'['.$regs[1].']'.$regs[2];
!
eval(str_replace(']',"']",str_replace('[',"['",'$value =
$content['.$regs[1].']'.$regs[2].';')));
! $org_name = substr($regs[2],1,-1);
}
else
{
! $form_name = $cname == '' ? $name :
$cname.'['.$name.']';
! $value = $content[$name];
! $org_name = $name;
}
if ($readonly = $cell['readonly'] || $readonlys[$name]
|| $readonlys['__ALL__'])
Index: class.uietemplate_gtk.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/etemplate/inc/class.uietemplate_gtk.inc.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** class.uietemplate_gtk.inc.php 20 Feb 2002 21:34:52 -0000 1.3
--- class.uietemplate_gtk.inc.php 2 Jun 2002 21:10:24 -0000 1.4
***************
*** 114,119 ****
$window->connect('destroy',array('etemplate','destroy'));
$window->connect('delete-event',array('etemplate','delete_event'));
! $window->set_title('phpGroupwareGTK');
! $window->set_default_size(800,600);
$GLOBALS['phpgw_info']['etemplate']['window'] =
&$window;
--- 114,119 ----
$window->connect('destroy',array('etemplate','destroy'));
$window->connect('delete-event',array('etemplate','delete_event'));
! $window->set_title('phpGroupWareGTK:
'.$GLOBALS['phpgw_info']['server']['site_title']);
! $window->set_default_size(1024,600);
$GLOBALS['phpgw_info']['etemplate']['window'] =
&$window;
***************
*** 123,128 ****
$window =
&$GLOBALS['phpgw_info']['etemplate']['window'];
}
! $result = array();
! $table =
&$this->show($result,$content,$sel_options,$readonlys);
$table->set_border_width(10);
$table->show();
--- 123,128 ----
$window =
&$GLOBALS['phpgw_info']['etemplate']['window'];
}
! $this->result = array('test' => 'test');
! $table =
&$this->show($this->result,$content,$sel_options,$readonlys);
$table->set_border_width(10);
$table->show();
***************
*** 149,154 ****
list($GLOBALS['phpgw_info']['flags']['currentapp']) =
explode('.',$method);
! //echo "<p>uietemplate.process_exec:
ExecMethod('${exec['method']}')</p>\n";
! ExecMethod($method,array_merge($result,$preserv));
}
--- 149,153 ----
list($GLOBALS['phpgw_info']['flags']['currentapp']) =
explode('.',$method);
! ExecMethod($method,array_merge($this->result,$preserv));
}
***************
*** 171,178 ****
}
! function button_clicked(&$data)
{
! $data = 'pressed';
! echo "button pressed\n";
Gtk::main_quit();
}
--- 170,183 ----
}
! function button_clicked(&$var,$form_name)
{
! echo "button '$form_name' pressed\n";
! $var = 'pressed';
! Gtk::main_quit();
! }
!
! function submit()
! {
! echo "OnChange --> submit\n";
Gtk::main_quit();
}
***************
*** 185,192 ****
$widget = &$set['widget'];
echo "$i:
$set[name]/$set[type]/".Gtk::type_name($widget->get_type());
switch ($set['type'])
{
! case 'button': // is already done in
the signal-handler
break;
case 'int':
--- 190,199 ----
$widget = &$set['widget'];
+ $val_is_set = False;
echo "$i:
$set[name]/$set[type]/".Gtk::type_name($widget->get_type());
switch ($set['type'])
{
! case 'button': // is set to 'pressed'
or is '' (not unset !!!)
! $val_is_set = ($val =
$this->get_array($this->result,$set['name']));
break;
case 'int':
***************
*** 194,206 ****
case 'text':
case 'textarea':
! $set['var'] =
$widget->get_chars(0,-1);
break;
case 'checkbox':
! $set['var'] =
$widget->get_active();
break;
case 'radio':
if ($widget->get_active())
{
! $set['var'] =
$set['set_val'];
}
break;
--- 201,216 ----
case 'text':
case 'textarea':
! $val = $widget->get_chars(0,-1);
! $val_is_set = True;
break;
case 'checkbox':
! $val = $widget->get_active();
! $val_is_set = True;
break;
case 'radio':
if ($widget->get_active())
{
! $val = $set['set_val'];
! $val_is_set = True;
}
break;
***************
*** 214,218 ****
if ($val == $selected)
{
! $set['var'] =
$key;
break;
}
--- 224,229 ----
if ($val == $selected)
{
! $val = $key;
! $val_is_set =
True;
break;
}
***************
*** 221,239 ****
case 'date':
}
! echo " = '$set[var]'\n";
! }
! }
! /*!
! @function isset_array($idx,$arr)
! @abstract checks if idx, which may contain ONE subindex is set
in array
! */
! function isset_array($idx,$arr)
! {
! if (ereg('^([^[]*)\\[(.*)\\]$',$idx,$regs))
! {
! return $regs[2] &&
isset($arr[$regs[1]][$regs[2]]);
}
- return isset($arr[$idx]);
}
--- 232,239 ----
case 'date':
}
! echo $val_is_set && !$set['readonly'] ? " =
'$val'\n" : " NOT SET\n";
!
$this->set_array($this->result,$set['name'],$val,$val_is_set &&
!$set['readonly']);
}
}
***************
*** 255,259 ****
@returns the generated HTML
*/
! function
show(&$result,$content,$sel_options='',$readonlys='',$show_c=0,$show_row=0)
{
if (!$sel_options)
--- 255,259 ----
@returns the generated HTML
*/
! function
show(&$result,$content,$sel_options='',$readonlys='',$cname='',$show_c=0,$show_row=0)
{
if (!$sel_options)
***************
*** 423,449 ****
$name =
$this->expand_name($cell['name'],$show_c,$show_row,$content['.c'],$content['.row'],$content);
- $value = $content[$name];
- $var = &$result[$name];
! $org_name = $name;
! if ($cname == '') // building the form-field-name
depending on prefix $cname and possibl. Array-subscript in name
! {
! $form_name = $name;
! }
! elseif (ereg('^([^[]*)\\[(.*)\\]$',$name,$regs))
// name contains array-index
{
! $form_name =
$cname.'['.$regs[1].']['.$regs[2].']';
! $value = $content[$regs[1]][$regs[2]];
! $var = &$result[$regs[1]][$regs[2]];
! $org_name = $regs[2];
}
else
{
! $form_name = $cname.'['.$name.']';
! }
! if ($readonly = $cell['readonly'] || $readonlys[$name]
|| $readonlys['__ALL__'])
! {
! $options .= ' READONLY';
}
if ($cell['disabled'] || $cell['type'] == 'button' &&
$readonly)
{
--- 423,444 ----
$name =
$this->expand_name($cell['name'],$show_c,$show_row,$content['.c'],$content['.row'],$content);
! // building the form-field-name depending on prefix
$cname and possibl. Array-subscript in name
! if (ereg('^([^[]*)(\\[.*\\])$',$name,$regs)) // name
contains array-index
{
! $form_name = $cname == '' ? $name :
$cname.'['.$regs[1].']'.$regs[2];
!
eval(str_replace(']',"']",str_replace('[',"['",'$value =
$content['.$regs[1].']'.$regs[2].';')));
! $org_name = substr($regs[2],1,-1);
!
eval(str_replace(']',"']",str_replace('[',"['",'$var =
&$result['.$regs[1].']'.$regs[2].';')));
}
else
{
! $form_name = $cname == '' ? $name :
$cname.'['.$name.']';
! $value = $content[$name];
! $org_name = $name;
! $var = &$result[$name];
}
+ $readonly = $cell['readonly'] || $readonlys[$name] ||
$readonlys['__ALL__'];
+
if ($cell['disabled'] || $cell['type'] == 'button' &&
$readonly)
{
***************
*** 465,468 ****
--- 460,464 ----
list($left_label,$right_label) = explode('%s',$label);
+ //echo "show_cell: type='$cell[type]',
name='$cell[name]'-->'$name', value='$value'\n";
$widget = False;
switch ($cell['type'])
***************
*** 581,585 ****
//$html .=
$this->html->submit_button($form_name,$cell['label'],'',strlen($cell['label'])
<= 1 || $cell['no_lang'],$options);
$widget = &new
GtkButton(strlen($cell['label']) > 1 ? lang($cell['label']) : $cell['label']);
! $widget->connect_object('clicked',
array('etemplate', 'button_clicked'),&$var);
break;
case 'hrule':
--- 577,581 ----
//$html .=
$this->html->submit_button($form_name,$cell['label'],'',strlen($cell['label'])
<= 1 || $cell['no_lang'],$options);
$widget = &new
GtkButton(strlen($cell['label']) > 1 ? lang($cell['label']) : $cell['label']);
! $widget->connect_object('clicked',
array('etemplate', 'button_clicked'),&$var,$form_name);
break;
case 'hrule':
***************
*** 652,655 ****
--- 648,655 ----
$entry->set_editable(False);
$entry->set_usize($maxlen*$this->font_width,0);
+ if ($cell['onchange'] == '1')
+ {
+
$entry->connect('changed',array('etemplate', 'submit'));
+ }
break;
/* case 'select-percent':
***************
*** 696,702 ****
'widget' => &$widget,
'type' => $cell['type'],
- 'var' => &$var,
'set_val' => $cell['type'] == 'radio' ?
$cell['size'] : $sel_options,
! 'name' => $form_name
);
}
--- 696,702 ----
'widget' => &$widget,
'type' => $cell['type'],
'set_val' => $cell['type'] == 'radio' ?
$cell['size'] : $sel_options,
! 'name' => $form_name,
! 'readonly' => $readonly
);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] CVS: etemplate/inc class.boetemplate.inc.php,1.6,1.7 class.uietemplate.inc.php,1.6,1.7 class.uietemplate_gtk.inc.php,1.3,1.4,
Ralf Becker <address@hidden> <=