Code

Moved goto partly
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 17 Jan 2008 12:30:06 +0000 (12:30 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 17 Jan 2008 12:30:06 +0000 (12:30 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8441 594d385d-05f5-0310-b6e9-bd551577e9d8

72 files changed:
gosa-core/plugins/admin/applications/class_applicationGeneric.inc [deleted file]
gosa-core/plugins/admin/applications/class_applicationManagement.inc [deleted file]
gosa-core/plugins/admin/applications/class_applicationParameters.inc [deleted file]
gosa-core/plugins/admin/applications/class_divListApplication.inc [deleted file]
gosa-core/plugins/admin/applications/generic.tpl [deleted file]
gosa-core/plugins/admin/applications/main.inc [deleted file]
gosa-core/plugins/admin/applications/parameters.tpl [deleted file]
gosa-core/plugins/admin/applications/release_select.tpl [deleted file]
gosa-core/plugins/admin/applications/remove.tpl [deleted file]
gosa-core/plugins/admin/applications/tabs_application.inc [deleted file]
gosa-core/plugins/admin/devices/class_deviceGeneric.inc [deleted file]
gosa-core/plugins/admin/devices/class_deviceManagement.inc [deleted file]
gosa-core/plugins/admin/devices/class_divListDevices.inc [deleted file]
gosa-core/plugins/admin/devices/deviceGeneric.tpl [deleted file]
gosa-core/plugins/admin/devices/main.inc [deleted file]
gosa-core/plugins/admin/devices/paste_deviceGeneric.tpl [deleted file]
gosa-core/plugins/admin/devices/remove.tpl [deleted file]
gosa-core/plugins/admin/devices/tabs_devices.inc [deleted file]
gosa-core/plugins/admin/mimetypes/class_divListMimeTypes.inc [deleted file]
gosa-core/plugins/admin/mimetypes/class_mimetypeGeneric.inc [deleted file]
gosa-core/plugins/admin/mimetypes/class_mimetypeManagement.inc [deleted file]
gosa-core/plugins/admin/mimetypes/generic.tpl [deleted file]
gosa-core/plugins/admin/mimetypes/main.inc [deleted file]
gosa-core/plugins/admin/mimetypes/paste_generic.tpl [deleted file]
gosa-core/plugins/admin/mimetypes/release_select.tpl [deleted file]
gosa-core/plugins/admin/mimetypes/remove.tpl [deleted file]
gosa-core/plugins/admin/mimetypes/tabs_mimetypes.inc [deleted file]
gosa-core/plugins/personal/environment/class_environment.inc [deleted file]
gosa-core/plugins/personal/environment/class_hotplugDialog.inc [deleted file]
gosa-core/plugins/personal/environment/class_logonManagementDialog.inc [deleted file]
gosa-core/plugins/personal/environment/class_selectPrinterDialog.inc [deleted file]
gosa-core/plugins/personal/environment/environment.tpl [deleted file]
gosa-core/plugins/personal/environment/hotplugDialog.tpl [deleted file]
gosa-core/plugins/personal/environment/logonManagement.tpl [deleted file]
gosa-core/plugins/personal/environment/main.inc [deleted file]
gosa-core/plugins/personal/environment/selectPrinterDialog.tpl [deleted file]
gosa-plugins/goto/admin/applications/class_applicationGeneric.inc [new file with mode: 0644]
gosa-plugins/goto/admin/applications/class_applicationManagement.inc [new file with mode: 0644]
gosa-plugins/goto/admin/applications/class_applicationParameters.inc [new file with mode: 0644]
gosa-plugins/goto/admin/applications/class_divListApplication.inc [new file with mode: 0644]
gosa-plugins/goto/admin/applications/generic.tpl [new file with mode: 0644]
gosa-plugins/goto/admin/applications/main.inc [new file with mode: 0644]
gosa-plugins/goto/admin/applications/parameters.tpl [new file with mode: 0644]
gosa-plugins/goto/admin/applications/release_select.tpl [new file with mode: 0644]
gosa-plugins/goto/admin/applications/remove.tpl [new file with mode: 0644]
gosa-plugins/goto/admin/applications/tabs_application.inc [new file with mode: 0644]
gosa-plugins/goto/admin/devices/class_deviceGeneric.inc [new file with mode: 0644]
gosa-plugins/goto/admin/devices/class_deviceManagement.inc [new file with mode: 0644]
gosa-plugins/goto/admin/devices/class_divListDevices.inc [new file with mode: 0644]
gosa-plugins/goto/admin/devices/deviceGeneric.tpl [new file with mode: 0644]
gosa-plugins/goto/admin/devices/main.inc [new file with mode: 0644]
gosa-plugins/goto/admin/devices/paste_deviceGeneric.tpl [new file with mode: 0644]
gosa-plugins/goto/admin/devices/remove.tpl [new file with mode: 0644]
gosa-plugins/goto/admin/devices/tabs_devices.inc [new file with mode: 0644]
gosa-plugins/goto/admin/mimetypes/class_divListMimeTypes.inc [new file with mode: 0644]
gosa-plugins/goto/admin/mimetypes/class_mimetypeGeneric.inc [new file with mode: 0644]
gosa-plugins/goto/admin/mimetypes/class_mimetypeManagement.inc [new file with mode: 0644]
gosa-plugins/goto/admin/mimetypes/generic.tpl [new file with mode: 0644]
gosa-plugins/goto/admin/mimetypes/main.inc [new file with mode: 0644]
gosa-plugins/goto/admin/mimetypes/paste_generic.tpl [new file with mode: 0644]
gosa-plugins/goto/admin/mimetypes/release_select.tpl [new file with mode: 0644]
gosa-plugins/goto/admin/mimetypes/remove.tpl [new file with mode: 0644]
gosa-plugins/goto/admin/mimetypes/tabs_mimetypes.inc [new file with mode: 0644]
gosa-plugins/goto/personal/environment/class_environment.inc [new file with mode: 0644]
gosa-plugins/goto/personal/environment/class_hotplugDialog.inc [new file with mode: 0644]
gosa-plugins/goto/personal/environment/class_logonManagementDialog.inc [new file with mode: 0644]
gosa-plugins/goto/personal/environment/class_selectPrinterDialog.inc [new file with mode: 0644]
gosa-plugins/goto/personal/environment/environment.tpl [new file with mode: 0644]
gosa-plugins/goto/personal/environment/hotplugDialog.tpl [new file with mode: 0644]
gosa-plugins/goto/personal/environment/logonManagement.tpl [new file with mode: 0644]
gosa-plugins/goto/personal/environment/main.inc [new file with mode: 0644]
gosa-plugins/goto/personal/environment/selectPrinterDialog.tpl [new file with mode: 0644]

diff --git a/gosa-core/plugins/admin/applications/class_applicationGeneric.inc b/gosa-core/plugins/admin/applications/class_applicationGeneric.inc
deleted file mode 100644 (file)
index 247acf9..0000000
+++ /dev/null
@@ -1,572 +0,0 @@
-<?php
-class application extends plugin
-{
-  /* CLI vars */
-  var $cli_summary= "Handling of GOsa's application object";
-  var $cli_description= "Some longer text\nfor help";
-  var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
-  /* application attributes */
-  var $cn= "";
-  var $description= "";
-  var $base= "";
-  var $gosaApplicationExecute= "";
-  var $gosaApplicationName= "";
-  var $gosaApplicationFlags= "";
-  var $gosaApplicationIcon= "";
-  var $gotoLogonScript ="";
-  var $iconData;
-  var $view_logged = FALSE;
-
-  /* Headpage attributes */
-  var $last_sorting= "invalid";
-  var $applications= array();
-
-  /* attribute list for save action */
-  var $attributes= array("cn", "description", "gosaApplicationExecute", "gosaApplicationName","gosaApplicationIcon",
-      "gosaApplicationFlags","gotoLogonScript");
-  var $objectclasses= array("top", "gosaApplication");
-
-  var $isReleaseApplikation = false;
-
-  function application (&$config, $dn= NULL, $parent= NULL)
-  {
-    plugin::plugin ($config, $dn, $parent);
-
-    $appfilter = session::get('appfilter')    ;
-
-    $tmp = $this->config->search("faiManagement", "CLASS",array('menu','tabs'));
-    if(!empty($tmp)) {
-      if(!preg_match("/^".get_ou('applicationou')."/",$appfilter['release'])){
-        $this->isReleaseApplikation = true;  
-      }
-    }
-
-    /* Load icon */
-    $ldap= $config->get_ldap_link();
-    if ($dn != 'new'){
-      $this->iconData= $ldap->get_attribute($dn, "gosaApplicationIcon");
-      $this->saved_attributes['gosaApplicationIcon'] = $this->iconData;
-    }
-    if ($this->iconData == ""){
-      $this->set_picture("");
-    }
-    session::set('binary',$this->iconData);
-    session::set('binarytype',"image/jpeg");
-    $this->gosaApplicationIcon= $this->iconData;
-
-    /* This is always an account */
-    $this->is_account= TRUE;
-
-    if ($this->dn == "new"){
-      if(session::is_set('CurrentMainBase')){
-        $this->base = session::get('CurrentMainBase');
-      }else{
-        $ui= get_userinfo();
-        $this->base= dn2base($ui->dn);
-      }
-    } else {
-
-      if($this->isReleaseApplikation){
-        $this->base = preg_replace("/^.*,".get_ou('applicationou')."/","",$this->dn);
-      }else{
-        $this->base= preg_replace ("/^[^,]+,[^,]+,/", "", $this->dn);
-      }
-    }
-  }
-
-
-  function generateTemplate()
-  {
-    $str= "# This code is part of GOsa (https://gosa.gonicus.de)\n#\n";
-
-    $values = array();
-    $names     = array();
-    if($this->parent->by_object['applicationParameters']->is_account){
-      $names = $this->parent->by_object['applicationParameters']->option_name;
-      $values = $this->parent->by_object['applicationParameters']->option_value;
-    }
-
-    if (count($names)){
-      $str .="# This plugin handles these environment variables:\n";
-    } else {
-      $str .="# This plugin handles no environment variables.\n";
-    }
-
-    foreach($names as $index => $name){
-
-      // Fix length
-      for($i = strlen($name) ; $i < 30 ; $i++){
-        $name= $name." ";
-      }
-      if((isset($values[$index]))&&(!empty($values[$index]))){
-        $str.= "# ".$name."\t(e.g. '".$values[$index]."')\n";
-      }else{
-        $str.= "# ".$name."\t("._("no example").")\n";
-      }
-    }
-    $str .= "#\n".
-      "# Don't remove the following tag, it is used for header update.\n".
-      "### END HEADER ###";
-
-    return($str);
-  }
-
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-    /* Log view */
-    if($this->is_account && !$this->view_logged){
-      $this->view_logged = TRUE;
-      new log("view","application/".get_class($this),$this->dn);
-    }
-
-    $smarty= get_smarty();
-
-    $tmp = $this->plInfo();
-    foreach($tmp['plProvidedAcls'] as $name => $translation){
-      $smarty->assign($name."ACL",$this->getacl($name));
-    }
-    /* Do we represent a valid group? */
-    if (!$this->is_account && $this->parent === NULL){
-      $display= "<img alt=\"\" src=\"images/stop.png\" align=\"middle\">&nbsp;<b>".
-        _("This 'dn' is no application.")."</b>";
-      return ($display);
-    }
-
-    /* Download requested */
-    foreach($_POST as $name => $value){
-      if(preg_match("/^downloadScript/",$name)){
-        session::set('binary',$this->gotoLogonScript);
-        session::set('binarytype',"octet-stream");
-        session::set('binaryfile',$this->cn.".gosaApplication");
-        header("location: getbin.php ");
-        exit();
-      }
-    }
-
-    /* Reassign picture data, sometimes its corrupt cause we started a download of application scripts */
-    session::set('binary',$this->iconData);
-    session::set('binarytype',"image/jpeg");
-    
-    $smarty->assign("rand", rand(0, 10000));
-    $head = $this->generateTemplate();
-    $this->gotoLogonScript= $this->generateTemplate().preg_replace('/.*### END HEADER ###/s', '', $this->gotoLogonScript);
-
-    if((isset($_POST['upLoad']))&&(isset($_FILES['ScriptFile']))){
-      $str = file_get_contents($_FILES['ScriptFile']['tmp_name']);
-      $this->gotoLogonScript = $str;
-    }
-
-    /* Fill templating stuff */
-    $smarty->assign("cn", $this->cn);
-    $smarty->assign("bases", $this->get_allowed_bases());
-    if ($this->dn == "new"){
-      $smarty->assign("selectmode", "");
-      $smarty->assign("namemode", "");
-    } else {
-      $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->get_allowed_bases());
-        $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()){
-        /* Just allow selection valid bases */ 
-        $tmp = $this->get_allowed_bases();
-        if(isset($tmp[$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);
-    $smarty->assign("rand", rand(0, 10000));
-
-    /* Variables */
-    foreach(array("description", "gosaApplicationExecute", "gosaApplicationName","cn") as $val){
-      $smarty->assign($val, $this->$val);
-    }
-
-    /* Checkboxes */
-    foreach (array("G" => "exec_for_groupmembers", "O" => "overwrite_config",
-          "L" => "place_on_kicker",
-          "D" => "place_on_desktop", "M" => "place_in_startmenu") as $key => $val){
-      if (preg_match("/$key/", $this->gosaApplicationFlags)){
-        $smarty->assign("$val", "checked");
-      } else {
-        $smarty->assign("$val", "");
-      }
-    }
-
-    $smarty->assign("isReleaseApplikation" , $this->isReleaseApplikation);
-    $smarty->assign("gotoLogonScript",htmlentities($this->gotoLogonScript, ENT_COMPAT, 'UTF-8'));
-    $smarty->assign("base_select", $this->base);
-    /* Show main page */
-    return($smarty->fetch (get_template_path('generic.tpl', TRUE)));
-  }
-
-
-  function remove_from_parent()
-  {
-    $ldap= $this->config->get_ldap_link();
-    $ldap->rmDir($this->dn);
-    new log("remove","application/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    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");
-
-    /* Delete references to object groups */
-    $ldap->cd ($this->config->current['BASE']);
-    $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".LDAP::prepare4filter($this->dn)."))", array("cn"));
-    while ($ldap->fetch()){
-      $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));
-    }
-
-  }
-
-
-  /* Save data to object */
-  function save_object()
-  {
-    if (isset($_POST['cn'])){
-
-      /* Create a base backup and reset the
-         base directly after calling plugin::save_object();
-         Base will be set seperatly a few lines below */
-      $base_tmp = $this->base;
-      plugin::save_object();
-      $this->base = $base_tmp;
-
-      /* Save attributes */
-      parent::save_object();
-
-      /* Save application flags */
-      $flag= "";
-      if (isset($_POST['exec_for_groupmembers']) && $_POST['exec_for_groupmembers'] == 1){
-        $flag.= "G";
-      }
-      if (isset($_POST['place_on_desktop']) && $_POST['place_on_desktop'] == 1){
-        $flag.= "D";
-      }
-      if (isset($_POST['place_on_kicker']) && $_POST['place_on_kicker'] == 1){
-        $flag.= "L";
-      }
-      if (isset($_POST['place_in_startmenu']) && $_POST['place_in_startmenu'] == 1){
-        $flag.= "M";
-      }
-      if (isset($_POST['overwrite_config']) && $_POST['overwrite_config'] == 1){
-        $flag.= "O";
-      }
-      if ($this->acl_is_writeable("gosaApplicationFlags")){
-        $this->gosaApplicationFlags= "[$flag]";
-      }
-
-      /* Remove current picture */
-      if(isset($_POST['remove_picture'])){
-        $this->set_picture("");
-      }
-
-      /* Check for picture upload */
-      if (isset($_FILES['picture_file']['name']) && $_FILES['picture_file']['name'] != ""){
-
-        if (!is_uploaded_file($_FILES['picture_file']['tmp_name'])) {
-          print_red (_("The specified picture has not been uploaded correctly."));
-        }
-
-        if (!function_exists("imagick_blob2image")){
-          /* Get temporary file name for conversation */
-          $fname = tempnam ("/tmp", "GOsa");
-
-          /* Open file and write out photoData */
-          $fp = fopen ($fname, "w");
-          fwrite ($fp, $_FILES['picture_file']['tmp_name']);
-          fclose ($fp);
-
-          /* Build conversation query. Filename is generated automatically, so
-             we do not need any special security checks. Exec command and save
-             output. For PHP safe mode, you'll need a configuration which respects
-             image magick as executable... */
-          $query= "convert -size 48x48 $fname -resize 48x48 +profile \"*\" -";
-          @DEBUG (DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__, $query, "Execute");
-
-          /* Read data written by convert */
-          $output= "";
-          $sh= popen($query, 'r');
-          while (!feof($sh)){
-            $output.= fread($sh, 4096);
-          }
-          pclose($sh);
-
-          unlink($fname);      
-        } else {
-
-          /* Load the new uploaded Photo */
-          if(!$handle  =  imagick_ReadImage($_FILES['picture_file']['tmp_name'])){
-            print_red(_("Can't access uploaded image."));
-          }
-
-          /* Resizing image to 147x200 and blur */
-          if(!imagick_resize($handle,48,48,IMAGICK_FILTER_GAUSSIAN,0)){
-            print_red(_("Uploaded image could not be resized, possilby the image magick extension is missing."));
-          }
-
-          /* Converting image to JPEG */
-          if(!imagick_convert($handle,"PNG")) {
-            print_red(_("Could not convert image to png, possilby the image magick extension is missing."));
-          }
-
-          if(!imagick_writeimage($handle,$_FILES['picture_file']['tmp_name'])){
-            print_red(sprintf(_("Could not save uploaded image to %s."),$_FILES['picture_file']['tmp_name']));
-          }
-
-          imagick_free($handle);
-        }
-
-        /* Activate new picture */
-        $this->set_picture($_FILES['picture_file']['tmp_name']);
-      }        
-
-      if(!$this->isReleaseApplikation){
-        $tmp = $this->get_allowed_bases();
-        if(isset($_POST['base'])){
-          if(isset($tmp[$_POST['base']])){
-            $this->base= $_POST['base'];
-          }
-        }
-      }
-    }
-  }
-
-
-  /* Check values */
-  function check()
-  {
-    /* Call common method to give check the hook */
-    $message= plugin::check();
-
-    if(!preg_match("#^/#",$this->gosaApplicationExecute)){
-      $message[]=(_("Specified execute path must start with '/'."));
-    }
-
-    /* Permissions for that base? */
-    if ($this->base != ""){
-      $new_dn= "cn=".$this->cn.",".get_ou('applicationou').$this->base;
-    } else {
-      $new_dn= $this->dn;
-    }
-
-
-    if($this->dn == "new"){
-      $this->set_acl_base($this->base);
-    }
-
-    /* All required fields are set? */
-    if ($this->cn == ""){
-      $message[]= _("Required field 'Name' is not filled.");
-    }
-
-    if(preg_match("/[^a-z0-9]/",$this->cn))    {
-      $message[]=_("Invalid character in application name. Only a-z 0-9 are allowed.");
-    }
-
-    if ($this->gosaApplicationExecute == ""){
-      $message[]= _("Required field 'Execute' is not filled.");
-    }
-
-    /* Check for existing application */
-    $ldap= $this->config->get_ldap_link();
-    $ldap->cd($this->config->current["BASE"]);
-
-    $tmp = $this->config->search("faiManagement", "CLASS",array('menu','tabs'));
-    $appfilter = session::get('appfilter');
-    if((!empty($tmp)) && (isset($appfilter['release']))){
-      $baseDn = str_replace($this->config->current['BASE'],$this->base,$appfilter['release']);
-      $baseDn = preg_replace("/".get_ou('applicationou').".*/",get_ou('applicationou').$this->base,$appfilter['release']);
-      $ldap->ls("(&(objectClass=gosaApplication)(cn=".$this->cn."))",$baseDn,array("cn"));
-      if($ldap->count()){
-        $attrs = $ldap->fetch();
-        if($this->dn != $attrs['dn']) {
-          $message[]= _("There's already an application with this 'Name'.");
-        }
-      }
-    }else{
-      $ldap->ls("(&(objectClass=gosaApplication)(cn=".$this->cn."))",get_ou('applicationou').$this->base,array("cn"));
-      if ($ldap->count()){
-        $attrs = $ldap->fetch();
-        if($this->dn != $attrs['dn']) {
-          $message[]= _("There's already an application with this 'Name'.");
-        }
-      }
-    }
-    return $message;
-  }
-
-
-  /* Save to LDAP */
-  function save()
-  {
-    /* Get application script without header part, to check if we must save the script itself */
-    $script = preg_replace('/.*### END HEADER ###/s', '', $this->gotoLogonScript);
-
-    plugin::save();
-    $this->attrs["gosaApplicationIcon"]= $this->gosaApplicationIcon;
-
-    /* Write back to ldap */
-    $ldap= $this->config->get_ldap_link();
-    $ldap->cat($this->dn, array('dn'));
-
-    $a= $ldap->fetch();
-    if (count($a)){
-
-      /* Remove gotoLogonScript if it is empty */
-      if(empty($script))    {
-        $this->attrs['gotoLogonScript'] = array();
-      }
-
-      $ldap->cd($this->dn);
-      $this->cleanup();
-      $ldap->modify ($this->attrs); 
-      $this->handle_post_events("modify");
-      new log("modify","application/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    } else {
-      
-      /* Remove gotoLogonScript if it is empty */
-      if(empty($script))    {
-        unset($this->attrs['gotoLogonScript']);
-      }
-
-      $ldap->cd($this->config->current['BASE']);
-      $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
-      $ldap->cd($this->dn);
-      $ldap->add($this->attrs);
-      new log("create","application/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-      $this->handle_post_events("add");
-    }
-    show_ldap_error($ldap->get_error(), sprintf(_("Saving of application with dn '%s' failed."),$this->dn));
-  }
-
-  function set_picture($filename)
-  {
-    if (!is_file($filename)){
-      $filename= "./images/default_icon.png";
-      $this->gosaApplicationIcon= "*removed*";
-    }
-
-    if (file_exists($filename)){
-      $fd = fopen ($filename, "rb");
-      $this->iconData= fread ($fd, filesize ($filename));
-      session::set('binary',$this->iconData);
-      session::set('binarytype',"image/jpeg");
-      $this->gosaApplicationIcon= $this->iconData;
-
-      fclose ($fd);
-    }
-  }
-
-  function getCopyDialog()
-  {
-    $vars = array("cn");
-
-    $str ="<h2>"._("Application settings")."</h2>
-      <table>
-      <tr>
-      <td>".
-      _("Application name"). 
-      "</td>  
-      <td>
-      <input id='gosaApplicationName' name='cn' size='35' maxlength='60' 
-      value='".$this->cn."' 
-      title='"._("Application name to be displayed (i.e. below icons)")."'>                     
-      </td>
-      </tr>
-      </table>";
-    $ret = array();
-    $ret['status'] = "";
-    $ret['string'] = $str;
-    return($ret);
-  }
-
-  function saveCopyDialog()
-  {
-    if(isset($_POST['cn'])){
-      $this->cn = $_POST['cn'];
-    }
-  }
-
-
-  function PrepareForCopyPaste($source)
-  {
-    plugin::PrepareForCopyPaste($source);
-    $source_o = new application($this->config,$source['dn']);
-    $this->gosaApplicationIcon = $source_o->gosaApplicationIcon;     
-  }
-
-
-  /* Return plugin informations for acl handling
-      #FIXME FAIscript seams to ununsed within this class... */
-  static 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"),
-            "base"              => _("Base"),
-            "description"       => _("Description"),
-            "gosaApplicationExecute"  => _("Execute"),
-            "gosaApplicationName"     => _("Name"),
-            "gosaApplicationIcon"     => _("Icon"),
-            "gosaApplicationFlags"    => _("Flag"),
-            "gotoLogonScript"         => _("Script content"),
-
-            "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:
-?>
diff --git a/gosa-core/plugins/admin/applications/class_applicationManagement.inc b/gosa-core/plugins/admin/applications/class_applicationManagement.inc
deleted file mode 100644 (file)
index c781032..0000000
+++ /dev/null
@@ -1,647 +0,0 @@
-<?php
-/*
-   This code is part of GOsa (https://gosa.gonicus.de)
-   Copyright (C) 2003  Cajus Pollmeier
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-class applicationManagement extends plugin
-{
-  /* Definitions */
-  var $plHeadline     = "Applications";
-  var $plDescription  = "This does something";
-
-  /* Dialog attributes */
-  var $apptabs                  = NULL;
-  var $ui                       = NULL;
-  var $CopyPasteHandler         = NULL;
-  var $DivListApplication       = NULL;
-  var $applications             = array();
-  var $enableReleaseManagement  = false;
-  var $start_pasting_copied_objects = FALSE;
-
-  function IsReleaseManagementActivated()
-  {
-    /* Check if we should enable the release selection */
-    $tmp = $this->config->search("faiManagement", "CLASS",array('menu','tabs'));
-    if(!empty($tmp)){
-      return(true);
-    }
-    return(false);
-  }
-
-  function applicationManagement (&$config, &$ui)
-  {
-    /* Save configuration for internal use */
-    $this->config   = &$config;
-    $this->ui       = &$ui;
-
-    /* Check if copy & paste is activated */
-    if($this->config->boolValueIsTrue("MAIN","ENABLECOPYPASTE")){
-      $this->CopyPasteHandler = new CopyPasteHandler($this->config);
-    }
-
-    /* Creat dialog object */
-    $this->DivListApplication = new divListApplication($this->config,$this);
-
-    if($this->IsReleaseManagementActivated()){
-    /* Check if we should enable the release selection */
-      $this->enableReleaseManagement = true;
-
-      /* Hide SubSearch checkbox */
-      $this->DivListApplication->DisableCheckBox("SubSearch");
-    }
-  }
-
-  function getReleases($base)
-  {
-    $ldap                   = $this->config->get_ldap_link();
-    $dn                     = get_ou('applicationou').$base;
-    $ret                    = array();
-    $ret [get_ou('applicationou').$base] = "/";
-
-    $ldap->cd($dn);
-    $ldap->search("objectClass=organizationalUnit",array("ou"));
-
-    while($attrs = $ldap->fetch()){
-      $str = str_replace($dn,"",$attrs['dn']);
-      $tmp = array_reverse( split("ou=",$str));
-      $str = "";
-      foreach($tmp as $val){
-        $val = trim(preg_replace("/,/","",$val));
-        if(empty($val)) break;
-        $str .= "/".$val;
-      } 
-      if(!empty($str)){
-        $ret[$attrs['dn']]= preg_replace("/^\//","",$str);
-      }
-    }
-    asort($ret);
-    return($ret);
-  }
-
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-
-    /**************** 
-      Variable init 
-     ****************/
-
-    /* These vars will be stored if you try to open a locked app, 
-        to be able to perform your last requests after showing a warning message */
-    session::set('LOCK_VARS_TO_USE',array("/^act$/","/^id$/","/^appl_edit_/","/^appl_del_/","/^item_selected/","/^remove_multiple_applications/"));
-
-    $smarty       = get_smarty();             // Smarty instance
-    $s_action     = "";                       // Contains the action to proceed
-    $s_entry      = "";                       // The value for s_action
-    $base_back    = "";                       // The Link for Backbutton
-    
-    /* Test Posts */
-    foreach($_POST as $key => $val){
-      // Post for delete
-      if(preg_match("/appl_del.*/",$key)){
-        $s_action = "del";
-        $s_entry  = preg_replace("/appl_".$s_action."_/i","",$key);
-        // Post for edit
-      }elseif(preg_match("/appl_edit_.*/",$key)){
-        $s_action="edit";
-        $s_entry  = preg_replace("/appl_".$s_action."_/i","",$key);
-        // Post for new
-      }elseif(preg_match("/^copy_.*/",$key)){
-        $s_action="copy";
-        $s_entry  = preg_replace("/^copy_/i","",$key);
-      }elseif(preg_match("/^cut_.*/",$key)){
-        $s_action="cut";
-        $s_entry  = preg_replace("/^cut_/i","",$key);
-        // Post for new
-      }elseif(preg_match("/^appl_new.*/",$key)){
-        $s_action="new";
-      }elseif(preg_match("/^remove_multiple_applications/",$key)){
-        $s_action="del_multiple";
-      }elseif(preg_match("/^editPaste.*/i",$key)){
-        $s_action="editPaste";
-      }elseif(preg_match("/^multiple_copy_groups/",$key)){
-        $s_action = "copy_multiple";
-      }elseif(preg_match("/^multiple_cut_groups/",$key)){
-        $s_action = "cut_multiple";
-      }
-    }
-
-    if((isset($_GET['act']))&&($_GET['act']=="edit_entry")){
-      $s_action ="edit";
-      $s_entry  = $_GET['id'];
-    }
-
-    $s_entry  = preg_replace("/_.$/","",$s_entry);
-
-
-    /* handle C&P from layers menu */
-    if(isset($_POST['menu_action']) && preg_match("/^multiple_copy_systems/",$_POST['menu_action'])){
-      $s_action = "copy_multiple";
-    }
-    if(isset($_POST['menu_action']) && preg_match("/^multiple_cut_systems/",$_POST['menu_action'])){
-      $s_action = "cut_multiple";
-    }
-    if(isset($_POST['menu_action']) && preg_match("/^editPaste/",$_POST['menu_action'])){
-      $s_action = "editPaste";
-    }
-
-    /* Create options */
-    if(isset($_POST['menu_action']) && $_POST['menu_action'] == "appl_new"){
-      $s_action = "new";
-    }
-
-    /* handle remove from layers menu */
-    if(isset($_POST['menu_action']) && preg_match("/^remove_multiple/",$_POST['menu_action'])){
-      $s_action = "del_multiple";
-    }
-
-    /**************** 
-      Copy & Paste handling  
-     ****************/
-
-    /* Display the copy & paste dialog, if it is currently open */
-    $ret = $this->copyPasteHandling_from_queue($s_action,$s_entry);
-    if($ret){
-      return($ret);
-    }
-
-    /**************** 
-      Create a new app 
-     ****************/
-
-    /* New application? */
-    if ($s_action=="new"){
-
-      /* By default we set 'dn' to 'new', all relevant plugins will
-         react on this. */
-      $this->dn= "new";
-
-      /* Create new usertab object */
-      $this->apptabs= new apptabs($this->config,$this->config->data['TABS']['APPSTABS'], $this->dn,"application");
-      $this->apptabs->set_acl_base($this->DivListApplication->selectedBase);
-    }
-
-
-    /**************** 
-      Edit entry canceled 
-     ****************/
-
-    /* Cancel dialogs */
-    if (isset($_POST['edit_cancel']) || isset($_POST['password_cancel'])){
-      del_lock ($this->apptabs->dn);
-      unset ($this->apptabs);
-      $this->apptabs= NULL;
-      session::un_set('objectinfo');
-    }
-
-
-    /**************** 
-      Edit entry finished 
-     ****************/
-
-    /* Finish apps edit is triggered by the tabulator dialog, so
-       the user wants to save edited data. Check and save at this
-       point. */
-    if ((isset($_POST['edit_finish']) || isset($_POST['edit_apply']) ) && (isset($this->apptabs->config))){
-
-      /* Check tabs, will feed message array */
-      $this->apptabs->last= $this->apptabs->current;
-      $this->apptabs->save_object();
-      $message= $this->apptabs->check();
-
-      /* Save, or display error message? */
-      if (count($message) == 0){
-
-        /* Save data data to ldap */
-        $this->apptabs->set_release($this->DivListApplication->selectedRelease);
-        $this->apptabs->save();
-
-        if (!isset($_POST['edit_apply'])){
-          /* Application has been saved successfully, remove lock from
-             LDAP. */
-          if ($this->dn != "new"){
-            del_lock ($this->dn);
-          }
-          unset ($this->apptabs);
-          $this->apptabs= NULL;
-          session::un_set('objectinfo');
-        }
-      } else {
-        /* Ok. There seem to be errors regarding to the tab data,
-           show message and continue as usual. */
-        show_errors($message);
-      }
-    }
-
-
-    /**************** 
-      Edit entry  
-     ****************/
-
-    /* User wants to edit data? */
-    if (($s_action=="edit") && (!isset($this->apptabs->config))){
-
-      /* Get 'dn' from posted 'applist', must be unique */
-      $this->dn= $this->applications[$s_entry]['dn'];
-
-      /* Check locking, save current plugin in 'back_plugin', so
-         the dialog knows where to return. */
-      if (($user= get_lock($this->dn)) != ""){
-        return(gen_locked_message ($user, $this->dn));
-      }
-
-      /* Lock the current entry, so everyone will get the
-         above dialog */
-      add_lock ($this->dn, $this->ui->dn);
-
-      /* Register apptabs to trigger edit dialog */
-      $this->apptabs= new apptabs($this->config,$this->config->data['TABS']['APPSTABS'], $this->dn,"application");
-      $this->apptabs->set_acl_base($this->dn);
-      session::set('objectinfo',$this->dn);
-    }
-
-
-
-    /********************
-      Delete MULTIPLE entries requested, display confirm dialog
-     ********************/
-
-    if ($s_action=="del_multiple"){
-      $ids = $this->list_get_selected_items();
-
-      if(count($ids)){
-
-        foreach($ids as $id){
-          $dn = $this->applications[$id]['dn'];
-          if (($user= get_lock($dn)) != ""){
-            return(gen_locked_message ($user, $dn));
-          }
-          $this->dns[$id] = $dn;
-        }
-
-        $dns_names = "<br><pre>";
-        foreach($this->dns as $dn){
-          add_lock ($dn, $this->ui->dn);
-          $dns_names .= $dn."\n";
-        }
-        $dns_names .="</pre>";
-
-        /* Lock the current entry, so nobody will edit it during deletion */
-        if (count($this->dns) == 1){
-          $smarty->assign("intro",     sprintf(_("You're about to delete the following entry %s"), @LDAP::fix($dns_names)));
-        } else {
-          $smarty->assign("intro",     sprintf(_("You're about to delete the following entries %s"), @LDAP::fix($dns_names)));
-        }
-        $smarty->assign("multiple", true);
-        return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
-      }
-    }
-
-
-    /********************
-      Delete MULTIPLE entries confirmed
-     ********************/
-
-    /* Confirmation for deletion has been passed. Users should be deleted. */
-    if (isset($_POST['delete_multiple_application_confirm'])){
-
-      /* Remove user by user and check acls before removeing them */
-      foreach($this->dns as $key => $dn){
-
-        $ui = get_userinfo();
-        $acl = $ui->get_permissions($dn ,"application/application");
-        if (preg_match('/d/', $acl)){
-
-          /* Delete request is permitted, perform LDAP action */
-          $this->apptabs= new apptabs($this->config, $this->config->data['TABS']['APPSTABS'], $dn,"application");
-          $this->apptabs->set_acl_base($dn);
-          $this->apptabs->delete ();
-          unset ($this->apptabs);
-          $this->apptabs= NULL;
-
-        } else {
-          /* Normally this shouldn't be reached, send some extra
-             logs to notify the administrator */
-          print_red (_("You are not allowed to delete this application!"));
-          new log("security","application/".get_class($this),$dn,array(),"Tried to trick deletion.");
-        }
-        /* Remove lock file after successfull deletion */
-        del_lock ($dn);
-        unset($this->dns[$key]);
-      }
-    }
-
-
-    /********************
-      Delete MULTIPLE entries Canceled
-     ********************/
-
-    /* Remove lock */
-    if(isset($_POST['delete_multiple_application_cancel'])){
-      foreach($this->dns as $key => $dn){
-        del_lock ($dn);
-        unset($this->dns[$key]);
-      }
-    }
-
-    /**************** 
-      Delete app 
-     ****************/
-
-    /* Remove user was requested */
-    if ($s_action == "del"){
-
-      /* Get 'dn' from posted 'uid' */
-      $this->dn= $this->applications[$s_entry]['dn'];
-
-      /* Load permissions for selected 'dn' and check if
-         we're allowed to remove this 'dn' */
-      $ui = get_userinfo();
-      $acl = $ui->get_permissions($this->dn ,"application/application");
-
-      if(preg_match("/d/",$acl)){
-        /* Check locking, save current plugin in 'back_plugin', so
-           the dialog knows where to return. */
-        if (($user= get_lock($this->dn)) != ""){
-          return (gen_locked_message ($user, $this->dn));
-        }
-
-        /* Lock the current entry, so nobody will edit it during deletion */
-        add_lock ($this->dn, $this->ui->dn);
-        $smarty= get_smarty();
-        $smarty->assign("intro", sprintf(_("You're about to delete the application '%s'."), @LDAP::fix($this->dn)));
-        $smarty->assign("multiple", false);
-        return($smarty->fetch (get_template_path('remove.tpl', TRUE)));
-      } else {
-
-        /* Obviously the user isn't allowed to delete. Show message and
-           clean session. */
-        print_red (_("You are not allowed to delete this application!"));
-      }
-    }
-
-
-    /**************** 
-      Delete app confirmed 
-     ****************/
-
-    /* Confirmation for deletion has been passed. Group should be deleted. */
-    if (isset($_POST['delete_app_confirm'])){
-
-      /* Some nice guy may send this as POST, so we've to check
-         for the permissions again. */
-      $ui = get_userinfo();
-      $acl = $ui->get_permissions($this->dn ,"application/application");
-
-      if(preg_match("/d/",$acl)){
-
-        /* Delete request is permitted, perform LDAP action */
-        $this->apptabs= new apptabs($this->config, $this->config->data['TABS']['APPSTABS'], $this->dn,"application");
-        $this->apptabs->set_acl_base($this->dn);
-        $this->apptabs->delete ();
-        unset ($this->apptabs);
-        $this->apptabs= NULL;
-
-      } else {
-
-        /* Normally this shouldn't be reached, send some extra
-           logs to notify the administrator */
-        print_red (_("You are not allowed to delete this application!"));
-        new log("security","application/".get_class($this),$dn,array(),"Tried to trick deletion.");
-      }
-
-      /* Remove lock file after successfull deletion */
-      del_lock ($this->dn);
-    }
-
-
-    /**************** 
-      Delete app canceled 
-     ****************/
-
-    /* Delete application canceled? */
-    if (isset($_POST['delete_cancel'])){
-      del_lock ($this->dn);
-      session::un_set('objectinfo');
-    }
-
-    /* Show tab dialog if object is present */
-    if (($this->apptabs) && (isset($this->apptabs->config))){
-      $display= $this->apptabs->execute();
-
-      /* Don't show buttons if tab dialog requests this */
-      if (!$this->apptabs->by_object[$this->apptabs->current]->dialog){
-        $display.= "<p style=\"text-align:right\">\n";
-        $display.= "<input type=\"submit\" name=\"edit_finish\" style=\"width:80px\" value=\""._("Ok")."\">\n";
-        $display.= "&nbsp;\n";
-        if ($this->dn != "new"){
-          $display.= "<input type=submit name=\"edit_apply\" value=\""._("Apply")."\">\n";
-          $display.= "&nbsp;\n";
-        }
-        $display.= "<input type=\"submit\" name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
-        $display.= "</p>";
-      }
-      return ($display);
-    }
-
-
-    /****************
-      Dialog display
-     ****************/
-
-    /* Check if there is a snapshot dialog open */
-    $base = $this->DivListApplication->selectedBase;
-    if($str = $this->showSnapshotDialog($base,$this->get_used_snapshot_bases($base))){
-      return($str);
-    }
-
-    /* Display dialog with system list */
-    $this->DivListApplication->parent = $this;
-    $this->DivListApplication->execute();
-    $this->DivListApplication->AddDepartments($this->DivListApplication->selectedBase,3,1);
-    $this->reload();
-    $this->DivListApplication->setEntries($this->applications);
-    return($this->DivListApplication->Draw());
-  }
-
-
-  /* Return departments, that will be included within snapshot detection */
-  function get_used_snapshot_bases(){
-    if($this->DivListApplication->selectedRelease == "main"){
-      return(array($this->DivListApplication->selectedBase));
-    }else{
-      return(array($this->DivListApplication->selectedRelease));
-    }
-  }
-
-
-  function reload()
-  {
-    $this->applications= array();
-
-    /* Set base for all searches */
-    $base       = $this->DivListApplication->selectedBase;
-    $release    = $this->DivListApplication->selectedRelease;
-    $Regex      = $this->DivListApplication->Regex;
-    $SubSearch  = $this->DivListApplication->SubSearch; 
-    $Flags      =  GL_NONE | GL_SIZELIMIT;
-    $Filter     = "(&(cn=".$Regex.")(objectClass=gosaApplication))";
-    $tmp        = array();
-    $Releases   = $this->getReleases($base);
-
-    if(!$this->enableReleaseManagement){
-      $use_base = get_ou('applicationou').$base;
-    }else{
-      if(isset($Releases[$release])){
-        $use_base  = $release;
-      }else{
-        $use_base  = get_ou('applicationou').$base;
-      }
-    }
-
-    if($SubSearch){
-      $Flags    |= GL_SUBSEARCH;  
-    }
-   
-    $res= get_sub_list($Filter, "application",get_ou('applicationou'), $use_base, array("cn","description","dn","objectClass"), $Flags);
-    $tmp2 = array();
-    foreach ($res as $val){
-      $tmp[strtolower($val['cn'][0]).$val['cn'][0].$val['dn']]=$val;
-      $tmp2[strtolower($val['cn'][0]).$val['cn'][0].$val['dn']] = strtolower($val['cn'][0]).$val['cn'][0].$val['dn'];
-    }
-
-    natcasesort($tmp2);
-    $this->applications=array();
-    foreach($tmp2 as $val){
-      $this->applications[]=$tmp[$val];
-    }
-    reset ($this->applications);
-  }
-
-  function remove_from_parent()
-  {
-    /* Optionally execute a command after we're done */
-    $this->postremove();
-  }
-
-
-  function copyPasteHandling_from_queue($s_action,$s_entry)
-  {
-    /* Check if Copy & Paste is disabled */
-    if(!is_object($this->CopyPasteHandler)){
-      return("");
-    }
-
-    /* Add a single entry to queue */
-    if($s_action == "cut" || $s_action == "copy"){
-
-      /* Cleanup object queue */
-      $this->CopyPasteHandler->cleanup_queue();
-      $dn = $this->applications[$s_entry]['dn'];
-      $this->CopyPasteHandler->add_to_queue($dn,$s_action,"apptabs","APPSTABS","application");
-    }
-
-
-    /* Add entries to queue */
-    if($s_action == "copy_multiple" || $s_action == "cut_multiple"){
-
-      /* Cleanup object queue */
-      $this->CopyPasteHandler->cleanup_queue();
-
-      /* Add new entries to CP queue */
-      foreach($this->list_get_selected_items() as $id){
-        $dn = $this->applications[$id]['dn'];
-
-        if($s_action == "copy_multiple"){
-          $this->CopyPasteHandler->add_to_queue($dn,"copy","apptabs","APPSTABS","application");
-        }
-        if($s_action == "cut_multiple"){
-          $this->CopyPasteHandler->add_to_queue($dn,"cut","apptabs","APPSTABS","application");
-        }
-      }
-    }
-
-    /* Start pasting entries */
-    if($s_action == "editPaste"){
-      $this->start_pasting_copied_objects = TRUE;
-    }
-
-
-    /* Return C&P dialog */
-    if($this->start_pasting_copied_objects && $this->CopyPasteHandler->entries_queued()){
-
-      /* Load entry from queue and set base */
-      $this->CopyPasteHandler->load_entry_from_queue();
-      $this->CopyPasteHandler->SetVar("base",$this->DivListApplication->selectedBase);
-
-      /* Get dialog */
-      $data = $this->CopyPasteHandler->execute();
-
-      /* Return dialog data */
-      if(!empty($data)){
-        return($data);
-      }
-    }
-
-    /* Automatically disable status for pasting */
-    if(!$this->CopyPasteHandler->entries_queued()){
-      $this->start_pasting_copied_objects = FALSE;
-    }
-    return("");
-  }
-
-
-  function list_get_selected_items()
-  {
-    $ids = array();
-    foreach($_POST as $name => $value){
-      if(preg_match("/^item_selected_[0-9]*$/",$name)){
-        $id   = preg_replace("/^item_selected_/","",$name);
-        $ids[$id] = $id;
-      }
-    }
-    return($ids);
-  }
-
-
-  /* Save to LDAP */
-  function save()
-  {
-    /* Optionally execute a command after we're done */
-    $this->postcreate();
-  }
-
-  function remove_lock()
-  {
-    if (isset($this->apptabs->dn)){
-      del_lock ($this->apptabs->dn);
-    }
-  }
-
-  function save_object() {
-    $this->DivListApplication->save_object();
-  }
-
-  function check() {}
-  function adapt_from_template($dn) {}
-  function password_change_needed() {}
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/gosa-core/plugins/admin/applications/class_applicationParameters.inc b/gosa-core/plugins/admin/applications/class_applicationParameters.inc
deleted file mode 100644 (file)
index 9f11eb6..0000000
+++ /dev/null
@@ -1,248 +0,0 @@
-<?php
-class applicationParameters extends plugin
-{
-  /* CLI vars */
-  var $cli_summary= "Manage application class parameters";
-  var $cli_description= "Some longer text\nfor help";
-  var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
-  /* Parameters  */
-  var $option_name= array();
-  var $option_value= array();
-
-  /* attribute list for save action */
-  var $attributes= array("gosaApplicationParameter");
-  var $objectclasses= array();
-
-  var $CopyPasteVars = array("option_name","option_value");
-
-  function applicationParameters (&$config, $dn= NULL, $parent= NULL)
-  {
-    plugin::plugin ($config, $dn, $parent);
-
-    $this->gosaApplicationParameter = array();
-
-    if (isset($this->attrs['gosaApplicationParameter'])){
-      $this->is_account= TRUE;
-      for ($i= 0; $i<$this->attrs['gosaApplicationParameter']['count']; $i++){
-        $option= preg_replace('/^[^:]+:/', '',
-            $this->attrs['gosaApplicationParameter'][$i]);
-        $name= preg_replace('/:.*$/', '',
-            $this->attrs['gosaApplicationParameter'][$i]);
-        $this->option_name[$i]= $name;
-        $this->option_value[$i]= $option;
-      }
-    } else {
-      $this->is_account= FALSE;
-    }
-  }
-
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-    /* Do we need to flip is_account state? */
-    if (isset($_POST['modify_state'])){
-      $this->is_account= !$this->is_account;
-    }
-
-    /* Show tab dialog headers */
-    $display= "";
-    if ($this->parent !== NULL){
-      if ($this->is_account){
-        $display= $this->show_disable_header(_("Remove options"),
-            _("This application has options. You can disable them by clicking below."));
-      } else {
-        $display= $this->show_enable_header(_("Create options"),
-            _("This application has options disabled. You can enable them by clicking below."));
-        $this->parent->by_object['application']->generateTemplate();
-        return ($display);
-      }
-    }
-
-    /* Add option to list */
-    if (isset($_POST['add_option'])){
-      $i= count($this->option_name);
-      $this->option_name[$i]= "";
-      $this->option_value[$i]= "";
-    }
-
-    /* Remove value from list */
-    for ($i= 0; $i<count($this->option_name); $i++){
-      if (isset($_POST["remove$i"])){
-        $k= 0;
-        $on= array();
-        $ov= array();
-        for ($j= 0; $j<count($this->option_name); $j++){
-          if ($j != $i){
-            $on[$k]= $this->option_name[$j];
-            $ov[$k]= $this->option_value[$j];
-            $k++;
-          }
-        }
-        $this->option_name= $on;
-        $this->option_value= $ov;
-        break;
-      }
-    }
-
-    /* Generate list of attributes */
-    if (count($this->option_name) == 0){
-      $this->option_name[]= "";
-      $this->option_value[]= "";
-    }
-
-
-    $acl = $this->getacl("gosaApplicationParameter")   ;
-    $table= "<table summary=\"\"><tr><td>"._("Variable")."</td><td>"._("Default value")."</td><td></td></tr>";
-    if (count ($this->option_name)){
-
-      for ($i= 0; $i < count($this->option_name); $i++){
-        $name = $this->option_name[$i];
-        $value= $this->option_value[$i];
-
-        $tag = "";
-        if(!preg_match("/w/",$acl)){
-          $tag = " disabled ";
-        }
-
-        if(!preg_match("/r/",$acl)){
-          $name = "";
-          $value= "";
-        }
-
-        $table.="<tr>".
-          " <td>".
-          "  <input name=\"option$i\" size=25 maxlength=50 value=\"".$name."\" ".$tag.">".
-          " </td>".
-          " <td>".
-          "  <input name=\"value$i\" size=60 maxlength=250 value=\"".$value."\" ".$tag.">".
-          "  <br>".
-          " </td>".
-          " <td>".
-          "  <input type=\"submit\" name=\"remove$i\" value=\""._("Remove")."\" ".$tag.">".
-          " </td>".
-          "</tr>";
-      }
-    }
-    $table.= "</table>";
-    $table.="<input type=\"submit\" name=\"add_option\" value=\""._("Add option")."\">";
-
-    /* Show main page */
-    $smarty= get_smarty();
-    $tmp = $this->plInfo();
-    foreach($tmp['plProvidedAcls'] as $name => $translation){
-      $smarty->assign($name."ACL",$this->getacl($name));
-    }
-
-    $smarty->assign("table", $table);
-    $display.= $smarty->fetch(get_template_path('parameters.tpl', TRUE));
-    $this->parent->by_object['application']->generateTemplate();
-    return ($display);
-  }
-
-  function remove_from_parent()
-  {
-    $ldap= $this->config->get_ldap_link();
-
-    /* Zero attributes */
-    $this->attrs= array();
-    $this->attrs['gosaApplicationParameter']= array();
-
-    $ldap->cd($this->dn);
-    @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__,
-        $this->attributes, "Save");
-    $this->cleanup();
-    $ldap->modify ($this->attrs); 
-
-    show_ldap_error($ldap->get_error(), sprintf(_("Removing of application parameters with dn '%s' failed."),$this->dn));
-
-    /* Optionally execute a command after we're done */
-    $this->handle_post_events('remove');
-  }
-
-
-  /* Save data to object */
-  function save_object()
-  {
-    if (isset($_POST['option0'])){
-      for ($i= 0; $i<count($this->option_name); $i++){
-        $this->option_name[$i]= $_POST["option$i"];
-        $this->option_value[$i]= "";
-        if ($_POST["value$i"] != ""){
-          $this->option_value[$i]= $_POST["value$i"];
-        }
-      }
-    }
-  }
-
-
-  /* Check values */
-  function check()
-  {
-    /* Call common method to give check the hook */
-    $message= plugin::check();
-
-    /* Check for valid option names */
-    for ($i= 0; $i<count($this->option_name); $i++){
-      if (!preg_match ("/^[a-z0-9_]+$/i", $this->option_name[$i])){
-        $message[]= sprintf(_("Value '%s' specified as option name is not valid."), 
-            $this->option_name[$i]);
-      }
-    }
-
-    return $message;
-  }
-
-
-  /* Save to LDAP */
-  function save()
-  {
-    /* Generate values */
-    $this->attrs= array();
-    if (count($this->option_name) == 0){
-      $this->attrs['gosaApplicationParameter']= array();
-    } else {
-      for ($i= 0; $i<count($this->option_name); $i++){
-        $this->attrs['gosaApplicationParameter'][]= $this->option_name[$i].
-          ":".$this->option_value[$i];
-      }
-    }
-
-    /* Write back to ldap */
-    $ldap= $this->config->get_ldap_link();
-    $ldap->cd($this->dn);
-    @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__,
-        $this->attributes, "Save");
-    $this->cleanup();
-    $ldap->modify ($this->attrs); 
-
-    show_ldap_error($ldap->get_error(), sprintf(_("Saving of application parameters with dn '%s' failed."),$this->dn));
-
-    /* Optionally execute a command after we're done */
-    $this->handle_post_events('modify');
-  }
-
-  /* Return plugin informations for acl handling
-#FIXME FAIscript seams to ununsed within this class... */
-  static function plInfo()
-  {
-    return (array(
-          "plShortName"   => _("Parameter"),
-          "plDescription" => _("Parameter configuration"),
-          "plSelfModify"  => FALSE,
-          "plDepends"     => array(),
-          "plPriority"    => 0,
-          "plSection"     => array("administration"),
-          "plCategory"    => array("application"),
-
-          "plProvidedAcls"=> array(
-            "gosaApplicationParameter"      => _("Application parameter settings"))  
-          ));
-  }
-
-
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/gosa-core/plugins/admin/applications/class_divListApplication.inc b/gosa-core/plugins/admin/applications/class_divListApplication.inc
deleted file mode 100644 (file)
index f70d5c6..0000000
+++ /dev/null
@@ -1,323 +0,0 @@
-<?php
-
-class divListApplication extends MultiSelectWindow
-{
-  /* Current base */
-  var $selectedBase       = "";
-  var $selectedRelease    = "main";
-  var $AvailableReleases  = array();
-  var $departments        = array();
-  var $parent               ;
-  var $ui                   ;
-
-  /* Regex */
-  var $Regex           = "*";
-
-  /* Subsearch checkbox */
-  var $SubSearch;
-
-  var $SaveAdditionalVars = array("selectedRelease");
-
-  function divListApplication (&$config,&$parent)
-  {
-    MultiSelectWindow::MultiSelectWindow($config,"Application", "application");
-   
-    $this->selectedRelease = get_ou('applicationou').session::get('CurrentMainBase');
-    $this->parent       = &$parent;
-    $this->ui           = get_userinfo();
-
-    /* Set list strings */
-    $this->SetTitle(_("List of Applications"));
-    $this->SetSummary(_("This table displays all applications in the selected tree."));
-
-    /* Result page will look like a headpage */
-    $this->SetHeadpageMode();
-    $this->SetInformation(_("This menu allows you to add, edit and remove selected applications. You may want to use the range selector on top of the application listbox, when working with a large number of applications."));
-
-    $this->EnableAplhabet(true);
-  
-    /* Disable buttonsm */
-    $this->EnableCloseButton(false);
-    $this->EnableSaveButton (false);
-
-    /* set Page header */
-    $action_col_size = 80;
-    if($this->parent->snapshotEnabled()){
-      $action_col_size += 38;
-    }
-
-
-    /* Toggle all selected / deselected */
-    $chk = "<input type='checkbox' id='select_all' name='select_all'
-               onClick='toggle_all_(\"^item_selected_[0-9]*$\",\"select_all\");' >";
-
-    /* set Page header */
-    $this->AddHeader(array("string"=> $chk,          "attach"=>"style='width:20px;'"));
-    $this->AddHeader(array("string" => "&nbsp;",                "attach" => "style='text-align:center;width:20px;'"));
-    $this->AddHeader(array("string" => _("Application name")." / "._("Department"), "attach" => "style=''"));
-    $this->AddHeader(array("string" => _("Actions"),            "attach" => "style='width:".$action_col_size."px;border-right:0px;text-align:right;'"));
-
-    /* Add SubSearch checkbox */
-    $this->AddCheckBox("SubSearch",  _("Select to search within subtrees"), _("Search in subtrees"), false);
-
-    /*                  Name                 ,Text                              ,Default  , Connect with alphabet  */
-    $this->AddRegex   ("Regex",     _("Display users matching"),"*" , true);
-  }
-
-  function AddUserBoxToFilter($position){
-    $str = "";
-    if(($position  == 2) && ($this->parent->IsReleaseManagementActivated($this->config))){
-      $smarty = get_smarty();
-      $smarty->assign("selectedRelease",$this->selectedRelease);
-      $smarty->assign("branchimage","images/branch.png");
-      $smarty->assign("releases",$this->AvailableReleases);
-      $str = $smarty->fetch(get_template_path('release_select.tpl', TRUE));
-    }
-    return($str);
-  }
-
-  function GenHeader()
-  {
-    /* Prepare departments,
-       which are shown in the listbox on top of the listbox
-    */
-    $options= "";
-
-    /* Get all departments within this subtree */
-    $base = $this->config->current['BASE'];
-
-    /* Add base */
-    $tmp = array();
-    $tmp[] = array("dn"=>$this->config->current['BASE']);
-    $tmp=  array_merge($tmp,get_list("(&(|(ou=*)(description=*))(objectClass=gosaDepartment))", $this->module, $base,
-                    array("ou", "description"), GL_SIZELIMIT | GL_SUBSEARCH));
-
-    $deps = array();
-    foreach($tmp as $tm){
-      $deps[$tm['dn']] = $tm['dn'];
-    }
-
-    /* Load possible departments */
-    $ui= get_userinfo();
-    $tdeps= $ui->get_module_departments("application");
-    $ids = $this->config->idepartments;
-    $first = "";
-    $found = FALSE;
-    foreach($ids as $dep => $name){
-      if(isset($deps[$dep]) && in_array_ics($dep, $tdeps)){
-
-        /* Keep first base dn in mind, we could need this
-         *  info if no valid base was found
-         */
-        if(empty($first)) {
-          $first = $dep['dn'];
-        }
-
-        $value = $ids[$dep];
-        if ($this->selectedBase == $dep){
-          $found = TRUE;
-          $options.= "<option selected='selected' value='".$dep."'>$value</option>";
-        } else {
-          $options.= "<option value='".$dep."'>$value</option>";
-        }
-      }
-    }
-
-    /* The currently used base is not visible with your acl setup.
-     * Set base to first useable base.
-     */
-    if(!$found){
-      $this->selectedBase = $first;
-    }
-
-    /* Get acls */
-    $ui       = get_userinfo();
-    $acl      = $ui->get_permissions("cn=dummy,".$this->selectedBase,"application/application");
-    $acl_all  = $ui->has_complete_category_acls($this->selectedBase,"application");
-
-    /* Add default header */
-    $listhead = MultiSelectWindow::get_default_header();
-
-    /* And the rest, a base selection box */
-    $listhead .= _("Base")."&nbsp;<select name='CurrentMainBase' onChange='mainform.submit()' class='center'>$options</select>".
-      " <input class='center' type='image' src='images/list_submit.png' align='middle' 
-        title='"._("Submit department")."' name='submit_department' alt='"._("Submit")."'>&nbsp;";
-
-    /* Create Layers menu */
-    $s  = ".|"._("Actions")."|\n";
-    $s .= "..|<img src='images/list_new.png' alt='' border='0' class='center'>".
-      "&nbsp;"._("Create")."|\n";
-
-    /* Append create options */
-    if(preg_match("/c/",$acl)) {
-      $s.= "...|<input class='center' type='image' src='images/list_new_app' alt=''>".
-        "&nbsp;"._("Application")."|appl_new|\n";
-    }
-
-    /* Multiple options */
-    $s.= "..|---|\n";
-    $s.= "..|<img src='images/edittrash.png' alt='' border='0' class='center'>".
-      "&nbsp;"._("Remove")."|"."remove_multiple|\n";
-
-    /* Add multiple copy & cut icons */
-    if(is_object($this->parent->CopyPasteHandler) && preg_match("/(c.*w|w.*c)/",$acl_all)){
-      $s.= "..|---|\n";
-      $s.= "..|<img src='images/editcopy.png' alt='' border='0' class='center'>".
-        "&nbsp;"._("Copy")."|"."multiple_copy_systems|\n";
-      $s.= "..|<img src='images/editcut.png' alt='' border='0' class='center'>".
-        "&nbsp;"._("Cut")."|"."multiple_cut_systems|\n";
-
-      if($this->parent->CopyPasteHandler->entries_queued()){
-        $img = "<img border='0' class='center' src='images/editpaste.png' alt=''>";
-        $s.="..|".$img."&nbsp;"._("Paste")."|editPaste|\n";
-      }else{
-        $img = "<img border='0' class='center' src='images/cant_editpaste.png' alt=''>";
-        $s.="..|".$img."&nbsp;"._("Paste")."\n";
-      }
-    }
-
-    /* Add snapshot icons */
-    if(preg_match("/(c.*w|w.*c)/",$acl_all)){
-      $s .= "..|---|\n";
-      $s .= $this->get_snapshot_header(TRUE);
-    }
-
-    $this->SetDropDownHeaderMenu($s);
-    $this->SetListHeader($listhead);
-
-    $this->SetListHeader($listhead);
-  }
-
-  /* so some basic settings */
-  function execute()
-  {
-    $this->ClearElementsList();
-    $this->GenHeader();
-    $this->AvailableReleases = $this->parent->getReleases($this->selectedBase);
-  }
-
-  function setEntries($list)
-  {
-    /********************
-      Variable init
-     ********************/
-  
-    /* Create links */
-    $linkopen = "<a href='?plug=".$_GET['plug']."&amp;act=dep_open&amp;dep_id=%s'>%s</a>";
-    $editlink = "<a href='?plug=".$_GET['plug']."&amp;id=%s&amp;act=edit_entry'>%s</a>";
-    $userimg  = "<img class='center' src='images/select_groups.png' alt='User'    title='%s'>";
-    $applimg  = "<img class='center' src='images/select_application.png' alt='A'  title='"._("Application")."'>";
-    $empty    = "<img class='center' src='images/empty.png' style='width:16px;height:16px;' alt=''>";
-
-    /* set Page header */
-    $action_col_size = 80;
-    if($this->parent->snapshotEnabled()){
-      $action_col_size += 38;
-    }
-
-    /********************
-      Attach objects
-     ********************/
-    
-    $ui = get_userinfo();
-    foreach($list as $key => $val){
-
-      $acl = $ui->get_permissions($val['dn'],"application/application");
-      $acl_all= $ui->has_complete_category_acls($val['dn'],"application");
-
-      /* Create action icons */
-      $actions= "";
-
-      /* Add Copy & Paste icon */
-      if(($this->parent->CopyPasteHandler) && preg_match("/(c.*w|w.*c)/",$acl_all)){
-        /* Only add cut icon, if we are allowed to move this user */
-        if(preg_match("/m/",$acl)){
-          $actions.= "<input class='center' type='image'
-            src='images/editcut.png' alt='"._("cut")."' name='cut_%KEY%' title='"._("Cut this entry")."'>&nbsp;";
-
-          $actions.= "<input class='center' type='image'
-            src='images/editcopy.png' alt='"._("copy")."' name='copy_%KEY%' title='"._("Copy this entry")."'>&nbsp;";
-        }
-      }
-
-      /* Add edit icon */
-      $actions.= "<input class='center' type='image'
-        src='images/edit.png' alt='"._("edit")."' name='appl_edit_%KEY%' title='"._("Edit this entry")."'>";
-
-
-      if(preg_match("/(c.*w|w.*c)/",$acl_all)){
-        $actions.= $this->GetSnapShotActions($val['dn']);
-      }
-
-      /* If we are allowed to remove the application account, display remove icon */
-      if(preg_match("/d/",$acl)){
-        $actions.= "<input class='center' type='image'
-          src='images/edittrash.png' alt='"._("delete")."' name='appl_del_%KEY%' title='"._("Delete this entry")."'>";
-      }else{
-        $actions.= "<img src='images/empty.png' alt='&nbsp;'>";
-      }
-
-      $title = "title='".preg_replace('/ /', '&nbsp;', @LDAP::fix($val['dn']))."'";
-
-      if(!isset($val['description'][0])){
-        $desc = "";
-      }else{
-        $desc = " - [ ".$val['description'][0]." ]";
-      }
-
-      /* Cutted objects should be displayed in light grey */
-      $display = $val['cn'][0].$desc;
-      if($this->parent->CopyPasteHandler){
-        foreach($this->parent->CopyPasteHandler->queue as $queue_key => $queue_data){
-          if($queue_data['dn'] == $val['dn']) {
-            $display = "<font color='#999999'>".$display."</font>";
-            break;
-          }
-        }
-      }
-
-      /* Create each field */
-      $field0 = array("string" => "<input type='checkbox' id='item_selected_".$key."' name='item_selected_".$key."'>" ,
-                      "attach" => "style='width:20px;'");
-      $field1 = array("string" => sprintf($applimg,$val['dn']), "attach" => "style='text-align:center;width:20px;'");
-      $field2 = array("string" => sprintf($editlink,$key,$display), "attach" => "style='' ".$title);
-      $field3 = array("string" => preg_replace("/%KEY%/", $key, $actions), "attach" => "style='width:".$action_col_size."px;border-right:0px;text-align:right;'");
-      $this->AddElement(array($field0,$field1,$field2,$field3));
-    }
-
-    /* Create summary string for list footer */
-    $num_deps=0;
-    if(!$this->SubSearch){
-      $num_deps = count($this->Added_Departments);
-    }
-    $num_apps = count($list);
-
-    $num_app_str = _("Number of listed applications");
-    $num_dep_str = _("Number of listed departments");
-  
-    $str = "<img class='center' src='images/select_application.png' 
-              title='".$num_app_str."' alt='".$num_app_str."'>&nbsp;".$num_apps."&nbsp;&nbsp;&nbsp;&nbsp;";
-    $str.= "<img class='center' src='images/folder.png' 
-              title='".$num_dep_str."' alt='".$num_dep_str."'>&nbsp;".$num_deps."&nbsp;&nbsp;&nbsp;&nbsp;";
-
-    $this->set_List_Bottom_Info($str);
-  }
-
-  function Save()
-  {
-    MultiSelectWindow::Save();  
-  }
-
-  function save_object()
-  {
-    /* Save automatic created POSTs like regex, checkboxes */
-    MultiSelectWindow::save_object(); 
-    $appfilter = session::get('appfilter');
-    $appfilter['release']  = $this->selectedRelease;
-    session::set('appfilter',$appfilter);
-  }
-
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/gosa-core/plugins/admin/applications/generic.tpl b/gosa-core/plugins/admin/applications/generic.tpl
deleted file mode 100644 (file)
index b50ed7e..0000000
+++ /dev/null
@@ -1,152 +0,0 @@
-<table summary="" style="width:100%;">
- <tr>
-  <td style="width:50%;">
-
-   <table summary="">
-     <tr>
-      <td><LABEL for="cn">{t}Application name{/t}{$must}</LABEL></td>
-      <td>
-{render acl=$cnACL}
-       <input id="cn" name="cn" size=25 maxlength=60 value="{$cn}" title="{t}Application name{/t}">
-{/render}
-      </td>
-    </tr>
-    <tr>
-     <td><LABEL for="gosaApplicationName">{t}Display name{/t}</LABEL></td>
-     <td>
-{render acl=$gosaApplicationNameACL}
-        <input id="gosaApplicationName" name="gosaApplicationName" size=35 maxlength=60 
-         value="{$gosaApplicationName}" title="{t}Application name to be displayed (i.e. below icons){/t}">
-{/render}
-     </td>
-    </tr>
-    <tr>
-     <td><LABEL for="gosaApplicationExecute">{t}Execute{/t}{$must}</LABEL></td>
-     <td>
-{render acl=$gosaApplicationExecuteACL}
-        <input id="gosaApplicationExecute" name="gosaApplicationExecute" size=35 maxlength=120 
-         value="{$gosaApplicationExecute}" title="{t}Path and/or binary name of application{/t}">
-{/render}
-     </td>
-    </tr>
-    <tr>
-     <td><LABEL for="description">{t}Description{/t}</LABEL></td>
-     <td>
-{render acl=$descriptionACL}
-      <input id="description" name="description" size=35 maxlength=80 value="{$description}">
-{/render}
-     </td>
-    </tr>
-    <tr><td colspan=2><div style="height:15px;"></div></td></tr>
-    <tr>
-      <td><LABEL for="base">{t}Base{/t}{$must}</LABEL></td>
-      <td>
-{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/folder_gray.png'}
-      <input type="image" name="chooseBase" src="images/folder.png" class="center" title="{t}Select a base{/t}">
-{/render}
-{/if}
-      </td>
-     </tr>
-   </table>
-  </td>
-  <td style="border-left:1px solid #A0A0A0">
-   &nbsp;
-  </td>
-  <td style="vertical-align:top;">
-   <table summary="">
-    <tr>
-    <td>
-    <LABEL for="picture_file">{t}Icon{/t}</LABEL>
-    <br>
-    <img alt="" src="getbin.php?rand={$rand}" border=1 style="width:48px; height:48; background-color:white; vertical-align:bottom;">
-    </td>
-    <td style="vertical-align:top">
-    &nbsp;<br>
-
-    <input type="hidden" name="MAX_FILE_SIZE" value="100000">
-{render acl=$gosaApplicationIconACL}
-    <input name="picture_file" type="file" size="20" maxlength="255" accept="image/*.png" id="picture_file">
-{/render}
-{render acl=$gosaApplicationIconACL}
-<input type="submit" name="update" value="{t}Update{/t}" title="{t}Reload picture from LDAP{/t}">
-{/render}
-{render acl=$gosaApplicationIconACL}
-<input type="submit" name="remove_picture" value="{t}Remove picture{/t}" title="{t}Remove picture from LDAP{/t}">
-{/render}
-    </td>
-    </tr>
-   </table>
-  </td>
- </tr>
-</table>
-
-<p class="plugbottom" style="height:4px; margin-bottom:0px;">&nbsp;</p>
-
-<h2><img src="images/lamp.png" alt="{t}Options{/t}" align="middle">&nbsp;{t}Options{/t}</h2>
-<table summary="" style="width:100%;">
-  <tr>
-    <td style="width:50%;border-right:1px solid #B0B0B0; vertical-align:top">
-{render acl=$gosaApplicationFlagsACL}
-      <input type=checkbox name="exec_for_groupmembers" value="1" {$exec_for_groupmembers}>
-{/render}
-       {t}Only executable for members{/t}
-      <br>
-{render acl=$gosaApplicationFlagsACL}
-      <input type=checkbox name="overwrite_config" value="1" {$overwrite_config}>
-{/render}
-       {t}Replace user configuration on startup{/t}
-    </td>
-    <td>
-{render acl=$gosaApplicationFlagsACL}
-      <input type=checkbox name="place_on_desktop" value="1" {$place_on_desktop}>
-{/render}
-      {t}Place icon on members desktop{/t}
-      <br>
-{render acl=$gosaApplicationFlagsACL}
-      <input type=checkbox name="place_in_startmenu" value="1" {$place_in_startmenu}>
-{/render}
-      {t}Place entry in members startmenu{/t}
-      <br>
-{render acl=$gosaApplicationFlagsACL}
-      <input type=checkbox name="place_on_kicker" value="1" {$place_on_kicker}>
-{/render}
-      {t}Place entry in members launch bar{/t}
-    </td>
-  </tr>
-</table>
-
-<p class="plugbottom" style="height:4px; margin-bottom:0px;">&nbsp;</p>
-
-<table width="99%" summary="">
-       <tr>
-               <td>
-                       <h2><img src="images/fai_script.png" alt="{t}Script{/t}" align="middle">&nbsp;{t}Script{/t}</h2>
-{render acl=$gotoLogonScriptACL}
-                       <textarea name="gotoLogonScript" style='width:99%;height:220px;'>{$gotoLogonScript}</textarea>
-{/render}
-{render acl=$gotoLogonScriptACL}
-                       <input type="file" name="ScriptFile" value="{t}Import{/t}">
-{/render}
-{render acl=$gotoLogonScriptACL}
-                       <input type="submit" name="upLoad" value="{t}Upload{/t}">
-{/render}
-                       <input type='image' name='downloadScript'  src='images/save.png' title='{t}Download{/t}' class='center'>
-               </td>
-       </tr>
-</table>
-
-<div style="height:20px;"></div>
-
-<!-- Place cursor -->
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-       focus_field('cn');
-  -->
-</script>
diff --git a/gosa-core/plugins/admin/applications/main.inc b/gosa-core/plugins/admin/applications/main.inc
deleted file mode 100644 (file)
index 7b74838..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-<?php
-/*
-  This code is part of GOsa (https://gosa.gonicus.de)
-  Copyright (C) 2003  Cajus Pollmeier
-
-  This program is free software; you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation; either version 2 of the License, or
-  (at your option) any later version.
-
-  This program is distributed in the hope that it will be useful,
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-  GNU General Public License for more details.
-
-  You should have received a copy of the GNU General Public License
-  along with this program; if not, write to the Free Software
-  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-*/
-
-if ($remove_lock){
-        if(session::is_set('applicationManagement')){
-                $applicationManagement = session::get('applicationManagement');
-                $applicationManagement->remove_lock();
-                del_lock ($ui->dn);
-                session::un_set ('applicationManagement');
-        }
-} else {
-       /* Create applicationManagement object on demand */
-       if (!session::is_set('applicationManagement') || (isset($_GET['reset']) && $_GET['reset'] == 1)){
-               session::set('applicationManagement',new applicationManagement ($config, $ui));
-       }
-       $applicationManagement = session::get('applicationManagement');
-       $applicationManagement->save_object();
-       $output= $applicationManagement->execute();
-
-       /* Page header*/
-       if (session::is_set('objectinfo')){
-               $display= print_header(get_template_path('images/application.png'), _("Application management"), "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png')."\"> ".@LDAP::fix(session::get('objectinfo')));
-       } else {
-               $display= print_header(get_template_path('images/application.png'), _("Application management"));
-       }
-
-       /* Reset requested? */
-       if (isset($_GET['reset']) && $_GET['reset'] == 1){
-               del_lock ($ui->dn);
-               session::un_set ('applicationManagement');
-       }
-
-       /* Show and save dialog */
-       $display.= $output;
-       session::set('applicationManagement',$applicationManagement);
-}
-
-?>
diff --git a/gosa-core/plugins/admin/applications/parameters.tpl b/gosa-core/plugins/admin/applications/parameters.tpl
deleted file mode 100644 (file)
index 57c2219..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-{$table}
-<div style="height:20px"></div>
diff --git a/gosa-core/plugins/admin/applications/release_select.tpl b/gosa-core/plugins/admin/applications/release_select.tpl
deleted file mode 100644 (file)
index d58738f..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-<br> 
-<div class="contentboxh" style="border-bottom:1px solid #B0B0B0;">
- <p class="contentboxh"><img src="{$branchimage}" align="right" alt="[F]">{t}Branches{/t}</p>
-</div>
-<div class="contentboxb">
- <table summary="" style="width:100%;">
-  <tr>
-   <td>
-    {t}Current release{/t}&nbsp;
-    <select name="selectedRelease" onChange="document.mainform.submit();">
-     {html_options options=$releases selected=$selectedRelease}
-    </select>
-   </td>
-  </tr>
- </table>
-</div>
diff --git a/gosa-core/plugins/admin/applications/remove.tpl b/gosa-core/plugins/admin/applications/remove.tpl
deleted file mode 100644 (file)
index 8598ed8..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-<div style="font-size:18px;">
-  <img alt="" src="images/button_cancel.png" align=top>&nbsp;{t}Warning{/t}
-</div>
-<p>
- {$intro}
- {t}This may be used by several groups. Please double check if your really want to do this since there is no way for GOsa to get your data back.{/t}
-</p>
-<p>
- {t}So - if you're sure - press 'Delete' to continue or 'Cancel' to abort.{/t}
-</p>
-
-<p class="plugbottom">
-       {if $multiple}
-               <input type=submit name="delete_multiple_application_confirm" value="{t}Delete{/t}">
-               &nbsp;
-               <input type=submit name="delete_multiple_application_cancel" value="{t}Cancel{/t}">
-       {else}
-               <input type=submit name="delete_app_confirm" value="{t}Delete{/t}">
-               &nbsp;
-               <input type=submit name="delete_cancel" value="{t}Cancel{/t}">
-       {/if}
-</p>
-
diff --git a/gosa-core/plugins/admin/applications/tabs_application.inc b/gosa-core/plugins/admin/applications/tabs_application.inc
deleted file mode 100644 (file)
index 5b6e829..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-<?php
-
-class apptabs extends tabs
-{
-  var $Release= "";
-
-  function apptabs($config, $data, $dn,$category)
-  {
-    tabs::tabs($config, $data, $dn,$category);
-
-    /* Add references/acls/snapshots */
-    $this->addSpecialTabs();
-  }
-
-  function set_release($newRelease)
-  {
-    $this->Release= preg_replace('/,'.get_ou('applicationou').'.*$/', '', $newRelease);
-    if ($this->Release != ""){
-      $this->Release= ",".$this->Release;
-    }
-  }
-
-  function save($ignore_account= FALSE)
-  {
-    $baseobject= $this->by_object['application'];
-
-    /* Check for new 'dn', in order to propagate the
-       'dn' to all plugins */
-    $tmp = $this->config->search("faiManagement", "CLASS",array('menu','tabs'));
-    $appfilter = session::get('appfilter');
-    if((!empty($tmp)) && (isset($appfilter['release']))){
-      if(!$baseobject->isReleaseApplikation){
-        $new_dn= "cn=".$baseobject->cn.",".get_ou('applicationou').$baseobject->base;
-      }else{
-        $new_dn ="cn=".$baseobject->cn.",".$appfilter['release'];
-      }
-    }else{
-      $new_dn= "cn=".$baseobject->cn.",".get_ou('applicationou').$baseobject->base;
-    }
-
-    /* Move group? */
-    if ($this->dn != $new_dn){
-
-      /* Write entry on new 'dn' */
-      if ($this->dn != "new"){
-        $baseobject->move($this->dn, $new_dn);
-        $this->by_object['application']= $baseobject;
-      }
-
-      /* Happen to use the new one */
-      $this->dn= $new_dn;
-    }
-
-    tabs::save();
-  }
-
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/gosa-core/plugins/admin/devices/class_deviceGeneric.inc b/gosa-core/plugins/admin/devices/class_deviceGeneric.inc
deleted file mode 100644 (file)
index bc870eb..0000000
+++ /dev/null
@@ -1,256 +0,0 @@
-<?php
-
-class deviceGeneric extends plugin
-{
-  public $dn            = "";
-  public $cn            = "";
-  public $orig_cn       = "";
-  public $description   = "";
-  public $vendor        = "";
-  public $dev_id        = "";
-  public $serial        = "";
-  public $base          = "";  
-  public $types;
-  public $type;
-
-  public $posts           = array("description","dev_id","serial","vendor", "type");
-  public $attributes      = array("cn");
-  public $objectclasses   = array("top","gotoDevice");
-
-  public $CopyPasteVars   = array("orig_cn","description","vendor","dev_id","serial","base");
-
-  public function deviceGeneric(&$config,$dn = NULL)
-  {
-    plugin::plugin($config,$dn);
-
-    $this->is_account = TRUE;
-
-    $this->types= array("camera" => _("Digital camera"),
-                        "harddisk" => _("Harddisk"),
-                        "stick" => _("USB stick"),
-                        "cd" => _("CD/DVD drive"),);
-    asort($this->types);
-
-    /* Set class values */
-    if(isset($this->attrs['gotoHotplugDevice'][0])){
-      $tmp = preg_split("/\|/",$this->attrs['gotoHotplugDevice'][0]);
-      $this->cn         = $this->attrs['cn'][0];
-      $this->description= $tmp[0];
-      $this->dev_id     = $tmp[1];
-      $this->serial     = $tmp[2];
-      $this->vendor     = $tmp[3];
-      if (isset($tmp[4])){
-        $this->type= $tmp[4];
-      }
-    }     
-
-    $this->orig_cn = $this->cn;
-
-    /* Set Base */
-    if ($this->dn == "new"){
-      if(session::is_set('CurrentMainBase')){
-        $this->base = session::get('CurrentMainBase');
-      }else{
-        $ui= get_userinfo();
-        $this->base= dn2base($ui->dn);
-      }
-    } else {
-      $this->base =preg_replace ("/^[^,]+,".get_ou('deviceou')."/","",$this->dn);
-    }
-  }
-
-
-  public function execute()
-  {
-    $smarty = get_smarty();
-    $smarty->assign("base",$this->base);
-    $smarty->assign("bases",$this->get_allowed_bases());
-    foreach($this->attributes as $attr){
-      $smarty->assign($attr,$this->$attr);
-    }
-    foreach($this->posts as $attr){
-      $smarty->assign($attr,$this->$attr);
-    }
-
-    $smarty->assign("type",$this->type);
-    $smarty->assign ("types", $this->types);
-
-    return($smarty->fetch(get_template_path("deviceGeneric.tpl",TRUE,dirname(__FILE__))));
-  }
-
-  
-  public function check()
-  {
-    $message = plugin::check();
-
-    if(empty($this->cn)||(preg_match("/[^a-z0-9]/i",$this->cn))){
-      $message[]=_("Please specify a valid name. Only 0-9 a-Z is allowed.");
-    }
-    if(preg_match("/[^a-z0-9!\"?.,;:-_\(\) ]/i",$this->description)){
-      $message[]=_("Invalid character in description. Please specify a valid description.");
-    }
-
-    /* Skip serial check if vendor and product id are given */
-    if(preg_match("/^\s+$/i",$this->dev_id)){
-      $message[]=_("Please specify a valid iSerial.");
-    }
-    if(empty($this->serial) || !$this->is_2byteHex($this->serial)){
-      $message[]=_("Please specify a valid vendor ID. (2 byte hex like '0xFFFF')");
-    }
-    if(empty($this->vendor) || !$this->is_2byteHex($this->vendor)){
-      $message[]=_("Please specify a valid product ID. (2 byte hex like '0xFFFF')");
-    }
-   
-    /* Check if entry already exists */ 
-    if($this->cn != $this->orig_cn){
-      $ldap = $this->config->get_ldap_link();
-      $ldap->search("(&(objectClass=gotoDevice)(cn=".$this->cn."*))",array("cn"));
-      if($ldap->count()){
-        $message[]=_("An Entry with this name already exists.");
-      }
-    }
-
-    return($message);
-  }
-
-
-  public function save_object()
-  {
-    if(isset($_POST['deviceGeneric_posted'])){
-      plugin::save_object();
-  
-      if(isset($_POST['base'])){
-        $tmp = $this->get_allowed_bases();
-        if(isset($tmp[get_post("base")])){
-          $this->base = get_post("base");
-        }
-      }
-    
-      foreach($this->posts as $post){
-        if(isset($_POST[$post])){
-          $this->$post = get_post($post);
-        }
-      }
-    }
-  }
-
-  
-  public function remove_from_parent()
-  {
-    plugin::remove_from_parent();
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cd($this->config->current['BASE']);
-
-    $ldap->search("(&(objectClass=gotoEnvironment)(gotoHotplugDeviceDN=".$this->dn."))",array("cn","gotoHotplugDeviceDN"));
-    $skip = FALSE;
-    $str ="";
-    $cnt = 3;
-    while($cnt && $attrs = $ldap->fetch()){
-      $skip =TRUE;
-      $str .= $attrs['cn'][0].", ";
-      $cnt --;
-    }
-    if($skip){
-      $str  = preg_replace("/, $/","",$str);
-      if($cnt == 0){
-        $str .= "...";
-      }
-      print_red(sprintf(_("Can't remove the device '%s' it is still in use be this user(s) : %s"),$this->cn,$str));
-    }else{
-      $ldap->rmdir_recursive($this->dn);
-    }
-  }
-
-
-  public function save()
-  {
-    plugin::save();
-
-    $this->attrs['gotoHotplugDevice'] = "";
-    foreach($this->posts as $post){
-      $this->attrs['gotoHotplugDevice'] .= $this->$post."|"; 
-    }
-    $this->attrs['gotoHotplugDevice'] = preg_replace("/\|$/","",$this->attrs['gotoHotplugDevice']);
-
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cd($this->config->current['BASE']);
-    $ldap->cat($this->dn);
-    if($ldap->count()){
-      $ldap->cd($this->dn);
-      $ldap->modify($this->attrs);
-    }else{
-      $ldap->create_missing_trees(preg_replace("/^[^,]+,/","",$this->dn));
-      $ldap->cd($this->dn);
-      $ldap->add($this->attrs);
-    }
-    show_ldap_error($ldap->get_error(),_("Device could not be saved."));
-  }
-
-
-  /* check if given str in like this 0xffff*/
-  function is_2byteHex($str)
-  {
-    return !strlen($str) || preg_match("/^(0x|x|)[a-f0-9][a-f0-9][a-f0-9][a-f0-9]/i",$str);
-  }
-
-
-  function PrepareForCopyPaste($source)
-  {
-    plugin::PrepareForCopyPaste($source);
-    $source_o = new deviceGeneric($this->config,$source['dn']);
-    foreach($this->CopyPasteVars as $post){
-      $this->$post = $source_o->$post;
-    }
-  }
-
-
-  /* Return a dialog with all fields that must be changed,
-     if we want to copy this entry */
-  function getCopyDialog()
-  {
-    $str = "";
-    $smarty = get_smarty();
-    $smarty->assign("cn",         $this->cn);
-    $str = $smarty->fetch(get_template_path("paste_deviceGeneric.tpl",TRUE,dirname(__FILE__)));
-
-    $ret = array();
-    $ret['string'] = $str;
-    $ret['status'] = "";
-    return($ret);
-  }
-
-
-  /* Save all */
-  function saveCopyDialog()
-  {
-    $attrs = array("cn");
-    foreach($attrs as $attr){
-      if(isset($_POST[$attr])){
-        $this->$attr = $_POST[$attr];
-      }
-    }
-  }
-
-
-
-  /* Return plugin informations for acl handling  */
-  public static function plInfo()
-  {
-    return (array(
-          "plShortName"   => _("Generic"),
-          "plDescription" => _("Device generic"),
-          "plSelfModify"  => FALSE,
-          "plDepends"     => array(),
-          "plPriority"    => 0,
-          "plSection"     => array("administration"),
-          "plCategory"    => array("devices" => array("description"  => _("Devices"),
-                                                        "objectClass"  => "gotoHotplugDevice")),
-          "plProvidedAcls"=> array(
-            "cn"                          => _("Name"))
-          ));
-
-  }
-       
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/gosa-core/plugins/admin/devices/class_deviceManagement.inc b/gosa-core/plugins/admin/devices/class_deviceManagement.inc
deleted file mode 100644 (file)
index 77c5825..0000000
+++ /dev/null
@@ -1,557 +0,0 @@
-<?php
-
-class deviceManagement extends plugin
-{
-
-  /* Definitions */
-  var $plHeadline     = "Devices";
-  var $plDescription  = "Manage devices";
-
-  /* Dialog attributes */
-  var $ui                             = NULL;
-  var $DivListDevices               = NULL;
-  var $enableReleaseManagement        = false;
-  var $devicetabs                       = NULL;
-  var $snapDialog                     = NULL;
-  var $CopyPasteHandler               = NULL;
-  var $start_pasting_copied_objects;
-  var $dn ="";
-
-  function deviceManagement(&$config, $dn= NULL)
-  {
-    plugin::plugin ($config, $dn);
-    $this->ui = get_userinfo();  
-
-    /* Check if copy & paste is activated */
-    if($this->config->boolValueIsTrue("MAIN","ENABLECOPYPASTE")){
-      $this->CopyPasteHandler = new CopyPasteHandler($this->config);
-    }
-
-    /* Creat dialog object */
-    $this->DivListDevices = new divListDevices($this->config,$this);
-  }
-
-
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-    /****************
-      Variable init
-     ****************/
-
-    /* These vars will be stored if you try to open a locked device,
-        to be able to perform your last requests after showing a warning message */
-    session::set('LOCK_VARS_TO_USE',array("/^act$/","/^id$/","/^device_edit_/",
-                                          "/^device_del_/","/^item_selected/","/^remove_multiple_devices/"));
-
-    $smarty       = get_smarty();             // Smarty instance
-    $s_action     = "";                       // Contains the action to proceed
-    $s_entry      = "";                       // The value for s_action
-    $base_back    = "";                       // The Link for Backbutton
-
-    /* Test Posts */
-    foreach($_POST as $key => $val){
-
-      if(preg_match("/device_del.*/",$key)){
-        $s_action = "del";
-        $s_entry  = preg_replace("/device_".$s_action."_/i","",$key);
-      }elseif(preg_match("/device_edit_.*/",$key)){
-        $s_action="edit";
-        $s_entry  = preg_replace("/device_".$s_action."_/i","",$key);
-      }elseif(preg_match("/^copy_.*/",$key)){
-        $s_action="copy";
-        $s_entry  = preg_replace("/^copy_/i","",$key);
-      }elseif(preg_match("/^cut_.*/",$key)){
-        $s_action="cut";
-        $s_entry  = preg_replace("/^cut_/i","",$key);
-      }elseif(preg_match("/^device_new.*/",$key)){
-        $s_action="new";
-      }elseif(preg_match("/^remove_multiple_devices/",$key)){
-        $s_action="del_multiple";
-      }elseif(preg_match("/^editPaste.*/i",$key)){
-        $s_action="editPaste";
-      }elseif(preg_match("/^multiple_copy_devices/",$key)){
-        $s_action = "copy_multiple";
-     }elseif(preg_match("/^multiple_cut_devices/",$key)){
-        $s_action = "cut_multiple";
-      }
-    }
-
-    if((isset($_GET['act']))&&($_GET['act']=="edit_entry")){
-      $s_action ="edit";
-      $s_entry  = $_GET['id'];
-    }
-
-    $s_entry  = preg_replace("/_.$/","",$s_entry);
-
-
-    /* handle C&P from layers menu */
-    if(isset($_POST['menu_action']) && preg_match("/^multiple_copy_systems/",$_POST['menu_action'])){
-      $s_action = "copy_multiple";
-    }
-    if(isset($_POST['menu_action']) && preg_match("/^multiple_cut_systems/",$_POST['menu_action'])){
-      $s_action = "cut_multiple";
-    }
-    if(isset($_POST['menu_action']) && preg_match("/^editPaste/",$_POST['menu_action'])){
-      $s_action = "editPaste";
-    }
-
-    /* Create options */
-    if(isset($_POST['menu_action']) && $_POST['menu_action'] == "device_new"){
-      $s_action = "new";
-    }
-
-    /* handle remove from layers menu */
-    if(isset($_POST['menu_action']) && preg_match("/^remove_multiple/",$_POST['menu_action'])){
-      $s_action = "del_multiple";
-    }
-
-    /****************
-      Copy & Paste handling
-     ****************/
-
-    /* Display the copy & paste dialog, if it is currently open */
-    $ret = $this->copyPasteHandling_from_queue($s_action,$s_entry);
-    if($ret){
-      return($ret);
-    }
-
-    /****************
-      Create a new device type
-     ****************/
-
-    /* New device type? */
-    $ui = get_userinfo();
-    $acl = $ui->get_permissions($this->DivListDevices->selectedBase,"devices/deviceGeneric");
-    if (($s_action=="new") && preg_match("/c/",$acl)){
-
-      /* By default we set 'dn' to 'new', all relevant plugins will
-         react on this. */
-      $this->dn= "new";
-
-      /* Create new usertab object */
-      $this->devicetabs= new devicetabs($this->config, $this->config->data['TABS']['DEVICETABS'], $this->dn,"devices");
-      $this->devicetabs->set_acl_base($this->DivListDevices->selectedBase);
-    }
-
-
-    /****************
-      Edit entry canceled
-     ****************/
-
-    /* Cancel dialogs */
-    if (isset($_POST['edit_cancel']) && is_object($this->devicetabs)){
-      del_lock ($this->devicetabs->dn);
-      unset ($this->devicetabs);
-      $this->devicetabs= NULL;
-      session::un_set('objectinfo');
-    }
-
-
-    /****************
-      Edit entry finished
-     ****************/
-
-    /* Finish device edit is triggered by the tabulator dialog, so
-       the user wants to save edited data. Check and save at this point. */
-    if ((isset($_POST['edit_finish']) || isset($_POST['edit_apply']) ) && (isset($this->devicetabs->config))){
-
-      /* Check tabs, will feed message array */
-      $this->devicetabs->save_object();
-      $message= $this->devicetabs->check();
-
-      /* Save, or display error message? */
-      if (count($message) == 0){
-
-        /* Save data data to ldap */
-#        $this->devicetabs->set_release($this->DivListDevices->selectedRelease);
-        $this->devicetabs->save();
-
-        if (!isset($_POST['edit_apply'])){
-          /* device type has been saved successfully, remove lock from LDAP. */
-          if ($this->dn != "new"){
-            del_lock ($this->dn);
-          }
-          unset ($this->devicetabs);
-          $this->devicetabs= NULL;
-          session::un_set('objectinfo');
-        }
-      } else {
-       /* Ok. There seem to be errors regarding to the tab data,
-           show message and continue as usual. */
-        show_errors($message);
-      }
-    }
-
-
-    /****************
-      Edit entry
-     ****************/
-
-    /* User wants to edit data? */
-    if (($s_action=="edit") && (!isset($this->devicetabs->config))){
-
-      /* Get 'dn' from posted 'devicelist', must be unique */
-      $this->dn= $this->devices[$s_entry]['dn'];
-
-      /* Check locking, save current plugin in 'back_plugin', so
-         the dialog knows where to return. */
-      if (($user= get_lock($this->dn)) != ""){
-        return(gen_locked_message ($user, $this->dn));
-      }
-
-      /* Lock the current entry, so everyone will get the
-         above dialog */
-      add_lock ($this->dn, $this->ui->dn);
-
-
-      /* Register devicetabs to trigger edit dialog */
-      $this->devicetabs= new devicetabs($this->config,$this->config->data['TABS']['DEVICETABS'], $this->dn,"devices");
-      $this->devicetabs->set_acl_base($this->dn);
-      session::set('objectinfo',$this->dn);
-    }
-
-
-    /********************
-      Delete MULTIPLE entries requested, display confirm dialog
-     ********************/
-    if ($s_action=="del_multiple"){
-      $ids = $this->list_get_selected_items();
-
-      if(count($ids)){
-
-        foreach($ids as $id){
-          $dn = $this->devices[$id]['dn'];
-          if (($user= get_lock($dn)) != ""){
-            return(gen_locked_message ($user, $dn));
-          }
-          $this->dns[$id] = $dn;
-        }
-
-        $dns_names = "<br><pre>";
-        foreach($this->dns as $dn){
-          add_lock ($dn, $this->ui->dn);
-          $dns_names .= $dn."\n";
-        }
-        $dns_names .="</pre>";
-
-        /* Lock the current entry, so nobody will edit it during deletion */
-        if (count($this->dns) == 1){
-          $smarty->assign("intro",     sprintf(_("You're about to delete the following entry %s"), @LDAP::fix($dns_names)));
-        } else {
-          $smarty->assign("intro",     sprintf(_("You're about to delete the following entries %s"), @LDAP::fix($dns_names)));
-        }
-        $smarty->assign("multiple", true);
-        return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
-      }
-    }
-
-
-    /********************
-      Delete MULTIPLE entries confirmed
-     ********************/
-
-    /* Confirmation for deletion has been passed. Users should be deleted. */
-    if (isset($_POST['delete_multiple_device_confirm'])){
-
-      $ui = get_userinfo();
-
-      /* Remove user by user and check acls before removeing them */
-      foreach($this->dns as $key => $dn){
-
-        $acl = $ui->get_permissions($dn,"devices/deviceGeneric");
-        if(preg_match("/d/",$acl)){
-
-          /* Delete request is permitted, perform LDAP action */
-          $this->devicetabs= new devicetabs($this->config, $this->config->data['TABS']['DEVICETABS'], $dn,"devices");
-          $this->devicetabs->set_acl_base($dn);
-          $this->devicetabs->delete ();
-          unset ($this->devicetabs);
-          $this->devicetabs= NULL;
-
-        } else {
-          /* Normally this shouldn't be reached, send some extra
-             logs to notify the administrator */
-          print_red (_("You are not allowed to delete this device type!"));
-          new log("security","devices/".get_class($this),$dn,array(),"Tried to trick deletion.");
-        }
-        /* Remove lock file after successfull deletion */
-        del_lock ($dn);
-        unset($this->dns[$key]);
-      }
-    }
-
-
-    /********************
-      Delete MULTIPLE entries Canceled
-     ********************/
-
-    /* Remove lock */
-    if(isset($_POST['delete_multiple_device_cancel'])){
-      foreach($this->dns as $key => $dn){
-        del_lock ($dn);
-        unset($this->dns[$key]);
-      }
-    }
-
-
-    /****************
-      Delete device type
-     ****************/
-
-    /* Remove user was requested */
-    if ($s_action == "del"){
-
-      /* Get 'dn' from posted 'uid' */
-      $this->dn= $this->devices[$s_entry]['dn'];
-
-      /* Load permissions for selected 'dn' and check if
-         we're allowed to remove this 'dn' */
-      $ui = get_userinfo();
-      $acl = $ui->get_permissions($this->dn,"devices/deviceGeneric");
-      if (preg_match("/d/",$acl)){
-
-        /* Check locking, save current plugin in 'back_plugin', so
-           the dialog knows where to return. */
-        if (($user= get_lock($this->dn)) != ""){
-          return (gen_locked_message ($user, $this->dn));
-        }
-
-        /* Lock the current entry, so nobody will edit it during deletion */
-        add_lock ($this->dn, $this->ui->dn);
-        $smarty= get_smarty();
-        $smarty->assign("intro", sprintf(_("You're about to delete the device '%s'."), @LDAP::fix($this->dn)));
-        $smarty->assign("multiple", false);
-        return($smarty->fetch (get_template_path('remove.tpl', TRUE)));
-      } else {
-
-        /* Obviously the user isn't allowed to delete. Show message and
-           clean session. */
-       print_red (_("You are not allowed to delete this device!"));
-      }
-    }
-
-
-    /****************
-      Delete device confirmed
-     ****************/
-
-    /* Confirmation for deletion has been passed. Group should be deleted. */
-    if (isset($_POST['delete_device_confirm'])){
-
-      /* Some nice guy may send this as POST, so we've to check
-         for the permissions again. */
-      $ui = get_userinfo();
-      $acl = $ui->get_permissions($this->dn,"devices/deviceGeneric");
-      if(preg_match("/d/",$acl)){
-
-        /* Delete request is permitted, perform LDAP action */
-        $this->devicetabs= new devicetabs($this->config, $this->config->data['TABS']['DEVICETABS'], $this->dn,"devices");
-        $this->devicetabs->set_acl_base($this->dn);
-        $this->devicetabs->delete ();
-        unset ($this->devicetabs);
-        $this->devicetabs= NULL;
-
-      } else {
-
-        /* Normally this shouldn't be reached, send some extra
-           logs to notify the administrator */
-        print_red (_("You are not allowed to delete this device!"));
-        new log("security","devices/".get_class($this),$dn,array(),"Tried to trick deletion.");
-      }
-
-      /* Remove lock file after successfull deletion */
-      del_lock ($this->dn);
-    }
-
-
-    /****************
-      Delete device canceled
-     ****************/
-
-    /* Delete device canceled? */
-    if (isset($_POST['delete_cancel'])){
-      del_lock ($this->dn);
-      session::un_set('objectinfo');
-  }
-
-    /* Show tab dialog if object is present */
-    if (($this->devicetabs) && (isset($this->devicetabs->config))){
-      $display= $this->devicetabs->execute();
-
-      /* Don't show buttons if tab dialog requests this */
-      if (!$this->devicetabs->by_object[$this->devicetabs->current]->dialog){
-        $display.= "<p style=\"text-align:right\">\n";
-        $display.= "<input type=\"submit\" name=\"edit_finish\" style=\"width:80px\" value=\""._("Ok")."\">\n";
-        $display.= "&nbsp;\n";
-        if ($this->dn != "new"){
-          $display.= "<input type=submit name=\"edit_apply\" value=\""._("Apply")."\">\n";
-          $display.= "&nbsp;\n";
-        }
-        $display.= "<input type=\"submit\" name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
-        $display.= "</p>";
-      }
-      return ($display);
-    }
-
-
-    /****************
-      Dialog display
-     ****************/
-
-        /* Check if there is a snapshot dialog open */
-    $base = $this->DivListDevices->selectedBase;
-    if($str = $this->showSnapshotDialog($base,$this->get_used_snapshot_bases())){
-      return($str);
-    }
-
-    /* Display dialog with system list */
-    $this->DivListDevices->parent = $this;
-    $this->DivListDevices->execute();
-    $this->DivListDevices->AddDepartments($this->DivListDevices->selectedBase,3,1);
-    $this->reload();
-    $this->DivListDevices->setEntries($this->devices);
-    return($this->DivListDevices->Draw());
-
-  }
-
-  function save_object() {
-    $this->DivListDevices->save_object();
-  }
-
-
-  /* Return departments, that will be included within snapshot detection */
-  function get_used_snapshot_bases()
-  {
-    return(array(get_ou('deviceou').$this->DivListDevices->selectedBase));
-  }
-
-  function copyPasteHandling_from_queue($s_action,$s_entry)
-  {
-    /* Check if Copy & Paste is disabled */
-    if(!is_object($this->CopyPasteHandler)){
-      return("");
-    }
-
-    /* Add a single entry to queue */
-    if($s_action == "cut" || $s_action == "copy"){
-
-      /* Cleanup object queue */
-      $this->CopyPasteHandler->cleanup_queue();
-      $dn = $this->devices[$s_entry]['dn'];
-      $this->CopyPasteHandler->add_to_queue($dn,$s_action,"devicetabs","DEVICETABS","devices");
-    }
-
-    /* Add entries to queue */
-    if($s_action == "copy_multiple" || $s_action == "cut_multiple"){
-
-      /* Cleanup object queue */
-      $this->CopyPasteHandler->cleanup_queue();
-
-      /* Add new entries to CP queue */
-      foreach($this->list_get_selected_items() as $id){
-        $dn = $this->devices[$id]['dn'];
-
-        if($s_action == "copy_multiple"){
-          $this->CopyPasteHandler->add_to_queue($dn,"copy","devicetabs","DEVICETABS","devices");
-        }
-        if($s_action == "cut_multiple"){
-          $this->CopyPasteHandler->add_to_queue($dn,"cut","devicetabs","DEVICETABS","devices");
-        }
-      }
-    }
-
-    /* Start pasting entries */
-    if($s_action == "editPaste"){
-      $this->start_pasting_copied_objects = TRUE;
-    }
-
-    /* Return C&P dialog */
-    if($this->start_pasting_copied_objects && $this->CopyPasteHandler->entries_queued()){
-
-      /* Load entry from queue and set base */
-      $this->CopyPasteHandler->load_entry_from_queue();
-      $this->CopyPasteHandler->SetVar("base",$this->DivListDevices->selectedBase);
-
-      /* Get dialog */
-      $data = $this->CopyPasteHandler->execute();
-
-      /* Return dialog data */
-      if(!empty($data)){
-        return($data);
-      }
-    }
-
-    /* Automatically disable status for pasting */
-    if(!$this->CopyPasteHandler->entries_queued()){
-      $this->start_pasting_copied_objects = FALSE;
-    }
-    return("");
-  }
-
-
-
-  function reload()
-  {
-    /* Set base for all searches */
-    $base       = $this->DivListDevices->selectedBase;
-    $Regex      = $this->DivListDevices->Regex;
-    $SubSearch  = $this->DivListDevices->SubSearch;
-    $Flags      =  GL_NONE | GL_SIZELIMIT;
-    $Filter     = "(&(|(cn=".$Regex.")(description=".$Regex."))(objectClass=gotoDevice))";
-    $tmp        = array();
-
-    /* In case of subsearch, add the subsearch flag */
-    if($SubSearch){
-      $Flags    |= GL_SUBSEARCH;
-    }else{
-      $base = get_ou('deviceou').$base;
-    }
-
-    /* Get results and create index */
-    $res= get_sub_list($Filter,"devices",get_ou('deviceou'), $base, array("cn","description","dn","objectClass"), $Flags);
-    $tmp2 = array();
-    foreach ($res as $val){
-      $tmp2[strtolower($val['cn'][0]).$val['cn'][0].$val['dn']] = strtolower($val['cn'][0]).$val['cn'][0].$val['dn'];
-      $tmp[strtolower($val['cn'][0]).$val['cn'][0].$val['dn']]=$val;
-    }
-
-    /* sort entries */
-    natcasesort($tmp2);
-    $this->devices=array();
-    foreach($tmp2 as $val){
-      $this->devices[]=$tmp[$val];
-    }
-    reset ($this->devices);
-  }
-
-
-  function remove_lock()
-  {
-    if (isset($this->devicetabs->dn)){
-      del_lock ($this->devicetabs->dn);
-    }
-  }
-
-  function list_get_selected_items()
-  {
-    $ids = array();
-    foreach($_POST as $name => $value){
-      if(preg_match("/^item_selected_[0-9]*$/",$name)){
-        $id   = preg_replace("/^item_selected_/","",$name);
-        $ids[$id] = $id;
-      }
-    }
-    return($ids);
-  }
-
-
-  function remove_from_parent()
-  {
-    /* This cannot be removed... */
-  }
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/gosa-core/plugins/admin/devices/class_divListDevices.inc b/gosa-core/plugins/admin/devices/class_divListDevices.inc
deleted file mode 100644 (file)
index e9d5f85..0000000
+++ /dev/null
@@ -1,303 +0,0 @@
-<?php
-
-class divListDevices extends MultiSelectWindow
-{
-  /* Current base */
-  var $selectedBase       = "";
-  var $departments        = array();
-  var $parent               ;
-  var $ui                   ;
-
-  /* Regex */
-  var $Regex              = "*";
-
-  /* Subsearch checkbox */
-  var $SubSearch;
-
-  function divListDevices (&$config, &$parent)
-  {
-    /* Create divlist and setup */
-    MultiSelectWindow::MultiSelectWindow($config, "Devices", "devices");
-    /* initialize required attributes */ 
-    $this->parent           = &$parent;
-    $this->ui               = get_userinfo();
-
-    /* set Page header */
-    $action_col_size = 80;
-    if($this->parent->snapshotEnabled()){
-      $action_col_size += 38;
-    }
-
-    /* Set list strings */
-    $this->SetTitle       (_("List of defined devices"));
-    $this->SetSummary     (_("List of defined devices"));
-    $this->SetInformation (_("This menu allows you to add, edit and remove selected devices. You may want to use the range selector on top of the device listbox, when working with a large number of devices."));
-
-    /* Result page will look like a headpage */
-    $this->SetHeadpageMode();
-    $this->EnableAplhabet(true);
-  
-    /* Disable buttonsm */
-    $this->EnableCloseButton(false);
-    $this->EnableSaveButton (false);
-
-    /* Toggle all selected / deselected */
-    $chk = "<input type='checkbox' id='select_all' name='select_all'
-               onClick='toggle_all_(\"^item_selected_[0-9]*$\",\"select_all\");' >";
-
-    /* set Page header */
-    $this->AddHeader(array("string"=> $chk,          "attach"=>"style='width:20px;'"));
-    $this->AddHeader(array("string" => "&nbsp;",                "attach" => "style='text-align:center;width:20px;'"));
-    $this->AddHeader(array("string" => _("Device name")." / "._("Department"), "attach" => "style=''"));
-    $this->AddHeader(array("string" => _("Actions"),            "attach" => "style='width:".$action_col_size."px;border-right:0px;text-align:right;'"));
-
-    /* Add SubSearch checkbox */
-    $this->AddCheckBox("SubSearch",  _("Select to search within subtrees"), _("Search in subtrees"), false);
-
-    /*                  Name                 ,Text                              ,Default  , Connect with alphabet  */
-    $this->AddRegex   ("Regex",     _("Display devices matching"),"*" , true);
-  }
-
-
-  /* Create list header, with create / copy & paste etc*/
-  function GenHeader()
-  {
-    /* Prepare departments,
-       which are shown in the listbox on top of the listbox
-     */
-    $options= "";
-
-    /* Get all departments within this subtree */
-    $ui= get_userinfo();
-    $first = "";
-    $found = FALSE;
-    $base = $this->config->current['BASE'];
-
-    /* Add base */
-    $tmp = array();
-    $tmp[] = array("dn"=>$this->config->current['BASE']);
-    $tmp=  array_merge($tmp,get_list("(&(|(ou=*)(description=*))(objectClass=gosaDepartment))", $this->module, $base,
-                    array("ou", "description"), GL_SIZELIMIT | GL_SUBSEARCH));
-
-    $deps = array();
-    foreach($tmp as $tm){
-      $deps[$tm['dn']] = $tm['dn'];
-    }
-
-    /* Load possible departments */
-    $ui= get_userinfo();
-    $tdeps= $ui->get_module_departments($this->module);
-    $ids = $this->config->idepartments;
-    $first = "";
-    $found = FALSE;
-    foreach($ids as $dep => $name){
-      if(isset($deps[$dep]) && in_array_ics($dep, $tdeps)){
-
-        /* Keep first base dn in mind, we could need this
-         *  info if no valid base was found
-         */
-        if(empty($first)) {
-          $first = $dep['dn'];
-        }
-
-        $value = $ids[$dep];
-        if ($this->selectedBase == $dep){
-          $found = TRUE;
-          $options.= "<option selected='selected' value='".$dep."'>$value</option>";
-        } else {
-          $options.= "<option value='".$dep."'>$value</option>";
-        }
-      }
-    }
-
-    /* The currently used base is not visible with your acl setup.
-     * Set base to first useable base.
-     */
-    if(!$found){
-      $this->selectedBase = $first;
-    }
-
-    /* Get acls */
-    $ui       = get_userinfo();
-    $acl      = $ui->get_permissions("cn=dummy,".get_ou('deviceou').$this->selectedBase,"devices/deviceGeneric");
-    $acl_all  = $ui->has_complete_category_acls($this->selectedBase,"devices") ;
-
-
-    /* If this is true we add an additional seperator. Just look a few lines below */  
-    $listhead = MultiSelectWindow::get_default_header();
-
-    /* And at least add a department selection box */
-    $listhead .=  _("Base")."&nbsp;<select name='CurrentMainBase' onChange='mainform.submit()' class='center'>$options</select>".
-      " <input class='center' type='image' src='images/list_submit.png' align='middle' 
-        title='"._("Submit department")."' name='submit_department' alt='"._("Submit")."'>&nbsp;";
-
-    /* Create Layers menu */
-    $s  = ".|"._("Actions")."|\n";
-    $s .= "..|<img src='images/list_new.png' alt='' border='0' class='center'>".
-      "&nbsp;"._("Create")."|\n";
-
-    /* Append create options */
-    if(preg_match("/c/",$acl)) {
-      $s.= "...|<input class='center' type='image' src='images/list_new_device.png' alt=''>".
-        "&nbsp;"._("Device")."|device_new|\n";
-    }
-
-    /* Multiple options */
-    $s.= "..|---|\n";
-    $s.= "..|<img src='images/edittrash.png' alt='' border='0' class='center'>".
-      "&nbsp;"._("Remove")."|"."remove_multiple|\n";
-
-    /* Add multiple copy & cut icons */
-    if(is_object($this->parent->CopyPasteHandler) && preg_match("/(c.*w|w.*c)/",$acl_all)){
-      $s.= "..|---|\n";
-      $s.= "..|<img src='images/editcopy.png' alt='' border='0' class='center'>".
-        "&nbsp;"._("Copy")."|"."multiple_copy_systems|\n";
-      $s.= "..|<img src='images/editcut.png' alt='' border='0' class='center'>".
-        "&nbsp;"._("Cut")."|"."multiple_cut_systems|\n";
-
-      if($this->parent->CopyPasteHandler->entries_queued()){
-        $img = "<img border='0' class='center' src='images/editpaste.png' alt=''>";
-        $s.="..|".$img."&nbsp;"._("Paste")."|editPaste|\n";
-      }else{
-        $img = "<img border='0' class='center' src='images/cant_editpaste.png' alt=''>";
-        $s.="..|".$img."&nbsp;"._("Paste")."\n";
-      }
-    }
-
-    /* Add snapshot icons */
-    if(preg_match("/(c.*w|w.*c)/",$acl_all)){
-      $s .= "..|---|\n";
-      $s .= $this->get_snapshot_header(TRUE);
-    }
-
-    $this->SetDropDownHeaderMenu($s);
-                                                                       
-    $this->SetListHeader($listhead);
-  }
-
-
-  /* Some basic settings */
-  function execute()
-  {
-    $this->ClearElementsList();
-    $this->GenHeader();
-  }
-
-
-  function setEntries($list)
-  {
-    /********************
-      Variable init
-     ********************/
-
-    /* Create links */
-    $linkopen = "<a href='?plug=".$_GET['plug']."&amp;act=dep_open&amp;dep_id=%s'>%s</a>";
-    $editlink = "<a href='?plug=".$_GET['plug']."&amp;id=%s&amp;act=edit_entry'>%s</a>";
-    $userimg  = "<img class='center' src='images/select_groups.png' alt='User'    title='%s'>";
-    $deviceimg  = "<img class='center' src='images/select_device.png' alt='A'  title='"._("Device")."'>";
-    $empty    = "<img class='center' src='images/empty.png' style='width:16px;height:16px;' alt=''>";
-
-    /* set Page header */
-    $action_col_size = 80;
-    if($this->parent->snapshotEnabled()){
-      $action_col_size += 38;
-    }
-
-    /********************
-      Attach objects
-     ********************/
-
-    foreach($list as $key => $val){
-
-      $ui       = get_userinfo();
-      $acl      = $ui->get_permissions($val['dn'],"devices/deviceGeneric");
-      $acl_all  = $ui->has_complete_category_acls($val['dn'],"devices") ;
-
-      /* Create action icons */
-      $actions = "";
-      if(preg_match("/(c.*w|w.*c)/",$acl_all)){
-        $actions .= $this->GetSnapShotActions($val['dn']);
-      }
-
-      /* Get copy Paste icons */
-      if(($this->parent->CopyPasteHandler) && preg_match("/(c.*w|w.*c)/",$acl_all)){
-        $actions.= "<input class='center' type='image'
-          src='images/editcut.png' alt='"._("cut")."' name='cut_%KEY%' title='"._("Cut this entry")."'>&nbsp;";
-        $actions.= "<input class='center' type='image'
-          src='images/editcopy.png' alt='"._("copy")."' name='copy_%KEY%' title='"._("Copy this entry")."'>&nbsp;";
-      }
-
-      $actions.= "<input class='center' type='image'
-        src='images/edit.png' alt='"._("edit")."' name='device_edit_%KEY%' title='"._("Edit this entry")."'>";
-
-      /* Add delete button */
-      if(preg_match("/d/",$acl)){
-        $actions.= "<input class='center' type='image'
-          src='images/edittrash.png' alt='"._("delete")."' name='device_del_%KEY%' title='"._("Delete this entry")."'>";
-      }else{
-        $actions.= "<img src='images/empty.png' alt='&nbsp;' class='center'>";
-      }
-
-      $title = "title='".preg_replace('/ /', '&nbsp;', @LDAP::fix($val['dn']))."'";
-
-      if(!isset($val['description'][0])){
-        $desc = "";
-      }else{
-        $desc = " - [ ".$val['description'][0]." ]";
-      }
-
-      /* Cutted objects should be displayed in light grey */
-      $display = $val['cn'][0].$desc;
-      if($this->parent->CopyPasteHandler){
-        foreach($this->parent->CopyPasteHandler->queue as $queue_key => $queue_data){
-          if($queue_data['dn'] == $val['dn']) {
-            $display = "<font color='#999999'>".$display."</font>";
-            break;
-          }
-        }
-      }
-
-
-      /* Create each field */
-      $field0 = array("string" => "<input type='checkbox' id='item_selected_".$key."' name='item_selected_".$key."'>" ,
-                      "attach" => "style='width:20px;'");
-      $field1 = array("string" => sprintf($deviceimg,$val['dn']), "attach" => "style='text-align:center;width:20px;'");
-      $field2 = array("string" => sprintf($editlink,$key,$display), "attach" => "style='' ".$title);
-      $field3 = array("string" => preg_replace("/%KEY%/", $key, $actions), "attach" => "style='width:".$action_col_size."px;border-right:0px;text-align:right;'");
-      $this->AddElement(array($field0,$field1,$field2,$field3));
-    }
-
-
-    /* Create summary string for list footer */
-    $num_deps=0;
-    if(!$this->SubSearch){
-      $num_deps = count($this->Added_Departments);
-    }
-    $num_objs = count($list);
-
-    $num_obj_str = _("Number of listed devices");
-    $num_dep_str = _("Number of listed departments");
-
-    $str = "<img class='center' src='images/select_devices.png'
-              title='".$num_obj_str."' alt='".$num_obj_str."'>&nbsp;".$num_objs."&nbsp;&nbsp;&nbsp;&nbsp;";
-    $str.= "<img class='center' src='images/folder.png'
-              title='".$num_dep_str."' alt='".$num_dep_str."'>&nbsp;".$num_deps."&nbsp;&nbsp;&nbsp;&nbsp;";
-
-    $this->set_List_Bottom_Info($str);
-  }
-
-  function Save()
-  {
-    MultiSelectWindow::Save();  
-  }
-
-  function save_object()
-  {
-    /* Save automatic created POSTs like regex, checkboxes */
-    MultiSelectWindow::save_object(); 
-  }
-
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/gosa-core/plugins/admin/devices/deviceGeneric.tpl b/gosa-core/plugins/admin/devices/deviceGeneric.tpl
deleted file mode 100644 (file)
index 863851e..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-
-<h2>{t}Devices{/t}</h2>
-
-<table width="100%" summary="">
- <tr>
-  <td width="50%" style="vertical-align:top">
-    <table style="border-right:1px solid #B0B0B0;width:100%">
-        <tr>
-            <td><LABEL for="base">{t}Base{/t}</LABEL>
-            </td>
-            <td>
-                               <select name="base">
-                                       {html_options options=$bases selected=$base}
-                               </select>
-            </td>
-        </tr>
-        <tr>
-            <td><LABEL for="cn">{t}Device name{/t}</LABEL>{$must}
-            </td>
-            <td>
-                <input type="text" size=40 value="{$cn}" name="cn" id="cn">
-            </td>
-        </tr>
-        <tr>
-            <td><LABEL for="description">{t}Description{/t}</LABEL>
-            </td>
-            <td>
-                <input type="text" size=40 value="{$description}" name="description" id="description">
-            </td>
-        </tr>
-        <tr>
-            <td><LABEL for="description">{t}Device type{/t}</LABEL>
-            </td>
-            <td>
-               <select id="type" size="1" name="type" title="{t}Choose the device type{/t}">
-                       {html_options options=$types selected=$type}
-               </select>
-            </td>
-        </tr>
-    </table>
-   </td>
-   <td style="vertical-align:top">
-    <table summary="">
-        <tr>
-            <td><LABEL for="dev_id">{t}Serial number{/t}&nbsp;{t}(iSerial){/t}</LABEL>{$must}
-            </td>
-            <td>
-                <input type="text" value="{$dev_id}" name="dev_id" id="dev_id">
-            </td>
-            <td colspan="2">&nbsp;</td>
-        </tr>
-        <tr>
-            <td><LABEL for="vendor">{t}Vendor-ID{/t}&nbsp;{t}(idVendor){/t}</LABEL>{$must}
-            </td>
-            <td>
-                <input type="text" value="{$vendor}" name="vendor" id="vendor">
-            </td>
-        </tr>
-        <tr>
-          <td><LABEL for="produkt">{t}Product-ID{/t}&nbsp;{t}(idProduct){/t}</LABEL>{$must}
-            </td>
-            <td>
-                <input type="text" value="{$serial}" name="serial" id="serial">
-            </td>
-        </tr>
-    </table>
-</table>
-<input type='hidden' value="1" name="deviceGeneric_posted">
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-    focus_field('name');
-  -->
-</script>
-
-
diff --git a/gosa-core/plugins/admin/devices/main.inc b/gosa-core/plugins/admin/devices/main.inc
deleted file mode 100644 (file)
index 45209ca..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-<?php
-/*
-   This code is part of GOsa (https://gosa.gonicus.de)
-   Copyright (C) 2003  Cajus Pollmeier
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-if ($remove_lock){
-               if(session::is_set('DeviceManagement')){
-                               $DeviceManagement = session::get('DeviceManagement');
-                               $DeviceManagement->remove_lock();
-                               del_lock ($ui->dn);
-                               session::un_set ('DeviceManagement');
-               }
-} else {
-
-               /* Create DeviceManagement object on demand */
-               if (!session::is_set('DeviceManagement') || (isset($_GET['reset']) && $_GET['reset'] == 1)){
-                       session::set('DeviceManagement',new deviceManagement ($config));
-               }
-
-               /* Get object */
-               $DeviceManagement = session::get('DeviceManagement');
-               $DeviceManagement->save_object();
-               $output= $DeviceManagement->execute();
-
-               /* Page header*/
-               if (session::is_set('objectinfo')){
-                               $display= print_header(get_template_path('images/devices.png'), _("Device management"), "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png')."\"> ".@LDAP::fix(session::get('objectinfo')));
-               } else {
-                               $display= print_header(get_template_path('images/devices.png'), _("Device management"));
-               }
-
-               /* Reset requested? */
-               if (isset($_GET['reset']) && $_GET['reset'] == 1){
-                               del_lock ($ui->dn);
-                               session::un_set ('DeviceManagement');
-               }
-
-               /* Show and save dialog */
-               $display.= $output;
-               session::set('DeviceManagement',$DeviceManagement);
-}
-?>
diff --git a/gosa-core/plugins/admin/devices/paste_deviceGeneric.tpl b/gosa-core/plugins/admin/devices/paste_deviceGeneric.tpl
deleted file mode 100644 (file)
index 44d6882..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-
-<h2>{t}Devices{/t}</h2>
-
-<table width="100%" summary="">
- <tr>
-  <td width="50%" style="vertical-align:top">
-    <table style="border-right:1px solid #B0B0B0;width:100%">
-        <tr>
-            <td><LABEL for="cn">{t}Device name{/t}</LABEL>{$must}
-            </td>
-            <td>
-                <input type="text" size=40 value="{$cn}" name="cn" id="cn">
-            </td>
-        </tr>
-    </table>
-   </td>
-</table>
-<input type='hidden' value="1" name="deviceGeneric_posted">
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-    focus_field('name');
-  -->
-</script>
-
-
diff --git a/gosa-core/plugins/admin/devices/remove.tpl b/gosa-core/plugins/admin/devices/remove.tpl
deleted file mode 100644 (file)
index 643056c..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-<div style="font-size:18px;">
-  <img alt="" src="images/button_cancel.png" align=top>&nbsp;{t}Warning{/t}
-</div>
-<p>
- {$intro}
- {t}This may be used by several users/groups. Please double check if your really want to do this since there is no way for GOsa to get your data back.{/t}
-</p>
-<p>
- {t}So - if you're sure - press 'Delete' to continue or 'Cancel' to abort.{/t}
-</p>
-
-<p class="plugbottom">
-       {if $multiple}
-               <input type=submit name="delete_multiple_device_confirm" value="{t}Delete{/t}">
-               &nbsp;
-               <input type=submit name="delete_multiple_device_cancel" value="{t}Cancel{/t}">
-       {else}
-               <input type=submit name="delete_device_confirm" value="{t}Delete{/t}">
-               &nbsp;
-               <input type=submit name="delete_cancel" value="{t}Cancel{/t}">
-       {/if}
-</p>
-
diff --git a/gosa-core/plugins/admin/devices/tabs_devices.inc b/gosa-core/plugins/admin/devices/tabs_devices.inc
deleted file mode 100644 (file)
index 0feddfc..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
-
-class devicetabs extends tabs
-{
-  var $Release= "";
-
-  function devicetabs($config, $data, $dn,$category)
-  {
-    tabs::tabs($config, $data, $dn,$category);
-
-    /* Add references/acls/snapshots */
-    $this->addSpecialTabs();
-  }
-
-  function save($ignore_account= FALSE)
-  {
-    $baseobject= $this->by_object['deviceGeneric'];
-    $new_dn= "cn=".$baseobject->cn.",".get_ou('deviceou').$baseobject->base;
-
-    /* Move group? */
-    if ($this->dn != $new_dn){
-
-      /* Write entry on new 'dn' */
-      if ($this->dn != "new"){
-        $baseobject->move($this->dn, $new_dn);
-        $this->by_object['deviceGeneric']= $baseobject;
-      }
-
-      /* Happen to use the new one */
-      $this->dn= $new_dn;
-    }
-
-    tabs::save();
-  }
-
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/gosa-core/plugins/admin/mimetypes/class_divListMimeTypes.inc b/gosa-core/plugins/admin/mimetypes/class_divListMimeTypes.inc
deleted file mode 100644 (file)
index da73758..0000000
+++ /dev/null
@@ -1,345 +0,0 @@
-<?php
-
-class divListMimeTypes extends MultiSelectWindow
-{
-  /* Current base */
-  var $selectedBase       = "";
-  var $selectedRelease    = "main";
-  var $AvailableReleases  = array();
-  var $departments        = array();
-  var $parent               ;
-  var $ui                   ;
-
-  /* Regex */
-  var $Regex              = "*";
-
-  /* Subsearch checkbox */
-  var $SubSearch;
-
-  /* These vars should be saved too */
-  var $SaveAdditionalVars = array("selectedRelease");
-
-
-  function divListMimeTypes (&$config, &$parent)
-  {
-    /* Create divlist and setup */
-    MultiSelectWindow::MultiSelectWindow($config, "Mimetypes", "mimetypes");
-  
-    /* initialize required attributes */ 
-    $this->selectedRelease  = get_ou('mimetypeou').session::get('CurrentMainBase');
-    $this->parent           = &$parent;
-    $this->ui               = get_userinfo();
-    $this->AvailableReleases= $this->parent->getReleases($this->selectedBase);
-
-    /* Set list strings */
-    $this->SetTitle       (_("List of defined mime types"));
-    $this->SetSummary     (_("List of defined mime types"));
-    $this->SetInformation (_("This menu allows you to add, edit and remove selected mime types. You may want to use the range selector on top of the mime type listbox, when working with a large number of mime types."));
-
-    /* Result page will look like a headpage */
-    $this->SetHeadpageMode();
-    $this->EnableAplhabet(true);
-  
-    /* Disable buttonsm */
-    $this->EnableCloseButton(false);
-    $this->EnableSaveButton (false);
-
-    /* set Page header */
-    $action_col_size = 80;
-    if($this->parent->snapshotEnabled()){
-      $action_col_size += 38;
-    }
-
-    /* Toggle all selected / deselected */
-    $chk = "<input type='checkbox' id='select_all' name='select_all'
-               onClick='toggle_all_(\"^item_selected_[0-9]*$\",\"select_all\");' >";
-
-    /* set Page header */
-    $this->AddHeader(array("string"=> $chk,          "attach"=>"style='width:20px;'"));
-    $this->AddHeader(array("string" => "&nbsp;",                "attach" => "style='text-align:center;width:20px;'"));
-    $this->AddHeader(array("string" => _("Mime type name")." / "._("Department"), "attach" => "style=''"));
-    $this->AddHeader(array("string" => _("Actions"),            "attach" => "style='width:".$action_col_size."px;border-right:0px;text-align:right;'"));
-
-    /* Add SubSearch checkbox */
-    $this->AddCheckBox("SubSearch",  _("Select to search within subtrees"), _("Search in subtrees"), false);
-
-    /*                  Name                 ,Text                              ,Default  , Connect with alphabet  */
-    $this->AddRegex   ("Regex",     _("Display mime types matching"),"*" , true);
-  }
-
-
-  /* This function allows us to add a user defined filter part at position $position*/
-  function AddUserBoxToFilter($position)
-  {
-    $str = "";
-    if(($position  == 2) && ($this->parent->IsReleaseManagementActivated($this->config))){
-      $smarty = get_smarty();
-      $smarty->assign("selectedRelease",$this->selectedRelease);
-      $smarty->assign("branchimage","images/branch.png");
-      $smarty->assign("releases",$this->AvailableReleases);
-      $str = $smarty->fetch(get_template_path('release_select.tpl', TRUE,dirname(__FILE__)));
-    }
-    return($str);
-  }
-
-
-  /* Create list header, with create / copy & paste etc*/
-  function GenHeader()
-  {
-    /* Prepare departments,
-       which are shown in the listbox on top of the listbox
-     */
-    $options= "";
-
-    /* Get all departments within this subtree */
-    $ui= get_userinfo();
-    $first = "";
-    $found = FALSE;
-    $base = $this->config->current['BASE'];
-
-    /* Add base */
-    $tmp = array();
-    $tmp[] = array("dn"=>$this->config->current['BASE']);
-    $tmp=  array_merge($tmp,get_list("(&(|(ou=*)(description=*))(objectClass=gosaDepartment))", $this->module, $base,
-                    array("ou", "description"), GL_SIZELIMIT | GL_SUBSEARCH));
-
-    $deps = array();
-    foreach($tmp as $tm){
-      $deps[$tm['dn']] = $tm['dn'];
-    }
-
-    /* Load possible departments */
-    $ui= get_userinfo();
-    $tdeps= $ui->get_module_departments($this->module);
-    $ids = $this->config->idepartments;
-    $first = "";
-    $found = FALSE;
-    foreach($ids as $dep => $name){
-      if(isset($deps[$dep]) && in_array_ics($dep, $tdeps)){
-
-        /* Keep first base dn in mind, we could need this
-         *  info if no valid base was found
-         */
-        if(empty($first)) {
-          $first = $dep['dn'];
-        }
-
-        $value = $ids[$dep];
-        if ($this->selectedBase == $dep){
-          $found = TRUE;
-          $options.= "<option selected='selected' value='".$dep."'>$value</option>";
-        } else {
-          $options.= "<option value='".$dep."'>$value</option>";
-        }
-      }
-    }
-
-    /* The currently used base is not visible with your acl setup.
-     * Set base to first useable base.
-     */
-    if(!$found){
-      $this->selectedBase = $first;
-    }
-
-    /* Get acls */
-    $ui       = get_userinfo();
-    $acl      = $ui->get_permissions("cn=dummy,".get_ou('mimetypeou').$this->selectedBase,"mimetypes/mimetype");
-    $acl_all  = $ui->has_complete_category_acls($this->selectedBase,"mimetypes") ;
-
-
-    /* If this is true we add an additional seperator. Just look a few lines below */  
-    $add_sep = false;
-    /* Get copy & paste icon */
-    $Copy_Paste ="";
-    if(preg_match("/(c.*w|w.*c)/",$acl_all) &&  $this->parent->CopyPasteHandler){
-      $Copy_Paste = $this->parent->CopyPasteHandler->generatePasteIcon();
-      $add_sep = true;
-    }
-
-    /* Add default header */
-    $listhead = MultiSelectWindow::get_default_header();
-
-    /* And at least add a department selection box */
-    $listhead .=  _("Base")."&nbsp;<select name='CurrentMainBase' onChange='mainform.submit()' class='center'>$options</select>".
-      " <input class='center' type='image' src='images/list_submit.png' align='middle' 
-        title='"._("Submit department")."' name='submit_department' alt='"._("Submit")."'>&nbsp;";
-
-    /* Create Layers menu */
-    $s  = ".|"._("Actions")."|\n";
-    $s .= "..|<img src='images/list_new.png' alt='' border='0' class='center'>".
-      "&nbsp;"._("Create")."|\n";
-
-    /* Append create options */
-    if(preg_match("/c/",$acl)) {
-      $s.= "...|<input class='center' type='image' src='images/list_new_mime.png' alt=''>".
-        "&nbsp;"._("Mime type")."|mime_new|\n";
-    }
-
-    /* Multiple options */
-    $s.= "..|---|\n";
-    $s.= "..|<img src='images/edittrash.png' alt='' border='0' class='center'>".
-      "&nbsp;"._("Remove")."|"."remove_multiple|\n";
-
-    /* Add multiple copy & cut icons */
-    if(is_object($this->parent->CopyPasteHandler) && preg_match("/(c.*w|w.*c)/",$acl_all)){
-      $s.= "..|---|\n";
-      $s.= "..|<img src='images/editcopy.png' alt='' border='0' class='center'>".
-        "&nbsp;"._("Copy")."|"."multiple_copy_systems|\n";
-      $s.= "..|<img src='images/editcut.png' alt='' border='0' class='center'>".
-        "&nbsp;"._("Cut")."|"."multiple_cut_systems|\n";
-
-      if($this->parent->CopyPasteHandler->entries_queued()){
-        $img = "<img border='0' class='center' src='images/editpaste.png' alt=''>";
-        $s.="..|".$img."&nbsp;"._("Paste")."|editPaste|\n";
-      }else{
-        $img = "<img border='0' class='center' src='images/cant_editpaste.png' alt=''>";
-        $s.="..|".$img."&nbsp;"._("Paste")."\n";
-      }
-    }
-
-    /* Add snapshot icons */
-    if(preg_match("/(c.*w|w.*c)/",$acl_all)){
-      $s .= "..|---|\n";
-      $s .= $this->get_snapshot_header(TRUE);
-    }
-
-    $this->SetDropDownHeaderMenu($s);
-    $this->SetListHeader($listhead);
-  }
-
-
-  /* Some basic settings */
-  function execute()
-  {
-    $this->ClearElementsList();
-    $this->GenHeader();
-  }
-
-
-  function setEntries($list)
-  {
-    /********************
-      Variable init
-     ********************/
-
-    /* Create links */
-    $linkopen = "<a href='?plug=".$_GET['plug']."&amp;act=dep_open&amp;dep_id=%s'>%s</a>";
-    $editlink = "<a href='?plug=".$_GET['plug']."&amp;id=%s&amp;act=edit_entry'>%s</a>";
-    $userimg  = "<img class='center' src='images/select_groups.png' alt='User'    title='%s'>";
-    $mimeimg  = "<img class='center' src='images/select_mimetype.png' alt='A'  title='"._("Mime type")."'>";
-    $empty    = "<img class='center' src='images/empty.png' style='width:16px;height:16px;' alt=''>";
-
-    /* set Page header */
-    $action_col_size = 80;
-    if($this->parent->snapshotEnabled()){
-      $action_col_size += 38;
-    }
-
-    /********************
-      Attach objects
-     ********************/
-
-    foreach($list as $key => $val){
-
-      $ui       = get_userinfo();
-      $acl      = $ui->get_permissions($val['dn'],"mimetypes/mimetype");
-      $acl_all  = $ui->has_complete_category_acls($val['dn'],"mimetypes") ;
-
-      /* Create action icons */
-      $actions = "";
-      if(preg_match("/(c.*w|w.*c)/",$acl_all)){
-        $actions .= $this->GetSnapShotActions($val['dn']);
-      }
-
-      /* Get copy Paste icons */
-      if(($this->parent->CopyPasteHandler) && preg_match("/(c.*w|w.*c)/",$acl_all)){
-        $actions.= "<input class='center' type='image'
-          src='images/editcut.png' alt='"._("cut")."' name='cut_%KEY%' title='"._("Cut this entry")."'>&nbsp;";
-        $actions.= "<input class='center' type='image'
-          src='images/editcopy.png' alt='"._("copy")."' name='copy_%KEY%' title='"._("Copy this entry")."'>&nbsp;";
-      }
-
-      $actions.= "<input class='center' type='image'
-        src='images/edit.png' alt='"._("edit")."' name='mime_edit_%KEY%' title='"._("Edit this entry")."'>";
-
-      /* Add delete button */
-      if(preg_match("/d/",$acl)){
-        $actions.= "<input class='center' type='image'
-          src='images/edittrash.png' alt='"._("delete")."' name='mime_del_%KEY%' title='"._("Delete this entry")."'>";
-      }else{
-        $actions.= "<img src='images/empty.png' alt='&nbsp;' class='center'>";
-      }
-
-      $title = "title='".preg_replace('/ /', '&nbsp;', @LDAP::fix($val['dn']))."'";
-
-      if(!isset($val['description'][0])){
-        $desc = "";
-      }else{
-        $desc = " - [ ".$val['description'][0]." ]";
-      }
-
-      /* Cutted objects should be displayed in light grey */
-      $display = $val['cn'][0].$desc;
-      if($this->parent->CopyPasteHandler){
-        foreach($this->parent->CopyPasteHandler->queue as $queue_key => $queue_data){
-          if($queue_data['dn'] == $val['dn']) {
-            $display = "<font color='#999999'>".$display."</font>";
-            break;
-          }
-        }
-      }
-
-
-      /* Create each field */
-      $field0 = array("string" => "<input type='checkbox' id='item_selected_".$key."' name='item_selected_".$key."'>" ,
-                      "attach" => "style='width:20px;'");
-      $field1 = array("string" => sprintf($mimeimg,$val['dn']), "attach" => "style='text-align:center;width:20px;'");
-      $field2 = array("string" => sprintf($editlink,$key,$display), "attach" => "style='' ".$title);
-      $field3 = array("string" => preg_replace("/%KEY%/", $key, $actions), "attach" => "style='width:".$action_col_size."px;border-right:0px;text-align:right;'");
-      $this->AddElement(array($field0,$field1,$field2,$field3));
-    }
-
-
-    /* Create summary string for list footer */
-    $num_deps=0;
-    if(!$this->SubSearch){
-      $num_deps = count($this->Added_Departments);
-    }
-    $num_objs = count($list);
-
-    $num_obj_str = _("Number of listed mimetypes");
-    $num_dep_str = _("Number of listed departments");
-
-    $str = "<img class='center' src='images/select_mimetype.png'
-              title='".$num_obj_str."' alt='".$num_obj_str."'>&nbsp;".$num_objs."&nbsp;&nbsp;&nbsp;&nbsp;";
-    $str.= "<img class='center' src='images/folder.png'
-              title='".$num_dep_str."' alt='".$num_dep_str."'>&nbsp;".$num_deps."&nbsp;&nbsp;&nbsp;&nbsp;";
-
-    $this->set_List_Bottom_Info($str);
-  }
-
-  function Save()
-  {
-    MultiSelectWindow::Save();  
-  }
-
-  function save_object()
-  {
-    /* Save automatic created POSTs like regex, checkboxes */
-    MultiSelectWindow::save_object(); 
-
-    /* check if returned selectedRelease is a valid release.
-        If it isn't set to a valid release */
-    $this->AvailableReleases = $this->parent->getReleases($this->selectedBase);
-    if(!isset($this->AvailableReleases[$this->selectedRelease])){
-      $this->selectedRelease =key($this->AvailableReleases);
-    }
-    $mimefilter = session::get('mimefilter');
-    $mimefilter['release']  = $this->selectedRelease;
-    session::set('mimefilter',$mimefilter);
-  }
-
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/gosa-core/plugins/admin/mimetypes/class_mimetypeGeneric.inc b/gosa-core/plugins/admin/mimetypes/class_mimetypeGeneric.inc
deleted file mode 100644 (file)
index 03867eb..0000000
+++ /dev/null
@@ -1,758 +0,0 @@
-<?php
-class mimetype extends plugin
-{
-       /* CLI vars */
-       var $cli_summary                  = "This tab allows you to modify, add or remove mime types in the selected department.";
-       var $cli_description    = "Management dialog to handle mime types";
-       var $ignore_account     = true; // This is always a valid account
-       var $cli_parameters             = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-       var $objectclasses              = array("top","gotoMimeType");
-       var $attributes                   = array("cn","gotoMimeApplication","gotoMimeLeftClickAction","gotoMimeIcon",
-                                                                       "description","gotoMimeFilePattern","gotoMimeEmbeddedApplication",
-                                                                       "gotoMimeGroup");       
-
-       /* Class vars */
-       var $ui;
-       var $cn                                                                               = "";                                     
-       var $gotoMimeLeftClickAction                        = "I";
-       var $gotoMimeLeftClickAction_I              = true;
-       var $gotoMimeLeftClickAction_E              = false;
-       var $gotoMimeLeftClickAction_Q              = false;
-       var $gotoMimeIcon                                                         = "*removed*";
-       var $description                                                          = "";
-       var $gotoMimeFilePattern                                      = array();
-       var $gotoMimeApplication                                      = array();
-       var $gotoMimeEmbeddedApplication            = array();
-       var $gotoMimeGroup                                                      = "";
-       var $iconData                                                               = NULL;     
-       var $base                                                                             = "";
-  var $ApplicationList                  = array();  
-
-
-  /* To prevent errors when using the 'apply' button, we use this variables 
-      to manage array attributes */
-       var $use_gotoMimeIcon                                           = NULL;
-       var $use_gotoMimeFilePattern                        = array();
-       var $use_gotoMimeApplication                        = array();
-       var $use_gotoMimeEmbeddedApplication    = array();
-
-  /* divLists */
-  var $DivPatterns                                                       = NULL;
-  var $DivApps                                                             = NULL;
-  var $DivEApps                                                                    = NULL;
-
-  /* Mime type release mode */
-  var $isReleaseMimeType                                             = false;
-
-  /* These vars will be copied too, if you use copy&paste mode */
-  var $CopyPasteVars        = array("use_gotoMimeFilePattern","use_gotoMimeApplication","use_gotoMimeEmbeddedApplication","iconData",
-                                    "gotoMimeLeftClickAction_I","gotoMimeLeftClickAction_E","gotoMimeLeftClickAction_Q","use_gotoMimeIcon");
-
-  var $view_logged  = FALSE;
-
-  /* Select options */
-  var $MimeGroups                            = array("application","audio","chemical","image","inode","message","model",
-                                      "multipart","text","video","x-conference","x-world");
-
-  /* Orig_Dn is used to verify if this object is new or only edited */         
-  var $orig_dn                 = "";
-
-  function mimetype(&$config,$dn= NULL)
-  {
-    plugin::plugin ($config, $dn);
-
-    /* Save original dn */
-    $this->orig_dn = $dn;      
-
-    /* get gotoMimeLeftClickActions I/E/Q */
-    if(isset($this->gotoMimeLeftClickAction)){
-      $str = $this->gotoMimeLeftClickAction;
-      for($i = 0 ; $i < strlen($str) ; $i ++ ){
-        $varna = "gotoMimeLeftClickAction_". $str[$i];
-        if(isset($this->$varna)){
-          $this->$varna = true;
-        }
-      }
-    }
-
-    /* Create list of defined applications in GOsa */
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cd($this->config->current['BASE']);
-    $ldap->search("(&(objectClass=gosaApplication)(cn=*))",array('cn'));
-    $this->ApplicationList = array();
-    while($attrs = $ldap->fetch()){
-      $this->ApplicationList[$attrs['cn'][0]] = $attrs['cn'][0];
-    }
-
-    /* If both radio buttons arn't set, set option I */
-    if(!$this->gotoMimeLeftClickAction_I && !$this->gotoMimeLeftClickAction_E){
-      $this->gotoMimeLeftClickAction_I = true;
-    }
-
-    /* Get list of array attributes */
-    foreach(array("gotoMimeFilePattern") as $attr){
-      $this->$attr = array();
-      if(isset($this->attrs[$attr])){
-        $tmp = array();
-        for($i = 0 ; $i < $this->attrs[$attr]['count'] ; $i ++){
-          $str = $this->attrs[$attr][$i];
-          $tmp[] = $str;
-        }
-        $use_attr = "use_".$attr;
-        $this->$use_attr = $tmp;
-      }
-    }
-
-    /* Get list of array attributes with priority tag ( Test|32 )*/
-    foreach(array("gotoMimeApplication","gotoMimeEmbeddedApplication") as $attr){
-      $this->$attr = array();
-      if(isset($this->attrs[$attr])){
-        $tmp = array();
-        for($i = 0 ; $i < $this->attrs[$attr]['count'] ; $i ++){
-          $str = $this->attrs[$attr][$i];
-          $tmp2= split("\|",$str);
-
-          if(count($tmp2) == 2){
-            $name = $tmp2[0];
-            $prio = $tmp2[1];
-            $tmp[$prio] = $name;
-          }
-        }
-        ksort($tmp);
-        $use_attr = "use_".$attr;
-        $this->$use_attr = $tmp;
-      }
-    }
-
-    /* Check if release Management is enabled */
-    $tmp = $this->config->search("faiManagement", "CLASS",array('menu','tabs'));
-    if(!empty($tmp)) {
-      $this->isReleaseMimeType= true;
-    }
-
-    /* Set base */     
-    if ($this->dn == "new"){
-      if(session::is_set('CurrentMainBase')){
-        $this->base= session::get('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();
-      $this->iconData = $ldap->get_attribute($this->dn,"gotoMimeIcon");
-      $this->saved_attributes['gotoMimeIcon'] = $this->iconData;
-    }
-    if ($this->iconData == ""){
-      $this->set_new_picture("");
-    }
-    session::set('binary',$this->iconData);
-    session::set('binarytype',"image/jpeg");
-  }
-
-
-  function execute()
-  {
-    $smarty = get_smarty();
-
-    if(!$this->view_logged){
-      $this->view_logged =TRUE;
-      new log("view","mimetypes/".get_class($this),$this->dn);
-    }
-
-    $tmp = $this->plInfo();
-    foreach($tmp['plProvidedAcls'] as $name => $translation){
-      $smarty->assign($name."ACL",$this->getacl($name));
-    }
-
-    /* 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->get_allowed_bases());
-        $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()){
-
-        /* A new base was selected, check if it is a valid one */
-        $tmp = $this->get_allowed_bases();
-        if(isset($tmp[$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"),
-        "/^Pattern_SortDown_/"         => array("Action" => "Pattern_SortDown","Func" => "ArrayDown",  "Attr" => "use_gotoMimeFilePattern"),
-        "/^Pattern_Remove_/"   => array("Action" => "Pattern_Remove",  "Func" => "ArrayRemove","Attr" => "use_gotoMimeFilePattern"),
-        "/^Apps_SortUp_/"              => array("Action" => "Apps_SortUp",             "Func" => "ArrayUp",    "Attr" => "use_gotoMimeApplication"),
-        "/^Apps_SortDown_/"    => array("Action" => "Apps_SortDown",   "Func" => "ArrayDown",  "Attr" => "use_gotoMimeApplication"),
-        "/^Apps_Remove_/"              => array("Action" => "Apps_Remove",             "Func" => "ArrayRemove","Attr" => "use_gotoMimeApplication"),
-        "/^EApps_SortUp_/"             => array("Action" => "EApps_SortUp",    "Func" => "ArrayUp",    "Attr" => "use_gotoMimeEmbeddedApplication"),
-        "/^EApps_SortDown_/"   => array("Action" => "EApps_SortDown",  "Func" => "ArrayDown",  "Attr" => "use_gotoMimeEmbeddedApplication"),
-        "/^EApps_Remove_/"             => array("Action" => "EApps_Remove",    "Func" => "ArrayRemove","Attr" => "use_gotoMimeEmbeddedApplication"));          
-    $once = true;
-
-    /* Walk through posts and try to find some commands for us. */
-    foreach($_POST as $name => $value){
-
-      /* Walk through possible commands */
-      foreach($posts as $regex => $action){
-
-        /* Check if there is a command posted */
-        if(preg_match($regex,$name) && $once){
-          $once = false;
-
-          /* Get action vars */
-          $func                = $action['Func'];              // Get function name 
-          $attr                = $action['Attr'];              // Get attribute name
-
-          /* Get entry id */
-          $s_entry     = preg_replace($regex,"",$name);
-          $s_entry     = preg_replace("/_[xy]$/","",$s_entry); 
-
-          /* Execute a command with the given attribute and entry 
-             e.g. $this->gotoMimeFilePattern = $this->ArrayUp(3,$this->gotoMimeFilePattern) */
-          if($this->acl_is_writeable($attr)){
-            $this->$attr= $this->$func($s_entry,$this->$attr,true);                                     
-          }
-        }
-      }
-    }
-
-    /* Set a new icon was requested */
-    if(isset($_POST['update_icon']) && (isset($_FILES['picture_file']['name']))){
-      $this->set_new_picture($_FILES['picture_file']['tmp_name']);             
-    }
-
-    /* Add gotoMimeFilePattern */
-    if(isset($_POST['AddNewFilePattern']) && isset($_POST['NewFilePattern'])){
-      if($this->acl_is_writeable("gotoMimeFilePattern")){
-        $str = $_POST['NewFilePattern'];
-        if(!empty($str)){
-          $this->use_gotoMimeFilePattern[] = $str;
-        }
-      }
-    }  
-
-    /* Add gotoMimeFilePattern */
-    if(isset($_POST['AddNewApplication']) && 
-            (isset($_POST['NewApplication']) || isset($_POST['NewApplicationSelect']))){
-      if($this->acl_is_writeable("gotoMimeApplication")){
-        $str = "";
-        if(isset($_POST['NewApplicationSelect']) && !empty($_POST['NewApplicationSelect'])){
-          $str = get_post("NewApplicationSelect");
-        }
-        if(isset($_POST['NewApplication']) && !empty($_POST['NewApplication'])){
-          $str = get_post("NewApplication");
-        }
-        if(!empty($str) && !in_array($str,$this->use_gotoMimeApplication)){
-          $this->use_gotoMimeApplication[] = $str;
-        }
-      }
-    }  
-
-    /* Add embedded application 
-     *  - From input or from select box 
-     */
-    if(isset($_POST['AddNewEmbeddedApplication']) && 
-            (isset($_POST['NewEmbeddedApplication']) || isset($_POST['NewEmbeddedApplicationSelect']))){
-      if($this->acl_is_writeable("gotoMimeEmbeddedApplication")){
-        $str = "";
-        if(isset($_POST['NewEmbeddedApplicationSelect']) && !empty($_POST['NewEmbeddedApplicationSelect'])){
-          $str = get_post('NewEmbeddedApplicationSelect');
-        }
-        if(isset($_POST['NewEmbeddedApplication']) && !empty($_POST['NewEmbeddedApplication'])){
-          $str = get_post('NewEmbeddedApplication');
-        }
-        if(!empty($str) && !in_array($str,$this->use_gotoMimeEmbeddedApplication)){
-          $this->use_gotoMimeEmbeddedApplication[] = $str;
-        }
-      }
-    }  
-
-    /* Create divlists */
-    $DivPatterns       = new divSelectBox("gotoMimePatterns");
-    $DivApps           = new divSelectBox("gotoMimeApplications");
-    $DivEApps          = new divSelectBox("gotoMimeEmbeddedApplications");
-    $DivPatterns       -> SetHeight(100);
-    $DivApps           -> SetHeight(100);
-    $DivEApps          -> SetHeight(100);
-
-
-    if($this->acl_is_writeable("gotoMimeFilePattern")){
-      $Pattern_Actions= " <input type='image' src='images/sort_up.png'         class='center'  name='Pattern_SortUp_%s' >&nbsp;
-      <input type='image' src='images/sort_down.png'   class='center'  name='Pattern_SortDown_%s'>&nbsp;
-      <input type='image' src='images/edittrash.png'   class='center'  name='Pattern_Remove_%s'>";
-    }else{
-      $Pattern_Actions= "";    
-    }
-
-    if($this->acl_is_writeable("gotoMimeApplication")){
-      $Apps_Actions    = " <input type='image' src='images/sort_up.png'        class='center'  name='Apps_SortUp_%s' >&nbsp;
-      <input type='image' src='images/sort_down.png'   class='center'  name='Apps_SortDown_%s'>&nbsp;
-      <input type='image' src='images/edittrash.png'   class='center'  name='Apps_Remove_%s'>";
-    }else{
-      $Apps_Actions= "";       
-    }
-
-    if($this->acl_is_writeable("gotoMimeEmbeddedApplication")){
-      $EApps_Actions   = " <input type='image' src='images/sort_up.png'        class='center'  name='EApps_SortUp_%s' >&nbsp;
-      <input type='image' src='images/sort_down.png'   class='center'  name='EApps_SortDown_%s'>&nbsp;
-      <input type='image' src='images/edittrash.png'   class='center'  name='EApps_Remove_%s'>";
-    }else{
-      $EApps_Actions= "";      
-    }
-
-    /* Before adding some entries check acls */
-    if($this->acl_is_readable("gotoMimeFilePattern")){
-      foreach($this->use_gotoMimeFilePattern as $key => $pattern){
-        $field1 = array("string" => $pattern);
-        $field2 = array("string" => preg_replace("/%s/",$key,$Pattern_Actions),"attach"=>"style='border-right:0px;width:50px;'");
-        $fields = array($field1,$field2);
-        $DivPatterns -> AddEntry($fields);
-      }                        
-    }
-
-    if($this->acl_is_readable("gotoMimeApplication")){
-      foreach($this->use_gotoMimeApplication as $key => $pattern){
-        $field1 = array("string" => $pattern);
-        $field2 = array("string" => preg_replace("/%s/",$key,$Apps_Actions),"attach"=>"style='border-right:0px;width:50px;'");
-        $fields = array($field1,$field2);
-        $DivApps -> AddEntry($fields);
-      }                        
-    }                  
-    if($this->acl_is_readable("gotoMimeEmbeddedApplication")){
-      foreach($this->use_gotoMimeEmbeddedApplication as $key => $pattern){
-        $field1 = array("string" => $pattern);
-        $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("bases",                                           $this->get_allowed_bases());            
-    $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());
-
-    $smarty->assign("ApplicationList",$this->ApplicationList);
-  
-    /* Assign class vars to smarty */
-    foreach($this->attributes as $attr){
-      $smarty->assign($attr,$this->$attr);
-    }  
-
-    /* Assign additional vars that are not included in attributes*/
-    foreach(array("gotoMimeLeftClickAction_I","gotoMimeLeftClickAction_E","gotoMimeLeftClickAction_Q") as $attr){
-      $smarty->assign($attr,$this->$attr);
-    }  
-
-    /* Assign select box options */
-    $smarty->assign("gotoMimeGroups",$this->MimeGroups);
-    $smarty->assign("gotoMimeIcon"     ,$this->get_picture());
-    return($smarty->fetch(get_template_path("generic.tpl",TRUE,dirname(__FILE__))));
-  }
-
-
-  function save_object()
-  {
-    if(isset($_POST['MimeGeneric'])){
-
-      /* Create a base backup and reset the
-         base directly after calling plugin::save_object();
-         Base will be set seperatly a few lines below */
-      $base_tmp = $this->base;
-      plugin::save_object();
-      $this->base = $base_tmp;
-  
-      /* Only save base if we are not in release mode */
-      if(!$this->isReleaseMimeType){
-
-        /* Set new base if allowed */
-        $tmp = $this->get_allowed_bases();
-        if(isset($_POST['base'])){
-          if(isset($tmp[$_POST['base']])){
-            $this->base= $_POST['base'];
-          }
-        }
-
-      }
-
-      /* Save radio buttons */
-      if($this->acl_is_writeable("gotoMimeLeftClickAction")){
-        if(isset($_POST['gotoMimeLeftClickAction_IE'])){
-          $chr = $_POST['gotoMimeLeftClickAction_IE'];
-          if($chr == "E"){
-            $this->gotoMimeLeftClickAction_E = true;
-            $this->gotoMimeLeftClickAction_I = false;
-          }else{
-            $this->gotoMimeLeftClickAction_E = false;
-            $this->gotoMimeLeftClickAction_I = true;
-          }
-        }
-        if(isset($_POST['gotoMimeLeftClickAction_Q'])){
-          $this->gotoMimeLeftClickAction_Q = true;
-        }else{
-          $this->gotoMimeLeftClickAction_Q = false;
-        }
-      }
-    }
-  }
-
-
-  /* save current changes */
-  function save()
-  {
-    /* Create gotoMimeLeftClickAction out of checkboxes and radio buttons */   
-    $arr = array ("E","I","Q");
-    $str = "";
-    foreach ($arr as $Chr){
-      $var = "gotoMimeLeftClickAction_".$Chr;
-      if($this->$var){
-        $str .= $Chr;
-      }
-    }
-    $this->gotoMimeLeftClickAction = $str;
-
-    /* Create array entries with priority tag ( Test|3 )*/
-    foreach(array("gotoMimeEmbeddedApplication","gotoMimeApplication") as $attr){
-      $i                               = 0;
-      $use_attr                = "use_".$attr;
-      $tmp                     = array();
-      $this->$attr     = array();
-      foreach($this->$use_attr as $entry){
-        $tmp[] = $entry."|".$i ++;
-      }
-      $this->$attr = $tmp;
-    }
-
-    /* Create array entries */
-    foreach(array("gotoMimeFilePattern") as $attr){
-      $i                               = 0;
-      $use_attr                = "use_".$attr;
-      $tmp                     = array();
-      $this->$attr     = array();
-      foreach($this->$use_attr as $entry){
-        $tmp[] = $entry;
-      }
-      $this->$attr = $tmp;
-    }
-
-    /* Remove Icon if requested  */
-    if($this->use_gotoMimeIcon != "*removed*"){
-      $this->gotoMimeIcon = $this->iconData;
-    }else{
-      $this->gotoMimeIcon = "";
-    }
-
-    plugin::save();
-
-    /* If this is a newly created object, skip storing those 
-       attributes that contain an empty array */
-    if($this->orig_dn == "new"){
-      foreach(array("gotoMimeEmbeddedApplication","gotoMimeApplication","gotoMimeFilePattern") as $attr){
-        if(!count($this->$attr)){
-          unset($this->attrs[$attr]);
-        }
-      }
-    }
-
-    $ldap = $this->config->get_ldap_link();
-    $ldap-> cd ( $this->config->current['BASE']);
-    $ldap->cat($this->dn);
-    if($ldap->count()){
-      $ldap->cd($this->dn);
-      $this->cleanup();
-      $ldap->modify($this->attrs);
-      new log("modify","mimetypes/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    }else{
-      $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
-      $ldap->cd($this->dn);
-      $ldap->add($this->attrs);
-      new log("create","mimetypes/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    }
-    show_ldap_error($ldap->get_error(), sprintf(_("Saving of mime type/generic with dn '%s' failed."),$this->dn));
-  }
-
-
-  /* Remove current mime type */
-  function remove_from_parent()
-  {
-    plugin::remove_from_parent();
-    $ldap = $this->config->get_ldap_link();
-    $ldap->rmDir($this->dn);
-    show_ldap_error($ldap->get_error(), sprintf(_("Removing of mime type/generic with dn '%s' failed."),$this->dn));
-    new log("remove","mimetypes/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-
-    /* Optionally execute a command after we're done */
-    $this->handle_post_events("remove");
-
-    /* Delete references to object groups */
-    $ldap->cd ($this->config->current['BASE']);
-    $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".LDAP::prepare4filter($this->dn)."))", array("cn"));
-    while ($ldap->fetch()){
-      $og= new ogroup($this->config, $ldap->getDN());
-      unset($og->member[$this->dn]);
-      $og->save ();
-      show_ldap_error($ldap->get_error(), sprintf(_("Removing mime type from objectgroup '%s' failed"), $og->dn));
-    }
-  }
-
-
-  /* Check given values */
-  function check()
-  {
-    $message = plugin::check();
-    if(empty($this->cn)){
-      $message[] = _("Please specify a valid name for this mime type.");
-    }
-    if(!count($this->use_gotoMimeFilePattern)){
-      $message[] = _("Please specify at least one file pattern.") ;
-    }
-
-    /* Check if there is already a mime type with this cn */
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cd($this->config->current["BASE"]);
-
-    $mimefilter = session::get('mimefilter');
-  
-    if($this->isReleaseMimeType && (isset($mimefilter['release']))){
-      $baseDn = str_replace($this->config->current['BASE'],$this->base,$mimefilter['release']);
-      $baseDn = preg_replace("/".get_ou('mimetypeou').".*/",get_ou('mimetypeou').$this->base,$mimefilter['release']);
-      $ldap->ls("(&(objectClass=gotoMimeType)(cn=".$this->cn."))",$baseDn,array("cn"));
-      if($ldap->count()){
-        $attrs = $ldap->fetch();
-        if($this->dn != $attrs['dn']) {
-          $message[]= _("There's already a mime type with this 'Name'.");
-        }
-      }
-    }else{
-      $ldap->ls("(&(objectClass=gotoMimeType)(cn=".$this->cn."))",get_ou('mimetypeou').$this->base,array("cn"));
-      if ($ldap->count()){
-        $attrs = $ldap->fetch();
-        if($this->dn != $attrs['dn']) {
-          $message[]= _("There's already an mime with this 'Name'.");
-        }
-      }
-    }
-
-    return($message);
-  }
-
-  /** Helper functions **/
-
-  /* Set a new picture */      
-  function set_new_picture($filename)
-  {
-    if (empty($filename)){
-      $filename= "./images/default_icon.png";
-      $this->use_gotoMimeIcon= "*removed*";
-    }else{
-      $this->use_gotoMimeIcon= $filename;
-    }
-
-    if (file_exists($filename)){
-      $fd = fopen ($filename, "rb");
-      $this->iconData= fread ($fd, filesize ($filename));
-      session::set('binary',$this->iconData);
-      session::set('binarytype',"image/jpeg");
-      fclose ($fd);
-    }
-  }
-
-  /* Get picture link */
-  function get_picture()
-  {
-    session::set('binary',$this->iconData);
-    session::set('binarytype',"image/jpeg");
-    return("getbin.php");
-  }
-
-  /* Transports the given Arraykey one position up*/
-  function ArrayUp($atr,$attrs)
-  {
-    $ret = $attrs;
-    $pos = $this->getpos($atr,$attrs) ;
-    $cn = count($attrs);
-    if(!(($pos == -1)||($pos == 1))){
-      $before = array_slice($attrs,0,($pos-2));
-      $mitte  = array_reverse(array_slice($attrs,($pos-2),2));
-      $unten  = array_slice($attrs,$pos);
-      $ret = array();
-      $ret = $this->combineArrays($before,$mitte,$unten);
-    }
-    return($ret);
-  }
-
-
-  /* Transports the given Arraykey one position down*/
-  function ArrayDown($atr,$attrs)
-  {
-    $ret = $attrs;
-    $pos = $this->getpos($atr,$attrs) ;
-    $cn = count($attrs);
-    if(!(($pos == -1)||($pos == $cn))){
-      $before = array_slice($attrs,0,($pos-1));
-      $mitte  = array_reverse(array_slice($attrs,($pos-1),2));
-      $unten  = array_slice($attrs,($pos+1));
-      $ret = array();
-      $ret = $this->combineArrays($before,$mitte,$unten);
-    }
-    return($ret);
-  }
-
-
-  /* return the position of the element in the array */
-  function getpos($atr,$attrs)
-  {
-    $i = 0;
-    foreach($attrs as $attr => $name)    {
-      $i++;
-      if($attr == $atr){
-        return($i);
-      }
-    }
-    return(-1);
-  }
-
-
-  /* Remove this element from array */
-  function ArrayRemove($key,$array,$reorder = false)   
-  {
-    if(isset($array[$key])){
-      unset($array[$key]);
-      if($reorder){
-        $tmp = array();
-        foreach($array as $entry){
-          $tmp[] = $entry;
-        }
-        $array = $tmp;
-      }
-    }  
-    return($array);
-  }
-
-
-  /* Combine new array */
-  function combineArrays($ar0,$ar1,$ar2)
-  {
-    $ret = array();
-    if(is_array($ar0))
-      foreach($ar0 as $ar => $a){
-        $ret[]=$a;
-      }
-    if(is_array($ar1))
-      foreach($ar1 as $ar => $a){
-        $ret[]=$a;
-      }
-    if(is_array($ar2))
-      foreach($ar2 as $ar => $a){
-        $ret[]=$a;
-      }
-    return($ret);
-  }
-
-
-  /* Return a dialog with all fields that must be changed, 
-     if we want to copy this entry */
-  function getCopyDialog()
-  {
-    $str = "";
-
-    $smarty = get_smarty();
-    $smarty->assign("cn",              $this->cn);
-    $smarty->assign("description",  $this->description);
-    $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE,dirname(__FILE__)));
-
-    $ret = array();
-    $ret['string'] = $str;
-    $ret['status'] = "";
-    return($ret);
-  }
-
-
-  /* Save all */
-  function saveCopyDialog()
-  {
-    $attrs = array("cn","description");
-    foreach($attrs as $attr){
-      if(isset($_POST[$attr])){
-        $this->$attr = $_POST[$attr];
-      }
-    }
-  }
-
-  /* Return plugin informations for acl handling  */ 
-  static function plInfo()
-  {
-    return (array(
-          "plShortName"   => _("Generic"),
-          "plDescription" => _("Mime type generic"),
-          "plSelfModify"  => FALSE,
-          "plDepends"     => array(),
-          "plPriority"    => 0,
-          "plSection"     => array("administration"),
-          "plCategory"    => array("mimetypes" => array("description"  => _("Mime types"),
-                                                        "objectClass"  => "gotoMimeType")),
-          "plProvidedAcls"=> array(
-            "cn"                          => _("Name"),
-            "gotoMimeGroup"               => _("Mime group"),
-            "description"                 => _("Description"),
-            "base"                        => _("Base"),
-            "gotoMimeApplication"         => _("Application"),
-            "gotoMimeLeftClickAction"     => _("Left click action"),
-            "gotoMimeIcon"                => _("Icon"),
-            "gotoMimeFilePattern"         => _("File patterns"),
-            "gotoMimeEmbeddedApplication" => _("Embedded applications"))
-          ));
-
-  }
-
-  function PrepareForCopyPaste($source)
-  {
-    plugin::PrepareForCopyPaste($source);
-
-    $source_o = new mimetype($this->config,$source['dn'],$this->parent);
-
-    foreach(array("gotoMimeLeftClickAction_Q","gotoMimeEmbeddedApplication","gotoMimeApplication","gotoMimeFilePattern","gotoMimeIcon","iconData") as $name){
-      $use_attr     = "use_".$name;
-      if(isset($this->$use_attr)){
-        $this->$use_attr= $source_o->$use_attr;
-      }
-      $this->$name = $source_o->$name;
-    } 
-    foreach($this->attributes as $name){
-      $this->$name = $source_o->$name;
-    }
-
-    if($this->iconData){
-      $this->use_gotoMimeIcon ="Not emtpy, causes icon to be written.";
-    }
-  }
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/gosa-core/plugins/admin/mimetypes/class_mimetypeManagement.inc b/gosa-core/plugins/admin/mimetypes/class_mimetypeManagement.inc
deleted file mode 100644 (file)
index 7af6280..0000000
+++ /dev/null
@@ -1,666 +0,0 @@
-<?php
-/*
-   This code is part of GOsa (https://gosa.gonicus.de)
-   Copyright (C) 2003  Cajus Pollmeier
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-class mimetypeManagement extends plugin
-{
-  /* Definitions */
-  var $plHeadline     = "Mime types";
-  var $plDescription  = "Manage mime types";
-
-  /* Dialog attributes */
-  var $ui                             = NULL;
-  var $DivListMimeTypes               = NULL;
-  var $enableReleaseManagement        = false;
-  var $mimetabs                       = NULL;
-  var $snapDialog                     = NULL;
-  var $CopyPasteHandler               = NULL;
-  var $start_pasting_copied_objects = FALSE;
-
-
-  function mimetypeManagement (&$config, &$ui)
-  {
-    /* Save configuration for internal use */
-    $this->config   = &$config;
-    $this->ui       = &$ui;
-
-    /* Check if copy & paste is activated */
-    if($this->config->boolValueIsTrue("MAIN","ENABLECOPYPASTE")){
-      $this->CopyPasteHandler = new CopyPasteHandler($this->config);
-    }
-
-    /* Creat dialog object */
-    $this->DivListMimeTypes = new divListMimeTypes($this->config,$this);
-
-    if($this->IsReleaseManagementActivated()){
-
-      /* Check if we should enable the release selection */
-      $this->enableReleaseManagement = true;
-
-      /* Hide SubSearch checkbox */
-      $this->DivListMimeTypes->DisableCheckBox("SubSearch");
-    }
-
-  }
-
-
-  /* Get all releases */
-  function getReleases($base)
-  {
-    $ldap                   = $this->config->get_ldap_link();
-    $dn                     = get_ou('mimetypeou').$base;
-    $ret                    = array();
-    $ret [get_ou('mimetypeou').$base] = "/";    
-
-    $ldap->cd($dn);
-    $ldap->search("objectClass=organizationalUnit",array("ou"));
-
-    while($attrs = $ldap->fetch()){
-      $str = str_replace($dn,"",$attrs['dn']);
-      $tmp = array_reverse( split("ou=",$str));
-      $str = "";
-      foreach($tmp as $val){
-        $val = trim(preg_replace("/,/","",$val));
-        if(empty($val)) break;
-        $str .= "/".$val;
-      } 
-      if(!empty($str)){
-        $ret[$attrs['dn']]= preg_replace("/^\//","",$str);
-      }
-    }
-    asort($ret);
-    return($ret);
-  }
-
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-
-    /**************** 
-      Variable init 
-     ****************/
-
-    /* These vars will be stored if you try to open a locked mime, 
-        to be able to perform your last requests after showing a warning message */
-    session::set('LOCK_VARS_TO_USE',array("/^act$/","/^id$/","/^mime_edit_/","/^mime_del_/","/^item_selected/","/^remove_multiple_mimetypes/"));
-
-    $smarty       = get_smarty();             // Smarty instance
-    $s_action     = "";                       // Contains the action to proceed
-    $s_entry      = "";                       // The value for s_action
-    $base_back    = "";                       // The Link for Backbutton
-    
-    /* Test Posts */
-    foreach($_POST as $key => $val){
-      // Post for delete
-      if(preg_match("/mime_del.*/",$key)){
-        $s_action = "del";
-        $s_entry  = preg_replace("/mime_".$s_action."_/i","",$key);
-        // Post for edit
-      }elseif(preg_match("/mime_edit_.*/",$key)){
-        $s_action="edit";
-        $s_entry  = preg_replace("/mime_".$s_action."_/i","",$key);
-        // Post for new
-      }elseif(preg_match("/^copy_.*/",$key)){
-        $s_action="copy";
-        $s_entry  = preg_replace("/^copy_/i","",$key);
-      }elseif(preg_match("/^cut_.*/",$key)){
-        $s_action="cut";
-        $s_entry  = preg_replace("/^cut_/i","",$key);
-        // Post for new
-      }elseif(preg_match("/^mime_new.*/",$key)){
-        $s_action="new";
-      }elseif(preg_match("/^remove_multiple_mimetypes/",$key)){
-        $s_action="del_multiple";
-      }elseif(preg_match("/^editPaste.*/i",$key)){
-        $s_action="editPaste";
-      }elseif(preg_match("/^multiple_copy_mimetypes/",$key)){
-        $s_action = "copy_multiple";
-      }elseif(preg_match("/^multiple_cut_mimetypes/",$key)){
-        $s_action = "cut_multiple";
-      }
-    }
-
-    if((isset($_GET['act']))&&($_GET['act']=="edit_entry")){
-      $s_action ="edit";
-      $s_entry  = $_GET['id'];
-    }
-
-    $s_entry  = preg_replace("/_.$/","",$s_entry);
-
-
-    /* handle C&P from layers menu */
-    if(isset($_POST['menu_action']) && preg_match("/^multiple_copy_systems/",$_POST['menu_action'])){
-      $s_action = "copy_multiple";
-    }
-    if(isset($_POST['menu_action']) && preg_match("/^multiple_cut_systems/",$_POST['menu_action'])){
-      $s_action = "cut_multiple";
-    }
-    if(isset($_POST['menu_action']) && preg_match("/^editPaste/",$_POST['menu_action'])){
-      $s_action = "editPaste";
-    }
-
-    /* Create options */
-    if(isset($_POST['menu_action']) && $_POST['menu_action'] == "mime_new"){
-      $s_action = "new";
-    }
-
-    /* handle remove from layers menu */
-    if(isset($_POST['menu_action']) && preg_match("/^remove_multiple/",$_POST['menu_action'])){
-      $s_action = "del_multiple";
-    }
-
-    /**************** 
-      Copy & Paste handling  
-     ****************/
-
-    /* Display the copy & paste dialog, if it is currently open */
-    $ret = $this->copyPasteHandling_from_queue($s_action,$s_entry);
-    if($ret){
-      return($ret);
-    }
-
-
-    /**************** 
-      Create a new mime type 
-     ****************/
-
-    /* New mime type? */
-    $ui = get_userinfo();
-    $acl = $ui->get_permissions($this->DivListMimeTypes->selectedBase,"mimetypes/mimetype");
-    if (($s_action=="new") && preg_match("/c/",$acl)){
-
-      /* By default we set 'dn' to 'new', all relevant plugins will
-         react on this. */
-      $this->dn= "new";
-
-      /* Create new usertab object */
-      $this->mimetabs= new mimetabs($this->config, $this->config->data['TABS']['MIMETABS'], $this->dn,"mimetypes");
-      $this->mimetabs->set_acl_base($this->DivListMimeTypes->selectedBase);
-    }   
-
-
-    /**************** 
-      Edit entry canceled 
-     ****************/
-
-    /* Cancel dialogs */
-    if (isset($_POST['edit_cancel'])){
-      del_lock ($this->mimetabs->dn);
-      unset ($this->mimetabs);
-      $this->mimetabs= NULL;
-      session::un_set('objectinfo');
-    }
-
-
-    /**************** 
-      Edit entry finished 
-     ****************/
-
-    /* Finish mime edit is triggered by the tabulator dialog, so
-       the user wants to save edited data. Check and save at this point. */
-    if ((isset($_POST['edit_finish']) || isset($_POST['edit_apply']) ) && (isset($this->mimetabs->config))){
-
-      /* Check tabs, will feed message array */
-      $this->mimetabs->save_object();
-      $message= $this->mimetabs->check();
-
-      /* Save, or display error message? */
-      if (count($message) == 0){
-
-        /* Save data data to ldap */
-        $this->mimetabs->set_release($this->DivListMimeTypes->selectedRelease);
-        $this->mimetabs->save();
-
-        if (!isset($_POST['edit_apply'])){
-          /* Mime type has been saved successfully, remove lock from LDAP. */
-          if ($this->dn != "new"){
-            del_lock ($this->dn);
-          }
-          unset ($this->mimetabs);
-          $this->mimetabs= NULL;
-          session::un_set('objectinfo');
-        }
-      } else {
-        /* Ok. There seem to be errors regarding to the tab data,
-           show message and continue as usual. */
-        show_errors($message);
-      }
-    }
-
-
-    /**************** 
-      Edit entry  
-     ****************/
-
-    /* User wants to edit data? */
-    if (($s_action=="edit") && (!isset($this->mimetabs->config))){
-
-      /* Get 'dn' from posted 'mimelist', must be unique */
-      $this->dn= $this->mimetypes[$s_entry]['dn'];
-
-      /* Check locking, save current plugin in 'back_plugin', so
-         the dialog knows where to return. */
-      if (($user= get_lock($this->dn)) != ""){
-        return(gen_locked_message ($user, $this->dn));
-      }
-
-      /* Lock the current entry, so everyone will get the
-         above dialog */
-      add_lock ($this->dn, $this->ui->dn);
-
-
-      /* Register mimetabs to trigger edit dialog */
-      $this->mimetabs= new mimetabs($this->config,$this->config->data['TABS']['MIMETABS'], $this->dn,"mimetypes");
-      $this->mimetabs->set_acl_base($this->dn);
-      session::set('objectinfo',$this->dn);
-    }
-
-
-    /********************
-      Delete MULTIPLE entries requested, display confirm dialog
-     ********************/
-
-    if ($s_action=="del_multiple"){
-      $ids = $this->list_get_selected_items();
-
-      $this->dns = array();
-      if(count($ids)){
-
-        foreach($ids as $id){
-          $dn = $this->mimetypes[$id]['dn'];
-          if (($user= get_lock($dn)) != ""){
-            return(gen_locked_message ($user, $dn));
-          }
-          $this->dns[$id] = $dn;
-        }
-
-        $dns_names = "<br><pre>";
-        foreach($this->dns as $dn){
-          add_lock ($dn, $this->ui->dn);
-          $dns_names .= $dn."\n";
-        }
-        $dns_names .="</pre>";
-
-        /* Lock the current entry, so nobody will edit it during deletion */
-        if (count($this->dns) == 1){
-          $smarty->assign("intro",     sprintf(_("You're about to delete the following entry %s"), @LDAP::fix($dns_names)));
-        } else {
-          $smarty->assign("intro",     sprintf(_("You're about to delete the following entries %s"), @LDAP::fix($dns_names)));
-        }
-        $smarty->assign("multiple", true);
-        return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
-      }
-    }
-
-
-
-
-    /********************
-      Delete MULTIPLE entries confirmed
-     ********************/
-
-    /* Confirmation for deletion has been passed. Users should be deleted. */
-    if (isset($_POST['delete_multiple_mimetype_confirm'])){
-
-      $ui = get_userinfo();
-
-      /* Remove user by user and check acls before removeing them */
-      foreach($this->dns as $key => $dn){
-
-        $acl = $ui->get_permissions($dn,"mimetypes/mimetype");
-        if(preg_match("/d/",$acl)){
-
-          /* Delete request is permitted, perform LDAP action */
-          $this->mimetabs= new mimetabs($this->config, $this->config->data['TABS']['MIMETABS'], $dn,"mimetypes");
-          $this->mimetabs->set_acl_base($dn);
-          $this->mimetabs->delete ();
-          unset ($this->mimetabs);
-          $this->mimetabs= NULL;
-
-        } else {
-          /* Normally this shouldn't be reached, send some extra
-             logs to notify the administrator */
-          print_red (_("You are not allowed to delete this mime type!"));
-          new log("security","mimetypes/".get_class($this),$dn,array(),"Tried to trick deletion.");
-        }
-        /* Remove lock file after successfull deletion */
-        del_lock ($dn);
-        unset($this->dns[$key]);
-      }
-    }
-
-
-    /********************
-      Delete MULTIPLE entries Canceled
-     ********************/
-
-    /* Remove lock */
-    if(isset($_POST['delete_multiple_mimetype_cancel'])){
-      foreach($this->dns as $key => $dn){
-        del_lock ($dn);
-        unset($this->dns[$key]);
-      }
-    }
-
-
-    /**************** 
-      Delete mime type 
-     ****************/
-
-    /* Remove user was requested */
-    if ($s_action == "del"){
-
-      /* Get 'dn' from posted 'uid' */
-      $this->dn= $this->mimetypes[$s_entry]['dn'];
-
-      /* Load permissions for selected 'dn' and check if
-         we're allowed to remove this 'dn' */
-      $ui = get_userinfo();
-      $acl = $ui->get_permissions($this->dn,"mimetypes/mimetype");
-      if (preg_match("/d/",$acl)){
-
-        /* Check locking, save current plugin in 'back_plugin', so
-           the dialog knows where to return. */
-        if (($user= get_lock($this->dn)) != ""){
-          return (gen_locked_message ($user, $this->dn));
-        }
-
-        /* Lock the current entry, so nobody will edit it during deletion */
-        add_lock ($this->dn, $this->ui->dn);
-        $smarty= get_smarty();
-        $smarty->assign("intro", sprintf(_("You're about to delete the mime type '%s'."), @LDAP::fix($this->dn)));
-        $smarty->assign("multiple", false);
-        return($smarty->fetch (get_template_path('remove.tpl', TRUE)));
-      } else {
-
-        /* Obviously the user isn't allowed to delete. Show message and
-           clean session. */
-        print_red (_("You are not allowed to delete this mime type!"));
-      }
-    }
-
-
-    /**************** 
-      Delete mime confirmed 
-     ****************/
-
-    /* Confirmation for deletion has been passed. Group should be deleted. */
-    if (isset($_POST['delete_mime_confirm'])){
-
-      /* Some nice guy may send this as POST, so we've to check
-         for the permissions again. */
-      $ui = get_userinfo();
-      $acl = $ui->get_permissions($this->dn,"mimetypes/mimetype");
-      if(preg_match("/d/",$acl)){
-
-        /* Delete request is permitted, perform LDAP action */
-        $this->mimetabs= new mimetabs($this->config, $this->config->data['TABS']['MIMETABS'], $this->dn,"mimetypes");
-        $this->mimetabs->set_acl_base($this->dn);
-        $this->mimetabs->delete ();
-        unset ($this->mimetabs);
-        $this->mimetabs= NULL;
-
-      } else {
-
-        /* Normally this shouldn't be reached, send some extra
-           logs to notify the administrator */
-        print_red (_("You are not allowed to delete this mime type!"));
-        new log("security","mimetypes/".get_class($this),$dn,array(),"Tried to trick deletion.");
-      }
-
-      /* Remove lock file after successfull deletion */
-      del_lock ($this->dn);
-    }
-
-
-    /**************** 
-      Delete mime canceled 
-     ****************/
-
-    /* Delete mime type canceled? */
-    if (isset($_POST['delete_cancel'])){
-      del_lock ($this->dn);
-      session::un_set('objectinfo');
-    }
-
-    /* Show tab dialog if object is present */
-    if (($this->mimetabs) && (isset($this->mimetabs->config))){
-      $display= $this->mimetabs->execute();
-
-      /* Don't show buttons if tab dialog requests this */
-      if (!$this->mimetabs->by_object[$this->mimetabs->current]->dialog){
-        $display.= "<p style=\"text-align:right\">\n";
-        $display.= "<input type=\"submit\" name=\"edit_finish\" style=\"width:80px\" value=\""._("Ok")."\">\n";
-        $display.= "&nbsp;\n";
-        if ($this->dn != "new"){
-          $display.= "<input type=submit name=\"edit_apply\" value=\""._("Apply")."\">\n";
-          $display.= "&nbsp;\n";
-        }
-        $display.= "<input type=\"submit\" name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
-        $display.= "</p>";
-      }
-      return ($display);
-    }
-
-
-    /****************
-      Dialog display
-     ****************/
-
-        /* Check if there is a snapshot dialog open */
-    $base = $this->DivListMimeTypes->selectedBase;
-    if($str = $this->showSnapshotDialog($base,$this->get_used_snapshot_bases())){
-      return($str);
-    }
-
-    /* Display dialog with system list */
-    $this->DivListMimeTypes->parent = $this;
-    $this->DivListMimeTypes->execute();
-    $this->DivListMimeTypes->AddDepartments($this->DivListMimeTypes->selectedBase,3,1);
-    $this->reload();
-    $this->DivListMimeTypes->setEntries($this->mimetypes);
-    return($this->DivListMimeTypes->Draw());
-  }
-
-    
-  /* Return departments, that will be included within snapshot detection */
-  function get_used_snapshot_bases()
-  {
-    return(array($this->DivListMimeTypes->selectedRelease));
-  }
-
-
-
-  function reload()
-  {
-    $this->mimetypes= array();
-
-    /* Set base for all searches */
-    $base       = $this->DivListMimeTypes->selectedBase;
-    $release    = $this->DivListMimeTypes->selectedRelease;
-    $Regex      = $this->DivListMimeTypes->Regex;
-    $SubSearch  = $this->DivListMimeTypes->SubSearch; 
-    $Flags      =  GL_NONE | GL_SIZELIMIT;
-    $Filter     = "(&(|(cn=".$Regex.")(description=".$Regex."))(objectClass=gotoMimeType))";
-    $tmp        = array();
-    $Releases   = $this->getReleases($base);
-
-
-    /* If release management is enabled, use release as base. */
-    if(!$this->enableReleaseManagement){
-      $use_base = $base;
-    }else{
-      if(isset($Releases[$release])){
-        $use_base  = $release;
-      }else{
-        $use_base  = $base;
-      }
-    }
-
-    /* In case of subsearch, add the subsearch flag */
-    if($SubSearch){
-      $Flags    |= GL_SUBSEARCH;  
-    }else{
-      if(!$this->enableReleaseManagement){
-        $use_base = get_ou('mimetypeou').$use_base;
-      }
-    }
-  
-    /* Get results and create index */ 
-    $res= get_sub_list($Filter, "mimetypes",get_ou('mimetypeou'), $use_base, array("cn","description","dn","objectClass"), $Flags);
-    $tmp2 = array();
-    foreach ($res as $val){
-      $tmp[strtolower($val['cn'][0]).$val['cn'][0].$val['dn']]=$val;
-      $tmp2[strtolower($val['cn'][0]).$val['cn'][0].$val['dn']] = strtolower($val['cn'][0]).$val['cn'][0].$val['dn'];
-    }
-
-    /* sort entries */
-    natcasesort($tmp2);
-    $this->mimetypes=array();
-    foreach($tmp2 as $val){
-      $this->mimetypes[]=$tmp[$val];
-    }
-    reset ($this->mimetypes);
-  }
-
-  function remove_from_parent()
-  {
-    /* Optionally execute a command after we're done */
-    $this->postremove();
-  }
-
-
-  function copyPasteHandling_from_queue($s_action,$s_entry)
-  {
-    /* Check if Copy & Paste is disabled */
-    if(!is_object($this->CopyPasteHandler)){
-      return("");
-    }
-
-    /* Add a single entry to queue */
-    if($s_action == "cut" || $s_action == "copy"){
-
-      /* Cleanup object queue */
-      $this->CopyPasteHandler->cleanup_queue();
-      $this->start_pasting_copied_objects = FALSE;
-      $dn = $this->mimetypes[$s_entry]['dn'];
-      $this->CopyPasteHandler->add_to_queue($dn,$s_action,"mimetabs","MIMETABS","mimetypes");
-    }
-
-    /* Add entries to queue */
-    if($s_action == "copy_multiple" || $s_action == "cut_multiple"){
-
-      /* Cleanup object queue */
-      $this->CopyPasteHandler->cleanup_queue();
-      $this->start_pasting_copied_objects = FALSE;
-  
-      /* Add new entries to CP queue */
-      foreach($this->list_get_selected_items() as $id){
-        $dn = $this->mimetypes[$id]['dn'];
-
-        if($s_action == "copy_multiple"){
-          $this->CopyPasteHandler->add_to_queue($dn,"copy","mimetabs","MIMETABS","mimetypes");
-        }
-        if($s_action == "cut_multiple"){
-          $this->CopyPasteHandler->add_to_queue($dn,"cut","mimetabs","MIMETABS","mimetypes");
-        }
-      }
-    }
-
-    /* Start pasting entries */
-    if($s_action == "editPaste"){
-      $this->start_pasting_copied_objects = TRUE;
-    }
-
-    /* Return C&P dialog */
-    if($this->start_pasting_copied_objects && $this->CopyPasteHandler->entries_queued()){
-
-      /* Load entry from queue and set base */
-      $this->CopyPasteHandler->load_entry_from_queue();
-      $this->CopyPasteHandler->SetVar("base",$this->DivListMimeTypes->selectedBase);
-
-      /* Get dialog */
-      $data = $this->CopyPasteHandler->execute();
-
-      /* Return dialog data */
-      if(!empty($data)){
-        return($data);
-      }
-    }
-
-    /* Automatically disable status for pasting */
-    #if(!$this->CopyPasteHandler->entries_queued()){
-    #  $this->start_pasting_copied_objects = FALSE;
-    #}
-    return("");
-  }
-
-
-  /* Check if the release management is activated. */
-  function IsReleaseManagementActivated()
-  {
-    /* Check if we should enable the release selection */
-    $tmp = $this->config->search("faiManagement", "CLASS",array('menu','tabs'));
-    if(!empty($tmp)){
-      return(true);
-    }
-    return(false);
-  }
-
-
-  function list_get_selected_items()
-  {
-    $ids = array();
-    foreach($_POST as $name => $value){
-      if(preg_match("/^item_selected_[0-9]*$/",$name)){
-        $id   = preg_replace("/^item_selected_/","",$name);
-        $ids[$id] = $id;
-      }
-    }
-    return($ids);
-  }
-
-
-  /* Save to LDAP */
-  function save()
-  {
-    /* Optionally execute a command after we're done */
-    $this->postcreate();
-  }
-
-  function remove_lock()
-  {
-    if (isset($this->mimetabs->dn)){
-      del_lock ($this->mimetabs->dn);
-    }
-  }
-
-  function save_object() {
-    $this->DivListMimeTypes->save_object();
-  }
-
-  function check() {}
-  function adapt_from_template($dn) {}
-  function password_change_needed() {}
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/gosa-core/plugins/admin/mimetypes/generic.tpl b/gosa-core/plugins/admin/mimetypes/generic.tpl
deleted file mode 100644 (file)
index 1cb6d75..0000000
+++ /dev/null
@@ -1,199 +0,0 @@
-<table style="width:100%">
-       <tr>
-               <td colspan="2">
-                       <h2><img src='images/list_mime.png' class='center' alt='[M]'>&nbsp;{t}Generic{/t}</h2>
-               </td>
-       </tr>
-       <tr>
-               <td style='width:50%; vertical-align:top;' >
-                       <table>
-                               <tr>
-                                       <td>
-                                               {t}Mime type{/t}{$must}
-                                       </td>
-                                       <td>
-{render acl=$gotoMimeGroupACL}
-                                               <input type="text" name='cn' value="{$cn}" title='{t}Please enter a name for the mime type here{/t}'>
-{/render}
-                                       </td>
-                               </tr>
-                               <tr>
-                                       <td>
-                                               {t}Mime group{/t}
-                                       </td>
-                                       <td>
-{render acl=$gotoMimeGroupACL}
-                                               <select name='gotoMimeGroup' title='{t}Categorize this mime type{/t}'>
-                                                       {html_options output=$gotoMimeGroups values=$gotoMimeGroups selected=$gotoMimeGroup}
-                                               </select>
-{/render}
-                                       </td>
-                               </tr>
-                               <tr>
-                                       <td>
-                                               {t}Description{/t}
-                                       </td>
-                                       <td>
-{render acl=$descriptionACL}
-                                               <input type="text" name='description' value="{$description}" title='{t}Please specify a description{/t}'>
-{/render}
-                                       </td>
-                               </tr>
-{if !$isReleaseMimeType} 
-                               <tr>
-                                       <td><LABEL for="base">{t}Base{/t}{$must}</LABEL></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/folder_gray.png'}
-                       <input type="image" name="chooseBase" src="images/folder.png" class="center" title="{t}Select a base{/t}">
-               {/render}
-       {/if}
-                                       </td>
-                                </tr>
-
-{/if}
-                       </table>
-                       
-               </td>
-               <td style="border-left:1px solid #A0A0A0;vertical-align:top;">
-                       <table summary="">
-                               <tr>
-                                       <td>
-                                               <LABEL for="picture_file">{t}Icon{/t}</LABEL><br>
-                                               <img src="{$gotoMimeIcon}" border=1 alt='{t}Mime icon{/t}' 
-                                                       style="width:48px; height:48; background-color:white; vertical-align:bottom;">
-                                       </td>
-                                       <td style="vertical-align:top">
-                                               &nbsp;<br>
-                                               <input type="hidden" name="MAX_FILE_SIZE" value="100000">
-{render acl=$gotoMimeIconACL}
-                                               <input name="picture_file" type="file" size="20" maxlength="255" 
-                                                       accept="image/*.png" id="picture_file">
-{/render}
-{render acl=$gotoMimeIconACL}
-                                               <input type="submit" name="update_icon" value="{t}Update{/t}" 
-                                                       title="{t}Update mime type icon{/t}">
-{/render}
-                                       </td>
-                               </tr>
-                       </table>
-               </td>
-       </tr>
-       <tr>
-               <td colspan="2">
-                       <p class='seperator'>&nbsp;</p>
-               </td>
-       </tr>
-       <tr>
-               <td colspan="2">
-                       <h2><img src='images/mime_leftclick.png' class='center' alt='{t}Left click{/t}'>&nbsp;{t}Left click{/t}</h2>
-               </td>
-       </tr>
-       <tr>
-               <td style='width:50%; vertical-align:top;' >
-                       {t}File patterns{/t}{$must}
-{render acl=$gotoMimeFilePatternACL}   
-                       {$gotoMimeFilePatterns} 
-{/render}
-
-{render acl=$gotoMimeFilePatternACL}   
-                       <input type='text'       name='NewFilePattern'    value='' title='{t}Please specify a new file pattern{/t}'>
-{/render}
-{render acl=$gotoMimeFilePatternACL}   
-                       <input type='submit' name='AddNewFilePattern' value='{t}Add{/t}' title='{t}Add a new file pattern{/t}'>
-{/render}
-               </td>
-               <td style="border-left:1px solid #A0A0A0;vertical-align:top;">
-                       {t}Applications{/t}
-{render acl=$gotoMimeApplicationACL}   
-                       {$gotoMimeApplications}         
-{/render}
-
-{render acl=$gotoMimeApplicationACL}   
-                       <select name="NewApplicationSelect">
-                               <option value="">-</option>
-                               {html_options options=$ApplicationList}
-                       </select>
-{/render}
-{render acl=$gotoMimeApplicationACL}   
-                       <input type='text'       name='NewApplication'    value='' title='{t}Enter an application name here{/t}'>
-{/render}
-{render acl=$gotoMimeApplicationACL}   
-                       <input type='submit' name='AddNewApplication' value='{t}Add{/t}' title='{t}Add application{/t}'>
-{/render}
-               </td>
-       </tr>
-       <tr>    
-               <td colspan="2">
-                       <p class='seperator'>&nbsp;</p>
-               </td>
-       </tr>
-       <tr>    
-               <td colspan="2">
-                       <h2><img src='images/mime_embedding.png' class='center' alt='{t}Embedding{/t}'>&nbsp;{t}Embedding{/t}</h2>
-               </td>
-       </tr>
-       <tr>
-               <td style='width:50%; vertical-align:top;' >
-                               
-                       <table>
-                               <tr>
-                                       <td style='vertical-align:top; '>
-{render acl=$gotoMimeLeftClickActionACL}
-                                               <input type='radio' name='gotoMimeLeftClickAction_IE' value='I' 
-                                                       {if $gotoMimeLeftClickAction_I} checked {/if}>
-{/render}
-                                               {t}Show file in embedded viewer{/t}
-                                               <br>
-
-{render acl=$gotoMimeLeftClickActionACL}
-                                               <input type='radio' name='gotoMimeLeftClickAction_IE' value='E' 
-                                                       {if $gotoMimeLeftClickAction_E} checked {/if}>
-{/render}
-                                               {t}Show file in external viewer{/t}
-                                               <br>
-
-{render acl=$gotoMimeLeftClickActionACL}
-                                               <input type='checkbox' name='gotoMimeLeftClickAction_Q' value='1' 
-                                                       {if $gotoMimeLeftClickAction_Q} checked {/if}>
-{/render}
-                                               {t}Ask whether to save to local disk{/t}
-                                       </td>
-                               </tr>
-                       </table>
-                       
-               </td>
-               <td style="border-left:1px solid #A0A0A0;vertical-align:top;">
-                       {t}Applications{/t}
-{render acl=$gotoMimeEmbeddedApplicationACL}
-                       {$gotoMimeEmbeddedApplications}         
-{/render}
-{render acl=$gotoMimeEmbeddedApplicationACL}
-                       <select name="NewEmbeddedApplicationSelect">
-                               <option value="">-</option>
-                               {html_options options=$ApplicationList}
-                       </select>
-{/render}
-{render acl=$gotoMimeEmbeddedApplicationACL}
-                       <input type='text'       name='NewEmbeddedApplication'    value='' 
-                               title='{t}Enter an application name here{/t}'>
-{/render}
-{render acl=$gotoMimeEmbeddedApplicationACL}
-                       <input type='submit' name='AddNewEmbeddedApplication' value='{t}Add{/t}' 
-                               title='{t}Add application{/t}'>
-{/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>
diff --git a/gosa-core/plugins/admin/mimetypes/main.inc b/gosa-core/plugins/admin/mimetypes/main.inc
deleted file mode 100644 (file)
index de92142..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-<?php
-/*
-   This code is part of GOsa (https://gosa.gonicus.de)
-   Copyright (C) 2003  Cajus Pollmeier
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-if ($remove_lock){
-               if(session::is_set('MimeTypeManagement')){
-                               $MimeTypeManagement = session::get('MimeTypeManagement');
-                               $MimeTypeManagement->remove_lock();
-                               del_lock ($ui->dn);
-                               session::un_set ('MimeTypeManagement');
-               }
-} else {
-
-               /* Create MimeTypeManagement object on demand */
-               if (!session::is_set('MimeTypeManagement') || (isset($_GET['reset']) && $_GET['reset'] == 1)){
-                       session::set('MimeTypeManagement',new mimetypeManagement ($config, $ui));
-               }
-
-               /* Get object */
-               $MimeTypeManagement = session::get('MimeTypeManagement');
-               $MimeTypeManagement->save_object();
-               $output= $MimeTypeManagement->execute();
-
-               /* Page header*/
-               if (session::is_set('objectinfo')){
-                               $display= print_header(get_template_path('images/mimetypes.png'), _("Mimetype management"), "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png')."\"> ".@LDAP::fix(session::get('objectinfo')));
-               } else {
-                               $display= print_header(get_template_path('images/mimetypes.png'), _("Mimetype management"));
-               }
-
-               /* Reset requested? */
-               if (isset($_GET['reset']) && $_GET['reset'] == 1){
-                               del_lock ($ui->dn);
-                               session::un_set ('MimeTypeManagement');
-               }
-
-               /* Show and save dialog */
-               $display.= $output;
-               session::set('MimeTypeManagement',$MimeTypeManagement);
-}
-?>
diff --git a/gosa-core/plugins/admin/mimetypes/paste_generic.tpl b/gosa-core/plugins/admin/mimetypes/paste_generic.tpl
deleted file mode 100644 (file)
index 34b5e07..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-<table style="width:100%">
-       <tr>
-               <td colspan="2">
-                       <h2><img src='images/head.png' class='center'>&nbsp;{t}Generic{/t}</h2>
-               </td>
-       </tr>
-       <tr>
-               <td style='width:50%; vertical-align:top;' >
-                               
-                       <table>
-                               <tr>
-                                       <td>
-                                               {t}Mime type{/t}
-                                       </td>
-                                       <td>
-                                               <input type="text" name='cn' value="{$cn}" title='{t}Please enter a name for the mime type here{/t}'>
-                                       </td>
-                               </tr>
-                               <tr>
-                                       <td>
-                                               {t}Description{/t}
-                                       </td>
-                                       <td>
-                                               <input type="text" name='description' value="{$description}" title='{t}Please specify a description for this mime type here{/t}'>
-                                       </td>
-                               </tr>
-                       </table>
-                       
-               </td>
-       </tr>
-</table>
diff --git a/gosa-core/plugins/admin/mimetypes/release_select.tpl b/gosa-core/plugins/admin/mimetypes/release_select.tpl
deleted file mode 100644 (file)
index d58738f..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-<br> 
-<div class="contentboxh" style="border-bottom:1px solid #B0B0B0;">
- <p class="contentboxh"><img src="{$branchimage}" align="right" alt="[F]">{t}Branches{/t}</p>
-</div>
-<div class="contentboxb">
- <table summary="" style="width:100%;">
-  <tr>
-   <td>
-    {t}Current release{/t}&nbsp;
-    <select name="selectedRelease" onChange="document.mainform.submit();">
-     {html_options options=$releases selected=$selectedRelease}
-    </select>
-   </td>
-  </tr>
- </table>
-</div>
diff --git a/gosa-core/plugins/admin/mimetypes/remove.tpl b/gosa-core/plugins/admin/mimetypes/remove.tpl
deleted file mode 100644 (file)
index 30c4233..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-<div style="font-size:18px;">
-  <img alt="" src="images/button_cancel.png" align=top>&nbsp;{t}Warning{/t}
-</div>
-<p>
- {$intro}
- {t}This may be used by several groups. Please double check if your really want to do this since there is no way for GOsa to get your data back.{/t}
-</p>
-<p>
- {t}So - if you're sure - press 'Delete' to continue or 'Cancel' to abort.{/t}
-</p>
-
-<p class="plugbottom">
-       {if $multiple}
-               <input type=submit name="delete_multiple_mimetype_confirm" value="{t}Delete{/t}">
-               &nbsp;
-               <input type=submit name="delete_multiple_mimetype_cancel" value="{t}Cancel{/t}">
-       {else}
-               <input type=submit name="delete_mime_confirm" value="{t}Delete{/t}">
-               &nbsp;
-               <input type=submit name="delete_cancel" value="{t}Cancel{/t}">
-       {/if}
-</p>
-
diff --git a/gosa-core/plugins/admin/mimetypes/tabs_mimetypes.inc b/gosa-core/plugins/admin/mimetypes/tabs_mimetypes.inc
deleted file mode 100644 (file)
index 38570fd..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-<?php
-
-class mimetabs extends tabs
-{
-  var $Release= "";
-
-  function mimetabs($config, $data, $dn,$category)
-  {
-    tabs::tabs($config, $data, $dn,$category);
-
-    /* Add references/acls/snapshots */
-    $this->addSpecialTabs();
-  }
-
-  function set_release($newRelease)
-  {
-    $this->Release= preg_replace('/,'.get_ou('mimetypeou').'.*$/', '', $newRelease);
-    if ($this->Release != ""){
-      $this->Release= ",".$this->Release;
-    }
-  }
-
-  function save($ignore_account= FALSE)
-  {
-    $baseobject= $this->by_object['mimetype'];
-
-    /* Check for new 'dn', in order to propagate the
-       'dn' to all plugins */
-    $tmp = $this->config->search("faiManagement", "CLASS",array('menu','tabs'));
-
-    $mimefilter = session::get('mimefilter');
-
-    if((!empty($tmp)) && (isset($mimefilter['release']))){
-      if(!$baseobject->isReleaseMimeType){
-        $new_dn= "cn=".$baseobject->cn.",".get_ou('mimetypeou').$baseobject->base;
-      }else{
-        $new_dn ="cn=".$baseobject->cn.",".$mimefilter['release'];
-      }
-    }else{
-      $new_dn= "cn=".$baseobject->cn.",".get_ou('mimetypeou').$baseobject->base;
-    }
-
-    /* Move group? */
-    if ($this->dn != $new_dn){
-
-      /* Write entry on new 'dn' */
-      if ($this->dn != "new"){
-        $baseobject->move($this->dn, $new_dn);
-        $this->by_object['mimetype']= $baseobject;
-      }
-
-      /* Happen to use the new one */
-      $this->dn= $new_dn;
-    }
-
-    tabs::save();
-  }
-
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/gosa-core/plugins/personal/environment/class_environment.inc b/gosa-core/plugins/personal/environment/class_environment.inc
deleted file mode 100644 (file)
index fe0be1d..0000000
+++ /dev/null
@@ -1,1772 +0,0 @@
-<?php
-
-class environment extends plugin
-{
-  /* CLI vars */
-  var $cli_summary          = "Manage server basic objects";
-  var $cli_description      = "Some longer text\nfor help";
-  var $cli_parameters       = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
-  /* attribute list for save action */
-  var $ignore_account       = FALSE;
-  var $plHeadline           = "Environment";
-  var $plDescription        = "This does something";
-  var $dialog               = false;    // Indicates that we are currently editing in an seperate dialog
-  
-  var $in_dialog            = false;
-  var $uid                  = "";
-
-  var $is_group             = false;
-  var $view_logged = FALSE;
-  
-  /* Attribute definition
-   */
-
-  /* profile management */
-  var $useProfile         = false;  // Specifies if we want to use a Server 
-  var $gotoProfileServer  = "";     // Specifies the selected profile server
-  var $gotoProfileServers = array();// Specifies all available and selectable servers
-  var $gotoProfileFlags   = "";     // Flags enabled  ? only used to set ACL and save 
-  var $gotoProfileFlagC  = "";     // Flag is set to C if we have the profile caching fucntion enabled 
-  
-  var $gotoXResolution    = "auto";     // The selected resolution eg: 1024x768
-  var $gotoXResolutions   = array();// Contains all available resolutions for this account
-  var $gotoProfileFlagL  = "";     // Flag is set to L to enable runtime resolution change 
-  var $gotoProfileQuota   = "";     // User Quota Settings
-
-  /* Logon script section*/
-  var $gotoLogonScripts   = array();// Contains all available Logon Scripts  
-  var $gotoLogonScript    = "";     // The selected Logon Script
-
-  /* Printer */
-  var $gotoPrinter        = array();// All available Printer, with their configurations
-  var $gotoPrinterSel     = "";     //  The selected Printer
-  var $gosaDefaultPrinter = "";     // Default printer
-
-  /* Share */
-  var $gotoShares         = array();// Current Share Options
-  var $gotoShare          = "";     // currently selected Share Option
-  var $gotoShareSelections= array();// Available Shares for this account in Listbox format
-  var $gotoAvailableShares= array();// Available Shares for this account
-
-  /* Kiosk profile */
-  var $kiosk_enabled      = FALSE;
-  var $gotoKioskProfile   = "";     // The selected Kiosk Profile
-  var $gotoKioskProfile_Server    = "";     // The selected Kiosk Profile
-  var $gotoKioskProfile_Profile   = "";     // The selected Kiosk Profile
-  var $gotoKioskProfiles  = array();// All available Kiosk profiles
-
-  /* Hotplug Devices */
-  var $gotoHotplugDevice  = array();     // Selected hotplug
-  var $gotoHotplugDevices = array();// Already configured hotplug devices 
-  var $gotoHotplugDeviceDN= array();
-
-  var $NewAddedPrinters   = array();
-  var $NewDeletedPrinters = array();
-
-  /* general settings */
-  // Sets the attributes which will kept on page reload, which will be saved, ...
-
-  var $CopyPasteVars      = array("gotoHotplugDevices","gotoAvailableShares","gotoShareSelections","gotoPrinterSel","gotoProfileFlagL","gotoXResolutions","gotoProfileFlagC","gotoProfileServers","useProfile","is_group","in_dialog","OrigCn","gotoKioskProfile_Server","gotoKioskProfile_Profile");
-
-  var $attributes         = array("uid","gotoProfileServer","gotoProfileFlags","gotoHotplugDeviceDN",
-      "gotoXResolution","gotoProfileQuota",
-      "gotoLogonScripts","gotoLogonScript",
-      "gotoPrinter", "gosaDefaultPrinter",
-      "gotoShares","gotoShare",
-      "gotoKioskProfile");
-  var $objectclasses      = array("gotoEnvironment"); // Specifies the objectClass which contains the attributes edited here 
-  var $cn;
-  var $OrigCn;
-  var $add_del_printer_member_was_called = false;
-
-  var $multiple_support =TRUE;
-
-  var $use_gotoPrinter;
-
-  function environment (&$config, $dn= NULL)
-  {
-    plugin::plugin ($config, $dn);
-
-    /* Setting uid to default */
-    if(isset($this->attrs['uid'][0])){
-      $this->uid = $this->attrs['uid'][0];
-    }
-
-    /* Check : Are we currently editing a group or user dialog */
-    if((isset($this->attrs['cn'][0]))&&(!isset($this->attrs['uid'][0]))){
-      $suffix="Group";
-      $this->uid          = $this->attrs['cn'][0];
-      $this->attrs['uid'] = $this->attrs['cn'][0];
-      $this->OrigCn = $this->attrs['cn'][0];
-    }else{
-      $suffix="User";
-    }
-
-    /* Get all Printer assignments */
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cd($this->config->current['BASE']);
-    $ldap->search("(&(objectClass=gotoPrinter)(goto".$suffix."Printer=".$this->uid."))",array("*"));
-    while($printer = $ldap->fetch()){
-      $this->gotoPrinter[$printer['cn'][0]]=$printer;
-      $this->gotoPrinter[$printer['cn'][0]]['mode']="user";
-    }
-    $ldap->search("(&(objectClass=gotoPrinter)(goto".$suffix."AdminPrinter=".$this->uid."))",array("*"));
-    while($printer = $ldap->fetch()){
-      $this->gotoPrinter[$printer['cn'][0]]=$printer;
-      $this->gotoPrinter[$printer['cn'][0]]['mode']="admin";
-    }
-
-
-    /* Prepare hotplugs */
-    if(isset($this->attrs['gotoHotplugDeviceDN']) && is_array($this->attrs['gotoHotplugDeviceDN'])){
-      $ldap = $this->config->get_ldap_link();
-      $ldap->cd($this->config->current['BASE']);
-      for($i = 0 ; $i < $this->attrs['gotoHotplugDeviceDN']['count'] ; $i ++){
-        $ldap->cat($this->attrs['gotoHotplugDeviceDN'][$i]);
-        if($ldap->count()){
-          $attrs = $ldap->fetch(); 
-
-          if(isset($attrs['gotoHotplugDevice'][0])){
-            $tmp      = preg_split("/\|/",$attrs['gotoHotplugDevice'][0]);
-            $tmp2     = array();
-            $tmp2['name']         = $attrs['cn'][0];
-            $tmp2['description']  = $tmp[0];
-            $tmp2['id']           = $tmp[1];
-            $tmp2['produkt']      = $tmp[2];
-            $tmp2['vendor']       = $tmp[3];
-            $tmp2['dn']           = $attrs['dn'];
-            $this->gotoHotplugDevices[] = $tmp2; 
-          }
-        }else{
-          msg_dialog::display(_("Warning"), sprintf(_("Device '%s' is not available anymore. It will be removed!"), $this->attrs['gotoHotplugDeviceDN'][$i]), WARNING_DIALOG);
-        }
-      }
-    }
-
-    /* prepare LogonScripts */
-    if((isset($this->attrs['gotoLogonScript']))&&(is_array($this->attrs['gotoLogonScript']))){
-      unset($this->attrs['gotoLogonScript']['count']);
-      foreach($this->attrs['gotoLogonScript'] as $device){
-        $tmp = $tmp2 = array();
-        $tmp = split("\|",$device);
-        $tmp2['LogonName']        = $tmp[0]; 
-        $tmp2['LogonPriority']    = $tmp[2]; 
-        if(preg_match("/O/i",$tmp[1])){
-          $tmp2['LogonOverload'] = "O";
-        }else{
-          $tmp2['LogonOverload'] = "";
-        }
-        if(preg_match("/L/i",$tmp[1])){
-          $tmp2['LogonLast'] = "L";
-        }else{
-          $tmp2['LogonLast'] = "";
-        }
-        $tmp2['LogonData']        = base64_decode($tmp[3]); 
-        $tmp2['LogonDescription'] = $tmp[4];
-        $this->gotoLogonScripts[$tmp[0]]=$tmp2;
-      }
-    }
-
-    /* Prepare Shares */
-    if((isset($this->attrs['gotoShare']))&&(is_array($this->attrs['gotoShare']))){
-      unset($this->attrs['gotoShare']['count']);
-      foreach($this->attrs['gotoShare'] as $share){
-        $tmp = $tmp2 = array();
-        $tmp = split("\|",$share);
-        $tmp2['server']      =$tmp[0];
-        $tmp2['name']        =$tmp[1];
-
-        /* Decode base64 if needed */
-        if (!preg_match('%/%', $tmp[2])){
-          $tmp2['mountPoint']  =base64_decode($tmp[2]);
-        } else {
-          $tmp2['mountPoint']  =$tmp[2];
-        }
-
-        if(isset($tmp[3])){
-          $tmp2['PwdHash']  =$tmp[3];
-        }else{
-          $tmp2['PwdHash']  ="";
-        }
-        if(isset($tmp[4])){
-          $tmp2['Username']  =$tmp[4];
-        }else{
-          $tmp2['Username']  ="";
-        }
-        $this->gotoShares[$tmp[1]."|".$tmp[0]]=$tmp2;
-      }
-    }
-
-    for($i = 0 ; $i < strlen($this->gotoProfileFlags) ; $i ++){
-      $chr = $this->gotoProfileFlags[$i];
-      $name = "gotoProfileFlag".$chr;
-      $this->$name=$chr;
-    }
-
-    if((!empty($this->gotoProfileServer))||($this->gotoProfileFlagC=="C")){
-      $this->useProfile = true;
-    }else{
-      $this->useProfile = false;
-    }
-
-    /* Set resolutions */
-    $this->gotoXResolutions = array("auto"=>_("auto"),
-                                    "640x480"   =>  "640x480",
-                                    "800x600"   =>  "800x600",
-                                    "1024x768"  =>  "1024x768",
-                                    "1152x864"  =>  "1152x864",
-                                    "1280x768"  =>  "1280x768",
-                                    "1280x1024" =>  "1280x1024");
-
-    if(isset($this->config->data['MAIN']['RESOLUTION_HOOK'])){
-      $file = $this->config->data['MAIN']['RESOLUTION_HOOK'];
-
-      if(is_readable($file)){
-        $str = file_get_contents($file);
-        $lines = split("\n",$str);
-        foreach($lines as $line){
-          $line = trim($line);
-          if(!empty($line)){
-            $this->gotoXResolutions[$line]=$line;
-          }
-        }
-        //natcasesort($this->gotoXResolutions);
-      }else{
-        msg_dialog::display(_("Configuration error"), sprintf(_("Cannot open file '%s'!"), $file), WARNING_DIALOG);
-      }
-    }
-
-    $this->gotoProfileServers= $config->getShareServerList() ;
-    $this->gotoShareSelections= $config->getShareList(true);
-    $this->gotoAvailableShares= $config->getShareList(false);  
-
-    $this->update_kiosk_profiles();
-  
-    $this->gotoKioskProfile= preg_replace("/^.*\//i","",$this->gotoKioskProfile);
-  }
-
-
-  function update_kiosk_profiles()
-  { 
-    $tmp1  = array("none" => array(_("disabled")));
-    $tmp2  = array("none" => _("disabled"));
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cd($this->config->current['BASE']);
-    $ldap->search("(&(objectClass=goEnvironmentServer)(gotoKioskProfile=*)(cn=*))",array("cn","gotoKioskProfile"));
-    $cnt = 0;
-    while($attrs = $ldap->fetch()){
-      for($i = 0 ; $i < $attrs['gotoKioskProfile']['count'] ; $i ++){
-        $name = preg_replace("/^.*kiosk\//","",$attrs['gotoKioskProfile'][$i]);
-        $tmp1[$attrs['cn'][0]][] = $name;
-      }
-      $tmp2[$attrs['cn'][0]]= $attrs['cn'][0];
-      $cnt ++;
-    }
-
-    if($cnt && $this->config->search("environment","kioskpath",array('menu','tabs'))){
-      $this->kiosk_enabled = TRUE;
-    }
-
-    $this->gotoKioskProfiles['BY_SERVER'] = $tmp1;
-    $this->gotoKioskProfiles['SERVERS']   = $tmp2;
-  
-    $this->gotoKioskProfile_Server = preg_replace("/^.*:\/\/([^\/]*).*$/","\\1",$this->gotoKioskProfile);
-    $this->gotoKioskProfile_Profile= preg_replace("/^.*\//","",$this->gotoKioskProfile);
-
-    $error = false;
-    if(!in_array($this->gotoKioskProfile_Server, $this->gotoKioskProfiles['SERVERS'])){
-      $this->gotoKioskProfile_Server = key($this->gotoKioskProfiles['SERVERS']);
-      $error = true;
-    }
-    if(!in_array($this->gotoKioskProfile_Profile, $this->gotoKioskProfiles['BY_SERVER'][$this->gotoKioskProfile_Server])){
-      $this->gotoKioskProfile_Profile = $this->gotoKioskProfiles['BY_SERVER'][$this->gotoKioskProfile_Server][0];
-      $error = true;
-    }
-    if($error && !empty($this->gotoKioskProfile)){
-      $this->gotoKioskProfile_Server ="none";
-      $this->gotoKioskProfile_Profile="";
-      msg_dialog::display(_("Warning"), sprintf(_("Kiosk profile '%s' located on server '%s' is not available anymore. Kiosk profile will be disabled!"), $this->gotoKioskProfile_Profile, $this->gotoKioskProfile_Server), WARNING_DIALOG);
-    }
-  }
-
-
-  /* Detect type of edited object (user|group)*/
-  function detect_grouptype()
-  {
-    if((!isset($this->parent))&&(!$this->is_account)){
-      $this->is_group     = false;
-    }elseif((isset($this->parent))&&(!isset($this->parent->by_object['posixAccount']))){
-      $this->is_group     = true;
-    }else{
-      $this->is_group     = false;
-    }
-  }
-
-
-  function execute()
-  {
-
-    /* Call parent execute */
-    plugin::execute();
-    /* Log view */
-    if($this->is_account && !$this->view_logged){
-      $this->view_logged = TRUE;
-      if(isset($this->parent->by_object['user']) || (isset($this->attrs['objectClass']) &&in_array("gosaAccount",$this->attrs['objectClass']))){
-        new log("view","users/".get_class($this),$this->dn);
-      }else{
-        new log("view","groups/".get_class($this),$this->dn);
-      }
-    }
-
-    /* Are we editing from MyAccount and not editing a user */
-    $WriteOnly = (!isset($this->parent)|| !$this->parent) && !session::is_set('edit');
-
-    /* Check profile server */
-    if($this->acl_is_writeable("gotoProfileServer",$WriteOnly)){
-      if(!empty($this->gotoProfileServer) && !isset($this->gotoProfileServers[$this->gotoProfileServer])){
-        if(count($this->gotoProfileServers)){
-
-          /* Get First Profile */
-          $new = key($this->gotoProfileServers);
-
-          /* Another profile server found */
-          msg_dialog::display(_("Warning"), sprintf(_("Profile server '%s' is not available anymore. Switched to server '%s'."), $this->gotoProfileServer, $new), WARNING_DIALOG);
-        }else{
-
-          /* No other profile servers found */
-          msg_dialog::display(_("Warning"), sprintf(_("Profile server '%s' is not available anymore. Kiosk profile will be disabled."), $this->gotoProfileServer), WARNING_DIALOG);
-          $this->gotoProfileServer = "none";
-        }
-      }
-    }    
-
-    $this->detect_grouptype();
-
-    /* Fill templating stuff */
-    $smarty= get_smarty();
-    $smarty->assign("kiosk_enabled",$this->kiosk_enabled);
-    $display= "";
-
-    $smarty->assign("is_group",$this->is_group);
-
-    /* Prepare all variables for smarty */
-    foreach($this->attributes as $s_attr){
-      /* Set value*/
-      $smarty->assign($s_attr,$this->$s_attr);
-
-      /* Set checkbox state*/
-      if(empty($this->$s_attr)){
-        $smarty->assign($s_attr."CHK","");
-      }else{
-        $smarty->assign($s_attr."CHK"," checked ");
-      }
-
-      /* Prepare ACL settings*/
-      $smarty->assign($s_attr."ACL",$this->getacl($s_attr,$WriteOnly));
-    }
-
-    /* Is accout enabled | are we editing from usermenu or admin menu 
-       All these tab management is done here
-     */
-
-
-    /* Working from Usermenu an the Account is currently disbled
-     * this->parent :  is only set if we are working in a list of tabs
-     * is_account   :  is only true if the needed objectClass is given
-     */
-    if((!isset($this->parent))&&(!$this->is_account)){
-      /* We are currently editing this tab from usermenu, but this account is not enabled */
-      $smarty->assign("is_account",$this->is_account);
-      /* Load template */
-      $display .= $smarty->fetch(get_template_path('environment.tpl', TRUE));
-      /* Avoid the "You are currently editing ...." message when you leave this tab */
-      $display .= back_to_main(); 
-      /* Display our message to the user */
-      return $display;
-
-
-      /* We are currently editing from group tabs, because 
-       * $this->parent is set
-       * posixAccount is not set, so we are not in usertabs.
-       */
-    }elseif((isset($this->parent))&&(!isset($this->parent->by_object['posixAccount']))){
-      $smarty->assign("is_account","true");
-      $this->uid          = $this->cn;
-      $this->attrs['uid'] = $this->cn;
-
-      /* Change state if needed */
-      if (isset($_POST['modify_state'])){
-        if(($this->acl_is_createable() && !$this->is_account) || 
-            ($this->acl_is_removeable() &&  $this->is_account)){
-          $this->is_account= !$this->is_account;
-        }
-      }
-      /* Group Dialog with enabled environment options */
-      if ($this->is_account){
-        $display= $this->show_enable_header(_("Remove environment extension"),
-            _("Environment extension enabled. You can disable it by clicking below."));
-      } else {
-
-        /* Environment is disabled 
-           If theres is no posixAccount enabled, you won't be able to enable 
-           environment extensions
-         */
-        if((isset($this->parent->by_object['group']))||(isset($this->attrs['objectClass']))&&((in_array("posixAccount",$this->attrs['objectClass'])))){
-          // 4. There is a PosixAccount
-          $display= $this->show_enable_header(_("Add environment extension"),
-              _("Environment extension disabled. You can enable it by clicking below."));
-          return $display;
-        }else{
-          // 4. There is no PosixAccount
-          $display= $this->show_enable_header(_("Add environment extension"),
-              _("Environment extension disabled. You have to setup a posix account before you can enable this feature."));
-          return $display;
-        }
-      }
-    }else{
-      /* Editing from Usermenu 
-       *  Tell smarty that this accoutn is enabled 
-       */
-      $smarty->assign("is_account","true");
-
-      /* Change state if needed */
-      if (isset($_POST['modify_state'])){
-        if(($this->acl_is_createable() && !$this->is_account) || 
-            ($this->acl_is_removeable() &&  $this->is_account)){
-          $this->is_account= !$this->is_account;
-        }
-      }
-
-      if(isset($this->parent)){
-
-        // 3. Account enabled . Editing from adminmenu
-        if ($this->is_account){
-          $display= $this->show_disable_header(_("Remove environment extension"),
-              _("Environment extension enabled. You can disable it by clicking below."));
-        } else {
-
-          if($this->parent->by_object['posixAccount']->is_account==true){
-            // 4. There is a PosixAccount
-            $display= $this->show_disable_header(_("Add environment extension"),
-                _("Environment extension disabled. You can enable it by clicking below."));
-            return $display;
-          }else{
-            // 4. There is a PosixAccount
-            $display= $this->show_disable_header(_("Add environment extension"),
-                _("Environment extension disabled. You have to setup a posix account before you can enable this feature."),TRUE,TRUE);
-            return $display;
-          }
-        }
-      }
-    }
-  
-    /* Reset header toggle */
-    if($this->multiple_support_active){
-      $display = "";
-    }
-
-    /* Account is Account : is_accounbt=true.
-     * Else we won't reach this. 
-     */
-
-    /* Prepare all variables for smarty */
-    foreach($this->attributes as $s_attr){
-      /* Set value*/
-      $smarty->assign($s_attr,$this->$s_attr);
-
-      /* Set checkbox state*/
-      if(empty($this->$s_attr)){
-        $smarty->assign($s_attr."CHK","");
-      }else{
-        $smarty->assign($s_attr."CHK"," checked ");
-      }
-
-      /* Prepare ACL settings*/
-      $smarty->assign($s_attr."ACL",$this->getacl($s_attr,$WriteOnly));
-    }
-
-    foreach(array("gotoHotplugDevice","gotoProfileFlagC","gotoProfileFlagL") as $s_attr){
-      $smarty->assign($s_attr."ACL",$this->getacl($s_attr,$WriteOnly));
-    }
-
-    if($WriteOnly) {
-      $smarty->assign("gotoPrinterACL","r");
-    }else{
-      $smarty->assign("gotoPrinterACL","rw");
-    }
-
-
-    $smarty->assign("useProfile",$this->useProfile);
-    if(empty($this->useProfile) && !$this->multiple_support_active){
-      $smarty->assign("useProfileCHK","");
-      $smarty->assign("gotoProfileServerACL" , preg_replace("/w/","",$this->getacl("gotoProfileServer",$WriteOnly)));
-      $smarty->assign("gotoProfileQuotaACL" , preg_replace("/w/","",$this->getacl("gotoProfileQuota",$WriteOnly)));
-      $smarty->assign("gotoProfileFlagCACL" , preg_replace("/w/","",$this->getacl("gotoProfileFlagC",$WriteOnly)));
-    }else{
-      $smarty->assign("useProfileCHK"," checked ");
-    }
-    
-    $smarty->assign("gotoProfileServerWriteable", $this->acl_is_writeable("gotoProfileServer",$WriteOnly));
-    $smarty->assign("gotoProfileACL", $this->getacl("gotoProfileServer",$WriteOnly).$this->getacl("gotoProfileQuota",$WriteOnly));
-
-    /* HANDLE Profile Settings here 
-     * Assign available Quota and resolution settings
-     * Get all available profile server
-     * Get cache checkbox
-     * Assign this all to Smarty 
-     */
-
-    if(empty($this->gotoProfileFlagL)){
-      $smarty->assign("gotoProfileFlagLCHK"," ");
-    }else{
-      $smarty->assign("gotoProfileFlagLCHK"," checked ");
-    }
-
-    if(empty($this->gotoProfileFlagC)){
-      $smarty->assign("gotoProfileFlagCCHK"," ");
-    }else{
-      $smarty->assign("gotoProfileFlagCCHK"," checked ");
-    }
-
-
-    $smarty->assign("gotoXResolutions"    , $this->gotoXResolutions);
-    $smarty->assign("gotoXResolutionKeys" , array_flip($this->gotoXResolutions));
-
-    $smarty->assign("gotoProfileServers",$this->gotoProfileServers);
-    if(!is_array($this->gotoProfileServers)){
-      $this->gotoProfileServers =array();
-    }
-    $smarty->assign("gotoProfileServerKeys",array_flip($this->gotoProfileServers));
-
-    /* Handle kiosk profiles*/
-    $smarty->assign("kiosk_servers" , $this->gotoKioskProfiles['SERVERS']);
-    $smarty->assign("kiosk_server" ,  $this->gotoKioskProfile_Server);
-    $smarty->assign("kiosk_profiles" , $this->gotoKioskProfiles['BY_SERVER'][$this->gotoKioskProfile_Server]);
-    $smarty->assign("kiosk_profile" ,  $this->gotoKioskProfile_Profile);
-  
-
-    /* Logonscript Management
-     * Get available LogonScripts (possibly grey out (or mark) these script that are defined for the group) 
-     * Perform add Delete edit Posts 
-     */
-
-    /* Dialog Save */
-    if(isset($_POST['LogonSave'])){
-
-      if(!$this->acl_is_writeable("gotoLogonScript")){
-        msg_dialog::display(_("Permission error"), _("You have no permission to modify logon scripts!"), ERROR_DIALOG);
-        unset($this->dialog);
-        $this->dialog=FALSE;
-        $this->is_dialog=false;
-      }else{
-        $this->dialog->save_object();
-        if(count($this->dialog->check())!=0){
-          foreach($this->dialog->check() as $msg){
-            msg_dialog::display(_("Error"), $msg, ERROR_DIALOG);
-          }
-        }else{
-          $tmp = $this->dialog->save();
-          unset($this->dialog);
-          $this->dialog=FALSE;
-          $this->is_dialog=false;
-
-          if($this->multiple_support_active){
-            $tmp['UsedByAllUsers'] = TRUE;
-          }
-          $this->gotoLogonScripts[$tmp['LogonName']]=$tmp; 
-        }
-      }
-    }
-    
-
-    /* Dialog Quit without saving */
-    if(isset($_POST['LogonCancel'])){
-      $this->is_dialog= false;
-      unset($this->dialog);
-      $this->dialog= FALSE;
-    }
-
-    /* Check Edit Del New Posts for a selected LogonScript */ 
-    if($this->acl_is_writeable("gotoLogonScript") && 
-        (isset($_POST['gotoLogonScriptNew'])) || isset($_POST['gotoLogonScriptEdit']) ||isset($_POST['gotoLogonScriptDel'])){
-
-      /* New Logon Script: Open an edit dialog, we don't need a $_POST['gotoLogonScript'] here.
-       * In this case we create a new Logon Script.
-       */
-      if(isset($_POST['gotoLogonScriptNew'])){
-        $this->is_dialog = true;
-        $this->dialog = new logonManagementDialog($this->config,$this->dn);
-      }
-
-      /* If we receive a Delete request and there is a Script selected in the selectbox, delete this one.
-       * We only can delete if there is an entry selected.
-       */
-      if((isset($_POST['gotoLogonScriptDel']))&&(isset($_POST['gotoLogonScript']))){
-        unset($this->gotoLogonScripts[$_POST['gotoLogonScript']]);
-      }
-
-      /* In this case we want to edit an existing entry, we open a new Dialog to allow editing.
-       * There must be an entry selected to perform edit request.
-       */
-      if((isset($_POST['gotoLogonScriptEdit']))&&(isset($_POST['gotoLogonScript']))){
-        $is_entry = $this->gotoLogonScripts[$_POST['gotoLogonScript']];
-        $this->is_dialog = true;
-        $this->dialog = new logonManagementDialog($this->config,$this->dn,$is_entry);
-      }
-    }
-
-    /* Append List to smarty*/
-    if($this->multiple_support_active){
-      $smarty->assign("gotoLogonScripts",  $this->gotoLogonScripts);
-      $smarty->assign("gotoLogonScriptKeysCnt",count($this->gotoLogonScripts));
-    }else{
-      $ls = $this->printOutLogonScripts();
-      $smarty->assign("gotoLogonScripts",  $ls);
-      $smarty->assign("gotoLogonScriptKeys",array_flip($ls));
-      $smarty->assign("gotoLogonScriptKeysCnt",count($ls));
-    }
-
-    /* In this section server shares will be defined 
-     * A user can select one of the given shares and a mount point
-     *  and attach this combination to his setup.
-     */
-
-    $smarty->assign("gotoShareSelections",    $this->gotoShareSelections);
-    if(!is_array($this->gotoShareSelections)){
-      $this->gotoShareSelections = array();
-    }
-    $smarty->assign("gotoShareSelectionKeys", array_flip($this->gotoShareSelections));
-
-    /* if $_POST['gotoShareAdd'] is set, we will try to add a new entry 
-     * This entry will be, a combination of mountPoint and sharedefinitions 
-     */
-    if(isset($_POST['gotoShareAdd']) && $this->acl_is_writeable("gotoShare")){
-
-      /* We assign a share to this user, if we don't know where to mount the share */
-      if(!isset($_POST['gotoShareSelection']) || get_post('gotoShareSelection') == ""){
-        msg_dialog::display(_("Error"), _("Please select a valid share!"), ERROR_DIALOG);
-      }elseif((!isset($_POST['gotoShareMountPoint']))||(empty($_POST['gotoShareMountPoint']))||(preg_match("/[\|]/i",$_POST['gotoShareMountPoint']))){
-        msg_dialog::display(_("Error"), _("Please specify a valid mount point!"), ERROR_DIALOG);
-      }elseif(preg_match('/ /', $_POST['gotoShareMountPoint'])){
-        msg_dialog::display(_("Error"), _("You cannot use spaces in the mount path!"), ERROR_DIALOG);
-      }elseif(!(
-            preg_match("/^\//",$_POST['gotoShareMountPoint'])  ||
-            preg_match("/^~/",$_POST['gotoShareMountPoint']) ||
-            preg_match("/^\$HOME/",$_POST['gotoShareMountPoint']) ||
-            preg_match("/^.HOME/",$_POST['gotoShareMountPoint']) ||
-            preg_match("/^\$USER/",$_POST['gotoShareMountPoint']) ||
-            preg_match("/^.USER/",$_POST['gotoShareMountPoint']) ||
-            preg_match("/^%/",$_POST['gotoShareMountPoint'])
-            )
-          ){
-        msg_dialog::display(_("Error"), _("Please specify a valid mount point!"), ERROR_DIALOG);
-      }else{
-        $a_share = $this->gotoAvailableShares[$_POST['gotoShareSelection']];
-        $s_mount = $_POST['gotoShareMountPoint'];
-        $s_user  = $_POST['ShareUser'];
-        /* Preparing the new assignment */ 
-        $this->gotoShares[$a_share['name']."|".$a_share['server']]=$a_share;
-        $this->gotoShares[$a_share['name']."|".$a_share['server']]['Username']=$s_user;
-        $this->gotoShares[$a_share['name']."|".$a_share['server']]['PwdHash']="";
-        $this->gotoShares[$a_share['name']."|".$a_share['server']]['mountPoint']=$s_mount;
-
-        if($this->multiple_support_active){
-          $this->gotoShares[$a_share['name']."|".$a_share['server']]['UsedByAllUsers']= TRUE;
-        }
-      }
-    }  
-
-    /* if the Post  gotoShareDel is set, someone asked GOsa to delete the selected entry (if there is one selected)
-     * If there is no defined share selected, we will abort the deletion without any message 
-     */
-    $once = true;
-    if($this->acl_is_writeable("gotoShare")){
-      foreach($_POST as $name => $value){
-        if((preg_match("/^gotoShareDel_/",$name)) && ($once)){
-          $once = false;  
-          $key  = preg_replace("/^gotoShareDel_/","",$name);
-          $key  = preg_replace("/_+[xy]$/","",$key);
-          $key  = base64_decode($key);
-          if(isset($this->gotoShares[$key])) {
-            unset($this->gotoShares[$key]);
-          }
-
-          /* Remove corresponding password entry, too. This is a workaround
-             to get rid of old-style entries. */
-          $key= preg_replace("/\|/", "|!", $key);
-          if(isset($this->gotoShares[$key])) {
-            unset($this->gotoShares[$key]);
-          }
-        }
-        if((preg_match("/^gotoShareResetPwd_/",$name)) && ($once)){
-          $once = false;
-          $key  = preg_replace("/^gotoShareResetPwd_/","",$name);
-          $key  = preg_replace("/_+[xy]$/","",$key);
-          $key  = base64_decode($key);
-          $this->gotoShares[$key]['PwdHash'] = "";
-          if(preg_match("/^!/",$this->gotoShares[$key]['server'])){
-            unset($this->gotoShares[$key]);
-          }
-        }
-      }
-    }
-    $divlistShares = new divSelectBox("gotoShares");
-    $divlistShares->SetHeight(100);
-
-
-    $tmp = array();
-    if($this->acl_is_readable("gotoShares")){
-      $tmp = $this->printOutAssignedShares();
-    }
-
-    
-    foreach($tmp as $key => $value){
-      $img = "";
-
-      /* Skip apssword only entries */
-      if( empty($this->gotoShares[$key]['server']) && 
-          empty($this->gotoShares[$key]['name']) &&
-          empty($this->gotoShares[$key]['mountPoint']) &&
-          empty($this->gotoShares[$key]['Username'])){
-        continue;
-      } 
-
-      $color = "";
-      if($this->multiple_support_active){
-        if($this->gotoShares[$key]['UsedByAllUsers']){
-          $value .= "&nbsp;(<b>"._("Used by all users")."</b>)";
-        }else{
-          $color = "color: #999999;";
-          $value .= "&nbsp;(<b>"._("Used by some users")."</b>)";
-        }
-      }
-
-      /* Check if entry starts with an ! */
-      if(preg_match("/^!/",$this->gotoShares[$key]['server'])){
-
-        /* If we are currently editing groups environment, skip those ! entries */ 
-        if($this->is_group) continue;
-
-        /* Create pwd reset images */
-        if($this->gotoShares[$key]['PwdHash'] != ""){
-          $img.= "<input type='image' name='gotoShareResetPwd_".base64_encode($key)." 'src='images/list_reset_password.png' alt='"._("Reset password hash")."' 
-            title='"._("Reset password hash")."'>";
-        }
-        $field1 = array("string" => "<font style=\"color:#C0C0C0\">".$value."</font>" , "attach" => "style='".$color."'");
-        $field2 = array("string" => $img   , "attach" => "style='border-right:0px;'");
-      }else{
-
-        /* Create pwd reset img && delete image */
-        if($this->gotoShares[$key]['PwdHash'] != ""){
-          $img.= "<input type='image' name='gotoShareResetPwd_".base64_encode($key)." 'src='images/list_reset_password.png' alt='"._("Reset password hash")."' 
-            title='"._("Reset password hash")."'>";
-          $img.= "&nbsp;";
-        }
-        $img.= "<input type='image' name='gotoShareDel_".base64_encode($key)." 'src='images/edittrash.png' alt='"._("Delete")."' 
-          title='"._("Delete share entry")."'>";
-        $field1 = array("string" => $value , "attach" => "style='".$color."'");
-        $field2 = array("string" => $img   , "attach" => "style='border-right:0px;'");
-      }
-      $divlistShares->AddEntry(array($field1,$field2));
-    }
-    $smarty->assign("divlistShares",$divlistShares->DrawList());
-
-    /* Hotplug devices will be handled here 
-     * There are 3 possible methods for this feature
-     * Create a new Hotplug, A Dialog will open where you can specify some hotplug information
-     * Delete will erase an entry, the entry must be selcted in the ListBox first
-     * Editing an entry will open a dialog where the informations about the selcted entry can be changed
-     */
-
-    /* We have to delete the selected hotplug from the list*/
-    if((isset($_POST['gotoHotplugDeviceDel']))&&(isset($_POST['gotoHotplugDevice_post'])) && $this->acl_is_writeable("gotoHotplugDevice")){
-      if($this->acl_is_writeable("gotoHotplugDevice")){
-        foreach($_POST['gotoHotplugDevice_post'] as $name){
-          unset($this->gotoHotplugDevices[$name]);
-        }
-      }
-    }
-
-    /* There are already defined hotplugs from other users we could use */
-    if(isset($_POST['gotoHotplugDeviceUse']) && $this->acl_is_writeable("gotoHotplugDevice")){
-      $tmp  =array();
-      foreach($this->gotoHotplugDevices as $plugs){
-        $tmp[] = $plugs['name'];
-      }
-      $this->dialog = new hotplugDialog($this->config,$tmp);
-      $this->is_dialog = true;
-    }
-
-    /* Dialog Aborted */
-    if(isset($_POST['HotPlugCancel'])){
-      unset($this->dialog);
-      $this->dialog= FALSE;
-      $this->is_dialog = false;
-    }
-
-    /* Dialod saved */
-    if(isset($_POST['HotPlugSave'])){
-
-      $this->dialog->save_object();
-      if(count($this->dialog->check())!=0){
-        foreach($this->dialog->check() as $msg){
-          msg_dialog::display(_("Error"), $msg, ERROR_DIALOG);
-        }
-      }else{
-        $this->dialog->save_object();
-        $a_tmp = $this->dialog->save();
-
-        if(is_array($a_tmp)){
-          foreach($a_tmp as $name => $hotplug){
-            if($this->multiple_support_active){
-              $hotplug['UsedByAllUsers'] = TRUE;
-            }
-            $this->gotoHotplugDevices[$name]= $hotplug; 
-          }
-        }
-        unset($this->dialog);
-        $this->dialog= FALSE;
-        $this->is_dialog = false;
-      }
-    }
-
-    if($this->multiple_support_active){
-      $smarty->assign("gotoHotplugDevices",$this->gotoHotplugDevices);
-    }else{
-      $smarty->assign("gotoHotplugDevices",$this->printOutHotPlugDevices());
-      $smarty->assign("gotoHotplugDeviceKeys",array_flip($this->printOutHotPlugDevices()));
-    }
-
-    /* Printer Assignment will managed below 
-     * A printer can be assigned in two different ways and two different types
-     * There are 2 types of users assigned to a printer : user and admin
-     * They only differ in the member attribute they will be assigned to. user: gotoUserPrinter admin: gotoadminPrinter
-     * The different types of assigning a user are : 1 assigning a user to a printer 2. assigning a group to a printer
-     */ 
-
-    /* First handle Add Post. Open a dialog that allows us to select a printer or two */ 
-    if(isset($_POST['gotoPrinterAdd'])){
-
-      $this->is_dialog=true;
-      $this->dialog = new selectPrinterDialog($this->config,$this->dn,$this->gotoPrinter);
-    }
-
-    if(isset($_POST['PrinterCancel'])){
-      $this->is_dialog=false;
-      unset($this->dialog);
-      $this->dialog=FALSE;
-    }
-
-    if(isset($_POST['PrinterSave'])){
-      if(count($this->dialog->check())!=0){
-        $tmp = $this->dialog->check();
-        foreach($tmp as $msg){
-          msg_dialog::display(_("Error"), $msg, ERROR_DIALOG);
-        } 
-      }else{
-        $this->dialog->save_object();
-        $tmp = $this->dialog->save();
-        $tmp2= $this->dialog->getPrinter(true);
-
-        foreach($tmp as $pname){
-          $printerObj = new printtabs($this->config,$this->config->data['TABS']['PRINTTABS'],$tmp2[$pname]['dn'],"printer");
-          $printerObj->set_acl_base($tmp2[$pname]['dn']);
-
-          $type = false;
-
-          if($this->is_group){
-            if($this->dn == "new"){  
-              $type = "AddGroup";
-            }elseif(isset($this->NewDeletedPrinters[$pname])){
-              $type = "AddGroup";
-            }elseif($printerObj->by_object['printgeneric']->AddMember("AddGroup",$this->dn)){
-              $type = "AddGroup";
-            }
-          }else{
-            if($this->multiple_support_active){
-              $type = "AddUser";
-            }elseif(isset($this->NewDeletedPrinters[$pname])){
-              $type = "AddUser";
-            }elseif($printerObj->by_object['printgeneric']->AddMember("AddUser",$this->dn)){
-              $type = "AddUser";
-            }
-          }
-
-          if($type){
-            $this->gotoPrinter[$pname]=$tmp2[$pname];
-            $this->gotoPrinter[$pname]['mode']="user";
-            $this->add_del_printer_member_was_called = true;
-
-            $this->NewAddedPrinters[$pname] = $pname;
-            if(isset($this->NewDeletedPrinters[$pname])){
-              unset($this->NewDeletedPrinters[$pname]);
-            }
-          }
-        }
-
-        $this->is_dialog=false;
-        unset($this->dialog);
-        $this->dialog   =FALSE;
-      }
-    }
-
-    if((isset($_POST['gotoPrinterDel']))&&(isset($_POST['gotoPrinterSel']))&&(!empty($_POST['gotoPrinterSel']))){
-      $printer = $_POST['gotoPrinterSel'];
-      foreach($printer as $pname){
-
-        $printerObj = new printtabs($this->config,$this->config->data['TABS']['PRINTTABS'],$this->gotoPrinter[$pname]['dn'],"printer");
-        $printerObj->set_acl_base($this->gotoPrinter[$pname]['dn']);
-
-        $type = false;
-        if($this->is_group){
-          if(isset($this->NewAddedPrinters[$pname])){
-            $type = "Group";
-          }elseif($printerObj->by_object['printgeneric']->DelMember("AddGroup",$this->cn)){
-            $type = "Group";
-          }
-        }else{
-          if(isset($this->NewAddedPrinters[$pname])){
-            $type = "User";
-          }elseif($printerObj->by_object['printgeneric']->DelMember("AddUser",$this->uid)){
-            $type = "User";
-          }
-        }
-        if($type){
-          $this->add_del_printer_member_was_called = true;
-          unset($this->gotoPrinter[$pname]);
-
-          $this->NewDeletedPrinters[$pname] = $pname;
-          if(isset($this->NewAddedPrinters[$pname])){
-            UNSET($this->NewAddedPrinters[$pname]);
-          }
-        }
-      }
-    }
-
-    if((isset($_POST['gotoPrinterEdit']))&&(isset($_POST['gotoPrinterSel']))&&(!empty($_POST['gotoPrinterSel']))){
-      $printers = $_POST['gotoPrinterSel'];
-      $this->add_del_printer_member_was_called = true;
-      foreach($printers as $printer){
-        if($this->gotoPrinter[$printer]['mode']=="user"){
-          $this->gotoPrinter[$printer]['mode']="admin";
-        }else{
-          $this->gotoPrinter[$printer]['mode']="user";
-        }
-      }
-    }
-
-    if((isset($_POST['gotoPrinterDefault']))&&(isset($_POST['gotoPrinterSel']))&&(!empty($_POST['gotoPrinterSel']))){
-      if($this->is_group){
-        msg_dialog::display(_("Error"), _("Cannot set default printer flag for groups!"), ERROR_DIALOG);
-      }else{
-        if ($this->gosaDefaultPrinter == $_POST['gotoPrinterSel'][0]){
-          $this->gosaDefaultPrinter= "";
-        } else {
-          $this->gosaDefaultPrinter= $_POST['gotoPrinterSel'][0];
-        }
-      }
-    }
-
-    $smarty->assign("gotoPrinter",$this->printOutPrinterDevices());
-    $smarty->assign("gotoPrinterKeys",array_flip($this->printOutPrinterDevices()));
-
-    /* General behavior */
-    if(is_object($this->dialog)){
-      $this->dialog->save_object();
-      $disp =$this->dialog->execute();
-      return($disp);
-    }
-
-    /* Assign used attributes for multiple edit */
-    foreach(array("gotoPrinter","kiosk_server","gotoProfileFlagL","gotoXResolution",
-                  "useProfile","gotoProfileServer","gotoProfileQuota","gotoProfileFlagC") as $box){
-      $ubox ="use_".$box;
-      if(in_array($box,$this->multi_boxes)){
-        $smarty->assign($ubox,TRUE);
-      }else{
-        $smarty->assign($ubox,FALSE);
-      }
-    }
-
-    /* Als smarty vars are set. Get smarty template and generate output */
-    $smarty->assign("multiple_support",$this->multiple_support_active);
-    $display.= $smarty->fetch(get_template_path('environment.tpl', TRUE,dirname(__FILE__)));
-    return($display);
-  }
-
-  function remove_from_parent()
-  {
-    /* only if it was an account*/
-    if (!$this->initially_was_account){
-      return;
-    }
-
-    /* include global link_info */
-    $ldap= $this->config->get_ldap_link();
-
-    /* Remove and write to LDAP */
-    plugin::remove_from_parent();
-
-    /* Don't save our template variables */
-    $skip = array("uid","gotoLogonScripts","gotoPrinter","gotoShares","gotoHotplugDevices" );
-
-    /* Skip all these attributes */
-    foreach($skip as $del){
-      unset($this->attrs[$del]);
-    }
-
-    @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__,$this->attributes, "Save");
-
-    $ldap->cd($this->dn);
-    $this->cleanup();
-    $ldap->modify ($this->attrs); 
-
-    if($this->is_group){
-      new log("remove","groups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    }else{
-      new log("remove","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    }
-
-    show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/environment account with dn '%s' failed."),$this->dn));
-
-    /* Optionally execute a command after we're done */
-    $this->handle_post_events("remove",array("uid" => $this->uid));
-  }
-
-
-  /* Save data to object */
-  function save_object()
-  {
-    /* Get all Posted vars 
-     * Setup checkboxes 
-     */
-    $WriteOnly = (!isset($this->parent)|| !$this->parent) && !session::is_set('edit');
-    if(isset($_POST['iamposted'])){
-
-      $PACL =  $this->getacl("gotoProfileServer",$WriteOnly).$this->getacl("gotoProfileQuota",$WriteOnly);
-
-      if(isset($_POST['kiosk_server'])){
-        $tmp = $_POST['kiosk_server'];
-        if(isset($this->gotoKioskProfiles['SERVERS'][$tmp])){
-          $this->gotoKioskProfile_Server = $_POST['kiosk_server'];
-        }
-      }
-      if(isset($_POST['kiosk_profile'])){
-        $tmp = $_POST['kiosk_profile'];
-        if(in_array($tmp,$this->gotoKioskProfiles['BY_SERVER'][$this->gotoKioskProfile_Server])){
-          $this->gotoKioskProfile_Profile = $_POST['kiosk_profile'];
-        }
-      }
-
-      if(preg_match("/w/",$PACL)){
-        if(isset($_POST['useProfile'])){
-          $this->useProfile = true;
-        }else{
-          $this->useProfile = false;
-        }
-      }
-
-      if($this->acl_is_writeable("gotoProfileFlagC")){
-        if(isset($_POST['gotoProfileFlagC'])){
-          $this->gotoProfileFlagC = $_POST['gotoProfileFlagC'];
-        }else{
-          $this->gotoProfileFlagC = false;
-        }
-      }
-
-      if($this->acl_is_writeable("gotoProfileFlagL")){
-        if(isset($_POST['gotoProfileFlagL'])){
-          $this->gotoProfileFlagL = $_POST['gotoProfileFlagL'];
-        }else{
-          $this->gotoProfileFlagL = false;
-        }
-      }
-
-      plugin::save_object();
-      foreach($this->attributes as $s_attr){
-        if((!isset($_POST[$s_attr])) || 
-            in_array($s_attr,array("gosaDefaultPrinter","gotoShares","gotoHotplugDevices","gotoPrinter","gotoLogonScripts","uid"))) continue;
-        if(!$this->acl_is_writeable($s_attr)){
-          continue;
-        }else{ 
-          if(isset($_POST[$s_attr])){
-            $this->$s_attr = $_POST[$s_attr];
-          }else{
-            $this->$s_attr = false;
-          }
-        }
-      }
-    }
-  }
-
-
-  /* Check supplied data */
-  function check()
-  {
-    /* Call common method to give check the hook */
-    $message= plugin::check();
-
-    $this->detect_grouptype();
-
-    if(preg_match("/[^0-9]/",$this->gotoProfileQuota)) {
-      $message[]=_("Please set a valid profile quota size.");
-    } 
-    if(!isset($this->attrs['objectClass'])){
-      $this->attrs['objectClass']=array();
-    } 
-    if(!$this->is_group){
-      if((!((in_array("posixAccount",$this->attrs['objectClass']))||($this->parent->by_object['posixAccount']->is_account==true)))&&(!$this->is_group)){
-        $message[]=(_("You need to setup a valid posix extension in order to enable evironment features."));  
-      }
-    }
-    return ($message);
-  }
-
-
-  /* Save to LDAP */
-  function save()
-  {
-    /* If group was renamed, all printer settings get lost
-     */ 
-    /* only save changed variables ....*/
-    if ($this->gotoKioskProfile_Server != "none"){
-      if(preg_match("/https/i",$_SERVER['HTTP_REFERER'])){
-        $method="https://".$this->gotoKioskProfile_Server."/kiosk/".$this->gotoKioskProfile_Profile;
-      }else{
-        $method="http://".$this->gotoKioskProfile_Server."/kiosk/".$this->gotoKioskProfile_Profile;
-      }
-      $this->gotoKioskProfile= $method;
-    }else{
-      $this->gotoKioskProfile= array();
-    }
-
-    plugin::save();
-    $ldap= $this->config->get_ldap_link();
-
-    $realyUsedAttrs= array();
-
-    /* Save already used objectClasses */
-    $ocs        = $this->attrs['objectClass'];
-    unset($ocs['count']);
-    $this->attrs = array();
-    $this->attrs['objectClass']= gosa_array_merge($ocs,$this->objectclasses);
-
-    /* 1. Search all printers that have our uid/cn as member 
-     * 2. Delete this uid/cn from every single entry and save it again.
-     * 2.1 There are different types of members: Users / Groups, this will be defined in $suffix
-     * 2.2 And each type has two modes, Admin (e.g. 'gotoUserAdminPrinter') and Normal 
-     */
-    
-    $this->detect_grouptype();
-
-    if($this->add_del_printer_member_was_called){
-
-      $types = array( "gotoUserPrinter"       => "AddUser",
-          "gotoGroupPrinter"      => "AddGroup",
-          "gotoUserAdminPrinter"  => "AddAdminUser",
-          "gotoGroupAdminPrinter" => "AddAdminGroup");
-
-      if($this->is_group){
-        $s_suffix = "Group";
-        $useVar   = "cn";
-      }else{
-        $useVar   = "uid";
-        $s_suffix = "User";
-      }
-
-      /* Remove old entries */
-      $ldap->search("(&(objectClass=gotoPrinter)(goto".$s_suffix."Printer=".$this->$useVar."))",array("*"));
-      while($attr = $ldap->fetch()){
-        $printerObj = NULL;
-        $printerObj = new printtabs($this->config,$this->config->data['TABS']['PRINTTABS'],$attr['dn'],"printer");
-        $printerObj->set_acl_base($attr['dn']);
-        $printerObj->by_object['printgeneric']->DelMember($types["goto".$s_suffix."Printer"],$this->$useVar);
-        $printerObj->by_object['printgeneric']->save();
-      }
-
-      $ldap->search("(&(objectClass=gotoPrinter)(goto".$s_suffix."AdminPrinter=".$this->$useVar."))",array("*"));
-      while($attr = $ldap->fetch()){
-        $printerObj = NULL;
-        $printerObj = new printtabs($this->config,$this->config->data['TABS']['PRINTTABS'],$attr['dn'],"printer");
-        $printerObj->set_acl_base($attr['dn']);
-        $printerObj->by_object['printgeneric']->DelMember($types["goto".$s_suffix."AdminPrinter"],$this->$useVar);
-        $printerObj->by_object['printgeneric']->save();
-      }
-
-      foreach($this->gotoPrinter as $printer){
-        $printerObj = NULL;
-        $printerObj = new printtabs($this->config,$this->config->data['TABS']['PRINTTABS'],$printer['dn'],"printer");
-        $printerObj->set_acl_base($printer['dn']);
-
-
-        if($printer['mode'] == "admin") {
-          $attribute = "goto".$s_suffix."AdminPrinter";
-        }else{
-          $attribute = "goto".$s_suffix."Printer";
-        }
-
-        $printerObj->by_object['printgeneric']->AddMember($types[$attribute],$this->dn);
-        $printerObj->by_object['printgeneric']->save();
-      }
-    }    
-
-    /* Prepare HotPlug devices */
-    $this->attrs['gotoHotplugDeviceDN'] = array();
-    foreach($this->gotoHotplugDevices as $name => $device){
-      $this->attrs['gotoHotplugDeviceDN'][]= $device['dn'];
-    }
-
-    /* Prepare LogonScripts */
-    $this->attrs['gotoLogonScript'] = array();
-    foreach($this->gotoLogonScripts as $name => $script){
-      $this->attrs['gotoLogonScript'][] =   $script['LogonName']."|".
-        $script['LogonOverload'].$script['LogonLast']."|".
-        $script['LogonPriority']."|".
-        base64_encode($script['LogonData'])."|".
-        $script['LogonDescription'];
-    }
-
-    /* Prepare Shares */
-    $this->attrs['gotoShare']=array();
-    foreach($this->gotoShares as $name => $share){
-      $mntp= $share['mountPoint'];
-      if (!preg_match('=^[a-z0-9+\._/%-]+$=i', $mntp)){
-        $mntp= base64_encode($mntp);
-      }
-      $this->attrs['gotoShare'][] =$share['server']."|".$share['name']."|".$mntp."|".$share['PwdHash']."|".$share['Username'];
-    }
-
-
-    if($this->gotoXResolution == "auto") $this->gotoXResolution ="";
-    $saveThis = array("gotoProfileQuota","gotoXResolution","gotoProfileServer","gotoKioskProfile","gosaDefaultPrinter");
-
-    foreach($saveThis as $tosave){
-      if(!empty($this->$tosave)){
-        $this->attrs[$tosave]=$this->$tosave;
-      }else{
-        $this->attrs[$tosave]=array();
-      }
-    }
-
-    /* Prepare Flags */
-    $this->attrs['gotoProfileFlags'] = array($this->gotoProfileFlagC.$this->gotoProfileFlagL);
-    if(empty($this->attrs['gotoProfileFlags'][0])){
-      $this->attrs['gotoProfileFlags']=array();
-    }
-
-    if($this->useProfile == false){
-      $this->attrs['gotoProfileFlags'] = preg_replace("/C/i","",$this->attrs['gotoProfileFlags']);
-      $this->attrs['gotoProfileServer']= array(); 
-    }
-
-    $ldap->cat ($this->dn, array('dn'));
-    if ($ldap->fetch()){
-      $mode= "modify";
-    } else {
-      $mode= "add";
-      $ldap->cd($this->config->current['BASE']);
-      $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
-    }
-
-    $ldap->cd($this->dn);
-    $this->cleanup();
-    $ldap->$mode($this->attrs);
-  
-    $cat = "users";
-    if($this->is_group){
-      $cat = "groups";
-    }
-
-    /* Log last action */ 
-    if($this->initially_was_account){
-      new log("modify",$cat."/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    }else{
-      new log("create",$cat."/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    }
-
-    show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/environment account with dn '%s' failed."),$this->dn));
-    $this->handle_post_events($mode,array("uid"=>$this->uid));
-  }
-
-  /* Generate ListBox frindly output for the defined shares 
-   * Possibly Add or remove an attribute here, 
-   */
-  function printOutAssignedShares()
-  {
-    $a_return = array();
-    if(is_array($this->gotoShares)){
-      foreach($this->gotoShares as $share){
-        if(preg_match("/^!/",$share['server'])){
-          $a_return[$share['name']."|".$share['server']]= preg_replace("/^!/","",$share['server'])."://".$share['name']." - "._("group share"); 
-        }else{
-          $a_return[$share['name']."|".$share['server']]= $share['server']."://".$share['name']." on ".$share['mountPoint']." as ".$share['Username'];
-        }
-      }
-      natcasesort($a_return);
-    }
-    return($a_return);
-  }
-
-  /* Generate ListBox frindly output for the definedhotplugs 
-   * Possibly Add or remove an attribute here,
-   */
-  function printOutHotPlugDevices()
-  {
-    $a_return= array();
-    if(is_array($this->gotoHotplugDevices)){
-      foreach($this->gotoHotplugDevices as $key=>$device){
-        $a_return[$key] = $device['name']." - ".$device['id'];
-      }
-    }
-    return($a_return);
-  }
-
-  /* Generates ListBox frienly output of used printer devices 
-   * Append ' - admin' if printer is used in admin mode
-   */
-  function printOutPrinterDevices()
-  {
-    $a_return = array();
-    
-    if($this->acl_is_readable("gotoPrinter")){
-
-      if(is_array($this->gotoPrinter)){
-        foreach($this->gotoPrinter as $printer){
-          if($printer['mode'] == "admin"){
-            $a_return[$printer['cn'][0]]= $printer['cn'][0]." - "._("Administrator");
-          }else{
-            $a_return[$printer['cn'][0]]= $printer['cn'][0]; 
-          }
-          if ($printer['cn'][0] == $this->gosaDefaultPrinter){
-            $a_return[$printer['cn'][0]].=" - "._("Default printer");
-          }
-        }
-      }
-    }
-    return($a_return);
-  }
-
-
-  function PrepareForCopyPaste($source)
-  {
-    plugin::PrepareForCopyPaste($source);
-
-    $class= get_class($this);
-    $o_source = new $class($this->config,$source['dn']);
-    foreach($this->CopyPasteVars as $attr){
-      $this->$attr = $o_source->$attr;  
-    }
-  }
-
-
-  function saveCopyDialog()
-  {
-    if(isset($_POST['cn'])){
-      $this->cn = $_POST['cn'];
-      $this->uid = $_POST['cn'];
-    }
-  }
-
-
-  /* Generates ListBox frienly output of used logonscripts 
-   */
-  function printOutLogonScripts()
-  {
-    $a_return = array();
-    if(is_array($this->gotoLogonScripts)){
-      foreach($this->gotoLogonScripts as $script){
-        $a_return[$script['LogonName']]= $script['LogonPriority']." - ".$script['LogonName']; 
-      }
-    }
-    return($a_return);
-  }
-
-
-  function multiple_execute()
-  {
-    /* Reset header toggle */
-    $this->is_account = TRUE;
-    return($this->execute());
-  }
-
-
-    /* Initialize plugin with given atribute arrays
-   */
-  function init_multiple_support($attrs,$all)
-  {
-    plugin::init_multiple_support($attrs,$all);
-
-    /* Prepare Shares */
-    if((isset($this->multi_attrs_all['gotoShare']))&&(is_array($this->multi_attrs_all['gotoShare']))){
-      unset($this->multi_attrs_all['gotoShare']['count']);
-      foreach($this->multi_attrs_all['gotoShare'] as $share){
-        $tmp = $tmp2 = array();
-        $tmp = split("\|",$share);
-        $tmp2['server']      =$tmp[0];
-        $tmp2['name']        =$tmp[1];
-
-        /* Decode base64 if needed */
-        if (!preg_match('%/%', $tmp[2])){
-          $tmp2['mountPoint']  =base64_decode($tmp[2]);
-        } else {
-          $tmp2['mountPoint']  =$tmp[2];
-        }
-
-        if(isset($tmp[3])){
-          $tmp2['PwdHash']  =$tmp[3];
-        }else{
-          $tmp2['PwdHash']  ="";
-        }
-        if(isset($tmp[4])){
-          $tmp2['Username']  =$tmp[4];
-        }else{
-          $tmp2['Username']  ="";
-        }
-        $tmp2['UsedByAllUsers'] = FALSE;
-        $this->gotoShares[$tmp[1]."|".$tmp[0]]=$tmp2;
-      }
-    }
-
-    /* Prepare Shares */
-    if((isset($this->multi_attrs['gotoShare']))&&(is_array($this->multi_attrs['gotoShare']))){
-      unset($this->multi_attrs['gotoShare']['count']);
-      foreach($this->multi_attrs['gotoShare'] as $share){
-        $tmp = $tmp2 = array();
-        $tmp = split("\|",$share);
-        $tmp2['server']      =$tmp[0];
-        $tmp2['name']        =$tmp[1];
-
-        /* Decode base64 if needed */
-        if (!preg_match('%/%', $tmp[2])){
-          $tmp2['mountPoint']  =base64_decode($tmp[2]);
-        } else {
-          $tmp2['mountPoint']  =$tmp[2];
-        }
-
-        if(isset($tmp[3])){
-          $tmp2['PwdHash']  =$tmp[3];
-        }else{
-          $tmp2['PwdHash']  ="";
-        }
-        if(isset($tmp[4])){
-          $tmp2['Username']  =$tmp[4];
-        }else{
-          $tmp2['Username']  ="";
-        }
-        $tmp2['UsedByAllUsers'] = TRUE;
-        $this->gotoShares[$tmp[1]."|".$tmp[0]]=$tmp2;
-      }
-    }
-
-
-    /* prepare LogonScripts */
-    if((isset($this->multi_attrs_all['gotoLogonScript']))&&(is_array($this->multi_attrs_all['gotoLogonScript']))){
-      unset($this->multi_attrs_all['gotoLogonScript']['count']);
-      foreach($this->multi_attrs_all['gotoLogonScript'] as $device){
-        $tmp = $tmp2 = array();
-        $tmp = split("\|",$device);
-        $tmp2['LogonName']        = $tmp[0];
-        $tmp2['LogonPriority']    = $tmp[2];
-        if(preg_match("/O/i",$tmp[1])){
-          $tmp2['LogonOverload'] = "O";
-        }else{
-          $tmp2['LogonOverload'] = "";
-        }
-        if(preg_match("/L/i",$tmp[1])){
-          $tmp2['LogonLast'] = "L";
-        }else{
-          $tmp2['LogonLast'] = "";
-        }
-        $tmp2['LogonData']        = base64_decode($tmp[3]);
-        $tmp2['LogonDescription'] = $tmp[4];
-        $tmp2['UsedByAllUsers'] = FALSE;
-        $this->gotoLogonScripts[$tmp[0]]=$tmp2;
-      }
-    }
-
-    /* prepare LogonScripts */
-    if((isset($this->multi_attrs['gotoLogonScript']))&&(is_array($this->multi_attrs['gotoLogonScript']))){
-      unset($this->multi_attrs['gotoLogonScript']['count']);
-      foreach($this->multi_attrs['gotoLogonScript'] as $device){
-        $tmp = $tmp2 = array();
-        $tmp = split("\|",$device);
-        $tmp2['LogonName']        = $tmp[0];
-        $tmp2['LogonPriority']    = $tmp[2];
-        if(preg_match("/O/i",$tmp[1])){
-          $tmp2['LogonOverload'] = "O";
-        }else{
-          $tmp2['LogonOverload'] = "";
-        }
-        if(preg_match("/L/i",$tmp[1])){
-          $tmp2['LogonLast'] = "L";
-        }else{
-          $tmp2['LogonLast'] = "";
-        }
-        $tmp2['LogonData']        = base64_decode($tmp[3]);
-        $tmp2['LogonDescription'] = $tmp[4];
-        $tmp2['UsedByAllUsers'] = TRUE;
-        $this->gotoLogonScripts[$tmp[0]]=$tmp2;
-      }
-    }
-
-    /* Prepare hotplugs */
-    if(isset($this->multi_attrs_all['gotoHotplugDeviceDN']) && is_array($this->multi_attrs_all['gotoHotplugDeviceDN'])){
-      $ldap = $this->config->get_ldap_link();
-      $ldap->cd($this->config->current['BASE']);
-      for($i = 0 ; $i < $this->multi_attrs_all['gotoHotplugDeviceDN']['count'] ; $i ++){
-        $ldap->cat($this->multi_attrs_all['gotoHotplugDeviceDN'][$i]);
-        if($ldap->count()){
-          $multi_attrs_all = $ldap->fetch();
-
-          if(isset($multi_attrs_all['gotoHotplugDevice'][0])){
-            $tmp      = preg_split("/\|/",$multi_attrs_all['gotoHotplugDevice'][0]);
-            $tmp2     = array();
-            $tmp2['name']         = $multi_attrs_all['cn'][0];
-            $tmp2['description']  = $tmp[0];
-            $tmp2['id']           = $tmp[1];
-            $tmp2['produkt']      = $tmp[2];
-            $tmp2['vendor']       = $tmp[3];
-            $tmp2['dn']           = $multi_attrs_all['dn'];
-            $tmp2['UsedByAllUsers'] = FALSE;
-            $this->gotoHotplugDevices[$tmp2['dn']] = $tmp2;
-          }
-        }
-      }
-    }
-
-    /* Prepare hotplugs */
-    if(isset($this->multi_attrs['gotoHotplugDeviceDN']) && is_array($this->multi_attrs['gotoHotplugDeviceDN'])){
-      $ldap = $this->config->get_ldap_link();
-      $ldap->cd($this->config->current['BASE']);
-      for($i = 0 ; $i < $this->multi_attrs['gotoHotplugDeviceDN']['count'] ; $i ++){
-        $ldap->cat($this->multi_attrs['gotoHotplugDeviceDN'][$i]);
-        if($ldap->count()){
-          $multi_attrs = $ldap->fetch();
-
-          if(isset($multi_attrs['gotoHotplugDevice'][0])){
-            $tmp      = preg_split("/\|/",$multi_attrs['gotoHotplugDevice'][0]);
-            $tmp2     = array();
-            $tmp2['name']         = $multi_attrs['cn'][0];
-            $tmp2['description']  = $tmp[0];
-            $tmp2['id']           = $tmp[1];
-            $tmp2['produkt']      = $tmp[2];
-            $tmp2['vendor']       = $tmp[3];
-            $tmp2['dn']           = $multi_attrs['dn'];
-            $tmp2['UsedByAllUsers'] = TRUE;
-            $this->gotoHotplugDevices[$tmp2['dn']] = $tmp2;
-          }
-        }
-      }
-    }
-    $this->gotoHotplugDevices = array_values($this->gotoHotplugDevices);
-    for($i = 0 ; $i < strlen($this->gotoProfileFlags) ; $i ++){
-      $chr = $this->gotoProfileFlags[$i];
-      $name = "gotoProfileFlag".$chr;
-      $this->$name=$chr;
-    }
-    $this->update_kiosk_profiles();
-    $this->gotoKioskProfile= preg_replace("/^.*\//i","",$this->gotoKioskProfile);
-
-    if((!empty($this->gotoProfileServer))||($this->gotoProfileFlagC=="C")){
-      $this->useProfile = true;
-    }else{
-      $this->useProfile = false;
-    }
-
-  }
-
-
-  function set_multi_edit_values($attrs)
-  {
-    $shares = $this->gotoShares;
-    $scripts= $this->gotoLogonScripts;
-    $plugs= $this->gotoHotplugDevices;
-    plugin::set_multi_edit_values($attrs);
-
-    $this->gotoShares = $shares;
-    $this->gotoLogonScripts = $scripts;
-    $this->gotoHotplugDevices = $plugs;
-
-    foreach($attrs['gotoShares'] as $name => $share){
-      if($share['UsedByAllUsers'] == TRUE){
-        $this->gotoShares[$name] = $share;
-      }
-    }
-    foreach($this->gotoShares as $name => $share){
-      if(!isset($attrs['gotoShares'][$name])){
-        unset($this->gotoShares[$name]);
-      }
-    }
-    foreach($attrs['gotoLogonScripts'] as $name => $script){
-      if($script['UsedByAllUsers'] == TRUE){
-        $this->gotoLogonScripts[$name] = $script;
-      }
-    }
-    foreach($this->gotoLogonScripts as $name => $script){
-      if(!isset($attrs['gotoLogonScripts'][$name])){
-        unset($this->gotoLogonScripts[$name]);
-      }
-    }
-    $tmp = array();
-    foreach($this->gotoHotplugDevices as $entry){
-      $tmp[$entry['dn']] = $entry;
-    }
-  
-    foreach($attrs['gotoHotplugDevices'] as $name => $plug){
-      if($plug['UsedByAllUsers'] == TRUE){
-        $tmp[$plug['dn']] = $plug;
-      }
-    }
-    foreach($tmp as $name => $plug){
-      $found = false;
-      foreach($attrs['gotoHotplugDevices'] as $test){
-        if($test['dn'] == $name){
-          $found = true;
-        }
-      }
-      if(!$found){
-        unset($tmp[$name]);
-      }
-    }
-  }
-
-
-    /* Return selected values for multiple edit */
-  function get_multi_edit_values()
-  {
-    $ret = plugin::get_multi_edit_values();
-    $ret['gotoShares'] = $this->gotoShares;
-    $ret['gotoLogonScripts'] = $this->gotoLogonScripts;
-    $ret['gotoHotplugDevices'] = $this->gotoHotplugDevices;
-  
-    if(in_array("gotoPrinter",$this->multi_boxes)){
-      $ret['gotoPrinter'] = $this->gotoPrinter;
-      $ret['gotoPrinterSel'] = $this->gotoPrinterSel;
-      $ret['gosaDefaultPrinter'] = $this->gosaDefaultPrinter;
-  
-      /* Force printer reset */
-      $ret['add_del_printer_member_was_called'] = TRUE;
-    }
-  
-    if(in_array("gotoProfileFlagL",$this->multi_boxes)){
-      $ret['gotoProfileFlagL'] = $this->gotoProfileFlagL;
-    }
-
-    if(in_array("useProfile",$this->multi_boxes)){
-      $ret['useProfile']=$this->useProfile;
-      if(in_array("gotoProfileServer",$this->multi_boxes)){
-        $ret['gotoProfileServer']=$this->gotoProfileServer;
-      }
-      if(in_array("gotoProfileQuota",$this->multi_boxes)){
-        $ret['gotoProfileQuota']=$this->gotoProfileQuota;
-      }
-      if(in_array("gotoProfileFlagC",$this->multi_boxes)){
-        $ret['gotoProfileFlagC'] = $this->gotoProfileFlagC;
-      }
-    }
-    if(in_array("gotoXResolution",$this->multi_boxes)){
-      $ret['gotoXResolution'] = $this->gotoXResolution;
-    }
-    if(in_array("kiosk_server",$this->multi_boxes)){
-      $ret['gotoKioskProfile_Server'] = $this->gotoKioskProfile_Server;
-      $ret['gotoKioskProfile_Profile'] = $this->gotoKioskProfile_Profile;
-    }
-    return($ret);
-  }
-
-
-  function multiple_check() 
-  {
-    $message = plugin::multiple_check();
-    $this->detect_grouptype();
-
-    if(preg_match("/[^0-9]/",$this->gotoProfileQuota) && in_array("gotoProfileQuota",$this->multi_boxes)) {
-      $message[]=_("Please set a valid profile quota size.");
-    }
-    return($message);
-  }
-
-
-  function multiple_save_object()
-  {
-    if(isset($_POST['environment_multiple_posted'])){
-      plugin::multiple_save_object();
-      
-      if(isset($_POST['useProfile'])){
-        $this->useProfile = true;
-      }else{
-        $this->useProfile = false;
-      }
-      if(isset($_POST['gotoProfileFlagC'])){
-        $this->gotoProfileFlagC = $_POST['gotoProfileFlagC'];
-      }else{
-        $this->gotoProfileFlagC = false;
-      }
-
-      if(isset($_POST['gotoProfileFlagL'])){
-        $this->gotoProfileFlagL = $_POST['gotoProfileFlagL'];
-      }else{
-        $this->gotoProfileFlagL = false;
-      }
-
-      foreach(array("gotoProfileFlagL","gotoPrinter","kiosk_server","gotoXResolution",
-                    "useProfile","gotoProfileServer","gotoProfileQuota","gotoProfileFlagC") as $attr){
-        $uattr = "use_".$attr;
-        if(isset($_POST[$uattr])){
-          $this->multi_boxes[] = $attr;
-        }
-      }
-      if(isset($_POST['kiosk_server'])){
-        $tmp = $_POST['kiosk_server'];
-        if(isset($this->gotoKioskProfiles['SERVERS'][$tmp])){
-          $this->gotoKioskProfile_Server = $_POST['kiosk_server'];
-        }
-      }
-      if(isset($_POST['kiosk_profile'])){
-        $tmp = $_POST['kiosk_profile'];
-        if(in_array($tmp,$this->gotoKioskProfiles['BY_SERVER'][$this->gotoKioskProfile_Server])){
-          $this->gotoKioskProfile_Profile = $_POST['kiosk_profile'];
-        }
-      }
-
-    }
-  }
-
-  /* Return plugin informations for acl handling 
-#FIXME these ACLs should work for groups too */ 
-  static function plInfo()
-  {
-    return (array("plShortName"     => _("Environment"),
-          "plDescription"   => _("Environment settings"),         // Description
-          "plSelfModify"    => TRUE,                              
-          "plDepends"       => array("user", "posixAccount"),     // This plugin depends on 
-          "plPriority"      => 3,                                 // Position in tabs 
-          "plSection"     => array("personal" => _("My account")),
-          "plCategory"    => array("users",
-                                   "groups"),
-          "plOptions"       => array("resolution_hook" => array("type" => "string",
-              "description" => _("Command to extend the list of possible screen resolutions"))),
-
-          "plProvidedAcls"  => array(
-
-            "gotoProfileFlagL"    => _("Resolution changeable during session") ,
-            "gotoProfileFlagC"    => _("Cache profile localy") ,
-
-            "gotoProfileQuota"    => _("Profile quota") ,
-            "gotoProfileServer"   => _("Profile server") ,
-
-            "gotoXResolution"     => _("Resolution") ,
-            "gotoKioskProfile"    => _("Kiosk profile") ,
-
-            "gosaDefaultPrinter"  => _("Default printer") ,
-            "gotoLogonScript"     => _("Logon script") ,
-            "gotoHotplugDevice"   => _("Hotplug devices"),
-            "gotoShare"           => _("Shares"))
-            ));
-  }
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/gosa-core/plugins/personal/environment/class_hotplugDialog.inc b/gosa-core/plugins/personal/environment/class_hotplugDialog.inc
deleted file mode 100644 (file)
index b3a20f8..0000000
+++ /dev/null
@@ -1,112 +0,0 @@
-<?php
-
-class hotplugDialog extends plugin
-{
-  /* CLI vars */
-  var $cli_summary          = "Manage server basic objects";
-  var $cli_description      = "Some longer text\nfor help";
-  var $cli_parameters       = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
-  /* attribute list for save action */
-  var $hotplugDevices           = ""; 
-  var $hotplugDeviceList        = array(); 
-  var $regex                    = "*";
-  var $depselect                = "/";
-  var $deplist                  = "/";
-  var $skipThese                = array();
-
-  function hotplugDialog (&$config,$skipThese = array())
-  {
-    $this->skipThese  = $skipThese;
-    $this->config     = $config;
-    $this->depselect   = session::get('CurrentMainBase');
-  }
-
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-    /* Fill templating stuff */
-    $smarty= get_smarty();
-    $display= "";
-
-    if(isset($_POST['dialogissubmitted'])){
-      $this->regex=$_POST['regexHot'];
-      $this->depselect = $_POST['depselectHot'];
-    }
-
-    if((isset($_GET['search']))&&(!empty($_GET['search']))){
-      $this->regex=$_GET['search']."*";
-      $this->regex=preg_replace("/\*\*/","*",$this->regex);
-    }
-
-    $this->deplist=$this->config->idepartments;
-
-    $this->hotplugDevices = $this->getHotplugs();
-    $smarty->assign("regexHot"    ,$this->regex);
-    $smarty->assign("deplistHot"  ,$this->deplist);
-    $smarty->assign("depselectHot",$this->depselect);
-    $smarty->assign("apply", apply_filter());
-    $smarty->assign("alphabet", generate_alphabet());
-    $smarty->assign("search_image", get_template_path('images/search.png'));
-    $smarty->assign("tree_image", get_template_path('images/tree.png'));
-    $smarty->assign("launchimage", get_template_path('images/small_filter.png'));
-    $smarty->assign("deplist", $this->config->idepartments);
-
-
-    $smarty->assign("hotplugDevices",$this->hotplugDevices);
-    $smarty->assign("hotplugDeviceKeys",array_flip($this->hotplugDevices));
-    $display.= $smarty->fetch(get_template_path('hotplugDialog.tpl', TRUE,dirname(__FILE__)));
-    return($display);
-  }
-
-
-  /* Save to LDAP */
-  function save()
-  {
-    $entries = array();
-    foreach($_POST['hotplugName'] as $name){
-      $entries[$name] = $this->hotplugDeviceList[$name];
-    }
-    return $entries;
-  }
-
-  function getHotplugs()
-  {
-    $ldap= $this->config->get_ldap_link();
-    $ldap->cd(get_ou('deviceou').$this->depselect);
-    $ldap->search("(&(objectClass=gotoDevice)(|(cn=".$this->regex.")(description=".$this->regex.")))",array("gotoHotplugDevice","cn","dn")); 
-
-    $a_return = array();  
-    $this->hotplugDeviceList = array();
-    while($attr = $ldap->fetch()){
-
-      if(isset($attr['gotoHotplugDevice'][0])){
-
-        $hot_plug = $attr['gotoHotplugDevice'][0];
-        $tmp      = preg_split("/\|/",$hot_plug);
-        $tmp2     = array();
-          
-        if(in_array($attr['cn'][0],$this->skipThese)){
-          continue;
-        }
-
-        $tmp2['name']         = $attr['cn'][0];
-        $tmp2['description']  = $tmp[0];
-        $tmp2['id']           = $tmp[1];
-        $tmp2['produkt']      = $tmp[2];
-        $tmp2['vendor']       = $tmp[3];
-        $tmp2['dn']           = $attr['dn'];
-
-        $a_return[$attr['cn'][0]]= $attr['cn'][0]." [".$tmp[0]."] ".$tmp[1];
-
-        $this->hotplugDeviceList[$attr['cn'][0]]=$tmp2;
-      }
-    }
-    return($a_return);
-  }
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/gosa-core/plugins/personal/environment/class_logonManagementDialog.inc b/gosa-core/plugins/personal/environment/class_logonManagementDialog.inc
deleted file mode 100644 (file)
index f125ad0..0000000
+++ /dev/null
@@ -1,139 +0,0 @@
-<?php
-class logonManagementDialog extends plugin
-{
-  /* CLI vars */
-  var $cli_summary          = "Manage server basic objects";
-  var $cli_description      = "Some longer text\nfor help";
-  var $cli_parameters       = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
-  /* attribute list for save action */
-  var $ignore_account       = TRUE;
-  var $attributes           = array("LogonName","LogonPriority","LogonLast","LogonOverload","LogonData","LogonDescription");
-  var $objectclasses        = array("whatever");
-  var $use_existing         = false;  
-
-  var $LogonName        ="";  // Name for the LogonScript
-  var $LogonPriority    ="";  // Priority defines the order in which the scripts will be processed 
-  var $LogonLast        ="";  // Is this script marked as the last, all following scripts will be skipped
-  var $LogonOverload    ="";  // If Overload is activated this script is overlaodable by a group script with same prio
-  var $LogonData        ="";  // The script itself
-  var $LogonDescription ="";
-    
-  var $nameIsEditable = true;
-
-  var $real_LogonName = "";
-
-  function logonManagementDialog (&$config, $dn= NULL,$data=false)
-  {
-    plugin::plugin ($config, $dn);
-    
-    if($data){
-      $this->LogonName        = $data['LogonName'];
-      $this->LogonPriority    = $data['LogonPriority'];
-      $this->LogonOverload    = $data['LogonOverload'];
-      $this->LogonLast        = $data['LogonLast'];
-      $this->LogonData        = $data['LogonData'];
-      $this->LogonDescription = $data['LogonDescription'];
-      $this->nameIsEditable   = false;
-      $this->real_LogonName   = $data['LogonName'];
-    }
-  }
-
-  function execute()
-  {
-       /* Call parent execute */
-       plugin::execute();
-
-    $smarty= get_smarty();
-    $display= "";
-
-    if((isset($_POST['StartImport']))&&(isset($_FILES['importFile']))){
-      $this->LogonData = file_get_contents($_FILES['importFile']['tmp_name']);
-      @unlink($_FILES['importFile']['tmp_name']);
-    }
-
-    foreach($this->attributes as $attr){
-      $smarty->assign($attr,$this->$attr);
-      if($this->$attr){
-        $smarty->assign($attr."CHK"," checked ");
-      }else{
-        $smarty->assign($attr."CHK","");
-      }
-    }
-    $prios=array(1,2,3,4,5,6,7,8,9,10);
-    $smarty->assign("LogonPrioritys",$prios);
-    $smarty->assign("LogonPriorityKeys",$prios);
-
-    if(!$this->nameIsEditable){
-      $smarty->assign("LogonNameACL"," disabled ");
-    }else{
-      $smarty->assign("LogonNameACL","");
-    }
-  
-
-    $display.= $smarty->fetch(get_template_path('logonManagement.tpl', TRUE,dirname(__FILE__)));
-    return($display);
-  }
-
-  function save_object()
-  {
-    if(isset($_POST['dialogissubmitted'])){
-      foreach($this->attributes as $attr){
-
-        if(!$this->nameIsEditable && $attr == 'LogonName'){
-          continue;
-        }
-        if(isset($_POST[$attr])){
-          $this->$attr = stripslashes($_POST[$attr]); 
-        }
-      }
-
-      foreach(array("LogonLast","LogonOverload") as $checkBoxes){
-        if(isset($_POST[$checkBoxes])){
-          $this->$checkBoxes = stripslashes($_POST[$checkBoxes]);
-        }else{
-          $this->$checkBoxes = "";
-        }
-
-      }
-    }
-  }
-
-  function check()
-  {
-    /* Call common method to give check the hook */
-    $message= plugin::check();
-  
-    if(preg_match("/[^a-zA-Z]/",$this->LogonName)){
-      $message[] = _("Specified name should only consist of upper-/lowercase characters.");
-    }
-
-    if(empty($this->LogonName)){
-      $message[] = _("Please specify a valid script name.");
-    }
-
-    if(preg_match("/[^a-z0-9,\.-;:_\(\)!\? ]/i",$this->LogonDescription)){
-      $message[] = _("Specified description contains invalid characters.");
-    }
-
-    return $message;
-  }
-
-
-  function save()
-  {
-    $a_return= array();
-    foreach($this->attributes as $attr){
-      $a_return[$attr]=$this->$attr;
-    }  
-
-    if(!$this->nameIsEditable){
-      $a_return['LogonName']=$this->real_LogonName;
-    }
-
-    return($a_return); 
-  }
-
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/gosa-core/plugins/personal/environment/class_selectPrinterDialog.inc b/gosa-core/plugins/personal/environment/class_selectPrinterDialog.inc
deleted file mode 100644 (file)
index b1ebc49..0000000
+++ /dev/null
@@ -1,170 +0,0 @@
-<?php
-
-class selectPrinterDialog extends plugin
-{
-  /* CLI vars */
-  var $cli_summary          = "Manage server basic objects";
-  var $cli_description      = "Some longer text\nfor help";
-  var $cli_parameters       = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
-  /* attribute list for save action */
-  var $ignore_account       = TRUE;
-  var $attributes           = array();
-  var $objectclasses        = array("whatever");
-  var $AlreadyAssigned      = array();  
-  var $regex                = "*";
-  var $depselect            = "/";
-  var $deplist              = array("/");
-  var $module               = array("printer");
-  var $ui                   = NULL;
-  var $subtreesearch        = FALSE;
-
-  function selectPrinterDialog (&$config, $dn= NULL,$alreadyused=array() )
-  {
-    $this->AlreadyAssigned = $alreadyused;
-    plugin::plugin ($config, $dn);
-
-    /* Get all departments within this subtree */
-    $base = $this->config->current['BASE'];
-
-    /* Add base */
-    $tmp = array();
-    $tmp[] = array("dn"=>$this->config->current['BASE']);
-    $tmp=  array_merge($tmp,get_list("(&(|(ou=*)(description=*))(objectClass=gosaDepartment))", $this->module, $base,
-                    array("ou", "description"), GL_SIZELIMIT | GL_SUBSEARCH));
-
-    $deps = array();
-    foreach($tmp as $tm){
-      $deps[$tm['dn']] = $tm['dn'];
-    }
-
-
-    /* Load possible departments */
-    $ui= get_userinfo();
-    $this->ui = $ui;
-    $tdeps= $ui->get_module_departments("users");
-    $ids = $this->config->idepartments;
-    $first = "";
-    $found = FALSE;
-    $res = array();
-    foreach($ids as $dep => $name){
-      if(isset($deps[$dep]) && in_array_ics($dep, $tdeps)){
-        $res[$dep] = $ids[$dep]; //$tdeps[$dep];
-      }
-    }
-    $this->deplist = $res;
-    $this->depselect = key($res);
-  }
-
-  function execute()
-  {
-    /* Call parent execute */
-    plugin::execute();
-
-    /* Fill templating stuff */
-    $smarty= get_smarty();
-    $display= "";
-
-    if(isset($_POST['dialogissubmitted'])){
-      foreach(array('regexPrinter' => 'regex','depselectPrinter'=>'depselect') as $attr => $name){
-        if(isset($_POST[$attr])){
-          $this->$name      =$_POST[$attr];
-        }
-      }
-    }
-
-    if(isset($_POST['subtrees'])){
-      $this->subtreesearch= TRUE;
-    } else {
-      $this->subtreesearch= FALSE;
-    }
-
-    if((isset($_GET['search']))&&(!empty($_GET['search']))){
-      $this->regex=$_GET['search']."*";
-      $this->regex=preg_replace("/\*\*/","*",$this->regex);
-    }
-
-    $smarty->assign("regexPrinter"    ,$this->regex);
-    $smarty->assign("deplistPrinter"  ,$this->deplist);
-    $smarty->assign("depselectPrinter",$this->depselect);
-    $smarty->assign("gotoPrinters",$this->getPrinter());
-    $smarty->assign("gotoPrinterKeys",array_flip($this->getPrinter()));
-    $smarty->assign("apply", apply_filter());
-    $smarty->assign("alphabet", generate_alphabet());
-    $smarty->assign("subtrees", $this->subtreesearch?"checked":"");
-    $smarty->assign("search_image", get_template_path('images/search.png'));
-    $smarty->assign("tree_image", get_template_path('images/tree.png'));
-    $smarty->assign("infoimage", get_template_path('images/info.png'));
-    $smarty->assign("launchimage", get_template_path('images/small_filter.png'));
-    $smarty->assign("deplist", $this->config->idepartments);
-
-    $display.= $smarty->fetch(get_template_path('selectPrinterDialog.tpl', TRUE,dirname(__FILE__)));
-    return($display);
-  }
-
-  function check(){
-    /* Call common method to give check the hook */
-    $message= plugin::check();
-
-    if(empty($_POST['gotoPrinter'])){
-      $message[] = _("Please select a printer or press cancel.");
-    }
-    return $message;
-  }
-
-  /* Save to LDAP */
-  function save()
-  {
-    return($_POST['gotoPrinter']);
-  }
-
-  /* This function generates the Printerlist
-   * All printers are returned that match regex and and depselect
-   */
-  function getPrinter($detailed = false)
-  {
-    $a_return=array();
-
-
-    $filter = "(&(objectClass=gotoPrinter)(cn=".$this->regex."))";
-    $module = $this->module;
-    $base   = $this->depselect;
-    $attrs  = array("cn","description");
-
-    if ($this->subtreesearch){
-      $res    = get_list($filter,$module,$base,$attrs, GL_SIZELIMIT | GL_SUBSEARCH);
-    } else {
-      $base= get_ou('printerou').$base;
-      $res    = get_list($filter,$module,$base,$attrs, GL_SIZELIMIT);
-    }
-
-    foreach($res as $printer)  {
-
-      $acl = $this->ui->get_permissions($printer['dn'],"printer/printgeneric","gotoUserPrinter");
-
-      if(!preg_match("/w/",$acl)){
-        continue;
-      }
-
-      if(isset($this->AlreadyAssigned[$printer['cn'][0]])) continue;
-
-      if($detailed ==true){
-        $a_return[$printer['cn'][0]] = $printer;
-      }else{
-        if(isset($printer['description'][0])){
-          $a_return[$printer['cn'][0]] = $printer['cn'][0]." - ".$printer['description'][0];  
-        }else{
-          $a_return[$printer['cn'][0]] = $printer['cn'][0];  
-        }
-      }
-    }
-    return($a_return);
-  }
-}
-
-
-
-
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/gosa-core/plugins/personal/environment/environment.tpl b/gosa-core/plugins/personal/environment/environment.tpl
deleted file mode 100644 (file)
index d1370f6..0000000
+++ /dev/null
@@ -1,405 +0,0 @@
-{if $is_account ne 'true'}
- <img alt="" class="center" src="images/stop.png" align="middle">
- {t}The environment extension is currently disabled.{/t}
-{else}
-
-
-<input type="hidden" name="iamposted" value="1">
-
-<h2> 
- <img class="center" alt="" src="images/fai_profile.png" align="middle" /> 
- {t}Profiles{/t}
-</h2>
-
-<table summary="{t}Environment managment settings{/t}" width="100%">
- <tr>
-  <td style="width:50%;border-right:1px solid #B0B0B0;vertical-align:top;">
-
-
-{if $multiple_support}
-
-       {render acl=$gotoProfileACL checkbox=$multiple_support checked=$use_useProfile}
-               <input class="center" type="checkbox" value="1" {if $useProfile} checked {/if} name="useProfile" id="useProfile">{t}Use profile managment{/t}
-       {/render}
-       <br>
-       {render acl=$gotoProfileServerACL checkbox=$multiple_support checked=$use_gotoProfileServer}
-               {t}Profil path{/t}
-               <select id="gotoProfileServer" name="gotoProfileServer">
-                       {html_options values=$gotoProfileServerKeys output=$gotoProfileServers selected=$gotoProfileServer}
-               </select>
-       {/render}
-       <br>
-       {render acl=$gotoProfileQuotaACL checkbox=$multiple_support checked=$use_gotoProfileQuota}
-                        <input type="text" name="gotoProfileQuota" value="{$gotoProfileQuota}" size="6" id="gotoProfileQuota">{t}MB{/t}
-       {/render}
-       <br>
-       {render acl=$gotoProfileFlagCACL checkbox=$multiple_support checked=$use_gotoProfileFlagC}
-               <input class="center" type="checkbox" name="gotoProfileFlagC" value="C" {$gotoProfileFlagCCHK} id="gotoProfileFlagC">&nbsp;
-               {t}Cache profile localy{/t}
-       {/render}
-
-{else}
-
-
-   <table summary="{t}Profile managment{/t}">
-    <tr>
-     <td style="vertical-align:top">
-{render acl=$gotoProfileACL}
-      <input class="center" type="checkbox" value="1" {$useProfileCHK} name="useProfile" id="useProfile" onclick="changeState('gotoProfileServer');changeState('gotoProfileFlagC');changeState('gotoProfileQuota');">
-{/render}
-     </td>
-     <td style="vertical-align:middle;">
-      <label for="useProfile">{t}Use profile managment{/t}</label>
-     </td>
-    </tr>
-    <tr>
-     <td>&nbsp;
-     </td>
-     <td>
-      <table summary="{t}Profile server managment{/t}">
-       <tr>
-        <td> 
-         <label for="gotoProfileServer">{t}Profil path{/t}</label>
-        </td>
-        <td>
-{render acl=$gotoProfileServerACL}
-
-{if $gotoProfileServerWriteable}
-         <select id="gotoProfileServer" name="gotoProfileServer">
-          {html_options values=$gotoProfileServerKeys output=$gotoProfileServers selected=$gotoProfileServer}
-          <option disabled>&nbsp;</option>
-         </select>
-{else}
-         <select id="gotoProfileServer" name="gotoProfileServer">
-          {html_options values=$gotoProfileServer output=$gotoProfileServer selected=$gotoProfileServer}
-          <option disabled>&nbsp;</option>
-         </select>
-{/if}
-{/render}
-        </td>
-       </tr>
-       <tr>
-        <td>
-         <label for="gotoProfileQuota">{t}Profil quota{/t}</label> 
-         <br>
-         <br>
-        </td>
-        <td>
-{render acl=$gotoProfileQuotaACL}
-         <input type="text" name="gotoProfileQuota" value="{$gotoProfileQuota}" size="6" id="gotoProfileQuota">{t}MB{/t}
-{/render}
-         <br>
-         <br>
-        </td>
-       </tr>
-       <tr>
-        <td colspan=2> 
-{render acl=$gotoProfileFlagCACL}
-         <input class="center" type="checkbox" name="gotoProfileFlagC" value="C" {$gotoProfileFlagCCHK} id="gotoProfileFlagC">&nbsp;
-{/render}
-         <label for="gotoProfileFlagC">{t}Cache profile localy{/t}</label>
-        </td>
-       </tr>
-      </table>
-     </td>
-    </tr>
-   </table>
-
-{/if}
-
-  </td>
-  <td style="vertical-align:top">
-
-  <table summary="{t}Kiosk profile settings{/t}">
-{if $kiosk_enabled }
-    <tr>
-     <td colwidth=2>
-      <label for="kiosk_server">{t}Kiosk profile{/t}</label>
-     </td>
-    </tr>
-    <tr>
-     <td>      
-{if $multiple_support}
-         <input type="checkbox" name="use_kiosk_server" value="1" {if $use_kiosk_server} checked {/if} 
-               class="center" 
-                       onClick="changeState('kiosk_server');
-                                        changeState('kiosk_profile');"> 
-{/if}
-         {t}Server{/t}
-      <select name='kiosk_server' id="kiosk_server" onChange='document.mainform.submit();'
-               {if !$use_kiosk_server && $multiple_support} disabled {/if}>
-       {html_options options=$kiosk_servers selected=$kiosk_server}
-      </select>
-     </td>
-     <td>
-      {if $kiosk_server != "none"}
-      {t}Profile{/t}
-      <select name='kiosk_profile' id="kiosk_profile"
-        {if !$use_kiosk_server && $multiple_support} disabled {/if}>
-       {html_options values=$kiosk_profiles output=$kiosk_profiles selected=$kiosk_profile}
-      </select>
-      {else}
-        &nbsp;
-      {/if}
-     </td>
-    </tr>
- {else}
-       <tr>
-               <td>
-                       <label for="dummy1">{t}Kiosk profile{/t}</label>
-               </td>
-               <td>
-                       <select name="dummy1" disabled id="dummy1"><option disabled>&nbsp;</option></select>
-                       <input type="button" disabled name="dummy2" value="{t}Manage{/t}">
-               </td>
-       </tr>
-{/if}
-    <tr>
-     <td colspan=2>
-      <br>
-{render acl=$gotoProfileFlagLACL checkbox=$multiple_support checked=$use_gotoProfileFlagL}
-      <input type="checkbox" name="gotoProfileFlagL" id="gotoProfileFlagL" value="L" {$gotoProfileFlagLCHK} class="center">
-{/render}
-      <label for="gotoProfileFlagL">{t}Resolution changeable during session{/t}</label>
-     </td>
-    </tr>
-    <tr>
-     <td>
-{if $multiple_support}
-         <input type="checkbox" value="1" class="center" name="use_gotoXResolution"
-               onClick="changeState('gotoXResolution');" {if $use_gotoXResolution} checked {/if}>
-{/if}
-      <label for="gotoXResolution">{t}Resolution{/t}</label>
-     </td>
-     <td>
-{render acl=$gotoXResolutionACL}
-      <select name="gotoXResolution" id="gotoXResolution" {if !$use_gotoXResolution && $multiple_support} disabled {/if}>
-       {html_options values=$gotoXResolutionKeys output=$gotoXResolutions selected=$gotoXResolution}
-      <option disabled>&nbsp;</option>
-      </select>
-{/render}
-     </td>
-    </tr>
-   </table> 
-
-
-
-
-
-
-  </td>
- </tr>
-</table>
-
-<p class="seperator">&nbsp;</p>
-
-<table summary="{t}Environment managment settings{/t}" width="100%">
- <tr>
-  <td style="width:50%;border-right:1px solid #B0B0B0">
-   <h2>
-    <img class="center" alt="" src="images/fai_partitionTable.png" align="middle" />&nbsp;
-    <label for="gotoShare">{t}Shares{/t}</label>
-   </h2>
-   <table summary="" style="width:100%">
-    <tr>
-     <td>
-       
-{render acl=$gotoShareACL}
-      {$divlistShares}
-{/render}
-{render acl=$gotoShareACL}
-      <input type="text" size=15 name="ShareUser" value="%u" title="{t}User used to connect to the share{/t}">@
-{/render}
-{render acl=$gotoShareACL}
-      <select name="gotoShareSelection" title="{t}Select a share{/t}">
-       {html_options values=$gotoShareSelectionKeys output=$gotoShareSelections}
-       <option disabled>&nbsp;</option>
-      </select>
-{/render}
-      :
-{render acl=$gotoShareACL}
-      <input type="text" size=15 name="gotoShareMountPoint" value="%H/Netzlaufwerke/%L/%S"
-      title="{t}Mount path{/t}">
-{/render}
-{render acl=$gotoShareACL}
-      <input type="submit" name="gotoShareAdd" value="{t}Add{/t}"> 
-{/render}
-      <!--   <input type="submit" name="gotoShareDel" value="{t}Remove{/t}"> -->
-     </td>
-    </tr>
-   </table>
-  </td>
-  <td style="vertical-align:top">
-   <h2>
-    <img class="center" alt="" src="images/fai_script.png" align="middle" />&nbsp;
-    <label for="gotoLogonScript">{t}Logon scripts{/t}</label>
-   </h2>
-   <table summary="{t}Logon script management{/t}" style="width:100%">
-    <tr>
-     <td>
-{render acl=$gotoLogonScriptACL}
-      <select style="width:100%;" name="gotoLogonScript" multiple size=5 id="gotoLogonScript">
-
-               {if $multiple_support}
-                       {foreach from=$gotoLogonScripts item=item key=key}
-                               {if $item.UsedByAllUsers}
-                               <option value="{$key}">{$item.LogonPriority}&nbsp;{$item.LogonName}&nbsp;[{$item.LogonDescription}] ({t}Used by all users{/t})</option>
-                               {else}
-                               <option style='color: #888888; background: #DDDDDD;background-color: #DDDDDD;' value="{$key}">{$item.LogonPriority}&nbsp;{$item.LogonName}&nbsp;[{$item.LogonDescription}] ({t}Used by some users{/t})</option>
-                               {/if}
-                       {/foreach}
-               {else}
-          {html_options values=$gotoLogonScriptKeys output=$gotoLogonScripts }
-              <option disabled>&nbsp;</option>
-               {/if}
-      </select>
-{/render}
-
-      <br>
-{render acl=$gotoLogonScriptACL}
-      <input type="submit" name="gotoLogonScriptNew" value="{t}Add{/t}">
-{/render}
-{render acl=$gotoLogonScriptACL}
-      <input type="submit" name="gotoLogonScriptEdit"  value="{t}Edit{/t}" {if $gotoLogonScriptKeysCnt ==0} disabled {/if}>
-{/render}
-{render acl=$gotoLogonScriptACL}
-      <input type="submit" name="gotoLogonScriptDel"  value="{t}Delete{/t}" {if $gotoLogonScriptKeysCnt ==0} disabled {/if}>
-{/render}
-     </td>
-    </tr>
-   </table> 
-  </td>
- </tr>
-</table>
-
-<p class="seperator">&nbsp;</p>
-
-<table summary="{t}Environment managment settings{/t}" width="100%">
- <tr>
-  <td style="border-right:1px solid #B0B0B0; width:50%; vertical-align:top">
-   <h2>
-    <img alt="" src="images/hotplug.png" align="middle" class="center" />&nbsp;
-    <label for="gotoHotplugDevice_post">{t}Hotplug devices{/t}</label>
-   </h2> 
-   <table style="width:100%" summary="{t}Hotplug device settings{/t}">
-    <tr>
-     <td>
-{render acl=$gotoHotplugDeviceACL}
-      <select name="gotoHotplugDevice_post[]" size=5  style="width:100%;" id="gotoHotplugDevice_post" multiple>
-               {if $multiple_support}
-                       {foreach from=$gotoHotplugDevices item=item key=key}
-                               {if $item.UsedByAllUsers}
-                               <option value="{$key}">{$item.name}&nbsp;[{$item.description}] ({t}Used by all users{/t})</option>
-                               {else}
-                               <option style='color: #888888; background: #DDDDDD;background-color: #DDDDDD;' value="{$key}">{$item.name}&nbsp;[{$item.description}] ({t}Used by some users{/t})</option>
-                               {/if}
-                       {/foreach}
-               {else}
-                  {html_options values=$gotoHotplugDeviceKeys output=$gotoHotplugDevices}
-                  <option disabled>&nbsp;</option>
-               {/if}
-      </select>
-{/render}
-     </td>
-    </tr>
-    <tr>
-     <td>
-{render acl=$gotoHotplugDeviceACL}
-      <input type="submit" name="gotoHotplugDeviceUse" value="{t}Add{/t}">
-{/render}
-{render acl=$gotoHotplugDeviceACL}
-      <input type="submit" name="gotoHotplugDeviceDel" value="{t}Delete{/t}"
-      {if !$gotoHotplugDevices} disabled {/if}>
-{/render}
-     </td>
-    </tr>
-   </table>
-  </td>
-  <td>
-
-
-{if $multiple_support}
-
-   <h2>
-       <input type="checkbox" name="use_gotoPrinter" value="1" {if $use_gotoPrinter} checked {/if}
-               class="center" onClick="toggle('div_gotoPrinter');">
-    <img alt="" src="images/select_printer.png" align="middle" class="center" />&nbsp;
-    <label for="gotoPrinter">{t}Printer{/t}</label>
-   </h2>
-
-   <div id="div_gotoPrinter" {if !$use_gotoPrinter} style="visibility:hidden;" {/if}>
-       <b>{t}Using this option will overwrite the complete printer settings for all currently edited objects!{/t}</b>
-   <table style="width:100%" summary="{t}Printer settings{/t}">
-    <tr>
-     <td>
-{render acl=$gotoPrinterACL}
-      <select style="width:100%;" name="gotoPrinterSel[]" multiple size=5 id="gotoPrinter">
-       {html_options values=$gotoPrinterKeys output=$gotoPrinter}
-       <option disabled>&nbsp;</option>
-      </select>
-{/render}
-      <br>
-{render acl=$gotoPrinterACL}
-      <input type="submit"  name="gotoPrinterAdd"     value="{t}Add{/t}">
-{/render}
-{render acl=$gotoPrinterACL}
-      <input type="submit" name="gotoPrinterDel"     value="{t}Delete{/t}" {if !$gotoPrinter } disabled {/if}>
-{/render}
-{render acl=$gotoPrinterACL}
-      <input type="submit" name="gotoPrinterEdit"    value="{t}Toggle admin{/t}" {if !$gotoPrinter } disabled {/if}>
-{/render}
-{render acl=$gosaDefaultPrinterACL}
-      <input type="submit" name="gotoPrinterDefault"    value="{t}Toggle default{/t}" {if !$gotoPrinter | $is_group} disabled {/if}>
-{/render}
-     </td>
-    </tr>
-   </table>
-       </div>
-
-{else}
-
-   <h2>
-    <img alt="" src="images/select_printer.png" align="middle" class="center" />&nbsp;
-    <label for="gotoPrinter">{t}Printer{/t}</label>
-   </h2>
-   <table style="width:100%" summary="{t}Printer settings{/t}">
-    <tr>
-     <td>
-{render acl=$gotoPrinterACL}
-      <select style="width:100%;" name="gotoPrinterSel[]" multiple size=5 id="gotoPrinter">
-       {html_options values=$gotoPrinterKeys output=$gotoPrinter}
-       <option disabled>&nbsp;</option>
-      </select>
-{/render}
-      <br>
-{render acl=$gotoPrinterACL}
-      <input type="submit"  name="gotoPrinterAdd"     value="{t}Add{/t}">
-{/render}
-{render acl=$gotoPrinterACL}
-      <input type="submit" name="gotoPrinterDel"     value="{t}Delete{/t}" {if !$gotoPrinter } disabled {/if}>
-{/render}
-{render acl=$gotoPrinterACL}
-      <input type="submit" name="gotoPrinterEdit"    value="{t}Toggle admin{/t}" {if !$gotoPrinter } disabled {/if}>
-{/render}
-{render acl=$gosaDefaultPrinterACL}
-      <input type="submit" name="gotoPrinterDefault"    value="{t}Toggle default{/t}" {if !$gotoPrinter | $is_group} disabled {/if}>
-{/render}
-     </td>
-    </tr>
-   </table>
-
-{/if}
-
-  </td>
- </tr>
-</table>
-{if $multiple_support}
-       <input type="hidden" name="environment_multiple_posted" value="1">
-{/if}
-<script language="JavaScript" type="text/javascript">
-<!-- // First input field on page
-focus_field('useProfile');
--->
-</script>
-{/if}
-
diff --git a/gosa-core/plugins/personal/environment/hotplugDialog.tpl b/gosa-core/plugins/personal/environment/hotplugDialog.tpl
deleted file mode 100644 (file)
index 868e72b..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-<h2><img class="center" alt="" src="images/hotplug.png" align="middle">&nbsp;{t}Add hotplug devices{/t}</h2>
-
-    <input type="hidden" name="dialogissubmitted" value="1">
-
-       <table summary="{t}Hotplug management{/t}" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4 cellspacing=2>
-        <tr>
-            <td width="50%" style="vertical-align:top;">
-                               <div class="contentboxh" style="height:20px;">
-                               <p class="contentboxh" style="font-size:12px">
-                                       <b><LABEL for="hotplugName">{t}Select hotplug device to add{/t}</LABEL></b>
-                               </p>
-                               </div>
-                               <div class="contentboxb">
-                               <p class="contentboxb" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
-                                               <select style="width:600px;height:450px" size=20 name="hotplugName[]" id="hotplugName" multiple>
-                                                       {html_options values=$hotplugDeviceKeys output=$hotplugDevices}
-                                               <option disabled>&nbsp;</option>
-                                               </select><br>
-                                       </p>
-                               </div>
-            </td>
-                       <td style="vertical-align:top;">
-                <div class="contentboxh" style="height:20px">
-                    <p class="contentboxh" style="font-size:12px"><img src="{$launchimage}" align="right" alt="[F]">{t}Filters{/t}</p>
-                </div>
-                <div class="contentboxb">
-                    <table summary="" style="width:100%;border-top:1px solid #B0B0B0;background-color:#F8F8F8">
-                    {$alphabet}
-                    </table>
-                <table summary="" width="100%" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
-                    <tr>
-                        <td>
-                            <img class="center" alt="" src="{$tree_image}" align=middle>&nbsp;
-                            <select name="depselectHot" size=1 onChange="mainform.submit()" title="{t}Choose the department the search will be based    on{/t}">
-                              {html_options options=$deplistHot selected=$depselectHot}
-                            </select>
-                        </td>
-                    </tr>
-                </table>
-                        <table summary="" width="100%" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
-                            <tr>
-                                <td>
-                                    <LABEL for='filter'><img class="center" alt="Search" src="{$search_image}" align="middle" title="{t}Display users matching{/t}">
-                                    </LABEL>
-                                </td>
-                                <td width="99%">
-                                    <input id='filter' style='width:99%' type='text' name='regexHot' maxlength='20' value='{$regexHot}'
-                                            title='{t}Regular expression for        matching hotplugs{/t}' onChange="mainform.submit()">
-                                </td>
-                            </tr>
-                        </table>
-                    {$apply}
-                </div>
-            </td>
-
-
-               </tr>
-       </table>
-
-    <p class="seperator">&nbsp;</p>
-
-    <p align="right">
-    <input type="submit" name="HotPlugSave"     value="{t}Add{/t}">
-    <input type="submit" name="HotPlugCancel"   value="{t}Cancel{/t}">
-    </p>
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-       focus_field('hotplugName');
-  -->
-</script>
diff --git a/gosa-core/plugins/personal/environment/logonManagement.tpl b/gosa-core/plugins/personal/environment/logonManagement.tpl
deleted file mode 100644 (file)
index 746be6f..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-<h2><img class="center" alt="" src="images/fai_script.png" align="middle">&nbsp;{t}Logon script management{/t}</h2>
-
-    <input type="hidden" name="dialogissubmitted" value="1">
-
-    <table summary="{t}Logon script management{/t}" width="100%">
-       <tr>
-                       <td width="50%" style="vertical-align:top;border-right:1px solid #B0B0B0">
-                                       <table summary="{t}Logon script settings{/t}">
-                                               <tr>
-                                                       <td><LABEL for="LogonName">{t}Skript name{/t}</LABEL>
-                                                       </td>
-                                                       <td>
-                                                               <input type="text" size=20 value="{$LogonName}" name="LogonName" {$LogonNameACL} id="LogonName">
-                                                       </td>
-                                               </tr>
-                                               <tr>
-                                                       <td><LABEL for="LogonDescription">{t}Description{/t}</LABEL>
-                                                       </td>
-                                                       <td>
-                                                               <input type="text" size=40 value="{$LogonDescription}" name="LogonDescription" id="LogonDescription"> 
-                                                       </td>
-                                               </tr>
-                                               <tr>
-                                                       <td><LABEL for="LogonPriority">{t}Priority{/t}</LABEL>
-                                                       </td><td>
-                                               <select name="LogonPriority" id="LogonPriority">
-                                                       {html_options values=$LogonPriorityKeys output=$LogonPrioritys}
-                                               </select>
-                                                       </td>
-                                               </tr>
-                                       </table>
-                       </td>
-                       <td style="vertical-align:top">
-                                       <table summary="{t}Logon script flags{/t}">
-                                               <tr>
-                                                       <td>
-                                                               <input type="checkbox" value="L" name="LogonLast" {$LogonLastCHK} id="LogonLast">
-                                                       <LABEL for="LogonLast">{t}Last script{/t}</LABEL>
-                                                       </td>
-                                               </tr>
-                                               <tr>
-                                                       <td>
-                                                               <input type="checkbox" value="O" name="LogonOverload" {$LogonOverloadCHK} id="LogonOverload">
-                                                               <LABEL for="LogonOverload">{t}Script can be replaced by user{/t}</LABEL>
-                                                       </td>
-                                               </tr>
-                                       </table>
-                       </td>
-               </tr>
-       </table>
-       <p class="seperator">&nbsp;</p>
-       <table width="100%" summary="">
-               <tr>
-                       <td colspan="2">
-                       <h2><img class="center" alt="" src="images/fai_script.png" align="middle">&nbsp;{t}Script{/t}</h2>
-                                       <table width="100%" summary="{t}Logon script{/t}">
-                                               <tr>
-                                                       <td>
-                                                               <textarea style="width:100%;height:400px;" name="LogonData">{$LogonData}</textarea>
-                                                       </td>
-                                               </tr>
-                                               <tr>
-                                                       <td>
-                                                               <input type="file" name="importFile" id="importFile">
-                                                               <input type="submit" value="{t}Import{/t}" name="StartImport" >
-                                                       </td>
-                                               </tr>
-                                       </table>
-                       </td>
-               </tr>
-       </table>        
-
-       <p class="seperator">&nbsp;</p>
-    <p align="right">
-    <input type="submit" name="LogonSave"     value="{t}Apply{/t}">
-    <input type="submit" name="LogonCancel"   value="{t}Cancel{/t}">
-    </p>
-
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-       focus_field('LogonName');
-  -->
-</script>
-
diff --git a/gosa-core/plugins/personal/environment/main.inc b/gosa-core/plugins/personal/environment/main.inc
deleted file mode 100644 (file)
index 4a31aef..0000000
+++ /dev/null
@@ -1,126 +0,0 @@
-<?php
-/*
-   This code is part of GOsa (https://gosa.gonicus.de)
-   Copyright (C) 2003  Cajus Pollmeier
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-$lock_msg = "";
-if (!$remove_lock){
-  /* Reset requested? */
-  if (isset($_POST['edit_cancel']) || 
-      (isset($_GET['reset']) && $_GET['reset'] == 1)){
-#    del_lock ($ui->dn);
-    session::un_set ('edit');
-    session::un_set ('environment');
-  }
-
-  /* Create mail object on demand */
-  if (!session::is_set('environment') || (isset($_GET['reset']) && $_GET['reset'] == 1)){
-    $environment= new environment ($config, $ui->dn);
-    $environment->enable_CSN_check();
-    $environment->set_acl_category('users');
-    $environment->set_acl_base($ui->dn);
-    session::set('environment',$environment);
-  }
-  $environment = session::get('environment');
-
-  /* save changes back to object */
-  if (session::is_set('edit')){
-    $environment->save_object ();
-  }
-
-  /* Enter edit mode? */
-  if (isset($_POST['edit'])){
-  
-   /* Check locking */
-    if (($username= get_lock($ui->dn)) != ""){
-      session::set('back_plugin',$plug);
-      session::set('LOCK_VARS_TO_USE',array("/^edit$/","/^plug$/"));
-      $lock_msg =  gen_locked_message ($username, $ui->dn);
-
-    }else{
-
-      /* Lock the current entry */
-      add_lock ($ui->dn, $ui->dn);
-      session::set('dn',$ui->dn);
-      session::set('edit',TRUE);
-    }
-  }
-
-  /* save changes to LDAP and disable edit mode */
-  if (isset($_POST['edit_finish'])){
-
-    /* Perform checks */
-    $message= $environment->check ();
-
-    /* No errors, save object */
-    if (count ($message) == 0){
-      $environment->save ();
-      del_lock ($ui->dn);
-      session::un_set ('edit');
-
-      /* Remove object */
-      session::un_set ('environment');
-    } else {
-      /* Errors found, show message */
-      show_errors ($message);
-    }
-  }
-
-  /* Execute formular */
-  if($lock_msg){
-    $display = $lock_msg;
-  }else{
-    $display = $environment->execute();
-  }
-
-  /* Store changes  in session */
-  if (session::is_set('edit')){
-    session::set('environment',$environment);
-  }
-
-  $info= "";
-  /* Show page footer depending on the mode */
-  if (!$environment->in_dialog && $environment->is_account  && empty($lock_msg)){
-    $display.= "<p class=\"plugbottom\">";
-
-    /* Are we in edit mode? */
-    if ((session::is_set('edit'))&&($environment->dialog===NULL)){
-      $display.= "<input type=submit name=\"edit_finish\" style=\"width:80px\" value=\""._("Ok")."\">\n";
-      $display.= "&nbsp;";
-      $display.= "<input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
-      $info= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png').
-             "\"> ".$ui->dn."&nbsp;";
-    } else {
-      $info= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/openlock.png').
-        "\"> ".$ui->dn."&nbsp;";
-      if(preg_match("/w/",$ui->get_permissions($ui->dn,"users/environment"))){
-        $info.= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/lamp.png').
-          "\"> "._("Click the 'Edit' button below to change informations in this dialog");
-        $display.= "<input type=submit name=\"edit\" value=\""._("Edit")."\">\n";
-      }
-      $display.= "<input type=\"hidden\" name=\"ignore\">\n";
-    }
-    $display.= "</p>\n";
-  }
-
-  /* Page header*/
-  $display= print_header(get_template_path('images/email.png'), _("User environment settings"), $info).$display;
-
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/gosa-core/plugins/personal/environment/selectPrinterDialog.tpl b/gosa-core/plugins/personal/environment/selectPrinterDialog.tpl
deleted file mode 100644 (file)
index f07674d..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-<h2><img class="center" alt="" src="images/select_printer.png" align="middle">&nbsp;{t}Add printer devcies{/t}</h2>
-
-    <input type="hidden" name="dialogissubmitted" value="1">
-
-       <table summary="{t}Select printer to add{/t}" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4>
-        <tr>
-            <td width="50%">
-                               <div class="contentboxh" style="height:20px;">
-                               <p class="contentboxh" style="font-size:12px">
-                                       <b><LABEL for="gotoPrinter">{t}Select printer to add{/t}</LABEL></b>
-                               </p>
-                               </div>
-                               <div class="contentboxb">
-                               <p class="contentboxb" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
-                               <select style="width:600px;height:450px" size=20 name="gotoPrinter[]" id="gotoPrinter" multiple>
-                               {html_options values=$gotoPrinterKeys output=$gotoPrinters}
-                               <option disabled>&nbsp;</option>
-                                        </select><br>
-                                       </p>
-                               </div>
-            </td>
-            <td valign="top">
-                               <div class="contentboxh" style="height:20px">
-                               <p class="contentboxh" style="font-size:12px"><img src="{$launchimage}" align="right" alt="[F]">{t}Filters{/t}</p>
-                               </div>
-                               <div class="contentboxb">
-                               <table summary="" style="width:100%;border-top:1px solid #B0B0B0;background-color:#F8F8F8">
-                               {$alphabet}
-                               </table>
-                               <table summary="" width="100%" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
-                                       <tr>
-                                               <td>
-                                                       <img class="center" alt="" src="{$tree_image}" align=middle>&nbsp;
-                                                       <select name="depselectPrinter" size=1 onChange="mainform.submit()" title="{t}Choose the department the search will be based on{/t}">
-                                                         {html_options options=$deplistPrinter selected=$depselectPrinter}
-                                                       </select>
-                                               </td>
-                                       </tr>
-                               </table>
-                               <table summary="" style="width:100%;border-top:1px solid #B0B0B0;background-color:#F8F8F8">
-                               <tr><td>
-                               <input type=checkbox name="subtrees" value="1" {$subtrees} onClick="mainform.submit()" title="{t}Select to search within subtrees{/t}">{t}Search in subtrees{/t}
-                               </tr></td>
-                               </table>
-                                       <table summary="" width="100%" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
-                                                       <tr>
-                                                               <td>
-                                                                       <LABEL for='filter'><img class="center" alt="Search" src="{$search_image}" align="middle" title="{t}Display printers matching{/t}">
-                                                                       </LABEL>
-                                                               </td>
-                                                       <td width="99%">
-                                                                       <input id='filter' style='width:99%' type='text' name='regexPrinter' maxlength='20' value='{$regexPrinter}' 
-                                                                                       title='{t}Regular expression for matching printer names{/t}' onChange="mainform.submit()">
-                                                               </td>
-                                                       </tr>
-                                               </table>
-                                       {$apply}
-                               </div>
-               </td>
-       </tr>
-    </table>
-
-    <p class="seperator">&nbsp;</p>
-    <p align="right">
-    <input type="submit" name="PrinterSave"     value="{t}Add{/t}">
-    <input type="submit" name="PrinterCancel"   value="{t}Cancel{/t}">
-    </p>
-<script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-       focus_field('gotoPrinter');
-  -->
-</script>
diff --git a/gosa-plugins/goto/admin/applications/class_applicationGeneric.inc b/gosa-plugins/goto/admin/applications/class_applicationGeneric.inc
new file mode 100644 (file)
index 0000000..247acf9
--- /dev/null
@@ -0,0 +1,572 @@
+<?php
+class application extends plugin
+{
+  /* CLI vars */
+  var $cli_summary= "Handling of GOsa's application object";
+  var $cli_description= "Some longer text\nfor help";
+  var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+  /* application attributes */
+  var $cn= "";
+  var $description= "";
+  var $base= "";
+  var $gosaApplicationExecute= "";
+  var $gosaApplicationName= "";
+  var $gosaApplicationFlags= "";
+  var $gosaApplicationIcon= "";
+  var $gotoLogonScript ="";
+  var $iconData;
+  var $view_logged = FALSE;
+
+  /* Headpage attributes */
+  var $last_sorting= "invalid";
+  var $applications= array();
+
+  /* attribute list for save action */
+  var $attributes= array("cn", "description", "gosaApplicationExecute", "gosaApplicationName","gosaApplicationIcon",
+      "gosaApplicationFlags","gotoLogonScript");
+  var $objectclasses= array("top", "gosaApplication");
+
+  var $isReleaseApplikation = false;
+
+  function application (&$config, $dn= NULL, $parent= NULL)
+  {
+    plugin::plugin ($config, $dn, $parent);
+
+    $appfilter = session::get('appfilter')    ;
+
+    $tmp = $this->config->search("faiManagement", "CLASS",array('menu','tabs'));
+    if(!empty($tmp)) {
+      if(!preg_match("/^".get_ou('applicationou')."/",$appfilter['release'])){
+        $this->isReleaseApplikation = true;  
+      }
+    }
+
+    /* Load icon */
+    $ldap= $config->get_ldap_link();
+    if ($dn != 'new'){
+      $this->iconData= $ldap->get_attribute($dn, "gosaApplicationIcon");
+      $this->saved_attributes['gosaApplicationIcon'] = $this->iconData;
+    }
+    if ($this->iconData == ""){
+      $this->set_picture("");
+    }
+    session::set('binary',$this->iconData);
+    session::set('binarytype',"image/jpeg");
+    $this->gosaApplicationIcon= $this->iconData;
+
+    /* This is always an account */
+    $this->is_account= TRUE;
+
+    if ($this->dn == "new"){
+      if(session::is_set('CurrentMainBase')){
+        $this->base = session::get('CurrentMainBase');
+      }else{
+        $ui= get_userinfo();
+        $this->base= dn2base($ui->dn);
+      }
+    } else {
+
+      if($this->isReleaseApplikation){
+        $this->base = preg_replace("/^.*,".get_ou('applicationou')."/","",$this->dn);
+      }else{
+        $this->base= preg_replace ("/^[^,]+,[^,]+,/", "", $this->dn);
+      }
+    }
+  }
+
+
+  function generateTemplate()
+  {
+    $str= "# This code is part of GOsa (https://gosa.gonicus.de)\n#\n";
+
+    $values = array();
+    $names     = array();
+    if($this->parent->by_object['applicationParameters']->is_account){
+      $names = $this->parent->by_object['applicationParameters']->option_name;
+      $values = $this->parent->by_object['applicationParameters']->option_value;
+    }
+
+    if (count($names)){
+      $str .="# This plugin handles these environment variables:\n";
+    } else {
+      $str .="# This plugin handles no environment variables.\n";
+    }
+
+    foreach($names as $index => $name){
+
+      // Fix length
+      for($i = strlen($name) ; $i < 30 ; $i++){
+        $name= $name." ";
+      }
+      if((isset($values[$index]))&&(!empty($values[$index]))){
+        $str.= "# ".$name."\t(e.g. '".$values[$index]."')\n";
+      }else{
+        $str.= "# ".$name."\t("._("no example").")\n";
+      }
+    }
+    $str .= "#\n".
+      "# Don't remove the following tag, it is used for header update.\n".
+      "### END HEADER ###";
+
+    return($str);
+  }
+
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+    /* Log view */
+    if($this->is_account && !$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","application/".get_class($this),$this->dn);
+    }
+
+    $smarty= get_smarty();
+
+    $tmp = $this->plInfo();
+    foreach($tmp['plProvidedAcls'] as $name => $translation){
+      $smarty->assign($name."ACL",$this->getacl($name));
+    }
+    /* Do we represent a valid group? */
+    if (!$this->is_account && $this->parent === NULL){
+      $display= "<img alt=\"\" src=\"images/stop.png\" align=\"middle\">&nbsp;<b>".
+        _("This 'dn' is no application.")."</b>";
+      return ($display);
+    }
+
+    /* Download requested */
+    foreach($_POST as $name => $value){
+      if(preg_match("/^downloadScript/",$name)){
+        session::set('binary',$this->gotoLogonScript);
+        session::set('binarytype',"octet-stream");
+        session::set('binaryfile',$this->cn.".gosaApplication");
+        header("location: getbin.php ");
+        exit();
+      }
+    }
+
+    /* Reassign picture data, sometimes its corrupt cause we started a download of application scripts */
+    session::set('binary',$this->iconData);
+    session::set('binarytype',"image/jpeg");
+    
+    $smarty->assign("rand", rand(0, 10000));
+    $head = $this->generateTemplate();
+    $this->gotoLogonScript= $this->generateTemplate().preg_replace('/.*### END HEADER ###/s', '', $this->gotoLogonScript);
+
+    if((isset($_POST['upLoad']))&&(isset($_FILES['ScriptFile']))){
+      $str = file_get_contents($_FILES['ScriptFile']['tmp_name']);
+      $this->gotoLogonScript = $str;
+    }
+
+    /* Fill templating stuff */
+    $smarty->assign("cn", $this->cn);
+    $smarty->assign("bases", $this->get_allowed_bases());
+    if ($this->dn == "new"){
+      $smarty->assign("selectmode", "");
+      $smarty->assign("namemode", "");
+    } else {
+      $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->get_allowed_bases());
+        $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()){
+        /* Just allow selection valid bases */ 
+        $tmp = $this->get_allowed_bases();
+        if(isset($tmp[$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);
+    $smarty->assign("rand", rand(0, 10000));
+
+    /* Variables */
+    foreach(array("description", "gosaApplicationExecute", "gosaApplicationName","cn") as $val){
+      $smarty->assign($val, $this->$val);
+    }
+
+    /* Checkboxes */
+    foreach (array("G" => "exec_for_groupmembers", "O" => "overwrite_config",
+          "L" => "place_on_kicker",
+          "D" => "place_on_desktop", "M" => "place_in_startmenu") as $key => $val){
+      if (preg_match("/$key/", $this->gosaApplicationFlags)){
+        $smarty->assign("$val", "checked");
+      } else {
+        $smarty->assign("$val", "");
+      }
+    }
+
+    $smarty->assign("isReleaseApplikation" , $this->isReleaseApplikation);
+    $smarty->assign("gotoLogonScript",htmlentities($this->gotoLogonScript, ENT_COMPAT, 'UTF-8'));
+    $smarty->assign("base_select", $this->base);
+    /* Show main page */
+    return($smarty->fetch (get_template_path('generic.tpl', TRUE)));
+  }
+
+
+  function remove_from_parent()
+  {
+    $ldap= $this->config->get_ldap_link();
+    $ldap->rmDir($this->dn);
+    new log("remove","application/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    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");
+
+    /* Delete references to object groups */
+    $ldap->cd ($this->config->current['BASE']);
+    $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".LDAP::prepare4filter($this->dn)."))", array("cn"));
+    while ($ldap->fetch()){
+      $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));
+    }
+
+  }
+
+
+  /* Save data to object */
+  function save_object()
+  {
+    if (isset($_POST['cn'])){
+
+      /* Create a base backup and reset the
+         base directly after calling plugin::save_object();
+         Base will be set seperatly a few lines below */
+      $base_tmp = $this->base;
+      plugin::save_object();
+      $this->base = $base_tmp;
+
+      /* Save attributes */
+      parent::save_object();
+
+      /* Save application flags */
+      $flag= "";
+      if (isset($_POST['exec_for_groupmembers']) && $_POST['exec_for_groupmembers'] == 1){
+        $flag.= "G";
+      }
+      if (isset($_POST['place_on_desktop']) && $_POST['place_on_desktop'] == 1){
+        $flag.= "D";
+      }
+      if (isset($_POST['place_on_kicker']) && $_POST['place_on_kicker'] == 1){
+        $flag.= "L";
+      }
+      if (isset($_POST['place_in_startmenu']) && $_POST['place_in_startmenu'] == 1){
+        $flag.= "M";
+      }
+      if (isset($_POST['overwrite_config']) && $_POST['overwrite_config'] == 1){
+        $flag.= "O";
+      }
+      if ($this->acl_is_writeable("gosaApplicationFlags")){
+        $this->gosaApplicationFlags= "[$flag]";
+      }
+
+      /* Remove current picture */
+      if(isset($_POST['remove_picture'])){
+        $this->set_picture("");
+      }
+
+      /* Check for picture upload */
+      if (isset($_FILES['picture_file']['name']) && $_FILES['picture_file']['name'] != ""){
+
+        if (!is_uploaded_file($_FILES['picture_file']['tmp_name'])) {
+          print_red (_("The specified picture has not been uploaded correctly."));
+        }
+
+        if (!function_exists("imagick_blob2image")){
+          /* Get temporary file name for conversation */
+          $fname = tempnam ("/tmp", "GOsa");
+
+          /* Open file and write out photoData */
+          $fp = fopen ($fname, "w");
+          fwrite ($fp, $_FILES['picture_file']['tmp_name']);
+          fclose ($fp);
+
+          /* Build conversation query. Filename is generated automatically, so
+             we do not need any special security checks. Exec command and save
+             output. For PHP safe mode, you'll need a configuration which respects
+             image magick as executable... */
+          $query= "convert -size 48x48 $fname -resize 48x48 +profile \"*\" -";
+          @DEBUG (DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__, $query, "Execute");
+
+          /* Read data written by convert */
+          $output= "";
+          $sh= popen($query, 'r');
+          while (!feof($sh)){
+            $output.= fread($sh, 4096);
+          }
+          pclose($sh);
+
+          unlink($fname);      
+        } else {
+
+          /* Load the new uploaded Photo */
+          if(!$handle  =  imagick_ReadImage($_FILES['picture_file']['tmp_name'])){
+            print_red(_("Can't access uploaded image."));
+          }
+
+          /* Resizing image to 147x200 and blur */
+          if(!imagick_resize($handle,48,48,IMAGICK_FILTER_GAUSSIAN,0)){
+            print_red(_("Uploaded image could not be resized, possilby the image magick extension is missing."));
+          }
+
+          /* Converting image to JPEG */
+          if(!imagick_convert($handle,"PNG")) {
+            print_red(_("Could not convert image to png, possilby the image magick extension is missing."));
+          }
+
+          if(!imagick_writeimage($handle,$_FILES['picture_file']['tmp_name'])){
+            print_red(sprintf(_("Could not save uploaded image to %s."),$_FILES['picture_file']['tmp_name']));
+          }
+
+          imagick_free($handle);
+        }
+
+        /* Activate new picture */
+        $this->set_picture($_FILES['picture_file']['tmp_name']);
+      }        
+
+      if(!$this->isReleaseApplikation){
+        $tmp = $this->get_allowed_bases();
+        if(isset($_POST['base'])){
+          if(isset($tmp[$_POST['base']])){
+            $this->base= $_POST['base'];
+          }
+        }
+      }
+    }
+  }
+
+
+  /* Check values */
+  function check()
+  {
+    /* Call common method to give check the hook */
+    $message= plugin::check();
+
+    if(!preg_match("#^/#",$this->gosaApplicationExecute)){
+      $message[]=(_("Specified execute path must start with '/'."));
+    }
+
+    /* Permissions for that base? */
+    if ($this->base != ""){
+      $new_dn= "cn=".$this->cn.",".get_ou('applicationou').$this->base;
+    } else {
+      $new_dn= $this->dn;
+    }
+
+
+    if($this->dn == "new"){
+      $this->set_acl_base($this->base);
+    }
+
+    /* All required fields are set? */
+    if ($this->cn == ""){
+      $message[]= _("Required field 'Name' is not filled.");
+    }
+
+    if(preg_match("/[^a-z0-9]/",$this->cn))    {
+      $message[]=_("Invalid character in application name. Only a-z 0-9 are allowed.");
+    }
+
+    if ($this->gosaApplicationExecute == ""){
+      $message[]= _("Required field 'Execute' is not filled.");
+    }
+
+    /* Check for existing application */
+    $ldap= $this->config->get_ldap_link();
+    $ldap->cd($this->config->current["BASE"]);
+
+    $tmp = $this->config->search("faiManagement", "CLASS",array('menu','tabs'));
+    $appfilter = session::get('appfilter');
+    if((!empty($tmp)) && (isset($appfilter['release']))){
+      $baseDn = str_replace($this->config->current['BASE'],$this->base,$appfilter['release']);
+      $baseDn = preg_replace("/".get_ou('applicationou').".*/",get_ou('applicationou').$this->base,$appfilter['release']);
+      $ldap->ls("(&(objectClass=gosaApplication)(cn=".$this->cn."))",$baseDn,array("cn"));
+      if($ldap->count()){
+        $attrs = $ldap->fetch();
+        if($this->dn != $attrs['dn']) {
+          $message[]= _("There's already an application with this 'Name'.");
+        }
+      }
+    }else{
+      $ldap->ls("(&(objectClass=gosaApplication)(cn=".$this->cn."))",get_ou('applicationou').$this->base,array("cn"));
+      if ($ldap->count()){
+        $attrs = $ldap->fetch();
+        if($this->dn != $attrs['dn']) {
+          $message[]= _("There's already an application with this 'Name'.");
+        }
+      }
+    }
+    return $message;
+  }
+
+
+  /* Save to LDAP */
+  function save()
+  {
+    /* Get application script without header part, to check if we must save the script itself */
+    $script = preg_replace('/.*### END HEADER ###/s', '', $this->gotoLogonScript);
+
+    plugin::save();
+    $this->attrs["gosaApplicationIcon"]= $this->gosaApplicationIcon;
+
+    /* Write back to ldap */
+    $ldap= $this->config->get_ldap_link();
+    $ldap->cat($this->dn, array('dn'));
+
+    $a= $ldap->fetch();
+    if (count($a)){
+
+      /* Remove gotoLogonScript if it is empty */
+      if(empty($script))    {
+        $this->attrs['gotoLogonScript'] = array();
+      }
+
+      $ldap->cd($this->dn);
+      $this->cleanup();
+      $ldap->modify ($this->attrs); 
+      $this->handle_post_events("modify");
+      new log("modify","application/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    } else {
+      
+      /* Remove gotoLogonScript if it is empty */
+      if(empty($script))    {
+        unset($this->attrs['gotoLogonScript']);
+      }
+
+      $ldap->cd($this->config->current['BASE']);
+      $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
+      $ldap->cd($this->dn);
+      $ldap->add($this->attrs);
+      new log("create","application/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+      $this->handle_post_events("add");
+    }
+    show_ldap_error($ldap->get_error(), sprintf(_("Saving of application with dn '%s' failed."),$this->dn));
+  }
+
+  function set_picture($filename)
+  {
+    if (!is_file($filename)){
+      $filename= "./images/default_icon.png";
+      $this->gosaApplicationIcon= "*removed*";
+    }
+
+    if (file_exists($filename)){
+      $fd = fopen ($filename, "rb");
+      $this->iconData= fread ($fd, filesize ($filename));
+      session::set('binary',$this->iconData);
+      session::set('binarytype',"image/jpeg");
+      $this->gosaApplicationIcon= $this->iconData;
+
+      fclose ($fd);
+    }
+  }
+
+  function getCopyDialog()
+  {
+    $vars = array("cn");
+
+    $str ="<h2>"._("Application settings")."</h2>
+      <table>
+      <tr>
+      <td>".
+      _("Application name"). 
+      "</td>  
+      <td>
+      <input id='gosaApplicationName' name='cn' size='35' maxlength='60' 
+      value='".$this->cn."' 
+      title='"._("Application name to be displayed (i.e. below icons)")."'>                     
+      </td>
+      </tr>
+      </table>";
+    $ret = array();
+    $ret['status'] = "";
+    $ret['string'] = $str;
+    return($ret);
+  }
+
+  function saveCopyDialog()
+  {
+    if(isset($_POST['cn'])){
+      $this->cn = $_POST['cn'];
+    }
+  }
+
+
+  function PrepareForCopyPaste($source)
+  {
+    plugin::PrepareForCopyPaste($source);
+    $source_o = new application($this->config,$source['dn']);
+    $this->gosaApplicationIcon = $source_o->gosaApplicationIcon;     
+  }
+
+
+  /* Return plugin informations for acl handling
+      #FIXME FAIscript seams to ununsed within this class... */
+  static 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"),
+            "base"              => _("Base"),
+            "description"       => _("Description"),
+            "gosaApplicationExecute"  => _("Execute"),
+            "gosaApplicationName"     => _("Name"),
+            "gosaApplicationIcon"     => _("Icon"),
+            "gosaApplicationFlags"    => _("Flag"),
+            "gotoLogonScript"         => _("Script content"),
+
+            "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:
+?>
diff --git a/gosa-plugins/goto/admin/applications/class_applicationManagement.inc b/gosa-plugins/goto/admin/applications/class_applicationManagement.inc
new file mode 100644 (file)
index 0000000..c781032
--- /dev/null
@@ -0,0 +1,647 @@
+<?php
+/*
+   This code is part of GOsa (https://gosa.gonicus.de)
+   Copyright (C) 2003  Cajus Pollmeier
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+class applicationManagement extends plugin
+{
+  /* Definitions */
+  var $plHeadline     = "Applications";
+  var $plDescription  = "This does something";
+
+  /* Dialog attributes */
+  var $apptabs                  = NULL;
+  var $ui                       = NULL;
+  var $CopyPasteHandler         = NULL;
+  var $DivListApplication       = NULL;
+  var $applications             = array();
+  var $enableReleaseManagement  = false;
+  var $start_pasting_copied_objects = FALSE;
+
+  function IsReleaseManagementActivated()
+  {
+    /* Check if we should enable the release selection */
+    $tmp = $this->config->search("faiManagement", "CLASS",array('menu','tabs'));
+    if(!empty($tmp)){
+      return(true);
+    }
+    return(false);
+  }
+
+  function applicationManagement (&$config, &$ui)
+  {
+    /* Save configuration for internal use */
+    $this->config   = &$config;
+    $this->ui       = &$ui;
+
+    /* Check if copy & paste is activated */
+    if($this->config->boolValueIsTrue("MAIN","ENABLECOPYPASTE")){
+      $this->CopyPasteHandler = new CopyPasteHandler($this->config);
+    }
+
+    /* Creat dialog object */
+    $this->DivListApplication = new divListApplication($this->config,$this);
+
+    if($this->IsReleaseManagementActivated()){
+    /* Check if we should enable the release selection */
+      $this->enableReleaseManagement = true;
+
+      /* Hide SubSearch checkbox */
+      $this->DivListApplication->DisableCheckBox("SubSearch");
+    }
+  }
+
+  function getReleases($base)
+  {
+    $ldap                   = $this->config->get_ldap_link();
+    $dn                     = get_ou('applicationou').$base;
+    $ret                    = array();
+    $ret [get_ou('applicationou').$base] = "/";
+
+    $ldap->cd($dn);
+    $ldap->search("objectClass=organizationalUnit",array("ou"));
+
+    while($attrs = $ldap->fetch()){
+      $str = str_replace($dn,"",$attrs['dn']);
+      $tmp = array_reverse( split("ou=",$str));
+      $str = "";
+      foreach($tmp as $val){
+        $val = trim(preg_replace("/,/","",$val));
+        if(empty($val)) break;
+        $str .= "/".$val;
+      } 
+      if(!empty($str)){
+        $ret[$attrs['dn']]= preg_replace("/^\//","",$str);
+      }
+    }
+    asort($ret);
+    return($ret);
+  }
+
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+
+    /**************** 
+      Variable init 
+     ****************/
+
+    /* These vars will be stored if you try to open a locked app, 
+        to be able to perform your last requests after showing a warning message */
+    session::set('LOCK_VARS_TO_USE',array("/^act$/","/^id$/","/^appl_edit_/","/^appl_del_/","/^item_selected/","/^remove_multiple_applications/"));
+
+    $smarty       = get_smarty();             // Smarty instance
+    $s_action     = "";                       // Contains the action to proceed
+    $s_entry      = "";                       // The value for s_action
+    $base_back    = "";                       // The Link for Backbutton
+    
+    /* Test Posts */
+    foreach($_POST as $key => $val){
+      // Post for delete
+      if(preg_match("/appl_del.*/",$key)){
+        $s_action = "del";
+        $s_entry  = preg_replace("/appl_".$s_action."_/i","",$key);
+        // Post for edit
+      }elseif(preg_match("/appl_edit_.*/",$key)){
+        $s_action="edit";
+        $s_entry  = preg_replace("/appl_".$s_action."_/i","",$key);
+        // Post for new
+      }elseif(preg_match("/^copy_.*/",$key)){
+        $s_action="copy";
+        $s_entry  = preg_replace("/^copy_/i","",$key);
+      }elseif(preg_match("/^cut_.*/",$key)){
+        $s_action="cut";
+        $s_entry  = preg_replace("/^cut_/i","",$key);
+        // Post for new
+      }elseif(preg_match("/^appl_new.*/",$key)){
+        $s_action="new";
+      }elseif(preg_match("/^remove_multiple_applications/",$key)){
+        $s_action="del_multiple";
+      }elseif(preg_match("/^editPaste.*/i",$key)){
+        $s_action="editPaste";
+      }elseif(preg_match("/^multiple_copy_groups/",$key)){
+        $s_action = "copy_multiple";
+      }elseif(preg_match("/^multiple_cut_groups/",$key)){
+        $s_action = "cut_multiple";
+      }
+    }
+
+    if((isset($_GET['act']))&&($_GET['act']=="edit_entry")){
+      $s_action ="edit";
+      $s_entry  = $_GET['id'];
+    }
+
+    $s_entry  = preg_replace("/_.$/","",$s_entry);
+
+
+    /* handle C&P from layers menu */
+    if(isset($_POST['menu_action']) && preg_match("/^multiple_copy_systems/",$_POST['menu_action'])){
+      $s_action = "copy_multiple";
+    }
+    if(isset($_POST['menu_action']) && preg_match("/^multiple_cut_systems/",$_POST['menu_action'])){
+      $s_action = "cut_multiple";
+    }
+    if(isset($_POST['menu_action']) && preg_match("/^editPaste/",$_POST['menu_action'])){
+      $s_action = "editPaste";
+    }
+
+    /* Create options */
+    if(isset($_POST['menu_action']) && $_POST['menu_action'] == "appl_new"){
+      $s_action = "new";
+    }
+
+    /* handle remove from layers menu */
+    if(isset($_POST['menu_action']) && preg_match("/^remove_multiple/",$_POST['menu_action'])){
+      $s_action = "del_multiple";
+    }
+
+    /**************** 
+      Copy & Paste handling  
+     ****************/
+
+    /* Display the copy & paste dialog, if it is currently open */
+    $ret = $this->copyPasteHandling_from_queue($s_action,$s_entry);
+    if($ret){
+      return($ret);
+    }
+
+    /**************** 
+      Create a new app 
+     ****************/
+
+    /* New application? */
+    if ($s_action=="new"){
+
+      /* By default we set 'dn' to 'new', all relevant plugins will
+         react on this. */
+      $this->dn= "new";
+
+      /* Create new usertab object */
+      $this->apptabs= new apptabs($this->config,$this->config->data['TABS']['APPSTABS'], $this->dn,"application");
+      $this->apptabs->set_acl_base($this->DivListApplication->selectedBase);
+    }
+
+
+    /**************** 
+      Edit entry canceled 
+     ****************/
+
+    /* Cancel dialogs */
+    if (isset($_POST['edit_cancel']) || isset($_POST['password_cancel'])){
+      del_lock ($this->apptabs->dn);
+      unset ($this->apptabs);
+      $this->apptabs= NULL;
+      session::un_set('objectinfo');
+    }
+
+
+    /**************** 
+      Edit entry finished 
+     ****************/
+
+    /* Finish apps edit is triggered by the tabulator dialog, so
+       the user wants to save edited data. Check and save at this
+       point. */
+    if ((isset($_POST['edit_finish']) || isset($_POST['edit_apply']) ) && (isset($this->apptabs->config))){
+
+      /* Check tabs, will feed message array */
+      $this->apptabs->last= $this->apptabs->current;
+      $this->apptabs->save_object();
+      $message= $this->apptabs->check();
+
+      /* Save, or display error message? */
+      if (count($message) == 0){
+
+        /* Save data data to ldap */
+        $this->apptabs->set_release($this->DivListApplication->selectedRelease);
+        $this->apptabs->save();
+
+        if (!isset($_POST['edit_apply'])){
+          /* Application has been saved successfully, remove lock from
+             LDAP. */
+          if ($this->dn != "new"){
+            del_lock ($this->dn);
+          }
+          unset ($this->apptabs);
+          $this->apptabs= NULL;
+          session::un_set('objectinfo');
+        }
+      } else {
+        /* Ok. There seem to be errors regarding to the tab data,
+           show message and continue as usual. */
+        show_errors($message);
+      }
+    }
+
+
+    /**************** 
+      Edit entry  
+     ****************/
+
+    /* User wants to edit data? */
+    if (($s_action=="edit") && (!isset($this->apptabs->config))){
+
+      /* Get 'dn' from posted 'applist', must be unique */
+      $this->dn= $this->applications[$s_entry]['dn'];
+
+      /* Check locking, save current plugin in 'back_plugin', so
+         the dialog knows where to return. */
+      if (($user= get_lock($this->dn)) != ""){
+        return(gen_locked_message ($user, $this->dn));
+      }
+
+      /* Lock the current entry, so everyone will get the
+         above dialog */
+      add_lock ($this->dn, $this->ui->dn);
+
+      /* Register apptabs to trigger edit dialog */
+      $this->apptabs= new apptabs($this->config,$this->config->data['TABS']['APPSTABS'], $this->dn,"application");
+      $this->apptabs->set_acl_base($this->dn);
+      session::set('objectinfo',$this->dn);
+    }
+
+
+
+    /********************
+      Delete MULTIPLE entries requested, display confirm dialog
+     ********************/
+
+    if ($s_action=="del_multiple"){
+      $ids = $this->list_get_selected_items();
+
+      if(count($ids)){
+
+        foreach($ids as $id){
+          $dn = $this->applications[$id]['dn'];
+          if (($user= get_lock($dn)) != ""){
+            return(gen_locked_message ($user, $dn));
+          }
+          $this->dns[$id] = $dn;
+        }
+
+        $dns_names = "<br><pre>";
+        foreach($this->dns as $dn){
+          add_lock ($dn, $this->ui->dn);
+          $dns_names .= $dn."\n";
+        }
+        $dns_names .="</pre>";
+
+        /* Lock the current entry, so nobody will edit it during deletion */
+        if (count($this->dns) == 1){
+          $smarty->assign("intro",     sprintf(_("You're about to delete the following entry %s"), @LDAP::fix($dns_names)));
+        } else {
+          $smarty->assign("intro",     sprintf(_("You're about to delete the following entries %s"), @LDAP::fix($dns_names)));
+        }
+        $smarty->assign("multiple", true);
+        return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
+      }
+    }
+
+
+    /********************
+      Delete MULTIPLE entries confirmed
+     ********************/
+
+    /* Confirmation for deletion has been passed. Users should be deleted. */
+    if (isset($_POST['delete_multiple_application_confirm'])){
+
+      /* Remove user by user and check acls before removeing them */
+      foreach($this->dns as $key => $dn){
+
+        $ui = get_userinfo();
+        $acl = $ui->get_permissions($dn ,"application/application");
+        if (preg_match('/d/', $acl)){
+
+          /* Delete request is permitted, perform LDAP action */
+          $this->apptabs= new apptabs($this->config, $this->config->data['TABS']['APPSTABS'], $dn,"application");
+          $this->apptabs->set_acl_base($dn);
+          $this->apptabs->delete ();
+          unset ($this->apptabs);
+          $this->apptabs= NULL;
+
+        } else {
+          /* Normally this shouldn't be reached, send some extra
+             logs to notify the administrator */
+          print_red (_("You are not allowed to delete this application!"));
+          new log("security","application/".get_class($this),$dn,array(),"Tried to trick deletion.");
+        }
+        /* Remove lock file after successfull deletion */
+        del_lock ($dn);
+        unset($this->dns[$key]);
+      }
+    }
+
+
+    /********************
+      Delete MULTIPLE entries Canceled
+     ********************/
+
+    /* Remove lock */
+    if(isset($_POST['delete_multiple_application_cancel'])){
+      foreach($this->dns as $key => $dn){
+        del_lock ($dn);
+        unset($this->dns[$key]);
+      }
+    }
+
+    /**************** 
+      Delete app 
+     ****************/
+
+    /* Remove user was requested */
+    if ($s_action == "del"){
+
+      /* Get 'dn' from posted 'uid' */
+      $this->dn= $this->applications[$s_entry]['dn'];
+
+      /* Load permissions for selected 'dn' and check if
+         we're allowed to remove this 'dn' */
+      $ui = get_userinfo();
+      $acl = $ui->get_permissions($this->dn ,"application/application");
+
+      if(preg_match("/d/",$acl)){
+        /* Check locking, save current plugin in 'back_plugin', so
+           the dialog knows where to return. */
+        if (($user= get_lock($this->dn)) != ""){
+          return (gen_locked_message ($user, $this->dn));
+        }
+
+        /* Lock the current entry, so nobody will edit it during deletion */
+        add_lock ($this->dn, $this->ui->dn);
+        $smarty= get_smarty();
+        $smarty->assign("intro", sprintf(_("You're about to delete the application '%s'."), @LDAP::fix($this->dn)));
+        $smarty->assign("multiple", false);
+        return($smarty->fetch (get_template_path('remove.tpl', TRUE)));
+      } else {
+
+        /* Obviously the user isn't allowed to delete. Show message and
+           clean session. */
+        print_red (_("You are not allowed to delete this application!"));
+      }
+    }
+
+
+    /**************** 
+      Delete app confirmed 
+     ****************/
+
+    /* Confirmation for deletion has been passed. Group should be deleted. */
+    if (isset($_POST['delete_app_confirm'])){
+
+      /* Some nice guy may send this as POST, so we've to check
+         for the permissions again. */
+      $ui = get_userinfo();
+      $acl = $ui->get_permissions($this->dn ,"application/application");
+
+      if(preg_match("/d/",$acl)){
+
+        /* Delete request is permitted, perform LDAP action */
+        $this->apptabs= new apptabs($this->config, $this->config->data['TABS']['APPSTABS'], $this->dn,"application");
+        $this->apptabs->set_acl_base($this->dn);
+        $this->apptabs->delete ();
+        unset ($this->apptabs);
+        $this->apptabs= NULL;
+
+      } else {
+
+        /* Normally this shouldn't be reached, send some extra
+           logs to notify the administrator */
+        print_red (_("You are not allowed to delete this application!"));
+        new log("security","application/".get_class($this),$dn,array(),"Tried to trick deletion.");
+      }
+
+      /* Remove lock file after successfull deletion */
+      del_lock ($this->dn);
+    }
+
+
+    /**************** 
+      Delete app canceled 
+     ****************/
+
+    /* Delete application canceled? */
+    if (isset($_POST['delete_cancel'])){
+      del_lock ($this->dn);
+      session::un_set('objectinfo');
+    }
+
+    /* Show tab dialog if object is present */
+    if (($this->apptabs) && (isset($this->apptabs->config))){
+      $display= $this->apptabs->execute();
+
+      /* Don't show buttons if tab dialog requests this */
+      if (!$this->apptabs->by_object[$this->apptabs->current]->dialog){
+        $display.= "<p style=\"text-align:right\">\n";
+        $display.= "<input type=\"submit\" name=\"edit_finish\" style=\"width:80px\" value=\""._("Ok")."\">\n";
+        $display.= "&nbsp;\n";
+        if ($this->dn != "new"){
+          $display.= "<input type=submit name=\"edit_apply\" value=\""._("Apply")."\">\n";
+          $display.= "&nbsp;\n";
+        }
+        $display.= "<input type=\"submit\" name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
+        $display.= "</p>";
+      }
+      return ($display);
+    }
+
+
+    /****************
+      Dialog display
+     ****************/
+
+    /* Check if there is a snapshot dialog open */
+    $base = $this->DivListApplication->selectedBase;
+    if($str = $this->showSnapshotDialog($base,$this->get_used_snapshot_bases($base))){
+      return($str);
+    }
+
+    /* Display dialog with system list */
+    $this->DivListApplication->parent = $this;
+    $this->DivListApplication->execute();
+    $this->DivListApplication->AddDepartments($this->DivListApplication->selectedBase,3,1);
+    $this->reload();
+    $this->DivListApplication->setEntries($this->applications);
+    return($this->DivListApplication->Draw());
+  }
+
+
+  /* Return departments, that will be included within snapshot detection */
+  function get_used_snapshot_bases(){
+    if($this->DivListApplication->selectedRelease == "main"){
+      return(array($this->DivListApplication->selectedBase));
+    }else{
+      return(array($this->DivListApplication->selectedRelease));
+    }
+  }
+
+
+  function reload()
+  {
+    $this->applications= array();
+
+    /* Set base for all searches */
+    $base       = $this->DivListApplication->selectedBase;
+    $release    = $this->DivListApplication->selectedRelease;
+    $Regex      = $this->DivListApplication->Regex;
+    $SubSearch  = $this->DivListApplication->SubSearch; 
+    $Flags      =  GL_NONE | GL_SIZELIMIT;
+    $Filter     = "(&(cn=".$Regex.")(objectClass=gosaApplication))";
+    $tmp        = array();
+    $Releases   = $this->getReleases($base);
+
+    if(!$this->enableReleaseManagement){
+      $use_base = get_ou('applicationou').$base;
+    }else{
+      if(isset($Releases[$release])){
+        $use_base  = $release;
+      }else{
+        $use_base  = get_ou('applicationou').$base;
+      }
+    }
+
+    if($SubSearch){
+      $Flags    |= GL_SUBSEARCH;  
+    }
+   
+    $res= get_sub_list($Filter, "application",get_ou('applicationou'), $use_base, array("cn","description","dn","objectClass"), $Flags);
+    $tmp2 = array();
+    foreach ($res as $val){
+      $tmp[strtolower($val['cn'][0]).$val['cn'][0].$val['dn']]=$val;
+      $tmp2[strtolower($val['cn'][0]).$val['cn'][0].$val['dn']] = strtolower($val['cn'][0]).$val['cn'][0].$val['dn'];
+    }
+
+    natcasesort($tmp2);
+    $this->applications=array();
+    foreach($tmp2 as $val){
+      $this->applications[]=$tmp[$val];
+    }
+    reset ($this->applications);
+  }
+
+  function remove_from_parent()
+  {
+    /* Optionally execute a command after we're done */
+    $this->postremove();
+  }
+
+
+  function copyPasteHandling_from_queue($s_action,$s_entry)
+  {
+    /* Check if Copy & Paste is disabled */
+    if(!is_object($this->CopyPasteHandler)){
+      return("");
+    }
+
+    /* Add a single entry to queue */
+    if($s_action == "cut" || $s_action == "copy"){
+
+      /* Cleanup object queue */
+      $this->CopyPasteHandler->cleanup_queue();
+      $dn = $this->applications[$s_entry]['dn'];
+      $this->CopyPasteHandler->add_to_queue($dn,$s_action,"apptabs","APPSTABS","application");
+    }
+
+
+    /* Add entries to queue */
+    if($s_action == "copy_multiple" || $s_action == "cut_multiple"){
+
+      /* Cleanup object queue */
+      $this->CopyPasteHandler->cleanup_queue();
+
+      /* Add new entries to CP queue */
+      foreach($this->list_get_selected_items() as $id){
+        $dn = $this->applications[$id]['dn'];
+
+        if($s_action == "copy_multiple"){
+          $this->CopyPasteHandler->add_to_queue($dn,"copy","apptabs","APPSTABS","application");
+        }
+        if($s_action == "cut_multiple"){
+          $this->CopyPasteHandler->add_to_queue($dn,"cut","apptabs","APPSTABS","application");
+        }
+      }
+    }
+
+    /* Start pasting entries */
+    if($s_action == "editPaste"){
+      $this->start_pasting_copied_objects = TRUE;
+    }
+
+
+    /* Return C&P dialog */
+    if($this->start_pasting_copied_objects && $this->CopyPasteHandler->entries_queued()){
+
+      /* Load entry from queue and set base */
+      $this->CopyPasteHandler->load_entry_from_queue();
+      $this->CopyPasteHandler->SetVar("base",$this->DivListApplication->selectedBase);
+
+      /* Get dialog */
+      $data = $this->CopyPasteHandler->execute();
+
+      /* Return dialog data */
+      if(!empty($data)){
+        return($data);
+      }
+    }
+
+    /* Automatically disable status for pasting */
+    if(!$this->CopyPasteHandler->entries_queued()){
+      $this->start_pasting_copied_objects = FALSE;
+    }
+    return("");
+  }
+
+
+  function list_get_selected_items()
+  {
+    $ids = array();
+    foreach($_POST as $name => $value){
+      if(preg_match("/^item_selected_[0-9]*$/",$name)){
+        $id   = preg_replace("/^item_selected_/","",$name);
+        $ids[$id] = $id;
+      }
+    }
+    return($ids);
+  }
+
+
+  /* Save to LDAP */
+  function save()
+  {
+    /* Optionally execute a command after we're done */
+    $this->postcreate();
+  }
+
+  function remove_lock()
+  {
+    if (isset($this->apptabs->dn)){
+      del_lock ($this->apptabs->dn);
+    }
+  }
+
+  function save_object() {
+    $this->DivListApplication->save_object();
+  }
+
+  function check() {}
+  function adapt_from_template($dn) {}
+  function password_change_needed() {}
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-plugins/goto/admin/applications/class_applicationParameters.inc b/gosa-plugins/goto/admin/applications/class_applicationParameters.inc
new file mode 100644 (file)
index 0000000..9f11eb6
--- /dev/null
@@ -0,0 +1,248 @@
+<?php
+class applicationParameters extends plugin
+{
+  /* CLI vars */
+  var $cli_summary= "Manage application class parameters";
+  var $cli_description= "Some longer text\nfor help";
+  var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+  /* Parameters  */
+  var $option_name= array();
+  var $option_value= array();
+
+  /* attribute list for save action */
+  var $attributes= array("gosaApplicationParameter");
+  var $objectclasses= array();
+
+  var $CopyPasteVars = array("option_name","option_value");
+
+  function applicationParameters (&$config, $dn= NULL, $parent= NULL)
+  {
+    plugin::plugin ($config, $dn, $parent);
+
+    $this->gosaApplicationParameter = array();
+
+    if (isset($this->attrs['gosaApplicationParameter'])){
+      $this->is_account= TRUE;
+      for ($i= 0; $i<$this->attrs['gosaApplicationParameter']['count']; $i++){
+        $option= preg_replace('/^[^:]+:/', '',
+            $this->attrs['gosaApplicationParameter'][$i]);
+        $name= preg_replace('/:.*$/', '',
+            $this->attrs['gosaApplicationParameter'][$i]);
+        $this->option_name[$i]= $name;
+        $this->option_value[$i]= $option;
+      }
+    } else {
+      $this->is_account= FALSE;
+    }
+  }
+
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+    /* Do we need to flip is_account state? */
+    if (isset($_POST['modify_state'])){
+      $this->is_account= !$this->is_account;
+    }
+
+    /* Show tab dialog headers */
+    $display= "";
+    if ($this->parent !== NULL){
+      if ($this->is_account){
+        $display= $this->show_disable_header(_("Remove options"),
+            _("This application has options. You can disable them by clicking below."));
+      } else {
+        $display= $this->show_enable_header(_("Create options"),
+            _("This application has options disabled. You can enable them by clicking below."));
+        $this->parent->by_object['application']->generateTemplate();
+        return ($display);
+      }
+    }
+
+    /* Add option to list */
+    if (isset($_POST['add_option'])){
+      $i= count($this->option_name);
+      $this->option_name[$i]= "";
+      $this->option_value[$i]= "";
+    }
+
+    /* Remove value from list */
+    for ($i= 0; $i<count($this->option_name); $i++){
+      if (isset($_POST["remove$i"])){
+        $k= 0;
+        $on= array();
+        $ov= array();
+        for ($j= 0; $j<count($this->option_name); $j++){
+          if ($j != $i){
+            $on[$k]= $this->option_name[$j];
+            $ov[$k]= $this->option_value[$j];
+            $k++;
+          }
+        }
+        $this->option_name= $on;
+        $this->option_value= $ov;
+        break;
+      }
+    }
+
+    /* Generate list of attributes */
+    if (count($this->option_name) == 0){
+      $this->option_name[]= "";
+      $this->option_value[]= "";
+    }
+
+
+    $acl = $this->getacl("gosaApplicationParameter")   ;
+    $table= "<table summary=\"\"><tr><td>"._("Variable")."</td><td>"._("Default value")."</td><td></td></tr>";
+    if (count ($this->option_name)){
+
+      for ($i= 0; $i < count($this->option_name); $i++){
+        $name = $this->option_name[$i];
+        $value= $this->option_value[$i];
+
+        $tag = "";
+        if(!preg_match("/w/",$acl)){
+          $tag = " disabled ";
+        }
+
+        if(!preg_match("/r/",$acl)){
+          $name = "";
+          $value= "";
+        }
+
+        $table.="<tr>".
+          " <td>".
+          "  <input name=\"option$i\" size=25 maxlength=50 value=\"".$name."\" ".$tag.">".
+          " </td>".
+          " <td>".
+          "  <input name=\"value$i\" size=60 maxlength=250 value=\"".$value."\" ".$tag.">".
+          "  <br>".
+          " </td>".
+          " <td>".
+          "  <input type=\"submit\" name=\"remove$i\" value=\""._("Remove")."\" ".$tag.">".
+          " </td>".
+          "</tr>";
+      }
+    }
+    $table.= "</table>";
+    $table.="<input type=\"submit\" name=\"add_option\" value=\""._("Add option")."\">";
+
+    /* Show main page */
+    $smarty= get_smarty();
+    $tmp = $this->plInfo();
+    foreach($tmp['plProvidedAcls'] as $name => $translation){
+      $smarty->assign($name."ACL",$this->getacl($name));
+    }
+
+    $smarty->assign("table", $table);
+    $display.= $smarty->fetch(get_template_path('parameters.tpl', TRUE));
+    $this->parent->by_object['application']->generateTemplate();
+    return ($display);
+  }
+
+  function remove_from_parent()
+  {
+    $ldap= $this->config->get_ldap_link();
+
+    /* Zero attributes */
+    $this->attrs= array();
+    $this->attrs['gosaApplicationParameter']= array();
+
+    $ldap->cd($this->dn);
+    @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__,
+        $this->attributes, "Save");
+    $this->cleanup();
+    $ldap->modify ($this->attrs); 
+
+    show_ldap_error($ldap->get_error(), sprintf(_("Removing of application parameters with dn '%s' failed."),$this->dn));
+
+    /* Optionally execute a command after we're done */
+    $this->handle_post_events('remove');
+  }
+
+
+  /* Save data to object */
+  function save_object()
+  {
+    if (isset($_POST['option0'])){
+      for ($i= 0; $i<count($this->option_name); $i++){
+        $this->option_name[$i]= $_POST["option$i"];
+        $this->option_value[$i]= "";
+        if ($_POST["value$i"] != ""){
+          $this->option_value[$i]= $_POST["value$i"];
+        }
+      }
+    }
+  }
+
+
+  /* Check values */
+  function check()
+  {
+    /* Call common method to give check the hook */
+    $message= plugin::check();
+
+    /* Check for valid option names */
+    for ($i= 0; $i<count($this->option_name); $i++){
+      if (!preg_match ("/^[a-z0-9_]+$/i", $this->option_name[$i])){
+        $message[]= sprintf(_("Value '%s' specified as option name is not valid."), 
+            $this->option_name[$i]);
+      }
+    }
+
+    return $message;
+  }
+
+
+  /* Save to LDAP */
+  function save()
+  {
+    /* Generate values */
+    $this->attrs= array();
+    if (count($this->option_name) == 0){
+      $this->attrs['gosaApplicationParameter']= array();
+    } else {
+      for ($i= 0; $i<count($this->option_name); $i++){
+        $this->attrs['gosaApplicationParameter'][]= $this->option_name[$i].
+          ":".$this->option_value[$i];
+      }
+    }
+
+    /* Write back to ldap */
+    $ldap= $this->config->get_ldap_link();
+    $ldap->cd($this->dn);
+    @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__,
+        $this->attributes, "Save");
+    $this->cleanup();
+    $ldap->modify ($this->attrs); 
+
+    show_ldap_error($ldap->get_error(), sprintf(_("Saving of application parameters with dn '%s' failed."),$this->dn));
+
+    /* Optionally execute a command after we're done */
+    $this->handle_post_events('modify');
+  }
+
+  /* Return plugin informations for acl handling
+#FIXME FAIscript seams to ununsed within this class... */
+  static function plInfo()
+  {
+    return (array(
+          "plShortName"   => _("Parameter"),
+          "plDescription" => _("Parameter configuration"),
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 0,
+          "plSection"     => array("administration"),
+          "plCategory"    => array("application"),
+
+          "plProvidedAcls"=> array(
+            "gosaApplicationParameter"      => _("Application parameter settings"))  
+          ));
+  }
+
+
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-plugins/goto/admin/applications/class_divListApplication.inc b/gosa-plugins/goto/admin/applications/class_divListApplication.inc
new file mode 100644 (file)
index 0000000..f70d5c6
--- /dev/null
@@ -0,0 +1,323 @@
+<?php
+
+class divListApplication extends MultiSelectWindow
+{
+  /* Current base */
+  var $selectedBase       = "";
+  var $selectedRelease    = "main";
+  var $AvailableReleases  = array();
+  var $departments        = array();
+  var $parent               ;
+  var $ui                   ;
+
+  /* Regex */
+  var $Regex           = "*";
+
+  /* Subsearch checkbox */
+  var $SubSearch;
+
+  var $SaveAdditionalVars = array("selectedRelease");
+
+  function divListApplication (&$config,&$parent)
+  {
+    MultiSelectWindow::MultiSelectWindow($config,"Application", "application");
+   
+    $this->selectedRelease = get_ou('applicationou').session::get('CurrentMainBase');
+    $this->parent       = &$parent;
+    $this->ui           = get_userinfo();
+
+    /* Set list strings */
+    $this->SetTitle(_("List of Applications"));
+    $this->SetSummary(_("This table displays all applications in the selected tree."));
+
+    /* Result page will look like a headpage */
+    $this->SetHeadpageMode();
+    $this->SetInformation(_("This menu allows you to add, edit and remove selected applications. You may want to use the range selector on top of the application listbox, when working with a large number of applications."));
+
+    $this->EnableAplhabet(true);
+  
+    /* Disable buttonsm */
+    $this->EnableCloseButton(false);
+    $this->EnableSaveButton (false);
+
+    /* set Page header */
+    $action_col_size = 80;
+    if($this->parent->snapshotEnabled()){
+      $action_col_size += 38;
+    }
+
+
+    /* Toggle all selected / deselected */
+    $chk = "<input type='checkbox' id='select_all' name='select_all'
+               onClick='toggle_all_(\"^item_selected_[0-9]*$\",\"select_all\");' >";
+
+    /* set Page header */
+    $this->AddHeader(array("string"=> $chk,          "attach"=>"style='width:20px;'"));
+    $this->AddHeader(array("string" => "&nbsp;",                "attach" => "style='text-align:center;width:20px;'"));
+    $this->AddHeader(array("string" => _("Application name")." / "._("Department"), "attach" => "style=''"));
+    $this->AddHeader(array("string" => _("Actions"),            "attach" => "style='width:".$action_col_size."px;border-right:0px;text-align:right;'"));
+
+    /* Add SubSearch checkbox */
+    $this->AddCheckBox("SubSearch",  _("Select to search within subtrees"), _("Search in subtrees"), false);
+
+    /*                  Name                 ,Text                              ,Default  , Connect with alphabet  */
+    $this->AddRegex   ("Regex",     _("Display users matching"),"*" , true);
+  }
+
+  function AddUserBoxToFilter($position){
+    $str = "";
+    if(($position  == 2) && ($this->parent->IsReleaseManagementActivated($this->config))){
+      $smarty = get_smarty();
+      $smarty->assign("selectedRelease",$this->selectedRelease);
+      $smarty->assign("branchimage","images/branch.png");
+      $smarty->assign("releases",$this->AvailableReleases);
+      $str = $smarty->fetch(get_template_path('release_select.tpl', TRUE));
+    }
+    return($str);
+  }
+
+  function GenHeader()
+  {
+    /* Prepare departments,
+       which are shown in the listbox on top of the listbox
+    */
+    $options= "";
+
+    /* Get all departments within this subtree */
+    $base = $this->config->current['BASE'];
+
+    /* Add base */
+    $tmp = array();
+    $tmp[] = array("dn"=>$this->config->current['BASE']);
+    $tmp=  array_merge($tmp,get_list("(&(|(ou=*)(description=*))(objectClass=gosaDepartment))", $this->module, $base,
+                    array("ou", "description"), GL_SIZELIMIT | GL_SUBSEARCH));
+
+    $deps = array();
+    foreach($tmp as $tm){
+      $deps[$tm['dn']] = $tm['dn'];
+    }
+
+    /* Load possible departments */
+    $ui= get_userinfo();
+    $tdeps= $ui->get_module_departments("application");
+    $ids = $this->config->idepartments;
+    $first = "";
+    $found = FALSE;
+    foreach($ids as $dep => $name){
+      if(isset($deps[$dep]) && in_array_ics($dep, $tdeps)){
+
+        /* Keep first base dn in mind, we could need this
+         *  info if no valid base was found
+         */
+        if(empty($first)) {
+          $first = $dep['dn'];
+        }
+
+        $value = $ids[$dep];
+        if ($this->selectedBase == $dep){
+          $found = TRUE;
+          $options.= "<option selected='selected' value='".$dep."'>$value</option>";
+        } else {
+          $options.= "<option value='".$dep."'>$value</option>";
+        }
+      }
+    }
+
+    /* The currently used base is not visible with your acl setup.
+     * Set base to first useable base.
+     */
+    if(!$found){
+      $this->selectedBase = $first;
+    }
+
+    /* Get acls */
+    $ui       = get_userinfo();
+    $acl      = $ui->get_permissions("cn=dummy,".$this->selectedBase,"application/application");
+    $acl_all  = $ui->has_complete_category_acls($this->selectedBase,"application");
+
+    /* Add default header */
+    $listhead = MultiSelectWindow::get_default_header();
+
+    /* And the rest, a base selection box */
+    $listhead .= _("Base")."&nbsp;<select name='CurrentMainBase' onChange='mainform.submit()' class='center'>$options</select>".
+      " <input class='center' type='image' src='images/list_submit.png' align='middle' 
+        title='"._("Submit department")."' name='submit_department' alt='"._("Submit")."'>&nbsp;";
+
+    /* Create Layers menu */
+    $s  = ".|"._("Actions")."|\n";
+    $s .= "..|<img src='images/list_new.png' alt='' border='0' class='center'>".
+      "&nbsp;"._("Create")."|\n";
+
+    /* Append create options */
+    if(preg_match("/c/",$acl)) {
+      $s.= "...|<input class='center' type='image' src='images/list_new_app' alt=''>".
+        "&nbsp;"._("Application")."|appl_new|\n";
+    }
+
+    /* Multiple options */
+    $s.= "..|---|\n";
+    $s.= "..|<img src='images/edittrash.png' alt='' border='0' class='center'>".
+      "&nbsp;"._("Remove")."|"."remove_multiple|\n";
+
+    /* Add multiple copy & cut icons */
+    if(is_object($this->parent->CopyPasteHandler) && preg_match("/(c.*w|w.*c)/",$acl_all)){
+      $s.= "..|---|\n";
+      $s.= "..|<img src='images/editcopy.png' alt='' border='0' class='center'>".
+        "&nbsp;"._("Copy")."|"."multiple_copy_systems|\n";
+      $s.= "..|<img src='images/editcut.png' alt='' border='0' class='center'>".
+        "&nbsp;"._("Cut")."|"."multiple_cut_systems|\n";
+
+      if($this->parent->CopyPasteHandler->entries_queued()){
+        $img = "<img border='0' class='center' src='images/editpaste.png' alt=''>";
+        $s.="..|".$img."&nbsp;"._("Paste")."|editPaste|\n";
+      }else{
+        $img = "<img border='0' class='center' src='images/cant_editpaste.png' alt=''>";
+        $s.="..|".$img."&nbsp;"._("Paste")."\n";
+      }
+    }
+
+    /* Add snapshot icons */
+    if(preg_match("/(c.*w|w.*c)/",$acl_all)){
+      $s .= "..|---|\n";
+      $s .= $this->get_snapshot_header(TRUE);
+    }
+
+    $this->SetDropDownHeaderMenu($s);
+    $this->SetListHeader($listhead);
+
+    $this->SetListHeader($listhead);
+  }
+
+  /* so some basic settings */
+  function execute()
+  {
+    $this->ClearElementsList();
+    $this->GenHeader();
+    $this->AvailableReleases = $this->parent->getReleases($this->selectedBase);
+  }
+
+  function setEntries($list)
+  {
+    /********************
+      Variable init
+     ********************/
+  
+    /* Create links */
+    $linkopen = "<a href='?plug=".$_GET['plug']."&amp;act=dep_open&amp;dep_id=%s'>%s</a>";
+    $editlink = "<a href='?plug=".$_GET['plug']."&amp;id=%s&amp;act=edit_entry'>%s</a>";
+    $userimg  = "<img class='center' src='images/select_groups.png' alt='User'    title='%s'>";
+    $applimg  = "<img class='center' src='images/select_application.png' alt='A'  title='"._("Application")."'>";
+    $empty    = "<img class='center' src='images/empty.png' style='width:16px;height:16px;' alt=''>";
+
+    /* set Page header */
+    $action_col_size = 80;
+    if($this->parent->snapshotEnabled()){
+      $action_col_size += 38;
+    }
+
+    /********************
+      Attach objects
+     ********************/
+    
+    $ui = get_userinfo();
+    foreach($list as $key => $val){
+
+      $acl = $ui->get_permissions($val['dn'],"application/application");
+      $acl_all= $ui->has_complete_category_acls($val['dn'],"application");
+
+      /* Create action icons */
+      $actions= "";
+
+      /* Add Copy & Paste icon */
+      if(($this->parent->CopyPasteHandler) && preg_match("/(c.*w|w.*c)/",$acl_all)){
+        /* Only add cut icon, if we are allowed to move this user */
+        if(preg_match("/m/",$acl)){
+          $actions.= "<input class='center' type='image'
+            src='images/editcut.png' alt='"._("cut")."' name='cut_%KEY%' title='"._("Cut this entry")."'>&nbsp;";
+
+          $actions.= "<input class='center' type='image'
+            src='images/editcopy.png' alt='"._("copy")."' name='copy_%KEY%' title='"._("Copy this entry")."'>&nbsp;";
+        }
+      }
+
+      /* Add edit icon */
+      $actions.= "<input class='center' type='image'
+        src='images/edit.png' alt='"._("edit")."' name='appl_edit_%KEY%' title='"._("Edit this entry")."'>";
+
+
+      if(preg_match("/(c.*w|w.*c)/",$acl_all)){
+        $actions.= $this->GetSnapShotActions($val['dn']);
+      }
+
+      /* If we are allowed to remove the application account, display remove icon */
+      if(preg_match("/d/",$acl)){
+        $actions.= "<input class='center' type='image'
+          src='images/edittrash.png' alt='"._("delete")."' name='appl_del_%KEY%' title='"._("Delete this entry")."'>";
+      }else{
+        $actions.= "<img src='images/empty.png' alt='&nbsp;'>";
+      }
+
+      $title = "title='".preg_replace('/ /', '&nbsp;', @LDAP::fix($val['dn']))."'";
+
+      if(!isset($val['description'][0])){
+        $desc = "";
+      }else{
+        $desc = " - [ ".$val['description'][0]." ]";
+      }
+
+      /* Cutted objects should be displayed in light grey */
+      $display = $val['cn'][0].$desc;
+      if($this->parent->CopyPasteHandler){
+        foreach($this->parent->CopyPasteHandler->queue as $queue_key => $queue_data){
+          if($queue_data['dn'] == $val['dn']) {
+            $display = "<font color='#999999'>".$display."</font>";
+            break;
+          }
+        }
+      }
+
+      /* Create each field */
+      $field0 = array("string" => "<input type='checkbox' id='item_selected_".$key."' name='item_selected_".$key."'>" ,
+                      "attach" => "style='width:20px;'");
+      $field1 = array("string" => sprintf($applimg,$val['dn']), "attach" => "style='text-align:center;width:20px;'");
+      $field2 = array("string" => sprintf($editlink,$key,$display), "attach" => "style='' ".$title);
+      $field3 = array("string" => preg_replace("/%KEY%/", $key, $actions), "attach" => "style='width:".$action_col_size."px;border-right:0px;text-align:right;'");
+      $this->AddElement(array($field0,$field1,$field2,$field3));
+    }
+
+    /* Create summary string for list footer */
+    $num_deps=0;
+    if(!$this->SubSearch){
+      $num_deps = count($this->Added_Departments);
+    }
+    $num_apps = count($list);
+
+    $num_app_str = _("Number of listed applications");
+    $num_dep_str = _("Number of listed departments");
+  
+    $str = "<img class='center' src='images/select_application.png' 
+              title='".$num_app_str."' alt='".$num_app_str."'>&nbsp;".$num_apps."&nbsp;&nbsp;&nbsp;&nbsp;";
+    $str.= "<img class='center' src='images/folder.png' 
+              title='".$num_dep_str."' alt='".$num_dep_str."'>&nbsp;".$num_deps."&nbsp;&nbsp;&nbsp;&nbsp;";
+
+    $this->set_List_Bottom_Info($str);
+  }
+
+  function Save()
+  {
+    MultiSelectWindow::Save();  
+  }
+
+  function save_object()
+  {
+    /* Save automatic created POSTs like regex, checkboxes */
+    MultiSelectWindow::save_object(); 
+    $appfilter = session::get('appfilter');
+    $appfilter['release']  = $this->selectedRelease;
+    session::set('appfilter',$appfilter);
+  }
+
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-plugins/goto/admin/applications/generic.tpl b/gosa-plugins/goto/admin/applications/generic.tpl
new file mode 100644 (file)
index 0000000..b50ed7e
--- /dev/null
@@ -0,0 +1,152 @@
+<table summary="" style="width:100%;">
+ <tr>
+  <td style="width:50%;">
+
+   <table summary="">
+     <tr>
+      <td><LABEL for="cn">{t}Application name{/t}{$must}</LABEL></td>
+      <td>
+{render acl=$cnACL}
+       <input id="cn" name="cn" size=25 maxlength=60 value="{$cn}" title="{t}Application name{/t}">
+{/render}
+      </td>
+    </tr>
+    <tr>
+     <td><LABEL for="gosaApplicationName">{t}Display name{/t}</LABEL></td>
+     <td>
+{render acl=$gosaApplicationNameACL}
+        <input id="gosaApplicationName" name="gosaApplicationName" size=35 maxlength=60 
+         value="{$gosaApplicationName}" title="{t}Application name to be displayed (i.e. below icons){/t}">
+{/render}
+     </td>
+    </tr>
+    <tr>
+     <td><LABEL for="gosaApplicationExecute">{t}Execute{/t}{$must}</LABEL></td>
+     <td>
+{render acl=$gosaApplicationExecuteACL}
+        <input id="gosaApplicationExecute" name="gosaApplicationExecute" size=35 maxlength=120 
+         value="{$gosaApplicationExecute}" title="{t}Path and/or binary name of application{/t}">
+{/render}
+     </td>
+    </tr>
+    <tr>
+     <td><LABEL for="description">{t}Description{/t}</LABEL></td>
+     <td>
+{render acl=$descriptionACL}
+      <input id="description" name="description" size=35 maxlength=80 value="{$description}">
+{/render}
+     </td>
+    </tr>
+    <tr><td colspan=2><div style="height:15px;"></div></td></tr>
+    <tr>
+      <td><LABEL for="base">{t}Base{/t}{$must}</LABEL></td>
+      <td>
+{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/folder_gray.png'}
+      <input type="image" name="chooseBase" src="images/folder.png" class="center" title="{t}Select a base{/t}">
+{/render}
+{/if}
+      </td>
+     </tr>
+   </table>
+  </td>
+  <td style="border-left:1px solid #A0A0A0">
+   &nbsp;
+  </td>
+  <td style="vertical-align:top;">
+   <table summary="">
+    <tr>
+    <td>
+    <LABEL for="picture_file">{t}Icon{/t}</LABEL>
+    <br>
+    <img alt="" src="getbin.php?rand={$rand}" border=1 style="width:48px; height:48; background-color:white; vertical-align:bottom;">
+    </td>
+    <td style="vertical-align:top">
+    &nbsp;<br>
+
+    <input type="hidden" name="MAX_FILE_SIZE" value="100000">
+{render acl=$gosaApplicationIconACL}
+    <input name="picture_file" type="file" size="20" maxlength="255" accept="image/*.png" id="picture_file">
+{/render}
+{render acl=$gosaApplicationIconACL}
+<input type="submit" name="update" value="{t}Update{/t}" title="{t}Reload picture from LDAP{/t}">
+{/render}
+{render acl=$gosaApplicationIconACL}
+<input type="submit" name="remove_picture" value="{t}Remove picture{/t}" title="{t}Remove picture from LDAP{/t}">
+{/render}
+    </td>
+    </tr>
+   </table>
+  </td>
+ </tr>
+</table>
+
+<p class="plugbottom" style="height:4px; margin-bottom:0px;">&nbsp;</p>
+
+<h2><img src="images/lamp.png" alt="{t}Options{/t}" align="middle">&nbsp;{t}Options{/t}</h2>
+<table summary="" style="width:100%;">
+  <tr>
+    <td style="width:50%;border-right:1px solid #B0B0B0; vertical-align:top">
+{render acl=$gosaApplicationFlagsACL}
+      <input type=checkbox name="exec_for_groupmembers" value="1" {$exec_for_groupmembers}>
+{/render}
+       {t}Only executable for members{/t}
+      <br>
+{render acl=$gosaApplicationFlagsACL}
+      <input type=checkbox name="overwrite_config" value="1" {$overwrite_config}>
+{/render}
+       {t}Replace user configuration on startup{/t}
+    </td>
+    <td>
+{render acl=$gosaApplicationFlagsACL}
+      <input type=checkbox name="place_on_desktop" value="1" {$place_on_desktop}>
+{/render}
+      {t}Place icon on members desktop{/t}
+      <br>
+{render acl=$gosaApplicationFlagsACL}
+      <input type=checkbox name="place_in_startmenu" value="1" {$place_in_startmenu}>
+{/render}
+      {t}Place entry in members startmenu{/t}
+      <br>
+{render acl=$gosaApplicationFlagsACL}
+      <input type=checkbox name="place_on_kicker" value="1" {$place_on_kicker}>
+{/render}
+      {t}Place entry in members launch bar{/t}
+    </td>
+  </tr>
+</table>
+
+<p class="plugbottom" style="height:4px; margin-bottom:0px;">&nbsp;</p>
+
+<table width="99%" summary="">
+       <tr>
+               <td>
+                       <h2><img src="images/fai_script.png" alt="{t}Script{/t}" align="middle">&nbsp;{t}Script{/t}</h2>
+{render acl=$gotoLogonScriptACL}
+                       <textarea name="gotoLogonScript" style='width:99%;height:220px;'>{$gotoLogonScript}</textarea>
+{/render}
+{render acl=$gotoLogonScriptACL}
+                       <input type="file" name="ScriptFile" value="{t}Import{/t}">
+{/render}
+{render acl=$gotoLogonScriptACL}
+                       <input type="submit" name="upLoad" value="{t}Upload{/t}">
+{/render}
+                       <input type='image' name='downloadScript'  src='images/save.png' title='{t}Download{/t}' class='center'>
+               </td>
+       </tr>
+</table>
+
+<div style="height:20px;"></div>
+
+<!-- Place cursor -->
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+       focus_field('cn');
+  -->
+</script>
diff --git a/gosa-plugins/goto/admin/applications/main.inc b/gosa-plugins/goto/admin/applications/main.inc
new file mode 100644 (file)
index 0000000..7b74838
--- /dev/null
@@ -0,0 +1,55 @@
+<?php
+/*
+  This code is part of GOsa (https://gosa.gonicus.de)
+  Copyright (C) 2003  Cajus Pollmeier
+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+if ($remove_lock){
+        if(session::is_set('applicationManagement')){
+                $applicationManagement = session::get('applicationManagement');
+                $applicationManagement->remove_lock();
+                del_lock ($ui->dn);
+                session::un_set ('applicationManagement');
+        }
+} else {
+       /* Create applicationManagement object on demand */
+       if (!session::is_set('applicationManagement') || (isset($_GET['reset']) && $_GET['reset'] == 1)){
+               session::set('applicationManagement',new applicationManagement ($config, $ui));
+       }
+       $applicationManagement = session::get('applicationManagement');
+       $applicationManagement->save_object();
+       $output= $applicationManagement->execute();
+
+       /* Page header*/
+       if (session::is_set('objectinfo')){
+               $display= print_header(get_template_path('images/application.png'), _("Application management"), "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png')."\"> ".@LDAP::fix(session::get('objectinfo')));
+       } else {
+               $display= print_header(get_template_path('images/application.png'), _("Application management"));
+       }
+
+       /* Reset requested? */
+       if (isset($_GET['reset']) && $_GET['reset'] == 1){
+               del_lock ($ui->dn);
+               session::un_set ('applicationManagement');
+       }
+
+       /* Show and save dialog */
+       $display.= $output;
+       session::set('applicationManagement',$applicationManagement);
+}
+
+?>
diff --git a/gosa-plugins/goto/admin/applications/parameters.tpl b/gosa-plugins/goto/admin/applications/parameters.tpl
new file mode 100644 (file)
index 0000000..57c2219
--- /dev/null
@@ -0,0 +1,2 @@
+{$table}
+<div style="height:20px"></div>
diff --git a/gosa-plugins/goto/admin/applications/release_select.tpl b/gosa-plugins/goto/admin/applications/release_select.tpl
new file mode 100644 (file)
index 0000000..d58738f
--- /dev/null
@@ -0,0 +1,16 @@
+<br> 
+<div class="contentboxh" style="border-bottom:1px solid #B0B0B0;">
+ <p class="contentboxh"><img src="{$branchimage}" align="right" alt="[F]">{t}Branches{/t}</p>
+</div>
+<div class="contentboxb">
+ <table summary="" style="width:100%;">
+  <tr>
+   <td>
+    {t}Current release{/t}&nbsp;
+    <select name="selectedRelease" onChange="document.mainform.submit();">
+     {html_options options=$releases selected=$selectedRelease}
+    </select>
+   </td>
+  </tr>
+ </table>
+</div>
diff --git a/gosa-plugins/goto/admin/applications/remove.tpl b/gosa-plugins/goto/admin/applications/remove.tpl
new file mode 100644 (file)
index 0000000..8598ed8
--- /dev/null
@@ -0,0 +1,23 @@
+<div style="font-size:18px;">
+  <img alt="" src="images/button_cancel.png" align=top>&nbsp;{t}Warning{/t}
+</div>
+<p>
+ {$intro}
+ {t}This may be used by several groups. Please double check if your really want to do this since there is no way for GOsa to get your data back.{/t}
+</p>
+<p>
+ {t}So - if you're sure - press 'Delete' to continue or 'Cancel' to abort.{/t}
+</p>
+
+<p class="plugbottom">
+       {if $multiple}
+               <input type=submit name="delete_multiple_application_confirm" value="{t}Delete{/t}">
+               &nbsp;
+               <input type=submit name="delete_multiple_application_cancel" value="{t}Cancel{/t}">
+       {else}
+               <input type=submit name="delete_app_confirm" value="{t}Delete{/t}">
+               &nbsp;
+               <input type=submit name="delete_cancel" value="{t}Cancel{/t}">
+       {/if}
+</p>
+
diff --git a/gosa-plugins/goto/admin/applications/tabs_application.inc b/gosa-plugins/goto/admin/applications/tabs_application.inc
new file mode 100644 (file)
index 0000000..5b6e829
--- /dev/null
@@ -0,0 +1,59 @@
+<?php
+
+class apptabs extends tabs
+{
+  var $Release= "";
+
+  function apptabs($config, $data, $dn,$category)
+  {
+    tabs::tabs($config, $data, $dn,$category);
+
+    /* Add references/acls/snapshots */
+    $this->addSpecialTabs();
+  }
+
+  function set_release($newRelease)
+  {
+    $this->Release= preg_replace('/,'.get_ou('applicationou').'.*$/', '', $newRelease);
+    if ($this->Release != ""){
+      $this->Release= ",".$this->Release;
+    }
+  }
+
+  function save($ignore_account= FALSE)
+  {
+    $baseobject= $this->by_object['application'];
+
+    /* Check for new 'dn', in order to propagate the
+       'dn' to all plugins */
+    $tmp = $this->config->search("faiManagement", "CLASS",array('menu','tabs'));
+    $appfilter = session::get('appfilter');
+    if((!empty($tmp)) && (isset($appfilter['release']))){
+      if(!$baseobject->isReleaseApplikation){
+        $new_dn= "cn=".$baseobject->cn.",".get_ou('applicationou').$baseobject->base;
+      }else{
+        $new_dn ="cn=".$baseobject->cn.",".$appfilter['release'];
+      }
+    }else{
+      $new_dn= "cn=".$baseobject->cn.",".get_ou('applicationou').$baseobject->base;
+    }
+
+    /* Move group? */
+    if ($this->dn != $new_dn){
+
+      /* Write entry on new 'dn' */
+      if ($this->dn != "new"){
+        $baseobject->move($this->dn, $new_dn);
+        $this->by_object['application']= $baseobject;
+      }
+
+      /* Happen to use the new one */
+      $this->dn= $new_dn;
+    }
+
+    tabs::save();
+  }
+
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-plugins/goto/admin/devices/class_deviceGeneric.inc b/gosa-plugins/goto/admin/devices/class_deviceGeneric.inc
new file mode 100644 (file)
index 0000000..bc870eb
--- /dev/null
@@ -0,0 +1,256 @@
+<?php
+
+class deviceGeneric extends plugin
+{
+  public $dn            = "";
+  public $cn            = "";
+  public $orig_cn       = "";
+  public $description   = "";
+  public $vendor        = "";
+  public $dev_id        = "";
+  public $serial        = "";
+  public $base          = "";  
+  public $types;
+  public $type;
+
+  public $posts           = array("description","dev_id","serial","vendor", "type");
+  public $attributes      = array("cn");
+  public $objectclasses   = array("top","gotoDevice");
+
+  public $CopyPasteVars   = array("orig_cn","description","vendor","dev_id","serial","base");
+
+  public function deviceGeneric(&$config,$dn = NULL)
+  {
+    plugin::plugin($config,$dn);
+
+    $this->is_account = TRUE;
+
+    $this->types= array("camera" => _("Digital camera"),
+                        "harddisk" => _("Harddisk"),
+                        "stick" => _("USB stick"),
+                        "cd" => _("CD/DVD drive"),);
+    asort($this->types);
+
+    /* Set class values */
+    if(isset($this->attrs['gotoHotplugDevice'][0])){
+      $tmp = preg_split("/\|/",$this->attrs['gotoHotplugDevice'][0]);
+      $this->cn         = $this->attrs['cn'][0];
+      $this->description= $tmp[0];
+      $this->dev_id     = $tmp[1];
+      $this->serial     = $tmp[2];
+      $this->vendor     = $tmp[3];
+      if (isset($tmp[4])){
+        $this->type= $tmp[4];
+      }
+    }     
+
+    $this->orig_cn = $this->cn;
+
+    /* Set Base */
+    if ($this->dn == "new"){
+      if(session::is_set('CurrentMainBase')){
+        $this->base = session::get('CurrentMainBase');
+      }else{
+        $ui= get_userinfo();
+        $this->base= dn2base($ui->dn);
+      }
+    } else {
+      $this->base =preg_replace ("/^[^,]+,".get_ou('deviceou')."/","",$this->dn);
+    }
+  }
+
+
+  public function execute()
+  {
+    $smarty = get_smarty();
+    $smarty->assign("base",$this->base);
+    $smarty->assign("bases",$this->get_allowed_bases());
+    foreach($this->attributes as $attr){
+      $smarty->assign($attr,$this->$attr);
+    }
+    foreach($this->posts as $attr){
+      $smarty->assign($attr,$this->$attr);
+    }
+
+    $smarty->assign("type",$this->type);
+    $smarty->assign ("types", $this->types);
+
+    return($smarty->fetch(get_template_path("deviceGeneric.tpl",TRUE,dirname(__FILE__))));
+  }
+
+  
+  public function check()
+  {
+    $message = plugin::check();
+
+    if(empty($this->cn)||(preg_match("/[^a-z0-9]/i",$this->cn))){
+      $message[]=_("Please specify a valid name. Only 0-9 a-Z is allowed.");
+    }
+    if(preg_match("/[^a-z0-9!\"?.,;:-_\(\) ]/i",$this->description)){
+      $message[]=_("Invalid character in description. Please specify a valid description.");
+    }
+
+    /* Skip serial check if vendor and product id are given */
+    if(preg_match("/^\s+$/i",$this->dev_id)){
+      $message[]=_("Please specify a valid iSerial.");
+    }
+    if(empty($this->serial) || !$this->is_2byteHex($this->serial)){
+      $message[]=_("Please specify a valid vendor ID. (2 byte hex like '0xFFFF')");
+    }
+    if(empty($this->vendor) || !$this->is_2byteHex($this->vendor)){
+      $message[]=_("Please specify a valid product ID. (2 byte hex like '0xFFFF')");
+    }
+   
+    /* Check if entry already exists */ 
+    if($this->cn != $this->orig_cn){
+      $ldap = $this->config->get_ldap_link();
+      $ldap->search("(&(objectClass=gotoDevice)(cn=".$this->cn."*))",array("cn"));
+      if($ldap->count()){
+        $message[]=_("An Entry with this name already exists.");
+      }
+    }
+
+    return($message);
+  }
+
+
+  public function save_object()
+  {
+    if(isset($_POST['deviceGeneric_posted'])){
+      plugin::save_object();
+  
+      if(isset($_POST['base'])){
+        $tmp = $this->get_allowed_bases();
+        if(isset($tmp[get_post("base")])){
+          $this->base = get_post("base");
+        }
+      }
+    
+      foreach($this->posts as $post){
+        if(isset($_POST[$post])){
+          $this->$post = get_post($post);
+        }
+      }
+    }
+  }
+
+  
+  public function remove_from_parent()
+  {
+    plugin::remove_from_parent();
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd($this->config->current['BASE']);
+
+    $ldap->search("(&(objectClass=gotoEnvironment)(gotoHotplugDeviceDN=".$this->dn."))",array("cn","gotoHotplugDeviceDN"));
+    $skip = FALSE;
+    $str ="";
+    $cnt = 3;
+    while($cnt && $attrs = $ldap->fetch()){
+      $skip =TRUE;
+      $str .= $attrs['cn'][0].", ";
+      $cnt --;
+    }
+    if($skip){
+      $str  = preg_replace("/, $/","",$str);
+      if($cnt == 0){
+        $str .= "...";
+      }
+      print_red(sprintf(_("Can't remove the device '%s' it is still in use be this user(s) : %s"),$this->cn,$str));
+    }else{
+      $ldap->rmdir_recursive($this->dn);
+    }
+  }
+
+
+  public function save()
+  {
+    plugin::save();
+
+    $this->attrs['gotoHotplugDevice'] = "";
+    foreach($this->posts as $post){
+      $this->attrs['gotoHotplugDevice'] .= $this->$post."|"; 
+    }
+    $this->attrs['gotoHotplugDevice'] = preg_replace("/\|$/","",$this->attrs['gotoHotplugDevice']);
+
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd($this->config->current['BASE']);
+    $ldap->cat($this->dn);
+    if($ldap->count()){
+      $ldap->cd($this->dn);
+      $ldap->modify($this->attrs);
+    }else{
+      $ldap->create_missing_trees(preg_replace("/^[^,]+,/","",$this->dn));
+      $ldap->cd($this->dn);
+      $ldap->add($this->attrs);
+    }
+    show_ldap_error($ldap->get_error(),_("Device could not be saved."));
+  }
+
+
+  /* check if given str in like this 0xffff*/
+  function is_2byteHex($str)
+  {
+    return !strlen($str) || preg_match("/^(0x|x|)[a-f0-9][a-f0-9][a-f0-9][a-f0-9]/i",$str);
+  }
+
+
+  function PrepareForCopyPaste($source)
+  {
+    plugin::PrepareForCopyPaste($source);
+    $source_o = new deviceGeneric($this->config,$source['dn']);
+    foreach($this->CopyPasteVars as $post){
+      $this->$post = $source_o->$post;
+    }
+  }
+
+
+  /* Return a dialog with all fields that must be changed,
+     if we want to copy this entry */
+  function getCopyDialog()
+  {
+    $str = "";
+    $smarty = get_smarty();
+    $smarty->assign("cn",         $this->cn);
+    $str = $smarty->fetch(get_template_path("paste_deviceGeneric.tpl",TRUE,dirname(__FILE__)));
+
+    $ret = array();
+    $ret['string'] = $str;
+    $ret['status'] = "";
+    return($ret);
+  }
+
+
+  /* Save all */
+  function saveCopyDialog()
+  {
+    $attrs = array("cn");
+    foreach($attrs as $attr){
+      if(isset($_POST[$attr])){
+        $this->$attr = $_POST[$attr];
+      }
+    }
+  }
+
+
+
+  /* Return plugin informations for acl handling  */
+  public static function plInfo()
+  {
+    return (array(
+          "plShortName"   => _("Generic"),
+          "plDescription" => _("Device generic"),
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 0,
+          "plSection"     => array("administration"),
+          "plCategory"    => array("devices" => array("description"  => _("Devices"),
+                                                        "objectClass"  => "gotoHotplugDevice")),
+          "plProvidedAcls"=> array(
+            "cn"                          => _("Name"))
+          ));
+
+  }
+       
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-plugins/goto/admin/devices/class_deviceManagement.inc b/gosa-plugins/goto/admin/devices/class_deviceManagement.inc
new file mode 100644 (file)
index 0000000..77c5825
--- /dev/null
@@ -0,0 +1,557 @@
+<?php
+
+class deviceManagement extends plugin
+{
+
+  /* Definitions */
+  var $plHeadline     = "Devices";
+  var $plDescription  = "Manage devices";
+
+  /* Dialog attributes */
+  var $ui                             = NULL;
+  var $DivListDevices               = NULL;
+  var $enableReleaseManagement        = false;
+  var $devicetabs                       = NULL;
+  var $snapDialog                     = NULL;
+  var $CopyPasteHandler               = NULL;
+  var $start_pasting_copied_objects;
+  var $dn ="";
+
+  function deviceManagement(&$config, $dn= NULL)
+  {
+    plugin::plugin ($config, $dn);
+    $this->ui = get_userinfo();  
+
+    /* Check if copy & paste is activated */
+    if($this->config->boolValueIsTrue("MAIN","ENABLECOPYPASTE")){
+      $this->CopyPasteHandler = new CopyPasteHandler($this->config);
+    }
+
+    /* Creat dialog object */
+    $this->DivListDevices = new divListDevices($this->config,$this);
+  }
+
+
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+    /****************
+      Variable init
+     ****************/
+
+    /* These vars will be stored if you try to open a locked device,
+        to be able to perform your last requests after showing a warning message */
+    session::set('LOCK_VARS_TO_USE',array("/^act$/","/^id$/","/^device_edit_/",
+                                          "/^device_del_/","/^item_selected/","/^remove_multiple_devices/"));
+
+    $smarty       = get_smarty();             // Smarty instance
+    $s_action     = "";                       // Contains the action to proceed
+    $s_entry      = "";                       // The value for s_action
+    $base_back    = "";                       // The Link for Backbutton
+
+    /* Test Posts */
+    foreach($_POST as $key => $val){
+
+      if(preg_match("/device_del.*/",$key)){
+        $s_action = "del";
+        $s_entry  = preg_replace("/device_".$s_action."_/i","",$key);
+      }elseif(preg_match("/device_edit_.*/",$key)){
+        $s_action="edit";
+        $s_entry  = preg_replace("/device_".$s_action."_/i","",$key);
+      }elseif(preg_match("/^copy_.*/",$key)){
+        $s_action="copy";
+        $s_entry  = preg_replace("/^copy_/i","",$key);
+      }elseif(preg_match("/^cut_.*/",$key)){
+        $s_action="cut";
+        $s_entry  = preg_replace("/^cut_/i","",$key);
+      }elseif(preg_match("/^device_new.*/",$key)){
+        $s_action="new";
+      }elseif(preg_match("/^remove_multiple_devices/",$key)){
+        $s_action="del_multiple";
+      }elseif(preg_match("/^editPaste.*/i",$key)){
+        $s_action="editPaste";
+      }elseif(preg_match("/^multiple_copy_devices/",$key)){
+        $s_action = "copy_multiple";
+     }elseif(preg_match("/^multiple_cut_devices/",$key)){
+        $s_action = "cut_multiple";
+      }
+    }
+
+    if((isset($_GET['act']))&&($_GET['act']=="edit_entry")){
+      $s_action ="edit";
+      $s_entry  = $_GET['id'];
+    }
+
+    $s_entry  = preg_replace("/_.$/","",$s_entry);
+
+
+    /* handle C&P from layers menu */
+    if(isset($_POST['menu_action']) && preg_match("/^multiple_copy_systems/",$_POST['menu_action'])){
+      $s_action = "copy_multiple";
+    }
+    if(isset($_POST['menu_action']) && preg_match("/^multiple_cut_systems/",$_POST['menu_action'])){
+      $s_action = "cut_multiple";
+    }
+    if(isset($_POST['menu_action']) && preg_match("/^editPaste/",$_POST['menu_action'])){
+      $s_action = "editPaste";
+    }
+
+    /* Create options */
+    if(isset($_POST['menu_action']) && $_POST['menu_action'] == "device_new"){
+      $s_action = "new";
+    }
+
+    /* handle remove from layers menu */
+    if(isset($_POST['menu_action']) && preg_match("/^remove_multiple/",$_POST['menu_action'])){
+      $s_action = "del_multiple";
+    }
+
+    /****************
+      Copy & Paste handling
+     ****************/
+
+    /* Display the copy & paste dialog, if it is currently open */
+    $ret = $this->copyPasteHandling_from_queue($s_action,$s_entry);
+    if($ret){
+      return($ret);
+    }
+
+    /****************
+      Create a new device type
+     ****************/
+
+    /* New device type? */
+    $ui = get_userinfo();
+    $acl = $ui->get_permissions($this->DivListDevices->selectedBase,"devices/deviceGeneric");
+    if (($s_action=="new") && preg_match("/c/",$acl)){
+
+      /* By default we set 'dn' to 'new', all relevant plugins will
+         react on this. */
+      $this->dn= "new";
+
+      /* Create new usertab object */
+      $this->devicetabs= new devicetabs($this->config, $this->config->data['TABS']['DEVICETABS'], $this->dn,"devices");
+      $this->devicetabs->set_acl_base($this->DivListDevices->selectedBase);
+    }
+
+
+    /****************
+      Edit entry canceled
+     ****************/
+
+    /* Cancel dialogs */
+    if (isset($_POST['edit_cancel']) && is_object($this->devicetabs)){
+      del_lock ($this->devicetabs->dn);
+      unset ($this->devicetabs);
+      $this->devicetabs= NULL;
+      session::un_set('objectinfo');
+    }
+
+
+    /****************
+      Edit entry finished
+     ****************/
+
+    /* Finish device edit is triggered by the tabulator dialog, so
+       the user wants to save edited data. Check and save at this point. */
+    if ((isset($_POST['edit_finish']) || isset($_POST['edit_apply']) ) && (isset($this->devicetabs->config))){
+
+      /* Check tabs, will feed message array */
+      $this->devicetabs->save_object();
+      $message= $this->devicetabs->check();
+
+      /* Save, or display error message? */
+      if (count($message) == 0){
+
+        /* Save data data to ldap */
+#        $this->devicetabs->set_release($this->DivListDevices->selectedRelease);
+        $this->devicetabs->save();
+
+        if (!isset($_POST['edit_apply'])){
+          /* device type has been saved successfully, remove lock from LDAP. */
+          if ($this->dn != "new"){
+            del_lock ($this->dn);
+          }
+          unset ($this->devicetabs);
+          $this->devicetabs= NULL;
+          session::un_set('objectinfo');
+        }
+      } else {
+       /* Ok. There seem to be errors regarding to the tab data,
+           show message and continue as usual. */
+        show_errors($message);
+      }
+    }
+
+
+    /****************
+      Edit entry
+     ****************/
+
+    /* User wants to edit data? */
+    if (($s_action=="edit") && (!isset($this->devicetabs->config))){
+
+      /* Get 'dn' from posted 'devicelist', must be unique */
+      $this->dn= $this->devices[$s_entry]['dn'];
+
+      /* Check locking, save current plugin in 'back_plugin', so
+         the dialog knows where to return. */
+      if (($user= get_lock($this->dn)) != ""){
+        return(gen_locked_message ($user, $this->dn));
+      }
+
+      /* Lock the current entry, so everyone will get the
+         above dialog */
+      add_lock ($this->dn, $this->ui->dn);
+
+
+      /* Register devicetabs to trigger edit dialog */
+      $this->devicetabs= new devicetabs($this->config,$this->config->data['TABS']['DEVICETABS'], $this->dn,"devices");
+      $this->devicetabs->set_acl_base($this->dn);
+      session::set('objectinfo',$this->dn);
+    }
+
+
+    /********************
+      Delete MULTIPLE entries requested, display confirm dialog
+     ********************/
+    if ($s_action=="del_multiple"){
+      $ids = $this->list_get_selected_items();
+
+      if(count($ids)){
+
+        foreach($ids as $id){
+          $dn = $this->devices[$id]['dn'];
+          if (($user= get_lock($dn)) != ""){
+            return(gen_locked_message ($user, $dn));
+          }
+          $this->dns[$id] = $dn;
+        }
+
+        $dns_names = "<br><pre>";
+        foreach($this->dns as $dn){
+          add_lock ($dn, $this->ui->dn);
+          $dns_names .= $dn."\n";
+        }
+        $dns_names .="</pre>";
+
+        /* Lock the current entry, so nobody will edit it during deletion */
+        if (count($this->dns) == 1){
+          $smarty->assign("intro",     sprintf(_("You're about to delete the following entry %s"), @LDAP::fix($dns_names)));
+        } else {
+          $smarty->assign("intro",     sprintf(_("You're about to delete the following entries %s"), @LDAP::fix($dns_names)));
+        }
+        $smarty->assign("multiple", true);
+        return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
+      }
+    }
+
+
+    /********************
+      Delete MULTIPLE entries confirmed
+     ********************/
+
+    /* Confirmation for deletion has been passed. Users should be deleted. */
+    if (isset($_POST['delete_multiple_device_confirm'])){
+
+      $ui = get_userinfo();
+
+      /* Remove user by user and check acls before removeing them */
+      foreach($this->dns as $key => $dn){
+
+        $acl = $ui->get_permissions($dn,"devices/deviceGeneric");
+        if(preg_match("/d/",$acl)){
+
+          /* Delete request is permitted, perform LDAP action */
+          $this->devicetabs= new devicetabs($this->config, $this->config->data['TABS']['DEVICETABS'], $dn,"devices");
+          $this->devicetabs->set_acl_base($dn);
+          $this->devicetabs->delete ();
+          unset ($this->devicetabs);
+          $this->devicetabs= NULL;
+
+        } else {
+          /* Normally this shouldn't be reached, send some extra
+             logs to notify the administrator */
+          print_red (_("You are not allowed to delete this device type!"));
+          new log("security","devices/".get_class($this),$dn,array(),"Tried to trick deletion.");
+        }
+        /* Remove lock file after successfull deletion */
+        del_lock ($dn);
+        unset($this->dns[$key]);
+      }
+    }
+
+
+    /********************
+      Delete MULTIPLE entries Canceled
+     ********************/
+
+    /* Remove lock */
+    if(isset($_POST['delete_multiple_device_cancel'])){
+      foreach($this->dns as $key => $dn){
+        del_lock ($dn);
+        unset($this->dns[$key]);
+      }
+    }
+
+
+    /****************
+      Delete device type
+     ****************/
+
+    /* Remove user was requested */
+    if ($s_action == "del"){
+
+      /* Get 'dn' from posted 'uid' */
+      $this->dn= $this->devices[$s_entry]['dn'];
+
+      /* Load permissions for selected 'dn' and check if
+         we're allowed to remove this 'dn' */
+      $ui = get_userinfo();
+      $acl = $ui->get_permissions($this->dn,"devices/deviceGeneric");
+      if (preg_match("/d/",$acl)){
+
+        /* Check locking, save current plugin in 'back_plugin', so
+           the dialog knows where to return. */
+        if (($user= get_lock($this->dn)) != ""){
+          return (gen_locked_message ($user, $this->dn));
+        }
+
+        /* Lock the current entry, so nobody will edit it during deletion */
+        add_lock ($this->dn, $this->ui->dn);
+        $smarty= get_smarty();
+        $smarty->assign("intro", sprintf(_("You're about to delete the device '%s'."), @LDAP::fix($this->dn)));
+        $smarty->assign("multiple", false);
+        return($smarty->fetch (get_template_path('remove.tpl', TRUE)));
+      } else {
+
+        /* Obviously the user isn't allowed to delete. Show message and
+           clean session. */
+       print_red (_("You are not allowed to delete this device!"));
+      }
+    }
+
+
+    /****************
+      Delete device confirmed
+     ****************/
+
+    /* Confirmation for deletion has been passed. Group should be deleted. */
+    if (isset($_POST['delete_device_confirm'])){
+
+      /* Some nice guy may send this as POST, so we've to check
+         for the permissions again. */
+      $ui = get_userinfo();
+      $acl = $ui->get_permissions($this->dn,"devices/deviceGeneric");
+      if(preg_match("/d/",$acl)){
+
+        /* Delete request is permitted, perform LDAP action */
+        $this->devicetabs= new devicetabs($this->config, $this->config->data['TABS']['DEVICETABS'], $this->dn,"devices");
+        $this->devicetabs->set_acl_base($this->dn);
+        $this->devicetabs->delete ();
+        unset ($this->devicetabs);
+        $this->devicetabs= NULL;
+
+      } else {
+
+        /* Normally this shouldn't be reached, send some extra
+           logs to notify the administrator */
+        print_red (_("You are not allowed to delete this device!"));
+        new log("security","devices/".get_class($this),$dn,array(),"Tried to trick deletion.");
+      }
+
+      /* Remove lock file after successfull deletion */
+      del_lock ($this->dn);
+    }
+
+
+    /****************
+      Delete device canceled
+     ****************/
+
+    /* Delete device canceled? */
+    if (isset($_POST['delete_cancel'])){
+      del_lock ($this->dn);
+      session::un_set('objectinfo');
+  }
+
+    /* Show tab dialog if object is present */
+    if (($this->devicetabs) && (isset($this->devicetabs->config))){
+      $display= $this->devicetabs->execute();
+
+      /* Don't show buttons if tab dialog requests this */
+      if (!$this->devicetabs->by_object[$this->devicetabs->current]->dialog){
+        $display.= "<p style=\"text-align:right\">\n";
+        $display.= "<input type=\"submit\" name=\"edit_finish\" style=\"width:80px\" value=\""._("Ok")."\">\n";
+        $display.= "&nbsp;\n";
+        if ($this->dn != "new"){
+          $display.= "<input type=submit name=\"edit_apply\" value=\""._("Apply")."\">\n";
+          $display.= "&nbsp;\n";
+        }
+        $display.= "<input type=\"submit\" name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
+        $display.= "</p>";
+      }
+      return ($display);
+    }
+
+
+    /****************
+      Dialog display
+     ****************/
+
+        /* Check if there is a snapshot dialog open */
+    $base = $this->DivListDevices->selectedBase;
+    if($str = $this->showSnapshotDialog($base,$this->get_used_snapshot_bases())){
+      return($str);
+    }
+
+    /* Display dialog with system list */
+    $this->DivListDevices->parent = $this;
+    $this->DivListDevices->execute();
+    $this->DivListDevices->AddDepartments($this->DivListDevices->selectedBase,3,1);
+    $this->reload();
+    $this->DivListDevices->setEntries($this->devices);
+    return($this->DivListDevices->Draw());
+
+  }
+
+  function save_object() {
+    $this->DivListDevices->save_object();
+  }
+
+
+  /* Return departments, that will be included within snapshot detection */
+  function get_used_snapshot_bases()
+  {
+    return(array(get_ou('deviceou').$this->DivListDevices->selectedBase));
+  }
+
+  function copyPasteHandling_from_queue($s_action,$s_entry)
+  {
+    /* Check if Copy & Paste is disabled */
+    if(!is_object($this->CopyPasteHandler)){
+      return("");
+    }
+
+    /* Add a single entry to queue */
+    if($s_action == "cut" || $s_action == "copy"){
+
+      /* Cleanup object queue */
+      $this->CopyPasteHandler->cleanup_queue();
+      $dn = $this->devices[$s_entry]['dn'];
+      $this->CopyPasteHandler->add_to_queue($dn,$s_action,"devicetabs","DEVICETABS","devices");
+    }
+
+    /* Add entries to queue */
+    if($s_action == "copy_multiple" || $s_action == "cut_multiple"){
+
+      /* Cleanup object queue */
+      $this->CopyPasteHandler->cleanup_queue();
+
+      /* Add new entries to CP queue */
+      foreach($this->list_get_selected_items() as $id){
+        $dn = $this->devices[$id]['dn'];
+
+        if($s_action == "copy_multiple"){
+          $this->CopyPasteHandler->add_to_queue($dn,"copy","devicetabs","DEVICETABS","devices");
+        }
+        if($s_action == "cut_multiple"){
+          $this->CopyPasteHandler->add_to_queue($dn,"cut","devicetabs","DEVICETABS","devices");
+        }
+      }
+    }
+
+    /* Start pasting entries */
+    if($s_action == "editPaste"){
+      $this->start_pasting_copied_objects = TRUE;
+    }
+
+    /* Return C&P dialog */
+    if($this->start_pasting_copied_objects && $this->CopyPasteHandler->entries_queued()){
+
+      /* Load entry from queue and set base */
+      $this->CopyPasteHandler->load_entry_from_queue();
+      $this->CopyPasteHandler->SetVar("base",$this->DivListDevices->selectedBase);
+
+      /* Get dialog */
+      $data = $this->CopyPasteHandler->execute();
+
+      /* Return dialog data */
+      if(!empty($data)){
+        return($data);
+      }
+    }
+
+    /* Automatically disable status for pasting */
+    if(!$this->CopyPasteHandler->entries_queued()){
+      $this->start_pasting_copied_objects = FALSE;
+    }
+    return("");
+  }
+
+
+
+  function reload()
+  {
+    /* Set base for all searches */
+    $base       = $this->DivListDevices->selectedBase;
+    $Regex      = $this->DivListDevices->Regex;
+    $SubSearch  = $this->DivListDevices->SubSearch;
+    $Flags      =  GL_NONE | GL_SIZELIMIT;
+    $Filter     = "(&(|(cn=".$Regex.")(description=".$Regex."))(objectClass=gotoDevice))";
+    $tmp        = array();
+
+    /* In case of subsearch, add the subsearch flag */
+    if($SubSearch){
+      $Flags    |= GL_SUBSEARCH;
+    }else{
+      $base = get_ou('deviceou').$base;
+    }
+
+    /* Get results and create index */
+    $res= get_sub_list($Filter,"devices",get_ou('deviceou'), $base, array("cn","description","dn","objectClass"), $Flags);
+    $tmp2 = array();
+    foreach ($res as $val){
+      $tmp2[strtolower($val['cn'][0]).$val['cn'][0].$val['dn']] = strtolower($val['cn'][0]).$val['cn'][0].$val['dn'];
+      $tmp[strtolower($val['cn'][0]).$val['cn'][0].$val['dn']]=$val;
+    }
+
+    /* sort entries */
+    natcasesort($tmp2);
+    $this->devices=array();
+    foreach($tmp2 as $val){
+      $this->devices[]=$tmp[$val];
+    }
+    reset ($this->devices);
+  }
+
+
+  function remove_lock()
+  {
+    if (isset($this->devicetabs->dn)){
+      del_lock ($this->devicetabs->dn);
+    }
+  }
+
+  function list_get_selected_items()
+  {
+    $ids = array();
+    foreach($_POST as $name => $value){
+      if(preg_match("/^item_selected_[0-9]*$/",$name)){
+        $id   = preg_replace("/^item_selected_/","",$name);
+        $ids[$id] = $id;
+      }
+    }
+    return($ids);
+  }
+
+
+  function remove_from_parent()
+  {
+    /* This cannot be removed... */
+  }
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-plugins/goto/admin/devices/class_divListDevices.inc b/gosa-plugins/goto/admin/devices/class_divListDevices.inc
new file mode 100644 (file)
index 0000000..e9d5f85
--- /dev/null
@@ -0,0 +1,303 @@
+<?php
+
+class divListDevices extends MultiSelectWindow
+{
+  /* Current base */
+  var $selectedBase       = "";
+  var $departments        = array();
+  var $parent               ;
+  var $ui                   ;
+
+  /* Regex */
+  var $Regex              = "*";
+
+  /* Subsearch checkbox */
+  var $SubSearch;
+
+  function divListDevices (&$config, &$parent)
+  {
+    /* Create divlist and setup */
+    MultiSelectWindow::MultiSelectWindow($config, "Devices", "devices");
+    /* initialize required attributes */ 
+    $this->parent           = &$parent;
+    $this->ui               = get_userinfo();
+
+    /* set Page header */
+    $action_col_size = 80;
+    if($this->parent->snapshotEnabled()){
+      $action_col_size += 38;
+    }
+
+    /* Set list strings */
+    $this->SetTitle       (_("List of defined devices"));
+    $this->SetSummary     (_("List of defined devices"));
+    $this->SetInformation (_("This menu allows you to add, edit and remove selected devices. You may want to use the range selector on top of the device listbox, when working with a large number of devices."));
+
+    /* Result page will look like a headpage */
+    $this->SetHeadpageMode();
+    $this->EnableAplhabet(true);
+  
+    /* Disable buttonsm */
+    $this->EnableCloseButton(false);
+    $this->EnableSaveButton (false);
+
+    /* Toggle all selected / deselected */
+    $chk = "<input type='checkbox' id='select_all' name='select_all'
+               onClick='toggle_all_(\"^item_selected_[0-9]*$\",\"select_all\");' >";
+
+    /* set Page header */
+    $this->AddHeader(array("string"=> $chk,          "attach"=>"style='width:20px;'"));
+    $this->AddHeader(array("string" => "&nbsp;",                "attach" => "style='text-align:center;width:20px;'"));
+    $this->AddHeader(array("string" => _("Device name")." / "._("Department"), "attach" => "style=''"));
+    $this->AddHeader(array("string" => _("Actions"),            "attach" => "style='width:".$action_col_size."px;border-right:0px;text-align:right;'"));
+
+    /* Add SubSearch checkbox */
+    $this->AddCheckBox("SubSearch",  _("Select to search within subtrees"), _("Search in subtrees"), false);
+
+    /*                  Name                 ,Text                              ,Default  , Connect with alphabet  */
+    $this->AddRegex   ("Regex",     _("Display devices matching"),"*" , true);
+  }
+
+
+  /* Create list header, with create / copy & paste etc*/
+  function GenHeader()
+  {
+    /* Prepare departments,
+       which are shown in the listbox on top of the listbox
+     */
+    $options= "";
+
+    /* Get all departments within this subtree */
+    $ui= get_userinfo();
+    $first = "";
+    $found = FALSE;
+    $base = $this->config->current['BASE'];
+
+    /* Add base */
+    $tmp = array();
+    $tmp[] = array("dn"=>$this->config->current['BASE']);
+    $tmp=  array_merge($tmp,get_list("(&(|(ou=*)(description=*))(objectClass=gosaDepartment))", $this->module, $base,
+                    array("ou", "description"), GL_SIZELIMIT | GL_SUBSEARCH));
+
+    $deps = array();
+    foreach($tmp as $tm){
+      $deps[$tm['dn']] = $tm['dn'];
+    }
+
+    /* Load possible departments */
+    $ui= get_userinfo();
+    $tdeps= $ui->get_module_departments($this->module);
+    $ids = $this->config->idepartments;
+    $first = "";
+    $found = FALSE;
+    foreach($ids as $dep => $name){
+      if(isset($deps[$dep]) && in_array_ics($dep, $tdeps)){
+
+        /* Keep first base dn in mind, we could need this
+         *  info if no valid base was found
+         */
+        if(empty($first)) {
+          $first = $dep['dn'];
+        }
+
+        $value = $ids[$dep];
+        if ($this->selectedBase == $dep){
+          $found = TRUE;
+          $options.= "<option selected='selected' value='".$dep."'>$value</option>";
+        } else {
+          $options.= "<option value='".$dep."'>$value</option>";
+        }
+      }
+    }
+
+    /* The currently used base is not visible with your acl setup.
+     * Set base to first useable base.
+     */
+    if(!$found){
+      $this->selectedBase = $first;
+    }
+
+    /* Get acls */
+    $ui       = get_userinfo();
+    $acl      = $ui->get_permissions("cn=dummy,".get_ou('deviceou').$this->selectedBase,"devices/deviceGeneric");
+    $acl_all  = $ui->has_complete_category_acls($this->selectedBase,"devices") ;
+
+
+    /* If this is true we add an additional seperator. Just look a few lines below */  
+    $listhead = MultiSelectWindow::get_default_header();
+
+    /* And at least add a department selection box */
+    $listhead .=  _("Base")."&nbsp;<select name='CurrentMainBase' onChange='mainform.submit()' class='center'>$options</select>".
+      " <input class='center' type='image' src='images/list_submit.png' align='middle' 
+        title='"._("Submit department")."' name='submit_department' alt='"._("Submit")."'>&nbsp;";
+
+    /* Create Layers menu */
+    $s  = ".|"._("Actions")."|\n";
+    $s .= "..|<img src='images/list_new.png' alt='' border='0' class='center'>".
+      "&nbsp;"._("Create")."|\n";
+
+    /* Append create options */
+    if(preg_match("/c/",$acl)) {
+      $s.= "...|<input class='center' type='image' src='images/list_new_device.png' alt=''>".
+        "&nbsp;"._("Device")."|device_new|\n";
+    }
+
+    /* Multiple options */
+    $s.= "..|---|\n";
+    $s.= "..|<img src='images/edittrash.png' alt='' border='0' class='center'>".
+      "&nbsp;"._("Remove")."|"."remove_multiple|\n";
+
+    /* Add multiple copy & cut icons */
+    if(is_object($this->parent->CopyPasteHandler) && preg_match("/(c.*w|w.*c)/",$acl_all)){
+      $s.= "..|---|\n";
+      $s.= "..|<img src='images/editcopy.png' alt='' border='0' class='center'>".
+        "&nbsp;"._("Copy")."|"."multiple_copy_systems|\n";
+      $s.= "..|<img src='images/editcut.png' alt='' border='0' class='center'>".
+        "&nbsp;"._("Cut")."|"."multiple_cut_systems|\n";
+
+      if($this->parent->CopyPasteHandler->entries_queued()){
+        $img = "<img border='0' class='center' src='images/editpaste.png' alt=''>";
+        $s.="..|".$img."&nbsp;"._("Paste")."|editPaste|\n";
+      }else{
+        $img = "<img border='0' class='center' src='images/cant_editpaste.png' alt=''>";
+        $s.="..|".$img."&nbsp;"._("Paste")."\n";
+      }
+    }
+
+    /* Add snapshot icons */
+    if(preg_match("/(c.*w|w.*c)/",$acl_all)){
+      $s .= "..|---|\n";
+      $s .= $this->get_snapshot_header(TRUE);
+    }
+
+    $this->SetDropDownHeaderMenu($s);
+                                                                       
+    $this->SetListHeader($listhead);
+  }
+
+
+  /* Some basic settings */
+  function execute()
+  {
+    $this->ClearElementsList();
+    $this->GenHeader();
+  }
+
+
+  function setEntries($list)
+  {
+    /********************
+      Variable init
+     ********************/
+
+    /* Create links */
+    $linkopen = "<a href='?plug=".$_GET['plug']."&amp;act=dep_open&amp;dep_id=%s'>%s</a>";
+    $editlink = "<a href='?plug=".$_GET['plug']."&amp;id=%s&amp;act=edit_entry'>%s</a>";
+    $userimg  = "<img class='center' src='images/select_groups.png' alt='User'    title='%s'>";
+    $deviceimg  = "<img class='center' src='images/select_device.png' alt='A'  title='"._("Device")."'>";
+    $empty    = "<img class='center' src='images/empty.png' style='width:16px;height:16px;' alt=''>";
+
+    /* set Page header */
+    $action_col_size = 80;
+    if($this->parent->snapshotEnabled()){
+      $action_col_size += 38;
+    }
+
+    /********************
+      Attach objects
+     ********************/
+
+    foreach($list as $key => $val){
+
+      $ui       = get_userinfo();
+      $acl      = $ui->get_permissions($val['dn'],"devices/deviceGeneric");
+      $acl_all  = $ui->has_complete_category_acls($val['dn'],"devices") ;
+
+      /* Create action icons */
+      $actions = "";
+      if(preg_match("/(c.*w|w.*c)/",$acl_all)){
+        $actions .= $this->GetSnapShotActions($val['dn']);
+      }
+
+      /* Get copy Paste icons */
+      if(($this->parent->CopyPasteHandler) && preg_match("/(c.*w|w.*c)/",$acl_all)){
+        $actions.= "<input class='center' type='image'
+          src='images/editcut.png' alt='"._("cut")."' name='cut_%KEY%' title='"._("Cut this entry")."'>&nbsp;";
+        $actions.= "<input class='center' type='image'
+          src='images/editcopy.png' alt='"._("copy")."' name='copy_%KEY%' title='"._("Copy this entry")."'>&nbsp;";
+      }
+
+      $actions.= "<input class='center' type='image'
+        src='images/edit.png' alt='"._("edit")."' name='device_edit_%KEY%' title='"._("Edit this entry")."'>";
+
+      /* Add delete button */
+      if(preg_match("/d/",$acl)){
+        $actions.= "<input class='center' type='image'
+          src='images/edittrash.png' alt='"._("delete")."' name='device_del_%KEY%' title='"._("Delete this entry")."'>";
+      }else{
+        $actions.= "<img src='images/empty.png' alt='&nbsp;' class='center'>";
+      }
+
+      $title = "title='".preg_replace('/ /', '&nbsp;', @LDAP::fix($val['dn']))."'";
+
+      if(!isset($val['description'][0])){
+        $desc = "";
+      }else{
+        $desc = " - [ ".$val['description'][0]." ]";
+      }
+
+      /* Cutted objects should be displayed in light grey */
+      $display = $val['cn'][0].$desc;
+      if($this->parent->CopyPasteHandler){
+        foreach($this->parent->CopyPasteHandler->queue as $queue_key => $queue_data){
+          if($queue_data['dn'] == $val['dn']) {
+            $display = "<font color='#999999'>".$display."</font>";
+            break;
+          }
+        }
+      }
+
+
+      /* Create each field */
+      $field0 = array("string" => "<input type='checkbox' id='item_selected_".$key."' name='item_selected_".$key."'>" ,
+                      "attach" => "style='width:20px;'");
+      $field1 = array("string" => sprintf($deviceimg,$val['dn']), "attach" => "style='text-align:center;width:20px;'");
+      $field2 = array("string" => sprintf($editlink,$key,$display), "attach" => "style='' ".$title);
+      $field3 = array("string" => preg_replace("/%KEY%/", $key, $actions), "attach" => "style='width:".$action_col_size."px;border-right:0px;text-align:right;'");
+      $this->AddElement(array($field0,$field1,$field2,$field3));
+    }
+
+
+    /* Create summary string for list footer */
+    $num_deps=0;
+    if(!$this->SubSearch){
+      $num_deps = count($this->Added_Departments);
+    }
+    $num_objs = count($list);
+
+    $num_obj_str = _("Number of listed devices");
+    $num_dep_str = _("Number of listed departments");
+
+    $str = "<img class='center' src='images/select_devices.png'
+              title='".$num_obj_str."' alt='".$num_obj_str."'>&nbsp;".$num_objs."&nbsp;&nbsp;&nbsp;&nbsp;";
+    $str.= "<img class='center' src='images/folder.png'
+              title='".$num_dep_str."' alt='".$num_dep_str."'>&nbsp;".$num_deps."&nbsp;&nbsp;&nbsp;&nbsp;";
+
+    $this->set_List_Bottom_Info($str);
+  }
+
+  function Save()
+  {
+    MultiSelectWindow::Save();  
+  }
+
+  function save_object()
+  {
+    /* Save automatic created POSTs like regex, checkboxes */
+    MultiSelectWindow::save_object(); 
+  }
+
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-plugins/goto/admin/devices/deviceGeneric.tpl b/gosa-plugins/goto/admin/devices/deviceGeneric.tpl
new file mode 100644 (file)
index 0000000..863851e
--- /dev/null
@@ -0,0 +1,75 @@
+
+<h2>{t}Devices{/t}</h2>
+
+<table width="100%" summary="">
+ <tr>
+  <td width="50%" style="vertical-align:top">
+    <table style="border-right:1px solid #B0B0B0;width:100%">
+        <tr>
+            <td><LABEL for="base">{t}Base{/t}</LABEL>
+            </td>
+            <td>
+                               <select name="base">
+                                       {html_options options=$bases selected=$base}
+                               </select>
+            </td>
+        </tr>
+        <tr>
+            <td><LABEL for="cn">{t}Device name{/t}</LABEL>{$must}
+            </td>
+            <td>
+                <input type="text" size=40 value="{$cn}" name="cn" id="cn">
+            </td>
+        </tr>
+        <tr>
+            <td><LABEL for="description">{t}Description{/t}</LABEL>
+            </td>
+            <td>
+                <input type="text" size=40 value="{$description}" name="description" id="description">
+            </td>
+        </tr>
+        <tr>
+            <td><LABEL for="description">{t}Device type{/t}</LABEL>
+            </td>
+            <td>
+               <select id="type" size="1" name="type" title="{t}Choose the device type{/t}">
+                       {html_options options=$types selected=$type}
+               </select>
+            </td>
+        </tr>
+    </table>
+   </td>
+   <td style="vertical-align:top">
+    <table summary="">
+        <tr>
+            <td><LABEL for="dev_id">{t}Serial number{/t}&nbsp;{t}(iSerial){/t}</LABEL>{$must}
+            </td>
+            <td>
+                <input type="text" value="{$dev_id}" name="dev_id" id="dev_id">
+            </td>
+            <td colspan="2">&nbsp;</td>
+        </tr>
+        <tr>
+            <td><LABEL for="vendor">{t}Vendor-ID{/t}&nbsp;{t}(idVendor){/t}</LABEL>{$must}
+            </td>
+            <td>
+                <input type="text" value="{$vendor}" name="vendor" id="vendor">
+            </td>
+        </tr>
+        <tr>
+          <td><LABEL for="produkt">{t}Product-ID{/t}&nbsp;{t}(idProduct){/t}</LABEL>{$must}
+            </td>
+            <td>
+                <input type="text" value="{$serial}" name="serial" id="serial">
+            </td>
+        </tr>
+    </table>
+</table>
+<input type='hidden' value="1" name="deviceGeneric_posted">
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+    focus_field('name');
+  -->
+</script>
+
+
diff --git a/gosa-plugins/goto/admin/devices/main.inc b/gosa-plugins/goto/admin/devices/main.inc
new file mode 100644 (file)
index 0000000..45209ca
--- /dev/null
@@ -0,0 +1,57 @@
+<?php
+/*
+   This code is part of GOsa (https://gosa.gonicus.de)
+   Copyright (C) 2003  Cajus Pollmeier
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+if ($remove_lock){
+               if(session::is_set('DeviceManagement')){
+                               $DeviceManagement = session::get('DeviceManagement');
+                               $DeviceManagement->remove_lock();
+                               del_lock ($ui->dn);
+                               session::un_set ('DeviceManagement');
+               }
+} else {
+
+               /* Create DeviceManagement object on demand */
+               if (!session::is_set('DeviceManagement') || (isset($_GET['reset']) && $_GET['reset'] == 1)){
+                       session::set('DeviceManagement',new deviceManagement ($config));
+               }
+
+               /* Get object */
+               $DeviceManagement = session::get('DeviceManagement');
+               $DeviceManagement->save_object();
+               $output= $DeviceManagement->execute();
+
+               /* Page header*/
+               if (session::is_set('objectinfo')){
+                               $display= print_header(get_template_path('images/devices.png'), _("Device management"), "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png')."\"> ".@LDAP::fix(session::get('objectinfo')));
+               } else {
+                               $display= print_header(get_template_path('images/devices.png'), _("Device management"));
+               }
+
+               /* Reset requested? */
+               if (isset($_GET['reset']) && $_GET['reset'] == 1){
+                               del_lock ($ui->dn);
+                               session::un_set ('DeviceManagement');
+               }
+
+               /* Show and save dialog */
+               $display.= $output;
+               session::set('DeviceManagement',$DeviceManagement);
+}
+?>
diff --git a/gosa-plugins/goto/admin/devices/paste_deviceGeneric.tpl b/gosa-plugins/goto/admin/devices/paste_deviceGeneric.tpl
new file mode 100644 (file)
index 0000000..44d6882
--- /dev/null
@@ -0,0 +1,25 @@
+
+<h2>{t}Devices{/t}</h2>
+
+<table width="100%" summary="">
+ <tr>
+  <td width="50%" style="vertical-align:top">
+    <table style="border-right:1px solid #B0B0B0;width:100%">
+        <tr>
+            <td><LABEL for="cn">{t}Device name{/t}</LABEL>{$must}
+            </td>
+            <td>
+                <input type="text" size=40 value="{$cn}" name="cn" id="cn">
+            </td>
+        </tr>
+    </table>
+   </td>
+</table>
+<input type='hidden' value="1" name="deviceGeneric_posted">
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+    focus_field('name');
+  -->
+</script>
+
+
diff --git a/gosa-plugins/goto/admin/devices/remove.tpl b/gosa-plugins/goto/admin/devices/remove.tpl
new file mode 100644 (file)
index 0000000..643056c
--- /dev/null
@@ -0,0 +1,23 @@
+<div style="font-size:18px;">
+  <img alt="" src="images/button_cancel.png" align=top>&nbsp;{t}Warning{/t}
+</div>
+<p>
+ {$intro}
+ {t}This may be used by several users/groups. Please double check if your really want to do this since there is no way for GOsa to get your data back.{/t}
+</p>
+<p>
+ {t}So - if you're sure - press 'Delete' to continue or 'Cancel' to abort.{/t}
+</p>
+
+<p class="plugbottom">
+       {if $multiple}
+               <input type=submit name="delete_multiple_device_confirm" value="{t}Delete{/t}">
+               &nbsp;
+               <input type=submit name="delete_multiple_device_cancel" value="{t}Cancel{/t}">
+       {else}
+               <input type=submit name="delete_device_confirm" value="{t}Delete{/t}">
+               &nbsp;
+               <input type=submit name="delete_cancel" value="{t}Cancel{/t}">
+       {/if}
+</p>
+
diff --git a/gosa-plugins/goto/admin/devices/tabs_devices.inc b/gosa-plugins/goto/admin/devices/tabs_devices.inc
new file mode 100644 (file)
index 0000000..0feddfc
--- /dev/null
@@ -0,0 +1,38 @@
+<?php
+
+class devicetabs extends tabs
+{
+  var $Release= "";
+
+  function devicetabs($config, $data, $dn,$category)
+  {
+    tabs::tabs($config, $data, $dn,$category);
+
+    /* Add references/acls/snapshots */
+    $this->addSpecialTabs();
+  }
+
+  function save($ignore_account= FALSE)
+  {
+    $baseobject= $this->by_object['deviceGeneric'];
+    $new_dn= "cn=".$baseobject->cn.",".get_ou('deviceou').$baseobject->base;
+
+    /* Move group? */
+    if ($this->dn != $new_dn){
+
+      /* Write entry on new 'dn' */
+      if ($this->dn != "new"){
+        $baseobject->move($this->dn, $new_dn);
+        $this->by_object['deviceGeneric']= $baseobject;
+      }
+
+      /* Happen to use the new one */
+      $this->dn= $new_dn;
+    }
+
+    tabs::save();
+  }
+
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-plugins/goto/admin/mimetypes/class_divListMimeTypes.inc b/gosa-plugins/goto/admin/mimetypes/class_divListMimeTypes.inc
new file mode 100644 (file)
index 0000000..da73758
--- /dev/null
@@ -0,0 +1,345 @@
+<?php
+
+class divListMimeTypes extends MultiSelectWindow
+{
+  /* Current base */
+  var $selectedBase       = "";
+  var $selectedRelease    = "main";
+  var $AvailableReleases  = array();
+  var $departments        = array();
+  var $parent               ;
+  var $ui                   ;
+
+  /* Regex */
+  var $Regex              = "*";
+
+  /* Subsearch checkbox */
+  var $SubSearch;
+
+  /* These vars should be saved too */
+  var $SaveAdditionalVars = array("selectedRelease");
+
+
+  function divListMimeTypes (&$config, &$parent)
+  {
+    /* Create divlist and setup */
+    MultiSelectWindow::MultiSelectWindow($config, "Mimetypes", "mimetypes");
+  
+    /* initialize required attributes */ 
+    $this->selectedRelease  = get_ou('mimetypeou').session::get('CurrentMainBase');
+    $this->parent           = &$parent;
+    $this->ui               = get_userinfo();
+    $this->AvailableReleases= $this->parent->getReleases($this->selectedBase);
+
+    /* Set list strings */
+    $this->SetTitle       (_("List of defined mime types"));
+    $this->SetSummary     (_("List of defined mime types"));
+    $this->SetInformation (_("This menu allows you to add, edit and remove selected mime types. You may want to use the range selector on top of the mime type listbox, when working with a large number of mime types."));
+
+    /* Result page will look like a headpage */
+    $this->SetHeadpageMode();
+    $this->EnableAplhabet(true);
+  
+    /* Disable buttonsm */
+    $this->EnableCloseButton(false);
+    $this->EnableSaveButton (false);
+
+    /* set Page header */
+    $action_col_size = 80;
+    if($this->parent->snapshotEnabled()){
+      $action_col_size += 38;
+    }
+
+    /* Toggle all selected / deselected */
+    $chk = "<input type='checkbox' id='select_all' name='select_all'
+               onClick='toggle_all_(\"^item_selected_[0-9]*$\",\"select_all\");' >";
+
+    /* set Page header */
+    $this->AddHeader(array("string"=> $chk,          "attach"=>"style='width:20px;'"));
+    $this->AddHeader(array("string" => "&nbsp;",                "attach" => "style='text-align:center;width:20px;'"));
+    $this->AddHeader(array("string" => _("Mime type name")." / "._("Department"), "attach" => "style=''"));
+    $this->AddHeader(array("string" => _("Actions"),            "attach" => "style='width:".$action_col_size."px;border-right:0px;text-align:right;'"));
+
+    /* Add SubSearch checkbox */
+    $this->AddCheckBox("SubSearch",  _("Select to search within subtrees"), _("Search in subtrees"), false);
+
+    /*                  Name                 ,Text                              ,Default  , Connect with alphabet  */
+    $this->AddRegex   ("Regex",     _("Display mime types matching"),"*" , true);
+  }
+
+
+  /* This function allows us to add a user defined filter part at position $position*/
+  function AddUserBoxToFilter($position)
+  {
+    $str = "";
+    if(($position  == 2) && ($this->parent->IsReleaseManagementActivated($this->config))){
+      $smarty = get_smarty();
+      $smarty->assign("selectedRelease",$this->selectedRelease);
+      $smarty->assign("branchimage","images/branch.png");
+      $smarty->assign("releases",$this->AvailableReleases);
+      $str = $smarty->fetch(get_template_path('release_select.tpl', TRUE,dirname(__FILE__)));
+    }
+    return($str);
+  }
+
+
+  /* Create list header, with create / copy & paste etc*/
+  function GenHeader()
+  {
+    /* Prepare departments,
+       which are shown in the listbox on top of the listbox
+     */
+    $options= "";
+
+    /* Get all departments within this subtree */
+    $ui= get_userinfo();
+    $first = "";
+    $found = FALSE;
+    $base = $this->config->current['BASE'];
+
+    /* Add base */
+    $tmp = array();
+    $tmp[] = array("dn"=>$this->config->current['BASE']);
+    $tmp=  array_merge($tmp,get_list("(&(|(ou=*)(description=*))(objectClass=gosaDepartment))", $this->module, $base,
+                    array("ou", "description"), GL_SIZELIMIT | GL_SUBSEARCH));
+
+    $deps = array();
+    foreach($tmp as $tm){
+      $deps[$tm['dn']] = $tm['dn'];
+    }
+
+    /* Load possible departments */
+    $ui= get_userinfo();
+    $tdeps= $ui->get_module_departments($this->module);
+    $ids = $this->config->idepartments;
+    $first = "";
+    $found = FALSE;
+    foreach($ids as $dep => $name){
+      if(isset($deps[$dep]) && in_array_ics($dep, $tdeps)){
+
+        /* Keep first base dn in mind, we could need this
+         *  info if no valid base was found
+         */
+        if(empty($first)) {
+          $first = $dep['dn'];
+        }
+
+        $value = $ids[$dep];
+        if ($this->selectedBase == $dep){
+          $found = TRUE;
+          $options.= "<option selected='selected' value='".$dep."'>$value</option>";
+        } else {
+          $options.= "<option value='".$dep."'>$value</option>";
+        }
+      }
+    }
+
+    /* The currently used base is not visible with your acl setup.
+     * Set base to first useable base.
+     */
+    if(!$found){
+      $this->selectedBase = $first;
+    }
+
+    /* Get acls */
+    $ui       = get_userinfo();
+    $acl      = $ui->get_permissions("cn=dummy,".get_ou('mimetypeou').$this->selectedBase,"mimetypes/mimetype");
+    $acl_all  = $ui->has_complete_category_acls($this->selectedBase,"mimetypes") ;
+
+
+    /* If this is true we add an additional seperator. Just look a few lines below */  
+    $add_sep = false;
+    /* Get copy & paste icon */
+    $Copy_Paste ="";
+    if(preg_match("/(c.*w|w.*c)/",$acl_all) &&  $this->parent->CopyPasteHandler){
+      $Copy_Paste = $this->parent->CopyPasteHandler->generatePasteIcon();
+      $add_sep = true;
+    }
+
+    /* Add default header */
+    $listhead = MultiSelectWindow::get_default_header();
+
+    /* And at least add a department selection box */
+    $listhead .=  _("Base")."&nbsp;<select name='CurrentMainBase' onChange='mainform.submit()' class='center'>$options</select>".
+      " <input class='center' type='image' src='images/list_submit.png' align='middle' 
+        title='"._("Submit department")."' name='submit_department' alt='"._("Submit")."'>&nbsp;";
+
+    /* Create Layers menu */
+    $s  = ".|"._("Actions")."|\n";
+    $s .= "..|<img src='images/list_new.png' alt='' border='0' class='center'>".
+      "&nbsp;"._("Create")."|\n";
+
+    /* Append create options */
+    if(preg_match("/c/",$acl)) {
+      $s.= "...|<input class='center' type='image' src='images/list_new_mime.png' alt=''>".
+        "&nbsp;"._("Mime type")."|mime_new|\n";
+    }
+
+    /* Multiple options */
+    $s.= "..|---|\n";
+    $s.= "..|<img src='images/edittrash.png' alt='' border='0' class='center'>".
+      "&nbsp;"._("Remove")."|"."remove_multiple|\n";
+
+    /* Add multiple copy & cut icons */
+    if(is_object($this->parent->CopyPasteHandler) && preg_match("/(c.*w|w.*c)/",$acl_all)){
+      $s.= "..|---|\n";
+      $s.= "..|<img src='images/editcopy.png' alt='' border='0' class='center'>".
+        "&nbsp;"._("Copy")."|"."multiple_copy_systems|\n";
+      $s.= "..|<img src='images/editcut.png' alt='' border='0' class='center'>".
+        "&nbsp;"._("Cut")."|"."multiple_cut_systems|\n";
+
+      if($this->parent->CopyPasteHandler->entries_queued()){
+        $img = "<img border='0' class='center' src='images/editpaste.png' alt=''>";
+        $s.="..|".$img."&nbsp;"._("Paste")."|editPaste|\n";
+      }else{
+        $img = "<img border='0' class='center' src='images/cant_editpaste.png' alt=''>";
+        $s.="..|".$img."&nbsp;"._("Paste")."\n";
+      }
+    }
+
+    /* Add snapshot icons */
+    if(preg_match("/(c.*w|w.*c)/",$acl_all)){
+      $s .= "..|---|\n";
+      $s .= $this->get_snapshot_header(TRUE);
+    }
+
+    $this->SetDropDownHeaderMenu($s);
+    $this->SetListHeader($listhead);
+  }
+
+
+  /* Some basic settings */
+  function execute()
+  {
+    $this->ClearElementsList();
+    $this->GenHeader();
+  }
+
+
+  function setEntries($list)
+  {
+    /********************
+      Variable init
+     ********************/
+
+    /* Create links */
+    $linkopen = "<a href='?plug=".$_GET['plug']."&amp;act=dep_open&amp;dep_id=%s'>%s</a>";
+    $editlink = "<a href='?plug=".$_GET['plug']."&amp;id=%s&amp;act=edit_entry'>%s</a>";
+    $userimg  = "<img class='center' src='images/select_groups.png' alt='User'    title='%s'>";
+    $mimeimg  = "<img class='center' src='images/select_mimetype.png' alt='A'  title='"._("Mime type")."'>";
+    $empty    = "<img class='center' src='images/empty.png' style='width:16px;height:16px;' alt=''>";
+
+    /* set Page header */
+    $action_col_size = 80;
+    if($this->parent->snapshotEnabled()){
+      $action_col_size += 38;
+    }
+
+    /********************
+      Attach objects
+     ********************/
+
+    foreach($list as $key => $val){
+
+      $ui       = get_userinfo();
+      $acl      = $ui->get_permissions($val['dn'],"mimetypes/mimetype");
+      $acl_all  = $ui->has_complete_category_acls($val['dn'],"mimetypes") ;
+
+      /* Create action icons */
+      $actions = "";
+      if(preg_match("/(c.*w|w.*c)/",$acl_all)){
+        $actions .= $this->GetSnapShotActions($val['dn']);
+      }
+
+      /* Get copy Paste icons */
+      if(($this->parent->CopyPasteHandler) && preg_match("/(c.*w|w.*c)/",$acl_all)){
+        $actions.= "<input class='center' type='image'
+          src='images/editcut.png' alt='"._("cut")."' name='cut_%KEY%' title='"._("Cut this entry")."'>&nbsp;";
+        $actions.= "<input class='center' type='image'
+          src='images/editcopy.png' alt='"._("copy")."' name='copy_%KEY%' title='"._("Copy this entry")."'>&nbsp;";
+      }
+
+      $actions.= "<input class='center' type='image'
+        src='images/edit.png' alt='"._("edit")."' name='mime_edit_%KEY%' title='"._("Edit this entry")."'>";
+
+      /* Add delete button */
+      if(preg_match("/d/",$acl)){
+        $actions.= "<input class='center' type='image'
+          src='images/edittrash.png' alt='"._("delete")."' name='mime_del_%KEY%' title='"._("Delete this entry")."'>";
+      }else{
+        $actions.= "<img src='images/empty.png' alt='&nbsp;' class='center'>";
+      }
+
+      $title = "title='".preg_replace('/ /', '&nbsp;', @LDAP::fix($val['dn']))."'";
+
+      if(!isset($val['description'][0])){
+        $desc = "";
+      }else{
+        $desc = " - [ ".$val['description'][0]." ]";
+      }
+
+      /* Cutted objects should be displayed in light grey */
+      $display = $val['cn'][0].$desc;
+      if($this->parent->CopyPasteHandler){
+        foreach($this->parent->CopyPasteHandler->queue as $queue_key => $queue_data){
+          if($queue_data['dn'] == $val['dn']) {
+            $display = "<font color='#999999'>".$display."</font>";
+            break;
+          }
+        }
+      }
+
+
+      /* Create each field */
+      $field0 = array("string" => "<input type='checkbox' id='item_selected_".$key."' name='item_selected_".$key."'>" ,
+                      "attach" => "style='width:20px;'");
+      $field1 = array("string" => sprintf($mimeimg,$val['dn']), "attach" => "style='text-align:center;width:20px;'");
+      $field2 = array("string" => sprintf($editlink,$key,$display), "attach" => "style='' ".$title);
+      $field3 = array("string" => preg_replace("/%KEY%/", $key, $actions), "attach" => "style='width:".$action_col_size."px;border-right:0px;text-align:right;'");
+      $this->AddElement(array($field0,$field1,$field2,$field3));
+    }
+
+
+    /* Create summary string for list footer */
+    $num_deps=0;
+    if(!$this->SubSearch){
+      $num_deps = count($this->Added_Departments);
+    }
+    $num_objs = count($list);
+
+    $num_obj_str = _("Number of listed mimetypes");
+    $num_dep_str = _("Number of listed departments");
+
+    $str = "<img class='center' src='images/select_mimetype.png'
+              title='".$num_obj_str."' alt='".$num_obj_str."'>&nbsp;".$num_objs."&nbsp;&nbsp;&nbsp;&nbsp;";
+    $str.= "<img class='center' src='images/folder.png'
+              title='".$num_dep_str."' alt='".$num_dep_str."'>&nbsp;".$num_deps."&nbsp;&nbsp;&nbsp;&nbsp;";
+
+    $this->set_List_Bottom_Info($str);
+  }
+
+  function Save()
+  {
+    MultiSelectWindow::Save();  
+  }
+
+  function save_object()
+  {
+    /* Save automatic created POSTs like regex, checkboxes */
+    MultiSelectWindow::save_object(); 
+
+    /* check if returned selectedRelease is a valid release.
+        If it isn't set to a valid release */
+    $this->AvailableReleases = $this->parent->getReleases($this->selectedBase);
+    if(!isset($this->AvailableReleases[$this->selectedRelease])){
+      $this->selectedRelease =key($this->AvailableReleases);
+    }
+    $mimefilter = session::get('mimefilter');
+    $mimefilter['release']  = $this->selectedRelease;
+    session::set('mimefilter',$mimefilter);
+  }
+
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-plugins/goto/admin/mimetypes/class_mimetypeGeneric.inc b/gosa-plugins/goto/admin/mimetypes/class_mimetypeGeneric.inc
new file mode 100644 (file)
index 0000000..03867eb
--- /dev/null
@@ -0,0 +1,758 @@
+<?php
+class mimetype extends plugin
+{
+       /* CLI vars */
+       var $cli_summary                  = "This tab allows you to modify, add or remove mime types in the selected department.";
+       var $cli_description    = "Management dialog to handle mime types";
+       var $ignore_account     = true; // This is always a valid account
+       var $cli_parameters             = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+       var $objectclasses              = array("top","gotoMimeType");
+       var $attributes                   = array("cn","gotoMimeApplication","gotoMimeLeftClickAction","gotoMimeIcon",
+                                                                       "description","gotoMimeFilePattern","gotoMimeEmbeddedApplication",
+                                                                       "gotoMimeGroup");       
+
+       /* Class vars */
+       var $ui;
+       var $cn                                                                               = "";                                     
+       var $gotoMimeLeftClickAction                        = "I";
+       var $gotoMimeLeftClickAction_I              = true;
+       var $gotoMimeLeftClickAction_E              = false;
+       var $gotoMimeLeftClickAction_Q              = false;
+       var $gotoMimeIcon                                                         = "*removed*";
+       var $description                                                          = "";
+       var $gotoMimeFilePattern                                      = array();
+       var $gotoMimeApplication                                      = array();
+       var $gotoMimeEmbeddedApplication            = array();
+       var $gotoMimeGroup                                                      = "";
+       var $iconData                                                               = NULL;     
+       var $base                                                                             = "";
+  var $ApplicationList                  = array();  
+
+
+  /* To prevent errors when using the 'apply' button, we use this variables 
+      to manage array attributes */
+       var $use_gotoMimeIcon                                           = NULL;
+       var $use_gotoMimeFilePattern                        = array();
+       var $use_gotoMimeApplication                        = array();
+       var $use_gotoMimeEmbeddedApplication    = array();
+
+  /* divLists */
+  var $DivPatterns                                                       = NULL;
+  var $DivApps                                                             = NULL;
+  var $DivEApps                                                                    = NULL;
+
+  /* Mime type release mode */
+  var $isReleaseMimeType                                             = false;
+
+  /* These vars will be copied too, if you use copy&paste mode */
+  var $CopyPasteVars        = array("use_gotoMimeFilePattern","use_gotoMimeApplication","use_gotoMimeEmbeddedApplication","iconData",
+                                    "gotoMimeLeftClickAction_I","gotoMimeLeftClickAction_E","gotoMimeLeftClickAction_Q","use_gotoMimeIcon");
+
+  var $view_logged  = FALSE;
+
+  /* Select options */
+  var $MimeGroups                            = array("application","audio","chemical","image","inode","message","model",
+                                      "multipart","text","video","x-conference","x-world");
+
+  /* Orig_Dn is used to verify if this object is new or only edited */         
+  var $orig_dn                 = "";
+
+  function mimetype(&$config,$dn= NULL)
+  {
+    plugin::plugin ($config, $dn);
+
+    /* Save original dn */
+    $this->orig_dn = $dn;      
+
+    /* get gotoMimeLeftClickActions I/E/Q */
+    if(isset($this->gotoMimeLeftClickAction)){
+      $str = $this->gotoMimeLeftClickAction;
+      for($i = 0 ; $i < strlen($str) ; $i ++ ){
+        $varna = "gotoMimeLeftClickAction_". $str[$i];
+        if(isset($this->$varna)){
+          $this->$varna = true;
+        }
+      }
+    }
+
+    /* Create list of defined applications in GOsa */
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd($this->config->current['BASE']);
+    $ldap->search("(&(objectClass=gosaApplication)(cn=*))",array('cn'));
+    $this->ApplicationList = array();
+    while($attrs = $ldap->fetch()){
+      $this->ApplicationList[$attrs['cn'][0]] = $attrs['cn'][0];
+    }
+
+    /* If both radio buttons arn't set, set option I */
+    if(!$this->gotoMimeLeftClickAction_I && !$this->gotoMimeLeftClickAction_E){
+      $this->gotoMimeLeftClickAction_I = true;
+    }
+
+    /* Get list of array attributes */
+    foreach(array("gotoMimeFilePattern") as $attr){
+      $this->$attr = array();
+      if(isset($this->attrs[$attr])){
+        $tmp = array();
+        for($i = 0 ; $i < $this->attrs[$attr]['count'] ; $i ++){
+          $str = $this->attrs[$attr][$i];
+          $tmp[] = $str;
+        }
+        $use_attr = "use_".$attr;
+        $this->$use_attr = $tmp;
+      }
+    }
+
+    /* Get list of array attributes with priority tag ( Test|32 )*/
+    foreach(array("gotoMimeApplication","gotoMimeEmbeddedApplication") as $attr){
+      $this->$attr = array();
+      if(isset($this->attrs[$attr])){
+        $tmp = array();
+        for($i = 0 ; $i < $this->attrs[$attr]['count'] ; $i ++){
+          $str = $this->attrs[$attr][$i];
+          $tmp2= split("\|",$str);
+
+          if(count($tmp2) == 2){
+            $name = $tmp2[0];
+            $prio = $tmp2[1];
+            $tmp[$prio] = $name;
+          }
+        }
+        ksort($tmp);
+        $use_attr = "use_".$attr;
+        $this->$use_attr = $tmp;
+      }
+    }
+
+    /* Check if release Management is enabled */
+    $tmp = $this->config->search("faiManagement", "CLASS",array('menu','tabs'));
+    if(!empty($tmp)) {
+      $this->isReleaseMimeType= true;
+    }
+
+    /* Set base */     
+    if ($this->dn == "new"){
+      if(session::is_set('CurrentMainBase')){
+        $this->base= session::get('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();
+      $this->iconData = $ldap->get_attribute($this->dn,"gotoMimeIcon");
+      $this->saved_attributes['gotoMimeIcon'] = $this->iconData;
+    }
+    if ($this->iconData == ""){
+      $this->set_new_picture("");
+    }
+    session::set('binary',$this->iconData);
+    session::set('binarytype',"image/jpeg");
+  }
+
+
+  function execute()
+  {
+    $smarty = get_smarty();
+
+    if(!$this->view_logged){
+      $this->view_logged =TRUE;
+      new log("view","mimetypes/".get_class($this),$this->dn);
+    }
+
+    $tmp = $this->plInfo();
+    foreach($tmp['plProvidedAcls'] as $name => $translation){
+      $smarty->assign($name."ACL",$this->getacl($name));
+    }
+
+    /* 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->get_allowed_bases());
+        $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()){
+
+        /* A new base was selected, check if it is a valid one */
+        $tmp = $this->get_allowed_bases();
+        if(isset($tmp[$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"),
+        "/^Pattern_SortDown_/"         => array("Action" => "Pattern_SortDown","Func" => "ArrayDown",  "Attr" => "use_gotoMimeFilePattern"),
+        "/^Pattern_Remove_/"   => array("Action" => "Pattern_Remove",  "Func" => "ArrayRemove","Attr" => "use_gotoMimeFilePattern"),
+        "/^Apps_SortUp_/"              => array("Action" => "Apps_SortUp",             "Func" => "ArrayUp",    "Attr" => "use_gotoMimeApplication"),
+        "/^Apps_SortDown_/"    => array("Action" => "Apps_SortDown",   "Func" => "ArrayDown",  "Attr" => "use_gotoMimeApplication"),
+        "/^Apps_Remove_/"              => array("Action" => "Apps_Remove",             "Func" => "ArrayRemove","Attr" => "use_gotoMimeApplication"),
+        "/^EApps_SortUp_/"             => array("Action" => "EApps_SortUp",    "Func" => "ArrayUp",    "Attr" => "use_gotoMimeEmbeddedApplication"),
+        "/^EApps_SortDown_/"   => array("Action" => "EApps_SortDown",  "Func" => "ArrayDown",  "Attr" => "use_gotoMimeEmbeddedApplication"),
+        "/^EApps_Remove_/"             => array("Action" => "EApps_Remove",    "Func" => "ArrayRemove","Attr" => "use_gotoMimeEmbeddedApplication"));          
+    $once = true;
+
+    /* Walk through posts and try to find some commands for us. */
+    foreach($_POST as $name => $value){
+
+      /* Walk through possible commands */
+      foreach($posts as $regex => $action){
+
+        /* Check if there is a command posted */
+        if(preg_match($regex,$name) && $once){
+          $once = false;
+
+          /* Get action vars */
+          $func                = $action['Func'];              // Get function name 
+          $attr                = $action['Attr'];              // Get attribute name
+
+          /* Get entry id */
+          $s_entry     = preg_replace($regex,"",$name);
+          $s_entry     = preg_replace("/_[xy]$/","",$s_entry); 
+
+          /* Execute a command with the given attribute and entry 
+             e.g. $this->gotoMimeFilePattern = $this->ArrayUp(3,$this->gotoMimeFilePattern) */
+          if($this->acl_is_writeable($attr)){
+            $this->$attr= $this->$func($s_entry,$this->$attr,true);                                     
+          }
+        }
+      }
+    }
+
+    /* Set a new icon was requested */
+    if(isset($_POST['update_icon']) && (isset($_FILES['picture_file']['name']))){
+      $this->set_new_picture($_FILES['picture_file']['tmp_name']);             
+    }
+
+    /* Add gotoMimeFilePattern */
+    if(isset($_POST['AddNewFilePattern']) && isset($_POST['NewFilePattern'])){
+      if($this->acl_is_writeable("gotoMimeFilePattern")){
+        $str = $_POST['NewFilePattern'];
+        if(!empty($str)){
+          $this->use_gotoMimeFilePattern[] = $str;
+        }
+      }
+    }  
+
+    /* Add gotoMimeFilePattern */
+    if(isset($_POST['AddNewApplication']) && 
+            (isset($_POST['NewApplication']) || isset($_POST['NewApplicationSelect']))){
+      if($this->acl_is_writeable("gotoMimeApplication")){
+        $str = "";
+        if(isset($_POST['NewApplicationSelect']) && !empty($_POST['NewApplicationSelect'])){
+          $str = get_post("NewApplicationSelect");
+        }
+        if(isset($_POST['NewApplication']) && !empty($_POST['NewApplication'])){
+          $str = get_post("NewApplication");
+        }
+        if(!empty($str) && !in_array($str,$this->use_gotoMimeApplication)){
+          $this->use_gotoMimeApplication[] = $str;
+        }
+      }
+    }  
+
+    /* Add embedded application 
+     *  - From input or from select box 
+     */
+    if(isset($_POST['AddNewEmbeddedApplication']) && 
+            (isset($_POST['NewEmbeddedApplication']) || isset($_POST['NewEmbeddedApplicationSelect']))){
+      if($this->acl_is_writeable("gotoMimeEmbeddedApplication")){
+        $str = "";
+        if(isset($_POST['NewEmbeddedApplicationSelect']) && !empty($_POST['NewEmbeddedApplicationSelect'])){
+          $str = get_post('NewEmbeddedApplicationSelect');
+        }
+        if(isset($_POST['NewEmbeddedApplication']) && !empty($_POST['NewEmbeddedApplication'])){
+          $str = get_post('NewEmbeddedApplication');
+        }
+        if(!empty($str) && !in_array($str,$this->use_gotoMimeEmbeddedApplication)){
+          $this->use_gotoMimeEmbeddedApplication[] = $str;
+        }
+      }
+    }  
+
+    /* Create divlists */
+    $DivPatterns       = new divSelectBox("gotoMimePatterns");
+    $DivApps           = new divSelectBox("gotoMimeApplications");
+    $DivEApps          = new divSelectBox("gotoMimeEmbeddedApplications");
+    $DivPatterns       -> SetHeight(100);
+    $DivApps           -> SetHeight(100);
+    $DivEApps          -> SetHeight(100);
+
+
+    if($this->acl_is_writeable("gotoMimeFilePattern")){
+      $Pattern_Actions= " <input type='image' src='images/sort_up.png'         class='center'  name='Pattern_SortUp_%s' >&nbsp;
+      <input type='image' src='images/sort_down.png'   class='center'  name='Pattern_SortDown_%s'>&nbsp;
+      <input type='image' src='images/edittrash.png'   class='center'  name='Pattern_Remove_%s'>";
+    }else{
+      $Pattern_Actions= "";    
+    }
+
+    if($this->acl_is_writeable("gotoMimeApplication")){
+      $Apps_Actions    = " <input type='image' src='images/sort_up.png'        class='center'  name='Apps_SortUp_%s' >&nbsp;
+      <input type='image' src='images/sort_down.png'   class='center'  name='Apps_SortDown_%s'>&nbsp;
+      <input type='image' src='images/edittrash.png'   class='center'  name='Apps_Remove_%s'>";
+    }else{
+      $Apps_Actions= "";       
+    }
+
+    if($this->acl_is_writeable("gotoMimeEmbeddedApplication")){
+      $EApps_Actions   = " <input type='image' src='images/sort_up.png'        class='center'  name='EApps_SortUp_%s' >&nbsp;
+      <input type='image' src='images/sort_down.png'   class='center'  name='EApps_SortDown_%s'>&nbsp;
+      <input type='image' src='images/edittrash.png'   class='center'  name='EApps_Remove_%s'>";
+    }else{
+      $EApps_Actions= "";      
+    }
+
+    /* Before adding some entries check acls */
+    if($this->acl_is_readable("gotoMimeFilePattern")){
+      foreach($this->use_gotoMimeFilePattern as $key => $pattern){
+        $field1 = array("string" => $pattern);
+        $field2 = array("string" => preg_replace("/%s/",$key,$Pattern_Actions),"attach"=>"style='border-right:0px;width:50px;'");
+        $fields = array($field1,$field2);
+        $DivPatterns -> AddEntry($fields);
+      }                        
+    }
+
+    if($this->acl_is_readable("gotoMimeApplication")){
+      foreach($this->use_gotoMimeApplication as $key => $pattern){
+        $field1 = array("string" => $pattern);
+        $field2 = array("string" => preg_replace("/%s/",$key,$Apps_Actions),"attach"=>"style='border-right:0px;width:50px;'");
+        $fields = array($field1,$field2);
+        $DivApps -> AddEntry($fields);
+      }                        
+    }                  
+    if($this->acl_is_readable("gotoMimeEmbeddedApplication")){
+      foreach($this->use_gotoMimeEmbeddedApplication as $key => $pattern){
+        $field1 = array("string" => $pattern);
+        $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("bases",                                           $this->get_allowed_bases());            
+    $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());
+
+    $smarty->assign("ApplicationList",$this->ApplicationList);
+  
+    /* Assign class vars to smarty */
+    foreach($this->attributes as $attr){
+      $smarty->assign($attr,$this->$attr);
+    }  
+
+    /* Assign additional vars that are not included in attributes*/
+    foreach(array("gotoMimeLeftClickAction_I","gotoMimeLeftClickAction_E","gotoMimeLeftClickAction_Q") as $attr){
+      $smarty->assign($attr,$this->$attr);
+    }  
+
+    /* Assign select box options */
+    $smarty->assign("gotoMimeGroups",$this->MimeGroups);
+    $smarty->assign("gotoMimeIcon"     ,$this->get_picture());
+    return($smarty->fetch(get_template_path("generic.tpl",TRUE,dirname(__FILE__))));
+  }
+
+
+  function save_object()
+  {
+    if(isset($_POST['MimeGeneric'])){
+
+      /* Create a base backup and reset the
+         base directly after calling plugin::save_object();
+         Base will be set seperatly a few lines below */
+      $base_tmp = $this->base;
+      plugin::save_object();
+      $this->base = $base_tmp;
+  
+      /* Only save base if we are not in release mode */
+      if(!$this->isReleaseMimeType){
+
+        /* Set new base if allowed */
+        $tmp = $this->get_allowed_bases();
+        if(isset($_POST['base'])){
+          if(isset($tmp[$_POST['base']])){
+            $this->base= $_POST['base'];
+          }
+        }
+
+      }
+
+      /* Save radio buttons */
+      if($this->acl_is_writeable("gotoMimeLeftClickAction")){
+        if(isset($_POST['gotoMimeLeftClickAction_IE'])){
+          $chr = $_POST['gotoMimeLeftClickAction_IE'];
+          if($chr == "E"){
+            $this->gotoMimeLeftClickAction_E = true;
+            $this->gotoMimeLeftClickAction_I = false;
+          }else{
+            $this->gotoMimeLeftClickAction_E = false;
+            $this->gotoMimeLeftClickAction_I = true;
+          }
+        }
+        if(isset($_POST['gotoMimeLeftClickAction_Q'])){
+          $this->gotoMimeLeftClickAction_Q = true;
+        }else{
+          $this->gotoMimeLeftClickAction_Q = false;
+        }
+      }
+    }
+  }
+
+
+  /* save current changes */
+  function save()
+  {
+    /* Create gotoMimeLeftClickAction out of checkboxes and radio buttons */   
+    $arr = array ("E","I","Q");
+    $str = "";
+    foreach ($arr as $Chr){
+      $var = "gotoMimeLeftClickAction_".$Chr;
+      if($this->$var){
+        $str .= $Chr;
+      }
+    }
+    $this->gotoMimeLeftClickAction = $str;
+
+    /* Create array entries with priority tag ( Test|3 )*/
+    foreach(array("gotoMimeEmbeddedApplication","gotoMimeApplication") as $attr){
+      $i                               = 0;
+      $use_attr                = "use_".$attr;
+      $tmp                     = array();
+      $this->$attr     = array();
+      foreach($this->$use_attr as $entry){
+        $tmp[] = $entry."|".$i ++;
+      }
+      $this->$attr = $tmp;
+    }
+
+    /* Create array entries */
+    foreach(array("gotoMimeFilePattern") as $attr){
+      $i                               = 0;
+      $use_attr                = "use_".$attr;
+      $tmp                     = array();
+      $this->$attr     = array();
+      foreach($this->$use_attr as $entry){
+        $tmp[] = $entry;
+      }
+      $this->$attr = $tmp;
+    }
+
+    /* Remove Icon if requested  */
+    if($this->use_gotoMimeIcon != "*removed*"){
+      $this->gotoMimeIcon = $this->iconData;
+    }else{
+      $this->gotoMimeIcon = "";
+    }
+
+    plugin::save();
+
+    /* If this is a newly created object, skip storing those 
+       attributes that contain an empty array */
+    if($this->orig_dn == "new"){
+      foreach(array("gotoMimeEmbeddedApplication","gotoMimeApplication","gotoMimeFilePattern") as $attr){
+        if(!count($this->$attr)){
+          unset($this->attrs[$attr]);
+        }
+      }
+    }
+
+    $ldap = $this->config->get_ldap_link();
+    $ldap-> cd ( $this->config->current['BASE']);
+    $ldap->cat($this->dn);
+    if($ldap->count()){
+      $ldap->cd($this->dn);
+      $this->cleanup();
+      $ldap->modify($this->attrs);
+      new log("modify","mimetypes/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }else{
+      $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
+      $ldap->cd($this->dn);
+      $ldap->add($this->attrs);
+      new log("create","mimetypes/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }
+    show_ldap_error($ldap->get_error(), sprintf(_("Saving of mime type/generic with dn '%s' failed."),$this->dn));
+  }
+
+
+  /* Remove current mime type */
+  function remove_from_parent()
+  {
+    plugin::remove_from_parent();
+    $ldap = $this->config->get_ldap_link();
+    $ldap->rmDir($this->dn);
+    show_ldap_error($ldap->get_error(), sprintf(_("Removing of mime type/generic with dn '%s' failed."),$this->dn));
+    new log("remove","mimetypes/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+
+    /* Optionally execute a command after we're done */
+    $this->handle_post_events("remove");
+
+    /* Delete references to object groups */
+    $ldap->cd ($this->config->current['BASE']);
+    $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".LDAP::prepare4filter($this->dn)."))", array("cn"));
+    while ($ldap->fetch()){
+      $og= new ogroup($this->config, $ldap->getDN());
+      unset($og->member[$this->dn]);
+      $og->save ();
+      show_ldap_error($ldap->get_error(), sprintf(_("Removing mime type from objectgroup '%s' failed"), $og->dn));
+    }
+  }
+
+
+  /* Check given values */
+  function check()
+  {
+    $message = plugin::check();
+    if(empty($this->cn)){
+      $message[] = _("Please specify a valid name for this mime type.");
+    }
+    if(!count($this->use_gotoMimeFilePattern)){
+      $message[] = _("Please specify at least one file pattern.") ;
+    }
+
+    /* Check if there is already a mime type with this cn */
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd($this->config->current["BASE"]);
+
+    $mimefilter = session::get('mimefilter');
+  
+    if($this->isReleaseMimeType && (isset($mimefilter['release']))){
+      $baseDn = str_replace($this->config->current['BASE'],$this->base,$mimefilter['release']);
+      $baseDn = preg_replace("/".get_ou('mimetypeou').".*/",get_ou('mimetypeou').$this->base,$mimefilter['release']);
+      $ldap->ls("(&(objectClass=gotoMimeType)(cn=".$this->cn."))",$baseDn,array("cn"));
+      if($ldap->count()){
+        $attrs = $ldap->fetch();
+        if($this->dn != $attrs['dn']) {
+          $message[]= _("There's already a mime type with this 'Name'.");
+        }
+      }
+    }else{
+      $ldap->ls("(&(objectClass=gotoMimeType)(cn=".$this->cn."))",get_ou('mimetypeou').$this->base,array("cn"));
+      if ($ldap->count()){
+        $attrs = $ldap->fetch();
+        if($this->dn != $attrs['dn']) {
+          $message[]= _("There's already an mime with this 'Name'.");
+        }
+      }
+    }
+
+    return($message);
+  }
+
+  /** Helper functions **/
+
+  /* Set a new picture */      
+  function set_new_picture($filename)
+  {
+    if (empty($filename)){
+      $filename= "./images/default_icon.png";
+      $this->use_gotoMimeIcon= "*removed*";
+    }else{
+      $this->use_gotoMimeIcon= $filename;
+    }
+
+    if (file_exists($filename)){
+      $fd = fopen ($filename, "rb");
+      $this->iconData= fread ($fd, filesize ($filename));
+      session::set('binary',$this->iconData);
+      session::set('binarytype',"image/jpeg");
+      fclose ($fd);
+    }
+  }
+
+  /* Get picture link */
+  function get_picture()
+  {
+    session::set('binary',$this->iconData);
+    session::set('binarytype',"image/jpeg");
+    return("getbin.php");
+  }
+
+  /* Transports the given Arraykey one position up*/
+  function ArrayUp($atr,$attrs)
+  {
+    $ret = $attrs;
+    $pos = $this->getpos($atr,$attrs) ;
+    $cn = count($attrs);
+    if(!(($pos == -1)||($pos == 1))){
+      $before = array_slice($attrs,0,($pos-2));
+      $mitte  = array_reverse(array_slice($attrs,($pos-2),2));
+      $unten  = array_slice($attrs,$pos);
+      $ret = array();
+      $ret = $this->combineArrays($before,$mitte,$unten);
+    }
+    return($ret);
+  }
+
+
+  /* Transports the given Arraykey one position down*/
+  function ArrayDown($atr,$attrs)
+  {
+    $ret = $attrs;
+    $pos = $this->getpos($atr,$attrs) ;
+    $cn = count($attrs);
+    if(!(($pos == -1)||($pos == $cn))){
+      $before = array_slice($attrs,0,($pos-1));
+      $mitte  = array_reverse(array_slice($attrs,($pos-1),2));
+      $unten  = array_slice($attrs,($pos+1));
+      $ret = array();
+      $ret = $this->combineArrays($before,$mitte,$unten);
+    }
+    return($ret);
+  }
+
+
+  /* return the position of the element in the array */
+  function getpos($atr,$attrs)
+  {
+    $i = 0;
+    foreach($attrs as $attr => $name)    {
+      $i++;
+      if($attr == $atr){
+        return($i);
+      }
+    }
+    return(-1);
+  }
+
+
+  /* Remove this element from array */
+  function ArrayRemove($key,$array,$reorder = false)   
+  {
+    if(isset($array[$key])){
+      unset($array[$key]);
+      if($reorder){
+        $tmp = array();
+        foreach($array as $entry){
+          $tmp[] = $entry;
+        }
+        $array = $tmp;
+      }
+    }  
+    return($array);
+  }
+
+
+  /* Combine new array */
+  function combineArrays($ar0,$ar1,$ar2)
+  {
+    $ret = array();
+    if(is_array($ar0))
+      foreach($ar0 as $ar => $a){
+        $ret[]=$a;
+      }
+    if(is_array($ar1))
+      foreach($ar1 as $ar => $a){
+        $ret[]=$a;
+      }
+    if(is_array($ar2))
+      foreach($ar2 as $ar => $a){
+        $ret[]=$a;
+      }
+    return($ret);
+  }
+
+
+  /* Return a dialog with all fields that must be changed, 
+     if we want to copy this entry */
+  function getCopyDialog()
+  {
+    $str = "";
+
+    $smarty = get_smarty();
+    $smarty->assign("cn",              $this->cn);
+    $smarty->assign("description",  $this->description);
+    $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE,dirname(__FILE__)));
+
+    $ret = array();
+    $ret['string'] = $str;
+    $ret['status'] = "";
+    return($ret);
+  }
+
+
+  /* Save all */
+  function saveCopyDialog()
+  {
+    $attrs = array("cn","description");
+    foreach($attrs as $attr){
+      if(isset($_POST[$attr])){
+        $this->$attr = $_POST[$attr];
+      }
+    }
+  }
+
+  /* Return plugin informations for acl handling  */ 
+  static function plInfo()
+  {
+    return (array(
+          "plShortName"   => _("Generic"),
+          "plDescription" => _("Mime type generic"),
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 0,
+          "plSection"     => array("administration"),
+          "plCategory"    => array("mimetypes" => array("description"  => _("Mime types"),
+                                                        "objectClass"  => "gotoMimeType")),
+          "plProvidedAcls"=> array(
+            "cn"                          => _("Name"),
+            "gotoMimeGroup"               => _("Mime group"),
+            "description"                 => _("Description"),
+            "base"                        => _("Base"),
+            "gotoMimeApplication"         => _("Application"),
+            "gotoMimeLeftClickAction"     => _("Left click action"),
+            "gotoMimeIcon"                => _("Icon"),
+            "gotoMimeFilePattern"         => _("File patterns"),
+            "gotoMimeEmbeddedApplication" => _("Embedded applications"))
+          ));
+
+  }
+
+  function PrepareForCopyPaste($source)
+  {
+    plugin::PrepareForCopyPaste($source);
+
+    $source_o = new mimetype($this->config,$source['dn'],$this->parent);
+
+    foreach(array("gotoMimeLeftClickAction_Q","gotoMimeEmbeddedApplication","gotoMimeApplication","gotoMimeFilePattern","gotoMimeIcon","iconData") as $name){
+      $use_attr     = "use_".$name;
+      if(isset($this->$use_attr)){
+        $this->$use_attr= $source_o->$use_attr;
+      }
+      $this->$name = $source_o->$name;
+    } 
+    foreach($this->attributes as $name){
+      $this->$name = $source_o->$name;
+    }
+
+    if($this->iconData){
+      $this->use_gotoMimeIcon ="Not emtpy, causes icon to be written.";
+    }
+  }
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-plugins/goto/admin/mimetypes/class_mimetypeManagement.inc b/gosa-plugins/goto/admin/mimetypes/class_mimetypeManagement.inc
new file mode 100644 (file)
index 0000000..7af6280
--- /dev/null
@@ -0,0 +1,666 @@
+<?php
+/*
+   This code is part of GOsa (https://gosa.gonicus.de)
+   Copyright (C) 2003  Cajus Pollmeier
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+class mimetypeManagement extends plugin
+{
+  /* Definitions */
+  var $plHeadline     = "Mime types";
+  var $plDescription  = "Manage mime types";
+
+  /* Dialog attributes */
+  var $ui                             = NULL;
+  var $DivListMimeTypes               = NULL;
+  var $enableReleaseManagement        = false;
+  var $mimetabs                       = NULL;
+  var $snapDialog                     = NULL;
+  var $CopyPasteHandler               = NULL;
+  var $start_pasting_copied_objects = FALSE;
+
+
+  function mimetypeManagement (&$config, &$ui)
+  {
+    /* Save configuration for internal use */
+    $this->config   = &$config;
+    $this->ui       = &$ui;
+
+    /* Check if copy & paste is activated */
+    if($this->config->boolValueIsTrue("MAIN","ENABLECOPYPASTE")){
+      $this->CopyPasteHandler = new CopyPasteHandler($this->config);
+    }
+
+    /* Creat dialog object */
+    $this->DivListMimeTypes = new divListMimeTypes($this->config,$this);
+
+    if($this->IsReleaseManagementActivated()){
+
+      /* Check if we should enable the release selection */
+      $this->enableReleaseManagement = true;
+
+      /* Hide SubSearch checkbox */
+      $this->DivListMimeTypes->DisableCheckBox("SubSearch");
+    }
+
+  }
+
+
+  /* Get all releases */
+  function getReleases($base)
+  {
+    $ldap                   = $this->config->get_ldap_link();
+    $dn                     = get_ou('mimetypeou').$base;
+    $ret                    = array();
+    $ret [get_ou('mimetypeou').$base] = "/";    
+
+    $ldap->cd($dn);
+    $ldap->search("objectClass=organizationalUnit",array("ou"));
+
+    while($attrs = $ldap->fetch()){
+      $str = str_replace($dn,"",$attrs['dn']);
+      $tmp = array_reverse( split("ou=",$str));
+      $str = "";
+      foreach($tmp as $val){
+        $val = trim(preg_replace("/,/","",$val));
+        if(empty($val)) break;
+        $str .= "/".$val;
+      } 
+      if(!empty($str)){
+        $ret[$attrs['dn']]= preg_replace("/^\//","",$str);
+      }
+    }
+    asort($ret);
+    return($ret);
+  }
+
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+
+    /**************** 
+      Variable init 
+     ****************/
+
+    /* These vars will be stored if you try to open a locked mime, 
+        to be able to perform your last requests after showing a warning message */
+    session::set('LOCK_VARS_TO_USE',array("/^act$/","/^id$/","/^mime_edit_/","/^mime_del_/","/^item_selected/","/^remove_multiple_mimetypes/"));
+
+    $smarty       = get_smarty();             // Smarty instance
+    $s_action     = "";                       // Contains the action to proceed
+    $s_entry      = "";                       // The value for s_action
+    $base_back    = "";                       // The Link for Backbutton
+    
+    /* Test Posts */
+    foreach($_POST as $key => $val){
+      // Post for delete
+      if(preg_match("/mime_del.*/",$key)){
+        $s_action = "del";
+        $s_entry  = preg_replace("/mime_".$s_action."_/i","",$key);
+        // Post for edit
+      }elseif(preg_match("/mime_edit_.*/",$key)){
+        $s_action="edit";
+        $s_entry  = preg_replace("/mime_".$s_action."_/i","",$key);
+        // Post for new
+      }elseif(preg_match("/^copy_.*/",$key)){
+        $s_action="copy";
+        $s_entry  = preg_replace("/^copy_/i","",$key);
+      }elseif(preg_match("/^cut_.*/",$key)){
+        $s_action="cut";
+        $s_entry  = preg_replace("/^cut_/i","",$key);
+        // Post for new
+      }elseif(preg_match("/^mime_new.*/",$key)){
+        $s_action="new";
+      }elseif(preg_match("/^remove_multiple_mimetypes/",$key)){
+        $s_action="del_multiple";
+      }elseif(preg_match("/^editPaste.*/i",$key)){
+        $s_action="editPaste";
+      }elseif(preg_match("/^multiple_copy_mimetypes/",$key)){
+        $s_action = "copy_multiple";
+      }elseif(preg_match("/^multiple_cut_mimetypes/",$key)){
+        $s_action = "cut_multiple";
+      }
+    }
+
+    if((isset($_GET['act']))&&($_GET['act']=="edit_entry")){
+      $s_action ="edit";
+      $s_entry  = $_GET['id'];
+    }
+
+    $s_entry  = preg_replace("/_.$/","",$s_entry);
+
+
+    /* handle C&P from layers menu */
+    if(isset($_POST['menu_action']) && preg_match("/^multiple_copy_systems/",$_POST['menu_action'])){
+      $s_action = "copy_multiple";
+    }
+    if(isset($_POST['menu_action']) && preg_match("/^multiple_cut_systems/",$_POST['menu_action'])){
+      $s_action = "cut_multiple";
+    }
+    if(isset($_POST['menu_action']) && preg_match("/^editPaste/",$_POST['menu_action'])){
+      $s_action = "editPaste";
+    }
+
+    /* Create options */
+    if(isset($_POST['menu_action']) && $_POST['menu_action'] == "mime_new"){
+      $s_action = "new";
+    }
+
+    /* handle remove from layers menu */
+    if(isset($_POST['menu_action']) && preg_match("/^remove_multiple/",$_POST['menu_action'])){
+      $s_action = "del_multiple";
+    }
+
+    /**************** 
+      Copy & Paste handling  
+     ****************/
+
+    /* Display the copy & paste dialog, if it is currently open */
+    $ret = $this->copyPasteHandling_from_queue($s_action,$s_entry);
+    if($ret){
+      return($ret);
+    }
+
+
+    /**************** 
+      Create a new mime type 
+     ****************/
+
+    /* New mime type? */
+    $ui = get_userinfo();
+    $acl = $ui->get_permissions($this->DivListMimeTypes->selectedBase,"mimetypes/mimetype");
+    if (($s_action=="new") && preg_match("/c/",$acl)){
+
+      /* By default we set 'dn' to 'new', all relevant plugins will
+         react on this. */
+      $this->dn= "new";
+
+      /* Create new usertab object */
+      $this->mimetabs= new mimetabs($this->config, $this->config->data['TABS']['MIMETABS'], $this->dn,"mimetypes");
+      $this->mimetabs->set_acl_base($this->DivListMimeTypes->selectedBase);
+    }   
+
+
+    /**************** 
+      Edit entry canceled 
+     ****************/
+
+    /* Cancel dialogs */
+    if (isset($_POST['edit_cancel'])){
+      del_lock ($this->mimetabs->dn);
+      unset ($this->mimetabs);
+      $this->mimetabs= NULL;
+      session::un_set('objectinfo');
+    }
+
+
+    /**************** 
+      Edit entry finished 
+     ****************/
+
+    /* Finish mime edit is triggered by the tabulator dialog, so
+       the user wants to save edited data. Check and save at this point. */
+    if ((isset($_POST['edit_finish']) || isset($_POST['edit_apply']) ) && (isset($this->mimetabs->config))){
+
+      /* Check tabs, will feed message array */
+      $this->mimetabs->save_object();
+      $message= $this->mimetabs->check();
+
+      /* Save, or display error message? */
+      if (count($message) == 0){
+
+        /* Save data data to ldap */
+        $this->mimetabs->set_release($this->DivListMimeTypes->selectedRelease);
+        $this->mimetabs->save();
+
+        if (!isset($_POST['edit_apply'])){
+          /* Mime type has been saved successfully, remove lock from LDAP. */
+          if ($this->dn != "new"){
+            del_lock ($this->dn);
+          }
+          unset ($this->mimetabs);
+          $this->mimetabs= NULL;
+          session::un_set('objectinfo');
+        }
+      } else {
+        /* Ok. There seem to be errors regarding to the tab data,
+           show message and continue as usual. */
+        show_errors($message);
+      }
+    }
+
+
+    /**************** 
+      Edit entry  
+     ****************/
+
+    /* User wants to edit data? */
+    if (($s_action=="edit") && (!isset($this->mimetabs->config))){
+
+      /* Get 'dn' from posted 'mimelist', must be unique */
+      $this->dn= $this->mimetypes[$s_entry]['dn'];
+
+      /* Check locking, save current plugin in 'back_plugin', so
+         the dialog knows where to return. */
+      if (($user= get_lock($this->dn)) != ""){
+        return(gen_locked_message ($user, $this->dn));
+      }
+
+      /* Lock the current entry, so everyone will get the
+         above dialog */
+      add_lock ($this->dn, $this->ui->dn);
+
+
+      /* Register mimetabs to trigger edit dialog */
+      $this->mimetabs= new mimetabs($this->config,$this->config->data['TABS']['MIMETABS'], $this->dn,"mimetypes");
+      $this->mimetabs->set_acl_base($this->dn);
+      session::set('objectinfo',$this->dn);
+    }
+
+
+    /********************
+      Delete MULTIPLE entries requested, display confirm dialog
+     ********************/
+
+    if ($s_action=="del_multiple"){
+      $ids = $this->list_get_selected_items();
+
+      $this->dns = array();
+      if(count($ids)){
+
+        foreach($ids as $id){
+          $dn = $this->mimetypes[$id]['dn'];
+          if (($user= get_lock($dn)) != ""){
+            return(gen_locked_message ($user, $dn));
+          }
+          $this->dns[$id] = $dn;
+        }
+
+        $dns_names = "<br><pre>";
+        foreach($this->dns as $dn){
+          add_lock ($dn, $this->ui->dn);
+          $dns_names .= $dn."\n";
+        }
+        $dns_names .="</pre>";
+
+        /* Lock the current entry, so nobody will edit it during deletion */
+        if (count($this->dns) == 1){
+          $smarty->assign("intro",     sprintf(_("You're about to delete the following entry %s"), @LDAP::fix($dns_names)));
+        } else {
+          $smarty->assign("intro",     sprintf(_("You're about to delete the following entries %s"), @LDAP::fix($dns_names)));
+        }
+        $smarty->assign("multiple", true);
+        return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
+      }
+    }
+
+
+
+
+    /********************
+      Delete MULTIPLE entries confirmed
+     ********************/
+
+    /* Confirmation for deletion has been passed. Users should be deleted. */
+    if (isset($_POST['delete_multiple_mimetype_confirm'])){
+
+      $ui = get_userinfo();
+
+      /* Remove user by user and check acls before removeing them */
+      foreach($this->dns as $key => $dn){
+
+        $acl = $ui->get_permissions($dn,"mimetypes/mimetype");
+        if(preg_match("/d/",$acl)){
+
+          /* Delete request is permitted, perform LDAP action */
+          $this->mimetabs= new mimetabs($this->config, $this->config->data['TABS']['MIMETABS'], $dn,"mimetypes");
+          $this->mimetabs->set_acl_base($dn);
+          $this->mimetabs->delete ();
+          unset ($this->mimetabs);
+          $this->mimetabs= NULL;
+
+        } else {
+          /* Normally this shouldn't be reached, send some extra
+             logs to notify the administrator */
+          print_red (_("You are not allowed to delete this mime type!"));
+          new log("security","mimetypes/".get_class($this),$dn,array(),"Tried to trick deletion.");
+        }
+        /* Remove lock file after successfull deletion */
+        del_lock ($dn);
+        unset($this->dns[$key]);
+      }
+    }
+
+
+    /********************
+      Delete MULTIPLE entries Canceled
+     ********************/
+
+    /* Remove lock */
+    if(isset($_POST['delete_multiple_mimetype_cancel'])){
+      foreach($this->dns as $key => $dn){
+        del_lock ($dn);
+        unset($this->dns[$key]);
+      }
+    }
+
+
+    /**************** 
+      Delete mime type 
+     ****************/
+
+    /* Remove user was requested */
+    if ($s_action == "del"){
+
+      /* Get 'dn' from posted 'uid' */
+      $this->dn= $this->mimetypes[$s_entry]['dn'];
+
+      /* Load permissions for selected 'dn' and check if
+         we're allowed to remove this 'dn' */
+      $ui = get_userinfo();
+      $acl = $ui->get_permissions($this->dn,"mimetypes/mimetype");
+      if (preg_match("/d/",$acl)){
+
+        /* Check locking, save current plugin in 'back_plugin', so
+           the dialog knows where to return. */
+        if (($user= get_lock($this->dn)) != ""){
+          return (gen_locked_message ($user, $this->dn));
+        }
+
+        /* Lock the current entry, so nobody will edit it during deletion */
+        add_lock ($this->dn, $this->ui->dn);
+        $smarty= get_smarty();
+        $smarty->assign("intro", sprintf(_("You're about to delete the mime type '%s'."), @LDAP::fix($this->dn)));
+        $smarty->assign("multiple", false);
+        return($smarty->fetch (get_template_path('remove.tpl', TRUE)));
+      } else {
+
+        /* Obviously the user isn't allowed to delete. Show message and
+           clean session. */
+        print_red (_("You are not allowed to delete this mime type!"));
+      }
+    }
+
+
+    /**************** 
+      Delete mime confirmed 
+     ****************/
+
+    /* Confirmation for deletion has been passed. Group should be deleted. */
+    if (isset($_POST['delete_mime_confirm'])){
+
+      /* Some nice guy may send this as POST, so we've to check
+         for the permissions again. */
+      $ui = get_userinfo();
+      $acl = $ui->get_permissions($this->dn,"mimetypes/mimetype");
+      if(preg_match("/d/",$acl)){
+
+        /* Delete request is permitted, perform LDAP action */
+        $this->mimetabs= new mimetabs($this->config, $this->config->data['TABS']['MIMETABS'], $this->dn,"mimetypes");
+        $this->mimetabs->set_acl_base($this->dn);
+        $this->mimetabs->delete ();
+        unset ($this->mimetabs);
+        $this->mimetabs= NULL;
+
+      } else {
+
+        /* Normally this shouldn't be reached, send some extra
+           logs to notify the administrator */
+        print_red (_("You are not allowed to delete this mime type!"));
+        new log("security","mimetypes/".get_class($this),$dn,array(),"Tried to trick deletion.");
+      }
+
+      /* Remove lock file after successfull deletion */
+      del_lock ($this->dn);
+    }
+
+
+    /**************** 
+      Delete mime canceled 
+     ****************/
+
+    /* Delete mime type canceled? */
+    if (isset($_POST['delete_cancel'])){
+      del_lock ($this->dn);
+      session::un_set('objectinfo');
+    }
+
+    /* Show tab dialog if object is present */
+    if (($this->mimetabs) && (isset($this->mimetabs->config))){
+      $display= $this->mimetabs->execute();
+
+      /* Don't show buttons if tab dialog requests this */
+      if (!$this->mimetabs->by_object[$this->mimetabs->current]->dialog){
+        $display.= "<p style=\"text-align:right\">\n";
+        $display.= "<input type=\"submit\" name=\"edit_finish\" style=\"width:80px\" value=\""._("Ok")."\">\n";
+        $display.= "&nbsp;\n";
+        if ($this->dn != "new"){
+          $display.= "<input type=submit name=\"edit_apply\" value=\""._("Apply")."\">\n";
+          $display.= "&nbsp;\n";
+        }
+        $display.= "<input type=\"submit\" name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
+        $display.= "</p>";
+      }
+      return ($display);
+    }
+
+
+    /****************
+      Dialog display
+     ****************/
+
+        /* Check if there is a snapshot dialog open */
+    $base = $this->DivListMimeTypes->selectedBase;
+    if($str = $this->showSnapshotDialog($base,$this->get_used_snapshot_bases())){
+      return($str);
+    }
+
+    /* Display dialog with system list */
+    $this->DivListMimeTypes->parent = $this;
+    $this->DivListMimeTypes->execute();
+    $this->DivListMimeTypes->AddDepartments($this->DivListMimeTypes->selectedBase,3,1);
+    $this->reload();
+    $this->DivListMimeTypes->setEntries($this->mimetypes);
+    return($this->DivListMimeTypes->Draw());
+  }
+
+    
+  /* Return departments, that will be included within snapshot detection */
+  function get_used_snapshot_bases()
+  {
+    return(array($this->DivListMimeTypes->selectedRelease));
+  }
+
+
+
+  function reload()
+  {
+    $this->mimetypes= array();
+
+    /* Set base for all searches */
+    $base       = $this->DivListMimeTypes->selectedBase;
+    $release    = $this->DivListMimeTypes->selectedRelease;
+    $Regex      = $this->DivListMimeTypes->Regex;
+    $SubSearch  = $this->DivListMimeTypes->SubSearch; 
+    $Flags      =  GL_NONE | GL_SIZELIMIT;
+    $Filter     = "(&(|(cn=".$Regex.")(description=".$Regex."))(objectClass=gotoMimeType))";
+    $tmp        = array();
+    $Releases   = $this->getReleases($base);
+
+
+    /* If release management is enabled, use release as base. */
+    if(!$this->enableReleaseManagement){
+      $use_base = $base;
+    }else{
+      if(isset($Releases[$release])){
+        $use_base  = $release;
+      }else{
+        $use_base  = $base;
+      }
+    }
+
+    /* In case of subsearch, add the subsearch flag */
+    if($SubSearch){
+      $Flags    |= GL_SUBSEARCH;  
+    }else{
+      if(!$this->enableReleaseManagement){
+        $use_base = get_ou('mimetypeou').$use_base;
+      }
+    }
+  
+    /* Get results and create index */ 
+    $res= get_sub_list($Filter, "mimetypes",get_ou('mimetypeou'), $use_base, array("cn","description","dn","objectClass"), $Flags);
+    $tmp2 = array();
+    foreach ($res as $val){
+      $tmp[strtolower($val['cn'][0]).$val['cn'][0].$val['dn']]=$val;
+      $tmp2[strtolower($val['cn'][0]).$val['cn'][0].$val['dn']] = strtolower($val['cn'][0]).$val['cn'][0].$val['dn'];
+    }
+
+    /* sort entries */
+    natcasesort($tmp2);
+    $this->mimetypes=array();
+    foreach($tmp2 as $val){
+      $this->mimetypes[]=$tmp[$val];
+    }
+    reset ($this->mimetypes);
+  }
+
+  function remove_from_parent()
+  {
+    /* Optionally execute a command after we're done */
+    $this->postremove();
+  }
+
+
+  function copyPasteHandling_from_queue($s_action,$s_entry)
+  {
+    /* Check if Copy & Paste is disabled */
+    if(!is_object($this->CopyPasteHandler)){
+      return("");
+    }
+
+    /* Add a single entry to queue */
+    if($s_action == "cut" || $s_action == "copy"){
+
+      /* Cleanup object queue */
+      $this->CopyPasteHandler->cleanup_queue();
+      $this->start_pasting_copied_objects = FALSE;
+      $dn = $this->mimetypes[$s_entry]['dn'];
+      $this->CopyPasteHandler->add_to_queue($dn,$s_action,"mimetabs","MIMETABS","mimetypes");
+    }
+
+    /* Add entries to queue */
+    if($s_action == "copy_multiple" || $s_action == "cut_multiple"){
+
+      /* Cleanup object queue */
+      $this->CopyPasteHandler->cleanup_queue();
+      $this->start_pasting_copied_objects = FALSE;
+  
+      /* Add new entries to CP queue */
+      foreach($this->list_get_selected_items() as $id){
+        $dn = $this->mimetypes[$id]['dn'];
+
+        if($s_action == "copy_multiple"){
+          $this->CopyPasteHandler->add_to_queue($dn,"copy","mimetabs","MIMETABS","mimetypes");
+        }
+        if($s_action == "cut_multiple"){
+          $this->CopyPasteHandler->add_to_queue($dn,"cut","mimetabs","MIMETABS","mimetypes");
+        }
+      }
+    }
+
+    /* Start pasting entries */
+    if($s_action == "editPaste"){
+      $this->start_pasting_copied_objects = TRUE;
+    }
+
+    /* Return C&P dialog */
+    if($this->start_pasting_copied_objects && $this->CopyPasteHandler->entries_queued()){
+
+      /* Load entry from queue and set base */
+      $this->CopyPasteHandler->load_entry_from_queue();
+      $this->CopyPasteHandler->SetVar("base",$this->DivListMimeTypes->selectedBase);
+
+      /* Get dialog */
+      $data = $this->CopyPasteHandler->execute();
+
+      /* Return dialog data */
+      if(!empty($data)){
+        return($data);
+      }
+    }
+
+    /* Automatically disable status for pasting */
+    #if(!$this->CopyPasteHandler->entries_queued()){
+    #  $this->start_pasting_copied_objects = FALSE;
+    #}
+    return("");
+  }
+
+
+  /* Check if the release management is activated. */
+  function IsReleaseManagementActivated()
+  {
+    /* Check if we should enable the release selection */
+    $tmp = $this->config->search("faiManagement", "CLASS",array('menu','tabs'));
+    if(!empty($tmp)){
+      return(true);
+    }
+    return(false);
+  }
+
+
+  function list_get_selected_items()
+  {
+    $ids = array();
+    foreach($_POST as $name => $value){
+      if(preg_match("/^item_selected_[0-9]*$/",$name)){
+        $id   = preg_replace("/^item_selected_/","",$name);
+        $ids[$id] = $id;
+      }
+    }
+    return($ids);
+  }
+
+
+  /* Save to LDAP */
+  function save()
+  {
+    /* Optionally execute a command after we're done */
+    $this->postcreate();
+  }
+
+  function remove_lock()
+  {
+    if (isset($this->mimetabs->dn)){
+      del_lock ($this->mimetabs->dn);
+    }
+  }
+
+  function save_object() {
+    $this->DivListMimeTypes->save_object();
+  }
+
+  function check() {}
+  function adapt_from_template($dn) {}
+  function password_change_needed() {}
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-plugins/goto/admin/mimetypes/generic.tpl b/gosa-plugins/goto/admin/mimetypes/generic.tpl
new file mode 100644 (file)
index 0000000..1cb6d75
--- /dev/null
@@ -0,0 +1,199 @@
+<table style="width:100%">
+       <tr>
+               <td colspan="2">
+                       <h2><img src='images/list_mime.png' class='center' alt='[M]'>&nbsp;{t}Generic{/t}</h2>
+               </td>
+       </tr>
+       <tr>
+               <td style='width:50%; vertical-align:top;' >
+                       <table>
+                               <tr>
+                                       <td>
+                                               {t}Mime type{/t}{$must}
+                                       </td>
+                                       <td>
+{render acl=$gotoMimeGroupACL}
+                                               <input type="text" name='cn' value="{$cn}" title='{t}Please enter a name for the mime type here{/t}'>
+{/render}
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td>
+                                               {t}Mime group{/t}
+                                       </td>
+                                       <td>
+{render acl=$gotoMimeGroupACL}
+                                               <select name='gotoMimeGroup' title='{t}Categorize this mime type{/t}'>
+                                                       {html_options output=$gotoMimeGroups values=$gotoMimeGroups selected=$gotoMimeGroup}
+                                               </select>
+{/render}
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td>
+                                               {t}Description{/t}
+                                       </td>
+                                       <td>
+{render acl=$descriptionACL}
+                                               <input type="text" name='description' value="{$description}" title='{t}Please specify a description{/t}'>
+{/render}
+                                       </td>
+                               </tr>
+{if !$isReleaseMimeType} 
+                               <tr>
+                                       <td><LABEL for="base">{t}Base{/t}{$must}</LABEL></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/folder_gray.png'}
+                       <input type="image" name="chooseBase" src="images/folder.png" class="center" title="{t}Select a base{/t}">
+               {/render}
+       {/if}
+                                       </td>
+                                </tr>
+
+{/if}
+                       </table>
+                       
+               </td>
+               <td style="border-left:1px solid #A0A0A0;vertical-align:top;">
+                       <table summary="">
+                               <tr>
+                                       <td>
+                                               <LABEL for="picture_file">{t}Icon{/t}</LABEL><br>
+                                               <img src="{$gotoMimeIcon}" border=1 alt='{t}Mime icon{/t}' 
+                                                       style="width:48px; height:48; background-color:white; vertical-align:bottom;">
+                                       </td>
+                                       <td style="vertical-align:top">
+                                               &nbsp;<br>
+                                               <input type="hidden" name="MAX_FILE_SIZE" value="100000">
+{render acl=$gotoMimeIconACL}
+                                               <input name="picture_file" type="file" size="20" maxlength="255" 
+                                                       accept="image/*.png" id="picture_file">
+{/render}
+{render acl=$gotoMimeIconACL}
+                                               <input type="submit" name="update_icon" value="{t}Update{/t}" 
+                                                       title="{t}Update mime type icon{/t}">
+{/render}
+                                       </td>
+                               </tr>
+                       </table>
+               </td>
+       </tr>
+       <tr>
+               <td colspan="2">
+                       <p class='seperator'>&nbsp;</p>
+               </td>
+       </tr>
+       <tr>
+               <td colspan="2">
+                       <h2><img src='images/mime_leftclick.png' class='center' alt='{t}Left click{/t}'>&nbsp;{t}Left click{/t}</h2>
+               </td>
+       </tr>
+       <tr>
+               <td style='width:50%; vertical-align:top;' >
+                       {t}File patterns{/t}{$must}
+{render acl=$gotoMimeFilePatternACL}   
+                       {$gotoMimeFilePatterns} 
+{/render}
+
+{render acl=$gotoMimeFilePatternACL}   
+                       <input type='text'       name='NewFilePattern'    value='' title='{t}Please specify a new file pattern{/t}'>
+{/render}
+{render acl=$gotoMimeFilePatternACL}   
+                       <input type='submit' name='AddNewFilePattern' value='{t}Add{/t}' title='{t}Add a new file pattern{/t}'>
+{/render}
+               </td>
+               <td style="border-left:1px solid #A0A0A0;vertical-align:top;">
+                       {t}Applications{/t}
+{render acl=$gotoMimeApplicationACL}   
+                       {$gotoMimeApplications}         
+{/render}
+
+{render acl=$gotoMimeApplicationACL}   
+                       <select name="NewApplicationSelect">
+                               <option value="">-</option>
+                               {html_options options=$ApplicationList}
+                       </select>
+{/render}
+{render acl=$gotoMimeApplicationACL}   
+                       <input type='text'       name='NewApplication'    value='' title='{t}Enter an application name here{/t}'>
+{/render}
+{render acl=$gotoMimeApplicationACL}   
+                       <input type='submit' name='AddNewApplication' value='{t}Add{/t}' title='{t}Add application{/t}'>
+{/render}
+               </td>
+       </tr>
+       <tr>    
+               <td colspan="2">
+                       <p class='seperator'>&nbsp;</p>
+               </td>
+       </tr>
+       <tr>    
+               <td colspan="2">
+                       <h2><img src='images/mime_embedding.png' class='center' alt='{t}Embedding{/t}'>&nbsp;{t}Embedding{/t}</h2>
+               </td>
+       </tr>
+       <tr>
+               <td style='width:50%; vertical-align:top;' >
+                               
+                       <table>
+                               <tr>
+                                       <td style='vertical-align:top; '>
+{render acl=$gotoMimeLeftClickActionACL}
+                                               <input type='radio' name='gotoMimeLeftClickAction_IE' value='I' 
+                                                       {if $gotoMimeLeftClickAction_I} checked {/if}>
+{/render}
+                                               {t}Show file in embedded viewer{/t}
+                                               <br>
+
+{render acl=$gotoMimeLeftClickActionACL}
+                                               <input type='radio' name='gotoMimeLeftClickAction_IE' value='E' 
+                                                       {if $gotoMimeLeftClickAction_E} checked {/if}>
+{/render}
+                                               {t}Show file in external viewer{/t}
+                                               <br>
+
+{render acl=$gotoMimeLeftClickActionACL}
+                                               <input type='checkbox' name='gotoMimeLeftClickAction_Q' value='1' 
+                                                       {if $gotoMimeLeftClickAction_Q} checked {/if}>
+{/render}
+                                               {t}Ask whether to save to local disk{/t}
+                                       </td>
+                               </tr>
+                       </table>
+                       
+               </td>
+               <td style="border-left:1px solid #A0A0A0;vertical-align:top;">
+                       {t}Applications{/t}
+{render acl=$gotoMimeEmbeddedApplicationACL}
+                       {$gotoMimeEmbeddedApplications}         
+{/render}
+{render acl=$gotoMimeEmbeddedApplicationACL}
+                       <select name="NewEmbeddedApplicationSelect">
+                               <option value="">-</option>
+                               {html_options options=$ApplicationList}
+                       </select>
+{/render}
+{render acl=$gotoMimeEmbeddedApplicationACL}
+                       <input type='text'       name='NewEmbeddedApplication'    value='' 
+                               title='{t}Enter an application name here{/t}'>
+{/render}
+{render acl=$gotoMimeEmbeddedApplicationACL}
+                       <input type='submit' name='AddNewEmbeddedApplication' value='{t}Add{/t}' 
+                               title='{t}Add application{/t}'>
+{/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>
diff --git a/gosa-plugins/goto/admin/mimetypes/main.inc b/gosa-plugins/goto/admin/mimetypes/main.inc
new file mode 100644 (file)
index 0000000..de92142
--- /dev/null
@@ -0,0 +1,57 @@
+<?php
+/*
+   This code is part of GOsa (https://gosa.gonicus.de)
+   Copyright (C) 2003  Cajus Pollmeier
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+if ($remove_lock){
+               if(session::is_set('MimeTypeManagement')){
+                               $MimeTypeManagement = session::get('MimeTypeManagement');
+                               $MimeTypeManagement->remove_lock();
+                               del_lock ($ui->dn);
+                               session::un_set ('MimeTypeManagement');
+               }
+} else {
+
+               /* Create MimeTypeManagement object on demand */
+               if (!session::is_set('MimeTypeManagement') || (isset($_GET['reset']) && $_GET['reset'] == 1)){
+                       session::set('MimeTypeManagement',new mimetypeManagement ($config, $ui));
+               }
+
+               /* Get object */
+               $MimeTypeManagement = session::get('MimeTypeManagement');
+               $MimeTypeManagement->save_object();
+               $output= $MimeTypeManagement->execute();
+
+               /* Page header*/
+               if (session::is_set('objectinfo')){
+                               $display= print_header(get_template_path('images/mimetypes.png'), _("Mimetype management"), "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png')."\"> ".@LDAP::fix(session::get('objectinfo')));
+               } else {
+                               $display= print_header(get_template_path('images/mimetypes.png'), _("Mimetype management"));
+               }
+
+               /* Reset requested? */
+               if (isset($_GET['reset']) && $_GET['reset'] == 1){
+                               del_lock ($ui->dn);
+                               session::un_set ('MimeTypeManagement');
+               }
+
+               /* Show and save dialog */
+               $display.= $output;
+               session::set('MimeTypeManagement',$MimeTypeManagement);
+}
+?>
diff --git a/gosa-plugins/goto/admin/mimetypes/paste_generic.tpl b/gosa-plugins/goto/admin/mimetypes/paste_generic.tpl
new file mode 100644 (file)
index 0000000..34b5e07
--- /dev/null
@@ -0,0 +1,31 @@
+<table style="width:100%">
+       <tr>
+               <td colspan="2">
+                       <h2><img src='images/head.png' class='center'>&nbsp;{t}Generic{/t}</h2>
+               </td>
+       </tr>
+       <tr>
+               <td style='width:50%; vertical-align:top;' >
+                               
+                       <table>
+                               <tr>
+                                       <td>
+                                               {t}Mime type{/t}
+                                       </td>
+                                       <td>
+                                               <input type="text" name='cn' value="{$cn}" title='{t}Please enter a name for the mime type here{/t}'>
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td>
+                                               {t}Description{/t}
+                                       </td>
+                                       <td>
+                                               <input type="text" name='description' value="{$description}" title='{t}Please specify a description for this mime type here{/t}'>
+                                       </td>
+                               </tr>
+                       </table>
+                       
+               </td>
+       </tr>
+</table>
diff --git a/gosa-plugins/goto/admin/mimetypes/release_select.tpl b/gosa-plugins/goto/admin/mimetypes/release_select.tpl
new file mode 100644 (file)
index 0000000..d58738f
--- /dev/null
@@ -0,0 +1,16 @@
+<br> 
+<div class="contentboxh" style="border-bottom:1px solid #B0B0B0;">
+ <p class="contentboxh"><img src="{$branchimage}" align="right" alt="[F]">{t}Branches{/t}</p>
+</div>
+<div class="contentboxb">
+ <table summary="" style="width:100%;">
+  <tr>
+   <td>
+    {t}Current release{/t}&nbsp;
+    <select name="selectedRelease" onChange="document.mainform.submit();">
+     {html_options options=$releases selected=$selectedRelease}
+    </select>
+   </td>
+  </tr>
+ </table>
+</div>
diff --git a/gosa-plugins/goto/admin/mimetypes/remove.tpl b/gosa-plugins/goto/admin/mimetypes/remove.tpl
new file mode 100644 (file)
index 0000000..30c4233
--- /dev/null
@@ -0,0 +1,23 @@
+<div style="font-size:18px;">
+  <img alt="" src="images/button_cancel.png" align=top>&nbsp;{t}Warning{/t}
+</div>
+<p>
+ {$intro}
+ {t}This may be used by several groups. Please double check if your really want to do this since there is no way for GOsa to get your data back.{/t}
+</p>
+<p>
+ {t}So - if you're sure - press 'Delete' to continue or 'Cancel' to abort.{/t}
+</p>
+
+<p class="plugbottom">
+       {if $multiple}
+               <input type=submit name="delete_multiple_mimetype_confirm" value="{t}Delete{/t}">
+               &nbsp;
+               <input type=submit name="delete_multiple_mimetype_cancel" value="{t}Cancel{/t}">
+       {else}
+               <input type=submit name="delete_mime_confirm" value="{t}Delete{/t}">
+               &nbsp;
+               <input type=submit name="delete_cancel" value="{t}Cancel{/t}">
+       {/if}
+</p>
+
diff --git a/gosa-plugins/goto/admin/mimetypes/tabs_mimetypes.inc b/gosa-plugins/goto/admin/mimetypes/tabs_mimetypes.inc
new file mode 100644 (file)
index 0000000..38570fd
--- /dev/null
@@ -0,0 +1,61 @@
+<?php
+
+class mimetabs extends tabs
+{
+  var $Release= "";
+
+  function mimetabs($config, $data, $dn,$category)
+  {
+    tabs::tabs($config, $data, $dn,$category);
+
+    /* Add references/acls/snapshots */
+    $this->addSpecialTabs();
+  }
+
+  function set_release($newRelease)
+  {
+    $this->Release= preg_replace('/,'.get_ou('mimetypeou').'.*$/', '', $newRelease);
+    if ($this->Release != ""){
+      $this->Release= ",".$this->Release;
+    }
+  }
+
+  function save($ignore_account= FALSE)
+  {
+    $baseobject= $this->by_object['mimetype'];
+
+    /* Check for new 'dn', in order to propagate the
+       'dn' to all plugins */
+    $tmp = $this->config->search("faiManagement", "CLASS",array('menu','tabs'));
+
+    $mimefilter = session::get('mimefilter');
+
+    if((!empty($tmp)) && (isset($mimefilter['release']))){
+      if(!$baseobject->isReleaseMimeType){
+        $new_dn= "cn=".$baseobject->cn.",".get_ou('mimetypeou').$baseobject->base;
+      }else{
+        $new_dn ="cn=".$baseobject->cn.",".$mimefilter['release'];
+      }
+    }else{
+      $new_dn= "cn=".$baseobject->cn.",".get_ou('mimetypeou').$baseobject->base;
+    }
+
+    /* Move group? */
+    if ($this->dn != $new_dn){
+
+      /* Write entry on new 'dn' */
+      if ($this->dn != "new"){
+        $baseobject->move($this->dn, $new_dn);
+        $this->by_object['mimetype']= $baseobject;
+      }
+
+      /* Happen to use the new one */
+      $this->dn= $new_dn;
+    }
+
+    tabs::save();
+  }
+
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-plugins/goto/personal/environment/class_environment.inc b/gosa-plugins/goto/personal/environment/class_environment.inc
new file mode 100644 (file)
index 0000000..fe0be1d
--- /dev/null
@@ -0,0 +1,1772 @@
+<?php
+
+class environment extends plugin
+{
+  /* CLI vars */
+  var $cli_summary          = "Manage server basic objects";
+  var $cli_description      = "Some longer text\nfor help";
+  var $cli_parameters       = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+  /* attribute list for save action */
+  var $ignore_account       = FALSE;
+  var $plHeadline           = "Environment";
+  var $plDescription        = "This does something";
+  var $dialog               = false;    // Indicates that we are currently editing in an seperate dialog
+  
+  var $in_dialog            = false;
+  var $uid                  = "";
+
+  var $is_group             = false;
+  var $view_logged = FALSE;
+  
+  /* Attribute definition
+   */
+
+  /* profile management */
+  var $useProfile         = false;  // Specifies if we want to use a Server 
+  var $gotoProfileServer  = "";     // Specifies the selected profile server
+  var $gotoProfileServers = array();// Specifies all available and selectable servers
+  var $gotoProfileFlags   = "";     // Flags enabled  ? only used to set ACL and save 
+  var $gotoProfileFlagC  = "";     // Flag is set to C if we have the profile caching fucntion enabled 
+  
+  var $gotoXResolution    = "auto";     // The selected resolution eg: 1024x768
+  var $gotoXResolutions   = array();// Contains all available resolutions for this account
+  var $gotoProfileFlagL  = "";     // Flag is set to L to enable runtime resolution change 
+  var $gotoProfileQuota   = "";     // User Quota Settings
+
+  /* Logon script section*/
+  var $gotoLogonScripts   = array();// Contains all available Logon Scripts  
+  var $gotoLogonScript    = "";     // The selected Logon Script
+
+  /* Printer */
+  var $gotoPrinter        = array();// All available Printer, with their configurations
+  var $gotoPrinterSel     = "";     //  The selected Printer
+  var $gosaDefaultPrinter = "";     // Default printer
+
+  /* Share */
+  var $gotoShares         = array();// Current Share Options
+  var $gotoShare          = "";     // currently selected Share Option
+  var $gotoShareSelections= array();// Available Shares for this account in Listbox format
+  var $gotoAvailableShares= array();// Available Shares for this account
+
+  /* Kiosk profile */
+  var $kiosk_enabled      = FALSE;
+  var $gotoKioskProfile   = "";     // The selected Kiosk Profile
+  var $gotoKioskProfile_Server    = "";     // The selected Kiosk Profile
+  var $gotoKioskProfile_Profile   = "";     // The selected Kiosk Profile
+  var $gotoKioskProfiles  = array();// All available Kiosk profiles
+
+  /* Hotplug Devices */
+  var $gotoHotplugDevice  = array();     // Selected hotplug
+  var $gotoHotplugDevices = array();// Already configured hotplug devices 
+  var $gotoHotplugDeviceDN= array();
+
+  var $NewAddedPrinters   = array();
+  var $NewDeletedPrinters = array();
+
+  /* general settings */
+  // Sets the attributes which will kept on page reload, which will be saved, ...
+
+  var $CopyPasteVars      = array("gotoHotplugDevices","gotoAvailableShares","gotoShareSelections","gotoPrinterSel","gotoProfileFlagL","gotoXResolutions","gotoProfileFlagC","gotoProfileServers","useProfile","is_group","in_dialog","OrigCn","gotoKioskProfile_Server","gotoKioskProfile_Profile");
+
+  var $attributes         = array("uid","gotoProfileServer","gotoProfileFlags","gotoHotplugDeviceDN",
+      "gotoXResolution","gotoProfileQuota",
+      "gotoLogonScripts","gotoLogonScript",
+      "gotoPrinter", "gosaDefaultPrinter",
+      "gotoShares","gotoShare",
+      "gotoKioskProfile");
+  var $objectclasses      = array("gotoEnvironment"); // Specifies the objectClass which contains the attributes edited here 
+  var $cn;
+  var $OrigCn;
+  var $add_del_printer_member_was_called = false;
+
+  var $multiple_support =TRUE;
+
+  var $use_gotoPrinter;
+
+  function environment (&$config, $dn= NULL)
+  {
+    plugin::plugin ($config, $dn);
+
+    /* Setting uid to default */
+    if(isset($this->attrs['uid'][0])){
+      $this->uid = $this->attrs['uid'][0];
+    }
+
+    /* Check : Are we currently editing a group or user dialog */
+    if((isset($this->attrs['cn'][0]))&&(!isset($this->attrs['uid'][0]))){
+      $suffix="Group";
+      $this->uid          = $this->attrs['cn'][0];
+      $this->attrs['uid'] = $this->attrs['cn'][0];
+      $this->OrigCn = $this->attrs['cn'][0];
+    }else{
+      $suffix="User";
+    }
+
+    /* Get all Printer assignments */
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd($this->config->current['BASE']);
+    $ldap->search("(&(objectClass=gotoPrinter)(goto".$suffix."Printer=".$this->uid."))",array("*"));
+    while($printer = $ldap->fetch()){
+      $this->gotoPrinter[$printer['cn'][0]]=$printer;
+      $this->gotoPrinter[$printer['cn'][0]]['mode']="user";
+    }
+    $ldap->search("(&(objectClass=gotoPrinter)(goto".$suffix."AdminPrinter=".$this->uid."))",array("*"));
+    while($printer = $ldap->fetch()){
+      $this->gotoPrinter[$printer['cn'][0]]=$printer;
+      $this->gotoPrinter[$printer['cn'][0]]['mode']="admin";
+    }
+
+
+    /* Prepare hotplugs */
+    if(isset($this->attrs['gotoHotplugDeviceDN']) && is_array($this->attrs['gotoHotplugDeviceDN'])){
+      $ldap = $this->config->get_ldap_link();
+      $ldap->cd($this->config->current['BASE']);
+      for($i = 0 ; $i < $this->attrs['gotoHotplugDeviceDN']['count'] ; $i ++){
+        $ldap->cat($this->attrs['gotoHotplugDeviceDN'][$i]);
+        if($ldap->count()){
+          $attrs = $ldap->fetch(); 
+
+          if(isset($attrs['gotoHotplugDevice'][0])){
+            $tmp      = preg_split("/\|/",$attrs['gotoHotplugDevice'][0]);
+            $tmp2     = array();
+            $tmp2['name']         = $attrs['cn'][0];
+            $tmp2['description']  = $tmp[0];
+            $tmp2['id']           = $tmp[1];
+            $tmp2['produkt']      = $tmp[2];
+            $tmp2['vendor']       = $tmp[3];
+            $tmp2['dn']           = $attrs['dn'];
+            $this->gotoHotplugDevices[] = $tmp2; 
+          }
+        }else{
+          msg_dialog::display(_("Warning"), sprintf(_("Device '%s' is not available anymore. It will be removed!"), $this->attrs['gotoHotplugDeviceDN'][$i]), WARNING_DIALOG);
+        }
+      }
+    }
+
+    /* prepare LogonScripts */
+    if((isset($this->attrs['gotoLogonScript']))&&(is_array($this->attrs['gotoLogonScript']))){
+      unset($this->attrs['gotoLogonScript']['count']);
+      foreach($this->attrs['gotoLogonScript'] as $device){
+        $tmp = $tmp2 = array();
+        $tmp = split("\|",$device);
+        $tmp2['LogonName']        = $tmp[0]; 
+        $tmp2['LogonPriority']    = $tmp[2]; 
+        if(preg_match("/O/i",$tmp[1])){
+          $tmp2['LogonOverload'] = "O";
+        }else{
+          $tmp2['LogonOverload'] = "";
+        }
+        if(preg_match("/L/i",$tmp[1])){
+          $tmp2['LogonLast'] = "L";
+        }else{
+          $tmp2['LogonLast'] = "";
+        }
+        $tmp2['LogonData']        = base64_decode($tmp[3]); 
+        $tmp2['LogonDescription'] = $tmp[4];
+        $this->gotoLogonScripts[$tmp[0]]=$tmp2;
+      }
+    }
+
+    /* Prepare Shares */
+    if((isset($this->attrs['gotoShare']))&&(is_array($this->attrs['gotoShare']))){
+      unset($this->attrs['gotoShare']['count']);
+      foreach($this->attrs['gotoShare'] as $share){
+        $tmp = $tmp2 = array();
+        $tmp = split("\|",$share);
+        $tmp2['server']      =$tmp[0];
+        $tmp2['name']        =$tmp[1];
+
+        /* Decode base64 if needed */
+        if (!preg_match('%/%', $tmp[2])){
+          $tmp2['mountPoint']  =base64_decode($tmp[2]);
+        } else {
+          $tmp2['mountPoint']  =$tmp[2];
+        }
+
+        if(isset($tmp[3])){
+          $tmp2['PwdHash']  =$tmp[3];
+        }else{
+          $tmp2['PwdHash']  ="";
+        }
+        if(isset($tmp[4])){
+          $tmp2['Username']  =$tmp[4];
+        }else{
+          $tmp2['Username']  ="";
+        }
+        $this->gotoShares[$tmp[1]."|".$tmp[0]]=$tmp2;
+      }
+    }
+
+    for($i = 0 ; $i < strlen($this->gotoProfileFlags) ; $i ++){
+      $chr = $this->gotoProfileFlags[$i];
+      $name = "gotoProfileFlag".$chr;
+      $this->$name=$chr;
+    }
+
+    if((!empty($this->gotoProfileServer))||($this->gotoProfileFlagC=="C")){
+      $this->useProfile = true;
+    }else{
+      $this->useProfile = false;
+    }
+
+    /* Set resolutions */
+    $this->gotoXResolutions = array("auto"=>_("auto"),
+                                    "640x480"   =>  "640x480",
+                                    "800x600"   =>  "800x600",
+                                    "1024x768"  =>  "1024x768",
+                                    "1152x864"  =>  "1152x864",
+                                    "1280x768"  =>  "1280x768",
+                                    "1280x1024" =>  "1280x1024");
+
+    if(isset($this->config->data['MAIN']['RESOLUTION_HOOK'])){
+      $file = $this->config->data['MAIN']['RESOLUTION_HOOK'];
+
+      if(is_readable($file)){
+        $str = file_get_contents($file);
+        $lines = split("\n",$str);
+        foreach($lines as $line){
+          $line = trim($line);
+          if(!empty($line)){
+            $this->gotoXResolutions[$line]=$line;
+          }
+        }
+        //natcasesort($this->gotoXResolutions);
+      }else{
+        msg_dialog::display(_("Configuration error"), sprintf(_("Cannot open file '%s'!"), $file), WARNING_DIALOG);
+      }
+    }
+
+    $this->gotoProfileServers= $config->getShareServerList() ;
+    $this->gotoShareSelections= $config->getShareList(true);
+    $this->gotoAvailableShares= $config->getShareList(false);  
+
+    $this->update_kiosk_profiles();
+  
+    $this->gotoKioskProfile= preg_replace("/^.*\//i","",$this->gotoKioskProfile);
+  }
+
+
+  function update_kiosk_profiles()
+  { 
+    $tmp1  = array("none" => array(_("disabled")));
+    $tmp2  = array("none" => _("disabled"));
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd($this->config->current['BASE']);
+    $ldap->search("(&(objectClass=goEnvironmentServer)(gotoKioskProfile=*)(cn=*))",array("cn","gotoKioskProfile"));
+    $cnt = 0;
+    while($attrs = $ldap->fetch()){
+      for($i = 0 ; $i < $attrs['gotoKioskProfile']['count'] ; $i ++){
+        $name = preg_replace("/^.*kiosk\//","",$attrs['gotoKioskProfile'][$i]);
+        $tmp1[$attrs['cn'][0]][] = $name;
+      }
+      $tmp2[$attrs['cn'][0]]= $attrs['cn'][0];
+      $cnt ++;
+    }
+
+    if($cnt && $this->config->search("environment","kioskpath",array('menu','tabs'))){
+      $this->kiosk_enabled = TRUE;
+    }
+
+    $this->gotoKioskProfiles['BY_SERVER'] = $tmp1;
+    $this->gotoKioskProfiles['SERVERS']   = $tmp2;
+  
+    $this->gotoKioskProfile_Server = preg_replace("/^.*:\/\/([^\/]*).*$/","\\1",$this->gotoKioskProfile);
+    $this->gotoKioskProfile_Profile= preg_replace("/^.*\//","",$this->gotoKioskProfile);
+
+    $error = false;
+    if(!in_array($this->gotoKioskProfile_Server, $this->gotoKioskProfiles['SERVERS'])){
+      $this->gotoKioskProfile_Server = key($this->gotoKioskProfiles['SERVERS']);
+      $error = true;
+    }
+    if(!in_array($this->gotoKioskProfile_Profile, $this->gotoKioskProfiles['BY_SERVER'][$this->gotoKioskProfile_Server])){
+      $this->gotoKioskProfile_Profile = $this->gotoKioskProfiles['BY_SERVER'][$this->gotoKioskProfile_Server][0];
+      $error = true;
+    }
+    if($error && !empty($this->gotoKioskProfile)){
+      $this->gotoKioskProfile_Server ="none";
+      $this->gotoKioskProfile_Profile="";
+      msg_dialog::display(_("Warning"), sprintf(_("Kiosk profile '%s' located on server '%s' is not available anymore. Kiosk profile will be disabled!"), $this->gotoKioskProfile_Profile, $this->gotoKioskProfile_Server), WARNING_DIALOG);
+    }
+  }
+
+
+  /* Detect type of edited object (user|group)*/
+  function detect_grouptype()
+  {
+    if((!isset($this->parent))&&(!$this->is_account)){
+      $this->is_group     = false;
+    }elseif((isset($this->parent))&&(!isset($this->parent->by_object['posixAccount']))){
+      $this->is_group     = true;
+    }else{
+      $this->is_group     = false;
+    }
+  }
+
+
+  function execute()
+  {
+
+    /* Call parent execute */
+    plugin::execute();
+    /* Log view */
+    if($this->is_account && !$this->view_logged){
+      $this->view_logged = TRUE;
+      if(isset($this->parent->by_object['user']) || (isset($this->attrs['objectClass']) &&in_array("gosaAccount",$this->attrs['objectClass']))){
+        new log("view","users/".get_class($this),$this->dn);
+      }else{
+        new log("view","groups/".get_class($this),$this->dn);
+      }
+    }
+
+    /* Are we editing from MyAccount and not editing a user */
+    $WriteOnly = (!isset($this->parent)|| !$this->parent) && !session::is_set('edit');
+
+    /* Check profile server */
+    if($this->acl_is_writeable("gotoProfileServer",$WriteOnly)){
+      if(!empty($this->gotoProfileServer) && !isset($this->gotoProfileServers[$this->gotoProfileServer])){
+        if(count($this->gotoProfileServers)){
+
+          /* Get First Profile */
+          $new = key($this->gotoProfileServers);
+
+          /* Another profile server found */
+          msg_dialog::display(_("Warning"), sprintf(_("Profile server '%s' is not available anymore. Switched to server '%s'."), $this->gotoProfileServer, $new), WARNING_DIALOG);
+        }else{
+
+          /* No other profile servers found */
+          msg_dialog::display(_("Warning"), sprintf(_("Profile server '%s' is not available anymore. Kiosk profile will be disabled."), $this->gotoProfileServer), WARNING_DIALOG);
+          $this->gotoProfileServer = "none";
+        }
+      }
+    }    
+
+    $this->detect_grouptype();
+
+    /* Fill templating stuff */
+    $smarty= get_smarty();
+    $smarty->assign("kiosk_enabled",$this->kiosk_enabled);
+    $display= "";
+
+    $smarty->assign("is_group",$this->is_group);
+
+    /* Prepare all variables for smarty */
+    foreach($this->attributes as $s_attr){
+      /* Set value*/
+      $smarty->assign($s_attr,$this->$s_attr);
+
+      /* Set checkbox state*/
+      if(empty($this->$s_attr)){
+        $smarty->assign($s_attr."CHK","");
+      }else{
+        $smarty->assign($s_attr."CHK"," checked ");
+      }
+
+      /* Prepare ACL settings*/
+      $smarty->assign($s_attr."ACL",$this->getacl($s_attr,$WriteOnly));
+    }
+
+    /* Is accout enabled | are we editing from usermenu or admin menu 
+       All these tab management is done here
+     */
+
+
+    /* Working from Usermenu an the Account is currently disbled
+     * this->parent :  is only set if we are working in a list of tabs
+     * is_account   :  is only true if the needed objectClass is given
+     */
+    if((!isset($this->parent))&&(!$this->is_account)){
+      /* We are currently editing this tab from usermenu, but this account is not enabled */
+      $smarty->assign("is_account",$this->is_account);
+      /* Load template */
+      $display .= $smarty->fetch(get_template_path('environment.tpl', TRUE));
+      /* Avoid the "You are currently editing ...." message when you leave this tab */
+      $display .= back_to_main(); 
+      /* Display our message to the user */
+      return $display;
+
+
+      /* We are currently editing from group tabs, because 
+       * $this->parent is set
+       * posixAccount is not set, so we are not in usertabs.
+       */
+    }elseif((isset($this->parent))&&(!isset($this->parent->by_object['posixAccount']))){
+      $smarty->assign("is_account","true");
+      $this->uid          = $this->cn;
+      $this->attrs['uid'] = $this->cn;
+
+      /* Change state if needed */
+      if (isset($_POST['modify_state'])){
+        if(($this->acl_is_createable() && !$this->is_account) || 
+            ($this->acl_is_removeable() &&  $this->is_account)){
+          $this->is_account= !$this->is_account;
+        }
+      }
+      /* Group Dialog with enabled environment options */
+      if ($this->is_account){
+        $display= $this->show_enable_header(_("Remove environment extension"),
+            _("Environment extension enabled. You can disable it by clicking below."));
+      } else {
+
+        /* Environment is disabled 
+           If theres is no posixAccount enabled, you won't be able to enable 
+           environment extensions
+         */
+        if((isset($this->parent->by_object['group']))||(isset($this->attrs['objectClass']))&&((in_array("posixAccount",$this->attrs['objectClass'])))){
+          // 4. There is a PosixAccount
+          $display= $this->show_enable_header(_("Add environment extension"),
+              _("Environment extension disabled. You can enable it by clicking below."));
+          return $display;
+        }else{
+          // 4. There is no PosixAccount
+          $display= $this->show_enable_header(_("Add environment extension"),
+              _("Environment extension disabled. You have to setup a posix account before you can enable this feature."));
+          return $display;
+        }
+      }
+    }else{
+      /* Editing from Usermenu 
+       *  Tell smarty that this accoutn is enabled 
+       */
+      $smarty->assign("is_account","true");
+
+      /* Change state if needed */
+      if (isset($_POST['modify_state'])){
+        if(($this->acl_is_createable() && !$this->is_account) || 
+            ($this->acl_is_removeable() &&  $this->is_account)){
+          $this->is_account= !$this->is_account;
+        }
+      }
+
+      if(isset($this->parent)){
+
+        // 3. Account enabled . Editing from adminmenu
+        if ($this->is_account){
+          $display= $this->show_disable_header(_("Remove environment extension"),
+              _("Environment extension enabled. You can disable it by clicking below."));
+        } else {
+
+          if($this->parent->by_object['posixAccount']->is_account==true){
+            // 4. There is a PosixAccount
+            $display= $this->show_disable_header(_("Add environment extension"),
+                _("Environment extension disabled. You can enable it by clicking below."));
+            return $display;
+          }else{
+            // 4. There is a PosixAccount
+            $display= $this->show_disable_header(_("Add environment extension"),
+                _("Environment extension disabled. You have to setup a posix account before you can enable this feature."),TRUE,TRUE);
+            return $display;
+          }
+        }
+      }
+    }
+  
+    /* Reset header toggle */
+    if($this->multiple_support_active){
+      $display = "";
+    }
+
+    /* Account is Account : is_accounbt=true.
+     * Else we won't reach this. 
+     */
+
+    /* Prepare all variables for smarty */
+    foreach($this->attributes as $s_attr){
+      /* Set value*/
+      $smarty->assign($s_attr,$this->$s_attr);
+
+      /* Set checkbox state*/
+      if(empty($this->$s_attr)){
+        $smarty->assign($s_attr."CHK","");
+      }else{
+        $smarty->assign($s_attr."CHK"," checked ");
+      }
+
+      /* Prepare ACL settings*/
+      $smarty->assign($s_attr."ACL",$this->getacl($s_attr,$WriteOnly));
+    }
+
+    foreach(array("gotoHotplugDevice","gotoProfileFlagC","gotoProfileFlagL") as $s_attr){
+      $smarty->assign($s_attr."ACL",$this->getacl($s_attr,$WriteOnly));
+    }
+
+    if($WriteOnly) {
+      $smarty->assign("gotoPrinterACL","r");
+    }else{
+      $smarty->assign("gotoPrinterACL","rw");
+    }
+
+
+    $smarty->assign("useProfile",$this->useProfile);
+    if(empty($this->useProfile) && !$this->multiple_support_active){
+      $smarty->assign("useProfileCHK","");
+      $smarty->assign("gotoProfileServerACL" , preg_replace("/w/","",$this->getacl("gotoProfileServer",$WriteOnly)));
+      $smarty->assign("gotoProfileQuotaACL" , preg_replace("/w/","",$this->getacl("gotoProfileQuota",$WriteOnly)));
+      $smarty->assign("gotoProfileFlagCACL" , preg_replace("/w/","",$this->getacl("gotoProfileFlagC",$WriteOnly)));
+    }else{
+      $smarty->assign("useProfileCHK"," checked ");
+    }
+    
+    $smarty->assign("gotoProfileServerWriteable", $this->acl_is_writeable("gotoProfileServer",$WriteOnly));
+    $smarty->assign("gotoProfileACL", $this->getacl("gotoProfileServer",$WriteOnly).$this->getacl("gotoProfileQuota",$WriteOnly));
+
+    /* HANDLE Profile Settings here 
+     * Assign available Quota and resolution settings
+     * Get all available profile server
+     * Get cache checkbox
+     * Assign this all to Smarty 
+     */
+
+    if(empty($this->gotoProfileFlagL)){
+      $smarty->assign("gotoProfileFlagLCHK"," ");
+    }else{
+      $smarty->assign("gotoProfileFlagLCHK"," checked ");
+    }
+
+    if(empty($this->gotoProfileFlagC)){
+      $smarty->assign("gotoProfileFlagCCHK"," ");
+    }else{
+      $smarty->assign("gotoProfileFlagCCHK"," checked ");
+    }
+
+
+    $smarty->assign("gotoXResolutions"    , $this->gotoXResolutions);
+    $smarty->assign("gotoXResolutionKeys" , array_flip($this->gotoXResolutions));
+
+    $smarty->assign("gotoProfileServers",$this->gotoProfileServers);
+    if(!is_array($this->gotoProfileServers)){
+      $this->gotoProfileServers =array();
+    }
+    $smarty->assign("gotoProfileServerKeys",array_flip($this->gotoProfileServers));
+
+    /* Handle kiosk profiles*/
+    $smarty->assign("kiosk_servers" , $this->gotoKioskProfiles['SERVERS']);
+    $smarty->assign("kiosk_server" ,  $this->gotoKioskProfile_Server);
+    $smarty->assign("kiosk_profiles" , $this->gotoKioskProfiles['BY_SERVER'][$this->gotoKioskProfile_Server]);
+    $smarty->assign("kiosk_profile" ,  $this->gotoKioskProfile_Profile);
+  
+
+    /* Logonscript Management
+     * Get available LogonScripts (possibly grey out (or mark) these script that are defined for the group) 
+     * Perform add Delete edit Posts 
+     */
+
+    /* Dialog Save */
+    if(isset($_POST['LogonSave'])){
+
+      if(!$this->acl_is_writeable("gotoLogonScript")){
+        msg_dialog::display(_("Permission error"), _("You have no permission to modify logon scripts!"), ERROR_DIALOG);
+        unset($this->dialog);
+        $this->dialog=FALSE;
+        $this->is_dialog=false;
+      }else{
+        $this->dialog->save_object();
+        if(count($this->dialog->check())!=0){
+          foreach($this->dialog->check() as $msg){
+            msg_dialog::display(_("Error"), $msg, ERROR_DIALOG);
+          }
+        }else{
+          $tmp = $this->dialog->save();
+          unset($this->dialog);
+          $this->dialog=FALSE;
+          $this->is_dialog=false;
+
+          if($this->multiple_support_active){
+            $tmp['UsedByAllUsers'] = TRUE;
+          }
+          $this->gotoLogonScripts[$tmp['LogonName']]=$tmp; 
+        }
+      }
+    }
+    
+
+    /* Dialog Quit without saving */
+    if(isset($_POST['LogonCancel'])){
+      $this->is_dialog= false;
+      unset($this->dialog);
+      $this->dialog= FALSE;
+    }
+
+    /* Check Edit Del New Posts for a selected LogonScript */ 
+    if($this->acl_is_writeable("gotoLogonScript") && 
+        (isset($_POST['gotoLogonScriptNew'])) || isset($_POST['gotoLogonScriptEdit']) ||isset($_POST['gotoLogonScriptDel'])){
+
+      /* New Logon Script: Open an edit dialog, we don't need a $_POST['gotoLogonScript'] here.
+       * In this case we create a new Logon Script.
+       */
+      if(isset($_POST['gotoLogonScriptNew'])){
+        $this->is_dialog = true;
+        $this->dialog = new logonManagementDialog($this->config,$this->dn);
+      }
+
+      /* If we receive a Delete request and there is a Script selected in the selectbox, delete this one.
+       * We only can delete if there is an entry selected.
+       */
+      if((isset($_POST['gotoLogonScriptDel']))&&(isset($_POST['gotoLogonScript']))){
+        unset($this->gotoLogonScripts[$_POST['gotoLogonScript']]);
+      }
+
+      /* In this case we want to edit an existing entry, we open a new Dialog to allow editing.
+       * There must be an entry selected to perform edit request.
+       */
+      if((isset($_POST['gotoLogonScriptEdit']))&&(isset($_POST['gotoLogonScript']))){
+        $is_entry = $this->gotoLogonScripts[$_POST['gotoLogonScript']];
+        $this->is_dialog = true;
+        $this->dialog = new logonManagementDialog($this->config,$this->dn,$is_entry);
+      }
+    }
+
+    /* Append List to smarty*/
+    if($this->multiple_support_active){
+      $smarty->assign("gotoLogonScripts",  $this->gotoLogonScripts);
+      $smarty->assign("gotoLogonScriptKeysCnt",count($this->gotoLogonScripts));
+    }else{
+      $ls = $this->printOutLogonScripts();
+      $smarty->assign("gotoLogonScripts",  $ls);
+      $smarty->assign("gotoLogonScriptKeys",array_flip($ls));
+      $smarty->assign("gotoLogonScriptKeysCnt",count($ls));
+    }
+
+    /* In this section server shares will be defined 
+     * A user can select one of the given shares and a mount point
+     *  and attach this combination to his setup.
+     */
+
+    $smarty->assign("gotoShareSelections",    $this->gotoShareSelections);
+    if(!is_array($this->gotoShareSelections)){
+      $this->gotoShareSelections = array();
+    }
+    $smarty->assign("gotoShareSelectionKeys", array_flip($this->gotoShareSelections));
+
+    /* if $_POST['gotoShareAdd'] is set, we will try to add a new entry 
+     * This entry will be, a combination of mountPoint and sharedefinitions 
+     */
+    if(isset($_POST['gotoShareAdd']) && $this->acl_is_writeable("gotoShare")){
+
+      /* We assign a share to this user, if we don't know where to mount the share */
+      if(!isset($_POST['gotoShareSelection']) || get_post('gotoShareSelection') == ""){
+        msg_dialog::display(_("Error"), _("Please select a valid share!"), ERROR_DIALOG);
+      }elseif((!isset($_POST['gotoShareMountPoint']))||(empty($_POST['gotoShareMountPoint']))||(preg_match("/[\|]/i",$_POST['gotoShareMountPoint']))){
+        msg_dialog::display(_("Error"), _("Please specify a valid mount point!"), ERROR_DIALOG);
+      }elseif(preg_match('/ /', $_POST['gotoShareMountPoint'])){
+        msg_dialog::display(_("Error"), _("You cannot use spaces in the mount path!"), ERROR_DIALOG);
+      }elseif(!(
+            preg_match("/^\//",$_POST['gotoShareMountPoint'])  ||
+            preg_match("/^~/",$_POST['gotoShareMountPoint']) ||
+            preg_match("/^\$HOME/",$_POST['gotoShareMountPoint']) ||
+            preg_match("/^.HOME/",$_POST['gotoShareMountPoint']) ||
+            preg_match("/^\$USER/",$_POST['gotoShareMountPoint']) ||
+            preg_match("/^.USER/",$_POST['gotoShareMountPoint']) ||
+            preg_match("/^%/",$_POST['gotoShareMountPoint'])
+            )
+          ){
+        msg_dialog::display(_("Error"), _("Please specify a valid mount point!"), ERROR_DIALOG);
+      }else{
+        $a_share = $this->gotoAvailableShares[$_POST['gotoShareSelection']];
+        $s_mount = $_POST['gotoShareMountPoint'];
+        $s_user  = $_POST['ShareUser'];
+        /* Preparing the new assignment */ 
+        $this->gotoShares[$a_share['name']."|".$a_share['server']]=$a_share;
+        $this->gotoShares[$a_share['name']."|".$a_share['server']]['Username']=$s_user;
+        $this->gotoShares[$a_share['name']."|".$a_share['server']]['PwdHash']="";
+        $this->gotoShares[$a_share['name']."|".$a_share['server']]['mountPoint']=$s_mount;
+
+        if($this->multiple_support_active){
+          $this->gotoShares[$a_share['name']."|".$a_share['server']]['UsedByAllUsers']= TRUE;
+        }
+      }
+    }  
+
+    /* if the Post  gotoShareDel is set, someone asked GOsa to delete the selected entry (if there is one selected)
+     * If there is no defined share selected, we will abort the deletion without any message 
+     */
+    $once = true;
+    if($this->acl_is_writeable("gotoShare")){
+      foreach($_POST as $name => $value){
+        if((preg_match("/^gotoShareDel_/",$name)) && ($once)){
+          $once = false;  
+          $key  = preg_replace("/^gotoShareDel_/","",$name);
+          $key  = preg_replace("/_+[xy]$/","",$key);
+          $key  = base64_decode($key);
+          if(isset($this->gotoShares[$key])) {
+            unset($this->gotoShares[$key]);
+          }
+
+          /* Remove corresponding password entry, too. This is a workaround
+             to get rid of old-style entries. */
+          $key= preg_replace("/\|/", "|!", $key);
+          if(isset($this->gotoShares[$key])) {
+            unset($this->gotoShares[$key]);
+          }
+        }
+        if((preg_match("/^gotoShareResetPwd_/",$name)) && ($once)){
+          $once = false;
+          $key  = preg_replace("/^gotoShareResetPwd_/","",$name);
+          $key  = preg_replace("/_+[xy]$/","",$key);
+          $key  = base64_decode($key);
+          $this->gotoShares[$key]['PwdHash'] = "";
+          if(preg_match("/^!/",$this->gotoShares[$key]['server'])){
+            unset($this->gotoShares[$key]);
+          }
+        }
+      }
+    }
+    $divlistShares = new divSelectBox("gotoShares");
+    $divlistShares->SetHeight(100);
+
+
+    $tmp = array();
+    if($this->acl_is_readable("gotoShares")){
+      $tmp = $this->printOutAssignedShares();
+    }
+
+    
+    foreach($tmp as $key => $value){
+      $img = "";
+
+      /* Skip apssword only entries */
+      if( empty($this->gotoShares[$key]['server']) && 
+          empty($this->gotoShares[$key]['name']) &&
+          empty($this->gotoShares[$key]['mountPoint']) &&
+          empty($this->gotoShares[$key]['Username'])){
+        continue;
+      } 
+
+      $color = "";
+      if($this->multiple_support_active){
+        if($this->gotoShares[$key]['UsedByAllUsers']){
+          $value .= "&nbsp;(<b>"._("Used by all users")."</b>)";
+        }else{
+          $color = "color: #999999;";
+          $value .= "&nbsp;(<b>"._("Used by some users")."</b>)";
+        }
+      }
+
+      /* Check if entry starts with an ! */
+      if(preg_match("/^!/",$this->gotoShares[$key]['server'])){
+
+        /* If we are currently editing groups environment, skip those ! entries */ 
+        if($this->is_group) continue;
+
+        /* Create pwd reset images */
+        if($this->gotoShares[$key]['PwdHash'] != ""){
+          $img.= "<input type='image' name='gotoShareResetPwd_".base64_encode($key)." 'src='images/list_reset_password.png' alt='"._("Reset password hash")."' 
+            title='"._("Reset password hash")."'>";
+        }
+        $field1 = array("string" => "<font style=\"color:#C0C0C0\">".$value."</font>" , "attach" => "style='".$color."'");
+        $field2 = array("string" => $img   , "attach" => "style='border-right:0px;'");
+      }else{
+
+        /* Create pwd reset img && delete image */
+        if($this->gotoShares[$key]['PwdHash'] != ""){
+          $img.= "<input type='image' name='gotoShareResetPwd_".base64_encode($key)." 'src='images/list_reset_password.png' alt='"._("Reset password hash")."' 
+            title='"._("Reset password hash")."'>";
+          $img.= "&nbsp;";
+        }
+        $img.= "<input type='image' name='gotoShareDel_".base64_encode($key)." 'src='images/edittrash.png' alt='"._("Delete")."' 
+          title='"._("Delete share entry")."'>";
+        $field1 = array("string" => $value , "attach" => "style='".$color."'");
+        $field2 = array("string" => $img   , "attach" => "style='border-right:0px;'");
+      }
+      $divlistShares->AddEntry(array($field1,$field2));
+    }
+    $smarty->assign("divlistShares",$divlistShares->DrawList());
+
+    /* Hotplug devices will be handled here 
+     * There are 3 possible methods for this feature
+     * Create a new Hotplug, A Dialog will open where you can specify some hotplug information
+     * Delete will erase an entry, the entry must be selcted in the ListBox first
+     * Editing an entry will open a dialog where the informations about the selcted entry can be changed
+     */
+
+    /* We have to delete the selected hotplug from the list*/
+    if((isset($_POST['gotoHotplugDeviceDel']))&&(isset($_POST['gotoHotplugDevice_post'])) && $this->acl_is_writeable("gotoHotplugDevice")){
+      if($this->acl_is_writeable("gotoHotplugDevice")){
+        foreach($_POST['gotoHotplugDevice_post'] as $name){
+          unset($this->gotoHotplugDevices[$name]);
+        }
+      }
+    }
+
+    /* There are already defined hotplugs from other users we could use */
+    if(isset($_POST['gotoHotplugDeviceUse']) && $this->acl_is_writeable("gotoHotplugDevice")){
+      $tmp  =array();
+      foreach($this->gotoHotplugDevices as $plugs){
+        $tmp[] = $plugs['name'];
+      }
+      $this->dialog = new hotplugDialog($this->config,$tmp);
+      $this->is_dialog = true;
+    }
+
+    /* Dialog Aborted */
+    if(isset($_POST['HotPlugCancel'])){
+      unset($this->dialog);
+      $this->dialog= FALSE;
+      $this->is_dialog = false;
+    }
+
+    /* Dialod saved */
+    if(isset($_POST['HotPlugSave'])){
+
+      $this->dialog->save_object();
+      if(count($this->dialog->check())!=0){
+        foreach($this->dialog->check() as $msg){
+          msg_dialog::display(_("Error"), $msg, ERROR_DIALOG);
+        }
+      }else{
+        $this->dialog->save_object();
+        $a_tmp = $this->dialog->save();
+
+        if(is_array($a_tmp)){
+          foreach($a_tmp as $name => $hotplug){
+            if($this->multiple_support_active){
+              $hotplug['UsedByAllUsers'] = TRUE;
+            }
+            $this->gotoHotplugDevices[$name]= $hotplug; 
+          }
+        }
+        unset($this->dialog);
+        $this->dialog= FALSE;
+        $this->is_dialog = false;
+      }
+    }
+
+    if($this->multiple_support_active){
+      $smarty->assign("gotoHotplugDevices",$this->gotoHotplugDevices);
+    }else{
+      $smarty->assign("gotoHotplugDevices",$this->printOutHotPlugDevices());
+      $smarty->assign("gotoHotplugDeviceKeys",array_flip($this->printOutHotPlugDevices()));
+    }
+
+    /* Printer Assignment will managed below 
+     * A printer can be assigned in two different ways and two different types
+     * There are 2 types of users assigned to a printer : user and admin
+     * They only differ in the member attribute they will be assigned to. user: gotoUserPrinter admin: gotoadminPrinter
+     * The different types of assigning a user are : 1 assigning a user to a printer 2. assigning a group to a printer
+     */ 
+
+    /* First handle Add Post. Open a dialog that allows us to select a printer or two */ 
+    if(isset($_POST['gotoPrinterAdd'])){
+
+      $this->is_dialog=true;
+      $this->dialog = new selectPrinterDialog($this->config,$this->dn,$this->gotoPrinter);
+    }
+
+    if(isset($_POST['PrinterCancel'])){
+      $this->is_dialog=false;
+      unset($this->dialog);
+      $this->dialog=FALSE;
+    }
+
+    if(isset($_POST['PrinterSave'])){
+      if(count($this->dialog->check())!=0){
+        $tmp = $this->dialog->check();
+        foreach($tmp as $msg){
+          msg_dialog::display(_("Error"), $msg, ERROR_DIALOG);
+        } 
+      }else{
+        $this->dialog->save_object();
+        $tmp = $this->dialog->save();
+        $tmp2= $this->dialog->getPrinter(true);
+
+        foreach($tmp as $pname){
+          $printerObj = new printtabs($this->config,$this->config->data['TABS']['PRINTTABS'],$tmp2[$pname]['dn'],"printer");
+          $printerObj->set_acl_base($tmp2[$pname]['dn']);
+
+          $type = false;
+
+          if($this->is_group){
+            if($this->dn == "new"){  
+              $type = "AddGroup";
+            }elseif(isset($this->NewDeletedPrinters[$pname])){
+              $type = "AddGroup";
+            }elseif($printerObj->by_object['printgeneric']->AddMember("AddGroup",$this->dn)){
+              $type = "AddGroup";
+            }
+          }else{
+            if($this->multiple_support_active){
+              $type = "AddUser";
+            }elseif(isset($this->NewDeletedPrinters[$pname])){
+              $type = "AddUser";
+            }elseif($printerObj->by_object['printgeneric']->AddMember("AddUser",$this->dn)){
+              $type = "AddUser";
+            }
+          }
+
+          if($type){
+            $this->gotoPrinter[$pname]=$tmp2[$pname];
+            $this->gotoPrinter[$pname]['mode']="user";
+            $this->add_del_printer_member_was_called = true;
+
+            $this->NewAddedPrinters[$pname] = $pname;
+            if(isset($this->NewDeletedPrinters[$pname])){
+              unset($this->NewDeletedPrinters[$pname]);
+            }
+          }
+        }
+
+        $this->is_dialog=false;
+        unset($this->dialog);
+        $this->dialog   =FALSE;
+      }
+    }
+
+    if((isset($_POST['gotoPrinterDel']))&&(isset($_POST['gotoPrinterSel']))&&(!empty($_POST['gotoPrinterSel']))){
+      $printer = $_POST['gotoPrinterSel'];
+      foreach($printer as $pname){
+
+        $printerObj = new printtabs($this->config,$this->config->data['TABS']['PRINTTABS'],$this->gotoPrinter[$pname]['dn'],"printer");
+        $printerObj->set_acl_base($this->gotoPrinter[$pname]['dn']);
+
+        $type = false;
+        if($this->is_group){
+          if(isset($this->NewAddedPrinters[$pname])){
+            $type = "Group";
+          }elseif($printerObj->by_object['printgeneric']->DelMember("AddGroup",$this->cn)){
+            $type = "Group";
+          }
+        }else{
+          if(isset($this->NewAddedPrinters[$pname])){
+            $type = "User";
+          }elseif($printerObj->by_object['printgeneric']->DelMember("AddUser",$this->uid)){
+            $type = "User";
+          }
+        }
+        if($type){
+          $this->add_del_printer_member_was_called = true;
+          unset($this->gotoPrinter[$pname]);
+
+          $this->NewDeletedPrinters[$pname] = $pname;
+          if(isset($this->NewAddedPrinters[$pname])){
+            UNSET($this->NewAddedPrinters[$pname]);
+          }
+        }
+      }
+    }
+
+    if((isset($_POST['gotoPrinterEdit']))&&(isset($_POST['gotoPrinterSel']))&&(!empty($_POST['gotoPrinterSel']))){
+      $printers = $_POST['gotoPrinterSel'];
+      $this->add_del_printer_member_was_called = true;
+      foreach($printers as $printer){
+        if($this->gotoPrinter[$printer]['mode']=="user"){
+          $this->gotoPrinter[$printer]['mode']="admin";
+        }else{
+          $this->gotoPrinter[$printer]['mode']="user";
+        }
+      }
+    }
+
+    if((isset($_POST['gotoPrinterDefault']))&&(isset($_POST['gotoPrinterSel']))&&(!empty($_POST['gotoPrinterSel']))){
+      if($this->is_group){
+        msg_dialog::display(_("Error"), _("Cannot set default printer flag for groups!"), ERROR_DIALOG);
+      }else{
+        if ($this->gosaDefaultPrinter == $_POST['gotoPrinterSel'][0]){
+          $this->gosaDefaultPrinter= "";
+        } else {
+          $this->gosaDefaultPrinter= $_POST['gotoPrinterSel'][0];
+        }
+      }
+    }
+
+    $smarty->assign("gotoPrinter",$this->printOutPrinterDevices());
+    $smarty->assign("gotoPrinterKeys",array_flip($this->printOutPrinterDevices()));
+
+    /* General behavior */
+    if(is_object($this->dialog)){
+      $this->dialog->save_object();
+      $disp =$this->dialog->execute();
+      return($disp);
+    }
+
+    /* Assign used attributes for multiple edit */
+    foreach(array("gotoPrinter","kiosk_server","gotoProfileFlagL","gotoXResolution",
+                  "useProfile","gotoProfileServer","gotoProfileQuota","gotoProfileFlagC") as $box){
+      $ubox ="use_".$box;
+      if(in_array($box,$this->multi_boxes)){
+        $smarty->assign($ubox,TRUE);
+      }else{
+        $smarty->assign($ubox,FALSE);
+      }
+    }
+
+    /* Als smarty vars are set. Get smarty template and generate output */
+    $smarty->assign("multiple_support",$this->multiple_support_active);
+    $display.= $smarty->fetch(get_template_path('environment.tpl', TRUE,dirname(__FILE__)));
+    return($display);
+  }
+
+  function remove_from_parent()
+  {
+    /* only if it was an account*/
+    if (!$this->initially_was_account){
+      return;
+    }
+
+    /* include global link_info */
+    $ldap= $this->config->get_ldap_link();
+
+    /* Remove and write to LDAP */
+    plugin::remove_from_parent();
+
+    /* Don't save our template variables */
+    $skip = array("uid","gotoLogonScripts","gotoPrinter","gotoShares","gotoHotplugDevices" );
+
+    /* Skip all these attributes */
+    foreach($skip as $del){
+      unset($this->attrs[$del]);
+    }
+
+    @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__,$this->attributes, "Save");
+
+    $ldap->cd($this->dn);
+    $this->cleanup();
+    $ldap->modify ($this->attrs); 
+
+    if($this->is_group){
+      new log("remove","groups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }else{
+      new log("remove","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }
+
+    show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/environment account with dn '%s' failed."),$this->dn));
+
+    /* Optionally execute a command after we're done */
+    $this->handle_post_events("remove",array("uid" => $this->uid));
+  }
+
+
+  /* Save data to object */
+  function save_object()
+  {
+    /* Get all Posted vars 
+     * Setup checkboxes 
+     */
+    $WriteOnly = (!isset($this->parent)|| !$this->parent) && !session::is_set('edit');
+    if(isset($_POST['iamposted'])){
+
+      $PACL =  $this->getacl("gotoProfileServer",$WriteOnly).$this->getacl("gotoProfileQuota",$WriteOnly);
+
+      if(isset($_POST['kiosk_server'])){
+        $tmp = $_POST['kiosk_server'];
+        if(isset($this->gotoKioskProfiles['SERVERS'][$tmp])){
+          $this->gotoKioskProfile_Server = $_POST['kiosk_server'];
+        }
+      }
+      if(isset($_POST['kiosk_profile'])){
+        $tmp = $_POST['kiosk_profile'];
+        if(in_array($tmp,$this->gotoKioskProfiles['BY_SERVER'][$this->gotoKioskProfile_Server])){
+          $this->gotoKioskProfile_Profile = $_POST['kiosk_profile'];
+        }
+      }
+
+      if(preg_match("/w/",$PACL)){
+        if(isset($_POST['useProfile'])){
+          $this->useProfile = true;
+        }else{
+          $this->useProfile = false;
+        }
+      }
+
+      if($this->acl_is_writeable("gotoProfileFlagC")){
+        if(isset($_POST['gotoProfileFlagC'])){
+          $this->gotoProfileFlagC = $_POST['gotoProfileFlagC'];
+        }else{
+          $this->gotoProfileFlagC = false;
+        }
+      }
+
+      if($this->acl_is_writeable("gotoProfileFlagL")){
+        if(isset($_POST['gotoProfileFlagL'])){
+          $this->gotoProfileFlagL = $_POST['gotoProfileFlagL'];
+        }else{
+          $this->gotoProfileFlagL = false;
+        }
+      }
+
+      plugin::save_object();
+      foreach($this->attributes as $s_attr){
+        if((!isset($_POST[$s_attr])) || 
+            in_array($s_attr,array("gosaDefaultPrinter","gotoShares","gotoHotplugDevices","gotoPrinter","gotoLogonScripts","uid"))) continue;
+        if(!$this->acl_is_writeable($s_attr)){
+          continue;
+        }else{ 
+          if(isset($_POST[$s_attr])){
+            $this->$s_attr = $_POST[$s_attr];
+          }else{
+            $this->$s_attr = false;
+          }
+        }
+      }
+    }
+  }
+
+
+  /* Check supplied data */
+  function check()
+  {
+    /* Call common method to give check the hook */
+    $message= plugin::check();
+
+    $this->detect_grouptype();
+
+    if(preg_match("/[^0-9]/",$this->gotoProfileQuota)) {
+      $message[]=_("Please set a valid profile quota size.");
+    } 
+    if(!isset($this->attrs['objectClass'])){
+      $this->attrs['objectClass']=array();
+    } 
+    if(!$this->is_group){
+      if((!((in_array("posixAccount",$this->attrs['objectClass']))||($this->parent->by_object['posixAccount']->is_account==true)))&&(!$this->is_group)){
+        $message[]=(_("You need to setup a valid posix extension in order to enable evironment features."));  
+      }
+    }
+    return ($message);
+  }
+
+
+  /* Save to LDAP */
+  function save()
+  {
+    /* If group was renamed, all printer settings get lost
+     */ 
+    /* only save changed variables ....*/
+    if ($this->gotoKioskProfile_Server != "none"){
+      if(preg_match("/https/i",$_SERVER['HTTP_REFERER'])){
+        $method="https://".$this->gotoKioskProfile_Server."/kiosk/".$this->gotoKioskProfile_Profile;
+      }else{
+        $method="http://".$this->gotoKioskProfile_Server."/kiosk/".$this->gotoKioskProfile_Profile;
+      }
+      $this->gotoKioskProfile= $method;
+    }else{
+      $this->gotoKioskProfile= array();
+    }
+
+    plugin::save();
+    $ldap= $this->config->get_ldap_link();
+
+    $realyUsedAttrs= array();
+
+    /* Save already used objectClasses */
+    $ocs        = $this->attrs['objectClass'];
+    unset($ocs['count']);
+    $this->attrs = array();
+    $this->attrs['objectClass']= gosa_array_merge($ocs,$this->objectclasses);
+
+    /* 1. Search all printers that have our uid/cn as member 
+     * 2. Delete this uid/cn from every single entry and save it again.
+     * 2.1 There are different types of members: Users / Groups, this will be defined in $suffix
+     * 2.2 And each type has two modes, Admin (e.g. 'gotoUserAdminPrinter') and Normal 
+     */
+    
+    $this->detect_grouptype();
+
+    if($this->add_del_printer_member_was_called){
+
+      $types = array( "gotoUserPrinter"       => "AddUser",
+          "gotoGroupPrinter"      => "AddGroup",
+          "gotoUserAdminPrinter"  => "AddAdminUser",
+          "gotoGroupAdminPrinter" => "AddAdminGroup");
+
+      if($this->is_group){
+        $s_suffix = "Group";
+        $useVar   = "cn";
+      }else{
+        $useVar   = "uid";
+        $s_suffix = "User";
+      }
+
+      /* Remove old entries */
+      $ldap->search("(&(objectClass=gotoPrinter)(goto".$s_suffix."Printer=".$this->$useVar."))",array("*"));
+      while($attr = $ldap->fetch()){
+        $printerObj = NULL;
+        $printerObj = new printtabs($this->config,$this->config->data['TABS']['PRINTTABS'],$attr['dn'],"printer");
+        $printerObj->set_acl_base($attr['dn']);
+        $printerObj->by_object['printgeneric']->DelMember($types["goto".$s_suffix."Printer"],$this->$useVar);
+        $printerObj->by_object['printgeneric']->save();
+      }
+
+      $ldap->search("(&(objectClass=gotoPrinter)(goto".$s_suffix."AdminPrinter=".$this->$useVar."))",array("*"));
+      while($attr = $ldap->fetch()){
+        $printerObj = NULL;
+        $printerObj = new printtabs($this->config,$this->config->data['TABS']['PRINTTABS'],$attr['dn'],"printer");
+        $printerObj->set_acl_base($attr['dn']);
+        $printerObj->by_object['printgeneric']->DelMember($types["goto".$s_suffix."AdminPrinter"],$this->$useVar);
+        $printerObj->by_object['printgeneric']->save();
+      }
+
+      foreach($this->gotoPrinter as $printer){
+        $printerObj = NULL;
+        $printerObj = new printtabs($this->config,$this->config->data['TABS']['PRINTTABS'],$printer['dn'],"printer");
+        $printerObj->set_acl_base($printer['dn']);
+
+
+        if($printer['mode'] == "admin") {
+          $attribute = "goto".$s_suffix."AdminPrinter";
+        }else{
+          $attribute = "goto".$s_suffix."Printer";
+        }
+
+        $printerObj->by_object['printgeneric']->AddMember($types[$attribute],$this->dn);
+        $printerObj->by_object['printgeneric']->save();
+      }
+    }    
+
+    /* Prepare HotPlug devices */
+    $this->attrs['gotoHotplugDeviceDN'] = array();
+    foreach($this->gotoHotplugDevices as $name => $device){
+      $this->attrs['gotoHotplugDeviceDN'][]= $device['dn'];
+    }
+
+    /* Prepare LogonScripts */
+    $this->attrs['gotoLogonScript'] = array();
+    foreach($this->gotoLogonScripts as $name => $script){
+      $this->attrs['gotoLogonScript'][] =   $script['LogonName']."|".
+        $script['LogonOverload'].$script['LogonLast']."|".
+        $script['LogonPriority']."|".
+        base64_encode($script['LogonData'])."|".
+        $script['LogonDescription'];
+    }
+
+    /* Prepare Shares */
+    $this->attrs['gotoShare']=array();
+    foreach($this->gotoShares as $name => $share){
+      $mntp= $share['mountPoint'];
+      if (!preg_match('=^[a-z0-9+\._/%-]+$=i', $mntp)){
+        $mntp= base64_encode($mntp);
+      }
+      $this->attrs['gotoShare'][] =$share['server']."|".$share['name']."|".$mntp."|".$share['PwdHash']."|".$share['Username'];
+    }
+
+
+    if($this->gotoXResolution == "auto") $this->gotoXResolution ="";
+    $saveThis = array("gotoProfileQuota","gotoXResolution","gotoProfileServer","gotoKioskProfile","gosaDefaultPrinter");
+
+    foreach($saveThis as $tosave){
+      if(!empty($this->$tosave)){
+        $this->attrs[$tosave]=$this->$tosave;
+      }else{
+        $this->attrs[$tosave]=array();
+      }
+    }
+
+    /* Prepare Flags */
+    $this->attrs['gotoProfileFlags'] = array($this->gotoProfileFlagC.$this->gotoProfileFlagL);
+    if(empty($this->attrs['gotoProfileFlags'][0])){
+      $this->attrs['gotoProfileFlags']=array();
+    }
+
+    if($this->useProfile == false){
+      $this->attrs['gotoProfileFlags'] = preg_replace("/C/i","",$this->attrs['gotoProfileFlags']);
+      $this->attrs['gotoProfileServer']= array(); 
+    }
+
+    $ldap->cat ($this->dn, array('dn'));
+    if ($ldap->fetch()){
+      $mode= "modify";
+    } else {
+      $mode= "add";
+      $ldap->cd($this->config->current['BASE']);
+      $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
+    }
+
+    $ldap->cd($this->dn);
+    $this->cleanup();
+    $ldap->$mode($this->attrs);
+  
+    $cat = "users";
+    if($this->is_group){
+      $cat = "groups";
+    }
+
+    /* Log last action */ 
+    if($this->initially_was_account){
+      new log("modify",$cat."/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }else{
+      new log("create",$cat."/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }
+
+    show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/environment account with dn '%s' failed."),$this->dn));
+    $this->handle_post_events($mode,array("uid"=>$this->uid));
+  }
+
+  /* Generate ListBox frindly output for the defined shares 
+   * Possibly Add or remove an attribute here, 
+   */
+  function printOutAssignedShares()
+  {
+    $a_return = array();
+    if(is_array($this->gotoShares)){
+      foreach($this->gotoShares as $share){
+        if(preg_match("/^!/",$share['server'])){
+          $a_return[$share['name']."|".$share['server']]= preg_replace("/^!/","",$share['server'])."://".$share['name']." - "._("group share"); 
+        }else{
+          $a_return[$share['name']."|".$share['server']]= $share['server']."://".$share['name']." on ".$share['mountPoint']." as ".$share['Username'];
+        }
+      }
+      natcasesort($a_return);
+    }
+    return($a_return);
+  }
+
+  /* Generate ListBox frindly output for the definedhotplugs 
+   * Possibly Add or remove an attribute here,
+   */
+  function printOutHotPlugDevices()
+  {
+    $a_return= array();
+    if(is_array($this->gotoHotplugDevices)){
+      foreach($this->gotoHotplugDevices as $key=>$device){
+        $a_return[$key] = $device['name']." - ".$device['id'];
+      }
+    }
+    return($a_return);
+  }
+
+  /* Generates ListBox frienly output of used printer devices 
+   * Append ' - admin' if printer is used in admin mode
+   */
+  function printOutPrinterDevices()
+  {
+    $a_return = array();
+    
+    if($this->acl_is_readable("gotoPrinter")){
+
+      if(is_array($this->gotoPrinter)){
+        foreach($this->gotoPrinter as $printer){
+          if($printer['mode'] == "admin"){
+            $a_return[$printer['cn'][0]]= $printer['cn'][0]." - "._("Administrator");
+          }else{
+            $a_return[$printer['cn'][0]]= $printer['cn'][0]; 
+          }
+          if ($printer['cn'][0] == $this->gosaDefaultPrinter){
+            $a_return[$printer['cn'][0]].=" - "._("Default printer");
+          }
+        }
+      }
+    }
+    return($a_return);
+  }
+
+
+  function PrepareForCopyPaste($source)
+  {
+    plugin::PrepareForCopyPaste($source);
+
+    $class= get_class($this);
+    $o_source = new $class($this->config,$source['dn']);
+    foreach($this->CopyPasteVars as $attr){
+      $this->$attr = $o_source->$attr;  
+    }
+  }
+
+
+  function saveCopyDialog()
+  {
+    if(isset($_POST['cn'])){
+      $this->cn = $_POST['cn'];
+      $this->uid = $_POST['cn'];
+    }
+  }
+
+
+  /* Generates ListBox frienly output of used logonscripts 
+   */
+  function printOutLogonScripts()
+  {
+    $a_return = array();
+    if(is_array($this->gotoLogonScripts)){
+      foreach($this->gotoLogonScripts as $script){
+        $a_return[$script['LogonName']]= $script['LogonPriority']." - ".$script['LogonName']; 
+      }
+    }
+    return($a_return);
+  }
+
+
+  function multiple_execute()
+  {
+    /* Reset header toggle */
+    $this->is_account = TRUE;
+    return($this->execute());
+  }
+
+
+    /* Initialize plugin with given atribute arrays
+   */
+  function init_multiple_support($attrs,$all)
+  {
+    plugin::init_multiple_support($attrs,$all);
+
+    /* Prepare Shares */
+    if((isset($this->multi_attrs_all['gotoShare']))&&(is_array($this->multi_attrs_all['gotoShare']))){
+      unset($this->multi_attrs_all['gotoShare']['count']);
+      foreach($this->multi_attrs_all['gotoShare'] as $share){
+        $tmp = $tmp2 = array();
+        $tmp = split("\|",$share);
+        $tmp2['server']      =$tmp[0];
+        $tmp2['name']        =$tmp[1];
+
+        /* Decode base64 if needed */
+        if (!preg_match('%/%', $tmp[2])){
+          $tmp2['mountPoint']  =base64_decode($tmp[2]);
+        } else {
+          $tmp2['mountPoint']  =$tmp[2];
+        }
+
+        if(isset($tmp[3])){
+          $tmp2['PwdHash']  =$tmp[3];
+        }else{
+          $tmp2['PwdHash']  ="";
+        }
+        if(isset($tmp[4])){
+          $tmp2['Username']  =$tmp[4];
+        }else{
+          $tmp2['Username']  ="";
+        }
+        $tmp2['UsedByAllUsers'] = FALSE;
+        $this->gotoShares[$tmp[1]."|".$tmp[0]]=$tmp2;
+      }
+    }
+
+    /* Prepare Shares */
+    if((isset($this->multi_attrs['gotoShare']))&&(is_array($this->multi_attrs['gotoShare']))){
+      unset($this->multi_attrs['gotoShare']['count']);
+      foreach($this->multi_attrs['gotoShare'] as $share){
+        $tmp = $tmp2 = array();
+        $tmp = split("\|",$share);
+        $tmp2['server']      =$tmp[0];
+        $tmp2['name']        =$tmp[1];
+
+        /* Decode base64 if needed */
+        if (!preg_match('%/%', $tmp[2])){
+          $tmp2['mountPoint']  =base64_decode($tmp[2]);
+        } else {
+          $tmp2['mountPoint']  =$tmp[2];
+        }
+
+        if(isset($tmp[3])){
+          $tmp2['PwdHash']  =$tmp[3];
+        }else{
+          $tmp2['PwdHash']  ="";
+        }
+        if(isset($tmp[4])){
+          $tmp2['Username']  =$tmp[4];
+        }else{
+          $tmp2['Username']  ="";
+        }
+        $tmp2['UsedByAllUsers'] = TRUE;
+        $this->gotoShares[$tmp[1]."|".$tmp[0]]=$tmp2;
+      }
+    }
+
+
+    /* prepare LogonScripts */
+    if((isset($this->multi_attrs_all['gotoLogonScript']))&&(is_array($this->multi_attrs_all['gotoLogonScript']))){
+      unset($this->multi_attrs_all['gotoLogonScript']['count']);
+      foreach($this->multi_attrs_all['gotoLogonScript'] as $device){
+        $tmp = $tmp2 = array();
+        $tmp = split("\|",$device);
+        $tmp2['LogonName']        = $tmp[0];
+        $tmp2['LogonPriority']    = $tmp[2];
+        if(preg_match("/O/i",$tmp[1])){
+          $tmp2['LogonOverload'] = "O";
+        }else{
+          $tmp2['LogonOverload'] = "";
+        }
+        if(preg_match("/L/i",$tmp[1])){
+          $tmp2['LogonLast'] = "L";
+        }else{
+          $tmp2['LogonLast'] = "";
+        }
+        $tmp2['LogonData']        = base64_decode($tmp[3]);
+        $tmp2['LogonDescription'] = $tmp[4];
+        $tmp2['UsedByAllUsers'] = FALSE;
+        $this->gotoLogonScripts[$tmp[0]]=$tmp2;
+      }
+    }
+
+    /* prepare LogonScripts */
+    if((isset($this->multi_attrs['gotoLogonScript']))&&(is_array($this->multi_attrs['gotoLogonScript']))){
+      unset($this->multi_attrs['gotoLogonScript']['count']);
+      foreach($this->multi_attrs['gotoLogonScript'] as $device){
+        $tmp = $tmp2 = array();
+        $tmp = split("\|",$device);
+        $tmp2['LogonName']        = $tmp[0];
+        $tmp2['LogonPriority']    = $tmp[2];
+        if(preg_match("/O/i",$tmp[1])){
+          $tmp2['LogonOverload'] = "O";
+        }else{
+          $tmp2['LogonOverload'] = "";
+        }
+        if(preg_match("/L/i",$tmp[1])){
+          $tmp2['LogonLast'] = "L";
+        }else{
+          $tmp2['LogonLast'] = "";
+        }
+        $tmp2['LogonData']        = base64_decode($tmp[3]);
+        $tmp2['LogonDescription'] = $tmp[4];
+        $tmp2['UsedByAllUsers'] = TRUE;
+        $this->gotoLogonScripts[$tmp[0]]=$tmp2;
+      }
+    }
+
+    /* Prepare hotplugs */
+    if(isset($this->multi_attrs_all['gotoHotplugDeviceDN']) && is_array($this->multi_attrs_all['gotoHotplugDeviceDN'])){
+      $ldap = $this->config->get_ldap_link();
+      $ldap->cd($this->config->current['BASE']);
+      for($i = 0 ; $i < $this->multi_attrs_all['gotoHotplugDeviceDN']['count'] ; $i ++){
+        $ldap->cat($this->multi_attrs_all['gotoHotplugDeviceDN'][$i]);
+        if($ldap->count()){
+          $multi_attrs_all = $ldap->fetch();
+
+          if(isset($multi_attrs_all['gotoHotplugDevice'][0])){
+            $tmp      = preg_split("/\|/",$multi_attrs_all['gotoHotplugDevice'][0]);
+            $tmp2     = array();
+            $tmp2['name']         = $multi_attrs_all['cn'][0];
+            $tmp2['description']  = $tmp[0];
+            $tmp2['id']           = $tmp[1];
+            $tmp2['produkt']      = $tmp[2];
+            $tmp2['vendor']       = $tmp[3];
+            $tmp2['dn']           = $multi_attrs_all['dn'];
+            $tmp2['UsedByAllUsers'] = FALSE;
+            $this->gotoHotplugDevices[$tmp2['dn']] = $tmp2;
+          }
+        }
+      }
+    }
+
+    /* Prepare hotplugs */
+    if(isset($this->multi_attrs['gotoHotplugDeviceDN']) && is_array($this->multi_attrs['gotoHotplugDeviceDN'])){
+      $ldap = $this->config->get_ldap_link();
+      $ldap->cd($this->config->current['BASE']);
+      for($i = 0 ; $i < $this->multi_attrs['gotoHotplugDeviceDN']['count'] ; $i ++){
+        $ldap->cat($this->multi_attrs['gotoHotplugDeviceDN'][$i]);
+        if($ldap->count()){
+          $multi_attrs = $ldap->fetch();
+
+          if(isset($multi_attrs['gotoHotplugDevice'][0])){
+            $tmp      = preg_split("/\|/",$multi_attrs['gotoHotplugDevice'][0]);
+            $tmp2     = array();
+            $tmp2['name']         = $multi_attrs['cn'][0];
+            $tmp2['description']  = $tmp[0];
+            $tmp2['id']           = $tmp[1];
+            $tmp2['produkt']      = $tmp[2];
+            $tmp2['vendor']       = $tmp[3];
+            $tmp2['dn']           = $multi_attrs['dn'];
+            $tmp2['UsedByAllUsers'] = TRUE;
+            $this->gotoHotplugDevices[$tmp2['dn']] = $tmp2;
+          }
+        }
+      }
+    }
+    $this->gotoHotplugDevices = array_values($this->gotoHotplugDevices);
+    for($i = 0 ; $i < strlen($this->gotoProfileFlags) ; $i ++){
+      $chr = $this->gotoProfileFlags[$i];
+      $name = "gotoProfileFlag".$chr;
+      $this->$name=$chr;
+    }
+    $this->update_kiosk_profiles();
+    $this->gotoKioskProfile= preg_replace("/^.*\//i","",$this->gotoKioskProfile);
+
+    if((!empty($this->gotoProfileServer))||($this->gotoProfileFlagC=="C")){
+      $this->useProfile = true;
+    }else{
+      $this->useProfile = false;
+    }
+
+  }
+
+
+  function set_multi_edit_values($attrs)
+  {
+    $shares = $this->gotoShares;
+    $scripts= $this->gotoLogonScripts;
+    $plugs= $this->gotoHotplugDevices;
+    plugin::set_multi_edit_values($attrs);
+
+    $this->gotoShares = $shares;
+    $this->gotoLogonScripts = $scripts;
+    $this->gotoHotplugDevices = $plugs;
+
+    foreach($attrs['gotoShares'] as $name => $share){
+      if($share['UsedByAllUsers'] == TRUE){
+        $this->gotoShares[$name] = $share;
+      }
+    }
+    foreach($this->gotoShares as $name => $share){
+      if(!isset($attrs['gotoShares'][$name])){
+        unset($this->gotoShares[$name]);
+      }
+    }
+    foreach($attrs['gotoLogonScripts'] as $name => $script){
+      if($script['UsedByAllUsers'] == TRUE){
+        $this->gotoLogonScripts[$name] = $script;
+      }
+    }
+    foreach($this->gotoLogonScripts as $name => $script){
+      if(!isset($attrs['gotoLogonScripts'][$name])){
+        unset($this->gotoLogonScripts[$name]);
+      }
+    }
+    $tmp = array();
+    foreach($this->gotoHotplugDevices as $entry){
+      $tmp[$entry['dn']] = $entry;
+    }
+  
+    foreach($attrs['gotoHotplugDevices'] as $name => $plug){
+      if($plug['UsedByAllUsers'] == TRUE){
+        $tmp[$plug['dn']] = $plug;
+      }
+    }
+    foreach($tmp as $name => $plug){
+      $found = false;
+      foreach($attrs['gotoHotplugDevices'] as $test){
+        if($test['dn'] == $name){
+          $found = true;
+        }
+      }
+      if(!$found){
+        unset($tmp[$name]);
+      }
+    }
+  }
+
+
+    /* Return selected values for multiple edit */
+  function get_multi_edit_values()
+  {
+    $ret = plugin::get_multi_edit_values();
+    $ret['gotoShares'] = $this->gotoShares;
+    $ret['gotoLogonScripts'] = $this->gotoLogonScripts;
+    $ret['gotoHotplugDevices'] = $this->gotoHotplugDevices;
+  
+    if(in_array("gotoPrinter",$this->multi_boxes)){
+      $ret['gotoPrinter'] = $this->gotoPrinter;
+      $ret['gotoPrinterSel'] = $this->gotoPrinterSel;
+      $ret['gosaDefaultPrinter'] = $this->gosaDefaultPrinter;
+  
+      /* Force printer reset */
+      $ret['add_del_printer_member_was_called'] = TRUE;
+    }
+  
+    if(in_array("gotoProfileFlagL",$this->multi_boxes)){
+      $ret['gotoProfileFlagL'] = $this->gotoProfileFlagL;
+    }
+
+    if(in_array("useProfile",$this->multi_boxes)){
+      $ret['useProfile']=$this->useProfile;
+      if(in_array("gotoProfileServer",$this->multi_boxes)){
+        $ret['gotoProfileServer']=$this->gotoProfileServer;
+      }
+      if(in_array("gotoProfileQuota",$this->multi_boxes)){
+        $ret['gotoProfileQuota']=$this->gotoProfileQuota;
+      }
+      if(in_array("gotoProfileFlagC",$this->multi_boxes)){
+        $ret['gotoProfileFlagC'] = $this->gotoProfileFlagC;
+      }
+    }
+    if(in_array("gotoXResolution",$this->multi_boxes)){
+      $ret['gotoXResolution'] = $this->gotoXResolution;
+    }
+    if(in_array("kiosk_server",$this->multi_boxes)){
+      $ret['gotoKioskProfile_Server'] = $this->gotoKioskProfile_Server;
+      $ret['gotoKioskProfile_Profile'] = $this->gotoKioskProfile_Profile;
+    }
+    return($ret);
+  }
+
+
+  function multiple_check() 
+  {
+    $message = plugin::multiple_check();
+    $this->detect_grouptype();
+
+    if(preg_match("/[^0-9]/",$this->gotoProfileQuota) && in_array("gotoProfileQuota",$this->multi_boxes)) {
+      $message[]=_("Please set a valid profile quota size.");
+    }
+    return($message);
+  }
+
+
+  function multiple_save_object()
+  {
+    if(isset($_POST['environment_multiple_posted'])){
+      plugin::multiple_save_object();
+      
+      if(isset($_POST['useProfile'])){
+        $this->useProfile = true;
+      }else{
+        $this->useProfile = false;
+      }
+      if(isset($_POST['gotoProfileFlagC'])){
+        $this->gotoProfileFlagC = $_POST['gotoProfileFlagC'];
+      }else{
+        $this->gotoProfileFlagC = false;
+      }
+
+      if(isset($_POST['gotoProfileFlagL'])){
+        $this->gotoProfileFlagL = $_POST['gotoProfileFlagL'];
+      }else{
+        $this->gotoProfileFlagL = false;
+      }
+
+      foreach(array("gotoProfileFlagL","gotoPrinter","kiosk_server","gotoXResolution",
+                    "useProfile","gotoProfileServer","gotoProfileQuota","gotoProfileFlagC") as $attr){
+        $uattr = "use_".$attr;
+        if(isset($_POST[$uattr])){
+          $this->multi_boxes[] = $attr;
+        }
+      }
+      if(isset($_POST['kiosk_server'])){
+        $tmp = $_POST['kiosk_server'];
+        if(isset($this->gotoKioskProfiles['SERVERS'][$tmp])){
+          $this->gotoKioskProfile_Server = $_POST['kiosk_server'];
+        }
+      }
+      if(isset($_POST['kiosk_profile'])){
+        $tmp = $_POST['kiosk_profile'];
+        if(in_array($tmp,$this->gotoKioskProfiles['BY_SERVER'][$this->gotoKioskProfile_Server])){
+          $this->gotoKioskProfile_Profile = $_POST['kiosk_profile'];
+        }
+      }
+
+    }
+  }
+
+  /* Return plugin informations for acl handling 
+#FIXME these ACLs should work for groups too */ 
+  static function plInfo()
+  {
+    return (array("plShortName"     => _("Environment"),
+          "plDescription"   => _("Environment settings"),         // Description
+          "plSelfModify"    => TRUE,                              
+          "plDepends"       => array("user", "posixAccount"),     // This plugin depends on 
+          "plPriority"      => 3,                                 // Position in tabs 
+          "plSection"     => array("personal" => _("My account")),
+          "plCategory"    => array("users",
+                                   "groups"),
+          "plOptions"       => array("resolution_hook" => array("type" => "string",
+              "description" => _("Command to extend the list of possible screen resolutions"))),
+
+          "plProvidedAcls"  => array(
+
+            "gotoProfileFlagL"    => _("Resolution changeable during session") ,
+            "gotoProfileFlagC"    => _("Cache profile localy") ,
+
+            "gotoProfileQuota"    => _("Profile quota") ,
+            "gotoProfileServer"   => _("Profile server") ,
+
+            "gotoXResolution"     => _("Resolution") ,
+            "gotoKioskProfile"    => _("Kiosk profile") ,
+
+            "gosaDefaultPrinter"  => _("Default printer") ,
+            "gotoLogonScript"     => _("Logon script") ,
+            "gotoHotplugDevice"   => _("Hotplug devices"),
+            "gotoShare"           => _("Shares"))
+            ));
+  }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-plugins/goto/personal/environment/class_hotplugDialog.inc b/gosa-plugins/goto/personal/environment/class_hotplugDialog.inc
new file mode 100644 (file)
index 0000000..b3a20f8
--- /dev/null
@@ -0,0 +1,112 @@
+<?php
+
+class hotplugDialog extends plugin
+{
+  /* CLI vars */
+  var $cli_summary          = "Manage server basic objects";
+  var $cli_description      = "Some longer text\nfor help";
+  var $cli_parameters       = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+  /* attribute list for save action */
+  var $hotplugDevices           = ""; 
+  var $hotplugDeviceList        = array(); 
+  var $regex                    = "*";
+  var $depselect                = "/";
+  var $deplist                  = "/";
+  var $skipThese                = array();
+
+  function hotplugDialog (&$config,$skipThese = array())
+  {
+    $this->skipThese  = $skipThese;
+    $this->config     = $config;
+    $this->depselect   = session::get('CurrentMainBase');
+  }
+
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+    /* Fill templating stuff */
+    $smarty= get_smarty();
+    $display= "";
+
+    if(isset($_POST['dialogissubmitted'])){
+      $this->regex=$_POST['regexHot'];
+      $this->depselect = $_POST['depselectHot'];
+    }
+
+    if((isset($_GET['search']))&&(!empty($_GET['search']))){
+      $this->regex=$_GET['search']."*";
+      $this->regex=preg_replace("/\*\*/","*",$this->regex);
+    }
+
+    $this->deplist=$this->config->idepartments;
+
+    $this->hotplugDevices = $this->getHotplugs();
+    $smarty->assign("regexHot"    ,$this->regex);
+    $smarty->assign("deplistHot"  ,$this->deplist);
+    $smarty->assign("depselectHot",$this->depselect);
+    $smarty->assign("apply", apply_filter());
+    $smarty->assign("alphabet", generate_alphabet());
+    $smarty->assign("search_image", get_template_path('images/search.png'));
+    $smarty->assign("tree_image", get_template_path('images/tree.png'));
+    $smarty->assign("launchimage", get_template_path('images/small_filter.png'));
+    $smarty->assign("deplist", $this->config->idepartments);
+
+
+    $smarty->assign("hotplugDevices",$this->hotplugDevices);
+    $smarty->assign("hotplugDeviceKeys",array_flip($this->hotplugDevices));
+    $display.= $smarty->fetch(get_template_path('hotplugDialog.tpl', TRUE,dirname(__FILE__)));
+    return($display);
+  }
+
+
+  /* Save to LDAP */
+  function save()
+  {
+    $entries = array();
+    foreach($_POST['hotplugName'] as $name){
+      $entries[$name] = $this->hotplugDeviceList[$name];
+    }
+    return $entries;
+  }
+
+  function getHotplugs()
+  {
+    $ldap= $this->config->get_ldap_link();
+    $ldap->cd(get_ou('deviceou').$this->depselect);
+    $ldap->search("(&(objectClass=gotoDevice)(|(cn=".$this->regex.")(description=".$this->regex.")))",array("gotoHotplugDevice","cn","dn")); 
+
+    $a_return = array();  
+    $this->hotplugDeviceList = array();
+    while($attr = $ldap->fetch()){
+
+      if(isset($attr['gotoHotplugDevice'][0])){
+
+        $hot_plug = $attr['gotoHotplugDevice'][0];
+        $tmp      = preg_split("/\|/",$hot_plug);
+        $tmp2     = array();
+          
+        if(in_array($attr['cn'][0],$this->skipThese)){
+          continue;
+        }
+
+        $tmp2['name']         = $attr['cn'][0];
+        $tmp2['description']  = $tmp[0];
+        $tmp2['id']           = $tmp[1];
+        $tmp2['produkt']      = $tmp[2];
+        $tmp2['vendor']       = $tmp[3];
+        $tmp2['dn']           = $attr['dn'];
+
+        $a_return[$attr['cn'][0]]= $attr['cn'][0]." [".$tmp[0]."] ".$tmp[1];
+
+        $this->hotplugDeviceList[$attr['cn'][0]]=$tmp2;
+      }
+    }
+    return($a_return);
+  }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-plugins/goto/personal/environment/class_logonManagementDialog.inc b/gosa-plugins/goto/personal/environment/class_logonManagementDialog.inc
new file mode 100644 (file)
index 0000000..f125ad0
--- /dev/null
@@ -0,0 +1,139 @@
+<?php
+class logonManagementDialog extends plugin
+{
+  /* CLI vars */
+  var $cli_summary          = "Manage server basic objects";
+  var $cli_description      = "Some longer text\nfor help";
+  var $cli_parameters       = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+  /* attribute list for save action */
+  var $ignore_account       = TRUE;
+  var $attributes           = array("LogonName","LogonPriority","LogonLast","LogonOverload","LogonData","LogonDescription");
+  var $objectclasses        = array("whatever");
+  var $use_existing         = false;  
+
+  var $LogonName        ="";  // Name for the LogonScript
+  var $LogonPriority    ="";  // Priority defines the order in which the scripts will be processed 
+  var $LogonLast        ="";  // Is this script marked as the last, all following scripts will be skipped
+  var $LogonOverload    ="";  // If Overload is activated this script is overlaodable by a group script with same prio
+  var $LogonData        ="";  // The script itself
+  var $LogonDescription ="";
+    
+  var $nameIsEditable = true;
+
+  var $real_LogonName = "";
+
+  function logonManagementDialog (&$config, $dn= NULL,$data=false)
+  {
+    plugin::plugin ($config, $dn);
+    
+    if($data){
+      $this->LogonName        = $data['LogonName'];
+      $this->LogonPriority    = $data['LogonPriority'];
+      $this->LogonOverload    = $data['LogonOverload'];
+      $this->LogonLast        = $data['LogonLast'];
+      $this->LogonData        = $data['LogonData'];
+      $this->LogonDescription = $data['LogonDescription'];
+      $this->nameIsEditable   = false;
+      $this->real_LogonName   = $data['LogonName'];
+    }
+  }
+
+  function execute()
+  {
+       /* Call parent execute */
+       plugin::execute();
+
+    $smarty= get_smarty();
+    $display= "";
+
+    if((isset($_POST['StartImport']))&&(isset($_FILES['importFile']))){
+      $this->LogonData = file_get_contents($_FILES['importFile']['tmp_name']);
+      @unlink($_FILES['importFile']['tmp_name']);
+    }
+
+    foreach($this->attributes as $attr){
+      $smarty->assign($attr,$this->$attr);
+      if($this->$attr){
+        $smarty->assign($attr."CHK"," checked ");
+      }else{
+        $smarty->assign($attr."CHK","");
+      }
+    }
+    $prios=array(1,2,3,4,5,6,7,8,9,10);
+    $smarty->assign("LogonPrioritys",$prios);
+    $smarty->assign("LogonPriorityKeys",$prios);
+
+    if(!$this->nameIsEditable){
+      $smarty->assign("LogonNameACL"," disabled ");
+    }else{
+      $smarty->assign("LogonNameACL","");
+    }
+  
+
+    $display.= $smarty->fetch(get_template_path('logonManagement.tpl', TRUE,dirname(__FILE__)));
+    return($display);
+  }
+
+  function save_object()
+  {
+    if(isset($_POST['dialogissubmitted'])){
+      foreach($this->attributes as $attr){
+
+        if(!$this->nameIsEditable && $attr == 'LogonName'){
+          continue;
+        }
+        if(isset($_POST[$attr])){
+          $this->$attr = stripslashes($_POST[$attr]); 
+        }
+      }
+
+      foreach(array("LogonLast","LogonOverload") as $checkBoxes){
+        if(isset($_POST[$checkBoxes])){
+          $this->$checkBoxes = stripslashes($_POST[$checkBoxes]);
+        }else{
+          $this->$checkBoxes = "";
+        }
+
+      }
+    }
+  }
+
+  function check()
+  {
+    /* Call common method to give check the hook */
+    $message= plugin::check();
+  
+    if(preg_match("/[^a-zA-Z]/",$this->LogonName)){
+      $message[] = _("Specified name should only consist of upper-/lowercase characters.");
+    }
+
+    if(empty($this->LogonName)){
+      $message[] = _("Please specify a valid script name.");
+    }
+
+    if(preg_match("/[^a-z0-9,\.-;:_\(\)!\? ]/i",$this->LogonDescription)){
+      $message[] = _("Specified description contains invalid characters.");
+    }
+
+    return $message;
+  }
+
+
+  function save()
+  {
+    $a_return= array();
+    foreach($this->attributes as $attr){
+      $a_return[$attr]=$this->$attr;
+    }  
+
+    if(!$this->nameIsEditable){
+      $a_return['LogonName']=$this->real_LogonName;
+    }
+
+    return($a_return); 
+  }
+
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-plugins/goto/personal/environment/class_selectPrinterDialog.inc b/gosa-plugins/goto/personal/environment/class_selectPrinterDialog.inc
new file mode 100644 (file)
index 0000000..b1ebc49
--- /dev/null
@@ -0,0 +1,170 @@
+<?php
+
+class selectPrinterDialog extends plugin
+{
+  /* CLI vars */
+  var $cli_summary          = "Manage server basic objects";
+  var $cli_description      = "Some longer text\nfor help";
+  var $cli_parameters       = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+  /* attribute list for save action */
+  var $ignore_account       = TRUE;
+  var $attributes           = array();
+  var $objectclasses        = array("whatever");
+  var $AlreadyAssigned      = array();  
+  var $regex                = "*";
+  var $depselect            = "/";
+  var $deplist              = array("/");
+  var $module               = array("printer");
+  var $ui                   = NULL;
+  var $subtreesearch        = FALSE;
+
+  function selectPrinterDialog (&$config, $dn= NULL,$alreadyused=array() )
+  {
+    $this->AlreadyAssigned = $alreadyused;
+    plugin::plugin ($config, $dn);
+
+    /* Get all departments within this subtree */
+    $base = $this->config->current['BASE'];
+
+    /* Add base */
+    $tmp = array();
+    $tmp[] = array("dn"=>$this->config->current['BASE']);
+    $tmp=  array_merge($tmp,get_list("(&(|(ou=*)(description=*))(objectClass=gosaDepartment))", $this->module, $base,
+                    array("ou", "description"), GL_SIZELIMIT | GL_SUBSEARCH));
+
+    $deps = array();
+    foreach($tmp as $tm){
+      $deps[$tm['dn']] = $tm['dn'];
+    }
+
+
+    /* Load possible departments */
+    $ui= get_userinfo();
+    $this->ui = $ui;
+    $tdeps= $ui->get_module_departments("users");
+    $ids = $this->config->idepartments;
+    $first = "";
+    $found = FALSE;
+    $res = array();
+    foreach($ids as $dep => $name){
+      if(isset($deps[$dep]) && in_array_ics($dep, $tdeps)){
+        $res[$dep] = $ids[$dep]; //$tdeps[$dep];
+      }
+    }
+    $this->deplist = $res;
+    $this->depselect = key($res);
+  }
+
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+    /* Fill templating stuff */
+    $smarty= get_smarty();
+    $display= "";
+
+    if(isset($_POST['dialogissubmitted'])){
+      foreach(array('regexPrinter' => 'regex','depselectPrinter'=>'depselect') as $attr => $name){
+        if(isset($_POST[$attr])){
+          $this->$name      =$_POST[$attr];
+        }
+      }
+    }
+
+    if(isset($_POST['subtrees'])){
+      $this->subtreesearch= TRUE;
+    } else {
+      $this->subtreesearch= FALSE;
+    }
+
+    if((isset($_GET['search']))&&(!empty($_GET['search']))){
+      $this->regex=$_GET['search']."*";
+      $this->regex=preg_replace("/\*\*/","*",$this->regex);
+    }
+
+    $smarty->assign("regexPrinter"    ,$this->regex);
+    $smarty->assign("deplistPrinter"  ,$this->deplist);
+    $smarty->assign("depselectPrinter",$this->depselect);
+    $smarty->assign("gotoPrinters",$this->getPrinter());
+    $smarty->assign("gotoPrinterKeys",array_flip($this->getPrinter()));
+    $smarty->assign("apply", apply_filter());
+    $smarty->assign("alphabet", generate_alphabet());
+    $smarty->assign("subtrees", $this->subtreesearch?"checked":"");
+    $smarty->assign("search_image", get_template_path('images/search.png'));
+    $smarty->assign("tree_image", get_template_path('images/tree.png'));
+    $smarty->assign("infoimage", get_template_path('images/info.png'));
+    $smarty->assign("launchimage", get_template_path('images/small_filter.png'));
+    $smarty->assign("deplist", $this->config->idepartments);
+
+    $display.= $smarty->fetch(get_template_path('selectPrinterDialog.tpl', TRUE,dirname(__FILE__)));
+    return($display);
+  }
+
+  function check(){
+    /* Call common method to give check the hook */
+    $message= plugin::check();
+
+    if(empty($_POST['gotoPrinter'])){
+      $message[] = _("Please select a printer or press cancel.");
+    }
+    return $message;
+  }
+
+  /* Save to LDAP */
+  function save()
+  {
+    return($_POST['gotoPrinter']);
+  }
+
+  /* This function generates the Printerlist
+   * All printers are returned that match regex and and depselect
+   */
+  function getPrinter($detailed = false)
+  {
+    $a_return=array();
+
+
+    $filter = "(&(objectClass=gotoPrinter)(cn=".$this->regex."))";
+    $module = $this->module;
+    $base   = $this->depselect;
+    $attrs  = array("cn","description");
+
+    if ($this->subtreesearch){
+      $res    = get_list($filter,$module,$base,$attrs, GL_SIZELIMIT | GL_SUBSEARCH);
+    } else {
+      $base= get_ou('printerou').$base;
+      $res    = get_list($filter,$module,$base,$attrs, GL_SIZELIMIT);
+    }
+
+    foreach($res as $printer)  {
+
+      $acl = $this->ui->get_permissions($printer['dn'],"printer/printgeneric","gotoUserPrinter");
+
+      if(!preg_match("/w/",$acl)){
+        continue;
+      }
+
+      if(isset($this->AlreadyAssigned[$printer['cn'][0]])) continue;
+
+      if($detailed ==true){
+        $a_return[$printer['cn'][0]] = $printer;
+      }else{
+        if(isset($printer['description'][0])){
+          $a_return[$printer['cn'][0]] = $printer['cn'][0]." - ".$printer['description'][0];  
+        }else{
+          $a_return[$printer['cn'][0]] = $printer['cn'][0];  
+        }
+      }
+    }
+    return($a_return);
+  }
+}
+
+
+
+
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-plugins/goto/personal/environment/environment.tpl b/gosa-plugins/goto/personal/environment/environment.tpl
new file mode 100644 (file)
index 0000000..d1370f6
--- /dev/null
@@ -0,0 +1,405 @@
+{if $is_account ne 'true'}
+ <img alt="" class="center" src="images/stop.png" align="middle">
+ {t}The environment extension is currently disabled.{/t}
+{else}
+
+
+<input type="hidden" name="iamposted" value="1">
+
+<h2> 
+ <img class="center" alt="" src="images/fai_profile.png" align="middle" /> 
+ {t}Profiles{/t}
+</h2>
+
+<table summary="{t}Environment managment settings{/t}" width="100%">
+ <tr>
+  <td style="width:50%;border-right:1px solid #B0B0B0;vertical-align:top;">
+
+
+{if $multiple_support}
+
+       {render acl=$gotoProfileACL checkbox=$multiple_support checked=$use_useProfile}
+               <input class="center" type="checkbox" value="1" {if $useProfile} checked {/if} name="useProfile" id="useProfile">{t}Use profile managment{/t}
+       {/render}
+       <br>
+       {render acl=$gotoProfileServerACL checkbox=$multiple_support checked=$use_gotoProfileServer}
+               {t}Profil path{/t}
+               <select id="gotoProfileServer" name="gotoProfileServer">
+                       {html_options values=$gotoProfileServerKeys output=$gotoProfileServers selected=$gotoProfileServer}
+               </select>
+       {/render}
+       <br>
+       {render acl=$gotoProfileQuotaACL checkbox=$multiple_support checked=$use_gotoProfileQuota}
+                        <input type="text" name="gotoProfileQuota" value="{$gotoProfileQuota}" size="6" id="gotoProfileQuota">{t}MB{/t}
+       {/render}
+       <br>
+       {render acl=$gotoProfileFlagCACL checkbox=$multiple_support checked=$use_gotoProfileFlagC}
+               <input class="center" type="checkbox" name="gotoProfileFlagC" value="C" {$gotoProfileFlagCCHK} id="gotoProfileFlagC">&nbsp;
+               {t}Cache profile localy{/t}
+       {/render}
+
+{else}
+
+
+   <table summary="{t}Profile managment{/t}">
+    <tr>
+     <td style="vertical-align:top">
+{render acl=$gotoProfileACL}
+      <input class="center" type="checkbox" value="1" {$useProfileCHK} name="useProfile" id="useProfile" onclick="changeState('gotoProfileServer');changeState('gotoProfileFlagC');changeState('gotoProfileQuota');">
+{/render}
+     </td>
+     <td style="vertical-align:middle;">
+      <label for="useProfile">{t}Use profile managment{/t}</label>
+     </td>
+    </tr>
+    <tr>
+     <td>&nbsp;
+     </td>
+     <td>
+      <table summary="{t}Profile server managment{/t}">
+       <tr>
+        <td> 
+         <label for="gotoProfileServer">{t}Profil path{/t}</label>
+        </td>
+        <td>
+{render acl=$gotoProfileServerACL}
+
+{if $gotoProfileServerWriteable}
+         <select id="gotoProfileServer" name="gotoProfileServer">
+          {html_options values=$gotoProfileServerKeys output=$gotoProfileServers selected=$gotoProfileServer}
+          <option disabled>&nbsp;</option>
+         </select>
+{else}
+         <select id="gotoProfileServer" name="gotoProfileServer">
+          {html_options values=$gotoProfileServer output=$gotoProfileServer selected=$gotoProfileServer}
+          <option disabled>&nbsp;</option>
+         </select>
+{/if}
+{/render}
+        </td>
+       </tr>
+       <tr>
+        <td>
+         <label for="gotoProfileQuota">{t}Profil quota{/t}</label> 
+         <br>
+         <br>
+        </td>
+        <td>
+{render acl=$gotoProfileQuotaACL}
+         <input type="text" name="gotoProfileQuota" value="{$gotoProfileQuota}" size="6" id="gotoProfileQuota">{t}MB{/t}
+{/render}
+         <br>
+         <br>
+        </td>
+       </tr>
+       <tr>
+        <td colspan=2> 
+{render acl=$gotoProfileFlagCACL}
+         <input class="center" type="checkbox" name="gotoProfileFlagC" value="C" {$gotoProfileFlagCCHK} id="gotoProfileFlagC">&nbsp;
+{/render}
+         <label for="gotoProfileFlagC">{t}Cache profile localy{/t}</label>
+        </td>
+       </tr>
+      </table>
+     </td>
+    </tr>
+   </table>
+
+{/if}
+
+  </td>
+  <td style="vertical-align:top">
+
+  <table summary="{t}Kiosk profile settings{/t}">
+{if $kiosk_enabled }
+    <tr>
+     <td colwidth=2>
+      <label for="kiosk_server">{t}Kiosk profile{/t}</label>
+     </td>
+    </tr>
+    <tr>
+     <td>      
+{if $multiple_support}
+         <input type="checkbox" name="use_kiosk_server" value="1" {if $use_kiosk_server} checked {/if} 
+               class="center" 
+                       onClick="changeState('kiosk_server');
+                                        changeState('kiosk_profile');"> 
+{/if}
+         {t}Server{/t}
+      <select name='kiosk_server' id="kiosk_server" onChange='document.mainform.submit();'
+               {if !$use_kiosk_server && $multiple_support} disabled {/if}>
+       {html_options options=$kiosk_servers selected=$kiosk_server}
+      </select>
+     </td>
+     <td>
+      {if $kiosk_server != "none"}
+      {t}Profile{/t}
+      <select name='kiosk_profile' id="kiosk_profile"
+        {if !$use_kiosk_server && $multiple_support} disabled {/if}>
+       {html_options values=$kiosk_profiles output=$kiosk_profiles selected=$kiosk_profile}
+      </select>
+      {else}
+        &nbsp;
+      {/if}
+     </td>
+    </tr>
+ {else}
+       <tr>
+               <td>
+                       <label for="dummy1">{t}Kiosk profile{/t}</label>
+               </td>
+               <td>
+                       <select name="dummy1" disabled id="dummy1"><option disabled>&nbsp;</option></select>
+                       <input type="button" disabled name="dummy2" value="{t}Manage{/t}">
+               </td>
+       </tr>
+{/if}
+    <tr>
+     <td colspan=2>
+      <br>
+{render acl=$gotoProfileFlagLACL checkbox=$multiple_support checked=$use_gotoProfileFlagL}
+      <input type="checkbox" name="gotoProfileFlagL" id="gotoProfileFlagL" value="L" {$gotoProfileFlagLCHK} class="center">
+{/render}
+      <label for="gotoProfileFlagL">{t}Resolution changeable during session{/t}</label>
+     </td>
+    </tr>
+    <tr>
+     <td>
+{if $multiple_support}
+         <input type="checkbox" value="1" class="center" name="use_gotoXResolution"
+               onClick="changeState('gotoXResolution');" {if $use_gotoXResolution} checked {/if}>
+{/if}
+      <label for="gotoXResolution">{t}Resolution{/t}</label>
+     </td>
+     <td>
+{render acl=$gotoXResolutionACL}
+      <select name="gotoXResolution" id="gotoXResolution" {if !$use_gotoXResolution && $multiple_support} disabled {/if}>
+       {html_options values=$gotoXResolutionKeys output=$gotoXResolutions selected=$gotoXResolution}
+      <option disabled>&nbsp;</option>
+      </select>
+{/render}
+     </td>
+    </tr>
+   </table> 
+
+
+
+
+
+
+  </td>
+ </tr>
+</table>
+
+<p class="seperator">&nbsp;</p>
+
+<table summary="{t}Environment managment settings{/t}" width="100%">
+ <tr>
+  <td style="width:50%;border-right:1px solid #B0B0B0">
+   <h2>
+    <img class="center" alt="" src="images/fai_partitionTable.png" align="middle" />&nbsp;
+    <label for="gotoShare">{t}Shares{/t}</label>
+   </h2>
+   <table summary="" style="width:100%">
+    <tr>
+     <td>
+       
+{render acl=$gotoShareACL}
+      {$divlistShares}
+{/render}
+{render acl=$gotoShareACL}
+      <input type="text" size=15 name="ShareUser" value="%u" title="{t}User used to connect to the share{/t}">@
+{/render}
+{render acl=$gotoShareACL}
+      <select name="gotoShareSelection" title="{t}Select a share{/t}">
+       {html_options values=$gotoShareSelectionKeys output=$gotoShareSelections}
+       <option disabled>&nbsp;</option>
+      </select>
+{/render}
+      :
+{render acl=$gotoShareACL}
+      <input type="text" size=15 name="gotoShareMountPoint" value="%H/Netzlaufwerke/%L/%S"
+      title="{t}Mount path{/t}">
+{/render}
+{render acl=$gotoShareACL}
+      <input type="submit" name="gotoShareAdd" value="{t}Add{/t}"> 
+{/render}
+      <!--   <input type="submit" name="gotoShareDel" value="{t}Remove{/t}"> -->
+     </td>
+    </tr>
+   </table>
+  </td>
+  <td style="vertical-align:top">
+   <h2>
+    <img class="center" alt="" src="images/fai_script.png" align="middle" />&nbsp;
+    <label for="gotoLogonScript">{t}Logon scripts{/t}</label>
+   </h2>
+   <table summary="{t}Logon script management{/t}" style="width:100%">
+    <tr>
+     <td>
+{render acl=$gotoLogonScriptACL}
+      <select style="width:100%;" name="gotoLogonScript" multiple size=5 id="gotoLogonScript">
+
+               {if $multiple_support}
+                       {foreach from=$gotoLogonScripts item=item key=key}
+                               {if $item.UsedByAllUsers}
+                               <option value="{$key}">{$item.LogonPriority}&nbsp;{$item.LogonName}&nbsp;[{$item.LogonDescription}] ({t}Used by all users{/t})</option>
+                               {else}
+                               <option style='color: #888888; background: #DDDDDD;background-color: #DDDDDD;' value="{$key}">{$item.LogonPriority}&nbsp;{$item.LogonName}&nbsp;[{$item.LogonDescription}] ({t}Used by some users{/t})</option>
+                               {/if}
+                       {/foreach}
+               {else}
+          {html_options values=$gotoLogonScriptKeys output=$gotoLogonScripts }
+              <option disabled>&nbsp;</option>
+               {/if}
+      </select>
+{/render}
+
+      <br>
+{render acl=$gotoLogonScriptACL}
+      <input type="submit" name="gotoLogonScriptNew" value="{t}Add{/t}">
+{/render}
+{render acl=$gotoLogonScriptACL}
+      <input type="submit" name="gotoLogonScriptEdit"  value="{t}Edit{/t}" {if $gotoLogonScriptKeysCnt ==0} disabled {/if}>
+{/render}
+{render acl=$gotoLogonScriptACL}
+      <input type="submit" name="gotoLogonScriptDel"  value="{t}Delete{/t}" {if $gotoLogonScriptKeysCnt ==0} disabled {/if}>
+{/render}
+     </td>
+    </tr>
+   </table> 
+  </td>
+ </tr>
+</table>
+
+<p class="seperator">&nbsp;</p>
+
+<table summary="{t}Environment managment settings{/t}" width="100%">
+ <tr>
+  <td style="border-right:1px solid #B0B0B0; width:50%; vertical-align:top">
+   <h2>
+    <img alt="" src="images/hotplug.png" align="middle" class="center" />&nbsp;
+    <label for="gotoHotplugDevice_post">{t}Hotplug devices{/t}</label>
+   </h2> 
+   <table style="width:100%" summary="{t}Hotplug device settings{/t}">
+    <tr>
+     <td>
+{render acl=$gotoHotplugDeviceACL}
+      <select name="gotoHotplugDevice_post[]" size=5  style="width:100%;" id="gotoHotplugDevice_post" multiple>
+               {if $multiple_support}
+                       {foreach from=$gotoHotplugDevices item=item key=key}
+                               {if $item.UsedByAllUsers}
+                               <option value="{$key}">{$item.name}&nbsp;[{$item.description}] ({t}Used by all users{/t})</option>
+                               {else}
+                               <option style='color: #888888; background: #DDDDDD;background-color: #DDDDDD;' value="{$key}">{$item.name}&nbsp;[{$item.description}] ({t}Used by some users{/t})</option>
+                               {/if}
+                       {/foreach}
+               {else}
+                  {html_options values=$gotoHotplugDeviceKeys output=$gotoHotplugDevices}
+                  <option disabled>&nbsp;</option>
+               {/if}
+      </select>
+{/render}
+     </td>
+    </tr>
+    <tr>
+     <td>
+{render acl=$gotoHotplugDeviceACL}
+      <input type="submit" name="gotoHotplugDeviceUse" value="{t}Add{/t}">
+{/render}
+{render acl=$gotoHotplugDeviceACL}
+      <input type="submit" name="gotoHotplugDeviceDel" value="{t}Delete{/t}"
+      {if !$gotoHotplugDevices} disabled {/if}>
+{/render}
+     </td>
+    </tr>
+   </table>
+  </td>
+  <td>
+
+
+{if $multiple_support}
+
+   <h2>
+       <input type="checkbox" name="use_gotoPrinter" value="1" {if $use_gotoPrinter} checked {/if}
+               class="center" onClick="toggle('div_gotoPrinter');">
+    <img alt="" src="images/select_printer.png" align="middle" class="center" />&nbsp;
+    <label for="gotoPrinter">{t}Printer{/t}</label>
+   </h2>
+
+   <div id="div_gotoPrinter" {if !$use_gotoPrinter} style="visibility:hidden;" {/if}>
+       <b>{t}Using this option will overwrite the complete printer settings for all currently edited objects!{/t}</b>
+   <table style="width:100%" summary="{t}Printer settings{/t}">
+    <tr>
+     <td>
+{render acl=$gotoPrinterACL}
+      <select style="width:100%;" name="gotoPrinterSel[]" multiple size=5 id="gotoPrinter">
+       {html_options values=$gotoPrinterKeys output=$gotoPrinter}
+       <option disabled>&nbsp;</option>
+      </select>
+{/render}
+      <br>
+{render acl=$gotoPrinterACL}
+      <input type="submit"  name="gotoPrinterAdd"     value="{t}Add{/t}">
+{/render}
+{render acl=$gotoPrinterACL}
+      <input type="submit" name="gotoPrinterDel"     value="{t}Delete{/t}" {if !$gotoPrinter } disabled {/if}>
+{/render}
+{render acl=$gotoPrinterACL}
+      <input type="submit" name="gotoPrinterEdit"    value="{t}Toggle admin{/t}" {if !$gotoPrinter } disabled {/if}>
+{/render}
+{render acl=$gosaDefaultPrinterACL}
+      <input type="submit" name="gotoPrinterDefault"    value="{t}Toggle default{/t}" {if !$gotoPrinter | $is_group} disabled {/if}>
+{/render}
+     </td>
+    </tr>
+   </table>
+       </div>
+
+{else}
+
+   <h2>
+    <img alt="" src="images/select_printer.png" align="middle" class="center" />&nbsp;
+    <label for="gotoPrinter">{t}Printer{/t}</label>
+   </h2>
+   <table style="width:100%" summary="{t}Printer settings{/t}">
+    <tr>
+     <td>
+{render acl=$gotoPrinterACL}
+      <select style="width:100%;" name="gotoPrinterSel[]" multiple size=5 id="gotoPrinter">
+       {html_options values=$gotoPrinterKeys output=$gotoPrinter}
+       <option disabled>&nbsp;</option>
+      </select>
+{/render}
+      <br>
+{render acl=$gotoPrinterACL}
+      <input type="submit"  name="gotoPrinterAdd"     value="{t}Add{/t}">
+{/render}
+{render acl=$gotoPrinterACL}
+      <input type="submit" name="gotoPrinterDel"     value="{t}Delete{/t}" {if !$gotoPrinter } disabled {/if}>
+{/render}
+{render acl=$gotoPrinterACL}
+      <input type="submit" name="gotoPrinterEdit"    value="{t}Toggle admin{/t}" {if !$gotoPrinter } disabled {/if}>
+{/render}
+{render acl=$gosaDefaultPrinterACL}
+      <input type="submit" name="gotoPrinterDefault"    value="{t}Toggle default{/t}" {if !$gotoPrinter | $is_group} disabled {/if}>
+{/render}
+     </td>
+    </tr>
+   </table>
+
+{/if}
+
+  </td>
+ </tr>
+</table>
+{if $multiple_support}
+       <input type="hidden" name="environment_multiple_posted" value="1">
+{/if}
+<script language="JavaScript" type="text/javascript">
+<!-- // First input field on page
+focus_field('useProfile');
+-->
+</script>
+{/if}
+
diff --git a/gosa-plugins/goto/personal/environment/hotplugDialog.tpl b/gosa-plugins/goto/personal/environment/hotplugDialog.tpl
new file mode 100644 (file)
index 0000000..868e72b
--- /dev/null
@@ -0,0 +1,70 @@
+<h2><img class="center" alt="" src="images/hotplug.png" align="middle">&nbsp;{t}Add hotplug devices{/t}</h2>
+
+    <input type="hidden" name="dialogissubmitted" value="1">
+
+       <table summary="{t}Hotplug management{/t}" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4 cellspacing=2>
+        <tr>
+            <td width="50%" style="vertical-align:top;">
+                               <div class="contentboxh" style="height:20px;">
+                               <p class="contentboxh" style="font-size:12px">
+                                       <b><LABEL for="hotplugName">{t}Select hotplug device to add{/t}</LABEL></b>
+                               </p>
+                               </div>
+                               <div class="contentboxb">
+                               <p class="contentboxb" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
+                                               <select style="width:600px;height:450px" size=20 name="hotplugName[]" id="hotplugName" multiple>
+                                                       {html_options values=$hotplugDeviceKeys output=$hotplugDevices}
+                                               <option disabled>&nbsp;</option>
+                                               </select><br>
+                                       </p>
+                               </div>
+            </td>
+                       <td style="vertical-align:top;">
+                <div class="contentboxh" style="height:20px">
+                    <p class="contentboxh" style="font-size:12px"><img src="{$launchimage}" align="right" alt="[F]">{t}Filters{/t}</p>
+                </div>
+                <div class="contentboxb">
+                    <table summary="" style="width:100%;border-top:1px solid #B0B0B0;background-color:#F8F8F8">
+                    {$alphabet}
+                    </table>
+                <table summary="" width="100%" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
+                    <tr>
+                        <td>
+                            <img class="center" alt="" src="{$tree_image}" align=middle>&nbsp;
+                            <select name="depselectHot" size=1 onChange="mainform.submit()" title="{t}Choose the department the search will be based    on{/t}">
+                              {html_options options=$deplistHot selected=$depselectHot}
+                            </select>
+                        </td>
+                    </tr>
+                </table>
+                        <table summary="" width="100%" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
+                            <tr>
+                                <td>
+                                    <LABEL for='filter'><img class="center" alt="Search" src="{$search_image}" align="middle" title="{t}Display users matching{/t}">
+                                    </LABEL>
+                                </td>
+                                <td width="99%">
+                                    <input id='filter' style='width:99%' type='text' name='regexHot' maxlength='20' value='{$regexHot}'
+                                            title='{t}Regular expression for        matching hotplugs{/t}' onChange="mainform.submit()">
+                                </td>
+                            </tr>
+                        </table>
+                    {$apply}
+                </div>
+            </td>
+
+
+               </tr>
+       </table>
+
+    <p class="seperator">&nbsp;</p>
+
+    <p align="right">
+    <input type="submit" name="HotPlugSave"     value="{t}Add{/t}">
+    <input type="submit" name="HotPlugCancel"   value="{t}Cancel{/t}">
+    </p>
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+       focus_field('hotplugName');
+  -->
+</script>
diff --git a/gosa-plugins/goto/personal/environment/logonManagement.tpl b/gosa-plugins/goto/personal/environment/logonManagement.tpl
new file mode 100644 (file)
index 0000000..746be6f
--- /dev/null
@@ -0,0 +1,84 @@
+<h2><img class="center" alt="" src="images/fai_script.png" align="middle">&nbsp;{t}Logon script management{/t}</h2>
+
+    <input type="hidden" name="dialogissubmitted" value="1">
+
+    <table summary="{t}Logon script management{/t}" width="100%">
+       <tr>
+                       <td width="50%" style="vertical-align:top;border-right:1px solid #B0B0B0">
+                                       <table summary="{t}Logon script settings{/t}">
+                                               <tr>
+                                                       <td><LABEL for="LogonName">{t}Skript name{/t}</LABEL>
+                                                       </td>
+                                                       <td>
+                                                               <input type="text" size=20 value="{$LogonName}" name="LogonName" {$LogonNameACL} id="LogonName">
+                                                       </td>
+                                               </tr>
+                                               <tr>
+                                                       <td><LABEL for="LogonDescription">{t}Description{/t}</LABEL>
+                                                       </td>
+                                                       <td>
+                                                               <input type="text" size=40 value="{$LogonDescription}" name="LogonDescription" id="LogonDescription"> 
+                                                       </td>
+                                               </tr>
+                                               <tr>
+                                                       <td><LABEL for="LogonPriority">{t}Priority{/t}</LABEL>
+                                                       </td><td>
+                                               <select name="LogonPriority" id="LogonPriority">
+                                                       {html_options values=$LogonPriorityKeys output=$LogonPrioritys}
+                                               </select>
+                                                       </td>
+                                               </tr>
+                                       </table>
+                       </td>
+                       <td style="vertical-align:top">
+                                       <table summary="{t}Logon script flags{/t}">
+                                               <tr>
+                                                       <td>
+                                                               <input type="checkbox" value="L" name="LogonLast" {$LogonLastCHK} id="LogonLast">
+                                                       <LABEL for="LogonLast">{t}Last script{/t}</LABEL>
+                                                       </td>
+                                               </tr>
+                                               <tr>
+                                                       <td>
+                                                               <input type="checkbox" value="O" name="LogonOverload" {$LogonOverloadCHK} id="LogonOverload">
+                                                               <LABEL for="LogonOverload">{t}Script can be replaced by user{/t}</LABEL>
+                                                       </td>
+                                               </tr>
+                                       </table>
+                       </td>
+               </tr>
+       </table>
+       <p class="seperator">&nbsp;</p>
+       <table width="100%" summary="">
+               <tr>
+                       <td colspan="2">
+                       <h2><img class="center" alt="" src="images/fai_script.png" align="middle">&nbsp;{t}Script{/t}</h2>
+                                       <table width="100%" summary="{t}Logon script{/t}">
+                                               <tr>
+                                                       <td>
+                                                               <textarea style="width:100%;height:400px;" name="LogonData">{$LogonData}</textarea>
+                                                       </td>
+                                               </tr>
+                                               <tr>
+                                                       <td>
+                                                               <input type="file" name="importFile" id="importFile">
+                                                               <input type="submit" value="{t}Import{/t}" name="StartImport" >
+                                                       </td>
+                                               </tr>
+                                       </table>
+                       </td>
+               </tr>
+       </table>        
+
+       <p class="seperator">&nbsp;</p>
+    <p align="right">
+    <input type="submit" name="LogonSave"     value="{t}Apply{/t}">
+    <input type="submit" name="LogonCancel"   value="{t}Cancel{/t}">
+    </p>
+
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+       focus_field('LogonName');
+  -->
+</script>
+
diff --git a/gosa-plugins/goto/personal/environment/main.inc b/gosa-plugins/goto/personal/environment/main.inc
new file mode 100644 (file)
index 0000000..4a31aef
--- /dev/null
@@ -0,0 +1,126 @@
+<?php
+/*
+   This code is part of GOsa (https://gosa.gonicus.de)
+   Copyright (C) 2003  Cajus Pollmeier
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+$lock_msg = "";
+if (!$remove_lock){
+  /* Reset requested? */
+  if (isset($_POST['edit_cancel']) || 
+      (isset($_GET['reset']) && $_GET['reset'] == 1)){
+#    del_lock ($ui->dn);
+    session::un_set ('edit');
+    session::un_set ('environment');
+  }
+
+  /* Create mail object on demand */
+  if (!session::is_set('environment') || (isset($_GET['reset']) && $_GET['reset'] == 1)){
+    $environment= new environment ($config, $ui->dn);
+    $environment->enable_CSN_check();
+    $environment->set_acl_category('users');
+    $environment->set_acl_base($ui->dn);
+    session::set('environment',$environment);
+  }
+  $environment = session::get('environment');
+
+  /* save changes back to object */
+  if (session::is_set('edit')){
+    $environment->save_object ();
+  }
+
+  /* Enter edit mode? */
+  if (isset($_POST['edit'])){
+  
+   /* Check locking */
+    if (($username= get_lock($ui->dn)) != ""){
+      session::set('back_plugin',$plug);
+      session::set('LOCK_VARS_TO_USE',array("/^edit$/","/^plug$/"));
+      $lock_msg =  gen_locked_message ($username, $ui->dn);
+
+    }else{
+
+      /* Lock the current entry */
+      add_lock ($ui->dn, $ui->dn);
+      session::set('dn',$ui->dn);
+      session::set('edit',TRUE);
+    }
+  }
+
+  /* save changes to LDAP and disable edit mode */
+  if (isset($_POST['edit_finish'])){
+
+    /* Perform checks */
+    $message= $environment->check ();
+
+    /* No errors, save object */
+    if (count ($message) == 0){
+      $environment->save ();
+      del_lock ($ui->dn);
+      session::un_set ('edit');
+
+      /* Remove object */
+      session::un_set ('environment');
+    } else {
+      /* Errors found, show message */
+      show_errors ($message);
+    }
+  }
+
+  /* Execute formular */
+  if($lock_msg){
+    $display = $lock_msg;
+  }else{
+    $display = $environment->execute();
+  }
+
+  /* Store changes  in session */
+  if (session::is_set('edit')){
+    session::set('environment',$environment);
+  }
+
+  $info= "";
+  /* Show page footer depending on the mode */
+  if (!$environment->in_dialog && $environment->is_account  && empty($lock_msg)){
+    $display.= "<p class=\"plugbottom\">";
+
+    /* Are we in edit mode? */
+    if ((session::is_set('edit'))&&($environment->dialog===NULL)){
+      $display.= "<input type=submit name=\"edit_finish\" style=\"width:80px\" value=\""._("Ok")."\">\n";
+      $display.= "&nbsp;";
+      $display.= "<input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
+      $info= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png').
+             "\"> ".$ui->dn."&nbsp;";
+    } else {
+      $info= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/openlock.png').
+        "\"> ".$ui->dn."&nbsp;";
+      if(preg_match("/w/",$ui->get_permissions($ui->dn,"users/environment"))){
+        $info.= "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/lamp.png').
+          "\"> "._("Click the 'Edit' button below to change informations in this dialog");
+        $display.= "<input type=submit name=\"edit\" value=\""._("Edit")."\">\n";
+      }
+      $display.= "<input type=\"hidden\" name=\"ignore\">\n";
+    }
+    $display.= "</p>\n";
+  }
+
+  /* Page header*/
+  $display= print_header(get_template_path('images/email.png'), _("User environment settings"), $info).$display;
+
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-plugins/goto/personal/environment/selectPrinterDialog.tpl b/gosa-plugins/goto/personal/environment/selectPrinterDialog.tpl
new file mode 100644 (file)
index 0000000..f07674d
--- /dev/null
@@ -0,0 +1,72 @@
+<h2><img class="center" alt="" src="images/select_printer.png" align="middle">&nbsp;{t}Add printer devcies{/t}</h2>
+
+    <input type="hidden" name="dialogissubmitted" value="1">
+
+       <table summary="{t}Select printer to add{/t}" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4>
+        <tr>
+            <td width="50%">
+                               <div class="contentboxh" style="height:20px;">
+                               <p class="contentboxh" style="font-size:12px">
+                                       <b><LABEL for="gotoPrinter">{t}Select printer to add{/t}</LABEL></b>
+                               </p>
+                               </div>
+                               <div class="contentboxb">
+                               <p class="contentboxb" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
+                               <select style="width:600px;height:450px" size=20 name="gotoPrinter[]" id="gotoPrinter" multiple>
+                               {html_options values=$gotoPrinterKeys output=$gotoPrinters}
+                               <option disabled>&nbsp;</option>
+                                        </select><br>
+                                       </p>
+                               </div>
+            </td>
+            <td valign="top">
+                               <div class="contentboxh" style="height:20px">
+                               <p class="contentboxh" style="font-size:12px"><img src="{$launchimage}" align="right" alt="[F]">{t}Filters{/t}</p>
+                               </div>
+                               <div class="contentboxb">
+                               <table summary="" style="width:100%;border-top:1px solid #B0B0B0;background-color:#F8F8F8">
+                               {$alphabet}
+                               </table>
+                               <table summary="" width="100%" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
+                                       <tr>
+                                               <td>
+                                                       <img class="center" alt="" src="{$tree_image}" align=middle>&nbsp;
+                                                       <select name="depselectPrinter" size=1 onChange="mainform.submit()" title="{t}Choose the department the search will be based on{/t}">
+                                                         {html_options options=$deplistPrinter selected=$depselectPrinter}
+                                                       </select>
+                                               </td>
+                                       </tr>
+                               </table>
+                               <table summary="" style="width:100%;border-top:1px solid #B0B0B0;background-color:#F8F8F8">
+                               <tr><td>
+                               <input type=checkbox name="subtrees" value="1" {$subtrees} onClick="mainform.submit()" title="{t}Select to search within subtrees{/t}">{t}Search in subtrees{/t}
+                               </tr></td>
+                               </table>
+                                       <table summary="" width="100%" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
+                                                       <tr>
+                                                               <td>
+                                                                       <LABEL for='filter'><img class="center" alt="Search" src="{$search_image}" align="middle" title="{t}Display printers matching{/t}">
+                                                                       </LABEL>
+                                                               </td>
+                                                       <td width="99%">
+                                                                       <input id='filter' style='width:99%' type='text' name='regexPrinter' maxlength='20' value='{$regexPrinter}' 
+                                                                                       title='{t}Regular expression for matching printer names{/t}' onChange="mainform.submit()">
+                                                               </td>
+                                                       </tr>
+                                               </table>
+                                       {$apply}
+                               </div>
+               </td>
+       </tr>
+    </table>
+
+    <p class="seperator">&nbsp;</p>
+    <p align="right">
+    <input type="submit" name="PrinterSave"     value="{t}Add{/t}">
+    <input type="submit" name="PrinterCancel"   value="{t}Cancel{/t}">
+    </p>
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+       focus_field('gotoPrinter');
+  -->
+</script>