index 98f02cee2fa00e1f020fc4958dc88d4833b15697..6bdd603ca37cd0519a890868d897bbb648e12251 100644 (file)
public $plHeadline = "unconfigured";
// The currently used object(s) (e.g. in edit, removal)
- protected $dn = "";
+ public $dn = ""; // this is public due to some compatibility problems with class plugin..
protected $dns = array();
// The last used object(s).
// The tab definitions to use for the current object.
protected $tabClass = ""; // e.g. usertabs
protected $tabType = ""; // e.g. USERTABS
+ protected $aclPlugin = ""; // e.g. generic
protected $aclCategory = ""; // e.g. users
protected $objectName = ""; // e.g. users
protected $actions = array();
// Attributes managed by this plugin, can be used in post events;
- protected $attributes = array();
+ public $attributes = array();
function __construct(&$config,$ui,$plugname, $headpage)
{
$this->registerAction("saveSnapshot","saveSnapshot");
$this->registerAction("restoreSnapshot","restoreSnapshot");
$this->registerAction("cancelSnapshot","closeDialogs");
+
+ $this->registerAction("config-filter","editFilter");
}
/*! \brief Execute this plugin
$this->filter->update();
session::global_set(get_class($this)."_filter", $this->filter);
session::set('autocomplete', $this->filter);
- if (!$this->filter->isValid()){
- msg_dialog::display(_("Filter error"), _("The filter is incomplete!"), ERROR_DIALOG);
- }
}
// Handle actions (POSTs and GETs)
// Display tab object.
if($this->tabObject instanceOf tabs || $this->tabObject instanceOf multi_plug){
- $this->tabObject->save_object();
+# $this->tabObject->save_object();
$display = $this->tabObject->execute();
$display.= $this->_getTabFooter();
return($this->getHeader().$display);
$this->snapHandler->setSnapshotBases($bases);
}
-
+
// Display list
return($this->renderList());
}
-
+
+ function editFilter()
+ {
+ $headpage = $this->getHeadpage();
+ $this->dialogObject = new userFilter($this->config,$headpage->categories);
+ }
+
function renderList()
{
$this->headpage->update();
*/
protected function getHeader()
{
- if($this->skipHeader) return("");
-
- if (get_object_info() != ""){
- $display= print_header(get_template_path($this->plIcon),_($this->plDescription),
- "<img alt=\"\" class=\"center\" src=\"".get_template_path('images/lists/locked.png')."\">".
- LDAP::fix(get_object_info()));
- } else {
- $display= print_header(get_template_path($this->plIcon),_($this->plDescription));
- }
- return($display);
+ // We do not display any headers right now.
+ if(1 || $this->skipHeader) return("");
}
if(isset($_POST['edit_cancel'])) $action['action'] = "cancel";
if(isset($_POST['delete_confirmed'])) $action['action'] = "removeConfirmed";
if(isset($_POST['delete_cancel'])) $action['action'] = "cancelDelete";
+ if(isset($_POST['saveFilter'])) $action['action'] = "save";
+ if(isset($_POST['cancelFilter'])) $action['action'] = "cancel";
// Detect Snapshot actions
if(isset($_POST['CreateSnapshot'])) $action['action'] = "saveSnapshot";
* @param Array 'all' A combination of both 'action' and 'target'.
*/
function saveSnapshot($action="",$target=array(),$all=array())
- {
+ {
+ if(!is_object($this->dialogObject)) return;
$this->dialogObject->save_object();
$msgs = $this->dialogObject->check();
if(count($msgs)){
if(empty($tabClass) || empty($tabType)){
// No tab type defined
}else{
- $this->tabObject= new $tabClass($this->config,$this->config->data['TABS'][$tabType], $this->dn, $aclCategory);
- $this->tabObject->set_acl_base($this->headpage->getBase());
- $this->tabObject->parent = &$this;
- @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__,$this->dn,"Create new entry initiated!");
+ if (isset($this->config->data['TABS'][$tabType])) {
+ $this->tabObject= new $tabClass($this->config,$this->config->data['TABS'][$tabType], $this->dn, $aclCategory);
+ $this->tabObject->set_acl_base($this->headpage->getBase());
+ $this->tabObject->parent = &$this;
+ @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__,$this->dn,"Create new entry initiated!");
+ } else {
+ msg_dialog::display(_("Error"), sprintf(_("No tab declaration for '%s' found in your configuration file. Cannot create plugin instance!"), $tabType), ERROR_DIALOG);
+ }
}
}
msg_dialog::display(_("Error"), $message, ERROR_DIALOG);
}
}
+ }
+ function is_modal_dialog()
+ {
+ return(is_object($this->tabObject) || is_object($this->dialogObject));
+ }
+
+
+ /*! \brief Forward command execution request
+ * to the correct method.
+ */
+ function handle_post_events($mode, $addAttrs= array())
+ {
+ if(!in_array($mode, array('add','remove','modify'))){
+ trigger_error(sprintf("Invalid post event type given '%s'! Valid types are [add,modify,remove].", $mode));
+ return;
+ }
+ switch ($mode){
+ case "add":
+ plugin::callHook($this,"POSTCREATE", $addAttrs);
+ break;
+
+ case "modify":
+ plugin::callHook($this,"POSTMODIFY", $addAttrs);
+ break;
+
+ case "remove":
+ plugin::callHook($this,"POSTREMOVE", $addAttrs);
+ break;
+ }
}
}