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

BKNR Commits bknr at bknr.net
Wed Jul 16 18:11:24 UTC 2008


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

Snapshot

U   trunk/projects/quickhoney/src/init.lisp
A   trunk/projects/quickhoney/upgrade-stuff/QH_Layout_Overlay_01.png
A   trunk/projects/quickhoney/upgrade-stuff/QH_Layout_Pixel_06_1_floating_flat.png
A   trunk/projects/quickhoney/upgrade-stuff/button-bottom.gif
A   trunk/projects/quickhoney/upgrade-stuff/buy.gif
A   trunk/projects/quickhoney/upgrade-stuff/hey.gif
U   trunk/projects/quickhoney/upgrade-stuff/import.lisp
A   trunk/projects/quickhoney/upgrade-stuff/overlay-close.gif
U   trunk/projects/quickhoney/website/static/javascript.js
U   trunk/projects/quickhoney/website/static/styles.css
U   trunk/projects/quickhoney/website/templates/index.xml

Modified: trunk/projects/quickhoney/src/init.lisp
===================================================================
--- trunk/projects/quickhoney/src/init.lisp	2008-07-16 15:17:06 UTC (rev 3472)
+++ trunk/projects/quickhoney/src/init.lisp	2008-07-16 18:11:24 UTC (rev 3473)
@@ -1,22 +1,33 @@
 (in-package :quickhoney)
 
