Code

Updated netatalk class
[gosa.git] / gosa-plugins / netatalk / personal / netatalk / class_netatalk.inc
index 29dda2f001c6f2e2ef5dc2aaf88656e290b8ac1e..86303b93776bb39dc042fc9e904b084f289e4437 100644 (file)
@@ -34,7 +34,7 @@ class netatalk extends plugin {
 
   /* Definitions */
   var $plHeadline     = "Netatalk";
-  var $plDescription  = "Manage netatalk account";
+  var $plDescription  = "Manage Netatalk account";
 
   var $view_logged = FALSE;
 
@@ -102,6 +102,10 @@ class netatalk extends plugin {
     $this->get_netatalk_shares(); 
     $this->apple_user_share = $this->selectedshare;
 
+    if(!$this->is_account){
+        $this->apple_user_share = key($this->shares);
+    }
+
     /* Save initial account state */
     $this->initially_was_account = $this->is_account;
   }
@@ -114,14 +118,7 @@ class netatalk extends plugin {
     /* Get netatalk shares */
     $this->shares = array();
     $ldap = $this->config->get_ldap_link();
-
-    if($this->dn === "new" || $this->dn === NULL) {
-      $base  = session::get('CurrentMainBase');
-    } else {
-      $base = preg_replace("/^[^,]+,".preg_quote(get_people_ou(), '/')."/i","",$this->dn);
-    }
-
-    $ldap->cd($base);
+    $ldap->cd($this->config->current['BASE']);
     $ldap->search ("(&(objectClass=mount)(|(mountType=url)(mountType=nfs))(cn=*))");
 
     while ($attrs = $ldap->fetch()){
@@ -173,7 +170,7 @@ class netatalk extends plugin {
     /* Do we represent a valid account? */
     if (!$this->is_account && $this->parent === NULL) {
       $display = "<img alt=\"\"src=\"images/small-error.png\" align=\"middle\">&nbsp;<b>".
-        msgPool::noValidExtension(_("netatalk"))."</b>";
+        msgPool::noValidExtension(_("Netatalk"))."</b>";
       $display .= back_to_main();
       return ($display);
     }
@@ -181,20 +178,20 @@ class netatalk extends plugin {
     /* Show tab dialog headers */
     if ($this->parent !== NULL) {
       if ($this->is_account) {
-        $display = $this->show_disable_header(msgPool::removeFeaturesButton(_("netatalk")), 
-            msgPool::featuresEnabled(_("netatalk")));
+        $display = $this->show_disable_header(msgPool::removeFeaturesButton(_("Netatalk")), 
+            msgPool::featuresEnabled(_("Netatalk")));
       } else {
         $errmsg="";
         $obj = $this->parent->by_object['posixAccount'];
         if  (!($obj->is_account) ) {
-          $display = $this->show_enable_header(msgPool::addFeaturesButton(_("netatalk")), 
-              msgPool::featuresDisabled(_("netatalk"), _("POSIX")), TRUE);
+          $display = $this->show_enable_header(msgPool::addFeaturesButton(_("Netatalk")), 
+              msgPool::featuresDisabled(_("Netatalk"), _("POSIX")), TRUE);
         } elseif (count($this->shares)== 0) {
-          $display = $this->show_enable_header(msgPool::addFeaturesButton(_("netatalk")), 
-              msgPool::featuresDisabled(_("netatalk"), _("netatalk or NFS share")), TRUE);
+          $display = $this->show_enable_header(msgPool::addFeaturesButton(_("Netatalk")), 
+              msgPool::featuresDisabled(_("Netatalk"), _("Netatalk or NFS share")), TRUE);
         } else {
-          $display = $this->show_enable_header(msgPool::addFeaturesButton(_("netatalk")), 
-              msgPool::featuresDisabled(_("netatalk")));
+          $display = $this->show_enable_header(msgPool::addFeaturesButton(_("Netatalk")), 
+              msgPool::featuresDisabled(_("Netatalk")));
         } 
         return ($display);
       }
@@ -250,7 +247,7 @@ class netatalk extends plugin {
       if($mountType=="url") {
         $this->apple_user_homeurl_xml = '<home_dir><url>afp://'.$host.$dir . '</url><path>'.
           $this->apple_user_homepath_raw.'</path></home_dir>';
-        $this->apple_user_homeurl = base64_encode($this->apple_user_homeurl_xml);
+        $this->apple_user_homeurl = $this->apple_user_homeurl_xml;
       } else {
         $this->apple_user_homeurl = "";
       }