diff options
author | dave@33eels.com <dave@33eels.com@4eb1ac78-321c-0410-a911-ec516a8615a5> | 2008-10-03 13:38:33 (GMT) |
---|---|---|
committer | dave@33eels.com <dave@33eels.com@4eb1ac78-321c-0410-a911-ec516a8615a5> | 2008-10-03 13:38:33 (GMT) |
commit | 83b9745fc05d9b0f4ae3a0c12772701a879d18a1 (patch) | |
tree | 036ae6f519d4f2dc17f135a947c206d8d26708aa | |
parent | 2c19d8e57213e2e283d70e4c6a8ffcf4ca8363f5 (diff) |
Work on bug 761 ("Publishing"):
- Submit progress: spinner, disabled fields.
- Inline error message.
git-svn-id: http://svn.mozilla.org/addons/trunk@18843 4eb1ac78-321c-0410-a911-ec516a8615a5
-rw-r--r-- | bandwagon/content/scripts/rpc/service.js | 4 | ||||
-rw-r--r-- | bandwagon/content/ui/overlays/extensionsOverlayController.js | 53 | ||||
-rw-r--r-- | bandwagon/content/ui/publish.xul | 5 | ||||
-rw-r--r-- | bandwagon/content/ui/publishController.js | 18 | ||||
-rw-r--r-- | bandwagon/skin/images/spinner-small.gif | bin | 0 -> 1849 bytes |
5 files changed, 24 insertions, 56 deletions
diff --git a/bandwagon/content/scripts/rpc/service.js b/bandwagon/content/scripts/rpc/service.js index 7eea56a..d747b5f 100644 --- a/bandwagon/content/scripts/rpc/service.js +++ b/bandwagon/content/scripts/rpc/service.js @@ -256,7 +256,9 @@ Bandwagon.RPC.Service.prototype.publishToFeed = function(extension, feed, person // TODO if (callback) - callback(new this.Bandwagon.RPC.Event()); + { + setTimeout(function() { callback(new this.Bandwagon.RPC.Event()) }, 2000); + } } Bandwagon.RPC.Service.prototype.shareToEmail = function(extension, emailAddress, personalNote, callback) diff --git a/bandwagon/content/ui/overlays/extensionsOverlayController.js b/bandwagon/content/ui/overlays/extensionsOverlayController.js index a6bd600..2b1f0a2 100644 --- a/bandwagon/content/ui/overlays/extensionsOverlayController.js +++ b/bandwagon/content/ui/overlays/extensionsOverlayController.js @@ -117,11 +117,6 @@ Bandwagon.Controller.ExtensionsOverlay.doPublishToFeed = function(feed) var extension = Bandwagon.Controller.ExtensionsOverlay._getSelectedExtension(); - /* - var callback = function(event) {}; - bandwagonService.publishToFeed(extension, feed, callback); - */ - var params = { publishType: 1, @@ -129,8 +124,7 @@ Bandwagon.Controller.ExtensionsOverlay.doPublishToFeed = function(feed) publishExtension: extension }; - window.openDialog("chrome://bandwagon/content/ui/publish.xul", "", - "chrome, dialog, modal, resizable=yes", params).focus(); + Bandwagon.Controller.ExtensionsOverlay._openPublishDialog(params); } Bandwagon.Controller.ExtensionsOverlay.doShareToEmail = function(emailAddress) @@ -139,15 +133,6 @@ Bandwagon.Controller.ExtensionsOverlay.doShareToEmail = function(emailAddress) var extension = Bandwagon.Controller.ExtensionsOverlay._getSelectedExtension(); - /* - bandwagonService.shareToEmail(extension, emailAddress, callback); - - var callback = function(event) - { - Bandwagon.Controller.ExtensionsOverlay._invalidatePublishButton(); - }; - */ - var params = { publishType: 2, @@ -155,8 +140,7 @@ Bandwagon.Controller.ExtensionsOverlay.doShareToEmail = function(emailAddress) publishExtension: extension }; - window.openDialog("chrome://bandwagon/content/ui/publish.xul", "", - "chrome, dialog, modal, resizable=yes", params).focus(); + Bandwagon.Controller.ExtensionsOverlay._openPublishDialog(params); } Bandwagon.Controller.ExtensionsOverlay._getSelectedExtension = function() @@ -175,30 +159,6 @@ Bandwagon.Controller.ExtensionsOverlay.doAddNewShareEmail = function() { Bandwagon.Logger.debug("In Bandwagon.Controller.ExtensionsOverlay.doAddNewShareEmail()"); - /* - - // prompt for the new email address - - var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] - .getService(Components.interfaces.nsIPromptService); - - var input = {value: ""}; - - var result = promptService.prompt( - window, - Bandwagon.Controller.ExtensionsOverlay.stringBundle.getString("publish.new.email.address.title"), - Bandwagon.Controller.ExtensionsOverlay.stringBundle.getString("publish.new.email.address.text"), - input, - null, - {} - ); - - if (result) - { - Bandwagon.Controller.ExtensionsOverlay.doShareToEmail(input.value); - } - */ - var extension = Bandwagon.Controller.ExtensionsOverlay._getSelectedExtension(); var params = @@ -208,12 +168,17 @@ Bandwagon.Controller.ExtensionsOverlay.doAddNewShareEmail = function() publishExtension: extension }; - window.openDialog("chrome://bandwagon/content/ui/publish.xul", "", - "chrome, dialog, modal, resizable=yes", params).focus(); + Bandwagon.Controller.ExtensionsOverlay._openPublishDialog(params); Bandwagon.Controller.ExtensionsOverlay._invalidatePublishButton(); } +Bandwagon.Controller.ExtensionsOverlay._openPublishDialog = function(params) +{ + window.openDialog("chrome://bandwagon/content/ui/publish.xul", "", + "chrome, dialog, modal, resizable=no", params).focus(); +} + Bandwagon.Controller.ExtensionsOverlay._moveSearchTab = function() { var parNode = document.getElementById("viewGroup"); diff --git a/bandwagon/content/ui/publish.xul b/bandwagon/content/ui/publish.xul index 3e1d54b..cef68cc 100644 --- a/bandwagon/content/ui/publish.xul +++ b/bandwagon/content/ui/publish.xul @@ -81,6 +81,11 @@ <textbox id="personal-note" multiline="true"/> + <hbox> + <image id="spinner" src="chrome://bandwagon/skin/images/spinner-small.gif" collapsed="true"/> + <label id="error" style="color: red; visibility: hidden;" value=" "/> + </hbox> + </vbox> </dialog> diff --git a/bandwagon/content/ui/publishController.js b/bandwagon/content/ui/publishController.js index 327e16c..8249a24 100644 --- a/bandwagon/content/ui/publishController.js +++ b/bandwagon/content/ui/publishController.js @@ -146,14 +146,11 @@ Bandwagon.Controller.Publish._shareToNewEmail = function() Bandwagon.Controller.Publish.invalidate = function() { - if (Bandwagon.Controller.Publish.hasSubmitted) - { - // TODO disable accept and other fields - } - else - { - // TODO enable accept and other fields - } + document.getElementById("bandwagon-publish").getButton("accept").disabled = Bandwagon.Controller.Publish.hasSubmitted; + document.getElementById("email-address").disabled = Bandwagon.Controller.Publish.hasSubmitted; + document.getElementById("personal-note").disabled = Bandwagon.Controller.Publish.hasSubmitted; + document.getElementById("spinner").collapsed = !Bandwagon.Controller.Publish.hasSubmitted; + document.getElementById("error").style.visibility = "hidden"; } Bandwagon.Controller.Publish.finished = function(event) @@ -178,9 +175,8 @@ Bandwagon.Controller.Publish.finished = function(event) Bandwagon.Controller.Publish._showError = function(message) { - // TODO nicer - - alert(message); + document.getElementById("error").style.visibility = "visible"; + document.getElementById("error").value = message; } window.addEventListener("load", Bandwagon.Controller.Publish.init, true); diff --git a/bandwagon/skin/images/spinner-small.gif b/bandwagon/skin/images/spinner-small.gif Binary files differnew file mode 100644 index 0000000..5b33f7e --- /dev/null +++ b/bandwagon/skin/images/spinner-small.gif |