summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 80c40c6)
raw | patch | inline | side by side (parent: 80c40c6)
author | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 27 Jun 2006 09:25:25 +0000 (09:25 +0000) | ||
committer | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 27 Jun 2006 09:25:25 +0000 (09:25 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@3935 594d385d-05f5-0310-b6e9-bd551577e9d8
diff --git a/plugins/admin/departments/class_departmentGeneric.inc b/plugins/admin/departments/class_departmentGeneric.inc
index 6dd6ff7de85406c7652c6bf4220f60ed8f4c0291..5205da94447f99145248934c108fc8bb617b3a91 100644 (file)
function must_be_tagged()
{
- if((isset($this->attrs['gosaUnitTag'][0])) && ($this->is_administrational_unit)){
- $this->must_be_tagged = false;
- }elseif((!isset($this->attrs['gosaUnitTag'][0])) && (!$this->is_administrational_unit)){
- $this->must_be_tagged = false;
- }else{
- $this->must_be_tagged = true;
- }
return $this->must_be_tagged;
}
/* Check for presence of this department */
$ldap= $this->config->get_ldap_link();
- $ldap->ls ("(&(ou=".$this->ou.")(objectClass=organizationalUnit))", $this->base, array('dn'));
- if ($this->orig_dn == "new" && $ldap->count()){
+ $ldap->ls ("(&(ou=".$this->ou.")(objectClass=organizationalUnit))", $this->base, array('dn'));
+ if ($this->orig_dn == "new" && $ldap->count()){
$message[]= _("Department with that 'Name' already exists.");
} elseif ($this->orig_dn != $this->dn && !($attrs === FALSE)){
$message[]= _("Department with that 'Name' already exists.");
if ($this->is_administrational_unit){
if(!in_array_ics("gosaAdministrativeUnit",$this->objectclasses)){
$this->objectclasses[]= "gosaAdministrativeUnit";
- $this->gosaUnitTag= "";
+ $this->gosaUnitTag= "";
}
+
if ($this->gosaUnitTag == ""){
/* It's unlikely, but check if already used... */
if (!preg_match("/^gosaAdministrativeUnit$/i", $oc)){
$tmp[]= $oc;
}
- if (preg_match("/^gosaAdministrativeUnitTag$/i", $oc)){
- $has_unit_tag= true;
- }
+ if (preg_match("/^gosaAdministrativeUnitTag$/i", $oc)){
+ $has_unit_tag= true;
+ }
}
$this->attrs['objectClass']= $tmp;
}
show_ldap_error($ldap->get_error(), _("Saving department failed"));
+ /* The parameter forces only to set must_be_tagged, and don't touch any objects
+ This will be done later */
+ $this->tag_objects(true);
+
/* Fix tagging if needed */
if (!$this->is_administrational_unit){
$this->handle_object_tagging();
}
-
+
/* Optionally execute a command after we're done */
$this->postcreate();
return(true);
} else {
$ldap->search('objectClass=gosaAdministrativeUnitTag', array('dn'));
}
+
while ($attrs= $ldap->fetch()){
/* Skip self */
diff --git a/plugins/admin/departments/class_departmentManagement.inc b/plugins/admin/departments/class_departmentManagement.inc
index c21927f09a08fd225ba3f744085f98f91240fea4..9bb51d3755ed233395f9e600d411000697e92cd9 100644 (file)
* The entry which will be edited is defined in $s_entry
*/
if (( $s_action=="edit") && (!isset($this->deptabs->config))){
- $s_entry = convert_department_dn(base64_decode($s_entry));
$this->dn= $this->config->departments[trim($s_entry)];
if (($user= get_lock($this->dn)) != ""){
* The entry which will be deleted is defined in $s_entry
*/
if ($s_action =="del"){
- $s_entry = convert_department_dn(base64_decode($s_entry));
$this->dn= $this->config->departments[trim($s_entry)];
/* Check locking */
if (count($message) == 0){
$this->deptabs->save(true);
-
- if(!$this->deptabs->by_object['department']->am_i_moved()){
- $this->deptabs->save(true);
- }
+ $this->deptabs->by_object['department']->save();
/* This object must be tagged, so set ObjectTaggingRequested to true */
if($this->deptabs->by_object['department']->must_be_tagged()){
$display= $this->deptabs->execute();
if (!$this->deptabs->by_object[$this->deptabs->current]->dialog){
$display.= "<p style=\"text-align:right\">\n";
- $display.= "<input type=submit name=\"edit_finish\" style=\"width:80px\" value=\""._("Ok")."\">\n";
+ $display.= "<input type=submit name=\"edit_finish\" value=\""._("Save")."\">\n";
$display.= " \n";
$display.= "<input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
$display.= "</p>";
}
return ($display);
}else{
-
- /* Check if there is a snapshot dialog open */
- $base = $this->DivListDepartment->selectedBase;
- if($str = $this->showSnapshotDialog($base,$this->get_used_snapshot_bases())){
- return($str);
- }
-
/* Display dialog with group list */
$this->DivListDepartment->parent = $this;
$this->DivListDepartment->execute();
}
- /* Return departments, that will be included within snapshot detection */
- function get_used_snapshot_bases()
- {
- return(array($this->DivListDepartment->selectedBase));
- }
-
-
-
function reload()
{
/* Vairaible init */
}
$this->departments= array();
- $tmp = array();
foreach ($res as $key => $value){
- #$tmp[get_sub_department(convert_department_dn($value['dn']))] = $key;
- $tmp[$key] = get_sub_department(convert_department_dn($value['dn']));
- }
- natcasesort($tmp);
- foreach($tmp as $key => $q){
- $value = $res [$key];
+
/* Don't display base as entry on subsearch */
if(($value['dn'] == $base) && ($this->DivListDepartment->SubSearch)){
continue;
}
- $this->departments[base64_encode($value['dn'])]= $value;
+ $cdn= convert_department_dn($value['dn']);
+
+ /* Append to dep list */
+ if(isset($value["description"][0])){
+ $this->departments[$cdn]= get_sub_department($cdn)." - [".$value["description"][0]."]";
+ }else{
+ $this->departments[$cdn]= get_sub_department($cdn);//$value["description"][0];
+ }
}
+ natcasesort ($this->departments);
+ reset ($this->departments);
}
function remove_from_parent()
diff --git a/plugins/admin/departments/class_divListDepartment.inc b/plugins/admin/departments/class_divListDepartment.inc
index 9d4af1e2d750b9c7b8ee814cfb0e9f77bdb98535..4eaea028be39dbd20e7ed3a3b0e4a0ef341d1ba0 100755 (executable)
$this->EnableCloseButton(false);
$this->EnableSaveButton (false);
- /* Dynamic action col, depending on snapshot icons */
- $action_col_size = 50;
- if($this->parent->snapshotEnabled()){
- $action_col_size += 20;
- }
-
/* set Page header */
$this->AddHeader(array("string" => " ", "attach" => "style='text-align:center;width:20px;'"));
$this->AddHeader(array("string"=>_("Department name"), "attach" => "style=''"));
- $this->AddHeader(array("string" =>_("Actions"), "attach" => "style='width:".$action_col_size."px;border-right:0px;text-align:right;'"));
+ $this->AddHeader(array("string" =>_("Actions"), "attach" => "style='width:60px;border-right:0px;text-align:right;'"));
+
/* Add SubSearch checkbox */
$this->AddCheckBox("SubSearch", _("Select to search within subtrees"), _("Ignore subtrees"), false);
}
/* Generate list head */
- $listhead = "<div style='background:#F0F0F9;padding:5px;'>".
- " <input type='image' class='center' src='images/list_root.png' align='middle'
- title='"._("Go to root department")."' name='dep_root' alt='". _("Root")."'> ".
- " <input type='image' class='center' src='images/list_up.png' align='middle'
- title='"._("Go up one department")."' name='dep_back' alt='"._("Up"). "'> ".
- " <input type='image' class='center' src='images/list_home.png' align='middle'
- title='"._("Go to users home department")."' name='dep_home' alt='". _("Home")."'> ".
- " <input class='center' type='image' src='images/list_reload.png' align='middle'
- title='"._("Reload list")."' name='submit_department' alt='". _("Submit")."'> ".
- " <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'> ";
- $listhead .= $this->get_snapshot_header($this->selectedBase);
- $listhead .= " <input class='center' type='image' src='images/list_new_department.png'
- align='middle' alt='"._("Create new department")."' name='dep_new'> ".
- " <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'> ".
- _("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")."'> ".
- "</div>";
+ $listhead = "<div style='background:#F0F0F9;padding:5px;'>".
+ " <input type='image' class='center' src='images/list_root.png' align='middle' title='"._("Go to root department")."' name='dep_root' alt='". _("Root")."'> ".
+ " <input type='image' class='center' src='images/list_up.png' align='middle' title='"._("Go up one department")."' name='dep_back' alt='"._("Up"). "'> ".
+ " <input type='image' class='center' src='images/list_home.png' align='middle' title='"._("Go to users home department")."' name='dep_home' alt='". _("Home")."'> ".
+ " <input class='center' type='image' src='images/list_reload.png' align='middle' title='"._("Reload list")."' name='submit_department' alt='". _("Submit")."'> ".
+ " <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'> ".
+ " <input class='center' type='image' src='images/list_new_department.png' align='middle' alt='"._("Create new department")."' name='dep_new'> ".
+ " <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'> ".
+ _("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")."'> ".
+ "</div>";
$this->SetListHeader($listhead);
}
function setEntries($list)
{
+ $actions= "<input class='center' type='image' src='images/edit.png'
+ alt='"._("edit")."' name='dep_edit_%KEY%' title='"._("Edit this entry")."'>";
+ $actions.= "<input class='center' type='image' src='images/edittrash.png'
+ alt='"._("delete")."' name='dep_del_%KEY%' title='"._("Delete this entry")."'>";
$linkopen = "<a href='?plug=".$_GET['plug']."&act=dep_open&dep_id=%s'>%s</a>";
- /* Dynamic action col, depending on snapshot icons */
- $action_col_size = 50;
- if($this->parent->snapshotEnabled()){
- $action_col_size += 20;
- }
-
foreach($list as $key => $val) {
-
- $cdn= convert_department_dn($val['dn']);
- if(isset($val["description"][0])) {
- $disp = get_sub_department($cdn)." - [".$val["description"][0]."]";
- }else{
- $disp = get_sub_department($cdn);
- }
-
- $actions= "<input class='center' type='image' src='images/edit.png'
- alt='"._("edit")."' name='dep_edit_%KEY%' title='"._("Edit this entry")."'>";
- $actions.= $this->GetSnapShotActions($val['dn']);
- $actions.= "<input class='center' type='image' src='images/edittrash.png'
- alt='"._("delete")."' name='dep_del_%KEY%' title='"._("Delete this entry")."'>";
-
if(!isset($this->config->departments[trim($key)])){
$this->config->departments[trim($key)]="";
}
$title = preg_replace('/ /', ' ', @LDAP::fix($this->config->departments[$key]));
$field0 = array("string" => "<img src='images/".$non_empty."folder.png' title='"._("department")."' alt='department'>", "attach" => "style='text-align:center;width:20px;'");
- $field1 = array("string" => sprintf($linkopen,base64_encode($cdn),$disp), "attach" => "style='' title='".$title."'");
- $field2 = array("string" => preg_replace("/%KEY%/", base64_encode($key), $actions), "attach" => "style='width:".$action_col_size."px;border-right:0px;text-align:
+ $field1 = array("string" => sprintf($linkopen,base64_encode($key),$val), "attach" => "style='' title='".$title."'");
+ $field2 = array("string" => preg_replace("/%KEY%/", base64_encode($key), $actions), "attach" => "style='width:60px;border-right:0px;text-align:
right;'");
$this->AddElement( array($field0,$field1,$field2));
diff --git a/plugins/admin/departments/tabs_department.inc b/plugins/admin/departments/tabs_department.inc
index e1b7b98d0684c1eac510e48a6fac2e5d665f954f..285b93a7940589aeb9cc7a6396727a5680f221e9 100644 (file)
$baseobject= $this->by_object['department'];
$ou= preg_replace('/,/', '\,', $baseobject->ou);
$new_dn= @LDAP::convert('ou='.$ou.','.$baseobject->base);
+
if($justsave){
if ($this->dn != $new_dn && $this->dn != "new"){
/* if( new_dn is subtree of this->dn ) */
print_red(_("Try to move tree failed. Destination tree is subtree of source tree."));
}else{
/* Prepare to be moved */
- $baseobject->recursive_move($this->dn, $new_dn);
+ $baseobject->recursive_move($this->dn, $new_dn);
$this->by_object['department'] = $baseobject;
return;
}
}
- }else{
- $this->dn= $new_dn;
- return(tabs::save(TRUE));
}
+ $this->dn= $new_dn;
+ $baseobject->dn= $this->dn;
+ $this->by_object['department']= $baseobject;
+ return(tabs::save(TRUE));
}
}