summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6819c98)
raw | patch | inline | side by side (parent: 6819c98)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 12 Jun 2008 13:47:40 +0000 (13:47 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 12 Jun 2008 13:47:40 +0000 (13:47 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11305 594d385d-05f5-0310-b6e9-bd551577e9d8
diff --git a/gosa-core/plugins/admin/departments/class_countryGeneric.inc b/gosa-core/plugins/admin/departments/class_countryGeneric.inc
index 6477cd146ae90454f6db50b0c6ecb49e69afe109..d44f72e682f4434a05a06b66fc301937c27f4255 100644 (file)
/* attribute list for save action */
var $attributes = array( "c", "description");
var $objectclasses = array("top", "country");
- var $type ="c";
+ var $type ="c";
+ var $c ="";
+ var $orgi_c ="";
+
+ var $namingAttr = "c";
+
+ function check()
+ {
+ $message = plugin::check();
+ return($message);
+ }
- var $c ="";
}
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
diff --git a/gosa-core/plugins/admin/departments/class_departmentGeneric.inc b/gosa-core/plugins/admin/departments/class_departmentGeneric.inc
index 62b3947afa36c125cbdbf6a937bd210935c13340..3962c47942570b43d7a8585d1f728fa42ac1464d 100644 (file)
var $view_logged = FALSE;
var $type ="ou";
+ var $namingAttr = "ou";
/* Headpage attributes */
var $last_dep_sorting= "invalid";
$this->ui= get_userinfo();
$this->dn= $dn;
$this->orig_dn= $dn;
- $this->orig_ou= $this->ou;
+
+ /* Save current naming attribuet
+ */
+ $nA = $this->namingAttr;
+ $orig_nA = "orig_".$nA;
+ $this->$orig_nA = $this->$nA;
+
$this->config= $config;
/* Set base */
diff --git a/gosa-core/plugins/admin/departments/class_departmentManagement.inc b/gosa-core/plugins/admin/departments/class_departmentManagement.inc
index baf9ae2e4d35b166650dff300021cb8f94b95b82..03cf292c68afe1185318e8e0f87d14b3299bf256 100644 (file)
So don't move it below the moved check !.
*/
$message= $this->deptabs->check();
- $obj = $this->deptabs->by_object['department'];
/*************
MOVED ?
$this->ObjectInSaveMode = true;
/* This object must be tagged, so set ObjectTaggingRequested to true */
- if($this->deptabs->by_object['department']->must_be_tagged()){
+ if($this->deptabs->by_object[$this->deptabs->base_name]->must_be_tagged()){
$smarty = get_smarty();
$smarty->assign("src","?plug=".$_GET['plug']."&TagDepartment&no_output_compression");
$smarty->assign("message",_("As soon as the tag operation has finished, you can scroll down to end of the page and press the 'Continue' button to continue with the department management dialog."));
$result[$tmp[$base_back]]=$tmp2;
}
+
+
if($this->DivListDepartment->SubSearch){
$res= get_list("(&(|(ou=$Regex)(description=$Regex))(objectClass=gosaDepartment))",
"department", $base, array("ou", "description"), GL_SIZELIMIT | GL_SUBSEARCH);
"department", $base, array("ou", "description"), GL_SIZELIMIT );
}
+
+ /**/
+ $non_ou = get_list("(&(|(c=$Regex)(description=$Regex))(objectClass=country))",
+ "department", $base, array("c", "description"), GL_SIZELIMIT );
+
$this->departments= array();
+ foreach($non_ou as $obj){
+ $this->departments[] = $obj['dn'];
+ }
+
/* Add current base to the list of available departments, but only if its naming attribute is 'ou' */
if(preg_match("/^ou=/",$base)){
diff --git a/gosa-core/plugins/admin/departments/class_divListDepartment.inc b/gosa-core/plugins/admin/departments/class_divListDepartment.inc
index 55ef8d2fac7cd8e8f0899241808d8933c7c4cb95..6fa3f8d0779effceb6245756b67e89aa9812652f 100644 (file)
$actions= "";
- $acl = $ui->get_permissions($this->config->departments[$key] ,"department/department");
- $acl_all = $ui->has_complete_category_acls($this->config->departments[$key] ,"department");
+ if(!isset($this->config->departments[$key])){
- $actions.= "<input class='center' type='image' src='images/lists/edit.png'
- alt='"._("edit")."' name='dep_edit_%KEY%' title='"._("Edit this entry")."'>";
+ $field01 = array("string" => " ", "attach" => "style='width:20px;'");
+ $field0 = array("string" => "<img src='images/".$non_empty."lists/folder.png'
+ title='"._("department")."' alt='department'>",
+ "attach" => "style='text-align:center;width:20px;'");
+ $field1 = array("string" => $val, "attach" => "style='' title='".$val."'");
+ $field2 = array("string" => "", "attach" => "style='border-right: 0px;'");
- if(preg_match("/d/",$acl)){
- $actions.= "<input class='center' type='image' src='images/lists/trash.png'
- alt='"._("delete")."' name='dep_del_%KEY%' title='"._("Delete this entry")."'>";
- }
+ }else{
+ $acl = $ui->get_permissions($this->config->departments[$key] ,"department/department");
+ $acl_all = $ui->has_complete_category_acls($this->config->departments[$key] ,"department");
- if(!isset($this->config->departments[trim($key)])){
- $this->config->departments[trim($key)]="";
- }
+ $actions.= "<input class='center' type='image' src='images/lists/edit.png'
+ alt='"._("edit")."' name='dep_edit_%KEY%' title='"._("Edit this entry")."'>";
- /* check if this department contains sub-departments
- Display different image in this case
- */
- $non_empty="";
- $nkey= normalizePreg($key);
- foreach($this->config->departments as $keyd=>$vald ){
- if(preg_match('/$nkey\/.*/',$keyd)){
- $non_empty="full";
+ if(preg_match("/d/",$acl)){
+ $actions.= "<input class='center' type='image' src='images/lists/trash.png'
+ alt='"._("delete")."' name='dep_del_%KEY%' title='"._("Delete this entry")."'>";
}
- }
- $title = preg_replace('/ /', ' ', @LDAP::fix($this->config->departments[$key]));
+ if(!isset($this->config->departments[trim($key)])){
+ $this->config->departments[trim($key)]="";
+ }
- if($val == "."){
- $field01 = array("string" => " ",
- "attach" => "style='width:20px;'");
- }else{
- $field01 = array("string" => "<input type='checkbox' id='item_selected_".base64_encode($key)."'
- name='item_selected_".base64_encode($key)."'>" ,
- "attach" => "style='width:20px;'");
- }
+ /* check if this department contains sub-departments
+ Display different image in this case
+ */
+ $non_empty="";
+ $nkey= normalizePreg($key);
+ foreach($this->config->departments as $keyd=>$vald ){
+ if(preg_match('/$nkey\/.*/',$keyd)){
+ $non_empty="full";
+ }
+ }
+
+ $title = preg_replace('/ /', ' ', @LDAP::fix($this->config->departments[$key]));
- $field0 = array("string" => "<img src='images/".$non_empty."lists/folder.png' title='"._("department")."' alt='department'>", "attach" => "style='text-align:center;width:20px;'");
- $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;'");
+ if($val == "."){
+ $field01 = array("string" => " ",
+ "attach" => "style='width:20px;'");
+ }else{
+ $field01 = array("string" => "<input type='checkbox' id='item_selected_".base64_encode($key)."'
+ name='item_selected_".base64_encode($key)."'>" ,
+ "attach" => "style='width:20px;'");
+ }
+
+ $field0 = array("string" => "<img src='images/".$non_empty."lists/folder.png' title='"._("department")."' alt='department'>", "attach" => "style='text-align:center;width:20px;'");
+ $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($field01,$field0,$field1,$field2));
}
diff --git a/gosa-core/plugins/admin/departments/tabs_department.inc b/gosa-core/plugins/admin/departments/tabs_department.inc
index 65fc151ef45dc2327fcfbb1d29213ecbd7030522..e8a7842487da9107811ff9967961f148265c2145 100644 (file)
{
var $base= "";
var $moved = FALSE;
+ var $base_name = "department";
function deptabs($config, $data, $dn,$category)
{
tabs::tabs($config, $data, $dn,$category);
+ /* Detect the base class (The classs which extends from department)
+ */
+ $class = "department";
+ foreach($this->by_object as $name => $object){
+ if($object instanceOf department){
+ $this->base_name = get_class($object);
+ break;
+ }
+ }
+
+
/* Add references/acls/snapshots */
$this->addSpecialTabs();
$this->by_object['acl']->skipTagging= TRUE;;
{
return(FALSE);
if($this->moved) return(FALSE);
- $baseobject= &$this->by_object['department'];
- $ou = preg_replace('/,/', '\,', $baseobject->ou);
- $new_dn = @LDAP::convert('ou='.$ou.','.$baseobject->base);
- $old_ou = preg_replace('/,/', '\,', $baseobject->orig_ou);
- $old_dn = @LDAP::convert('ou='.$ou.','.$baseobject->orig_base);
+ $baseobject= &$this->by_object[$this->base_name];
+
+ $namingAttr = $baseobject->namingAttr;
+ $orig_namingAttr = $baseobject->orig_namingAttr;
+
+ $value = preg_replace('/,/', '\,', $baseobject->$namingAttr);
+ $orig_value = preg_replace('/,/', '\,', $baseobject->$orig_namingAttr);
+
+ $new_dn = @LDAP::convert($namingAttr.'='.$value.','.$baseobject->base);
+ $old_dn = @LDAP::convert($namingAttr.'='.$orig_value.','.$baseobject->orig_base);
+
+ print_a(array($new_dn,$old_dn));
+
if ($this->dn != $new_dn && $this->dn != "new"){
return(TRUE);
}
function move_me()
{
if(!$this->am_i_moved()) return;
- $baseobject= &$this->by_object['department'];
+ $baseobject= &$this->by_object[$this->base_name];
$ou = preg_replace('/,/', '\,', $baseobject->ou);
$new_dn = @LDAP::convert('ou='.$ou.','.$baseobject->base);
$old_ou = preg_replace('/,/', '\,', $baseobject->orig_ou);
function save($ignore_account= FALSE)
{
- $baseobject= &$this->by_object['department'];
- $ou = preg_replace('/,/', '\,', $baseobject->ou);
- $new_dn = @LDAP::convert('ou='.$ou.','.$baseobject->base);
+ $baseobject= &$this->by_object[$this->base_name];
+
+ $namingAttr = $baseobject->namingAttr;
+
+ $nAV = preg_replace('/,/', '\,', $baseobject->$namingAttr);
+ $new_dn = @LDAP::convert($namingAttr.'='.$nAV.','.$baseobject->base);
/* Move group? */
if ($this->dn != $new_dn && $this->dn != "new"){