Show spinner while retrieving events.
authorJan Schneider <jan@horde.org>
Fri, 13 Mar 2009 11:26:22 +0000 (12:26 +0100)
committerJan Schneider <jan@horde.org>
Fri, 13 Mar 2009 11:26:37 +0000 (12:26 +0100)
kronolith/ajax.php
kronolith/js/src/kronolith.js
kronolith/templates/index/index.inc
kronolith/themes/screen.css

index 6af4536..fc1f655 100644 (file)
@@ -63,7 +63,7 @@ case 'ListEvents':
         if (!array_key_exists($calendar,
                               Kronolith::listCalendars(false, PERMS_READ))) {
             $notification->push(_("Permission Denied"), 'horde.error');
-            $result = false;
+            $result = true;
             break 2;
         }
         $driver = '';
@@ -87,7 +87,7 @@ case 'ListEvents':
     $events = $kronolith_driver->listEvents($start, $end, true, false, true);
     if (is_a($events, 'PEAR_Error')) {
         $notification->push($events, 'horde.error');
-        $result = false;
+        $result = true;
     } else {
         $result = new stdClass;
         $result->cal = $cal;
index 6f7319d..6e654cf 100644 (file)
@@ -23,6 +23,7 @@ KronolithCore = {
     ecache: $H(),
     efifo: {},
     eventsLoading: $H(),
+    loading: 0,
     date: new Date(),
 
     doActionOpts: {
@@ -516,6 +517,8 @@ KronolithCore = {
         calendars.each(function(cal) {
             var calendar = cal.join('|');
             this.eventsLoading[calendar] = start + end;
+            this.loading++;
+            $('kronolithLoading').show();
             this.doAction('ListEvents', { start: start, end: end, cal: calendar, view: view }, callback.bind(this));
         }, this);
     },
@@ -529,6 +532,12 @@ KronolithCore = {
     {
         var div;
 
+        // Hide spinner.
+        this.loading--;
+        if (!this.loading) {
+            $('kronolithLoading').hide();
+        }
+
         // Check if this is the still the result of the most current request.
         if (r.response.view != this.view ||
             r.response.sig != this.eventsLoading[r.response.cal]) {
index 54a2535..f3dc115 100644 (file)
 
 <!-- ini body -->
 <div id="kronolithBody">
+<div id="kronolithLoading" style="display:none"></div>
 <?php
 $img_blank = Horde::img('blank.gif', '', 'height="8" width="8"', $registry->getImageDir('horde'));
 require dirname(__FILE__) . '/month.inc';
index 666be22..7701b76 100644 (file)
@@ -482,6 +482,22 @@ body.kronolithAjax {
     display: none;
 }
 
+/* Loading spinner */
+#kronolithLoading {
+    position: absolute;
+    z-index: 1000;
+    background: transparent url("graphics/loading.gif") no-repeat center;
+    padding: 2px;
+    width: 16px;
+    height: 17px;
+    /* Take values from .kronolithView */
+    top: 50px;
+    left: 175px;
+    margin-top: 5px;
+    /* Take values from .kronolithRow */
+    border: 1px #c0c0c0 solid;
+}
+
 /* User data and options */
 #kronolithUser {
     float: right;