print "<input type=\"hidden\" name=\"id\" value=\"$feed\">";
print "<input type=\"hidden\" name=\"cat\" value=\"$cat_view\">";
- print "<ul class=\"headlines\">";
+ print "<ul class=\"headlines\" id=\"headlines\">";
$page_art_ids = array();
print "<li class='$class' id=\"HROW-$id\">";
- print "<input type=\"checkbox\" name=\"sel_ids[$id]\"
- onchange=\"toggleSelectRow(this, $id)\">";
+ print "<input type=\"checkbox\" name=\"sel_ids[$id]\"
+ id=\"HSCB-$id\" onchange=\"toggleSelectRow(this, $id)\">";
print "<a href=\"?go=vf&id=$feed&ts=$id&cat=$cat_view\">$marked_pic</a>";
print "<a href=\"?go=vf&id=$feed&tp=$id&cat=$cat_view\">$published_pic</a>";
/* print "<a href=\"tt-rss.php?go=vf&id=$feed&subop=MarkPageRead\">Page</a>, ";
print "<a href=\"tt-rss.php?go=vf&id=$feed&subop=MarkAllRead\">Feed</a></div>"; */
+ print "Select:
+ <a href=\"javascript:selectHeadlines(1)\">All</a>,
+ <a href=\"javascript:selectHeadlines(2)\">Unread</a>,
+ <a href=\"javascript:selectHeadlines(3)\">None</a>,
+ <a href=\"javascript:selectHeadlines(4)\">Invert</a>";
+
+ print " ";
+
print "<select name=\"catchup_op\">
<option value=\"selection\">Selection</option>
<option value=\"page\">Page</option>
<option value=\"feed\">Entire feed</option>
</select>
<input type=\"hidden\" name=\"cat\" value=\"$cat_view\">
- <input type=\"submit\" value=\"Mark as read\">";
+ <input type=\"submit\" value=\"Mark as read\">";
print "</form>";
function toggleSelectRow(cb, id) {
- var row = document.getElementById("HROW-" + id);
- var checked = cb.checked;
- if (row) {
- var unread = row.className.match("Unread");
- var new_classname = row.className;
+ try {
- new_classname = new_classname.replace("Selected", "");
- new_classname = new_classname.replace("Unread", "");
+ var row = document.getElementById("HROW-" + id);
+ var checked = cb.checked;
+ if (row) {
+ var unread = row.className.match("Unread");
+ var new_classname = row.className;
- if (unread) new_classname = new_classname + "Unread";
- if (checked) new_classname = new_classname + "Selected";
+ new_classname = new_classname.replace("Selected", "");
+ new_classname = new_classname.replace("Unread", "");
- row.className = new_classname;
+ if (unread) new_classname = new_classname + "Unread";
+ if (checked) new_classname = new_classname + "Selected";
+
+ row.className = new_classname;
+ }
+ } catch (e) {
+ exception_error("toggleSelectRow", e);
+ }
+}
+
+function selectHeadlines(mode) {
+ try {
+
+ var cboxes = document.getElementsByTagName("INPUT");
+
+ for (var i = 0; i < cboxes.length; i++) {
+ if (cboxes[i].id && cboxes[i].id.match("HSCB-")) {
+ var row_id = cboxes[i].id.replace("HSCB-", "")
+ var row = document.getElementById("HROW-" + row_id);
+
+ if (row) {
+
+ if (mode == 1) {
+ cboxes[i].checked = true;
+ toggleSelectRow(cboxes[i], row_id);
+ }
+
+ if (mode == 2) {
+
+ var unread = row.className.match("Unread");
+
+ if (unread) {
+ cboxes[i].checked = true;
+ } else {
+ cboxes[i].checked = false;
+ }
+ }
+
+ if (mode == 3) {
+ cboxes[i].checked = false;
+ }
+
+ if (mode == 4) {
+ cboxes[i].checked = !cboxes[i].checked;
+ }
+
+ toggleSelectRow(cboxes[i], row_id);
+
+ }
+
+ }
+
+ }
+
+ } catch (e) {
+ exception_error("selectHeadlines", e);
+ }
+}
+
+function exception_error(location, e, silent) {
+ var msg;
+
+ if (e.fileName) {
+ var base_fname = e.fileName.substring(e.fileName.lastIndexOf("/") + 1);
+
+ msg = "Exception: " + e.name + ", " + e.message +
+ "\nFunction: " + location + "()" +
+ "\nLocation: " + base_fname + ":" + e.lineNumber;
+
+ } else if (e.description) {
+ msg = "Exception: " + e.description + "\nFunction: " + location + "()";
+ } else {
+ msg = "Exception: " + e + "\nFunction: " + location + "()";
+ }
+
+ debug("<b>EXCEPTION: " + msg + "</b>");
+
+ if (!silent) {
+ alert(msg);
}
}
+