<tr><td style="vertical-align:top;padding:0;">
<?php
$form->renderActive(null, null, 'upload.php', 'post', 'multipart/form-data');
-if ($browser->getPlatform() == 'win' && Horde::showService('help')) {
+if ($browser->getPlatform() == 'win' && Horde_Menu::showService('help')) {
echo '<div class="box" style="margin:8px; padding:8px"><h3>' . Horde_Help::link('ansel', 'xppublish') . ' ' . _("Learn how to publish photos directly from Windows.") . '</h3></div>';
}
}
/**
- * Checks if services link should be shown and returns the necessary code.
+ * Returns the URL to various Horde services.
*
- * @param string $type Type of link to display
+ * @param string $type The service to display.
* <pre>
- * The following must be defined in Horde's menu config, or else $override
- * must be true:
- * 'help', 'problem', 'logout', 'login', 'options'
- *
- * The following are service links only and do not need to be defined
- * in Horde's menu config.
+ * TODO
* 'ajax', 'cache', 'download', 'go', 'prefsapi'
+ * 'help', 'problem', 'logout', 'login', 'options'
* </pre>
* @param string $app The name of the current Horde application.
- * @param boolean $override Override Horde settings?
*
* @return Horde_Url|boolean The HTML to create the link.
*/
- static public function getServiceLink($type, $app = null,
- $override = false)
+ static public function getServiceLink($type, $app = null)
{
- if (!in_array($type, array('ajax', 'cache', 'download', 'go', 'prefsapi')) &&
- !self::showService($type, $override)) {
- return false;
- }
-
$webroot = $GLOBALS['registry']->get('webroot', 'horde');
switch ($type) {
}
/**
- * TODO
- *
- * @param string $type The type of link.
- * @param boolean $override Override Horde settings?
- *
- * @return boolean True if the link is to be shown.
- */
- static public function showService($type, $override = false)
- {
- global $conf;
-
- if (empty($conf['menu']['links'][$type])) {
- return false;
- }
-
- switch ($conf['menu']['links'][$type]) {
- case 'all':
- return true;
-
- case 'never':
- return $override;
-
- case 'authenticated':
- return $override || (bool)Horde_Auth::getAuth();
-
- default:
- return $override;
- }
- }
-
- /**
* Loads global and vhost specific configuration files.
*
* @param string $config_file The name of the configuration file.
*/
static public function link($module, $topic)
{
- if (!Horde::showService('help')) {
+ if (!Horde_Menu::showService('help')) {
return ' ';
}
}
/* Add settings link. */
- if ($this->_mask & self::MASK_PREFS && $url = Horde::getServiceLink('options', $app)) {
+ if (($this->_mask & self::MASK_PREFS) &&
+ $this->showService('options') &&
+ ($url = Horde::getServiceLink('options', $app))) {
$this->add($url, _("_Options"), 'prefs.png', $graphics);
}
/* Add problem link. */
- if ($this->_mask & self::MASK_PROBLEM && $problem_link = Horde::getServiceLink('problem', $app)) {
+ if (($this->_mask & self::MASK_PROBLEM) &&
+ $this->showService('problem') &&
+ ($problem_link = Horde::getServiceLink('problem', $app))) {
$this->add($problem_link, _("Problem"), 'problem.png', $graphics);
}
/* Add help link. */
- if ($this->_mask & self::MASK_HELP && $help_link = Horde::getServiceLink('help', $app)) {
+ if (($this->_mask & self::MASK_HELP) &&
+ $this->showService('help') &&
+ ($help_link = Horde::getServiceLink('help', $app))) {
Horde::
$this->add($help_link, _("Help"), 'help_index.png', $graphics, 'help', Horde::popupJs($help_link, array('urlencode' => true)) . 'return false;', 'helplink');
}
}
if (Horde_Auth::getAuth()) {
- if ($logout_link = Horde::getServiceLink('logout', $app, !$prefs->getValue('show_sidebar'))) {
+ if ((!$prefs->getValue('show_sidebar') || $this->showService('logout')) &&
+ ($logout_link = Horde::getServiceLink('logout', $app))) {
$this->add($logout_link, _("_Log out"), 'logout.png', $graphics, $auth_target, null, '__noselection');
}
} else {
- if ($login_link = Horde::getServiceLink('login', $app)) {
+ if ($this->showService('login') &&
+ ($login_link = Horde::getServiceLink('login', $app))) {
$this->add(Horde_Util::addParameter($login_link, array('url' => Horde::selfUrl(true, true, true))), _("_Log in"), 'login.png', $graphics, $auth_target, null, '__noselection');
}
}
return false;
}
+ /**
+ * TODO
+ *
+ * @param string $type The type of link.
+ * <pre>
+ * The following must be defined in Horde's menu config, or else they
+ * won't be displayed in the menu:
+ * 'help', 'problem', 'logout', 'login', 'options'
+ * </pre>
+ * @param boolean $override Override Horde settings?
+ *
+ * @return boolean True if the link is to be shown.
+ */
+ static public function showService($type)
+ {
+ global $conf;
+
+ if (!in_array($type, array('help', 'problem', 'logout', 'login', 'options'))) {
+ return true;
+ }
+
+ if (empty($conf['menu']['links'][$type])) {
+ return false;
+ }
+
+ switch ($conf['menu']['links'][$type]) {
+ case 'all':
+ return true;
+
+ case 'authenticated':
+ return (bool)Horde_Auth::getAuth();
+
+ default:
+ case 'never':
+ return false;
+ }
+ }
+
}
} catch (Horde_Exception $e) {}
}
- if (Horde::showService('options') &&
+ if (Horde_Menu::showService('options') &&
$conf['prefs']['driver'] != '' && $conf['prefs']['driver'] != 'none') {
$menu['options'] = array('name' => _("Options"),
'status' => 'active',
$menu['logout'] = array('name' => _("Log out"),
'status' => 'active',
'icon' => $registry->getImageDir() . '/logout.png',
- 'url' => Horde::getServiceLink('logout', 'horde', true),
+ 'url' => Horde::getServiceLink('logout', 'horde'),
'target' => '_parent');
} else {
$menu['login'] = array('name' => _("Log in"),
'status' => 'active',
'icon' => $registry->getImageDir() . '/login.png',
- 'url' => Horde::getServiceLink('login', 'horde', true, false));
+ 'url' => Horde::getServiceLink('login', 'horde'));
}
return $menu;
require_once dirname(__FILE__) . '/../lib/Application.php';
Horde_Registry::appInit('horde', array('authentication' => 'none'));
-if (!Horde::showService('problem')) {
+if (!Horde_Menu::showService('problem')) {
_returnToPage();
}
<?php if (($registry->get('status', 'horde') != 'hidden') && ($registry->get('status', 'horde') != 'notoolbar')): ?>
<?php echo _simpleButton('appportal', _("_Portal"), 'hordeIcon') ?>
<?php endif; ?>
-<?php if (Horde::showService('options')): ?>
+<?php if (Horde_Menu::showService('options')): ?>
<?php echo _simpleButton('appoptions', _("_Options"), 'prefsIcon') ?>
<?php endif; ?>
-<?php if (Horde::showService('logout')): ?>
+<?php if (Horde_Menu::showService('logout')): ?>
<?php echo _simpleButton('applogout', _("_Log Out"), 'logoutIcon') ?>
<?php endif; ?>
</ul>
<p class="calendar-info-url">
<?php echo htmlspecialchars(Kronolith::embedCode($calendar->getName())); ?>
</p>
-<?php if (Horde::showService('help')) {
+<?php if (Horde_Menu::showService('help')) {
echo '<p>' . Horde_Help::link('kronolith', 'embed') . ' ' . _("Learn how to embed other calendar views.") . '</p>';
} ?>
<?php endif; ?>