public function html($active = true) { if (!$this->contact) { echo '<h3>' . _("The requested contact was not found.") . '</h3>'; return; } if (!$this->contact->hasPermission(Horde_Perms::DELETE)) { if (!$this->contact->hasPermission(Horde_Perms::READ)) { echo '<h3>' . _("You do not have permission to view this contact.") . '</h3>'; return; } else { echo '<h3>' . _("You only have permission to view this contact.") . '</h3>'; return; } } echo '<div id="DeleteContact"' . ($active ? '' : ' style="display:none"') . '>'; ?> <form action="<?php echo Horde::url('delete.php'); ?> " method="post"> <?php echo Horde_Util::formInput(); ?> <input type="hidden" name="url" value="<?php echo htmlspecialchars(Horde_Util::getFormData('url')); ?> " /> <input type="hidden" name="source" value="<?php echo htmlspecialchars($this->contact->driver->getName()); ?> " /> <input type="hidden" name="key" value="<?php echo htmlspecialchars($this->contact->getValue('__key')); ?> " /> <div class="headerbox" style="padding: 8px"> <p><?php echo _("Permanently delete this contact?"); ?> </p> <input type="submit" class="horde-delete" name="delete" value="<?php echo _("Delete"); ?> " /> </div> </form> </div> <?php if ($active && $GLOBALS['browser']->hasFeature('dom')) { if ($this->contact->hasPermission(Horde_Perms::READ)) { $view = new Turba_View_Contact($this->contact); $view->html(false); } if ($this->contact->hasPermission(Horde_Perms::EDIT)) { $delete = new Turba_View_EditContact($this->contact); $delete->html(false); } } }
/** */ protected function _content() { global $page_output; $name = strval(new Horde_Support_Randomid()); $page_output->addScriptFile('vatid.js', 'horde'); $page_output->addInlineScript(array('$("' . $name . '").observe("submit", HordeBlockVatid.onSubmit.bindAsEventListener(HordeBlockVatid))'), true); return '<form style="padding:2px" action="' . $this->_ajaxUpdateUrl() . '" id="' . $name . '">' . Horde_Util::formInput() . Horde::label('vatid', _("VAT identification number:")) . '<br /><input type="text" length="14" name="vatid" />' . '<br /><input type="submit" id="vatbutton" value="' . _("Check") . '" class="horde-default" /> ' . Horde_Themes_Image::tag('loading.gif', array('alt' => _("Checking"), 'attr' => array('style' => 'display:none'))) . '<div class="vatidResults"></div>' . '</form>'; }
/** * Renders this page in display mode. * * @throws Wicked_Exception */ public function display() { $GLOBALS['page_output']->addScriptFile('edit.js'); $view = $GLOBALS['injector']->createInstance('Horde_View'); $view->action = Wicked::url('NewPage'); $view->formInput = Horde_Util::formInput(); $view->referrer = $this->referrer(); if (!empty($GLOBALS['conf']['wicked']['captcha']) && !$GLOBALS['registry']->getAuth()) { $figlet = new Text_Figlet(); Horde_Exception_Pear::catchError($figlet->loadFont($GLOBALS['conf']['wicked']['figlet_font'])); $view->captcha = $figlet->lineEcho(Wicked::getCAPTCHA(true)); } if ($this->_template) { $view->text = Wicked_Page::getPage($this->_template)->getText(); } return $view->render('edit/new'); }
/** * $registry * $notification * $conf * $criteria * */ public function run() { extract($this->_params, EXTR_REFS); $templates = Horde::loadConfiguration('templates.php', 'templates', 'jonah'); /* Get requested channel. */ try { $channel = $GLOBALS['injector']->getInstance('Jonah_Driver')->getChannel($criteria['feed']); } catch (Exception $e) { Horde::log($e, 'ERR'); $notification->push(_("Invalid channel."), 'horde.error'); Horde::url('delivery/index.php', true)->redirect(); exit; } $title = sprintf(_("HTML Delivery for \"%s\""), $channel['channel_name']); $options = array(); foreach ($templates as $key => $info) { $options[] = '<option value="' . $key . '"' . ($key == $criteria['format'] ? ' selected="selected"' : '') . '>' . $info['name'] . '</option>'; } $template = new Horde_Template(); $template->setOption('gettext', 'true'); $template->set('url', Horde::selfUrl()); $template->set('session', Horde_Util::formInput()); $template->set('channel_id', $criteria['feed']); $template->set('channel_name', $channel['channel_name']); $template->set('format', $criteria['format']); $template->set('options', $options); // @TODO: This is ugly. storage driver shouldn't be rendering any display // refactor this to use individual views possibly with a choice of different templates $template->set('stories', $GLOBALS['injector']->getInstance('Jonah_Driver')->renderChannel($criteria['feed'], $criteria['format'])); // Buffer the notifications and send to the template Horde::startBuffer(); $GLOBALS['notification']->notify(array('listeners' => 'status')); $template->set('notify', Horde::endBuffer()); $GLOBALS['page_output']->header(array('title' => $title)); echo $template->fetch(JONAH_TEMPLATES . '/delivery/html.html'); $GLOBALS['page_output']->footer(); }
/** * 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'); }
$storage->delete($memo_id); $notification->push(_("The note was deleted."), 'horde.success'); } catch (Mnemo_Exception $e) { $notification->push(sprintf(_("There was an error removing the note: %s"), $e->getMessage()), 'horde.warning'); } } else { $notification->push(_("Access denied deleting note."), 'horde.warning'); } } /* Return to the notepad. */ Horde::url('list.php', true)->redirect(); default: Horde::url('list.php', true)->redirect(); } $view = $injector->createInstance('Horde_View'); $view->formInput = Horde_Util::formInput(); $view->id = $memo_id; $view->listid = $memolist_id; $view->modify = $actionID == 'modify_memo'; $view->passphrase = $show_passphrase; $view->title = $title; $view->url = Horde::url('memo.php'); if (!$view->modify || !$view->passphrase) { $injector->getInstance('Horde_Core_Factory_Imple')->create('Mnemo_Ajax_Imple_TagAutoCompleter', array('id' => 'memo_tags')); $view->body = $memo_body; $view->count = sprintf(_("%s characters"), '<span id="mnemo-count">' . Horde_String::length(str_replace(array("\r", "\n"), '', $memo_body)) . '</span>'); $view->encrypted = $memo_encrypted; $view->encryption = $storage->encryptionSupported(); try { $view->help = Horde::callHook('description_help', array(), 'mnemo', ''); } catch (Horde_Exception_HookNotSet $e) {
/** * Returns this page rendered in Display mode. * * @throws Wicked_Exception */ public function display() { global $registry, $wicked, $notification, $conf; try { $attachments = $this->content(); } catch (Wicked_Exception $e) { $notification->push(sprintf(_("Error retrieving attachments: %s"), $e->getMessage()), 'horde.error'); throw $e; } $GLOBALS['page_output']->addScriptFile('tables.js', 'horde'); $view = $GLOBALS['injector']->createInstance('Horde_View'); $view->pageName = $this->pageName(); $view->formAction = Wicked::url('AttachedFiles'); $view->deleteButton = Horde_Themes::img('delete.png'); $view->referrerLink = Wicked::url($this->referrer()); $refreshIcon = Horde::link($this->pageUrl()) . Horde::img('reload.png', sprintf(_("Reload \"%s\""), $this->pageTitle())) . '</a>'; $view->refreshIcon = $refreshIcon; $view->attachments = $attachments; /* Get an array of unique filenames for the update form. */ $files = array(); foreach ($attachments as $attachment) { $files[$attachment['attachment_name']] = true; } $files = array_keys($files); sort($files); $view->files = $files; $view->canUpdate = $this->allows(Wicked::MODE_EDIT) && count($files); $view->canAttach = $this->allows(Wicked::MODE_EDIT); $view->requireChangelog = $conf['wicked']['require_change_log']; $view->requiredMarker = Horde::img('required.png', '*'); $view->referrer = $this->referrer(); $view->formInput = Horde_Util::formInput(); echo $view->render('display/AttachedFiles'); }
/** * Renders this page in History mode. * * @return string The content. * @throws Wicked_Exception */ public function history() { global $injector, $page_output; $page_output->addScriptFile('history.js'); $view = $injector->createInstance('Horde_View'); // Header. $view->formInput = Horde_Util::formInput(); $view->name = $this->pageName(); $view->pageLink = $this->pageUrl()->link() . htmlspecialchars($this->pageName()) . '</a>'; $view->refreshLink = $this->pageUrl('history.php')->link() . Horde::img('reload.png', _("Reload History")) . '</a>'; if ($this->allows(Wicked::MODE_REMOVE)) { $view->remove = Horde::img('delete.png', _("Delete Version")); } if ($this->allows(Wicked::MODE_EDIT) && !$this->isLocked(Wicked::lockUser())) { $view->edit = Horde::img('edit.png', _("Edit Version")); $view->restore = Horde::img('restore.png', _("Restore Version")); } $content = $view->render('history/header'); // First item is this page. $view->showRestore = false; $this->_setViewProperties($view, $this); $content .= $view->render('history/summary'); // Now the rest of the histories. $view->showRestore = true; foreach ($GLOBALS['wicked']->getHistory($this->pageName()) as $page) { $page = new Wicked_Page_StandardHistoryPage($page); $this->_setViewProperties($view, $page); $view->pversion = $page->version(); $content .= $view->render('history/summary'); } // Footer. return $content . $view->render('history/footer'); }
/** */ private function _init() { global $conf, $page_output; // Get the backend details. $backend_key = $this->_vars->backend; if (!isset($this->_backends[$backend_key])) { $backend_key = null; } if ($backend_key && $this->_vars->submit) { $this->_changePassword($backend_key); } // Choose the prefered backend from config/backends.php. foreach ($this->_backends as $k => $v) { if (!isset($backend_key) && substr($k, 0, 1) != '_') { $backend_key = $k; } if ($this->_isPreferredBackend($v)) { $backend_key = $k; break; } } $view = new Horde_View(array('templatePath' => PASSWD_TEMPLATES)); $view->addHelper('FormTag'); $view->addHelper('Horde_Core_View_Helper_Help'); $view->addHelper('Horde_Core_View_Helper_Label'); $view->addHelper('Tag'); $view->formInput = Horde_Util::formInput(); $view->url = $this->_vars->return_to; $view->userid = $this->_userid; $view->userChange = $conf['user']['change']; $view->showlist = $conf['backend']['backend_list'] == 'shown'; $view->backend = $backend_key; // Build the <select> widget for the backends list. if ($view->showlist) { $view->backends = $this->_backends; $view->header = _("Change your password"); } else { $view->header = sprintf(_("Changing password for %s"), htmlspecialchars($this->_backends[$backend_key]['name'])); } $page_output->sidebar = false; $page_output->addScriptFile('stripe.js', 'horde'); $page_output->addScriptFile('passwd.js'); $page_output->addInlineJsVars(array('var Passwd' => array('current_pass' => _("Please provide your current password"), 'new_pass' => _("Please provide a new password"), 'verify_pass' => _("Please verify your new password"), 'no_match' => _("Your passwords do not match")))); $this->_output = $view->render('index'); }
/** * Returns a link to display, download, and delete a file from the VFS * backend associated with this object. * * @param string $file The file name. * * @return string The HTML code of the generated link. */ public function vfsEditUrl($file) { $delform = '<form action="' . Horde::url('deletefile.php') . '" style="display:inline" method="post">' . Horde_Util::formInput() . '<input type="hidden" name="file" value="' . htmlspecialchars($file['name']) . '" />' . '<input type="hidden" name="source" value="' . htmlspecialchars($this->driver->getName()) . '" />' . '<input type="hidden" name="key" value="' . htmlspecialchars($this->getValue('__key')) . '" />' . '<input type="image" class="img" src="' . Horde_Themes::img('delete.png') . '" />' . '</form>'; return $this->vfsDisplayUrl($file) . ' ' . $delform; }
Horde::url('forums.php', true)->redirect(); } elseif (empty($messages_list)) { $messages_count = 0; $notification->push(_("No messages are waiting for moderation."), 'horde.message'); } else { $messages_count = count($messages_list); $messages_list = array_slice($messages_list, $messages_start, $messages_per_page); } /* Set up the column headers. */ $col_headers = array('forum_id' => _("Forum"), 'message_subject' => _("Subject"), 'message_author' => _("Posted by"), 'message_body' => _("Body"), 'message_timestamp' => _("Date")); $col_headers = Agora::formatColumnHeaders($col_headers, $sort_by, $sort_dir, 'moderate'); /* Set up the template tags. */ $view = new Agora_View(); $view->col_headers = $col_headers; $view->messages = $messages_list; $view->buttons = array(_("Approve"), _("Delete")); $view->session_tag = Horde_Util::formInput(); Horde::startBuffer(); $notification->notify(array('listeners' => 'status')); $view->notify = Horde::endBuffer(); /* Set up pager. */ $vars = Horde_Variables::getDefaultVariables(); $pager_ob = new Horde_Core_Ui_Pager('moderate_page', $vars, array('num' => $messages_count, 'url' => Horde::selfUrl(true), 'perpage' => $messages_per_page)); $pager_ob->preserve('agora', Horde_Util::getFormData('agora')); $view->pager = $pager_ob->render(); if (isset($api_call)) { return $view->render('moderate'); } $page_output->header(array('title' => _("Messages Awaiting Moderation"))); echo $view->render('moderate'); $page_output->footer();
/** * Generates hidden form fields with all required parameters. * * @return string The form fields, with session information if necessary. */ public static function formInputs() { $arglist = self::_getArgList($GLOBALS['acts'], $GLOBALS['defaultActs'], array()); $fields = Horde_Util::formInput(); foreach ($arglist as $key => $val) { $fields .= '<input type="hidden" name="' . htmlspecialchars($key) . '" value="' . htmlspecialchars($val) . '" />'; } return $fields; }
$upload = _uploadFTP($info); if ($upload) { $notification->push(_("Uploaded all application configuration files to the server."), 'horde.success'); Horde::url('admin/config/index.php', true)->redirect(); } } /* Render the form. */ Horde::startBuffer(); $ftpform->renderActive(new Horde_Form_Renderer(), $vars, Horde::url('admin/config/index.php'), 'post'); $ftpform = Horde::endBuffer(); } if (file_exists(Horde::getTempDir() . '/horde_configuration_upgrade.php')) { /* Action to remove the configuration upgrade PHP script. */ $url = Horde::url('admin/config/scripts.php')->add('clean', 'tmp'); $action = _("Remove saved script from server's temporary directory."); $actions[] = array('icon' => Horde_Themes_Image::tag('delete.png', array('attr' => array('align' => 'middle'))), 'link' => Horde::link($url) . $action . '</a>'); } $view = new Horde_View(array('templatePath' => HORDE_TEMPLATES . '/admin/config')); $view->actions = $actions; $view->apps = $apps; $view->config_outdated = $config_outdated; $view->ftpform = $ftpform; $view->schema_outdated = $schema_outdated; $view->version_action = Horde::url('admin/config/index.php'); $view->version_input = Horde_Util::formInput(); $view->versions = !empty($versions); $page_output->addScriptFile('stripe.js', 'horde'); $page_output->header(array('title' => sprintf(_("%s Configuration"), $registry->get('name', 'horde')))); require HORDE_TEMPLATES . '/admin/menu.inc'; echo $view->render('index'); $page_output->footer();
/** * 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(); }
public function renderActive($form, $action, $method = 'get', $enctype = null, $focus = true) { $this->_name = $form->getName(); echo "<form class=\"horde-form\" action=\"{$action}\" method=\"{$method}\"" . (empty($this->_name) ? '' : ' id="' . $this->_name . '"') . (is_null($this->_enctype) ? '' : ' enctype="' . $this->_enctype . '"') . ">\n"; echo Horde_Util::formInput(); $this->listFormVars($form); if (!empty($this->_name)) { $this->_preserveVarByPost('formname', $this->_name); } if ($form->useToken()) { $this->_preserveVarByPost($this->_name . '_formToken', Horde_Token::generateId($this->_name)); } if (count($form->getSections())) { $this->_preserveVarByPost('__formOpenSection', $form->getOpenSection()); } $vars = $form->getVars(); $variables = $form->getVariables(); foreach ($variables as $var) { if ($var->getOption('trackchange')) { $varname = $var->getVarName(); $this->preserveVarByPost($vars, $varname, '__old_' . $varname); } } foreach ($form->getHiddenVariables() as $var) { $this->preserveVarByPost($vars, $var->getVarName()); } $this->_renderBeginActive($form->getTitle()); $this->_renderForm($form, true); $this->submit($this->_submit, $this->_reset); echo "\n</fieldset>\n</form>\n"; if ($focus && !empty($this->_firstField)) { echo '<script type="text/javascript"> try { document.getElementById("' . $this->_firstField . '").focus(); } catch (e) {} </script> '; } }
/** * Return the rendered inline version of the Horde_Mime_Part object. * * @return array See parent::render(). */ protected function _renderInline() { $browser = $this->getConfigParam('browser'); $notification = $this->getConfigParam('notification'); $prefs = $this->getConfigParam('prefs'); $registry = $this->getConfigParam('registry'); $data = $this->_mimepart->getContents(); $html = ''; $title = Horde_Core_Translation::t("vCard"); $iCal = new Horde_Icalendar(); if (!$iCal->parsevCalendar($data, 'VCALENDAR', $this->_mimepart->getCharset())) { $notification->push(Horde_Core_Translation::t("There was an error reading the contact data."), 'horde.error'); } if (Horde_Util::getFormData('import') && Horde_Util::getFormData('source') && $registry->hasMethod('contacts/import')) { $source = Horde_Util::getFormData('source'); $count = 0; foreach ($iCal->getComponents() as $c) { if ($c->getType() == 'vcard') { try { $registry->call('contacts/import', array($c, null, $source)); ++$count; } catch (Horde_Exception $e) { $notification->push(Horde_Core_Translation::t("There was an error importing the contact data:") . ' ' . $e->getMessage(), 'horde.error'); } } } $notification->push(sprintf(Horde_Core_Translation::ngettext("%d contact was successfully added to your address book.", "%d contacts were successfully added to your address book.", $count), $count), 'horde.success'); } $html .= '<table class="horde-table" style="width:100%">'; foreach ($iCal->getComponents() as $i => $vc) { if ($i > 0) { $html .= '<tr><td colspan="2"> </td></tr>'; } $addresses = $vc->getAllAttributes('EMAIL'); $html .= '<tr><td colspan="2" class="header">'; if (($fullname = $vc->getAttributeDefault('FN', false)) === false) { $fullname = count($addresses) ? $addresses[0]['value'] : Horde_Core_Translation::t("[No Label]"); } $html .= htmlspecialchars($fullname) . '</td></tr>'; $n = $vc->printableName(); if (!empty($n)) { $html .= $this->_row(Horde_Core_Translation::t("Name"), $n); } try { $html .= $this->_row(Horde_Core_Translation::t("Alias"), implode("\n", $vc->getAttributeValues('ALIAS'))); } catch (Horde_Icalendar_Exception $e) { } try { $birthdays = $vc->getAttributeValues('BDAY'); $birthday = new Horde_Date($birthdays[0]); $html .= $this->_row(Horde_Core_Translation::t("Birthday"), $birthday->strftime($prefs->getValue('date_format'))); } catch (Horde_Icalendar_Exception $e) { } $photos = $vc->getAllAttributes('PHOTO'); foreach ($photos as $p => $photo) { if (isset($photo['params']['VALUE']) && Horde_String::upper($photo['params']['VALUE']) == 'URI') { $html .= $this->_row(Horde_Core_Translation::t("Photo"), '<img src="' . htmlspecialchars($photo['value']) . '" />', false); } elseif (isset($photo['params']['ENCODING']) && Horde_String::upper($photo['params']['ENCODING']) == 'B' && isset($photo['params']['TYPE'])) { if ($browser->hasFeature('datauri') === true || $browser->hasFeature('datauri') >= strlen($photo['value'])) { $html .= $this->_row(Horde_Core_Translation::t("Photo"), '<img src="' . Horde_Url_Data::create($photo['params']['TYPE'], base64_decode($photo['value'])) . '" />', false); } elseif ($this->_imageUrl) { $html .= $this->_row(Horde_Core_Translation::t("Photo"), '<img src="' . $this->_imageUrl->add(array('c' => $i, 'p' => $p)) . '" />', false); } } } $labels = $vc->getAllAttributes('LABEL'); foreach ($labels as $label) { if (isset($label['params']['TYPE'])) { if (!is_array($label['params']['TYPE'])) { $label['params']['TYPE'] = array($label['params']['TYPE']); } } else { $label['params']['TYPE'] = array_keys($label['params']); } $types = array(); foreach ($label['params']['TYPE'] as $type) { switch (Horde_String::upper($type)) { case 'HOME': $types[] = Horde_Core_Translation::t("Home Address"); break; case 'WORK': $types[] = Horde_Core_Translation::t("Work Address"); break; case 'DOM': $types[] = Horde_Core_Translation::t("Domestic Address"); break; case 'INTL': $types[] = Horde_Core_Translation::t("International Address"); break; case 'POSTAL': $types[] = Horde_Core_Translation::t("Postal Address"); break; case 'PARCEL': $types[] = Horde_Core_Translation::t("Parcel Address"); break; case 'PREF': $types[] = Horde_Core_Translation::t("Preferred Address"); break; } } if (!count($types)) { $types = array(Horde_Core_Translation::t("Address")); } $html .= $this->_row(implode('/', $types), $label['value']); } $adrs = $vc->getAllAttributes('ADR'); foreach ($adrs as $item) { if (isset($item['params']['TYPE'])) { if (!is_array($item['params']['TYPE'])) { $item['params']['TYPE'] = array($item['params']['TYPE']); } } else { $item['params']['TYPE'] = array_keys($item['params']); } $address = $item['values']; $a = array(); $a_list = array(Horde_Icalendar_Vcard::ADR_STREET, Horde_Icalendar_Vcard::ADR_LOCALITY, Horde_Icalendar_Vcard::ADR_REGION, Horde_Icalendar_Vcard::ADR_POSTCODE, Horde_Icalendar_Vcard::ADR_COUNTRY); foreach ($a_list as $val) { if (isset($address[$val])) { $a[] = $address[$val]; } } $types = array(); foreach ($item['params']['TYPE'] as $type) { switch (Horde_String::upper($type)) { case 'HOME': $types[] = Horde_Core_Translation::t("Home Address"); break; case 'WORK': $types[] = Horde_Core_Translation::t("Work Address"); break; case 'DOM': $types[] = Horde_Core_Translation::t("Domestic Address"); break; case 'INTL': $types[] = Horde_Core_Translation::t("International Address"); break; case 'POSTAL': $types[] = Horde_Core_Translation::t("Postal Address"); break; case 'PARCEL': $types[] = Horde_Core_Translation::t("Parcel Address"); break; case 'PREF': $types[] = Horde_Core_Translation::t("Preferred Address"); break; } } if (!count($types)) { $types = array(Horde_Core_Translation::t("Address")); } $html .= $this->_row(implode('/', $types), implode("\n", $a)); } $numbers = $vc->getAllAttributes('TEL'); foreach ($numbers as $number) { if (isset($number['params']['TYPE'])) { if (!is_array($number['params']['TYPE'])) { $number['params']['TYPE'] = array($number['params']['TYPE']); } foreach ($number['params']['TYPE'] as $type) { $number['params'][Horde_String::upper($type)] = true; } } if (isset($number['params']['FAX'])) { $html .= $this->_row(Horde_Core_Translation::t("Fax"), $number['value']); } else { if (isset($number['params']['HOME'])) { $html .= $this->_row(Horde_Core_Translation::t("Home Phone"), $number['value']); } elseif (isset($number['params']['WORK'])) { $html .= $this->_row(Horde_Core_Translation::t("Work Phone"), $number['value']); } elseif (isset($number['params']['CELL'])) { $html .= $this->_row(Horde_Core_Translation::t("Cell Phone"), $number['value']); } else { $html .= $this->_row(Horde_Core_Translation::t("Phone"), $number['value']); } } } $emails = array(); foreach ($addresses as $address) { if (isset($address['params']['TYPE'])) { if (!is_array($address['params']['TYPE'])) { $address['params']['TYPE'] = array($address['params']['TYPE']); } foreach ($address['params']['TYPE'] as $type) { $address['params'][Horde_String::upper($type)] = true; } } $email = '<a href="'; if ($registry->hasMethod('mail/compose')) { $email .= $registry->call('mail/compose', array(array('to' => $address['value']))); } else { $email .= 'mailto:' . htmlspecialchars($address['value']); } $email .= '">' . htmlspecialchars($address['value']) . '</a>'; if (isset($address['params']['PREF'])) { array_unshift($emails, $email); } else { $emails[] = $email; } } if (count($emails)) { $html .= $this->_row(Horde_Core_Translation::t("Email"), implode("\n", $emails), false); } try { $title = $vc->getAttributeValues('TITLE'); $html .= $this->_row(Horde_Core_Translation::t("Title"), $title[0]); } catch (Horde_Icalendar_Exception $e) { } try { $role = $vc->getAttributeValues('ROLE'); $html .= $this->_row(Horde_Core_Translation::t("Role"), $role[0]); } catch (Horde_Icalendar_Exception $e) { } try { $org = $vc->getAttributeValues('ORG'); $html .= $this->_row(Horde_Core_Translation::t("Company"), $org[0]); if (isset($org[1])) { $html .= $this->_row(Horde_Core_Translation::t("Department"), $org[1]); } } catch (Horde_Icalendar_Exception $e) { } try { $notes = $vc->getAttributeValues('NOTE'); $html .= $this->_row(Horde_Core_Translation::t("Notes"), $notes[0]); } catch (Horde_Icalendar_Exception $e) { } try { $url = $vc->getAttributeValues('URL'); $html .= $this->_row(Horde_Core_Translation::t("URL"), '<a href="' . htmlspecialchars($url[0]) . '" target="_blank">' . htmlspecialchars($url[0]) . '</a>', false); } catch (Horde_Icalendar_Exception $e) { } } $html .= '</table>'; if ($registry->hasMethod('contacts/import') && $registry->hasMethod('contacts/sources')) { $html .= '<div class="horde-form-buttons"><form action="' . Horde::selfUrl() . '" method="get" name="vcard_import" id="vcard_import">' . Horde_Util::formInput(); foreach ($_GET as $key => $val) { $html .= '<input type="hidden" name="' . htmlspecialchars($key) . '" value="' . htmlspecialchars($val) . '" />'; } $sources = $registry->call('contacts/sources', array(true)); if (count($sources) > 1) { $html .= '<input type="submit" class="horde-default" name="import" value="' . Horde_Core_Translation::t("Add to address book:") . '" />' . ' <label for="add_source" class="hidden">' . Horde_Core_Translation::t("Address Book") . '</label>' . '<select id="add_source" name="source">'; foreach ($sources as $key => $label) { $selected = $key == $prefs->getValue('add_source') ? ' selected="selected"' : ''; $html .= '<option value="' . htmlspecialchars($key) . '"' . $selected . '>' . htmlspecialchars($label) . '</option>'; } $html .= '</select>'; } else { reset($sources); $html .= '<input type="submit" class="horde-default" name="import" value="' . Horde_Core_Translation::t("Add to my address book") . '" />' . '<input type="hidden" name="source" value="' . htmlspecialchars(key($sources)) . '" />'; } $html .= '</form></div>'; } Horde::startBuffer(); $notification->notify(array('listeners' => 'status')); return $this->_renderReturn(Horde::endBuffer() . $html, 'text/html; charset=' . $this->getConfigParam('charset')); }
/** * Renders this page in display mode. * * @throws Wicked_Exception */ public function display() { global $wicked, $registry, $notification; $referrer = $this->referrer(); $callback = function ($string) { return '=' . str_pad(dechex(ord($string[1])), 2, '0', STR_PAD_LEFT); }; $references = $wicked->getBackLinks($referrer); foreach ($references as $key => $page) { $references[$key]['page_url'] = Wicked::url($page['page_name']); $references[$key]['page_name'] = $page['page_name']; // Since the page name can have [ and ] and other special // characters in it, and we don't want the browser or PHP decoding // it, we encode it in quoted printable for the checkbox names. $references[$key]['checkbox'] = preg_replace_callback('/([^a-zA-Z_0-9 ])/', $callback, $page['page_name']); } // Propogate any validation errors. foreach (array('new_name', 'collision') as $elt) { if (!isset($this->_errors[$elt])) { $this->_errors[$elt] = ''; } } $view = $GLOBALS['injector']->createInstance('Horde_View'); $view->pageName = 'MergeOrRename'; $view->formAction = Wicked::url('MergeOrRename'); $view->referrer = $referrer; $view->referrerLink = Wicked::url($referrer); $view->requiredMarker = Horde::img('required.png', '*'); $view->references = $references; $view->referenceCount = sprintf(_("This page is referenced from %d other page(s)."), count($references)); $view->formInput = Horde_Util::formInput(); $view->errors = $this->_errors; $view->new_name = Horde_Util::getFormData('new_name', $referrer); echo $view->render('display/MergeOrRename'); }
/* Prepare the template. */ $template = $injector->createInstance('Horde_View'); $attrib = $gollem_vfs->getModifiablePermissions(); foreach (array('owner', 'group', 'all') as $val) { foreach (array('read', 'write', 'execute') as $val2) { if (isset($attrib[$val][$val2])) { $template->{$val . '_' . $val2} = !$attrib[$val][$val2]; } } } $all_columns = array('type', 'name', 'share', 'edit', 'download', 'modified', 'size', 'permission', 'owner', 'group'); foreach ($all_columns as $column) { $template->{'columns_' . $column} = in_array($column, $columns); } $template->action = $refresh_url; $template->forminput = Horde_Util::formInput(); $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();
$item = $vars->get('item'); if (is_null($item) || !count($item)) { $notification->push(_("No timeslices were selected to submit."), 'horde.error'); } else { foreach (array_keys($item) as $id) { $time[] = array('id' => $id); } try { $GLOBALS['injector']->getInstance('Hermes_Driver')->markAs('submitted', $time); $notification->push(_("Your time was successfully submitted."), 'horde.success'); $vars = new Horde_Variables(); } catch (Horde_Exception $e) { $notification->push(sprintf(_("There was an error submitting your time: %s"), $e->getMessage()), 'horde.error'); } } break; } // We are displaying all time. $tabs = Hermes::tabs(); $criteria = array('employee' => $GLOBALS['registry']->getAuth(), 'submitted' => false, 'link_page' => 'time.php'); $table = new Hermes_Table('week', $vars, array('title' => _("My Unsubmitted Time"), 'name' => 'hermes/hours', 'params' => $criteria)); $template = new Horde_Template(); $template->setOption('gettext', true); $template->set('postUrl', Horde::url('time.php', false, -1)); $template->set('sessionId', Horde_Util::formInput()); $template->set('table', $table->render()); $page_output->header(array('title' => _("My Time"))); $notification->notify(array('listeners' => 'status')); echo $tabs; echo $template->fetch(HERMES_TEMPLATES . '/time/form.html'); $page_output->footer();
/** * Constructor. * * @param array $config Configuration key-value pairs. */ public function __construct($config = array()) { global $conf, $injector, $registry, $session; $config['templatePath'] = KRONOLITH_TEMPLATES . '/attendees'; parent::__construct($config); $this->addHelper('Text'); $this->formInput = Horde_Util::formInput(); $this->view = Horde_Util::getFormData('view', 'Day'); $this->date = $config['start']->dateString(); $this->end = $config['end']->dateString(); $this->freeBusy = $config['fbView']->render($config['start']); $auth = $injector->getInstance('Horde_Core_Factory_Auth')->create(); if ($auth->hasCapability('list') && ($conf['auth']['list_users'] == 'list' || $conf['auth']['list_users'] == 'both')) { $this->userList = $auth->listNames(); } $this->resourcesEnabled = !empty($conf['resources']['enabled']); if ($registry->hasMethod('contacts/search')) { $this->addressbookLink = Horde::url('#')->link(array('class' => 'widget', 'onclick' => 'window.open(\'' . Horde::url('contacts.php') . '\', \'contacts\', \'toolbar=no,location=no,status=no,scrollbars=yes,resizable=yes,width=550,height=270,left=100,top=100\'); return false;')) . Horde::img('addressbook_browse.png') . '<br />' . _("Address Book") . '</a>'; } $vars = Horde_Variables::getDefaultVariables(); $tabs = new Horde_Core_Ui_Tabs(null, $vars); $tabs->addTab(_("Day"), new Horde_Url('javascript:switchView(\'Day\')'), 'Day'); $tabs->addTab(_("Work Week"), new Horde_Url('javascript:switchView(\'Workweek\')'), 'Workweek'); $tabs->addTab(_("Week"), new Horde_Url('javascript:switchView(\'Week\')'), 'Week'); $tabs->addTab(_("Month"), new Horde_Url('javascript:switchView(\'Month\')'), 'Month'); $this->tabs = $tabs->render($this->view); $attendees = $session->get('kronolith', 'attendees'); if ($attendees) { $roles = array(Kronolith::PART_REQUIRED, Kronolith::PART_OPTIONAL, Kronolith::PART_NONE); $responses = array(Kronolith::RESPONSE_ACCEPTED, Kronolith::RESPONSE_DECLINED, Kronolith::RESPONSE_TENTATIVE, Kronolith::RESPONSE_NONE); $this->attendees = array(); foreach ($attendees as $attendee) { $viewAttendee = array('id' => $attendee->id, 'name' => strval($attendee), 'deleteLink' => Horde::url('#')->link(array('title' => sprintf(_("Remove %s"), $attendee->displayName), 'onclick' => "performAction('remove', decodeURIComponent('" . rawurlencode($attendee->id) . "')); return false;")) . Horde::img('delete.png') . '</a>'); if ($attendee->user) { unset($this->userList[$attendee->user]); } else { $viewAttendee['editLink'] = Horde::url('#')->link(array('title' => sprintf(_("Edit %s"), $attendee->displayName), 'onclick' => "performAction('edit', decodeURIComponent('" . rawurlencode($attendee->id) . "')); return false;")) . Horde::img('edit.png') . '</a>'; } foreach ($roles as $role) { $viewAttendee['roles'][$role] = array('selected' => $attendee->role == $role, 'label' => Kronolith::partToString($role)); } foreach ($responses as $response) { $viewAttendee['responses'][$response] = array('selected' => $attendee->response == $response, 'label' => Kronolith::responseToString($response)); } $this->attendees[] = $viewAttendee; } } $this->resources = $session->get('kronolith', 'resources', Horde_Session::TYPE_ARRAY); foreach ($this->resources as $id => &$resource) { $resource['id'] = $id; $resource['deleteLink'] = Horde::url('#')->link(array('title' => sprintf(_("Remove %s"), $resource['name']), 'onclick' => "performAction('removeResource', decodeURIComponent('" . $id . "')); return false;")) . Horde::img('delete.png') . '</a>'; foreach ($roles as $role) { $resource['roles'][$role] = array('selected' => $resource['attendance'] == $role, 'label' => Kronolith::partToString($role)); } foreach ($responses as $response) { $resource['responses'][$response] = array('selected' => $resource['response'] == $response, 'label' => Kronolith::responseToString($response)); } } /* Get list of resources for select list, and remove those we already * added. */ if ($this->resourcesEnabled) { $this->allResources = array_diff_key(Kronolith::getDriver('Resource')->listResources(Horde_Perms::READ, array(), 'name'), $this->resources); } }
$page_output->addInlineScript(array('jQuery("#sortContainer").sortable()', 'jQuery("#sortContainer").disableSelection()'), true); $title = sprintf(_("%s :: Sort"), $gallery->get('name')); $page_output->header(array('title' => _("Search Forums"))); $notification->notify(array('listeners' => 'status')); ?> <h1 class="header"><?php echo htmlspecialchars($title); ?> </h1> <div class="instructions"> <form action="<?php echo Horde::url('gallery/sort.php'); ?> " method="post"> <?php echo Horde_Util::formInput(); ?> <input type="hidden" name="gallery" value="<?php echo (int) $galleryId; ?> " /> <input type="hidden" name="action" value="Sort" /> <input type="hidden" name="order" id="order" /> <input type="hidden" name="year" value="<?php echo $date['year']; ?> " /> <input type="hidden" name="month" value="<?php echo $date['month']; ?> " />
/** * Renders this page in display mode. * * @throws Wicked_Exception */ public function display() { $GLOBALS['page_output']->addScriptFile('edit.js'); $GLOBALS['injector']->getInstance('Horde_View_Topbar')->subinfo = sprintf(_("Last Modified %s by %s"), $this->formatVersionCreated(), $this->author()); $page = Wicked_Page::getPage($this->referrer()); $view = $GLOBALS['injector']->createInstance('Horde_View'); $view->action = Wicked::url('EditPage'); $view->formInput = Horde_Util::formInput(); $view->name = $page->pageName(); $view->header = $page->pageUrl()->link() . htmlspecialchars($page->pageName()) . '</a> '; if ($page->isLocked()) { $view->header .= ' ' . Horde::img('locked.png', _("Locked")); } $view->cancel = $page->pageUrl()->add('actionID', 'unlock')->link(array('class' => 'horde-cancel')) . _("Cancel") . '</a>'; if (!empty($GLOBALS['conf']['wicked']['require_change_log'])) { $view->changelogRequired = Horde::img('required.png', _("Changelog is required")); } if (!empty($GLOBALS['conf']['wicked']['captcha']) && !$GLOBALS['registry']->getAuth()) { $figlet = new Text_Figlet(); Horde_Exception_Pear::catchError($figlet->loadFont($GLOBALS['conf']['wicked']['figlet_font'])); $view->captcha = $figlet->lineEcho(Wicked::getCAPTCHA(true)); } $view->text = Horde_Util::getFormData('page_text'); if (is_null($view->text)) { $view->text = $page->getText(); } return $view->render('edit/standard'); }