From: hickert Date: Wed, 13 Oct 2010 14:09:50 +0000 (+0000) Subject: Updated Shared Folders X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=3845d320a0dfebcc625816956efb01d6771d82e8;p=gosa.git Updated Shared Folders -Removed hard coded acls -Updated save() method, added several echos which can later be replaced by real functions git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20036 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-plugins/groupware/admin/groups/GroupwareSharedFolder/class_GroupwareSharedFolder.inc b/gosa-plugins/groupware/admin/groups/GroupwareSharedFolder/class_GroupwareSharedFolder.inc index 9c5899f2c..a928e33aa 100644 --- a/gosa-plugins/groupware/admin/groups/GroupwareSharedFolder/class_GroupwareSharedFolder.inc +++ b/gosa-plugins/groupware/admin/groups/GroupwareSharedFolder/class_GroupwareSharedFolder.inc @@ -1,28 +1,7 @@ gwFolderGetMembers($path); - if(!$rpc->success()){ - $this->rpcError = TRUE; - $this->rpcErrorMessage = $rpc->get_error(); - $message = sprintf(_("Failed to load permissions for folder '%s'! Error was: '%s'."), - $path,$rpc->get_error()); - msg_dialog::display(_("Error"),msgPool::rpcError($message), ERROR_DIALOG); - return; - } + $acls = array(); +# $acls = $rpc->gwFolderGetMembers($path); +# if(!$rpc->success()){ +# $this->rpcError = TRUE; +# $this->rpcErrorMessage = $rpc->get_error(); +# $message = sprintf(_("Failed to load permissions for folder '%s'! Error was: '%s'."), +# $path,$rpc->get_error()); +# msg_dialog::display(_("Error"),msgPool::rpcError($message), ERROR_DIALOG); +# return; +# } $entry['acls'] = $acls; $folderList[$path] = $entry; } @@ -155,7 +134,7 @@ class GroupwareSharedFolder extends plugin // {%cn} will be replaced by the groups cn when save() is called. if(!$is_account){ $this->folderPrefix = "shared/{%cn}"; - $intialFolderEntry = array('name' => '{%cn}', 'status' => '', 'acls' => array()); + $intialFolderEntry = array('name' => '{%cn}', 'status' => 'added', 'acls' => array()); $folderList = array(); $folderList[$this->folderPrefix] = $intialFolderEntry; } @@ -228,7 +207,7 @@ class GroupwareSharedFolder extends plugin } if(isset($_POST['configureFolder'])){ $this->FolderWidget = new FolderWidget($this->config,$this->folderList, $this->folderPrefix); - $this->FolderWidget->setPermissions($this->getPermissions()); + $this->FolderWidget->setPermissions(GroupwareDefinitions::getPermissions()); $this->FolderWidget->acl_base = $this->acl_base; $this->FolderWidget->acl_category = $this->acl_category; } @@ -276,6 +255,7 @@ class GroupwareSharedFolder extends plugin */ function remove_from_parent() { + echo "
Remove all folders"; } @@ -284,8 +264,34 @@ class GroupwareSharedFolder extends plugin */ function save() { - print_a(array('current' => $this->folderList)); - print_a(array('old' => $this->saved_attributes['folderList'])); + // Walk through folders and perform requested actions + foreach($this->folderList as $path => $folder){ + + // Update folder names for newly created groupware extensions. + $path = preg_replace("/\{%cn\}/", $this->cn, $path); + $folder['name'] = preg_replace("/\{%cn\}/", $this->cn, $folder['name']); + + // Call requested backend methods, for added/removed + if($folder['status'] == 'removed'){ + echo "
Remove folder {$path}"; + continue; + } + if($folder['status'] == 'added'){ + echo "
Add folder {$path}"; + continue; + } + + // Set members + echo "
Set members for {$path} "; + $members = array(); + foreach($folder['acls'] as $id => $data) $members[] = $data['name']; + print_a($members); + + // Set permissions + foreach($folder['acls'] as $id => $data){ + echo "
Set acls for {$data['name']} : {$data['acl']}"; + } + } } @@ -318,39 +324,5 @@ class GroupwareSharedFolder extends plugin "folderList" => _("Shared folder")) )); } - - - // #Fixme: Put this in a separate class - function getPermissions() - { - $ret[GROUPWARE_RIGHTS_NONE] = _("None"); - $ret[RIGHTS_GROUPWARE_READ] = _("Read"); - $ret[RIGHTS_GROUPWARE_POST] = _("Post"); - $ret[GROUPWARE_RIGHTS_APPEND] = _("Append"); - $ret[RIGHTS_GROUPWARE_WRITE] = _("Write"); - $ret[GROUPWARE_RIGHTS_ALL] = _("All"); - return($ret); - } - - - // Returns a dummy folder list . #Fixme remove this. - function getFolderList() - { - $folders = array( - "shared/{$this->cn}/Favorites", - "shared/{$this->cn}/All Public Folders", - "shared/{$this->cn}/All Public Folders/Internet Newsgroups", - "shared/{$this->cn}/All Public Folders/testordner", - "shared/{$this->cn}/All Public Folders/testordner/klaus ist auch ein ordner", - "shared/{$this->cn}/All Public Folders/testordner/klaus ist auch ein ordner/testordner", - "shared/{$this->cn}/All Public Folders/testordner/klaus ist auch ein ordner/testordner/xcbdxfgh"); - - $ret = array(); - foreach($folders as $folder){ - $name = preg_replace("/^.*\//","",$folder); - $ret[$folder] = array('status' => '', 'name' => $name, 'acls' => array()); - } - return($ret); - } } ?>