Пример #1
0
 /**
  */
 protected function _init()
 {
     global $injector, $notification;
     /* Redirect if forward is not available. */
     $this->_assertCategory(Ingo_Storage::ACTION_FORWARD, _("Forward"));
     if ($this->vars->submitbutton == _("Return to Rules List")) {
         Ingo_Basic_Filters::url()->redirect();
     }
     /* Get the forward object and rule. */
     $ingo_storage = $injector->getInstance('Ingo_Factory_Storage')->create();
     $forward = $ingo_storage->retrieve(Ingo_Storage::ACTION_FORWARD);
     $filters = $ingo_storage->retrieve(Ingo_Storage::ACTION_FILTERS);
     $fwd_id = $filters->findRuleId(Ingo_Storage::ACTION_FORWARD);
     $fwd_rule = $filters->getRule($fwd_id);
     /* Build form. */
     $form = new Ingo_Form_Forward($this->vars);
     /* Perform requested actions. Ingo_Form_Forward does token checking
      * for us. */
     if ($form->validate($this->vars)) {
         $forward->setForwardAddresses($this->vars->addresses);
         $forward->setForwardKeep($this->vars->keep_copy == 'on');
         try {
             $ingo_storage->store($forward);
             $notification->push(_("Changes saved."), 'horde.success');
             if ($this->vars->submitbutton == _("Save and Enable")) {
                 $filters->ruleEnable($fwd_id);
                 $ingo_storage->store($filters);
                 $notification->push(_("Rule Enabled"), 'horde.success');
                 $fwd_rule['disable'] = false;
             } elseif ($this->vars->submitbutton == _("Save and Disable")) {
                 $filters->ruleDisable($fwd_id);
                 $ingo_storage->store($filters);
                 $notification->push(_("Rule Disabled"), 'horde.success');
                 $fwd_rule['disable'] = true;
             }
             Ingo_Script_Util::update();
         } catch (Ingo_Exception $e) {
             $notification->push($e);
         }
     }
     /* Add buttons depending on the above actions. */
     $form->setCustomButtons($fwd_rule['disable']);
     /* Set default values. */
     if (!$form->isSubmitted()) {
         $this->vars->keep_copy = $forward->getForwardKeep();
         $this->vars->addresses = implode("\n", $forward->getForwardAddresses());
     }
     /* Set form title. */
     $form_title = _("Forward");
     if (!empty($fwd_rule['disable'])) {
         $form_title .= ' [<span class="horde-form-error">' . _("Disabled") . '</span>]';
     }
     $form_title .= ' ' . Horde_Help::link('ingo', 'forward');
     $form->setTitle($form_title);
     $this->header = _("Forwards Edit");
     Horde::startBuffer();
     $form->renderActive(new Horde_Form_Renderer(array('encode_title' => false, 'varrenderer_driver' => array('ingo', 'ingo'))), $this->vars, self::url(), 'post');
     $this->output = Horde::endBuffer();
 }
Пример #2
0
 /**
  * Renders this page in display mode.
  *
  * @throws Wicked_Exception
  */
 public function display()
 {
     global $injector, $page_output, $wicked;
     $view = $injector->createInstance('Horde_View');
     $view->action = Wicked::url('NewPage');
     $view->formInput = Horde_Util::formInput();
     $view->referrer = $this->referrer();
     $view->name = $this->pageName();
     if ($this->_results) {
         $page_output->addScriptFile('tables.js', 'horde');
         $view->pages = array();
         foreach ($this->_results as $page) {
             if (!empty($page['page_history'])) {
                 $page = new Wicked_Page_StandardHistoryPage($page);
             } else {
                 $page = new Wicked_Page_StandardPage($page);
             }
             $view->pages[] = $page->toView();
         }
     }
     $view->templates = $wicked->getMatchingPages('Template', Wicked_Page::MATCH_ENDS);
     $view->help = Horde_Help::link('wicked', 'Templates');
     return $view->render('edit/create');
 }
Пример #3
0
?>
</span><br />
      <input type="text" id="kronolithCalendarinternalUrlFeed" class="kronolithLongField" onfocus="this.select()" /><br />
    </div>
    <div>
      <label for="kronolithCalendarinternalEmbedUrl"><?php 
