From 3b0feb9b7f962e5745d26f8e115fd897e77a54ac Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Wed, 23 Nov 2005 15:25:42 +0100 Subject: [PATCH] misc prefs interface cleanups --- backend.php | 972 ++++++++++++++++++++++++++------------------------ functions.php | 4 +- 2 files changed, 498 insertions(+), 478 deletions(-) diff --git a/backend.php b/backend.php index 87b4708b2..ff3e26056 100644 --- a/backend.php +++ b/backend.php @@ -1134,217 +1134,221 @@ ttrss_feeds WHERE owner_uid = '".$_SESSION["uid"]."' ORDER by $feeds_sort,title"); - print "
PLACEHOLDER
"; + if (db_num_rows($result) != 0) { - print "

"; - print " - - - - "; - - if (get_pref($link, 'ENABLE_FEED_CATS')) { - print ""; - } - - print " - - - - "; - - $lnum = 0; - - while ($line = db_fetch_assoc($result)) { - - $class = ($lnum % 2) ? "even" : "odd"; - - $feed_id = $line["id"]; - - $edit_feed_id = $_GET["id"]; - - if ($subop == "edit" && $feed_id != $edit_feed_id) { - $class .= "Grayed"; + print "
PLACEHOLDER
"; + + print "

 Select - Title - Link - - Category - Update Interval - - Purge Days - - Last updated -
"; + print " + + + + "; + + if (get_pref($link, 'ENABLE_FEED_CATS')) { + print ""; } - - print ""; - - $icon_file = ICONS_DIR . "/$feed_id.ico"; - - if (file_exists($icon_file) && filesize($icon_file) > 0) { - $feed_icon = ""; - } else { - $feed_icon = " "; - } - print ""; - - $edit_title = htmlspecialchars(db_unescape_string($line["title"])); - $edit_link = htmlspecialchars(db_unescape_string($line["feed_url"])); - $edit_cat = htmlspecialchars(db_unescape_string($line["category"])); - - if (!$edit_cat) $edit_cat = "Uncategorized"; - - if (!$edit_feed_id || $subop != "edit") { - - print ""; - - print ""; - - print ""; - - if (get_pref($link, 'ENABLE_FEED_CATS')) { - print ""; - } - - if ($line["update_interval"] == "0") - $line["update_interval"] = "Default"; - - print ""; - - if ($line["purge_interval"] == "0") - $line["purge_interval"] = "Default"; - - if ($line["purge_interval"] < 0) - $line["purge_interval"] = "Disabled"; - - print ""; - - } else if ($feed_id != $edit_feed_id) { - - print ""; - - print ""; - print ""; - - if (get_pref($link, 'ENABLE_FEED_CATS')) { - print ""; - } - - if ($line["update_interval"] == "0") - $line["update_interval"] = "Default"; - - print ""; - - if ($line["purge_interval"] == "0") - $line["purge_interval"] = "Default"; - - if ($line["purge_interval"] < 0) - $line["purge_interval"] = "Disabled"; - - print ""; - - } else { - - print ""; - - print ""; - print ""; - - if (get_pref($link, 'ENABLE_FEED_CATS')) { - - print ""; - print ""; - - } - - print ""; - print ""; - - } - - if (!$line["last_updated"]) $line["last_updated"] = "Never"; - - print ""; - print ""; - - ++$lnum; - } - - if ($lnum == 0) { - print ""; - } - - print "
 Select + Title + Link + + Category
$feed_icon" . - $edit_title . "" . - $edit_link . "" . - $edit_cat . "" . - $line["update_interval"] . "" . - $line["purge_interval"] . "$edit_title$edit_link$edit_cat" . $line["update_interval"] . "" . $line["purge_interval"] . ""; - print "" . $line["last_updated"] . "
No feeds defined.
"; - - print "

