From d67da305632bd879b581c7ac14b473500bf8a5e9 Mon Sep 17 00:00:00 2001 From: cajus Date: Thu, 17 Jan 2008 13:10:12 +0000 Subject: [PATCH] Removed admin git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8446 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../applications/class_applicationGeneric.inc | 572 ------------- .../class_applicationManagement.inc | 647 --------------- .../class_applicationParameters.inc | 248 ------ .../applications/class_divListApplication.inc | 323 -------- .../goto/admin/applications/generic.tpl | 152 ---- gosa-plugins/goto/admin/applications/main.inc | 55 -- .../goto/admin/applications/parameters.tpl | 2 - .../admin/applications/release_select.tpl | 16 - .../goto/admin/applications/remove.tpl | 23 - .../admin/applications/tabs_application.inc | 59 -- .../admin/devices/class_deviceGeneric.inc | 256 ------ .../admin/devices/class_deviceManagement.inc | 557 ------------- .../admin/devices/class_divListDevices.inc | 303 ------- .../goto/admin/devices/deviceGeneric.tpl | 75 -- gosa-plugins/goto/admin/devices/main.inc | 57 -- .../admin/devices/paste_deviceGeneric.tpl | 25 - gosa-plugins/goto/admin/devices/remove.tpl | 23 - .../goto/admin/devices/tabs_devices.inc | 38 - .../mimetypes/class_divListMimeTypes.inc | 345 -------- .../admin/mimetypes/class_mimetypeGeneric.inc | 758 ------------------ .../mimetypes/class_mimetypeManagement.inc | 666 --------------- gosa-plugins/goto/admin/mimetypes/generic.tpl | 199 ----- gosa-plugins/goto/admin/mimetypes/main.inc | 57 -- .../goto/admin/mimetypes/paste_generic.tpl | 31 - .../goto/admin/mimetypes/release_select.tpl | 16 - gosa-plugins/goto/admin/mimetypes/remove.tpl | 23 - .../goto/admin/mimetypes/tabs_mimetypes.inc | 61 -- 27 files changed, 5587 deletions(-) delete mode 100644 gosa-plugins/goto/admin/applications/class_applicationGeneric.inc delete mode 100644 gosa-plugins/goto/admin/applications/class_applicationManagement.inc delete mode 100644 gosa-plugins/goto/admin/applications/class_applicationParameters.inc delete mode 100644 gosa-plugins/goto/admin/applications/class_divListApplication.inc delete mode 100644 gosa-plugins/goto/admin/applications/generic.tpl delete mode 100644 gosa-plugins/goto/admin/applications/main.inc delete mode 100644 gosa-plugins/goto/admin/applications/parameters.tpl delete mode 100644 gosa-plugins/goto/admin/applications/release_select.tpl delete mode 100644 gosa-plugins/goto/admin/applications/remove.tpl delete mode 100644 gosa-plugins/goto/admin/applications/tabs_application.inc delete mode 100644 gosa-plugins/goto/admin/devices/class_deviceGeneric.inc delete mode 100644 gosa-plugins/goto/admin/devices/class_deviceManagement.inc delete mode 100644 gosa-plugins/goto/admin/devices/class_divListDevices.inc delete mode 100644 gosa-plugins/goto/admin/devices/deviceGeneric.tpl delete mode 100644 gosa-plugins/goto/admin/devices/main.inc delete mode 100644 gosa-plugins/goto/admin/devices/paste_deviceGeneric.tpl delete mode 100644 gosa-plugins/goto/admin/devices/remove.tpl delete mode 100644 gosa-plugins/goto/admin/devices/tabs_devices.inc delete mode 100644 gosa-plugins/goto/admin/mimetypes/class_divListMimeTypes.inc delete mode 100644 gosa-plugins/goto/admin/mimetypes/class_mimetypeGeneric.inc delete mode 100644 gosa-plugins/goto/admin/mimetypes/class_mimetypeManagement.inc delete mode 100644 gosa-plugins/goto/admin/mimetypes/generic.tpl delete mode 100644 gosa-plugins/goto/admin/mimetypes/main.inc delete mode 100644 gosa-plugins/goto/admin/mimetypes/paste_generic.tpl delete mode 100644 gosa-plugins/goto/admin/mimetypes/release_select.tpl delete mode 100644 gosa-plugins/goto/admin/mimetypes/remove.tpl delete mode 100644 gosa-plugins/goto/admin/mimetypes/tabs_mimetypes.inc diff --git a/gosa-plugins/goto/admin/applications/class_applicationGeneric.inc b/gosa-plugins/goto/admin/applications/class_applicationGeneric.inc deleted file mode 100644 index 247acf972..000000000 --- a/gosa-plugins/goto/admin/applications/class_applicationGeneric.inc +++ /dev/null @@ -1,572 +0,0 @@ - "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= "\"\" ". - _("This 'dn' is no application.").""; - 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 ="

