summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/reserved_nicks.txt2
-rw-r--r--src/fame.clj27
-rw-r--r--src/site.clj11
-rw-r--r--template/fame.st39
-rw-r--r--template/fame_dump.st15
5 files changed, 92 insertions, 2 deletions
diff --git a/docs/reserved_nicks.txt b/docs/reserved_nicks.txt
index b57cb8e..c53caae 100644
--- a/docs/reserved_nicks.txt
+++ b/docs/reserved_nicks.txt
@@ -20,6 +20,7 @@ directory
dump
dumpfm
error
+fame
favicon
feed
feeds
@@ -28,6 +29,7 @@ free
friends
goodies
google
+hall
help
hookup
image
diff --git a/src/fame.clj b/src/fame.clj
new file mode 100644
index 0000000..8f0ae4f
--- /dev/null
+++ b/src/fame.clj
@@ -0,0 +1,27 @@
+(ns fame
+ (:use scheduled-agent
+ utils))
+
+; should probably cache this to disk somewhere
+(def hall-of-fame-update-frequency (* 4 60 60))
+
+(def hall-of-fame-query "
+select m.created_on, m.message_id, m.content, u.nick, u.avatar, r.key, count(*)
+from tags t, messages m, rooms r, users u
+where t.message_id = m.message_id
+and m.user_id = u.user_id
+and m.room_id = r.room_id
+and r.admin_only = false
+group by m.created_on, m.message_id, m.content, u.nick, u.avatar, r.key
+order by count(*) desc
+limit 50
+")
+
+(defn fetch-hall-of-fame []
+ (do-select [hall-of-fame-query]))
+
+
+(def hall-results (scheduled-agent fetch-hall-of-fame
+ hall-of-fame-update-frequency
+ nil))
+ \ No newline at end of file
diff --git a/src/site.clj b/src/site.clj
index 2777efc..6a011c6 100644
--- a/src/site.clj
+++ b/src/site.clj
@@ -17,6 +17,7 @@
admin
compojure
email
+ fame
utils
cookie-login
session-sweeper
@@ -741,7 +742,6 @@ FROM users u
(if (not= offset 0)
(.setAttribute st "prev" (max (dec offset) 0)))
(.setAttribute st "dumps" dumps)
- ;; (.setAttribute st "json_tags" json-tags)
(if (default-room? roomkey)
(.setAttribute st "roomkey" "")
(.setAttribute st "roomkey" (str roomkey ".")))
@@ -1046,6 +1046,11 @@ FROM users u
(.toString st)
(unknown-page)))
+(defn hall-of-fame [session]
+ (let [st (fetch-template "fame" session)]
+ (.setAttribute st "dumps" (map process-message-for-output (poll hall-results)))
+ (.toString st)))
+
;; Compojure Routes
(defn serve-static [dir path]
@@ -1121,6 +1126,8 @@ FROM users u
;; Memes
(GET "/m/:m" (serve-meme session (params :m)))
+
+ (GET "/hall" (hall-of-fame session))
;; Footer pages
(GET "/about_us" (serve-template "about_us" session))
@@ -1217,7 +1224,7 @@ FROM users u
(Thread/sleep 3000)
(start-user-flusher!)
(start-session-pruner!)
-
+(start! hall-results)
(if (= *server-url* "http://dump.fm")
(do (start! feed-downloader)
(start! feed-inserter)))
diff --git a/template/fame.st b/template/fame.st
new file mode 100644
index 0000000..52bceb3
--- /dev/null
+++ b/template/fame.st
@@ -0,0 +1,39 @@
+<html>
+ <head>
+ <title>dump.fm hall of fame</title>
+ $head()$
+ <link rel="stylesheet" type="text/css" href="/static/css/dump.css">
+ <script>
+ jQuery(document).ready(initLog);
+ </script>
+ </head>
+ <body>
+ $banner()$
+ <div id="content">
+ <div id="messagetabs"></div>
+ <div id="rapper">
+ </div>
+
+ <div id="messagePanep">
+
+ <div id="userListp">
+ <h2>Hall Of Fame </h2><br><h3></h3>
+ </div>
+
+ <div id="messageList">
+ $if(dumps)$
+ <span class="content">
+ $dumps: { d | $fame_dump(dump=d)$ }$
+ </span>
+ $else$
+ No dumps!
+ $endif$
+ </div>
+
+ <div id="footerc">
+ $footer()$
+ </div>
+ </div>
+ </div>
+ </body>
+</html>
diff --git a/template/fame_dump.st b/template/fame_dump.st
new file mode 100644
index 0000000..c0fb2a2
--- /dev/null
+++ b/template/fame_dump.st
@@ -0,0 +1,15 @@
+<div class="logged-dump dump" id="message-$dump.message_id$" nick="$dump.nick$">
+
+$dump.created_on$ -- by <a href="/$dump.nick$"><b>$dump.nick$</b>
+ <div id="logavatar">
+$if(dump.avatar)$
+ <img height="50" width="50" src="$dump.avatar$" />
+$else$
+ <img height="50" width="50" src="/static/noinfo.png">
+$endif$
+
+ </div></a> &nbsp;&nbsp;&nbsp;<img height="16px" width="16px" src="http://dump.fm/static/img/thumbs/heartfaved.gif">$dump.count$
+ <div class="content">$dump.content$</div>
+ <hr />
+$share_buttons()$
+ </div>