]> git.wh0rd.org - tt-rss.git/commitdiff
generic popup user dialog mechanism
authorAndrew Dolgov <fox@madoka.spb.ru>
Fri, 28 Oct 2005 05:59:29 +0000 (06:59 +0100)
committerAndrew Dolgov <fox@madoka.spb.ru>
Fri, 28 Oct 2005 05:59:29 +0000 (06:59 +0100)
backend.php
functions.js
tt-rss.css
tt-rss.js
tt-rss.php

index 378b645f82ae4419435dae9575c0ca1e11f0e400..6937a9af4608e9cc21b1cbb491ba0af08dae64d0 100644 (file)
 
        }
 
+       if ($op == "dlg") {
+               $id = $_GET["id"];
+
+               if ($id == "quickAddFeed") {
+                       print "Feed URL: <input id=\"qafInput\">
+                       <input class=\"button\"
+                               type=\"submit\" onclick=\"javascript:qafAdd()\" value=\"Add feed\">
+                       <input class=\"button\"
+                               type=\"submit\" onclick=\"javascript:closeDlg()\" 
+                               value=\"Cancel\">";
+               }
+       }
+
        db_close($link);
 ?>
 
index fe77163cbedf181fbe4f84f954755b169deed4f8..baee89558aef55a618d7a45b4e2ee0a52568b25c 100644 (file)
@@ -396,8 +396,3 @@ function popupHelp(tid) {
     }
   }
 
-function cancelDialog(sender) {
-
-       sender.offsetParent.style.display = "none";
-       
-}
index d72ccf949bfea7a00f0909a458146fc253b272a7..b2b5dc2f44fd9f5d5f953283c7b878a7e0318cf5 100644 (file)
@@ -388,7 +388,7 @@ pre {
        background : #f0f0f0;
 }
 
-#qafDialog {
+#userDlg {
        left : 400px;
        top : 18px;
        background : #fffff0;
index 664e5c8a5eb27db5b223d1d1dba7ab61aa0525d4..c49a52c136a7ccdc847d33ca1b014e6ba3887a9b 100644 (file)
--- a/tt-rss.js
+++ b/tt-rss.js
@@ -49,15 +49,20 @@ function toggleTags() {
 }
 
 function qaf_add_callback() {
-       var container = document.getElementById('feeds');
        if (xmlhttp.readyState == 4) {
                updateFeedList(false, false);
-               var qafDialog = document.getElementById("qafDialog");
-               qafDialog.style.display = "none";
-
+               closeDlg();
        } 
 }
 
+function dialog_refresh_callback() {
+       if (xmlhttp.readyState == 4) {
+               var dlg = document.getElementById("userDlg");
+
+               dlg.innerHTML = xmlhttp.responseText;
+               dlg.style.display = "block";
+       } 
+}
 
 function refetch_callback() {
        if (xmlhttp.readyState == 4) {
@@ -428,8 +433,7 @@ function quickMenuGo() {
        }
 
        if (opname == "Add new feed") {
-               var qafDialog = document.getElementById("qafDialog");
-               qafDialog.style.display = "block";
+               displayDlg("quickAddFeed");
        }
 }
 
@@ -459,6 +463,19 @@ function qafAdd() {
                link.value = "";
 
        }
+}
+
+function displayDlg(id) {
 
+       xmlhttp.open("GET", "backend.php?op=dlg&id=" +
+               param_escape(id), true);
+       xmlhttp.onreadystatechange=dialog_refresh_callback;
+       xmlhttp.send(null);
 
 }
+
+function closeDlg() {
+       var dlg = document.getElementById("userDlg");
+       dlg.style.display = "none";
+}
+
index cf11e564d51d568ad73c7f4acc33919de6e8abeb..6fc00c55615606c6c0e843ee2c18ef3223776688 100644 (file)
                        </td>
                </tr></table>
 
-               <div id="qafDialog">
-                       Feed URL: <input id="qafInput">
-                       <input class="button"
-                               type="submit" onclick="javascript:qafAdd()" value="Add feed">
-                       <input class="button"
-                               type="submit" onclick="javascript:cancelDialog(this)" value="Cancel">
-               </div>
+               <div id="userDlg">&nbsp;</div>
+
        </td>
 </tr>
 <? } ?>