From 6b4163cb464534e827b4282f84541d86c8e19ec5 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Thu, 28 Sep 2006 13:00:03 +0100 Subject: [PATCH] css-based layout + required fixes --- backend.php | 110 +++++++++++++++++----------------- feedlist.js | 60 ++++++++----------- functions.js | 32 +++------- tt-rss.css | 143 +++++++++++++++++++++++++++++++++++--------- tt-rss.js | 23 ++++++-- tt-rss.php | 163 ++++++++++++++++----------------------------------- version.php | 2 +- viewfeed.js | 44 ++++++++++---- 8 files changed, 305 insertions(+), 272 deletions(-) diff --git a/backend.php b/backend.php index 719cb1b1..cfe322b7 100644 --- a/backend.php +++ b/backend.php @@ -124,7 +124,7 @@ function outputFeedList($link, $tags = false) { - print " +/* print " Tiny Tiny RSS : Feedlist "; @@ -159,7 +159,7 @@ document.addEventListener(\"DOMContentLoaded\", init, null); } window.onload = init; - "; + "; */ print ""; - print ' - '; +# print ' +# '; } @@ -520,7 +520,7 @@ FROM ttrss_entries,ttrss_user_entries WHERE id = '$id' AND ref_id = id AND owner_uid = " . $_SESSION["uid"]); - print " +/* print " Tiny Tiny RSS : Article $id "; @@ -544,7 +544,7 @@ - "; + "; */ if ($result) { @@ -669,7 +669,7 @@ "; } - print ""; +// print ""; } if ($op == "viewfeed") { @@ -683,7 +683,7 @@ if ($subop == "undefined") $subop = ""; - print " +/* print " Tiny Tiny RSS : Feed $feed "; @@ -700,7 +700,7 @@ } else { print ""; - } + } */ if ($subop == "CatchupSelected") { $ids = split(",", db_escape_string($_GET["ids"])); @@ -757,7 +757,7 @@ $script_dt_add = get_script_dt_add(); - print " +/* print " @@ -771,7 +771,7 @@ document.addEventListener(\"DOMContentLoaded\", init, null); } window.onload = init; - "; + "; */ /// START ///////////////////////////////////////////////////////////////////////////////// @@ -1053,37 +1053,37 @@ print ""; - print " - "; - - print ""; +# print " +# "; +# +# print ""; } if ($op == "pref-feeds") { diff --git a/feedlist.js b/feedlist.js index b3c2b833..df1e17fb 100644 --- a/feedlist.js +++ b/feedlist.js @@ -5,31 +5,30 @@ function viewCategory(cat) { viewfeed(cat, '', true); } +function feedlist_callback() { + if (xmlhttp.readyState == 4) { + var f = document.getElementById("feeds-frame"); + f.innerHTML = xmlhttp.responseText; + } +} + function viewfeed(feed, subop, is_cat, subop_param) { try { - + enableHotkeys(); var toolbar_query = parent.Form.serialize("main_toolbar_form"); - var toolbar_form = parent.document.forms["main_toolbar_form"]; + var toolbar_form = document.forms["main_toolbar_form"]; - if (parent.document.forms["main_toolbar_form"].query) { + if (document.forms["main_toolbar_form"].query) { toolbar_form.query.value = ""; } -// setCookie("ttrss_vf_limit", toolbar_form.limit[toolbar_form.limit.selectedIndex].value); -// setCookie("ttrss_vf_vmode", toolbar_form.view_mode[toolbar_form.view_mode.selectedIndex].value); - - storeInitParam("toolbar_limit", +/* storeInitParam("toolbar_limit", toolbar_form.limit[toolbar_form.limit.selectedIndex].value); storeInitParam("toolbar_view_mode", - toolbar_form.view_mode[toolbar_form.view_mode.selectedIndex].value); - -/* var sp = new Object(); - sp["toolbar_limit"] = toolbar_form.limit[toolbar_form.limit.selectedIndex].value; - sp["toolbar_view_mode"] = toolbar_form.view_mode[toolbar_form.view_mode.selectedIndex].value; - storeInitParams(sp); */ + toolbar_form.view_mode[toolbar_form.view_mode.selectedIndex].value); */ var query = "backend.php?op=viewfeed&feed=" + feed + "&" + toolbar_query + "&subop=" + param_escape(subop); @@ -56,18 +55,6 @@ function viewfeed(feed, subop, is_cat, subop_param) { if (subop == "MarkAllRead") { -/* var feedr = document.getElementById("FEEDR-" + feed); - var feedctr = document.getElementById("FEEDCTR-" + feed); - - if (feedr && feedctr) { - - feedctr.className = "invisible"; - - if (feedr.className.match("Unread")) { - feedr.className = feedr.className.replace("Unread", ""); - } - } */ - var feedlist = document.getElementById('feedList'); var next_unread_feed = getRelativeFeedId(feedlist, @@ -93,12 +80,6 @@ function viewfeed(feed, subop, is_cat, subop_param) { query = query + "&ts=" + timestamp } - debug(query); - - headlines_frame.location.href = query; - -// cleanSelectedList("feedList"); - if (!activeFeedIsCat()) { var feedr = document.getElementById("FEEDR-" + getActiveFeedId()); if (feedr && !feedr.className.match("Selected")) { @@ -106,8 +87,19 @@ function viewfeed(feed, subop, is_cat, subop_param) { } } - parent.disableContainerChildren("headlinesToolbar", false); - parent.Form.enable("main_toolbar_form"); + disableContainerChildren("headlinesToolbar", false); + Form.enable("main_toolbar_form"); + + debug(query); + + if (xmlhttp_ready(xmlhttp)) { + xmlhttp.open("GET", query, true); + xmlhttp.onreadystatechange=headlines_callback; + xmlhttp.send(null); + } else { + debug("xmlhttp busy (@feeds)"); + } + } catch (e) { exception_error("viewfeed", e); @@ -147,7 +139,7 @@ function toggleCollapseCat(cat) { } } -function init() { +function feedlist_init() { try { if (arguments.callee.done) return; arguments.callee.done = true; diff --git a/functions.js b/functions.js index 6fbabb69..ccf2bab1 100644 --- a/functions.js +++ b/functions.js @@ -162,6 +162,8 @@ function hotkey_handler(e) { var keycode; if (!hotkeys_enabled) return; + + return; //fixme disables for now if (window.event) { keycode = window.event.keyCode; @@ -468,8 +470,8 @@ function setActiveFeedId(id) { function parse_counters(reply, scheduled_call) { try { - var f_document = getFeedsContext().document; - var title_obj = getMainContext(); + var f_document = document; + var title_obj = this.window; var feeds_found = 0; @@ -602,7 +604,7 @@ function all_counters_callback() { return; } - debug("in all_counters_callback"); + debug("in all_counters_callback : " + xmlhttp_rpc.responseXML); var reply = xmlhttp_rpc.responseXML.firstChild; @@ -1287,36 +1289,20 @@ function filterCR(e) } function getMainContext() { - if (parent.window != window) { - return parent.window; - } else { - return this.window; - } + return this.window; } function getFeedsContext() { - try { - return getMainContext().frames["feeds-frame"]; - } catch (e) { - exception_error("getFeedsContext", e); - } + return this.window; } function getContentContext() { - try { - return getMainContext().frames["content-frame"]; - } catch (e) { - exception_error("getContentContext", e); - } + return this.window; } function getHeadlinesContext() { - try { - return getMainContext().frames["headlines-frame"]; - } catch (e) { - exception_error("getHeadlinesContext", e); - } + return this.window; } var debug_last_class = "even"; diff --git a/tt-rss.css b/tt-rss.css index 337797e7..29f855a0 100644 --- a/tt-rss.css +++ b/tt-rss.css @@ -176,44 +176,44 @@ ul.feedList li { margin : 0px; } -ul.feedlist li.feedUnread, -ul.feedlist li.errorUnread, -ul.feedlist li.labelUnread, -ul.feedlist li.virtUnread, -ul.feedlist li.tagUnread { +li.feedUnread, +li.errorUnread, +li.labelUnread, +li.virtUnread, +li.tagUnread { font-weight : bold; } -ul.feedlist li.errorSelected a, -ul.feedlist li.error a, -ul.feedlist li.errorUnread a, -ul.feedlist li.errorUnreadSelected a { +li.errorSelected a, +li.error a, +li.errorUnread a, +li.errorUnreadSelected a { color : #f04040; } -ul.feedlist li.feedSelected a, -ul.feedlist li.labelSelected a, -ul.feedlist li.virtSelected a, -ul.feedlist li.tagSelected a { +li.feedSelected a, +li.labelSelected a, +li.virtSelected a, +li.tagSelected a { color : #4684ff; } -ul.feedlist li.feedUnreadSelected a, -ul.feedlist li.labelUnreadSelected a, -ul.feedlist li.virtUnreadSelected a, -ul.feedlist li.tagUnreadSelected a { +li.feedUnreadSelected a, +li.labelUnreadSelected a, +li.virtUnreadSelected a, +li.tagUnreadSelected a { color : #4684ff; } -ul.feedlist li.feedUnreadSelected, -ul.feedlist li.errorUnreadSelected, -ul.feedlist li.labelUnreadSelected, -ul.feedlist li.virtUnreadSelected, -ul.feedlist li.tagUnreadSelected { +li.feedUnreadSelected, +li.errorUnreadSelected, +li.labelUnreadSelected, +li.virtUnreadSelected, +li.tagUnreadSelected { font-weight : bold; } -ul.feedList li.feed { +li.feed { display : block; } @@ -1060,14 +1060,14 @@ a.cdmToggleLink:hover { } #debug_output { - width : 400; - height : 200; - right : 20; - bottom : 20; + position : absolute; + width : 400px; + height : 200px; + right : 20px; + bottom : 20px; + z-index : 999; background-color : white; display : none; - z-index : 999; - position : absolute; border : 1px solid #c0c0c0; overflow : auto; margin : 0px; @@ -1223,3 +1223,88 @@ table.loginForm2 .innerLoginCell { #milestoneDetails { display : none; } + +/* layout */ + +#header { + position : absolute; + white-space: nowrap; + top : 10px; + left : 15px; + right : 5px; + height : 40px; + color : #4684ff; + font-size : x-small; +} + +#feeds-holder { + border-width : 1px 1px 1px 0px; + border-style : solid; + border-color : #88b0f0; + top : 50px; + left : 0px; + position : absolute; + width : 260px; + overflow : auto; + bottom : 50px; +} + +#toolbar { + position : absolute; + left : 261px; + padding : 5px 10px 5px 5px; + top : 50px; + right : 0px; + white-space: nowrap; + height : 30px; + background-image : url("images/toolbar.png"); + background-position : bottom left; + background-repeat : repeat-x; + font-size : small; +} + +#headlines-frame { + position : absolute; + border-width : 1px 0px 0px 0px; + border-style : solid; + border-color : #88b0f0; + left : 260px; + height : 300px; + top : 85px; + right : 0px; + overflow : auto; + font-size : small; +} + +#content-frame { + position : absolute; + border-width : 1px 0px 1px 0px; + border-style : solid; + border-color : #88b0f0; + overflow : auto; + top : 390px; + left : 260px; + bottom : 50px; + right : 0px; +} + +#footer { + position : absolute; + bottom : 0px; + height : 30px; + text-align : center; + color : gray; + font-size : x-small; + background-image : url("images/footer.png"); + background-position : top left; + background-repeat : repeat-x; + background-color : white; + right : 0px; + left : 0px; + padding : 10px; +} + +#headlinesContainer { + margin-left : 1px; + background-color : white; +} diff --git a/tt-rss.js b/tt-rss.js index 597dd2fa..bcbadcb5 100644 --- a/tt-rss.js +++ b/tt-rss.js @@ -222,9 +222,20 @@ function updateFeedList(silent, fetch) { if (fetch) query_str = query_str + "&fetch=yes"; - var feeds_frame = document.getElementById("feeds-frame"); +// var feeds_frame = document.getElementById("feeds-frame"); +// feeds_frame.src = query_str; + + debug("updateFeedList"); + + if (xmlhttp_ready(xmlhttp)) { + xmlhttp.open("GET", query_str, true); + xmlhttp.onreadystatechange=feedlist_callback; + xmlhttp.send(null); + } else { + debug("xmlhttp busy"); + //printLockingError(); + } - feeds_frame.src = query_str; } function catchupAllFeeds() { @@ -382,9 +393,11 @@ function resize_feeds_frame() { if (th) { header_height = th.scrollHeight; } - - f.style.height = document.body.scrollHeight - footer_height - - header_height - 50 + "px"; + + if (f) { + f.style.height = document.body.scrollHeight - footer_height - + header_height - 50 + "px"; + } } function init_second_stage() { diff --git a/tt-rss.php b/tt-rss.php index 1315e3aa..a3a7f465 100644 --- a/tt-rss.php +++ b/tt-rss.php @@ -17,6 +17,8 @@ $dt_add = get_script_dt_add(); ?> + Tiny Tiny RSS @@ -52,6 +54,9 @@ + + + +

