Default and forced preferences for nearly all apps

This commit is contained in:
Ralf Becker 2009-10-19 17:04:11 +00:00
parent dbcf17972e
commit 20e655c466
7 changed files with 88 additions and 102 deletions

View File

@ -121,7 +121,7 @@ class addressbook_hooks
'xmlrpc' => True,
'admin' => False,
);
if ($GLOBALS['egw_info']['server']['hide_birthdays'] != 'yes')
if ($GLOBALS['egw_info']['server']['hide_birthdays'] != 'yes') // calendar config
{
$settings['mainscreen_showbirthdays'] = array(
'type' => 'select',
@ -137,6 +137,7 @@ class addressbook_hooks
),
'xmlrpc' => True,
'admin' => False,
'default'=> 3,
);
}
$settings['no_auto_hide'] = array(
@ -146,6 +147,7 @@ class addressbook_hooks
'help' => 'Should the columns photo and home address always be displayed, even if they are empty.',
'xmlrpc' => True,
'admin' => false,
'forced' => false,
);
// CSV Export
$settings['csv_fields'] = array(
@ -160,6 +162,7 @@ class addressbook_hooks
'help' => 'Which fields should be exported. All means every field stored in the addressbook incl. the custom fields. The business or home address only contains name, company and the selected address.',
'xmlrpc' => True,
'admin' => false,
'default'=> 'business',
);
$settings['csv_charset'] = array(
'type' => 'select',
@ -169,6 +172,7 @@ class addressbook_hooks
'help' => 'Which charset should be used for the CSV export. The system default is the charset of this eGroupWare installation.',
'xmlrpc' => True,
'admin' => false,
'default'=> 'iso-8859-1',
);
if ($GLOBALS['egw_info']['server']['contact_repository'] != 'ldap')
@ -180,6 +184,7 @@ class addressbook_hooks
'help' => 'Do you want a private addressbook, which can not be viewed by users, you grant access to your personal addressbook?',
'xmlrpc' => True,
'admin' => False,
'forced' => false,
);
}
$settings['link_title'] = array(
@ -196,6 +201,7 @@ class addressbook_hooks
'help' => 'What should links to the addressbook display in other applications. Empty values will be left out. You need to log in anew, if you change this setting!',
'xmlrpc' => True,
'admin' => false,
'default'=> 'org_name: n_family, n_given',
);
$settings['addr_format'] = array(
'type' => 'select',
@ -208,6 +214,7 @@ class addressbook_hooks
'help' => 'Which address format should the addressbook use for countries it does not know the address format. If the address format of a country is known, it uses it independent of this setting.',
'xmlrpc' => True,
'admin' => false,
'default'=> 'postcode_city',
);
$settings['fileas_default'] = array(
'type' => 'select',
@ -217,6 +224,7 @@ class addressbook_hooks
'help' => 'Default format for fileas, eg. for new entries.',
'xmlrpc' => True,
'admin' => false,
'default'=> 'org_name: n_family, n_given',
);
$settings['hide_accounts'] = array(
'type' => 'check',
@ -225,6 +233,7 @@ class addressbook_hooks
'help' => 'Hides accounts completly from the adressbook.',
'xmlrpc' => True,
'admin' => false,
'default'=> false,
);
$settings['distributionListPreferredMail'] = array(
'type' => 'select',
@ -236,7 +245,8 @@ class addressbook_hooks
),
'help' => 'Defines which email address (business or home) to use as the preferred one for distribution lists in mail.',
'xmlrpc' => True,
'admin' => False
'admin' => False,
'forced'=> 'email',
);
if ($GLOBALS['egw_info']['user']['apps']['filemanager'])
{

View File

@ -1847,41 +1847,32 @@ class calendar_bo
$GLOBALS['egw']->session->appsession('default_prefs_set','calendar','set');
$default_prefs =& $GLOBALS['egw']->preferences->default['calendar'];
$forced_prefs =& $GLOBALS['egw']->preferences->forced['calendar'];
if (!($planner_start_with_group = $GLOBALS['egw']->accounts->name2id('Default')))
{
$planner_start_with_group = '0';
}
$subject = lang('Calendar Event') . ' - $$action$$: $$startdate$$ $$title$$'."\n";
$defaults = array(
'defaultcalendar' => 'week',
'mainscreen_showevents' => '0',
'summary' => 'no',
'receive_updates' => 'no',
'update_format' => 'extended',
$values = array(
'notifyAdded' => $subject . lang ('You have a meeting scheduled for %1','$$startdate$$'),
'notifyCanceled' => $subject . lang ('Your meeting scheduled for %1 has been canceled','$$startdate$$'),
'notifyModified' => $subject . lang ('Your meeting that had been scheduled for %1 has been rescheduled to %2','$$olddate$$','$$startdate$$'),
'notifyDisinvited'=> $subject . lang ('You have been disinvited from the meeting at %1','$$startdate$$'),
'notifyResponse' => $subject . lang ('On %1 %2 %3 your meeting request for %4','$$date$$','$$fullname$$','$$action$$','$$startdate$$'),
'notifyAlarm' => lang('Alarm for %1 at %2 in %3','$$title$$','$$startdate$$','$$location$$')."\n".lang ('Here is your requested alarm.'),
'show_rejected' => '0',
'display_status' => '1',
'weekdaystarts' => 'Monday',
'workdaystarts' => '9',
'workdayends' => '17',
'interval' => '30',
'defaultlength' => '60',
'planner_start_with_group' => $planner_start_with_group,
'defaultfilter' => 'all',
'default_private' => '0',
'defaultresource_sel' => 'resources',
'interval' => 30,
);
foreach($defaults as $var => $default)
foreach($values as $var => $default)
{
if (!isset($default_prefs[$var]) || (string)$default_prefs[$var] == '')
$type = substr($var,0,6) == 'notify' ? 'forced' : 'default';
// only set, if neither default nor forced pref exists
if ((!isset($default_prefs[$var]) || (string)$default_prefs[$var] === '') && (!isset($forced_prefs[$var]) || (string)$forced_prefs[$var] === ''))
{
$GLOBALS['egw']->preferences->add('calendar',$var,$default,'default');
$GLOBALS['egw']->preferences->add('calendar',$var,$default,'default'); // always store default, even if we have a forced too
if ($type == 'forced') $GLOBALS['egw']->preferences->add('calendar',$var,$default,'forced');
$this->cal_prefs[$var] = $default;
$need_save = True;
}
@ -1889,6 +1880,7 @@ class calendar_bo
if ($need_save)
{
$GLOBALS['egw']->preferences->save_repository(False,'default');
$GLOBALS['egw']->preferences->save_repository(False,'forced');
}
}

View File

@ -286,7 +286,7 @@ class calendar_hooks
'help' => 'Displays your default calendar view on the startpage (page you get when you enter eGroupWare or click on the homepage icon)?',
'xmlrpc' => True,
'admin' => False,
'default'=> true,
'default'=> '1',
),
'weekdaystarts' => array(
'type' => 'select',
@ -316,7 +316,7 @@ class calendar_hooks
'help' => 'This defines the end of your dayview. Events after this time, are shown below the dayview.',
'xmlrpc' => True,
'admin' => False,
'default'=> 17,
'default'=> 18,
),
'use_time_grid' => array(
'type' => 'select',
@ -336,7 +336,7 @@ class calendar_hooks
'help' => 'How many minutes should each interval last?',
'xmlrpc' => True,
'admin' => False,
'interval'=> 30,
'default'=> 30,
),
'defaultlength' => array(
'type' => 'input',
@ -457,7 +457,6 @@ class calendar_hooks
'rows' => 5,
'cols' => 50,
'help' => 'This message is sent to disinvited participants.',
'default' => '',
'values' => $event_details,
'subst_help' => False,
'xmlrpc' => True,
@ -470,7 +469,6 @@ class calendar_hooks
'rows' => 5,
'cols' => 50,
'help' => 'This message is sent when you accept, tentative accept or reject an event.',
'default' => '',
'values' => $event_details,
'subst_help' => False,
'xmlrpc' => True,
@ -483,7 +481,6 @@ class calendar_hooks
'rows' => 5,
'cols' => 50,
'help' => 'This message is sent when you set an Alarm for a certain event. Include all information you might need.',
'default' => '',
'values' => $event_details,
'subst_help' => False,
'xmlrpc' => True,
@ -495,10 +492,10 @@ class calendar_hooks
'name' => 'freebusy',
'help' => $freebusy_help,
'run_lang' => false,
'default' => '',
'subst_help' => False,
'xmlrpc' => True,
'admin' => False,
'forced' => false,
),
'freebusy_pw' => array(
'type' => 'input',
@ -507,6 +504,7 @@ class calendar_hooks
'help' => 'If you dont set a password here, the information is available to everyone, who knows the URL!!!',
'xmlrpc' => True,
'admin' => False,
'forced' => 'no'
)
);
}

