summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Andreas Benkard <code@mail.matthias.benkard.de>2009-11-20 21:18:24 +0100
committerMatthias Andreas Benkard <code@mail.matthias.benkard.de>2009-11-20 21:19:25 +0100
commit7e9769d2dc173397b7c90341e4c452301f1c6590 (patch)
tree1082970e98f6a8619c4eaccfcdbea595166a113c
parenta8ba2e4f40fed4fd29802e543c51e79f410ad8ac (diff)
Stop using ParenScript.
-rw-r--r--logikorr.asd2
-rw-r--r--logikorr.js27
-rw-r--r--logikorr.lisp52
3 files changed, 38 insertions, 43 deletions
diff --git a/logikorr.asd b/logikorr.asd
index e7913be..0143054 100644
--- a/logikorr.asd
+++ b/logikorr.asd
@@ -5,5 +5,5 @@
:author "Matthias Benkard <code@matthias.benkard.de>"
:licence ""
:description "Ein einfaches Bewertungsaufnahmesystem"
- :depends-on (:parenscript :alexandria :yaclml :hunchentoot :json :split-sequence :xml-emitter)
+ :depends-on (:alexandria :yaclml :hunchentoot :json :split-sequence :xml-emitter)
:components ((:file "logikorr")))
diff --git a/logikorr.js b/logikorr.js
new file mode 100644
index 0000000..efa3b2f
--- /dev/null
+++ b/logikorr.js
@@ -0,0 +1,27 @@
+var loader;
+var autocompleteList;
+YUI().use('node-base', 'io-base', 'io-form', 'io-queue', function (Y) {
+ function makeStudentRow() {
+ var table = document.getElementById('ergebnisse');
+ var num = table.rows.length;
+ var row = table.insertRow(num);
+
+ var cell = row.insertCell(0);
+ var input = document.createElement('input');
+ var completion = document.createElement('div');
+ input.setAttribute('type', 'text');
+ completion.setAttribute('class', 'autocomplete');
+ cell.appendChild(input);
+ cell.appendChild(completion);
+ new Autocompleter.Local(input, completion, autocompleteList, { 'fullSearch' : true });
+
+ var cell = row.insertCell(1);
+ var input = document.createElement('input');
+ input.setAttribute('type', 'text');
+ input.setAttribute('maxlength', '3');
+ input.setAttribute('size', '3');
+ cell.appendChild(input);
+ };
+
+ return Y.on('domready', makeStudentRow);
+});
diff --git a/logikorr.lisp b/logikorr.lisp
index f3ad4ae..fefa795 100644
--- a/logikorr.lisp
+++ b/logikorr.lisp
@@ -1,7 +1,5 @@
(defpackage :logikorr-ht
- (:use #:hunchentoot #:common-lisp #+(or) #:cl-prevalence #:json #:yaclml
- #:split-sequence #:xml-emitter)
- (:import-from #:parenscript #:@))
+ (:use #:hunchentoot #:common-lisp #:json #:yaclml #:split-sequence #:xml-emitter))
(in-package #:logikorr-ht)
@@ -50,7 +48,8 @@
:src "js/scriptaculous.js")
(<:link :type "text/css" :rel "stylesheet" :href "style.css")
(<:script :type "text/javascript" :src "http://yui.yahooapis.com/3.0.0/build/yui/yui-min.js")
- (<:script :type "text/javascript" :src "logikorr.js"))
+ (<:script :type "text/javascript" :src "logikorr.js")
+ (<:script :type "text/javascript" :src "logikorr-completion-data.js"))
(<:body
(<:h1 "Logik I: Korrekturergebnisse")
(<:h2 "Neue Ergebnisse")
@@ -67,44 +66,13 @@
(<:td (<:as-html first-name)))))))))))
(define-easy-handler (logikorr.js :uri "/logikorr.js") ()
- (ignore-errors
- (setf (header-out :content-type) "text/javascript; charset=UTF-8"))
- (concatenate
- 'string
- (ps:ps
- (defvar loader)
- (defvar autocomplete-list)
- (defvar autocomplete-data)
- ((@ (*YUI*) use)
- "node-base" "io-base" "io-form" "io-queue"
- (lambda (y)
- (defun make-student-row ()
- (let* ((table ((@ document get-element-by-id) "ergebnisse"))
- (num (length (@ table rows)))
- (row ((@ table insert-row) num)))
- (let* ((cell ((@ row insert-cell) 0))
- (input ((@ document create-element) "input"))
- (completion ((@ document create-element) "div")))
- ((@ input set-attribute) "type" "text")
- ((@ completion set-attribute) "class" "autocomplete")
- ((@ cell append-child) input)
- ((@ cell append-child) completion)
- (ps:new ((@ *autocompleter *local)
- input
- completion
- autocomplete-list
- (ps:create "fullSearch" t))))
- (let* ((cell ((@ row insert-cell) 1))
- (input ((@ document create-element) "input")))
- ((@ input set-attribute) "type" "text")
- ((@ input set-attribute) "maxlength" "3")
- ((@ input set-attribute) "size" "3")
- ((@ cell append-child) input))))
-
- ((@ y on) "domready" make-student-row))))
- (format nil "~%autocompleteList = ~A"
- (json:encode-json-to-string (mapcar (lambda (x) (unsplit-name (student-first-name x) (student-last-name x)))
- (find-students))))))
+ (handle-static-file (relpath "logikorr.js")))
+
+(define-easy-handler (logikorr-completion-data.js :uri "/logikorr-completion-data.js") ()
+ (ignore-errors (setf (header-out :content-type) "text/javascript; charset=UTF-8"))
+ (format nil "~%autocompleteList = ~A"
+ (json:encode-json-to-string (mapcar (lambda (x) (unsplit-name (student-first-name x) (student-last-name x)))
+ (find-students)))))
(define-easy-handler (style.css :uri "/style.css") ()