echo _("Embed Script");
?>
</label>
      <span class="kronolithSeparator">&mdash; <?php 
echo _("Embed calendar on external website");
?>
</span><br />
      <input type="text" id="kronolithCalendarinternalEmbedUrl" class="kronolithLongField" onfocus="this.select()" /><br />
      <?php 
echo Horde_Help::link('kronolith', 'embed') . ' ' . _("Learn how to embed other calendar views.");
?>
<br />
    </div>
  </div>
</div>

<div id="kronolithCalendarinternalTabPerms" class="kronolithTabsOption" style="display:none">
<?php 
$type = 'internal';
include __DIR__ . '/permissions.inc';
?>
</div>

<div id="kronolithCalendarinternalTabImport" class="kronolithTabsOption" style="display:none">
  <div class="kronolithDialogInfo"><?php 
Пример #4
0
 /**
  */
 protected function _init()
 {
     global $injector, $notification;
     $this->_assertCategory(Ingo_Storage::ACTION_SPAM, _("Spam filtering"));
     /* Get the spam object and rule. */
     $ingo_storage = $injector->getInstance('Ingo_Factory_Storage')->create();
     $spam = $ingo_storage->retrieve(Ingo_Storage::ACTION_SPAM);
     $filters = $ingo_storage->retrieve(Ingo_Storage::ACTION_FILTERS);
     $spam_id = $filters->findRuleId(Ingo_Storage::ACTION_SPAM);
     $spam_rule = $filters->getRule($spam_id);
     if ($this->vars->submitbutton == _("Return to Rules List")) {
         Ingo_Basic_Filters::url()->redirect();
     }
     /* Build form. */
     $form = new Ingo_Form_Spam($this->vars);
     $renderer = new Horde_Form_Renderer(array('encode_title' => false, 'varrenderer_driver' => array('ingo', 'ingo')));
     /* Perform requested actions. Ingo_Form_Spam does token checking for
      * us .*/
     if ($form->validate($this->vars)) {
         $success = false;
         try {
             $spam->setSpamFolder($this->validateMbox('folder'));
             $success = true;
         } catch (Horde_Exception $e) {
             $notification->push($e);
         }
         $spam->setSpamLevel($this->vars->level);
         try {
             $ingo_storage->store($spam);
             $notification->push(_("Changes saved."), 'horde.success');
             if ($this->vars->submitbutton == _("Save and Enable")) {
                 $filters->ruleEnable($spam_id);
                 $ingo_storage->store($filters);
                 $notification->push(_("Rule Enabled"), 'horde.success');
                 $spam_rule['disable'] = false;
             } elseif ($this->vars->submitbutton == _("Save and Disable")) {
                 $filters->ruleDisable($spam_id);
                 $ingo_storage->store($filters);
                 $notification->push(_("Rule Disabled"), 'horde.success');
                 $spam_rule['disable'] = true;
             }
             Ingo_Script_Util::update();
         } catch (Ingo_Exception $e) {
             $notification->push($e);
         }
     }
     /* Add buttons depending on the above actions. */
     $form->setCustomButtons($spam_rule['disable']);
     /* Set default values. */
     $form->folder_var->type->setFolder($spam->getSpamFolder());
     if (!$form->isSubmitted()) {
         $this->vars->level = $spam->getSpamLevel();
         $this->vars->folder = $spam->getSpamFolder();
         $this->vars->actionID = '';
     }
     /* Set form title. */
     $form_title = _("Spam Filtering");
     if (!empty($spam_rule['disable'])) {
         $form_title .= ' [<span class="horde-form-error">' . _("Disabled") . '</span>]';
     }
     $form_title .= ' ' . Horde_Help::link('ingo', 'spam');
     $form->setTitle($form_title);
     $this->header = _("Spam Filtering");
     Horde::startBuffer();
     $form->renderActive($renderer, $this->vars, self::url(), 'post');
     $this->output = Horde::endBuffer();
 }
