summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorckonstanski <kostcarl@isu.edu>2026-08-20 10:05:39 -0600
committerckonstanski <kostcarl@isu.edu>2026-08-20 10:05:39 -0600
commit40dba201fdfba8c69e8dc30206468aee8082df2a (patch)
tree85e1b5d5d27f8cc5c314845c93adea0cec823bc2 /lisp
parent26a106b0d9687be8448e37658887c8bc2937804e (diff)
stuff
Diffstat (limited to 'lisp')
-rw-r--r--lisp/service/users-service.lisp80
-rw-r--r--lisp/webapps/resume/clojurescript/resume/src/resume/core.clj9
2 files changed, 38 insertions, 51 deletions
diff --git a/lisp/service/users-service.lisp b/lisp/service/users-service.lisp
index 4143ad3..0461cbb 100644
--- a/lisp/service/users-service.lisp
+++ b/lisp/service/users-service.lisp
@@ -9,10 +9,6 @@
:accessor title))
(:documentation ""))
-(defun users-json ()
- (with-auth (instance users-service "users-view")
- (setf (title instance) "Users")))
-
(defclass users/view-service (users-service user)
((users :initarg :users
:initform nil
@@ -20,6 +16,36 @@
(location-p :initform nil))
(:documentation ""))
+(defclass users/modify-service (users/view-service)
+ ((form :initarg :form
+ :initform nil
+ :accessor form))
+ (:documentation ""))
+
+(defclass users/register-service (rest-service)
+ ((title :initarg :title
+ :initform nil
+ :accessor title)
+ (hash :initarg :hash
+ :initform nil
+ :accessor hash))
+ (:documentation ""))
+
+(defclass users/register/form-service (rest-service)
+ ((form :initarg :form
+ :initform nil
+ :accessor form)
+ (location-p :initform nil))
+ (:documentation ""))
+
+(defclass users/register/submit-service (rest-service)
+ ((location-p :initform nil))
+ (:documentation ""))
+
+(defun users-json ()
+ (with-auth (instance users-service "users-view")
+ (setf (title instance) "Users")))
+
(defun users-view-json ()
(with-auth (instance users/view-service "users-view")
(with-resume-database
@@ -29,12 +55,6 @@
(loop for user in (users instance)
do (sanitize-json user))))
-(defclass users/add-service (users/view-service)
- ((form :initarg :form
- :initform nil
- :accessor form))
- (:documentation ""))
-
(defun role-checkboxes (name role-groups &optional active-role-groups)
(remove-if 'null
(mapcar (lambda (role-group)
@@ -49,7 +69,7 @@
role-groups)))
(defun users-add-json ()
- (with-auth (instance users/add-service "users-modify")
+ (with-auth (instance users/modify-service "users-modify")
(setf (title instance) "Users - Add")
(with-resume-database
(let* ((auth-pkg (make-instance 'auth-pkg))
@@ -66,7 +86,7 @@
(defun users-add-submit-json (role_groups first_name last_name email)
(declare (special role_groups first_name last_name email))
- (with-auth (instance users/add-service "users-modify")
+ (with-auth (instance users/modify-service "users-modify")
(with-resume-database
(let ((registration (make-instance 'registration)))
(loop for param in (sb-introspect:function-lambda-list #'users-add-submit-json)
@@ -117,27 +137,11 @@
(error (e)
(setf (errormsg instance) (format nil "Error sending email to ~a. Registration failed. ~a" (email registration) e))))))))
-(defclass users/register-service (rest-service)
- ((title :initarg :title
- :initform nil
- :accessor title)
- (hash :initarg :hash
- :initform nil
- :accessor hash))
- (:documentation ""))
-
(defun users-register-json (hash)
(with-noauth (instance users/register-service)
(setf (title instance) "New User Registration")
(setf (hash instance) hash)))
-(defclass users/register/form-service (rest-service)
- ((form :initarg :form
- :initform nil
- :accessor form)
- (location-p :initform nil))
- (:documentation ""))
-
(defun users-register-form-json (hash)
(with-noauth (instance users/register/form-service)
(with-resume-database
@@ -157,10 +161,6 @@
(:label "Register" :field-type "button" :onclick "on_users_register_submit_clicked()"))))
(setf (errormsg instance) "Error: invalid registration."))))))
-(defclass users/register/submit-service (rest-service)
- ((location-p :initform nil))
- (:documentation ""))
-
(defun users-register-submit-json (hash username pwd pwd2 phone)
(with-noauth (instance users/register/submit-service)
(with-resume-database
@@ -192,10 +192,6 @@
(setf (errormsg instance) "Error: passwords do not match."))
(setf (errormsg instance) "Error while completing registration."))))))
-(defclass users/modify-service (users/add-service)
- ()
- (:documentation ""))
-
(defun users-modify-json (id)
(with-auth (instance users/modify-service "users-modify")
(setf (title instance) "Users - Modify")
@@ -242,12 +238,8 @@
(setf (message instance) "User saved successfully."))
(setf (errormsg instance) "An error occured."))))))
-(defclass users/toggle-service (users/add-service)
- ()
- (:documentation ""))
-
(defun users-toggle-active-json (id)
- (with-auth (instance users/toggle-service "users-modify")
+ (with-auth (instance users/modify-service "users-modify")
(with-resume-database
(let* ((auth-pkg (make-instance 'auth-pkg))
(user (get-user-by-id auth-pkg id)))
@@ -260,12 +252,8 @@
(setf (message instance) "User active state toggled successfully.")))
(setf (errormsg instance) "Error: could not toggle the active state of the user: not found."))))))
-(defclass users/delete-service (users/add-service)
- ()
- (:documentation ""))
-
(defun users-delete-json (id)
- (with-auth (instance users/delete-service "users-modify")
+ (with-auth (instance users/modify-service "users-modify")
(with-resume-database
(let* ((auth-pkg (make-instance 'auth-pkg))
(user (get-user-by-id auth-pkg id)))
diff --git a/lisp/webapps/resume/clojurescript/resume/src/resume/core.clj b/lisp/webapps/resume/clojurescript/resume/src/resume/core.clj
index 7d61812..829fa66 100644
--- a/lisp/webapps/resume/clojurescript/resume/src/resume/core.clj
+++ b/lisp/webapps/resume/clojurescript/resume/src/resume/core.clj
@@ -122,9 +122,7 @@
[:thead
[:tr
(for [key# (filter #(not (str/includes? % "_id")) keys#)]
- [:th {:id (str "th-" ~component "-" key#)
- :key (str "th-" ~component "-" key#)
- :scope "col"}
+ [:th {:scope "col"}
key#])
[:th {:scope "col"} "Mod"]
[:th {:scope "col"} "Del"]]]
@@ -132,10 +130,11 @@
(for [rec# results#]
(let [tr-attributes# (atom {:id (str "tr-" ~component "-" (get rec# "id"))
:key (str "tr-" ~component "-" (get rec# "id"))})
- td-attributes# (atom {:on-click #()})]
+ td-attributes# (atom {:on-click #(print "yourmom")})]
[:tr @tr-attributes#
(for [key# (filter #(not (str/includes? % "_id")) keys#)]
- [:td (str (get rec# key#))])
+ [:td @td-attributes#
+ (str (get rec# key#))])
[:td {:width "30"}
[:img {:src "/static/images/edit.png"
:on-click #(~(symbol (str "on-" component "-modify-clicked")) (get rec# "id"))}]]