diff --git a/addressbook/inc/class.addressbook_hooks.inc.php b/addressbook/inc/class.addressbook_hooks.inc.php
index ce0de67fac..437cf1ca6a 100644
--- a/addressbook/inc/class.addressbook_hooks.inc.php
+++ b/addressbook/inc/class.addressbook_hooks.inc.php
@@ -48,27 +48,6 @@ class addressbook_hooks
display_sidebox($appname,lang('Addressbook menu'),$file);
}
- if ($GLOBALS['egw_info']['user']['apps']['preferences'] && $location != 'admin')
- {
- $file = array(
- 'Preferences' => egw::link('/index.php','menuaction=preferences.uisettings.index&appname='.$appname,'preferences'),
- 'Grant Access' => egw::link('/index.php','menuaction=preferences.uiaclprefs.index&acl_app='.$appname),
- 'Edit Categories' => egw::link('/index.php','menuaction=preferences.preferences_categories_ui.index&cats_app=' . $appname . '&cats_level=True&global_cats=True')
- );
- if ($GLOBALS['egw_info']['server']['contact_repository'] == 'ldap' || $GLOBALS['egw_info']['server']['deny_user_grants_access'])
- {
- unset($file['Grant Access']);
- }
- if ($location == 'preferences')
- {
- display_section($appname,$file);
- }
- else
- {
- display_sidebox($appname,lang('Preferences'),$file);
- }
- }
-
if ($GLOBALS['egw_info']['user']['apps']['admin'] && $location != 'preferences')
{
$file = Array(
@@ -479,4 +458,15 @@ class addressbook_hooks
acl::DELETE => 'delete',
);
}
+
+ /**
+ * Hook to tell framework we use standard categories method
+ *
+ * @param string|array $data hook-data or location
+ * @return boolean
+ */
+ public static function categories($data)
+ {
+ return true;
+ }
}
diff --git a/addressbook/setup/setup.inc.php b/addressbook/setup/setup.inc.php
index 7efa7dc3ec..434a7d078a 100755
--- a/addressbook/setup/setup.inc.php
+++ b/addressbook/setup/setup.inc.php
@@ -33,7 +33,6 @@ $setup_info['addressbook']['tables'] = array(); // addressbook tables are in th
/* The hooks this app includes, needed for hooks registration */
$setup_info['addressbook']['hooks']['admin'] = 'addressbook_hooks::all_hooks';
-$setup_info['addressbook']['hooks']['preferences'] = 'addressbook_hooks::all_hooks';
$setup_info['addressbook']['hooks']['sidebox_menu'] = 'addressbook_hooks::all_hooks';
$setup_info['addressbook']['hooks']['settings'] = 'addressbook_hooks::settings';
$setup_info['addressbook']['hooks'][] = 'home';
@@ -47,6 +46,7 @@ $setup_info['addressbook']['hooks']['group_acl'] = 'addressbook_hooks::group_acl
$setup_info['addressbook']['hooks']['not_enum_group_acls'] = 'addressbook_hooks::not_enum_group_acls';
$setup_info['addressbook']['hooks']['export_limit'] = 'addressbook_hooks::getAppExportLimit';
$setup_info['addressbook']['hooks']['acl_rights'] = 'addressbook_hooks::acl_rights';
+$setup_info['addressbook']['hooks']['categories'] = 'addressbook_hooks::categories';
/* Dependencies for this app to work */
$setup_info['addressbook']['depends'][] = array(
diff --git a/admin/inc/class.admin_prefs_sidebox_hooks.inc.php b/admin/inc/class.admin_prefs_sidebox_hooks.inc.php
index aafe57562a..39bc62d31c 100644
--- a/admin/inc/class.admin_prefs_sidebox_hooks.inc.php
+++ b/admin/inc/class.admin_prefs_sidebox_hooks.inc.php
@@ -25,7 +25,7 @@ class admin_prefs_sidebox_hooks
);
/**
- * hooks to build projectmanager's sidebox-menu plus the admin and preferences sections
+ * hooks to build projectmanager's sidebox-menu
*
* @param string/array $args hook args
*/
@@ -52,7 +52,7 @@ class admin_prefs_sidebox_hooks
display_sidebox($appname,lang('Admin'),$file);
return;
}
- if ($GLOBALS['egw_info']['user']['apps']['admin'] && $location != 'admins')
+ if ($GLOBALS['egw_info']['user']['apps']['admin'])
{
if (! $GLOBALS['egw']->acl->check('site_config_access',1,'admin'))
diff --git a/admin/setup/setup.inc.php b/admin/setup/setup.inc.php
index b4db05359a..2bdc747e6c 100755
--- a/admin/setup/setup.inc.php
+++ b/admin/setup/setup.inc.php
@@ -41,7 +41,6 @@ $setup_info['admin']['hooks'] = array(
'group_manager' => 'admin.uiaccounts.edit_group_hook',
'topmenu_info'
);
-$setup_info['admin']['hooks']['preferences'] =$setup_info['admin']['name'].'.admin_prefs_sidebox_hooks.all_hooks';
$setup_info['admin']['hooks']['admin'] =$setup_info['admin']['name'].'.admin_prefs_sidebox_hooks.all_hooks';
$setup_info['admin']['hooks']['sidebox_menu'] =$setup_info['admin']['name'].'.admin_prefs_sidebox_hooks.all_hooks';
diff --git a/calendar/csv_import.php b/calendar/csv_import.php
deleted file mode 100644
index 42fd114ed9..0000000000
--- a/calendar/csv_import.php
+++ /dev/null
@@ -1,542 +0,0 @@
-
- * @package calendar
- * @copyright (c) 2003-9 by Ralf Becker
- * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
- * @version $Id$
- */
-
-$GLOBALS['egw_info'] = array(
- 'flags' => array(
- 'currentapp' => 'calendar',
- 'noheader' => True
- ),
-);
-include('../header.inc.php');
-
-$is_admin = isset($GLOBALS['egw_info']['user']['apps']['admin']) && $GLOBALS['egw_info']['user']['apps']['admin'];
-
-if (isset($_FILES['csvfile']['tmp_name']))
-{
- $csvfile = tempnam($GLOBALS['egw_info']['server']['temp_dir'],$GLOBALS['egw_info']['flags']['currentapp']."_");
- $GLOBALS['egw']->session->appsession('csvfile','',$csvfile);
- $_POST['action'] = move_uploaded_file($_FILES['csvfile']['tmp_name'],$csvfile) ?
- 'download' : '';
-}
-else
-{
- $csvfile = $GLOBALS['egw']->session->appsession('csvfile');
-}
-if ($_POST['cancel'])
-{
- @unlink($csvfile);
- $GLOBALS['egw']->redirect_link('/calendar/index.php');
-}
-if (isset($_POST['charset']))
-{
- // we have to set the local, to fix eg. utf-8 imports, as fgetcsv requires it!
- common::setlocale(LC_CTYPE,$_POST['charset']);
-}
-$GLOBALS['egw_info']['flags']['app_header'] = $GLOBALS['egw_info']['apps']['calendar']['title'].' - '.lang('Import CSV-File');
-$cal = new calendar_boupdate(true);
-$GLOBALS['egw']->common->egw_header();
-
-$template = CreateObject('phpgwapi.Template',common::get_tpl_dir('calendar'));
-$template->set_file(array('import_t' => 'csv_import.tpl'));
-$template->set_block('import_t','filename','filenamehandle');
-$template->set_block('import_t','fheader','fheaderhandle');
-$template->set_block('import_t','fields','fieldshandle');
-$template->set_block('import_t','ffooter','ffooterhandle');
-$template->set_block('import_t','imported','importedhandle');
-$template->set_block('import_t','import','importhandle');
-
-if(($_POST['action'] == 'download' || $_POST['action'] == 'continue') && (!$_POST['fieldsep'] || !$csvfile || !($fp=fopen($csvfile,'rb'))))
-{
- $_POST['action'] = '';
-}
-$template->set_var("action_url",$GLOBALS['egw']->link("/calendar/csv_import.php"));
-
-$PSep = '||'; // Pattern-Separator, separats the pattern-replacement-pairs in trans
-$ASep = '|>'; // Assignment-Separator, separats pattern and replacesment
-$VPre = '|#'; // Value-Prefix, is expanded to \ for ereg_replace
-$CPre = '|['; $CPreReg = '\|\['; // |{csv-fieldname} is expanded to the value of the csv-field
-$CPos = ']'; $CPosReg = '\]'; // if used together with @ (replacement is eval-ed) value gets autom. quoted
-
-function addr_id( $n_family,$n_given=null,$org_name=null )
-{ // find in Addressbook, at least n_family AND (n_given OR org_name) have to match
- static $contacts;
- if (!is_object($contacts))
- {
- $contacts =& CreateObject('phpgwapi.contacts');
- }
- if (!is_null($org_name)) // org_name given?
- {
- $addrs = $contacts->read( 0,0,array('id'),'',"n_family=$n_family,n_given=$n_given,org_name=$org_name" );
- if (!count($addrs))
- {
- $addrs = $contacts->read( 0,0,array('id'),'',"n_family=$n_family,org_name=$org_name",'','n_family,org_name');
- }
- }
- if (!is_null($n_given) && (is_null($org_name) || !count($addrs))) // first name given and no result so far
- {
- $addrs = $contacts->read( 0,0,array('id'),'',"n_family=$n_family,n_given=$n_given",'','n_family,n_given' );
- }
- if (is_null($n_given) && is_null($org_name)) // just one name given, check against fn (= full name)
- {
- $addrs = $contacts->read( 0,0,array('id'),'',"n_fn=$n_family",'','n_fn' );
- }
- if (count($addrs))
- {
- return $addrs[0]['id'];
- }
- return False;
-}
-
-$cat2id = array( );
-
-function cat_id($cats)
-{
- if (!$cats)
- {
- return '';
- }
-
- foreach(preg_split('/[,;]/',$cats) as $cat)
- {
- if (isset($cat2id[$cat]))
- {
- $ids[$cat] = $cat2id[$cat]; // cat is in cache
- }
- else
- {
- if (is_numeric($cat) && $GLOBALS['egw']->categories->id2name($cat) != '--')
- {
- $cat2id[$cat] = $ids[$cat] = $cat;
- }
- elseif ($id = $GLOBALS['egw']->categories->name2id( addslashes($cat) ))
- { // cat exists
- $cat2id[$cat] = $ids[$cat] = $id;
- }
- else
- { // create new cat
- $GLOBALS['egw']->categories->add( array('name' => $cat,'descr' => $cat ));
- $cat2id[$cat] = $ids[$cat] = $GLOBALS['egw']->categories->name2id( addslashes($cat) );
- }
- }
- }
- return implode( ',',$ids );
-}
-
-if ($_POST['next']) $_POST['action'] = 'next';
-switch ($_POST['action'])
-{
-case '': // Start, ask Filename
- $template->set_var('lang_csvfile',lang('CSV-Filename'));
- $template->set_var('lang_fieldsep',lang('Fieldseparator'));
- $template->set_var('lang_charset',lang('Charset of file'));
- $template->set_var('lang_help',lang('Please note: You can configure the field assignments AFTER you uploaded the file.'));
- $template->set_var('select_charset',
- html::select('charset','',translation::get_installed_charsets(),True));
- $template->set_var('fieldsep',$_POST['fieldsep'] ? $_POST['fieldsep'] : ';');
- $template->set_var('submit',lang('Import'));
- $template->set_var('enctype','ENCTYPE="multipart/form-data"');
-
- $template->parse('rows','filename');
- break;
-
-case 'continue':
-case 'download':
- $GLOBALS['egw']->preferences->read_repository();
- $defaults = $GLOBALS['egw_info']['user']['preferences']['calendar']['cvs_import'];
- if (!is_array($defaults))
- {
- $defaults = array();
- }
- $template->set_var('lang_csv_fieldname',lang('CSV-Fieldname'));
- $template->set_var('lang_info_fieldname',lang('calendar-Fieldname'));
- $template->set_var('lang_translation',lang("Translation").' '.lang('help').' ');
- $template->set_var('submit',
- html::submit_button('convert','Import') . ' '.
- html::submit_button('cancel','Cancel'));
- $template->set_var('lang_debug',lang('Test Import (show importable records only in browser)'));
- $template->parse('rows','fheader');
-
- $cal_names = array(
- 'title' => 'Title varchar(80)',
- 'description' => 'Description text',
- 'location' => 'Location varchar(255)',
- 'start' => 'Start Date: Timestamp or eg. YYYY-MM-DD hh:mm',
- 'end' => 'End Date: Timestamp or eg. YYYY-MM-DD hh:mm',
- 'participants' => 'Participants: comma separated user-id\'s or -names',
- 'category' => 'Categories: id\'s or names, comma separated (new ones got created)',
- 'priority' => 'Priority: 1=Low, 2=Normal, 3=High',
- 'public' => 'Access: 1=public, 0=private',
- 'owner' => 'Owner: int(11) user-id/-name',
- 'modified' => 'Modification date',
- 'modifier' => 'Modification user',
- 'non_blocking' => '0=Event blocks time, 1=Event creates no conflicts',
- 'uid' => 'Unique Id, allows multiple import to update identical entries',
-// 'recur_type'=> 'Type of recuring event',
- 'addr_id' => 'Link to Addressbook, use nlast,nfirst[,org] or contact_id from addressbook',
- 'link_1' => '1. link: appname:appid the entry should be linked to, eg.: addressbook:123',
- 'link_2' => '2. link: appname:appid the entry should be linked to, eg.: addressbook:123',
- 'link_3' => '3. link: appname:appid the entry should be linked to, eg.: addressbook:123',
- );
- $custom_fields = config::get_customfields('calendar');
- //echo "custom-fields=".print_r($custom_fields,True)." ";
- foreach ($custom_fields as $name => $data)
- {
- $cal_names['#'.$name] = $data['label'].': Custom field ('.$data['type'].')';
- }
-
- // the next line is used in the help-text too
- $mktime_lotus = "${PSep}0?([0-9]+)[ .:-]+0?([0-9]*)[ .:-]+0?([0-9]*)[ .:-]+0?([0-9]*)[ .:-]+0?([0-9]*)[ .:-]+0?([0-9]*).*$ASep@mktime(${VPre}4,${VPre}5,${VPre}6,${VPre}2,${VPre}3,${VPre}1)";
-
- $cal_name_options = "none\n";
- foreach($cal_names as $field => $name)
- {
- $cal_name_options .= " ".$GLOBALS['egw']->strip_html($name)."\n";
- }
- $csv_fields = fgetcsv($fp,8000,$_POST['fieldsep']);
- $csv_fields = translation::convert($csv_fields,$_POST['charset']);
- $csv_fields[] = 'no CSV 1'; // eg. for static assignments
- $csv_fields[] = 'no CSV 2';
- $csv_fields[] = 'no CSV 3';
- foreach($csv_fields as $csv_idx => $csv_field)
- {
- $template->set_var('csv_field',$csv_field);
- $template->set_var('csv_idx',$csv_idx);
- if ($def = $defaults[$csv_field])
- {
- list( $info,$trans ) = explode($PSep,$def,2);
- $template->set_var('trans',$trans);
- $template->set_var('cal_fields',str_replace('="'.$info.'">','="'.$info.'" selected>',$cal_name_options));
- }
- else
- {
- $template->set_var('trans','');
- $template->set_var('cal_fields',$cal_name_options);
- }
- $template->parse('rows','fields',True);
- }
- $template->set_var('lang_start',lang('Startrecord'));
- $template->set_var('start',get_var('start',array('POST'),1));
- $msg = ($safe_mode = ini_get('safe_mode') == 'On') ? lang('to many might exceed your execution-time-limit'):
- lang('empty for all');
- $template->set_var('lang_max',lang('Number of records to read (%1)',$msg));
- $template->set_var('max',get_var('max',array('POST'),$safe_mode ? 200 : ''));
- $template->set_var('debug',get_var('debug',array('POST'),True)?' checked':'');
- $template->parse('rows','ffooter',True);
- fclose($fp);
-
- $hiddenvars = html::input_hidden(array(
- 'action' => 'import',
- 'fieldsep'=> $_POST['fieldsep'],
- 'charset' => $_POST['charset']
- ));
- $help_on_trans = "How to use Translation's ".
- "Translations enable you to change / adapt the content of each CSV field for your needs. ".
- "General syntax is: pattern1 ${ASep} replacement1 ${PSep} ... ${PSep} patternN ${ASep} replacementN ".
- "If the pattern-part of a pair is ommited it will match everything ('^.*$'), which is only ".
- "usefull for the last pair, as they are worked from left to right.
".
- "First example: 1${ASep}private${PSep}public ".
- "This will translate a '1' in the CVS field to 'privat' and everything else to 'public'.
".
- "Patterns as well as the replacement can be regular expressions (the replacement is done via ereg_replace). ".
- "If, after all replacements, the value starts with an '@' AND you have admin rights the whole value is eval()'ed, so you ".
- "may use php, eGroupWare or your own functions. This is quiet powerfull, but circumvents all ACL .
".
- "Example using regular expressions and '@'-eval(): $mktime_lotus ".
- "It will read a date of the form '2001-05-20 08:00:00.00000000000000000' (and many more, see the regular expr.). ".
- "The [ .:-]-separated fields are read and assigned in different order to @mktime(). Please note to use ".
- "${VPre} insted of a backslash (I couldn't get backslash through all the involved templates and forms.) ".
- "plus the field-number of the pattern.
".
- "In addintion to the fields assign by the pattern of the reg.exp. you can use all other CSV-fields, with the ".
- "syntax ${CPre}CVS-FIELDNAME$CPos . Here is an example: ".
- ".+$ASep${CPre}Company$CPos: ${CPre}NFamily$CPos, ${CPre}NGiven$CPos$PSep${CPre}NFamily$CPos, ${CPre}NGiven$CPos ".
- "It is used on the CVS-field 'Company' and constructs a something like Company: FamilyName, GivenName or ".
- "FamilyName, GivenName if 'Company' is empty.
".
- "You can use the 'No CVS #'-fields to assign cvs-values to more than on field, the following example uses the ".
- "cvs-field 'Note' (which gots already assingned to the description) and construct a short subject: ".
- "@substr(${CPre}Note$CPos,0,60).' ...'
".
- "Their is two important user-function for the calendar: ".
- "@addr_id(${CPre}NFamily$CPos,${CPre}NGiven$CPos,${CPre}Company$CPos) ".
- "searches the addressbook for an address and returns the id if it founds an exact match of at least ".
- "NFamily AND (NGiven OR Company ). This is necessary to link your imported calendar-entrys ".
- "with the addressbook. ".
- "@cat_id(Cat1,...,CatN) returns a (','-separated) list with the cat_id's. If a category isn't found, it ".
- "will be automaticaly added. This function is automaticaly called if the category is not numerical!
".
- "I hope that helped to understand the features, if not ask .";
-
- $template->set_var('help_on_trans',lang($help_on_trans)); // I don't think anyone will translate this
- break;
-
-case 'next':
- $_POST['cal_fields'] = unserialize(stripslashes($_POST['cal_fields']));
- $_POST['trans'] = unserialize(stripslashes($_POST['trans']));
- // fall-through
-case 'import':
- $hiddenvars = html::input_hidden(array(
- 'action' => 'continue',
- 'fieldsep'=> $_POST['fieldsep'],
- 'charset' => $_POST['charset'],
- 'start' => $_POST['start']+(!$_POST['debug'] ? $_POST['max'] : 0),
- 'max' => $_POST['max'],
- 'debug' => $_POST['debug'],
- 'cal_fields' => $_POST['cal_fields'],
- 'trans' => $_POST['trans']
- ));
- @set_time_limit(0);
- $fp=fopen($csvfile,'r');
- $csv_fields = fgetcsv($fp,8000,$_POST['fieldsep']);
- $csv_fields = translation::convert($csv_fields,$_POST['charset']);
- $csv_fields[] = 'no CSV 1'; // eg. for static assignments
- $csv_fields[] = 'no CSV 2';
- $csv_fields[] = 'no CSV 3';
-
- $cal_fields = array_diff($_POST['cal_fields'],array( '' )); // throw away empty / not assigned entrys
-
- $defaults = array();
- foreach($cal_fields as $csv_idx => $info)
- { // convert $trans[$csv_idx] into array of pattern => value
- $defaults[$csv_fields[$csv_idx]] = $info;
- if ($_POST['trans'][$csv_idx])
- {
- $defaults[$csv_fields[$csv_idx]] .= $PSep.addslashes($_POST['trans'][$csv_idx]);
- }
- }
-
- $GLOBALS['egw']->preferences->read_repository();
- $GLOBALS['egw']->preferences->add('calendar','cvs_import',$defaults);
- $GLOBALS['egw']->preferences->save_repository(True);
-
- $log = '
'."\n\t# \n";
-
- foreach($cal_fields as $csv_idx => $info)
- { // convert $trans[$csv_idx] into array of pattern => value
- // if (!$debug) echo "$csv_idx: ".$csv_fields[$csv_idx].": $info".($trans[$csv_idx] ? ': '.$trans[$csv_idx] : '')."
";
- $pat_reps = explode($PSep,stripslashes($_POST['trans'][$csv_idx]));
- $replaces = ''; $values = '';
- if ($pat_reps[0] != '')
- {
- foreach($pat_reps as $k => $pat_rep)
- {
- list($pattern,$replace) = explode($ASep,$pat_rep,2);
- if ($replace == '')
- {
- $replace = $pattern; $pattern = '^.*$';
- }
- $values[$pattern] = $replace; // replace two with only one, added by the form
- $replaces .= ($replaces != '' ? $PSep : '') . $pattern . $ASep . $replace;
- }
- $trans[$csv_idx] = $values;
- }
- $log .= "\t\t$info \n";
- }
- if (!in_array('public',$cal_fields)) // autocreate public access if not set by user
- {
- $log .= "\t\tisPublic \n";
- $cal_fields[] = 'public';
- }
-/* if (!in_array('recur_type',$cal_fields)) // autocreate single event if not set by user
- {
- $log .= "\t\trecureing \n";
- }*/
- $log .= "\t\tImported \n\t \n";
-
- $start = $_POST['start'] < 1 ? 1 : $_POST['start'];
-
- // ignore empty lines, is_null($fields[0]) is returned on empty lines !!!
- for($i = 1; $i < $start; ++$i) // overread lines before our start-record
- {
- while(($fields = fgetcsv($fp,8000,$_POST['fieldsep'])) && is_null($fields[0])) ;
- }
- for($anz = 0; !$_POST['max'] || $anz < $_POST['max']; ++$anz)
- {
- while(($fields = fgetcsv($fp,8000,$_POST['fieldsep'])) && is_null($fields[0])) ;
- if (!$fields)
- {
- break; // EOF
- }
- $fields = translation::convert($fields,$_POST['charset']);
-
- $log .= "\t\n\t\t".($start+$anz)." \n";
-
- $values = $orig = array();
- foreach($cal_fields as $csv_idx => $info)
- {
- //echo "$csv: $info".($trans[$csv] ? ': '.$trans[$csv] : '')."
";
- $val = $fields[$csv_idx];
- if (isset($trans[$csv_idx]) && is_array($trans[$csv_idx]))
- {
- foreach($trans[$csv_idx] as $pattern => $replace)
- {
- if (ereg((string) $pattern,$val))
- {
- //echo "csv_idx='$csv_idx',info='$info',trans_csv=".print_r($trans_csv).",preg_replace('/$pattern/','$replace','$val') = ";
- $val = preg_replace('/'.(string) $pattern.'/',str_replace($VPre,'\\',$replace),(string) $val);
- //echo "'$val'";
-
- $reg = $CPreReg.'([a-zA-Z_0-9 ]+)'.$CPosReg;
- while (ereg($reg,$val,$vars))
- { // expand all CSV fields
- $val = str_replace($CPre.$vars[1].$CPos,$val[0] == '@' ? "'".addslashes($fields[array_search($vars[1],$csv_fields)])."'" : $fields[array_search($vars[1],$csv_fields)],$val);
- }
- //echo "='$val'
";
- if ($val[0] == '@' && is_admin)
- {
- // removing the $ to close security hole of showing vars, which contain eg. passwords
- $val = 'return '.substr(str_replace('$','',$val),1).';';
- // echo "eval('$val')=";
- $val = eval($val);
- // echo "'$val'
";
- }
- if ($pattern[0] != '@' || $val)
- break;
- }
- }
- }
- $values[$info] = $orig[$info] = $val;
- }
- if (!isset($values['public']))
- {
- $values['public'] = 1; // public access if not set by user
- }
- if (!isset($values['recur_type']))
- {
- $values['recur_type'] = MCAL_RECUR_NONE; // single event if not set by user
- }
-
- if(count($values)) // dont import empty contacts
- {
- //echo "values=".print_r($values,True)." \n";
- foreach(array('owner','modifier') as $name)
- {
- if (preg_match('/\[([^\]]+)\]/',$values[$name],$matches)) $values[$name] = $matches[1];
- if (!is_numeric($values[$name])) $values[$name] = $GLOBALS['egw']->accounts->name2id($values[$name],'account_lid','u');
- }
- if (!$values['owner'] || !$GLOBALS['egw']->accounts->exists($values['owner']))
- {
- $values['owner'] = $GLOBALS['egw_info']['user']['account_id'];
- }
- if ($values['priority'] < 1 || $values['priority'] > 3)
- {
- $values['priority'] = 2;
- }
- // convert the category name to an id
- if ($values['category'] && !is_numeric($values['category']))
- {
- $values['category'] = cat_id($values['category']);
- }
- if (empty($values['title']))
- {
- $values['title'] = '('.lang('none').')';
- }
-
- // convert dates to timestamps
- foreach(array('start','end','modified') as $date)
- {
- if (isset($values[$date]) && !is_numeric($date))
- {
- // convert german DD.MM.YYYY format into ISO YYYY-MM-DD format
- $values[$date] = preg_replace('/([0-9]{1,2}).([0-9]{1,2}).([0-9]{4})/','\3-\2-\1',$values[$date]);
- // remove fractures of seconds if present at the end of the string
- if (preg_match('/(.*)\.[0-9]+/',$values[$date],$parts)) $values[$date] = $parts[1];
- $values[$date] = strtotime($values[$date]);
- }
- }
- // convert participants-names to user-id's
- $parts = $values['participants'] ? preg_split('/[,;]/',$values['participants']) : array();
- $values['participants'] = array();
- foreach($parts as $part_status)
- {
- list($part,$status) = explode('=',$part_status);
- $valid_status = array('U'=>'U','u'=>'U','A'=>'A','a'=>'A','R'=>'R','r'=>'R','T'=>'T','t'=>'T');
- $status = isset($valid_status[$status]) ? $valid_status[$status] : 'U';
- if (!is_numeric($part))
- {
- if (preg_match('/\[([^\]]+)\]/',$part,$matches)) $part = $matches[1];
- $part = $GLOBALS['egw']->accounts->name2id($part);
- }
- if ($part && is_numeric($part))
- {
- $values['participants'][$part] = $status;
- }
- }
- if (!count($values['participants'])) // no valid participants so far --> add the importing user/owner
- {
- $values['participants'][$values['owner']] = 'A';
- }
- if ($values['addr_id'] && !is_numeric($values['addr_id']))
- {
- list($lastname,$firstname,$org_name) = explode(',',$values['addr_id']);
- $values['addr_id'] = addr_id($lastname,$firstname,$org_name);
- }
- if ($values['uid'])
- {
- if (is_numeric($values['uid'])) // to not conflict with our own id's
- {
- $values['uid'] = 'cal-csv-import-'.$values['uid'].'-'.$GLOBALS['egw_info']['server']['install_id'];
- }
- if (($event = $cal->read($values['uid'],null,$is_admin))) // no ACL check for admins
- {
- //echo "updating existing event"; _debug_array($event);
- $values['id'] = $event['id'];
- }
- }
- $action = $values['id'] ? 'updating' : 'adding';
- //echo $action.''.print_r($values,True)." \n";
-
- // Keep links, $cal->update will remove them
- $links = array(
- 'addr_id' => 'addressbook:' . $values['addr_id'],
- 'link_1' => $values['link_1'],
- 'link_2' => $values['link_2'],
- 'link_3' => $values['link_3'],
- );
- if (!$_POST['debug'] &&
- ($cal_id = $cal->update($values,true,!$values['modified'],$is_admin))) // ignoring conflicts and ACL (for admins) on import
- {
- foreach($links as $value) {
- list($app,$app_id) = explode(':',$value);
- if ($app && $app_id)
- {
- //echo "linking calendar:$cal_id with $app:$app_id
\n";
- egw_link::link('calendar',$cal_id,$app,$app_id);
- }
- }
- }
- // display read and interpreted results, so the user can check it
- foreach($cal_fields as $name)
- {
- $log .= "\t\t".($orig[$name] != $values[$name] ? htmlspecialchars($orig[$name]).' --> ' : '').
- htmlspecialchars($values[$name])." \n";
- }
- if(!$_POST['debug'] && count($values)) // dont import empty contacts
- {
- $log .= "\t\t".''.($cal_id ? $action." cal_id=$cal_id" : 'Error '.$action)." \n\t \n";
- }
- else
- {
- $log .= "\t\t".'only test '."\n\t\n";
- }
- }
- }
- $log .= "
\n";
-
- $template->set_var('anz_imported',($_POST['debug'] ?
- lang('%1 records read (not yet imported, you may go back and uncheck Test Import)',
- $anz,'','') :
- lang('%1 records imported',$anz)). ' '.
- (!$_POST['debug'] && $fields ? html::submit_button('next','Import next set') . ' ':'').
- html::submit_button('continue','Back') . ' '.
- html::submit_button('cancel','Cancel'));
- $template->set_var('log',$log);
- $template->parse('rows','imported');
- break;
-}
-$template->set_var('hiddenvars',str_replace('{','{',$hiddenvars));
-$template->pfp('phpgw_body','import');
-$GLOBALS['egw']->common->egw_footer();
diff --git a/calendar/inc/class.calendar_hooks.inc.php b/calendar/inc/class.calendar_hooks.inc.php
index ef6db9964d..8f407812c9 100644
--- a/calendar/inc/class.calendar_hooks.inc.php
+++ b/calendar/inc/class.calendar_hooks.inc.php
@@ -143,20 +143,6 @@ class calendar_hooks
display_section('calendar','calendar',$file);
}
- /**
- * Entries for calendar's preferences menu
- */
- static function preferences()
- {
- $file = array(
- 'Preferences' => egw::link('/index.php','menuaction=preferences.uisettings.index&appname=calendar'),
- 'Grant Access' => egw::link('/index.php','menuaction=preferences.uiaclprefs.index&acl_app=calendar'),
- 'Edit Categories' => egw::link('/index.php','menuaction=preferences.preferences_categories_ui.index&cats_app=calendar&cats_level=True&global_cats=True'),
- 'Import CSV-File' => egw::link('/calendar/csv_import.php'),
- );
- display_section('calendar','calendar',$file);
- }
-
/**
* Calendar preferences
*
@@ -737,6 +723,17 @@ class calendar_hooks
}
return $rights;
}
+
+ /**
+ * Hook to tell framework we use standard categories method
+ *
+ * @param string|array $data hook-data or location
+ * @return boolean
+ */
+ public static function categories($data)
+ {
+ return true;
+ }
}
// Not part of the class, since config hooks are still using the old style
diff --git a/calendar/inc/class.calendar_ui.inc.php b/calendar/inc/class.calendar_ui.inc.php
index 173027070a..feb4c3d8bf 100644
--- a/calendar/inc/class.calendar_ui.inc.php
+++ b/calendar/inc/class.calendar_ui.inc.php
@@ -869,17 +869,6 @@ function load_cal(url,id,no_reset) {
display_sidebox($appname,$menu_title,$file);
}
- if ($GLOBALS['egw_info']['user']['apps']['preferences'])
- {
- $menu_title = lang('Preferences');
- $file = Array(
- 'Calendar preferences'=>egw::link('/index.php','menuaction=preferences.uisettings.index&appname=calendar','preferences'),
- 'Grant Access'=>egw::link('/index.php','menuaction=preferences.uiaclprefs.index&acl_app=calendar'),
- 'Edit Categories' =>egw::link('/index.php','menuaction=preferences.preferences_categories_ui.index&cats_app=calendar&cats_level=True&global_cats=True'),
- );
- display_sidebox($appname,$menu_title,$file);
- }
-
if ($GLOBALS['egw_info']['user']['apps']['admin'])
{
$menu_title = lang('Administration');
diff --git a/calendar/setup/setup.inc.php b/calendar/setup/setup.inc.php
index 12e86dee01..4597aaade2 100755
--- a/calendar/setup/setup.inc.php
+++ b/calendar/setup/setup.inc.php
@@ -37,7 +37,6 @@ $setup_info['calendar']['tables'][] = 'egw_cal_timezones';
$setup_info['calendar']['hooks']['admin'] = 'calendar_hooks::admin';
$setup_info['calendar']['hooks']['deleteaccount'] = 'calendar.calendar_so.deleteaccount';
$setup_info['calendar']['hooks']['home'] = 'calendar_hooks::home';
-$setup_info['calendar']['hooks']['preferences'] = 'calendar_hooks::preferences';
$setup_info['calendar']['hooks']['settings'] = 'calendar_hooks::settings';
$setup_info['calendar']['hooks']['sidebox_menu'] = 'calendar.calendar_ui.sidebox_menu';
$setup_info['calendar']['hooks']['search_link'] = 'calendar_hooks::search_link';
@@ -46,6 +45,7 @@ $setup_info['calendar']['hooks']['timesheet_set'] = 'calendar.calendar_bo.timesh
$setup_info['calendar']['hooks']['infolog_set'] = 'calendar.calendar_bo.infolog_set';
$setup_info['calendar']['hooks']['export_limit'] = 'calendar_hooks::getAppExportLimit';
$setup_info['calendar']['hooks']['acl_rights'] = 'calendar_hooks::acl_rights';
+$setup_info['calendar']['hooks']['categories'] = 'calendar_hooks::categories';
/* Dependencies for this app to work */
$setup_info['calendar']['depends'][] = array(
diff --git a/calendar/setup/tz_aliases.inc.php b/calendar/setup/tz_aliases.inc.php
index f9ca2da318..9eb44aab6b 100644
--- a/calendar/setup/tz_aliases.inc.php
+++ b/calendar/setup/tz_aliases.inc.php
@@ -205,4 +205,7 @@ $tz_aliases = array(
'Mexico Standard Time' => 'America/Mexico_City',
'Mexico Standard Time 2' => 'America/Chihuahua',
'Mid-Atlantic Standard Time' => 'Atlantic/South_Georgia',
+
+ // for CalDAVTester
+ 'US/Eastern' => 'America/New_York',
);
diff --git a/filemanager/inc/class.filemanager_hooks.inc.php b/filemanager/inc/class.filemanager_hooks.inc.php
index 1abae89ec9..e911933b94 100644
--- a/filemanager/inc/class.filemanager_hooks.inc.php
+++ b/filemanager/inc/class.filemanager_hooks.inc.php
@@ -84,7 +84,6 @@ class filemanager_hooks
}
display_sidebox(self::$appname,$title,$file);
}
- if ($GLOBALS['egw_info']['user']['apps']['preferences']) self::preferences(self::$appname);
if ($GLOBALS['egw_info']['user']['apps']['admin']) self::admin(self::$appname);
}
@@ -120,28 +119,6 @@ class filemanager_hooks
}
}
- /**
- * Entries for filemanagers's preferences menu
- *
- * @param string|array $location ='preferences' hook name or params
- */
- static function preferences($location = 'preferences')
- {
- if (is_array($location)) $location = $location['location'];
-
- $file = array(
- 'Preferences' => egw::link('/index.php','menuaction=preferences.uisettings.index&appname='.self::$appname,'preferences'),
- );
- if ($location == 'preferences')
- {
- display_section(self::$appname,$file);
- }
- else
- {
- display_sidebox(self::$appname,lang('Preferences'),$file);
- }
- }
-
/**
* Settings for preferences
*
diff --git a/filemanager/setup/setup.inc.php b/filemanager/setup/setup.inc.php
index 1528e4300f..98839e29a1 100755
--- a/filemanager/setup/setup.inc.php
+++ b/filemanager/setup/setup.inc.php
@@ -23,7 +23,6 @@ $setup_info['filemanager']['maintainer'] = array(
$setup_info['filemanager']['license'] = 'GPL';
/* The hooks this app includes, needed for hooks registration */
-$setup_info['filemanager']['hooks']['preferences'] = 'filemanager_hooks::preferences';
$setup_info['filemanager']['hooks']['settings'] = 'filemanager_hooks::settings';
$setup_info['filemanager']['hooks']['sidebox_menu'] = 'filemanager_hooks::sidebox_menu';
#$setup_info['filemanager']['hooks']['verify_settings'] = 'filemanager.filemanager_hooks.verify_settings';
diff --git a/importexport/inc/class.importexport_admin_prefs_sidebox_hooks.inc.php b/importexport/inc/class.importexport_admin_prefs_sidebox_hooks.inc.php
index 78eee333b1..2a07e7ee31 100644
--- a/importexport/inc/class.importexport_admin_prefs_sidebox_hooks.inc.php
+++ b/importexport/inc/class.importexport_admin_prefs_sidebox_hooks.inc.php
@@ -56,17 +56,10 @@ class importexport_admin_prefs_sidebox_hooks
'menuaction' => 'importexport.importexport_definitions_ui.index',
),$GLOBALS['egw_info']['user']['apps']['admin'] ? 'admin' : 'preferences');
}
- if ($location == 'preferences')
- {
- display_section($appname,$file);
- }
- else
- {
- display_sidebox($appname,lang($appname),$file);
- }
+ display_sidebox($appname,lang($appname),$file);
}
- if ($GLOBALS['egw_info']['user']['apps']['admin'] && $location != 'preferences')
+ if ($GLOBALS['egw_info']['user']['apps']['admin'])
{
$file = Array(
'Site Configuration' => egw::link('/index.php','menuaction=importexport.importexport_definitions_ui.site_config','admin'),
diff --git a/importexport/setup/setup.inc.php b/importexport/setup/setup.inc.php
index a461586bbc..3c1f36cb3a 100644
--- a/importexport/setup/setup.inc.php
+++ b/importexport/setup/setup.inc.php
@@ -29,7 +29,6 @@ $setup_info['importexport']['note'] =
'';
/* The hooks this app includes, needed for hooks registration */
-$setup_info['importexport']['hooks']['preferences'] =
$setup_info['importexport']['hooks']['admin'] =
$setup_info['importexport']['hooks']['sidebox_menu'] = 'importexport_admin_prefs_sidebox_hooks::all_hooks';
$setup_info['importexport']['hooks']['sidebox_all'] = 'importexport_admin_prefs_sidebox_hooks::other_apps';
diff --git a/infolog/inc/class.infolog_hooks.inc.php b/infolog/inc/class.infolog_hooks.inc.php
index b33a4cfe09..08171ca085 100644
--- a/infolog/inc/class.infolog_hooks.inc.php
+++ b/infolog/inc/class.infolog_hooks.inc.php
@@ -103,24 +103,7 @@ class infolog_hooks
display_sidebox($appname,$GLOBALS['egw_info']['apps']['infolog']['title'].' '.lang('Menu'),$file);
}
- if ($GLOBALS['egw_info']['user']['apps']['preferences'] && $location != 'admin')
- {
- $file = array(
- 'Preferences' => egw::link('/index.php','menuaction=preferences.uisettings.index&appname='.$appname,'preferences'),
- 'Grant Access' => egw::link('/index.php','menuaction=preferences.uiaclprefs.index&acl_app='.$appname),
- 'Edit Categories' => egw::link('/index.php','menuaction=preferences.preferences_categories_ui.index&cats_app=' . $appname . '&cats_level=True&global_cats=True')
- );
- if ($location == 'preferences')
- {
- display_section($appname,$file);
- }
- else
- {
- display_sidebox($appname,lang('Preferences'),$file);
- }
- }
-
- if ($GLOBALS['egw_info']['user']['apps']['admin'] && $location != 'preferences')
+ if ($GLOBALS['egw_info']['user']['apps']['admin'])
{
$file = Array(
'Site configuration' => egw::link('/index.php',array(
@@ -572,4 +555,15 @@ class infolog_hooks
acl::PRIVAT => 'private',
);
}
+
+ /**
+ * Hook to tell framework we use standard categories method
+ *
+ * @param string|array $data hook-data or location
+ * @return boolean
+ */
+ public static function categories($data)
+ {
+ return true;
+ }
}
diff --git a/infolog/setup/setup.inc.php b/infolog/setup/setup.inc.php
index 6bea665cab..9f7c600abc 100755
--- a/infolog/setup/setup.inc.php
+++ b/infolog/setup/setup.inc.php
@@ -45,12 +45,12 @@ $setup_info['infolog']['note'] =
InfoLog page on our Website .
';
/* The hooks this app includes, needed for hooks registration */
-$setup_info['infolog']['hooks']['preferences'] = 'infolog_hooks::all_hooks';
$setup_info['infolog']['hooks']['settings'] = 'infolog_hooks::settings';
$setup_info['infolog']['hooks']['verify_settings'] = 'infolog_hooks::verify_settings';
$setup_info['infolog']['hooks']['admin'] = 'infolog_hooks::all_hooks';
$setup_info['infolog']['hooks']['not_enum_group_acls'] = 'infolog_hooks::not_enum_group_acls';
$setup_info['infolog']['hooks']['acl_rights'] = 'infolog_hooks::acl_rights';
+$setup_info['infolog']['hooks']['categories'] = 'infolog_hooks::categories';
$setup_info['infolog']['hooks']['deleteaccount'] = 'infolog.infolog_so.change_delete_owner';
$setup_info['infolog']['hooks'][] = 'home';
$setup_info['infolog']['hooks']['addressbook_view'] = 'infolog.infolog_ui.hook_view';
diff --git a/mail/inc/class.mail_hooks.inc.php b/mail/inc/class.mail_hooks.inc.php
index 69c4e98f71..8b78571698 100644
--- a/mail/inc/class.mail_hooks.inc.php
+++ b/mail/inc/class.mail_hooks.inc.php
@@ -717,52 +717,6 @@ class mail_hooks
display_section($appname,$title,$file);
}
- /**
- * Preferences hook
- *
- * @param array|string $hook_data
- */
- static function preferences($hook_data)
- {
- unset($GLOBALS['egw_info']['user']['preferences']['common']['auto_hide_sidebox']);
- // Only Modify the $file and $title variables.....
- $title = $appname = 'mail';
- $profileID = 0;
- if (isset($GLOBALS['egw_info']['user']['preferences']['mail']['ActiveProfileID']))
- $profileID = (int)$GLOBALS['egw_info']['user']['preferences']['mail']['ActiveProfileID'];
-
- $mail_bo = mail_bo::getInstance(true,$profileID);
- $profileID = $GLOBALS['egw_info']['user']['preferences']['mail']['ActiveProfileID'] = $mail_bo->profileID;
- $mailPreferences =& $mail_bo->mailPreferences;
-
- $file['Preferences'] = egw::link('/index.php','menuaction=preferences.preferences_settings.index&appname=' . $appname,'preferences');
-
- if($mailPreferences->userDefinedAccounts) {
- $linkData = array
- (
- 'menuaction' => 'mail.uipreferences.listAccountData',
- );
- $file['Manage eMail Accounts and Identities'] = egw::link('/index.php',$linkData);
- }
- if(empty($mailPreferences->preferences['prefpreventmanagefolders']) || $mailPreferences->preferences['prefpreventmanagefolders'] == 0) {
- $file['Manage Folders'] = egw::link('/index.php','menuaction=mail.uipreferences.listFolder');
- }
- if (is_object($mailPreferences))
- {
- $icServer = $mailPreferences->getIncomingServer($profileID);
-
- if($icServer->enableSieve) {
- if(empty($mailPreferences->preferences['prefpreventeditfilterrules']) || $mailPreferences->preferences['prefpreventeditfilterrules'] == 0)
- $file['filter rules'] = egw::link('/index.php', 'menuaction=mail.mail_sieve.index');
- if(empty($mailPreferences->preferences['prefpreventabsentnotice']) || $mailPreferences->preferences['prefpreventabsentnotice'] == 0)
- $file['vacation notice'] = egw::link('/index.php','menuaction=mail.mail_sieve.editVacation');
- }
- }
-
- //Do not modify below this line
- display_section($appname,$title,$file);
- }
-
/**
* Sidebox menu hook
*
@@ -848,10 +802,8 @@ class mail_hooks
if ($GLOBALS['egw_info']['user']['apps']['preferences'])
{
#$mailPreferences = ExecMethod('mail.bopreferences.getPreferences');
- $menu_title = lang('Preferences');
- $file = array(
- 'Preferences' => egw::link('/index.php','menuaction=preferences.preferences_settings.index&appname=mail','preferences'),
- );
+ $menu_title = lang('Preferences'); // ToDo: remove Preferences sub-menu from sidebox
+ $file = array();
/*
if($preferences->userDefinedAccounts || $preferences->userDefinedIdentities) {
$linkData = array (
diff --git a/mail/setup/setup.inc.php b/mail/setup/setup.inc.php
index 8e0aabe962..6905b83e10 100644
--- a/mail/setup/setup.inc.php
+++ b/mail/setup/setup.inc.php
@@ -33,7 +33,6 @@ $setup_info['mail']['hooks']['editaccount'] = 'mail_hooks::accountHooks';
$setup_info['mail']['hooks']['search_link'] = 'mail_hooks::search_link';
$setup_info['mail']['hooks']['admin'] = 'mail_hooks::admin';
$setup_info['mail']['hooks']['settings'] = 'mail_hooks::settings';
-$setup_info['mail']['hooks']['preferences'] = 'mail_hooks::preferences';
$setup_info['mail']['hooks']['sidebox_menu'] = 'mail_hooks::sidebox_menu';
$setup_info['mail']['hooks']['session_creation'] = 'mail_bo::resetConnectionErrorCache';
$setup_info['mail']['hooks']['verify_settings'] = 'mail_bo::forcePrefReload';
diff --git a/notifications/inc/hook_preferences.inc.php b/notifications/inc/hook_preferences.inc.php
deleted file mode 100644
index 4a2ab92ece..0000000000
--- a/notifications/inc/hook_preferences.inc.php
+++ /dev/null
@@ -1,19 +0,0 @@
-
- * @version $Id$
- */
-
-$file = Array(
- 'Preferences' => egw::link('/index.php',array(
- 'menuaction' => 'preferences.uisettings.index',
- 'appname' => $appname,
- )),
- 'Java desktop notification app' => egw::link('/notifications/download.php'),
-);
-display_section($appname,$file);
diff --git a/notifications/setup/setup.inc.php b/notifications/setup/setup.inc.php
index 395b3774c7..5860edccd1 100644
--- a/notifications/setup/setup.inc.php
+++ b/notifications/setup/setup.inc.php
@@ -31,7 +31,6 @@ $setup_info[NOTIFICATION_APP]['description'] =
/* The hooks this app includes, needed for hooks registration */
$setup_info[NOTIFICATION_APP]['hooks'][] = 'after_navbar';
-$setup_info[NOTIFICATION_APP]['hooks'][] = 'preferences';
$setup_info[NOTIFICATION_APP]['hooks'][] = 'settings';
$setup_info[NOTIFICATION_APP]['hooks'][] = 'admin';
$setup_info[NOTIFICATION_APP]['hooks']['deleteaccount'] = 'notifications.notifications.deleteaccount';
diff --git a/phpgwapi/inc/class.egw_framework.inc.php b/phpgwapi/inc/class.egw_framework.inc.php
index f63253ac2d..e236d25634 100644
--- a/phpgwapi/inc/class.egw_framework.inc.php
+++ b/phpgwapi/inc/class.egw_framework.inc.php
@@ -198,7 +198,7 @@ abstract class egw_framework
* @param string $msg message to show
* @param string $type='success' 'error', 'warning' or 'success' (default)
*/
- function message($msg, $type='success')
+ public static function message($msg, $type='success')
{
self::$extra['message'] = func_get_args();
}
@@ -1010,10 +1010,14 @@ abstract class egw_framework
{
$this->_add_topmenu_item($apps['home']);
}
+
if($GLOBALS['egw_info']['user']['apps']['preferences'])
{
- $this->_add_topmenu_item($apps['preferences']);
+ $this->add_preferences_topmenu('prefs');
+ $this->add_preferences_topmenu('acl');
+ $this->add_preferences_topmenu('cats');
}
+
// allways display password in topmenu, if user has rights to change it
if((($pw_app = $GLOBALS['egw_info']['user']['apps']['preferences']) ||
($pw_app = $GLOBALS['egw_info']['user']['apps']['password'])) &&
@@ -1027,11 +1031,6 @@ abstract class egw_framework
));
}
- if (($acl = $this->topmenu_acl()))
- {
- $this->_add_topmenu_item($acl);
- }
-
if($GLOBALS['egw_info']['user']['apps']['manual'] && isset($apps['manual']))
{
$this->_add_topmenu_item(array_merge($apps['manual'],array('title' => lang('Help'))));
@@ -1055,29 +1054,50 @@ abstract class egw_framework
}
/**
- * Add ACL link to topmenu using acl_rights-hook to know if an app supports acl
+ * Add preferences link to topmenu using settings-hook to know if an app supports preferences
*/
- function topmenu_acl()
+ protected function add_preferences_topmenu($type='prefs')
{
- if (!$GLOBALS['egw_info']['user']['apps']['preferences'] ||
- $GLOBALS['egw_info']['server']['deny_acl'] && array_intersect(
- $GLOBALS['egw']->accounts->memberships($GLOBALS['egw_info']['user']['account_id'], true),
- (array)$GLOBALS['egw_info']['server']['deny_acl']))
+ static $memberships;
+ if (!isset($memberships)) $memberships = $GLOBALS['egw']->accounts->memberships($GLOBALS['egw_info']['user']['account_id'], true);
+ static $types = array(
+ 'prefs' => array(
+ 'title' => 'Preferences',
+ 'hook' => 'settings',
+ ),
+ 'acl' => array(
+ 'title' => 'Access',
+ 'hook' => 'acl_rights',
+ ),
+ 'cats' => array(
+ 'title' => 'Categories',
+ 'hook' => 'categories',
+ 'run_hook' => true, // acturally run hook, not just look it's implemented
+ ),
+ );
+ if (!$GLOBALS['egw_info']['user']['apps']['preferences'] || $GLOBALS['egw_info']['server']['deny_'.$type] &&
+ array_intersect($memberships, (array)$GLOBALS['egw_info']['server']['deny_'.$type]))
{
return; // user has no access to preferences app
}
- $apps = $GLOBALS['egw']->hooks->process('acl_rights');
- foreach($apps as $app => $rights)
+ if (isset($types[$type]['run_hook']))
{
- if (!$rights) unset($apps[$app]);
+ $apps = $GLOBALS['egw']->hooks->process($types[$type]['hook']);
+ // as all apps answer, we need to remove none-true responses
+ foreach($apps as $app => $val)
+ {
+ if (!$val) unset($apps[$app]);
+ }
}
- $apps = array_keys($apps);
-
- return array(
+ else
+ {
+ $apps = $GLOBALS['egw']->hooks->hook_implemented($types[$type]['hook']);
+ }
+ $this->_add_topmenu_item(array(
'name' => 'preferences',
- 'title' => lang('Access'),
- 'url' => 'javascript:egw_preferences("acl", '.json_encode($apps).')',
- );
+ 'title' => lang($types[$type]['title']),
+ 'url' => "javascript:egw_preferences('$type',".json_encode($apps).')',
+ ));
}
/**
diff --git a/preferences/inc/class.preferences_hooks.inc.php b/preferences/inc/class.preferences_hooks.inc.php
index d5bcea627e..b115dd202b 100644
--- a/preferences/inc/class.preferences_hooks.inc.php
+++ b/preferences/inc/class.preferences_hooks.inc.php
@@ -424,22 +424,6 @@ class preferences_hooks
return $settings;
}
- /**
- * Hook to return preferences menu items
- *
- * @param string|array $hook_data
- */
- public static function preferences($hook_data)
- {
- if (!$GLOBALS['egw']->acl->check('nopasswordchange',1))
- {
- $file['Change your Password'] = $GLOBALS['egw']->link('/index.php','menuaction=preferences.uipassword.change');
- }
- $file['common preferences'] = $GLOBALS['egw']->link('/index.php','menuaction=preferences.preferences_settings.index&appname=preferences');
-
- display_section('preferences',$file);
- }
-
/**
* Hook called when a user gets deleted, to delete his preferences
*
diff --git a/preferences/inc/class.preferences_settings.inc.php b/preferences/inc/class.preferences_settings.inc.php
index 962f694697..8b6146e21f 100644
--- a/preferences/inc/class.preferences_settings.inc.php
+++ b/preferences/inc/class.preferences_settings.inc.php
@@ -88,12 +88,9 @@ class preferences_settings
$attribute = $type == 'group' ? 'user' : $type;
if (!($msg=$this->process_array($GLOBALS['egw']->preferences->$attribute, $prefs, $content['types'], $appname, $attribute)))
{
- $msg = lang('Preferences saved.'); //.array2string($prefs);
+ $msg_type = 'success';
+ $msg = lang('Preferences saved.');
}
- if ($button == 'apply') break;
- // fall throught
- case 'cancel':
- egw::redirect_link('/preferences/index.php');
}
}
$appname = $content['appname'] ? $content['appname'] : 'common';
@@ -124,7 +121,8 @@ class preferences_settings
$msg = $this->process_array($GLOBALS['egw']->preferences->$attribute,
(array)$GLOBALS['egw']->preferences->{$attribute}[$appname], $preserve['types'], $appname, $attribute, true);
}
- $content['msg'] = $msg;
+
+ if ($msg) egw_framework::message($msg, $msg_type ? $msg_type : 'error');
$tpl->exec('preferences.preferences_settings.index', $content, $sel_options, $readonlys, $preserve);
}
@@ -429,7 +427,7 @@ class preferences_settings
{
$content['type'] .= ':'.$id;
$sel_options['type'][$content['type']] = common::grab_owner_name($GLOBALS['egw']->preferences->account_id);
-
+
// Restrict app list to apps the user has access to
$user_apps = $GLOBALS['egw']->acl->get_user_applications($id);
$sel_options['appname'] = array_intersect_key($sel_options['appname'], $user_apps);
diff --git a/preferences/index.php b/preferences/index.php
deleted file mode 100755
index 9621ad0840..0000000000
--- a/preferences/index.php
+++ /dev/null
@@ -1,105 +0,0 @@
-
- * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
- * @version $Id$
- */
-
-$GLOBALS['egw_info'] = array(
- 'flags' => array(
- 'noheader' => true,
- 'novavbar' => true,
- 'currentapp' => 'preferences',
- 'disable_Template_class' => True,
- ),
-);
-include('../header.inc.php');
-
-auth::check_password_age('preferences','index');
-$GLOBALS['egw_info']['flags']['nonavbar']=false;
-common::egw_header();
-$pref_tpl = new Template(EGW_APP_TPL);
-$templates = Array(
- 'pref' => 'index.tpl'
-);
-
-$pref_tpl->set_file($templates);
-
-$pref_tpl->set_block('pref','list');
-$pref_tpl->set_block('pref','app_row');
-$pref_tpl->set_block('pref','app_row_noicon');
-$pref_tpl->set_block('pref','link_row');
-$pref_tpl->set_block('pref','spacer_row');
-
-// This func called by the includes to dump a row header
-function section_start($appname='',$icon='')
-{
- global $pref_tpl;
-
- $pref_tpl->set_var('a_name',$appname);
- $pref_tpl->set_var('app_name',$GLOBALS['egw_info']['apps'][$appname]['title']);
- $pref_tpl->set_var('app_icon',$icon);
- if ($icon)
- {
- $pref_tpl->parse('rows','app_row',True);
- }
- else
- {
- $pref_tpl->parse('rows','app_row_noicon',True);
- }
-}
-
-function section_item($pref_link='',$pref_text='')
-{
- global $pref_tpl;
-
- $pref_link = str_replace('preferences.uisettings.index', 'preferences.preferences_settings.index', $pref_link);
-
- $pref_tpl->set_var('pref_link',$pref_link);
-
- if (strtolower($pref_text) == 'grant access' && $GLOBALS['egw_info']['server']['deny_user_grants_access'])
- {
- return False;
- }
- else
- {
- $pref_tpl->set_var('pref_text',$pref_text);
- }
-
- $pref_tpl->parse('rows','link_row',True);
-}
-
-function section_end()
-{
- global $pref_tpl;
-
- $pref_tpl->parse('rows','spacer_row',True);
-}
-
-function display_section($appname,$file,$file2=False)
-{
- if ($file2)
- {
- $file = $file2;
- }
- section_start($appname,common::image($appname,Array('navbar',$appname)));
-
- foreach($file as $text => $url)
- {
- if (is_array($url))
- {
- $text = $url['text'];
- $url = $url['link'];
- }
- section_item($url,lang($text));
- }
- section_end();
-}
-
-$GLOBALS['egw']->hooks->process('preferences',array('preferences'));
-$pref_tpl->pfp('out','list');
-common::egw_footer();
diff --git a/preferences/setup/setup.inc.php b/preferences/setup/setup.inc.php
index 1a0b37dd73..9854314461 100755
--- a/preferences/setup/setup.inc.php
+++ b/preferences/setup/setup.inc.php
@@ -20,7 +20,6 @@ $setup_info['preferences']['license'] = 'GPL';
/* The hooks this app includes, needed for hooks registration */
$setup_info['preferences']['hooks']['deleteaccount'] = 'preferences_hooks::deleteaccount';
$setup_info['preferences']['hooks']['deletegroup'] = 'preferences_hooks::deleteaccount';
-$setup_info['preferences']['hooks']['preferences'] = 'preferences_hooks::preferences';
$setup_info['preferences']['hooks']['settings'] = 'preferences_hooks::settings';
$setup_info['preferences']['hooks']['edit_user'] = 'preferences_hooks::edit_user';
$setup_info['preferences']['hooks']['view_user'] = 'preferences_hooks::edit_user';
@@ -36,16 +35,3 @@ $setup_info['preferences']['depends'][] = array(
'appname' => 'phpgwapi',
'versions' => Array('1.7','1.8','1.9')
);
-
-/**
- * Password change without preferences rights
- */
-$setup_info['password']['name'] = 'password';
-$setup_info['password']['title'] = 'Password';
-$setup_info['password']['version'] = $setup_info['preferences']['version'];
-$setup_info['password']['app_order'] = 1;
-$setup_info['password']['tables'] = array();
-$setup_info['password']['enable'] = 2;
-$setup_info['password']['index'] = '/preferences/password.php';
-$setup_info['password']['license'] = $setup_info['preferences']['license'];
-$setup_info['password']['depends'] = $setup_info['preferences']['depends'];
diff --git a/preferences/templates/default/index.tpl b/preferences/templates/default/index.tpl
deleted file mode 100644
index 8d693170f8..0000000000
--- a/preferences/templates/default/index.tpl
+++ /dev/null
@@ -1,63 +0,0 @@
-
-
-
- {rows}
-
-
-
-
-
-
{app_name}
-
-
-
-
-
-
diff --git a/preferences/templates/default/settings.xet b/preferences/templates/default/settings.xet
index 84d56cd352..aa57a95e2a 100644
--- a/preferences/templates/default/settings.xet
+++ b/preferences/templates/default/settings.xet
@@ -22,7 +22,6 @@
-
@@ -37,10 +36,6 @@
-
-
-
-
-
+
\ No newline at end of file
diff --git a/resources/inc/class.resources_hooks.inc.php b/resources/inc/class.resources_hooks.inc.php
index 1a24182cd3..c10a0d9d71 100644
--- a/resources/inc/class.resources_hooks.inc.php
+++ b/resources/inc/class.resources_hooks.inc.php
@@ -40,26 +40,7 @@ class resources_hooks
display_sidebox($appname,$title,$file);
}
- if ($GLOBALS['egw_info']['user']['apps']['preferences'] && $location != 'admin'
- && $GLOBALS['egw_info']['user']['apps']['importexport']) // Only one preference right now, need this to prevent errors
- {
- $file = array(
- 'Preferences' => egw::link('/index.php','menuaction=preferences.uisettings.index&appname='.$appname,'preferences'),
- // Categories control access, not regular ACL system
- // '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')
- );
- if ($location == 'preferences')
- {
- display_section($appname,$file);
- }
- else
- {
- display_sidebox($appname,lang('Preferences'),$file);
- }
- }
-
- if ($GLOBALS['egw_info']['user']['apps']['admin'] && $location != 'preferences')
+ if ($GLOBALS['egw_info']['user']['apps']['admin'])
{
$file = Array(
'Site Configuration' => egw::link('/index.php','menuaction=admin.uiconfig.index&appname=' . $appname),
@@ -226,4 +207,23 @@ class resources_hooks
}
return $settings;
}
+
+ /**
+ * Hook to tell framework we use only global categories (return link data in that case and false otherwise)
+ *
+ * @param string|array $data hook-data or location
+ * @return boolean|array
+ */
+ public static function categories($data)
+ {
+ if ($GLOBALS['egw_info']['user']['apps']['admin'])
+ {
+ return array(
+ 'menuaction' => 'admin.admin_categories.index',
+ 'appname' => $appname,
+ 'global_cats'=> true
+ );
+ }
+ return false;
+ }
}
diff --git a/resources/setup/setup.inc.php b/resources/setup/setup.inc.php
index 0c7a6c1326..0ccb34460f 100755
--- a/resources/setup/setup.inc.php
+++ b/resources/setup/setup.inc.php
@@ -27,7 +27,7 @@ $setup_info['resources']['maintainer'] = array(
'email' => 'egroupware-developers@lists.sf.net'
);
-$setup_info['resources']['hooks']['preferences'] = 'resources.resources_hooks.admin_prefs_sidebox';
+$setup_info['resources']['hooks']['categories'] = 'resources_hooks::categories';
$setup_info['resources']['hooks']['admin'] = 'resources.resources_hooks.admin_prefs_sidebox';
$setup_info['resources']['hooks']['sidebox_menu'] = 'resources.resources_hooks.admin_prefs_sidebox';
$setup_info['resources']['hooks']['search_link'] = 'resources.resources_hooks.search_link';
diff --git a/timesheet/inc/class.timesheet_hooks.inc.php b/timesheet/inc/class.timesheet_hooks.inc.php
index 948534b50d..8c9dc4fc12 100644
--- a/timesheet/inc/class.timesheet_hooks.inc.php
+++ b/timesheet/inc/class.timesheet_hooks.inc.php
@@ -117,25 +117,7 @@ class timesheet_hooks
display_sidebox($appname,$GLOBALS['egw_info']['apps'][$appname]['title'].' '.lang('Menu'),$file);
}
- if ($GLOBALS['egw_info']['user']['apps']['preferences'] && $location != 'admin')
- {
- $file = array(
- 'Preferences' => egw::link('/index.php','menuaction=preferences.uisettings.index&appname='.$appname,'preferences'),
- 'Grant Access' => egw::link('/index.php','menuaction=preferences.uiaclprefs.index&acl_app='.$appname),
- 'Edit Categories' => egw::link('/index.php','menuaction=preferences.preferences_categories_ui.index&cats_app=' . $appname . '&cats_level=True&global_cats=True')
- );
-
- if ($location == 'preferences')
- {
- display_section($appname,$file);
- }
- else
- {
- display_sidebox($appname,lang('Preferences'),$file);
- }
- }
-
- if ($GLOBALS['egw_info']['user']['apps']['admin'] && $location != 'preferences')
+ if ($GLOBALS['egw_info']['user']['apps']['admin'])
{
$file = Array(
'Site Configuration' => egw::link('/index.php','menuaction=admin.uiconfig.index&appname=' . $appname),
@@ -265,4 +247,15 @@ class timesheet_hooks
acl::DELETE => 'delete',
);
}
+
+ /**
+ * Hook to tell framework we use standard categories method
+ *
+ * @param string|array $data hook-data or location
+ * @return boolean
+ */
+ public static function categories($data)
+ {
+ return true;
+ }
}
diff --git a/timesheet/setup/setup.inc.php b/timesheet/setup/setup.inc.php
index 44c5a9bc62..e47e34cd6e 100644
--- a/timesheet/setup/setup.inc.php
+++ b/timesheet/setup/setup.inc.php
@@ -38,7 +38,7 @@ $setup_info[TIMESHEET_APP]['note'] =
';
/* The hooks this app includes, needed for hooks registration */
-$setup_info[TIMESHEET_APP]['hooks']['preferences'] = 'timesheet_hooks::all_hooks';
+$setup_info[TIMESHEET_APP]['hooks']['categories'] = 'timesheet_hooks::categories';
$setup_info[TIMESHEET_APP]['hooks']['settings'] = 'timesheet_hooks::settings';
$setup_info[TIMESHEET_APP]['hooks']['admin'] = 'timesheet_hooks::all_hooks';
$setup_info[TIMESHEET_APP]['hooks']['sidebox_menu'] = 'timesheet_hooks::all_hooks';