From d51f17648ac98e9662589c759cd381d0afe513bd Mon Sep 17 00:00:00 2001 From: cajus Date: Wed, 31 May 2006 09:56:34 +0000 Subject: [PATCH] Added option for plugins to stop delete process git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@3577 594d385d-05f5-0310-b6e9-bd551577e9d8 --- include/class_plugin.inc | 8 ++++++++ include/class_tabs.inc | 9 +++++++++ 2 files changed, 17 insertions(+) diff --git a/include/class_plugin.inc b/include/class_plugin.inc index 15180d73c..7ba3a4054 100644 --- a/include/class_plugin.inc +++ b/include/class_plugin.inc @@ -972,6 +972,14 @@ class plugin } + + /* Add possibility to stop remove process */ + function allow_remove() + { + $reason= ""; + return $reason; + } + } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: ?> diff --git a/include/class_tabs.inc b/include/class_tabs.inc index 689d89268..e0e8dbe42 100644 --- a/include/class_tabs.inc +++ b/include/class_tabs.inc @@ -175,6 +175,15 @@ class tabs function delete() { + /* Check if all plugins will ACK for deletion */ + foreach (array_reverse($this->by_object) as $key => $obj){ + $reason= $obj->allow_remove(); + if ($reason != ""){ + print_red(sprintf(_("Delete process has been canceled by plugin '%s': %s"), $key, $reason)); + return; + } + } + /* Delete for all plugins */ foreach (array_reverse($this->by_object) as $key => $obj){ $obj->remove_from_parent(); -- 2.30.2