index eb4d40a8fe4218e862e2a7088a4e8d0d14d3ba9f..f2d01c51bd79a09346dc5c0193146dad032ae7da 100644 (file)
--- a/include/class_plugin.inc
+++ b/include/class_plugin.inc
/* This can be set to render the tabulators in another stylesheet */
var $pl_notify= FALSE;
/* This can be set to render the tabulators in another stylesheet */
var $pl_notify= FALSE;
+
+ /* This variable indicates that this class can handle multiple dns at once. */
+ var $multiple_support = FALSE;
+
+ /* This aviable indicates, that we are currently in multiple edit handle */
+ var $multiple_support_active = FALSE;
+ var $selected_edit_values = array();
+
/*! \brief plugin constructor
If 'dn' is set, the node loads the given 'dn' from LDAP
/*! \brief plugin constructor
If 'dn' is set, the node loads the given 'dn' from LDAP
/* Get LDAP descriptor */
$ldap= $this->config->get_ldap_link();
/* Get LDAP descriptor */
$ldap= $this->config->get_ldap_link();
- if ($dn != NULL){
+ if ($dn !== NULL){
/* Load data to 'attrs' and save 'dn' */
/* Load data to 'attrs' and save 'dn' */
- if ($parent != NULL){
+ if ($parent !== NULL){
$this->attrs= $parent->attrs;
} else {
$ldap->cat ($dn);
$this->attrs= $parent->attrs;
} else {
$ldap->cat ($dn);
}
/* Is Account? */
}
/* Is Account? */
- error_reporting(0);
$found= TRUE;
foreach ($this->objectclasses as $obj){
if (preg_match('/top/i', $obj)){
$found= TRUE;
foreach ($this->objectclasses as $obj){
if (preg_match('/top/i', $obj)){
break;
}
}
break;
}
}
- error_reporting(E_ALL | E_STRICT);
if ($found){
$this->is_account= TRUE;
@DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__,
if ($found){
$this->is_account= TRUE;
@DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__,
/* Get current objectClasses in order to add the required ones */
$ldap->cat($this->dn);
$tmp= $ldap->fetch ();
/* Get current objectClasses in order to add the required ones */
$ldap->cat($this->dn);
$tmp= $ldap->fetch ();
- $oc= array();
+ $oc= array();
if (isset($tmp['objectClass'])){
$oc= $tmp['objectClass'];
unset($oc['count']);
if (isset($tmp['objectClass'])){
$oc= $tmp['objectClass'];
unset($oc['count']);
/* Save data to object */
function save_object()
{
/* Save data to object */
function save_object()
{
+ if($this->multiple_support_active){
+ foreach($this->attributes as $attr){
+ if(isset($_POST["use_".$attr])){
+ $this->selected_edit_values[$attr] = TRUE;
+ }else{
+ $this->selected_edit_values[$attr] = FALSE;
+ }
+ }
+ }
+
/* Save values to object */
foreach ($this->attributes as $val){
if ($this->acl_is_writeable($val) && isset ($_POST["$val"])){
/* Save values to object */
foreach ($this->attributes as $val){
if ($this->acl_is_writeable($val) && isset ($_POST["$val"])){
$ldap->cat($this->dn);
$tmp= $ldap->fetch ();
$ldap->cat($this->dn);
$tmp= $ldap->fetch ();
-
+
+ $oc= array();
if (isset($tmp['objectClass'])){
$oc= $tmp["objectClass"];
$this->is_new= FALSE;
if (isset($tmp['objectClass'])){
$oc= $tmp["objectClass"];
$this->is_new= FALSE;
+ unset($oc['count']);
} else {
} else {
- $oc= array("count" => 0);
$this->is_new= TRUE;
}
/* Load (minimum) attributes, add missing ones */
$this->is_new= TRUE;
}
/* Load (minimum) attributes, add missing ones */
- $this->attrs['objectClass']= $this->objectclasses;
- for ($i= 0; $i<$oc["count"]; $i++){
- if (!in_array_ics($oc[$i], $this->objectclasses)){
- $this->attrs['objectClass'][]= $oc[$i];
- }
- }
+ $this->attrs['objectClass']= gosa_array_merge($oc,$this->objectclasses);
/* Copy standard attributes */
foreach ($this->attributes as $val){
/* Copy standard attributes */
foreach ($this->attributes as $val){
$message= array();
/* Skip if we've no config object */
$message= array();
/* Skip if we've no config object */
- if (!isset($this->config)){
+ if (!isset($this->config) || !is_object($this->config)){
return $message;
}
/* Find hooks entries for this class */
return $message;
}
/* Find hooks entries for this class */
- $command= search_config($this->config->data['MENU'], get_class($this), "CHECK");
- if ($command == "" && isset($this->config->data['TABS'])){
- $command= search_config($this->config->data['TABS'], get_class($this), "CHECK");
- }
+ $command= $this->config->search(get_class($this), "CHECK", array('menu', 'tabs'));
if ($command != ""){
if ($command != ""){
function postcreate($add_attrs= array())
{
/* Find postcreate entries for this class */
function postcreate($add_attrs= array())
{
/* Find postcreate entries for this class */
- $command= search_config($this->config->data['MENU'], get_class($this), "POSTCREATE");
- if ($command == "" && isset($this->config->data['TABS'])){
- $command= search_config($this->config->data['TABS'], get_class($this), "POSTCREATE");
- }
+ $command= $this->config->search(get_class($this), "POSTCREATE",array('menu', 'tabs'));
if ($command != ""){
if ($command != ""){
function postmodify($add_attrs= array())
{
/* Find postcreate entries for this class */
function postmodify($add_attrs= array())
{
/* Find postcreate entries for this class */
- $command= search_config($this->config->data['MENU'], get_class($this), "POSTMODIFY");
- if ($command == "" && isset($this->config->data['TABS'])){
- $command= search_config($this->config->data['TABS'], get_class($this), "POSTMODIFY");
- }
+ $command= $this->config->search(get_class($this), "POSTMODIFY",array('menu','tabs'));
if ($command != ""){
if ($command != ""){
function postremove($add_attrs= array())
{
/* Find postremove entries for this class */
function postremove($add_attrs= array())
{
/* Find postremove entries for this class */
- $command= search_config($this->config->data['MENU'], get_class($this), "POSTREMOVE");
- if ($command == "" && isset($this->config->data['TABS'])){
- $command= search_config($this->config->data['TABS'], get_class($this), "POSTREMOVE");
- }
-
+ $command= $this->config->search(get_class($this), "POSTREMOVE",array('menu','tabs'));
if ($command != ""){
/* Additional attributes */
if ($command != ""){
/* Additional attributes */
}
$r=ldap_bind($ds,$this->config->current['ADMIN'], $this->config->current['PASSWORD']);
}
$r=ldap_bind($ds,$this->config->current['ADMIN'], $this->config->current['PASSWORD']);
- error_reporting (0);
$sr=ldap_read($ds, @LDAP::fix($src_dn), "objectClass=*");
/* Fill data from LDAP */
$sr=ldap_read($ds, @LDAP::fix($src_dn), "objectClass=*");
/* Fill data from LDAP */
$ei=ldap_first_entry($ds, $sr);
if ($ei) {
foreach($attrs as $attr => $val){
$ei=ldap_first_entry($ds, $sr);
if ($ei) {
foreach($attrs as $attr => $val){
- if ($info = ldap_get_values_len($ds, $ei, $attr)){
+ if ($info = @ldap_get_values_len($ds, $ei, $attr)){
for ($i= 0; $i<$info['count']; $i++){
if ($info['count'] == 1){
$new[$attr]= $info[$i];
for ($i= 0; $i<$info['count']; $i++){
if ($info['count'] == 1){
$new[$attr]= $info[$i];
}
/* close conncetion */
}
/* close conncetion */
- error_reporting (E_ALL | E_STRICT);
ldap_unbind($ds);
/* Adapt naming attribute */
ldap_unbind($ds);
/* Adapt naming attribute */
$snapldapbase = $cfg['SNAPSHOT_BASE'];
$ldap_to = new LDAP($user,$password, $server);
$ldap_to->cd ($snapldapbase);
$snapldapbase = $cfg['SNAPSHOT_BASE'];
$ldap_to = new LDAP($user,$password, $server);
$ldap_to->cd ($snapldapbase);
- show_ldap_error($ldap->get_error(), sprintf(_("Method get deleted snapshots with dn '%s' failed."),$this->dn));
+ show_ldap_error($ldap_to->get_error(), sprintf(_("Method get deleted snapshots with dn '%s' failed."),$this->dn));
}else{
$ldap_to = $ldap;
}
}else{
$ldap_to = $ldap;
}
}
/* Restore one of the already deleted objects */
}
/* Restore one of the already deleted objects */
- if(preg_match("/^RestoreDeletedSnapShot_/",$name) && $once){
+ if(((isset($_POST['menu_action']) && $_POST['menu_action'] == "RestoreDeletedSnapShot")
+ || preg_match("/^RestoreDeletedSnapShot_/",$name)) && $once){
$once = false;
$this->snapDialog = new SnapShotDialog($this->config,"",$this);
$this->snapDialog->set_snapshot_bases($baseSuffixe);
$once = false;
$this->snapDialog = new SnapShotDialog($this->config,"",$this);
$this->snapDialog->set_snapshot_bases($baseSuffixe);
/* Create a new snapshot requested, check
the given attributes and create the snapshot*/
/* Create a new snapshot requested, check
the given attributes and create the snapshot*/
- if(isset($_POST['CreateSnapshot'])){
+ if(isset($_POST['CreateSnapshot']) && is_object($this->snapDialog)){
$this->snapDialog->save_object();
$msgs = $this->snapDialog->check();
if(count($msgs)){
$this->snapDialog->save_object();
$msgs = $this->snapDialog->check();
if(count($msgs)){
$this->snapDialog = NULL;
}
$this->snapDialog = NULL;
}
- if($this->snapDialog){
+ if(is_object($this->snapDialog )){
$this->snapDialog->save_object();
return($this->snapDialog->execute());
}
$this->snapDialog->save_object();
return($this->snapDialog->execute());
}
}
}
}
}
}
}
+
+
+ function get_multi_edit_values()
+ {
+ $ret = array();
+ foreach($this->selected_edit_values as $attr => $active){
+ if($active){
+ $ret[$attr] = $this->$attr;
+ }
+ }
+ return($ret);
+ }
+
+ function set_multi_edit_value()
+ {
+
+ }
+
}
}
+
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
?>
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
?>