[bknr-cvs] r1874 - in branches/xml-class-rework/projects/lisp-ecoop: src website/static website/templates

bknr at bknr.net bknr at bknr.net
Thu Feb 23 10:03:37 UTC 2006


Author: hhubner
Date: 2006-02-23 04:03:36 -0600 (Thu, 23 Feb 2006)
New Revision: 1874

Added:
   branches/xml-class-rework/projects/lisp-ecoop/website/templates/edit-submission-submitters.xml
Modified:
   branches/xml-class-rework/projects/lisp-ecoop/src/tags.lisp
   branches/xml-class-rework/projects/lisp-ecoop/website/static/javascript.js
   branches/xml-class-rework/projects/lisp-ecoop/website/templates/toplevel.xml
Log:
Editing submitter list now works with a popup window.


Modified: branches/xml-class-rework/projects/lisp-ecoop/src/tags.lisp
===================================================================
--- branches/xml-class-rework/projects/lisp-ecoop/src/tags.lisp	2006-02-23 06:42:34 UTC (rev 1873)
+++ branches/xml-class-rework/projects/lisp-ecoop/src/tags.lisp	2006-02-23 10:03:36 UTC (rev 1874)
@@ -147,6 +147,38 @@
     (let ((*submission* submission))
       (mapc #'emit-template-node children))))
 
+(define-bknr-tag submission-submitter-editor ()
+  (let ((submission (submission-from-request)))
+    (unless submission
+      (html (:h2 "Invalid submission ID"))
+      (return-from submission-submitter-editor))
+    (unless (submission-edit-permitted-p submission)
+      (error "can't edit this submission"))
+    (with-query-params (*req* add-submitter-id remove-submitter-id add-submitter remove-submitter)
+      (let ((submitters (submission-submitters submission)))
+        (cond
+          (add-submitter-id
+           (with-transaction ("adding submitter")
+             (submission-add-submitter submission (find-store-object (parse-integer add-submitter-id))))
+           (html (:h2 "Submitter has been added")))
+          (remove-submitter-id
+           (with-transaction ("removing submitter")
+             (submission-remove-submitter submission (find-store-object (parse-integer remove-submitter-id))))
+           (html (:h2 "Submitter has been removed")
+                 ((:script :type "text/javascript") "alert(parent.location.href); parent.location.href = parent.location.href + '?' + (new Date()).getTime(); window.close();" )))
+          (add-submitter
+           (html (:strong "Add submitter")
+                 (:ul
+                  (dolist (participant (set-difference (class-instances 'participant) submitters))
+                    (html (:li ((:a :href (format nil "~A?add-submitter-id=~A" (puri:uri-path (request-uri *req*)) (store-object-id participant)))
+                                (:princ-safe (user-full-name participant)))))))))
+          (remove-submitter
+           (html (:strong "Remove Submitter")
+                 (:ul
+                  (dolist (participant submitters)
+                    (html (:li ((:a :href (format nil "~A?remove-submitter-id=~A" (puri:uri-path (request-uri *req*)) (store-object-id participant)))
+                                (:princ-safe (user-full-name participant))))))))))))))
+
 (define-bknr-tag submission-uploader ()
   (html (:princ-safe (submission-info *submission*)) :br
 	((:button :type "button" :value "show" :onclick (format-object-id "document.location.href = '/submission/~A';" *submission*))
@@ -159,15 +191,13 @@
   (let ((submitters (submission-submitters *submission*)))
     (dolist (submitter submitters)
       (html ((:a :href (format-object-id "/profile/~A" submitter)) (:princ-safe (user-full-name submitter)) :br)))
-    (labels ((participant-option (participant)
-	       (list (user-full-name participant)
-		     (store-object-id participant))))
-      (unless (eql 1 (length submitters))
-	(html "Remove submitter: "
-	      (select-box "remove-submitter-id" (mapcar #'participant-option submitters))
-	      :br))
-      (html "Add submitter: "
-	    (select-box "add-submitter-id" (mapcar #'participant-option (set-difference (class-instances 'participant) submitters)))))))
+    (unless (eql 1 (length submitters))
+      (html (submit-button "remove-submitter" "Remove Submitter" :formcheck (format nil "return submitters_window('~Aedit-submission-submitters/~A?remove-submitter=1')"
+                                                                                    (website-base-href *website*)
+                                                                                    (store-object-id *submission*)))))
+    (html (submit-button "add-submitter" "Add Submitter" :formcheck (format nil "return submitters_window('~Aedit-submission-submitters/~A?add-submitter=1')"
+                                                                            (website-base-href *website*)
+                                                                            (store-object-id *submission*))))))
 
 (define-bknr-tag participant-picture-uploader ()
   (let ((picture (participant-picture *participant*)))

Modified: branches/xml-class-rework/projects/lisp-ecoop/website/static/javascript.js
===================================================================
--- branches/xml-class-rework/projects/lisp-ecoop/website/static/javascript.js	2006-02-23 06:42:34 UTC (rev 1873)
+++ branches/xml-class-rework/projects/lisp-ecoop/website/static/javascript.js	2006-02-23 10:03:36 UTC (rev 1874)
@@ -20,3 +20,11 @@
 	return true;
     }
 }
+
+/* adding/removing submitters */
+
+function submitters_window(url) {
+    var submitters_window = open(url, "change submitters", "width=200,height=400,status=no,toolbar=no,menubar=no,resizable=yes,scrollbars=yes");
+    submitters_window.focus();
+    return false;
+}

Added: branches/xml-class-rework/projects/lisp-ecoop/website/templates/edit-submission-submitters.xml
===================================================================
--- branches/xml-class-rework/projects/lisp-ecoop/website/templates/edit-submission-submitters.xml	2006-02-23 06:42:34 UTC (rev 1873)
+++ branches/xml-class-rework/projects/lisp-ecoop/website/templates/edit-submission-submitters.xml	2006-02-23 10:03:36 UTC (rev 1874)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html
+  xmlns:lisp-ecoop="http://lisp-ecoop06.bknr.net">
+ <head>
+  <title>Edit Submitter List</title>
+ </head>
+ <lisp-ecoop:submission-submitter-editor/>
+ <p>
+  <a href="#" onclick="window.close();">Cancel</a>
+ </p>
+</html>

Modified: branches/xml-class-rework/projects/lisp-ecoop/website/templates/toplevel.xml
===================================================================
--- branches/xml-class-rework/projects/lisp-ecoop/website/templates/toplevel.xml	2006-02-23 06:42:34 UTC (rev 1873)
+++ branches/xml-class-rework/projects/lisp-ecoop/website/templates/toplevel.xml	2006-02-23 10:03:36 UTC (rev 1874)
@@ -9,7 +9,6 @@
   >
   <head>
     <title>LISP-ECOOP06 - $(title)</title>
-    <base href="$(base)"/>
     <link rel="stylesheet" type="text/css" href="$(base)static/styles.css" />
     <script src="$(base)static/javascript.js" language="javascript" type="text/javascript"> </script>
   </head>
@@ -20,7 +19,7 @@
       <div id="subtitle">Co-located with <a href="http://2006.ecoop.org/" target="_new">ECOOP 2006</a><br />July 3-4 - Nantes - France</div>
       <div id="logo">
         <a href="http://bknr.net/" target="_new">
-	  <img width="57" height="20" alt="BKNR Logo" src="image/bknr-logo/thumbnail,,57,20" border="0" />
+	  <img width="57" height="20" alt="BKNR Logo" src="$(base)image/bknr-logo/thumbnail,,57,20" border="0" />
 	</a>
       </div>
     </div>




More information about the Bknr-cvs mailing list