summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 48567b1)
raw | patch | inline | side by side (parent: 48567b1)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 28 Jun 2006 10:31:01 +0000 (10:31 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 28 Jun 2006 10:31:01 +0000 (10:31 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@3956 594d385d-05f5-0310-b6e9-bd551577e9d8
plugins/admin/mimetypes/class_divListMimeTypes.inc | [new file with mode: 0755] | patch | blob |
plugins/admin/mimetypes/class_mimetypeGeneric.inc | [new file with mode: 0644] | patch | blob |
plugins/admin/mimetypes/class_mimetypeManagement.inc | [new file with mode: 0755] | patch | blob |
plugins/admin/mimetypes/generic.tpl | [new file with mode: 0644] | patch | blob |
plugins/admin/mimetypes/main.inc | [new file with mode: 0755] | patch | blob |
plugins/admin/mimetypes/paste_generic.tpl | [new file with mode: 0644] | patch | blob |
plugins/admin/mimetypes/release_select.tpl | [new file with mode: 0755] | patch | blob |
plugins/admin/mimetypes/remove.tpl | [new file with mode: 0755] | patch | blob |
plugins/admin/mimetypes/tabs_mimetypes.inc | [new file with mode: 0755] | patch | blob |
diff --git a/plugins/admin/mimetypes/class_divListMimeTypes.inc b/plugins/admin/mimetypes/class_divListMimeTypes.inc
--- /dev/null
@@ -0,0 +1,212 @@
+<?php
+
+class divListMimeTypes extends MultiSelectWindow
+{
+ /* Current base */
+ var $selectedBase = "";
+ var $selectedRelease = "main";
+ var $AvailableReleases = array();
+ var $departments = array();
+ var $parent ;
+ var $ui ;
+
+ /* Regex */
+ var $Regex = "*";
+
+ /* Subsearch checkbox */
+ var $SubSearch;
+
+ /* These vars should be saved too */
+ var $SaveAdditionalVars = array("selectedRelease");
+
+
+ function divListMimeTypes ($config,$parent)
+ {
+ /* Create divlist and setup */
+ MultiSelectWindow::MultiSelectWindow($config,"Mimetypes");
+
+ /* initialize required attributes */
+ $this->selectedRelease = "ou=mime,".$_SESSION['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 = 70;
+ if($this->parent->snapshotEnabled()){
+ $action_col_size += 38;
+ }
+
+ /* set Page header */
+ $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"), _("Ignore 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));
+ }
+ 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= "";
+ foreach ($this->config->idepartments as $key => $value){
+ if ($this->selectedBase == $key){
+ $options.= "<option selected='selected' value='$key'>$value</option>";
+ } else {
+ $options.= "<option value='$key'>$value</option>";
+ }
+ }
+
+ /* Get copy & paste icon */
+ if($this->parent->CopyPasteHandler){
+ $Copy_Paste = $this->parent->CopyPasteHandler->generatePasteIcon();
+ }else{
+ $Copy_Paste ="";
+ }
+
+ /* Create listhead, it will be shown on top of the divlist.
+ * It provides general navigation and object creation
+ */
+ $listhead = "<div style='background:#F0F0F9;padding:5px;'>".
+ " <input class='center' type='image' src='images/list_root.png' align='middle' ".
+ "title='"._("Go to root department")."' name='dep_root' alt='"._("Root")."'> ".
+ " <input class='center' type='image' align='middle' src='images/list_back.png' ".
+ "title='"._("Go up one department")."' alt='"._("Up")."' name='dep_back'> ".
+ " <input class='center' type='image' align='middle' src='images/list_home.png' ".
+ "title='"._("Go to users department")."' alt='"._("Home")."' name='dep_home'> ".
+ " <input class='center' type='image' src='images/list_reload.png' align='middle' ".
+ "title='"._("Reload list")."' name='submit_department' alt='"._("Submit")."'> ".
+ " <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'> ";
+ $listhead .= $this->get_snapshot_header($this->selectedBase);
+ $listhead .= " <input class='center' type='image' align='middle' src='images/list_new_mime.png' alt='"._("new").
+ "' title='"._("Create new mime type")."' name='mime_new'> ".
+ $Copy_Paste.
+ " <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'> ".
+ _("Base")." <select name='CurrentMainBase' onChange='mainform.submit()' class='center'>$options</select>".
+ " <input class='center' type='image' src='images/list_submit.png' align='middle'
+ title='"._("Submit department")."' name='submit_department' alt='"._("Submit")."'> ".
+ "</div>";
+
+ $this->SetListHeader($listhead);
+ }
+
+
+ /* Some basic settings */
+ function execute()
+ {
+ $this->ClearElementsList();
+ $this->GenHeader();
+ }
+
+
+ function setEntries($list)
+ {
+ /********************
+ Variable init
+ ********************/
+
+ /* Create links */
+ $linkopen = "<a href='?plug=".$_GET['plug']."&act=dep_open&dep_id=%s'>%s</a>";
+ $editlink = "<a href='?plug=".$_GET['plug']."&id=%s&act=edit_entry'>%s</a>";
+ $userimg = "<img class='center' src='images/select_groups.png' alt='User' title='%s'>";
+ $mimeimg = "<img class='center' src='images/select_mimetype.png' alt='A' title='"._("Mime type")."'>";
+ $empty = "<img class='center' src='images/empty.png' style='width:16px;height:16px;' alt=''>";
+
+ /* set Page header */
+ $action_col_size = 70;
+ if($this->parent->snapshotEnabled()){
+ $action_col_size += 38;
+ }
+
+ /********************
+ Attach objects
+ ********************/
+
+ foreach($list as $key => $val){
+
+ /* Create action icons */
+ $actions = $this->GetSnapShotActions($val['dn']);
+ if($this->parent->CopyPasteHandler){
+ $actions.= "<input class='center' type='image'
+ src='images/editcut.png' alt='"._("cut")."' name='cut_%KEY%' title='"._("Cut this entry")."'> ";
+ $actions.= "<input class='center' type='image'
+ src='images/editcopy.png' alt='"._("copy")."' name='copy_%KEY%' title='"._("Copy this entry")."'> ";
+ }
+ $actions.= "<input class='center' type='image'
+ src='images/edit.png' alt='"._("edit")."' name='mime_edit_%KEY%' title='"._("Edit this entry")."'>";
+ $actions.= "<input class='center' type='image'
+ src='images/edittrash.png' alt='"._("delete")."' name='mime_del_%KEY%' title='"._("Delete this entry")."'>";
+
+ $title = "title='".preg_replace('/ /', ' ', @LDAP::fix($val['dn']))."'";
+
+ if(!isset($val['description'][0])){
+ $desc = "";
+ }else{
+ $desc = " - [ ".$val['description'][0]." ]";
+ }
+ $field1 = array("string" => sprintf($mimeimg,$val['dn']), "attach" => "style='text-align:center;width:20px;'");
+ $field2 = array("string" => sprintf($editlink,$key,($val['cn']['0'].$desc)), "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($field1,$field2,$field3));
+ }
+
+ }
+
+ 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);
+ }
+ $_SESSION['mimefilter']['release'] = $this->selectedRelease;
+ }
+
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/plugins/admin/mimetypes/class_mimetypeGeneric.inc b/plugins/admin/mimetypes/class_mimetypeGeneric.inc
--- /dev/null
@@ -0,0 +1,536 @@
+<?php
+class mimetype extends plugin
+{
+ /* CLI vars */
+ var $cli_summary = "This tab allows you to modify, add or remove mime types in the selected department.";
+ var $cli_description = "Management dialog to handle mime types";
+ var $ignore_account = true; // This is always a valid account
+ var $cli_parameters = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+ var $objectclasses = array("top","gotoMimeType");
+ var $attributes = array("cn","gotoMimeApplication","gotoMimeLeftClickAction","gotoMimeIcon",
+ "description","gotoMimeFilePattern","gotoMimeEmbeddedApplication",
+ "gotoMimeGroup");
+
+ /* Class vars */
+ var $acl;
+ var $ui;
+ var $cn = "";
+ var $gotoMimeLeftClickAction = "I";
+ var $gotoMimeLeftClickAction_I = false;
+ var $gotoMimeLeftClickAction_E = false;
+ var $gotoMimeLeftClickAction_Q = false;
+ var $gotoMimeIcon = "*removed*";
+ var $description = "";
+ var $gotoMimeFilePattern = array();
+ var $gotoMimeApplication = array();
+ var $gotoMimeEmbeddedApplication = array();
+ var $use_gotoMimeFilePattern = array();
+ var $use_gotoMimeApplication = array();
+ var $use_gotoMimeEmbeddedApplication = array();
+ var $gotoMimeGroup = "";
+ var $iconData = NULL;
+
+ /* 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");
+
+ /* Select options */
+ var $MimeGroups = array("video","audio","system");
+
+
+ function mimetype($config,$dn= NULL)
+ {
+ plugin::plugin ($config, $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;
+ }
+ }
+ }
+
+ /* 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 wit priority */
+ 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 = search_config($this->config->data,"faiManagement","CLASS");
+ if(!empty($tmp)) {
+ if(!preg_match("/^ou=apps,/",$_SESSION['mimefilter']['release'])){
+ $this->isReleaseMimeType= true;
+ }
+ }
+
+ /* 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['binary'] = $this->iconData;
+ $_SESSION['binarytype'] = "image/jpeg";
+ }
+
+
+ function execute()
+ {
+ $smarty = get_smarty();
+
+ /* 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(chkacl($this->acl,$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(chkacl($this->acl,"gotoMimeFilePattern") == ""){
+ $str = $_POST['NewFilePattern'];
+ if(!empty($str)){
+ $this->use_gotoMimeFilePattern[] = $str;
+ }
+ }
+ }
+
+ /* Add gotoMimeFilePattern */
+ if(isset($_POST['AddNewApplication']) && isset($_POST['NewApplication'])){
+ if(chkacl($this->acl,"gotoMimeApplication") == ""){
+ $str = $_POST['NewApplication'];
+ if(!empty($str)){
+ $this->use_gotoMimeApplication[] = $str;
+ }
+ }
+ }
+
+ /* Add gotoMimeFilePattern */
+ if(isset($_POST['AddNewEmbeddedApplication']) && isset($_POST['NewEmbeddedApplication'])){
+ if(chkacl($this->acl,"gotoMimeEmbeddedApplication") == ""){
+ $str = $_POST['NewEmbeddedApplication'];
+ if(!empty($str)){
+ $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(chkacl($this->acl,"gotoMimeFilePattern") == ""){
+ $Pattern_Actions= " <input type='image' src='images/sort_up.png' class='center' name='Pattern_SortUp_%s' >
+ <input type='image' src='images/sort_down.png' class='center' name='Pattern_SortDown_%s'>
+ <input type='image' src='images/edittrash.png' class='center' name='Pattern_Remove_%s'>";
+ }else{
+ $Pattern_Actions= "";
+ }
+
+ if(chkacl($this->acl,"gotoMimeApplication") == ""){
+ $Apps_Actions = " <input type='image' src='images/sort_up.png' class='center' name='Apps_SortUp_%s' >
+ <input type='image' src='images/sort_down.png' class='center' name='Apps_SortDown_%s'>
+ <input type='image' src='images/edittrash.png' class='center' name='Apps_Remove_%s'>";
+ }else{
+ $Apps_Actions= "";
+ }
+
+ if(chkacl($this->acl,"gotoMimeEmbeddedApplication") == ""){
+ $EApps_Actions = " <input type='image' src='images/sort_up.png' class='center' name='EApps_SortUp_%s' >
+ <input type='image' src='images/sort_down.png' class='center' name='EApps_SortDown_%s'>
+ <input type='image' src='images/edittrash.png' class='center' name='EApps_Remove_%s'>";
+ }else{
+ $EApps_Actions= "";
+ }
+
+ 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);
+ }
+ 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);
+ }
+ 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("gotoMimeFilePatterns", $DivPatterns->DrawList());
+ $smarty->assign("gotoMimeApplications", $DivApps->DrawList());
+ $smarty->assign("gotoMimeEmbeddedApplications", $DivEApps->DrawList());
+
+ /* Assign class vars to smarty */
+ foreach($this->attributes as $attr){
+ $smarty->assign($attr,$this->$attr);
+ $smarty->assign($attr."ACL",chkacl($this->acl,$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'])){
+ plugin::save_object();
+
+
+ /* Save radio buttons */
+ if(chkacl($this->acl,"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 */
+ 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 ++;
+ }
+ if($this->new && count($tmp) == 0){
+ $this->$attr = "";
+ }
+ }
+
+ /* Create array entries */
+ foreach(array("gotoMimeFilePattern") as $attr){
+ $i = 0;
+ $use_attr = "use_".$attr;
+ $tmp = array();
+ $this->$attr = "";
+ foreach($this->$use_attr as $entry){
+ $tmp[] = $entry;
+ }
+ $this->$attr = $tmp;
+ }
+
+ plugin::save();
+
+ if($this->gotoMimeIcon != "*removed"){
+ $this->attrs['gotoMimeIcon'] = $this->iconData;
+ }
+
+ $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);
+ }else{
+ $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
+ $ldap->cd($this->dn);
+ $ldap->add($this->attrs);
+ }
+ show_ldap_error($ldap->get_error(),_("Saving mime type failed."));
+ }
+
+
+ /* Remove current mime type */
+ function remove_from_parent()
+ {
+ $ldap->rmDir($this->dn);
+ show_ldap_error($ldap->get_error(), _("Removing mie type failed"));
+
+ /* 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=".$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.") ;
+ }
+ return($message);
+ }
+
+ /** Helper functions **/
+
+ /* Set a new picture */
+ function set_new_picture($filename)
+ {
+ if (empty($filename)){
+ $filename= "./images/default_icon.png";
+ $this->gotoMimeIcon= "*removed*";
+ }
+
+ if (file_exists($filename)){
+ $fd = fopen ($filename, "rb");
+ $this->iconData= fread ($fd, filesize ($filename));
+ $_SESSION['binary']= $this->iconData;
+ $_SESSION['binarytype']= "image/jpeg";
+ fclose ($fd);
+ }
+ }
+
+ /* Get picture link */
+ function get_picture()
+ {
+ $_SESSION['binary']= $this->iconData;
+ $_SESSION['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];
+ }
+ }
+ }
+}
+?>
diff --git a/plugins/admin/mimetypes/class_mimetypeManagement.inc b/plugins/admin/mimetypes/class_mimetypeManagement.inc
--- /dev/null
@@ -0,0 +1,506 @@
+<?php
+/*
+ This code is part of GOsa (https://gosa.gonicus.de)
+ Copyright (C) 2003 Cajus Pollmeier
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+require "tabs_mimetypes.inc";
+
+class mimetypeManagement extends plugin
+{
+ /* Definitions */
+ var $plHeadline = "Mime types";
+ var $plDescription = "Manage mime types";
+
+ /* Dialog attributes */
+ var $ui = NULL;
+ var $DivListMimeTypes = NULL;
+ var $enableReleaseManagement = false;
+ var $mimetabs = NULL;
+ var $snapDialog = NULL;
+ var $acl = NULL;
+
+ function mimetypeManagement ($config, $ui)
+ {
+ /* Save configuration for internal use */
+ $this->config = $config;
+ $this->ui = $ui;
+
+ /* Check if copy & paste is activated */
+ if($this->config->boolValueIsTrue("MAIN","ENABLECOPYPASTE")){
+ $this->CopyPasteHandler = new CopyPasteHandler($this->config);
+ }
+
+ /* Creat dialog object */
+ $this->DivListMimeTypes = new divListMimeTypes($this->config,$this);
+
+ if($this->IsReleaseManagementActivated()){
+
+ /* Check if we should enable the release selection */
+ $this->enableReleaseManagement = true;
+
+ /* Hide SubSearch checkbox */
+ $this->DivListMimeTypes->DisableCheckBox("SubSearch");
+ }
+
+ /* Get acls */
+ $acl= get_permissions ($ui->dn, $ui->subtreeACL);
+ $this->acl= get_module_permission($acl, "mimetype", $ui->dn);
+ }
+
+
+ /* Get all releases */
+ function getReleases($base)
+ {
+ $ldap = $this->config->get_ldap_link();
+ $dn = "ou=mime,".$base;
+ $ret = array();
+ $ret ["ou=mime,".$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['LOCK_VARS_TO_USE'] = array("/^act$/","/^id$/","/^mime_edit_/","/^mime_del_/");
+
+ $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("/^editPaste.*/i",$key)){
+ $s_action="editPaste";
+ }
+ }
+
+ if((isset($_GET['act']))&&($_GET['act']=="edit_entry")){
+ $s_action ="edit";
+ $s_entry = $_GET['id'];
+ }
+
+ $s_entry = preg_replace("/_.$/","",$s_entry);
+
+
+ /****************
+ Copy & Paste handling
+ ****************/
+
+ /* Only perform copy / paste if it is enabled
+ */
+ if($this->CopyPasteHandler){
+ if($str = $this->copyPasteHandling($s_action,$s_entry)){
+ return($str);
+ };
+ }
+
+
+ /****************
+ Create a new mime type
+ ****************/
+
+ /* New mime type? */
+ 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->mimetabs= new mimetabs($this->config, $this->config->data['TABS']['MIMETABS'], $this->dn);
+
+ /* set acl */
+ $acl= get_permissions ($this->DivListMimeTypes->selectedBase, $this->ui->subtreeACL);
+ $this->mimetabs->set_acl($acl);
+ }
+
+
+ /****************
+ Edit entry canceled
+ ****************/
+
+ /* Cancel dialogs */
+ if (isset($_POST['edit_cancel']) || isset($_POST['password_cancel'])){
+ del_lock ($this->mimetabs->dn);
+ unset ($this->mimetabs);
+ $this->mimetabs= NULL;
+ unset ($_SESSION['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();
+ gosa_log ("Mime object'".$this->dn."' has been saved");
+
+ 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;
+ unset ($_SESSION['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);
+
+ /* Set up the users ACL's for this 'dn' */
+ $acl= get_permissions ($this->dn, $this->ui->subtreeACL);
+ $this->mimetabs->set_acl($acl);
+ $_SESSION['objectinfo']= $this->dn;
+ }
+
+
+ /****************
+ 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' */
+ if (chkacl($this->acl, "delete") == ""){
+
+ /* 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)));
+ 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. */
+ if (chkacl($this->acl, "delete") == ""){
+
+ /* Delete request is permitted, perform LDAP action */
+ $this->mimetabs= new mimetabs($this->config, $this->config->data['TABS']['MIMETABS'], $this->dn);
+ $acl= get_permissions ($this->dn, $this->ui->subtreeACL);
+ $this->mimetabs->set_acl($acl);
+ $this->mimetabs->delete ();
+ gosa_log ("Mime type object'".$this->dn."' has been removed");
+ 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!"));
+ gosa_log ("Warning: '".$this->ui->uid."' tried to trick group 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);
+ unset($_SESSION['objectinfo']);
+ }
+
+ /* Show tab dialog if object is present */
+ if (($this->mimetabs) && (isset($this->mimetabs->config))){
+ $display= $this->mimetabs->execute();
+
+ /* Don't show buttons if tab dialog requests this */
+ if (!$this->mimetabs->by_object[$this->mimetabs->current]->dialog){
+ $display.= "<p style=\"text-align:right\">\n";
+ $display.= "<input type=\"submit\" name=\"edit_finish\" style=\"width:80px\" value=\""._("Ok")."\">\n";
+ $display.= " \n";
+ if ($this->dn != "new"){
+ $display.= "<input type=submit name=\"edit_apply\" value=\""._("Apply")."\">\n";
+ $display.= " \n";
+ }
+ $display.= "<input type=\"submit\" name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
+ $display.= "</p>";
+ }
+ return ($display);
+ }
+
+
+ /****************
+ Dialog display
+ ****************/
+
+ /* Check if there is a snapshot dialog open */
+ $base = $this->DivListMimeTypes->selectedBase;
+ if($str = $this->showSnapshotDialog($base,$this->get_used_snapshot_bases())){
+ return($str);
+ }
+
+ /* Display dialog with system list */
+ $this->DivListMimeTypes->parent = $this;
+ $this->DivListMimeTypes->execute();
+ $this->DivListMimeTypes->AddDepartments($this->DivListMimeTypes->selectedBase);
+ $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;
+ }
+
+ /* Get results and create index */
+ $res= get_list($Filter, $this->ui->subtreeACL,$use_base, array("cn","description","dn","objectClass"), $Flags);
+ foreach ($res as $val){
+ $tmp[strtolower($val['cn'][0]).$val['cn'][0]]=$val;
+ }
+
+ /* sort entries */
+ ksort($tmp);
+ $this->mimetypes=array();
+ foreach($tmp as $val){
+ $this->mimetypes[]=$val;
+ }
+ reset ($this->mimetypes);
+ }
+
+ function remove_from_parent()
+ {
+ /* Optionally execute a command after we're done */
+ $this->postremove();
+ }
+
+
+ function copyPasteHandling($s_action,$s_entry)
+ {
+ /* Paste copied/cutted object in here
+ */
+ if(($s_action == "editPaste") || ($this->CopyPasteHandler->stillOpen())){
+ $this->CopyPasteHandler->save_object();
+ $this->CopyPasteHandler->SetVar("base", $this->DivListMimeTypes->selectedBase);
+
+ if($str = $this->CopyPasteHandler->execute()) {
+ return($str);
+ }
+ }
+
+ /* Copy current object to CopyHandler
+ */
+ if($s_action == "copy"){
+ $this->CopyPasteHandler->Clear();
+ $dn = $this->mimetypes[$s_entry]['dn'];
+ $obj = new mimetabs($this->config, $this->config->data['TABS']['MIMETABS'], $dn);
+ $objNew = new mimetabs($this->config, $this->config->data['TABS']['MIMETABS'], "new");
+ $this->CopyPasteHandler->Copy($obj,$objNew);
+ }
+
+ /* Copy current object to CopyHandler
+ */
+ if($s_action == "cut"){
+ $this->CopyPasteHandler->Clear();
+ $dn = $this->mimetypes[$s_entry]['dn'];
+ $obj = new mimetabs($this->config, $this->config->data['TABS']['MIMETABS'], $dn);
+ $this->CopyPasteHandler->Cut($obj);
+ }
+ }
+
+ /* Check if the release management is activated. */
+ function IsReleaseManagementActivated()
+ {
+ /* Check if we should enable the release selection */
+ $tmp = search_config($this->config->data,"faiManagement","CLASS");
+ if(!empty($tmp)){
+ return(true);
+ }
+ return(false);
+ }
+
+ /* 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() {}
+ function show_header($button_text, $text, $disabled= FALSE) {}
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/plugins/admin/mimetypes/generic.tpl b/plugins/admin/mimetypes/generic.tpl
--- /dev/null
@@ -0,0 +1,131 @@
+<table style="width:100%">
+ <tr>
+ <td colspan="2">
+ <h2><img src='images/head.png' class='center'> {t}Generic{/t}</h2>
+ </td>
+ </tr>
+ <tr>
+ <td style='width:50%; vertical-align:top;' >
+
+ <table>
+ <tr>
+ <td>
+ {t}Mime type{/t}
+ </td>
+ <td>
+ <input type="text" name='cn' value="{$cn}" {$cnACL} title='{t}Please enter a name for the mime type here{/t}'>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ {t}Mime group{/t}
+ </td>
+ <td>
+ <select name='gotoMimeGroup' {$gotoMimeGroupACL} title='{t}Categorize this mime type{/t}'>
+ {html_options output=$gotoMimeGroups values=$gotoMimeGroups selected=$gotoMimeGroup}
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ {t}Description{/t}
+ </td>
+ <td>
+ <input type="text" name='description' value="{$description}" {$descriptionACL} title='{t}Please sepecify a description{/t}'>
+ </td>
+ </tr>
+ </table>
+
+ </td>
+ <td style="border-left:1px solid #A0A0A0;vertical-align:top;">
+ <table summary="">
+ <tr>
+ <td>
+ <LABEL for="picture_file">{t}Icon{/t}</LABEL><br>
+ <img src="{$gotoMimeIcon}" border=1 style="width:48px; height:48; background-color:white; vertical-align:bottom;">
+ </td>
+ <td style="vertical-align:top">
+ <br>
+ <input type="hidden" name="MAX_FILE_SIZE" value="100000">
+ <input name="picture_file" type="file" size="20" maxlength="255" accept="image/*.png" id="picture_file" {$gotoMimeIconACL}>
+ <input type="submit" name="update_icon" value="{t}Update{/t}" title="{t}Update mime type icon{/t}" {$gotoMimeIconACL}>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2">
+ <p class='seperator'> </p>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2">
+ <h2><img src='images/mime_leftclick.png' class='center'> {t}Left click{/t}</h2>
+ </td>
+ </tr>
+ <tr>
+ <td style='width:50%; vertical-align:top;' >
+ {t}File patterns{/t}
+ {$gotoMimeFilePatterns}
+ <br>
+ <input type='text' name='NewFilePattern' value='' title='{t}Please specify a new file pattern{/t}' {$gotoMimeFilePatternACL}>
+ <input type='submit' name='AddNewFilePattern' value='{t}Add{/t}' title='{t}Add a new file pattern{/t}' {$gotoMimeFilePatternACL}>
+ </td>
+ <td style="border-left:1px solid #A0A0A0;vertical-align:top;">
+ {t}Applications{/t}
+ {$gotoMimeApplications}
+ <br>
+ <input type='text' name='NewApplication' value='' title='{t}Enter an application name here{/t}' {$gotoMimeApplicationACL}>
+ <input type='submit' name='AddNewApplication' value='{t}Add{/t}' title='{t}Add application{/t}' {$gotoMimeApplicationACL}>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2">
+ <p class='seperator'> </p>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2">
+ <h2><img src='images/mime_embedding.png' class='center'> {t}Embedding{/t}</h2>
+ </td>
+ </tr>
+ <tr>
+ <td style='width:50%; vertical-align:top;' >
+
+ <table>
+ <tr>
+ <td style='vertical-align:top; '>
+ <input type='radio' name='gotoMimeLeftClickAction_IE' value='I'
+ {if $gotoMimeLeftClickAction_I} checked {/if} {$gotoMimeLeftClickActionACL}>
+ {t}Show file in embedded viewer{/t}
+ <br>
+
+ <input type='radio' name='gotoMimeLeftClickAction_IE' value='E'
+ {if $gotoMimeLeftClickAction_E} checked {/if} {$gotoMimeLeftClickActionACL}>
+ {t}Show file in external viewer{/t}
+ <br>
+
+ <input type='checkbox' name='gotoMimeLeftClickAction_Q' value='1'
+ {if $gotoMimeLeftClickAction_Q} checked {/if} {$gotoMimeLeftClickActionACL}>
+ {t}Ask wheter to save to local disk{/t}
+ </td>
+ </tr>
+ </table>
+
+ </td>
+ <td style="border-left:1px solid #A0A0A0;vertical-align:top;">
+ {t}Applications{/t}
+ {$gotoMimeEmbeddedApplications}
+ <br>
+ <input type='text' name='NewEmbeddedApplication' value='' title='{t}Enter an application name here{/t}' {$gotoMimeEmbeddedApplicationACL}>
+ <input type='submit' name='AddNewEmbeddedApplication' value='{t}Add{/t}' title='{t}Add application{/t}' {$gotoMimeEmbeddedApplicationACL}>
+ </td>
+ </tr>
+</table>
+<input type="hidden" name="MimeGeneric" value="1">
+
+
+
+
+
diff --git a/plugins/admin/mimetypes/main.inc b/plugins/admin/mimetypes/main.inc
--- /dev/null
@@ -0,0 +1,49 @@
+<?php
+/*
+ This code is part of GOsa (https://gosa.gonicus.de)
+ Copyright (C) 2003 Cajus Pollmeier
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+
+/* Create MimeTypeManagement object on demand */
+if (!isset($_SESSION['MimeTypeManagement']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){
+ $_SESSION['MimeTypeManagement']= new mimetypeManagement ($config, $_SESSION['ui']);
+}
+
+/* Get object */
+$MimeTypeManagement= $_SESSION['MimeTypeManagement'];
+$MimeTypeManagement->save_object();
+$output= $MimeTypeManagement->execute();
+
+/* Page header*/
+if (isset($_SESSION['objectinfo'])){
+ $display= print_header(get_template_path('images/mimetypes.png'), _("Mimetype management"), "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png')."\"> ".@LDAP::fix($_SESSION['objectinfo']));
+} else {
+ $display= print_header(get_template_path('images/application.png'), _("Mimetype management"));
+}
+
+/* Reset requested? */
+if (isset($_GET['reset']) && $_GET['reset'] == 1){
+ del_lock ($ui->dn);
+ sess_del ('MimeTypeManagement');
+}
+
+/* Show and save dialog */
+$display.= $output;
+$_SESSION['MimeTypeManagement']= $MimeTypeManagement;
+
+?>
diff --git a/plugins/admin/mimetypes/paste_generic.tpl b/plugins/admin/mimetypes/paste_generic.tpl
--- /dev/null
@@ -0,0 +1,31 @@
+<table style="width:100%">
+ <tr>
+ <td colspan="2">
+ <h2><img src='images/head.png' class='center'> {t}Generic{/t}</h2>
+ </td>
+ </tr>
+ <tr>
+ <td style='width:50%; vertical-align:top;' >
+
+ <table>
+ <tr>
+ <td>
+ {t}Mime type{/t}
+ </td>
+ <td>
+ <input type="text" name='cn' value="{$cn}" title='{t}Please enter a name for the mime type here{/t}'>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ {t}Description{/t}
+ </td>
+ <td>
+ <input type="text" name='description' value="{$description}" title='{t}Please sepecify a description for this mime type here{/t}'>
+ </td>
+ </tr>
+ </table>
+
+ </td>
+ </tr>
+</table>
diff --git a/plugins/admin/mimetypes/release_select.tpl b/plugins/admin/mimetypes/release_select.tpl
--- /dev/null
@@ -0,0 +1,16 @@
+<br>
+<div class="contentboxh" style="border-bottom:1px solid #B0B0B0;">
+ <p class="contentboxh"><img src="{$branchimage}" align="right" alt="[F]">{t}Branches{/t}</p>
+</div>
+<div class="contentboxb">
+ <table summary="" style="width:100%;">
+ <tr>
+ <td>
+ {t}Current release{/t}
+ <select name="selectedRelease" onChange="document.mainform.submit();">
+ {html_options options=$releases selected=$selectedRelease}
+ </select>
+ </td>
+ </tr>
+ </table>
+</div>
diff --git a/plugins/admin/mimetypes/remove.tpl b/plugins/admin/mimetypes/remove.tpl
--- /dev/null
@@ -0,0 +1,17 @@
+<div style="font-size:18px;">
+ <img alt="" src="images/button_cancel.png" align=top> {t}Warning{/t}
+</div>
+<p>
+ {$intro}
+ {t}This may be used by several groups. Please double check if your really want to do this since there is no way for GOsa to get your data back.{/t}
+</p>
+<p>
+ {t}So - if you're sure - press 'Delete' to continue or 'Cancel' to abort.{/t}
+</p>
+
+<p class="plugbottom">
+ <input type=submit name="delete_mime_confirm" value="{t}Delete{/t}">
+
+ <input type=submit name="delete_cancel" value="{t}Cancel{/t}">
+</p>
+
diff --git a/plugins/admin/mimetypes/tabs_mimetypes.inc b/plugins/admin/mimetypes/tabs_mimetypes.inc
--- /dev/null
@@ -0,0 +1,61 @@
+<?php
+
+class mimetabs extends tabs
+{
+ var $Release= "";
+
+ function mimetabs($config, $data, $dn)
+ {
+ tabs::tabs($config, $data, $dn);
+ }
+
+ function set_release($newRelease)
+ {
+ $this->Release= preg_replace('/,ou=mime,.*$/', '', $newRelease);
+ if ($this->Release != ""){
+ $this->Release= ",".$this->Release;
+ }
+ }
+
+ function save()
+ {
+ $baseobject= $this->by_object['mimetype'];
+
+ /* Check for new 'dn', in order to propagate the
+ 'dn' to all plugins */
+ $tmp = search_config($this->config->data,"faiManagement","CLASS");
+
+ if((!empty($tmp)) && (isset($_SESSION['mimefilter']['release']))){
+ if(!$baseobject->isReleaseMimeType){
+ $new_dn= "cn=".$baseobject->cn.",ou=mime,".$baseobject->base;
+ }else{
+ $new_dn ="cn=".$baseobject->cn.",".$_SESSION['mimefilter']['release'];
+ }
+ }else{
+ $new_dn= "cn=".$baseobject->cn.",ou=mime,".$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();
+
+ /* Fix tagging if needed */
+ $baseobject->dn= $this->dn;
+ $baseobject->handle_object_tagging();
+ $this->by_object['mimetype'] = $baseobject;
+ }
+
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>