aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Andreas Benkard <code@mail.matthias.benkard.de>2009-02-23 17:42:41 +0100
committerMatthias Andreas Benkard <code@mail.matthias.benkard.de>2009-02-23 17:42:41 +0100
commit5f115b1abd8228b349f94a6268d1bad68c0330bf (patch)
tree4053120a192a90ce542376ff48c9ea264df6b333
parent72a1c6912333e23b9a40fd710e73d79f8dc91c51 (diff)
Reformat code.
-rw-r--r--cljssss-g.clj123
1 files changed, 67 insertions, 56 deletions
diff --git a/cljssss-g.clj b/cljssss-g.clj
index 4f781db..59441db 100644
--- a/cljssss-g.clj
+++ b/cljssss-g.clj
@@ -33,59 +33,72 @@
(sql/with-query-results
results
["SELECT feed.uri, feed.link, user_feed_link.title FROM feed, user_feed_link WHERE user_feed_link.feed=feed.id AND user_feed_link.user=?" id]
- (str "<?xml version=\"1.0\" encoding=\"utf-8\"?><opml version=\"1.0\"><head>"
- "<dateCreated>blah</dateCreated>"
- "<title>G&ouml;del-Gentzen Clojure Syndication Services Super System Feed Export</title></head><body>"
+ (str
+ "<?xml version=\"1.0\" encoding=\"utf-8\"?><opml version=\"1.0\"><head>"
+ "<dateCreated>blah</dateCreated>"
+ "<title>G&ouml;del-Gentzen Clojure Syndication Services Super System Feed Export</title></head><body>"
(loop [clstr "" r results]
- (if (first r)
- (recur
- (str clstr
- "<outline text=\""
- (:title (first r))
- "\" xmlUrl=\""
- (:uri (first r))
- "\" htmlUrl=\""
- (:link (first r))
- "\" />")
- (rest r))
- clstr))
+ (if (first r)
+ (recur
+ (str clstr
+ "<outline text=\""
+ (:title (first r))
+ "\" xmlUrl=\""
+ (:uri (first r))
+ "\" htmlUrl=\""
+ (:link (first r))
+ "\" />")
+ (rest r))
+ clstr))
"</body></opml>"))))
(defn lynxy-feedlist [id]
(with-dbt
(sql/with-query-results
results
- ["SELECT feed.id, feed.uri, feed.link, user_feed_link.title FROM feed, user_feed_link WHERE user_feed_link.feed=feed.id AND user_feed_link.user=?" id]
- (html `[html [head [title "G&ouml;del-Gentzen Clojure Syndication Services Super System"]]
- [body [ul
- ~@(loop [back '[] r results]
- (if (first r)
- (recur (concat back `[[li
- [a {:href ~(str "lynxy-showfeed?feed=" (:id (first r)))}
- ~(:title (first r)) " - "
- ~(:link (first r))
- ]]])
- (rest r))
- back))]]]))))
+ [(str "SELECT feed.id, feed.uri, feed.link, user_feed_link.title"
+ " FROM feed, user_feed_link"
+ " WHERE user_feed_link.feed=feed.id AND user_feed_link.user=?")
+ id]
+ (html
+ `[html
+ [head [title "G&ouml;del-Gentzen Clojure Syndication Services Super System"]]
+ [body [ul
+ ~@(loop [back '[] r results]
+ (if (first r)
+ (recur (concat back `[[li
+ [a {:href ~(str "lynxy-showfeed?feed=" (:id (first r)))}
+ ~(:title (first r)) " - "
+ ~(:link (first r))
+ ]]])
+ (rest r))
+ back))]]]))))
(defn lynxy-showfeed [id feednum]
(with-dbt
(sql/with-query-results
results
- ["SELECT entry.link, entry.title FROM entry, feed_entry_link, user_feed_link WHERE entry.id = feed_entry_link.entry AND feed_entry_link.feed = user_feed_link.feed AND user_feed_link.user = ? AND user_feed_link.feed = ?" id feednum]
- (html `[html [head [title "G&ouml;del-Gentzen Clojure Syndication Services Super System"]]
- [body [ul
- ~@(loop [back '[] r results]
- (if (first r)
- (recur (concat back `[[li
- [a {:href ~(:link (first r))}
- ~(:title (first r)) " - "
- ~(:link (first r))
- ]]])
- (rest r))
- back))]
- [a {:href "lynxy-feedlist.html"} "&laquo; To Feedlist"]
- ]]))))
+ [(str "SELECT entry.link, entry.title"
+ " FROM entry, feed_entry_link, user_feed_link"
+ " WHERE entry.id = feed_entry_link.entry"
+ " AND feed_entry_link.feed = user_feed_link.feed"
+ " AND user_feed_link.user = ?"
+ " AND user_feed_link.feed = ?")
+ id feednum]
+ (html
+ `[html
+ [head [title "G&ouml;del-Gentzen Clojure Syndication Services Super System"]]
+ [body [ul
+ ~@(loop [back '[] r results]
+ (if (first r)
+ (recur (concat back `[[li
+ [a {:href ~(:link (first r))}
+ ~(:title (first r)) " - "
+ ~(:link (first r))
+ ]]])
+ (rest r))
+ back))]
+ [a {:href "lynxy-feedlist.html"} "&laquo; To Feedlist"]]]))))
(defmacro with-session [& body]
`(if (not (~'session :id))
@@ -96,19 +109,17 @@
(defservlet cljssss-g
(GET "/login"
(if (= (params :valuesofbetawillgiverisetodom) "true")
- (.toString (doto
- (.getInstanceOf templates "login")
- (.setAttributes {"logintext" "Login failed"})))
- (.toString (doto
- (.getInstanceOf templates "login")
- (.setAttributes {"logintext" "Login"})))))
+ (.toString (doto (.getInstanceOf templates "login")
+ (.setAttributes {"logintext" "Login failed"})))
+ (.toString (doto (.getInstanceOf templates "login")
+ (.setAttributes {"logintext" "Login"})))))
(POST "/login"
- (dosync
- (with-db
- (sql/with-query-results [{id :id password :password}]
- ["SELECT id, password FROM user WHERE name = ?"
- (params :name)]
- (if (= password (params :password))
+ (dosync
+ (with-db
+ (sql/with-query-results [{id :id password :password}]
+ ["SELECT id, password FROM user WHERE name = ?"
+ (params :name)]
+ (if (= password (params :password))
(do
(alter session assoc :id id)
(redirect-to "/"))
@@ -119,13 +130,13 @@
(with-session (lynxy-feedlist (session :id))))
(GET "/lynxy-showfeed"
(with-session
- (lynxy-showfeed (session :id) (. Integer parseInt (params :feed)))))
+ (lynxy-showfeed (session :id) (. Integer parseInt (params :feed)))))
(GET "/"
(with-session
(.toString
(doto (.getInstanceOf templates "index")
- (.setAttributes {"title" "Subscriptions",
- "mainParagraph" "Hi there!"})))))
+ (.setAttributes {"title" "Subscriptions",
+ "mainParagraph" "Hi there!"})))))
(ANY "*"
(page-not-found)))