Пример #5
0
 /**
  */
 protected function _init()
 {
     global $injector, $notification;
     $this->_assertCategory(Ingo_Storage::ACTION_VACATION, _("Vacation"));
     /* Get vacation object and rules. */
     $ingo_storage = $injector->getInstance('Ingo_Factory_Storage')->create();
     $vacation = $ingo_storage->retrieve(Ingo_Storage::ACTION_VACATION);
     $filters = $ingo_storage->retrieve(Ingo_Storage::ACTION_FILTERS);
     $vac_id = $filters->findRuleId(Ingo_Storage::ACTION_VACATION);
     $vac_rule = $filters->getRule($vac_id);
     /* Load libraries. */
     if ($this->vars->submitbutton == _("Return to Rules List")) {
         Ingo_Basic_Filters::url()->redirect();
     }
     /* Build form. */
     $form = new Ingo_Form_Vacation($this->vars, '', null, $injector->getInstance('Ingo_Factory_Script')->create(Ingo::RULE_VACATION)->availableCategoryFeatures(Ingo_Storage::ACTION_VACATION));
     /* Perform requested actions. Ingo_Form_Vacation does token checking
      * for us. */
     if ($form->validate($this->vars)) {
         $form->getInfo($this->vars, $info);
         $vacation->setVacationAddresses(isset($info['addresses']) ? $info['addresses'] : '');
         $vacation->setVacationDays($info['days']);
         $vacation->setVacationExcludes($info['excludes']);
         $vacation->setVacationIgnorelist($info['ignorelist'] == 'on');
         $vacation->setVacationReason($info['reason']);
         $vacation->setVacationSubject($info['subject']);
         $vacation->setVacationStart($info['start']);
         $vacation->setVacationEnd($info['end']);
         try {
             $ingo_storage->store($vacation);
             $notification->push(_("Changes saved."), 'horde.success');
             if ($this->vars->submitbutton == _("Save and Enable")) {
                 $filters->ruleEnable($vac_id);
                 $ingo_storage->store($filters);
                 $notification->push(_("Rule Enabled"), 'horde.success');
                 $vac_rule['disable'] = false;
             } elseif ($this->vars->get('submitbutton') == _("Save and Disable")) {
                 $filters->ruleDisable($vac_id);
                 $ingo_storage->store($filters);
                 $notification->push(_("Rule Disabled"), 'horde.success');
                 $vac_rule['disable'] = true;
             }
             Ingo_Script_Util::update();
         } catch (Ingo_Exception $e) {
             $notification->push($e);
         }
     }
     /* Add buttons depending on the above actions. */
     $form->setCustomButtons($vac_rule['disable']);
     /* Make sure we have at least one address. */
     if (!$vacation->getVacationAddresses()) {
         $identity = $injector->getInstance('Horde_Core_Factory_Identity')->create();
         $addresses = implode("\n", $identity->getAll('from_addr'));
         /* Remove empty lines. */
         $addresses = trim(preg_replace('/\\n+/', "\n", $addresses));
         if (empty($addresses)) {
             $addresses = $GLOBALS['registry']->getAuth();
         }
         $vacation->setVacationAddresses($addresses);
     }
     /* Set default values. */
     if (!$form->isSubmitted()) {
         $this->vars->set('addresses', implode("\n", $vacation->getVacationAddresses()));
         $this->vars->set('excludes', implode("\n", $vacation->getVacationExcludes()));
         $this->vars->set('ignorelist', $vacation->getVacationIgnorelist());
         $this->vars->set('days', $vacation->getVacationDays());
         $this->vars->set('subject', $vacation->getVacationSubject());
         $this->vars->set('reason', $vacation->getVacationReason());
         $this->vars->set('start', $vacation->getVacationStart());
         $this->vars->set('end', $vacation->getVacationEnd());
         $this->vars->set('start_year', $vacation->getVacationStartYear());
         $this->vars->set('start_month', $vacation->getVacationStartMonth() - 1);
         $this->vars->set('start_day', $vacation->getVacationStartDay() - 1);
         $this->vars->set('end_year', $vacation->getVacationEndYear());
         $this->vars->set('end_month', $vacation->getVacationEndMonth() - 1);
         $this->vars->set('end_day', $vacation->getVacationEndDay() - 1);
     }
     /* Set form title. */
     $form_title = _("Vacation");
     if (!empty($vac_rule['disable'])) {
         $form_title .= ' [<span class="horde-form-error">' . _("Disabled") . '</span>]';
     }
     $form_title .= ' ' . Horde_Help::link('ingo', 'vacation');
     $form->setTitle($form_title);
     $this->header = _("Vacation Edit");
     Horde::startBuffer();
     $form->renderActive(new Horde_Form_Renderer(array('encode_title' => false, 'varrenderer_driver' => array('ingo', 'ingo'))), $this->vars, self::url(), 'post');
     $this->output = Horde::endBuffer();
 }
