]> git.wh0rd.org - tt-rss.git/commitdiff
combined article display mode (option COMBINED_DISPLAY_MODE), remove xml feed output
authorAndrew Dolgov <fox@madoka.spb.ru>
Tue, 13 Dec 2005 05:52:32 +0000 (06:52 +0100)
committerAndrew Dolgov <fox@madoka.spb.ru>
Tue, 13 Dec 2005 05:52:32 +0000 (06:52 +0100)
backend.php
functions.js
schema/ttrss_schema_mysql.sql
schema/ttrss_schema_pgsql.sql
schema/upgrade-1.1-1.1.1-mysql.sql
schema/upgrade-1.1-1.1.1-pgsql.sql
tt-rss.css
tt-rss.php
viewfeed.js

index ec662d818dff657cb20c4357f456a4c849d36ef7..97b5c5197ffd321d5d95c117e88ccd8167c55e64 100644 (file)
                $view_mode = $_GET["view"];
                $addheader = $_GET["addheader"];
                $limit = $_GET["limit"];
-               $omode = $_GET["omode"];
-
-               if ($omode == "xml") {
-                       header("Content-Type: application/xml");
-               }
 
                if (!$feed) {
                        return;
 
                if ($feed < -10) error_reporting (0);
 
+               print "<div id=\"headlinesContainer\">";
+
                if (sprintf("%d", $feed) != 0) {
 
                        if ($feed > 0) {                        
                                $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,
                }
 
                if (!$result) {
-                       if ($omode != "xml") {
-                               print "<div align='center'>
-                                       Could not display feed (query failed). Please check label match syntax or local configuration.</div>";
-                               return;
-                       } else {
-                               print "<error error-code=\"8\"/>";
-
-                       }
+                       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 ($omode != "xml") {
+                       print "<table class=\"headlinesSubToolbar\" 
+                               width=\"100%\" cellspacing=\"0\" cellpadding=\"0\"><tr>";
+
+                       if (!get_pref($link, 'COMBINED_DISPLAY_MODE')) {
 
-                               print "<table class=\"headlinesSubToolbar\" 
-                                       width=\"100%\" cellspacing=\"0\" cellpadding=\"0\"><tr>";
-                               
                                print "<td class=\"headlineActions\">
                                        Select: 
-                                                       <a href=\"javascript:selectTableRowsByIdPrefix('headlinesList', 
-                                                               'RROW-', 'RCHK-', true)\">All</a>,
-                                                       <a href=\"javascript:selectTableRowsByIdPrefix('headlinesList', 
-                                                               'RROW-', 'RCHK-', true, 'Unread')\">Unread</a>,
-                                                       <a href=\"javascript:selectTableRowsByIdPrefix('headlinesList', 
-                                                               'RROW-', 'RCHK-', false)\">None</a>
-                                       &nbsp;&nbsp;
-                                       Toggle: <a href=\"javascript:selectionToggleUnread()\">Unread</a>,
-                                                       <a href=\"javascript:selectionToggleMarked()\">Starred</a>";
-               
+                                                               <a href=\"javascript:selectTableRowsByIdPrefix('headlinesList', 
+                                                                       'RROW-', 'RCHK-', true)\">All</a>,
+                                                               <a href=\"javascript:selectTableRowsByIdPrefix('headlinesList', 
+                                                                       'RROW-', 'RCHK-', true, 'Unread')\">Unread</a>,
+                                                               <a href=\"javascript:selectTableRowsByIdPrefix('headlinesList', 
+                                                                       'RROW-', 'RCHK-', false)\">None</a>
+                                               &nbsp;&nbsp;
+                                               Toggle: <a href=\"javascript:selectionToggleUnread()\">Unread</a>,
+                                                               <a href=\"javascript:selectionToggleMarked()\">Starred</a>";
+                       
                                print "</td>";
-               
-                               print "<td class=\"headlineTitle\">";
-               
-                               if ($feed_site_url) {
-                                       print "<a target=\"_blank\" href=\"$feed_site_url\">$feed_title</a>";
-                               } else {
-                                       print $feed_title;
-                               }
-                               
+
+                       } else {
+
+                               print "<td class=\"headlineActions\">
+                                       Select: 
+                                                               <a href=\"javascript:cdmSelectArticles('all')\">All</a>,
+                                                               <a href=\"javascript:cdmSelectArticles('unread')\">Unread</a>,
+                                                               <a href=\"javascript:cdmSelectArticles('none')\">None</a>
+                                               &nbsp;&nbsp;
+                                               Toggle: <a href=\"javascript:selectionToggleUnread(true)\">Unread</a>,
+                                                               <a href=\"javascript:selectionToggleMarked(true)\">Starred</a>";
+                       
                                print "</td>";
-                               print "</tr></table>";
+
+
+                       }
+
+                       print "<td class=\"headlineTitle\">";
                
+                       if ($feed_site_url) {
+                               print "<a target=\"_blank\" href=\"$feed_site_url\">$feed_title</a>";
+                       } else {
+                               print $feed_title;
+                       }
+                               
+                       print "</td>";
+                       print "</tr></table>";
+
+                       if (!get_pref($link, 'COMBINED_DISPLAY_MODE')) {
                                print "<table class=\"headlinesList\" id=\"headlinesList\" 
                                        cellspacing=\"0\" width=\"100%\">";
-
-                       } else {
-                               print "<headlines feed=\"$feed\" title=\"$feed_title\" site_url=\"$feed_site_url\">";
                        }
