From: Jan Schneider Date: Wed, 17 Feb 2010 22:14:09 +0000 (+0100) Subject: Add Horde_Registry#hasAjaxView() and load non-ajax applications in iframe. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=5fb5cc21e861699d935a686940e72dc5097ec2fe;p=horde.git Add Horde_Registry#hasAjaxView() and load non-ajax applications in iframe. --- diff --git a/framework/Core/lib/Horde/Registry.php b/framework/Core/lib/Horde/Registry.php index f723cf0b1..7c58e3a51 100644 --- a/framework/Core/lib/Horde/Registry.php +++ b/framework/Core/lib/Horde/Registry.php @@ -1294,7 +1294,28 @@ class Horde_Registry try { $api = $this->getApiInstance($app, 'application'); - return $api->mobileView; + return !empty($api->mobileView); + } catch (Horde_Exception $e) { + return false; + } + } + + /** + * Does the given application have an ajax view? + * + * @param string $app The application to check. + * + * @return boolean Whether app has an ajax view. + */ + public function hasAjaxView($app = null) + { + if (empty($app)) { + $app = $this->getApp(); + } + + try { + $api = $this->getApiInstance($app, 'application'); + return !empty($api->ajaxView); } catch (Horde_Exception $e) { return false; } diff --git a/imp/lib/Application.php b/imp/lib/Application.php index 3e016091e..259fd1c96 100644 --- a/imp/lib/Application.php +++ b/imp/lib/Application.php @@ -35,6 +35,13 @@ require_once HORDE_BASE . '/lib/core.php'; class IMP_Application extends Horde_Registry_Application { /** + * Does this application support an ajax view? + * + * @var boolean + */ + public $ajaxView = true; + + /** * Does this application support a mobile view? * * @var boolean diff --git a/kronolith/js/kronolith.js b/kronolith/js/kronolith.js index 1d5fda7db..8e0710ecc 100644 --- a/kronolith/js/kronolith.js +++ b/kronolith/js/kronolith.js @@ -434,6 +434,19 @@ KronolithCore = { this._addHistory(loc); this.view = 'iframe'; break; + + case 'app': + this.closeView('iframe'); + var app = locParts.shift(); + if (data) { + this.iframeContent(loc, data); + } else if (Kronolith.conf.app_urls[app]) { + this.iframeContent(loc, Kronolith.conf.app_urls[app]); + } + this.updateMinical(this.date); + this._addHistory(fullloc); + this.view = 'iframe'; + break; } }, diff --git a/kronolith/lib/Application.php b/kronolith/lib/Application.php index 8ea37b8eb..188e2dd3c 100644 --- a/kronolith/lib/Application.php +++ b/kronolith/lib/Application.php @@ -35,6 +35,13 @@ require_once HORDE_BASE . '/lib/core.php'; class Kronolith_Application extends Horde_Registry_Application { /** + * Does this application support an ajax view? + * + * @var boolean + */ + public $ajaxView = true; + + /** * The application's version. * * @var string diff --git a/kronolith/lib/Kronolith.php b/kronolith/lib/Kronolith.php index cd1047a85..6c8ef0170 100644 --- a/kronolith/lib/Kronolith.php +++ b/kronolith/lib/Kronolith.php @@ -174,6 +174,13 @@ class Kronolith $kronolith_webroot = $registry->get('webroot'); $horde_webroot = $registry->get('webroot', 'horde'); $has_tasks = $GLOBALS['registry']->hasInterface('tasks'); + $app_urls = array(); + if (isset($GLOBALS['conf']['menu']['apps']) && + is_array($GLOBALS['conf']['menu']['apps'])) { + foreach ($GLOBALS['conf']['menu']['apps'] as $app) { + $app_urls[$app] = (string) Horde::url($GLOBALS['registry']->getInitialPage($app), true); + } + } /* Variables used in core javascript files. */ $code['conf'] = array( @@ -183,6 +190,7 @@ class Kronolith 'SESSION_ID' => defined('SID') ? SID : '', 'user' => Horde_Auth::getAuth(), 'prefs_url' => str_replace('&', '&', Horde::getServiceLink('options', 'kronolith')), + 'app_urls' => $app_urls, 'name' => $registry->get('name'), 'has_tasks' => $has_tasks, 'is_ie6' => ($browser->isBrowser('msie') && ($browser->getMajor() < 7)), diff --git a/kronolith/templates/index/index.inc b/kronolith/templates/index/index.inc index 73137c8b6..a4ea5d52a 100644 --- a/kronolith/templates/index/index.inc +++ b/kronolith/templates/index/index.inc @@ -7,9 +7,13 @@
|