diff --git a/addressbook/inc/class.addressbook_hooks.inc.php b/addressbook/inc/class.addressbook_hooks.inc.php index e0db43b6a1..9f7dc499e9 100644 --- a/addressbook/inc/class.addressbook_hooks.inc.php +++ b/addressbook/inc/class.addressbook_hooks.inc.php @@ -273,6 +273,7 @@ class addressbook_hooks 'run_lang' => false, 'xmlrpc' => True, 'admin' => False, + 'default' => '/templates/addressbook', ); } diff --git a/calendar/inc/class.calendar_hooks.inc.php b/calendar/inc/class.calendar_hooks.inc.php index 8bf0ba8508..e15f85318e 100644 --- a/calendar/inc/class.calendar_hooks.inc.php +++ b/calendar/inc/class.calendar_hooks.inc.php @@ -609,6 +609,7 @@ class calendar_hooks 'run_lang' => false, 'xmlrpc' => True, 'admin' => False, + 'default' => '/templates/calendar', ); } // Import / Export for nextmatch diff --git a/infolog/inc/class.infolog_hooks.inc.php b/infolog/inc/class.infolog_hooks.inc.php index 5eedcf4eb7..eb675ee8c7 100644 --- a/infolog/inc/class.infolog_hooks.inc.php +++ b/infolog/inc/class.infolog_hooks.inc.php @@ -398,6 +398,7 @@ class infolog_hooks 'run_lang' => false, 'xmlrpc' => True, 'admin' => False, + 'default' => '/templates/infolog', ); } diff --git a/phpgwapi/setup/default_records.inc.php b/phpgwapi/setup/default_records.inc.php index b7da1d8616..5de2c053d7 100644 --- a/phpgwapi/setup/default_records.inc.php +++ b/phpgwapi/setup/default_records.inc.php @@ -205,3 +205,29 @@ $oProc->UpdateSequence('egw_sqlfs','fs_id'); // Create Addressbook for Default group, by setting a group ACL from the group to itself for all rights: add, read, edit and delete $defaultgroup = $GLOBALS['egw_setup']->add_account('Default','Default','Group',False,False); $GLOBALS['egw_setup']->add_acl('addressbook',$defaultgroup,$defaultgroup,1|2|4|8); + +/** + * Create template directory and set default document_dir preference of addressbook, calendar, infolog, tracker, timesheet and projectmanager + */ +$admins = $GLOBALS['egw_setup']->add_account('Admins','Admin','Group',False,False); + +egw_vfs::$is_root = true; +$prefs = new preferences(); +$prefs->read_repository(false); +foreach(array('','addressbook', 'calendar', 'infolog', 'tracker', 'timesheet', 'projectmanager') as $app) +{ + if ($app && !file_exists(EGW_SERVER_ROOT.'/'.$app)) continue; + + // create directory and set permissions: Admins writable and other readable + $dir = '/templates'.($app ? '/'.$app : ''); + egw_vfs::mkdir($dir, 075, STREAM_MKDIR_RECURSIVE); + egw_vfs::chgrp($dir, abs($admins)); + egw_vfs::chmod($dir, 075); + if (!$app) continue; + + // set default preference for app (preserving a maybe already set document-directory) + if ($prefs->default[$app]['document_dir']) $dir .= ' '.$prefs->default[$app]['document_dir']; + $prefs->add($app, 'document_dir', $dir, 'default'); +} +$prefs->save_repository(false, 'default'); +egw_vfs::$is_root = false; diff --git a/phpgwapi/setup/setup.inc.php b/phpgwapi/setup/setup.inc.php index 53665864fb..c7577748fa 100755 --- a/phpgwapi/setup/setup.inc.php +++ b/phpgwapi/setup/setup.inc.php @@ -12,7 +12,7 @@ /* Basic information about this app */ $setup_info['phpgwapi']['name'] = 'phpgwapi'; $setup_info['phpgwapi']['title'] = 'EGroupware API'; -$setup_info['phpgwapi']['version'] = '1.9.010'; +$setup_info['phpgwapi']['version'] = '1.9.011'; $setup_info['phpgwapi']['versions']['current_header'] = '1.29'; $setup_info['phpgwapi']['enable'] = 3; $setup_info['phpgwapi']['app_order'] = 1; diff --git a/phpgwapi/setup/tables_update.inc.php b/phpgwapi/setup/tables_update.inc.php index a967a4f931..618c6b1da0 100644 --- a/phpgwapi/setup/tables_update.inc.php +++ b/phpgwapi/setup/tables_update.inc.php @@ -282,3 +282,33 @@ function phpgwapi_upgrade1_9_009() return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.9.010'; } +/** + * Create template directory and set default document_dir preference of addressbook, calendar, infolog, tracker, timesheet and projectmanager + */ +function phpgwapi_upgrade1_9_010() +{ + $admins = $GLOBALS['egw_setup']->add_account('Admins','Admin','Group',False,False); + + egw_vfs::$is_root = true; + $prefs = new preferences(); + $prefs->read_repository(false); + foreach(array('','addressbook', 'calendar', 'infolog', 'tracker', 'timesheet', 'projectmanager') as $app) + { + if ($app && !file_exists(EGW_SERVER_ROOT.'/'.$app)) continue; + + // create directory and set permissions: Admins writable and other readable + $dir = '/templates'.($app ? '/'.$app : ''); + egw_vfs::mkdir($dir, 075, STREAM_MKDIR_RECURSIVE); + egw_vfs::chgrp($dir, abs($admins)); + egw_vfs::chmod($dir, 075); + if (!$app) continue; + + // set default preference for app (preserving a maybe already set document-directory) + if ($prefs->default[$app]['document_dir']) $dir .= ' '.$prefs->default[$app]['document_dir']; + $prefs->add($app, 'document_dir', $dir, 'default'); + } + $prefs->save_repository(false, 'default'); + egw_vfs::$is_root = false; + + return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.9.011'; +} diff --git a/timesheet/inc/class.timesheet_hooks.inc.php b/timesheet/inc/class.timesheet_hooks.inc.php index 6600572de0..60849d3437 100644 --- a/timesheet/inc/class.timesheet_hooks.inc.php +++ b/timesheet/inc/class.timesheet_hooks.inc.php @@ -192,6 +192,7 @@ class timesheet_hooks 'run_lang' => false, 'xmlrpc' => True, 'admin' => False, + 'default' => '/templates/timesheet', ); } // Import / Export for nextmatch