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 = "