From 85fce6db3ab0deff9624741adf6bdf6e43803093 Mon Sep 17 00:00:00 2001 From: timb Date: Sat, 20 Mar 2010 01:21:05 -0700 Subject: put people right into the chat --- src/site.clj | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/site.clj b/src/site.clj index b3e7e70..b6643a9 100755 --- a/src/site.clj +++ b/src/site.clj @@ -284,9 +284,10 @@ ;; Landing (defn landing [session] - (if (session :nick) - (redirect-to "/chat") - (serve-file "static" "index.html"))) + (redirect-to "/chat")) +; (if (session :nick) +; (redirect-to "/chat") +; (serve-file "static" "index.html"))) (defn login [session params cookies] (let [nick (params :nick) -- cgit v1.2.3-70-g09d2 From f6cfd190a8a118d08d0c66818c94028f4336f5bb Mon Sep 17 00:00:00 2001 From: sostler Date: Sat, 20 Mar 2010 22:57:04 -0400 Subject: Added variable chat templates --- src/site.clj | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/site.clj b/src/site.clj index b6643a9..f36d740 100755 --- a/src/site.clj +++ b/src/site.clj @@ -285,9 +285,6 @@ (defn landing [session] (redirect-to "/chat")) -; (if (session :nick) -; (redirect-to "/chat") -; (serve-file "static" "index.html"))) (defn login [session params cookies] (let [nick (params :nick) @@ -518,10 +515,11 @@ (or (not (room :admin_only)) (session :is_admin))))) -(defn chat [session room] +;; 3/20/10: add template so multiple chat urls for ryder +(defn chat [session room template] (let [now (System/currentTimeMillis) nick (session :nick) - st (fetch-template "chat" session) + st (fetch-template template session) message-list (to-array (map process-message-for-output ; TODO: remove db query @@ -540,9 +538,9 @@ (.setAttribute st "timestamp" now) (.toString st))) -(defn validated-chat [session room-key] +(defn validated-chat [session room-key template] (if (validate-room-access room-key session) - (chat session (@rooms room-key)) + (chat session (@rooms room-key) template) (resp-error "UNKNOWN_ROOM"))) (defn refresh [session params room] @@ -781,7 +779,8 @@ (GET "/logout" (logout session)) (GET "/register" (serve-static "static" "register.html")) (GET "/:room/chat" (no-cache (validated-chat session (-> request :route-params :room)))) - (GET "/chat" (no-cache (validated-chat session "RoomA"))) + (GET "/chat" (no-cache (validated-chat session "RoomA" "chat"))) + (GET "/chat/:t" (no-cache (validated-chat session "RoomA" (-> request :route-params :t)))) (GET "/browser" (browser session)) (GET "/refresh" (validated-refresh session params)) (GET "/log" (validated-log session "RoomA" "0" params)) @@ -792,7 +791,6 @@ (-> request :route-params :room) (-> request :route-params :offset) params)) - ;; TODO: validate POST Referrer headers for POSTs (POST "/msg" (validated-msg session params)) (POST "/submit-registration" (register session params)) (POST "/update-profile" (update-profile session params)) -- cgit v1.2.3-70-g09d2 From 4756d85e0b31eda680bbe8ba65ee84eec26f11a6 Mon Sep 17 00:00:00 2001 From: sostler Date: Sat, 20 Mar 2010 23:11:05 -0400 Subject: Fix room/chat routing bug --- src/site.clj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/site.clj b/src/site.clj index f36d740..16d7aee 100755 --- a/src/site.clj +++ b/src/site.clj @@ -757,7 +757,7 @@ ; TODO: cache policy for other static files (js, css, etc.) (let [cache-header (if (re-find pic-regex path) {:headers {"Cache-Control" "max-age=604800,public"}} - {})] + {}] [cache-header (serve-file dir path)])) @@ -778,7 +778,7 @@ (GET "/login" (login session params cookies)) (GET "/logout" (logout session)) (GET "/register" (serve-static "static" "register.html")) - (GET "/:room/chat" (no-cache (validated-chat session (-> request :route-params :room)))) + (GET "/:room/chat" (no-cache (validated-chat session (-> request :route-params :room) "chat"))) (GET "/chat" (no-cache (validated-chat session "RoomA" "chat"))) (GET "/chat/:t" (no-cache (validated-chat session "RoomA" (-> request :route-params :t)))) (GET "/browser" (browser session)) -- cgit v1.2.3-70-g09d2 From 5cb38dd389948bc2aae5dea175dd36b1f4e4d20b Mon Sep 17 00:00:00 2001 From: sostler Date: Sat, 20 Mar 2010 23:15:21 -0400 Subject: Fix bug --- src/site.clj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/site.clj b/src/site.clj index 16d7aee..39509a9 100755 --- a/src/site.clj +++ b/src/site.clj @@ -757,7 +757,7 @@ ; TODO: cache policy for other static files (js, css, etc.) (let [cache-header (if (re-find pic-regex path) {:headers {"Cache-Control" "max-age=604800,public"}} - {}] + {})] [cache-header (serve-file dir path)])) -- cgit v1.2.3-70-g09d2 From 5a94d94fef2748cc6d22cebbcd0b1eb85d0b7798 Mon Sep 17 00:00:00 2001 From: sostler Date: Sun, 21 Mar 2010 00:56:06 -0400 Subject: Added room names to profiles --- src/site.clj | 2 +- template/log.st | 45 +++++----- template/log_dump.st | 18 ++++ template/profile.st | 222 +++++++++++++++++++++++------------------------ template/profile_dump.st | 18 ++++ 5 files changed, 166 insertions(+), 139 deletions(-) create mode 100644 template/log_dump.st create mode 100644 template/profile_dump.st (limited to 'src') diff --git a/src/site.clj b/src/site.clj index 39509a9..b6d0ee9 100755 --- a/src/site.clj +++ b/src/site.clj @@ -188,7 +188,7 @@ (defn fetch-messages-by-nick ([nick image-only] (fetch-messages-by-nick nick image-only 0)) ([nick image-only offset] - (let [query (str "SELECT m.content, m.created_on, m.message_id, u.nick, u.avatar + (let [query (str "SELECT m.content, m.created_on, m.message_id, u.nick, u.avatar, r.key FROM messages m, users u, rooms r WHERE m.user_id = u.user_id AND u.nick = ? AND r.room_id = m.room_id AND r.admin_only = false " diff --git a/template/log.st b/template/log.st index 145f8c6..45de47e 100755 --- a/template/log.st +++ b/template/log.st @@ -2,50 +2,45 @@ dump.fm log $head()$ - + $banner()$ -
- - +

-
+
-
- $if(dumps)$ - $dumps: { d | $logged_dump(dump=d)$ }$ - $else$ - No dumps! - $endif$ -
- - $if(next)$ - +
+ $if(dumps)$ + $dumps: { d | $log_dump(dump=d)$ }$ + $else$ + No dumps! $endif$ +
-   - $if(prev)$ - - $endif$ + $if(next)$ + + $endif$ +   + $if(prev)$ + + $endif$ -

+

-
- - +
- +
+ diff --git a/template/log_dump.st b/template/log_dump.st new file mode 100644 index 0000000..49aab4b --- /dev/null +++ b/template/log_dump.st @@ -0,0 +1,18 @@ +
+
+ $dump.created_on$ -- by $dump.nick$ +
+ +
+ + $if(dump.avatar)$ + + $else$ + + $endif$ + +
+
$dump.content$
+
+ $share_buttons()$ +
diff --git a/template/profile.st b/template/profile.st index bca6a8b..377346f 100755 --- a/template/profile.st +++ b/template/profile.st @@ -7,143 +7,139 @@ - - - - + - + $banner()$
-
+

- +
- $if(dumps)$ - -
- + $if(dumps)$ +
+
+ + $dumps:{ d | $profile_dump(dump=d)$ }$ +
- $dumps:{ d | $logged_dump(dump=d)$ }$ -
+

$nick$

+ $if(avatar)$ + + $else$ + + $endif$ + + $if(is_home)$ + + $endif$ + +

contact info

+ $if(contact)$ +
$contact$
+ $else$ +
+ $endif$ +
+ +

bio

+ $if(bio)$ +
$bio$
+ $else$ +
+ $endif$ + + $if(is_home)$ +
+ + $endif$ + +
+
+
+
-

$nick$

- $if(avatar)$ - - $else$ - - $endif$ - - $if(is_home)$ - - $endif$ - -

contact info

- $if(contact)$ -
$contact$
- $else$ -
- $endif$ -
- -

bio

- $if(bio)$ -
$bio$
$else$ -
+

 

+

 

+

 

+

 

+

 

+

 

+
+

Welcome to dump.fm

+

+ +

Step ❶

+

☟ Find a sweet image for your avatar, paste the URL below ☟

+ $if(avatar)$ + + $else$ + + $endif$ + + $if(is_home)$ +
+
$avatar$
+ + +
+ $endif$ + +

Step ❷

+

☟ Enter some contact info below ☟

+
$contact$
+
+ +

Step ❸

+

☟ Enter some personal info below ☟

+
$bio$
+
+

Step ❹

+ +

Join the ♣ and start posting pictures!

+

 

+

 

+

 

+

 

+

 

+

 

$endif$ + +

 

+
- $if(is_home)$ -
- - $endif$ - -
-
-
-
+ $if(next)$ + + $endif$ - $else$ -

 

-

 

-

 

-

 

-

 

-

 

-
-

Welcome to dump.fm

-

- -

Step ❶

-

☟ Find a sweet image for your avatar, paste the URL below ☟

- $if(avatar)$ - - $else$ - - $endif$ - - $if(is_home)$ -
-
$avatar$
- - +   + $if(prev)$ + + $endif$ + +

- $endif$ - -

Step ❷

-

☟ Enter some contact info below ☟

-
$contact$
-
- -

Step ❸

-

☟ Enter some personal info below ☟

-
$bio$
-
-

Step ❹

- -

Join the ♣ and start posting pictures!

-

 

-

 

-

 

-

 

-

 

-

 

- $endif$ - -

 

-
- - $if(next)$ - - $endif$ -   - $if(prev)$ - - $endif$ - -

+
- - -
-$preload()$ + $preload()$ diff --git a/template/profile_dump.st b/template/profile_dump.st new file mode 100644 index 0000000..52001d6 --- /dev/null +++ b/template/profile_dump.st @@ -0,0 +1,18 @@ +
+
+ $dump.created_on$ -- in $dump.key$ +
+ +
+ + $if(dump.avatar)$ + + $else$ + + $endif$ + +
+
$dump.content$
+
+ $share_buttons()$ +
-- cgit v1.2.3-70-g09d2 From e998ac72a7479ed28024133f90e688004d7d95d6 Mon Sep 17 00:00:00 2001 From: sostler Date: Sun, 21 Mar 2010 11:46:25 -0400 Subject: fix browser --- src/site.clj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/site.clj b/src/site.clj index b6d0ee9..78d745b 100755 --- a/src/site.clj +++ b/src/site.clj @@ -610,7 +610,7 @@ ;; Browser (defn browser [session] - (let [room (@rooms "RoomA") + (let [room (@rooms "dumpfm") now (System/currentTimeMillis) nick (session :nick) st (fetch-template "browser" session)] -- cgit v1.2.3-70-g09d2 From c21d4e2ba126aa751920fa7a4fea2e6c6d4c97dd Mon Sep 17 00:00:00 2001 From: sostler Date: Sun, 21 Mar 2010 11:56:00 -0400 Subject: Fix room key --- src/site.clj | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/site.clj b/src/site.clj index 78d745b..55a668a 100755 --- a/src/site.clj +++ b/src/site.clj @@ -779,11 +779,11 @@ (GET "/logout" (logout session)) (GET "/register" (serve-static "static" "register.html")) (GET "/:room/chat" (no-cache (validated-chat session (-> request :route-params :room) "chat"))) - (GET "/chat" (no-cache (validated-chat session "RoomA" "chat"))) - (GET "/chat/:t" (no-cache (validated-chat session "RoomA" (-> request :route-params :t)))) + (GET "/chat" (no-cache (validated-chat session "dumpfm" "chat"))) + (GET "/chat/:t" (no-cache (validated-chat session "dumpfm" (-> request :route-params :t)))) (GET "/browser" (browser session)) (GET "/refresh" (validated-refresh session params)) - (GET "/log" (validated-log session "RoomA" "0" params)) + (GET "/log" (validated-log session "dumpfm" "0" params)) (GET "/:room/log" (validated-log session (-> request :route-params :room) "0" params)) -- cgit v1.2.3-70-g09d2