From: hzerres Date: Wed, 6 Oct 2010 10:04:06 +0000 (+0000) Subject: Added ability to display folders X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=98b65e3b8ee1c385a69b322bb524e627ca84ae93;p=gosa.git Added ability to display folders git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19919 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-plugins/groupware/personal/groupware/class_Groupware.inc b/gosa-plugins/groupware/personal/groupware/class_Groupware.inc index 789dda9ab..44b3b239e 100644 --- a/gosa-plugins/groupware/personal/groupware/class_Groupware.inc +++ b/gosa-plugins/groupware/personal/groupware/class_Groupware.inc @@ -18,9 +18,33 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +# Access constants +define ("LOOKUP", 1); +define ("READ", 2); +define ("STATUS", 4); +define ("WRITE", 8); +define ("INSERT", 16); +define ("POST", 32); +define ("CREATE", 64); +define ("DELETE", 128); +define ("ADMINISTRATE", 256); + + +define ("RIGHTS_NONE", 0); +define ("RIGHTS_READ", LOOKUP | READ | STATUS); +define ("RIGHTS_POST", RIGHTS_READ | POST); +define ("RIGHTS_APPEND", RIGHTS_POST | INSERT); +define ("RIGHTS_WRITE", RIGHTS_APPEND | WRITE | CREATE | DELETE); +define ("RIGHTS_ALL", RIGHTS_WRITE | ADMINISTRATE); + + + class Groupware extends plugin { + // Folder related attributes, will be moved into a speperate widget late on + var $currentSelectedFolder = ""; + var $plHeadline = "Mail"; var $plDescription = "GOsa mail extension."; var $view_logged = FALSE; @@ -56,6 +80,7 @@ class Groupware extends plugin var $mailAddress = ""; var $mailLocation = ""; + var $mailFolder = array(); var $quotaUsage = 0; var $quotaSize = 0; var $alternateAddresses = array(); @@ -74,7 +99,6 @@ class Groupware extends plugin var $mailBoxAutomaticRemovalValue = 100; var $localDeliveryOnly = FALSE; var $dropOwnMails = FALSE; - var $mailFolder = FALSE; var $groupwareDao = null; /*! \brief @@ -83,6 +107,7 @@ class Groupware extends plugin { plugin::plugin($config,$dn); + echo "Klasse:".get_class($config); // Get attributes from parent object foreach(array("uid","cn") as $attr){ if(isset($this->parent->by_object['group']) && isset($this->parent->by_object['group']->$attr)){ @@ -91,6 +116,19 @@ class Groupware extends plugin $this->$attr = $this->attrs[$attr][0]; } } + + // Initialize file browser list + $this->fileBrowser= new sortableListing(); + $this->fileBrowser->setDeleteable(FALSE); + $this->fileBrowser->setEditable(TRUE); + $this->fileBrowser->setColspecs(array('*')); + $this->fileBrowser->setWidth("100%"); + $this->fileBrowser->setHeight("150px"); + $this->fileBrowser->setAcl("rwcdm"); + $this->fileBrowser->setListData(array("eins", "zwei"),array("eins" =>array( "data"=> array("Uno") ) , "zwei" =>array( "data"=> array("Due") )) ); + $this->fileBrowser->update(); + $this->fileBrowser->sortingEnabled(FALSE); + // Initialize the plugin using rpc. $this->init(); } @@ -209,16 +247,6 @@ class Groupware extends plugin } $this->accountInitialized = TRUE; } - // Initialize file browser list - $this->fileBrowser= new sortableListing(); - $this->fileBrowser->setDeleteable(FALSE); - $this->fileBrowser->setEditable(TRUE); - $this->fileBrowser->setColspecs(array('*')); - $this->fileBrowser->setWidth("100%"); - $this->fileBrowser->setHeight("150px"); - $this->fileBrowser->setAcl("rwcdm"); - $this->fileBrowser->setListData(array("eins", "zwei"),array("eins" =>array( "data"=> array("Uno") ) , "zwei" =>array( "data"=> array("Due") )) ); - $this->fileBrowser->update(); // Set vacation start/stop if not set alreasy $this->vacationStart = time(); @@ -434,7 +462,6 @@ class Groupware extends plugin $this->delAlternate ($_POST['alternateAddressList']); } - /**************** SMARTY- Assign smarty variables ****************/ @@ -448,15 +475,28 @@ class Groupware extends plugin foreach($plInfo['plProvidedAcls'] as $acl => $name){ $smarty->assign($acl."ACL", $this->getacl($acl)); } - foreach($this->enabledFeatures as $feature => $state){ - $smarty->assign($feature."_isActive", $state); } - + + // Build up folder list + $data = $lData = array(); + foreach($this->mailFolder as $folderPath => $entries){ + $data[$folderPath] = $entries; + $name = $entries['name']; + $cnt = count($entries['acls']); + if($this->currentSelectedFolder == $folderPath){ + $name = "{$name}"; + } + $prefix = preg_replace("/^([^\/]*).*$/","\\1", $folderPath); + $name = str_pad($name, (substr_count($folderPath, '/')*3-3) + strlen($name),'../', STR_PAD_LEFT); + $lData[$folderPath]= array('data' => array($name,$prefix,$cnt)); + } + $this->fileBrowser->setListData($data, $lData) ; + $this->fileBrowser->update(); + + $smarty->assign("currentSelectedFolder", $this->currentSelectedFolder); $smarty->assign("fileBrowser", $this->fileBrowser->render()); - - $smarty->assign("mailLocations", $this->mailLocations); if (count($this->vacationTemplates)){ $smarty->assign("displayTemplateSelector", "true"); @@ -484,6 +524,17 @@ class Groupware extends plugin { if(isset($_POST['groupwarePluginPosted'])){ + $this->fileBrowser->save_object(); + $action = $this->fileBrowser->getAction(); + if($action['action'] == "edit"){ + $folderPath = $this->fileBrowser->getKey($action['targets'][0]); + $this->currentSelectedFolder = $folderPath; + } + + + + echo $this->currentSelectedFolder; + // We ran into a communication error with the backend. // Try a simple communication operation with the backend // again and let us see if it works. @@ -853,8 +904,10 @@ class Groupware extends plugin */ function mapComprehensiveUserData($callBackMap) { + $map = array( "mailLocations" => "mailLocations", + "mailFolder" => "mailFolder", "mailAddress" => "primaryMail", "mailLocation" => "mailLocation", "quotaUsage" => "quotaUsage", diff --git a/gosa-plugins/groupware/personal/groupware/class_GroupwareDao.inc b/gosa-plugins/groupware/personal/groupware/class_GroupwareDao.inc index d3ce7550b..0f763e069 100644 --- a/gosa-plugins/groupware/personal/groupware/class_GroupwareDao.inc +++ b/gosa-plugins/groupware/personal/groupware/class_GroupwareDao.inc @@ -50,9 +50,9 @@ class GroupwareDao{ "accountProperties" => array("get"=>"gwAcctGetProperties", "save"=>"gwAcctSetProperties", "delete"=>"gwAcctDelProperties"), - "mailFolder" => array( "get"=>"gwAcctGetFolderList", - "save"=>"gwAcctAddFolder", - "delete"=>"gwAcctDelFolder") + "mailFolder" => array( "get"=>"gwFolderList", + "save"=>"gwFolderAdd", + "delete"=>"gwFolderDel") ); @@ -176,6 +176,43 @@ class GroupwareDao{ $resultArr["mailLocation"] = $this->groupwarePluginRef->rpcExec('gwAcctGetLocation',$uid); } + //getThefolderList from the user + if($this->groupwarePluginRef->isFeatureEnabled("mailFolder")){ + + //Folder Id from the User ... + //user/$id/ + //$resultArr["mailFolder"] = $this->get("mailFolder", array("user/".$uid."/")); + /* + "RIGHTS_NONE", 0); + "RIGHTS_READ", LOOKUP | READ | STATUS); + "RIGHTS_POST", RIGHTS_READ | POST); + "RIGHTS_APPEND", RIGHTS_POST | INSERT); + "RIGHTS_WRITE", RIGHTS_APPEND | WRITE | CREATE | DELETE); + "" + */ + $resultArr["mailFolder"] = array( + 'user/wiwu/Aufgaben' => array( + "name" =>"Aufgaben", + "acls"=> array( array("wiwu"=> RIGHTS_ALL, "type"=>"user"), + array("2a"=> RIGHTS_ALL, "type"=>"user"))), + 'user/wiwu/Entw\xc3\xbcrfe' =>array( + "name" => "Entw\xc3\xbcrfe", + "acls" => array( array("wiwu"=> RIGHTS_ALL, "type"=>"user"))), + 'user/wiwu/Gel\xc3\xb6schte Objekte' => array( + "name" => "Gel\xc3\xb6schte Objekte", + "acls" => array( array("wiwu"=> RIGHTS_ALL, "type"=>"user"))), + 'user/wiwu/Synchronisierungsprobleme/Lokale Fehler' => array( + "name" =>"Synchronisierungsprobleme/Lokale Fehler", + "acls"=> array(array("wiwu"=> RIGHTS_ALL, "type"=>"user"))), + 'user/wiwu/Synchronisierungsprobleme/Serverfehler' => array( + "name" =>"Synchronisierungsprobleme/Serverfehler", + "acls"=> array(array("wiwu"=> RIGHTS_ALL, "type"=>"user"))), + 'shared/publicFolder' => array( + "name" =>"publicFolder", + "acls" => array(array("wiwu"=> RIGHTS_READ, "type"=>"user"))) + ); + } + //TODO: getLocation muss ebenfalls geholt werden // Quota quotaUsage, quotaSize if($this->groupwarePluginRef->isFeatureEnabled("quotaSize") || @@ -230,5 +267,18 @@ class GroupwareDao{ } return $resultArr; } + + //TODO: move this function into the groupwareplugin. # + //This is a feature with many datasets inside which should be cut in slices and saved separately. + //Since the knowledge about the feature is only known in the plugin this has got to be moved. + + function saveFoldersAndAcls($mailFolder){ + + foreach($mailFolder as $key => $val) + { + + } + + } } ?> diff --git a/gosa-plugins/groupware/personal/groupware/generic.tpl b/gosa-plugins/groupware/personal/groupware/generic.tpl index 2fefd1b84..460adda4f 100644 --- a/gosa-plugins/groupware/personal/groupware/generic.tpl +++ b/gosa-plugins/groupware/personal/groupware/generic.tpl @@ -6,6 +6,9 @@ {else} +{if $mailFolder_isActive} + {$fileBrowser} +{/if}
@@ -319,10 +322,4 @@
{/if} {/if} - {if $mailFolder_isActive} -
Hape, die Folder sind enabled - {$fileBrowser} - -
- {/if}