Bug 737349 - Add account dialog for Filelink should display Learn More... links for the feature and for each service. r+ui-r=bwinton, a=bienvenu.
authorMike Conley <mconley@mozilla.com>
Thu, 12 Apr 2012 21:13:39 -0400
changeset 11185 f1039ec2ed7d8ab2a5b1f96143ab1399dc47cf95
parent 11184 bc7bd2dee00d1d53d7d20851d8318698376fa6ab
child 11186 9633d82db33f82c003d8b249abacfd86dac5bbbb
push id463
push userbugzilla@standard8.plus.com
push dateTue, 24 Apr 2012 17:34:51 +0000
treeherdercomm-beta@e53588e8f7b0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbienvenu
bugs737349
Bug 737349 - Add account dialog for Filelink should display Learn More... links for the feature and for each service. r+ui-r=bwinton, a=bienvenu.
mail/components/cloudfile/content/Dropbox/settings.xhtml
mail/components/cloudfile/content/YouSendIt/settings.xhtml
mail/components/cloudfile/content/addAccountDialog.js
mail/components/cloudfile/content/emptySettings.xhtml
mail/themes/gnomestripe/mail/cloudfile/addAccountDialog.css
mail/themes/pinstripe/mail/cloudfile/addAccountDialog.css
mail/themes/qute/mail/cloudfile/addAccountDialog.css
--- a/mail/components/cloudfile/content/Dropbox/settings.xhtml
+++ b/mail/components/cloudfile/content/Dropbox/settings.xhtml
@@ -1,17 +1,20 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!-- This Source Code Form is subject to the terms of the Mozilla Public
    - License, v. 2.0. If a copy of the MPL was not distributed with this file,
    - You can obtain one at http://mozilla.org/MPL/2.0/.  -->
 
-<!DOCTYPE html
-PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
-"DTD/xhtml1-strict.dtd">
+<!DOCTYPE html [
+  <!ENTITY % htmlDTD PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd"> %htmlDTD;
+]>
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
   <head>
     <link rel="stylesheet"
         type="text/css"
         href="chrome://messenger/skin/cloudfile/addAccountDialog.css" />
   </head>
   <body id="provider-settings">
+    <div id="learn-more">
+      <a href="https://www.dropbox.com/"></a>
+    </div>
   </body>
 </html>
--- a/mail/components/cloudfile/content/YouSendIt/settings.xhtml
+++ b/mail/components/cloudfile/content/YouSendIt/settings.xhtml
@@ -7,21 +7,24 @@
   <!ENTITY % htmlDTD PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd"> %htmlDTD;
   <!ENTITY % ysiDTD SYSTEM "chrome://messenger/locale/cloudfile/YouSendIt/settings.dtd"> %ysiDTD;
 ]>
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
   <head>
     <script type="application/javascript"
             src="chrome://messenger/content/cloudfile/YouSendIt/settings.js"/>
     <link rel="stylesheet"
-        type="text/css"
-        href="chrome://messenger/skin/cloudfile/addAccountDialog.css" />
+          type="text/css"
+          href="chrome://messenger/skin/cloudfile/addAccountDialog.css" />
   </head>
   <body id="provider-settings">
     <form id="provider-form" onsubmit="return false;">
       <label for="username">&youSendItSettings.username;</label>
       <input id="username" type="text" required="true"/>
+      <div id="learn-more" class="float-right">
+        <a href="https://www.yousendit.com/"></a>
+      </div>
       <div>
         <a href="http://www.yousendit.com/compare-plans">&youSendItSettings.needAnAccount;</a>
       </div>
     </form>
   </body>
 </html>
--- a/mail/components/cloudfile/content/addAccountDialog.js
+++ b/mail/components/cloudfile/content/addAccountDialog.js
@@ -61,46 +61,68 @@ let addAccountDialog = {
     this._authSpinner = document.getElementById("authorizing");
     this._error = document.getElementById("error");
     this._createAccountText = document.getElementById("createAccountText");
 
     this.removeTitleMenuItem();
     this.addAccountTypes();
 
     // Hook up our onInput event handler
-    this._settings.addEventListener("DOMContentLoaded", function(e) {
-      let doc = this.contentDocument;
-
-      let links = doc.getElementsByTagName("a");
-
-      for (let [, link] in Iterator(links))
-        link.addEventListener("click", addAccountDialog.onClickLink);
-
-      let form = doc.getElementById(kFormId);
-
-      if (form)
-        form.addEventListener("input", addAccountDialog.onInput);
-
-      addAccountDialog.onInput();
-
-      // Focus the first field in the form, if any, that does not have the
-      // class "focus-filter".
-      let firstField = doc.querySelector("form:not(.filter) input:not(.hidden)");
-      if (firstField)
-        firstField.focus();
-
-    }, false);
+    this._settings.addEventListener("DOMContentLoaded",
+                                    this.onIFrameLoaded.bind(this),
+                                    false);
 
     this._settings.addEventListener("overflow", function(e) {
       addAccountDialog.fitIFrame();
     });
 
+    // Hook up the default "Learn More..." link to the appropriate link.
+    let learnMore = this._settings
+                        .contentDocument
+                        .querySelector('#learn-more > a[href=""]');
+    if (learnMore) {
+      this.insertLearnMoreString(learnMore);
+      learnMore.href = Services.prefs
+                               .getCharPref("mail.cloud_files.learn_more_url");
+    }
+
+    // The default emptySettings.xhtml is already loaded into the IFrame
+    // at this point, before we could attach our DOMContentLoaded event
+    // listener, so we'll call the function here manually.
+    this.onIFrameLoaded(null);
+
     addAccountDialog.fitIFrame();
   },
 
