* or to the list of script files to include via includeScriptFiles().
*
* As long as one script file is added, 'prototype.js' will be
- * automatically added.
+ * automatically added, if the prototypejs property of Horde_Script_Files
+ * is true (it is true by default).
*
* @param string $file The full javascript file name.
* @param string $app The application name. Defaults to the current
class Horde_Script_Files
{
/**
+ * Automatically include prototypejs?
+ *
+ * @var boolean
+ */
+ public $prototypejs = true;
+
+ /**
* The list of script files to add.
*
* @var array
*/
- protected $_files = array();
+ protected $_files = array(
+ 'horde' => array()
+ );
/**
* The list of files we have already included.
$this->_included[$app][$url] = true;
- // Always add prototype.js.
- if (!isset($this->_included[$app]['prototype.js'])) {
- $this->add('prototype.js', 'horde');
- }
-
$this->_files[$app][] = array(
'f' => basename($url),
'u' => $url,
}
$this->_included[$app][$file] = true;
- // Always add prototype.js.
- if (!isset($this->_included[$app]['prototype.js']) &&
- ($file != 'prototype.js')) {
- $this->add('prototype.js', 'horde', $full);
- }
-
// Add localized string for popup.js
if (($file == 'popup.js') && ($app == 'horde')) {
Horde::addInlineJsVars(array(
return array();
}
- /* Add accesskeys.js if access keys are enabled. */
- if ($GLOBALS['prefs']->getValue('widget_accesskey')) {
- $this->_add('accesskeys.js', 'horde', false);
+ /* Add prototype.js? */
+ if ($this->prototypejs) {
+ if (!isset($this->_included['horde']['prototype.js'])) {
+ $old = $this->_files['horde'];
+ $this->_files['horde'] = array();
+ $this->_add('prototype.js', 'horde', false);
+ $this->_files['horde'] = array_merge($this->_files['horde'], $old);
+ }
+
+ /* Add accesskeys.js if access keys are enabled. */
+ if ($GLOBALS['prefs']->getValue('widget_accesskey')) {
+ $this->_add('accesskeys.js', 'horde', false);
+ }
+ } elseif (empty($this->_files['horde'])) {
+ /* Remove horde entry if nothing in it (was added on creation to
+ * ensure that it gets loaded first. */
+ unset($this->_files['horde']);
}
return $this->_files;
<?php
+
header('Content-type: text/html; charset=UTF-8');
header('Vary: Accept-Language');
+
?>
<!DOCTYPE html>
<html>
<head>
<title><?php echo htmlspecialchars(Horde_Util::nonInputVar('title')) ?></title>
- <link type="text/css" rel="stylesheet" href="<?php echo $GLOBALS['registry']->get('jsuri', 'horde') ?>/jquery.mobile/jquery.mobile.min.css" />
- <script type="text/javascript" src="<?php echo $GLOBALS['registry']->get('jsuri', 'horde') ?>/jquery.mobile/jquery.min.js"></script>
- <script type="text/javascript">
- $(window.document).bind('mobileinit', function() {
- $.mobile.page.prototype.options.backBtnText = '<?php echo _("Back") ?>';
- $.mobile.loadingMessage = '<?php echo _("loading") ?>';
- });
- </script>
- <script type="text/javascript" src="<?php echo $GLOBALS['registry']->get('jsuri', 'horde') ?>/jquery.mobile/jquery.mobile.min.js"></script>
+<?php
+
+/* CSS Files. */
+$horde_css = $GLOBALS['injector']->getInstance('Horde_Themes_Css');
+$horde_css->addStylesheet(
+ $GLOBALS['registry']->get('jsfs', 'horde') . '/jquery.mobile/jquery.mobile.min.css',
+ $GLOBALS['registry']->get('jsuri', 'horde') . '/jquery.mobile/jquery.mobile.min.css'
+);
+$horde_css->addThemeStylesheet('mobile.css');
+Horde::includeStylesheetFiles(array(
+ 'nobase' => true
+));
+
+/* JS Files. */
+$GLOBALS['injector']->getInstance('Horde_Script_Files')->prototypejs = false;
+Horde::addScriptFile(array(
+ array('jquery.mobile/jquery.min.js', 'horde'),
+ array('jquery.mobile/jquery.mobile.min.js', 'horde'),
+ array('horde-jquery.js', 'horde')
+));
+Horde::includeScriptFiles();
+
+/* Inline script. */
+Horde::addInlineScript(
+ '$(window.document).bind("mobileinit", function() {
+ $.mobile.page.prototype.options.backBtnText = "' . _("Back") .'";
+ $.mobile.loadingMessage = "' . _("loading") . '";
+ });'
+);
+Horde::outputInlineScript();
$view->logout = Horde::getServiceLink('logout')->setRaw(false);
$title = _("Mobile Mail");
+Horde::addScriptFile('mobile.js', 'imp');
+
require $registry->get('templates', 'horde') . '/common-header-mobile.inc';
include IMP_TEMPLATES . '/mobile/javascript_defs.php';
echo $view->render('head.html.php');
- <link type="text/css" rel="stylesheet" href="<?php echo $GLOBALS['registry']->get('themesuri', 'imp') ?>/mobile.css" />
- <script type="text/javascript" src="<?php echo $GLOBALS['registry']->get('jsuri', 'horde') ?>/horde-jquery.js"></script>
- <script type="text/javascript" src="<?php echo $GLOBALS['registry']->get('jsuri') ?>/mobile.js"></script>
</head>
<body>
$view->portal = Horde::getServiceLink('portal', 'horde')->setRaw(false);
$view->logout = Horde::getServiceLink('logout')->setRaw(false);
+Horde::addScriptFile(array(
+ array('date/en-US.js', 'horde'),
+ array('date/date.js', 'horde'),
+ array('mobile.js', 'kronolith')
+));
+
require $registry->get('templates', 'horde') . '/common-header-mobile.inc';
require KRONOLITH_TEMPLATES . '/mobile/javascript_defs.php';
echo $view->render('head');
- <script type="text/javascript" src="<?php echo $this->registry->get('jsuri', 'horde')?>/horde-jquery.js"></script>
- <script type="text/javascript" src="<?php echo $this->registry->get('jsuri', 'horde') ?>/date/en-US.js"></script>
- <script type="text/javascript" src="<?php echo $this->registry->get('jsuri', 'horde') ?>/date/date.js"></script>
- <script type="text/javascript" src="<?php echo $this->registry->get('jsuri', 'kronolith') ?>/mobile.js"></script>
- <link href="<?php echo $this->registry->get('themesuri');?>/mobile.css" rel="stylesheet" type="text/css" />
</head>
-<body>
\ No newline at end of file
+<body>