"._("Application settings")."

- - - - - -
". - _("Application name"). - " - -
"; - $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 deleted file mode 100644 index c7810321e..000000000 --- a/gosa-plugins/goto/admin/applications/class_applicationManagement.inc +++ /dev/null @@ -1,647 +0,0 @@ -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 = "
";
-        foreach($this->dns as $dn){
-          add_lock ($dn, $this->ui->dn);
-          $dns_names .= $dn."\n";
-        }
-        $dns_names .="
"; - - /* 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.= "

\n"; - $display.= "\n"; - $display.= " \n"; - if ($this->dn != "new"){ - $display.= "\n"; - $display.= " \n"; - } - $display.= "\n"; - $display.= "

"; - } - 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 deleted file mode 100644 index 9f11eb6b9..000000000 --- a/gosa-plugins/goto/admin/applications/class_applicationParameters.inc +++ /dev/null @@ -1,248 +0,0 @@ - "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; $ioption_name); $i++){ - if (isset($_POST["remove$i"])){ - $k= 0; - $on= array(); - $ov= array(); - for ($j= 0; $joption_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= ""; - 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.="". - " ". - " ". - " ". - ""; - } - } - $table.= "
"._("Variable").""._("Default value")."
". - " ". - " ". - " ". - "
". - "
". - " ". - "
"; - $table.=""; - - /* 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; $ioption_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; $ioption_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; $ioption_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 deleted file mode 100644 index f70d5c618..000000000 --- a/gosa-plugins/goto/admin/applications/class_divListApplication.inc +++ /dev/null @@ -1,323 +0,0 @@ -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 = ""; - - /* set Page header */ - $this->AddHeader(array("string"=> $chk, "attach"=>"style='width:20px;'")); - $this->AddHeader(array("string" => " ", "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.= ""; - } else { - $options.= ""; - } - } - } - - /* 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")." ". - "  "; - - /* Create Layers menu */ - $s = ".|"._("Actions")."|\n"; - $s .= "..|". - " "._("Create")."|\n"; - - /* Append create options */ - if(preg_match("/c/",$acl)) { - $s.= "...|". - " "._("Application")."|appl_new|\n"; - } - - /* Multiple options */ - $s.= "..|---|\n"; - $s.= "..|". - " "._("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.= "..|". - " "._("Copy")."|"."multiple_copy_systems|\n"; - $s.= "..|". - " "._("Cut")."|"."multiple_cut_systems|\n"; - - if($this->parent->CopyPasteHandler->entries_queued()){ - $img = ""; - $s.="..|".$img." "._("Paste")."|editPaste|\n"; - }else{ - $img = ""; - $s.="..|".$img." "._("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 = "%s"; - $editlink = "%s"; - $userimg = "User"; - $applimg = "A"; - $empty = ""; - - /* 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.= " "; - - $actions.= " "; - } - } - - /* Add edit icon */ - $actions.= ""; - - - 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.= ""; - }else{ - $actions.= " "; - } - - $title = "title='".preg_replace('/ /', ' ', @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 = "".$display.""; - break; - } - } - } - - /* Create each field */ - $field0 = array("string" => "" , - "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 = "".$num_app_str." ".$num_apps."    "; - $str.= "".$num_dep_str." ".$num_deps."    "; - - $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 deleted file mode 100644 index b50ed7eb8..000000000 --- a/gosa-plugins/goto/admin/applications/generic.tpl +++ /dev/null @@ -1,152 +0,0 @@ - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - -
-{render acl=$cnACL} - -{/render} -
-{render acl=$gosaApplicationNameACL} - -{/render} -
-{render acl=$gosaApplicationExecuteACL} - -{/render} -
-{render acl=$descriptionACL} - -{/render} -
-{render acl=$baseACL} - -{/render} -{if !$isReleaseApplikation} -{render acl=$baseACL disable_picture='images/folder_gray.png'} - -{/render} -{/if} -
-
-   - - - - - - -
- -
- -
-  
- - -{render acl=$gosaApplicationIconACL} - -{/render} -{render acl=$gosaApplicationIconACL} - -{/render} -{render acl=$gosaApplicationIconACL} - -{/render} -
-
- -

 

- -

{t}Options{/t} {t}Options{/t}

- - - - - -
-{render acl=$gosaApplicationFlagsACL} - -{/render} - {t}Only executable for members{/t} -
-{render acl=$gosaApplicationFlagsACL} - -{/render} - {t}Replace user configuration on startup{/t} -
-{render acl=$gosaApplicationFlagsACL} - -{/render} - {t}Place icon on members desktop{/t} -
-{render acl=$gosaApplicationFlagsACL} - -{/render} - {t}Place entry in members startmenu{/t} -
-{render acl=$gosaApplicationFlagsACL} - -{/render} - {t}Place entry in members launch bar{/t} -
- -

 

- - - - - -
-

{t}Script{/t} {t}Script{/t}

-{render acl=$gotoLogonScriptACL} - -{/render} -{render acl=$gotoLogonScriptACL} - -{/render} -{render acl=$gotoLogonScriptACL} - -{/render} - -
- -
- - - diff --git a/gosa-plugins/goto/admin/applications/main.inc b/gosa-plugins/goto/admin/applications/main.inc deleted file mode 100644 index 7b748386a..000000000 --- a/gosa-plugins/goto/admin/applications/main.inc +++ /dev/null @@ -1,55 +0,0 @@ -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"), "\"\" ".@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 deleted file mode 100644 index 57c221971..000000000 --- a/gosa-plugins/goto/admin/applications/parameters.tpl +++ /dev/null @@ -1,2 +0,0 @@ -{$table} -
diff --git a/gosa-plugins/goto/admin/applications/release_select.tpl b/gosa-plugins/goto/admin/applications/release_select.tpl deleted file mode 100644 index d58738f05..000000000 --- a/gosa-plugins/goto/admin/applications/release_select.tpl +++ /dev/null @@ -1,16 +0,0 @@ -
-
-

[F]{t}Branches{/t}

-
-
- - - - -
- {t}Current release{/t}  - -
-
diff --git a/gosa-plugins/goto/admin/applications/remove.tpl b/gosa-plugins/goto/admin/applications/remove.tpl deleted file mode 100644 index 8598ed857..000000000 --- a/gosa-plugins/goto/admin/applications/remove.tpl +++ /dev/null @@ -1,23 +0,0 @@ -
-  {t}Warning{/t} -
-

- {$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} -

-

- {t}So - if you're sure - press 'Delete' to continue or 'Cancel' to abort.{/t} -

- -

- {if $multiple} - -   - - {else} - -   - - {/if} -

- diff --git a/gosa-plugins/goto/admin/applications/tabs_application.inc b/gosa-plugins/goto/admin/applications/tabs_application.inc deleted file mode 100644 index 5b6e82989..000000000 --- a/gosa-plugins/goto/admin/applications/tabs_application.inc +++ /dev/null @@ -1,59 +0,0 @@ -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 deleted file mode 100644 index bc870eb74..000000000 --- a/gosa-plugins/goto/admin/devices/class_deviceGeneric.inc +++ /dev/null @@ -1,256 +0,0 @@ -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 deleted file mode 100644 index 77c582575..000000000 --- a/gosa-plugins/goto/admin/devices/class_deviceManagement.inc +++ /dev/null @@ -1,557 +0,0 @@ -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 = "
";
-        foreach($this->dns as $dn){
-          add_lock ($dn, $this->ui->dn);
-          $dns_names .= $dn."\n";
-        }
-        $dns_names .="
"; - - /* 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.= "

\n"; - $display.= "\n"; - $display.= " \n"; - if ($this->dn != "new"){ - $display.= "\n"; - $display.= " \n"; - } - $display.= "\n"; - $display.= "

"; - } - 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 deleted file mode 100644 index e9d5f8522..000000000 --- a/gosa-plugins/goto/admin/devices/class_divListDevices.inc +++ /dev/null @@ -1,303 +0,0 @@ -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 = ""; - - /* set Page header */ - $this->AddHeader(array("string"=> $chk, "attach"=>"style='width:20px;'")); - $this->AddHeader(array("string" => " ", "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.= ""; - } else { - $options.= ""; - } - } - } - - /* 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")." ". - "  "; - - /* Create Layers menu */ - $s = ".|"._("Actions")."|\n"; - $s .= "..|". - " "._("Create")."|\n"; - - /* Append create options */ - if(preg_match("/c/",$acl)) { - $s.= "...|". - " "._("Device")."|device_new|\n"; - } - - /* Multiple options */ - $s.= "..|---|\n"; - $s.= "..|". - " "._("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.= "..|". - " "._("Copy")."|"."multiple_copy_systems|\n"; - $s.= "..|". - " "._("Cut")."|"."multiple_cut_systems|\n"; - - if($this->parent->CopyPasteHandler->entries_queued()){ - $img = ""; - $s.="..|".$img." "._("Paste")."|editPaste|\n"; - }else{ - $img = ""; - $s.="..|".$img." "._("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 = "%s"; - $editlink = "%s"; - $userimg = "User"; - $deviceimg = "A"; - $empty = ""; - - /* 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.= " "; - $actions.= " "; - } - - $actions.= ""; - - /* Add delete button */ - if(preg_match("/d/",$acl)){ - $actions.= ""; - }else{ - $actions.= " "; - } - - $title = "title='".preg_replace('/ /', ' ', @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 = "".$display.""; - break; - } - } - } - - - /* Create each field */ - $field0 = array("string" => "" , - "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 = "".$num_obj_str." ".$num_objs."    "; - $str.= "".$num_dep_str." ".$num_deps."    "; - - $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 deleted file mode 100644 index 863851e44..000000000 --- a/gosa-plugins/goto/admin/devices/deviceGeneric.tpl +++ /dev/null @@ -1,75 +0,0 @@ - -

{t}Devices{/t}

- - - - -
- - - - - - - - - - - - - - - - - -
- - -
{$must} - - -
- - -
- - -
-
- - - - - - - - - - - - - - -
{$must} - - -  
{$must} - - -
{$must} - - -
-
- - - - diff --git a/gosa-plugins/goto/admin/devices/main.inc b/gosa-plugins/goto/admin/devices/main.inc deleted file mode 100644 index 45209ca64..000000000 --- a/gosa-plugins/goto/admin/devices/main.inc +++ /dev/null @@ -1,57 +0,0 @@ -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"), "\"\" ".@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 deleted file mode 100644 index 44d688246..000000000 --- a/gosa-plugins/goto/admin/devices/paste_deviceGeneric.tpl +++ /dev/null @@ -1,25 +0,0 @@ - -

{t}Devices{/t}

- - - - -
- - - - - -
{$must} - - -
-
- - - - diff --git a/gosa-plugins/goto/admin/devices/remove.tpl b/gosa-plugins/goto/admin/devices/remove.tpl deleted file mode 100644 index 643056cd3..000000000 --- a/gosa-plugins/goto/admin/devices/remove.tpl +++ /dev/null @@ -1,23 +0,0 @@ -
-  {t}Warning{/t} -
-

- {$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} -

-

- {t}So - if you're sure - press 'Delete' to continue or 'Cancel' to abort.{/t} -

- -

- {if $multiple} - -   - - {else} - -   - - {/if} -

- diff --git a/gosa-plugins/goto/admin/devices/tabs_devices.inc b/gosa-plugins/goto/admin/devices/tabs_devices.inc deleted file mode 100644 index 0feddfc4e..000000000 --- a/gosa-plugins/goto/admin/devices/tabs_devices.inc +++ /dev/null @@ -1,38 +0,0 @@ -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 deleted file mode 100644 index da73758aa..000000000 --- a/gosa-plugins/goto/admin/mimetypes/class_divListMimeTypes.inc +++ /dev/null @@ -1,345 +0,0 @@ -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 = ""; - - /* set Page header */ - $this->AddHeader(array("string"=> $chk, "attach"=>"style='width:20px;'")); - $this->AddHeader(array("string" => " ", "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.= ""; - } else { - $options.= ""; - } - } - } - - /* 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")." ". - "  "; - - /* Create Layers menu */ - $s = ".|"._("Actions")."|\n"; - $s .= "..|". - " "._("Create")."|\n"; - - /* Append create options */ - if(preg_match("/c/",$acl)) { - $s.= "...|". - " "._("Mime type")."|mime_new|\n"; - } - - /* Multiple options */ - $s.= "..|---|\n"; - $s.= "..|". - " "._("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.= "..|". - " "._("Copy")."|"."multiple_copy_systems|\n"; - $s.= "..|". - " "._("Cut")."|"."multiple_cut_systems|\n"; - - if($this->parent->CopyPasteHandler->entries_queued()){ - $img = ""; - $s.="..|".$img." "._("Paste")."|editPaste|\n"; - }else{ - $img = ""; - $s.="..|".$img." "._("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 = "%s"; - $editlink = "%s"; - $userimg = "User"; - $mimeimg = "A"; - $empty = ""; - - /* 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.= " "; - $actions.= " "; - } - - $actions.= ""; - - /* Add delete button */ - if(preg_match("/d/",$acl)){ - $actions.= ""; - }else{ - $actions.= " "; - } - - $title = "title='".preg_replace('/ /', ' ', @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 = "".$display.""; - break; - } - } - } - - - /* Create each field */ - $field0 = array("string" => "" , - "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 = "".$num_obj_str." ".$num_objs."    "; - $str.= "".$num_dep_str." ".$num_deps."    "; - - $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 deleted file mode 100644 index 03867ebab..000000000 --- a/gosa-plugins/goto/admin/mimetypes/class_mimetypeGeneric.inc +++ /dev/null @@ -1,758 +0,0 @@ - "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= "   -   - "; - }else{ - $Pattern_Actions= ""; - } - - if($this->acl_is_writeable("gotoMimeApplication")){ - $Apps_Actions = "   -   - "; - }else{ - $Apps_Actions= ""; - } - - if($this->acl_is_writeable("gotoMimeEmbeddedApplication")){ - $EApps_Actions = "   -   - "; - }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 deleted file mode 100644 index 7af6280d7..000000000 --- a/gosa-plugins/goto/admin/mimetypes/class_mimetypeManagement.inc +++ /dev/null @@ -1,666 +0,0 @@ -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 = "
";
-        foreach($this->dns as $dn){
-          add_lock ($dn, $this->ui->dn);
-          $dns_names .= $dn."\n";
-        }
-        $dns_names .="
"; - - /* 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.= "

\n"; - $display.= "\n"; - $display.= " \n"; - if ($this->dn != "new"){ - $display.= "\n"; - $display.= " \n"; - } - $display.= "\n"; - $display.= "

"; - } - 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 deleted file mode 100644 index 1cb6d7549..000000000 --- a/gosa-plugins/goto/admin/mimetypes/generic.tpl +++ /dev/null @@ -1,199 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-

[M] {t}Generic{/t}

-
- - - - - - - - - - - - - -{if !$isReleaseMimeType} - - - - - -{/if} -
- {t}Mime type{/t}{$must} - -{render acl=$gotoMimeGroupACL} - -{/render} -
- {t}Mime group{/t} - -{render acl=$gotoMimeGroupACL} - -{/render} -
- {t}Description{/t} - -{render acl=$descriptionACL} - -{/render} -
- {render acl=$baseACL} - - {/render} - {if !$isReleaseMimeType} - {render acl=$baseACL disable_picture='images/folder_gray.png'} - - {/render} - {/if} -
- -
- - - - - -
-
- {t}Mime icon{/t} -
-  
- -{render acl=$gotoMimeIconACL} - -{/render} -{render acl=$gotoMimeIconACL} - -{/render} -
-
-

 

-
-

{t}Left click{/t} {t}Left click{/t}

-
- {t}File patterns{/t}{$must} -{render acl=$gotoMimeFilePatternACL} - {$gotoMimeFilePatterns} -{/render} - -{render acl=$gotoMimeFilePatternACL} - -{/render} -{render acl=$gotoMimeFilePatternACL} - -{/render} - - {t}Applications{/t} -{render acl=$gotoMimeApplicationACL} - {$gotoMimeApplications} -{/render} - -{render acl=$gotoMimeApplicationACL} - -{/render} -{render acl=$gotoMimeApplicationACL} - -{/render} -{render acl=$gotoMimeApplicationACL} - -{/render} -
-

 

-
-

{t}Embedding{/t} {t}Embedding{/t}

-
- - - - - -
-{render acl=$gotoMimeLeftClickActionACL} - -{/render} - {t}Show file in embedded viewer{/t} -
- -{render acl=$gotoMimeLeftClickActionACL} - -{/render} - {t}Show file in external viewer{/t} -
- -{render acl=$gotoMimeLeftClickActionACL} - -{/render} - {t}Ask whether to save to local disk{/t} -
- -
- {t}Applications{/t} -{render acl=$gotoMimeEmbeddedApplicationACL} - {$gotoMimeEmbeddedApplications} -{/render} -{render acl=$gotoMimeEmbeddedApplicationACL} - -{/render} -{render acl=$gotoMimeEmbeddedApplicationACL} - -{/render} -{render acl=$gotoMimeEmbeddedApplicationACL} - -{/render} -
- - - diff --git a/gosa-plugins/goto/admin/mimetypes/main.inc b/gosa-plugins/goto/admin/mimetypes/main.inc deleted file mode 100644 index de9214254..000000000 --- a/gosa-plugins/goto/admin/mimetypes/main.inc +++ /dev/null @@ -1,57 +0,0 @@ -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"), "\"\" ".@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 deleted file mode 100644 index 34b5e0751..000000000 --- a/gosa-plugins/goto/admin/mimetypes/paste_generic.tpl +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - -
-

 {t}Generic{/t}

-
- - - - - - - - - - -
- {t}Mime type{/t} - - -
- {t}Description{/t} - - -
- -
diff --git a/gosa-plugins/goto/admin/mimetypes/release_select.tpl b/gosa-plugins/goto/admin/mimetypes/release_select.tpl deleted file mode 100644 index d58738f05..000000000 --- a/gosa-plugins/goto/admin/mimetypes/release_select.tpl +++ /dev/null @@ -1,16 +0,0 @@ -
-
-

[F]{t}Branches{/t}

-
-
- - - - -
- {t}Current release{/t}  - -
-
diff --git a/gosa-plugins/goto/admin/mimetypes/remove.tpl b/gosa-plugins/goto/admin/mimetypes/remove.tpl deleted file mode 100644 index 30c423318..000000000 --- a/gosa-plugins/goto/admin/mimetypes/remove.tpl +++ /dev/null @@ -1,23 +0,0 @@ -
-  {t}Warning{/t} -
-

- {$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} -

-

- {t}So - if you're sure - press 'Delete' to continue or 'Cancel' to abort.{/t} -

- -

- {if $multiple} - -   - - {else} - -   - - {/if} -

- diff --git a/gosa-plugins/goto/admin/mimetypes/tabs_mimetypes.inc b/gosa-plugins/goto/admin/mimetypes/tabs_mimetypes.inc deleted file mode 100644 index 38570fde2..000000000 --- a/gosa-plugins/goto/admin/mimetypes/tabs_mimetypes.inc +++ /dev/null @@ -1,61 +0,0 @@ -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: -?> -- 2.30.2