[bknr-cvs] hans changed trunk/projects/quickhoney/
BKNR Commits
bknr at bknr.net
Sat Jul 19 14:16:31 UTC 2008
Revision: 3521
Author: hans
URL: http://bknr.net/trac/changeset/3521
Checkpoint.
U trunk/projects/quickhoney/src/handlers.lisp
U trunk/projects/quickhoney/src/image.lisp
A trunk/projects/quickhoney/upgrade-stuff/add-to-cart.gif
A trunk/projects/quickhoney/upgrade-stuff/checkout.gif
U trunk/projects/quickhoney/upgrade-stuff/import.lisp
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/handlers.lisp
===================================================================
--- trunk/projects/quickhoney/src/handlers.lisp 2008-07-19 11:42:24 UTC (rev 3520)
+++ trunk/projects/quickhoney/src/handlers.lisp 2008-07-19 14:16:31 UTC (rev 3521)
@@ -38,32 +38,30 @@
(defclass image-query-js-handler (javascript-handler object-handler)
())
+(defparameter *editable-keywords* '(:explicit :buy-file :buy-print :buy-t-shirt)
+ "List of keywords that are image keywords which can be edited through the CMS")
+
(defmethod object-handler-get-object ((handler image-query-js-handler))
(sort (remove-if-not #'(lambda (object) (subtypep (type-of object) 'quickhoney-image))
(get-keywords-intersection-store-images (mapcar #'make-keyword-from-string (decoded-handler-path handler))))
#'< :key #'blob-timestamp))
(defmethod image-to-javascript ((image quickhoney-image))
- (format nil " new parent.ServerImage(~S, ~D, ~S, ~D, ~D, ~S, ~S, ~A)"
+ (format nil " new parent.ServerImage(~S, ~D, ~S, ~D, ~D, ~S, ~S, ~S, {~{~A~^,~}})"
(store-image-name image)
(store-object-id image)
(image-content-type (blob-mime-type image))
(store-image-width image)
(store-image-height image)
(or (quickhoney-image-client image) "")
+ (if (typep image 'quickhoney-animation-image)
+ (image-content-type (blob-mime-type (quickhoney-animation-image-animation image)))
+ "")
(or (quickhoney-image-spider-keywords image) "")
- (if (quickhoney-image-explicit image) "true" "false")))
+ (mapcar (lambda (keyword)
+ (format nil "~(~A~):true" (substitute #\_ #\- (symbol-name keyword))))
+ (intersection *editable-keywords* (store-image-keywords image)))))
-(defmethod image-to-javascript ((image quickhoney-animation-image))
- (format nil " new parent.ServerImage(~S, ~D, ~S, ~D, ~D, ~S, ~S)"
- (store-image-name image)
- (store-object-id image)
- (image-content-type (blob-mime-type image))
- (store-image-width image)
- (store-image-height image)
- (or (quickhoney-image-client image) "")
- (image-content-type (blob-mime-type (quickhoney-animation-image-animation image)))))
-
(defmethod layout-to-javascript ((layout layout))
(with-output-to-string (*standard-output*)
(format t "[~%")
@@ -110,12 +108,20 @@
(defmethod handle-object-form ((handler edit-image-js-handler) action image)
(format t "; invalid action ~A or invalid object ~A~%" action image))
+(defun set-image-keywords-from-request-parameters (image)
+ (setf (store-image-keywords image)
+ (set-difference (store-image-keywords image) *editable-keywords*))
+ (dolist (keyword *editable-keywords*)
+ (when (query-param (string-downcase (symbol-name keyword)))
+ (push keyword (store-image-keywords image))))
+ (store-image-keywords image))
+
(defmethod handle-object-form ((handler edit-image-js-handler) (action (eql :edit)) image)
- (with-query-params (client spider-keywords explicit)
+ (with-query-params (client spider-keywords)
(with-transaction (:edit-image)
(setf (quickhoney-image-client image) client
- (quickhoney-image-spider-keywords image) spider-keywords
- (quickhoney-image-explicit image) (when explicit t)))
+ (quickhoney-image-spider-keywords image) spider-keywords)
+ (set-image-keywords-from-request-parameters image))
(format *js-stream* "parent.image_edited()~%")))
(defmethod handle-object-form ((handler edit-image-js-handler) (action (eql :delete)) (image quickhoney-image))
Modified: trunk/projects/quickhoney/src/image.lisp
===================================================================
--- trunk/projects/quickhoney/src/image.lisp 2008-07-19 11:42:24 UTC (rev 3520)
+++ trunk/projects/quickhoney/src/image.lisp 2008-07-19 14:16:31 UTC (rev 3521)
@@ -6,12 +6,14 @@
:index-reader images-for-client
:index-keys all-clients)
(spider-keywords :update :initform nil)
- (products :update :initform nil)
- (explicit :update :initform nil)))
+ (products :update :initform nil)))
(defmethod rss-item-pub-date ((item quickhoney-image))
(blob-timestamp item))
+(defmethod quickhoney-image-explicit ((image quickhoney-image))
+ (member :explicit (store-image-keywords image)))
+
(defmethod rss-item-encoded-content ((image quickhoney-image))
(let* ((category (first (intersection (store-image-keywords image) '(:vector :pixel))))
(is-vector (eq category :vector)))
Added: trunk/projects/quickhoney/upgrade-stuff/add-to-cart.gif
===================================================================
(Binary files differ)
Property changes on: trunk/projects/quickhoney/upgrade-stuff/add-to-cart.gif
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ application/octet-stream
Added: trunk/projects/quickhoney/upgrade-stuff/checkout.gif
===================================================================
(Binary files differ)
Property changes on: trunk/projects/quickhoney/upgrade-stuff/checkout.gif
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/projects/quickhoney/upgrade-stuff/import.lisp
===================================================================
--- trunk/projects/quickhoney/upgrade-stuff/import.lisp 2008-07-19 11:42:24 UTC (rev 3520)
+++ trunk/projects/quickhoney/upgrade-stuff/import.lisp 2008-07-19 14:16:31 UTC (rev 3521)
@@ -3,7 +3,12 @@
(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))
+(dolist (name '(#P"overlay-close.gif"
+ #P"hey.gif" #P"buy-print.gif" #P"buy-file.gif" #P"buy-t-shirt.gif"
+ #P"button-bottom.gif" #P"add-to-cart.gif" #P"checkout.gif"))
+ (handler-case
+ (import-image name)
+ (error (e)
+ (format t "~&; error importing ~S: ~A~%" name e))))
-(import-image #p"news-sep.png")
\ No newline at end of file
+(import-image #p"news-sep.gif")
\ No newline at end of file
Modified: trunk/projects/quickhoney/website/static/javascript.js
===================================================================
--- trunk/projects/quickhoney/website/static/javascript.js 2008-07-19 11:42:24 UTC (rev 3520)
+++ trunk/projects/quickhoney/website/static/javascript.js 2008-07-19 14:16:31 UTC (rev 3521)
@@ -148,7 +148,7 @@
function do_edit() {
current_image.client = $("edit_client").value;
current_image.spider_keywords = $("edit_keywords").value;
- current_image.explicit = $("edit_explicit").checked ? true : false;
+ current_image.keywords.explicit = $("edit_explicit").checked ? true : false;
show_cms_window('saving_edits_form'); // hide edit window until server replies
}
@@ -254,7 +254,8 @@
var current_subdirectory;
var current_image;
-function ServerImage(name, id, type, width, height, client, animation_type, spider_keywords, explicit) {
+function ServerImage(name, id, type, width, height, client, animation_type, spider_keywords,
+ keywords) {
this.name = name;
this.id = id;
this.type = type;
@@ -263,7 +264,7 @@
this.client = client;
this.animation_type = animation_type;
this.spider_keywords = spider_keywords;
- this.explicit = explicit;
+ this.keywords = keywords || {};
return this;
}
@@ -475,33 +476,18 @@
var rules = document.styleSheets[i][document.all ? 'rules' : 'cssRules'];
for (var j = 0; j < rules.length; j++) {
var rule = rules[j];
- if (rule.selectorText.toLowerCase() == 'a') {
+ var selectorText = rule.selectorText.toLowerCase();
+ if (selectorText == 'a') {
rule.style['color'] = '#' + link_color;
rule.style['backgroundColor'] = '#' + background_color;
- } else if (rule.selectorText == '.text') {
+ } else if (selectorText == '.text') {
rule.style['color'] = '#' + foreground_color;
rule.style['backgroundColor'] = '#' + background_color;
- } else if (rule.selectorText == 'img.menu') {
+ } else if (selectorText == 'img.menu') {
rule.style['backgroundColor'] = '#' + link_color;
}
}
}
- /*
- // change menu images
- for (var menuname in pages) {
- if (menuname == 'home') {
- $("m_" + menuname).src = "/image/quickhoney/color,000000," + link_color;
- } else {
- if (pagename == 'home') {
- $("m_" + menuname).src = "/image/" + menuname + "/color,000000,ffffff,ffffff," + link_color;
- } else if (pagename == menuname) {
- $("m_" + menuname).src = "/image/" + menuname + "/color,000000," + link_color;
- } else {
- $("m_" + menuname).src = "/image/" + menuname + "/color,000000,ffffff,ffffff," + link_color;
- }
- }
- }
- */
}
function display_cms_window() {
@@ -1008,7 +994,7 @@
$("edit_form_element").setAttribute("action", "/edit-image-js/" + current_image.id);
$("edit_client").value = current_image.client;
$("edit_keywords").value = current_image.spider_keywords;
- $("edit_explicit").checked = current_image.explicit ? "checked" : null;
+ $("edit_explicit").checked = current_image.keywords.explicit ? "checked" : null;
show_cms_window("edit_form");
}
}
@@ -1102,22 +1088,6 @@
}
}
-function initEditor()
-{
- tinyMCE.init({
- mode: 'textareas',
- editor_selector: 'mce_editor',
- theme: "advanced",
- theme_advanced_buttons1: "bold,italic,underline,separator,strikethrough,justifyleft,justifycenter,justifyright, justifyfull,bullist,numlist,undo,redo,link,unlink",
- theme_advanced_buttons2: "",
- theme_advanced_buttons3: "",
- theme_advanced_toolbar_location: "top",
- theme_advanced_toolbar_align: "left",
- theme_advanced_statusbar_location: "bottom",
- extended_valid_elements: "a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]"
- });
-}
-
function enable_debuger()
{
want_debugger = true;
@@ -1164,8 +1134,6 @@
safari_compatibility_hack();
}
- initEditor();
-
debug('init - done');
// setTimeout("preload_menu_images();", 100);
@@ -1241,12 +1209,12 @@
function recolored_image_path(name)
{
- return '/image/' + name + '/color,000000,' + pages[current_directory].colors[2];
+ return '/image/' + name + '/color,ff00ff,' + pages[current_directory].colors[2];
}
-function make_image_action_button(name, action)
+function make_image_action_button(name, action, height)
{
- var div = DIV(null, IMG({ src: recolored_image_path(name), width: 60, height: 23 }));
+ var div = DIV(null, IMG({ src: recolored_image_path(name), width: 126, height: height }));
div.onclick = function() { action(); return false; };
return div;
}
@@ -1255,9 +1223,18 @@
{
var buttons = [];
if (1 || current_image.download_product) {
- buttons.push(make_image_action_button('buy', make_buy_form));
+ buttons.push(make_image_action_button('buy-file', make_buy_form, 22));
}
- 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 })));
+ buttons.push(make_image_action_button('hey', make_hey_form, 23));
replaceChildNodes('image_action_buttons', buttons);
+ $('image_action_buttons').onmouseover = function () {
+ var e = $('image_action_buttons');
+ e.style.left = '518px';
+ e.style.width = '126px';
+ }
+ $('image_action_buttons').onmouseout = function () {
+ var e = $('image_action_buttons');
+ e.style.left = '584px';
+ e.style.width = '60px';
+ }
}
\ No newline at end of file
Modified: trunk/projects/quickhoney/website/static/styles.css
===================================================================
--- trunk/projects/quickhoney/website/static/styles.css 2008-07-19 11:42:24 UTC (rev 3520)
+++ trunk/projects/quickhoney/website/static/styles.css 2008-07-19 14:16:31 UTC (rev 3521)
@@ -515,6 +515,8 @@
position: absolute;
left: 584px;
top: 32px;
+ width: 60px;
+ overflow: hidden;
z-index: 100;
}
Modified: trunk/projects/quickhoney/website/templates/index.xml
===================================================================
--- trunk/projects/quickhoney/website/templates/index.xml 2008-07-19 11:42:24 UTC (rev 3520)
+++ trunk/projects/quickhoney/website/templates/index.xml 2008-07-19 14:16:31 UTC (rev 3521)
@@ -13,8 +13,6 @@
</script>
<script src="/static/AC_QuickTime.js" type="text/javascript"><!-- x -->
</script>
- <script src="/static/tiny_mce/tiny_mce.js" type="text/javascript"><!-- x -->
- </script>
<script src="/MochiKit/MochiKit.js" type="text/javascript"><!-- x -->
</script>
<script src="/static/javascript.js" type="text/javascript"><!-- x -->
@@ -266,6 +264,9 @@
Keywords:<br />
<input type="text" id="edit_keywords" name="spider-keywords" value="" /><br />
<input type="checkbox" id="edit_explicit" name="explicit" value="1" /> Explicit<br/>
+ <input type="checkbox" name="buy-file" value="1"/> Sell as file<br/>
+ <input type="checkbox" name="buy-print" value="1"/> Sell as print<br/>
+ <input type="checkbox" name="buy-t-shirt" value="1"/> Sell as t-shirt<br/>
</p>
<p class="cms">
<input type="submit" name="action" value="edit" />
More information about the Bknr-cvs
mailing list