mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-22 07:53:39 +01:00
update preferences: helptexts
This commit is contained in:
parent
99094a97a4
commit
8e6837762a
@ -23,22 +23,41 @@
|
||||
$_themes[$value] = $value;
|
||||
}
|
||||
|
||||
create_input_box('Max matches per page','maxmatchs');
|
||||
create_select_box('Interface/Template Selection','template_set',$_templates);
|
||||
create_select_box('Theme (colors/fonts) Selection','theme',$_themes);
|
||||
create_input_box('Max matches per page','maxmatchs',
|
||||
'Any listing in phpGW will show you this number or entries or lines per page.<br>
|
||||
To many slow down the page display, to less will cost you the overview.',15,3);
|
||||
create_select_box('Interface/Template Selection','template_set',$_templates,
|
||||
'A template defines the layout of phpGroupWare and it contains icons vor each application.');
|
||||
create_select_box('Theme (colors/fonts) Selection','theme',$_themes,
|
||||
'A theme defines the colors and fonts used by the template.');
|
||||
|
||||
$navbar_format = array(
|
||||
'icons' => lang('Icons only'),
|
||||
'icons_and_text' => lang('Icons and text'),
|
||||
'text' => lang('Text only')
|
||||
);
|
||||
create_select_box('Show navigation bar as','navbar_format',$navbar_format);
|
||||
create_select_box('Show navigation bar as','navbar_format',$navbar_format,
|
||||
'You can show the applications as icons only, icons with app-name or both.');
|
||||
|
||||
$format = $GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
|
||||
$format = ($format ? $format : 'Y/m/d') . ', ';
|
||||
if ($GLOBALS['phpgw_info']['user']['preferences']['common']['timeformat'] == '12')
|
||||
{
|
||||
$format .= 'h:i a';
|
||||
}
|
||||
else
|
||||
{
|
||||
$format .= 'H:i';
|
||||
}
|
||||
for ($i = -23; $i<24; $i++)
|
||||
{
|
||||
$tz_offset[$i] = $i;
|
||||
$t = time() + $i * 60*60;
|
||||
$tz_offset[$i] = $i . ' ' . lang('hours').': ' . date($format,$t);
|
||||
}
|
||||
create_select_box('Time zone offset','tz_offset',$tz_offset);
|
||||
create_select_box('Time zone offset','tz_offset',$tz_offset,
|
||||
'How many hours are you in front or after the timezone of the server.<br>
|
||||
If you are in the same time zone as the server select 0 hours,
|
||||
else select your locale date and time.',0);
|
||||
|
||||
$date_formats = array(
|
||||
'm/d/Y' => 'm/d/Y',
|
||||
@ -54,16 +73,19 @@
|
||||
'd-m-Y' => 'd-m-Y',
|
||||
'd.m.Y' => 'd.m.Y'
|
||||
);
|
||||
create_select_box('Date format','dateformat',$date_formats);
|
||||
create_select_box('Date format','dateformat',$date_formats,
|
||||
'How should phpGroupWare display dates for you.');
|
||||
|
||||
$time_formats = array(
|
||||
'12' => lang('12 hour'),
|
||||
'24' => lang('24 hour')
|
||||
);
|
||||
create_select_box('Time format','timeformat',$time_formats);
|
||||
create_select_box('Time format','timeformat',$time_formats,
|
||||
'Do you prefer a 24 hour time format, or a 12 hour one with am/pm attached.');
|
||||
|
||||
$sbox = createobject('phpgwapi.sbox');
|
||||
create_select_box('Country','country',$sbox->country_array);
|
||||
create_select_box('Country','country',$sbox->country_array,
|
||||
'In which country are you. This is used to set certain defaults for you.');
|
||||
|
||||
$db2 = $GLOBALS['phpgw']->db;
|
||||
$GLOBALS['phpgw']->db->query("select distinct lang from phpgw_lang",__LINE__,__FILE__);
|
||||
@ -90,17 +112,15 @@
|
||||
$langs[$key] = $trans;
|
||||
}
|
||||
}
|
||||
create_select_box('Language','lang',$langs);
|
||||
|
||||
create_select_box('Language','lang',$langs,
|
||||
'Select the language of texts and messages within phpGroupWare.<br>
|
||||
Some languages may not contain all messages, in that case you will see an english message.');
|
||||
|
||||
// preference.php handles this function
|
||||
if (is_admin())
|
||||
{
|
||||
// The 'True' is *NOT* being used as a constant, don't change it
|
||||
$yes_and_no = array(
|
||||
'True' => lang('Yes'),
|
||||
'' => lang('No')
|
||||
);
|
||||
create_select_box('Show current users on navigation bar','show_currentusers',$yes_and_no);
|
||||
create_check_box('Show current users on navigation bar','show_currentusers',
|
||||
'Should the number of active sessions be displayed for you all the time.');
|
||||
}
|
||||
|
||||
reset($GLOBALS['phpgw_info']['user']['apps']);
|
||||
@ -111,6 +131,14 @@
|
||||
$user_apps[$app] = $GLOBALS['phpgw_info']['apps'][$app]['title'] ? $GLOBALS['phpgw_info']['apps'][$app]['title'] : lang($app);
|
||||
}
|
||||
}
|
||||
create_select_box('Default application','default_app',$user_apps);
|
||||
create_select_box('Default application','default_app',$user_apps,
|
||||
"This is the application which will be started when you enter phpGroupWare or click on the homepage icon.<br>
|
||||
You can also have more than one applications showing up on the homepage, if you don't
|
||||
choose a specific application here (has to be configured in the preferences of
|
||||
each applicaton).");
|
||||
|
||||
create_input_box('Currency','currency');
|
||||
create_input_box('Currency','currency',
|
||||
'Which currency symbole or name should be used in phpGroupWare.');
|
||||
|
||||
create_check_box('Show helpmessages by default','show_help',
|
||||
'Should the help messages always be shown when you enter the preferences or only on request.');
|
||||
|
@ -11,62 +11,55 @@
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
$user = (@isset($GLOBALS['HTTP_POST_VARS']['user'])?$GLOBALS['HTTP_POST_VARS']['user']:'');
|
||||
$forced = (@isset($GLOBALS['HTTP_POST_VARS']['forced'])?$GLOBALS['HTTP_POST_VARS']['forced']:'');
|
||||
$default = (@isset($GLOBALS['HTTP_POST_VARS']['default'])?$GLOBALS['HTTP_POST_VARS']['default']:'');
|
||||
|
||||
$GLOBALS['phpgw_info']['flags'] = array(
|
||||
'noheader' => True,
|
||||
'noappheader' => True,
|
||||
'nonavbar' => True,
|
||||
'currentapp' => $GLOBALS['HTTP_GET_VARS']['appname'],
|
||||
'currentapp' => $_GET['appname'],
|
||||
'enable_nextmatchs_class' => True
|
||||
);
|
||||
include('../header.inc.php');
|
||||
|
||||
|
||||
if ($_POST['cancel'])
|
||||
{
|
||||
$GLOBALS['phpgw']->redirect_link('/preferences/index.php');
|
||||
}
|
||||
|
||||
$user = get_var('user',Array('POST'));
|
||||
$forced = get_var('forced',Array('POST'));
|
||||
$default = get_var('default',Array('POST'));
|
||||
|
||||
$GLOBALS['appname'] = get_var('appname',Array('GET'));
|
||||
|
||||
if(get_var('cancel',Array('POST')))
|
||||
{
|
||||
Header('Location: ' . $GLOBALS['phpgw']->link('/preferences/index.php'));
|
||||
}
|
||||
|
||||
$t = CreateObject('phpgwapi.Template',$GLOBALS['phpgw']->common->get_tpl_dir('preferences'));
|
||||
$t->set_file(array(
|
||||
'_preferences' => 'preferences.tpl'
|
||||
'preferences' => 'preferences.tpl'
|
||||
));
|
||||
$t->set_block('_preferences','list');
|
||||
$t->set_block('_preferences','row');
|
||||
|
||||
$t->set_block('_preferences','header');
|
||||
$t->set_block('_preferences','footer');
|
||||
$t->set_block('_preferences','row_error');
|
||||
|
||||
if ($GLOBALS['HTTP_GET_VARS']['appname'] != 'preverences')
|
||||
$t->set_block('preferences','list','lists');
|
||||
$t->set_block('preferences','row','rowhandle');
|
||||
$t->set_block('preferences','help_row','help_rowhandle');
|
||||
$t->set_var(array('rowhandle' => '','help_rowhandle' => '','messages' => ''));
|
||||
|
||||
if ($_GET['appname'] != 'preverences')
|
||||
{
|
||||
$GLOBALS['phpgw']->translation->add_app('preferences'); // we need the prefs translations too
|
||||
}
|
||||
|
||||
/* Make things a little easier to follow */
|
||||
/* Some places we will need to change this if there in common */
|
||||
function check_app()
|
||||
{
|
||||
if ($GLOBALS['appname'] == 'preferences')
|
||||
if ($_GET['appname'] == 'preferences')
|
||||
{
|
||||
return 'common';
|
||||
}
|
||||
else
|
||||
{
|
||||
return $GLOBALS['appname'];
|
||||
return $_GET['appname'];
|
||||
}
|
||||
}
|
||||
|
||||
function is_forced_value($_appname,$preference_name)
|
||||
{
|
||||
if ($GLOBALS['gp']->data[$_appname][$preference_name] && $GLOBALS['type'] != 'forced')
|
||||
if (isset($GLOBALS['gp']->data[$_appname][$preference_name]) && $GLOBALS['type'] != 'forced')
|
||||
{
|
||||
return True;
|
||||
}
|
||||
@ -76,60 +69,89 @@
|
||||
}
|
||||
}
|
||||
|
||||
function create_input_box($label_name,$preference_name,$size = '',$max_size = '')
|
||||
function create_password_box($label_name,$preference_name,$help='',$size = '',$max_size = '')
|
||||
{
|
||||
global $t;
|
||||
|
||||
global $user,$forced,$default;
|
||||
|
||||
$_appname = check_app();
|
||||
$GLOBALS['phpgw']->nextmatchs->template_alternate_row_color($t);
|
||||
$t->set_var('row_name',lang($label_name));
|
||||
|
||||
if (is_forced_value($_appname,$preference_name))
|
||||
{
|
||||
return True;
|
||||
}
|
||||
create_input_box($label_name,$preference_name.'][pw',$help,'',$size,$max_size,'password');
|
||||
}
|
||||
|
||||
function create_input_box($label,$name,$help='',$default='',$size = '',$max_size = '',$type='')
|
||||
{
|
||||
global $t,$prefs;
|
||||
|
||||
switch ($GLOBALS['type'])
|
||||
$_appname = check_app();
|
||||
if (is_forced_value($_appname,$name))
|
||||
{
|
||||
case 'user':
|
||||
$s = '<input name="user[' . $preference_name . ']" value="' . $GLOBALS['phpgw_info']['user']['preferences'][$_appname][$preference_name] . '">';
|
||||
break;
|
||||
case 'default':
|
||||
$s = '<input name="default[' . $preference_name . ']" value="' . $GLOBALS['dp']->data[$_appname][$preference_name] . '">';
|
||||
break;
|
||||
case 'forced':
|
||||
$s = '<input name="forced[' . $preference_name . ']" value="' . $GLOBALS['gp']->data[$_appname][$preference_name] . '">';
|
||||
break;
|
||||
return True;
|
||||
}
|
||||
$t->set_var('row_value',$s);
|
||||
|
||||
$t->fp('rows','row',True);
|
||||
if ($type) // used to specify password
|
||||
{
|
||||
$options = " TYPE='$type'";
|
||||
}
|
||||
if ($size)
|
||||
{
|
||||
$options .= " SIZE='$size'";
|
||||
}
|
||||
if ($maxsize)
|
||||
{
|
||||
$options .= " MAXSIZE='$maxsize'";
|
||||
}
|
||||
|
||||
if (isset($prefs[$name]) || $GLOBALS['type'] != 'user')
|
||||
{
|
||||
$default = $prefs[$name];
|
||||
}
|
||||
|
||||
$t->set_var('row_value',"<input name=\"${GLOBALS[type]}[$name]\" value=\"$default\"$options>");
|
||||
$t->set_var('row_name',lang($label));
|
||||
$GLOBALS['phpgw']->nextmatchs->template_alternate_row_color($t);
|
||||
|
||||
$t->fp('rows',process_help($help) ? 'help_row' : 'row',True);
|
||||
}
|
||||
|
||||
function process_help($help)
|
||||
{
|
||||
global $t,$show_help,$has_help;
|
||||
|
||||
if (!empty($help))
|
||||
{
|
||||
$has_help = True;
|
||||
|
||||
if ($show_help)
|
||||
{
|
||||
$t->set_var('help_value',lang($help));
|
||||
|
||||
return True;
|
||||
}
|
||||
}
|
||||
return False;
|
||||
}
|
||||
|
||||
function create_check_box($label_name,$preference_name)
|
||||
function create_check_box($label,$name,$help='',$default='')
|
||||
{
|
||||
global $t;
|
||||
|
||||
if ($GLOBALS['type'] != 'user') // for default and forced we need a 3. setting
|
||||
// checkboxes itself can't be use as they return nothing if uncheckt !!!
|
||||
global $prefs;
|
||||
|
||||
if ($GLOBALS['type'] != 'user')
|
||||
{
|
||||
return create_select_box($label_name,$preference_name,array(
|
||||
'0' => lang('No'),
|
||||
'1' => lang('Yes')
|
||||
));
|
||||
$default = ''; // no defaults for default or forced prefs
|
||||
}
|
||||
$_appname = check_app();
|
||||
$GLOBALS['phpgw']->nextmatchs->template_alternate_row_color($t);
|
||||
$t->set_var('row_name',lang($label_name));
|
||||
|
||||
if (is_forced_value($_appname,$preference_name))
|
||||
if (isset($prefs[$name]))
|
||||
{
|
||||
return True;
|
||||
$prefs[$name] = intval(!!$prefs[$name]); // to care for '' and 'True'
|
||||
}
|
||||
|
||||
$s = '<input type="checkbox" name="user[' . $preference_name . ']" value="1"' . ($GLOBALS['phpgw_info']['user']['preferences'][$_appname][$preference_name] ? ' CHECKED' : '') . '">';
|
||||
$t->set_var('row_value',$s);
|
||||
|
||||
$t->fp('rows','row',True);
|
||||
|
||||
return create_select_box($label,$name,array(
|
||||
'0' => lang('No'),
|
||||
'1' => lang('Yes')
|
||||
),$help,$default);
|
||||
}
|
||||
|
||||
function create_option_string($selected,$values)
|
||||
@ -137,7 +159,7 @@
|
||||
while (is_array($values) && list($var,$value) = each($values))
|
||||
{
|
||||
$s .= '<option value="' . $var . '"';
|
||||
if ($var == $selected)
|
||||
if ("$var" == "$selected") // the "'s are necessary to force a string-compare
|
||||
{
|
||||
$s .= ' selected';
|
||||
}
|
||||
@ -146,70 +168,61 @@
|
||||
return $s;
|
||||
}
|
||||
|
||||
function create_select_box($label_name,$preference_name,$values)
|
||||
function create_select_box($label,$name,$values,$help='',$default='')
|
||||
{
|
||||
global $t;
|
||||
global $t,$prefs;
|
||||
|
||||
$_appname = check_app();
|
||||
if (is_forced_value($_appname,$preference_name))
|
||||
if (is_forced_value($_appname,$name))
|
||||
{
|
||||
return True;
|
||||
}
|
||||
|
||||
$GLOBALS['phpgw']->nextmatchs->template_alternate_row_color($t);
|
||||
|
||||
$t->set_var('row_name',lang($label_name));
|
||||
|
||||
if (isset($prefs[$name]) || $GLOBALS['type'] != 'user')
|
||||
{
|
||||
$default = $prefs[$name];
|
||||
}
|
||||
|
||||
switch ($GLOBALS['type'])
|
||||
{
|
||||
case 'user':
|
||||
$s = '<option value="">' . lang('Select one') . '</option>'
|
||||
. create_option_string($GLOBALS['phpgw_info']['user']['preferences'][$_appname][$preference_name],$values);
|
||||
$t->set_var('row_value','<select name="user[' . $preference_name . ']">' . $s . '</select>');
|
||||
$s = '<option value="">' . lang('Select one') . '</option>';
|
||||
break;
|
||||
case 'default':
|
||||
$s = '<option value="">' . lang('Select one') . '</option>'
|
||||
. create_option_string($GLOBALS['dp']->data[$_appname][$preference_name],$values);
|
||||
$t->set_var('row_value','<select name="default[' . $preference_name . ']">' . $s . '</select>');
|
||||
$s = '<option value="">' . lang('Select one') . '</option>';
|
||||
break;
|
||||
case 'forced':
|
||||
$s = '<option value="**NULL**">' . lang('Users choice') . '</option>'
|
||||
. create_option_string($GLOBALS['gp']->data[$_appname][$preference_name],$values);
|
||||
$t->set_var('row_value','<select name="forced[' . $preference_name . ']">' . $s . '</select>');
|
||||
$s = '<option value="**NULL**">' . lang('Users choice') . '</option>';
|
||||
break;
|
||||
}
|
||||
$s .= create_option_string($default,$values);
|
||||
$t->set_var('row_value',"<select name=\"${GLOBALS[type]}[$name]\">$s</select>");
|
||||
$t->set_var('row_name',lang($label));
|
||||
$GLOBALS['phpgw']->nextmatchs->template_alternate_row_color($t);
|
||||
|
||||
$t->fp('rows','row',True);
|
||||
$t->fp('rows',process_help($help) ? 'help_row' : 'row',True);
|
||||
}
|
||||
|
||||
function create_text_area($label_name,$preference_name,$rows,$cols)
|
||||
function create_text_area($label,$name,$rows,$cols,$help='',$default='')
|
||||
{
|
||||
global $t;
|
||||
global $t,$prefs;
|
||||
|
||||
$_appname = check_app();
|
||||
$GLOBALS['phpgw']->nextmatchs->template_alternate_row_color($t);
|
||||
$t->set_var('row_name',lang($label_name));
|
||||
|
||||
if (is_forced_value($_appname,$preference_name))
|
||||
if (is_forced_value($_appname,$name))
|
||||
{
|
||||
return True;
|
||||
}
|
||||
|
||||
switch ($GLOBALS['type'])
|
||||
|
||||
if (isset($prefs[$name]) || $GLOBALS['type'] != 'user')
|
||||
{
|
||||
case 'user':
|
||||
$s = '<textarea rows="'.$rows.'" cols="'.$cols.'" name="user[' . $preference_name . ']">' . $GLOBALS['phpgw_info']['user']['preferences'][$_appname][$preference_name] . '</textarea>';
|
||||
break;
|
||||
case 'default':
|
||||
$s = '<textarea rows="'.$rows.'" cols="'.$cols.'" name="default[' . $preference_name . ']">' . $GLOBALS['dp']->data[$_appname][$preference_name] . '</textarea>';
|
||||
break;
|
||||
case 'forced':
|
||||
$s = '<textarea rows="'.$rows.'" cols="'.$cols.'" name="forced[' . $preference_name . ']">' . $GLOBALS['gp']->data[$_appname][$preference_name] . '</textarea>';
|
||||
break;
|
||||
$default = $prefs[$name];
|
||||
}
|
||||
$t->set_var('row_value',$s);
|
||||
|
||||
$t->fp('rows','row',True);
|
||||
$t->set_var('row_value',"<textarea rows=\"$rows\" cols=\"$cols\" name=\"${GLOBALS[type]}[$name]\">$default</textarea>");
|
||||
$t->set_var('row_name',lang($label));
|
||||
$GLOBALS['phpgw']->nextmatchs->template_alternate_row_color($t);
|
||||
|
||||
$t->fp('rows',process_help($help) ? 'help_row' : 'row',True);
|
||||
}
|
||||
|
||||
function process_array(&$_p, $array)
|
||||
@ -220,6 +233,14 @@
|
||||
{
|
||||
if (isset($value) && $value != '' && $value != '**NULL**')
|
||||
{
|
||||
if (is_array($value))
|
||||
{
|
||||
$value = $value['pw'];
|
||||
if (empty($value))
|
||||
{
|
||||
continue; // dont write empty password-fields
|
||||
}
|
||||
}
|
||||
$_p->add($_appname,$var,$value);
|
||||
}
|
||||
else
|
||||
@ -230,9 +251,6 @@
|
||||
$_p->save_repository(True);
|
||||
}
|
||||
|
||||
$p = createobject('phpgwapi.preferences');
|
||||
$p->read_repository();
|
||||
|
||||
/* So we can check if the admin is allowing users to make there own choices */
|
||||
/* in life. */
|
||||
$GLOBALS['gp'] = createobject('phpgwapi.preferences',-1);
|
||||
@ -249,7 +267,7 @@
|
||||
/* and is able to create less powerfull admins. This will handle the ACL checks for that (jengo) */
|
||||
function is_admin()
|
||||
{
|
||||
if (HAS_ADMIN_RIGHTS == 1)
|
||||
if (HAS_ADMIN_RIGHTS == 1 && !isset($_GET['prefix'])) // tabs only without prefix
|
||||
{
|
||||
return True;
|
||||
}
|
||||
@ -258,50 +276,46 @@
|
||||
return False;
|
||||
}
|
||||
}
|
||||
|
||||
function show_list($header = ' ')
|
||||
{
|
||||
global $t,$list_shown;
|
||||
|
||||
$t->set_var('list_header',$header);
|
||||
$t->parse('lists','list',$list_shown);
|
||||
|
||||
$t->set_var('rows','');
|
||||
$list_shown = True;
|
||||
}
|
||||
|
||||
$session_data = $GLOBALS['phpgw']->session->appsession('session_data','preferences');
|
||||
|
||||
if (is_admin())
|
||||
{
|
||||
/* This is where we will keep track of our postion. */
|
||||
/* Developers won't have to pass around a variable then */
|
||||
$session_data = $GLOBALS['phpgw']->session->appsession('session_data','preferences');
|
||||
|
||||
if (!($GLOBALS['type'] = get_var('type',Array('GET','POST'))))
|
||||
{
|
||||
$GLOBALS['type'] = is_array($session_data) ? $session_data['type'] : 'user';
|
||||
}
|
||||
$GLOBALS['type'] = get_var('type',Array('GET','POST'),$session_data['type']);
|
||||
|
||||
if (empty($GLOBALS['type']))
|
||||
{
|
||||
$GLOBALS['type'] = 'user';
|
||||
}
|
||||
$GLOBALS['phpgw']->session->appsession('session_data','preferences',array(
|
||||
'type' => $GLOBALS['type']
|
||||
));
|
||||
|
||||
$tabs[] = array(
|
||||
'label' => lang('Your preferences'),
|
||||
'link' => $GLOBALS['phpgw']->link('/preferences/preferences.php','appname=' . $GLOBALS['appname'] . '&type=user')
|
||||
);
|
||||
$tabs[] = array(
|
||||
'label' => lang('Default preferences'),
|
||||
'link' => $GLOBALS['phpgw']->link('/preferences/preferences.php','appname=' . $GLOBALS['appname'] . '&type=default')
|
||||
);
|
||||
$tabs[] = array(
|
||||
'label' => lang('Forced preferences'),
|
||||
'link' => $GLOBALS['phpgw']->link('/preferences/preferences.php','appname=' . $GLOBALS['appname'] . '&type=forced')
|
||||
);
|
||||
|
||||
switch($GLOBALS['type'])
|
||||
{
|
||||
case 'user': $selected = 0; break;
|
||||
case 'default': $selected = 1; break;
|
||||
case 'forced': $selected = 2; break;
|
||||
}
|
||||
$t->set_var('tabs',$GLOBALS['phpgw']->common->create_tabs($tabs,$selected));
|
||||
}
|
||||
else
|
||||
{
|
||||
$GLOBALS['type'] = 'user';
|
||||
}
|
||||
$prefix = get_var('prefix',array('GET'),$session_data['prefix']);
|
||||
|
||||
$show_help = "$session_data[show_help]" != '' ? $session_data['show_help'] :
|
||||
intval($GLOBALS['phpgw_info']['user']['preferences']['common']['show_help']);
|
||||
|
||||
if ($toggle_help = get_var('toggle_help','POST'))
|
||||
{
|
||||
$show_help = intval(!$show_help);
|
||||
}
|
||||
$has_help = 0;
|
||||
|
||||
/* Only load if there working on the default preferences */
|
||||
if ($GLOBALS['type'] == 'default')
|
||||
@ -310,12 +324,12 @@
|
||||
$GLOBALS['dp']->read_repository();
|
||||
}
|
||||
|
||||
if (get_var('submit',Array('POST')))
|
||||
if ($_POST['submit'])
|
||||
{
|
||||
/* Don't use a switch here, we need to check some permissions durring the ifs */
|
||||
if ($GLOBALS['type'] == 'user' || !($GLOBALS['type']))
|
||||
{
|
||||
process_array($p, $user);
|
||||
process_array($GLOBALS['phpgw']->preferences, $user);
|
||||
}
|
||||
|
||||
if ($GLOBALS['type'] == 'default' && is_admin())
|
||||
@ -328,29 +342,56 @@
|
||||
process_array($GLOBALS['gp'], $forced);
|
||||
}
|
||||
|
||||
Header('Location: ' . $GLOBALS['phpgw']->link('/preferences/index.php'));
|
||||
$GLOBALS['phpgw_info']['flags']['nodisplay'] = True;
|
||||
exit;
|
||||
if (!is_admin())
|
||||
{
|
||||
$GLOBALS['phpgw']->redirect_link('/preferences/index.php');
|
||||
}
|
||||
|
||||
if ($GLOBALS['type'] == 'user' && $_GET['appname'] == 'preferences' && $user['show_help'] != '')
|
||||
{
|
||||
$show_help = $user['show_help']; // use it, if admin changes his help-prefs
|
||||
}
|
||||
}
|
||||
$GLOBALS['phpgw']->session->appsession('session_data','preferences',array(
|
||||
'type' => $GLOBALS['type'], // save our state in the app-session
|
||||
'show_help' => $show_help,
|
||||
'prefix' => $prefix
|
||||
));
|
||||
|
||||
$GLOBALS['phpgw']->common->phpgw_header();
|
||||
|
||||
if ($GLOBALS['appname'] == 'preferences')
|
||||
if ($_GET['appname'] == 'preferences')
|
||||
{
|
||||
$t->set_var('lang_title',lang('Preferences'));
|
||||
}
|
||||
else
|
||||
{
|
||||
$t->set_var('lang_title',lang('%1 - Preferences',$GLOBALS['phpgw_info']['apps'][$GLOBALS['HTTP_GET_VARS']['appname']]['title']));
|
||||
$t->set_var('lang_title',lang('%1 - Preferences',$GLOBALS['phpgw_info']['apps'][$_GET['appname']]['title']));
|
||||
}
|
||||
|
||||
$t->set_var('action_url',$GLOBALS['phpgw']->link('/preferences/preferences.php','appname=' . $GLOBALS['appname']));
|
||||
$t->set_var('th_bg', $GLOBALS['phpgw_info']['theme']['th_bg']);
|
||||
$t->set_var('th_text',$GLOBALS['phpgw_info']['theme']['th_text']);
|
||||
$t->set_var('row_on', $GLOBALS['phpgw_info']['theme']['row_on']);
|
||||
$t->set_var('row_off',$GLOBALS['phpgw_info']['theme']['row_off']);
|
||||
$t->set_var('action_url',$GLOBALS['phpgw']->link('/preferences/preferences.php','appname=' . $_GET['appname']));
|
||||
|
||||
if ($GLOBALS['appname'] == 'preferences')
|
||||
switch ($GLOBALS['type']) // set up some globals to be used by the hooks
|
||||
{
|
||||
case 'forced':
|
||||
$prefs = &$GLOBALS['gp']->data[check_app()];
|
||||
break;
|
||||
case 'default':
|
||||
$prefs = &$GLOBALS['dp']->data[check_app()];
|
||||
break;
|
||||
default:
|
||||
$prefs = &$GLOBALS['phpgw']->preferences->data[check_app()];
|
||||
// use prefix if given in the url, used for email extra-accounts
|
||||
if ($_GET['prefix'] != '')
|
||||
{
|
||||
$prefix = explode('/',$_GET['prefix']);
|
||||
foreach ($prefix as $pre)
|
||||
{
|
||||
$prefs = &$prefs[$pre];
|
||||
}
|
||||
}
|
||||
}
|
||||
//echo "prefs=<pre>"; print_r($prefs); echo "</pre>\n";
|
||||
|
||||
if ($_GET['appname'] == 'preferences')
|
||||
{
|
||||
if (! $GLOBALS['phpgw']->hooks->single('settings','preferences',True))
|
||||
{
|
||||
@ -359,7 +400,7 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
if (! $GLOBALS['phpgw']->hooks->single('settings',$GLOBALS['appname']))
|
||||
if (! $GLOBALS['phpgw']->hooks->single('settings',$_GET['appname']))
|
||||
{
|
||||
$error = True;
|
||||
}
|
||||
@ -367,19 +408,46 @@
|
||||
|
||||
if ($error)
|
||||
{
|
||||
$t->set_block('preferences','form','formhandle'); // skip the form
|
||||
$t->set_var('formhandle','');
|
||||
|
||||
$t->set_var('messages',lang('Error: There was a problem finding the preference file for %1 in %2',
|
||||
$GLOBALS['phpgw_info']['navbar'][$GLOBALS['appname']]['title'],PHPGW_SERVER_ROOT . SEP
|
||||
. $GLOBALS['appname'] . SEP . 'inc' . SEP . 'hook_settings.inc.php'));
|
||||
$GLOBALS['phpgw_info']['navbar'][$_GET['appname']]['title'],PHPGW_SERVER_ROOT . SEP
|
||||
. $_GET['appname'] . SEP . 'inc' . SEP . 'hook_settings.inc.php'));
|
||||
}
|
||||
$t->pfp('out','header');
|
||||
|
||||
$t->set_var('lang_submit', lang('submit'));
|
||||
$t->set_var('lang_cancel', lang('cancel'));
|
||||
|
||||
if (! $error)
|
||||
if (is_admin())
|
||||
{
|
||||
$t->pfp('out','list');
|
||||
$t->pfp('out','footer');
|
||||
$tabs[] = array(
|
||||
'label' => lang('Your preferences'),
|
||||
'link' => $GLOBALS['phpgw']->link('/preferences/preferences.php','appname=' . $_GET['appname'] . "&type=user")
|
||||
);
|
||||
$tabs[] = array(
|
||||
'label' => lang('Default preferences'),
|
||||
'link' => $GLOBALS['phpgw']->link('/preferences/preferences.php','appname=' . $_GET['appname'] . "&type=default")
|
||||
);
|
||||
$tabs[] = array(
|
||||
'label' => lang('Forced preferences'),
|
||||
'link' => $GLOBALS['phpgw']->link('/preferences/preferences.php','appname=' . $_GET['appname'] . "&type=forced")
|
||||
);
|
||||
|
||||
switch($GLOBALS['type'])
|
||||
{
|
||||
case 'user': $selected = 0; break;
|
||||
case 'default': $selected = 1; break;
|
||||
case 'forced': $selected = 2; break;
|
||||
}
|
||||
$t->set_var('tabs',$GLOBALS['phpgw']->common->create_tabs($tabs,$selected));
|
||||
}
|
||||
$GLOBALS['phpgw']->common->phpgw_footer();
|
||||
$t->set_var('lang_submit', lang('save'));
|
||||
$t->set_var('lang_cancel', lang('cancel'));
|
||||
$t->set_var('show_help',intval($show_help));
|
||||
$t->set_var('help_button',$has_help ? '<input type="submit" name="toggle_help" value="'.
|
||||
($show_help ? lang('help off') : lang('help')).'">' : '');
|
||||
|
||||
if (!$list_shown)
|
||||
{
|
||||
show_list();
|
||||
}
|
||||
$t->parse('phpgw_body','preferences');
|
||||
?>
|
||||
|
@ -1,40 +1,48 @@
|
||||
<!-- BEGIN header -->
|
||||
<b>{lang_title}</b>
|
||||
<hr><p>
|
||||
|
||||
<center>{messages}</center>
|
||||
|
||||
<table border="0" width="100%" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td>{tabs}</td>
|
||||
</tr>
|
||||
</table>
|
||||
<hr>
|
||||
<br>
|
||||
<center><b>{messages}</b></center>
|
||||
|
||||
<!-- BEGIN form -->
|
||||
<form method="POST" action="{action_url}">
|
||||
<table border="0">
|
||||
|
||||
<!-- END header -->
|
||||
|
||||
<!-- BEGIN footer -->
|
||||
</table>
|
||||
<table border="0" width="70%" cellspacing="5" cellpadding="5">
|
||||
<table border="0">
|
||||
<tr>
|
||||
<td align="left"><input type="submit" name="submit" value="{lang_submit}"></td>
|
||||
<td align="right"><input type="submit" name="cancel" value="{lang_cancel}"></td>
|
||||
<td colspan="2">{tabs}</td>
|
||||
</tr>
|
||||
</table>
|
||||
<!-- END footer -->
|
||||
|
||||
<!-- BEGIN list -->
|
||||
<tr class="th">
|
||||
<td colspan="2"> </td>
|
||||
<td colspan="2"><b>{list_header}</b></td>
|
||||
</tr>
|
||||
{rows}
|
||||
<!-- END list -->
|
||||
|
||||
<tr height="30" valign="bottom">
|
||||
<td align="left">
|
||||
<input type="submit" name="submit" value="{lang_submit}">
|
||||
<input type="submit" name="cancel" value="{lang_cancel}">
|
||||
</td>
|
||||
<td align="right"> {help_button}</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</form>
|
||||
<!-- END form -->
|
||||
|
||||
<!-- BEGIN row -->
|
||||
<tr class={tr_color}>
|
||||
<td>{row_name}</td>
|
||||
<td>{row_value}</td>
|
||||
</tr>
|
||||
<!-- END row -->
|
||||
|
||||
<!-- BEGIN help_row -->
|
||||
<tr class="{tr_color}">
|
||||
<td><b>{row_name}<b></td>
|
||||
<td>{row_value}</td>
|
||||
</tr>
|
||||
<tr class="{tr_color}">
|
||||
<td colspan="2">{help_value}</td>
|
||||
</tr>
|
||||
<!-- END help_row -->
|
||||
|
Loading…
Reference in New Issue
Block a user