summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2010-09-09 16:50:10 +0400
committerAndrew Dolgov <[email protected]>2010-09-09 16:50:10 +0400
commitc01f40f4d9c8fae847ecec5a18ff52c0a15dd57b (patch)
treeada4e599b1234b3a068603d819fcbc1c5a8b13ea
parent911d4c0836cf6d1be53be5917739defc91277a7e (diff)
add experimental digest thingie (2)
-rw-r--r--digest.css170
-rw-r--r--digest.js108
-rw-r--r--digest.php113
3 files changed, 391 insertions, 0 deletions
diff --git a/digest.css b/digest.css
new file mode 100644
index 000000000..5139114f0
--- /dev/null
+++ b/digest.css
@@ -0,0 +1,170 @@
+body {
+ background : #f0f0f0;
+ color : gray;
+ font-family : sans-serif;
+ font-size : 12px;
+}
+
+a {
+ color : #0069D8;
+ text-decoration : none;
+}
+
+a:hover {
+ color : gray;
+}
+
+#header a, #footer a {
+ color : gray;
+}
+
+#header {
+ font-weight : bold;
+ font-size : 14px;
+ font-family : "Lucida Grande", "Segoe UI", Tahoma, Arial, sans-serif;
+ margin-left : 1em;
+ margin-right : 1em;
+}
+
+#header div.links {
+ float : right;
+}
+
+#search {
+ float : right;
+ clear : left;
+
+}
+
+#content {
+ border : 1px solid #e0e0e0;
+ background : white;
+ padding : 0.8em;
+ margin : 0.5em;
+}
+
+#footer {
+ font-size : 12px;
+ text-align : center;
+}
+
+/*#content h1 {
+ font-weight : bold;
+ font-size : 25px;
+ font-family : "Lucida Grande", "Segoe UI", Tahoma, Arial, sans-serif;
+ letter-spacing : -2;
+ margin : 0px 0px 0.5em 0px;
+ color : black;
+}
+
+#content h2 {
+ font-weight : bold;
+ font-size : 20px;
+ font-family : "Lucida Grande", "Segoe UI", Tahoma, Arial, sans-serif;
+ letter-spacing : 2;
+ margin : 0px 0px 0.5em 0px;
+ color : #684C99;
+}
+
+#content h3 {
+ font-weight : bold;
+ font-size : 16px;
+ font-family : "Lucida Grande", "Segoe UI", Tahoma, Arial, sans-serif;
+ letter-spacing : 2;
+ margin : 0px 0px 0.5em 0px;
+ color : #659a4c;
+} */
+
+#content h1 {
+ margin : 0px 0px 20px 0px;
+ font-family : "Lucida Grande", "Segoe UI", Tahoma, Arial, sans-serif;
+ font-size : 18px;
+ letter-spacing : 1px;
+ color : #684C99;
+}
+
+#title {
+}
+
+#latest {
+ padding : 5px;
+}
+
+#feeds {
+ float : right;
+ width : 30%;
+ min-width : 300px;
+ padding : 5px;
+ font-size : 14px;
+}
+
+#feeds h1 {
+ text-align : right;
+}
+
+#feeds ul#feeds-content img {
+ width : 16px;
+ height : 16px;
+ vertical-align : middle;
+ margin-right : 5px;
+}
+
+#feeds ul#feeds-content div.unread-ctr {
+ color : gray;
+ float : right;
+}
+
+#feeds ul#feeds-content li {
+ margin : 0px 0px 2px 0px;
+}
+
+#feeds ul#feeds-content {
+ list-style-type : none;
+ font-weight : bold;
+ color : #659a4c;
+ margin : 0px;
+ padding : 0px;
+}
+
+#headlines {
+ padding : 5px;
+ font-size : 14px;
+}
+
+#headlines ul#headlines-content img {
+ width : 16px;
+ height : 16px;
+ vertical-align : middle;
+ margin-right : 5px;
+}
+
+#headlines ul#headlines-content {
+ list-style-type : none;
+ color : gray;
+ margin : 0px;
+ padding : 0px;
+}
+
+#headlines ul#headlines-content li {
+ margin : 0px 0px 10px 0px;
+ color : #909090;
+}
+
+#headlines ul#headlines-content a.title {
+ font-weight : bold;
+ font-size : 16px;
+}
+
+#headlines ul#headlines-content div.excerpt {
+ margin-left : 22px;
+ color : #404040;
+}
+
+#headlines ul#headlines-content div.info {
+ margin-left : 22px;
+}
+
+#headlines ul#headlines-content div.info a {
+ color : gray;
+}
+
diff --git a/digest.js b/digest.js
new file mode 100644
index 000000000..7bfd9df27
--- /dev/null
+++ b/digest.js
@@ -0,0 +1,108 @@
+var last_feeds = [];
+
+function find_feed(feeds, feed_id) {
+ try {
+ for (var i = 0; i < feeds.length; i++) {
+ if (feeds[i].id == feed_id)
+ return feeds[i];
+ }
+
+ return false;
+
+ } catch (e) {
+ exception_error("find_feed", e);
+ }
+}
+
+function add_feed_entry(feed) {
+ try {
+ var icon_part = "";
+
+ if (feed.has_icon)
+ icon_part = "<img alt='zz' src='icons/" + feed.id + ".ico'/>";
+
+ var tmp_html = "<li>" +
+ icon_part +
+ feed.title +
+ "<div class='unread-ctr'>" + feed.unread + "</div>" +
+ "</li>";
+
+ $("feeds-content").innerHTML += tmp_html;
+
+ } catch (e) {
+ exception_error("add_feed_entry", e);
+ }
+}
+
+function add_latest_entry(article) {
+ try {
+
+ } catch (e) {
+ exception_error("add_latest_entry", e);
+ }
+}
+
+function add_headline_entry(article, feed) {
+ try {
+
+ var icon_part = "";
+
+ if (article.has_icon)
+ icon_part = "<img alt='zz' src='icons/" + article.feed_id + ".ico'/>";
+
+ var tmp_html = "<li>" +
+ icon_part +
+ "<a class='title'>" + article.title + "</a>" +
+ "<div class='excerpt'>" + article.excerpt + "</div>" +
+ "<div class='info'><a>" + feed.title + "</a> " + " @ " +
+ article.updated + "</div>" +
+ "</li>";
+
+ $("headlines-content").innerHTML += tmp_html;
+
+ } catch (e) {
+ exception_error("add_headline_entry", e);
+ }
+}
+
+function digest_update(transport) {
+ try {
+ var feeds = transport.responseXML.getElementsByTagName('feeds')[0];
+ var headlines = transport.responseXML.getElementsByTagName('headlines')[0];
+
+ if (feeds) {
+ last_feeds = feeds;
+
+ feeds = eval("(" + feeds.firstChild.nodeValue + ")");
+
+ for (var i = 0; i < feeds.length; i++) {
+ add_feed_entry(feeds[i]);
+ }
+ }
+
+ if (headlines) {
+ headlines = eval("(" + headlines.firstChild.nodeValue + ")");
+
+ for (var i = 0; i < headlines.length; i++) {
+ add_headline_entry(headlines[i], find_feed(feeds, headlines[i].feed_id));
+ }
+ }
+
+ } catch (e) {
+ exception_error("digest_update", e);
+ }
+ }
+
+function digest_init() {
+ try {
+
+ new Ajax.Request("backend.php", {
+ parameters: "backend.php?op=rpc&subop=digest-init",
+ onComplete: function(transport) {
+ digest_update(transport);
+ } });
+
+ } catch (e) {
+ exception_error("digest_init", e);
+ }
+}
diff --git a/digest.php b/digest.php
new file mode 100644
index 000000000..cfe16cfe4
--- /dev/null
+++ b/digest.php
@@ -0,0 +1,113 @@
+<?php
+ error_reporting(E_ERROR | E_WARNING | E_PARSE);
+
+ require_once "functions.php";
+ require_once "sessions.php";
+ require_once "sanity_check.php";
+ require_once "version.php";
+ require_once "config.php";
+ require_once "db-prefs.php";
+
+ $link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);
+
+ login_sequence($link);
+
+ $dt_add = get_script_dt_add();
+
+ no_cache_incantation();
+
+ header('Content-Type: text/html; charset=utf-8');
+
+?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>Tiny Tiny Digest</title>
+ <link rel="stylesheet" type="text/css" href="digest.css?<?php echo $dt_add ?>"/>
+
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+
+ <?php $user_css_url = get_pref($link, 'USER_STYLESHEET_URL'); ?>
+ <?php if ($user_css_url) { ?>
+ <link rel="stylesheet" type="text/css" href="<?php echo $user_css_url ?>"/>
+ <?php } ?>
+
+ <link rel="shortcut icon" type="image/png" href="images/favicon.png"/>
+
+ <script type="text/javascript" src="lib/prototype.js"></script>
+ <script type="text/javascript" src="lib/scriptaculous/scriptaculous.js?load=effects,dragdrop,controls"></script>
+ <script type="text/javascript" charset="utf-8" src="localized_js.php?<?php echo $dt_add ?>"></script>
+ <script type="text/javascript" charset="utf-8" src="tt-rss.js?<?php echo $dt_add ?>"></script>
+ <script type="text/javascript" charset="utf-8" src="functions.js?<?php echo $dt_add ?>"></script>
+
+ <script type="text/javascript" src="digest.js"></script>
+
+ <script type="text/javascript">
+ Event.observe(window, 'load', function() {
+ digest_init();
+ });
+ </script>
+</head>
+<body id="ttrssDigest">
+ <div id="header">
+
+ <div class="links">
+
+ <?php if (!SINGLE_USER_MODE) { ?>
+ <?php echo __('Hello,') ?> <b><?php echo $_SESSION["name"] ?></b> |
+ <?php } ?>
+
+ <?php if (!SINGLE_USER_MODE) { ?>
+ <a href="logout.php"><?php echo __('Logout') ?></a>
+ <?php } ?>
+
+ </div>
+
+ Tiny Tiny Digest
+
+ </div>
+ <div id="content">
+ <div id="title">
+ <div id="search">
+ <input name="search" type="search"></input>
+ <button>Search</button>
+ </div>
+
+ </div>
+
+ <div id="latest">
+ <h1>latest articles</h1>
+
+ <em>TODO</em>
+
+ <div id="latest-content"> </div>
+ </div>
+
+ <div id="feeds">
+ <h1>feeds</h1>
+
+ <ul id="feeds-content"> </ul>
+ </div>
+
+ <div id="headlines">
+ <h1>headlines</h1>
+
+ <ul id="headlines-content"> </ul>
+ </div>
+
+ <br clear="both">
+
+ </div>
+
+ <div id="footer">
+
+ <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>
+
+</body>