View File

@ -113,15 +113,8 @@ class filemanager_hooks
$config = config::read(self::$appname);
if (!empty($config['max_folderlinks'])) self::$foldercount = (int)$config['max_folderlinks'];
$upload_boxes = array(
'1' => '1',
'5' => '5',
'10' => '10',
'20' => '20',
'30' => '30'
);
$yes_no = array(
'no' => lang('No'),
'no' => lang('No'),
'yes' => lang('Yes')
);
@ -133,17 +126,17 @@ class filemanager_hooks
'label' => lang('Show link to filemanagers basedirectory (/) in side box menu?'),
'help' => lang('Default behavior is NO. The link will not be shown, but you are still able to navigate to this location, or configure this paricular location as startfolder or folderlink.'),
'xmlrpc' => True,
'amin' => False
'admin' => False,
'default' => 'no',
),
'startfolder' => array(
'type' => 'input',
'name' => 'startfolder',
'size' => 60,
'default' => '',
'label' => lang('Enter the complete VFS path to specify your desired start folder.'),
'help' => lang('The default start folder is your personal Folder. The default is used, if you leave this empty, the path does not exist or you lack the neccessary access permissions.'),
'xmlrpc' => True,
'amin' => False
'admin' => False,
),
);
for ($i=1; $i <= self::$foldercount; $i++)
@ -155,7 +148,7 @@ class filemanager_hooks
'default' => '',
'label' => lang('Enter the complete VFS path to specify a fast access link to a folder').' ('.$i.').',
'xmlrpc' => True,
'amin' => False
'admin' => False
);
}
return $settings;

