Code

Implemented gen_cd image into trunk
[gosa.git] / plugins / admin / systems / class_goShareServer.inc
index 0eab8bf07f1bbd5504b65091f6b0af6f9d4dc710..5f580dde93e6d69bc6555e0bbb4f843506252a28 100644 (file)
@@ -212,8 +212,26 @@ class goShareServer extends goService{
     $this->goExportEntryList[$key]=$entry[$key];
   }
 
-  function deleteFromList($id){
-    unset($this->goExportEntryList[$id]);
+  function deleteFromList($id)
+  {
+    /* Check if the share is used by someone */
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd($this->config->current['BASE']);
+    $ldap->search("(|(gotoProfileServer=*|$id)(gotoShare=*|$id|*))", array("cn"));
+    $cnt= $ldap->count();
+    if ($cnt){
+      $msg= sprintf(_("The share can't be removed since it is still used by %d users:"), $cnt);
+      $msg.= "<br><br><ul>";
+      while ($attrs= $ldap->fetch()){
+        $msg.= "<li>".$attrs["cn"][0]."</li>";
+      }
+      $msg.= "</ul>"._("Please correct the share-/profile settings of these users");
+      print_red($msg);
+
+    } else {
+      /* Finally remove it */
+      unset($this->goExportEntryList[$id]);
+    }
   }
 
    function process_mounts() {
@@ -340,11 +358,11 @@ class goShareServer extends goService{
   function plInfo()
   {
     return (array(
-          "plShortName"   => _("Shares"),
-          "plDescription" => _("Share service"),
+          "plShortName"   => _("File service (Shares)"),
+          "plDescription" => _("File service - Shares")." ("._("Services").")",
           "plSelfModify"  => FALSE,
           "plDepends"     => array(),
-          "plPriority"    => 0,
+          "plPriority"    => 90,
           "plSection"     => array("administration"),
           "plCategory"    => array("server"),