-       
+
                        $lnum = 0;
        
                        error_reporting (DEFAULT_ERROR_LEVEL);
                                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") {
                                                200);
                                }
 
-                               if ($omode != "xml") {
+                               if (!get_pref($link, 'COMBINED_DISPLAY_MODE')) {
                                        
                                        print "<tr class='$class' id='RROW-$id'>";
-                                       // onclick=\"javascript:view($id,$feed_id)\">
                
                                        print "<td class='hlUpdatePic'>$update_pic</td>";
                
                                        print "</tr>";
 
                                } else {
+                                       
+                                       if ($is_unread) {
+                                               $add_class = "Unread";
+                                       } else {
+                                               $add_class = "";
+                                       }       
+                                       
+                                       print "<div class=\"cdmArticle$add_class\" id=\"RROW-$id\">";
+
+                                       print "<div class=\"cdmHeader\">";
 
-                                       print "<entry unread='$is_unread' id='$id'>";
-                                       print "<title><![CDATA[" . $line["title"] . "]]></title>";
-                                       print "<link>" . $line["link"] . "</link>";
-                                       print "<updated>$updated_fmt</updated>";
-                                       if ($content_preview) {
-                                               print "<preview><![CDATA[ $content_preview ]]></preview>";
-                                       }                                       
+                                       print "<div style=\"float : right\">$updated_fmt</div>";
+                                       
+                                       print "<a href=\"".$line["link"]."\">".$line["title"]."</a>";
 
-                                       if ($line["feed_title"]) {
-                                       print "<feed id='$feed_id'><![CDATA[" . $line["feed_title"] . "]]></feed>";
+                                       if ($line["feed_title"]) {      
+                                               print "&nbsp;(<a href='javascript:viewfeed($feed_id)'>".$line["feed_title"]."</a>)";
                                        }
-                                       print "</entry>";
 
-                               }
-                               
+                                       print "</div>";
+
+                                       print "<div class=\"cdmContent\">" . $line["content_preview"] . "</div>";
+       
+                                       print "<div style=\"float : right\">$marked_pic</div>
+                                               <div class=\"cdmFooter\">
+                                                       <input type=\"checkbox\" onclick=\"toggleSelectRowById(this, 
+                                                       'RROW-$id')\" class=\"feedCheckBox\" id=\"RCHK-$id\"></div>";
+
+                                       print "</div>"; 
+
+                               }                               
        
                                ++$lnum;
                        }
 
-                       if ($omode != "xml") {                  
+                       if (!get_pref($link, 'COMBINED_DISPLAY_MODE')) {                        
                                print "</table>";
-                       } else {
-                               print "</headlines>";
                        }
 
                } else {
                        print "<div width='100%' align='center'>No articles found.</div>";
                }
 
-               if ($omode != "xml") {
+               print "</div>";
 
-                       print "<script type=\"text/javascript\">
-                               document.onkeydown = hotkey_handler;
-                               update_all_counters('$feed');
-                       </script>";
+               print "<script type=\"text/javascript\">
+                       document.onkeydown = hotkey_handler;
+                       update_all_counters('$feed');
+               </script>";
        
-                       if ($addheader) {
-                               print "</body></html>";
-                       }
+               if ($addheader) {
+                       print "</body></html>";
                }
        }
 
index d901cbb90f88c27f3e776286f4a76c2716d2ad31..b72c1157bfa3819c0d90b9f557715d734c787adb 100644 (file)
@@ -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;
 
index b9855fbd656d351b8b8159c53488a0680e9cbc31..fe711d1a90f2adb86a5ecee3ff6c2ee6da2e2dae 100644 (file)
@@ -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),
index d584929198e8e5a08dc9b433c2705bd3d8895fb5..758c6f664ef0fd4e84af0df361462d6fe4479c02 100644 (file)
@@ -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,
index 685582b891ad1c93ead2304836b43a933f4110f3..c7f96fa1b7c13746826690efc73915762b31fdad 100644 (file)
@@ -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;
index 9c7b5e35d677a14d43b839a4c7c4192c496abfe9..4ad609949d996d9b56569f587b879f496095c09c 100644 (file)
@@ -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;
index ac306ab90beae8e1f778157871adde6e182f93d1..f683d85bec446e63d354cd068d1566e80130fe31 100644 (file)
@@ -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 {
+}
index f76614c2ea4c9a0ee895a50cc5dec006e4521d56..13c2b17c5ff012558271b304efd96b776ada3ede 100644 (file)
                </td>
                </tr>
                </table>
-       </td> 
-</tr><tr>
+       </td>
+</tr>
+<? if (get_pref($link, 'COMBINED_DISPLAY_MODE')) { ?>
+<tr>
+       <td id="headlines" class="headlines2" valign="top">
+               <iframe frameborder="0" name="headlines-frame" 
+                       id="headlines-frame" class="headlinesFrame" 
+                               src="backend.php?op=error&msg=No%20feed%20selected."></iframe>
+       </td>
+</tr>
+<? } else { ?>
+<tr>
        <td id="headlines" class="headlines" valign="top">
                <iframe frameborder="0" name="headlines-frame" 
                        id="headlines-frame" class="headlinesFrame" 
                        id="content-frame" class="contentFrame"> </iframe>
        </td>
 </tr>
+<? } ?>
 <? if (get_pref($link, 'DISPLAY_FOOTER')) { ?>
 <tr>
        <td colspan="2" class="footer">
index 68555bde09d767dcf81be5350eb259b53fff9037..7047aaae26035b8dd1da673956ca51e9d7a9af26 100644 (file)
@@ -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;
 }