inline feed editor, yay!

This commit is contained in:
Andrew Dolgov 2005-08-26 07:56:00 +01:00
parent e1123aee35
commit 603c27f828
4 changed files with 69 additions and 20 deletions

View File

@ -433,7 +433,7 @@
$subop = $_GET["subop"];
if ($subop == "edit") {
/* if ($subop == "old_edit") {
$feed_id = $_GET["id"];
@ -460,7 +460,7 @@
<a class=\"button\" href=\"javascript:addFeed()\">Add feed</a></td></tr>
</table>";
}
} */
if ($subop == "editSave") {
$feed_title = pg_escape_string($_GET["t"]);
@ -517,7 +517,8 @@
print "<p><table width=\"100%\" class=\"prefFeedList\" id=\"prefFeedList\">";
print "<tr class=\"title\">
<td>&nbsp;</td><td>Select</td><td>Title</td><td>Link</td><td>Last Updated</td></tr>";
<td>&nbsp;</td><td>Select</td><td width=\"40%\">Title</td>
<td width=\"40%\">Link</td><td>Last Updated</td></tr>";
$lnum = 0;
@ -526,7 +527,9 @@
$class = ($lnum % 2) ? "even" : "odd";
$feed_id = $line["id"];
$edit_feed_id = $_GET["id"];
print "<tr class=\"$class\" id=\"FEEDR-$feed_id\">";
$icon_file = ICONS_DIR . "/$feed_id.ico";
@ -539,15 +542,26 @@
}
print "<td align='center'>$feed_icon</td>";
print "<td><input onclick='toggleSelectRow(this);'
if ($feed_id != $edit_feed_id || $subop != "edit" ) {
print "<td><input onclick='toggleSelectRow(this);'
type=\"checkbox\" id=\"FRCHK-".$line["id"]."\"></td>";
print "<td><a href=\"javascript:editFeed($feed_id);\">" .
$line["title"] . "</td>";
print "<td><a href=\"javascript:editFeed($feed_id);\">" .
$line["feed_url"] . "</td>";
print "<td><a href=\"javascript:editFeed($feed_id);\">" .
$line["title"] . "</td>";
print "<td><a href=\"javascript:editFeed($feed_id);\">" .
$line["feed_url"] . "</td>";
} else {
print "<td><input disabled=\"true\" type=\"checkbox\" id=\"FRCHK-".$line["id"]."\"></td>";
print "<td><input id=\"iedit_title\" value=\"".$line["title"]."\"></td>";
print "<td><input id=\"iedit_link\" value=\"".$line["feed_url"]."\"></td>";
}
print "<td>" . $line["last_updated"] . "</td>";
print "</tr>";
++$lnum;
@ -555,6 +569,31 @@
print "</table>";
print "<p>";
if ($subop == "edit") {
print "Edit feed:&nbsp;
<a class=\"button\" href=\"javascript:feedEditCancel()\">Cancel</a>&nbsp;
<a class=\"button\" href=\"javascript:feedEditSave()\">Save</a>";
} else {
// <a class=\"button\"
// href=\"javascript:editSelectedFeed()\">Edit</a>&nbsp;
// <a class=\"button\"
// href=\"javascript:updateFeedList()\">Refresh</a>";
print "
Selection:&nbsp;
<a class=\"buttonWarn\"
href=\"javascript:removeSelectedFeeds()\">Remove</a>&nbsp;
<a class=\"button\"
href=\"javascript:readSelectedFeeds()\">Mark as read</a>&nbsp;
<a class=\"button\"
href=\"javascript:unreadSelectedFeeds()\">Mark as unread</a>";
}
}
pg_close($link);

View File

@ -236,17 +236,19 @@ function feedEditCancel() {
}
function feedEditSave(feed) {
function feedEditSave() {
var feed = active_feed;
if (!xmlhttp_ready(xmlhttp)) {
printLockingError();
return
}
notify("Saving feed.");
var link = document.getElementById("iedit_link").value;
var title = document.getElementById("iedit_title").value;
var link = document.getElementById("fedit_link").value;
var title = document.getElementById("fedit_title").value;
// notify("Saving feed.");
if (link.length == 0) {
notify("Feed link cannot be blank.");
@ -258,6 +260,8 @@ function feedEditSave(feed) {
return;
}
active_feed = false;
xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=editSave&id=" +
feed + "&l=" + param_escape(link) + "&t=" + param_escape(title) ,true);
xmlhttp.onreadystatechange=feedlist_callback;

View File

@ -30,18 +30,17 @@
<td id="prefContent" class="prefContent" valign="top" colspan="2">
<h2>Feed Configuration</h2>
<!--
<div id="piggie">&nbsp;</div>
<table class="prefAddFeed">
<td><input id="fadd_link"></td>
<td colspan="4" align="right">
<a class="button" href="javascript:addFeed()">Add feed</a></td></tr>
</table>
-->
<div id="piggie">&nbsp;</div>
<div id="feeds">&nbsp;</div>
<p>Selection:&nbsp;
<!-- <p>Selection:&nbsp;
<a class="button"
href="javascript:editSelectedFeed()">Edit</a>&nbsp;
<a class="buttonWarn"
@ -51,7 +50,7 @@
<a class="button"
href="javascript:unreadSelectedFeeds()">Mark as unread</a>&nbsp;
<a class="button"
href="javascript:updateFeedList()">Refresh</a>&nbsp;
href="javascript:updateFeedList()">Refresh</a>&nbsp; -->
<hr>

View File

@ -356,3 +356,10 @@ img.feedIcon {
margin : 3px;
border : 1px solid #c0c0c0;
}
#iedit_title, #iedit_link {
width : 100%;
padding-left : 2px;
}