/[drupal]/contributions/modules/popups/popups.js
ViewVC logotype

Diff of /contributions/modules/popups/popups.js

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.9.8.12, Sat Mar 21 00:57:15 2009 UTC revision 1.9.8.13, Thu Mar 26 04:43:11 2009 UTC
# Line 204  Popups.Popup.prototype.targetLayerSelect Line 204  Popups.Popup.prototype.targetLayerSelect
204   * @return bool   * @return bool
205   */   */
206  Popups.Popup.prototype.isDone = function(path) {  Popups.Popup.prototype.isDone = function(path) {
 //  console.log("Doing isDone for popup: " + this.id + ", now at " + path );  
207    var done;    var done;
208    if (this.options.doneTest) {    if (this.options.doneTest) {
209      // Test if we are at the path specified by doneTest.      // Test if we are at the path specified by doneTest.
# Line 214  Popups.Popup.prototype.isDone = function Line 213  Popups.Popup.prototype.isDone = function
213      if (this.parent) {      if (this.parent) {
214         // Test if we are back to the parent popup's path.         // Test if we are back to the parent popup's path.
215        done = (path === this.parent.path);        done = (path === this.parent.path);
 //      console.log("Lookin at parent: " + this.parent.path + ". Done = " + done);  
216      }      }
217      else {      else {
218         // Test if we are back to the original page's path.         // Test if we are back to the original page's path.
219        done = (path === Popups.originalSettings.popups.originalPath);        done = (path === Popups.originalSettings.popups.originalPath);
 //      console.log("Lookin at original page: " + Popups.originalSettings.popups.originalPath + ". Done = " + done);  
220      }      }
221    };    };
222    return done;    return done;
# Line 974  Popups.formSuccess = function(popup, dat Line 971  Popups.formSuccess = function(popup, dat
971        }        }
972      }      }
973      else { // Normal, targeted ajax, reload behavior.      else { // Normal, targeted ajax, reload behavior.
974          var showingMessagePopup = false;
975        // Show messages in dialog and embed the results in the original page.        // Show messages in dialog and embed the results in the original page.
976        var showMessage = data.messages.length && !popup.options.noMessage;        // TODO - should seperate these two functions.
977        if (showMessage) {  //      var showMessage = data.messages.length && !popup.options.noMessage;
978          var messagePopup = Popups.message(data.messages); // Popup message.        if (data.messages.length) {
979          if (Popups.originalSettings.popups.autoCloseFinalMessage) {          // If we just dismissed the last popup dialog.
980            setTimeout(function(){Popups.close(messagePopup);}, 2500); // Autoclose the message box in 2.5 seconds.          if (!Popups.activePopup() && !popup.options.noMessage) {
981              // Show drupal_set_message in message popup.
982              var messagePopup = Popups.message(data.messages);
983              if (Popups.originalSettings.popups.autoCloseFinalMessage) {
984                setTimeout(function(){Popups.close(messagePopup);}, 2500); // Autoclose the message box in 2.5 seconds.
985              }
986              showingMessagePopup = true;
987          }          }
988    
989          // Insert the message into the page above the content.  
990            // Insert the message into the parent layer, above the content.
991          // Might not be the standard spot, but it is the easiest to find.          // Might not be the standard spot, but it is the easiest to find.
992          var $next;          var $next;
993          if (popup.targetLayerSelector() === 'body') {          if (popup.targetLayerSelector() === 'body') {
# Line 1005  Popups.formSuccess = function(popup, dat Line 1010  Popups.formSuccess = function(popup, dat
1010              if(!isNaN(t_new)) {              if(!isNaN(t_new)) {
1011                t_new = t_old; // handle case where targetSelectors is an array, not a hash.                t_new = t_old; // handle case where targetSelectors is an array, not a hash.
1012              }              }
 //            console.log("Updating target " + t_old + ' with ' + t_new);  
1013              var new_content = $(t_new, data.content);              var new_content = $(t_new, data.content);
 //            console.log("new content... ");  
 //            console.log(new_content);  
1014              var $c = $(popup.targetLayerSelector()).find(t_old).html(new_content); // Inject the new content into the original page.              var $c = $(popup.targetLayerSelector()).find(t_old).html(new_content); // Inject the new content into the original page.
1015    
1016              Drupal.attachBehaviors($c);              Drupal.attachBehaviors($c);
# Line 1016  Popups.formSuccess = function(popup, dat Line 1018  Popups.formSuccess = function(popup, dat
1018          }          }
1019          else { // Put the entire new content into default content area.          else { // Put the entire new content into default content area.
1020            var $c = $(popup.targetLayerSelector()).find(Popups.originalSettings.popups.defaultTargetSelector).html(data.content);            var $c = $(popup.targetLayerSelector()).find(Popups.originalSettings.popups.defaultTargetSelector).html(data.content);
 //          console.log("updating entire content area.")  
1021            Drupal.attachBehaviors($c);            Drupal.attachBehaviors($c);
1022          }          }
1023        }        }
# Line 1030  Popups.formSuccess = function(popup, dat Line 1031  Popups.formSuccess = function(popup, dat
1031    
1032        // Done with changes to the original page, remove effects.        // Done with changes to the original page, remove effects.
1033        Popups.removeLoading();        Popups.removeLoading();
1034        if (!showMessage) {        if (!showingMessagePopup) {
1035          // If there is not a messages popups, close current layer.          // If there is not a messages popups, close current layer.
1036          Popups.close();          Popups.close(null);
1037        }        }
1038      }      }
1039    

Legend:
Removed from v.1.9.8.12  
changed lines
  Added in v.1.9.8.13

  ViewVC Help
Powered by ViewVC 1.1.2