Create template directory and set default document_dir preference of addressbook, calendar, infolog, tracker, timesheet and projectmanager

This commit is contained in:
Ralf Becker 2011-06-11 11:57:51 +00:00
parent c2feef73de
commit 220af27f60
7 changed files with 61 additions and 1 deletions

View File

@ -273,6 +273,7 @@ class addressbook_hooks
'run_lang' => false,
'xmlrpc' => True,
'admin' => False,
'default' => '/templates/addressbook',
);
}

View File

@ -609,6 +609,7 @@ class calendar_hooks
'run_lang' => false,
'xmlrpc' => True,
'admin' => False,
'default' => '/templates/calendar',
);
}
// Import / Export for nextmatch

View File

@ -398,6 +398,7 @@ class infolog_hooks
'run_lang' => false,
'xmlrpc' => True,
'admin' => False,
'default' => '/templates/infolog',
);
}

View File

@ -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;

View File

@ -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;

View File

@ -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';
}

View File

@ -192,6 +192,7 @@ class timesheet_hooks
'run_lang' => false,
'xmlrpc' => True,
'admin' => False,
'default' => '/templates/timesheet',
);
}
// Import / Export for nextmatch