summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2005-12-28 20:17:26 +0100
committerAndrew Dolgov <[email protected]>2005-12-28 20:17:26 +0100
commit1da7e457d84e97a7b961f115289481febace0cc5 (patch)
treef4efeacc0bc3a237df94e90b54b3434820032eb4
parentde99f5005d48a668392ff4bda877854134e0d2f1 (diff)
some initial feed-linking work
-rw-r--r--backend.php49
-rw-r--r--prefs.js17
-rw-r--r--tt-rss.css8
3 files changed, 58 insertions, 16 deletions
diff --git a/backend.php b/backend.php
index 2b527cc17..e929e59a4 100644
--- a/backend.php
+++ b/backend.php
@@ -1536,6 +1536,34 @@
print "<td><input id=\"iedit_updintl\"
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");
$row_class = toggleEvenOdd($row_class);
@@ -1579,6 +1607,7 @@
$cat_id = db_escape_string($_POST["catid"]);
$auth_login = db_escape_string($_POST["login"]);
$auth_pass = db_escape_string($_POST["pass"]);
+ $parent_feed = db_escape_string($_POST["pfeed"]);
if (strtoupper($upd_intl) == "DEFAULT")
$upd_intl = 0;
@@ -1598,8 +1627,15 @@
$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
$category_qpart,
+ $parent_qpart,
title = '$feed_title', feed_url = '$feed_link',
update_interval = '$upd_intl',
purge_interval = '$purge_intl',
@@ -1836,8 +1872,11 @@
$result = db_query($link, "SELECT
id,title,feed_url,substring(last_updated,1,16) as last_updated,
update_interval,purge_interval,cat_id,
+ parent_feed AS parent_feed_id,
(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
ttrss_feeds
WHERE
@@ -1923,8 +1962,14 @@
$edit_title = truncate_string($edit_title, 40);
$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);\">" .
- "$feed_icon $edit_title" . "</a></td>";
+ "$feed_icon $edit_title $parent_title" . "</a></td>";
print "<td><a href=\"javascript:editFeed($feed_id);\">" .
$edit_link . "</a></td>";
diff --git a/prefs.js b/prefs.js
index 89ad81d38..82d897c97 100644
--- a/prefs.js
+++ b/prefs.js
@@ -677,18 +677,9 @@ function feedEditSave() {
var fcat = document.getElementById("iedit_fcat");
var fcat_id = fcat[fcat.selectedIndex].id;
-
- // notify("Saving feed.");
-
- /* 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;
- } */
+
+ var pfeed = document.getElementById("iedit_parent_feed");
+ var parent_feed_id = pfeed[pfeed.selectedIndex].id;
if (link.length == 0) {
notify("Feed link cannot be blank.");
@@ -711,7 +702,7 @@ function feedEditSave() {
feed + "&l=" + param_escape(link) + "&t=" + param_escape(title) +
"&ui=" + param_escape(upd_intl) + "&pi=" + param_escape(purge_intl) +
"&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.onreadystatechange=feedlist_callback;
diff --git a/tt-rss.css b/tt-rss.css
index fd50263bc..bffbe0e23 100644
--- a/tt-rss.css
+++ b/tt-rss.css
@@ -320,7 +320,8 @@ a:hover {
#iedit_title, #iedit_link, #iedit_regexp, #iedit_descr, #iedit_expr, #iedit_updintl,
#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%;
padding-left : 2px;
}
@@ -910,3 +911,8 @@ img.closeButton {
border-width : 0px;
float : right;
}
+
+span.groupPrompt {
+ font-size : x-small;
+ color : #505050;
+}