"; - - if ($subop == "edit") { - print "Edit feed:  - - "; - } else { - print " - Selection:  - - - "; - - if (get_pref($link, 'ENABLE_PREFS_CATCHUP_UNCATCHUP')) { - print " - -  "; - } - print " - All feeds: - "; + + Update Interval + + + Purge Days + + + Last updated + + "; + + $lnum = 0; + + while ($line = db_fetch_assoc($result)) { + + $class = ($lnum % 2) ? "even" : "odd"; + + $feed_id = $line["id"]; + + $edit_feed_id = $_GET["id"]; + + if ($subop == "edit" && $feed_id != $edit_feed_id) { + $class .= "Grayed"; + } + + print ""; + + $icon_file = ICONS_DIR . "/$feed_id.ico"; + + if (file_exists($icon_file) && filesize($icon_file) > 0) { + $feed_icon = ""; + } else { + $feed_icon = " "; + } + print "$feed_icon"; + + $edit_title = htmlspecialchars(db_unescape_string($line["title"])); + $edit_link = htmlspecialchars(db_unescape_string($line["feed_url"])); + $edit_cat = htmlspecialchars(db_unescape_string($line["category"])); + + if (!$edit_cat) $edit_cat = "Uncategorized"; + + if (!$edit_feed_id || $subop != "edit") { + + print ""; + + print "" . + $edit_title . ""; + + print "" . + $edit_link . ""; + + if (get_pref($link, 'ENABLE_FEED_CATS')) { + print "" . + $edit_cat . ""; + } + + if ($line["update_interval"] == "0") + $line["update_interval"] = "Default"; + + print "" . + $line["update_interval"] . ""; + + if ($line["purge_interval"] == "0") + $line["purge_interval"] = "Default"; + + if ($line["purge_interval"] < 0) + $line["purge_interval"] = "Disabled"; + + print "" . + $line["purge_interval"] . ""; + + } else if ($feed_id != $edit_feed_id) { + + print ""; + + print "$edit_title"; + print "$edit_link"; + + if (get_pref($link, 'ENABLE_FEED_CATS')) { + print "$edit_cat"; + } + + if ($line["update_interval"] == "0") + $line["update_interval"] = "Default"; + + print "" . $line["update_interval"] . ""; + + if ($line["purge_interval"] == "0") + $line["purge_interval"] = "Default"; + + if ($line["purge_interval"] < 0) + $line["purge_interval"] = "Disabled"; + + print "" . $line["purge_interval"] . ""; + + } else { + + print ""; + + print ""; + print ""; + + if (get_pref($link, 'ENABLE_FEED_CATS')) { + + print ""; + print ""; + print ""; + + } + + print ""; + print ""; + + } + + if (!$line["last_updated"]) $line["last_updated"] = "Never"; + + print "" . $line["last_updated"] . ""; + + print ""; + + ++$lnum; + } + + print ""; + + print "

"; + + if ($subop == "edit") { + print "Edit feed:  + + "; + } else { + + print " + Selection:  + + + "; + + if (get_pref($link, 'ENABLE_PREFS_CATCHUP_UNCATCHUP')) { + print " + +  "; + } + + print " + All feeds: "; + } + } else { + + print "

No feeds defined.

"; + + } if (get_pref($link, 'ENABLE_FEED_CATS')) { + print "

Edit Categories

"; + // print "

Categories

