From cf684daa1eacac996223f6c407074abd019ede4a Mon Sep 17 00:00:00 2001 From: ckonstanski Date: Sun, 22 Dec 2024 18:32:18 -0700 Subject: rename to bogenherrc --- .../clojurescript/woodriverlessons/.gitignore | 16 - .../clojurescript/woodriverlessons/README.md | 14 - .../clojurescript/woodriverlessons/project.clj | 13 - .../clojurescript/woodriverlessons/src/core.cljs | 1310 -------------------- lisp/webapps/woodriverlessons/conf/.gitignore | 1 - .../woodriverlessons/conf/options.lisp.example | 13 - lisp/webapps/woodriverlessons/site.lisp | 234 ---- .../woodriverlessons/static/css/stylesheet.css | 80 -- .../webapps/woodriverlessons/static/images/add.png | Bin 1832 -> 0 bytes .../static/images/classical-bow.jpg | Bin 158141 -> 0 bytes .../woodriverlessons/static/images/delete.png | Bin 1427 -> 0 bytes .../static/images/document-open.png | Bin 608 -> 0 bytes .../woodriverlessons/static/images/down.png | Bin 1297 -> 0 bytes .../woodriverlessons/static/images/download.png | Bin 577 -> 0 bytes .../woodriverlessons/static/images/edit-redo.png | Bin 1584 -> 0 bytes .../woodriverlessons/static/images/edit-undo.png | Bin 1585 -> 0 bytes .../woodriverlessons/static/images/edit.png | Bin 1034 -> 0 bytes .../static/images/emblem-favorite.png | Bin 1523 -> 0 bytes .../static/images/emblem-nowrite.png | Bin 1032 -> 0 bytes .../static/images/instrument-cabinet.jpg | Bin 4547021 -> 0 bytes lisp/webapps/woodriverlessons/static/images/no.png | Bin 1089 -> 0 bytes .../woodriverlessons/static/images/sort-alpha.png | Bin 625 -> 0 bytes lisp/webapps/woodriverlessons/static/images/up.png | Bin 1315 -> 0 bytes .../static/images/violin-strip.jpg | Bin 198050 -> 0 bytes .../webapps/woodriverlessons/static/images/yes.png | Bin 1013 -> 0 bytes lisp/webapps/woodriverlessons/static/js/cljs | 1 - 26 files changed, 1682 deletions(-) delete mode 100644 lisp/webapps/woodriverlessons/clojurescript/woodriverlessons/.gitignore delete mode 100644 lisp/webapps/woodriverlessons/clojurescript/woodriverlessons/README.md delete mode 100644 lisp/webapps/woodriverlessons/clojurescript/woodriverlessons/project.clj delete mode 100644 lisp/webapps/woodriverlessons/clojurescript/woodriverlessons/src/core.cljs delete mode 100644 lisp/webapps/woodriverlessons/conf/.gitignore delete mode 100644 lisp/webapps/woodriverlessons/conf/options.lisp.example delete mode 100644 lisp/webapps/woodriverlessons/site.lisp delete mode 100644 lisp/webapps/woodriverlessons/static/css/stylesheet.css delete mode 100644 lisp/webapps/woodriverlessons/static/images/add.png delete mode 100644 lisp/webapps/woodriverlessons/static/images/classical-bow.jpg delete mode 100644 lisp/webapps/woodriverlessons/static/images/delete.png delete mode 100644 lisp/webapps/woodriverlessons/static/images/document-open.png delete mode 100644 lisp/webapps/woodriverlessons/static/images/down.png delete mode 100644 lisp/webapps/woodriverlessons/static/images/download.png delete mode 100644 lisp/webapps/woodriverlessons/static/images/edit-redo.png delete mode 100644 lisp/webapps/woodriverlessons/static/images/edit-undo.png delete mode 100644 lisp/webapps/woodriverlessons/static/images/edit.png delete mode 100644 lisp/webapps/woodriverlessons/static/images/emblem-favorite.png delete mode 100644 lisp/webapps/woodriverlessons/static/images/emblem-nowrite.png delete mode 100644 lisp/webapps/woodriverlessons/static/images/instrument-cabinet.jpg delete mode 100644 lisp/webapps/woodriverlessons/static/images/no.png delete mode 100644 lisp/webapps/woodriverlessons/static/images/sort-alpha.png delete mode 100644 lisp/webapps/woodriverlessons/static/images/up.png delete mode 100644 lisp/webapps/woodriverlessons/static/images/violin-strip.jpg delete mode 100644 lisp/webapps/woodriverlessons/static/images/yes.png delete mode 120000 lisp/webapps/woodriverlessons/static/js/cljs (limited to 'lisp/webapps/woodriverlessons') diff --git a/lisp/webapps/woodriverlessons/clojurescript/woodriverlessons/.gitignore b/lisp/webapps/woodriverlessons/clojurescript/woodriverlessons/.gitignore deleted file mode 100644 index 864ae75..0000000 --- a/lisp/webapps/woodriverlessons/clojurescript/woodriverlessons/.gitignore +++ /dev/null @@ -1,16 +0,0 @@ -target -classes -resources -checkouts -pom.xml -pom.xml.asc -*.jar -*.class -.lein-* -.nrepl-port -.rebel_readline_history -.hgignore -.hg -profiles.clj -figwheel_server.log -.rebel_readline_history diff --git a/lisp/webapps/woodriverlessons/clojurescript/woodriverlessons/README.md b/lisp/webapps/woodriverlessons/clojurescript/woodriverlessons/README.md deleted file mode 100644 index 53ca866..0000000 --- a/lisp/webapps/woodriverlessons/clojurescript/woodriverlessons/README.md +++ /dev/null @@ -1,14 +0,0 @@ -# ldapadmin - -A Clojure library designed to ... well, that part is up to you. - -## Usage - -FIXME - -## License - -Copyright © 2017 FIXME - -Distributed under the Eclipse Public License either version 1.0 or (at -your option) any later version. diff --git a/lisp/webapps/woodriverlessons/clojurescript/woodriverlessons/project.clj b/lisp/webapps/woodriverlessons/clojurescript/woodriverlessons/project.clj deleted file mode 100644 index 9b93c1e..0000000 --- a/lisp/webapps/woodriverlessons/clojurescript/woodriverlessons/project.clj +++ /dev/null @@ -1,13 +0,0 @@ -(defproject woodriverlessons "0.1.0-SNAPSHOT" - :description "FIXME" - :url "FIXME" - :license "public domain" - :dependencies [[org.clojure/clojure "LATEST"] - [org.clojure/clojurescript "LATEST"] - [cljs-ajax "LATEST"] - [prismatic/dommy "LATEST"] - [hiccups "LATEST"] - [cljsjs/showdown "LATEST"] - [com.andrewmcveigh/cljs-time "LATEST"]] - :plugins [[lein-cljsbuild "LATEST"]] - :clean-targets ^{:protect false} [:target-path "out" "resources/public/cljs"]) diff --git a/lisp/webapps/woodriverlessons/clojurescript/woodriverlessons/src/core.cljs b/lisp/webapps/woodriverlessons/clojurescript/woodriverlessons/src/core.cljs deleted file mode 100644 index e1b26bb..0000000 --- a/lisp/webapps/woodriverlessons/clojurescript/woodriverlessons/src/core.cljs +++ /dev/null @@ -1,1310 +0,0 @@ -(ns woodriverlessons.core - (:require-macros [hiccups.core :as hiccups :refer [html]]) - (:require [ajax.core :refer [GET POST raw-response-format]] - [dommy.core :as dommy] - [hiccups.runtime :as hiccupsrt] - [cljsjs.showdown :as showdown] - [clojure.string :as str] - [cljs-time.format :as time-format] - [org-ckons-cljs.notifications.core :as ck-notifications] - [org-ckons-cljs.form.core :as ck-form])) - -;; declarations - -(enable-console-print!) -(def jquery (js* "$")) -(def sql-formatter (time-format/formatter "yyyy-MM-dd HH:mm:ss")) -(def pretty-formatter (time-format/formatters :rfc822)) - -(declare date-sql-to-pretty) -(declare markdown-to-html) -(declare reduce-checkboxes) -(declare notifications) -(declare auth-notifications) -(declare template-menu) -(declare template-menu-user) -(declare handler-menu) -(declare handler-menu-user) -(declare render-menu) -(declare template-home) -(declare handler-home) -(declare render-home) -(declare template-login) -(declare handler-login) -(declare render-login) -(declare on-login-submit-clicked) -(declare handler-login-authenticate) -(declare render-login-authenticate) -(declare handler-logout) -(declare render-logout) -(declare template-profile) -(declare handler-profile) -(declare render-profile) -(declare template-profile-view) -(declare handler-profile-view) -(declare render-profile-view) -(declare on-profile-modify-clicked) -(declare template-profile-modify) -(declare handler-profile-modify) -(declare render-profile-modify) -(declare on-profile-modify-submit-clicked) -(declare handler-profile-modify-submit) -(declare render-profile-modify-submit) -(declare template-password) -(declare handler-password) -(declare render-password) -(declare on-password-submit-clicked) -(declare handler-password-submit) -(declare render-password-submit) -(declare template-about-us) -(declare handler-about-us) -(declare render-about-us) -(declare template-about-us-view) -(declare handler-about-us-view) -(declare render-about-us-view) -(declare on-about-us-modify-clicked) -(declare template-about-us-modify) -(declare handler-about-us-modify) -(declare render-about-us-modify) -(declare on-about-us-modify-submit-clicked) -(declare handler-about-us-modify-submit) -(declare render-about-us-modify-submit) -(declare render-gallery) -(declare template-gallery-view) -(declare template-gallery-image-fullscreen) -(declare on-gallery-image-clicked ) -(declare handler-gallery-view) -(declare render-gallery-view) -(declare on-gallery-add-clicked) -(declare template-gallery-add) -(declare handler-gallery-add) -(declare render-gallery-add) -(declare on-gallery-add-submit-clicked) -(declare handler-gallery-add-submit) -(declare render-gallery-add-submit) -(declare on-gallery-modify-clicked) -(declare template-gallery-modify) -(declare handler-gallery-modify) -(declare render-gallery-modify) -(declare on-gallery-modify-submit-clicked) -(declare handler-gallery-modify-submit) -(declare render-gallery-modify-submit) -(declare on-gallery-delete-clicked) -(declare handler-gallery-delete) -(declare render-gallery-delete) -(declare template-testimonials) -(declare handler-testimonials) -(declare render-testimonials) -(declare template-testimonials-view) -(declare handler-testimonials-view) -(declare render-testimonials-view) -(declare on-testimonials-modify-clicked) -(declare template-testimonials-modify) -(declare handler-testimonials-modify) -(declare render-testimonials-modify) -(declare on-testimonials-modify-submit-clicked) -(declare handler-testimonials-modify-submit) -(declare render-testimonials-modify-submit) -(declare template-contact-us) -(declare handler-contact-us) -(declare render-contact-us) -(declare template-contact-us-view) -(declare handler-contact-us-view) -(declare render-contact-us-view) -(declare on-contact-us-email-submit-clicked) -(declare handler-contact-us-email-submit) -(declare render-contact-us-email-submit) -(declare template-messages) -(declare handler-messages) -(declare render-messages) -(declare on-messages-mode-clicked) -(declare template-messages-results) -(declare handler-messages-results) -(declare render-messages-results) -(declare on-messages-mark) -(declare handler-messages-mark) -(declare render-messages-mark) -(declare template-users) -(declare handler-users) -(declare render-users) -(declare template-users-view) -(declare handler-users-view) -(declare render-users-view) -(declare on-users-add-clicked) -(declare template-users-add) -(declare handler-users-add) -(declare render-users-add) -(declare on-users-add-submit-clicked) -(declare handler-users-add-submit) -(declare render-users-add-submit) -(declare template-users-register) -(declare handler-users-register) -(declare render-users-register) -(declare template-users-register-form) -(declare handler-users-register-form) -(declare handler-users-register-form-impl) -(declare render-users-register-form) -(declare on-users-register-submit-clicked) -(declare template-users-register-submit) -(declare handler-users-register-submit) -(declare render-users-register-submit) -(declare on-users-modify-clicked) -(declare template-users-modify) -(declare handler-users-modify) -(declare render-users-modify) -(declare on-users-modify-submit-clicked) -(declare handler-users-modify-submit) -(declare render-users-modify-submit) -(declare on-users-toggle-active-clicked) -(declare handler-users-toggle-active) -(declare render-users-toggle-active) -(declare on-users-delete-clicked) -(declare handler-users-delete) -(declare render-users-delete) -(declare on-menu-clicked) -(declare handler-location) -(declare goto-location) -(declare reset-app) -(declare goto-register) - -(defn date-sql-to-pretty [sql-date] - (first (str/split (time-format/unparse pretty-formatter (time-format/parse sql-formatter (first (str/split sql-date ".")))) " Z"))) - -(defn markdown-to-html [markdown] - (let [converter (js/showdown.Converter.)] - (.makeHtml converter markdown))) - -(defn reduce-checkboxes [selector] - "Reduces the names of all checked checkboxes to a pipe-separated - list. Assumes that the checkboxes are named via the convention - `chk_something-more'. The important thing is the underscore - separating the throwaway prefix and the remaining useful - bit. `selector' will likely be something like: [id^='chk_']" - (reduce (fn [x y] - (cond (and x y) (str x "|" y) - (and x (not y)) x - (and (not x) y) y - :else "")) - (map (fn [elem] - (let [this (jquery (str "#" (dommy/attr elem :id)))] - (when (-> this (.prop "checked")) - (second (str/split (-> this (.prop "id")) "_"))))) - (.toArray (jquery selector))))) - -;; notifications - -(defn notifications [jsonobj] - (ck-notifications/maybe-message jsonobj) - (ck-notifications/maybe-error jsonobj)) - -(defn auth-notifications [jsonobj] - (cond (empty? (get jsonobj "errormsg")) - (notifications jsonobj) - :else - (do - (render-home "" (get jsonobj "errormsg")) - (render-menu)))) - -;; menu - -(hiccups/defhtml template-menu [menuitems] - [:ul {:class "nav nav-pills"} - (for [menuitem menuitems] - [:li {:class "nav-item"} - [:a {:class (cond (= (str/upper-case (get menuitem "handler")) - (str/upper-case (dommy/html (dommy/sel1 :#location)))) - "nav-link active" - :else - "nav-link") - :id (get menuitem "id") - :onclick (str (namespace ::x) ".on_menu_clicked('" (get menuitem "handler") "')")} - (get menuitem "label")]])]) - -(hiccups/defhtml template-menu-user [jsonobj] - [:div {:class "dropdown"} - [:button {:class "btn btn-primary dropdown-toggle" - :type "button" - :id "button-menu-user" - :data-toggle "dropdown" - :aria-haspopup "true" - :aria-expanded "false"} - (get jsonobj "label")] - [:div {:class "dropdown-menu" :aria-labelledby "button-menu-user"} - (for [menuitem (get jsonobj "menuitems")] - [:a {:class "dropdown-item" - :onclick (str (namespace ::x) ".on_menu_clicked('" (get menuitem "handler") "')")} - (get menuitem "label")])]]) - -(defn handler-menu [response] - (let [jsonobj (js->clj (js/JSON.parse response))] - (dommy/set-html! (dommy/sel1 :#menu) (template-menu (get jsonobj "menuitems"))))) - -(defn handler-menu-user [response] - (let [jsonobj (js->clj (js/JSON.parse response))] - (dommy/set-html! (dommy/sel1 :#menu-user) (template-menu-user jsonobj)))) - -(defn render-menu [] - (GET "/menu" {:handler handler-menu}) - (GET "/menu/user" {:handler handler-menu-user})) - -;; home - -(hiccups/defhtml template-home [jsonobj] - [:h1 {:style "text-align: center"} "Welcome to the studio of Carlos Konstanski"] - [:div {:style "text-align: center"} - [:img {:style "width: 100%" - :src "/static/images/instrument-cabinet.jpg"}]]) - -(defn handler-home [response] - (let [jsonobj (js->clj (js/JSON.parse response))] - (notifications jsonobj) - (dommy/set-html! (dommy/sel1 :#body) (template-home jsonobj)))) - -(defn render-home - ([] - (GET "/home" {:handler handler-home})) - ([message errormsg] - (POST "/home" - {:format :raw - :params {:message message - :errormsg errormsg} - :handler handler-home}))) - -;; login - -(hiccups/defhtml template-login [jsonobj] - [:h3 {:style "text-align: center"} (get jsonobj "title")] - (ck-form/template-generic-form (get jsonobj "form") (namespace ::x)) - [:div {:style "text-align: center"} - [:a {:href ""} "Forgot password?"]]) - -(defn handler-login [response] - (let [jsonobj (js->clj (js/JSON.parse response))] - (notifications jsonobj) - (dommy/set-html! (dommy/sel1 :#body) (template-login jsonobj)))) - -(defn render-login [] - (GET "/login" {:handler handler-login})) - -;; login-authenticate - -(defn on-login-submit-clicked [] - (when (-> (jquery "#login-form") - (.get "0") - (.checkValidity)) - (render-login-authenticate))) - -(defn handler-login-authenticate [response] - (let [jsonobj (js->clj (js/JSON.parse response))] - (cond (get jsonobj "errormsg") - (goto-location "/login") - (get jsonobj "message") - (do - (dommy/set-html! (dommy/sel1 :#location) "/home") - (render-home) - (render-menu))))) - -(defn render-login-authenticate [] - (POST "/login/authenticate" - {:format :raw - :params {:username (dommy/value (dommy/sel1 :#username)) - :pwd (dommy/value (dommy/sel1 :#pwd))} - :handler handler-login-authenticate})) - -;; logout - -(defn handler-logout [response] - (let [jsonobj (js->clj (js/JSON.parse response))] - (render-home "You are now logged out" "") - (dommy/set-html! (dommy/sel1 :#location) "/home") - (render-menu))) - -(defn render-logout [] - (GET "/logout" {:handler handler-logout})) - -;; profile - -(hiccups/defhtml template-profile [jsonobj] - [:h3 {:style "text-align: center"} (get jsonobj "title")] - [:div {:id "content"}] - [:div {:id "modify" - :class "modal fade" - :role "dialog" - :tabindex "-1"} - [:div {:class "modal-dialog modal-lg"} - [:div {:class "modal-content"} - [:div {:class "modal-header"} - [:h5 {:class "modal-title"} "Profile - Modify"] - [:button {:type "button" - :class "close" - :data-dismiss "modal"} - "×"]] - [:div {:id "modify-body" - :class "modal-body" - :style "height: 460px;"}] - [:div {:class "modal-footer"} - [:button {:type "submit" - :class "btn btn-danger btn-default" - :data-dismiss "modal"} - [:span {:class "glyphicon glyphicon-remove"}] - "Cancel"]]]]]) - -(defn handler-profile [response] - (let [jsonobj (js->clj (js/JSON.parse response))] - (notifications jsonobj) - (dommy/set-html! (dommy/sel1 :#body) (template-profile jsonobj)) - (render-profile-view))) - -(defn render-profile [] - (GET "/profile" {:handler handler-profile})) - -;; profile-view - -(hiccups/defhtml template-profile-view [jsonobj] - [:div {:style "text-align: right"} - [:img {:src "/static/images/edit.png" - :style "cursor:pointer; cursor:hand" - :onclick (str (namespace ::x) ".on_profile_modify_clicked()")}]] - [:div {:class "container"} - [:div {:class "row"} - [:div {:class "col" :style "text-align: right"} "Username:"] - [:div {:class "col-10"} (get jsonobj "username")]] - [:div {:class "row"} - [:div {:class "col" :style "text-align: right"} "First Name:"] - [:div {:class "col-10"} (get jsonobj "first_name")]] - [:div {:class "row"} - [:div {:class "col" :style "text-align: right"} "Last Name:"] - [:div {:class "col-10"} (get jsonobj "last_name")]] - [:div {:class "row"} - [:div {:class "col" :style "text-align: right"} "Email:"] - [:div {:class "col-10"} (get jsonobj "email")]] - [:div {:class "row"} - [:div {:class "col" :style "text-align: right"} "Phone:"] - [:div {:class "col-10"} (get jsonobj "phone")]]]) - -(defn handler-profile-view [response] - (let [jsonobj (js->clj (js/JSON.parse response))] - (dommy/set-html! (dommy/sel1 :#content) (template-profile-view jsonobj)))) - -(defn render-profile-view [] - (GET "/profile/view" {:handler handler-profile-view})) - -;; profile-modify - -(defn on-profile-modify-clicked [] - (render-profile-modify)) - -(hiccups/defhtml template-profile-modify [jsonobj] - (ck-form/template-generic-form (get jsonobj "form") (namespace ::x))) - -(defn handler-profile-modify [response] - (let [jsonobj (js->clj (js/JSON.parse response))] - (auth-notifications jsonobj) - (dommy/set-html! (dommy/sel1 :#modify-body) (template-profile-modify jsonobj)) - (.modal (jquery "#modify")))) - -(defn render-profile-modify [] - (POST "/profile/modify" {:handler handler-profile-modify})) - -;; profile-modify-submit - -(defn on-profile-modify-submit-clicked [] - (when (-> (jquery "#profile-modify-form") - (.get "0") - (.checkValidity)) - (.modal (jquery "#modify") "hide") - (render-profile-modify-submit))) - -(defn handler-profile-modify-submit [response] - (let [jsonobj (js->clj (js/JSON.parse response))] - (auth-notifications jsonobj) - (on-menu-clicked "/profile"))) - -(defn render-profile-modify-submit [] - (POST "/profile/modify/submit" - {:format :raw - :params {:id (dommy/value (dommy/sel1 :#id)) - :username (dommy/value (dommy/sel1 :#username)) - :first_name (dommy/value (dommy/sel1 :#first_name)) - :last_name (dommy/value (dommy/sel1 :#last_name)) - :email (dommy/value (dommy/sel1 :#email)) - :phone (dommy/value (dommy/sel1 :#phone))} - :handler handler-profile-modify-submit})) - -;; password - -(hiccups/defhtml template-password [jsonobj] - [:h3 {:style "text-align: center"} (get jsonobj "title")] - (ck-form/template-generic-form (get jsonobj "form") (namespace ::x))) - -(defn handler-password [response] - (let [jsonobj (js->clj (js/JSON.parse response))] - (notifications jsonobj) - (dommy/set-html! (dommy/sel1 :#body) (template-password jsonobj)))) - -(defn render-password [] - (GET "/password" {:handler handler-password})) - -;; password-submit - -(defn on-password-submit-clicked [] - (when (-> (jquery "#password-form") - (.get "0") - (.checkValidity)) - (render-password-submit))) - -(defn handler-password-submit [response] - (let [jsonobj (js->clj (js/JSON.parse response))] - (auth-notifications jsonobj) - (on-menu-clicked "/password"))) - -(defn render-password-submit [] - (POST "/password/submit" - {:format :raw - :params {:id (dommy/value (dommy/sel1 :#id)) - :pwd (dommy/value (dommy/sel1 :#pwd)) - :pwd2 (dommy/value (dommy/sel1 :#pwd2))} - :handler handler-password-submit})) - -;; about-us - -(hiccups/defhtml template-about-us [jsonobj] - [:h1 {:style "text-align: center"} "About the Studio"] - [:div {:id "content"}] - [:div {:id "modify" - :class "modal fade" - :role "dialog" - :tabindex "-1"} - [:div {:class "modal-dialog modal-lg"} - [:div {:class "modal-content"} - [:div {:class "modal-header"} - [:h5 [:span {:id "modify-title"}]] - [:button {:type "button" - :class "close" - :data-dismiss "modal"} - "×"]] - [:div {:id "modify-body" - :class "modal-body" - :style "height: 460px;"}] - [:div {:class "modal-footer"} - [:button {:type "submit" - :class "btn btn-danger btn-default" - :data-dismiss "modal"} - [:span {:class "glyphicon glyphicon-remove"}] - "Cancel"]]]]]) - -(defn handler-about-us [response] - (let [jsonobj (js->clj (js/JSON.parse response))] - (notifications jsonobj) - (dommy/set-html! (dommy/sel1 :#body) (template-about-us jsonobj)) - (render-about-us-view))) - -(defn render-about-us [] - (GET "/about-us" {:handler handler-about-us})) - -;; about-us-view - -(hiccups/defhtml template-about-us-view [jsonobj] - (when (get jsonobj "adminP") - [:div {:style "text-align: right;"} - [:img {:src "/static/images/edit.png" - :style "cursor:pointer; cursor:hand" - :onclick (str (namespace ::x) ".on_about_us_modify_clicked()")}]]) - [:div {:id "markdown"}]) - -(defn handler-about-us-view [response] - (let [jsonobj (js->clj (js/JSON.parse response))] - (dommy/set-html! (dommy/sel1 :#content) (template-about-us-view jsonobj)) - (dommy/set-html! (dommy/sel1 :#markdown) (markdown-to-html (get jsonobj "content"))))) - -(defn render-about-us-view [] - (GET "/about-us/view" {:handler handler-about-us-view})) - -;; about-us-modify - -(defn on-about-us-modify-clicked [] - (render-about-us-modify)) - -(hiccups/defhtml template-about-us-modify [jsonobj] - (ck-form/template-generic-form (get jsonobj "form") (namespace ::x))) - -(defn handler-about-us-modify [response] - (let [jsonobj (js->clj (js/JSON.parse response))] - (auth-notifications jsonobj) - (dommy/set-html! (dommy/sel1 :#modify-title) "About Us - Modify") - (dommy/set-html! (dommy/sel1 :#modify-body) (template-about-us-modify jsonobj)) - (.modal (jquery "#modify")))) - -(defn render-about-us-modify [] - (POST "/about-us/modify" {:handler handler-about-us-modify})) - -;; about-us-modify-submit - -(defn on-about-us-modify-submit-clicked [] - (when (-> (jquery "#about-us-modify-form") - (.get "0") - (.checkValidity)) - (.modal (jquery "#modify") "hide") - (render-about-us-modify-submit))) - -(defn handler-about-us-modify-submit [response] - (let [jsonobj (js->clj (js/JSON.parse response))] - (auth-notifications jsonobj) - (dommy/set-html! (dommy/sel1 :#content) (template-about-us-view jsonobj)) - (dommy/set-html! (dommy/sel1 :#markdown) (markdown-to-html (get jsonobj "content"))))) - -(defn render-about-us-modify-submit [] - (POST "/about-us/modify/submit" - {:format :raw - :params {:content (dommy/value (dommy/sel1 :#txt-content))} - :handler handler-about-us-modify-submit})) - -;; gallery - -(hiccups/defhtml template-gallery [jsonobj] - [:h1 {:style "text-align: center"} "Gallery"] - [:div {:id "content"}] - [:div {:id "image" - :class "modal fade" - :role "dialog" - :tabindex "-1"} - [:div {:class "modal-dialog modal-lg mw-100 w-75"} - [:div {:class "modal-content"} - [:div {:class "modal-header"} - [:button {:type "button" - :class "close" - :data-dismiss "modal"} - "×"]] - [:div {:id "image-body" - :class "modal-body" - :style "width: 100%"}] - [:div {:class "modal-footer"} - [:button {:type "submit" - :class "btn btn-danger btn-default" - :data-dismiss "modal"} - [:span {:class "glyphicon glyphicon-remove"}] - "Close"]]]]] - [:div {:id "modify" - :class "modal fade" - :role "dialog" - :tabindex "-1"} - [:div {:class "modal-dialog modal-lg"} - [:div {:class "modal-content"} - [:div {:class "modal-header"} - [:h5 [:span {:id "modify-title"}]] - [:button {:type "button" - :class "close" - :data-dismiss "modal"} - "×"]] - [:div {:id "modify-body" - :class "modal-body" - :style "height: 425px;"}] - [:div {:class "modal-footer"} - [:button {:type "submit" - :class "btn btn-danger btn-default" - :data-dismiss "modal"} - [:span {:class "glyphicon glyphicon-remove"}] - "Cancel"]]]]]) - -(defn handler-gallery [response] - (let [jsonobj (js->clj (js/JSON.parse response))] - (auth-notifications jsonobj) - (dommy/set-html! (dommy/sel1 :#body) (template-gallery jsonobj)) - (render-gallery-view))) - -(defn render-gallery [] - (GET "/gallery" {:handler handler-gallery})) - -;; gallery-view - -(hiccups/defhtml template-gallery-view [jsonobj] - [:div {:style "text-align: right"} - (when (get jsonobj "adminP") - [:img {:src "/static/images/add.png" - :style "cursor:pointer; cursor:hand" - :onclick (str (namespace ::x) ".on_gallery_add_clicked()")}])] - (let [results (get jsonobj "results")] - (cond (empty? results) - [:h5 {:style "text-align: center"} "No results found."] - :else - (for [rec results] - [:span {:style "width:720px; height:425px"} - [:table - [:tr - [:td - (cond (not (= (get rec "video_embed_url") "null")) - [:iframe {:width "720" - :height "405" - :src (get rec "video_embed_url") - :frameborder "0" - :allow "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" - :referrerpolicy "strict-origin-when-cross-origin" - :allowfullscreen "allowfullscreen"}] - :else - (let [img-src (str "/gallery/file/view?id=" (get rec "id"))] - [:img {:style "height:405px; cursor:pointer; cursor:hand" - :src img-src - :onclick (str (namespace ::x) ".on_gallery_image_clicked('" img-src "')")}]))] - (when (get jsonobj "adminP") - [:td {:style "text-align:right; vertical-align:top"} - [:img {:src "/static/images/edit.png" - :onclick (str (namespace ::x) ".on_gallery_modify_clicked(" (get rec "id") ")")}] - [:br] - [:img {:src "/static/images/delete.png" - :onclick (str (namespace ::x) ".on_gallery_delete_clicked(" (get rec "id") ")")}]])] - [:tr - [:td (get rec "description")]] - [:tr - [:td " "]] - [:tr - [:td " "]]]])))) - -(hiccups/defhtml template-gallery-image-fullscreen [src] - [:img {:src src - :style "width: 100%"}]) - -(defn on-gallery-image-clicked [src] - (dommy/set-html! (dommy/sel1 :#image-body) (template-gallery-image-fullscreen src)) - (.modal (jquery "#image"))) - -(defn handler-gallery-view [response] - (let [jsonobj (js->clj (js/JSON.parse response))] - (auth-notifications jsonobj) - (dommy/set-html! (dommy/sel1 :#content) (template-gallery-view jsonobj)))) - -(defn render-gallery-view [] - (GET "/gallery/view" {:handler handler-gallery-view})) - -;; gallery-add - -(defn on-gallery-add-clicked [] - (render-gallery-add)) - -(hiccups/defhtml template-gallery-add [jsonobj] - (ck-form/template-generic-form (get jsonobj "form") (namespace ::x))) - -(defn handler-gallery-add [response] - (let [jsonobj (js->clj (js/JSON.parse response))] - (auth-notifications jsonobj) - (dommy/set-html! (dommy/sel1 :#modify-title) "Gallery - Add") - (dommy/set-html! (dommy/sel1 :#modify-body) (template-gallery-add jsonobj)) - (.modal (jquery "#modify")))) - -(defn render-gallery-add [] - (POST "/gallery/add" {:handler handler-gallery-add})) - -;; gallery-add-submit - -(defn on-gallery-add-submit-clicked [] - (when (-> (jquery "#gallery-add-form") - (.get "0") - (.checkValidity)) - (.modal (jquery "#modify") "hide") - (render-gallery-add-submit))) - -(defn handler-gallery-add-submit [response] - (let [jsonobj (js->clj (js/JSON.parse response))] - (auth-notifications jsonobj) - (on-menu-clicked "/gallery"))) - -(defn render-gallery-add-submit [] - (let [form-data (js/FormData. (dommy/sel1 :#gallery-add-form))] - (POST "/gallery/add/submit" - {:body form-data - :response-format (raw-response-format) - :handler handler-gallery-add-submit}))) - -;; gallery-modify - -(defn on-gallery-modify-clicked [id] - (render-gallery-modify id)) - -(hiccups/defhtml template-gallery-modify [jsonobj] - (ck-form/template-generic-form (get jsonobj "form") (namespace ::x))) - -(defn handler-gallery-modify [response] - (let [jsonobj (js->clj (js/JSON.parse response))] - (auth-notifications jsonobj) - (dommy/set-html! (dommy/sel1 :#modify-title) "Gallery - Modify") - (dommy/set-html! (dommy/sel1 :#modify-body) (template-gallery-modify jsonobj)) - (.modal (jquery "#modify")))) - -(defn render-gallery-modify [id] - (POST "/gallery/modify" - {:format :raw - :params {:id id} - :handler handler-gallery-modify})) - -;; gallery-modify-submit - -(defn on-gallery-modify-submit-clicked [] - (when (-> (jquery "#gallery-modify-form") - (.get "0") - (.checkValidity)) - (.modal (jquery "#modify") "hide") - (render-gallery-modify-submit))) - -(defn handler-gallery-modify-submit [response] - (let [jsonobj (js->clj (js/JSON.parse response))] - (auth-notifications jsonobj) - (on-menu-clicked "/gallery"))) - -(defn render-gallery-modify-submit [] - (let [form-data (js/FormData. (dommy/sel1 :#gallery-modify-form))] - (POST "/gallery/modify/submit" - {:body form-data - :response-format (raw-response-format) - :handler handler-gallery-add-submit}))) - -;; gallery-delete - -(defn on-gallery-delete-clicked [id] - (when (js/confirm (str "Are you sure you want to delete " id "? This action cannot be undone.")) - (render-gallery-delete id))) - -(defn handler-gallery-delete [response] - (let [jsonobj (js->clj (js/JSON.parse response))] - (auth-notifications jsonobj) - (on-menu-clicked "/gallery"))) - -(defn render-gallery-delete [id] - (POST "/gallery/delete" - {:format :raw - :params {:id id} - :handler handler-gallery-delete})) - -;; testimonials - -(hiccups/defhtml template-testimonials [jsonobj] - [:h3 {:style "text-align: center"} (get jsonobj "title")] - [:div {:id "content"}] - [:div {:id "modify" - :class "modal fade" - :role "dialog" - :tabindex "-1"} - [:div {:class "modal-dialog modal-lg"} - [:div {:class "modal-content"} - [:div {:class "modal-header"} - [:h5 [:span {:id "modify-title"}]] - [:button {:type "button" - :class "close" - :data-dismiss "modal"} - "×"]] - [:div {:id "modify-body" - :class "modal-body" - :style "height: 460px;"}] - [:div {:class "modal-footer"} - [:button {:type "submit" - :class "btn btn-danger btn-default" - :data-dismiss "modal"} - [:span {:class "glyphicon glyphicon-remove"}] - "Cancel"]]]]]) - -(defn handler-testimonials [response] - (let [jsonobj (js->clj (js/JSON.parse response))] - (notifications jsonobj) - (dommy/set-html! (dommy/sel1 :#body) (template-testimonials jsonobj)) - (render-testimonials-view))) - -(defn render-testimonials [] - (GET "/testimonials" {:handler handler-testimonials})) - -;; testimonials-view - -(hiccups/defhtml template-testimonials-view [jsonobj] - (when (get jsonobj "adminP") - [:div {:style "text-align: right;"} - [:img {:src "/static/images/edit.png" - :style "cursor:pointer; cursor:hand" - :onclick (str (namespace ::x) ".on_testimonials_modify_clicked()")}]]) - [:div {:id "markdown"}]) - -(defn handler-testimonials-view [response] - (let [jsonobj (js->clj (js/JSON.parse response))] - (dommy/set-html! (dommy/sel1 :#content) (template-testimonials-view jsonobj)) - (dommy/set-html! (dommy/sel1 :#markdown) (markdown-to-html (get jsonobj "content"))))) - -(defn render-testimonials-view [] - (GET "/testimonials/view" {:handler handler-testimonials-view})) - -;; testimonials-modify - -(defn on-testimonials-modify-clicked [] - (render-testimonials-modify)) - -(hiccups/defhtml template-testimonials-modify [jsonobj] - (ck-form/template-generic-form (get jsonobj "form") (namespace ::x))) - -(defn handler-testimonials-modify [response] - (let [jsonobj (js->clj (js/JSON.parse response))] - (auth-notifications jsonobj) - (dommy/set-html! (dommy/sel1 :#modify-title) (get jsonobj "title")) - (dommy/set-html! (dommy/sel1 :#modify-body) (template-testimonials-modify jsonobj)) - (.modal (jquery "#modify")))) - -(defn render-testimonials-modify [] - (POST "/testimonials/modify" {:handler handler-testimonials-modify})) - -;; testimonials-modify-submit - -(defn on-testimonials-modify-submit-clicked [] - (when (-> (jquery "#testimonials-modify-form") - (.get "0") - (.checkValidity)) - (.modal (jquery "#modify") "hide") - (render-testimonials-modify-submit))) - -(defn handler-testimonials-modify-submit [response] - (let [jsonobj (js->clj (js/JSON.parse response))] - (auth-notifications jsonobj) - (on-menu-clicked "/testimonials"))) - -(defn render-testimonials-modify-submit [] - (POST "/testimonials/modify/submit" - {:format :raw - :params {:content (dommy/value (dommy/sel1 :#txt-content))} - :handler handler-testimonials-modify-submit})) - -;; contact-us - -(hiccups/defhtml template-contact-us [jsonobj] - [:h1 {:style "text-align: center"} "Reach out to me by filling out the form."] - [:div {:id "content"}]) - -(defn handler-contact-us [response] - (let [jsonobj (js->clj (js/JSON.parse response))] - (notifications jsonobj) - (dommy/set-html! (dommy/sel1 :#body) (template-contact-us jsonobj)) - (render-contact-us-view))) - -(defn render-contact-us [] - (GET "/contact-us" {:handler handler-contact-us})) - -;; contact-us-view - -(hiccups/defhtml template-contact-us-view [jsonobj] - (ck-form/template-generic-form (get jsonobj "form") (namespace ::x))) - -(defn handler-contact-us-view [response] - (let [jsonobj (js->clj (js/JSON.parse response))] - (notifications jsonobj) - (dommy/set-html! (dommy/sel1 :#content) (template-contact-us-view jsonobj)))) - -(defn render-contact-us-view [] - (GET "/contact-us/view" {:handler handler-contact-us-view})) - -;; contact-us-email - -(defn on-contact-us-email-submit-clicked [] - (render-contact-us-email-submit)) - -(defn handler-contact-us-email-submit [response] - (on-menu-clicked "/contact-us")) - -(defn render-contact-us-email-submit [] - (POST "/contact-us/email" - {:format :raw - :params {:first_name (dommy/value (dommy/sel1 :#first_name)) - :last_name (dommy/value (dommy/sel1 :#last_name)) - :email (dommy/value (dommy/sel1 :#email)) - :phone (dommy/value (dommy/sel1 :#phone)) - :comments (dommy/value (dommy/sel1 :#comments))} - :handler handler-contact-us-email-submit})) - -;; messages - -(hiccups/defhtml template-messages [jsonobj] - [:h3 {:style "text-align: center"} (get jsonobj "title")] - (ck-form/template-generic-form (get jsonobj "form") (namespace ::x)) - [:div {:id "results"}]) - -(defn handler-messages [response] - (let [jsonobj (js->clj (js/JSON.parse response))] - (notifications jsonobj) - (dommy/set-html! (dommy/sel1 :#body) (template-messages jsonobj)) - (when (not (empty? (dommy/value (dommy/sel1 :#read)))) - (render-messages-results)))) - -(defn render-messages [] - (GET "/messages" {:handler handler-messages})) - -;; messages-results - -(defn on-messages-mode-clicked [read] - (dommy/set-value! (dommy/sel1 :#read) read) - (render-messages-results)) - -(hiccups/defhtml template-messages-results [jsonobj] - (let [results (get jsonobj "results") - keys (remove (fn [x] - (not (get (first results) x))) - (keys (first results)))] - (cond (empty? results) - [:h5 {:style "text-align: center"} "No results found."] - :else - [:table {:class "table table-hover"} - [:thead - [:tr - (for [key keys] - [:th key]) - [:th - (str "Mark " (cond (= (dommy/value (dommy/sel1 :#read)) "read") - "unread" - :else - "read"))]]] - [:tbody - (for [rec results] - (let [onclick "void()"] - [:tr - (for [key keys] - [:td {:onclick onclick} (get rec key)]) - [:td [:img {:src (str "/static/images/" - (cond (= (dommy/value (dommy/sel1 :#read)) "read") - "edit-undo.png" - :else - "edit-redo.png")) - :style "cursor: pointer; cursor: hand" - :onclick (str (namespace ::x) - ".on_messages_mark(" - (cond (= (dommy/value (dommy/sel1 :#read)) "read") - "'unread'" - :else - "'read'") - "," (get rec "id") ")")}]]]))]]))) - -(defn handler-messages-results [response] - (let [jsonobj (js->clj (js/JSON.parse response))] - (auth-notifications jsonobj) - (dommy/set-html! (dommy/sel1 :#results) (template-messages-results jsonobj)))) - -(defn render-messages-results [] - (POST "/messages/results" - {:format :raw - :params {:read (dommy/value (dommy/sel1 :#read))} - :handler handler-messages-results})) - -;; messages-mark - -(defn on-messages-mark [read id] - (render-messages-mark read id)) - -(defn handler-messages-mark [response] - (let [jsonobj (js->clj (js/JSON.parse response))] - (auth-notifications jsonobj) - (on-menu-clicked "/messages"))) - -(defn render-messages-mark [read id] - (POST "/messages/mark" - {:format :raw - :params {:read read - :id id} - :handler handler-messages-mark})) - -;; users - -(hiccups/defhtml template-users [jsonobj] - [:h3 {:style "text-align: center"} (get jsonobj "title")] - [:div {:id "content"}] - [:div {:id "modify" - :class "modal fade" - :role "dialog" - :tabindex "-1"} - [:div {:class "modal-dialog modal-lg"} - [:div {:class "modal-content"} - [:div {:class "modal-header"} - [:h5 [:span {:id "modify-title"}]] - [:button {:type "button" - :class "close" - :data-dismiss "modal"} - "×"]] - [:div {:id "modify-body" - :class "modal-body" - :style "height: 450px;"}] - [:div {:class "modal-footer"} - [:button {:type "submit" - :class "btn btn-danger btn-default" - :data-dismiss "modal"} - [:span {:class "glyphicon glyphicon-remove"}] - "Cancel"]]]]]) - -(defn handler-users [response] - (let [jsonobj (js->clj (js/JSON.parse response))] - (notifications jsonobj) - (dommy/set-html! (dommy/sel1 :#body) (template-users jsonobj)) - (render-users-view))) - -(defn render-users [] - (GET "/users" {:handler handler-users})) - -;; users-view - -(hiccups/defhtml template-users-view [jsonobj] - [:div {:style "text-align: right"} - [:img {:src "/static/images/add.png" - :style "cursor:pointer; cursor:hand" - :onclick (str (namespace ::x) ".on_users_add_clicked()")}]] - [:table {:class "table table-striped table-hover table-sm"} - [:thead - [:tr - [:th {:scope "col"} "Active?"] - [:th {:scope "col"} "Last Name"] - [:th {:scope "col"} "First Name"] - [:th {:scope "col"} "Username"] - [:th {:scope "col"} "Email"] - [:th {:scope "col"} "Phone"] - [:th {:scope "col"} "Del"]]] - [:tbody - (for [user (get jsonobj "users")] - (let [onclick (str (namespace ::x) ".on_users_modify_clicked(" (get user "id") ")") - toggle-active (str (namespace ::x) ".on_users_toggle_active_clicked(" (get user "id") ")")] - [:tr - [:td [:img {:src (cond (get user "active") - "/static/images/yes.png" - :else - "/static/images/no.png") - :onclick toggle-active}]] - [:td {:onclick onclick} (get user "last_name")] - [:td {:onclick onclick} (get user "first_name")] - [:td {:onclick onclick} (get user "username")] - [:td {:onclick onclick} (get user "email")] - [:td {:onclick onclick} (get user "phone")] - [:td [:img {:src "/static/images/delete.png" - :onclick (str (namespace ::x) ".on_users_delete_clicked(" (get user "id") ", '" (get user "first_name") "', '" (get user "last_name") "')")}]]]))]]) - -(defn handler-users-view [response] - (let [jsonobj (js->clj (js/JSON.parse response))] - (dommy/set-html! (dommy/sel1 :#content) (template-users-view jsonobj)))) - -(defn render-users-view [] - (GET "/users/view" {:handler handler-users-view})) - -;; users-add - -(defn on-users-add-clicked [] - (render-users-add)) - -(hiccups/defhtml template-users-add [jsonobj] - (ck-form/template-generic-form (get jsonobj "form") (namespace ::x))) - -(defn handler-users-add [response] - (let [jsonobj (js->clj (js/JSON.parse response))] - (auth-notifications jsonobj) - (dommy/set-html! (dommy/sel1 :#modify-title) (get jsonobj "title")) - (dommy/set-html! (dommy/sel1 :#modify-body) (template-users-add jsonobj)) - (.modal (jquery "#modify")))) - -(defn render-users-add [] - (POST "/users/add" {:handler handler-users-add})) - -;; users-add-submit - -(defn on-users-add-submit-clicked [] - (when (-> (jquery "#users-add-form") - (.get "0") - (.checkValidity)) - (.modal (jquery "#modify") "hide") - (render-users-add-submit))) - -(defn handler-users-add-submit [response] - (let [jsonobj (js->clj (js/JSON.parse response))] - (auth-notifications jsonobj) - (on-menu-clicked "/users"))) - -(defn render-users-add-submit [] - (POST "/users/add/submit" - {:format :raw - :params {:role_groups (reduce-checkboxes "[id^='chk_']") - :first_name (dommy/value (dommy/sel1 :#first_name)) - :last_name (dommy/value (dommy/sel1 :#last_name)) - :email (dommy/value (dommy/sel1 :#email))} - :handler handler-users-add-submit})) - -;; users-register - -(hiccups/defhtml template-users-register [jsonobj] - [:h3 {:style "text-align: center"} (get jsonobj "title")] - [:div {:id "content"}]) - -(defn handler-users-register [response] - (let [jsonobj (js->clj (js/JSON.parse response))] - (dommy/set-html! (dommy/sel1 :#body) (template-users-register jsonobj)) - (render-users-register-form (get jsonobj "hash")))) - -(defn render-users-register [hash] - (POST "/users/register" - {:format :raw - :params {:hash hash} - :handler handler-users-register})) - -;; users-register-form - -(hiccups/defhtml template-users-register-form [jsonobj] - (cond (get jsonobj "errormsg") - [:a {:href (str "javascript:" (namespace ::x) ".reset_app()")} - "Click here to return to the home page."] - :else - (do - [:p (str "Welcome " (get jsonobj "firstName") " " (get jsonobj "lastName") " to the new user registration page. Please fill out the form below to complete your registration.")] - [:p "Create a new username and password for your login to the website. Phone number is optional."] - [:p (str "Your email address is recorded as " (get jsonobj "email") ". This is where notifications will be sent. If this is not the desired email address, you can change it later by visiting the Edit Profile page.")] - [:p (str "This registration will expire in " (get jsonobj "validFor") ". Please submit this form before that time.")] - (ck-form/template-generic-form (get jsonobj "form") (namespace ::x))))) - -(defn handler-users-register-form [response] - (let [jsonobj (js->clj (js/JSON.parse response))] - (notifications jsonobj) - (dommy/set-html! (dommy/sel1 :#content) (template-users-register-form jsonobj)))) - -(defn render-users-register-form [hash] - (POST "/users/register/form" - {:format :raw - :params {:hash hash} - :handler handler-users-register-form})) - -;; users-register-submit - -(defn on-users-register-submit-clicked [] - (when (-> (jquery "#users-register-form") - (.get "0") - (.checkValidity)) - (render-users-register-submit))) - -(hiccups/defhtml template-users-register-submit [jsonobj] - [:a {:href (str "javascript:" (namespace ::x) ".reset_app()")} - "Click here to start using the website!"]) - -(defn handler-users-register-submit [response] - (let [jsonobj (js->clj (js/JSON.parse response))] - (notifications jsonobj) - (cond (get jsonobj "errormsg") - (do - (dommy/set-value! (dommy/sel1 :#pwd) "") - (dommy/set-value! (dommy/sel1 :#pwd2) "")) - :else - (dommy/set-html! (dommy/sel1 :#content) (template-users-register-submit jsonobj))))) - -(defn render-users-register-submit [] - (POST "/users/register/submit" - {:format :raw - :params {:hash (dommy/value (dommy/sel1 :#hash)) - :username (dommy/value (dommy/sel1 :#username)) - :pwd (dommy/value (dommy/sel1 :#pwd)) - :pwd2 (dommy/value (dommy/sel1 :#pwd2)) - :phone (dommy/value (dommy/sel1 :#phone))} - :handler handler-users-register-submit})) - -;; users-modify - -(defn on-users-modify-clicked [id] - (render-users-modify id)) - -(hiccups/defhtml template-users-modify [jsonobj] - (ck-form/template-generic-form (get jsonobj "form") (namespace ::x))) - -(defn handler-users-modify [response] - (let [jsonobj (js->clj (js/JSON.parse response))] - (auth-notifications jsonobj) - (dommy/set-html! (dommy/sel1 :#modify-title) (get jsonobj "title")) - (dommy/set-html! (dommy/sel1 :#modify-body) (template-users-modify jsonobj)) - (.modal (jquery "#modify")))) - -(defn render-users-modify [id] - (POST "/users/modify" - {:format :raw - :params {:id id} - :handler handler-users-modify})) - -;; users-modify-submit - -(defn on-users-modify-submit-clicked [] - (when (-> (jquery "#users-modify-form") - (.get "0") - (.checkValidity)) - (.modal (jquery "#modify") "hide") - (render-users-modify-submit))) - -(defn handler-users-modify-submit [response] - (let [jsonobj (js->clj (js/JSON.parse response))] - (auth-notifications jsonobj) - (on-menu-clicked "/users"))) - -(defn render-users-modify-submit [] - (POST "/users/modify/submit" - {:format :raw - :params {:id (dommy/value (dommy/sel1 :#id)) - :role_groups (reduce-checkboxes "[id^='chk_']") - :username (dommy/value (dommy/sel1 :#username)) - :first_name (dommy/value (dommy/sel1 :#first_name)) - :last_name (dommy/value (dommy/sel1 :#last_name)) - :email (dommy/value (dommy/sel1 :#email)) - :phone (dommy/value (dommy/sel1 :#phone))} - :handler handler-users-modify-submit})) - -;; users-toggle-active - -(defn on-users-toggle-active-clicked [id] - (render-users-toggle-active id)) - -(defn handler-users-toggle-active [response] - (let [jsonobj (js->clj (js/JSON.parse response))] - (auth-notifications jsonobj) - (on-menu-clicked "/users"))) - -(defn render-users-toggle-active [id] - (POST "/users/toggle-active" - {:format :raw - :params {:id id} - :handler handler-users-toggle-active})) - -;; users-delete - -(defn on-users-delete-clicked [id first-name last-name] - (when (js/confirm (str "Are you sure you want to delete " first-name " " last-name "? This action cannot be undone.")) - (render-users-delete id))) - -(defn handler-users-delete [response] - (let [jsonobj (js->clj (js/JSON.parse response))] - (auth-notifications jsonobj) - (on-menu-clicked "/users"))) - -(defn render-users-delete [id] - (POST "/users/delete" - {:format :raw - :params {:id id} - :handler handler-users-delete})) - -;; location - -(defn on-menu-clicked [handler] - (dommy/set-html! (dommy/sel1 :#location) handler) - (render-menu) - (cond (= handler "/home") (render-home) - (= handler "/login") (render-login) - (= handler "/logout") (render-logout) - (= handler "/profile") (render-profile) - (= handler "/password") (render-password) - (= handler "/about-us") (render-about-us) - (= handler "/gallery") (render-gallery) - (= handler "/testimonials") (render-testimonials) - (= handler "/contact-us") (render-contact-us) - (= handler "/messages") (render-messages) - (= handler "/users") (render-users))) - -(defn handler-location [response] - (let [jsonobj (js->clj (js/JSON.parse response))] - (on-menu-clicked (get jsonobj "location")) - (notifications jsonobj))) - -(defn goto-location [location] - (POST "/location" - {:format :raw - :params {:location location} - :handler handler-location})) - -(defn reset-app [] - (set! (.-location js/document) "/")) - -(defn goto-register [hash] - (dommy/set-html! (dommy/sel1 :#location) "/users/register") - (render-menu) - (render-users-register hash)) diff --git a/lisp/webapps/woodriverlessons/conf/.gitignore b/lisp/webapps/woodriverlessons/conf/.gitignore deleted file mode 100644 index 14fa7a6..0000000 --- a/lisp/webapps/woodriverlessons/conf/.gitignore +++ /dev/null @@ -1 +0,0 @@ -options.lisp diff --git a/lisp/webapps/woodriverlessons/conf/options.lisp.example b/lisp/webapps/woodriverlessons/conf/options.lisp.example deleted file mode 100644 index d2afe8e..0000000 --- a/lisp/webapps/woodriverlessons/conf/options.lisp.example +++ /dev/null @@ -1,13 +0,0 @@ -(:name "woodriverlessons" - :url "woodriverlessons.org" - :document-root "woodriverlessons" - :title "Wood River Orchestra" - :meta-description "A website for the members of the Wood River Orchestra written in Common Lisp/Hunchentoot and ClojureScript." - :databases (:db-woodriverlessons ("127.0.0.1" "woodriverlessons" "woodriverlessons" "password")) - :mail-mx "mail.ckons.org" - :mail-from "postmaster@ckons.org" - :mail-postmaster "postmaster@ckons.org" - :mail-webmaster "webmaster@ckons.org" - :mail-info "info@ckons.org" - :mail-login-notify "me@ckons.org" - :mail-authentication ("me@ckons.org" "password")) diff --git a/lisp/webapps/woodriverlessons/site.lisp b/lisp/webapps/woodriverlessons/site.lisp deleted file mode 100644 index d47b2b6..0000000 --- a/lisp/webapps/woodriverlessons/site.lisp +++ /dev/null @@ -1,234 +0,0 @@ -;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10 -*- -(declaim (optimize (speed 0) (safety 3) (debug 3))) - -(in-package :woodriverlessons) - -(defmacro .base (&optional (onload-fn "goto_location('/home')")) - `(org-ckons-http::html5 - `(html - (head - ((meta :name "viewport" :content "width=device-width, initial-scale=1, shrink-to-fit=no")) - ((meta :charset "utf-8")) - ((title) ,(title *webapp*)) - ,@(mapcar (lambda (css) - `((link :rel "stylesheet" :href ,(getf css :href) :integrity ,(getf css :integrity) :crossorigin ,(getf css :crossorigin)))) - '((:href "https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.min.css" :integrity "sha384-xOolHFLEh07PJGoPkLv1IbcEPTNtaed2xpHsD9ESMhqIYd0nLMwNLD69Npy4HI+N" :crossorigin "anonymous") - (:href "/static/css/stylesheet.css" :crossorigin "anonymous"))) - ,@(mapcar (lambda (js) - `((script :type "text/javascript" :src ,(getf js :src) :integrity ,(getf js :integrity) :crossorigin ,(getf js :crossorigin)))) - '((:src "https://code.jquery.com/jquery-3.7.1.slim.min.js" :integrity "ha256-kmHvs0B+OpCW5GVHUNjv9rOmY0IvSIRcf7zGUDTDQM8=" :crossorigin "anonymous"))) - ((script :type "text/javascript" :src "/static/js/cljs/main.js"))) - ((body :onload ,(format nil "woodriverlessons.core.~a" ,onload-fn)) - ((div :class "container-fluid") - ((div :class "banner") - ((table :width "100%" :height "100%") - (tr - ((td :class "banner-title") "Wood River Lessons") - ((td :class "banner-menu") - ((div :id "menu-user")))))) - ((div :id "menu" :class "well")) - ((div :id "location" :style "display: none")) - ((div :id "errormsg")) - ((div :id "message")) - ((div :id "body")) - ((div :id "footer") - (hr) - "Carlos Konstanski    (970) 294-9708") - ,@(mapcar (lambda (js) - `((script :type "text/javascript" :src ,(getf js :src) :integrity ,(getf js :integrity) :crossorigin ,(getf js :crossorigin)))) - '((:src "https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/js/bootstrap.bundle.min.js" :integrity "sha384-Fy6S3B9q64WdZWQUiU+q4/2Lc9npb8tCaSX9FK7E8HnRr0Jz8D6OP9dO5Vg3Q9ct" :crossorigin "anonymous")))))))) - -(defmacro .location () - `(location-json location)) - -(defmacro .home-get () - `(home-json)) - -(defmacro .home-post () - `(home-json message errormsg)) - -(defmacro .menu () - `(menu-json)) - -(defmacro .menu-user () - `(menu-user-json)) - -(defmacro .login () - `(login-json)) - -(defmacro .login-authenticate () - `(login-authenticate-json username pwd)) - -(defmacro .login-forgot () - `(login-forgot-json)) - -(defmacro .logout () - `(logout-json)) - -(defmacro .profile () - `(profile-json)) - -(defmacro .profile-view () - `(profile-view-json)) - -(defmacro .profile-modify () - `(profile-modify-json)) - -(defmacro .profile-modify-submit () - `(profile-modify-submit-json id username first_name last_name email phone)) - -(defmacro .password () - `(password-json)) - -(defmacro .password-submit () - `(password-submit-json id pwd pwd2)) - -(defmacro .about-us () - `(about-us-json)) - -(defmacro .about-us-view () - `(about-us-view-json)) - -(defmacro .about-us-modify () - `(about-us-modify-json)) - -(defmacro .about-us-modify-submit () - `(about-us-modify-submit-json content)) - -(defmacro .gallery () - `(gallery-json)) - -(defmacro .gallery-view () - `(gallery-view-json)) - -(defmacro .gallery-add () - `(gallery-add-json)) - -(defmacro .gallery-add-submit () - `(gallery-add-submit-json description video_embed_url upload)) - -(defmacro .gallery-modify () - `(gallery-modify-json id)) - -(defmacro .gallery-modify-submit () - `(gallery-modify-submit-json id description video_embed_url upload)) - -(defmacro .gallery-delete () - `(gallery-delete-json id)) - -(defmacro .gallery-file-view () - `(gallery-file-view id)) - -(defmacro .testimonials () - `(testimonials-json)) - -(defmacro .testimonials-view () - `(testimonials-view-json)) - -(defmacro .testimonials-modify () - `(testimonials-modify-json)) - -(defmacro .testimonials-modify-submit () - `(testimonials-modify-submit-json content)) - -(defmacro .contact-us () - `(contact-us-json)) - -(defmacro .contact-us-view () - `(contact-us-view-json)) - -(defmacro .contact-us-email () - `(contact-us-email-json first_name last_name email phone comments)) - -(defmacro .messages () - `(messages-json)) - -(defmacro .messages-results () - `(messages-results-json read)) - -(defmacro .messages-mark () - `(messages-mark-json read id)) - -(defmacro .users () - `(users-json)) - -(defmacro .users-view () - `(users-view-json)) - -(defmacro .users-add () - `(users-add-json)) - -(defmacro .users-add-submit () - `(users-add-submit-json role_groups first_name last_name email)) - -(defmacro .users-register () - `(users-register-json hash)) - -(defmacro .users-register-form () - `(users-register-form-json hash)) - -(defmacro .users-register-submit () - `(users-register-submit-json hash username pwd pwd2 phone)) - -(defmacro .users-modify () - `(users-modify-json id)) - -(defmacro .users-modify-submit () - `(users-modify-submit-json id role_groups username first_name last_name email phone)) - -(defmacro .users-toggle-active () - `(users-toggle-active-json id)) - -(defmacro .users-delete () - `(users-delete-json id)) - -(define-endpoint :get "/" () .base) -(define-endpoint :post "/location" ((location :parameter-type 'string)) .location) -(define-endpoint :get "/home" () .home-get) -(define-endpoint :post "/home" ((message :parameter-type 'string) (errormsg :parameter-type 'string)) .home-post) -(define-endpoint :get "/menu" () .menu) -(define-endpoint :get "/menu/user" () .menu-user) -(define-endpoint :get "/login" () .login) -(define-endpoint :post "/login/authenticate" ((username :parameter-type 'string) (pwd :parameter-type 'string)) .login-authenticate) -(define-endpoint :get "/login/forgot" () .login-forgot) -(define-endpoint :get "/logout" () .logout) -(define-endpoint :get "/profile" () .profile) -(define-endpoint :get "/profile/view" () .profile-view) -(define-endpoint :post "/profile/modify" () .profile-modify) -(define-endpoint :post "/profile/modify/submit" ((id :parameter-type 'integer) (username :parameter-type 'string) (first_name :parameter-type 'string) (last_name :parameter-type 'string) (email :parameter-type 'string) (phone :parameter-type 'string)) .profile-modify-submit) -(define-endpoint :get "/password" () .password) -(define-endpoint :post "/password/submit" ((id :parameter-type 'integer) (pwd :parameter-type 'string) (pwd2 :parameter-type 'string)) .password-submit) -(define-endpoint :get "/about-us" () .about-us) -(define-endpoint :get "/about-us/view" () .about-us-view) -(define-endpoint :post "/about-us/modify" () .about-us-modify) -(define-endpoint :post "/about-us/modify/submit" ((content :parameter-type 'string)) .about-us-modify-submit) -(define-endpoint :get "/gallery" () .gallery) -(define-endpoint :get "/gallery/view" () .gallery-view) -(define-endpoint :post "/gallery/add" () .gallery-add) -(define-endpoint :post "/gallery/add/submit" ((description :parameter-type 'string) (video_embed_url :parameter-type 'string) (upload :parameter-type 'string)) .gallery-add-submit) -(define-endpoint :post "/gallery/modify" ((id :parameter-type 'integer)) .gallery-modify) -(define-endpoint :post "/gallery/modify/submit" ((id :parameter-type 'integer) (description :parameter-type 'string) (video_embed_url :parameter-type 'string) (upload :parameter-type 'string)) .gallery-modify-submit) -(define-endpoint :post "/gallery/delete" ((id :parameter-type 'integer)) .gallery-delete) -(define-endpoint :get "/gallery/file/view" ((id :parameter-type 'integer)) .gallery-file-view) -(define-endpoint :get "/testimonials" () .testimonials) -(define-endpoint :get "/testimonials/view" () .testimonials-view) -(define-endpoint :post "/testimonials/modify" () .testimonials-modify) -(define-endpoint :post "/testimonials/modify/submit" ((content :parameter-type 'string)) .testimonials-modify-submit) -(define-endpoint :get "/contact-us" () .contact-us) -(define-endpoint :get "/contact-us/view" () .contact-us-view) -(define-endpoint :post "/contact-us/email" ((first_name :parameter-type 'string) (last_name :parameter-type 'string) (email :parameter-type 'string) (phone :parameter-type 'string) (comments :parameter-type 'string)) .contact-us-email) -(define-endpoint :get "/messages" () .messages) -(define-endpoint :post "/messages/results" ((read :parameter-type 'string)) .messages-results) -(define-endpoint :post "/messages/mark" ((read :parameter-type 'string) (id :parameter-type 'integer)) .messages-mark) -(define-endpoint :get "/users" () .users) -(define-endpoint :get "/users/view" () .users-view) -(define-endpoint :post "/users/add" () .users-add) -(define-endpoint :post "/users/add/submit" ((role_groups :parameter-type 'string) (first_name :parameter-type 'string) (last_name :parameter-type 'string) (email :parameter-type 'string)) .users-add-submit) -(define-endpoint :get "/register" ((hash :parameter-type 'string)) .base (format nil "goto_register('~a') " hash)) -(define-endpoint :post "/users/register" ((hash :parameter-type 'string)) .users-register) -(define-endpoint :post "/users/register/form" ((hash :parameter-type 'string)) .users-register-form) -(define-endpoint :post "/users/register/submit" ((hash :parameter-type 'string) (username :parameter-type 'string) (pwd :parameter-type 'string) (pwd2 :parameter-type 'string) (phone :parameter-type 'string)) .users-register-submit) -(define-endpoint :post "/users/modify" ((id :parameter-type 'integer)) .users-modify) -(define-endpoint :post "/users/modify/submit" ((id :parameter-type 'integer) (role_groups :parameter-type 'string) (username :parameter-type 'string) (first_name :parameter-type 'string) (last_name :parameter-type 'string) (email :parameter-type 'string) (phone :parameter-type 'string)) .users-modify-submit) -(define-endpoint :post "/users/toggle-active" ((id :parameter-type 'integer)) .users-toggle-active) -(define-endpoint :post "/users/delete" ((id :parameter-type 'integer)) .users-delete) diff --git a/lisp/webapps/woodriverlessons/static/css/stylesheet.css b/lisp/webapps/woodriverlessons/static/css/stylesheet.css deleted file mode 100644 index efb4c07..0000000 --- a/lisp/webapps/woodriverlessons/static/css/stylesheet.css +++ /dev/null @@ -1,80 +0,0 @@ -body { - background-color: #161012; - color: white; -} - -p { - font-size: 14px; -} - -hr { - border: 1px #ffd081 solid; - width: 200px; -} - -.container-fluid { - width: 100%; - margin: 20px auto; -} - -.table { - color: white; -} - -.nav-link { - color: white; - cursor: pointer; - cursor: hand; -} - -.well { - background-color: #2c180d; - border: 1px black solid; - text-align: center; -} - -.banner { - height: 90px; - background-image: url("/static/images/violin-strip.jpg"); - background-repeat: repeat; - background-position: left; -} - -.banner-title { - width: *; - color: #59200e; - font-size: 28px; - font-style: italic; - font-weight: bold; - text-align: center; -} - -.banner-menu { - width: 150px; - text-align: right; - vertical-align: top; -} - -.form-control { - width: 600px; - background-color: #ffd081; -} - -.contact-info { - color: #59200e; - font-size: 15px; - font-weight: bold; - line-height: 0.4; -} - -.modal-content { - background-color: #161012; -} - -#body { - min-height: 500px; -} - -#footer { - text-align: center; -} diff --git a/lisp/webapps/woodriverlessons/static/images/add.png b/lisp/webapps/woodriverlessons/static/images/add.png deleted file mode 100644 index 1055df8..0000000 Binary files a/lisp/webapps/woodriverlessons/static/images/add.png and /dev/null differ diff --git a/lisp/webapps/woodriverlessons/static/images/classical-bow.jpg b/lisp/webapps/woodriverlessons/static/images/classical-bow.jpg deleted file mode 100644 index fce1392..0000000 Binary files a/lisp/webapps/woodriverlessons/static/images/classical-bow.jpg and /dev/null differ diff --git a/lisp/webapps/woodriverlessons/static/images/delete.png b/lisp/webapps/woodriverlessons/static/images/delete.png deleted file mode 100644 index ec140b7..0000000 Binary files a/lisp/webapps/woodriverlessons/static/images/delete.png and /dev/null differ diff --git a/lisp/webapps/woodriverlessons/static/images/document-open.png b/lisp/webapps/woodriverlessons/static/images/document-open.png deleted file mode 100644 index 20b7ca8..0000000 Binary files a/lisp/webapps/woodriverlessons/static/images/document-open.png and /dev/null differ diff --git a/lisp/webapps/woodriverlessons/static/images/down.png b/lisp/webapps/woodriverlessons/static/images/down.png deleted file mode 100644 index e2d15bf..0000000 Binary files a/lisp/webapps/woodriverlessons/static/images/down.png and /dev/null differ diff --git a/lisp/webapps/woodriverlessons/static/images/download.png b/lisp/webapps/woodriverlessons/static/images/download.png deleted file mode 100644 index 3973b3c..0000000 Binary files a/lisp/webapps/woodriverlessons/static/images/download.png and /dev/null differ diff --git a/lisp/webapps/woodriverlessons/static/images/edit-redo.png b/lisp/webapps/woodriverlessons/static/images/edit-redo.png deleted file mode 100644 index 3d4db6c..0000000 Binary files a/lisp/webapps/woodriverlessons/static/images/edit-redo.png and /dev/null differ diff --git a/lisp/webapps/woodriverlessons/static/images/edit-undo.png b/lisp/webapps/woodriverlessons/static/images/edit-undo.png deleted file mode 100644 index 367fc5a..0000000 Binary files a/lisp/webapps/woodriverlessons/static/images/edit-undo.png and /dev/null differ diff --git a/lisp/webapps/woodriverlessons/static/images/edit.png b/lisp/webapps/woodriverlessons/static/images/edit.png deleted file mode 100644 index 550dacd..0000000 Binary files a/lisp/webapps/woodriverlessons/static/images/edit.png and /dev/null differ diff --git a/lisp/webapps/woodriverlessons/static/images/emblem-favorite.png b/lisp/webapps/woodriverlessons/static/images/emblem-favorite.png deleted file mode 100644 index 6535d5d..0000000 Binary files a/lisp/webapps/woodriverlessons/static/images/emblem-favorite.png and /dev/null differ diff --git a/lisp/webapps/woodriverlessons/static/images/emblem-nowrite.png b/lisp/webapps/woodriverlessons/static/images/emblem-nowrite.png deleted file mode 100644 index 997fedf..0000000 Binary files a/lisp/webapps/woodriverlessons/static/images/emblem-nowrite.png and /dev/null differ diff --git a/lisp/webapps/woodriverlessons/static/images/instrument-cabinet.jpg b/lisp/webapps/woodriverlessons/static/images/instrument-cabinet.jpg deleted file mode 100644 index a683c45..0000000 Binary files a/lisp/webapps/woodriverlessons/static/images/instrument-cabinet.jpg and /dev/null differ diff --git a/lisp/webapps/woodriverlessons/static/images/no.png b/lisp/webapps/woodriverlessons/static/images/no.png deleted file mode 100644 index 1dc1b7c..0000000 Binary files a/lisp/webapps/woodriverlessons/static/images/no.png and /dev/null differ diff --git a/lisp/webapps/woodriverlessons/static/images/sort-alpha.png b/lisp/webapps/woodriverlessons/static/images/sort-alpha.png deleted file mode 100644 index 0e4a831..0000000 Binary files a/lisp/webapps/woodriverlessons/static/images/sort-alpha.png and /dev/null differ diff --git a/lisp/webapps/woodriverlessons/static/images/up.png b/lisp/webapps/woodriverlessons/static/images/up.png deleted file mode 100644 index 55bab86..0000000 Binary files a/lisp/webapps/woodriverlessons/static/images/up.png and /dev/null differ diff --git a/lisp/webapps/woodriverlessons/static/images/violin-strip.jpg b/lisp/webapps/woodriverlessons/static/images/violin-strip.jpg deleted file mode 100644 index 6149a87..0000000 Binary files a/lisp/webapps/woodriverlessons/static/images/violin-strip.jpg and /dev/null differ diff --git a/lisp/webapps/woodriverlessons/static/images/yes.png b/lisp/webapps/woodriverlessons/static/images/yes.png deleted file mode 100644 index b9cadf5..0000000 Binary files a/lisp/webapps/woodriverlessons/static/images/yes.png and /dev/null differ diff --git a/lisp/webapps/woodriverlessons/static/js/cljs b/lisp/webapps/woodriverlessons/static/js/cljs deleted file mode 120000 index 88f0c64..0000000 --- a/lisp/webapps/woodriverlessons/static/js/cljs +++ /dev/null @@ -1 +0,0 @@ -../../clojurescript/woodriverlessons/resources/public/cljs \ No newline at end of file -- cgit v1.3