]> git.wh0rd.org - tt-rss.git/commitdiff
implement catchup above/below (refs #140)
authorAndrew Dolgov <fox@madoka.spb.ru>
Wed, 22 Aug 2007 04:45:01 +0000 (05:45 +0100)
committerAndrew Dolgov <fox@madoka.spb.ru>
Wed, 22 Aug 2007 04:45:01 +0000 (05:45 +0100)
functions.php
localized_js.php
tt-rss.css
viewfeed.js

index fd8f4da00af40d0c95818d75508e25f8754a0210..d9ae31ab75928a27a6a7f145ad754b306d3ff2a9 100644 (file)
                                        <li class=\"vsep\">&nbsp;</li>
                                        <li class=\"top\"><a href=\"$catchup_page_link\">".__('Mark as read')."</a><ul>
                                                <li onclick=\"$catchup_sel_link\">".__('Selection')."</li>
-                                               <li onclick=\"$catchup_page_link\">".__('This page')."</li>
+                                               <!-- <li onclick=\"$catchup_page_link\">".__('This page')."</li> -->
+                                               <li><span class=\"insensitive\">--------</span></li>
+                                               <li onclick=\"catchupRelativeToArticle(0)\">".__("Above active article")."</li>
+                                               <li onclick=\"catchupRelativeToArticle(1)\">".__("Below active article")."</li>
+                                               <li><span class=\"insensitive\">--------</span></li>
                                                <li onclick=\"$catchup_feed_link\">".__('Entire feed')."</li></ul></li>
                                        ";
 
index d2ab946704e481378c14935ac2aac533d0e6ea4d..77b9ea2f50c3cadff4dd326d15fcd7fe61df09b7 100644 (file)
@@ -116,9 +116,9 @@ print T_js_decl("Save current configuration?");
 print T_js_decl("Old password cannot be blank.");
 print T_js_decl("New password cannot be blank.");
 print T_js_decl("Entered passwords do not match.");
-#print T_js_decl(
-#print T_js_decl(
-#print T_js_decl(
+print T_js_decl("No articles found to mark");
+print T_js_decl("Mark %d article(s) as read?");
+print T_js_decl("No article is selected.");
 #print T_js_decl(
 #print T_js_decl(
 #print T_js_decl(
index 7efc0142f2791f7cf120f679dc4b5a8ea771923e..ba1d4070ee8a0b9cb6f783f64ea4a5c7ecd4570e 100644 (file)
@@ -668,7 +668,7 @@ span.feed_error {
        color : red;
 }
 
-span.insensitive, div.insensitive {
+span.insensitive, div.insensitive, li.insensitive {
        color : gray;
 }
 
@@ -1552,7 +1552,7 @@ ul.headlineDropdownMenu {
 
 ul.headlineDropdownMenu li.top {
        float : left;
-       width : 11em;
+       width : 12em;
        background-image : url("images/down_arrow.png");
        background-position : center right;
        background-repeat : no-repeat;
@@ -1604,7 +1604,7 @@ ul.headlineDropdownMenu ul {
        padding : 0px;
        display : none;
        background-color : white;
-       width : 11em;
+       width : 12em;
        z-index : 3;
        top : auto;
        left : auto;
index b1fbdd800604632139fffd3bec812dd07b8d8004..c7a85fdb60b404d5c446c2d0aca5dc99b3af73f2 100644 (file)
@@ -871,6 +871,39 @@ function cdmGetSelectedArticles() {
        return sel_articles;
 }
 
+function cdmGetVisibleArticles() {
+       var sel_articles = new Array();
+       var container = document.getElementById("headlinesInnerContainer");
+
+       for (i = 0; i < container.childNodes.length; i++) {
+               var child = container.childNodes[i];
+
+               if (child.id.match("RROW-")) {
+                       var c_id = child.id.replace("RROW-", "");
+                       sel_articles.push(c_id);
+               }
+       }
+
+       return sel_articles;
+}
+
+function cdmGetUnreadArticles() {
+       var sel_articles = new Array();
+       var container = document.getElementById("headlinesInnerContainer");
+
+       for (i = 0; i < container.childNodes.length; i++) {
+               var child = container.childNodes[i];
+
+               if (child.id.match("RROW-") && child.className.match("Unread")) {
+                       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("headlinesInnerContainer");
@@ -1253,3 +1286,79 @@ function headlines_scroll_handler() {
                exception_error("headlines_scroll_handler", e);
        }
 }
+
+function catchupRelativeToArticle(below) {
+
+       try {
+
+               if (!xmlhttp_ready(xmlhttp_rpc)) {
+                       printLockingError();
+               }
+       
+               if (!getActiveArticleId()) {
+                       alert(__("No article is selected."));
+                       return;
+               }
+
+               var visible_ids;
+
+               if (document.getElementById("headlinesList")) {
+                       visible_ids = getVisibleHeadlineIds();
+               } else {
+                       visible_ids = cdmGetVisibleArticles();
+               }
+
+               var ids_to_mark = new Array();
+
+               if (!below) {
+                       for (var i = 0; i < visible_ids.length; i++) {
+                               if (visible_ids[i] != getActiveArticleId()) {
+                                       var e = document.getElementById("RROW-" + visible_ids[i]);
+
+                                       if (e && e.className.match("Unread")) {
+                                               ids_to_mark.push(visible_ids[i]);
+                                       }
+                               } else {
+                                       break;
+                               }
+                       }
+               } else {
+                       for (var i = visible_ids.length-1; i >= 0; i--) {
+                               if (visible_ids[i] != getActiveArticleId()) {
+                                       var e = document.getElementById("RROW-" + visible_ids[i]);
+
+                                       if (e && e.className.match("Unread")) {
+                                               ids_to_mark.push(visible_ids[i]);
+                                       }
+                               } else {
+                                       break;
+                               }
+                       }
+               }
+
+               if (ids_to_mark.length == 0) {
+                       alert(__("No articles found to mark"));
+               } else {
+                       var msg = __("Mark %d article(s) as read?").replace("%d", ids_to_mark.length);
+
+                       if (confirm(msg)) {
+
+                               for (var i = 0; i < ids_to_mark.length; i++) {
+                                       var e = document.getElementById("RROW-" + ids_to_mark[i]);
+                                       e.className = e.className.replace("Unread", "");
+                               }
+
+                               var query = "backend.php?op=rpc&subop=catchupSelected&ids=" +
+                                       param_escape(ids_to_mark.toString()) + "&cmode=0";
+
+                               xmlhttp_rpc.open("GET", query, true);
+                               xmlhttp_rpc.onreadystatechange=catchup_callback;
+                               xmlhttp_rpc.send(null);
+       
+                       }
+               }
+
+       } catch (e) {
+               exception_error("catchupRelativeToArticle", e);
+       }
+}