From fcf70c510686a0b289f8f5e8713f959d95ae743b Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Mon, 15 Nov 2010 21:49:00 +0300 Subject: [PATCH] dijit.tree feedlist improvements --- backend.php | 3 +- feedlist.js | 369 +++++++++++++++++----------------------------- functions.php | 211 +++++++++++++++++---------- prefs.js | 10 +- prefs.php | 6 +- tt-rss.css | 397 ++++++-------------------------------------------- tt-rss.js | 103 +++++-------- tt-rss.php | 66 ++++----- viewfeed.js | 24 ++- 9 files changed, 408 insertions(+), 781 deletions(-) diff --git a/backend.php b/backend.php index 8e8fc91d..c69a8ff5 100644 --- a/backend.php +++ b/backend.php @@ -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; diff --git a/feedlist.js b/feedlist.js index 5b646785..5b3476e4 100644 --- a/feedlist.js +++ b/feedlist.js @@ -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 && 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 (kind != "cat") { + //setFeedValue(id, false, 'error', error); + setFeedValue(id, false, 'updated', 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); } } diff --git a/functions.php b/functions.php index 17bb9774..bf9c7264 100644 --- a/functions.php +++ b/functions.php @@ -4117,25 +4117,119 @@ # print "
"; - $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 "
"; + + print __('Select:')." + ".__('All').", + ".__('Unread').", + ".__('Invert').", + ".__('None').""; + + print " "; + +/* print "". + __("Actions...") . "   + "; + + print "
    "; + + print "
  • ".__('Selection toggle:')."
  • +
  •   ".__('Unread')."
  • +
  •   ".__('Starred')."
  • +
  •   ".__('Published')."
  • +
  • ".__('Selection:')."
  • +
  •   ".__('Mark as read')."
  • "; + +// print "
  •   ".__('Entire feed'). +// "
  • "; + + if ($feed_id != "0") { + print "
  •   ".__('Archive')."
  • "; + } else { + print "
  •   ".__('Move back')."
  • "; + print "
  •   ".__('Delete')."
  • "; + + } + + print "
  •   ". + __('Forward by email')."
  • "; + + //print "
  • --------
  • "; + print "
  • ".__('Assign label:')."
  • "; + + print_labels_headlines_dropdown($link, $feed_id); + + print "
  • ".__('Feed:')."
  • "; + print "
  •   ".__('View as RSS')."
  • "; + + print "
"; */ + + print ""; + + print "
"; print "
"; @@ -4197,56 +4291,6 @@ print "
"; - print __('Select:')." - ".__('All').", - ".__('Unread').", - ".__('Invert').", - ".__('None').""; - - print "  "; - - print "". - __("Actions...") . "   - "; - - print ""; - -# print "
"; } 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 "
  • -   ".__("Create label...")."
  • "; + print ""; $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 "
  • -   $label_caption ".__('(remove)')."
  • "; + print ""; } else { - print "
  • -   $label_caption
  • "; + print ""; } } } @@ -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; } diff --git a/prefs.js b/prefs.js index e6af5660..d858b6e7 100644 --- a/prefs.js +++ b/prefs.js @@ -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; } diff --git a/prefs.php b/prefs.php index 898840e3..12ad10f0 100644 --- a/prefs.php +++ b/prefs.php @@ -25,7 +25,7 @@ Tiny Tiny RSS : Preferences - + @@ -42,7 +42,7 @@ - + @@ -61,7 +61,7 @@ - +
    diff --git a/tt-rss.css b/tt-rss.css index aedec4ff..9c5dd79a 100644 --- a/tt-rss.css +++ b/tt-rss.css @@ -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; -} - -/* 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; + display : table-cell; + text-align : right; + padding-right : 5px; } -#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; -} +/* preferences layout */ -#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; +} diff --git a/tt-rss.js b/tt-rss.js index 133a93ab..d5905346 100644 --- a/tt-rss.js +++ b/tt-rss.js @@ -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 = "<<"; - - 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 = ">>"; - - 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); diff --git a/tt-rss.php b/tt-rss.php index 07fb1c24..3b61d521 100644 --- a/tt-rss.php +++ b/tt-rss.php @@ -131,37 +131,6 @@
    -
    - -
    -
    @@ -216,13 +216,13 @@
    - diff --git a/viewfeed.js b/viewfeed.js index 209e84eb..4c9edfbd 100644 --- a/viewfeed.js +++ b/viewfeed.js @@ -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 = "
    " + __('Could not update headlines (missing XML data)') + "
    "; + $('headlinesInnerContainer').innerHTML = "
    " + __('Could not update headlines (missing XML data)') + "
    "; } } else { @@ -201,7 +198,7 @@ function headlines_callback2(transport, feed_cur_page) { } else { console.warn("headlines_callback: returned no XML object"); - f.innerHTML = "
    " + __('Could not update headlines (missing XML object)') + "
    "; + $('headlinesInnerContainer').innerHTML = "
    " + __('Could not update headlines (missing XML object)') + "
    "; } @@ -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); + } +} -- 2.39.5