Code

Added base selector to mime generic
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 31 Mar 2010 09:59:23 +0000 (09:59 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 31 Mar 2010 09:59:23 +0000 (09:59 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@17431 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/goto/admin/mimetypes/class_mimetypeGeneric.inc
gosa-plugins/goto/admin/mimetypes/generic.tpl

index 168488df7d14355653a651d90650fee5faa73546..966186251f808778b8985f655ca3b2311642d5aa 100644 (file)
@@ -53,6 +53,8 @@ class mimetype extends plugin
   var $orig_dn                 = "";
   var $orig_base         = "";
 
+  var $baseSelector;
+
   function mimetype(&$config,$dn= NULL)
   {
     plugin::plugin ($config, $dn);
@@ -143,6 +145,13 @@ class mimetype extends plugin
     }
     session::set('binary',$this->iconData);
     session::set('binarytype',"image/jpeg");
+
+    /* Instanciate base selector */
+    $this->baseSelector= new baseSelector($this->get_allowed_bases(), $this->base);
+    $this->baseSelector->setSubmitButton(false);
+    $this->baseSelector->setHeight(300);
+    $this->baseSelector->update(true);
+
     $this->orig_base = $this->base;
   }
 
@@ -152,6 +161,9 @@ class mimetype extends plugin
     plugin::execute();
     $smarty = get_smarty();
 
+    /* Assign base ACL */
+    $smarty->assign("base", $this->baseSelector->render());
+
     if(!$this->view_logged){
       $this->view_logged =TRUE;
       new log("view","mimetypes/".get_class($this),$this->dn);
@@ -366,6 +378,17 @@ class mimetype extends plugin
 
       }
 
+      /* Refresh base */
+      if ($this->acl_is_moveable($this->base)){
+        if (!$this->baseSelector->update()) {
+          msg_dialog::display(_("Error"), msgPool::permMove(), ERROR_DIALOG);
+        }
+        if ($this->base != $this->baseSelector->getBase()) {
+          $this->base= $this->baseSelector->getBase();
+          $this->is_modified= TRUE;
+        }
+      }
+
       /* Save radio buttons */
       if($this->acl_is_writeable("gotoMimeLeftClickAction")){
         if(isset($_POST['gotoMimeLeftClickAction_IE'])){
@@ -504,6 +527,11 @@ class mimetype extends plugin
       $message[] = msgPool::required(_("File pattern"));
     }
 
+    // Check if a wrong base was supplied
+    if(!$this->baseSelector->checkLastBaseUpdate()){
+      $message[]= msgPool::check_base();;
+    }
+
     /* Check if there is already a mime type with this cn */
     $ldap = $this->config->get_ldap_link();
     $ldap->cd($this->config->current["BASE"]);
index 24a3be19c3d5b2130cbf357a3adb3b0ccc6a059d..488e4d7a40e847f046de7ed2a7a1245c1b532b50 100644 (file)
@@ -1,18 +1,13 @@
 
+<h3>{t}Generic{/t}</h3>
+
 <table style="width:100%" summary="{t}Mimetype generic{/t}">
- <tr>
-  <td colspan="2">
-   <h3>{t}Generic{/t}
-   </h3>
-  </td>
- </tr>
  <tr>
   <td style='width:50%; '>
    <table summary="{t}Mimetype settings{/t}">
     <tr>
-     <td>{t}Mime type{/t}
-      {$must}
-     </td>
+     <td>{t}Mime type{/t}{$must}</td>
      <td>
       {render acl=$cnACL}
        <input type="text" name='cn' value="{$cn}" title='{t}Please enter a name for the mime type here{/t}'>
@@ -20,8 +15,7 @@
      </td>
     </tr>
     <tr>
-     <td>{t}Mime group{/t}
-     </td>
+     <td>{t}Mime group{/t}</td>
      <td>
       {render acl=$gotoMimeGroupACL}
        <select name='gotoMimeGroup' title='{t}Categorize this mime type{/t}' size=1>
@@ -31,8 +25,7 @@
      </td>
     </tr>
     <tr>
-     <td>{t}Description{/t}
-     </td>
+     <td>{t}Description{/t}</td>
      <td>
       {render acl=$descriptionACL}
        <input type="text" name='description' value="{$description}" title='{t}Please specify a description{/t}'>
     
     {if !$isReleaseMimeType}
      <tr>
-      <td><LABEL for="base">{t}Base{/t}
-       {$must}</LABEL>
-      </td>
+      <td><br><LABEL for="base">{t}Base{/t}</LABEL>{$must}</td>
       <td>
-       {render acl=$baseACL}
-        <select size="1" id="base" name="base" title="{t}Choose subtree to place application in{/t}">
-         {html_options options=$bases selected=$base_select}
-        </select>
-       {/render}
-       
-       {if !$isReleaseMimeType}
-        {render acl=$baseACL disable_picture='images/lists/folder_grey.png'}
-         {image path="images/lists/folder.png" action="chooseBase" title="{t}Select a base{/t}"}
-        {/render}
-        
-       {/if}
+       <br>
+{render acl=$baseACL}
+           {$base}
+{/render}
       </td>
      </tr>
-     
     {/if}
    </table>
+
   </td>
   <td class='left-border'>
+
    <table summary="{t}Picture settings{/t}">
     <tr>
      <td><LABEL for="picture_file">{t}Icon{/t}</LABEL>
     </select>
    {/render}
    {render acl=$gotoMimeEmbeddedApplicationACL}
-    <input type='text'  name='NewEmbeddedApplication'    value=''                              title='{t}Enter an application name here{/t}'>
+    <input type='text' name='NewEmbeddedApplication' value=''  title='{t}Enter an application name here{/t}'>
    {/render}
    {render acl=$gotoMimeEmbeddedApplicationACL}
-    <button type='submit' name='AddNewEmbeddedApplication'>
-    {msgPool type=addButton}</button>title='{t}Add application{/t}'>
+    <button type='submit' name='AddNewEmbeddedApplication' 
+      title='{t}Add application{/t}'>{msgPool type=addButton}</button>
    {/render}
   </td>
  </tr>
 </table>
 <input type="hidden" name="MimeGeneric" value="1"><!-- Place cursor -->
-<script language="JavaScript" type="text/javascript"><!-- // First input field on page focus_field('cn');  --></script>
\ No newline at end of file
+<script language="JavaScript" type="text/javascript"><!-- // First input field on page focus_field('cn');  --></script>