View File

@ -29,7 +29,7 @@
'type' => 'section',
'title' => 'Preferences for the idots template set',
'xmlrpc' => False,
'admin' => False
'admin' => False,
),
'show_general_menu' => array(
'type' => 'select',
@ -38,7 +38,8 @@
'values' => $top_menu,
'help' => 'Where and how will the egroupware links like preferences, about and logout be displayed.',
'xmlrpc' => False,
'admin' => False
'admin' => False,
'forced' => 'topmenu',
),
'start_and_logout_icons' => array(
'type' => 'select',
@ -47,17 +48,18 @@
'values' => $yes_no,
'help' => 'When you say yes the home and logout buttons are presented as applications in the main top applcation bar.',
'xmlrpc' => False,
'admin' => False
'admin' => False,
'forced' => 'yes',
),
'max_icons' => array(
'type' => 'input',
'label' => 'Max number of icons in navbar',
'name' => 'max_icons',
'help' => 'How many icons should be shown in the navbar (top of the page). Additional icons go into a kind of pulldown menu, callable by the icon on the far right side of the navbar.',
'default' => '',
'size' => 3,
'xmlrpc' => False,
'admin' => False
'admin' => False,
'forced' => 12,
),
'auto_hide_sidebox' => array(
'type' => 'check',
@ -65,7 +67,8 @@
'name' => 'auto_hide_sidebox',
'help' => 'Automatically hide the Sidebox menu\'s?',
'xmlrpc' => False,
'admin' => False
'admin' => False,
'default' => true,
),
'click_or_onmouseover' => array(
'type' => 'select',
@ -74,7 +77,8 @@
'values' => $click_or_onmouseover,
'help' => 'Click or Mouse Over to show menus?',
'xmlrpc' => False,
'admin' => False
'admin' => False,
'forced' => 'click',
),
'disable_slider_effects' => array(
'type' => 'check',
@ -82,7 +86,8 @@
'name' => 'disable_slider_effects',
'help' => 'Disable the animated slider effects when showing or hiding menus in the page? Opera and Konqueror users will probably must want this.',
'xmlrpc' => False,
'admin' => False
'admin' => False,
'forced' => false,
),
'disable_pngfix' => array(
'type' => 'check',
@ -90,7 +95,8 @@
'name' => 'disable_pngfix',
'help' => 'Disable the execution a bugfixscript for Internet Explorer 5.5 and higher to show transparency in PNG-images?',
'xmlrpc' => False,
'admin' => False
'admin' => False,
'forced' => false,
),
'show_generation_time' => array(
'type' => 'check',
@ -98,6 +104,7 @@
'name' => 'show_generation_time',
'help' => 'Show page generation time on the bottom of the page?',
'xmlrpc' => False,
'admin' => False
'admin' => False,
'forced' => false,
)
);

