From 699dc9c754b76490091b5f1108a05953f6b8272c Mon Sep 17 00:00:00 2001 From: dumpfmprod Date: Wed, 24 Feb 2010 08:08:31 -0500 Subject: Added filename check --- static/js/pichat.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/static/js/pichat.js b/static/js/pichat.js index 3137ac4..641662f 100755 --- a/static/js/pichat.js +++ b/static/js/pichat.js @@ -291,8 +291,8 @@ function favoriteImage() {}; function setupUpload(elementId, roomKey) { var onSubmit = function(file, ext) { - if (!(ext && /^(jpg|png|jpeg|gif)$/i.test(ext))) { - alert('Error: invalid file extension ' + ext); + if (!(ext && /^(jpg|png|jpeg|gif|bmp)$/i.test(ext))) { + alert('SORRY, NOT AN IMAGE DUDE... '); return false; } }; -- cgit v1.2.3-70-g09d2 From 0f8f1b234276514560e6df3bb6f6bac56fa9807d Mon Sep 17 00:00:00 2001 From: dumpfmprod Date: Wed, 24 Feb 2010 08:09:42 -0500 Subject: Commit template changes --- template/banner.st | 2 +- template/log.st | 2 +- template/logged_dump.st | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/template/banner.st b/template/banner.st index c67bafa..557a0e0 100755 --- a/template/banner.st +++ b/template/banner.st @@ -18,7 +18,7 @@
  • Image Search
  • $else$    - Register +
    $endif$ diff --git a/template/log.st b/template/log.st index 0a12550..425a0fb 100755 --- a/template/log.st +++ b/template/log.st @@ -1,6 +1,6 @@ - $roomname$ Log + dump.fm log $head()$
    -
    $dump.created_on$ -- by $dump.nick$
    +
    $dump.created_on$ -- by $dump.nick$
    $dump.content$

    -- cgit v1.2.3-70-g09d2 From cf48ab4a81339f327a534585c54e01a57f9dfa86 Mon Sep 17 00:00:00 2001 From: dumpfmprod Date: Wed, 24 Feb 2010 08:38:11 -0500 Subject: Resolved site.clj --- src/site.clj | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/src/site.clj b/src/site.clj index 4db69e8..167f4d5 100755 --- a/src/site.clj +++ b/src/site.clj @@ -661,29 +661,19 @@ (dosync (doseq [room-db (fetch-rooms)] - (alter rooms assoc (room-db :key) - (build-room-map-from-db room-db)))) -<<<<<<< HEAD - -(run-server {:port 8080} - "/static/*" (servlet static) - "/images/*" (servlet static) - "/avatars/*" (servlet static) - "/upload/*" (servlet multipart) - "/*" (servlet pichat)) - -(send-off flusher flush!) -======= + (alter rooms assoc (room-db :key) + (build-room-map-from-db room-db)))) (defn start-server ([port] (run-server {:port port} "/static/*" (servlet static) "/images/*" (servlet static) - "/upload" (servlet multipart) + "/avatars/*" (servlet static) + "/upload/*" (servlet multipart) "/*" (servlet pichat))) ([] (start-server 8080))) (start-server) (start-user-flusher!) (start-session-pruner!) ->>>>>>> 8003ba27e49a630b24090f3af01426f35e85af67 + -- cgit v1.2.3-70-g09d2 From c4b8c62ffe424e8c3b45519d113905384f3b9b87 Mon Sep 17 00:00:00 2001 From: dumpfmprod Date: Wed, 24 Feb 2010 08:38:28 -0500 Subject: Added static content --- static/browsertool.gif | Bin 6231 -> 14805 bytes static/header.css | 22 +++++++++++++++++++++- static/index.html | 2 +- static/pichat.css | 1 + static/profile.css | 4 ++-- static/register.html | 13 ++++++------- 6 files changed, 31 insertions(+), 11 deletions(-) diff --git a/static/browsertool.gif b/static/browsertool.gif index 9777d27..05a3379 100644 Binary files a/static/browsertool.gif and b/static/browsertool.gif differ diff --git a/static/header.css b/static/header.css index 5ad2fbc..5b4e549 100755 --- a/static/header.css +++ b/static/header.css @@ -28,11 +28,13 @@ margin-right:80%; color: #fff; } + #header7{ background-image:url(/static/dblue2.png); background-attachment:inherit; margin: 0px auto -1px auto; top: 0px; +height:38; position:fixed; background-repeat:repeat-x; width:100%; @@ -147,7 +149,7 @@ width:auto; #landscape{ position:absolute; width:auto; - +display:none; margin-left:55%; top:-38; opacity:0.8; @@ -159,6 +161,7 @@ width:auto; left:190; margin-left:29%; top:-19; +display:none; z-index:3; } @@ -188,7 +191,24 @@ z-index:3; #topnav a.signin, #topnav a.signin:hover { *background-position:0 3px!important; } +#register{ + top:-5px; + position:absolute; + font-size: 16px; +height:22; +word-spacing:2; +width:365; +color:#fff; +text-indent:14; +line-height:1.9; +font-weight:bold; + left: -140; + margin-left: 1.2%; + margin-right: 8%; + letter-spacing:.2px; + z-index: 999; +} #banner-menu { position: relative; height: 26px; } diff --git a/static/index.html b/static/index.html index a7e896a..ccdf7ee 100755 --- a/static/index.html +++ b/static/index.html @@ -183,7 +183,7 @@ label {

    Right now dump.fm is invite only...
    - If you have registration code, click here!
    + If you have a registration code, click here!
    diff --git a/static/pichat.css b/static/pichat.css index f01a150..6c693de 100755 --- a/static/pichat.css +++ b/static/pichat.css @@ -309,6 +309,7 @@ border-bottom:2px solid #c8cbce; -moz-box-shadow: 3px 3px 4px #c8cbce; filter: progid:DXImageTransform.Microsoft.dropShadow(color=#c8cbce, offX=3, offY=4, positive=true); text-overflow:ellipsis; +opacity:0.87; z-index:18; text-align: left; } diff --git a/static/profile.css b/static/profile.css index 8ee09d3..7594dab 100755 --- a/static/profile.css +++ b/static/profile.css @@ -162,7 +162,7 @@ color:000; } .logged-dump{ - + max-width:500px; text-overflow: ellipsis-word; padding: 18px; font-family: Arial, Helvetica, sans-serif; @@ -274,7 +274,7 @@ color:#087cff; -moz-box-shadow: 0 0 10px #d8dbde, 0px 0px 10px #d8dbde; padding:20; line-height:1.5; -height:380; +height:auto; margin-top:-100px; width:600; diff --git a/static/register.html b/static/register.html index ce222e1..4d86ac0 100644 --- a/static/register.html +++ b/static/register.html @@ -20,6 +20,8 @@ + + - - - - - - -- cgit v1.2.3-70-g09d2 From c3a98fda15c707f3718e30cf1abb30c1ea042df8 Mon Sep 17 00:00:00 2001 From: Scott Ostler Date: Wed, 24 Feb 2010 09:55:06 -0500 Subject: Added edit-toggle to profile --- static/js/pichat.js | 51 +++++++++++++++++---------- template/profile.st | 99 +++++++++++++++++++++++++++-------------------------- 2 files changed, 83 insertions(+), 67 deletions(-) diff --git a/static/js/pichat.js b/static/js/pichat.js index 071e8e6..d348d93 100755 --- a/static/js/pichat.js +++ b/static/js/pichat.js @@ -240,18 +240,12 @@ function initChat() { setTimeout(refresh, 1000); } -function initProfile() { - jQuery(".linkify").each(function() { - var text = jQuery(this).text(); - jQuery(this).html(linkify(text)); - }); - - - $('.logged-dump .content').each(function() { - var t = $(this); - t.html(buildMsgContent(t.text())); - }); +function makePlainText() { + var j = $(this); + j.text(j.text()); +} +function enableProfileEdit() { var onSubmit = function(attr, newVal, oldVal) { newVal = $.trim(newVal); if (newVal == oldVal) { return oldVal }; @@ -273,22 +267,43 @@ function initProfile() { return escapeHtml(newVal); }; + $('#avatar-editing').show(); + var avatarOpts = { 'default_text': 'Enter here!', 'callback': onSubmit, 'field_type': 'text', 'callbackShowErrors': false }; $('#avatar.editable').editInPlace(avatarOpts); + if ($('#upload').length > 0) { + setupUploadAvatar('upload'); + } + var textareaOpts = { 'default_text': 'Enter here!', 'callback': onSubmit, 'field_type': 'textarea', - 'callbackShowErrors': false }; - $('#contact.editable, #bio.editable').editInPlace(textareaOpts); + 'callbackShowErrors': false }; + $('#contact, #bio') + .addClass('editable') + .editInPlace(textareaOpts) + .each(makePlainText); + + var resetPage = function() { location.reload() }; + $('#edit-toggle a').text('--> Done editing <--').click(resetPage); +} - if ($('#upload').length > 0) { - setupUploadAvatar('upload'); - } +function initProfile() { + $(".linkify").each(function() { + var text = jQuery(this).text(); + jQuery(this).html(linkify(text)); + }); + $('#edit-toggle').click(enableProfileEdit); + + $('.logged-dump .content').each(function() { + var t = $(this); + t.html(buildMsgContent(t.text())); + }); }; function initLog() { @@ -331,9 +346,9 @@ function setupUploadAvatar(elementId) { var onComplete = function(file, resp) { $('#spinner').hide(); if (resp == 'INVALID_REQUEST') { - location.href = location.href; + location.reload(); } else if (resp == 'NOT_LOGGED_IN') { - location.href = location.href; + location.reload(); } else if (resp == 'INVALID_IMAGE') { alert("Sorry, dump.fm can't deal with your image. Pick another :("); return; diff --git a/template/profile.st b/template/profile.st index b5d3f38..52b745c 100755 --- a/template/profile.st +++ b/template/profile.st @@ -34,59 +34,60 @@ $dumps:{ d | $logged_dump(dump=d)$ }$ -
    - -

    $nick$

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

    contact info

    -
    $contact$
    - $elseif(contact)$ -

    contact info

    -
    $contact$
    - $else$ -

    -
    - $endif$ - - -
    - - $if(is_home)$ -

    bio

    -
    $bio$
    - $elseif(bio)$ -

    bio

    -
    $bio$
    - $else$ -
    - $endif$ - - -
    -
    -
    -
    +
    + +

    $nick$

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

    contact info

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

    +
    + $endif$ +
    + +

    bio

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

     

     

    -

     

     

     

    -

     

    -

    ☺✌ Welcome to dump.fm ✌☺

    +

     

    +

     

    +

     

    +
    +

    ☺✌ Welcome to dump.fm ✌☺



    -- cgit v1.2.3-70-g09d2 From 215f4f8bf89aa74091815286c0ff7d7594b6e42f Mon Sep 17 00:00:00 2001 From: Scott Ostler Date: Wed, 24 Feb 2010 09:56:09 -0500 Subject: Renamed db to *db* --- src/site.clj | 12 +++--------- src/utils.clj | 24 ++++++++++++++++-------- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/src/site.clj b/src/site.clj index 167f4d5..fcd2930 100755 --- a/src/site.clj +++ b/src/site.clj @@ -155,12 +155,6 @@ (def *dumps-per-page* 20) -(defn maybe-parse-int [s f] - (if s (Integer/parseInt s) f)) - -(defn maybe-parse-long [s f] - (if s (Long/parseLong s) f)) - (defn count-messages-by-room [room-id image-only] (let [query (str "SELECT COUNT(*) " "FROM messages m, users u " @@ -301,7 +295,7 @@ invalid-nick-reason (is-invalid-nick? nick)] (cond invalid-nick-reason (resp-error invalid-nick-reason) (fetch-nick nick) (resp-error "NICK_TAKEN") - :else (with-connection db + :else (with-connection *db* (insert-values :users [:nick :hash :email] [nick hash email]) @@ -338,7 +332,7 @@ (defn update-user-db [user-id attr val] - (with-connection db + (with-connection *db* (update-values "users" ["user_id = ?" user-id] {attr val}))) (defn download-avatar [session url] @@ -430,7 +424,7 @@ (let [is-image (is-image? content) qry (str "INSERT INTO messages (user_id, room_id, content, is_image) " "VALUES (?, ?, ?, ?) RETURNING message_id")] - (with-connection db + (with-connection *db* ((first (do-select [qry user-id room-id content is-image])) :message_id)))) diff --git a/src/utils.clj b/src/utils.clj index 3ffd54b..33a247f 100755 --- a/src/utils.clj +++ b/src/utils.clj @@ -7,11 +7,11 @@ (let [db-host "localhost" db-port 5432 db-name "dumpfm"] - (def db {:classname "org.postgresql.Driver" - :subprotocol "postgresql" - :subname (str "//" db-host ":" db-port "/" db-name) - :user "postgres" - :password "root"})) + (def *db* {:classname "org.postgresql.Driver" + :subprotocol "postgresql" + :subname (str "//" db-host ":" db-port "/" db-name) + :user "postgres" + :password "root"})) ;; JSON responses @@ -30,12 +30,12 @@ ;; Database (defn do-select [query] - (with-connection db + (with-connection *db* (with-query-results rs query (doall rs)))) (defn do-count [query] - ((first (with-connection db + ((first (with-connection *db* (with-query-results rs query (doall rs)))) :count)) @@ -72,4 +72,12 @@ (defn validated-stats [session params] (if (session :is_admin) (stats session params) - (resp-error "BAD_REQUEST"))) \ No newline at end of file + (resp-error "BAD_REQUEST"))) + +;; Parsing + +(defn maybe-parse-int [s f] + (if s (Integer/parseInt s) f)) + +(defn maybe-parse-long [s f] + (if s (Long/parseLong s) f)) \ No newline at end of file -- cgit v1.2.3-70-g09d2 From 09adb55a01f9c752cf843dd4dc7163a2ea51cfb8 Mon Sep 17 00:00:00 2001 From: Scott Ostler Date: Thu, 25 Feb 2010 08:21:38 -0500 Subject: Added new templates --- template/about_us.st | 7 +++++ template/goodies.st | 8 ++++++ template/head.st | 4 +-- template/help.st | 7 +++++ template/privacy.st | 7 +++++ template/profile.st | 76 +++++++++++++++++++++++++--------------------------- template/terms.st | 7 +++++ 7 files changed, 75 insertions(+), 41 deletions(-) create mode 100644 template/about_us.st create mode 100644 template/goodies.st create mode 100644 template/help.st create mode 100644 template/privacy.st create mode 100644 template/terms.st diff --git a/template/about_us.st b/template/about_us.st new file mode 100644 index 0000000..b8ee9f9 --- /dev/null +++ b/template/about_us.st @@ -0,0 +1,7 @@ + + + About Us + $head()$ + + + diff --git a/template/goodies.st b/template/goodies.st new file mode 100644 index 0000000..a7c0824 --- /dev/null +++ b/template/goodies.st @@ -0,0 +1,8 @@ + + + Goodies + $head()$ + + + + \ No newline at end of file diff --git a/template/head.st b/template/head.st index 46ce6a5..e83e687 100755 --- a/template/head.st +++ b/template/head.st @@ -1,7 +1,7 @@ - - + + diff --git a/template/help.st b/template/help.st new file mode 100644 index 0000000..0d41e21 --- /dev/null +++ b/template/help.st @@ -0,0 +1,7 @@ + + + Help + $head()$ + + + diff --git a/template/privacy.st b/template/privacy.st new file mode 100644 index 0000000..513eca3 --- /dev/null +++ b/template/privacy.st @@ -0,0 +1,7 @@ + + + Privacy + $head()$ + + + \ No newline at end of file diff --git a/template/profile.st b/template/profile.st index 52b745c..26cb5a1 100755 --- a/template/profile.st +++ b/template/profile.st @@ -88,55 +88,53 @@

     

    ☺✌ 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!

    -

     

    +

    + +

    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(next)$ - - $endif$ - -   - $if(prev)$ - - $endif$ - + $if(next)$ + + $endif$ -

    +   + $if(prev)$ + + $endif$ + +

    $users: { u | -
    + diff --git a/template/log.st b/template/log.st index 7281e11..65f149e 100755 --- a/template/log.st +++ b/template/log.st @@ -2,7 +2,7 @@ dump.fm log $head()$ - + @@ -20,6 +20,9 @@
    +
    + +
    $if(dumps)$ $dumps: { d | $logged_dump(dump=d)$ }$ $else$ diff --git a/template/logged_dump.st b/template/logged_dump.st index c7cbbd2..86465e3 100755 --- a/template/logged_dump.st +++ b/template/logged_dump.st @@ -32,7 +32,7 @@ img{
    $dump.created_on$ -- by $dump.nick$
    - +
    $dump.content$

    diff --git a/template/profile.st b/template/profile.st index b5d3f38..9f085c6 100755 --- a/template/profile.st +++ b/template/profile.st @@ -32,8 +32,9 @@ $if(dumps)$ $dumps:{ d | $logged_dump(dump=d)$ }$ - - +
    + +

    $nick$

    @@ -45,8 +46,8 @@ $endif$ $if(is_home)$ -
    $avatar$
    - + + $endif$ -- cgit v1.2.3-70-g09d2 From af00dc516ad125f01189f673ff3d3b35738086fc Mon Sep 17 00:00:00 2001 From: Scott Ostler Date: Thu, 25 Feb 2010 09:41:36 -0500 Subject: Fixed field mis-spelling --- static/register.html | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/static/register.html b/static/register.html index 4d86ac0..c60a319 100644 --- a/static/register.html +++ b/static/register.html @@ -15,13 +15,6 @@