summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 0144a6d)
raw | patch | inline | side by side (parent: 0144a6d)
author | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 28 Apr 2006 10:52:03 +0000 (10:52 +0000) | ||
committer | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 28 Apr 2006 10:52:03 +0000 (10:52 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@3166 594d385d-05f5-0310-b6e9-bd551577e9d8
diff --git a/html/main.php b/html/main.php
index 8c096eb3b49a7bc8396b84dcd5bdc7b09b2c1690..e589f95975a8ec85b702f6ab13cf15f4f8f3aa35 100644 (file)
--- a/html/main.php
+++ b/html/main.php
compromise between speed and beeing up to date */
if (isset($_GET['reset'])){
if (!isset($_SESSION['cached_departments'])){
- $_SESSION['cached_departments']= get_departments();
+ $config->get_departments();
+ $_SESSION['cached_departments']= $config->departments;
+ } else {
+ $config->departments= $_SESSION['cached_departments'];
}
- $config->departments= $_SESSION['cached_departments'];
$config->make_idepartments ();
if (isset($_SESSION['objectinfo'])){
unset ($_SESSION['objectinfo']);
index bca1f5bdcc49db7763f14aacde8e40f3bee7e838..ef1c93c669e9b47ec270b12b36545c872f95b1e9 100644 (file)
--- a/include/class_config.inc
+++ b/include/class_config.inc
}
}
+
+ function get_departments($ignore_dn= "")
+ {
+ global $config;
+
+ /* Initialize result hash */
+ $result= array();
+ $result['/']= $this->current['BASE'];
+
+ /* Get list of department objects */
+ $ldap= $this->get_ldap_link();
+ $ldap->cd ($this->current['BASE']);
+ $ldap->search ("(objectClass=gosaDepartment)", array("ou"));
+ while ($attrs= $ldap->fetch()){
+ $dn= $ldap->getDN();
+ if ($dn == $ignore_dn){
+ continue;
+ }
+
+ /* Only assign non-root departments */
+ if ($dn != $result['/']){
+ $result[convert_department_dn($dn)]= $dn;
+ }
+ }
+
+ $this->departments= $result;
+ }
+
+
function make_idepartments($max_size= 28)
{
global $config;
index 66a191fc89f11acfa5cd864ede95bae3de8e3d75..9d7de4e59ff66c58dd69c003e8ca18b90a35a51d 100644 (file)
--- a/include/class_plugin.inc
+++ b/include/class_plugin.inc
$_SESSION['LOCK_VARS_TO_USE'] =array();
}
- /* remove object from parent */
+ /*! \brief execute plugin
+ Removes object from parent
+ */
function remove_from_parent()
{
/* include global link_info */
}
}
+
+ function handle_object_tagging()
+ {
+ /* Watch out for an administrative unit below own base */
+ echo "<b>handle_object_tagging()</b><br><pre>";
+ echo "DN : ".$this->dn."\n";
+ echo "Base: ".$this->config->current['BASE']."\n";
+ echo "</pre>";
+
+ /* Make a base search on every department */
+ //FIXME: evaluate if these informations should be cached, too
+ #$parts= split(',', preg_replace("/,".normalizePreg($this->config->current['BASE'])."$/", '', $this->dn));
+
+ /* Set objectclass and attribute */
+
+ }
+
}
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
?>
diff --git a/include/functions.inc b/include/functions.inc
index d93aa89095ea95dc1562d330af0273c7ea62fecb..e051a3948c32447ef7e3b2a501fee4f9384cae3c 100644 (file)
--- a/include/functions.inc
+++ b/include/functions.inc
}
-function get_departments($ignore_dn= "")
-{
- global $config;
-
- /* Initialize result hash */
- $result= array();
- $result['/']= $config->current['BASE'];
-
- /* Get list of department objects */
- $ldap= $config->get_ldap_link();
- $ldap->cd ($config->current['BASE']);
- $ldap->search ("(objectClass=gosaDepartment)", array("ou"));
- while ($attrs= $ldap->fetch()){
- $dn= $ldap->getDN();
- if ($dn == $ignore_dn){
- continue;
- }
-
- /* Only assign non-root departments */
- if ($dn != $result['/']){
- $result[convert_department_dn($dn)]= $dn;
- }
- }
-
- return ($result);
-}
-
-
function chkacl($acl, $name)
{
/* Look for attribute in ACL */
diff --git a/plugins/admin/departments/class_departmentGeneric.inc b/plugins/admin/departments/class_departmentGeneric.inc
index bf6b7e8214032aa70628a0a9c98036d2b5dfd10d..97bc429efb0fa555ffcd40184a475ebd6e7a555e 100644 (file)
var $telephoneNumber= "";
var $facsimileTelephoneNumber= "";
var $orig_dn= "";
+ var $is_administrational_unit= false;
+ var $gosaUnitTag= "";
var $rec_dst=false; // Destination for recursive move
var $rec_src=false; // Source for recursive move
var $rec_cpy=false; // Is recursive move requested ?
- function am_i_moved()
- {
- return $this->rec_cpy;
- }
-
/* Headpage attributes */
var $last_dep_sorting= "invalid";
var $departments= array();
} else {
$this->base= preg_replace ("/^[^,]+,/", "", $this->dn);
}
+
/* set permissions */
$ui= get_userinfo();
$acl= get_permissions ($ui->dn, $ui->subtreeACL);
$this->acl= get_module_permission($acl, "department", $ui->dn);
+
+ /* Is administrational Unit? */
+ if ($dn != "new" && in_array_ics('gosaAdministrationalUnit', $this->attrs['objectClass'])){
+ $this->is_administrational_unit= true;
+ }
}
function execute()
plugin::execute();
/* Reload departments */
- $this->config->departments= get_departments($this->dn);
+ $this->config->get_departments($this->dn);
$this->config->make_idepartments();
$smarty= get_smarty();
$smarty->assign("$val"."ACL", chkacl($this->acl, "$val"));
}
$smarty->assign("base_select", $this->base);
+
+ /* Set admin unit flag */
+ if ($this->is_administrational_unit) {
+ $smarty->assign("unitTag", "checked");
+ } else {
+ $smarty->assign("unitTag", "");
+ }
+ $smarty->assign("unitTag"."ACL", chkacl($this->acl, "unitTag"));
+
return($smarty->fetch (get_template_path('generic.tpl', TRUE)));
}
if (chkacl($this->acl, "create") == ""){
$this->base= $_POST['base'];
}
+
+ /* Save tagging flag */
+ if (chkacl($this->acl, "unitTag") == ""){
+ if (isset($_POST['unitTag'])){
+ $this->is_administrational_unit= true;
+ } else {
+ $this->is_administrational_unit= false;
+ }
+ }
}
}
/* Save to LDAP */
function save()
{
+ /* Add tag objects if needed */
+ if ($this->is_administrational_unit){
+ $this->objectclasses[]= "gosaAdministrationalUnit";
+ $this->attributes[]= "gosaUnitTag";
+ } else {
+ plugin::handle_object_tagging();
+ }
+
plugin::save();
/* Write back to ldap */
$ldap->cat($this->dn);
$a= $ldap->fetch();
$ldap->cd($this->dn);
+
if (count($a)){
$this->cleanup();
$ldap->modify ($this->attrs);
}
show_ldap_error($ldap->get_error());
+ if ($this->is_administrational_unit){
+ $this->tag_objects();
+ } else {
+ $this->untag_objects();
+ }
+
/* Optionally execute a command after we're done */
$this->postcreate();
}
+
+ /* Tag objects to have the gosaAdministrationalUnitTag */
+ function tag_objects()
+ {
+ echo "Tag";
+ }
+
+ /* Remove the gosaAdministrationalUnitTag from objects */
+ function untag_objects()
+ {
+ echo "Untag";
+ }
+
/* Move/Rename complete trees */
function recursive_move($src_dn, $dst_dn,$force = false)
{
}
}
+ function am_i_moved()
+ {
+ return $this->rec_cpy;
+ }
}
diff --git a/plugins/admin/departments/class_departmentManagement.inc b/plugins/admin/departments/class_departmentManagement.inc
index eb578897611b817ab99b300388d9ab0001d7dba3..c15e2a2d62f64b732011ee65b5e9ef28784467cf 100644 (file)
$_SESSION['LOCK_VARS_TO_USE'] = array("/^act$/","/^id$/","/^dep_edit_.*/","/^dep_del_.*/");
/* Reload departments */
- $this->config->departments = get_departments();
+ $this->config->get_departments();
$smarty = get_smarty();
$display = "";
$depfilter = get_global("depfilter");
index ef30d12d1642052faec2271382d5c1276eacf4e8..620c971ddddeeec0c6326931cb6137ba0dd2ffaf 100644 (file)
</tr>
</table>
+<p class='seperator'> </p>
+
+<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4>
+ <tr>
+ <td style="vertical-align:top; width:100%">
+ <h2><img class="center" alt="" align="middle" src="images/closedlock.png"> {t}Administrational settings{/t}</h2>
+
+ <input id="unitTag" type=checkbox name="unitTag" value="1" {$unitTag} {$unitTagACL}><label for="unitTag">{t}Tag department as an independent administrational unit{/t}</label>
+ </td>
+ </tr>
+</table>
+
<!-- Place cursor -->
<script language="JavaScript" type="text/javascript">
<!-- // First input field on page