[bknr-cvs] r2147 - in trunk/projects/bos: m2 payment-website/infosystem payment-website/infosystem/da payment-website/infosystem/de payment-website/infosystem/en payment-website/static worldpay-test

bknr at bknr.net bknr at bknr.net
Sat Apr 14 16:15:38 UTC 2007


Author: hhubner
Date: 2007-04-14 12:15:34 -0400 (Sat, 14 Apr 2007)
New Revision: 2147

Added:
   trunk/projects/bos/payment-website/static/enable_tinymce.js
Modified:
   trunk/projects/bos/m2/packages.lisp
   trunk/projects/bos/m2/poi.lisp
   trunk/projects/bos/payment-website/infosystem/da/satellitenkarte.htm
   trunk/projects/bos/payment-website/infosystem/de/satellitenkarte.htm
   trunk/projects/bos/payment-website/infosystem/en/satellitenkarte.htm
   trunk/projects/bos/payment-website/infosystem/javascript.js
   trunk/projects/bos/payment-website/static/cms.js
   trunk/projects/bos/worldpay-test/poi-handlers.lisp
   trunk/projects/bos/worldpay-test/web-utils.lisp
Log:
Support YouTube movies as additional information elements for POIs.


Modified: trunk/projects/bos/m2/packages.lisp
===================================================================
--- trunk/projects/bos/m2/packages.lisp	2007-04-14 16:14:58 UTC (rev 2146)
+++ trunk/projects/bos/m2/packages.lisp	2007-04-14 16:15:34 UTC (rev 2147)
@@ -151,6 +151,8 @@
 	   #:airals
 	   #:poi-panoramas
 	   #:panoramas
+	   #:poi-movies
+	   #:movies
 	   #:make-poi-image
 	   #:update-poi-image
 	   #:poi

Modified: trunk/projects/bos/m2/poi.lisp
===================================================================
--- trunk/projects/bos/m2/poi.lisp	2007-04-14 16:14:58 UTC (rev 2146)
+++ trunk/projects/bos/m2/poi.lisp	2007-04-14 16:15:34 UTC (rev 2147)
@@ -79,6 +79,7 @@
    (images :update :initform nil)
    (airals :update :initform nil)
    (panoramas :update :initform nil)
+   (movies :update :initform nil)
    (published :update :initform nil)))
 
 (deftransaction make-poi (language name &key title description area)
@@ -96,7 +97,7 @@
        (poi-images poi)
        t))
 
