Don't show user/password fields when editing calendars that don't require
authorJan Schneider <jan@horde.org>
Tue, 22 Dec 2009 22:39:25 +0000 (23:39 +0100)
committerJan Schneider <jan@horde.org>
Tue, 22 Dec 2009 22:53:15 +0000 (23:53 +0100)
authentication.

kronolith/js/kronolith.js

index 861189c..b11f632 100644 (file)
@@ -2931,8 +2931,9 @@ KronolithCore = {
                 while (!$('kronolithCalendar' + type + i).visible()) {
                     i++;
                 }
-                if (type == 'remote' && !$F('kronolithCalendarremoteId')) {
+                if (type == 'remote') {
                     elt.disable();
+                    var params = { url: $F('kronolithCalendarremoteUrl') };
                     if (i == 1) {
                         if (!$F('kronolithCalendarremoteUrl')) {
                             this.showNotifications([ { type: 'horde.warning', message: Kronolith.text.no_url }]);
@@ -2940,7 +2941,7 @@ KronolithCore = {
                             return;
                         }
                         this.doAction('GetRemoteInfo',
-                                      { url: $F('kronolithCalendarremoteUrl') },
+                                      params,
                                       function(r) {
                                           if (r.response.success) {
                                               if (r.response.name) {
@@ -2960,7 +2961,6 @@ KronolithCore = {
                                       { asynchronous: false });
                     }
                     if (i == 2) {
-                        var params = { url: $F('kronolithCalendarremoteUrl') };
                         if ($F('kronolithCalendarremoteUsername')) {
                             params.username = $F('kronolithCalendarremoteUsername');
                             params.password =  $F('kronolithCalendarremotePassword');
@@ -2969,10 +2969,12 @@ KronolithCore = {
                                       params,
                                       function(r) {
                                           if (r.response.success) {
-                                              if (r.response.name) {
+                                              if (r.response.name &&
+                                                  !$F('kronolithCalendarremoteName')) {
                                                   $('kronolithCalendarremoteName').setValue(r.response.name);
                                               }
-                                              if (r.response.desc) {
+                                              if (r.response.desc &&
+                                                  !$F('kronolithCalendarremoteDescription')) {
                                                   $('kronolithCalendarremoteDescription').setValue(r.response.desc);
                                               }
                                               this._calendarNext(type);