From: hickert Date: Fri, 8 Oct 2010 11:42:53 +0000 (+0000) Subject: Added ability to add acls X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=9f1edf6a75d8b1526c3020ceecc20799c5557e1a;p=gosa.git Added ability to add acls git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19953 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-plugins/groupware/personal/groupware/FolderWidget/FolderEditDialog.tpl b/gosa-plugins/groupware/personal/groupware/FolderWidget/FolderEditDialog.tpl index eec1e9e30..7182206cf 100644 --- a/gosa-plugins/groupware/personal/groupware/FolderWidget/FolderEditDialog.tpl +++ b/gosa-plugins/groupware/personal/groupware/FolderWidget/FolderEditDialog.tpl @@ -1,4 +1,41 @@ -adsf +

{t}Folder editing dialog{/t}

+ + + + + + + + + + +
{t}Name{/t}: {$folderItem.name}
{t}Path{/t}: {$folderItem.path}
+ +
+ +

{t}Permissions{/t}

+ + + + + + + + {foreach from=$folderItem.acls item=item key=key} + + + + + + + {/foreach} + + + + + + +
{t}Name{/t}{t}Permission{/t}{t}Type{/t}
{$item.type}

diff --git a/gosa-plugins/groupware/personal/groupware/FolderWidget/class_FolderEditDialog.inc b/gosa-plugins/groupware/personal/groupware/FolderWidget/class_FolderEditDialog.inc index 3363021b9..0f5f6d9fe 100644 --- a/gosa-plugins/groupware/personal/groupware/FolderWidget/class_FolderEditDialog.inc +++ b/gosa-plugins/groupware/personal/groupware/FolderWidget/class_FolderEditDialog.inc @@ -2,21 +2,52 @@ class FolderEditDialog extends plugin { - private $item = NULL; + private $folderItem = NULL; - function __construct($config, $item) + function __construct($config, $folderItem) { $this->config = $config; - $this->item = $item; + $this->folderItem = $folderItem; } function execute() { $smarty = get_smarty(); - $smarty->assign('item', $this->item); + $smarty->assign('folderItem', $this->folderItem); return($smarty->fetch(get_template_path("FolderEditDialog.tpl", TRUE, dirname(__FILE__)))); } -} + function save_object() + { + // Get all posted value modifications + foreach($this->folderItem['acls'] as $id => $aclEntry){ + + // Name or ACL modified? + if(isset($_POST["permission_{$id}_name"])) { + $this->folderItem['acls'][$id]['name'] = get_post("permission_{$id}_name"); + } + if(isset($_POST["permission_{$id}_acl"])) { + $this->folderItem['acls'][$id]['acl'] = get_post("permission_{$id}_acl"); + } + + // Check if entry has to be removed. + if(isset($_POST["permission_{$id}_del"])){ + unset($this->folderItem['acls'][$id]); + } + } + + // New ACL entry to add? + if(isset($_POST['permission_add'])){ + $this->folderItem['acls'][] = array('name' => '', 'acl' => 0, 'type' => 'user'); + } + $this->folderItem['acls'] = array_values($this->folderItem['acls']); + } + + function save() + { + return($this->folderItem); + } +} + ?> diff --git a/gosa-plugins/groupware/personal/groupware/FolderWidget/class_FolderWidget.inc b/gosa-plugins/groupware/personal/groupware/FolderWidget/class_FolderWidget.inc index fdbb6ac49..6bba3f0eb 100644 --- a/gosa-plugins/groupware/personal/groupware/FolderWidget/class_FolderWidget.inc +++ b/gosa-plugins/groupware/personal/groupware/FolderWidget/class_FolderWidget.inc @@ -206,13 +206,6 @@ class FolderWidget extends plugin $this->FolderWidgetListing->setFolderList($this->folderList); $str = $this->FolderWidgetListing->execute(); - // Handle dialogs - if(isset($_POST['FolderEditDialog_ok'])){ - $this->dialog = NULL; - } - if(isset($_POST['FolderEditDialog_cancel'])){ - $this->dialog = NULL; - } if($this->dialog){ $this->dialog->save_object(); return($this->dialog->execute()); @@ -225,6 +218,24 @@ class FolderWidget extends plugin function save_object() { $this->FolderWidgetListing->save_object(); + + // Handle dialogs + if(isset($_POST['FolderEditDialog_ok'])){ + + $this->dialog->save_object(); + $msgs = $this->dialog->check(); + if(count($msgs)){ + msg_dialog::displayChecks($msgs); + }else{ + $newItem = $this->dialog->save(); + $path = $this->currentlyEditedItem['path']; + $this->folderList['linear'][$path]['acls'] = $newItem['acls']; + $this->dialog = NULL; + } + } + if(isset($_POST['FolderEditDialog_cancel'])){ + $this->dialog = NULL; + } } }