index 07543b03c0166ee4a0ff6ff805d2d8096fe3d55f..ed479f75f706b06018ba398114b1d8eaabcbe0ac 100644 (file)
gosa_log ("FAI class '".$this->dn."' has been tagged as removed");
$this->dialog= NULL;
$to_del = clean_up_releases($this->dn);
+ save_release_changes_now();
foreach($to_del as $dn){
$ldap->rmdir_recursive($dn);
/* Duplicate applications
*/
- $ldap->cd ($appdst);
- $ldap->recursive_remove();
- $ldap->cd ($this->config->current['BASE']);
- $ldap->copy_FAI_resource_recursive($appsrc,$appdst,$NewReleaseName,$type,true);
-
+ $ldap->cat($appsrc,array("dn")) ;
+ if($ldap->count()){
+ $ldap->cd ($appdst);
+ $ldap->recursive_remove();
+ $ldap->cd ($this->config->current['BASE']);
+ $ldap->copy_FAI_resource_recursive($appsrc,$appdst,$NewReleaseName,$type,true);
+ }
+
/* Duplicate mime types
*/
- $ldap->cd ($appdst);
- $ldap->recursive_remove();
- $ldap->cd ($this->config->current['BASE']);
- $ldap->copy_FAI_resource_recursive($mimesrc,$mimedst,$NewReleaseName,$type,true);
-
+ $ldap->cat($mimesrc,array("dn")) ;
+ if($ldap->count()){
+ $ldap->cd ($appdst);
+ $ldap->recursive_remove();
+ $ldap->cd ($this->config->current['BASE']);
+ $ldap->copy_FAI_resource_recursive($mimesrc,$mimedst,$NewReleaseName,$type,true);
+ }
$attr = array();
$attr['objectClass'] = array("organizationalUnit","FAIbranch");
- $attr['ou'] = $name;
+ $attr['ou'] = $name;
+ $attr['FAIstate'] = $type;
$ldap->cd($this->config->current['BASE']);
$ldap->cd("ou=".$name.",".$baseToUse);
$ldap->cat("ou=".$name.",".$baseToUse);
}
}else{
$this->dialog->save();
+ save_release_changes_now();
if (!isset($_POST['edit_apply'])){
del_lock ($this->dn);
unset($this->dialog);
if(($this->dialog != NULL) && (isset($this->dialog->config))){
$display .= $this->dialog->execute();
/* Don't show buttons if tab dialog requests this */
- if (((isset($this->dialog->current))&&($this->dialog->by_object[$this->dialog->current]->is_dialog))){
-
- }elseif(((isset($this->dialog->current))&&(!$this->dialog->by_object[$this->dialog->current]->is_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";
+
+ if(isset($this->dialog->current)){
+
+ $obj = $this->dialog->by_object[$this->dialog->current];
+
+ if((isset($obj->is_dialog) && (!$obj->is_dialog)) || (isset($obj->dialog) && (!$obj->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>";
+ }elseif(!isset($this->dialog->current)){
+ $display.= "<p style=\"text-align:right\">\n";
+ $display.= "<input type=\"submit\" name=\"edit_continue\" value=\""._("Continue")."\"> ";
+ $display.= "<input type=\"submit\" name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
+ $display.= "</p>";
}
- $display.= "<input type=\"submit\" name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
- $display.= "</p>";
- }elseif(!isset($this->dialog->current)){
- $display.= "<p style=\"text-align:right\">\n";
- $display.= "<input type=\"submit\" name=\"edit_continue\" value=\""._("Continue")."\"> ";
- $display.= "<input type=\"submit\" name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
- $display.= "</p>";
- }
+ }
return($display);
}
$ret = array("main"=>"/");
$ldap = $this->config->get_ldap_link();
if(!$base){
- $base= "ou=fai,ou=configs,ou=systems,".$_SESSION['CurrentMainBase'];
+ $base= $_SESSION['CurrentMainBase'];
}
- $ldap->ls("(objectClass=FAIbranch)",$base);
- while($attrs = $ldap->fetch()){
- if((isset($attrs['ou']))&&($attrs['dn']!=$base)){
- $ret[$attrs['dn']]= $prefix.$attrs['ou'][0];
- $ret = array_merge($ret,$this->getBranches($attrs['dn'],"".$prefix.$attrs['ou'][0]."/"));
- }
+ $tmp = get_all_releases_from_base($base,true);
+ foreach($tmp as $dn => $name){
+ $ret[$dn]=$name;
}
-
return ($ret);
}
}
}
+ $this->lock_type = get_release_tag(get_release_dn($base));
+
/* Get resolved release dependencies */
$tmp = get_all_objects_for_given_base($base,"(&(|(objectClass=FAIpartitionTable)(objectClass=FAIpackageList)(objectClass=FAIscript)
(objectClass=FAIvariable)(objectClass=FAIhook)(objectClass=FAIprofile)(objectClass=FAItemplate))(cn=$Regex))");
}
/* Clean up object informations */
+ $obj = array();
$obj['cn'] = $object['cn'][0];
$obj['dn'] = $object['dn'];
$obj['description'] = $object['description'][0];
/* Append type to this string, to be able to check if the selected
* entry is of type 'freeze' or 'branch'
*/
- if(isset($object['FAIstate'])){
- $obj['FAIstate'] = $object['FAIstate'][0];
- $str.="|".$obj['FAIstate'];
+ if(!isset($object['FAIstate'])){
+ $obj['FAIstate'] = $this->lock_type;
}else{
- $obj['FAIstate'] ="";
+ $obj['FAIstate'] = $object['FAIstate'][0];
}
+
$this->objects[strtolower($obj['cn']).$obj['cn'].$type] = $obj;
$this->objects[strtolower($obj['cn']).$obj['cn'].$type]['type']=$type;
}
}
}
- /* Tell class what we have currently opened
- 'main' has type '' */
- if(preg_match("/freeze/",$str)){
- $this->lock_type = "freeze";
- }elseif(preg_match("/branch/",$str)){
- $this->lock_type = "branch";
- }else{
- $this->lock_type = "";
- }
-
ksort($this->objects);
reset ($this->objects);
function CheckNewBranchName($name,$base)
{
$f = $this->DivListFai->selectedBranch;
- if(empty($name)){
+ if($name == ""){
return(false);
}elseif(in_array($name,$this->getBranches($f))) {
return(false);
- }elseif(empty($name)){
- return(false);
}elseif(is_department_name_reserved($name,$base)){
return(false);
}