From f84a97a31bd588bcf70fc71dbed27aca46d60b66 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Fri, 28 Oct 2005 06:59:29 +0100 Subject: [PATCH] generic popup user dialog mechanism --- backend.php | 13 +++++++++++++ functions.js | 5 ----- tt-rss.css | 2 +- tt-rss.js | 29 +++++++++++++++++++++++------ tt-rss.php | 9 ++------- 5 files changed, 39 insertions(+), 19 deletions(-) diff --git a/backend.php b/backend.php index 378b645f..6937a9af 100644 --- a/backend.php +++ b/backend.php @@ -1315,6 +1315,19 @@ } + if ($op == "dlg") { + $id = $_GET["id"]; + + if ($id == "quickAddFeed") { + print "Feed URL: + + "; + } + } + db_close($link); ?> diff --git a/functions.js b/functions.js index fe77163c..baee8955 100644 --- a/functions.js +++ b/functions.js @@ -396,8 +396,3 @@ function popupHelp(tid) { } } -function cancelDialog(sender) { - - sender.offsetParent.style.display = "none"; - -} diff --git a/tt-rss.css b/tt-rss.css index d72ccf94..b2b5dc2f 100644 --- a/tt-rss.css +++ b/tt-rss.css @@ -388,7 +388,7 @@ pre { background : #f0f0f0; } -#qafDialog { +#userDlg { left : 400px; top : 18px; background : #fffff0; diff --git a/tt-rss.js b/tt-rss.js index 664e5c8a..c49a52c1 100644 --- 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"; +} + diff --git a/tt-rss.php b/tt-rss.php index cf11e564..6fc00c55 100644 --- a/tt-rss.php +++ b/tt-rss.php @@ -44,13 +44,8 @@ -
- Feed URL: - - -
+
 
+ -- 2.39.5