summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Andreas Benkard <code@mail.matthias.benkard.de>2009-11-26 15:03:12 +0100
committerMatthias Andreas Benkard <code@mail.matthias.benkard.de>2009-11-26 15:03:12 +0100
commit873203207e76ca15ab302e6ab3581bd0309863d0 (patch)
tree0fe91101e0141d06a1bb304e1ad63fbb37c9af67
parent5c5cb472204ea08f971c48168644fc3dfc41cdaa (diff)
JavaScript: Support the creation of new revisions upon user request.
-rw-r--r--logikorr.js16
-rw-r--r--logikorr.lisp9
2 files changed, 22 insertions, 3 deletions
diff --git a/logikorr.js b/logikorr.js
index a0730bf..1fd21f4 100644
--- a/logikorr.js
+++ b/logikorr.js
@@ -1,6 +1,17 @@
var loader;
var autocompleteList;
-YUI().use('node-base', 'io-base', 'io-form', 'io-queue', 'json', function (Y) {
+YUI().use('node', 'node-base', 'io-base', 'io-form', 'io-queue', 'json', function (Y) {
+ function registerMakeRevisionAction() {
+ var button = Y.one("#make-revision");
+ button.on("click", function(e) {
+ Y.io("make-new-revision",
+ { 'on': { 'complete': function(id, o, args) {
+ Y.log("Neue Version: " + o.responseText);
+ Y.one("#new-version-label").set("innerText", "Gesichert. Neue Version: " + o.responseText + ".");
+ } } });
+ });
+ }
+
function markAsChanged(input) {
input.setAttribute("style", "background-color: #faa");
}
@@ -116,5 +127,6 @@ YUI().use('node-base', 'io-base', 'io-form', 'io-queue', 'json', function (Y) {
}
};
- return Y.on('domready', makeStudentRow);
+ Y.on('domready', registerMakeRevisionAction);
+ Y.on('domready', makeStudentRow);
});
diff --git a/logikorr.lisp b/logikorr.lisp
index c272880..0ce4884 100644
--- a/logikorr.lisp
+++ b/logikorr.lisp
@@ -40,7 +40,8 @@
*database*)))
(find-students)
(write-database-to-file new-path)
- (setq *database* new-path)))
+ (setq *database* new-path)
+ (1+ number)))
(defmacro with-authentication (() &body body)
`(call-with-authentication (lambda () ,@body)))
@@ -113,6 +114,7 @@
(<:body
(<:h1 "Logik I: Korrekturergebnisse")
(<:h2 "Neue Ergebnisse")
+ (<:form (<:button :type "button" :id "make-revision" (<:as-html "Aktuelle Version sichern")) (<:div :id "new-version-label" :style "display: inline; color: #070"))
(<:table :id "ergebnisse")
(<:h2 "Bestehende Ergebnisse")
(<:table
@@ -242,6 +244,11 @@ div.autocomplete ul li {
(write-database)))
"\"OK\"")
+(define-easy-handler (create-new-revision :uri "/make-new-revision")
+ ()
+ (with-authentication ()
+ (format nil "~D" (make-new-revision))))
+
(defun write-database ()
(find-and-initialise-database)
(write-database-to-file *database*))