]> git.wh0rd.org Git - tt-rss.git/commitdiff
rework email article dialog
authorAndrew Dolgov <fox@fakecake.org>
Sat, 20 Nov 2010 20:45:31 +0000 (23:45 +0300)
committerAndrew Dolgov <fox@fakecake.org>
Sat, 20 Nov 2010 20:45:31 +0000 (23:45 +0300)
modules/popup-dialog.php
prefs.js
tt-rss.js
viewfeed.js

index 351d4b0f90717638cfa8e18df6d7c75f30d9926f..ad3ca0c3a6d04340189a4ff1a77b19f2b7296214 100644 (file)
 
                        print "<div align='center'>";
 
-                       print "<button onclick=\"return opmlRegenKey()\">".
+                       print "<button dojoType=\"dijit.form.Button\" onclick=\"return opmlRegenKey()\">".
                                __('Generate new URL')."</button> ";
 
-                       print "<button onclick=\"return closeInfoBox()\">".
+                       print "<button dojoType=\"dijit.form.Button\" onclick=\"return closeInfoBox()\">".
                                __('Close this window')."</button>";
 
                        print "</div>";
 
                if ($id == "emailArticle") {
 
-                       print "<title>".__('Forward article by email')."</title>";
-                       print "<content><![CDATA[";
-
-                       print "<form id=\"article_email_form\" onsubmit='return false'>";
-
                        $secretkey = sha1(uniqid(rand(), true));
 
                        $_SESSION['email_secretkey'] = $secretkey;
 
-                       print "<input type=\"hidden\" name=\"secretkey\" value=\"$secretkey\">";
-                       print "<input type=\"hidden\" name=\"op\" value=\"rpc\">";
-                       print "<input type=\"hidden\" name=\"subop\" value=\"sendEmail\">"; 
+                       print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"secretkey\" value=\"$secretkey\">";
+                       print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"rpc\">";
+                       print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"subop\" value=\"sendEmail\">"; 
 
                        $result = db_query($link, "SELECT email, full_name FROM ttrss_users WHERE
                                id = " . $_SESSION["uid"]);
 
                        print "</td><td>";
 
-                       print "<input size=\"40\" disabled
-                                       onkeypress=\"return filterCR(event, false)\"
+                       print "<input dojoType=\"dijit.form.TextBox\" disabled=\"1\" style=\"width : 30em;\"
                                        value=\"$user_name <$user_email>\">";
 
                        print "</td></tr><tr><td>";
 
                        print "</td><td>";
 
-                       print "<input size=\"40\"
-                                       onkeypress=\"return filterCR(event, false)\"
-                                       name=\"destination\" id=\"destination\">";
+                       print "<input dojoType=\"dijit.form.ValidationTextBox\" required=\"true\"
+                                       style=\"width : 30em;\"
+                                       name=\"destination\" id=\"emailArticleDlg_destination\">";
 
-                       print "<div class=\"autocomplete\" id=\"destination_choices\" 
-                                       style=\"display:none\"></div>"; 
+                       print "<div class=\"autocomplete\" id=\"emailArticleDlg_dst_choices\" 
+                                       style=\"z-index: 30; display : none\"></div>";  
 
                        print "</td></tr><tr><td>";
 
 
                        print "</td><td>";
 
-                       print "<input size=\"60\" class=\"iedit\"
-                                       onkeypress=\"return filterCR(event, false)\"
+                       print "<input dojoType=\"dijit.form.ValidationTextBox\" required=\"true\"
+                                       style=\"width : 30em;\" 
                                        name=\"subject\" value=\"$subject\" id=\"subject\">";
 
-                       print "</td></tr></table>";
+                       print "</td></tr>";
 
-                       print "<textarea rows='10' class='iedit' style='font-size : small'
+                       print "<tr><td colspan='2'><textarea dojoType=\"dijit.form.SimpleTextarea\" style='font-size : 12px; width : 100%' rows=\"20\"
                                name='content'>$content</textarea>";
 
-                       print "</form>";
+                       print "</td></tr></table>";
 
                        print "<div class='dlgButtons'>";
-
-                       print "<button onclick=\"return emailArticleDo()\">".__('Send e-mail')."</button> ";
-                       print "<button onclick=\"return closeInfoBox()\">".__('Cancel')."</button>";
-
-                       print "]]></content>";
+                       print "<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('emailArticleDlg').execute()\">".__('Send e-mail')."</button> ";
+                       print "<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('emailArticleDlg').hide()\">".__('Cancel')."</button>";
+                       print "</div>";
 
                        //return;
                }
 
                        print "<div align='center'>";
 
-                       print "<button onclick=\"return genUrlChangeKey('$feed_id', '$is_cat')\">".
+                       print "<button dojoType=\"dijit.form.Button\" onclick=\"return genUrlChangeKey('$feed_id', '$is_cat')\">".
                                __('Generate new URL')."</button> ";
 
-                       print "<button onclick=\"return closeInfoBox()\">".
+                       print "<button dojoType=\"dijit.form.Button\" onclick=\"return closeInfoBox()\">".
                                __('Close this window')."</button>";
 
                        print "</div>";
index 33e0ccf4614192f7acbcdb072c57510a913f5aae..6c7ed3679e1e45703a7fb5f5420702ec4786c92e 100644 (file)
--- a/prefs.js
+++ b/prefs.js
@@ -1027,6 +1027,8 @@ function validatePrefsReset() {
 function pref_hotkey_handler(e) {
        try {
 
+               if (dijit.getEnclosingWidget(e.target)) return;
+
                var keycode;
                var shift_key = false;
 
index 8af5c2221af5f1afb2c85f3e3ec96696c353b9aa..a0c1b70f46f837ae3e203b45a1d71c9b1b72546a 100644 (file)
--- a/tt-rss.js
+++ b/tt-rss.js
@@ -280,6 +280,7 @@ function init() {
                dojo.require("dijit.form.ValidationTextBox");
                dojo.require("dijit.form.FilteringSelect");
                dojo.require("dijit.form.CheckBox");
+               dojo.require("dijit.form.SimpleTextarea");
                dojo.require("dijit.Toolbar");
                dojo.require("dijit.ProgressBar");
                dojo.require("dijit.Menu");
@@ -623,6 +624,9 @@ function hotkey_handler(e) {
 
        try {
 
+               var widget = dijit.getEnclosingWidget(e.target);
+               if (widget && Element.visible(widget.domNode)) return;
+
                var keycode;
                var shift_key = false;
 
index bee13f5a76c144a41b0b933989183a7c7f594f83..d14d9818049a8b040077858c63bc727169682c4e 100644 (file)
@@ -1869,61 +1869,58 @@ function emailArticle(id) {
                        id = ids.toString();
                }
 
-               displayDlg('emailArticle', id, 
-                  function () {                                
-                               document.forms['article_email_form'].destination.focus();
+               if (dijit.byId("emailArticleDlg"))
+                       dijit.byId("emailArticleDlg").destroyRecursive();
 
-                          new Ajax.Autocompleter('destination', 'destination_choices',
-                                  "backend.php?op=rpc&subop=completeEmails",
-                                  { tokens: '', paramName: "search" });
+               var query = "backend.php?op=dlg&id=emailArticle&param=" + param_escape(id);
 
-                       });
-
-       } catch (e) {
-               exception_error("emailArticle", e);
-       }
-}
+               dialog = new dijit.Dialog({
+                       id: "emailArticleDlg",
+                       title: __("Forward article by email"),
+                       style: "width: 600px",
+                       execute: function() {
+                               if (this.validate()) {
 
-function emailArticleDo() {
-       try {
-               var f = document.forms['article_email_form'];
-
-               if (f.destination.value == "") {
-                       alert("Please fill in the destination email.");
-                       return;
-               }
-
-               if (f.subject.value == "") {
-                       alert("Please fill in the subject.");
-                       return;
-               }
-
-               var query = Form.serialize("article_email_form");
+                                       new Ajax.Request("backend.php", {
+                                               parameters: dojo.objectToQuery(this.attr('value')),
+                                               onComplete: function(transport) { 
+               
+                                                       var error = transport.responseXML.getElementsByTagName('error')[0];
+                       
+                                                       if (error) {
+                                                               alert(__('Error sending email:') + ' ' + error.firstChild.nodeValue);
+                                                       } else {
+                                                               notify_info('Your message has been sent.');
+                                                               dialog.hide();
+                                                       }
+                       
+                                       } });
+                               }
+                       },
+                       href: query});
 
-//             console.log(query);
+               var tmph = dojo.connect(dialog, 'onLoad', function() {
+               dojo.disconnect(tmph);
 
-               new Ajax.Request("backend.php", {
-                       parameters: query,
-                       onComplete: function(transport) { 
-                               try {
+                  new Ajax.Autocompleter('emailArticleDlg_destination', 'emailArticleDlg_dst_choices',
+                          "backend.php?op=rpc&subop=completeEmails",
+                          { tokens: '', paramName: "search" });
+               });
 
-                                       var error = transport.responseXML.getElementsByTagName('error')[0];
+               dialog.show();
 
-                                       if (error) {
-                                               alert(__('Error sending email:') + ' ' + error.firstChild.nodeValue);
-                                       } else {
-                                               notify_info('Your message has been sent.');
-                                               closeInfoBox();
-                                       }
+               /* displayDlg('emailArticle', id, 
+                  function () {                                
+                               document.forms['article_email_form'].destination.focus();
 
-                               } catch (e) {
-                                       exception_error("sendEmailDo", e);
-                               }
+                          new Ajax.Autocompleter('destination', 'destination_choices',
+                                  "backend.php?op=rpc&subop=completeEmails",
+                                  { tokens: '', paramName: "search" });
 
-                       } });
+                       }); */
 
        } catch (e) {
-               exception_error("emailArticleDo", e);
+               exception_error("emailArticle", e);
        }
 }