Code

Added base select dialog
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 29 Jun 2006 03:36:00 +0000 (03:36 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 29 Jun 2006 03:36:00 +0000 (03:36 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@3967 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/mimetypes/class_mimetypeGeneric.inc
plugins/admin/mimetypes/class_mimetypeManagement.inc
plugins/admin/mimetypes/generic.tpl

index 33932e2c61ecad3ab446db7f2c17dd089c85d391..b475b2f419624681a9e02e54c7cec13f94223e31 100644 (file)
@@ -30,6 +30,7 @@ class mimetype extends plugin
        var $use_gotoMimeEmbeddedApplication    = array();
        var $gotoMimeGroup                                              = "";
        var $iconData                                                   = NULL; 
+       var $base                                                               = "";
 
        /* divLists */
        var $DivPatterns                                                = NULL;
@@ -38,6 +39,7 @@ class mimetype extends plugin
 
        /* Mime type release mode */
        var $isReleaseMimeType                                  = false;
+       var $dialog                                                             = NULL;
        
        /* These vars will be copied too, if you use copy&paste mode */
        var $CopyPasteVars      = array("use_gotoMimeFilePattern","use_gotoMimeApplication","use_gotoMimeEmbeddedApplication","iconData");
@@ -114,6 +116,18 @@ class mimetype extends plugin
                        }
                }
 
+               /* Set base */  
+               if ($this->dn == "new"){
+                 if(isset($_SESSION['CurrentMainBase'])){
+                       $this->base= $_SESSION['CurrentMainBase'];
+                 }else{
+                       $ui= get_userinfo();
+                       $this->base= dn2base($ui->dn);
+                 }
+               } else {
+                 $this->base= preg_replace ("/^[^,]+,[^,]+,/", "", $this->dn);
+               }
+
                /* Get icon data */
                if(isset($this->attrs['gotoMimeIcon'])){
                        $ldap = $this->config->get_ldap_link();
@@ -132,6 +146,33 @@ class mimetype extends plugin
        {
                $smarty = get_smarty();
 
+               /* 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);
+                               echo $this->base;
+                               $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());
+                       }
+               }
+
                /* Check Posts */
                $posts = array( 
                        "/^Pattern_SortUp_/"    => array("Action" => "Pattern_SortUp",  "Func" => "ArrayUp",    "Attr" => "use_gotoMimeFilePattern"),
@@ -257,7 +298,11 @@ class mimetype extends plugin
                        $field2 = array("string" => preg_replace("/%s/",$key,$EApps_Actions),"attach"=>"style='border-right:0px;width:50px;'");
                        $fields = array($field1,$field2);
                        $DivEApps -> AddEntry($fields);
-               }                       
+               }
+               $smarty->assign("baseACL",                                              chkacl($this->acl,"base"));     
+           $smarty->assign("bases",                                            $this->config->idepartments);           
+           $smarty->assign("base_select",                                      $this->base);           
+               $smarty->assign("isReleaseMimeType",                    $this->isReleaseMimeType);
                $smarty->assign("gotoMimeFilePatterns",                 $DivPatterns->DrawList());
                $smarty->assign("gotoMimeApplications",                 $DivApps->DrawList());
                $smarty->assign("gotoMimeEmbeddedApplications", $DivEApps->DrawList());
@@ -556,4 +601,5 @@ class mimetype extends plugin
                }
        }
 }
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
 ?>
index c7b7c528441adf730be5e3c8db619de911685015..f503455d9738d0c3bd10dc56541c1a3dbd719d3c 100755 (executable)
@@ -33,6 +33,7 @@ class mimetypeManagement extends plugin
   var $mimetabs                       = NULL;
   var $snapDialog                     = NULL;
   var $acl                            = NULL;
+  var $CopyPasteHandler               = NULL;
 
   function mimetypeManagement ($config, $ui)
   {
index f41ad78faede188aeaef48390cf920dac95e85b5..10fc17003084c0bea04efeb0d4435e7cbfded338 100644 (file)
                                                <input type="text" name='description' value="{$description}" {$descriptionACL} title='{t}Please sepecify a description{/t}'>
                                        </td>
                                </tr>
+                               <tr>
+                                       <td><LABEL for="base">{t}Base{/t}{$must}</LABEL></td>
+                                       <td>
+                                               <select size="1" id="base" name="base" title="{t}Choose subtree to place application in{/t}"
+                                                       {if $isReleaseMimeType} disabled {/if} {$baseACL}>
+                                                       {html_options options=$bases selected=$base_select}
+                                               </select>
+                                               {if $baseACL == "" && !$isReleaseMimeType}
+                                                       <input type="image" name="chooseBase" src="images/folder.png" class="center" title="{t}Select a base{/t}">
+                                               {else}
+                                                       <img src="images/folder_gray.png" class="center" title="{t}Select a base{/t}">
+                                               {/if}
+                                 </td>
+                                </tr>
+
                        </table>
                        
                </td>