Browse Source

add storage, pages and archive entries to dashboard.html template.

The route in web.lisp calls the recently created 'get latest'
functions in the nera package. The code is web should be fine but the
dashboard.html stuff is buggy and so is the back-end routes for
uploading deleting file in the /storage section of the website. This
is an end-of-session commit, though, so the bugs will have to be fixed
at a later time.
stable
Craig Oates 2 years ago
parent
commit
4647323fda
  1. 29
      src/web.lisp

29
src/web.lisp

@ -183,6 +183,11 @@
(render #P"user/dashboard.html"
(append (auth:auth-user-data)
`(:alert ,alert
:storage-files
,(nera:latest-storage-editted-files 10 t)
:pages ,(nera:latest-editted-pages 10 t)
:archive-entries
,(nera::latest-archive-editted-entries 10 t)
:system-data ,(nera:system-data)))))
;; Not Authorised
(progn (utils:set-alert "You are not logged in.")
@ -865,31 +870,13 @@
(t (hermetic:auth
(:administrator)
;; Authorised
(cond ((and (null (storage:file-exists-p "" "media" slug))
(null (nera:get-storage-file :slug slug)))
(cond ((null (nera:get-storage-file :slug slug))
(utils:set-alert "Unable to find file. Nothing deleted.")
(redirect "/storage/manage"))
((and (not (null (storage:file-exists-p "" "media" slug)))
(null (nera:get-storage-file :slug slug)))
(utils:set-alert "Unable to find entry in database. Deleted file from system.")
(storage:remove-file "" "media" slug)
;; Delete thumbnail if there is one (for image files only)
(when (storage:file-exists-p
"" "media" (format nil "thumbnail-~a" slug))
(storage:remove-file
"" "media" (format nil "thumbnail-~a" slug)))
(redirect "/storage/manage"))
((and (null (storage:file-exists-p "" "media" slug))
(not (null (nera:get-storage-file :slug slug))))
(utils:set-alert "Unable to find file. Deleted entry from database.")
(nera:delete-storage-file :slug slug)
(redirect "/storage/manage"))
(t (storage:remove-file
"" ; `USERNAME' blank because it's not used/needed.
"media" slug)
"" "media"
(files::name-of (nera:get-storage-file :slug slug)))
(when (storage:file-exists-p
"" "media" (format nil "thumbnail-~a" slug))
(storage:remove-file

Loading…
Cancel
Save