+(defvar *dumped-image* nil)
+
+(defun dump-executable ()
+  #+openmcl
+  (ccl:save-application "quickhoney" :prepend-kernel t))
+
 (defun startup ()
-  (setq cxml::*default-catalog* '("/home/hans/share/xml/catalog"))
-  (setf *hunchentoot-default-external-format* (flex:make-external-format :utf-8 :eol-style :lf))
-  (close-store)
-  (make-instance 'store
-		 :directory *store-directory*
-		 :subsystems (list (make-instance 'store-object-subsystem)
-				   (make-instance 'blob-subsystem
-						  :n-blobs-per-directory 1000)))
+  (cond
+    (*dumped-image*
+     (asdf:oos 'asdf:load-op :quickhoney)
+     (format t "; starting from dumped image, skipping store initialization~%"))
+    (t
+     (setq cxml::*default-catalog* '("/home/hans/share/xml/catalog"))
+     (setf *hunchentoot-default-external-format* (flex:make-external-format :utf-8 :eol-style :lf))
+     (close-store)
+     (make-instance 'store
+                    :directory *store-directory*
+                    :subsystems (list (make-instance 'store-object-subsystem)
+                                      (make-instance 'blob-subsystem
+                                                     :n-blobs-per-directory 1000)))
 
-  (unless (class-instances 'bknr.cron::cron-job)
-    (bknr.cron:make-cron-job "daily statistics" 'make-yesterdays-statistics 1 0 :every :every)
-    (bknr.cron:make-cron-job "snapshot" 'snapshot-store 0 5 :every :every))
-  (unless (class-instances 'rss-channel)
-    (make-rss-channel "quickhoney" "QuickHoney" "QuickHoney Illustrations" "rss/quickhoney"
-                      :items (class-instances 'quickhoney-image)))
-  (cl-gd::load-gd-glue)
+     (unless (class-instances 'bknr.cron::cron-job)
+       (bknr.cron:make-cron-job "daily statistics" 'make-yesterdays-statistics 1 0 :every :every)
+       (bknr.cron:make-cron-job "snapshot" 'snapshot-store 0 5 :every :every))
+     (unless (class-instances 'rss-channel)
+       (make-rss-channel "quickhoney" "QuickHoney" "QuickHoney Illustrations" "rss/quickhoney"
+                         :items (class-instances 'quickhoney-image)))
+     (cl-gd::load-gd-glue)))
   #+cmu
   (actor-start (make-instance 'cron-actor))
   (publish-quickhoney)

Added: trunk/projects/quickhoney/upgrade-stuff/QH_Layout_Overlay_01.png
===================================================================
(Binary files differ)


Property changes on: trunk/projects/quickhoney/upgrade-stuff/QH_Layout_Overlay_01.png
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:mime-type
   + application/octet-stream

Added: trunk/projects/quickhoney/upgrade-stuff/QH_Layout_Pixel_06_1_floating_flat.png
===================================================================
(Binary files differ)


Property changes on: trunk/projects/quickhoney/upgrade-stuff/QH_Layout_Pixel_06_1_floating_flat.png
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:mime-type
   + application/octet-stream

Added: trunk/projects/quickhoney/upgrade-stuff/button-bottom.gif
===================================================================
(Binary files differ)


Property changes on: trunk/projects/quickhoney/upgrade-stuff/button-bottom.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/projects/quickhoney/upgrade-stuff/buy.gif
===================================================================
(Binary files differ)


Property changes on: trunk/projects/quickhoney/upgrade-stuff/buy.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/projects/quickhoney/upgrade-stuff/hey.gif
===================================================================
(Binary files differ)


Property changes on: trunk/projects/quickhoney/upgrade-stuff/hey.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Modified: trunk/projects/quickhoney/upgrade-stuff/import.lisp
===================================================================
--- trunk/projects/quickhoney/upgrade-stuff/import.lisp	2008-07-16 15:17:06 UTC (rev 3472)
+++ trunk/projects/quickhoney/upgrade-stuff/import.lisp	2008-07-16 18:11:24 UTC (rev 3473)
@@ -3,4 +3,7 @@
 (dolist (name '(#p"type-news.png" #p"type-pixel.png" #p"type-shop.png" #p"type-vector.png"))
   (import-image name :keywords '(:type)))
 
+(dolist (name '(#P"overlay-close.gif" #P"hey.gif" #P"buy.gif" #P"button-bottom.gif"))
+  (import-image name))
+
 (import-image #p"news-sep.png")
\ No newline at end of file

Added: trunk/projects/quickhoney/upgrade-stuff/overlay-close.gif
===================================================================
(Binary files differ)


Property changes on: trunk/projects/quickhoney/upgrade-stuff/overlay-close.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Modified: trunk/projects/quickhoney/website/static/javascript.js
===================================================================
--- trunk/projects/quickhoney/website/static/javascript.js	2008-07-16 15:17:06 UTC (rev 3472)
+++ trunk/projects/quickhoney/website/static/javascript.js	2008-07-16 18:11:24 UTC (rev 3473)
@@ -49,7 +49,7 @@
     for (var i = 0; i < arguments.length; i++) {
         message += arguments[i];
     }
-    if (window.console.log) {
+    if (window.console && window.console.log) {
         window.console.log(message);
     }
     if (want_debugger) {
@@ -869,10 +869,10 @@
     footer_hide();
     display_path();
     make_images_navbar();
+    make_image_action_buttons();
 
     $("results").style.visibility = 'hidden';
     $("browse").style.visibility = 'visible';
-    $("digg_picture_name").innerHTML = current_image.name;
 
     var ratio = 1 / Math.max(current_image.width / 648, current_image.height / 648);
     var imageproc_ops = "";
@@ -972,13 +972,14 @@
     }
 }
 
-function digg_send()
+function hey_send()
 {
     var d = doXHR("/digg-image/" + current_image.id,
                   { method: 'POST',
                     headers: {"Content-Type":"application/x-www-form-urlencoded"},
-                    sendContent: queryString({ from: $('digg_from').value, text: $('digg_text').value }) })
-        .addCallback(function () { alert('sent'); });
+                    sendContent: queryString({ from: $('hey_from').value, text: $('hey_text').value }) })
+        .addCallback(hide_overlay);
+    make_overlay('send-comment', 'Sending your comment', 300);
     return false;
 }
 
@@ -1144,3 +1145,78 @@
 {
     document.location.href = document.location.href.replace(/\/image-browse.*/, "index#");
 }
+
+function hide_overlay()
+{
+    $('overlay').style.visibility = 'hidden';
+    return false;
+}
+
+/* make_overlay() opens an overlay window with the given title.
+ * Additional arguments passed are assumed to be DOM child nodes and
+ * are added to the overlay window.
+ */
+
+function make_overlay(id, title, width)
+{
+    var overlay = $('overlay');
+    overlay.className = current_directory;
+    replaceChildNodes(overlay,
+                      H1(null, title),
+                      IMG({ src: '/image/overlay-close/color,000000,' + pages[current_directory].colors[2],
+                                  id: 'close', width: 13, height: 13}));
+    overlay.style.width = width + 'px';
+    $('close').style.left = (width - 23) + 'px';
+    $('close').onclick = hide_overlay;
+    var elements = [];
+    for (var i = 3; i < arguments.length; i++) {
+        elements.push(arguments[i]);
+    }
+    appendChildNodes(overlay, DIV({id: id}, elements));
+    overlay.style.visibility = 'inherit';
+}
+
+function make_hey_form()
+{
+    var subject = 'Comment on ' + current_image.name;
+    make_overlay('hey', 'Comment', 320,
+                 FORM({ method: 'POST', action: '#' },
+                      'email',
+                      BR(),
+                      INPUT({ type: 'text', id: 'hey_from', value: '' }),
+                      BR(),
+                      BR(),
+                      'comment',
+                      BR(),
+                      TEXTAREA({ name: 'text', id: 'hey_text', rows: 4, columns: 40 }, ''),
+                      BR(),
+                      INPUT({ type: 'submit', id: 'hey_send', value: 'Send' })));
+    $('hey_send').onclick = hey_send;
+}
+
+function make_buy_form()
+{
+}
+
+function recolored_image_path(name)
+{
+    return '/image/' + name + '/color,000000,' + pages[current_directory].colors[2];
+}
+
+function make_image_action_button(name, action)
+{
+    var div = DIV(null, IMG({ src: recolored_image_path(name), width: 60, height: 23 }));
+    div.onclick = function() { action(); return false; };
+    return div;
+}
+
+function make_image_action_buttons()
+{
+    var buttons = [];
+    if (1 || current_image.download_product) {
+        buttons.push(make_image_action_button('buy', make_buy_form));
+    }
+    buttons.push(make_image_action_button('hey', make_hey_form));
+    buttons.push(DIV(null, IMG({ src: recolored_image_path('button-bottom'), width: 60, height: 1 })));
+    replaceChildNodes('image_action_buttons', buttons);
+}
\ No newline at end of file

Modified: trunk/projects/quickhoney/website/static/styles.css
===================================================================
--- trunk/projects/quickhoney/website/static/styles.css	2008-07-16 15:17:06 UTC (rev 3472)
+++ trunk/projects/quickhoney/website/static/styles.css	2008-07-16 18:11:24 UTC (rev 3473)
@@ -377,17 +377,6 @@
 	z-index: 1;
 }
 
-/* digg form */
-
-div#digg {
-        position: absolute;
-        left: 700px;
-        top: 500px;
-        z-index: 10;
-        background-color: #eee;
-        padding: 10px;
-}
-
 /* news styles */
 
 div#news_page {
@@ -495,3 +484,48 @@
 #frontpage div p {
         margin: 2em;
 }
+
+#overlay {
+         z-index: 100;
+         position: absolute;
+         background: white;
+         border: 1px solid #000000;
+         margin: 0px;
+         padding: 0px;
+}
+
+#overlay #close {
+         position: absolute;
+         top: 12px;
+}
+
+#overlay h1 {
+         margin-left: 10px;
+}
+
+#overlay.pixel h1, #overlay.pixel h2 {
+         color: #ff00ff;
+}
+
+#overlay.vector h1, #overlay.vector h2 {
+         color: #00ccff;
+}
+
+#image_action_buttons {
+	position: absolute;
+        left: 584px;
+        top: 32px;
+        z-index: 100;
+}
+
+#overlay #hey {
+         padding: 10px 15px 10px 10px;
+}
+
+#overlay #hey #hey_from, #overlay #hey textarea {
+         width: 100%;
+}
+
+#overlay #hey #hey_send {
+         margin-top: 5px;
+}
\ No newline at end of file

Modified: trunk/projects/quickhoney/website/templates/index.xml
===================================================================
--- trunk/projects/quickhoney/website/templates/index.xml	2008-07-16 15:17:06 UTC (rev 3472)
+++ trunk/projects/quickhoney/website/templates/index.xml	2008-07-16 18:11:24 UTC (rev 3473)
@@ -24,6 +24,9 @@
 
   <body id="body">
 
+    <div id="overlay">
+    </div>
+
     <div id="menu">
       <a onclick="show_page('home')" href="#home">
         <img alt="home" class="menu" id="m_home" src="/image/quickhoney" />
@@ -108,6 +111,9 @@
           </span>
         </span>
         
+        <div id="image_action_buttons">
+        </div>
+
         <div id="image_detail">
         </div>
         
@@ -175,18 +181,6 @@
       </div>
     </div>
 
-    <div id="digg">
-      <form id="digg_form" method="post" action="#">
-        From: <input type="text" id="digg_from" value=""/>
-        <br/>
-        Your comment on <b id="digg_picture_name"> </b>:
-        <br/>
-        <textarea name="text" id="digg_text" rows="10" cols="60"> </textarea>
-        <br/>
-        <button type="submit" onclick="return digg_send();">send</button>
-      </form>
-    </div>
-
     <!-- CMS elements -->
 
     <div id="cms">




More information about the Bknr-cvs mailing list