[bknr-cvs] hans changed trunk/projects/quickhoney/

BKNR Commits bknr at bknr.net
Fri Sep 12 15:06:47 UTC 2008


Revision: 3897
Author: hans
URL: http://bknr.net/trac/changeset/3897

Support QuickTime movie uploads.
Small other tweaks.

U   trunk/projects/quickhoney/src/handlers.lisp
U   trunk/projects/quickhoney/src/init.lisp
U   trunk/projects/quickhoney/src/tags.lisp
U   trunk/projects/quickhoney/upgrade-stuff/import.lisp
U   trunk/projects/quickhoney/website/static/javascript.js
U   trunk/projects/quickhoney/website/templates/index.xml
U   trunk/projects/quickhoney/website/templates/login.xml

Modified: trunk/projects/quickhoney/src/handlers.lisp
===================================================================
--- trunk/projects/quickhoney/src/handlers.lisp	2008-09-12 14:54:52 UTC (rev 3896)
+++ trunk/projects/quickhoney/src/handlers.lisp	2008-09-12 15:06:47 UTC (rev 3897)
@@ -399,14 +399,17 @@
 	  (progn
 	    (unless (and uploaded-image uploaded-animation)
 	      (error "files not uploaded"))
-	    (unless (find (upload-content-type uploaded-animation) '("application/x-shockwave-flash" "video/quicktime" "application/x-director")
+	    (unless (find (upload-content-type uploaded-animation)
+                          '("application/x-shockwave-flash" "video/quicktime" "application/x-director")
                           :test #'equal)
-	      (error "Invalid content type ~A - Please upload a Flash, Shockwave or Quicktime file" (upload-content-type uploaded-animation)))
+	      (error "Invalid content type ~A - Please upload a Flash, Shockwave or Quicktime file"
+                     (upload-content-type uploaded-animation)))
 	    (with-image-from-upload* (uploaded-image)
 	      (let* ((animation-blob (make-blob-from-file (upload-pathname uploaded-animation) 'blob
 							  :type (upload-content-type uploaded-animation)))
 		     (image (make-store-image :name (pathname-name (upload-original-filename uploaded-image))
-                                              :type (make-keyword-from-string (pathname-type (upload-original-filename uploaded-image)))
+                                              :type (make-keyword-from-string (pathname-type
+                                                                               (upload-original-filename uploaded-image)))
 					      :class-name 'quickhoney-animation-image
 					      :keywords (list :upload)
 					      :initargs (list :cat-sub (list :pixel :animation)

Modified: trunk/projects/quickhoney/src/init.lisp
===================================================================
--- trunk/projects/quickhoney/src/init.lisp	2008-09-12 14:54:52 UTC (rev 3896)
+++ trunk/projects/quickhoney/src/init.lisp	2008-09-12 15:06:47 UTC (rev 3897)
@@ -28,6 +28,8 @@
        (make-rss-channel "quickhoney" "QuickHoney" "QuickHoney Illustrations" "rss/quickhoney"
                          :items (class-instances 'quickhoney-image)))
      (cl-gd::load-gd-glue)))
+  (ensure-directories-exist
+   (setf tbnl:*tmp-directory* (merge-pathnames "hunchentoot-tmp/" *store-directory*)))
   #+cmu
   (actor-start (make-instance 'cron-actor))
   (publish-quickhoney)

Modified: trunk/projects/quickhoney/src/tags.lisp
===================================================================
--- trunk/projects/quickhoney/src/tags.lisp	2008-09-12 14:54:52 UTC (rev 3896)
+++ trunk/projects/quickhoney/src/tags.lisp	2008-09-12 15:06:47 UTC (rev 3897)
@@ -104,12 +104,13 @@
        (emit-tag-children)))))
 
 (define-bknr-tag login-status ()
-  (cond
-    ((bknr.web::admin-p (bknr-session-user))
-     (redirect "/index"))
-    ((and (bknr.web::anonymous-p (bknr-session-user))
-          (query-param "__username"))
-     (html (:h1 "Login failed, please try again")))
-    (t
-     (html (:h1 "Please login")))))
+  (with-query-params (login)
+    (cond
+      ((bknr.web::admin-p (bknr-session-user))
+       (redirect (or login "/")))
+      ((and (bknr.web::anonymous-p (bknr-session-user))
+            (query-param "__username"))
+       (html (:h1 "Login failed, please try again")))
+      (t
+       (html (:h1 "Please login"))))))
 

Modified: trunk/projects/quickhoney/upgrade-stuff/import.lisp
===================================================================
--- trunk/projects/quickhoney/upgrade-stuff/import.lisp	2008-09-12 14:54:52 UTC (rev 3896)
+++ trunk/projects/quickhoney/upgrade-stuff/import.lisp	2008-09-12 15:06:47 UTC (rev 3897)
@@ -84,3 +84,7 @@
               #'>
               :key #'blob-timestamp)))
 
+(with-transaction (:initialize-animation-mime-types)
+  (dolist (animation (mapcar #'quickhoney-animation-image-animation (class-instances 'quickhoney-animation-image)))
+    (unless (slot-boundp animation 'bknr.datastore::type)
+      (setf (slot-value animation 'bknr.datastore::type) "application/x-shockwave-flash"))))
\ No newline at end of file

Modified: trunk/projects/quickhoney/website/static/javascript.js
===================================================================
--- trunk/projects/quickhoney/website/static/javascript.js	2008-09-12 14:54:52 UTC (rev 3896)
+++ trunk/projects/quickhoney/website/static/javascript.js	2008-09-12 15:06:47 UTC (rev 3897)
@@ -1162,6 +1162,8 @@
     }
     document.location.href = "/#" + path;
 
+    log('init_applicaton done');
+
     poll_path();
 
     application_initialized = true;

Modified: trunk/projects/quickhoney/website/templates/index.xml
===================================================================
--- trunk/projects/quickhoney/website/templates/index.xml	2008-09-12 14:54:52 UTC (rev 3896)
+++ trunk/projects/quickhoney/website/templates/index.xml	2008-09-12 15:06:47 UTC (rev 3897)
@@ -233,11 +233,11 @@
       <div id="upload_animation_form" class="cms_form">
         <form id="upload_animation_form_element" action="/upload-animation" method="post"
               enctype="multipart/form-data" target="upload_result" onsubmit="do_upload(this.target);">
-          <div class="cms_title">Upload new animatoin</div>
+          <div class="cms_title">Upload new animation</div>
           <p class="cms">
             Image:<br />
             <input type="file" name="image-file" /><br />
-            Animation (Flash File):<br />
+            Animation (Flash file or QuickTime movie):<br />
             <input type="file" name="animation-file" /><br />
           </p>
           <p class="cms">

Modified: trunk/projects/quickhoney/website/templates/login.xml
===================================================================
--- trunk/projects/quickhoney/website/templates/login.xml	2008-09-12 14:54:52 UTC (rev 3896)
+++ trunk/projects/quickhoney/website/templates/login.xml	2008-09-12 15:06:47 UTC (rev 3897)
@@ -34,7 +34,8 @@
           </tr>
         </tbody>
       </table>
-      <button name="login" type="submit">login</button>
+      <button name="login" type="submit" value="/">login</button>
+      <button name="login" type="submit" value="/admin">login to admin area</button>
     </form>
 
     <h1 id="logging-in" style="display: none">Logging in...</h1>




More information about the Bknr-cvs mailing list