diff --git a/gosa-plugins/goto/admin/groups/apps/class_groupApplication.inc b/gosa-plugins/goto/admin/groups/apps/class_groupApplication.inc
index a4396270b35a5e43fbbc1196271d1a8ec661e938..29a6d540fa80ab2627a8b1f0c07a37ca2af47814 100644 (file)
if($this->enableReleaseManagement){
/* Only display those releases that we are able to read */
- $dn = $this->config->current['BASE'];
+ $dn = get_ou("applicationou").$this->config->current['BASE'];
$filter = "(&(objectClass=organizationalUnit)(objectClass=FAIbranch))";
$res = get_sub_list($filter,array("application","fai"), array(get_ou("applicationou"),get_ou("faiou")),$dn, array("ou","FAIstate"), GL_SUBSEARCH);
}
}elseif(in_array("gotoMenuEntry",$attrs['objectClass'])){
+
$type = "ENTRY";
$data['INFO'] = "";
$data['PARAMETER'] = array();
if(isset($attrs['gosaApplicationParameter'])){
for($p = 0 ; $p < $attrs['gosaApplicationParameter']['count'] ; $p ++){
- $tmp = split(":",$attrs['gosaApplicationParameter'][$p]);
- $data['PARAMETER'][$tmp[0]] = $tmp[1];
+ if(preg_match("/:/",$attrs['gosaApplicationParameter'][$p])){
+ $tmp = split(":",$attrs['gosaApplicationParameter'][$p]);
+ $data['PARAMETER'][$tmp[0]] = $tmp[1];
+ }elseif($attrs['gosaApplicationParameter'][$p] == "*separator*"){
+ $type = "SEPERATOR";
+ $data['PARAMETER'] = array();
+ break;
+ }
}
}
}elseif(in_array("FAIbranch",$attrs['objectClass'])){
}
}
+ $data['LDAP_ATTRS'] = $attrs;
$data['DN'] = $attrs['dn'];
$data['NAME'] = $name;
$data['TYPE'] = $type;
/* Call parent execute */
plugin::execute();
+ if(isset($_GET['r'])) $this->__construct($this->config,$this->dn);
+
if (isset($_POST['modify_state'])){
$this->is_account = !$this->is_account;
}
/* Do we represent a valid account? */
if (!$this->is_account){
- $display= $this->show_enable_header(_("Add application extension"),
- msgPool::featuresDisabled(_("application")));
+ $display= $this->show_disable_header(msgPool::addFeaturesButton(_("Menu")), msgPool::featuresDisabled(_("Menu")));
return ($display);
}
- $display = $this->show_enable_header(_("Remove application extension"),
- msgPool::featuresEnabled(_("application")));
+ $display= $this->show_disable_header(msgPool::removeFeaturesButton(_("Menu")), msgPool::featuresEnabled(_("Menu")));
if(isset($_GET['send'])){
$id = $_GET['send'];
/* Append departments for current base */
foreach($departments as $key => $app){
$div->AddEntry(array(
- array("string"=>"<img class='center' src='images/folder.png' alt='"._("department")."'> ".sprintf($linkopen,
+ array("string"=>"<img class='center' src='images/lists/folder.png' alt='"._("department")."'> ".sprintf($linkopen,
base64_encode($key),$app),
"attach"=>"style='border:0px;'")
));
}
}
}
+
+ /* Add seperator */
+ if(isset($_POST['add_seperator']) && isset($_POST['menu_folder'])){
+ $folder = $_POST['menu_folder'];
+ $this->_add_seperator($folder);
+ }
+
if(isset($_POST['add_menu_to_folder']) && isset($_POST['menu_folder'])){
$folder = $_POST['menu_folder'];
$name = $_POST['menu_folder_name'];
/* !\brief Remove the given id from the menu structure.
- @param String ID to of the entry we want to remove.
- @return Boolean TRUE on success
+ @param String ID to of the entry we want to remove.
+ @return Boolean TRUE on success
*/
function _add_entry($folder_id,$entry,$pos = 0)
{
$entry['PARENT'] = $folder_id;
$entry['ENTRIES']= array();
$entry['STATUS'] = "ADDED";
-
+
$cnt = 0;
$new = array();
$added =FALSE;
- if($obj['STATUS'] == "LOADED"){
- $obj['STATUS'] = "EDITED";
+ foreach($folder['ENTRIES'] as $key => $obj){
+ if($obj['STATUS'] == "LOADED"){
+ $obj['STATUS'] = "EDITED";
+ }
+ if($pos == $cnt){
+ $new[] = $entry;
+ $added = TRUE;
+ }
+ $cnt ++;
+ $new[] = $obj;
}
- if($pos == $cnt){
+ if(!$added){
$new[] = $entry;
- $added = TRUE;
}
- $cnt ++;
- $new[] = $obj;
- }
- if(!$added){
- $new[] = $entry;
- }
-
- $all[$folder_id]['ENTRIES'] = $new;
- foreach($entries as $sub){
- $this->_add_entry($entry['UNIQID'],$sub,-1);
+
+ $all[$folder_id]['ENTRIES'] = $new;
+ foreach($entries as $sub){
+ $this->_add_entry($entry['UNIQID'],$sub,-1);
+ }
+ return(TRUE);
}
- return(TRUE);
+ return(FALSE);
}
}
+ /*! \brief Add the application identified by $app_id to folder $folder_id
+ @param String folder_id The UNIQID of the folder where we want to add the new folder.
+ @param Integer app_id The ID of the application which should be added.
+ */
+ function _add_seperator($folder_id)
+ {
+ $all = $this->_get_all_entries();
+ if($folder_id == "BASE"){
+ $folder_id = $this->_get_release_key($this->FAIrelease);
+ }
+
+ if(isset($all[$folder_id])){
+ $new = array();
+ $new['TYPE'] = "SEPERATOR";
+ $new['NAME'] = "SEPERATOR";
+ $new['UNIQID']= uniqid();
+ $new['PARENT']= $folder_id;
+ $new['PARAMETER']= array();
+ $new['STATUS']= "ADDED";
+ $all[$folder_id]['ENTRIES'][] = $new;
+ }
+ }
+
+
/*! \brief Return all entries linear.
@param Boolean $add_tags If TRUE, OPEN/CLOSE Tags will be appended.
@param &Array Start here, Pointer to an array.
$prio = 0;
$Actions = array("Remove" => array(),"Edit" => array() , "Add" => array());
+ $sep_id = 0;
foreach($all as $entry){
$prio ++;
$cur = $entry;
$dn = "";
do{
- if($cur['TYPE'] == "ENTRY"){
+ if($cur['TYPE'] == "SEPERATOR"){
+ $sep_id ++;
+ $dn.= "cn=seperator_".$sep_id.",";
+ }elseif($cur['TYPE'] == "ENTRY"){
$dn.= "cn=".$cur['NAME'].",";
}elseif($cur['TYPE'] == "FOLDER"){
$dn.= "cn=".$cur['NAME'].",";
$cur_dn = $dn.$this->dn;
$attrs = array();
+
switch($entry['TYPE']){
+ case "SEPERATOR" :
+ {
+ $attrs['objectClass'] = array("gotoMenuEntry");
+ $attrs['cn'] = "seperator_".$sep_id;
+ $attrs['gosaApplicationPriority'] = $prio;
+ $attrs['gosaApplicationParameter'] = "*separator*";
+ }
+ break;
case "ENTRY" :
{
- $attrs['objectClass'] = "gotoMenuEntry";
+ $attrs['objectClass'] = array("gotoMenuEntry");
$attrs['cn'] = $entry['NAME'];
$attrs['gosaApplicationPriority'] = $prio;
$attrs['gosaApplicationParameter'] = array();
break;
case "FOLDER" :
{
- $attrs['objectClass'] = "gotoSubmenuEntry";
+ $attrs['objectClass'] = array("gotoSubmenuEntry");
$attrs['cn'] = $entry['NAME'];
$attrs['gosaApplicationPriority'] = $prio;
if($entry['STATUS'] != "ADDED"){
}
break;
case "RELEASE" :
- {
+ {
$attrs['ou'] = $entry['NAME'];
$attrs['objectClass'] = array();
$attrs['objectClass'][] = "top";
}
break;
}
-
+
+ /* Append missing ObjectClasses, ... Tagging */
+ if(isset($entry['LDAP_ATTRS'])){
+ for($i = 0 ; $i < $entry['LDAP_ATTRS']['objectClass']['count']; $i ++){
+ $oc = $entry['LDAP_ATTRS']['objectClass'][$i];
+ if(!in_array($oc,$attrs['objectClass'])){
+ $attrs['objectClass'][] = $oc;
+ }
+ }
+ }
+
if($entry['STATUS'] == "LOADED"){
continue;
}
if($entry['STATUS'] == "REMOVED"){
- $Actions['Remove'][$cur_dn] = $cur_dn;
+ if(isset($entry['DN'])){
+ $Actions['Remove'][$entry['DN']] = $entry['DN'];
+ }else{
+ $Actions['Remove'][$cur_dn] = $cur_dn;
+ }
}
if($entry['STATUS'] == "EDITED"){
$Actions['Edit'][$cur_dn] = $attrs;
}
}
}
+
$this->_load_menu_structure();
}