inline feed editor, yay!

master
Andrew Dolgov 20 years ago
parent e1123aee35
commit 603c27f828

@ -433,7 +433,7 @@
$subop = $_GET["subop"]; $subop = $_GET["subop"];
if ($subop == "edit") { /* if ($subop == "old_edit") {
$feed_id = $_GET["id"]; $feed_id = $_GET["id"];
@ -460,7 +460,7 @@
<a class=\"button\" href=\"javascript:addFeed()\">Add feed</a></td></tr> <a class=\"button\" href=\"javascript:addFeed()\">Add feed</a></td></tr>
</table>"; </table>";
} } */
if ($subop == "editSave") { if ($subop == "editSave") {
$feed_title = pg_escape_string($_GET["t"]); $feed_title = pg_escape_string($_GET["t"]);
@ -517,7 +517,8 @@
print "<p><table width=\"100%\" class=\"prefFeedList\" id=\"prefFeedList\">"; print "<p><table width=\"100%\" class=\"prefFeedList\" id=\"prefFeedList\">";
print "<tr class=\"title\"> 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; $lnum = 0;
@ -527,6 +528,8 @@
$feed_id = $line["id"]; $feed_id = $line["id"];
$edit_feed_id = $_GET["id"];
print "<tr class=\"$class\" id=\"FEEDR-$feed_id\">"; print "<tr class=\"$class\" id=\"FEEDR-$feed_id\">";
$icon_file = ICONS_DIR . "/$feed_id.ico"; $icon_file = ICONS_DIR . "/$feed_id.ico";
@ -539,6 +542,8 @@
} }
print "<td align='center'>$feed_icon</td>"; print "<td align='center'>$feed_icon</td>";
if ($feed_id != $edit_feed_id || $subop != "edit" ) {
print "<td><input onclick='toggleSelectRow(this);' print "<td><input onclick='toggleSelectRow(this);'
type=\"checkbox\" id=\"FRCHK-".$line["id"]."\"></td>"; type=\"checkbox\" id=\"FRCHK-".$line["id"]."\"></td>";
@ -546,8 +551,17 @@
$line["title"] . "</td>"; $line["title"] . "</td>";
print "<td><a href=\"javascript:editFeed($feed_id);\">" . print "<td><a href=\"javascript:editFeed($feed_id);\">" .
$line["feed_url"] . "</td>"; $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 "<td>" . $line["last_updated"] . "</td>";
print "</tr>"; print "</tr>";
++$lnum; ++$lnum;
@ -555,6 +569,31 @@
print "</table>"; 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); pg_close($link);

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

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

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

Loading…
Cancel
Save