{{= story["story_date"] }}
+Index: applications/mobileblur/controllers/default.py
==================================================================
--- applications/mobileblur/controllers/default.py
+++ applications/mobileblur/controllers/default.py
@@ -21,11 +21,18 @@
if login_form.accepts(request):
try:
results = newsblur.login(login_form.vars["username"], login_form.vars["password"])
response.cookies["nb_cookie"] = newsblur.cookies["newsblur_sessionid"]
response.cookies["nb_cookie"]["path"] = "/"
- print "cookie =", newsblur.cookies
redirect(URL("index"))
except Exception as ex:
login_form.insert(-1, ex.message)
+ login_form._class = "alert-message block-message error"
return dict(login_form=login_form)
+
+
+def logout():
+ response.cookies["nb_cookie"] = ""
+ response.cookies["nb_cookie"]["expires"] = -10
+ response.cookies["nb_cookie"]["path"] = "/"
+ redirect(URL("index"))
Index: applications/mobileblur/controllers/feeds.py
==================================================================
--- applications/mobileblur/controllers/feeds.py
+++ applications/mobileblur/controllers/feeds.py
@@ -1,13 +1,32 @@
# -*- coding: utf-8 -*-
from pprint import pprint
+import time
def view():
- stories = newsblur.feed(request.args[0])["stories"]
- feeds = newsblur.feeds(flat=True)["feeds"]
- feed = [feed for feed in feeds.itervalues() if feed["id"]==int(request.args[0])][0]
+ print ""
+ s = time.time()
+ feed = newsblur.feed(request.args[0])
+ stories = feed["stories"]
+ print time.time() - s
+
+ print feed.keys()
+
+ if not feed.has_key("feed_title"):
+ s = time.time()
+ feeds = newsblur.feeds(flat=True)["feeds"]
+ print time.time() - s
+
+ s = time.time()
+ feed = [feed for feed in feeds.itervalues() if feed["id"]==int(request.args[0])][0]
+ print time.time() - s
+
+ response.title = feed["feed_title"]
+
return dict(stories=stories, feed=feed)
+
def mark_read():
- newsblur.mark_feed_as_read(request.vars["feed"])
+ if len(request.args) > 0:
+ newsblur.mark_feed_as_read(request.args[0])
redirect(URL("default", "index"))
Index: applications/mobileblur/controllers/stories.py
==================================================================
--- applications/mobileblur/controllers/stories.py
+++ applications/mobileblur/controllers/stories.py
@@ -3,6 +3,10 @@
from pprint import pprint
def view():
stories = newsblur.feed(request.vars["feed_id"])["stories"]
story = [story for story in stories if story["id"]==request.vars["story"]][0]
- return dict(story=story)
+ return dict(story=story, feed_id=request.vars["feed_id"])
+
+def mark_read():
+ results = newsblur.mark_story_as_read(request.vars["story_id"], request.vars["feed_id"])
+ redirect(URL("default", "index"))
Index: applications/mobileblur/models/0_helpers.py
==================================================================
--- applications/mobileblur/models/0_helpers.py
+++ applications/mobileblur/models/0_helpers.py
@@ -2,11 +2,10 @@
newsblur = newsblur.NewsBlur()
threshold = 0
thresholds = ["nt", "ps", "ng"] # indices -1, 0, 1 for negative, neutral, and positive intelligence filters
-print request.cookies
if [request.application, request.controller, request.function] != [request.application, "default", "login"]:
if "nb_cookie" not in request.cookies.keys():
redirect(URL("default", "login"))
else:
newsblur.cookies["newsblur_sessionid"] = request.cookies["nb_cookie"].value
Index: applications/mobileblur/modules/newsblur.py
==================================================================
--- applications/mobileblur/modules/newsblur.py
+++ applications/mobileblur/modules/newsblur.py
@@ -21,12 +21,10 @@
Required parameters, username and password, must be of string type.
'''
url = nb_url + 'api/login'
results = requests.post(url, data={"username": username, "password": password})
- print "results.cookies =", results.cookies
- print type(results.cookies)
self.cookies = results.cookies
results = simplejson.loads(results.content)
if results["authenticated"] is False:
raise Exception("The newsblur credentials you provided are invalid")
return results
Index: applications/mobileblur/static/css/base.css
==================================================================
--- applications/mobileblur/static/css/base.css
+++ applications/mobileblur/static/css/base.css
@@ -25,17 +25,17 @@
- form and table padding
- code blocks
- left and right padding to quoted text
- page layout alignment, width and padding (change this for spaces)
- column widths (change this to use left_sidebar and right_sidebar)
-- backrgound images and colors (change this for colors)
+- background images and colors (change this for colors)
- web2py specific (.flash, .error)
Notice:
- even if you use a different layout/css you may need classes .flash and .error
- this is all color neutral except for #349C01 (header, links, lines)
-- there are two backrgound images: images/background.png and images/header.png
+- there are two background images: images/background.png and images/header.png
License: This file is released under BSD and MIT
*/
@@ -143,13 +143,14 @@
/* always force a scrollbar in non-IE */
html { overflow-y: scroll; }
/* Accessible focus treatment: people.opera.com/patrickl/experiments/keyboard/test */
a:hover, a:active { outline: none; }
-
+/*
a, a:active, a:visited { color:#607890; }
a:hover { color:#036; }
+*/
ul, ol { margin-left: 1.8em; }
ol { list-style-type: decimal; }
/* Remove margins for navigation lists */
@@ -327,63 +328,18 @@
fieldset { border: 1px solid #dedede; padding: 6px; }
legend { font-weight: bold; }
input:focus, textarea:focus { background: #fafafa; }
-p {text-indent:30px;}
-
-p, blockquote {
- margin-bottom: 10px;
-}
-
h1,h2,h3,h4,h5,h6 { line-height: 170%; }
h1 {font-size: 2.0em;}
h2 {font-size: 1.8em;}
h3 {font-size: 1.4em;}
h4 {font-size: 1.2em;}
h5 {font-size: 1.0em;}
h6 {font-size: 0.8em;}
-/*********** page layout alignment, width and padding ***********/
-/*body {background-color: #000;}*/
-#container, #header, #page, #content, #statusbar,
-#footer, #wrapper { display:block; line-height: 170%; }
-#wrapper {width: 900px;}
-#container {
- margin: 0 auto;
- padding: 0;
-}
-#wrapper {margin: 0 auto;}
-#wrapper {background-color: #fff; padding: 5px;}
-#statusbar { margin: 5px 0px 20px 0px;}
-#footer {
- margin-top: 30px;
- padding: 5px;
-}
-#statusbar, #footer {
- background: #eaeaea;
- border-top: 1px #aaa solid;
-}
-#logo {
- width: 68px;
- height: 62px;
- background: url(../images/logo.png);
-}
-#appname {
- color: #cccccc;
-}
-
-#right_sidebar { width: 160px; float:right; display: none; }
-#left_sidebar { width: 160px; float:left; display: none; }
-#content { float: left; /*width: 740px;*//*width: 63%;*/ /*width: 640px; float:left;*/ } /* uncomment this if you are going to use sidebars */
-
-.auth_navbar {
- top: 0px;
- float: right;
- padding: 3px 10px 3px 10px;
-}
-
/*********** web2py specific ***********/
div.flash {
font-weight: bold;
display: none;
position: fixed;
@@ -533,10 +489,15 @@
/* Uncomment if you don't want iOS and WinMobile to mobile-optimize the text for you
j.mp/textsizeadjust
html { -webkit-text-size-adjust:none; -ms-text-size-adjust:none; } */
}
+@media handheld {
+ body {
+ }
+}
+
/*
* print styles
* inlined to avoid required HTTP connection www.phpied.com/delay-loading-your-print-css/
*/
@@ -552,5 +513,82 @@
@page { margin: 0.5cm; }
p, h2, h3 { orphans: 3; widows: 3; }
h2, h3{ page-break-after: avoid; }
}
+body {
+/* background-color: #f2c84b;*/
+ color: #493F3E
+}
+
+header {
+ background-color: #95392E;
+ padding: 1%;
+ border-bottom: 1px solid #95392E;
+ color: white;
+}
+header > h1 > a {
+ text-decoration: none;
+ color: white;
+ font-weight: bold;
+}
+
+#story > header > a {
+ color: white;
+}
+
+header > a> h2 {
+/* border-top: 1px solid white;*/
+ color: white;
+}
+
+#story-list {
+/* background-color: #f2c84b;*/
+}
+
+#story-list > .story > a, .feed > a {
+ text-decoration: none;
+ font-weight: bold;
+ margin-top: 0;
+}
+#story-list > .story > p {
+ font-size: .75em;
+}
+
+#story-list > .story > .read {
+ color: #D99B48;
+}
+#story-list > .story > .unread, .feed > a {
+ color: #C57E3C;
+}
+
+#story-list > .story, .feed {
+ padding: .5%;
+ border-top: 1px solid #95392E;
+ margin-top: .33%;
+}
+
+span.ps, span.nt, span.ng {
+ padding: .05em;
+ border-radius: 5px;
+}
+span.ps {
+ background-color: #ABAA7A;
+}
+span.nt {
+ background-color: #D99B48;
+}
+span.ng {
+ background-color: red;
+}
+
+footer {
+ background-color: #95392E;
+ padding: 1%;
+ border-top: 1px solid #95392E;
+ color: white;
+}
+footer > a {
+ text-decoration: none;
+ color: white;
+ font-weight: bold;
+}
Index: applications/mobileblur/views/default/index.html
==================================================================
--- applications/mobileblur/views/default/index.html
+++ applications/mobileblur/views/default/index.html
@@ -1,12 +1,10 @@
-{{left_sidebar_enabled=right_sidebar_enabled=False}}
{{extend 'layout.html'}}
{{ for feed in feeds.itervalues(): }}
- {{ if threshold == -1 and feed["ng"] > 0: }} [ {{= feed["ng"] }} ] {{ pass }}
- {{ if threshold <= 0 and feed["nt"] > 0: }} [ {{= feed["nt"] }} ] {{ pass }}
- {{if feed["ps"] > 0: }}[ {{= feed["ps"] }} ] {{ pass }}
- {{= feed["feed_title"] }}
+
{{= story["story_date"] }}
+