+  onIFrameLoaded: function AAD_onIFrameLoaded(aEvent) {
+    let doc = this._settings.contentDocument;
+
+    let links = doc.getElementsByTagName("a");
+
+    for (let [, link] in Iterator(links))
+      link.addEventListener("click", this.onClickLink);
+
+    let form = doc.getElementById(kFormId);
+
+    if (form)
+      form.addEventListener("input", this.onInput);
+
+    this.onInput();
+
+    let learnMore = doc.querySelector('#learn-more > a');
+    if (learnMore)
+      this.insertLearnMoreString(learnMore);
+
+    // Focus the first field in the form, if any, that does not have the
+    // class "focus-filter".
+    let firstField = doc.querySelector("form:not(.filter) input:not(.hidden)");
+    if (firstField)
+      firstField.focus();
+  },
+
   fitIFrame: function() {
     // Determine the height of the accountSettings iframe, and adjust
     // the height of the window appropriately.
     let newHeight = this._settings.contentDocument
                                   .body
                                   .offsetHeight;
     this._settings.style.height = this._settings.style.minHeight = newHeight + "px";
     window.sizeToContent();
@@ -209,13 +231,18 @@ let addAccountDialog = {
                    .getElementById(kFormId);
 
     if (form)
       return form.checkValidity();
 
     return true;
   },
 
+  insertLearnMoreString: function AAD_insertLearnMoreString(aNode) {
+    let msgBundle = Services.strings
+                            .createBundle("chrome://messenger/locale/messenger.properties");
+    aNode.textContent = msgBundle.GetStringFromName("crashedpluginsMessage.learnMore");
+  },
 }
 
 XPCOMUtils.defineLazyServiceGetter(this, "gProtocolService",
                                    "@mozilla.org/uriloader/external-protocol-service;1",
                                    "nsIExternalProtocolService");
--- a/mail/components/cloudfile/content/emptySettings.xhtml
+++ b/mail/components/cloudfile/content/emptySettings.xhtml
@@ -1,17 +1,21 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!-- This Source Code Form is subject to the terms of the Mozilla Public
    - License, v. 2.0. If a copy of the MPL was not distributed with this file,
    - You can obtain one at http://mozilla.org/MPL/2.0/.  -->
 
-<!DOCTYPE html
-PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
-"DTD/xhtml1-strict.dtd">
+<!DOCTYPE html [
+  <!ENTITY % htmlDTD PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd"> %htmlDTD;
+  <!ENTITY % aadDTD SYSTEM "chrome://messenger/locale/cloudfile/addAccountDialog.dtd"> %aadDTD;
+]>
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
   <head>
     <link rel="stylesheet"
         type="text/css"
         href="chrome://messenger/skin/cloudfile/addAccountDialog.css" />
   </head>
   <body id="provider-settings">
+    <div id="learn-more">
+      <a href=""></a>
+    </div>
   </body>
 </html>
--- a/mail/themes/gnomestripe/mail/cloudfile/addAccountDialog.css
+++ b/mail/themes/gnomestripe/mail/cloudfile/addAccountDialog.css
@@ -79,8 +79,16 @@ a {
 }
 
 /* Make the icons show up in the menulist */
 #accountType > menupopup > menuitem > .menu-iconic-left {
   -moz-padding-end: 2px;
   display: -moz-box;
   min-width: 16px;
 }
+
+#learn-more {
+  text-align: right;
+}
+
+.float-right {
+  float: right;
+}
--- a/mail/themes/pinstripe/mail/cloudfile/addAccountDialog.css
+++ b/mail/themes/pinstripe/mail/cloudfile/addAccountDialog.css
@@ -84,8 +84,16 @@ a {
   width: 100%;
 }
 
 #accountType > menupopup > menuitem > .menu-iconic-left {
   display: -moz-box;
   min-width: 16px;
   -moz-padding-end: 2px;
 }
+
+#learn-more {
+  text-align: right;
+}
+
+.float-right {
+  float: right;
+}
--- a/mail/themes/qute/mail/cloudfile/addAccountDialog.css
+++ b/mail/themes/qute/mail/cloudfile/addAccountDialog.css
@@ -79,8 +79,16 @@ a {
   width: 100%;
 }
 
 #accountType > menupopup > menuitem > .menu-iconic-left {
   display: -moz-box;
   min-width: 16px;
   -moz-padding-end: 2px;
 }
+
+#learn-more {
+  text-align: right;
+}
+
+.float-right {
+  float: right;
+}