generic popup user dialog mechanism

This commit is contained in:
Andrew Dolgov 2005-10-28 06:59:29 +01:00
parent e2f8f7b47a
commit f84a97a31b
5 changed files with 39 additions and 19 deletions

View File

@ -1315,6 +1315,19 @@
} }
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); db_close($link);
?> ?>

View File

@ -396,8 +396,3 @@ function popupHelp(tid) {
} }
} }
function cancelDialog(sender) {
sender.offsetParent.style.display = "none";
}

View File

@ -388,7 +388,7 @@ pre {
background : #f0f0f0; background : #f0f0f0;
} }
#qafDialog { #userDlg {
left : 400px; left : 400px;
top : 18px; top : 18px;
background : #fffff0; background : #fffff0;

View File

@ -49,15 +49,20 @@ function toggleTags() {
} }
function qaf_add_callback() { function qaf_add_callback() {
var container = document.getElementById('feeds');
if (xmlhttp.readyState == 4) { if (xmlhttp.readyState == 4) {
updateFeedList(false, false); updateFeedList(false, false);
var qafDialog = document.getElementById("qafDialog"); closeDlg();
qafDialog.style.display = "none";
} }
} }
function dialog_refresh_callback() {
if (xmlhttp.readyState == 4) {
var dlg = document.getElementById("userDlg");
dlg.innerHTML = xmlhttp.responseText;
dlg.style.display = "block";
}
}
function refetch_callback() { function refetch_callback() {
if (xmlhttp.readyState == 4) { if (xmlhttp.readyState == 4) {
@ -428,8 +433,7 @@ function quickMenuGo() {
} }
if (opname == "Add new feed") { if (opname == "Add new feed") {
var qafDialog = document.getElementById("qafDialog"); displayDlg("quickAddFeed");
qafDialog.style.display = "block";
} }
} }
@ -459,6 +463,19 @@ function qafAdd() {
link.value = ""; 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";
}

View File

@ -44,13 +44,8 @@
</td> </td>
</tr></table> </tr></table>
<div id="qafDialog"> <div id="userDlg">&nbsp;</div>
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>
</td> </td>
</tr> </tr>
<? } ?> <? } ?>