View File

@ -126,7 +126,7 @@ class preferences_hooks
'size' => 3,
'xmlrpc' => True,
'admin' => False,
'default' => 15,
'default' => 20,
),
'template_set' => array(
'type' => 'select',
@ -136,7 +136,7 @@ class preferences_hooks
'help' => 'A template defines the layout of eGroupWare and it contains icons for each application.',
'xmlrpc' => True,
'admin' => False,
'default' => 'idots',
'forced' => 'idots',
),
'theme' => array(
'type' => 'select',
@ -146,7 +146,7 @@ class preferences_hooks
'help' => 'A theme defines the colors and fonts used by the template.',
'xmlrpc' => True,
'admin' => False,
'default' => 'idots',
'forced' => 'idots',
),
'navbar_format' => array(
'type' => 'select',
@ -166,6 +166,7 @@ class preferences_hooks
'help' => 'You can show the linked entries with icons only, icons with app-name or both.',
'xmlrpc' => True,
'admin' => False,
'forced' => 'icons',
),
'link_list_thumbnail' => array(
'type' => 'select',
@ -178,6 +179,7 @@ class preferences_hooks
'help' => 'Images linked to an entry can be displayed as thumbnails. You can turn this off to speed up page display.',
'xmlrpc' => True,
'admin' => False,
'forced' => '1',
),
'tz' => array(
'type' => 'select',
@ -197,6 +199,7 @@ class preferences_hooks
'help' => 'Please select timezones, you want to be able to quickly switch between. Switch is NOT shown, if less then two are selected.',
'xmlrpc' => True,
'admin' => False,
'forced' => date_default_timezone_get(),
),
'dateformat' => array(
'type' => 'select',
@ -256,7 +259,7 @@ class preferences_hooks
'help' => 'Select how the rich text editor will generate the enter (linebreak) tag.',
'xmlrpc' => True,
'admin' => False,
'default'=> 'br',
'forced' => 'br',
),
'rte_skin' => array(
'type' => 'select',
@ -266,7 +269,7 @@ class preferences_hooks
'help' => 'Select the theme (visualization) of the rich text editor.',
'xmlrpc' => True,
'admin' => False,
'default'=> 'office2003',
'forced' => 'office2003',
),
'show_currentusers' => array(
'type' => 'check',
@ -275,6 +278,7 @@ class preferences_hooks
'help' => 'Should the number of active sessions be displayed for you all the time.',
'xmlrpc' => False,
'admin' => True,
'forced' => true,
),
'default_app' => array(
'type' => 'select',
@ -284,7 +288,7 @@ class preferences_hooks
'help' => "The default application will be started when you enter eGroupWare or click on the homepage icon.<br>You can also have more than one application showing up on the homepage, if you don't choose a specific application here (has to be configured in the preferences of each application).",
'xmlrpc' => False,
'admin' => False,
'default'=> 'calendar',
'default'=> '',
),
'currency' => array(
'type' => 'input',
@ -305,6 +309,7 @@ class preferences_hooks
'run_lang' => false,
'xmlrpc' => True,
'admin' => False,
'default'=> 'primary_group'
),
'account_display' => array(
'type' => 'select',
@ -314,6 +319,7 @@ class preferences_hooks
'help' => 'Set this to your convenience. For security reasons, you might not want to show your Loginname in public.',
'xmlrpc' => True,
'admin' => False,
'default'=> 'lastname',
),
'show_help' => array(
'type' => 'check',
@ -332,15 +338,17 @@ class preferences_hooks
'drag and drop, it will be disabled automatically. This feature is experimental at the moment.',
'xmlrpc' => False,
'admin' => False,
'forced' => true,
),
'csv_charset' => array(
'type' => 'select',
'label' => 'Charset for the CSV export',
'name' => 'csv_charset',
'values' => translation::get_installed_charsets()+array('utf-8' => 'utf-8 (Unicode)'),
'values' => translation::get_installed_charsets(),
'help' => 'Which charset should be used for the CSV export. The system default is the charset of this eGroupWare installation.',
'xmlrpc' => True,
'admin' => false,
'default'=> 'iso-8859-1',
),
);
// disable thumbnails, if no size configured by admin

