summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 344e91a)
raw | patch | inline | side by side (parent: 344e91a)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 15 Apr 2008 10:36:06 +0000 (10:36 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 15 Apr 2008 10:36:06 +0000 (10:36 +0000) |
-Removed Base selector
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@10458 594d385d-05f5-0310-b6e9-bd551577e9d8
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@10458 594d385d-05f5-0310-b6e9-bd551577e9d8
diff --git a/gosa-plugins/goto/admin/applications/class_applicationManagement.inc b/gosa-plugins/goto/admin/applications/class_applicationManagement.inc
index d144f45c3d9a9e179bd59a8f970e91a92e6b287c..83c870da17c6137e74b62cee7b90e61a0ccd0623 100644 (file)
var $enableReleaseManagement = false;
var $start_pasting_copied_objects = FALSE;
+ var $app_base ="";
+ var $app_release ="";
+
function IsReleaseManagementActivated()
{
/* Check if we should enable the release selection */
if(!empty($tmp)){
return(true);
}
- return(false);
}
+
function applicationManagement (&$config, &$ui)
{
/* Save configuration for internal use */
/* Hide SubSearch checkbox */
$this->DivListApplication->DisableCheckBox("SubSearch");
}
+
+ /* Set default release */
+ if(!$this->IsReleaseManagementActivated()){
+ $this->app_base = get_ou("applicationou").$this->config->current['BASE'];
+ if(!session::is_set("app_filter")){
+ session::set("app_filter",array("app_base" => $this->app_base));
+ }
+ $app_filter = session::get("app_filter");
+ $this->app_base = $app_filter['app_base'];
+ }else{
+ $this->app_base = get_ou("applicationou").$this->config->current['BASE'];
+ if(!session::is_set("app_filter")){
+ session::set("app_filter",array("app_base" => $this->app_base,"app_release" => $this->app_base));
+ }
+ $app_filter = session::get("app_filter");
+ $this->app_base = $app_filter['app_base'];
+ $this->app_release = $app_filter['app_release'];
+ }
+ $this->app_base = "ou=apps,ou=Direktorium,o=Landeshauptstadt München,c=de";
+ $this->app_release= $this->app_base;
}
- 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"));
+ function getReleases()
+ {
+ $ldap = $this->config->get_ldap_link();
+ $ret = array();
+ $base = $this->app_base;
+ $ret[$this->app_base] = "/";
+ $ldap->cd($base);
+ $ldap->search("(&(objectClass=organizationalUnit)(objectClass=FAIbranch))",array("ou"));
while($attrs = $ldap->fetch()){
- $str = str_replace($dn,"",$attrs['dn']);
+ $str = str_replace($base,"",$attrs['dn']);
$tmp = array_reverse( split("ou=",$str));
$str = "";
foreach($tmp as $val){
/* 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);
+ $this->apptabs->parent = &$this;
+ $this->apptabs->set_acl_base($this->app_base);
}
if (count($message) == 0){
/* Save data data to ldap */
- $this->apptabs->set_release($this->DivListApplication->selectedRelease);
$this->apptabs->save();
if (!isset($_POST['edit_apply'])){
/* Register apptabs to trigger edit dialog */
$this->apptabs= new apptabs($this->config,$this->config->data['TABS']['APPSTABS'], $this->dn,"application");
+ $this->apptabs->parent = &$this;
$this->apptabs->set_acl_base($this->dn);
session::set('objectinfo',$this->dn);
}
/* Delete request is permitted, perform LDAP action */
$this->apptabs= new apptabs($this->config, $this->config->data['TABS']['APPSTABS'], $dn,"application");
+ $this->apptabs->parent = &$this;
$this->apptabs->set_acl_base($dn);
$this->apptabs->delete ();
unset ($this->apptabs);
/* Delete request is permitted, perform LDAP action */
$this->apptabs= new apptabs($this->config, $this->config->data['TABS']['APPSTABS'], $this->dn,"application");
+ $this->apptabs->parent = &$this;
$this->apptabs->set_acl_base($this->dn);
$this->apptabs->delete ();
unset ($this->apptabs);
****************/
/* Check if there is a snapshot dialog open */
- $base = $this->DivListApplication->selectedBase;
- if($str = $this->showSnapshotDialog($base,$this->get_used_snapshot_bases($base))){
+ if($this->IsReleaseManagementActivated()){
+ $base = $this->app_release;
+ }else{
+ $base = $this->app_base;
+ }
+ if($str = $this->showSnapshotDialog($base,$this->get_used_snapshot_bases())){
return($str);
}
/* Display dialog with system list */
$this->DivListApplication->parent = $this;
$this->DivListApplication->execute();
- $this->DivListApplication->AddDepartments($this->DivListApplication->selectedBase,3,1);
+ if(!$this->IsReleaseManagementActivated()){
+ $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));
+ function get_used_snapshot_bases()
+ {
+ if($this->IsReleaseManagementActivated()){
+ return(array($this->app_release));
}else{
- return(array($this->DivListApplication->selectedRelease));
+ return(array($this->app_base));
}
}
$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;
+ if(!$this->IsReleaseManagementActivated()){
+ $use_base = $this->app_base;
}else{
- if(isset($Releases[$release])){
- $use_base = $release;
- }else{
- $use_base = get_ou('applicationou').$base;
- }
+ $use_base = $this->app_release;
}
if($SubSearch){
/* Get dialog */
- $this->CopyPasteHandler->SetVar("base",$this->DivListApplication->selectedBase);
+ $this->CopyPasteHandler->SetVar("base",$this->app_base);
+ $this->CopyPasteHandler->SetVar("parent",&$this);
$data = $this->CopyPasteHandler->execute();
/* Return dialog data */
if(is_object($this->CopyPasteHandler)){
$this->CopyPasteHandler->save_object();
}
+
+ if($this->IsReleaseManagementActivated() && isset($_POST['app_release'])){
+ $sel_rel = get_post('app_release');
+ $releases = array_flip($this->getReleases());
+ if(isset($releases[$sel_rel])){
+ $this->app_release = $releases[$sel_rel];
+ }
+ }elseif(!$this->IsReleaseManagementActivated()){
+ $this->app_base = get_ou("applicationou").$this->DivListApplication->selectedBase;
+ }
}
function check() {}
diff --git a/gosa-plugins/goto/admin/applications/class_divListApplication.inc b/gosa-plugins/goto/admin/applications/class_divListApplication.inc
index 1fc03c02a9104ebe069b08aee9b00fd2a373fbc7..0ffdec859d6c3913b18d4a5261fe98bfb128e60c 100644 (file)
class divListApplication extends MultiSelectWindow
{
/* Current base */
- var $selectedBase = "";
- var $selectedRelease = "main";
- var $AvailableReleases = array();
var $departments = array();
var $parent ;
var $ui ;
/* Subsearch checkbox */
var $SubSearch;
-
- var $SaveAdditionalVars = array("selectedRelease");
+ var $selectedBase ="";
function divListApplication (&$config,&$parent)
{
MultiSelectWindow::MultiSelectWindow($config,"Application", "application");
-
- $this->selectedRelease = get_ou('applicationou').session::get('CurrentMainBase');
-
+
$this->parent = &$parent;
$this->ui = get_userinfo();
$this->AddRegex ("Regex", _("Display users matching"),"*" , true);
}
- function AddUserBoxToFilter($position){
+
+ function AddUserBoxToFilter($position)
+ {
$str = "";
if(($position == 2) && ($this->parent->IsReleaseManagementActivated($this->config))){
$smarty = get_smarty();
- $smarty->assign("selectedRelease",$this->selectedRelease);
+ $releases = $this->parent->getReleases();
+ $smarty->assign("app_release" , $releases[$this->parent->app_release]);
+ $smarty->assign("app_base" , $releases[$this->parent->app_base]);
$smarty->assign("branchimage","images/branch.png");
- $smarty->assign("releases",$this->AvailableReleases);
+ $smarty->assign("app_releases", $releases);
$str = $smarty->fetch(get_template_path('release_select.tpl', TRUE));
}
return($str);
}
+
function GenHeader()
{
/* Prepare departments,
*/
$options= "";
- /* Get all departments within this subtree */
- $base = $this->config->current['BASE'];
+ /* Add default header */
+ $listhead = MultiSelectWindow::get_default_header();
+
+ if(!$this->parent->IsReleaseManagementActivated()){
+
+ /* 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));
+ /* 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'];
- }
+ $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'];
- }
+ /* 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.= "<option selected='selected' value='".$dep."'>$value</option>";
- } else {
- $options.= "<option value='".$dep."'>$value</option>";
+ $value = $ids[$dep];
+ if ($this->selectedBase == $dep){
+ $found = TRUE;
+ $options.= "<option selected='selected' value='".$dep."'>$value</option>";
+ } else {
+ $options.= "<option value='".$dep."'>$value</option>";
+ }
}
}
- }
- /* The currently used base is not visible with your acl setup.
- * Set base to first useable base.
- */
- if(!$found){
- $this->selectedBase = $first;
+ /* The currently used base is not visible with your acl setup.
+ * Set base to first useable base.
+ */
+ if(!$found){
+ $this->selectedBase = $first;
+ }
+
+
+ /* And the rest, a base selection box */
+ $listhead .= _("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")."'> ";
}
/* 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")." <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")."'> ";
+ $acl = $ui->get_permissions("cn=dummy,".$this->parent->app_base,"application/application");
+ $acl_all = $ui->has_complete_category_acls($this->parent->app_base,"application");
/* Create Layers menu */
$s = ".|"._("Actions")."|\n";
$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)
{
/********************
{
/* Save automatic created POSTs like regex, checkboxes */
MultiSelectWindow::save_object();
- $appfilter = session::get('appfilter');
- $appfilter['release'] = $this->selectedRelease;
- session::set('appfilter',$appfilter);
}
}
diff --git a/gosa-plugins/goto/admin/applications/release_select.tpl b/gosa-plugins/goto/admin/applications/release_select.tpl
index d864cebcf5243f4176582740bbc3ebcd0a2f3914..4a8cee26830f2293e1ba6066ba2ae9974a10e61e 100644 (file)
<tr>
<td>
{t}Current release{/t}
- <select name="selectedRelease" onChange="document.mainform.submit();">
- {html_options options=$releases selected=$selectedRelease}
+ <select name="app_release" onChange="document.mainform.submit();">
+ {html_options output=$app_releases values=$app_releases selected=$app_release}
</select>
</td>
</tr>
diff --git a/gosa-plugins/goto/admin/applications/tabs_application.inc b/gosa-plugins/goto/admin/applications/tabs_application.inc
index 5b6e82989e9129b09615e9bd925f06f9a4bd92b8..9636c44db90d962227ea0a6d56f69d6410b6872d 100644 (file)
class apptabs extends tabs
{
- var $Release= "";
+ var $parent = FALSE;
function apptabs($config, $data, $dn,$category)
{
$this->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'];
- }
+ if($this->parent->IsReleaseManagementActivated()){
+ $new_dn= "cn=".$baseobject->cn.",".$this->parent->app_release;
}else{
$new_dn= "cn=".$baseobject->cn.",".get_ou('applicationou').$baseobject->base;
}