Author: hhubner Date: 2006-10-15 17:30:30 -0400 (Sun, 15 Oct 2006) New Revision: 2001
Modified: branches/xml-class-rework/projects/bos/payment-website/static/cms.js branches/xml-class-rework/projects/bos/worldpay-test/worldpay-test.lisp Log: Link statistics to admin menu
Modified: branches/xml-class-rework/projects/bos/payment-website/static/cms.js =================================================================== --- branches/xml-class-rework/projects/bos/payment-website/static/cms.js 2006-10-15 14:14:22 UTC (rev 2000) +++ branches/xml-class-rework/projects/bos/payment-website/static/cms.js 2006-10-15 21:30:30 UTC (rev 2001) @@ -1,3 +1,5 @@ +// This may look like -*- Java -*-, but it really is ECMAScript + // Formularcheck für Sponsoren-Erzeugung
function check_complete_sale() { @@ -2,44 +4,53 @@
- if (document.form.name.value == "") { - alert('Missing name for certificate'); - return false; - } + if (document.form.name.value == "") { + alert('Missing name for certificate'); + return false; + }
- if (document.form.numsqm.value == "" - || !document.form.numsqm.value.match(/^\d+$/)) { - alert('Invalid number of square meters'); - document.form.numsqm.focus(); - document.form.numsqm.select(); - return false; - } + if (document.form.numsqm.value == "" + || !document.form.numsqm.value.match(/^\d+$/)) { + alert('Invalid number of square meters'); + document.form.numsqm.focus(); + document.form.numsqm.select(); + return false; + }
- if (!document.form.date.value.match(/^[0-9][0-9].[0-9][0-9].[0-9][0-9][0-9][0-9]$/)) { - alert('Invalid date format, use DD.MM.YYYY'); - return false; - } + if (!document.form.date.value.match(/^[0-9][0-9].[0-9][0-9].[0-9][0-9][0-9][0-9]$/)) { + alert('Invalid date format, use DD.MM.YYYY'); + return false; + }
- var mail_message; + var mail_message;
- if (document.form.email.value == "") { - mail_message = 'No welcome email will be sent\n'; - } else { - mail_message = 'Welcome email will be sent to ' + document.form.email.value + '\n'; - } + if (document.form.email.value == "") { + mail_message = 'No welcome email will be sent\n'; + } else { + mail_message = 'Welcome email will be sent to ' + document.form.email.value + '\n'; + }
- var send_cert_message; + var send_cert_message;
- if (document.form.postaladdress.value.match(/^\s*$/)) { - send_cert_message = 'No printed certificate will be mailed\n'; - } else { - send_cert_message = 'Printed certificate will be mailed to:\n' + document.form.postaladdress.value; - } + if (document.form.postaladdress.value.match(/^\s*$/)) { + send_cert_message = 'No printed certificate will be mailed\n'; + } else { + send_cert_message = 'Printed certificate will be mailed to:\n' + document.form.postaladdress.value; + }
- var numsqm = document.form.numsqm.value; - var price = numsqm * 3; + var numsqm = document.form.numsqm.value; + var price = numsqm * 3;
- return confirm(numsqm + ' square meters have been bought for ' + price + ' euros\n' - + mail_message - + send_cert_message); + return confirm(numsqm + ' square meters have been bought for ' + price + ' euros\n' + + mail_message + + send_cert_message); }
+function statistic_selected () +{ + var select = document.getElementById('selector'); + var stats_name = select[select.options.selectedIndex].value;
+ document.getElementById('stats').innerHTML + = '<embed src="/images/statistics/' + stats_name + '.svg" width="800" height="600" type="image/svg+xml"></embed>'; + + return true; +}
Modified: branches/xml-class-rework/projects/bos/worldpay-test/worldpay-test.lisp =================================================================== --- branches/xml-class-rework/projects/bos/worldpay-test/worldpay-test.lisp 2006-10-15 14:14:22 UTC (rev 2000) +++ branches/xml-class-rework/projects/bos/worldpay-test/worldpay-test.lisp 2006-10-15 21:30:30 UTC (rev 2001) @@ -120,6 +120,24 @@ (setf contract (find-if #'contract-pdf-pathname (sponsor-contracts (bknr-request-user req))))) (redirect (format nil "/certificates/~D.pdf" (store-object-id contract)) req))
+(defclass statistics-handler (admin-only-handler prefix-handler) + ()) + +(defmethod handle ((handler statistics-handler) req) + (let ((stats-name (parse-url req))) + (cond + (stats-name + (redirect (format nil "~A.svg" stats-name) req)) + (t + (with-bos-cms-page (req :title "Statistics browser") + (:p + ((:select :id "selector" :onchange "return statistic_selected()") + (dolist (file (directory (merge-pathnames #p"images/statistics/*.svg" *website-directory*))) + (html ((:option :value (pathname-name file)) + (:princ-safe (pathname-name file))))))) + ((:p :id "stats") + ((:embed :src "/images/statistics/all-contracts.svg" :width 800 :height 600 :type "image/svg+xml") ""))))))) + (defclass print-certificate-handler (admin-only-handler object-handler) () (:default-initargs :class 'contract)) @@ -209,6 +227,7 @@ ("/create-contract" create-contract-handler) ("/pay-contract" pay-contract-handler) ("/cancel-contract" cancel-contract-handler) + ("/statistics" statistics-handler) ("/rss" rss-handler) ("/" redirect-handler :to "/index") @@ -220,6 +239,7 @@ :modules '(user images stats) :admin-navigation '(("user" . "user/") ("sponsor" . "edit-sponsor/") + ("statistics" . "statistics/") ("news" . "edit-news/") ("poi" . "edit-poi/") ("languages" . "languages")