-(defun update-poi (poi language &key title subtitle description area icon published (images :not-set))
+(defun update-poi (poi language &key title subtitle description area icon published (images :not-set) (movies :not-set))
   (with-transaction ()
     (setf (slot-value poi 'published) published)
     (when title
@@ -110,7 +111,9 @@
     (when icon
       (setf (poi-icon poi) icon))
     (when (listp images)
-      (setf (poi-images poi) images))))
+      (setf (poi-images poi) images))
+    (when (listp movies)
+      (setf (poi-movies poi) movies))))
 
 (defmethod poi-center-x ((poi poi))
   (first (poi-area poi)))
@@ -150,17 +153,19 @@
 	      (length (poi-images poi)))
       (format t "poi.thumbnail = ~D;~%" (length (poi-images poi)))
       (when (poi-airals poi)
+	
 	(format t "poi.luftbild = ~D;~%" (store-object-id (first (poi-airals poi)))))
       (when (poi-panoramas poi)
-	(let ((panorama-ids (mapcar #'store-object-id (poi-panoramas poi))))
-	  (format t "poi.panoramas = [ ~D~{, ~D~} ];~%" (first panorama-ids) (rest panorama-ids))))
+	(format t "poi.panoramas = [ ~{~D~^, ~} ];~%" (mapcar #'store-object-id (poi-panoramas poi))))
+      (when (poi-movies poi)
+	(format t "poi.movies = [ ~{~S~^, ~} ];~%" (poi-movies poi)))
       (loop for slot-name in '(title subtitle description)
-	    for javascript-name in '("imageueberschrift" "imageuntertitel" "imagetext")
-	    for slot-values = (mapcar #'(lambda (image)
-					  (escape-nl (slot-string image slot-name language)))
-				      (poi-images poi))
-	    when slot-values
-	    do (format t "poi.~A = [ ~S~{, ~S~} ];~%" javascript-name (car slot-values) (cdr slot-values)))
+	 for javascript-name in '("imageueberschrift" "imageuntertitel" "imagetext")
+	 for slot-values = (mapcar (lambda (image)
+				     (escape-nl (slot-string image slot-name language)))
+				   (poi-images poi))
+	 when slot-values
+	 do (format t "poi.~A = [ ~{~S~^, ~} ];~%" javascript-name slot-values))
       (format t "pois.push(poi);~%"))
     (dolist (allocation-area (remove-if (complement #'allocation-area-active-p) (class-instances 'allocation-area)))
       (destructuring-bind (x y) (allocation-area-center allocation-area)

Modified: trunk/projects/bos/payment-website/infosystem/da/satellitenkarte.htm
===================================================================
--- trunk/projects/bos/payment-website/infosystem/da/satellitenkarte.htm	2007-04-14 16:14:58 UTC (rev 2146)
+++ trunk/projects/bos/payment-website/infosystem/da/satellitenkarte.htm	2007-04-14 16:15:34 UTC (rev 2147)
@@ -223,6 +223,12 @@
 		    <div id="PanoramaFooter" style="position: absolute; top: 0px; left: 0px; width:360px; height:360px; color: white; background-color: black; " align="right">
 		    </div>
 		</div>
+	        <div id="Movie" style="position:absolute; width:360px; height:360px; z-index:9; left: 0px; top: 0px; border: 0px; visibility: hidden;">
+		    <div id="MovieApplet" style="position: absolute; top: 0px; left: 0px; width:360px; height:340px;">
+		    </div>
+		    <div id="MovieFooter" style="position: absolute; top: 0px; left: 0px; width:360px; height:360px; color: white; background-color: black; " align="right">
+		    </div>
+		</div>
 		<div align="right"> 
 		  <table width="360" height="360" border="0" cellpadding="0" cellspacing="0">
 			<tr> 

Modified: trunk/projects/bos/payment-website/infosystem/de/satellitenkarte.htm
===================================================================
--- trunk/projects/bos/payment-website/infosystem/de/satellitenkarte.htm	2007-04-14 16:14:58 UTC (rev 2146)
+++ trunk/projects/bos/payment-website/infosystem/de/satellitenkarte.htm	2007-04-14 16:15:34 UTC (rev 2147)
@@ -222,13 +222,13 @@
 		    </div>
 		    <div id="PanoramaFooter" style="position: absolute; top: 0px; left: 0px; width:360px; height:360px; color: white; background-color: black; " align="right">
 		    </div>
-<!--
-		    <iframe src="about:blank" height="360" width="320" name="panorama" scrolling="no"
-		            hspace="0" vspace="0" marginwidth="0" marginheight="0" frameborder="0">
-			 Panaramas können nur bei eingeschalteten IFRAMES angezeigt werden.
-		    </iframe>
--->
 		</div>
+	        <div id="Movie" style="position:absolute; width:360px; height:360px; z-index:9; left: 0px; top: 0px; border: 0px; visibility: hidden;">
+		    <div id="MovieApplet" style="position: absolute; top: 0px; left: 0px; width:360px; height:340px;">
+		    </div>
+		    <div id="MovieFooter" style="position: absolute; top: 0px; left: 0px; width:360px; height:360px; color: white; background-color: black; " align="right">
+		    </div>
+		</div>
 		<div align="right"> 
 		  <table width="360" height="360" border="0" cellpadding="0" cellspacing="0">
 			<tr> 

Modified: trunk/projects/bos/payment-website/infosystem/en/satellitenkarte.htm
===================================================================
--- trunk/projects/bos/payment-website/infosystem/en/satellitenkarte.htm	2007-04-14 16:14:58 UTC (rev 2146)
+++ trunk/projects/bos/payment-website/infosystem/en/satellitenkarte.htm	2007-04-14 16:15:34 UTC (rev 2147)
@@ -223,6 +223,12 @@
 		    <div id="PanoramaFooter" style="position: absolute; top: 0px; left: 0px; width:360px; height:360px; color: white; background-color: black; " align="right">
 		    </div>
 		</div>
+	        <div id="Movie" style="position:absolute; width:360px; height:360px; z-index:9; left: 0px; top: 0px; border: 0px; visibility: hidden;">
+		    <div id="MovieApplet" style="position: absolute; top: 0px; left: 0px; width:360px; height:340px;">
+		    </div>
+		    <div id="MovieFooter" style="position: absolute; top: 0px; left: 0px; width:360px; height:360px; color: white; background-color: black; " align="right">
+		    </div>
+		</div>
 		<div align="right"> 
 		  <table width="360" height="360" border="0" cellpadding="0" cellspacing="0">
 			<tr> 

Modified: trunk/projects/bos/payment-website/infosystem/javascript.js
===================================================================
--- trunk/projects/bos/payment-website/infosystem/javascript.js	2007-04-14 16:14:58 UTC (rev 2146)
+++ trunk/projects/bos/payment-website/infosystem/javascript.js	2007-04-14 16:15:34 UTC (rev 2147)
@@ -825,6 +825,7 @@
     // Ebenen entsprechen ein- oder ausblenden
     hide_poi_panorama();
     hide_poi_luftbild();
+    hide_poi_movie();
 
     n_profil = {};
     display_selected_contract();
@@ -843,6 +844,7 @@
 function show_poi_luftbild() {
     help_page = 'luftbild';
     hide_poi_panorama();
+    hide_poi_movie();
     if (poi[aktuelles_objekt]['luftbild']) {
 	document.getElementById("Luftbild").style.visibility = "visible";
     }
@@ -856,6 +858,7 @@
     var the_poi = poi[aktuelles_objekt];
     help_page = 'panorama';
     hide_poi_luftbild();
+    hide_poi_movie();
     if (the_poi.panoramas) {
 	var panorama_id = the_poi.panoramas[0];
 	document.getElementById("Panorama").style.visibility = "visible";
@@ -871,13 +874,37 @@
 
 function hide_poi_panorama() {
     document.getElementById("Panorama").style.visibility = "hidden";
+    document.getElementById("PanoramaApplet").innerHTML = '';
 }
 
 function show_poi_satbild() {
     hide_poi_luftbild(); // for now
     hide_poi_panorama();
+    hide_poi_movie();
 }
 
+function show_poi_movie() {
+    var the_poi = poi[aktuelles_objekt];
+    help_page = 'movie';
+    hide_poi_luftbild();
+    hide_poi_panorama();
+    if (the_poi.movies) {
+	var movie_url = the_poi.movies[0];
+	document.getElementById("Movie").style.visibility = "visible";
+	document.getElementById("PoiInfoText").innerHTML
+	    = msg('Das Laden des Videos dauert einen Moment und benötigt Flash in Ihrem Browser.');
+	document.getElementById("MovieApplet").innerHTML
+	    = '<object width="360" height="340"> <param name="movie" value=" '
+	    + movie_url + '"> </param> <embed src=" '
+	    + movie_url + '" type="application/x-shockwave-flash" width="360" height="340"> </embed> </object>';
+    }
+}
+
+function hide_poi_movie() {
+    document.getElementById("Movie").style.visibility = "hidden";
+    document.getElementById("MovieApplet").innerHTML = '';
+}
+
 var poi_menu_items;
 var poi_active_menu_item;
 
@@ -913,6 +940,9 @@
     if (the_poi.panoramas) {
 	poi_menu_items.push([ msg('Panorama'), show_poi_panorama ]);
     }
+    if (the_poi.movies) {
+	poi_menu_items.push([ msg('Film'), show_poi_movie ]);
+    }
 
     poi_active_menu_item = msg('Sat-Karte');
 
@@ -924,6 +954,7 @@
 
     hide_poi_luftbild();
     hide_poi_panorama();
+    hide_poi_movie();
 
     if (the_poi['luftbild']) {
 	document.poiluftbild.src = "/image/" + the_poi['luftbild'];

Modified: trunk/projects/bos/payment-website/static/cms.js
===================================================================
--- trunk/projects/bos/payment-website/static/cms.js	2007-04-14 16:14:58 UTC (rev 2146)
+++ trunk/projects/bos/payment-website/static/cms.js	2007-04-14 16:15:34 UTC (rev 2147)
@@ -1,5 +1,11 @@
 // This may look like -*- Java -*-, but it really is ECMAScript
 
+// Allgemeine Initialisierungsfunktion fuer alle CMS-Seiten
+
+function init() {
+    update_movie_preview();
+}
+
 // Formularcheck für Sponsoren-Erzeugung
 
 function check_complete_sale() {
@@ -56,3 +62,33 @@
 
     return true;
 }
+
+function $(id) { return document.getElementById(id); }
+
+function update_movie_preview()
+{
+    if ($('movie') && $('movie_preview')) {
+	var url = $('movie').value;
+	if (url == "") {
+	    $('movie_preview').innerHTML = '';
+	} else {
+	    $('movie_preview').innerHTML = '<object width="360" height="340"> <param name="movie" value=" ' + url + '"> </param> <embed src=" ' + url + '" type="application/x-shockwave-flash" width="360" height="340"> </embed> </object>';
+	}
+    }
+}
+
+function parse_youtube_link (input)
+{
+    var text = input.value;
+
+    text = text.replace(/.*src=" (http:\/\/www.youtube.com[^"]+).*/, "$1")
+    input.value = text;
+    if ((input.value != "") && !input.value.match(/^http:\/\/www.youtube.com\/v\/\S+/)) {
+        alert("Invalid YouTube URL: " + input.value);
+        input.value = "";
+        return false;
+    } else {
+        update_movie_preview();
+        return true;
+    }
+}

Added: trunk/projects/bos/payment-website/static/enable_tinymce.js
===================================================================
--- trunk/projects/bos/payment-website/static/enable_tinymce.js	2007-04-14 16:14:58 UTC (rev 2146)
+++ trunk/projects/bos/payment-website/static/enable_tinymce.js	2007-04-14 16:15:34 UTC (rev 2147)
@@ -0,0 +1,4 @@
+tinyMCE.init({
+    mode : "textareas",
+    theme : "simple"
+});

Modified: trunk/projects/bos/worldpay-test/poi-handlers.lisp
===================================================================
--- trunk/projects/bos/worldpay-test/poi-handlers.lisp	2007-04-14 16:14:58 UTC (rev 2146)
+++ trunk/projects/bos/worldpay-test/poi-handlers.lisp	2007-04-14 16:15:34 UTC (rev 2147)
@@ -150,11 +150,25 @@
 			((:input :type "file" :name "image-file"))
 			:br
 			(submit-button "upload-panorama" "upload-panorama"))))
-	(:tr (:td (submit-button "save" "save") (submit-button "delete" "delete" :confirm "Really delete the POI?"))))))))
+	(:tr (:td "movie")
+	     (:td (html "URL or 'embed' string: "
+			((:input :type "text"
+				 :size "50"
+				 :name "movie"
+				 :id "movie"
+				 :value (or (first (poi-movies poi)) "")
+				 :onchange "parse_youtube_link(this)"))
+			" "
+			(when (poi-movies poi)
+			  (html :br (submit-button "delete-movie" "delete-movie" :confirm "Really delete the movie?")))
+			:br
+			((:div :id "movie_preview" :style "height: 340px; width: 360px;") ""))))
+	(:tr (:td (submit-button "save" "save")
+		  (submit-button "delete" "delete" :confirm "Really delete the POI?"))))))))
 
 (defmethod handle-object-form ((handler edit-poi-handler)
 			       (action (eql :save)) (poi poi) req)
-  (with-query-params (req published title subtitle description language x y icon)
+  (with-query-params (req published title subtitle description language x y icon movie)
     (unless language (setq language (session-variable :language)))
     (let ((args (list :title title
 		      :published published
@@ -163,6 +177,8 @@
 		      :icon icon)))
       (when (and x y)
 	(setq args (append args (list :area (list (parse-integer x) (parse-integer y))))))
+      (when movie
+	(setq args (append args (list :movies (list movie)))))
       (apply #'update-poi poi language args))
     (with-bos-cms-page (req :title "POI has been updated")
       (html (:h2 "Your changes have been saved")
@@ -204,6 +220,13 @@
 		    (store-object-id poi)) req))
 
 (defmethod handle-object-form ((handler edit-poi-handler)
+			       (action (eql :delete-movie))
+			       (poi poi)
+			       req)
+  (change-slot-values poi 'movies nil)
+  (redirect (format nil "/edit-poi/~D" (store-object-id poi)) req))
+
+(defmethod handle-object-form ((handler edit-poi-handler)
 			       (action (eql :upload-panorama))
 			       (poi poi)
 			       req)

Modified: trunk/projects/bos/worldpay-test/web-utils.lisp
===================================================================
--- trunk/projects/bos/worldpay-test/web-utils.lisp	2007-04-14 16:14:58 UTC (rev 2146)
+++ trunk/projects/bos/worldpay-test/web-utils.lisp	2007-04-14 16:15:34 UTC (rev 2147)
@@ -6,6 +6,22 @@
 (defclass bos-website (website)
   ())
 
+(defmethod website-show-page ((website bos-website) fn title)
+  (html
+   (princ "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">" *html-stream*)
+   (princ #\Newline *html-stream*)
+   (:html
+    (:head
+     (bknr.web::header :title title))
+    ((:body :class "cms" :onload "init();")
+     ((:div :class "navigation")
+      (bknr.web::logo)
+      (:h1 (:princ-safe (website-name website)))
+      (bknr.web::navigation))
+     (:h1 (:princ-safe title))
+     (funcall fn)
+     (website-session-info website)))))
+
 (defmethod website-session-info ((website bos-website))
   (html :br :hr
 	((:p :class "footer")




More information about the Bknr-cvs mailing list