/**
*/
protected function _init()
{
global $injector, $notification, $page_output;
$this->_assertCategory('Ingo_Rule_System_Whitelist', _("Whitelist"));
$ingo_storage = $injector->getInstance('Ingo_Factory_Storage')->create();
$whitelist = $ingo_storage->getSystemRule('Ingo_Rule_System_Whitelist');
/* Token checking & perform requested actions. */
switch ($this->_checkToken(array('rule_update'))) {
case 'rule_update':
try {
$whitelist->addresses = $this->vars->whitelist;
$ingo_storage->updateRule($whitelist);
$notification->push(_("Changes saved."), 'horde.success');
$injector->getInstance('Ingo_Factory_Script')->activateAll();
} catch (Ingo_Exception $e) {
$notification->push($e);
}
break;
}
/* Prepare the view. */
$view = new Horde_View(array('templatePath' => INGO_TEMPLATES . '/basic/whitelist'));
$view->addHelper('Horde_Core_View_Helper_Help');
$view->addHelper('Horde_Core_View_Helper_Label');
$view->addHelper('Text');
$view->disabled = $whitelist->disable;
$view->formurl = $this->_addToken(self::url());
$view->whitelist = implode("\n", $whitelist->addresses);
$page_output->addScriptFile('whitelist.js');
$page_output->addInlineJsVars(array('IngoWhitelist.filtersurl' => strval(Ingo_Basic_Filters::url()->setRaw(true))));
$this->title = _("Whitelist Edit");
$this->output = $view->render('whitelist');
}