Code

Fixed problem with unknown printer member
[gosa.git] / plugins / admin / applications / class_applicationGeneric.inc
index c50184cf9e41f351de38a9824c20a8ca43b372f2..967eaaf634992091264694944290d529e0881e14 100644 (file)
@@ -117,6 +117,10 @@ class application extends plugin
       return ($display);
     }
 
+    $_SESSION['binary']       = $this->gotoLogonScript;
+    $_SESSION['binarytype']   = "octet-stream";
+    $_SESSION['binaryfile']   = $this->cn.".gosaApplication";
+    $smarty->assign("rand", rand(0, 10000));
     $head = $this->generateTemplate();
     $this->gotoLogonScript= $this->generateTemplate().preg_replace('/.*### END HEADER ###/s', '', $this->gotoLogonScript);
 
@@ -135,6 +139,31 @@ class application extends plugin
       $smarty->assign("namemode", "readonly");
       $smarty->assign("selectmode", "disabled");
     }
+    
+    /* Base select dialog */
+    $once = true;
+    foreach($_POST as $name => $value){
+      if(preg_match("/^chooseBase/",$name) && $once){
+        $once = false;
+        $this->dialog = new baseSelectDialog($this->config,$this);
+        $this->dialog->setCurrentBase($this->base);
+      }
+    }
+
+    /* Dialog handling */
+    if(is_object($this->dialog)){
+      /* Must be called before save_object */
+      $this->dialog->save_object();
+
+      if($this->dialog->isClosed()){
+        $this->dialog = false;
+      }elseif($this->dialog->isSelected()){
+        $this->base = $this->dialog->isSelected();
+        $this->dialog= false;
+      }else{
+        return($this->dialog->execute());
+      }
+    }
 
     /* Get random number for pictures */
     srand((double)microtime()*1000000);
@@ -145,6 +174,7 @@ class application extends plugin
       $smarty->assign($val, $this->$val);
       $smarty->assign($val."ACL", chkacl($this->acl, $val));
     }
+    $smarty->assign("baseACL", chkacl($this->acl,"base"));
 
     /* Checkboxes */
     foreach (array("G" => "exec_for_groupmembers", "O" => "overwrite_config",
@@ -170,6 +200,7 @@ class application extends plugin
   {
     $ldap= $this->config->get_ldap_link();
     $ldap->rmDir($this->dn);
+    show_ldap_error($ldap->get_error(), sprintf(_("Removing of application with dn '%s' failed."),$this->dn));
 
     /* Optionally execute a command after we're done */
     $this->handle_post_events("remove");
@@ -181,12 +212,14 @@ class application extends plugin
       $og= new ogroup($this->config, $ldap->getDN());
       unset($og->member[$this->dn]);
       $og->save ();
+      show_ldap_error($ldap->get_error(), sprintf(_("Removing application from objectgroup '%s' failed"), $og->dn));
     }
     $ldap->search ("(&(objectClass=posixGroup)(gosaMemberApplication=".$this->cn."))", array("cn"));
     while ($attrs= $ldap->fetch()){
       $ag= new appgroup($this->config, $ldap->getDN());
       $ag->removeApp($this->cn);
       $ag->save ();
+      show_ldap_error($ldap->get_error(), sprintf(_("Removing application from group '%s' failed"), $ag->dn));
     }
 
   }
@@ -385,7 +418,7 @@ class application extends plugin
       $ldap->add($this->attrs);
       $this->handle_post_events("add");
     }
-    show_ldap_error($ldap->get_error());
+    show_ldap_error($ldap->get_error(), sprintf(_("Saving of application with dn '%s' failed."),$this->dn));
   }
 
   function set_picture($filename)
@@ -435,6 +468,38 @@ class application extends plugin
       $this->cn = $_POST['cn'];
     }
   }
+
+
+  /* Return plugin informations for acl handling
+      #FIXME FAIscript seams to ununsed within this class... */
+  function plInfo()
+  {
+    return (array(
+          "plShortName"   => _("Generic"),
+          "plDescription" => _("Application generic"),
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 0,
+          "plSection"     => array("administration"),
+          "plCategory"    => array("application" => array("description"  => _("Application"),
+                                                          "objectClass"  => "gosaApplication")),
+          "plProvidedAcls"=> array(
+            "cn"                => _("Name"),
+            "description"       => _("Description"),
+            "gosaApplicationExecute"  => _("Execute"),
+            "gosaApplicationName"     => _("Name"),
+            "gosaApplicationIcon"     => _("Icon"),
+            "gosaApplicationFlags"    => _("Flag"),
+            "gotoLogonScript"         => _("Script content"),
+            "gosaApplicationParameter"=> _("Application parameter"),
+
+            "exec_for_groupmembers" => _("Only executable for members"),              // G
+            "place_on_desktop"      => _("Place icon on members desktop"),            // D
+            "place_on_kicker"       => _("Place entry in members launch bar"),        // L
+            "place_in_startmenu"    => _("Place entry in members startmenu"),         // M
+            "overwrite_config"      => _("Replace user configuration on startup"))  // O
+            ));
+  }
 }
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
 ?>