From 87a31822e119cc2cd6694aaab878a72a5300554d Mon Sep 17 00:00:00 2001 From: hickert Date: Thu, 9 Nov 2006 12:31:28 +0000 Subject: [PATCH] Some (not completed) netatalk plugin git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@5062 594d385d-05f5-0310-b6e9-bd551577e9d8 --- plugins/personal/netatalk/class_netatalk.inc | 76 ++++++++++++-------- plugins/personal/netatalk/netatalk.tpl | 5 +- 2 files changed, 49 insertions(+), 32 deletions(-) diff --git a/plugins/personal/netatalk/class_netatalk.inc b/plugins/personal/netatalk/class_netatalk.inc index 9df9eeb19..ad52179cb 100644 --- a/plugins/personal/netatalk/class_netatalk.inc +++ b/plugins/personal/netatalk/class_netatalk.inc @@ -55,7 +55,8 @@ class netatalk extends plugin { /* Attributes to save to LDAP */ var $attributes = array ("apple-user-homeurl", "apple-user-homeDirectory"); - var $CopyPasteVars= array("apple_user_homeurl", "apple_user_homeDirectory"); + var $CopyPasteVars= array("apple_user_homeurl", "apple_user_homeDirectory","apple_user_share","shares_settings","apple_user_homepath_raw", + "apple_user_homeurl_raw","apple_user_homeurl_xml","apple_user_homeurl","selectedshare","mountDirectory"); /* Attributes to use in smarty template */ var $smarty_attributes = array ("apple_user_homepath_raw", "shares", "selectedshare"); @@ -94,33 +95,20 @@ class netatalk extends plugin { if (strlen($this->apple_user_homeDirectory) >0) { $this->apple_user_homepath_raw = substr($this->apple_user_homeDirectory, strrpos($this->apple_user_homeDirectory, '/') + 1 ); } - + + /* get share list an set default values */ + $this->get_netatalk_shares(); + $this->apple_user_share = $this->selectedshare; + /* Save initial account state */ $this->initially_was_account = $this->is_account; } - /* Execute the plugin, produce the output. */ - function execute() { - plugin :: execute(); - /* Use the smarty templating engine here... */ - $smarty = get_smarty(); - $display = ""; - - /* Do we need to flip is_account state? */ - if (isset ($_POST['modify_state'])) { - $this->is_account = !$this->is_account; - } - - /* Do we represent a valid account? */ - if (!$this->is_account && $this->parent == NULL) { - $display = "\"\"src=\"images/stop.png\" "._("This account has no netatalk extensions.").""; - - $display .= back_to_main(); - return ($display); - } - + /* Get netatalk shares */ + function get_netatalk_shares() + { /* Get netatalk shares */ $this->shares = array(); $ldap = $this->config->get_ldap_link(); @@ -133,11 +121,11 @@ class netatalk extends plugin { } $ldap->search ("(&(objectClass=mount)(|(mountType=url)(mountType=nfs))(cn=*))"); - /* Show tab dialog headers */ if ($this->parent != NULL) { if ($this->is_account) { - $display = $this->show_header(_("Remove netatalk account"), _("This account has netatalk features enabled. You can disable them by clicking below.")); + $display = $this->show_header(_("Remove netatalk account"), + _("This account has netatalk features enabled. You can disable them by clicking below.")); } else { $errmsg=""; $obj = $this->parent->by_object['posixAccount']; @@ -148,19 +136,19 @@ class netatalk extends plugin { $errmsg.="At least one share with netatalk or NFS mount entry needed."; } if($errmsg==""){ - $display = $this->show_header(_("Create netatalk account"), _("This account has netatalk features disabled. You can enable them by clicking below.")); + $display = $this->show_header(_("Create netatalk account"), + _("This account has netatalk features disabled. You can enable them by clicking below.")); } else { $display = $this->show_header(_("Create netatalk account"), _($errmsg), TRUE); } return ($display); } } - - + while ($attrs = $ldap->fetch()){ - $tmp = split(":", $attrs["cn"][0]); + $tmp = split(":", $attrs["cn"][0]); $host = trim($tmp[0]); - $dir = trim($tmp[1]); + $dir = trim($tmp[1]); $mountType = trim($attrs["mountType"][0]); if ($mountType == "url") { $mountTypeReal = "netatalk"; @@ -176,11 +164,35 @@ class netatalk extends plugin { $oldShare=substr($this->apple_user_homeDirectory, 0, strrpos($this->apple_user_homeDirectory, '/')); $newShare=($this->mountDirectory . "/". $host . $dir ); if (strcmp($oldShare, $newShare)==0) { - $this->selectedshare = $share; + $this->selectedshare = $share; } } asort($this->shares); - /* Assign attributes and ACL to smarty */ + } + + + /* Execute the plugin, produce the output. */ + function execute() + { + plugin :: execute(); + + /* Use the smarty templating engine here... */ + $smarty = get_smarty(); + $display = ""; + + /* Do we need to flip is_account state? */ + if (isset ($_POST['modify_state'])) { + $this->is_account = !$this->is_account; + } + + /* Do we represent a valid account? */ + if (!$this->is_account && $this->parent == NULL) { + $display = "\"\"src=\"images/stop.png\" "._("This account has no netatalk extensions.").""; + + $display .= back_to_main(); + return ($display); + } + $smarty->assign("netatalkShareACL", chkacl($this->acl, "netatalkShare")); $smarty->assign("netatalkUserHomepathACL", chkacl($this->acl, "netatalkUserHomepath")); @@ -204,6 +216,8 @@ class netatalk extends plugin { /* Check if we have correct data */ function check() { $message = array (); + + echo $this->apple_user_share; if (strlen($this->apple_user_share) == 0) { $message[] = _("You must select a share to use."); diff --git a/plugins/personal/netatalk/netatalk.tpl b/plugins/personal/netatalk/netatalk.tpl index 0f5b4a039..8d34ac4b2 100644 --- a/plugins/personal/netatalk/netatalk.tpl +++ b/plugins/personal/netatalk/netatalk.tpl @@ -4,7 +4,10 @@ - + -- 2.30.2