Open prefs ui in iframe.
authorJan Schneider <jan@horde.org>
Tue, 27 Oct 2009 17:47:15 +0000 (18:47 +0100)
committerJan Schneider <jan@horde.org>
Wed, 28 Oct 2009 14:54:20 +0000 (15:54 +0100)
kronolith/index.php
kronolith/js/kronolith.js
kronolith/lib/Kronolith.php
kronolith/templates/index/index.inc
kronolith/themes/screen.css

index 333eb17..5eee64f 100644 (file)
@@ -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)) {
index a4c654f..0856d49 100644 (file)
@@ -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();
index 06e8dd6..1ee54ed 100644 (file)
@@ -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));
index f4266ee..ad9d69c 100644 (file)
@@ -4,7 +4,7 @@
 
   <!-- ini user zone -->
   <div id="kronolithUser">
-   <a href="#"><?php echo _("Options") ?></a><?php if ($help_link) echo ' <span class="kronolithSeparator">&middot;</span> ' . $help_link; if ($logout_link) echo ' <span class="kronolithSeparator">&middot;</span> ' . $logout_link ?><br />
+   <a href="#" id="kronolithOptions"><?php echo _("Options") ?></a><?php if ($help_link) echo ' <span class="kronolithSeparator">&middot;</span> ' . $help_link; if ($logout_link) echo ' <span class="kronolithSeparator">&middot;</span> ' . $logout_link ?><br />
    <span class="kronolithUserName"><?php echo $identity->getName(); ?></span><br />
   </div>
   <!-- end user zone -->
@@ -13,9 +13,9 @@
 
 <!-- ini bar -->
 <div id="kronolithBar">
-    <div class="kronolithDateChoice" title="<?php echo _("Today") ?>">
-      <div><?php echo $today->format('l, j F Y') ?></div>
-    </div>
+  <div class="kronolithDateChoice" title="<?php echo _("Today") ?>">
+    <div><?php echo $today->format('l, j F Y') ?></div>
+  </div>
 
   <div id="kronolithNav">
     <a id="kronolithNavDay"><?php echo _("Day") ?></a>
@@ -128,6 +128,7 @@ require dirname(__FILE__) . '/year.inc';
 require dirname(__FILE__) . '/tasks.inc';
 require dirname(__FILE__) . '/agenda.inc';
 ?>
+<div id="kronolithIframe" style="display:none"></div>
 </div>
 <!-- end body -->
 
index e897d26..256448c 100644 (file)
@@ -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;