more mobile prototyping
This commit is contained in:
parent
a9cb1f8344
commit
2f4685371a
|
@ -271,4 +271,346 @@
|
|||
|
||||
}
|
||||
|
||||
function render_headlines($link, $cat_view = false) {
|
||||
|
||||
$feed = db_escape_string($_GET["id"]);
|
||||
$limit = db_escape_string($_GET["limit"]);
|
||||
$view_mode = db_escape_string($_GET["viewmode"]);
|
||||
|
||||
if (!$view_mode) $view_mode = "Adaptive";
|
||||
if (!$limit) $limit = 30;
|
||||
|
||||
$result = db_query($link, "SELECT rtl_content FROM ttrss_feeds
|
||||
WHERE id = '$feed' AND owner_uid = " . $_SESSION["uid"]);
|
||||
|
||||
if (db_num_rows($result) == 1) {
|
||||
$rtl_content = sql_bool_to_bool(db_fetch_result($result, 0, "rtl_content"));
|
||||
} else {
|
||||
$rtl_content = false;
|
||||
}
|
||||
|
||||
if ($rtl_content) {
|
||||
$rtl_tag = "dir=\"RTL\"";
|
||||
} else {
|
||||
$rtl_tag = "";
|
||||
}
|
||||
|
||||
print "<div id=\"headlines\" $rtl_tag>";
|
||||
|
||||
if ($subop == "ForceUpdate" && sprintf("%d", $feed) > 0) {
|
||||
update_generic_feed($link, $feed, $cat_view);
|
||||
}
|
||||
|
||||
if ($subop == "MarkAllRead") {
|
||||
catchup_feed($link, $feed, $cat_view);
|
||||
}
|
||||
|
||||
$search = db_escape_string($_GET["search"]);
|
||||
$search_mode = db_escape_string($_GET["smode"]);
|
||||
|
||||
if ($search) {
|
||||
$search_query_part = "(upper(ttrss_entries.title) LIKE upper('%$search%')
|
||||
OR ttrss_entries.content LIKE '%$search%') AND";
|
||||
} else {
|
||||
$search_query_part = "";
|
||||
}
|
||||
|
||||
$view_query_part = "";
|
||||
|
||||
if ($view_mode == "Adaptive") {
|
||||
if ($search) {
|
||||
$view_query_part = " ";
|
||||
} else if ($feed != -1) {
|
||||
$unread = getFeedUnread($link, $feed);
|
||||
if ($unread > 0) {
|
||||
$view_query_part = " unread = true AND ";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($view_mode == "Starred") {
|
||||
$view_query_part = " marked = true AND ";
|
||||
}
|
||||
|
||||
if ($view_mode == "Unread") {
|
||||
$view_query_part = " unread = true AND ";
|
||||
}
|
||||
|
||||
if ($limit && $limit != "All") {
|
||||
$limit_query_part = "LIMIT " . $limit;
|
||||
}
|
||||
|
||||
$vfeed_query_part = "";
|
||||
|
||||
// override query strategy and enable feed display when searching globally
|
||||
if ($search && $search_mode == "All feeds") {
|
||||
$query_strategy_part = "ttrss_entries.id > 0";
|
||||
$vfeed_query_part = "ttrss_feeds.title AS feed_title,";
|
||||
} else if (preg_match("/^-?[0-9][0-9]*$/", $feed) == false) {
|
||||
$query_strategy_part = "ttrss_entries.id > 0";
|
||||
$vfeed_query_part = "(SELECT title FROM ttrss_feeds WHERE
|
||||
id = feed_id) as feed_title,";
|
||||
} else if ($feed >= 0 && $search && $search_mode == "This category") {
|
||||
|
||||
$vfeed_query_part = "ttrss_feeds.title AS feed_title,";
|
||||
|
||||
$tmp_result = db_query($link, "SELECT id
|
||||
FROM ttrss_feeds WHERE cat_id =
|
||||
(SELECT cat_id FROM ttrss_feeds WHERE id = '$feed') AND id != '$feed'");
|
||||
|
||||
$cat_siblings = array();
|
||||
|
||||
if (db_num_rows($tmp_result) > 0) {
|
||||
while ($p = db_fetch_assoc($tmp_result)) {
|
||||
array_push($cat_siblings, "feed_id = " . $p["id"]);
|
||||
}
|
||||
|
||||
$query_strategy_part = sprintf("(feed_id = %d OR %s)",
|
||||
$feed, implode(" OR ", $cat_siblings));
|
||||
|
||||
} else {
|
||||
$query_strategy_part = "ttrss_entries.id > 0";
|
||||
}
|
||||
|
||||
} else if ($feed >= 0) {
|
||||
|
||||
if ($cat_view) {
|
||||
|
||||
if ($feed > 0) {
|
||||
$query_strategy_part = "cat_id = '$feed'";
|
||||
} else {
|
||||
$query_strategy_part = "cat_id IS NULL";
|
||||
}
|
||||
|
||||
$vfeed_query_part = "ttrss_feeds.title AS feed_title,";
|
||||
|
||||
} else {
|
||||
$tmp_result = db_query($link, "SELECT id
|
||||
FROM ttrss_feeds WHERE parent_feed = '$feed'
|
||||
ORDER BY cat_id,title");
|
||||
|
||||
$parent_ids = array();
|
||||
|
||||
if (db_num_rows($tmp_result) > 0) {
|
||||
while ($p = db_fetch_assoc($tmp_result)) {
|
||||
array_push($parent_ids, "feed_id = " . $p["id"]);
|
||||
}
|
||||
|
||||
$query_strategy_part = sprintf("(feed_id = %d OR %s)",
|
||||
$feed, implode(" OR ", $parent_ids));
|
||||
|
||||
$vfeed_query_part = "ttrss_feeds.title AS feed_title,";
|
||||
} else {
|
||||
$query_strategy_part = "feed_id = '$feed'";
|
||||
}
|
||||
}
|
||||
} else if ($feed == -1) { // starred virtual feed
|
||||
$query_strategy_part = "marked = true";
|
||||
$vfeed_query_part = "ttrss_feeds.title AS feed_title,";
|
||||
} else if ($feed <= -10) { // labels
|
||||
$label_id = -$feed - 11;
|
||||
|
||||
$tmp_result = db_query($link, "SELECT sql_exp FROM ttrss_labels
|
||||
WHERE id = '$label_id'");
|
||||
|
||||
$query_strategy_part = db_fetch_result($tmp_result, 0, "sql_exp");
|
||||
|
||||
$vfeed_query_part = "ttrss_feeds.title AS feed_title,";
|
||||
} else {
|
||||
$query_strategy_part = "id > 0"; // dumb
|
||||
}
|
||||
|
||||
$order_by = "updated DESC";
|
||||
|
||||
// if ($feed < -10) {
|
||||
// $order_by = "feed_id,updated DESC";
|
||||
// }
|
||||
|
||||
$feed_title = "";
|
||||
|
||||
if ($search && $search_mode == "All feeds") {
|
||||
$feed_title = "Global search results ($search)";
|
||||
} else if ($search && preg_match('/^-?[0-9][0-9]*$/', $feed) == false) {
|
||||
$feed_title = "Feed search results ($search, $feed)";
|
||||
} else if (preg_match('/^-?[0-9][0-9]*$/', $feed) == false) {
|
||||
$feed_title = $feed;
|
||||
} else if (preg_match('/^-?[0-9][0-9]*$/', $feed) != false && $feed >= 0) {
|
||||
|
||||
if ($cat_view) {
|
||||
|
||||
if ($feed != 0) {
|
||||
$result = db_query($link, "SELECT title FROM ttrss_feed_categories
|
||||
WHERE id = '$feed' AND owner_uid = " . $_SESSION["uid"]);
|
||||
$feed_title = db_fetch_result($result, 0, "title");
|
||||
} else {
|
||||
$feed_title = "Uncategorized";
|
||||
}
|
||||
} else {
|
||||
|
||||
$result = db_query($link, "SELECT title,site_url,last_error FROM ttrss_feeds
|
||||
WHERE id = '$feed' AND owner_uid = " . $_SESSION["uid"]);
|
||||
|
||||
$feed_title = db_fetch_result($result, 0, "title");
|
||||
$feed_site_url = db_fetch_result($result, 0, "site_url");
|
||||
$last_error = db_fetch_result($result, 0, "last_error");
|
||||
|
||||
}
|
||||
|
||||
} else if ($feed == -1) {
|
||||
$feed_title = "Starred articles";
|
||||
} else if ($feed < -10) {
|
||||
$label_id = -$feed - 11;
|
||||
$result = db_query($link, "SELECT description FROM ttrss_labels
|
||||
WHERE id = '$label_id'");
|
||||
$feed_title = db_fetch_result($result, 0, "description");
|
||||
} else {
|
||||
$feed_title = "?";
|
||||
}
|
||||
|
||||
if ($feed < -10) error_reporting (0);
|
||||
|
||||
if (preg_match("/^-?[0-9][0-9]*$/", $feed) != false) {
|
||||
|
||||
if ($feed >= 0) {
|
||||
$feed_kind = "Feeds";
|
||||
} else {
|
||||
$feed_kind = "Labels";
|
||||
}
|
||||
|
||||
$query = "SELECT
|
||||
ttrss_entries.id,ttrss_entries.title,
|
||||
SUBSTRING(updated,1,16) as updated,
|
||||
unread,feed_id,marked,link,last_read,
|
||||
SUBSTRING(last_read,1,19) as last_read_noms,
|
||||
$vfeed_query_part
|
||||
SUBSTRING(updated,1,19) as updated_noms
|
||||
FROM
|
||||
ttrss_entries,ttrss_user_entries,ttrss_feeds
|
||||
WHERE
|
||||
ttrss_user_entries.feed_id = ttrss_feeds.id AND
|
||||
ttrss_user_entries.ref_id = ttrss_entries.id AND
|
||||
ttrss_user_entries.owner_uid = '".$_SESSION["uid"]."' AND
|
||||
$search_query_part
|
||||
$view_query_part
|
||||
$query_strategy_part ORDER BY $order_by
|
||||
$limit_query_part";
|
||||
|
||||
$result = db_query($link, $query);
|
||||
|
||||
if ($_GET["debug"]) print $query;
|
||||
|
||||
} else {
|
||||
// browsing by tag
|
||||
|
||||
$feed_kind = "Tags";
|
||||
|
||||
$result = db_query($link, "SELECT
|
||||
ttrss_entries.id as id,title,
|
||||
SUBSTRING(updated,1,16) as updated,
|
||||
unread,feed_id,
|
||||
marked,link,last_read,
|
||||
SUBSTRING(last_read,1,19) as last_read_noms,
|
||||
$vfeed_query_part
|
||||
$content_query_part
|
||||
SUBSTRING(updated,1,19) as updated_noms
|
||||
FROM
|
||||
ttrss_entries,ttrss_user_entries,ttrss_tags
|
||||
WHERE
|
||||
ref_id = ttrss_entries.id AND
|
||||
ttrss_user_entries.owner_uid = '".$_SESSION["uid"]."' AND
|
||||
post_int_id = int_id AND tag_name = '$feed' AND
|
||||
$view_query_part
|
||||
$search_query_part
|
||||
$query_strategy_part ORDER BY $order_by
|
||||
$limit_query_part");
|
||||
}
|
||||
|
||||
if (!$result) {
|
||||
print "<div align='center'>
|
||||
Could not display feed (query failed). Please check label match syntax or local configuration.</div>";
|
||||
return;
|
||||
}
|
||||
|
||||
if (db_num_rows($result) > 0) {
|
||||
|
||||
if (!get_pref($link, 'COMBINED_DISPLAY_MODE')) {
|
||||
print "<table class=\"headlinesList\" id=\"headlinesList\"
|
||||
cellspacing=\"0\" width=\"100%\">";
|
||||
}
|
||||
|
||||
$lnum = 0;
|
||||
|
||||
error_reporting (DEFAULT_ERROR_LEVEL);
|
||||
|
||||
$num_unread = 0;
|
||||
|
||||
while ($line = db_fetch_assoc($result)) {
|
||||
|
||||
$class = ($lnum % 2) ? "even" : "odd";
|
||||
|
||||
$id = $line["id"];
|
||||
$feed_id = $line["feed_id"];
|
||||
|
||||
if ($line["last_read"] == "" &&
|
||||
($line["unread"] != "t" && $line["unread"] != "1")) {
|
||||
|
||||
$update_pic = "<img id='FUPDPIC-$id' src=\"images/updated.png\"
|
||||
alt=\"Updated\">";
|
||||
} else {
|
||||
$update_pic = "<img id='FUPDPIC-$id' src=\"images/blank_icon.gif\"
|
||||
alt=\"Updated\">";
|
||||
}
|
||||
|
||||
if ($line["unread"] == "t" || $line["unread"] == "1") {
|
||||
$class .= "Unread";
|
||||
++$num_unread;
|
||||
$is_unread = true;
|
||||
} else {
|
||||
$is_unread = false;
|
||||
}
|
||||
|
||||
if ($line["marked"] == "t" || $line["marked"] == "1") {
|
||||
$marked_pic = "<img id=\"FMARKPIC-$id\" src=\"../images/mark_set.png\">";
|
||||
} else {
|
||||
$marked_pic = "<img id=\"FMARKPIC-$id\" src=\"../images/mark_unset.png\">";
|
||||
}
|
||||
|
||||
$content_link = "<a href=\"?go=view&id=$id&feed=$feed_id\">" .
|
||||
$line["title"] . "</a>";
|
||||
|
||||
if (get_pref($link, 'HEADLINES_SMART_DATE')) {
|
||||
$updated_fmt = smart_date_time(strtotime($line["updated"]));
|
||||
} else {
|
||||
$short_date = get_pref($link, 'SHORT_DATE_FORMAT');
|
||||
$updated_fmt = date($short_date, strtotime($line["updated"]));
|
||||
}
|
||||
|
||||
print "<tr class='$class'>";
|
||||
|
||||
print "<td class='hlContent'>$content_link";
|
||||
|
||||
if ($line["feed_title"]) {
|
||||
print " (<a href='?go=vf&id=$feed_id'>".
|
||||
$line["feed_title"]."</a>)";
|
||||
}
|
||||
|
||||
print "</td";
|
||||
|
||||
print "<td class='hlMarkedPic'>$marked_pic</td>";
|
||||
|
||||
print "<td class=\"hlUpdated\"><nobr>$updated_fmt </nobr></td>";
|
||||
|
||||
print "</tr>";
|
||||
|
||||
++$lnum;
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
|
||||
} else {
|
||||
print "<div align='center'>No articles found.</div>";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -24,12 +24,20 @@ input {
|
|||
}
|
||||
|
||||
#opsel {
|
||||
float : right;
|
||||
margin-top : 3px;
|
||||
}
|
||||
|
||||
#content {
|
||||
#heading {
|
||||
padding : 2px;
|
||||
}
|
||||
|
||||
#content {
|
||||
border-width : 1px 0px 0px 0px;
|
||||
border-style : solid;
|
||||
border-color : #c0c0c0;
|
||||
background-image : url("../images/vgrad_light_rev.png");
|
||||
background-position : top left;
|
||||
background-repeat : repeat-x;
|
||||
}
|
||||
|
||||
#footer {
|
||||
|
@ -40,35 +48,9 @@ input {
|
|||
font-size : x-small;
|
||||
background-color : white;
|
||||
color : gray;
|
||||
padding : 2px;
|
||||
}
|
||||
|
||||
/*
|
||||
table.main td.heading {
|
||||
font-weight : bold;
|
||||
}
|
||||
|
||||
table.main td.content {
|
||||
background-image : url("../images/vgrad_light_rev.png");
|
||||
background-position : top left;
|
||||
background-repeat : repeat-x;
|
||||
border-width : 1px 0px 0px 0px;
|
||||
border-style : solid;
|
||||
border-color : #c0c0c0;
|
||||
}
|
||||
|
||||
table.main td.footer {
|
||||
border-width : 1px 0px 0px 0px;
|
||||
border-style : solid;
|
||||
border-color : #c0c0c0;
|
||||
text-align : center;
|
||||
font-size : x-small;
|
||||
background-image : url("images/vgrad_light_rev2.png");
|
||||
background-position : top left;
|
||||
background-repeat : repeat-x;
|
||||
color : gray;
|
||||
}
|
||||
*/
|
||||
|
||||
form {
|
||||
padding : 0px;
|
||||
margin : 0px;
|
||||
|
@ -133,3 +115,29 @@ ul.feedList img, img.tinyFeedIcon {
|
|||
border-width : 0px;
|
||||
}
|
||||
|
||||
ul.feedlist li.feedUnread,
|
||||
ul.feedlist li.errorUnread,
|
||||
ul.feedlist li.labelUnread,
|
||||
ul.feedlist li.virtUnread,
|
||||
ul.feedlist li.tagUnread {
|
||||
font-weight : bold;
|
||||
}
|
||||
|
||||
.even {
|
||||
background-color : #f0f0f0;
|
||||
}
|
||||
|
||||
.evenUnread {
|
||||
background-color : #f0f0f0;
|
||||
font-weight : bold;
|
||||
}
|
||||
|
||||
.oddUnread {
|
||||
font-weight : bold;
|
||||
}
|
||||
|
||||
.invisible {
|
||||
display : none;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -19,14 +19,17 @@
|
|||
<head>
|
||||
<title>Tiny Tiny RSS - Mobile</title>
|
||||
<link rel="stylesheet" type="text/css" href="mobile.css">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="heading">
|
||||
|
||||
<div id="opsel">
|
||||
<form method="GET">
|
||||
<select name="go">
|
||||
<option>Feeds</option>
|
||||
<option>Preferences</option>
|
||||
<option disabled>Preferences</option>
|
||||
<option disabled>--------------</option>
|
||||
<option disabled>[user feed list]</option>
|
||||
<option disabled>--------------</option>
|
||||
|
@ -36,12 +39,16 @@
|
|||
</form>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="content">
|
||||
<?
|
||||
$go = $_GET["go"];
|
||||
|
||||
if (!$go || $go == "Feeds") {
|
||||
render_feeds_list($link);
|
||||
} else if ($go == "vf") {
|
||||
render_headlines($link);
|
||||
} else {
|
||||
print "Function not implemented";
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue