mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-26 07:49:28 +01:00
added time and date+time to date_widget and select-number to select_widget
This commit is contained in:
parent
36ed2608fd
commit
3e73fa66d8
@ -15,7 +15,7 @@
|
||||
/*!
|
||||
@class date_widget
|
||||
@author ralfbecker
|
||||
@abstract widget that reads a date
|
||||
@abstract widget that reads a date and/or time
|
||||
@param Options/$cell['size'] = $format[,$year_no_select], $format: ''=timestamp or eg. 'Y-m-d' for 2002-12-31
|
||||
@discussion This widget is independent of the UI as it only uses etemplate-widgets and has therefor no render-function
|
||||
*/
|
||||
@ -25,52 +25,83 @@
|
||||
'pre_process' => True,
|
||||
'post_process' => True
|
||||
);
|
||||
var $human_name = 'Date'; // this is the name for the editor
|
||||
var $human_name = array(
|
||||
'date' => 'Date', // just a date, no time
|
||||
'date-time' => 'Date+Time', // date + time
|
||||
'date-timeonly' => 'Time'
|
||||
);
|
||||
|
||||
function date_widget($ui)
|
||||
{
|
||||
$this->timeformat = $GLOBALS['phpgw_info']['user']['preferences']['common']['timeformat'];
|
||||
}
|
||||
|
||||
function pre_process($name,&$value,&$cell,&$readonlys,&$extension_data,&$tmpl)
|
||||
{
|
||||
list($data_format,$options) = explode(',',$cell['size']);
|
||||
$extension_data = $data_format;
|
||||
$type = $cell['type'];
|
||||
|
||||
if (!$value)
|
||||
{
|
||||
$value = array(
|
||||
'Y' => '',
|
||||
'm' => '',
|
||||
'd' => ''
|
||||
'd' => '',
|
||||
'H' => '',
|
||||
'i' => ''
|
||||
);
|
||||
}
|
||||
elseif ($data_format != '')
|
||||
{
|
||||
$date = split('[/.-]',$value);
|
||||
$mdy = split('[/.-]',$data_format);
|
||||
for ($value=array(),$n = 0; $n < 3; ++$n)
|
||||
$date = split('[- /.:,]',$value);
|
||||
//echo "date=<pre>"; print_r($date); echo "</pre>";
|
||||
$mdy = split('[- /.:,]',$data_format);
|
||||
$value = array();
|
||||
foreach ($date as $n => $dat)
|
||||
{
|
||||
switch($mdy[$n])
|
||||
{
|
||||
case 'Y': $value['Y'] = $date[$n]; break;
|
||||
case 'm': $value['m'] = $date[$n]; break;
|
||||
case 'd': $value['d'] = $date[$n]; break;
|
||||
case 'Y': $value['Y'] = $dat; break;
|
||||
case 'm': $value['m'] = $dat; break;
|
||||
case 'd': $value['d'] = $dat; break;
|
||||
case 'H': $value['H'] = $dat; break;
|
||||
case 'i': $value['i'] = $dat; break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$value += $GLOBALS['phpgw']->datetime->tz_offset;
|
||||
$value = array(
|
||||
'Y' => date('Y',$value),
|
||||
'm' => date('m',$value),
|
||||
'd' => date('d',$value)
|
||||
'd' => date('d',$value),
|
||||
'H' => date('H',$value),
|
||||
'i' => date('i',$value)
|
||||
);
|
||||
}
|
||||
$timeformat = array(3 => 'H', 4 => 'i');
|
||||
if ($this->timeformat == '12')
|
||||
{
|
||||
$value['a'] = $value['H'] < 12 ? 'am' : 'pm';
|
||||
|
||||
if ($value['H'] > 12)
|
||||
{
|
||||
$value['H'] -= 12;
|
||||
}
|
||||
$timeformat += array(5 => 'a');
|
||||
}
|
||||
$format = split('[/.-]',$sep=$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
|
||||
|
||||
if ($type != 'date')
|
||||
{
|
||||
$format += $timeformat;
|
||||
}
|
||||
$sep = $sep[1];
|
||||
if ($cell['readonly'] || $readonlys) // is readonly
|
||||
{
|
||||
for ($str='',$n = 0; $n < 3; ++$n)
|
||||
for ($str='',$n = $type == 'date-timeonly' ? 3 : 0; $n < count($format); ++$n)
|
||||
{
|
||||
$str .= ($str != '' ? $sep : '');
|
||||
$str .= $value[$format[$n]];
|
||||
@ -83,26 +114,69 @@
|
||||
$tpl = new etemplate;
|
||||
$tpl->init('*** generated fields for date','','',0,'',0,0); // make an empty template
|
||||
|
||||
$fields = array(
|
||||
'Y' => ($options ? 'int' : 'select-year'), // if options set, show an int-field
|
||||
$types = array(
|
||||
'Y' => ($options&1 ? 'int' : 'select-year'), // if options&1 set, show an int-field
|
||||
'm' => 'select-month',
|
||||
'd' => 'select-day'
|
||||
'd' => 'select-day',
|
||||
'H' => 'select-number',
|
||||
'i' => 'select-number'
|
||||
);
|
||||
$options = array(
|
||||
'H' => $this->timeformat == '12' ? ',0,12' : ',0,23',
|
||||
'i' => ',0,59,5'
|
||||
);
|
||||
$help = array(
|
||||
'Y' => 'Year',
|
||||
'm' => 'Month',
|
||||
'd' => 'Day'
|
||||
'd' => 'Day',
|
||||
'H' => 'Hour',
|
||||
'i' => 'Minute'
|
||||
);
|
||||
$row = array();
|
||||
for ($n=0; $n < 3; ++$n)
|
||||
for ($i=0,$n=$type == 'date-timeonly'?3:0; $n < ($type == 'date' ? 3 : 5); ++$n,++$i)
|
||||
{
|
||||
$dcell = $tpl->empty_cell();
|
||||
$dcell['type'] = $fields[$format[$n]];
|
||||
$dcell['type'] = $types[$format[$n]];
|
||||
$dcell['size'] = $options[$format[$n]];
|
||||
$dcell['name'] = $format[$n];
|
||||
$dcell['help'] = lang($help[$format[$n]]).': '.$cell['help']; // note: no lang on help, already done
|
||||
$dcell['no_lang'] = True;
|
||||
$row[$tpl->num2chrs($n)] = &$dcell;
|
||||
$row[$tpl->num2chrs($i)] = &$dcell;
|
||||
unset($dcell);
|
||||
|
||||
if ($n == 2 && $options & 2) // Today button
|
||||
{
|
||||
$dcell = $tpl->empty_cell();
|
||||
$dcell['type'] = 'button';
|
||||
$dcell['name'] = 'today';
|
||||
$dcell['label'] = $type == 'Today';
|
||||
$dcell['help'] = 'sets today as date';
|
||||
$dcell['onchange'] = "this.form.elements['$name"."[Y]'].value='".date('Y')."'; this.form.elements['$name"."[m]'].value='".date('n')."';this.form.elements['$name"."[d]'].value='".(0+date('d'))."'; return false;";
|
||||
$row[$tpl->num2chrs(3)] = &$dcell;
|
||||
unset($dcell);
|
||||
}
|
||||
if ($n == 2 && $type == 'date-time') // insert some space between date+time
|
||||
{
|
||||
$dcell = $tpl->empty_cell();
|
||||
$dcell['type'] = 'label';
|
||||
$dcell['name'] = 'space';
|
||||
$value['space'] = ' ';
|
||||
$dcell['no_lang'] = True;
|
||||
$row[$tpl->num2chrs(++$i)] = &$dcell;
|
||||
unset($dcell);
|
||||
}
|
||||
if ($n == 4 && $type != 'date' && $this->timeformat == '12')
|
||||
{
|
||||
$dcell = $tpl->empty_cell();
|
||||
$dcell['type'] = 'radio';
|
||||
$dcell['name'] = 'a';
|
||||
$dcell['help'] = $cell['help'];
|
||||
$dcell['size'] = $dcell['label'] = 'am';
|
||||
$row[$tpl->num2chrs(++$i)] = $dcell;
|
||||
$dcell['size'] = $dcell['label'] = 'pm';
|
||||
$row[$tpl->num2chrs(++$i)] = &$dcell;
|
||||
unset($dcell);
|
||||
}
|
||||
}
|
||||
$tpl->data[0] = array();
|
||||
$tpl->data[1] = &$row;
|
||||
@ -123,29 +197,45 @@
|
||||
{
|
||||
return False;
|
||||
}
|
||||
if ($value['d'])
|
||||
if ($value['d'] || $value['H'] !== '' || $value['i'] !== '')
|
||||
{
|
||||
if (!$value['m'])
|
||||
if ($value['d'])
|
||||
{
|
||||
$value['m'] = date('m');
|
||||
if (!$value['m'])
|
||||
{
|
||||
$value['m'] = date('m');
|
||||
}
|
||||
if (!$value['Y'])
|
||||
{
|
||||
$value['Y'] = date('Y');
|
||||
}
|
||||
elseif ($value['Y'] < 100)
|
||||
{
|
||||
$value['Y'] += $value['Y'] < 30 ? 2000 : 1900;
|
||||
}
|
||||
}
|
||||
if (!$value['Y'])
|
||||
else // for the timeonly field
|
||||
{
|
||||
$value['Y'] = date('Y');
|
||||
$value['d'] = $value['m'] = 1;
|
||||
$value['Y'] = 1970;
|
||||
}
|
||||
elseif ($value['Y'] < 100)
|
||||
if (isset($value['a']))
|
||||
{
|
||||
$value['Y'] += $value['Y'] < 30 ? 2000 : 1900;
|
||||
if ($value['a'] == 'pm' && $value['H'] < 12)
|
||||
{
|
||||
$value['H'] += 12;
|
||||
}
|
||||
}
|
||||
if (empty($extension_data))
|
||||
{
|
||||
$value = mktime(0,0,0,$value['m'],$value['d'],$value['Y']);
|
||||
$value = mktime(intval($value['H']),intval($value['i']),0,$value['m'],$value['d'],$value['Y'])
|
||||
- $GLOBALS['phpgw']->datetime->tz_offset;
|
||||
}
|
||||
else
|
||||
{
|
||||
for ($n = 0,$str = ''; $n < strlen($extension_data); ++$n)
|
||||
{
|
||||
if (strstr('Ymd',$c = $extension_data[$n]))
|
||||
if (strstr('YmdHi',$c = $extension_data[$n]))
|
||||
{
|
||||
$str .= sprintf($c=='Y'?'%04d':'%02d',$value[$c]);
|
||||
}
|
||||
|
@ -36,6 +36,7 @@
|
||||
'select-year' => 'Select Year',
|
||||
'select-month' => 'Select Month',
|
||||
'select-day' => 'Select Day',
|
||||
'select-number' => 'Select Number',
|
||||
'select-app' => 'Select Application'
|
||||
);
|
||||
var $monthnames = array(
|
||||
@ -359,7 +360,7 @@
|
||||
|
||||
function pre_process($name,&$value,&$cell,&$readonlys,&$extension_data,&$tmpl)
|
||||
{
|
||||
list($rows,$type,$type2) = explode(',',$cell['size']);
|
||||
list($rows,$type,$type2,$type3) = explode(',',$cell['size']);
|
||||
|
||||
switch ($cell['type'])
|
||||
{
|
||||
@ -468,10 +469,23 @@
|
||||
break;
|
||||
|
||||
case 'select-day':
|
||||
$type = 1;
|
||||
$type2 = 31;
|
||||
$type3 = 1;
|
||||
// fall-through
|
||||
|
||||
case 'select-number': // options: rows,min,max,dec
|
||||
$cell['sel_options'][''] = '';
|
||||
for ($d=1; $d <= 31; ++$d)
|
||||
$type = $type === '' ? 1 : intval($type);
|
||||
$type2 = $type2 === '' ? 10 : intval($type2);
|
||||
$type3 = !$type3 ? 1 : intval($type3);
|
||||
if (($type < $type2) != ($type3 > 0))
|
||||
{
|
||||
$cell['sel_options'][$d] = $d;
|
||||
$type3 = -$type3; // void infinite loop
|
||||
}
|
||||
for ($i=0,$n=$type; $n <= $type2 && $i <= 100; $n += $type3)
|
||||
{
|
||||
$cell['sel_options'][$n] = $n;
|
||||
}
|
||||
$cell['no_lang'] = True;
|
||||
break;
|
||||
|
@ -33,16 +33,31 @@
|
||||
|
||||
function pre_process($form_name,&$value,&$cell,&$readonlys,&$extension_data,&$tmpl)
|
||||
{
|
||||
$dom_enabled = 0;//$GLOBALS['phpgw_info']['etemplate']['dom_enabled'];
|
||||
$labels = explode('|',$cell['label']);
|
||||
$helps = explode('|',$cell['help']);
|
||||
$names = explode('|',$cell['name']);
|
||||
|
||||
$tabs = new etemplate();
|
||||
$tab = new etemplate('etemplate.tab_widget.tab');
|
||||
$tab = new etemplate('etemplate.tab_widget.tab'.($dom_enabled ? '_dom' : ''));
|
||||
$tab_active = new etemplate('etemplate.tab_widget.tab_active');
|
||||
|
||||
$tabs = new etemplate();
|
||||
$tabs->init('*** generated tabs','','',0,'',0,0); // make an empty template
|
||||
|
||||
foreach($names as $k => $name)
|
||||
{
|
||||
if (!strstr($name,'.'))
|
||||
{
|
||||
$name = $names[$k] = $tmpl->name . '.' . $name;
|
||||
}
|
||||
if ($extension_data == $name)
|
||||
{
|
||||
$selected_tab = $name;
|
||||
}
|
||||
}
|
||||
if (empty($selected_tab))
|
||||
{
|
||||
$extension_data = $selected_tab = $names[0];
|
||||
}
|
||||
$tab_row = array(); // generate the tab row
|
||||
while (list($k,$name) = each($names))
|
||||
{
|
||||
@ -55,14 +70,19 @@
|
||||
{
|
||||
// save selected tab in persistent extension_data to use it in post_process
|
||||
$selected_tab = $name;
|
||||
$tcell['obj'] = &$tab_active;
|
||||
$tcell['obj'] = $tab_active;
|
||||
$tcell['name'] = $tab_active->name;
|
||||
}
|
||||
else
|
||||
{
|
||||
$tcell['obj'] = &$tab;
|
||||
$tcell['obj'] = $tab;
|
||||
$tcell['name'] = $tab->name;
|
||||
}
|
||||
if ($dom_enabled)
|
||||
{
|
||||
$tcell['obj']->set_cell_attribute('tab','onclick',"activate_tab('$name','$cell[name]');");
|
||||
$tcell['obj']->set_cell_attribute('tab','id',$name.'-tab');
|
||||
}
|
||||
$tcell['type'] = 'template';
|
||||
$tcell['size'] = $cell['name'].'['.$name.']';
|
||||
$value[$name] = array(
|
||||
@ -77,24 +97,38 @@
|
||||
$tabs->data[0][$k] = '99%'; // width
|
||||
$tabs->data[0]['c1'] = ',bottom';
|
||||
|
||||
if (!isset($selected_tab))
|
||||
{
|
||||
$tab_row['A']['obj'] = &$tab_active;
|
||||
$tcell['name'] = $tab_active->name;
|
||||
$extension_data = $selected_tab = $names[0];
|
||||
}
|
||||
$tabs->data[1] = $tab_row;
|
||||
$tabs->set_rows_cols();
|
||||
$tabs->size = ',,,,0';
|
||||
$tabs->size = "$cell[width],,,0,0";
|
||||
|
||||
$tab_widget = new etemplate('etemplate.tab_widget');
|
||||
$tab_widget->set_cell_attribute('@tabs','obj',$tabs);
|
||||
|
||||
$stab = new etemplate($selected_tab,$tmpl->as_array());
|
||||
$options = array_pad(explode(',',$stab->size),3,'');
|
||||
$options[3] = ($options[3]!= '' ? $options[3].' ':'') . 'tab_body';
|
||||
$stab->size = implode(',',$options);
|
||||
$tab_widget->set_cell_attribute('@body','obj',$stab);
|
||||
if ($dom_enabled)
|
||||
{
|
||||
$tab_widget->set_cell_attribute('@body','type','deck');
|
||||
$tab_widget->set_cell_attribute('@body','width',$cell['width']);
|
||||
$tab_widget->set_cell_attribute('@body','height',$cell['height']);
|
||||
$tab_widget->set_cell_attribute('@body','size',count($names));
|
||||
$tab_widget->set_cell_attribute('@body','class',$cell['class']);
|
||||
foreach($names as $n => $name)
|
||||
{
|
||||
$bcell = $tab_widget->empty_cell();
|
||||
$bcell['type'] = 'template';
|
||||
$bcell['obj'] = new etemplate($name,$tmpl->as_array());
|
||||
$bcell['name'] = $name;
|
||||
$tab_widget->set_cell_attribute('@body',$n+1,$bcell);
|
||||
}
|
||||
$tab_widget->set_cell_attribute('@body','name',$cell['name']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$stab = new etemplate($selected_tab,$tmpl->as_array());
|
||||
$options = array_pad(explode(',',$stab->size),3,'');
|
||||
$options[3] = ($options[3]!= '' ? $options[3].' ':'') . 'tab_body';
|
||||
$stab->size = implode(',',$options);
|
||||
$tab_widget->set_cell_attribute('@body','obj',$stab);
|
||||
}
|
||||
$tab_widget->set_cell_attribute('@body','name',$selected_tab);
|
||||
|
||||
$cell['type'] = 'template';
|
||||
|
@ -55,7 +55,7 @@
|
||||
|
||||
list($a,$b,$c,$d) = explode('.',$GLOBALS['phpgw_info']['server']['versions']['phpgwapi']);
|
||||
//echo "Version: $a.$b.$c.$d\n";
|
||||
$this->stable = $a <= 0 && $b <= 9 && $c <= 14;
|
||||
$this->stable = $a <= 0 && $b <= 9 && $c <= 14 && !is_object($GLOBALS['phpgw']->xslttpl);
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -152,6 +152,7 @@
|
||||
'extension_data' => $GLOBALS['phpgw_info']['etemplate']['extension_data'],
|
||||
'to_process' => $GLOBALS['phpgw_info']['etemplate']['to_process'],
|
||||
'java_script' => $GLOBALS['phpgw_info']['etemplate']['java_script'],
|
||||
'dom_enabled' => $GLOBALS['phpgw_info']['etemplate']['dom_enabled'],
|
||||
'method' => $method,
|
||||
'hooked' => $hooked
|
||||
),$id);
|
||||
@ -193,6 +194,7 @@
|
||||
$this->init($session_data);
|
||||
$GLOBALS['phpgw_info']['etemplate']['extension_data'] = $session_data['extension_data'];
|
||||
$GLOBALS['phpgw_info']['etemplate']['java_script'] = $session_data['java_script'] || $GLOBALS['HTTP_POST_VARS']['java_script'];
|
||||
$GLOBALS['phpgw_info']['etemplate']['dom_enabled'] = $session_data['dom_enabled'] || $GLOBALS['HTTP_POST_VARS']['dom_enabled'];
|
||||
//echo "globals[java_script] = '".$GLOBALS['phpgw_info']['etemplate']['java_script']."', session_data[java_script] = '".$session_data['java_script']."', HTTP_POST_VARS[java_script] = '".$GLOBALS['HTTP_POST_VARS']['java_script']."'\n";
|
||||
//echo "process_exec($this->name) content ="; _debug_array($content);
|
||||
$this->process_show($content,$session_data['to_process'],'exec');
|
||||
@ -345,7 +347,24 @@
|
||||
else
|
||||
{
|
||||
$cell = &$cols[$c_key];
|
||||
list(,$col_disabled) = explode(',',$opts[$col]);
|
||||
list($col_width,$col_disabled) = explode(',',$opts[$col]);
|
||||
|
||||
if (!$cell['height']) // if not set, cell-height = height of row
|
||||
{
|
||||
$cell['height'] = $height;
|
||||
}
|
||||
if (!$cell['width']) // if not set, cell-width = width of column or table
|
||||
{
|
||||
list($col_span) = explode(',',$cell['span']);
|
||||
if ($col_span == 'all' && !$c)
|
||||
{
|
||||
list($cell['width']) = explode(',',$this->size);
|
||||
}
|
||||
else
|
||||
{
|
||||
$cell['width'] = $col_width;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($cell['type'] == 'template' && $cell['onchange'])
|
||||
{
|
||||
@ -362,6 +381,15 @@
|
||||
unset($row_data[$col]); // omit empty/disabled cells if only one row
|
||||
continue;
|
||||
}
|
||||
if ($cell['onclick']) // can only be set via source at the moment
|
||||
{
|
||||
$row_data[".$col"] .= ' onClick="'.$cell['onclick'].'"';
|
||||
|
||||
if ($cell['id'])
|
||||
{
|
||||
$row_data[".$col"] .= ' ID="'.$cell['id'].'"';
|
||||
}
|
||||
}
|
||||
$colspan = $span == 'all' ? $this->cols-$c : 0+$span;
|
||||
if ($colspan > 1)
|
||||
{
|
||||
@ -478,7 +506,7 @@
|
||||
$options .= " onMouseOut=\"self.status=''; return true;\"";
|
||||
}
|
||||
}
|
||||
if ($cell['onchange'] && $cell['type'] != 'button') // values != '1' can only set by a program (not in the editor so far)
|
||||
if ($cell['onchange'] && $cell['type'] != 'button') // values != '1' can only set by a program (not in the editor so fa
|
||||
{
|
||||
$options .= ' onChange="'.($cell['onchange']=='1'?'this.form.submit();':$cell['onchange']).'"';
|
||||
}
|
||||
@ -576,20 +604,28 @@
|
||||
break;
|
||||
case 'button':
|
||||
list($app) = explode('.',$this->name);
|
||||
if ($this->java_script() && $cell['onchange'])
|
||||
if ($this->java_script() && $cell['onchange'] != '') // use a link instead of a button
|
||||
{
|
||||
$html .= $this->html->input_hidden($form_name,'',False) . "\n";
|
||||
$html .= '<a href="" onClick="set_element(document.eTemplate,\''.$form_name.'\',\'pressed\'); document.eTemplate.submit(); return false;" '.$options.'>' .
|
||||
(strlen($label) <= 1 || $cell['no_lang'] ? $label : lang($label)) . '</a>';
|
||||
if ($cell['onchange'] == 1)
|
||||
{
|
||||
$html .= $this->html->input_hidden($form_name,'',False) . "\n";
|
||||
$html .= '<a href="" onClick="set_element(document.eTemplate,\''.$form_name.'\',\'pressed\'); document.eTemplate.submit(); return false;" '.$options.'>' .
|
||||
(strlen($label) <= 1 || $cell['no_lang'] ? $label : lang($label)) . '</a>';
|
||||
}
|
||||
else // use custom javascript
|
||||
{
|
||||
$html .= '<a href="" onClick="'.$cell['onchange'].'; return false;" '.$options.'>' .
|
||||
(strlen($label) <= 1 || $cell['no_lang'] ? $label : lang($label)) . '</a>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
list($img,$ro_img) = explode(',',$cell['size']);
|
||||
if (!empty($img))
|
||||
if (!empty($img))
|
||||
{
|
||||
$options .= ' TITLE="'.(strlen($label)<=1||$cell['no_lang']?$label:lang($label)).'"';
|
||||
}
|
||||
$html .= !$readonly ? $this->html->submit_button($form_name,$label,'',
|
||||
$html .= !$readonly ? $this->html->submit_button($form_name,$label,$cell['onchange'],
|
||||
strlen($label) <= 1 || $cell['no_lang'],$options,$img,$app) :
|
||||
$this->html->image($app,$ro_img);
|
||||
}
|
||||
@ -758,6 +794,40 @@
|
||||
"\n\n<!-- END $cell[type] -->\n\n";
|
||||
}
|
||||
break;
|
||||
case 'deck':
|
||||
for ($n = 1; $n <= $cell['size'] && (empty($value) || $value != $cell[$n]['name']); ++$n) ;
|
||||
if ($n > $cell['size'])
|
||||
{
|
||||
$value = $cell[1]['name'];
|
||||
}
|
||||
if ($s_width = $cell['width'])
|
||||
{
|
||||
$s_width = "width: $s_width".(substr($s_width,-1) != '%' ? 'px' : '').';';
|
||||
}
|
||||
if ($s_height = $cell['height'])
|
||||
{
|
||||
$s_height = "height: $s_height".(substr($s_height,-1) != '%' ? 'px' : '').';';
|
||||
}
|
||||
for ($n = 1; $n <= $cell['size']; ++$n)
|
||||
{
|
||||
$h = $this->show_cell($cell[$n],$content,$sel_options,$readonlys,$cname,$show_c,$show_row,$nul);
|
||||
$vis = !empty($value) && $value == $cell['size'][$n]['name'] || $n == 1 && $first ? 'visible' : 'hidden';
|
||||
list (,$cl) = explode(',',$cell[$n]['span']);
|
||||
$html .= $this->html->div($h,$this->html->formatOptions(array(
|
||||
$cl.($cl ? ' ':'').'tab_body',
|
||||
"$s_width $s_height position: absolute; left: 0px; top: 0px; visibility: $vis; z-index: 50;",
|
||||
$cell[$n]['name']
|
||||
),'CLASS,STYLE,ID'));
|
||||
}
|
||||
$html .= $this->html->input_hidden($form_name,$value); // to store active plane
|
||||
|
||||
list (,$cl) = explode(',',$cell['span']);
|
||||
$html = $this->html->input_hidden($form_name,$value)."\n". // to store active plane
|
||||
$this->html->div($html,$this->html->formatOptions(array(
|
||||
$cl,
|
||||
"$s_width $s_height position: relative; z-index: 100;"
|
||||
),'CLASS,STYLE'));
|
||||
break;
|
||||
default:
|
||||
if ($ext_type && $this->haveExtension($ext_type,'render'))
|
||||
{
|
||||
@ -786,9 +856,9 @@
|
||||
$label = str_replace('&'.$accesskey[1],'<u>'.$accesskey[1].'</u>',$label);
|
||||
$label = $this->html->label($label,$form_name,$accesskey[1]);
|
||||
}
|
||||
if (strstr($label,'%s'))
|
||||
if ($type == 'radio' || strstr($label,'%s')) // default for radio is label after the button
|
||||
{
|
||||
$html = str_replace('%s',$html,$label);
|
||||
$html = strstr($label,'%s') ? str_replace('%s',$html,$label) : $html.' '.$label;
|
||||
}
|
||||
elseif (($html = $label . ' ' . $html) == ' ')
|
||||
{
|
||||
@ -924,7 +994,7 @@
|
||||
@author ralfbecker
|
||||
@abstract is javascript enabled?
|
||||
@discussion this should be tested by the api at login
|
||||
@result true if javascript is enabled or not yet tested
|
||||
@result true if javascript is enabled or not yet tested and $consider_not_tested_as_enabled
|
||||
*/
|
||||
function java_script($consider_not_tested_as_enabled = True)
|
||||
{
|
||||
@ -947,6 +1017,9 @@
|
||||
{
|
||||
$js = '<script language="javascript">
|
||||
document.write(\''.str_replace("\n",'',$this->html->input_hidden('java_script','1')).'\');
|
||||
if (document.getElementById) {
|
||||
document.write(\''.str_replace("\n",'',$this->html->input_hidden('dom_enabled','1')).'\');
|
||||
}
|
||||
</script>
|
||||
';
|
||||
}
|
||||
@ -954,10 +1027,10 @@ document.write(\''.str_replace("\n",'',$this->html->input_hidden('java_script','
|
||||
// here are going all the necesarry functions if javascript is enabled
|
||||
if ($this->java_script(True))
|
||||
{
|
||||
$js .= '<script language="JavaScript">
|
||||
$js .= "<script language=\"JavaScript\">
|
||||
function set_element(form,name,value)
|
||||
{
|
||||
'. /* ' alert("set_element: "+name+"="+value);'. */ '
|
||||
". /* " alert('set_element: '+name+'='+value);". */ "
|
||||
for (i = 0; i < form.length; i++)
|
||||
{
|
||||
if (form.elements[i].name == name)
|
||||
@ -969,7 +1042,7 @@ function set_element(form,name,value)
|
||||
|
||||
function set_element2(form,name,vname)
|
||||
{
|
||||
'. /* ' alert("set_element2: "+name+"="+vname);'. */ '
|
||||
". /* " alert('set_element2: '+name+'='+vname);". */ "
|
||||
for (i = 0; i < form.length; i++)
|
||||
{
|
||||
if (form.elements[i].name == vname)
|
||||
@ -977,7 +1050,7 @@ function set_element2(form,name,vname)
|
||||
value = form.elements[i].value;
|
||||
}
|
||||
}
|
||||
'. /* ' alert("set_element2: "+name+"="+value);'. */ '
|
||||
". /* " alert('set_element2: '+name+'='+value);". */ "
|
||||
for (i = 0; i < form.length; i++)
|
||||
{
|
||||
if (form.elements[i].name == name)
|
||||
@ -986,8 +1059,29 @@ function set_element2(form,name,vname)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user