Fatal Error

Unknown Error
@@ -89,69 +95,51 @@ window.onload = init; start the daemon process or contact instance owner.
- -
 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - -
- Tiny Tiny RSS - -
 
-
- - Hello, - (Logout) - -
-
-
 
-
 
-
- +
- - -
- -
- - + + Tiny Tiny RSS + -
+
+ +
-fixme-
+
-
- +
-
- - -
+
+ +
@@ -203,64 +191,15 @@ window.onload = init; -
- -
-
- -
- -
- -
+
+ +
-fixme-
+ +
-fixme-
+ + diff --git a/version.php b/version.php index efa3485f..275ce79d 100644 --- a/version.php +++ b/version.php @@ -1,3 +1,3 @@ diff --git a/viewfeed.js b/viewfeed.js index 58bc7abd..ee8d0216 100644 --- a/viewfeed.js +++ b/viewfeed.js @@ -2,13 +2,30 @@ var active_post_id = false; var xmlhttp_rpc = Ajax.getTransport(); +function headlines_callback() { + if (xmlhttp.readyState == 4) { + debug("headlines_callback"); + var f = document.getElementById("headlines-frame"); + f.innerHTML = xmlhttp.responseText; + } +} + +function article_callback() { + if (xmlhttp.readyState == 4) { + debug("article_callback"); + var f = document.getElementById("content-frame"); + f.innerHTML = xmlhttp.responseText; + update_all_counters(); + } +} + function view(id, feed_id) { try { debug("loading article: " + id + "/" + feed_id); var f_document = getFeedsContext().document; - var m_document = parent.document; + var m_document = document; enableHotkeys(); @@ -29,12 +46,20 @@ function view(id, feed_id) { var content = m_document.getElementById("content-frame"); - content.src = "backend.php?op=view&id=" + param_escape(id) + - "&feed=" + param_escape(feed_id); - selectTableRowsByIdPrefix('headlinesList', 'RROW-', 'RCHK-', false); markHeadline(active_post_id); + var query = "backend.php?op=view&id=" + param_escape(id) + + "&feed=" + param_escape(feed_id); + + if (xmlhttp_ready(xmlhttp)) { + xmlhttp.open("GET", query, true); + xmlhttp.onreadystatechange=article_callback; + xmlhttp.send(null); + } else { + debug("xmlhttp busy (@view)"); + } + } catch (e) { exception_error("view", e); } @@ -42,7 +67,7 @@ function view(id, feed_id) { function toggleMark(id) { - var f_document = parent.frames["feeds-frame"].document; + var f_document = document; if (!xmlhttp_ready(xmlhttp_rpc)) { printLockingError(); @@ -58,7 +83,6 @@ function toggleMark(id) { if (mark_img.alt != "Reset mark") { mark_img.src = "images/mark_set.png"; mark_img.alt = "Reset mark"; - mark_img.setAttribute('onclick', 'javascript:toggleMark('+id+')'); query = query + "&mark=1"; if (vfeedu && crow.className.match("Unread")) { @@ -68,7 +92,6 @@ function toggleMark(id) { } else { mark_img.src = "images/mark_unset.png"; mark_img.alt = "Set mark"; - mark_img.setAttribute('onclick', 'javascript:toggleMark('+id+')'); query = query + "&mark=0"; if (vfeedu && crow.className.match("Unread")) { @@ -134,11 +157,6 @@ function moveToPost(mode) { } } -function viewfeed(id) { - var f = parent.frames["feeds-frame"]; - f.viewfeed(id, 0); -} - function toggleUnread(id, cmode) { try { if (!xmlhttp_ready(xmlhttp_rpc)) { @@ -368,7 +386,7 @@ function labelFromSearch(search, search_mode, match_on, feed_id, is_cat) { -function init() { +function headlines_init() { if (arguments.callee.done) return; arguments.callee.done = true; -- 2.39.5