[bknr-cvs] r1908 - in branches/xml-class-rework/projects/lisp-ecoop: src website/static website/templates
bknr at bknr.net
bknr at bknr.net
Wed Mar 8 06:49:37 UTC 2006
Author: hhubner
Date: 2006-03-08 01:49:37 -0500 (Wed, 08 Mar 2006)
New Revision: 1908
Added:
branches/xml-class-rework/projects/lisp-ecoop/website/templates/create-submission.xml
Modified:
branches/xml-class-rework/projects/lisp-ecoop/src/handlers.lisp
branches/xml-class-rework/projects/lisp-ecoop/src/webserver.lisp
branches/xml-class-rework/projects/lisp-ecoop/website/static/javascript.js
branches/xml-class-rework/projects/lisp-ecoop/website/templates/upload.xml
branches/xml-class-rework/projects/lisp-ecoop/website/templates/user-error.xml
Log:
First version for Pascal to test.
Modified: branches/xml-class-rework/projects/lisp-ecoop/src/handlers.lisp
===================================================================
--- branches/xml-class-rework/projects/lisp-ecoop/src/handlers.lisp 2006-03-07 20:03:26 UTC (rev 1907)
+++ branches/xml-class-rework/projects/lisp-ecoop/src/handlers.lisp 2006-03-08 06:49:37 UTC (rev 1908)
@@ -14,14 +14,21 @@
(defmethod handle-form ((handler add-participant-handler) (action (eql nil)) req)
(with-lisp-ecoop-page (req "Create new participant")
- ((:form :method "post" :enctype "multipart/form-data")
+ ((:form :method "post" :enctype "multipart/form-data" :onsubmit "return check_participant_form(this);")
((:table :border "1")
(:tr (:th "Login")
(:td (text-field "login" :size 15)))
(:tr (:th "Full Name")
(:td (text-field "full-name" :size 25)))
(:tr (:th "Email")
- (:td (text-field "email" :size 25))))
+ (:td (text-field "email" :size 25)))
+ (:tr (:th "Submission")
+ (:td ((:select :name "submission" :id "submission-selector" :size "1")
+ (dolist (submission (sort (copy-list (class-instances 'submission))
+ #'string-lessp :key #'submission-title))
+ (html ((:option :value (store-object-id submission))
+ (:princ-safe (submission-title submission))))))
+ ((:input :type "submit" :onclick "return create_submission_window();" :value "new")))))
(submit-button "create" "create"))))
(defmethod handle-form ((handler add-participant-handler) (action (eql :create)) req)
@@ -37,7 +44,7 @@
(:default-initargs :class 'participant :query-function #'find-user))
(defmethod handle-object-form ((handler edit-participant-handler) (action (eql nil)) (participant participant) req)
- (with-lisp-ecoop-page (req #?"Edit participant ((user-login participant))")
+ (with-lisp-ecoop-page (req #?"Edit participant $((user-login participant))")
((:form :method "post" :enctype "multipart/form-data")
((:table :border "1")
(:tr (:th "Login")
@@ -66,7 +73,22 @@
(with-http-body (req *ent* :external-format '(unsigned-byte 8))
(write-sequence pdf net.aserve::*html-stream*)))))
+(defclass make-submission-handler (admin-only-handler page-handler)
+ ())
+(defmethod handle ((handler make-submission-handler) req)
+ (with-query-params (req title abstract)
+ (let ((submission (make-object 'submission :title title :abstract abstract)))
+ (with-lisp-ecoop-page (req #?"Submission created")
+ (html ((:script :type "text/javascript")
+ (:princ-safe #?"
+if (window.opener) {
+ opener.add_submission($((store-object-id submission)), '$(title)');
+ window.close();
+} else {
+ window.location.href = 'edit-submission/$((store-object-id submission))';
+}")))))))
+
(defclass upload-document-handler (object-handler)
()
(:default-initargs :class 'submission))
@@ -111,6 +133,7 @@
(define-bknr-webserver-module participants
("/add-participant" add-participant-handler)
("/edit-participant" edit-participant-handler)
+ ("/make-submission" make-submission-handler)
("/pdf" pdf-handler)
("/upload-document" upload-document-handler)
("/delete-document" delete-document-handler)
Modified: branches/xml-class-rework/projects/lisp-ecoop/src/webserver.lisp
===================================================================
--- branches/xml-class-rework/projects/lisp-ecoop/src/webserver.lisp 2006-03-07 20:03:26 UTC (rev 1907)
+++ branches/xml-class-rework/projects/lisp-ecoop/src/webserver.lisp 2006-03-08 06:49:37 UTC (rev 1908)
@@ -17,13 +17,12 @@
(make-instance 'website
:name "LISP ECOOP CMS"
:base-href base-href
+ :template-base-directory (namestring (merge-pathnames #p"templates/" *website-directory*))
+ :template-command-packages '((:lisp-ecoop . :lisp-ecoop.tags)
+ (:bknr . :bknr.web)
+ (:menu . :bknr.site-menu))
:handler-definitions `(("/" redirect-handler
:to "home")
- ("/" template-handler
- :destination ,(namestring (merge-pathnames #p"templates/" *website-directory*))
- :command-packages ((:lisp-ecoop . :lisp-ecoop.tags)
- (:bknr . :bknr.web)
- (:menu . :bknr.site-menu)))
("/static" directory-handler
:destination ,(unix-namestring (merge-pathnames #p"static/" *website-directory*))))
:modules '(user images stats mailinglist mailinglist-registration participants schedule)
Modified: branches/xml-class-rework/projects/lisp-ecoop/website/static/javascript.js
===================================================================
--- branches/xml-class-rework/projects/lisp-ecoop/website/static/javascript.js 2006-03-07 20:03:26 UTC (rev 1907)
+++ branches/xml-class-rework/projects/lisp-ecoop/website/static/javascript.js 2006-03-08 06:49:37 UTC (rev 1908)
@@ -1,6 +1,6 @@
// -*- Java -*-
-var POPUP_WINDOW_PARAMS = 'width=500,height=300,status=no,toolbar=no,menubar=no,resizable=yes,scrollbars=yes';
+var POPUP_WINDOW_PARAMS = 'width=700,height=450,status=no,toolbar=no,menubar=no,resizable=yes,scrollbars=yes';
function http_request(url)
{
@@ -93,3 +93,50 @@
return true;
}
+// Create Participant form check
+
+function check_form_fields(form)
+{
+ var input_complete = true;
+ var first_missing;
+ for (var i = 1; i < arguments.length; i++) {
+ var field = form[arguments[i]];
+ if (field.value.match(/^\S+$/)) {
+ field.style.background = '#fff';
+ } else {
+ input_complete = false;
+ field.style.background = '#faa';
+ if (!first_missing) {
+ first_missing = field;
+ }
+ }
+ }
+
+ if (!input_complete) {
+ first_missing.focus();
+ }
+
+ return input_complete;
+}
+
+function check_participant_form(form) {
+ return check_form_fields(form, 'login', 'full-name', 'email');
+}
+
+// Make a new submission
+
+function create_submission_window() {
+ window.add_submission = function(id, title) {
+ var submission_selector = document.getElementById('submission-selector');
+ submission_selector.innerHTML = '<option selected="selected" value="' + id + '">' + title + '</option>' + submission_selector.innerHTML;
+ submission_selector.selectedIndex = 0;
+ }
+
+ open('/create-submission', 'createsubmission', POPUP_WINDOW_PARAMS);
+
+ return false;
+}
+
+function check_create_submission_form(form) {
+ return check_form_fields(form, 'title');
+}
Added: branches/xml-class-rework/projects/lisp-ecoop/website/templates/create-submission.xml
===================================================================
--- branches/xml-class-rework/projects/lisp-ecoop/website/templates/create-submission.xml 2006-03-07 20:03:26 UTC (rev 1907)
+++ branches/xml-class-rework/projects/lisp-ecoop/website/templates/create-submission.xml 2006-03-08 06:49:37 UTC (rev 1908)
@@ -0,0 +1,43 @@
+<?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>Create submission</title>
+ <link rel="stylesheet" type="text/css" href="/static/document-utils.css" />
+ <script src="/static/document-utils.js" language="javascript" type="text/javascript"> </script>
+ <script src="/static/javascript.js" language="javascript" type="text/javascript"> </script>
+ </head>
+ <body class="utility-window" onload="init()">
+ <div id="form" class="page">
+ <h1>Create a Submission</h1>
+ <p>
+ Using this form, a new submission may be created.
+ </p>
+ <form method="post" name="create_submission_form" id="create_submission_form" enctype="multipart/form-data"
+ action="/make-submission" onsubmit="return check_create_submission_form(this);">
+ <label for="title">Title</label><br/>
+ <input type="text" size="40" maxlength="40" name="title" id="title_input"/><br/>
+ <label for="abstract">Abstract</label><br/>
+ <textarea name="abstract" cols="72" rows="10"> </textarea><br/>
+ <button type="submit" name="submit">Create</button>
+ </form>
+ <p>
+ <a href="#" onclick="window.close();">Cancel</a>
+ </p>
+ </div>
+ <div id="progress" class="page">
+ Creating submission...
+ </div>
+ <div id="success" class="page">
+ Submission created.
+ </div>
+ <div id="failed" class="page">
+ <p>
+ Cannot create submission: <span id="error-message"> </span>
+ </p>
+ <a href="#" onclick="window.close();">Dang!</a>
+ </div>
+ </body>
+</html>
Modified: branches/xml-class-rework/projects/lisp-ecoop/website/templates/upload.xml
===================================================================
--- branches/xml-class-rework/projects/lisp-ecoop/website/templates/upload.xml 2006-03-07 20:03:26 UTC (rev 1907)
+++ branches/xml-class-rework/projects/lisp-ecoop/website/templates/upload.xml 2006-03-08 06:49:37 UTC (rev 1908)
@@ -28,10 +28,10 @@
</p>
</div>
<div id="progress" class="page">
- Upload in progress, please wait
+ Upload in progress, please wait....
</div>
<div id="success" class="page">
- Done uploading
+ Done uploading.
</div>
<div id="failed" class="page">
<p>
Modified: branches/xml-class-rework/projects/lisp-ecoop/website/templates/user-error.xml
===================================================================
--- branches/xml-class-rework/projects/lisp-ecoop/website/templates/user-error.xml 2006-03-07 20:03:26 UTC (rev 1907)
+++ branches/xml-class-rework/projects/lisp-ecoop/website/templates/user-error.xml 2006-03-08 06:49:37 UTC (rev 1908)
@@ -7,8 +7,16 @@
xmlns:lisp-ecoop="http://lisp-ecoop06.bknr.net"
xmlns:menu="http://bknr.net/menu"
>
-Your request could not be processed because an error occured:
+ <head>
+ <title>Error</title>
+ <link rel="stylesheet" type="text/css" href="$(base)static/styles.css" />
+ </head>
+ <body>
+ <h2>
+ Your request could not be processed because an error occured:
+ </h2>
<pre>
$(error-message)
</pre>
+ </body>
</html>
\ No newline at end of file
More information about the Bknr-cvs
mailing list