Пример #6
0
 function _renderVarInputEnd(&$form, &$var, &$vars)
 {
     /* Display any description for the field. */
     if ($var->hasDescription()) {
         echo '<br />' . $var->getDescription();
     }
     /* Display any help for the field. */
     if ($var->hasHelp()) {
         global $registry;
         if (isset($registry) && $registry instanceof Horde_Registry) {
             $link = Horde_Help::link($GLOBALS['registry']->getApp(), $var->getHelp());
         } else {
             $link = '<a href="#" onclick="alert(\'' . addslashes(@htmlspecialchars($var->getHelp())) . '\');return false;">' . $this->_helpMarker . '</a>';
         }
         echo "</td>\n  <td style=\"text-align:right\">{$link}&nbsp;";
     }
     echo "</td>\n</tr>\n";
 }
Пример #7
0
  <p>
    <label for="kronolithCalendartasklistsUrlAccount"><?php 
echo _("CalDAV Account URL");
?>
</label>
    <span class="kronolithSeparator">&mdash; <?php 
echo _("Subscribe to all your calendars from another calendar program");
?>
</span><br />
    <input type="text" id="kronolithCalendartasklistsUrlAccount" class="kronolithLongField" onfocus="this.select()" value="<?php 
echo $accountUrl;
?>
" />
  </p>
    <p><?php 
echo Horde_Help::link('kronolith', 'caldav') . ' ' . _("Learn how to subscribe via CalDAV from calendar clients.");
?>
</p>
    <hr />
  <p>
    <label for="kronolithCalendartasklistsUrlWebdav"><?php 
echo _("WebDAV/ICS Subscription URL");
?>
</label>
    <span class="kronolithSeparator">&mdash; <?php 
echo _("Subscribe to this task list from another calendar program");
?>
</span><br />
    <input type="text" id="kronolithCalendartasklistsUrlWebdav" class="kronolithLongField" onfocus="this.select()" />
  </p>