"; print "
@@ -1355,81 +1359,84 @@ $result = db_query($link, "SELECT title,id FROM ttrss_feed_categories WHERE owner_uid = ".$_SESSION["uid"]." ORDER BY title"); + + if (db_num_rows($result) != 0) { - print "

"; - print " - - "; - - $lnum = 0; - - while ($line = db_fetch_assoc($result)) { - - $class = ($lnum % 2) ? "even" : "odd"; - - $cat_id = $line["id"]; - - $edit_cat_id = $_GET["id"]; - - if ($subop == "editCat" && $cat_id != $edit_cat_id) { - $class .= "Grayed"; - } - - print ""; - - $edit_title = htmlspecialchars(db_unescape_string($line["title"])); - - if (!$edit_cat_id || $subop != "editCat") { - - print ""; - - print ""; - - } else if ($cat_id != $edit_cat_id) { - - print ""; - - print ""; - - } else { - - print ""; - - print ""; - - } + print "

SelectTitle
" . - $edit_title . "$edit_title
"; + print " + + "; + + $lnum = 0; - print ""; + while ($line = db_fetch_assoc($result)) { + + $class = ($lnum % 2) ? "even" : "odd"; + + $cat_id = $line["id"]; + + $edit_cat_id = $_GET["id"]; + + if ($subop == "editCat" && $cat_id != $edit_cat_id) { + $class .= "Grayed"; + } + + print ""; + + $edit_title = htmlspecialchars(db_unescape_string($line["title"])); + + if (!$edit_cat_id || $subop != "editCat") { + + print ""; + + print ""; + + } else if ($cat_id != $edit_cat_id) { + + print ""; + + print ""; + + } else { + + print ""; + + print ""; + + } + + print ""; + + ++$lnum; + } - ++$lnum; - } + print "
SelectTitle
" . + $edit_title . "$edit_title
"; - if ($lnum == 0) { - print "No categories defined."; - } + print "

"; - print ""; - - print "

"; - - if ($subop == "editCat") { - print "Edit category:  + if ($subop == "editCat") { + print "Edit category:  + + "; + } else { + + print " + Selection:  + onclick=\"javascript:editSelectedFeedCat()\" value=\"Edit\"> "; - } else { + onclick=\"javascript:removeSelectedFeedCats()\" value=\"Remove\">"; - print " - Selection:  - - "; - } + } + + } else { + print "

No feed categories defined.

"; + } } print "

Import OPML

@@ -1551,134 +1558,142 @@ ttrss_filters.owner_uid = ".$_SESSION["uid"]." ORDER by reg_exp"); - print "

"; + if (db_num_rows($result) != 0) { - print " - - - "; + print "

SelectFilter expressionFeedMatchDescription
"; + + print " + + + "; - $lnum = 0; - - while ($line = db_fetch_assoc($result)) { - - $class = ($lnum % 2) ? "even" : "odd"; - - $filter_id = $line["id"]; - $edit_filter_id = $_GET["id"]; - - if ($subop == "edit" && $filter_id != $edit_filter_id) { - $class .= "Grayed"; - } - - print ""; - - $line["regexp"] = htmlspecialchars($line["reg_exp"]); - $line["description"] = htmlspecialchars($line["description"]); - - if (!$line["feed_title"]) $line["feed_title"] = "All feeds"; - - if (!$edit_filter_id || $subop != "edit") { - - if (!$line["description"]) $line["description"] = "[No description]"; - - print ""; - - print ""; - - print ""; - - print ""; - - print ""; - - } else if ($filter_id != $edit_filter_id) { - - if (!$line["description"]) $line["description"] = "[No description]"; - - print ""; - - print ""; - print ""; - print ""; - print ""; - - } else { - - print ""; - - print ""; - - print ""; - - print ""; - - print ""; - - print ""; - } + $lnum = 0; - print ""; - - ++$lnum; - } - - if ($lnum == 0) { - print ""; - } - - print "
SelectFilter expressionFeedMatchDescription
" . - $line["reg_exp"] . "" . - $line["feed_title"] . "" . - $line["filter_type_descr"] . "" . - $line["description"] . "".$line["reg_exp"]."".$line["feed_title"]."".$line["filter_type_descr"]."".$line["description"].""; - - print ""; - print_select("iedit_match", $line["filter_type_descr"], $filter_types); - print "
No filters defined.
"; - - print "

"; - - if ($subop == "edit") { - print "Edit feed: + while ($line = db_fetch_assoc($result)) { + + $class = ($lnum % 2) ? "even" : "odd"; + + $filter_id = $line["id"]; + $edit_filter_id = $_GET["id"]; + + if ($subop == "edit" && $filter_id != $edit_filter_id) { + $class .= "Grayed"; + } + + print ""; + + $line["regexp"] = htmlspecialchars($line["reg_exp"]); + $line["description"] = htmlspecialchars($line["description"]); + + if (!$line["feed_title"]) $line["feed_title"] = "All feeds"; + + if (!$edit_filter_id || $subop != "edit") { + + if (!$line["description"]) $line["description"] = "[No description]"; + + print ""; + + print "" . + $line["reg_exp"] . ""; + + print "" . + $line["feed_title"] . ""; + + print "" . + $line["filter_type_descr"] . ""; + + print "" . + $line["description"] . ""; + + } else if ($filter_id != $edit_filter_id) { + + if (!$line["description"]) $line["description"] = "[No description]"; + + print ""; + + print "".$line["reg_exp"].""; + print "".$line["feed_title"].""; + print "".$line["filter_type_descr"].""; + print "".$line["description"].""; + + } else { + + print ""; + + print ""; + + print ""; + + print ""; + + print ""; + print_select("iedit_match", $line["filter_type_descr"], $filter_types); + print ""; + + print ""; + + print ""; + } + + print ""; + + ++$lnum; + } + + if ($lnum == 0) { + print "No filters defined."; + } + + print ""; + + print "

"; + + if ($subop == "edit") { + print "Edit feed: + + "; + + } else { + + print " + Selection: + onclick=\"javascript:editSelectedFilter()\" value=\"Edit\"> "; - + onclick=\"javascript:removeSelectedFilters()\" value=\"Remove\">"; + } + } else { - print " - Selection: - - "; + print "

No filters defined.

"; + } } @@ -1740,96 +1755,101 @@ owner_uid = ".$_SESSION["uid"]." ORDER by description"); - print "

