r74935 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r74934‎ | r74935 | r74936 >
Date:03:34, 18 October 2010
Author:ning
Status:deferred
Tags:
Comment:
Bug fixing: OBPendingIndicator is not defined.
When adding Notifications on NotifyMe Special page
Modified paths:
  • /trunk/extensions/SemanticNotifyMe/scripts/NotifyMe/NotifyHelper.js (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticNotifyMe/scripts/NotifyMe/NotifyHelper.js
@@ -555,3 +555,90 @@
556556 // have to load the event handler afterwards
557557 if($('nmemail')) $('nmemail').onclick = function() {notifyhelper.doUpdateMail();};
558558 }
 559+
 560+// copy from SMWHalo extension scripts/OntologyBrowser/generalTools.js
 561+var OBPendingIndicator = Class.create();
 562+OBPendingIndicator.prototype = {
 563+ initialize: function(container) {
 564+ this.container = container;
 565+ this.pendingIndicator = document.createElement("img");
 566+ Element.addClassName(this.pendingIndicator, "obpendingElement");
 567+ this.pendingIndicator.setAttribute("src", wgServer + wgScriptPath + "/extensions/SMWHalo/skins/OntologyBrowser/images/ajax-loader.gif");
 568+ //this.pendingIndicator.setAttribute("id", "pendingAjaxIndicator_OB");
 569+ //this.pendingIndicator.style.left = (Position.cumulativeOffset(this.container)[0]-Position.realOffset(this.container)[0])+"px";
 570+ //this.pendingIndicator.style.top = (Position.cumulativeOffset(this.container)[1]-Position.realOffset(this.container)[1])+"px";
 571+ //this.hide();
 572+ //Indicator will not be added to the page on creation anymore but on fist time calling show
 573+ //this is preventing errors during add if contentelement is not yet available
 574+ this.contentElement = null;
 575+ },
 576+
 577+ /**
 578+ * Shows pending indicator relative to given container or relative to initial container
 579+ * if container is not specified.
 580+ */
 581+ show: function(container, alignment) {
 582+
 583+ //check if the content element is there
 584+ if($("content") == null){
 585+ return;
 586+ }
 587+
 588+ var alignOffset = 0;
 589+ if (alignment != undefined) {
 590+ switch(alignment) {
 591+ case "right": {
 592+ if (!container) {
 593+ alignOffset = $(this.container).offsetWidth - 16;
 594+ } else {
 595+ alignOffset = $(container).offsetWidth - 16;
 596+ }
 597+
 598+ break;
 599+ }
 600+ case "left": break;
 601+ }
 602+ }
 603+
 604+ //if not already done, append the indicator to the content element so it can become visible
 605+ if(this.contentElement == null) {
 606+ this.contentElement = $("content");
 607+ this.contentElement.appendChild(this.pendingIndicator);
 608+ }
 609+ if (!container) {
 610+ this.pendingIndicator.style.left = (alignOffset + Position.cumulativeOffset(this.container)[0]-Position.realOffset(this.container)[0])+"px";
 611+ this.pendingIndicator.style.top = (Position.cumulativeOffset(this.container)[1]-Position.realOffset(this.container)[1]+this.container.scrollTop)+"px";
 612+ } else {
 613+ this.pendingIndicator.style.left = (alignOffset + Position.cumulativeOffset($(container))[0]-Position.realOffset($(container))[0])+"px";
 614+ this.pendingIndicator.style.top = (Position.cumulativeOffset($(container))[1]-Position.realOffset($(container))[1]+$(container).scrollTop)+"px";
 615+ }
 616+ // hmm, why does Element.show(...) not work here?
 617+ this.pendingIndicator.style.display="block";
 618+ this.pendingIndicator.style.visibility="visible";
 619+
 620+ },
 621+
 622+ /**
 623+ * Shows the pending indicator on the specified <element>. This works also
 624+ * in popup panels with a defined z-index.
 625+ */
 626+ showOn: function(element) {
 627+ container = element.offsetParent;
 628+ $(container).insert({top: this.pendingIndicator});
 629+ var pOff = $(element).positionedOffset();
 630+ this.pendingIndicator.style.left = pOff[0]+"px";
 631+ this.pendingIndicator.style.top = pOff[1]+"px";
 632+ this.pendingIndicator.style.display="block";
 633+ this.pendingIndicator.style.visibility="visible";
 634+ this.pendingIndicator.style.position = "absolute";
 635+
 636+ },
 637+
 638+ hide: function() {
 639+ Element.hide(this.pendingIndicator);
 640+ },
 641+
 642+ remove: function() {
 643+ Element.remove(this.pendingIndicator);
 644+ }
 645+}
\ No newline at end of file

Status & tagging log