From: hickert Date: Wed, 16 Apr 2008 07:05:19 +0000 (+0000) Subject: Updated mimetypes X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=eecd84a0e6cd439d6c5d1b0c4b80cf343cbcea2b;p=gosa.git Updated mimetypes -Fixed copy & Paste git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@10486 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-plugins/goto/admin/mimetypes/class_mimetypeGeneric.inc b/gosa-plugins/goto/admin/mimetypes/class_mimetypeGeneric.inc index 4bd6e9d0b..71121377c 100644 --- a/gosa-plugins/goto/admin/mimetypes/class_mimetypeGeneric.inc +++ b/gosa-plugins/goto/admin/mimetypes/class_mimetypeGeneric.inc @@ -540,31 +540,23 @@ class mimetype extends plugin $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[]= msgPool::duplicated(_("Name")); - } - } + if($this->is_release()){ + $base = $this->parent->parent->mime_release; }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[]= msgPool::duplicated(_("Name")); - } - } + $base = $this->base; } + $ldap->ls("(&(objectClass=gotoMimeType)(cn=".$this->cn."))",$base,array("cn")); + if($ldap->count()){ + $attrs = $ldap->fetch(); + if($this->dn != $attrs['dn']) { + $message[]= msgPool::duplicated("cn"); + } + } return($message); } + /** Helper functions **/ /* Set a new picture */ @@ -734,6 +726,22 @@ class mimetype extends plugin } + + function is_release() + { + if(is_object($this->parent->parent)){ + return($this->parent->parent->IsReleaseManagementActivated()); + }else{ + /* 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 PrepareForCopyPaste($source) { plugin::PrepareForCopyPaste($source); diff --git a/gosa-plugins/goto/admin/mimetypes/class_mimetypeManagement.inc b/gosa-plugins/goto/admin/mimetypes/class_mimetypeManagement.inc index c12bbdf8f..54a04b55b 100644 --- a/gosa-plugins/goto/admin/mimetypes/class_mimetypeManagement.inc +++ b/gosa-plugins/goto/admin/mimetypes/class_mimetypeManagement.inc @@ -27,11 +27,11 @@ class mimetypeManagement extends plugin /* Dialog attributes */ var $ui = NULL; var $DivListMimeTypes = NULL; - var $enableReleaseManagement = false; var $mimetabs = NULL; var $snapDialog = NULL; var $CopyPasteHandler = NULL; - var $start_pasting_copied_objects = FALSE; + var $start_pasting_copied_objects = FALSE; + var $enableReleaseManagement = false; var $mime_base = ""; var $mime_release = ""; @@ -71,7 +71,6 @@ class mimetypeManagement extends plugin $this->DivListMimeTypes->DisableCheckBox("SubSearch"); } - /* Set default release */ if(!$this->IsReleaseManagementActivated()){ $this->mime_base = get_ou("mimetypeou").$this->config->current['BASE']; @@ -132,7 +131,8 @@ class mimetypeManagement extends plugin /* 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/")); + 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 @@ -177,8 +177,6 @@ class mimetypeManagement extends plugin $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"; @@ -200,6 +198,7 @@ class mimetypeManagement extends plugin $s_action = "del_multiple"; } + /**************** Copy & Paste handling ****************/ @@ -260,7 +259,6 @@ class mimetypeManagement extends plugin if (count($message) == 0){ /* Save data data to ldap */ - $this->mimetabs->set_release($this->mime_base); $this->mimetabs->save(); if (!isset($_POST['edit_apply'])){ @@ -300,7 +298,6 @@ class mimetypeManagement extends plugin 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->parent = &$this; @@ -341,8 +338,6 @@ class mimetypeManagement extends plugin } - - /******************** Delete MULTIPLE entries confirmed ********************/ @@ -541,7 +536,6 @@ class mimetypeManagement extends plugin $Flags = GL_NONE | GL_SIZELIMIT; $Filter = "(&(|(cn=".$Regex.")(description=".$Regex."))(objectClass=gotoMimeType))"; $tmp = array(); - $Releases = $this->getReleases(); if(!$this->IsReleaseManagementActivated()){ $use_base = $this->mime_base; @@ -575,6 +569,7 @@ class mimetypeManagement extends plugin reset ($this->mimetypes); } + function remove_from_parent() { /* Optionally execute a command after we're done */ @@ -594,17 +589,16 @@ class mimetypeManagement extends plugin /* 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){ @@ -628,8 +622,9 @@ class mimetypeManagement extends plugin if($this->start_pasting_copied_objects && $this->CopyPasteHandler->entries_queued()){ /* Get dialog */ + $this->CopyPasteHandler->SetVar("base",preg_replace("/^".normalizePreg(get_ou("mimetypeou"))."/","",$this->mime_base)); + $this->CopyPasteHandler->SetVar("parent",&$this); $data = $this->CopyPasteHandler->execute(); - $this->CopyPasteHandler->SetVar("base",$this->DivListMimeTypes->selectedBase); /* Return dialog data */ if(!empty($data)){ @@ -638,9 +633,9 @@ class mimetypeManagement extends plugin } /* Automatically disable status for pasting */ - #if(!$this->CopyPasteHandler->entries_queued()){ - # $this->start_pasting_copied_objects = FALSE; - #} + if(!$this->CopyPasteHandler->entries_queued()){ + $this->start_pasting_copied_objects = FALSE; + } return(""); } diff --git a/gosa-plugins/goto/admin/mimetypes/tabs_mimetypes.inc b/gosa-plugins/goto/admin/mimetypes/tabs_mimetypes.inc index 9597704ca..a2fc2bb40 100644 --- a/gosa-plugins/goto/admin/mimetypes/tabs_mimetypes.inc +++ b/gosa-plugins/goto/admin/mimetypes/tabs_mimetypes.inc @@ -2,7 +2,6 @@ class mimetabs extends tabs { - var $Release= ""; var $parent = FALSE; function mimetabs($config, $data, $dn,$category) @@ -13,14 +12,6 @@ class mimetabs extends tabs $this->addSpecialTabs(); } - function set_release($newRelease) - { - $this->Release= preg_replace('/,'.get_ou('mimetypeou').'.*$/', '', $newRelease); - if ($this->Release != ""){ - $this->Release= ",".$this->Release; - } - } - function save($ignore_account= FALSE) { $baseobject= $this->by_object['mimetype']; @@ -30,7 +21,7 @@ class mimetabs extends tabs if($this->parent->IsReleaseManagementActivated()){ $new_dn= "cn=".$baseobject->cn.",".$this->parent->mime_release; }else{ - $new_dn= "cn=".$baseobject->cn.",".get_ou('mimeou').$baseobject->base; + $new_dn= "cn=".$baseobject->cn.",".get_ou('mimetypeou').$baseobject->base; } /* Move group? */