From: Andrew Dolgov Date: Tue, 13 Dec 2005 05:52:32 +0000 (+0100) Subject: combined article display mode (option COMBINED_DISPLAY_MODE), remove xml feed output X-Git-Tag: schema_freeze_for_1.1.1~56 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=386cbf27aa42980ad46322ba59f0ae550a2b9ac7;p=tt-rss.git combined article display mode (option COMBINED_DISPLAY_MODE), remove xml feed output --- diff --git a/backend.php b/backend.php index ec662d81..97b5c519 100644 --- a/backend.php +++ b/backend.php @@ -803,11 +803,6 @@ $view_mode = $_GET["view"]; $addheader = $_GET["addheader"]; $limit = $_GET["limit"]; - $omode = $_GET["omode"]; - - if ($omode == "xml") { - header("Content-Type: application/xml"); - } if (!$feed) { return; @@ -1050,6 +1045,8 @@ if ($feed < -10) error_reporting (0); + print "
"; + if (sprintf("%d", $feed) != 0) { if ($feed > 0) { @@ -1058,11 +1055,11 @@ $feed_kind = "Labels"; } - if (!$vfeed_query_part) { - $content_query_part = "SUBSTRING(content,1,300) as content_preview,"; - } else { - $content_query_part = ""; - } +// if (!$vfeed_query_part) { + $content_query_part = "content as content_preview,"; +// } else { +// $content_query_part = ""; +// } $result = db_query($link, "SELECT id,title, @@ -1109,55 +1106,64 @@ } if (!$result) { - if ($omode != "xml") { - print "
- Could not display feed (query failed). Please check label match syntax or local configuration.
"; - return; - } else { - print ""; - - } + print "
+ Could not display feed (query failed). Please check label match syntax or local configuration.
"; + return; } if (db_num_rows($result) > 0) { - if ($omode != "xml") { + print ""; + + if (!get_pref($link, 'COMBINED_DISPLAY_MODE')) { - print "
"; - print ""; - - print ""; - print "
Select: - All, - Unread, - None -    - Toggle: Unread, - Starred"; - + All, + Unread, + None +    + Toggle: Unread, + Starred"; + print ""; - - if ($feed_site_url) { - print "$feed_title"; - } else { - print $feed_title; - } - + + } else { + + print " + Select: + All, + Unread, + None +    + Toggle: Unread, + Starred"; + print "
"; + + + } + + print ""; + if ($feed_site_url) { + print "$feed_title"; + } else { + print $feed_title; + } + + print ""; + print ""; + + if (!get_pref($link, 'COMBINED_DISPLAY_MODE')) { print ""; - - } else { - print ""; } - + $lnum = 0; error_reporting (DEFAULT_ERROR_LEVEL); @@ -1184,9 +1190,9 @@ if ($line["unread"] == "t" || $line["unread"] == "1") { $class .= "Unread"; ++$num_unread; - $is_unread = 'true'; + $is_unread = true; } else { - $is_unread = 'false'; + $is_unread = false; } if ($line["marked"] == "t" || $line["marked"] == "1") { @@ -1212,10 +1218,9 @@ 200); } - if ($omode != "xml") { + if (!get_pref($link, 'COMBINED_DISPLAY_MODE')) { print ""; - // onclick=\"javascript:view($id,$feed_id)\"> print ""; @@ -1252,46 +1257,58 @@ print ""; } else { + + if ($is_unread) { + $add_class = "Unread"; + } else { + $add_class = ""; + } + + print "
"; + + print "
"; - print ""; - print "<![CDATA[" . $line["title"] . "]]>"; - print "" . $line["link"] . ""; - print "$updated_fmt"; - if ($content_preview) { - print ""; - } + print "
$updated_fmt
"; + + print "".$line["title"].""; - if ($line["feed_title"]) { - print ""; + if ($line["feed_title"]) { + print " (".$line["feed_title"].")"; } - print "
"; - } - + print "
"; + + print "
" . $line["content_preview"] . "
"; + + print "
$marked_pic
+
+
"; + + print "
"; + + } ++$lnum; } - if ($omode != "xml") { + if (!get_pref($link, 'COMBINED_DISPLAY_MODE')) { print "
$update_pic
"; - } else { - print ""; } } else { print "
No articles found.
"; } - if ($omode != "xml") { + print "
"; - print ""; + print ""; - if ($addheader) { - print ""; - } + if ($addheader) { + print ""; } } diff --git a/functions.js b/functions.js index d901cbb9..b72c1157 100644 --- a/functions.js +++ b/functions.js @@ -537,6 +537,21 @@ function getSelectedTableRowIds(content_id, prefix) { } +function toggleSelectRowById(sender, id) { + var row = document.getElementById(id); + + if (sender.checked) { + if (!row.className.match("Selected")) { + row.className = row.className + "Selected"; + } + } else { + if (row.className.match("Selected")) { + row.className = row.className.replace("Selected", ""); + } + } +} + + function toggleSelectRow(sender) { var parent_row = sender.parentNode.parentNode; diff --git a/schema/ttrss_schema_mysql.sql b/schema/ttrss_schema_mysql.sql index b9855fbd..fe711d1a 100644 --- a/schema/ttrss_schema_mysql.sql +++ b/schema/ttrss_schema_mysql.sql @@ -220,6 +220,8 @@ insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) valu insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('HEADLINES_SMART_DATE', 1, 'true', 'Use more accessible date/time format for headlines',3); +insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('COMBINED_DISPLAY_MODE', 1, 'false', 'Combined feed display, no headline/article separation',2); + create table ttrss_user_prefs ( owner_uid integer not null, pref_name varchar(250), diff --git a/schema/ttrss_schema_pgsql.sql b/schema/ttrss_schema_pgsql.sql index d5849291..758c6f66 100644 --- a/schema/ttrss_schema_pgsql.sql +++ b/schema/ttrss_schema_pgsql.sql @@ -200,6 +200,8 @@ insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) valu insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('HEADLINES_SMART_DATE', 1, 'true', 'Use more accessible date/time format for headlines',3); +insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('COMBINED_DISPLAY_MODE', 1, 'false', 'Combined feed display, no headline/article separation',2); + create table ttrss_user_prefs ( owner_uid integer not null references ttrss_users(id) ON DELETE CASCADE, pref_name varchar(250) not null references ttrss_prefs(pref_name) ON DELETE CASCADE, diff --git a/schema/upgrade-1.1-1.1.1-mysql.sql b/schema/upgrade-1.1-1.1.1-mysql.sql index 685582b8..c7f96fa1 100644 --- a/schema/upgrade-1.1-1.1.1-mysql.sql +++ b/schema/upgrade-1.1-1.1.1-mysql.sql @@ -7,4 +7,6 @@ update ttrss_entries set num_comments = 0; alter table ttrss_entries change num_comments num_comments integer not null; alter table ttrss_entries alter column num_comments set default 0; +insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('COMBINED_DISPLAY_MODE', 1, 'false', 'Combined feed display, no headline/article separation',2); + commit; diff --git a/schema/upgrade-1.1-1.1.1-pgsql.sql b/schema/upgrade-1.1-1.1.1-pgsql.sql index 9c7b5e35..4ad60994 100644 --- a/schema/upgrade-1.1-1.1.1-pgsql.sql +++ b/schema/upgrade-1.1-1.1.1-pgsql.sql @@ -7,4 +7,6 @@ update ttrss_entries set num_comments = 0; alter table ttrss_entries alter column num_comments set not null; alter table ttrss_entries alter column num_comments set default 0; +insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('COMBINED_DISPLAY_MODE', 1, 'false', 'Combined feed display, no headline/article separation',2); + commit; diff --git a/tt-rss.css b/tt-rss.css index ac306ab9..f683d85b 100644 --- a/tt-rss.css +++ b/tt-rss.css @@ -77,6 +77,13 @@ table.main td.headlines { border-color : #c0c0c0; } +table.main td.headlines2 { + height : 100%; + border-width : 0px 0px 1px 1px; + border-style : solid; + border-color : #c0c0c0; +} + table.main td.content { height : 100%; background-image : url("images/vgrad_light_rev.png"); @@ -825,3 +832,57 @@ td.hlContent { td.hlMarkedPic, td.hlSelectRow, td.hlUpdated, td.hlFeed { height : 1em; } + +div.cdmArticle { + border : 1px solid #f0f0f0; + background-color : #fafafa; + -moz-border-radius : 5px; + margin : 10px 10px 0px 10px; + padding : 10px; +} + +div.cdmArticleUnread { + border : 1px solid #d5f1f4; + background-color : #fafeff; + -moz-border-radius : 5px; + margin : 10px 10px 0px 10px; + padding : 10px; +} + +div.cdmArticleSelected, div.cdmArticleUnreadSelected { + border : 1px solid #d0d0f6; + background-color : #eaeaff; + -moz-border-radius : 5px; + margin : 10px 10px 0px 10px; + padding : 10px; +} + +div.cdmArticleUnread div.cdmHeader a, div.cdmArticleUnreadSelected div.cdmHeader a { + font-weight : bold; +} + +div.cdmHeader { + padding-bottom : 5px; +} + +div.cdmFooter { + font-size : x-small; + color : gray; + padding-top : 5px; +} + +div.cdmFooter input, div.cdmHeader input, div.cdmFooter img { + margin : 0px; +} + +div.cdmHeader, div.cdmHeader a { + color : gray; + font-size : x-small; +} + +div.cdmHeader a:hover { + color : #5050aa; +} + +div.cdmContent { +} diff --git a/tt-rss.php b/tt-rss.php index f76614c2..13c2b17c 100644 --- a/tt-rss.php +++ b/tt-rss.php @@ -209,8 +209,18 @@ - - + + + + + + + + + + + diff --git a/viewfeed.js b/viewfeed.js index 68555bde..7047aaae 100644 --- a/viewfeed.js +++ b/viewfeed.js @@ -226,14 +226,20 @@ function localHotkeyHandler(keycode) { } -function selectionToggleUnread() { +function selectionToggleUnread(cdm_mode) { try { if (!xmlhttp_ready(xmlhttp_rpc)) { printLockingError(); return; } - var rows = getSelectedTableRowIds("headlinesList", "RROW", "RCHK"); + var rows; + + if (cdm_mode) { + rows = cdmGetSelectedArticles(); + } else { + rows = getSelectedTableRowIds("headlinesList", "RROW", "RCHK"); + } for (i = 0; i < rows.length; i++) { var row = document.getElementById("RROW-" + rows[i]); @@ -266,14 +272,20 @@ function selectionToggleUnread() { } } -function selectionToggleMarked() { +function selectionToggleMarked(cdm_mode) { try { if (!xmlhttp_ready(xmlhttp_rpc)) { printLockingError(); return; } - var rows = getSelectedTableRowIds("headlinesList", "RROW", "RCHK"); + var rows; + + if (cdm_mode) { + rows = cdmGetSelectedArticles(); + } else { + rows = getSelectedTableRowIds("headlinesList", "RROW", "RCHK"); + } for (i = 0; i < rows.length; i++) { var row = document.getElementById("RROW-" + rows[i]); @@ -312,6 +324,46 @@ function selectionToggleMarked() { } } +function cdmGetSelectedArticles() { + var sel_articles = new Array(); + var container = document.getElementById("headlinesContainer"); + + for (i = 0; i < container.childNodes.length; i++) { + var child = container.childNodes[i]; + + if (child.id.match("RROW-") && child.className.match("Selected")) { + var c_id = child.id.replace("RROW-", ""); + sel_articles.push(c_id); + } + } + + return sel_articles; +} + +// mode = all,none,unread +function cdmSelectArticles(mode) { + var container = document.getElementById("headlinesContainer"); + + for (i = 0; i < container.childNodes.length; i++) { + var child = container.childNodes[i]; + + if (child.id.match("RROW-")) { +// var aid = child.id.replace("RROW-", ""); + if (mode == "all") { + if (!child.className.match("Selected")) { + child.className = child.className + "Selected"; + } + } else if (mode == "unread") { + if (child.className.match("Unread") && !child.className.match("Selected")) { + child.className = child.className + "Selected"; + } + } else { + child.className = child.className.replace("Selected", ""); + } + } + } +} + function init() { document.onkeydown = hotkey_handler; }