dijit.tree feedlist improvements

This commit is contained in:
Andrew Dolgov 2010-11-15 21:49:00 +03:00
parent 13e785e069
commit fcf70c5106
9 changed files with 410 additions and 783 deletions

View File

@ -176,7 +176,8 @@
case "collapse":
$cat_id = db_escape_string($_REQUEST["cid"]);
toggle_collapse_cat($link, $cat_id);
$mode = (int) db_escape_string($_REQUEST['mode']);
toggle_collapse_cat($link, $cat_id, $mode);
return;
break;

View File

@ -31,20 +31,6 @@ function viewCategory(cat) {
return false;
}
/* function render_feedlist(data) {
try {
var f = $("feeds-frame");
f.innerHTML = data;
// cache_invalidate("FEEDLIST");
// cache_inject("FEEDLIST", data, getInitParam("num_feeds"));
feedlist_init();
} catch (e) {
exception_error("render_feedlist", e);
}
} */
function viewNextFeedPage() {
try {
//if (!getActiveFeedId()) return;
@ -227,25 +213,11 @@ function viewfeed(feed, subop, is_cat, offset) {
}
if (cache_check) {
var f = $("headlines-frame");
clean_feed_selections();
setActiveFeedId(feed, is_cat);
if (!is_cat) {
var feedr = $("FEEDR-" + feed);
if (feedr && !feedr.hasClassName("Selected")) {
feedr.addClassName("Selected");
}
} else {
var feedr = $("FCAT-" + feed_id);
if (feedr && !feedr.hasClassName("Selected")) {
feedr.addClassName("Selected");
}
}
f.innerHTML = cache_find_param(cache_prefix + feed, unread_ctr);
$("headlines-frame").innerHTML = cache_find_param(cache_prefix + feed,
unread_ctr);
request_counters();
remove_splash();
@ -316,61 +288,6 @@ function viewfeed(feed, subop, is_cat, offset) {
}
}
function toggleCollapseCat_af(effect) {
//var caption = elem.id.replace("FCATLIST-", "");
try {
var elem = effect.element;
var cat = elem.id.replace("FCATLIST-", "");
var cap = $("FCAP-" + cat);
if (Element.visible(elem)) {
cap.innerHTML = cap.innerHTML.replace("…", "");
} else {
if (cap.innerHTML.lastIndexOf("…") != cap.innerHTML.length-3) {
cap.innerHTML = cap.innerHTML + "…";
}
}
} catch (e) {
exception_error("toggleCollapseCat_af", e);
}
}
function toggleCollapseCat(cat) {
try {
var cat_elem = $("FCAT-" + cat);
var cat_list = $("FCATLIST-" + cat).parentNode;
var caption = $("FCAP-" + cat);
Effect.toggle('FCATLIST-' + cat, 'blind', { duration: 0.5,
afterFinish: toggleCollapseCat_af });
var img = cat_elem.getElementsByTagName("IMG")[0];
if (img.src.match("-collapse"))
img.src = img.src.replace("-collapse", "-uncollapse")
else
img.src = img.src.replace("-uncollapse", "-collapse")
new Ajax.Request("backend.php",
{ parameters: "backend.php?op=feeds&subop=collapse&cid=" +
param_escape(cat) } );
} catch (e) {
exception_error("toggleCollapseCat", e);
}
}
function isCatCollapsed(cat) {
try {
return Element.visible("FCATLIST-" + cat);
} catch (e) {
exception_error("isCatCollapsed", e);
}
}
function feedlist_dragsorted(ctr) {
try {
@ -400,24 +317,26 @@ function feedlist_init() {
try {
loading_set_progress(90);
//console.log("in feedlist init");
console.log("in feedlist init");
hideOrShowFeeds(getInitParam("hide_read_feeds") == 1);
document.onkeydown = hotkey_handler;
setTimeout("hotkey_prefix_timeout()", 5*1000);
if (getActiveFeedId()) {
if (getActiveFeedId()) {
//console.log("some feed is open on feedlist refresh, reloading");
//setTimeout("viewCurrentFeed()", 100);
} else {
if (getInitParam("cdm_auto_catchup") != 1 && get_feed_unread(-3) > 0) {
notify_silent_next();
if (getInitParam("cdm_auto_catchup") != 1) {
setTimeout("viewfeed(-3)", 100);
} else {
setTimeout("viewfeed(-5)", 100);
remove_splash();
}
}
}
console.log("T:" +
getInitParam("cdm_auto_catchup") + " " + get_feed_unread(-3));
if (getInitParam("theme") == "" ||
getInitParam("theme_options").match("hide_footer")) {
@ -461,13 +380,13 @@ function feedlist_init() {
function hide_footer() {
try {
if (Element.visible("footer")) {
/* if (Element.visible("footer")) {
Element.hide("footer");
dijit.byId("main").resize();
//new Effect.Fade("footer", { afterFinish: hide_footer_af });
}
} */
} catch (e) {
exception_error("hide_footer", e);
}
@ -583,114 +502,17 @@ function parse_counters(reply, scheduled_call) {
var treeItem;
setFeedUnread(id, (kind == "cat"), ctr);
if (kind != "cat") {
//setFeedValue(id, false, 'error', error);
setFeedValue(id, false, 'updated', updated);
}
}
/* if (kind && kind == "cat") {
var catctr = $("FCATCTR-" + id);
if (catctr) {
catctr.innerHTML = "(" + ctr + ")";
if (ctr > 0) {
catctr.addClassName("Unread");
} else {
catctr.removeClassName("Unread");
}
}
continue;
}
var feedctr = $("FEEDCTR-" + id);
var feedu = $("FEEDU-" + id);
var feedr = $("FEEDR-" + id);
var feed_img = $("FIMG-" + id);
var feedlink = $("FEEDL-" + id);
var feedupd = $("FLUPD-" + id);
if (updated && feedlink) {
if (error) {
feedlink.title = __("Error:") + " " + error + " (" + updated + ")";
} else {
feedlink.title = __("Updated:") + " " + updated;
}
} else if (!updated && feedlink) {
feedlink.title = __("Updated:") + " " + __("Never");
}
if (feedupd) {
if (!updated) updated = "";
if (error) {
if (xmsg) {
feedupd.innerHTML = updated + " " + xmsg + " (Error)";
} else {
feedupd.innerHTML = updated + " (Error)";
}
} else {
if (xmsg) {
feedupd.innerHTML = updated + " (" + xmsg + ")";
} else {
feedupd.innerHTML = updated;
}
}
}
if (has_img && feed_img) {
if (!feed_img.src.match(id + ".ico")) {
feed_img.src = getInitParam("icons_url") + "/" + id + ".ico";
}
}
if (feedlink && title) {
feedlink.innerHTML = title;
}
if (feedctr && feedu && feedr) {
// if (id == getActiveFeedId())
// console.log("HAS CTR: " + feedu.innerHTML + " GOT CTR: " + ctr +
// " IS_SCHED: " + scheduled_call);
if (parseInt(ctr) > 0 &&
parseInt(feedu.innerHTML) < parseInt(ctr) &&
id == getActiveFeedId() && scheduled_call) {
displayNewContentPrompt(id);
}
var row_needs_hl = (ctr > 0 && ctr > parseInt(feedu.innerHTML));
feedu.innerHTML = ctr;
if (error) {
feedr.removeClassName("feed");
feedr.addClassName("error");
} else if (id > 0) {
feedr.removeClassName("error");
feedr.addClassName("feed");
}
if (ctr > 0) {
feedctr.addClassName("Unread");
feedr.addClassName("Unread");
if (row_needs_hl &&
!getInitParam("theme_options").match('no_highlights')) {
new Effect.Highlight(feedr, {duration: 1, startcolor: "#fff7d5",
queue: { position:'end', scope: 'EFQ-' + id, limit: 1 } } );
cache_invalidate("F:" + id);
}
} else {
feedctr.removeClassName("Unread");
feedr.removeClassName("Unread");
}
} */
}
hideOrShowFeeds(getInitParam("hide_read_feeds") == 1);
var feeds_stored = number_of_feeds;
//console.log("Feed counters, C: " + feeds_found + ", S:" + feeds_stored);
if (feeds_stored != feeds_found) {
number_of_feeds = feeds_found;
@ -698,12 +520,6 @@ function parse_counters(reply, scheduled_call) {
console.log("Subscribed feed number changed, refreshing feedlist");
setTimeout('updateFeedList()', 50);
}
} else {
/* var fl = $("feeds-frame").innerHTML;
if (fl) {
cache_invalidate("FEEDLIST");
cache_inject("FEEDLIST", fl, getInitParam("num_feeds"));
} */
}
} catch (e) {
@ -711,23 +527,25 @@ function parse_counters(reply, scheduled_call) {
}
}
function get_feed_unread(id) {
function get_feed_unread(feed, is_cat) {
try {
return parseInt($("FEEDU-" + id).innerHTML);
if (is_cat)
treeItem = treeModel.store._itemsByIdentity['CAT:' + feed];
else
treeItem = treeModel.store._itemsByIdentity['FEED:' + feed];
if (treeItem)
return treeModel.store.getValue(treeItem, 'unread');
} catch (e) {
return -1;
//
}
return -1;
}
function get_cat_unread(id) {
try {
var ctr = $("FCATCTR-" + id).innerHTML;
ctr = ctr.replace("(", "");
ctr = ctr.replace(")", "");
return parseInt(ctr);
} catch (e) {
return -1;
}
return get_feed_unread(id, true);
}
function get_feed_entry_unread(elem) {
@ -810,6 +628,33 @@ function resort_feedlist() {
}
function hideOrShowFeeds(hide) {
var tree = dijit.byId("feedTree");
if (getInitParam("enable_feed_cats")) {
var cats = tree.model.store._arrayOfTopLevelItems;
cats.each(function(cat) {
var cat_unread = hideOrShowFeedsCategory(cat.items, hide);
var id = String(cat.id);
var node = tree._itemNodesMap[id];
if (node) {
if (hide && cat_unread == 0) {
Effect.Fade(node[0].rowNode, {duration : 0.3,
queue: { position: 'end', scope: 'FFADE-' + id, limit: 1 }});
} else {
Element.show(node[0].rowNode);
++cat_unread;
}
}
});
} else {
hideOrShowFeedsCategory(tree.model.store._arrayOfTopLevelItems, hide);
}
/* try {
@ -830,10 +675,33 @@ function hideOrShowFeeds(hide) {
} */
}
function hideOrShowFeedsCategory(cat_id, hide) {
function hideOrShowFeedsCategory(feeds, hide) {
try {
//console.warn("hideOrShowFeedsCategory: function not implemented");
var tree = dijit.byId("feedTree");
var cat_unread = 0;
var nodes;
feeds.each(function(feed) {
var id = String(feed.id);
var bare_id = parseInt(id.substr(id.indexOf(":")+1));
var unread = feed.unread[0];
var node = tree._itemNodesMap[id];
if (node) {
if (hide && unread == 0 && (bare_id > 0 || !getInitParam("hide_read_shows_special"))) {
Effect.Fade(node[0].rowNode, {duration : 0.3,
queue: { position: 'end', scope: 'FFADE-' + id, limit: 1 }});
} else {
Element.show(node[0].rowNode);
++cat_unread;
}
}
});
return cat_unread;
/* var nodes;
var cat_node;
if (cat_id) {
@ -869,26 +737,33 @@ function hideOrShowFeedsCategory(cat_id, hide) {
} else {
Element.show(cat_node);
}
}
} */
} catch (e) {
exception_error("hideOrShowFeedsCategory", e);
}
}
function getFeedName(id, is_cat) {
var e;
function getFeedName(feed, is_cat) {
return getFeedValue(feed, is_cat, 'name');
}
if (is_cat) {
e = $("FCATN-" + id);
} else {
e = $("FEEDN-" + id);
}
if (e) {
return e.innerHTML.stripTags();
} else {
return '';
function getFeedValue(feed, is_cat, key) {
try {
if (is_cat)
treeItem = treeModel.store._itemsByIdentity['CAT:' + feed];
else
treeItem = treeModel.store._itemsByIdentity['FEED:' + feed];
if (treeItem)
return treeModel.store.getValue(treeItem, key);
} catch (e) {
//
}
return '';
}
function getNextUnreadCat(id) {
@ -986,29 +861,55 @@ function getRelativeFeedId2(id, is_cat, direction, unread_only) {
}
}
function clean_feed_selections() {
try {
$$("#feedList li").invoke('removeClassName', 'Selected');
} catch (e) {
exception_error("clean_feed_selections", e);
}
}
function feedsSortByUnread() {
return feeds_sort_by_unread;
}
function setFeedUnread(feed, is_cat, unread) {
try {
setFeedValue(feed, is_cat, 'unread', parseInt(unread));
} catch (e) {
exception_error("setFeedUnread", e);
}
}
function setFeedValue(feed, is_cat, key, value) {
try {
if (!value) value = '';
if (is_cat)
treeItem = treeModel.store._itemsByIdentity['CAT:' + feed];
else
treeItem = treeModel.store._itemsByIdentity['FEED:' + feed];
if (treeItem)
treeModel.store.setValue(treeItem, 'unread', parseInt(unread));
treeModel.store.setValue(treeItem, key, value);
} catch (e) {
exception_error("setFeedUnread", e);
exception_error("setFeedValue", e);
}
}
function toggleCollapseCat(id) {
console.warn("toggleCollapseCat: function not implemented");
}
function selectFeed(feed, is_cat) {
try {
var tree = dijit.byId("feedTree");
if (is_cat)
treeNode = tree._itemNodesMap['CAT:' + feed];
else
treeNode = tree._itemNodesMap['FEED:' + feed];
if (treeNode) {
treeNode = treeNode[0];
tree._expandNode(treeNode);
tree._selectNode(treeNode);
}
} catch (e) {
exception_error("selectFeed", e);
}
}

View File

@ -4117,25 +4117,119 @@
# print "<div class=\"headlinesSubToolbar\">";
$page_prev_link = "javascript:viewFeedGoPage(-1)";
$page_next_link = "javascript:viewFeedGoPage(1)";
$page_first_link = "javascript:viewFeedGoPage(0)";
$page_prev_link = "viewFeedGoPage(-1)";
$page_next_link = "viewFeedGoPage(1)";
$page_first_link = "viewFeedGoPage(0)";
$catchup_page_link = "javascript:catchupPage()";
$catchup_feed_link = "javascript:catchupCurrentFeed()";
$catchup_sel_link = "javascript:catchupSelection()";
$catchup_page_link = "catchupPage()";
$catchup_feed_link = "catchupCurrentFeed()";
$catchup_sel_link = "catchupSelection()";
$archive_sel_link = "javascript:archiveSelection()";
$delete_sel_link = "javascript:deleteSelection()";
$archive_sel_link = "archiveSelection()";
$delete_sel_link = "deleteSelection()";
$sel_all_link = "javascript:selectArticles('all')";
$sel_unread_link = "javascript:selectArticles('unread')";
$sel_none_link = "javascript:selectArticles('none')";
$sel_inv_link = "javascript:selectArticles('invert')";
$sel_all_link = "selectArticles('all')";
$sel_unread_link = "selectArticles('unread')";
$sel_none_link = "selectArticles('none')";
$sel_inv_link = "selectArticles('invert')";
$tog_unread_link = "javascript:selectionToggleUnread()";
$tog_marked_link = "javascript:selectionToggleMarked()";
$tog_published_link = "javascript:selectionTogglePublished()";
$tog_unread_link = "selectionToggleUnread()";
$tog_marked_link = "selectionToggleMarked()";
$tog_published_link = "selectionTogglePublished()";
print "<div id=\"subtoolbar_main\">";
print __('Select:')."
<a href=\"#\" onclick=\"$sel_all_link\">".__('All')."</a>,
<a href=\"#\" onclick=\"$sel_unread_link\">".__('Unread')."</a>,
<a href=\"#\" onclick=\"$sel_inv_link\">".__('Invert')."</a>,
<a href=\"#\" onclick=\"$sel_none_link\">".__('None')."</a></li>";
print " ";
/* print "<span
onmouseover=\"enable_selection(false)\"
onmouseout=\"enable_selection(true)\"
onclick=\"toggleHeadlineActions()\" id=\"headlineActionsDrop\">".
__("Actions...") . "&nbsp;&nbsp;<img width='11' height'7'
src=\"images/down_arrow.png\">
</span>";
print "<ul id=\"headlineActionsBody\" style=\"display : none\">";
print "<li class=\"insensitive\">".__('Selection toggle:')."</li>
<li onclick=\"$tog_unread_link\">&nbsp;&nbsp;".__('Unread')."</li>
<li onclick=\"$tog_marked_link\">&nbsp;&nbsp;".__('Starred')."</li>
<li onclick=\"$tog_published_link\">&nbsp;&nbsp;".__('Published')."</li>
<li class=\"insensitive\">".__('Selection:')."</li>
<li onclick=\"$catchup_sel_link\">&nbsp;&nbsp;".__('Mark as read')."</li>";
// print "<li onclick=\"$catchup_feed_link\">&nbsp;&nbsp;".__('Entire feed').
// "</li>";
if ($feed_id != "0") {
print "<li onclick=\"$archive_sel_link\">&nbsp;&nbsp;".__('Archive')."</li>";
} else {
print "<li onclick=\"$archive_sel_link\">&nbsp;&nbsp;".__('Move back')."</li>";
print "<li onclick=\"$delete_sel_link\">&nbsp;&nbsp;".__('Delete')."</li>";
}
print "<li onclick=\"emailArticle(false)\">&nbsp;&nbsp;".
__('Forward by email')."</li>";
//print "<li><span class=\"insensitive\">--------</span></li>";
print "<li class=\"insensitive\">".__('Assign label:')."</li>";
print_labels_headlines_dropdown($link, $feed_id);
print "<li class=\"insensitive\">".__('Feed:')."</li>";
print "<li onclick=\"displayDlg('generatedFeed', '$feed_id:$is_cat:$rss_link')\">&nbsp;&nbsp;".__('View as RSS')."</li>";
print "</ul>"; */
print "<select dojoType=\"dijit.form.Select\"
onchange=\"headlineActionsChange(this)\">";
print "<option value=\"\">".__('Actions...')."</option>";
# print "<optgroup label=\"".__("Selection toggle:")."\">";
print "<option value=\"$tog_unread_link\">".__('Toggle unread')."</option>
<option value=\"$tog_marked_link\">".__('Toggle starred')."</option>
<option value=\"$tog_published_link\">".__('Toggle published')."</option>";
# print "</optgroup>
# <optgroup label=\"".__("Selection:")."\">";
print "<option>----------</option>";
print "<option value=\"$catchup_sel_link\">".__('Mark as read')."</option>";
if ($feed_id != "0") {
print "<option value=\"$archive_sel_link\">".__('Archive')."</option>";
} else {
print "<option value=\"$archive_sel_link\">".__('Move back')."</option>";
print "<option value=\"$delete_sel_link\">".__('Delete')."</option>";
}
print "<option value=\"emailArticle(false)\">".__('Forward by email').
"</option>";
# print "<optgroup label=\"".__("Assign label:")."\">";
print "<option>----------</option>";
print_labels_headlines_dropdown($link, $feed_id);
print "<option>----------</option>";
# print "</optgroup>";
print "<option value=\"displayDlg('generatedFeed', '$feed_id:$is_cat:$rss_link')\">".__('View as RSS')."</option>";
print "</select>";
print "</div>";
print "<div id=\"subtoolbar_ftitle\">";
@ -4197,56 +4291,6 @@
print "</div>";
print __('Select:')."
<a href=\"#\" onclick=\"$sel_all_link\">".__('All')."</a>,
<a href=\"#\" onclick=\"$sel_unread_link\">".__('Unread')."</a>,
<a href=\"#\" onclick=\"$sel_inv_link\">".__('Invert')."</a>,
<a href=\"#\" onclick=\"$sel_none_link\">".__('None')."</a></li>";
print "&nbsp;&nbsp;";
print "<span
onmouseover=\"enable_selection(false)\"
onmouseout=\"enable_selection(true)\"
onclick=\"toggleHeadlineActions()\" id=\"headlineActionsDrop\">".
__("Actions...") . "&nbsp;&nbsp;<img width='11' height'7'
src=\"images/down_arrow.png\">
</span>";
print "<ul id=\"headlineActionsBody\" style=\"display : none\">";
print "<li class=\"insensitive\">".__('Selection toggle:')."</li>
<li onclick=\"$tog_unread_link\">&nbsp;&nbsp;".__('Unread')."</li>
<li onclick=\"$tog_marked_link\">&nbsp;&nbsp;".__('Starred')."</li>
<li onclick=\"$tog_published_link\">&nbsp;&nbsp;".__('Published')."</li>
<li class=\"insensitive\">".__('Selection:')."</li>
<li onclick=\"$catchup_sel_link\">&nbsp;&nbsp;".__('Mark as read')."</li>";
// print "<li onclick=\"$catchup_feed_link\">&nbsp;&nbsp;".__('Entire feed').
// "</li>";
if ($feed_id != "0") {
print "<li onclick=\"$archive_sel_link\">&nbsp;&nbsp;".__('Archive')."</li>";
} else {
print "<li onclick=\"$archive_sel_link\">&nbsp;&nbsp;".__('Move back')."</li>";
print "<li onclick=\"$delete_sel_link\">&nbsp;&nbsp;".__('Delete')."</li>";
}
print "<li onclick=\"emailArticle(false)\">&nbsp;&nbsp;".
__('Forward by email')."</li>";
//print "<li><span class=\"insensitive\">--------</span></li>";
print "<li class=\"insensitive\">".__('Assign label:')."</li>";
print_labels_headlines_dropdown($link, $feed_id);
print "<li class=\"insensitive\">".__('Feed:')."</li>";
print "<li onclick=\"displayDlg('generatedFeed', '$feed_id:$is_cat:$rss_link')\">&nbsp;&nbsp;".__('View as RSS')."</li>";
print "</ul>";
# print "</div>";
}
function printCategoryHeader($link, $cat_id, $hidden = false, $can_browse = true,
@ -4437,8 +4481,10 @@
$cat = feedlist_init_cat($link, $cat_id, $collapsed);
}
$updated = make_local_datetime($link, $line["updated_noms"], false);
array_push($cat['items'], feedlist_init_feed($link, $feed_id,
$feed, $unread));
$feed, $unread, $line['last_error'], $updated));
}
if (!$enable_cats) {
@ -6294,8 +6340,7 @@
}
function print_labels_headlines_dropdown($link, $feed_id) {
print "<li onclick=\"javascript:addLabel()\">
&nbsp;&nbsp;".__("Create label...")."</li>";
print "<option value=\"addLabel()\">".__("Create label...")."</option>";
$result = db_query($link, "SELECT id, caption FROM ttrss_labels2 WHERE
owner_uid = '".$_SESSION["uid"]."' ORDER BY caption");
@ -6307,13 +6352,13 @@
$id = $line["id"];
if ($feed_id < -10 && $feed_id == -11-$label_id) {
print "<li id=\"LHDL-$id\"
onclick=\"javascript:selectionRemoveLabel($label_id)\">
&nbsp;&nbsp;$label_caption ".__('(remove)')."</li>";
print "<option id=\"LHDL-$id\"
value=\"selectionRemoveLabel($label_id)\">".
__('Remove:') . " $label_caption</option>";
} else {
print "<li id=\"LHDL-$id\"
onclick=\"javascript:selectionAssignLabel($label_id)\">
&nbsp;&nbsp;$label_caption</li>";
print "<option id=\"LHDL-$id\"
value=\"selectionAssignLabel($label_id)\">".
__('Assign:') . " $label_caption</option>";
}
}
}
@ -6397,10 +6442,12 @@
return $str;
}
function toggle_collapse_cat($link, $cat_id) {
function toggle_collapse_cat($link, $cat_id, $mode) {
if ($cat_id > 0) {
$mode = bool_to_sql_bool($mode);
db_query($link, "UPDATE ttrss_feed_categories SET
collapsed = NOT collapsed WHERE id = '$cat_id' AND owner_uid = " .
collapsed = $mode WHERE id = '$cat_id' AND owner_uid = " .
$_SESSION["uid"]);
} else {
$pref_name = '';
@ -6418,10 +6465,10 @@
}
if ($pref_name) {
if (get_pref($link, $pref_name)) {
set_pref($link, $pref_name, 'false');
} else {
if ($mode) {
set_pref($link, $pref_name, 'true');
} else {
set_pref($link, $pref_name, 'false');
}
}
}
@ -7145,7 +7192,7 @@
$cat_unread = getCategoryUnread($link, $cat_id);
}
$obj['id'] = 'CAT:' . $cat_id;
$obj['id'] = 'CAT:' . ((int)$cat_id);
$obj['items'] = array();
$obj['name'] = getCategoryTitle($link, $cat_id);
$obj['type'] = 'feed';
@ -7155,7 +7202,7 @@
return $obj;
}
function feedlist_init_feed($link, $feed_id, $title = false, $unread = false) {
function feedlist_init_feed($link, $feed_id, $title = false, $unread = false, $error = '', $updated = '') {
$obj = array();
if (!$title)
@ -7168,6 +7215,8 @@
$obj['name'] = $title;
$obj['unread'] = (int) $unread;
$obj['type'] = 'feed';
$obj['error'] = $error;
$obj['updated'] = $updated;
return $obj;
}

View File

@ -1162,6 +1162,14 @@ function init() {
try {
//dojo.require("dijit.layout.BorderContainer");
//dojo.require("dijit.layout.ContentPane");
dojo.require("dijit.Dialog");
dojo.require("dijit.form.Button");
//dojo.require("dojo.data.ItemFileReadStore");
//dojo.require("dojo.data.ItemFileWriteStore");
//dojo.require("dijit.Tree");
loading_set_progress(30);
var query = "?op=rpc&subop=sanityCheck";
@ -1241,7 +1249,7 @@ function pref_hotkey_handler(e) {
closeInfoBox();
}
if (!hotkeys_enabled) {
if (dialogs.length > 0 || !hotkeys_enabled) {
console.log("hotkeys disabled");
return;
}

View File

@ -25,7 +25,7 @@
<head>
<title>Tiny Tiny RSS : Preferences</title>
<link rel="stylesheet" type="text/css" href="tt-rss.css?<?php echo $dt_add ?>"/>
<link rel="stylesheet" type="text/css" href="lib/modalbox/modalbox.css"/>
<link rel="stylesheet" type="text/css" href="lib/dijit/themes/claro/claro.css"/>
<?php $user_theme = get_user_theme_path($link);
if ($user_theme) { ?>
@ -42,7 +42,7 @@
<script type="text/javascript" src="lib/prototype.js"></script>
<script type="text/javascript" src="lib/position.js"></script>
<script type="text/javascript" src="lib/scriptaculous/scriptaculous.js?load=effects,dragdrop,controls"></script>
<script type="text/javascript" src="lib/modalbox/modalbox.js"></script>
<script type="text/javascript" src="lib/dojo/dojo.js" djConfig="parseOnLoad: true"></script>
<script type="text/javascript" charset="utf-8" src="localized_js.php?<?php echo $dt_add ?>"></script>
@ -61,7 +61,7 @@
</head>
<body id="ttrssPrefs">
<body id="ttrssPrefs" class="claro">
<div id="overlay">
<div id="overlay_inner">

View File

@ -1,4 +1,4 @@
body#ttrssMain {
body#ttrssMain, body#ttrssPrefs {
background : white;
color : black;
margin : 0px;
@ -106,130 +106,6 @@ div.postReply span.author {
font-size : 12px;
}
ul.feedList span.feedlink:hover {
cursor : pointer;
color : #4684ff;
}
ul.feedList img.hlLoading {
margin-left : 5px;
vertical-align : middle;
height : 10px;
}
ul.feedList {
list-style-type : none;
margin : 5px 5px 5px 0px;
padding : 0px 0px 0px 5px;
font-size : 12px;
}
ul.feedList li.feedCat, ul.feedList li.virtCat {
margin : 0px;
padding : 3px 0px 3px 0px;
color : #707070;
font-size : 12px;
}
ul.feedList img.catCollapse {
cursor : pointer;
vertical-align : middle;
width : 11px;
height : 11px;
padding-bottom : 3px;
}
ul.feedList span.catTitle {
color : #707070;
cursor : pointer;
}
ul.feedList span.catTitle:hover {
color : #4684ff;
}
ul.feedList li.feedCat.Selected {
margin : 0px;
padding : 3px 0px 3px 0px;
color : #4684ff;
font-size : 12px;
}
ul.feedList li.feedCat.Selected span.catTitle {
color : #4684ff;
cursor : pointer;
}
ul.feedCatList {
list-style-type : none;
margin : 0px 0px 0px 20px;
padding : 0px;
}
ul.feedCatList li {
margin : 0px;
padding : 0px 0px 2px 0px;
color : black;
}
ul.feedList > li {
padding : 0px 0px 2px 0px;
}
ul.feedCatList img, ul.feedList img {
vertical-align : bottom;
}
li.feed.Unread,
li.error.Unread,
li.label.Unread,
li.virt.Unread,
li.tag.Unread {
font-weight : bold;
}
li.error.Selected span.feedlink,
li.error span.feedlink,
li.error.Unread span.feedlink,
li.error.Unread.Selected span.feedlink {
color : #f04040;
}
li.feed.Selected span.feedlink,
li.label.Selected span.feedlink,
li.virt.Selected span.feedlink,
li.tag.Selected span.feedlink {
color : #4684ff;
}
li.feed.Unread.Selected span.feedlink,
li.label.Unread.Selected span.feedlink,
li.virt.Unread.Selected span.feedlink,
li.tag.Unread.Selected span.feedlink {
color : #4684ff;
}
li.feed.Unread.Selected,
li.error.Unread.Selected,
li.label.Unread.Selected,
li.virt.Unread.Selected,
li.tag.Unread.Selected {
font-weight : bold;
}
li.feed {
display : block;
}
ul.feedList img, img.tinyFeedIcon {
margin : 0px 3px 0px 0px;
width : 16px;
height : 16px;
vertical-align : middle;
border-width : 0px;
}
h1 {
font-size : 18px;
}
@ -684,18 +560,29 @@ div#headlines-toolbar {
font-size : 11px;
font-family : "Lucida Grande", "Segoe UI", Tahoma, Arial, sans-serif;
color : gray;
padding : 0px 5px 0px 0px;
padding : 0px;
margin : 0px;
overflow : hidden;
height : 21px;
}
/* div.headlines-toolbar * {
line-height : normal;
} */
div#headlines-toolbar .dijitSelect {
font-size : 11px;
}
div#headlines-toolbar div#subtoolbar_main {
display : table-cell;
width : 100%;
white-space : nowrap;
vertical-align : middle;
}
div#headlines-toolbar div#subtoolbar_ftitle {
float : right;
/* line-height : 20px; */
display : table-cell;
text-align : right;
vertical-align : middle;
white-space : nowrap;
padding-right : 5px;
}
span.contentPreview {
@ -932,7 +819,9 @@ form {
#main_toolbar_form {
margin : 0px;
padding : 0px;
display : inline;
display : table-cell;
white-space : nowrap;
width : 100%;
}
div.feedExtInfo {
@ -1027,120 +916,23 @@ div.whiteBox {
padding : 1em;
}
html, body, #main {
html, body#ttrssMain, #main {
width: 100%;
height: 100%;
border: 0;
padding: 0;
margin: 0;
}
}
#toolbar div.actionChooser {
/* margin-right : 5px; */
float : right;
display : table-cell;
text-align : right;
padding-right : 5px;
}
/* layout */
/* preferences layout */
/* #header {
position : absolute;
white-space: nowrap;
top : 5px;
left : 15px;
right : 5px;
height : 35px;
color : #4684ff;
font-size : 12px;
}
#feeds-holder {
border-width : 1px 1px 0px 0px;
border-style : solid solid;
border-color : #C4D1E4 #88b0f0;
top : 40px;
left : 0px;
position : absolute;
width : 260px;
overflow : auto;
bottom : 0px;
border-collapse : collapse;
}
#toolbar div.actionChooser {
margin-right : 5px;
float : right;
}
#toolbar {
position : absolute;
left : 261px;
padding : 0px 0px 0px 10px;
top : 40px;
right : 0px;
white-space: nowrap;
height : 30px;
background-image : url("images/toolbar.png");
background-position : bottom left;
background-repeat : repeat-x;
font-size : 12px;
}
#toolbar input {
vertical-align : middle;
}
div.headlines_normal {
position : absolute;
border-width : 1px 0px 0px 0px;
border-style : solid;
border-color : #88b0f0;
left : 261px;
height : 305px;
top : 70px;
right : 0px;
overflow : hidden;
font-size : 12px;
border-collapse : collapse;
}
div.headlines_cdm {
position : absolute;
border-width : 1px 0px 1px 0px;
border-style : solid;
border-color : #88b0f0;
left : 261px;
bottom : 40px;
top : 70px;
right : 0px;
overflow : hidden;
font-size : 12px;
border-collapse : collapse;
}
#content-frame {
position : absolute;
border-width : 1px 0px 0px 0px;
border-style : solid;
border-color : #88b0f0;
overflow : auto;
top : 390px;
left : 261px;
bottom : 40px;
right : 0px;
border-collapse : collapse;
}
#resize-grabber {
height : 5px;
border-width : 0px 0px 1px 0px;
border-style : solid;
border-color : #88b0f0;
background : url("images/resize_horiz.png") top left;
cursor : move;
text-align : center;
}
#footer, #prefFooter {
#prefFooter {
position : absolute;
bottom : 0px;
height : 20px;
@ -1173,26 +965,6 @@ div.headlines_cdm {
color : black;
}
#headlinesContainer {
margin-left : 0px;
background-color : white;
}
#headlineActionsTop {
font-size : 12px;
}
#headlinesInnerContainer {
overflow : auto;
position : absolute;
left : 0px;
right : 0px;
bottom : 0px;
top : 25px;
} */
/* preferences layout */
#prefHeader {
color : #4684ff;
font-size : 12px;
@ -1243,40 +1015,16 @@ div.return a:hover {
}
#userSwitch {
position : absolute;
bottom : 2px;
right : 2px;
}
.catCtr.Unread, .feedCtr.Unread {
font-weight : bold;
color : #707070;
display : inline;
}
.catCtr, .feedCtr {
display : none;
}
div.topLinks img {
vertical-align : middle;
cursor : pointer;
}
#offlineModePic {
margin-left : 5px;
}
a.helpLinkPic img {
border-width : 0px;
vertical-align : middle;
}
li.feedCatHolder {
display : inline;
}
table.prefFeedCatList {
background-color : white;
}
@ -1524,53 +1272,6 @@ pre, code {
font-family : monospace;
}
span#headlineActionsDrop {
border : 1px solid #c0c0c0;
padding : 1px 5px 1px 10px;
color : #063064;
cursor : pointer;
}
ul#headlineActionsBody {
list-style-type : none;
position : absolute;
margin : 0px;
padding : 0px;
background-color : white;
width : 150px;
z-index : 4;
top : auto;
left : auto;
border-width : 1px 1px 1px 1px;
border-color : #c0c0c0;
border-style : solid;
margin-left : -1px;
max-height : 250px;
overflow : auto;
}
ul#headlineActionsBody li {
padding : 2px 5px 2px 10px;
color : black;
}
ul#headlineActionsBody li:hover {
color : #4684ff;
cursor : pointer;
background : #ecf4ff;
}
ul#headlineActionsBody li.insensitive {
color : gray;
}
ul#headlineActionsBody li.insensitive:hover {
background : white;
cursor : normal;
color : gray;
}
span.prefsLabelEntry {
padding : 2px;
}
@ -1619,29 +1320,6 @@ div.colorPicker {
color : #909090;
}
div#offlineModeDrop div {
padding : 2px 2px 2px 2px;
text-align : left;
}
div#offlineModeDrop {
position : absolute;
margin : 0px;
padding : 2px;
background-color : white;
z-index : 2;
margin : 2px 0px 0px 0px;
top : auto;
right : 0px;
border : 1px solid #cccccc;
background : white;
min-width : 170px;
margin-left : -1px;
max-height : 250px;
overflow : auto;
color : #909090;
}
optgroup {
color : #4684ff;
font-style : normal;
@ -1711,6 +1389,11 @@ div.hlRight {
vertical-align : middle;
}
div.hlRight img {
max-width : 16px;
max-height : 16px;
}
span.hlUpdated {
color : gray;
font-weight : medium;
@ -1764,6 +1447,9 @@ div.fatalError textarea {
#feeds-holder {
padding : 0px;
border-color : #88b0f0;
border-left-width : 0px;
border-bottom-width : 0px;
}
#headlines-wrap-inner {
@ -1774,6 +1460,8 @@ div.fatalError textarea {
#headlines-frame {
padding : 0px;
border-color : #88b0f0;
border-right-width : 0px;
}
#headlinesInnerContainer {
@ -1802,10 +1490,19 @@ div.fatalError textarea {
#content-insert {
padding : 0px;
border-color : #88b0f0;
border-bottom-width : 0px;
border-right-width : 0px;
}
.dijitTreeLabel.Unread {
font-weight : bold;
}
.dijitTreeRow.Error {
color : red;
}
.dijitTreeRow.Hidden {
display : none;
}

103
tt-rss.js
View File

@ -38,13 +38,14 @@ function getActiveFeedId() {
function setActiveFeedId(id, is_cat) {
try {
//console.log("sAFID(" + id + ", " + is_cat + ")");
_active_feed_id = id;
if (is_cat != undefined) {
_active_feed_is_cat = is_cat;
}
selectFeed(id, is_cat);
} catch (e) {
exception_error("setActiveFeedId", e);
}
@ -92,13 +93,13 @@ function dlg_frefresh_callback(transport, deleted_feed) {
setTimeout("viewfeed(-5)", 100);
}
setTimeout('updateFeedList(false, false)', 50);
setTimeout('updateFeedList()', 50);
closeInfoBox();
}
function updateFeedList() {
try {
console.log("updateFeedList");
console.warn("updateFeedList: function not implemented");
/* var query_str = "backend.php?op=feeds";
@ -245,9 +246,10 @@ function init() {
dojo.require("dijit.layout.ContentPane");
dojo.require("dijit.Dialog");
dojo.require("dijit.form.Button");
dojo.require("dojo.data.ItemFileReadStore");
dojo.require("dojo.data.ItemFileWriteStore");
dojo.require("dijit.Tree");
dojo.require("dijit.form.Select");
dojo.require("dojo.parser");
dojo.addOnLoad(function() {
@ -274,6 +276,10 @@ function init() {
getLabelClass: function (item, opened) {
return (item.unread == 0) ? "dijitTreeLabel" : "dijitTreeLabel Unread";
},
getRowClass: function (item, opened) {
return (!item.error || item.error == '') ? "dijitTreeRow" :
"dijitTreeRow Error";
},
getLabel: function(item) {
if (item.unread > 0) {
return item.name + " (" + item.unread + ")";
@ -281,6 +287,23 @@ function init() {
return item.name;
}
},
onOpen: function (item, node) {
var id = String(item.id);
var cat_id = id.substr(id.indexOf(":")+1);
new Ajax.Request("backend.php",
{ parameters: "backend.php?op=feeds&subop=collapse&cid=" +
param_escape(cat_id) + "&mode=1" } );
},
onClose: function (item, node) {
var id = String(item.id);
var cat_id = id.substr(id.indexOf(":")+1);
new Ajax.Request("backend.php",
{ parameters: "backend.php?op=feeds&subop=collapse&cid=" +
param_escape(cat_id) + "&mode=0" } );
},
onClick: function (item, node) {
var id = String(item.id);
var is_cat = id.match("^CAT:");
@ -323,16 +346,15 @@ function init_second_stage() {
feeds_sort_by_unread = getInitParam("feeds_sort_by_unread") == 1;
remove_splash();
feedlist_init();
console.log("second stage ok");
loading_set_progress(60);
if (has_local_storage())
localStorage.clear();
console.log("second stage ok");
feedlist_init();
} catch (e) {
exception_error("init_second_stage", e);
}
@ -626,69 +648,10 @@ function feedEditSave() {
function collapse_feedlist() {
try {
//console.log("collapse_feedlist");
/* var theme = getInitParam("theme");
if (theme != "" &&
!getInitParam("theme_options").match("collapse_feedlist")) return;
var fl = $("feeds-holder");
var fh = $("headlines-frame");
var fc = $("content-frame");
var ft = $("toolbar");
var ff = $("footer");
var fhdr = $("header");
var fbtn = $("collapse_feeds_btn");
if (!Element.visible(fl)) {
Element.show(fl);
fbtn.innerHTML = "&lt;&lt;";
if (theme != "graycube") {
fh.style.left = fl.offsetWidth + "px";
ft.style.left = fl.offsetWidth + "px";
if (fc) fc.style.left = fl.offsetWidth + "px";
if (ff && theme != "compat") ff.style.left = (fl.offsetWidth-1) + "px";
if (theme == "compact") fhdr.style.left = (fl.offsetWidth + 10) + "px";
} else {
fh.style.left = fl.offsetWidth + 40 + "px";
ft.style.left = fl.offsetWidth + 40 +"px";
if (fc) fc.style.left = fl.offsetWidth + 40 + "px";
}
query = "?op=rpc&subop=setpref&key=_COLLAPSED_FEEDLIST&value=false";
new Ajax.Request("backend.php", { parameters: query });
} else {
Element.hide(fl);
fbtn.innerHTML = "&gt;&gt;";
if (theme != "graycube") {
fh.style.left = "0px";
ft.style.left = "0px";
if (fc) fc.style.left = "0px";
if (ff) ff.style.left = "0px";
if (theme == "compact") fhdr.style.left = "10px";
} else {
fh.style.left = "20px";
ft.style.left = "20px";
if (fc) fc.style.left = "20px";
}
query = "?op=rpc&subop=setpref&key=_COLLAPSED_FEEDLIST&value=true";
new Ajax.Request("backend.php", { parameters: query });
} */
console.warn("collapse_feedlist: function not implemented");
query = "?op=rpc&subop=setpref&key=_COLLAPSED_FEEDLIST&value=true";
new Ajax.Request("backend.php", { parameters: query });
} catch (e) {
exception_error("collapse_feedlist", e);

View File

@ -131,37 +131,6 @@
<div id="toolbar" dojoType="dijit.layout.ContentPane" region="top">
<div class="actionChooser">
<select id="quickMenuChooser" onchange="quickMenuChange()">
<option value="qmcDefault" selected="selected"><?php echo __('Actions...') ?></option>
<option value="qmcSearch"><?php echo __('Search...') ?></option>
<optgroup label="<?php echo __('Feed actions:') ?>">
<option value="qmcAddFeed"><?php echo __('Subscribe to feed...') ?></option>
<option value="qmcEditFeed"><?php echo __('Edit this feed...') ?></option>
<option value="qmcRescoreFeed"><?php echo __('Rescore feed') ?></option>
<option value="qmcRemoveFeed"><?php echo __('Unsubscribe') ?></option>
</optgroup>
<optgroup label="<?php echo __('All feeds:') ?>">
<option value="qmcCatchupAll"><?php echo __('Mark as read') ?></option>
<option value="qmcShowOnlyUnread"><?php echo __('(Un)hide read feeds') ?></option>
</optgroup>
<optgroup label="<?php echo __('Categories:') ?>">
<option value="qmcToggleReorder"><?php echo __('Toggle reordering mode') ?></option>
<option value="qmcResetCats"><?php echo __('Reset order') ?></option>
</optgroup>
<optgroup label="<?php echo __('Other actions:') ?>">
<option value="qmcAddLabel"><?php echo __('Create label...') ?></option>
<option value="qmcAddFilter"><?php echo __('Create filter...') ?></option>
<option value="qmcResetUI"><?php echo __('Reset UI layout') ?></option>
<option value="qmcHKhelp"><?php echo __('Keyboard shortcuts help') ?></option>
</optgroup>
</select>
</div>
<form id="main_toolbar_form" action="" onsubmit='return false'>
<button id="collapse_feeds_btn" onclick="collapse_feedlist()"
@ -195,6 +164,37 @@
</form>
<div class="actionChooser">
<select id="quickMenuChooser" onchange="quickMenuChange()">
<option value="qmcDefault" selected="selected"><?php echo __('Actions...') ?></option>
<option value="qmcSearch"><?php echo __('Search...') ?></option>
<optgroup label="<?php echo __('Feed actions:') ?>">
<option value="qmcAddFeed"><?php echo __('Subscribe to feed...') ?></option>
<option value="qmcEditFeed"><?php echo __('Edit this feed...') ?></option>
<option value="qmcRescoreFeed"><?php echo __('Rescore feed') ?></option>
<option value="qmcRemoveFeed"><?php echo __('Unsubscribe') ?></option>
</optgroup>
<optgroup label="<?php echo __('All feeds:') ?>">
<option value="qmcCatchupAll"><?php echo __('Mark as read') ?></option>
<option value="qmcShowOnlyUnread"><?php echo __('(Un)hide read feeds') ?></option>
</optgroup>
<optgroup label="<?php echo __('Categories:') ?>">
<option value="qmcToggleReorder"><?php echo __('Toggle reordering mode') ?></option>
<option value="qmcResetCats"><?php echo __('Reset order') ?></option>
</optgroup>
<optgroup label="<?php echo __('Other actions:') ?>">
<option value="qmcAddLabel"><?php echo __('Create label...') ?></option>
<option value="qmcAddFilter"><?php echo __('Create filter...') ?></option>
<option value="qmcResetUI"><?php echo __('Reset UI layout') ?></option>
<option value="qmcHKhelp"><?php echo __('Keyboard shortcuts help') ?></option>
</optgroup>
</select>
</div>
</div>
<div id="headlines-wrap-inner" dojoType="dijit.layout.BorderContainer" region="center">
@ -216,13 +216,13 @@
</div>
</div>
<div id="footer" dojoType="dijit.layout.ContentPane" region="bottom">
<!-- <div id="footer" dojoType="dijit.layout.ContentPane" region="bottom">
<a href="http://tt-rss.org/">Tiny Tiny RSS</a>
<?php if (!defined('HIDE_VERSION')) { ?>
v<?php echo VERSION ?>
<?php } ?>
&copy; 2005&ndash;<?php echo date('Y') ?> <a href="http://fakecake.org/">Andrew Dolgov</a>
</div>
</div> -->
</div>

View File

@ -44,8 +44,6 @@ function headlines_callback2(transport, feed_cur_page) {
if (!transport_error_check(transport)) return;
clean_feed_selections();
var is_cat = false;
var feed_id = false;
@ -85,11 +83,9 @@ function headlines_callback2(transport, feed_cur_page) {
img.src = img.alt;
}
var f = $("headlines-frame");
try {
if (feed_cur_page == 0) {
//console.log("resetting headlines scrollTop");
f.scrollTop = 0;
$("headlines-frame").scrollTop = 0;
}
} catch (e) { };
@ -131,6 +127,7 @@ function headlines_callback2(transport, feed_cur_page) {
$("headlinesInnerContainer").innerHTML = headlines_content.firstChild.nodeValue;
$("headlines-toolbar").innerHTML = headlines_toolbar.firstChild.nodeValue;
dojo.parser.parse("headlines-toolbar");
dijit.byId("main").resize();
var cache_prefix = "";
@ -145,12 +142,12 @@ function headlines_callback2(transport, feed_cur_page) {
if (!disable_cache) {
cache_inject(cache_prefix + feed_id,
headlines.firstChild.nodeValue, headlines_unread);
$("headlines-frame").innerHTML, headlines_unread);
}
} else {
console.warn("headlines_callback: returned no data");
f.innerHTML = "<div class='whiteBox'>" + __('Could not update headlines (missing XML data)') + "</div>";
$('headlinesInnerContainer').innerHTML = "<div class='whiteBox'>" + __('Could not update headlines (missing XML data)') + "</div>";
}
} else {
@ -201,7 +198,7 @@ function headlines_callback2(transport, feed_cur_page) {
} else {
console.warn("headlines_callback: returned no XML object");
f.innerHTML = "<div class='whiteBox'>" + __('Could not update headlines (missing XML object)') + "</div>";
$('headlinesInnerContainer').innerHTML = "<div class='whiteBox'>" + __('Could not update headlines (missing XML object)') + "</div>";
}
@ -2237,4 +2234,15 @@ function correctHeadlinesOffset(id) {
}
function headlineActionsChange(elem) {
try {
var op = elem[elem.selectedIndex].value;
eval(op);
elem.selectedIndex = 0;
} catch (e) {
exception_error("headlineActionsChange", e);
}
}