From 2918839ab4d9beda8bbed923f1f419a5f335ea96 Mon Sep 17 00:00:00 2001 From: Jan Schneider Date: Tue, 27 Oct 2009 18:47:15 +0100 Subject: [PATCH] Open prefs ui in iframe. --- kronolith/index.php | 1 + kronolith/js/kronolith.js | 62 ++++++++++++++++++++----------------- kronolith/lib/Kronolith.php | 1 + kronolith/templates/index/index.inc | 9 +++--- kronolith/themes/screen.css | 12 +++++++ 5 files changed, 53 insertions(+), 32 deletions(-) diff --git a/kronolith/index.php b/kronolith/index.php index 333eb1740..5eee64fae 100644 --- a/kronolith/index.php +++ b/kronolith/index.php @@ -37,6 +37,7 @@ foreach (Kronolith::listCalendars() as $id => $cal) { $shared_calendars[$id] = $cal; } } +$_SESSION['horde_prefs']['nomenu'] = true; $datejs = str_replace('_', '-', $language) . '.js'; if (!file_exists($registry->get('jsfs') . '/' . $datejs)) { diff --git a/kronolith/js/kronolith.js b/kronolith/js/kronolith.js index a4c654fa1..0856d4989 100644 --- a/kronolith/js/kronolith.js +++ b/kronolith/js/kronolith.js @@ -181,14 +181,9 @@ KronolithCore = { case 'year': case 'agenda': case 'tasks': + this.closeView(); var locCap = loc.capitalize(); - [ 'Day', 'Week', 'Month', 'Year', 'Tasks', 'Agenda' ].each(function(a) { - $('kronolithNav' + a).removeClassName('on'); - }); $('kronolithNav' + locCap).addClassName('on'); - if (this.view && this.view != loc) { - $('kronolithView' + this.view.capitalize()).fade({ 'queue': 'end' }); - } switch (loc) { case 'day': @@ -258,14 +253,9 @@ KronolithCore = { break; case 'search': - [ 'Day', 'Week', 'Month', 'Year', 'Tasks', 'Agenda' ].each(function(a) { - $('kronolithNav' + a).removeClassName('on'); - }); - if (this.view) { - $('kronolithView' + this.view.capitalize()).fade({ 'queue': 'end' }); - } var cals = [], term = locParts[1], query = Object.toJSON({ 'title': term }); + this.closeView(); this.updateView(null, 'search', term); $H(Kronolith.conf.calendars).each(function(type) { $H(type.value).each(function(calendar) { @@ -334,10 +324,10 @@ KronolithCore = { break; case 'options': - //this.highlightSidebar('appoptions'); - this._addHistory(loc); - this.setTitle(Kronolith.text.prefs); + this.closeView(); this.iframeContent(loc, Kronolith.conf.prefs_url); + this.setTitle(Kronolith.text.prefs); + this._addHistory(loc); break; } }, @@ -443,6 +433,22 @@ KronolithCore = { }, /** + * Closes the currently active view. + */ + closeView: function() + { + [ 'Day', 'Week', 'Month', 'Year', 'Tasks', 'Agenda' ].each(function(a) { + $('kronolithNav' + a).removeClassName('on'); + }); + if (this.view) { + $('kronolithView' + this.view.capitalize()).fade({ 'queue': 'end' }); + } + if ($('kronolithIframe').visible()) { + $('kronolithIframe').fade({ 'queue': 'end' }); + } + }, + + /** * Creates a single row of day cells for usage in the month and multi-week * views. * @@ -1737,21 +1743,16 @@ KronolithCore = { name = loc; } - var container = $('dimpmain_portal'), iframe; - if (!container) { - this.showNotifications([ { type: 'horde.error', message: 'Bad portal!' } ]); - return; - } - - iframe = new Element('IFRAME', { id: 'iframe' + name, className: 'iframe', frameBorder: 0, src: loc }); - this._resizeIE6Iframe(iframe); - - // Hide menu in prefs pages. - if (name == 'options') { - iframe.observe('load', function() { $('iframeoptions').contentWindow.document.getElementById('menu').style.display = 'none'; }); + if ($('kronolithIframe' + name)) { + $('kronolithIframe' + name).src = loc; + } else { + var iframe = new Element('IFRAME', { 'id': 'kronolithIframe' + name, 'class': 'kronolithIframe', 'frameBorder': 0, 'src': loc }); + //this._resizeIE6Iframe(iframe); + $('kronolithIframe').insert(iframe); } - container.insert(iframe); + this.view = null; + $('kronolithIframe').appear({ 'queue': 'end' }); }, onResize: function(noupdate, nowait) @@ -1904,6 +1905,11 @@ KronolithCore = { e.stop(); return; + case 'kronolithOptions': + this.go('options'); + e.stop(); + return; + case 'kronolithMinicalDate': this.go('month:' + orig.retrieve('date')); e.stop(); diff --git a/kronolith/lib/Kronolith.php b/kronolith/lib/Kronolith.php index 06e8dd641..1ee54ed15 100644 --- a/kronolith/lib/Kronolith.php +++ b/kronolith/lib/Kronolith.php @@ -194,6 +194,7 @@ class Kronolith 'agenda' => _("Agenda"), 'searching' => str_replace('%s', '#{term}', _("Events matching \"%s\"")), 'allday' => _("All day"), + 'prefs' => _("Options"), ); for ($i = 1; $i <= 12; ++$i) { $code['text']['month'][$i - 1] = Horde_Nls::getLangInfo(constant('MON_' . $i)); diff --git a/kronolith/templates/index/index.inc b/kronolith/templates/index/index.inc index f4266ee65..ad9d69cf9 100644 --- a/kronolith/templates/index/index.inc +++ b/kronolith/templates/index/index.inc @@ -4,7 +4,7 @@
- · ' . $help_link; if ($logout_link) echo ' · ' . $logout_link ?>
+ · ' . $help_link; if ($logout_link) echo ' · ' . $logout_link ?>
getName(); ?>
@@ -13,9 +13,9 @@
-
"> -
format('l, j F Y') ?>
-
+
"> +
format('l, j F Y') ?>
+
@@ -128,6 +128,7 @@ require dirname(__FILE__) . '/year.inc'; require dirname(__FILE__) . '/tasks.inc'; require dirname(__FILE__) . '/agenda.inc'; ?> +
diff --git a/kronolith/themes/screen.css b/kronolith/themes/screen.css index e897d26f7..256448cf7 100644 --- a/kronolith/themes/screen.css +++ b/kronolith/themes/screen.css @@ -1203,6 +1203,18 @@ div.kronolithView div.kronolithViewBody div.kronolithRow div .kronolithEvent.kro overflow: hidden; } +/* IFRAME */ +#kronolithIframe iframe { + position: absolute; + left: 0; + top: 0; + bottom: 0; + right: 0; + border: none; + width: 100%; + height: 100%; +} + /* Tags */ .panel-tags { margin-left: 10px; -- 2.11.0