View File

@ -5,7 +5,7 @@
* @link http://www.egroupware.org
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
* @package timesheet
* @copyright (c) 2005-8 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
* @copyright (c) 2005-9 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @version $Id$
*/
@ -21,6 +21,13 @@ if (!defined('TIMESHEET_APP'))
*/
class timesheet_hooks
{
/**
* Instance of timesheet_bo class
*
* @var timesheet_bo
*/
static $timesheet_bo;
/**
* Hook called by link-class to include timesheet in the appregistry of the linkage
*
@ -101,6 +108,10 @@ class timesheet_hooks
'Grant Access' => egw::link('/index.php','menuaction=preferences.uiaclprefs.index&acl_app='.$appname),
'Edit Categories' => egw::link('/index.php','menuaction=preferences.uicategories.index&cats_app=' . $appname . '&cats_level=True&global_cats=True')
);
// until we have more then one preference
if (is_null(self::$timesheet_bo)) self::$timesheet_bo = new timesheet_bo();
if (!self::$timesheet_bo->status_labels) unset($file['Preferences']);
if ($location == 'preferences')
{
display_section($appname,$file);
@ -138,51 +149,18 @@ class timesheet_hooks
*/
static function settings()
{
self::check_set_default_prefs();
if (is_null(self::$timesheet_bo)) self::$timesheet_bo = new timesheet_bo();
$timesheet = new timesheet_bo(); //nedd Status from timesheet
$GLOBALS['settings']['predefined_status'] = array(
'type' => 'select',
'label' => 'Status of created timesheets',
'name' => 'predefined_status',
'values' => $timesheet->status_labels,
'help' => 'Select the predefined status, whan creating a new timesheet ',
'xmlrpc' => True,
'admin' => False,
return array(
'predefined_status' => array(
'type' => 'select',
'label' => 'Status of created timesheets',
'name' => 'predefined_status',
'values' => self::$timesheet_bo->status_labels,
'help' => 'Select the predefined status, when creating a new timesheet ',
'xmlrpc' => True,
'admin' => False,
),
);
return true; // otherwise prefs say it cant find the file ;-)
}
/**
* Check if reasonable default preferences are set and set them if not
*
* It sets a flag in the app-session-data to be called only once per session
*/
static function check_set_default_prefs()
{
if ($GLOBALS['egw']->session->appsession('default_prefs_set',TIMESHEET_APP))
{
return;
}
$GLOBALS['egw']->session->appsession('default_prefs_set',TIMESHEET_APP,'set');
$default_prefs =& $GLOBALS['egw']->preferences->default[TIMESHEET_APP];
$defaults = array(
);
foreach($defaults as $var => $default)
{
if (!isset($default_prefs[$var]) || $default_prefs[$var] === '')
{
$GLOBALS['egw']->preferences->add(TIMESHEET_APP,$var,$default,'default');
$need_save = True;
}
}
if ($need_save)
{
$GLOBALS['egw']->preferences->save_repository(False,'default');
}
}
}