Code

Added new kind of base selector
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 31 Mar 2010 10:03:15 +0000 (10:03 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 31 Mar 2010 10:03:15 +0000 (10:03 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@17432 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/goto/admin/applications/class_applicationGeneric.inc
gosa-plugins/goto/admin/applications/class_applicationManagement.inc
gosa-plugins/goto/admin/applications/generic.tpl

index 59a67c8b8dcdb9d9541ff37fe34525d738127231..a8aa74c78081676e4ac4cf564ba6c1d0b1e157a9 100644 (file)
@@ -28,6 +28,8 @@ class application extends plugin
   var $objectclasses= array("top", "gosaApplication");
   var $FAIstate ="";
 
+  var $baseSelector;
+
   function application (&$config, $dn= NULL, $parent= NULL)
   {
     plugin::plugin ($config, $dn, $parent);
@@ -63,6 +65,12 @@ class application extends plugin
     $this->orig_cn = $this->cn;
     $this->orig_base = $this->base;
     $this->gosaApplicationFlags = preg_replace("/[^GDLMO]/","",$this->gosaApplicationFlags);
+
+    /* 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);
   }
 
 
@@ -115,6 +123,9 @@ class application extends plugin
 
     $smarty= get_smarty();
 
+    /* Assign base ACL */
+    $smarty->assign("base", $this->baseSelector->render());
+
     $tmp = $this->plInfo();
     foreach($tmp['plProvidedAcls'] as $name => $translation){
       $smarty->assign($name."ACL",$this->getacl($name, preg_match("/freeze/i",$this->FAIstate)));
@@ -274,6 +285,20 @@ class application extends plugin
       plugin::save_object();
       $this->base = $base_tmp;
 
+      /* Refresh base */
+      if(!$this->is_release()){
+        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 attributes */
       parent::save_object();
 
@@ -360,15 +385,6 @@ class application extends plugin
         /* Activate new picture */
         $this->set_picture($_FILES['picture_file']['tmp_name']);
       }        
-
-      if(!$this->is_release()){
-        $tmp = $this->get_allowed_bases();
-        if(isset($_POST['base'])){
-          if(isset($tmp[$_POST['base']])){
-            $this->base= $_POST['base'];
-          }
-        }
-      }
     }
   }
 
@@ -383,6 +399,11 @@ class application extends plugin
       $message[]=msgPool::invalid(_("Execute path"),"","","/some/path");
     }
 
+    // Check if a wrong base was supplied
+    if(!$this->baseSelector->checkLastBaseUpdate()){
+      $message[]= msgPool::check_base();;
+    }
+
     /* Permissions for that base? */
     if ($this->base != ""){
       $new_dn= "cn=".$this->cn.",".get_ou('applicationRDN').$this->base;
index 301d1f3ebfba770359fe6cc77f191fb2f1c98dc6..de94ad62dfc608b68e185146d959d34e77836171 100644 (file)
@@ -58,7 +58,7 @@ class applicationManagement extends management
     }
 
     // Build filter
-    if (0 && session::global_is_set(get_class($this)."_filter")){
+    if (session::global_is_set(get_class($this)."_filter")){
       $filter= session::global_get(get_class($this)."_filter");
     } else {
       $filter = new filter(get_template_path($filter_xml, true));
@@ -99,7 +99,7 @@ class applicationManagement extends management
     $errors = $disallowed = array();
     $headpage = $this->getHeadpage();
     foreach($target as $dn){
-  
+
       $obj = $headpage->getEntry($dn);
       $acl  = $this->ui->get_permissions($obj['dn'],"application/application");
       if(!preg_match("/d/",$acl)){
@@ -112,7 +112,8 @@ class applicationManagement extends management
     }
     if(count($errors)){
       msg_dialog::display(_("Branch locked"),
-          sprintf(_("The following entries are locked, you can't remove them %s."),msgPool::buildList($errors)),         INFO_DIALOG);
+          sprintf(_("The following entries are locked, you can't remove them %s."),
+            msgPool::buildList($errors)),INFO_DIALOG);
     }
     if(count($disallowed)){
       msg_dialog::display(_("Permission error"), msgPool::permDelete($disallowed), ERROR_DIALOG);
@@ -121,7 +122,7 @@ class applicationManagement extends management
   }
 
 
-    /*! \brief  This method opens an existing object or a list of existing objects to be edited.
+  /*! \brief  This method opens an existing object or a list of existing objects to be edited.
    *
    *
    *  @param  String  'action'  The name of the action which was the used as trigger.
index 4baf3926266dcbc431f29d71ea3d58f5554a30c2..3c84c9289c844c8ea0c5edb7177f901ed7cca386 100644 (file)
      </td>
     </tr>
 {if !$isReleaseApplikation}
-    <tr><td colspan=2><div style="height:15px;"></div></td></tr>
-    <tr>
-      <td><LABEL for="base">{t}Base{/t}{$must}</LABEL></td>
-      <td>
+   <tr>
+    <td><br><LABEL for="base">{t}Base{/t}</LABEL>{$must}</td>
+    <td>
+     <br>
 {render acl=$baseACL}
-       <select size="1" id="base" name="base" title="{t}Choose subtree to place application in{/t}" 
-        {if $isReleaseApplikation} disabled {/if}>
-        {html_options options=$bases selected=$base_select}
-       </select>
-{/render}
-{if !$isReleaseApplikation}
-{render acl=$baseACL disable_picture='images/lists/folder_grey.png'}
-      {image path="images/lists/folder.png" action="chooseBase" title="{t}Select a base{/t}"}
-
+           {$base}
 {/render}
-{/if}
-      </td>
-     </tr>
+     </td>
+    </tr>
 {/if}
    </table>
   </td>