"; + if (db_num_rows($result) != 0) { - print " - - "; - - $lnum = 0; - - while ($line = db_fetch_assoc($result)) { - - $class = ($lnum % 2) ? "even" : "odd"; - - $label_id = $line["id"]; - $edit_label_id = $_GET["id"]; - - if ($subop == "edit" && $label_id != $edit_label_id) { - $class .= "Grayed"; - } - - print ""; - - $line["sql_exp"] = htmlspecialchars($line["sql_exp"]); - $line["description"] = htmlspecialchars($line["description"]); - - if (!$edit_label_id || $subop != "edit") { - - if (!$line["description"]) $line["description"] = "[No caption]"; - - print ""; - - print ""; - - print ""; - - } else if ($label_id != $edit_label_id) { - - if (!$line["description"]) $line["description"] = "[No description]"; - - print ""; - - print ""; - print ""; - - } else { - - print ""; - - print ""; - - print ""; - - } - + print "

SelectSQL expression - (?) - Caption
" . - $line["sql_exp"] . "" . - $line["description"] . "".$line["sql_exp"]."".$line["description"]."
"; + + print " + + "; - print ""; - - ++$lnum; - } - - if ($lnum == 0) { - print ""; - } - - print "
SelectSQL expression + (?) + Caption
No labels defined.
"; - - print "

"; - - if ($subop == "edit") { - print "Edit label: - - "; + $lnum = 0; + + while ($line = db_fetch_assoc($result)) { + + $class = ($lnum % 2) ? "even" : "odd"; + + $label_id = $line["id"]; + $edit_label_id = $_GET["id"]; + + if ($subop == "edit" && $label_id != $edit_label_id) { + $class .= "Grayed"; + } + + print ""; + + $line["sql_exp"] = htmlspecialchars($line["sql_exp"]); + $line["description"] = htmlspecialchars($line["description"]); + + if (!$edit_label_id || $subop != "edit") { + + if (!$line["description"]) $line["description"] = "[No caption]"; + + print ""; + + print "" . + $line["sql_exp"] . ""; + + print "" . + $line["description"] . ""; + + } else if ($label_id != $edit_label_id) { + + if (!$line["description"]) $line["description"] = "[No description]"; + + print ""; + + print "".$line["sql_exp"].""; + print "".$line["description"].""; + + } else { + + print ""; + + print ""; + + print ""; + + } + + print ""; + + ++$lnum; + } + + if ($lnum == 0) { + print "No labels defined."; + } + + print ""; + + print "

"; + + if ($subop == "edit") { + print "Edit label: + + "; + + } else { + + print " + Selection: + + "; + } } else { - - print " - Selection: - - "; + print "

No labels defined.

"; } } diff --git a/functions.php b/functions.php index 4ba7da748..7ca9bb81c 100644 --- a/functions.php +++ b/functions.php @@ -649,8 +649,8 @@ db_query($link, "insert into ttrss_feeds (owner_uid,title,feed_url) values ('$uid', 'Tiny Tiny RSS Dev. Feed', 'http://bah.spb.su/darcsweb/darcsweb.cgi?r=tt-rss;a=rss')"); - - } + + } function logout_user() { session_destroy();