</div>
Пример #8
0
$template->dir = Gollem::$backend['dir'];
$template->navlink = Gollem::directoryNavLink(Gollem::$backend['dir'], $manager_url);
$template->refresh = Horde::widget(array('url' => $refresh_url, 'title' => _("Refresh"), 'id' => 'gollem-refresh'));
$template->hasclipboard = $edit_perms;
$shares_enabled = !empty(Gollem::$backend['shares']) && strpos(Gollem::$backend['dir'], Gollem::$backend['home']) === 0;
if ($shares_enabled) {
    $shares = $injector->getInstance('Gollem_Shares');
    $perms_url_base = Horde::url('share.php', true)->add('app', 'gollem');
    $share_name = $backkey . '|' . Gollem::$backend['dir'];
    $template->share_folder = Horde::widget(array('url' => $perms_url_base->add('share', $share_name), 'title' => _("Share Folder"), 'target' => '_blank', 'class' => 'gollem-sharefolder', 'onclick' => Horde::popupJs($perms_url_base, array('params' => array('share' => $share_name), 'urlencode' => true)) . 'return false;'));
}
if ($edit_perms) {
    $template->perms_edit = true;
    $template->upload_file = _("Upload File(s)");
    $template->upload_identifier = session_id();
    $template->upload_help = Horde_Help::link('gollem', 'file-upload');
    $template->perms_chmod = in_array('permission', $columns);
    $injector->getInstance('Horde_View_Sidebar')->addNewButton(_("Create Folder"), Horde::url('#'), array('id' => 'gollem-createfolder'));
} else {
    $template->perms_edit = false;
    $template->perms_chmod = false;
}
if ($read_perms) {
    $template->change_folder = Horde::widget(array('url' => Horde::url('#'), 'title' => _("Change Folder"), 'id' => 'gollem-changefolder'));
}
if ($numitem) {
    $template->list_count = true;
    $template->perms_delete = $delete_perms;
    $topbar = $injector->getInstance('Horde_View_Topbar');
    $topbar->search = true;
    $topbar->searchAction = $refresh_url;
Пример #9
0
Файл: Ui.php Проект: horde/horde
 /**
  * Generate the UI for the preferences interface, either for a
  * specific group, or the group selection interface.
  *
  * @throws Horde_Exception
  */
 public function generateUI()
 {
     global $notification, $page_output, $prefs, $registry;
     $columns = $pref_list = array();
     $identities = false;
     $prefgroups = $this->_getPrefGroups();
     if ($this->group) {
         $pref_list = $this->getChangeablePrefs($this->group);
         if (empty($pref_list)) {
             $this->group = '';
             $this->generateUI();
             return;
         }
         /* Add necessary init stuff for identities pages. */
         if (isset($prefgroups[$this->group]['type']) && $prefgroups[$this->group]['type'] == 'identities') {
             $page_output->addScriptFile('identityselect.js', 'horde');
             $identities = true;
             /* If this is an identities group, need to grab the base
              * identity fields from Horde, if current app is NOT Horde. */
             $pref_list = $this->_addHordeIdentitiesPrefs($pref_list);
         }
     } else {
         foreach ($prefgroups as $key => $val) {
             $columns[$val['column']][$key] = $val;
         }
     }
     if (empty($columns) && empty($pref_list)) {
         $notification->push(Horde_Core_Translation::t("There are no preferences available for this application."), 'horde.message');
         $this->nobuttons = true;
     }
     $options_link = $registry->getServiceLink('prefs');
     $h_templates = $registry->get('templates', 'horde');
     $base = $GLOBALS['injector']->createInstance('Horde_Template');
     $base->setOption('gettext', true);
     /* Need to buffer output - it is possible that 'special' types can
      * do things like add javascript to the page output. This should all
      * be combined and served in the page HEAD. */
     Horde::startBuffer();
     $page_output->addScriptFile('prefs.js', 'horde');
     if ($this->group) {
         if ($identities) {
             echo $this->_identityHeader($pref_list);
         }
         foreach ($pref_list as $pref) {
             if (isset($this->prefs[$pref]['on_init']) && is_callable($this->prefs[$pref]['on_init'])) {
                 $this->prefs[$pref]['on_init']($this);
             }
             if ($this->prefs[$pref]['type'] == 'special' && isset($this->prefs[$pref]['handler']) && ($ob = $GLOBALS['injector']->getInstance($this->prefs[$pref]['handler']))) {
                 $ob->init($this);
                 echo $ob->display($this);
                 continue;
             }
             $t = clone $base;
             if (isset($this->_errors[$pref])) {
                 echo $t->fetch(HORDE_TEMPLATES . '/prefs/error_start.html');
             }
             if (isset($this->prefs[$pref]['desc'])) {
                 $t->set('desc', Horde::label($pref, $this->prefs[$pref]['desc']));
             }
             $t->set('helplink', empty($this->prefs[$pref]['help']) ? null : Horde_Help::link(empty($this->prefs[$pref]['shared']) ? $this->app : 'horde', $this->prefs[$pref]['help']));
             $t->set('pref', htmlspecialchars($pref));
             $type = $this->prefs[$pref]['type'];
             switch ($type) {
                 case 'checkbox':
                     $t->set('checked', $prefs->getValue($pref));
                     break;
                 case 'enum':
                     $enum = $this->prefs[$pref]['enum'];
                     $esc = !empty($this->prefs[$pref]['escaped']);
                     $curval = $prefs->getValue($pref);
                     $tmp = array();
                     foreach ($enum as $key => $val) {
                         $tmp[] = array('l' => $esc ? $val : htmlspecialchars($val), 's' => $curval == $key, 'v' => $esc ? $key : htmlspecialchars($key));
                     }
                     $t->set('enum', $tmp);
                     break;
                 case 'prefslink':
                     $url = $this->selfUrl()->add('group', $this->prefs[$pref]['group']);
                     if (!empty($this->prefs[$pref]['app'])) {
                         $url->add('app', $this->prefs[$pref]['app']);
                     }
                     $this->prefs[$pref]['url'] = $url;
                     $type = 'link';
                     // Fall through to 'link'
                 // Fall through to 'link'
                 case 'link':
                     if (isset($this->prefs[$pref]['img'])) {
                         $t->set('img', Horde_Themes_Image::tag($this->prefs[$pref]['img'], array('alt' => $this->prefs[$pref]['desc'], 'attr' => array('class' => 'prefsLinkImg'))));
                     }
                     $t->set('url', isset($this->prefs[$pref]['url']) ? Horde::url($this->prefs[$pref]['url']) : $this->prefs[$pref]['xurl']);
                     if (isset($this->prefs[$pref]['target'])) {
                         $t->set('target', htmlspecialchars($this->prefs[$pref]['target']));
                     }
                     break;
                 case 'multienum':
                     $enum = $this->prefs[$pref]['enum'];
                     $esc = !empty($this->prefs[$pref]['escaped']);
                     if (!($selected = @unserialize($prefs->getValue($pref)))) {
                         $selected = array();
                     }
                     $tmp = array();
                     foreach ($enum as $key => $val) {
                         $tmp[] = array('l' => $esc ? $val : htmlspecialchars($val), 's' => in_array($key, $selected), 'v' => $esc ? $key : htmlspecialchars($key));
                     }
                     $t->set('enum', $tmp);
                     $t->set('size', min(4, count($enum)));
                     break;
                 case 'number':
                     $t->set('val', htmlspecialchars(intval($prefs->getValue($pref))));
                     break;
                 case 'password':
                 case 'text':
                 case 'textarea':
                     $t->set('val', htmlspecialchars($prefs->getValue($pref)));
                     break;
                 case 'rawhtml':
                     $t->set('html', $this->prefs[$pref]['value']);
                     break;
                 default:
                     throw new LogicException(sprintf('Missing or invalid type option for the %s preference.', $pref));
             }
             echo $t->fetch(HORDE_TEMPLATES . '/prefs/' . $type . '.html');
             if (isset($this->_errors[$pref])) {
                 $t->set('error', htmlspecialchars($this->_errors[$pref]));
                 echo $t->fetch(HORDE_TEMPLATES . '/prefs/error_end.html');
             }
         }
         $t = clone $base;
         $t->set('buttons', !$this->nobuttons);
         $t->set('prefgroups', count($prefgroups) > 1);
         echo $t->fetch($h_templates . '/prefs/end.html');
     } elseif (!empty($columns)) {
         $t = clone $base;
         $span = round(100 / count($columns));
         $cols = array();
         foreach ($columns as $key => $column) {
             $tmp = array('groups' => array(), 'hdr' => htmlspecialchars($key), 'width' => $span - 1);
             foreach ($column as $group => $gvals) {
                 if ($this->groupIsEditable($group)) {
                     $tmp['groups'][] = array('desc' => htmlspecialchars($gvals['desc']), 'link' => Horde::widget(array('url' => $options_link->copy()->add(array('app' => $this->app, 'group' => $group)), 'title' => $gvals['label'])));
                 }
             }
             $cols[] = $tmp;
         }
         $t->set('columns', $cols);
         echo $t->fetch($h_templates . '/prefs/overview.html');
     }
     $content = Horde::endBuffer();
     /* Get the menu output before we start to output the page.
      * Again, this will catch any javascript inserted into the page. */
     $GLOBALS['page_output']->sidebar = false;
     /* Get list of accessible applications. */
     $apps = array();
     foreach ($registry->listApps() as $app) {
         // Make sure the app is installed and has a prefs file.
         if (file_exists($registry->get('fileroot', $app) . '/config/prefs.php')) {
             $apps[$app] = $registry->get('name', $app);
         }
     }
     asort($apps);
     /* Ouptut screen. */
     $page_output->header(array('body_id' => 'services_prefs', 'title' => Horde_Core_Translation::t("User Preferences"), 'view' => $registry::VIEW_BASIC));
     $notification->notify(array('listeners' => 'status'));
     $base_ui = clone $base;
     $base_ui->set('action', $options_link);
     $base_ui->set('forminput', Horde_Util::formInput());
     /* Show the current application and a form for switching
      * applications. */
     $t = clone $base_ui;
     $t->set('horde', !empty($apps['horde']) && $this->app != 'horde');
     unset($apps['horde'], $apps[$this->app]);
     $tmp = array();
     foreach ($apps as $key => $val) {
         $tmp[] = array('l' => htmlspecialchars($val), 'v' => htmlspecialchars($key));
     }
     $t->set('apps', $tmp);
     if ($this->app == 'horde') {
         $header = Horde_Core_Translation::t("Global Preferences");
     } else {
         $header = sprintf(Horde_Core_Translation::t("Preferences for %s"), Horde::url($registry->getInitialPage($this->app))->link() . htmlspecialchars($registry->get('name', $this->app)) . '</a>');
     }
     $t->set('header', $header);
     $t->set('has_advanced', $this->hasAdvancedPrefs());
     if ($GLOBALS['session']->get('horde', 'prefs_advanced')) {
         $t->set('basic', $this->selfUrl()->add('show_basic', 1));
     } else {
         $t->set('advanced', $this->selfUrl()->add('show_advanced', 1));
     }
     echo $t->fetch($h_templates . '/prefs/app.html');
     /* Generate navigation header. */
     if ($this->group) {
         $t = clone $base_ui;
         $t->set('app', htmlspecialchars($this->app));
         $t->set('group', htmlspecialchars($this->group));
         $t->set('label', htmlspecialchars($this->prefGroups[$this->group]['label']));
         $t->set('token', $GLOBALS['injector']->getInstance('Horde_Token')->get('horde.prefs'));
         // Search for previous and next groups.
         if (count($prefgroups) > 1) {
             $prefgroups = array_keys($prefgroups);
             $key = array_search($this->group, $prefgroups);
             $previous = isset($prefgroups[$key - 1]) ? $prefgroups[$key - 1] : end($prefgroups);
             $next = isset($prefgroups[$key + 1]) ? $prefgroups[$key + 1] : reset($prefgroups);
             $prefs_url = $this->selfUrl();
             if ($next != $previous) {
                 $t->set('prev', $prefs_url->copy()->add('group', $previous));
                 $t->set('prevlabel', htmlspecialchars($this->prefGroups[$previous]['label']));
                 $t->set('previcon', Horde_Themes_Image::tag('nav/left.png'));
             }
             $t->set('next', $prefs_url->copy()->add('group', $next));
             $t->set('nextlabel', htmlspecialchars($this->prefGroups[$next]['label']));
             $t->set('nexticon', Horde_Themes_Image::tag('nav/right.png'));
         }
         echo $t->fetch($h_templates . '/prefs/begin.html');
     }
     echo $content;
     $GLOBALS['page_output']->footer();
 }
Пример #10
0
 /**
  * Wrapper around the Horde_Help::link() method.
  *
  * @see Horde_Help::link()
  */
 public function hordeHelp($app, $topic)
 {
     return Horde_Help::link($app, $topic);
 }
Пример #11
0
 /**
  * Renders the end of an writeable form entry, including any form notes
  * and help info.
  *
  * @access private
  * @author Matt Warden <*****@*****.**>
  * @author  Robert E. Coyle <*****@*****.**>
  */
 function _renderVarInputEnd($form, $var)
 {
     /* Display any help for the field. */
     if ($var->hasHelp()) {
         global $registry;
         if (isset($registry) && is_a($registry, 'Registry')) {
             $help = Horde_Help::link($GLOBALS['registry']->getApp(), $var->getHelp());
         } else {
             $help = @htmlspecialchars($var->getHelp());
         }
         echo '<p class="form-hint">', $help, '</p>';
     }
     /* Display any description for the field. */
     if ($var->hasDescription()) {
         echo '<div class="form-note"><p>', $var->getDescription(), '</p></div>';
     } else {
         echo '<br class="clear" />';
     }
     echo '</div>';
 }
Пример #12
0
 /**
  */
 protected function _init()
 {
     global $injector, $notification, $registry;
     $this->_assertCategory('Ingo_Rule_System_Vacation', _("Vacation"));
     if ($this->vars->submitbutton == _("Return to Rules List")) {
         Ingo_Basic_Filters::url()->redirect();
     }
     /* Get vacation object and rules. */
     $ingo_storage = $injector->getInstance('Ingo_Factory_Storage')->create();
     $vacation = $ingo_storage->getSystemRule('Ingo_Rule_System_Vacation');
     /* Build form. */
     $form = new Ingo_Form_Vacation($this->vars, '', null, $injector->getInstance('Ingo_Factory_Script')->create(Ingo::RULE_VACATION)->availableCategoryFeatures('Ingo_Rule_System_Vacation'));
     /* Perform requested actions. Ingo_Form_Vacation does token checking
      * for us. */
     if ($form->validate($this->vars)) {
         $form->getInfo($this->vars, $info);
         $vacation->addresses = isset($info['addresses']) ? $info['addresses'] : '';
         $vacation->days = $info['days'];
         $vacation->exclude = $info['excludes'];
         $vacation->ignore_list = $info['ignorelist'] == 'on';
         $vacation->reason = $info['reason'];
         $vacation->subject = $info['subject'];
         $vacation->start = $info['start'];
         $vacation->end = $info['end'];
         try {
             if ($this->vars->submitbutton == _("Save and Enable")) {
                 $vacation->disable = false;
                 $notify = _("Rule Enabled");
             } elseif ($this->vars->get('submitbutton') == _("Save and Disable")) {
                 $vacation->disable = true;
                 $notify = _("Rule Disabled");
             } else {
                 $notification->push(_("Changes saved."), 'horde.success');
             }
             $ingo_storage->updateRule($vacation);
             $notification->push($notify, 'horde.success');
             $injector->getInstance('Ingo_Factory_Script')->activateAll();
         } catch (Ingo_Exception $e) {
             $notification->push($e);
         }
     }
     /* Add buttons depending on the above actions. */
     $form->setCustomButtons($vacation->disable);
     /* Make sure we have at least one address. */
     if (!count($vacation)) {
         $identity = $injector->getInstance('Horde_Core_Factory_Identity')->create();
         $addresses = implode("\n", $identity->getAll('from_addr'));
         /* Remove empty lines. */
         $addresses = trim(preg_replace('/\\n+/', "\n", $addresses));
         if (empty($addresses)) {
             $addresses = $registry->getAuth();
         }
         $vacation->addresses = $addresses;
     }
     /* Set default values. */
     if (!$form->isSubmitted()) {
         $this->vars->set('addresses', implode("\n", $vacation->addresses));
         $this->vars->set('excludes', implode("\n", $vacation->exclude));
         $this->vars->set('ignorelist', $vacation->ignore_list);
         $this->vars->set('days', $vacation->days);
         $this->vars->set('subject', $vacation->subject);
         $this->vars->set('reason', $vacation->reason);
         $this->vars->set('start', $vacation->start);
         $this->vars->set('end', $vacation->end);
         $this->vars->set('start_year', $vacation->start_year);
         $this->vars->set('start_month', $vacation->start_month - 1);
         $this->vars->set('start_day', $vacation->start_day - 1);
         $this->vars->set('end_year', $vacation->end_year);
         $this->vars->set('end_month', $vacation->end_month - 1);
         $this->vars->set('end_day', $vacation->end_day - 1);
     }
     /* Set form title. */
     $form_title = _("Vacation");
     if ($vacation->disable) {
         $form_title .= ' [<span class="horde-form-error">' . _("Disabled") . '</span>]';
     }
     $form_title .= ' ' . Horde_Help::link('ingo', 'vacation');
     $form->setTitle($form_title);
     $this->header = _("Vacation Edit");
     Horde::startBuffer();
     Horde_Util::pformInput();
     $form->renderActive(new Horde_Form_Renderer(array('encode_title' => false, 'varrenderer_driver' => array('ingo', 'ingo'))), $this->vars, self::url(array('append_session' => -1)), 'post');
     $this->output = Horde::endBuffer();
 }