[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] CVS: etemplate/inc class.select_widget.inc.php,NONE,1
From: |
Ralf Becker <address@hidden> |
Subject: |
[Phpgroupware-cvs] CVS: etemplate/inc class.select_widget.inc.php,NONE,1.1 class.boetemplate.inc.php,1.24,1.25 class.editor.inc.php,1.22,1.23 class.html.inc.php,1.8,1.9 class.uietemplate.inc.php,1.33,1.34 |
Date: |
Tue, 01 Oct 2002 20:44:35 -0400 |
Update of /cvsroot/phpgroupware/etemplate/inc
In directory subversions:/tmp/cvs-serv16477
Modified Files:
class.boetemplate.inc.php class.editor.inc.php
class.html.inc.php class.uietemplate.inc.php
Added Files:
class.select_widget.inc.php
Log Message:
put all pre-defined select-boxes in an extension, dont need sbox-class any more
***** Error reading new file: [Errno 2] No such file or directory:
'class.select_widget.inc.php'
Index: class.boetemplate.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/etemplate/inc/class.boetemplate.inc.php,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -r1.24 -r1.25
*** class.boetemplate.inc.php 1 Oct 2002 18:26:30 -0000 1.24
--- class.boetemplate.inc.php 2 Oct 2002 00:44:33 -0000 1.25
***************
*** 41,52 ****
'select' => 'Selectbox', // Selectbox
($sel_options[$name] or $content[options-$name] is array with options)
// if size > 1 then multiple selections, size lines showed
- 'select-percent' => 'Select Percentage',
- 'select-priority' => 'Select Priority',
- 'select-access' => 'Select Access',
- 'select-country' => 'Select Country',
- 'select-state' => 'Select State', //
US-states
- 'select-cat' => 'Select Category', //
Category-Selection, size: -1=Single+All, 0=Single, >0=Multiple with size lines
- 'select-account' => 'Select Account', //
label=accounts(default),groups,both
-
// size: -1=Single+not
assigned, 0=Single, >0=Multiple
'raw' => 'Raw', // Raw html in
$content[$cell['name']]
'file' => 'FileUpload' // show an input type='file',
set the local name as ${name}_path
--- 41,44 ----
Index: class.editor.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/etemplate/inc/class.editor.inc.php,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -r1.22 -r1.23
*** class.editor.inc.php 30 Sep 2002 18:19:50 -0000 1.22
--- class.editor.inc.php 2 Oct 2002 00:44:33 -0000 1.23
***************
*** 411,415 ****
{
$m = new editor(False);
! $additional = $m->messages +
$this->etemplate->types + $this->aligns;
}
$msg =
$this->etemplate->writeLangFile($content['name'],'en',$additional);
--- 411,415 ----
{
$m = new editor(False);
! $additional = $m->messages +
$this->etemplate->types + $this->extensions + $this->aligns;
}
$msg =
$this->etemplate->writeLangFile($content['name'],'en',$additional);
***************
*** 709,713 ****
($ext =
$this->etemplate->loadExtension($regs[1].'.'.$app,$this->etemplate)))
{
! $extensions[$regs[1]] = $ext;
}
}
--- 709,727 ----
($ext =
$this->etemplate->loadExtension($regs[1].'.'.$app,$this->etemplate)))
{
! if (is_array($ext))
! {
! if (!is_array($extensions))
! {
! $extensions = $ext;
! }
! else
! {
! $extensions += $ext;
! }
! }
! else
! {
! $extensions[$regs[1]] = $ext;
! }
}
}
Index: class.html.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/etemplate/inc/class.html.inc.php,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** class.html.inc.php 29 Sep 2002 16:33:47 -0000 1.8
--- class.html.inc.php 2 Oct 2002 00:44:33 -0000 1.9
***************
*** 28,31 ****
--- 28,76 ----
}
+ /*
+ * Function: Allows to show and select one item from an array
+ * Parameters: $name string with name of the
submitted var which holds the key of the selected item form array
+ * $key key(s)
of already selected item(s) from $arr, eg. '1' or '1,2' or array with keys
+ * $arr array
with items to select, eg. $arr = array ( 'y' => 'yes','n' => 'no','m' =>
'maybe');
+ * $no_lang if
!$no_lang send items through lang()
+ * $options
additional options (e.g. 'multiple')
+ * On submit $XXX is the key of the selected item
(XXX is the content of $name)
+ * Returns: string to set for a template or to echo
into html page
+ */
+ function select($name, $key, $arr=0,$no_lang=0,$options='',$multiple=0)
+ {
+ // should be in class common.sbox
+ if (!is_array($arr))
+ {
+ $arr = array('no','yes');
+ }
+ if (0+$multiple > 0)
+ {
+ $options .= ' MULTIPLE SIZE='.(0+$multiple);
+ if (substr($name,-2) != '[]')
+ {
+ $name .= '[]';
+ }
+ }
+ $out = "<select name=\"$name\" $options>\n";
+
+ if (is_array($key))
+ {
+ $key = implode(',',$key);
+ }
+ while (list($k,$text) = each($arr))
+ {
+ $out .= '<option value="'.$k.'"';
+ if($k == $key || strstr(",$key,",",$k,"))
+ {
+ $out .= " SELECTED";
+ }
+ $out .= ">" . ($no_lang || $text == '' ? $text :
lang($text)) . "</option>\n";
+ }
+ $out .= "</select>\n";
+
+ return $out;
+ }
+
function div($content,$options='')
{
Index: class.uietemplate.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/etemplate/inc/class.uietemplate.inc.php,v
retrieving revision 1.33
retrieving revision 1.34
diff -C2 -r1.33 -r1.34
*** class.uietemplate.inc.php 1 Oct 2002 18:26:30 -0000 1.33
--- class.uietemplate.inc.php 2 Oct 2002 00:44:33 -0000 1.34
***************
*** 27,31 ****
@param $debug enables debug messages: 0=no, 1=calls to show and
process_show, 2=content of process_show
@param 3=calls to show_cell OR template-
or cell-type name
! @param $html,$sbox instances of html and sbox2 class used to generate
the html
*/
class etemplate extends boetemplate
--- 27,31 ----
@param $debug enables debug messages: 0=no, 1=calls to show and
process_show, 2=content of process_show
@param 3=calls to show_cell OR template-
or cell-type name
! @param $html instances of html class used to generate the html
*/
class etemplate extends boetemplate
***************
*** 33,37 ****
var $debug; // 1=calls to show and process_show, 2=content
after process_show,
// 3=calls to show_cell and
process_show_cell, or template-name or cell-type
! var $html,$sbox; // instance of html / sbox2-class
var $class_conf = array('nmh' => 'th','nmr0' => 'row_on','nmr1'
=> 'row_off');
--- 33,37 ----
var $debug; // 1=calls to show and process_show, 2=content
after process_show,
// 3=calls to show_cell and
process_show_cell, or template-name or cell-type
! var $html; // instance of html-class
var $class_conf = array('nmh' => 'th','nmr0' => 'row_on','nmr1'
=> 'row_off');
***************
*** 51,55 ****
);
$this->html = CreateObject('etemplate.html'); //
should be in the api (older version in infolog)
- $this->sbox = CreateObject('etemplate.sbox2'); //
older version is in the api
$this->boetemplate($name,$load_via);
--- 51,54 ----
***************
*** 343,351 ****
$name =
$this->expand_name($cell['name'],$show_c,$show_row,$content['.c'],$content['.row'],$content);
! /*if (strstr($name,'|')) // extension which uses
whole content array
! {
! $value = $content;
! }
! else*/if (ereg('^([^[]*)(\\[.*\\])$',$name,$regs))
// name contains array-index
{
$form_name = $cname == '' ? $name :
$cname.'['.$regs[1].']'.$regs[2];
--- 342,346 ----
$name =
$this->expand_name($cell['name'],$show_c,$show_row,$content['.c'],$content['.row'],$content);
! if (ereg('^([^[]*)(\\[.*\\])$',$name,$regs)) // name
contains array-index
{
$form_name = $cname == '' ? $name :
$cname.'['.$regs[1].']'.$regs[2];
***************
*** 373,386 ****
$extra_label = True;
! if (!$this->types[$cell['type']] &&
$this->haveExtension($cell['type'],'pre_process'))
{
! $ext_type = $cell['type'];
$extra_label =
$this->extensionPreProcess($ext_type,$form_name,$value,$cell,$readonlys[$name]);
! /*if (strstr($name,'|'))
! {
! $content =
$this->complete_array_merge($content,$value);
! }
! else*/if (!$regs)
{
$content[$name] = $value; // set
result for template
--- 368,378 ----
$extra_label = True;
! list($type,$sub_type) = explode('-',$cell['type']);
! if ((!$this->types[$cell['type']] || !empty($sub_type))
&& $this->haveExtension($type,'pre_process'))
{
! $ext_type = $type;
$extra_label =
$this->extensionPreProcess($ext_type,$form_name,$value,$cell,$readonlys[$name]);
! if (!$regs)
{
$content[$name] = $value; // set
result for template
***************
*** 418,422 ****
}
}
! switch ($cell['type'])
{
case 'label': // size:
[[b]old][[i]talic]
--- 410,415 ----
}
}
! list($type,$sub_type) = explode('-',$cell['type']);
! switch ($type)
{
case 'label': // size:
[[b]old][[i]talic]
***************
*** 456,466 ****
break;
case 'checkbox':
if ($value)
{
$options .= ' CHECKED';
}
! $html .=
$this->html->input($form_name,'1','CHECKBOX',$options);
! if (!$readonly)
!
$GLOBALS['phpgw_info']['etemplate']['to_process'][$form_name] = $cell['type'];
break;
case 'radio': // size: value if
checked
--- 449,478 ----
break;
case 'checkbox':
+ if (!empty($cell['size']))
+ {
+
list($true_val,$false_val,$ro_true,$ro_false) = explode(',',$cell['size']);
+ $value = $value == $true_val;
+ }
+ else
+ {
+ $ro_true = 'x';
+ $ro_false = '';
+ }
if ($value)
{
$options .= ' CHECKED';
}
! if ($readonly)
! {
! $html .= $value ?
$this->html->bold($ro_true) : $ro_false;
! }
! else
! {
! $html .=
$this->html->input($form_name,'1','CHECKBOX',$options);
!
$GLOBALS['phpgw_info']['etemplate']['to_process'][$form_name] = array(
! 'type' => $cell['type'],
! 'values' =>
$cell['size']
! );
! }
break;
case 'radio': // size: value if
checked
***************
*** 469,475 ****
$options .= ' CHECKED';
}
! $html .=
$this->html->input($form_name,$cell['size'],'RADIO',$options);
! if (!$readonly)
$GLOBALS['phpgw_info']['etemplate']['to_process'][$form_name] = $cell['type'];
break;
case 'button':
--- 481,493 ----
$options .= ' CHECKED';
}
! if ($readonly)
! {
! $html .= $value ==
$cell['size'] ? $this->html->bold('x') : '';
! }
! else
! {
! $html .=
$this->html->input($form_name,$cell['size'],'RADIO',$options);
$GLOBALS['phpgw_info']['etemplate']['to_process'][$form_name] = $cell['type'];
+ }
break;
case 'button':
***************
*** 549,553 ****
break;
case 'select': // size:[linesOnMultiselect]
! if (isset($sel_options[$name]))
{
$sel_options =
$sel_options[$name];
--- 567,588 ----
break;
case 'select': // size:[linesOnMultiselect]
! if (!empty($cell['sel_options']))
! {
! if (!is_array($cell))
! {
! $sel_options = array();
! $opts =
explode(',',$cell['sel_options']);
! while (list(,$opt) =
each($opts))
! {
! list($k,$v) =
explode('=',$opt);
!
$sel_options[$k] = $v;
! }
! }
! else
! {
! $sel_options =
$cell['sel_options'];
! }
! }
! elseif (isset($sel_options[$name]))
{
$sel_options =
$sel_options[$name];
***************
*** 556,608 ****
{
$sel_options =
$sel_options[$org_name];
! } elseif
(isset($content["options-$name"]))
{
$sel_options =
$content["options-$name"];
}
! $html .=
$this->sbox->getArrayItem($form_name.'[]',$value,$sel_options,$cell['no_lang'],
! $options,$cell['size']);
! if (!$readonly)
!
$GLOBALS['phpgw_info']['etemplate']['to_process'][$form_name] = $cell['type'];
! break;
! case 'select-percent':
! $html .=
$this->sbox->getPercentage($form_name,$value,$options);
! if (!$readonly)
!
$GLOBALS['phpgw_info']['etemplate']['to_process'][$form_name] = $cell['type'];
! break;
! case 'select-priority':
! $html .=
$this->sbox->getPriority($form_name,$value,$options);
! if (!$readonly)
!
$GLOBALS['phpgw_info']['etemplate']['to_process'][$form_name] = $cell['type'];
! break;
! case 'select-access':
! $html .=
$this->sbox->getAccessList($form_name,$value,$options);
! if (!$readonly)
!
$GLOBALS['phpgw_info']['etemplate']['to_process'][$form_name] = $cell['type'];
! break;
! case 'select-country':
! $html .=
$this->sbox->getCountry($form_name,$value,$options);
! if (!$readonly)
!
$GLOBALS['phpgw_info']['etemplate']['to_process'][$form_name] = $cell['type'];
! break;
! case 'select-state':
! $html .=
$this->sbox->list_states($form_name,$value); // no helptext - old Function!!!
! if (!$readonly)
!
$GLOBALS['phpgw_info']['etemplate']['to_process'][$form_name] = $cell['type'];
! break;
! case 'select-cat':
! $html .=
$this->sbox->getCategory($form_name.'[]',$value,$cell['size'] >= 0,
! False,$cell['size'],$options);
! if (!$readonly)
!
$GLOBALS['phpgw_info']['etemplate']['to_process'][$form_name] = $cell['type'];
! break;
! case 'select-account':
! $type =
substr(strstr($cell['size'],','),1);
! if ($type == '')
{
! $type = 'accounts'; //
default is accounts
}
! $html .=
$this->sbox->getAccount($form_name.'[]',$value,2,$type,0+$cell['size'],$options);
! if (!$readonly)
$GLOBALS['phpgw_info']['etemplate']['to_process'][$form_name] = $cell['type'];
break;
case 'image':
--- 591,611 ----
{
$sel_options =
$sel_options[$org_name];
! }
! elseif
(isset($content["options-$name"]))
{
$sel_options =
$content["options-$name"];
}
! list($multiple) =
explode(',',$cell['size']);
!
! if ($readonly)
{
! $html .= $cell['no_lang'] ?
$sel_options[$value] : lang($sel_options[$value]);
}
! else
! {
! $html .=
$this->html->select($form_name.($multiple > 1 ? '[]' : ''),$value,$sel_options,
!
$cell['no_lang'],$options,$multiple);
$GLOBALS['phpgw_info']['etemplate']['to_process'][$form_name] = $cell['type'];
+ }
break;
case 'image':
***************
*** 631,635 ****
break;
}
! if ($ext_type && !$readonly) // extension-processing
need to be after all other
{
$GLOBALS['phpgw_info']['etemplate']['to_process'][$form_name] =
'ext-'.$ext_type;
--- 634,639 ----
break;
}
! if ($ext_type && !$readonly && // extension-processing
need to be after all other and only with diff. name
!
!isset($GLOBALS['phpgw_info']['etemplate']['to_process'][$form_name]))
{
$GLOBALS['phpgw_info']['etemplate']['to_process'][$form_name] =
'ext-'.$ext_type;
***************
*** 678,682 ****
if ($this->debug >= 1 || $this->debug == $this->name &&
$this->name)
{
! echo "<p>process_show($this->name) start:
content ="; _debug_array($GLOBALS['HTTP_POST_VARS']/*$content*/);
}
$content_in = $cname ? array($cname => $content) :
$content;
--- 682,686 ----
if ($this->debug >= 1 || $this->debug == $this->name &&
$this->name)
{
! echo "<p>process_show($this->name) start:
content ="; _debug_array($content);
}
$content_in = $cname ? array($cname => $content) :
$content;
***************
*** 685,689 ****
--- 689,703 ----
while (list($form_name,$type) = each($to_process))
{
+ if (is_array($type))
+ {
+ $attr = $type;
+ $type = $attr['type'];
+ }
+ else
+ {
+ $attr = array();
+ }
$value =
$this->get_array($content_in,$form_name);
+ //echo "<p>process_show($this->name) $type:
$form_name = '$value'</p>\n";
list($type,$sub) = explode('-',$type);
switch ($type)
***************
*** 713,716 ****
--- 727,735 ----
{
$value = 0;
// need to be reported too
+ }
+ if (!empty($attr['values']))
+ {
+
list($true_val,$false_val) = explode(',',$attr['values']);
+ $value = $value ?
$true_val : $false_val;
}
$this->set_array($content,$form_name,$value);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] CVS: etemplate/inc class.select_widget.inc.php,NONE,1.1 class.boetemplate.inc.php,1.24,1.25 class.editor.inc.php,1.22,1.23 class.html.inc.php,1.8,1.9 class.uietemplate.inc.php,1.33,1.34,
Ralf Becker <address@hidden> <=