some initial feed-linking work

This commit is contained in:
Andrew Dolgov 2005-12-28 20:17:26 +01:00
parent de99f5005d
commit 1da7e457d8
3 changed files with 58 additions and 16 deletions

View File

@ -1536,6 +1536,34 @@
print "<td><input id=\"iedit_updintl\" print "<td><input id=\"iedit_updintl\"
value=\"$update_interval\"></td></tr>"; value=\"$update_interval\"></td></tr>";
$row_class = toggleEvenOdd($row_class);
print "<tr class='$row_class'><td>Link to:</td>";
$parent_feed = db_fetch_result($result, 0, "parent_feed");
print "<select id=\"iedit_parent_feed\">";
print "<option id=\"0\">None</option>";
$tmp_result = db_query($link, "SELECT id,title FROM ttrss_feeds
WHERE owner_uid = ".$_SESSION["uid"]." ORDER BY title");
if (db_num_rows($tmp_result) > 0) {
print "<option disabled>--------</option>";
}
while ($tmp_line = db_fetch_assoc($tmp_result)) {
if ($tmp_line["id"] == $parent_feed) {
$is_selected = "selected";
} else {
$is_selected = "";
}
printf("<option $is_selected id='%d'>%s</option>",
$tmp_line["id"], $tmp_line["title"]);
}
print "</select></td>";
print "</td></tr>";
$purge_interval = db_fetch_result($result, 0, "purge_interval"); $purge_interval = db_fetch_result($result, 0, "purge_interval");
$row_class = toggleEvenOdd($row_class); $row_class = toggleEvenOdd($row_class);
@ -1579,6 +1607,7 @@
$cat_id = db_escape_string($_POST["catid"]); $cat_id = db_escape_string($_POST["catid"]);
$auth_login = db_escape_string($_POST["login"]); $auth_login = db_escape_string($_POST["login"]);
$auth_pass = db_escape_string($_POST["pass"]); $auth_pass = db_escape_string($_POST["pass"]);
$parent_feed = db_escape_string($_POST["pfeed"]);
if (strtoupper($upd_intl) == "DEFAULT") if (strtoupper($upd_intl) == "DEFAULT")
$upd_intl = 0; $upd_intl = 0;
@ -1598,8 +1627,15 @@
$category_qpart = 'cat_id = NULL'; $category_qpart = 'cat_id = NULL';
} }
if ($parent_feed != 0) {
$parent_qpart = "parent_feed = '$parent_feed'";
} else {
$parent_qpart = 'parent_feed = NULL';
}
$result = db_query($link, "UPDATE ttrss_feeds SET $result = db_query($link, "UPDATE ttrss_feeds SET
$category_qpart, $category_qpart,
$parent_qpart,
title = '$feed_title', feed_url = '$feed_link', title = '$feed_title', feed_url = '$feed_link',
update_interval = '$upd_intl', update_interval = '$upd_intl',
purge_interval = '$purge_intl', purge_interval = '$purge_intl',
@ -1836,8 +1872,11 @@
$result = db_query($link, "SELECT $result = db_query($link, "SELECT
id,title,feed_url,substring(last_updated,1,16) as last_updated, id,title,feed_url,substring(last_updated,1,16) as last_updated,
update_interval,purge_interval,cat_id, update_interval,purge_interval,cat_id,
parent_feed AS parent_feed_id,
(SELECT title FROM ttrss_feed_categories (SELECT title FROM ttrss_feed_categories
WHERE id = cat_id) AS category WHERE id = cat_id) AS category,
(SELECT title FROM ttrss_feeds
WHERE id = parent_feed_id) AS parent_title
FROM FROM
ttrss_feeds ttrss_feeds
WHERE WHERE
@ -1923,8 +1962,14 @@
$edit_title = truncate_string($edit_title, 40); $edit_title = truncate_string($edit_title, 40);
$edit_link = truncate_string($edit_link, 60); $edit_link = truncate_string($edit_link, 60);
$parent_title = $line["parent_title"];
if ($parent_title) {
$parent_title = "<span class='groupPrompt'>(linked to
$parent_title)</span>";
}
print "<td><a href=\"javascript:editFeed($feed_id);\">" . print "<td><a href=\"javascript:editFeed($feed_id);\">" .
"$feed_icon $edit_title" . "</a></td>"; "$feed_icon $edit_title $parent_title" . "</a></td>";
print "<td><a href=\"javascript:editFeed($feed_id);\">" . print "<td><a href=\"javascript:editFeed($feed_id);\">" .
$edit_link . "</a></td>"; $edit_link . "</a></td>";

View File

@ -677,18 +677,9 @@ function feedEditSave() {
var fcat = document.getElementById("iedit_fcat"); var fcat = document.getElementById("iedit_fcat");
var fcat_id = fcat[fcat.selectedIndex].id; var fcat_id = fcat[fcat.selectedIndex].id;
// notify("Saving feed."); var pfeed = document.getElementById("iedit_parent_feed");
var parent_feed_id = pfeed[pfeed.selectedIndex].id;
/* if (upd_intl < 0) {
notify("Update interval must be &gt;= 0 (0 = default)");
return;
}
if (purge_intl < 0) {
notify("Purge days must be &gt;= 0 (0 = default)");
return;
} */
if (link.length == 0) { if (link.length == 0) {
notify("Feed link cannot be blank."); notify("Feed link cannot be blank.");
@ -711,7 +702,7 @@ function feedEditSave() {
feed + "&l=" + param_escape(link) + "&t=" + param_escape(title) + feed + "&l=" + param_escape(link) + "&t=" + param_escape(title) +
"&ui=" + param_escape(upd_intl) + "&pi=" + param_escape(purge_intl) + "&ui=" + param_escape(upd_intl) + "&pi=" + param_escape(purge_intl) +
"&catid=" + param_escape(fcat_id) + "&login=" + param_escape(auth_login) + "&catid=" + param_escape(fcat_id) + "&login=" + param_escape(auth_login) +
"&pass=" + param_escape(auth_pass); "&pfeed=" + param_escape(parent_feed_id) + "&pass=" + param_escape(auth_pass);
xmlhttp.open("POST", "backend.php", true); xmlhttp.open("POST", "backend.php", true);
xmlhttp.onreadystatechange=feedlist_callback; xmlhttp.onreadystatechange=feedlist_callback;

View File

@ -320,7 +320,8 @@ a:hover {
#iedit_title, #iedit_link, #iedit_regexp, #iedit_descr, #iedit_expr, #iedit_updintl, #iedit_title, #iedit_link, #iedit_regexp, #iedit_descr, #iedit_expr, #iedit_updintl,
#iedit_purgintl, #iedit_ulogin, #iedit_ulevel, #iedit_match, #iedit_feed, #iedit_purgintl, #iedit_ulogin, #iedit_ulevel, #iedit_match, #iedit_feed,
#iedit_fcat, #iedit_filter_action, #iedit_login, #iedit_pass, #iedit_email { #iedit_fcat, #iedit_filter_action, #iedit_login, #iedit_pass, #iedit_email,
#iedit_parent_feed {
width : 100%; width : 100%;
padding-left : 2px; padding-left : 2px;
} }
@ -910,3 +911,8 @@ img.closeButton {
border-width : 0px; border-width : 0px;
float : right; float : right;
} }
span.groupPrompt {
font-size : x-small;
color : #505050;
}