From 5e35e502522e5e1806a60d6dfe1d44124472eef2 Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Mon, 11 Jan 2010 21:45:33 +1300 Subject: [PATCH] Create a default calendar when a User or Resource principal is created. --- inc/ui/principal-edit.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/inc/ui/principal-edit.php b/inc/ui/principal-edit.php index 7783c9a2..8d7f9ef0 100644 --- a/inc/ui/principal-edit.php +++ b/inc/ui/principal-edit.php @@ -34,7 +34,18 @@ if ( $can_write_principal && $editor->IsSubmit() ) { $_POST['default_privileges'] = sprintf('%024s',decbin($privs)); $editor->Assign('default_privileges', $privs_dec); } + if ( $editor->IsCreate() ) { + $c->messages[] = i18n("Creating new Principal record."); + } + else { + $c->messages[] = i18n("Updating Principal record."); + } $editor->Write(); + if ( $_POST['type_id'] != 3 && $editor->IsCreate() ) { + /** We only add the default calendar if it isn't a group, and this is a create action */ + require_once('auth-functions.php'); + CreateHomeCalendar($editor->Value('username')); + } } else { $editor->GetRecord(); @@ -415,7 +426,8 @@ $rowurl = $c->base_url . '/admin.php?action=edit&t=collection&id='; $browser->AddHidden( 'collection_link', "'' || collection_id || ''" ); $browser->AddColumn( 'dav_name', translate('Path') ); $browser->AddColumn( 'dav_displayname', translate('Display Name') ); -$browser->AddColumn( 'privs', translate('Privileges'), '', '', 'privileges_list(default_privileges)' ); +$browser->AddColumn( 'privs', translate('Privileges'), '', '', + "COALESCE( privileges_list(default_privileges), '[".translate('default principal privileges')."]')" ); $browser->SetOrdering( 'dav_name', 'A' );