From 7bea618e1978c5b2887734d86b6187d62aeb9137 Mon Sep 17 00:00:00 2001 From: hickert Date: Thu, 29 Nov 2007 07:47:28 +0000 Subject: [PATCH] Closes #280 Made applications selectable in mime generic git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7928 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../admin/mimetypes/class_mimetypeGeneric.inc | 43 ++++++++++++++++--- plugins/admin/mimetypes/generic.tpl | 13 ++++++ 2 files changed, 49 insertions(+), 7 deletions(-) diff --git a/plugins/admin/mimetypes/class_mimetypeGeneric.inc b/plugins/admin/mimetypes/class_mimetypeGeneric.inc index c96097586..38b695e98 100644 --- a/plugins/admin/mimetypes/class_mimetypeGeneric.inc +++ b/plugins/admin/mimetypes/class_mimetypeGeneric.inc @@ -26,6 +26,8 @@ class mimetype extends plugin 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 */ @@ -73,6 +75,15 @@ class mimetype extends plugin } } + /* 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; @@ -247,20 +258,36 @@ class mimetype extends plugin } /* Add gotoMimeFilePattern */ - if(isset($_POST['AddNewApplication']) && isset($_POST['NewApplication'])){ + if(isset($_POST['AddNewApplication']) && + (isset($_POST['NewApplication']) || isset($_POST['NewApplicationSelect']))){ if($this->acl_is_writeable("gotoMimeApplication")){ - $str = $_POST['NewApplication']; - if(!empty($str)){ + $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 gotoMimeFilePattern */ - if(isset($_POST['AddNewEmbeddedApplication']) && isset($_POST['NewEmbeddedApplication'])){ + /* 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 = $_POST['NewEmbeddedApplication']; - if(!empty($str)){ + $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; } } @@ -332,6 +359,8 @@ class mimetype extends plugin $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); diff --git a/plugins/admin/mimetypes/generic.tpl b/plugins/admin/mimetypes/generic.tpl index 06556cf4b..1cb6d7549 100644 --- a/plugins/admin/mimetypes/generic.tpl +++ b/plugins/admin/mimetypes/generic.tpl @@ -113,6 +113,13 @@ {render acl=$gotoMimeApplicationACL} {$gotoMimeApplications} {/render} + +{render acl=$gotoMimeApplicationACL} + +{/render} {render acl=$gotoMimeApplicationACL} {/render} @@ -166,6 +173,12 @@ {render acl=$gotoMimeEmbeddedApplicationACL} {$gotoMimeEmbeddedApplications} {/render} +{render acl=$gotoMimeEmbeddedApplicationACL} + +{/render} {render acl=$gotoMimeEmbeddedApplicationACL} -- 2.30.2