Upgrade notes
@@ -27,7 +28,11 @@ This is a list of API changes for all LAM releases.
-
3.1.0 -> 3.2.0
Account types: The CSS classes have changed.
+
3.2.0 -> 3.3.0
The cache was removed. Please use local caching and the functions searchLDAP... instead of get_cache().
+The return values for baseModule::pre/postDeleteActions() was changed to an array of status message parameters.
+
+
3.1.0 -> 3.2.0
+Account types: The CSS classes have changed.
tr.TYPElist-over: removed without replacement
diff --git a/lam/lib/baseModule.inc b/lam/lib/baseModule.inc
index f526a651..2889d3e5 100644
--- a/lam/lib/baseModule.inc
+++ b/lam/lib/baseModule.inc
@@ -1058,22 +1058,22 @@ abstract class baseModule {
* Allows the module to run commands before the LDAP entry is deleted.
*
* Calling this method requires the existence of an enclosing {@link accountContainer}.
- *
- * An error message should be printed if the function returns false.
*
- * @return boolean true, if no problems occured
+ * @return array Array which contains status messages. Each entry is an array containing the status message parameters.
*/
public function preDeleteActions() {
- return true;
+ return array();
}
/**
* Allows the module to run commands after the LDAP entry is deleted.
*
* Calling this method requires the existence of an enclosing {@link accountContainer}.
+ *
+ * @return array Array which contains status messages. Each entry is an array containing the status message parameters.
*/
public function postDeleteActions() {
- return;
+ return array();
}
/**
diff --git a/lam/lib/lists.inc b/lam/lib/lists.inc
index 8f815629..b3e5a208 100644
--- a/lam/lib/lists.inc
+++ b/lam/lib/lists.inc
@@ -151,6 +151,8 @@ class lamList {
$this->listGetParams();
// print HTML head
$this->listPrintHeader();
+ // print messages when redirected from other pages
+ $this->listPrintRedirectMessages();
// refresh data if needed
if ($this->refresh) {
$this->listBuildFilter();
@@ -924,6 +926,15 @@ class lamList {
return;
}
+ /**
+ * Prints messages when another page (e.g. delete/upload) redirects to the list view.
+ */
+ protected function listPrintRedirectMessages() {
+ if (isset($_GET['deleteAllOk'])) {
+ StatusMessage('INFO', _('Deletion was successful.'));
+ }
+ }
+
}
/**
@@ -1169,7 +1180,7 @@ class lamSelectListOption extends lamListOption {
$return->addElement(new htmlTableExtendedSelect($this->getID(), $this->options, array($this->getValue()), $this->name, $this->helpID));
return $return;
}
-
+
}
?>
\ No newline at end of file
diff --git a/lam/lib/modules/posixAccount.inc b/lam/lib/modules/posixAccount.inc
index 1e68f083..7faa04db 100644
--- a/lam/lib/modules/posixAccount.inc
+++ b/lam/lib/modules/posixAccount.inc
@@ -591,12 +591,11 @@ class posixAccount extends baseModule implements passwordService {
/**
* Allows the module to run commands before the LDAP entry is deleted.
- * An error message should be printed if the function returns false.
*
- * @return true, if no problems occured
+ * @return array Array which contains status messages. Each entry is an array containing the status message parameters.
*/
function preDeleteActions() {
- $return = true;
+ $return = array();
if (isset($_POST['deletehomedir'])) {
// get list of lamdaemon servers
$lamdaemonServers = explode(";", $_SESSION['config']->get_scriptServers());
@@ -624,7 +623,7 @@ class posixAccount extends baseModule implements passwordService {
$singleresult = explode(",", $singleresult);
if (is_array($singleresult)) {
if (($singleresult[0] == 'ERROR') || ($singleresult[0] == 'WARN') || ($singleresult[0] == 'INFO')) {
- call_user_func_array('StatusMessage', $singleresult);
+ $return[] = $singleresult;
}
}
}
diff --git a/lam/lib/modules/quota.inc b/lam/lib/modules/quota.inc
index b2c38f10..44aba381 100644
--- a/lam/lib/modules/quota.inc
+++ b/lam/lib/modules/quota.inc
@@ -271,9 +271,8 @@ class quota extends baseModule {
/**
* Allows the module to run commands before the LDAP entry is deleted.
- * An error message should be printed if the function returns false.
*
- * @return true, if no problems occured
+ * @return array Array which contains status messages. Each entry is an array containing the status message parameters.
*/
function preDeleteActions() {
$this->initQuotas();
@@ -306,7 +305,7 @@ class quota extends baseModule {
}
lamdaemon(implode(quota::$SPLIT_DELIMITER, array($id, "quota", "set", $this->get_scope(), "$quotastring\n")), $server);
}
- return true;
+ return array();
}
/**
diff --git a/lam/templates/delete.php b/lam/templates/delete.php
index cf98fad1..e9273204 100644
--- a/lam/templates/delete.php
+++ b/lam/templates/delete.php
@@ -123,6 +123,10 @@ if (isset($_POST['cancel'])) {
if (isset($_SESSION['delete_dn'])) unset($_SESSION['delete_dn']);
metaRefresh("lists/list.php?type=" . $_POST['type']);
}
+elseif (isset($_POST['cancelAllOk'])) {
+ if (isset($_SESSION['delete_dn'])) unset($_SESSION['delete_dn']);
+ metaRefresh("lists/list.php?type=" . $_POST['type'] . '&deleteAllOk=1');
+}
if (isset($_POST['delete'])) {
// Show HTML Page
@@ -133,6 +137,7 @@ if (isset($_POST['delete'])) {
echo " \n";
// Delete dns
+ $allOk = true;
for ($m=0; $mpreDeleteActions();
+ $success = true;
+ $messages = $modules[$singlemodule]->preDeleteActions();
+ for ($i = 0; $i < sizeof($messages); $i++) {
+ $errors[] = $messages[$i];
+ if ($messages[$i][0] == 'ERROR') {
+ $success = false;
+ $allOk = false;
+ }
+ elseif ($messages[$i][0] == 'WARN') {
+ $allOk = false;
+ }
+ }
if (!$success) {
$stopprocessing = true;
break;
@@ -177,7 +193,10 @@ if (isset($_POST['delete'])) {
if (isset($attributes[$DNs[$i]]['errors'])) {
foreach ($attributes[$DNs[$i]]['errors'] as $singleerror) {
$errors[] = $singleerror;
- if ($singleerror[0] == 'ERROR') $stopprocessing = true;
+ if ($singleerror[0] == 'ERROR') {
+ $stopprocessing = true;
+ $allOk = false;
+ }
}
}
if (!$stopprocessing) {
@@ -187,6 +206,7 @@ if (isset($_POST['delete'])) {
if (!$success) {
$errors[] = array ('ERROR', sprintf(_('Was unable to modify attribtues from DN: %s.'), $DNs[$i]), ldap_error($_SESSION['ldap']->server()));
$stopprocessing = true;
+ $allOk = false;
}
}
// add attributes
@@ -195,6 +215,7 @@ if (isset($_POST['delete'])) {
if (!$success) {
$errors[] = array ('ERROR', sprintf(_('Was unable to add attribtues to DN: %s.'), $DNs[$i]), ldap_error($_SESSION['ldap']->server()));
$stopprocessing = true;
+ $allOk = false;
}
}
// removce attributes
@@ -203,6 +224,7 @@ if (isset($_POST['delete'])) {
if (!$success) {
$errors[] = array ('ERROR', sprintf(_('Was unable to remove attribtues from DN: %s.'), $DNs[$i]), ldap_error($_SESSION['ldap']->server()));
$stopprocessing = true;
+ $allOk = false;
}
}
}
@@ -210,34 +232,53 @@ if (isset($_POST['delete'])) {
}
if (!$stopprocessing) {
$errors = deleteDN($_SESSION['delete_dn'][$m]);
- if (sizeof($errors) > 0) $stopprocessing = true;
+ if (sizeof($errors) > 0) {
+ $stopprocessing = true;
+ $allOk = false;
+ }
}
// post delete actions
if (!$stopprocessing) {
foreach ($moduleNames as $singlemodule) {
- $modules[$singlemodule]->postDeleteActions();
+ $messages = $modules[$singlemodule]->postDeleteActions();
+ for ($i = 0; $i < sizeof($messages); $i++) {
+ $errors[] = $messages[$i];
+ if (($messages[$i][0] == 'ERROR') || ($messages[$i][0] == 'WARN')) {
+ $allOk = false;
+ }
+ }
}
}
if (!$stopprocessing) {
echo sprintf(_('Deleted DN: %s'), $_SESSION['delete_dn'][$m]) . " \n";
- foreach ($errors as $error) StatusMessage($error[0], $error[1], $error[2]);
+ foreach ($errors as $error) {
+ call_user_func_array('StatusMessage', $error);
+ }
echo " \n";
flush();
}
else {
echo sprintf(_('Error while deleting DN: %s'), $_SESSION['delete_dn'][$m]) . " \n";
- foreach ($errors as $error) StatusMessage($error[0], $error[1], $error[2]);
+ foreach ($errors as $error) {
+ call_user_func_array('StatusMessage', $error);
+ }
echo " \n";
}
}
echo " \n";
echo " \n";
+ echo " \n";
echo "\n";
echo "\n";
?>