summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2a2e91a)
raw | patch | inline | side by side (parent: 2a2e91a)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 14 Apr 2008 13:31:39 +0000 (13:31 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 14 Apr 2008 13:31:39 +0000 (13:31 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@10424 594d385d-05f5-0310-b6e9-bd551577e9d8
19 files changed:
diff --git a/gosa-plugins/fai/admin/fai/branch_selector.tpl b/gosa-plugins/fai/admin/fai/branch_selector.tpl
index 67d4d0b4f888a8779f506bd06a02af01db3677c7..b5bac4656b64fe5a3c5782dfcb85f1410d394584 100644 (file)
<tr>
<td>
{t}Current release{/t}
- <select name="selectedBranch" onChange="document.mainform.submit();">
- {html_options options=$branches selected=$selectedBranch}
+ <select name="fai_release" onChange="document.mainform.submit();">
+ {html_options output=$fai_releases values=$fai_releases selected=$fai_release}
</select>
</td>
</tr>
{t}Create new locked branch{/t}
{/if}
- {if $selectedBranch != "main" && $allow_remove}
+ {if $fai_release != $fai_base && $allow_remove}
<br>
<input class="center" type="image" name="remove_branch" src="images/lists/trash.png">
<a href="?plug={$plug_id}&act=remove_branch">{t}Delete current release{/t}</a>
{/if}
</td>
</tr>
- </table>
+ </table>
</div>
<br>
diff --git a/gosa-plugins/fai/admin/fai/class_askClassName.inc b/gosa-plugins/fai/admin/fai/class_askClassName.inc
index cde5eb96604a8d5a009b8b7ce150d78d8e171414..e409a868f98ac9015aad5d11f8a6ad9d90ddf2b5 100644 (file)
var $forbidden = array();
var $ClassName = "";
var $ClassAlreadyExists = false;
+ var $parent;
function askClassName (&$config,$dn,$ui,$objectClass)
{
$this->ui = $ui;
$this->objectClass = $objectClass;
plugin::plugin ($config, $dn);
- if(!session::is_set('CurrentMainBase')){
- session::set('CurrentMainBase',$this->config->current['BASE']);
- }
}
function execute()
$smarty = get_smarty();
$display= "";
- /* The faifilter contais
- * The base for all fai objects
- */
- $faifilter = session::get('faifilter');
-
/* First search for every ou, in given fai base
* With a second search detect all object that belong to the different ous.
*/
- $base = get_ou('faiou').session::get('CurrentMainBase');
- if($faifilter['branch'] != "main"){
- $base = $faifilter['branch'];
- }
+ $base = $this->parent->fai_release;
$ldap = $this->config->get_ldap_link();
-
$type_acl_mapping = array(
"FAIpartitionTable" => "faiPartitionTable",
- "FAIpackageList" => "faiPackage",
+ "FAIpackageList" => "faiPackageList",
"FAIscript" => "faiScript",
"FAIvariable" => "faiVariable",
"FAIhook" => "faiHook",
diff --git a/gosa-plugins/fai/admin/fai/class_divListFai.inc b/gosa-plugins/fai/admin/fai/class_divListFai.inc
index 2252fd92eca9c71211b60d3bbc09b29abc38f4c3..78009204429adc3ef0c8a940e663d593aa71385a 100644 (file)
class divListFai extends MultiSelectWindow
{
- /* Current base */
- var $selectedBase = "";
- var $selectedBranch = "main";
- var $AvailableBranches = array();
- var $departments = array();
-
/* Regex */
var $Regex = "*";
var $ShowProfiles;
var $parent ;
var $ui ;
- var $SaveAdditionalVars = array("selectedBranch");
-
function divListFai (&$config,$parent)
{
MultiSelectWindow::MultiSelectWindow($config, "Fai", "fai");
$this->parent = $parent;
$this->ui = get_userinfo();
- /* Set default base */
- if(!session::is_set('CurrentMainBase')){
- session::set('CurrentMainBase',$this->config->current['BASE']);
- }
- $this->selectedBase = session::get('CurrentMainBase');
-
/* Set list strings */
- $this->SetTitle(_("List of classes"));
+ $this->SetTitle( _("List of classes"));
$this->SetSummary(_("List of deployment classes and packages"));
/* Result page will look like a headpage */
/* Dynamic action col, depending on snapshot icons */
$action_col_size = 120;
-# if($this->parent->snapshotEnabled()){
-# $action_col_size += 32;
-# }
/* Toggle all selected / deselected */
$chk = "<input type='checkbox' id='select_all' name='select_all'
$c = $this->config->search("faiManagement", "POSTCREATE",array('menu','tabs'));
$smarty = get_smarty();
+ $releases = $this->parent->getBranches();
$smarty->assign("allow_create", $c);
$smarty->assign("allow_remove", $r);
- $smarty->assign("selectedBranch",$this->selectedBranch);
+ $smarty->assign("fai_release" , $releases[$this->parent->fai_release]);
+ $smarty->assign("fai_base" , $releases[$this->parent->fai_base]);
$smarty->assign("branchimage","images/branch.png");
- $smarty->assign("branches",$this->AvailableBranches);
+ $smarty->assign("fai_releases", $releases);
$plug_id = 0;
if(isset($_GET['plug'])){
$plug_id = $_GET['plug'];
function GenHeader()
{
- /* Prepare departments,
- which are shown in the listbox on top of the listbox
- */
- $options= "";
-
/* Get all departments within this subtree */
$ui= get_userinfo();
$first = "";
$found = FALSE;
$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));
-
- $deps = array();
- foreach($tmp as $tm){
- $deps[$tm['dn']] = $tm['dn'];
- }
-
- /* Load possible departments */
- $ui= get_userinfo();
- $tdeps= $ui->get_module_departments("fai");
- $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>";
- }
- }
- }
-
- /* The currently used base is not visible with your acl setup.
- * Set base to first useable base.
- */
- if(!$found){
- $this->selectedBase = $first;
- }
-
/* Add seperator */
$add_sep = false;
/* Get complete fai acls, to be able to check if we must show or hide the snapshot abilities */
- $acl_all = $ui->has_complete_category_acls($this->selectedBase,$this->module);
+ $acl_all = $ui->has_complete_category_acls($this->parent->fai_base,$this->module);
/* Add default header */
$listhead = MultiSelectWindow::get_default_header();
$listhead .=" <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'> ";
}
- $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")."'> ";
-
-
$s = ".|"._("Actions")."|\n";
$s .= "..|<img src='images/list_new.png' alt='' border='0' class='center'>".
" "._("Create")."|\n";
- $acl = $ui->get_permissions($this->selectedBase,"fai/faiProfile");
+ $acl = $ui->get_permissions($this->parent->fai_base,"fai/faiProfile");
if(preg_match("/c/",$acl)){
$s.= "...|<input class='center' type='image' src='images/fai_new_profile.png' alt=''>".
" "._("Profile")."|Create_profile|\n";
array("images/fai_new_packages.png" , _("Package list") ,"Create_package" , _("PK") , "faiPackage"));
foreach($arr as $ar){
- $acl = $ui->get_permissions($this->selectedBase,"fai/".$ar[4]);
+ $acl = $ui->get_permissions($this->parent->fai_base,"fai/".$ar[4]);
if(preg_match("/c/",$acl)){
$s.= "...|<input class='center' type='image' src='".$ar[0]."' alt=''>".
" ".$ar[1]."|".$ar[2]."|\n";
/* Add copy & cut icons */
$ui = get_userinfo();
$action ="";
- $acl_all = $ui->has_complete_category_acls($this->selectedBase,$this->module);
+ $acl_all = $ui->has_complete_category_acls($this->parent->fai_base,$this->module);
if(preg_match("/(c.*w|w.*c)/",$acl_all) && $this->parent->CopyPasteHandler){
$action .= "<input class='center' type='image'
src='images/lists/cut.png' alt='"._("cut")."' name='cut_%KEY%' title='"._("Cut this entry")."'> ";
{
/* Save automatic created POSTs like regex, checkboxes */
MultiSelectWindow::save_object();
- $faifilter = session::get('faifilter');
- $faifilter['branch'] = $this->selectedBranch;
- session::set('faifilter',$faifilter);
}
}
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
diff --git a/gosa-plugins/fai/admin/fai/class_faiHook.inc b/gosa-plugins/fai/admin/fai/class_faiHook.inc
index b385e490d1b86397100a915683943d6587c18c06..92b43193cb2fc93412e98932af8ebbf0493ed604 100644 (file)
*/
function remove_from_parent()
{
- $ldap = $this->config->get_ldap_link();
- $ldap->cd ($this->dn);
-
- $faifilter = session::get('faifilter');
- $use_dn = preg_replace("/".normalizePreg(FAI::get_release_dn($this->dn))."/i", $faifilter['branch'], $this->dn);
- if($faifilter['branch'] == "main"){
- $use_dn = $this->dn;
- }
-
- FAI::prepare_to_save_FAI_object($use_dn,array(),true);
-
- new log("remove","fai/".get_class($this),$use_dn,$this->attributes);
+ if($this->acl_is_removeable()){
+ $ldap = $this->config->get_ldap_link();
+ $ldap->cd ($this->dn);
+ $release = $this->parent->parent->fai_release;
+ $use_dn = preg_replace("/".normalizePreg(FAI::get_release_dn($this->dn))."/i", $release, $this->dn);
+ new log("remove","fai/".get_class($this),$use_dn,$this->attributes);
+ FAI::prepare_to_save_FAI_object($use_dn,array(),true);
- foreach($this->SubObjects as $name => $obj){
- $use_dn = preg_replace("/".normalizePreg(FAI::get_release_dn($this->dn))."/i", $faifilter['branch'], $obj['dn']);
- if($faifilter['branch'] == "main"){
- $use_dn = $obj['dn'];
+ foreach($this->SubObjects as $name => $obj){
+ $use_dn = preg_replace("/".normalizePreg(FAI::get_release_dn($this->dn))."/i", $release, $obj['dn']);
+ FAI::prepare_to_save_FAI_object($use_dn,array(),true);
}
- FAI::prepare_to_save_FAI_object($use_dn,array(),true);
+ $this->handle_post_events("remove");
}
- $this->handle_post_events("remove");
}
/* Ensure that we do not overwrite an allready existing entry
*/
if($this->is_new){
- $new_dn= 'cn='.$this->cn.",".get_ou('faihookou').get_ou('faiou').session::get('CurrentMainBase');
- $faifilter = session::get('faifilter');
- if($faifilter['branch']!="main"){
- $new_dn ='cn='.$this->cn.",".get_ou('faihookou').$faifilter['branch'];
- }
-
+ $release = $this->parent->parent->fai_release;
+ $new_dn= 'cn='.$this->cn.",".get_ou('faihookou').get_ou('faiou').$release;
$res = faiManagement::check_class_name("FAIhook",$this->cn,$new_dn);
if(isset($res[$this->cn])){
$message[] = msgPool::duplicated(_("Name"));
diff --git a/gosa-plugins/fai/admin/fai/class_faiManagement.inc b/gosa-plugins/fai/admin/fai/class_faiManagement.inc
index 34144831efa6e1486d16b9fa294a819a5f47486e..28c5a8337fb88ffa2fe3d51884a3428dbd025f3d 100644 (file)
var $DivListFai;
var $start_pasting_copied_objects = FALSE;
var $CopyPasteHandler = FALSE;
- var $base = "";
/* Allow inserting of new elements if freezed releases
*/
var $allow_freeze_object_attach = FALSE;
var $no_save;
+ var $fai_base ="";
+ var $fai_release ="";
/* construction/reconstruction
*/
$this->DivListFai = new divListFai($this->config,$this);
/* Copy & Paste handler */
- if ($this->config->boolValueIsTrue("main", "enableCopyPaste")){
+ if ($this->config->boolValueIsTrue($this->fai_base, "enableCopyPaste")){
$this->CopyPasteHandler= new CopyPasteHandler($this->config);
}
+
+ /* Set default release */
+ $this->fai_base = get_ou("faiou")."ou=Direktorium,".$this->config->current['BASE'];
+ if(!session::is_set("fai_filter")){
+ session::set("fai_filter",array("fai_release" => $this->fai_base));
+ }
+
+ $fai_filter = session::get("fai_filter");
+ $this->fai_release = $fai_filter['fai_release'];
}
function execute()
/* Call parent execute */
plugin::execute();
+ print_a(array($this->fai_base,$this->fai_release));
+
/* Initialise vars and smarty */
$smarty = get_smarty();
$smarty->assign("BranchName","");
if(preg_match("/d/",$acl)){
$this->dialog = new $type[0]($this->config, $this->config->data['TABS'][$type[2]], $dn,"fai");
+ $this->dialog->parent = &$this;
$this->dialog->set_acl_base($dn);
$this->dialog->by_object[$type[1]]->remove_from_parent ();
unset ($this->dialog);
$this->dialog = new $type[0]($this->config, $this->config->data['TABS'][$type[2]], $this->dn,"fai");
$this->dialog->set_acl_base($this->dn);
+ $this->dialog->parent = &$this;
$this->dialog->by_object[$type[1]]->remove_from_parent ();
unset ($this->dialog);
$this->dialog= FALSE;
add_lock ($this->dn, $this->ui->dn);
$this->dialog = new $a_setup[0]($this->config,$this->config->data['TABS'][$a_setup[2]],$this->dn,"fai");
-
+ $this->dialog->parent = &$this;
$this->dialog->set_acl_base($this->dn);
$this->is_dialog = true;
/* Remove branch
*/
if($s_action == "remove_branch"){
- $base= $this->DivListFai->selectedBranch;
+ $base= $this->fai_release;
/* Check if we have a post remove method configured
* else skip this operation. (Skip:Button in the ui should be disabled in this case too)
we're allowed to remove this 'dn' */
if($this->acl_is_removeable()){
- $smarty->assign("info", msgPool::deleteInfo(@LDAP::fix($this->DivListFai->selectedBranch),_("FAI branch/freeze")));
+ $smarty->assign("info", msgPool::deleteInfo(@LDAP::fix($this->fai_release),_("FAI branch/freeze")));
return($smarty->fetch(get_template_path('remove_branch.tpl',TRUE)));
} else {
msg_dialog::display(_("Permission error"), _("You have no permission to delete this release!"), ERROR_DIALOG);
*/
if("" != $this->config->search("faiManagement", "POSTREMOVE",array('menu','tabs'))){
- $bb = $this->DivListFai->selectedBranch;
+ $bb = $this->fai_release;
if(!isset($ldap)){
$ldap = $this->config->get_ldap_link();
}
$ldap->recursive_remove();
$ldap->cd(preg_replace('/,'.normalizePreg(get_ou('faiou')).'/', ','.get_ou('applicationou'), $bb));
$ldap->recursive_remove();
- $this->DivListFai->selectedBranch = "main";
+ $this->fai_release = $this->fai_base;
/* Post remove */
$this->lock_name = $name;
$name = $_POST['BranchName'];
$is_ok = true;
$smarty->assign("BranchName",$name);
- $base= get_ou('faiou').$this->DivListFai->selectedBase;
+ $base= $this->fai_base;
/* Check used characters */
if(preg_match("/[^0-9a-z \ö\ä\ü\.-_:,]/i",$name)){
}
/* Check if this name is already in use */
- if(!$this->CheckNewBranchName($_POST['BranchName'],$this->DivListFai->selectedBranch)){
+ if(!$this->CheckNewBranchName($_POST['BranchName'],$this->fai_release)){
msg_dialog::display(_("Error"), msgPool::duplicated(_("Name")), ERROR_DIALOG);
$is_ok = false;
}
$ldap = $this->config->get_ldap_link();
$baseToUse = $base;
- if($this->DivListFai->selectedBranch != "main" ){
- $baseToUse = $this->DivListFai->selectedBranch;
+ if($this->fai_release != $this->fai_base){
+ $baseToUse = $this->fai_release;
}
/* Create new Release name to be able to set faidebianRelease for FAIpackageList */
$CurrentReleases = $this->getBranches();
$NewReleaseName = $name;
- if(isset($CurrentReleases[$this->DivListFai->selectedBranch])) {
- if($this->DivListFai->selectedBranch != "main"){
- $NewReleaseName = $CurrentReleases[$this->DivListFai->selectedBranch]."/".$name;
+ if(isset($CurrentReleases[$this->fai_release])) {
+ if($this->fai_release != $this->fai_base){
+ $NewReleaseName = $CurrentReleases[$this->fai_release]."/".$name;
$NewReleaseName = preg_replace("#\/#","/",$NewReleaseName);
}else{
$NewReleaseName = $name;
/* Duplicate group application releases
*/
- FAI::copy_FAI_group_releases($CurrentReleases[$this->DivListFai->selectedBranch],$name,$type);
+ FAI::copy_FAI_group_releases($CurrentReleases[$this->fai_release],$name,$type);
/* Duplicate applications
*/
"new_package" => _("package list"));
if(isset($types[$s_action])){
- $acl = $this->ui->get_permissions($this->DivListFai->selectedBase,"fai/".$type_acl_mapping[$types[$s_action]]);
+ $acl = $this->ui->get_permissions($this->fai_base,"fai/".$type_acl_mapping[$types[$s_action]]);
if(preg_match("/c/",$acl)){
$this->dialog = new askClassName($this->config,$this->dn,$this->ui,$types[$s_action]);
+ $this->dialog->parent = &$this;
}else{
msg_dialog::display(_("Permission error"), sprintf(_("You have no permission to create a new %s!"), $types_i18n[$s_action]), ERROR_DIALOG);
}
if($s_action == "new_profile"){
$this->dn = "new" ;
- $acl = $this->ui->get_permissions($this->DivListFai->selectedBase,"fai/faiProfile");
+ $acl = $this->ui->get_permissions($this->fai_base,"fai/faiProfile");
if(preg_match("/c/",$acl)){
$a_setup= $this->get_type(array("objectClass"=>array("FAIprofile")));
$this->dialog = new $a_setup[0]($this->config,$this->config->data['TABS'][$a_setup[2]],$this->dn,"fai");
$this->dialog->set_acl_base($this->base);
+ $this->dialog->parent = &$this;
$this->is_dialog = false;
}else{
$this->dialog = new $a_setup[0]($this->config,$this->config->data['TABS'][$a_setup[2]],$this->dn,"fai");
$this->dialog->set_acl_base($this->base);
$this->dialog->by_object[$a_setup[1]]->cn = $name;
+ $this->dialog->parent = &$this;
$this->is_dialog = true;
}
}
****************/
/* Check if there is a snapshot dialog open */
- $base = $this->DivListFai->selectedBase;
+ $base = $this->fai_base;
if($str = $this->showSnapshotDialog($base,$this->get_used_snapshot_bases())){
return($str);
}
$this->reload();
$this->DivListFai->parent = $this;
$this->DivListFai->execute();
- $this->DivListFai->AddDepartments($this->DivListFai->selectedBase,4,1);
$this->DivListFai->setEntries($this->objects);
return($this->DivListFai->Draw());
}
$tmp = array();
$types = array("faipartitionou","faiscriptou","faitemplateou","faihookou","faiprofileou","faivariableou","faipackageou");
foreach($types as $type){
- if($this->DivListFai->selectedBranch == "main"){
- $tmp[] = get_ou($type).get_ou('faiou').$this->DivListFai->selectedBase;
- }else{
- $tmp[] = get_ou($type).$this->DivListFai->selectedBranch;
- }
+ $tmp[] = get_ou($type).$this->fai_release;
}
return($tmp);
}
/* Get available branches for current base */
function getBranches($base = false,$prefix = "")
{
- $ret = array("/"=>"main");
+ $ret = array("/"=>$this->fai_base);
$ldap = $this->config->get_ldap_link();
if(!$base){
- $base = session::get('CurrentMainBase');
+ $base = $this->fai_base;
}
$tmp = FAI::get_all_releases_from_base($base,true);
foreach($tmp as $dn => $name){
$this->objects = array();
/* Get base */
- $base = get_ou('faiou').$this->DivListFai->selectedBase;
- if($this->DivListFai->selectedBranch != "main"){
+ $base = $this->fai_base;
+ if($this->fai_release != $this->fai_base){
$br = $this->getBranches();
- if(isset($br[$this->DivListFai->selectedBranch])){
- $base = $this->DivListFai->selectedBranch;
+ if(isset($br[$this->fai_release])){
+ $base = $this->fai_release;
}else{
- $base = get_ou('faiou').$this->DivListFai->selectedBase;
+ $base = $this->fai_base;
}
}
$this->base = $base;
function CheckNewBranchName($name,$base)
{
- $f = $this->DivListFai->selectedBranch;
+ $f = $this->fai_release;
if($name == ""){
return(false);
}elseif(in_array($name,$this->getBranches($f))) {
{
$this->DivListFai->save_object();
+ /* Get posted release */
+ $r_releases = array_flip($this->getBranches());
+ if(isset($_POST['fai_release']) && isset($r_releases[get_post('fai_release')])){
+ $this->fai_release = $r_releases[get_post('fai_release')];
+
+ $fai_filter = session::get("fai_filter");
+ $fai_filter['fai_release'] = $this->fai_release;
+ session::set("fai_filter",$fai_filter);
+ }
+
if(is_object($this->CopyPasteHandler)){
$this->CopyPasteHandler->save_object();
}
return("");
}
- $base = $this->DivListFai->selectedBranch;
- if($base == "main"){
- $base = $this->DivListFai->selectedBase;
- }
/* Add a single entry to queue */
if($s_action == "cut" || $s_action == "copy"){
/* Get dialog */
$data = $this->CopyPasteHandler->execute();
- $this->CopyPasteHandler->SetVar("base",$base);
FAI::save_release_changes_now();
diff --git a/gosa-plugins/fai/admin/fai/class_faiPackage.inc b/gosa-plugins/fai/admin/fai/class_faiPackage.inc
index 1814daf6f3275e359a797d847e7d9e6b5532a451..f7a8e9277dd0aaac3a934b90d7154c110fb7b5f0 100644 (file)
if(!$this->is_account){
/* Assemble release name */
- $faifilter = session::get('faifilter');
- $tmp= preg_replace('/,'.normalizePreg(get_ou('faiou')).'.*$/', '', $faifilter['branch']);
+ $release = $this->parent->parent->fai_release;
+ $tmp= preg_replace('/,'.normalizePreg(get_ou('faiou')).'.*$/', '', $release);
$tmp= preg_replace('/ou=/', '', $tmp);
$rev= array_reverse(split(',', $tmp));
$this->FAIdebianRelease= "";
{
$ldap = $this->config->get_ldap_link();
$ldap->cd ($this->dn);
-
- $faifilter = session::get('faifilter');
- $use_dn = preg_replace("/".normalizePreg(FAI::get_release_dn($this->dn))."/i", $faifilter['branch'], $this->dn);
- if($faifilter['branch'] == "main"){
- $use_dn = $this->dn;
- }
-
+ $release = $this->parent->parent->fai_release;
+ $use_dn = preg_replace("/".normalizePreg(FAI::get_release_dn($this->dn))."/i", $release, $this->dn);
FAI::prepare_to_save_FAI_object($use_dn,array(),true);
-
new log("remove","fai/".get_class($this),$use_dn,$this->attributes);
-
foreach($this->ConfiguredPackages as $pkgname => $attrs){
foreach($attrs as $name => $attr){
$pkgdn = "FAIvariable=".$name.",".$this->dn;
- $use_dn = preg_replace("/".normalizePreg(FAI::get_release_dn($this->dn))."/i", $faifilter['branch'], $pkgdn);
- if($faifilter['branch'] == "main"){
- $use_dn = $obj['dn'];
- }
+ $use_dn = preg_replace("/".normalizePreg(FAI::get_release_dn($this->dn))."/i", $release, $pkgdn);
FAI::prepare_to_save_FAI_object($use_dn,array(),true);
}
}
/* Ensure that we do not overwrite an allready existing entry
*/
if($this->is_new){
- $new_dn= 'cn='.$this->cn.",".get_ou('faipackageou').get_ou('faiou').session::get('CurrentMainBase');
- $faifilter = session::get('faifilter');
- if($faifilter['branch']!="main"){
- $new_dn ='cn='.$this->cn.",".get_ou('faipackageou').$faifilter['branch'];
- }
-
+ $release = $this->parent->parent->fai_filter;
+ $new_dn= 'cn='.$this->cn.",".get_ou('faipackageou').get_ou('faiou').$release;
$res = faiManagement::check_class_name("FAIpackageList",$this->cn,$new_dn);
if(isset($res[$this->cn])){
$message[] = msgPool::duplicated(_("Name"));
/* Assemble release name */
if($this->FAIdebianRelease == "ClearFromCopyPaste"){
- $faifilter = session::get('faifilter');
- $tmp= preg_replace('/,'.normalizePreg(get_ou('faiou')).'.*$/', '', $faifilter['branch']);
+
+ $current_release = $this->parent->parent->fai_release;
+ $tmp= preg_replace('/,'.normalizePreg(get_ou('faiou')).'.*$/', '', $current_release);
$tmp= preg_replace('/ou=/', '', $tmp);
$rev= array_reverse(split(',', $tmp));
$this->FAIdebianRelease= "";
diff --git a/gosa-plugins/fai/admin/fai/class_faiPartitionTable.inc b/gosa-plugins/fai/admin/fai/class_faiPartitionTable.inc
index c721a8ed73eb40ff52052423d4f83d480cc9a92a..8d848e77b2098430c4fbb364b298b4ed79d9f5b4 100644 (file)
$ldap = $this->config->get_ldap_link();
$ldap->cd ($this->dn);
- $faifilter = session::get('faifilter');
- $use_dn = preg_replace("/".normalizePreg(FAI::get_release_dn($this->dn))."/i", $faifilter['branch'], $this->dn);
- if($faifilter['branch'] == "main"){
- $use_dn = $this->dn;
- }
+ $release = $this->parent->parent->fai_release;
+ $use_dn = preg_replace("/".normalizePreg(FAI::get_release_dn($this->dn))."/i", $release, $this->dn);
FAI::prepare_to_save_FAI_object($use_dn,array(),true);
-
new log("remove","fai/".get_class($this),$use_dn,$this->attributes);
-
foreach($this->disks as $disk){
-
$disk_dn = "cn=".$disk['cn'].",".$this->dn;
- $use_dn = preg_replace("/".normalizePreg(FAI::get_release_dn($this->dn))."/i", $faifilter['branch'], $disk_dn);
- if($faifilter['branch'] == "main"){
- $use_dn = $disk_dn;
- }
+ $use_dn = preg_replace("/".normalizePreg(FAI::get_release_dn($this->dn))."/i",$release, $disk_dn);
FAI::prepare_to_save_FAI_object($use_dn,array(),true);
-
foreach($disk['partitions'] as $key => $partition){
-
$partition_dn= "FAIpartitionNr=".$partition['FAIpartitionNr'].",".$disk_dn;
- $use_dn = preg_replace("/".normalizePreg(FAI::get_release_dn($this->dn))."/i", $faifilter['branch'], $partition_dn);
- if($faifilter['branch'] == "main"){
- $use_dn = $disk_dn;
- }
+ $use_dn = preg_replace("/".normalizePreg(FAI::get_release_dn($this->dn))."/i", $release, $partition_dn);
FAI::prepare_to_save_FAI_object($use_dn,array(),true);
}
}
/* Ensure that we do not overwrite an allready existing entry
*/
if($this->is_new){
- $new_dn= 'cn='.$this->cn.",".get_ou('faipartitionou').get_ou('faiou').session::get('CurrentMainBase');
- $faifilter = session::get('faifilter');
- if($faifilter['branch']!="main"){
- $new_dn ='cn='.$this->cn.",".get_ou('faipartitionou').$faifilter['branch'];
- }
-
+ $release = $this->parent->parent->fai_filter;
+ $new_dn= 'cn='.$this->cn.",".get_ou('faipartitionou').get_ou('faiou').$release;
$res = faiManagement::check_class_name("FAIpartitionTable",$this->cn,$new_dn);
if(isset($res[$this->cn])){
$message[] = msgPool::duplicated(_("Name"));
diff --git a/gosa-plugins/fai/admin/fai/class_faiProfile.inc b/gosa-plugins/fai/admin/fai/class_faiProfile.inc
index 83a57eddb1be385860d82f3acbfb69ccc02a51c8..cb71d0d06479ccbdf14f17d3104ad9bea38b537c 100644 (file)
{
$ldap = $this->config->get_ldap_link();
$ldap->cd ($this->dn);
-
- $faifilter = session::get('faifilter');
- $use_dn = preg_replace("/".normalizePreg(FAI::get_release_dn($this->dn))."/i", $faifilter['branch'], $this->dn);
- if($faifilter['branch'] == "main"){
- $use_dn = $this->dn;
- }
-
+ $release = $this->parent->parent->fai_release;
+ $use_dn = preg_replace("/".normalizePreg(FAI::get_release_dn($this->dn))."/i", $release, $this->dn);
new log("remove","fai/".get_class($this),$use_dn,$this->attributes);
FAI::prepare_to_save_FAI_object($use_dn,array(),true);
$this->handle_post_events("remove");
/* Ensure that we do not overwrite an allready existing entry
*/
if($this->dn == "new" || $this->cn != $this->old_cn){
- $new_dn= 'cn='.$this->cn.",".get_ou('faiprofileou').get_ou('faiou').session::get('CurrentMainBase');
- $faifilter = session::get('faifilter');
- if($faifilter['branch']!="main"){
- $new_dn ='cn='.$this->cn.",".get_ou('faiprofileou').$faifilter['branch'];
- }
+ $release = $this->parent->parent->fai_filter;
+ $new_dn= 'cn='.$this->cn.",".get_ou('faiprofileou').get_ou('faiou').$release;
$res = faiManagement::check_class_name("FAIprofile",$this->cn,$new_dn);
if(isset($res[$this->cn])){
$message[] = msgPool::duplicated(_("Name"));
diff --git a/gosa-plugins/fai/admin/fai/class_faiProfileEntry.inc b/gosa-plugins/fai/admin/fai/class_faiProfileEntry.inc
index d15526631cb65faa85ae77e529b1e36ff507c415..86ca1c6b2227ca239c426ffe6088bde804d81a2f 100644 (file)
plugin::plugin ($config, $dn);
/* Search only in fai tree */
- $base = get_ou('faiou').session::get('CurrentMainBase');
- $faifilter = session::get('faifilter');
- if($faifilter['branch']!="main"){
- $base = $faifilter['branch'];
- }
-
+
+ $base = $this->parent->parent->fai_release;
$this->ui = get_userinfo();
$filter = "(|(objectClass=FAIscript)(objectClass=FAItemplate)(objectClass=FAIhook)".
diff --git a/gosa-plugins/fai/admin/fai/class_faiScript.inc b/gosa-plugins/fai/admin/fai/class_faiScript.inc
index 500dddb0af8aa82b4e2420bd4e74fb13d73706e5..e15c840a4ed6348804c4bc8c47204673de388251 100644 (file)
if($this->acl_is_removeable()){
$ldap = $this->config->get_ldap_link();
$ldap->cd ($this->dn);
- $faifilter = session::get('faifilter');
- $use_dn = preg_replace("/".normalizePreg(FAI::get_release_dn($this->dn))."/i", $faifilter['branch'], $this->dn);
- if($faifilter['branch'] == "main"){
- $use_dn = $this->dn;
- }
-
+ $release = $this->parent->parent->fai_release;
+ $use_dn = preg_replace("/".normalizePreg(FAI::get_release_dn($this->dn))."/i", $release, $this->dn);
new log("remove","fai/".get_class($this),$use_dn,$this->attributes);
-
FAI::prepare_to_save_FAI_object($use_dn,array(),true);
-
+
foreach($this->SubObjects as $name => $obj){
- $use_dn = preg_replace("/".normalizePreg(FAI::get_release_dn($this->dn))."/i", $faifilter['branch'], $obj['dn']);
- if($faifilter['branch'] == "main"){
- $use_dn = $obj['dn'];
- }
+ $use_dn = preg_replace("/".normalizePreg(FAI::get_release_dn($this->dn))."/i", $release, $obj['dn']);
FAI::prepare_to_save_FAI_object($use_dn,array(),true);
}
$this->handle_post_events("remove");
/* Ensure that we do not overwrite an allready existing entry
*/
if($this->is_new){
- $new_dn= 'cn='.$this->cn.",".get_ou('faiscriptou').get_ou('faiou').session::get('CurrentMainBase');
- $faifilter = session::get('faifilter');
- if($faifilter['branch']!="main"){
- $new_dn ='cn='.$this->cn.",".get_ou('faiscriptou').$faifilter['branch'];
- }
-
+ $release = $this->parent->parent->fai_release;
+ $new_dn= 'cn='.$this->cn.",".get_ou('faiscriptou').get_ou('faiou').$release;
$res = faiManagement::check_class_name("FAIscript",$this->cn,$new_dn);
if(isset($res[$this->cn])){
$message[] = msgPool::duplicated(_("Name"));
diff --git a/gosa-plugins/fai/admin/fai/class_faiTemplate.inc b/gosa-plugins/fai/admin/fai/class_faiTemplate.inc
index 7ea9a836befe4cb641f8e529647b32c37aa6c773..d0cc63c2bdc6c2fd5e50fbfc11cea406dfdc2cd0 100644 (file)
*/
function remove_from_parent()
{
- $ldap = $this->config->get_ldap_link();
- $ldap->cd ($this->dn);
-
- $faifilter = session::get('faifilter');
- $use_dn = preg_replace("/".normalizePreg(FAI::get_release_dn($this->dn))."/i", $faifilter['branch'], $this->dn);
- if($faifilter['branch'] == "main"){
- $use_dn = $this->dn;
- }
-
- FAI::prepare_to_save_FAI_object($use_dn,array(),true);
- new log("remove","fai/".get_class($this),$use_dn,$this->attributes);
+ if($this->acl_is_removeable()){
+ $ldap = $this->config->get_ldap_link();
+ $ldap->cd ($this->dn);
+ $release = $this->parent->parent->fai_release;
+ $use_dn = preg_replace("/".normalizePreg(FAI::get_release_dn($this->dn))."/i", $release, $this->dn);
+ new log("remove","fai/".get_class($this),$use_dn,$this->attributes);
+ FAI::prepare_to_save_FAI_object($use_dn,array(),true);
- foreach($this->SubObjects as $name => $obj){
- $use_dn = preg_replace("/".normalizePreg(FAI::get_release_dn($this->dn))."/i", $faifilter['branch'], $obj['dn']);
- if($faifilter['branch'] == "main"){
- $use_dn = $obj['dn'];
+ foreach($this->SubObjects as $name => $obj){
+ $use_dn = preg_replace("/".normalizePreg(FAI::get_release_dn($this->dn))."/i", $release, $obj['dn']);
+ FAI::prepare_to_save_FAI_object($use_dn,array(),true);
}
- FAI::prepare_to_save_FAI_object($use_dn,array(),true);
+ $this->handle_post_events("remove");
}
- $this->handle_post_events("remove");
}
/* Ensure that we do not overwrite an allready existing entry
*/
if($this->is_new){
- $new_dn= 'cn='.$this->cn.",".get_ou('faitemplateou').get_ou('faiou').session::get('CurrentMainBase');
- $faifilter = session::get('faifilter');
- if($faifilter['branch']!="main"){
- $new_dn ='cn='.$this->cn.",".get_ou('faitemplateou').$faifilter['branch'];
- }
-
+ $release = $this->parent->parent->fai_release;
+ $new_dn= 'cn='.$this->cn.",".get_ou('faitemplateou').get_ou('faiou').$release;
$res = faiManagement::check_class_name("FAItemplate",$this->cn,$new_dn);
if(isset($res[$this->cn])){
$message[] = msgPool::duplicated(_("Name"));
diff --git a/gosa-plugins/fai/admin/fai/class_faiVariable.inc b/gosa-plugins/fai/admin/fai/class_faiVariable.inc
index af021e7df6f56bf174515bf4b28220171991bdb9..3e026af041aeb22922a7aca40e522c8dd66b6bd4 100644 (file)
if($this->acl_is_removeable()){
$ldap = $this->config->get_ldap_link();
$ldap->cd ($this->dn);
-
- $faifilter = session::get('faifilter');
- $use_dn = preg_replace("/".normalizePreg(FAI::get_release_dn($this->dn))."/i", $faifilter['branch'], $this->dn);
- if($faifilter['branch'] == "main"){
- $use_dn = $this->dn;
- }
-
- FAI::prepare_to_save_FAI_object($use_dn,array(),true);
+ $release = $this->parent->parent->fai_release;
+ $use_dn = preg_replace("/".normalizePreg(FAI::get_release_dn($this->dn))."/i", $release, $this->dn);
new log("remove","fai/".get_class($this),$use_dn,$this->attributes);
+ FAI::prepare_to_save_FAI_object($use_dn,array(),true);
foreach($this->SubObjects as $name => $obj){
- $use_dn = preg_replace("/".normalizePreg(FAI::get_release_dn($this->dn))."/i", $faifilter['branch'], $obj['dn']);
- if($faifilter['branch'] == "main"){
- $use_dn = $obj['dn'];
- }
+ $use_dn = preg_replace("/".normalizePreg(FAI::get_release_dn($this->dn))."/i", $release, $obj['dn']);
FAI::prepare_to_save_FAI_object($use_dn,array(),true);
}
$this->handle_post_events("remove");
/* Ensure that we do not overwrite an allready existing entry
*/
if($this->is_new){
- $new_dn= 'cn='.$this->cn.",".get_ou('faivariableou').get_ou('faiou').session::get('CurrentMainBase');
- $faifilter = session::get('faifilter');
- if($faifilter['branch']!="main"){
- $new_dn ='cn='.$this->cn.",".get_ou('faivariableou').$faifilter['branch'];
- }
-
+ $release = $this->parent->parent->fai_filter;
+ $new_dn= 'cn='.$this->cn.",".get_ou('faivariableou').get_ou('faiou').$release;
$res = faiManagement::check_class_name("FAIvariable",$this->cn,$new_dn);
if(isset($res[$this->cn])){
$message[] = msgPool::duplicated(_("Name"));
index ad41dbdf84e1e1aea0e284e3b2877faccba40243..7b0859fb62ac06a426c9c3f4797aff1cccb7e96c 100644 (file)
class tabsHook extends tabs
{
var $base= "";
+ var $parent;
function tabsHook($config, $data, $dn,$category)
{
function save($ignore_account= FALSE)
{
$baseobject= $this->by_object['faiHook'];
-
- $new_dn= 'cn='.$baseobject->cn.",".get_ou('faihookou').get_ou('faiou').session::get('CurrentMainBase');
- $faifilter = session::get('faifilter');
- if($faifilter['branch']!="main"){
- $new_dn ='cn='.$baseobject->cn.",".get_ou('faihookou').$faifilter['branch'];
- }
+ $new_dn ='cn='.$baseobject->cn.",".get_ou('faihookou').$this->parent->fai_release;
if ($this->dn != $new_dn && $this->dn != "new"){
diff --git a/gosa-plugins/fai/admin/fai/tabsPackage.inc b/gosa-plugins/fai/admin/fai/tabsPackage.inc
index 197f86370caf39ce737a247e10cbf2c0e90bd435..e3101d4f484e22ca5d237e354863692456a4b5cd 100644 (file)
class tabsPackage extends tabs
{
var $base= "";
+ var $parent;
function tabsPackage($config, $data, $dn,$category)
{
function save($ignore_account= FALSE)
{
$baseobject= $this->by_object['faiPackage'];
-
- $new_dn= 'cn='.$baseobject->cn.",".get_ou('faipackageou').get_ou('faiou').session::get('CurrentMainBase');
-
- $faifilter = session::get('faifilter');
-
- if($faifilter['branch']!="main"){
- $new_dn ='cn='.$baseobject->cn.",".get_ou('faipackageou').$faifilter['branch'];
- }
+ $new_dn ='cn='.$baseobject->cn.",".get_ou('faipackageou').$this->parent->fai_release;
if ($this->dn != $new_dn && $this->dn != "new"){
diff --git a/gosa-plugins/fai/admin/fai/tabsPartition.inc b/gosa-plugins/fai/admin/fai/tabsPartition.inc
index b1aab1e09bbf2a946996d0497beb9d6f7ff2356c..33cb80ba8a184d2c088f044c500a22333312a22e 100644 (file)
class tabsPartition extends tabs
{
var $base= "";
+ var $parent;
function tabsPartition($config, $data, $dn,$category)
{
{
$baseobject= $this->by_object['faiPartitionTable'];
- $new_dn= 'cn='.$baseobject->cn.",".get_ou('faipartitionou').get_ou('faiou').session::get('CurrentMainBase');
-
- $faifilter = session::get('faifilter');
- if($faifilter['branch']!="main"){
- $new_dn ='cn='.$baseobject->cn.",".get_ou('faipartitionou').$faifilter['branch'];
- }
+ $new_dn ='cn='.$baseobject->cn.",".get_ou('faipartitionou').$this->parent->fai_release;
if ($this->dn != $new_dn && $this->dn != "new"){
diff --git a/gosa-plugins/fai/admin/fai/tabsProfile.inc b/gosa-plugins/fai/admin/fai/tabsProfile.inc
index 64fc7025c1aa74b4d5773c0a5e8beb9edebbe6e0..6dea9226d83eb444c6cb620977234f46705231e1 100644 (file)
class tabsProfile extends tabs
{
var $base= "";
+ var $parent;
function tabsProfile($config, $data, $dn,$category)
{
function save($ignore_account= FALSE)
{
$baseobject= $this->by_object['faiProfile'];
-
- $new_dn= 'cn='.$baseobject->cn.",".get_ou('faiprofileou').get_ou('faiou').session::get('CurrentMainBase');
-
- $faifilter = session::get('faifilter');
- if($faifilter['branch']!="main"){
- $new_dn ='cn='.$baseobject->cn.",".get_ou('faiprofileou').$faifilter['branch'];
- }
+ $new_dn ='cn='.$baseobject->cn.",".get_ou('faiprofileou').$this->parent->fai_release;
if ($this->dn != $new_dn && $this->dn != "new"){
index 01cafc149cd0b38251ae2afd5f7100bb5d315aaf..3c5059b907bfb0f559d9dcc0cc9c39cf6ea29e68 100644 (file)
class tabsScript extends tabs
{
var $base= "";
+ var $parent;
function tabsScript($config, $data, $dn,$category)
{
function save($ignore_account= FALSE)
{
$baseobject= $this->by_object['faiScript'];
-
- $new_dn= 'cn='.$baseobject->cn.",".get_ou('faiscriptou').get_ou('faiou').session::get('CurrentMainBase');
-
- $faifilter = session::get('faifilter');
-
- if($faifilter['branch']!="main"){
- $new_dn ='cn='.$baseobject->cn.",".get_ou('faiscriptou').$faifilter['branch'];
- }
+ $new_dn ='cn='.$baseobject->cn.",".get_ou('faiscriptou').$this->parent->fai_release;
if ($this->dn != $new_dn && $this->dn != "new"){
diff --git a/gosa-plugins/fai/admin/fai/tabsTemplate.inc b/gosa-plugins/fai/admin/fai/tabsTemplate.inc
index 3c8576e3c9a9e1a40a8fc4c974f13f1e77a4707a..6e9150812491fee21b95a170c62be872de501ede 100644 (file)
class tabsTemplate extends tabs
{
var $base= "";
+ var $parent;
function tabsTemplate($config, $data, $dn,$category)
{
function save($ignore_account= FALSE)
{
$baseobject= $this->by_object['faiTemplate'];
-
- $new_dn= 'cn='.$baseobject->cn.",".get_ou('faitemplateou').get_ou('faiou').session::get('CurrentMainBase');
-
- $faifilter = session::get('faifilter');
- if($faifilter['branch']!="main"){
- $new_dn ='cn='.$baseobject->cn.",".get_ou('faitemplateou').$faifilter['branch'];
- }
+ $new_dn ='cn='.$baseobject->cn.",".get_ou('faitemplateou').$this->parent->fai_release;
if ($this->dn != $new_dn && $this->dn != "new"){
diff --git a/gosa-plugins/fai/admin/fai/tabsVariable.inc b/gosa-plugins/fai/admin/fai/tabsVariable.inc
index 0a4dcfbc6e9de0d95e4fd08beb81426354eefaf9..1e05c873204c1fc71bd10e771a532def3dbd953e 100644 (file)
class tabsVariable extends tabs
{
var $base= "";
+ var $parent;
function tabsVariable($config, $data, $dn,$category)
{
function save($ignore_account= FALSE)
{
$baseobject= $this->by_object['faiVariable'];
-
- $new_dn= 'cn='.$baseobject->cn.",".get_ou('faivariableou').get_ou('faiou').session::get('CurrentMainBase');
-
- $faifilter = session::get('faifilter');
-
- if($faifilter['branch']!="main"){
- $new_dn ='cn='.$baseobject->cn.",".get_ou('faivariableou').$faifilter['branch'];
- }
+ $new_dn ='cn='.$baseobject->cn.",".get_ou('faivariableou').$this->parent->fai_release;
if ($this->dn != $new_dn && $this->dn != "new"){