mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-06-25 12:22:25 +02:00
fixed not working default for checkboxes of "No"="0" and displaying sections now with class="th" and colspan="2"
This commit is contained in:
parent
221a2d4eb6
commit
ce781ca666
@ -14,6 +14,10 @@
|
||||
class uisettings
|
||||
{
|
||||
var $public_functions = array('index' => True);
|
||||
/**
|
||||
* Instance of Template class
|
||||
* @var Template
|
||||
*/
|
||||
var $t;
|
||||
var $list_shown = False;
|
||||
var $show_help;
|
||||
@ -98,14 +102,15 @@
|
||||
$forced = get_var('forced',Array('POST'));
|
||||
$default = get_var('default',Array('POST'));
|
||||
|
||||
$this->t =& CreateObject('phpgwapi.Template',$GLOBALS['egw']->common->get_tpl_dir('preferences'));
|
||||
$this->t = new Template(common::get_tpl_dir('preferences'));
|
||||
$this->t->set_file(array(
|
||||
'preferences' => 'preferences.tpl'
|
||||
));
|
||||
$this->t->set_block('preferences','list','lists');
|
||||
$this->t->set_block('preferences','row','rowhandle');
|
||||
$this->t->set_block('preferences','help_row','help_rowhandle');
|
||||
$this->t->set_var(array('rowhandle' => '','help_rowhandle' => '','messages' => ''));
|
||||
$this->t->set_block('preferences','section_row','section_rowhandle');
|
||||
$this->t->set_var(array('rowhandle' => '','help_rowhandle' => '','messages' => '', 'section_rowhandle'));
|
||||
|
||||
$this->prefix = get_var('prefix',array('GET'),$this->bo->session_data['appname'] == $_GET['appname'] ? $this->bo->session_data['prefix'] : '');
|
||||
|
||||
@ -215,7 +220,7 @@
|
||||
$this->create_section($valarray['title']);
|
||||
break;
|
||||
case 'subsection':
|
||||
$this->create_subsection($valarray['title']);
|
||||
$this->create_section($valarray['title'],'prefSubSection');
|
||||
break;
|
||||
case 'input':
|
||||
$this->create_input_box(
|
||||
@ -459,7 +464,7 @@
|
||||
}
|
||||
if(isset($this->bo->prefs[$name]))
|
||||
{
|
||||
$this->bo->prefs[$name] = (int)(!!$this->bo->prefs[$name]); // to care for '' and 'True'
|
||||
$this->bo->prefs[$name] = (string)(int)(!!$this->bo->prefs[$name]); // to care for '' and 'True'
|
||||
}
|
||||
|
||||
return $this->create_select_box($label,$name,array(
|
||||
@ -482,24 +487,14 @@
|
||||
return $s;
|
||||
}
|
||||
|
||||
/* for creating different sections with a title */
|
||||
function create_section($title='')
|
||||
/**
|
||||
* Create different sections with a title
|
||||
*/
|
||||
function create_section($title='',$span_class='prefSection')
|
||||
{
|
||||
$this->t->set_var('row_value','');
|
||||
$this->t->set_var('row_name','<span class="prefSection">'.lang($title).'</span>');
|
||||
$GLOBALS['egw']->nextmatchs->template_alternate_row_color($this->t);
|
||||
$this->t->set_var('title','<span class="'.$span_class.'">'.lang($title).'</span>');
|
||||
|
||||
$this->t->fp('rows',$this->process_help($help) ? 'help_row' : 'row',True);
|
||||
}
|
||||
|
||||
/* for creating different sections with a title */
|
||||
function create_subsection($title='')
|
||||
{
|
||||
$this->t->set_var('row_value','');
|
||||
$this->t->set_var('row_name','<span class="prefSubSection">'.lang($title).'</span>');
|
||||
$GLOBALS['egw']->nextmatchs->template_alternate_row_color($this->t);
|
||||
|
||||
$this->t->fp('rows',$this->process_help($help) ? 'help_row' : 'row',True);
|
||||
$this->t->fp('rows','section_row',True);
|
||||
}
|
||||
|
||||
function create_select_box($label,$name,$values,$help='',$default='',$run_lang=True,$multiple=false)
|
||||
@ -540,7 +535,7 @@
|
||||
$select = html::input_hidden($GLOBALS['type'].'['.$name.']','',false); // causes bosettings not to ignore unsetting all
|
||||
$select .= html::checkbox_multiselect($GLOBALS['type'].'['.$name.']',$default,$values,true,'',5);
|
||||
}
|
||||
if($GLOBALS['type'] == 'user' && $GLOBALS['egw']->preferences->default[$_appname][$name])
|
||||
if($GLOBALS['type'] == 'user' && (string)$GLOBALS['egw']->preferences->default[$_appname][$name] !== '')
|
||||
{
|
||||
// flatten values first (some selectbox values are given multi-dimensional)
|
||||
foreach($values as $id => $val)
|
||||
|
49
preferences/templates/default/preferences.tpl
Normal file
49
preferences/templates/default/preferences.tpl
Normal file
@ -0,0 +1,49 @@
|
||||
<center><b>{messages}</b></center>
|
||||
|
||||
<!-- BEGIN form -->
|
||||
<form method="POST" action="{action_url}">
|
||||
|
||||
<table border="0">
|
||||
<tr>
|
||||
<td colspan="2">{tabs}</td>
|
||||
</tr>
|
||||
|
||||
<!-- BEGIN list -->
|
||||
{rows}
|
||||
<!-- END list -->
|
||||
|
||||
<tr height="30" valign="bottom">
|
||||
<td align="left">
|
||||
<input type="submit" name="save" value="{lang_save}">
|
||||
<input type="submit" name="apply" value="{lang_apply}">
|
||||
<input type="submit" name="cancel" value="{lang_cancel}">
|
||||
</td>
|
||||
<td align="right"> {help_button}</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</form>
|
||||
<!-- END form -->
|
||||
|
||||
<!-- BEGIN row -->
|
||||
<tr bgcolor="{tr_color}">
|
||||
<td>{row_name}</td>
|
||||
<td>{row_value}</td>
|
||||
</tr>
|
||||
<!-- END row -->
|
||||
|
||||
<!-- BEGIN help_row -->
|
||||
<tr bgcolor="{tr_color}">
|
||||
<td><b>{row_name}<b></td>
|
||||
<td>{row_value}</td>
|
||||
</tr>
|
||||
<tr bgcolor="{tr_color}">
|
||||
<td colspan="2">{help_value}</td>
|
||||
</tr>
|
||||
<!-- END help_row -->
|
||||
|
||||
<!-- BEGIN section_row -->
|
||||
<tr class="th">
|
||||
<td colspan="2"><b>{title}</b></td>
|
||||
</tr>
|
||||
<!-- END section_row -->
|
Loading…
x
Reference in New Issue
Block a user