]> git.plutz.net Git - shellwiki/commitdiff
handler addresses allowing easyier relative link navigation
authorPaul Hänsch <paul@plutz.net>
Mon, 23 May 2022 09:34:57 +0000 (11:34 +0200)
committerPaul Hänsch <paul@plutz.net>
Mon, 23 May 2022 09:34:57 +0000 (11:34 +0200)
handlers/20_attachment.sh
handlers/20_revision.sh
themes/default.css

index 983cc7ee043e38bc87db4898d63be355a7e036e2..efc66f1b77f714fa4ed6afcfc25030c2e87b8258 100755 (executable)
@@ -66,10 +66,13 @@ attachment_convert(){
 
 case ${PATH_INFO} in
   */\[attachment\]/)
+    REDIRECT "${_BASE}${PATH_INFO%/}"
+    ;;
+  */\[attachment\])
     tsid="$(POST session_key)"; tsid="${tsid%% *}"
     attachment_delete="$(POST delete)"
 
-    if [ "${CONTENT_TYPE%%;*}" = "multipart/form-data" ] && acl_write "${PATH_INFO%\[attachment\]/}"; then
+    if [ "${CONTENT_TYPE%%;*}" = "multipart/form-data" ] && acl_write "${PATH_INFO%\[attachment\]}"; then
       . "$_EXEC/multipart.sh"
       multipart_cache
 
@@ -84,10 +87,10 @@ case ${PATH_INFO} in
         return 0
       fi
 
-      mkdir -p "$_DATA/pages/${PATH_INFO%/\[attachment\]/}/#attachments/"
+      mkdir -p "$_DATA/pages/${PATH_INFO%/\[attachment\]}/#attachments/"
       n=1; while filename=$(multipart_filename "file" "$n"); do
         filename="$(printf %s "$filename" |tr /\\0 __)"
-        multipart "file" "$n" >"$_DATA/pages/${PATH_INFO%/\[attachment\]/}/#attachments/$filename"
+        multipart "file" "$n" >"$_DATA/pages/${PATH_INFO%/\[attachment\]}/#attachments/$filename"
         n=$((n + 1))
       done
       rm -- "$multipart_cachefile"
@@ -98,14 +101,14 @@ case ${PATH_INFO} in
       head -c $((CONTENT_LENGTH)) >/dev/null
       return 0
     elif [ "$attachment_delete" -a "$SESSION_ID" = "$tsid" ]; then
-      rm -- "$_DATA/pages/${PATH_INFO%/\[attachment\]/}/#attachments/$attachment_delete"
+      rm -- "$_DATA/pages/${PATH_INFO%/\[attachment\]}/#attachments/$attachment_delete"
       REDIRECT "${_BASE}${PATH_INFO}"
     elif [ "$attachment_delete" ]; then
       printf 'Refresh: %i\r\n' 4
       theme_error 403
       return 0
-    elif acl_read "${PATH_INFO%\[attachment\]/}"; then
-      theme_attachments "${PATH_INFO%\[attachment\]/}"
+    elif acl_read "${PATH_INFO%\[attachment\]}"; then
+      theme_attachments "${PATH_INFO%\[attachment\]}"
       return 0
     else
       theme_error 404
index a9c5d3975e75097502d1fe48c1c7e6a0a0dfed19..b34b2b9681378aae5fc0e7d67c29b63b5063a9ab 100644 (file)
@@ -1,11 +1,14 @@
 #!/bin/sh
 
 case "${PATH_INFO}" in
-  */\[revision\]|*/\[revision\]/)
-    if ! acl_read "${PATH_INFO%\[revision\]?}"; then
+  */\[revision\]/)
+    REDIRECT "${_BASE}/${PATH_INFO%/}"
+    ;;
+  */\[revision\])
+    if ! acl_read "${PATH_INFO%\[revision\]}"; then
       theme_error 403
     else
-      theme_revisions "${PATH_INFO%\[revision\]?}"
+      theme_revisions "${PATH_INFO%\[revision\]}"
     fi
     return 0
     ;;
index 9b8cc75c95c774af9833b958f9d687303ff9413b..c22da7cf474bf2bfba8d8d7726ffc81ca650d88a 100644 (file)
@@ -52,18 +52,20 @@ main .pagemenu li {
 main .pagemenu li a { color: #FFF; }
 
 main article,
-[id$="/[attachment]/"] main form.upload {
+[id$="/[attachment]"] main form.upload {
   margin: 1em;
   padding: .125em 1em 1em 1em;
   box-shadow: .25em .25em .75em;
   background-color: #FFF;
 }
 
-[id$="/[attachment]/"] main .attachment.list {
+[id$="/[revision]"] main .revisions,
+[id$="/[attachment]"] main .attachment.list {
   margin: 1em;
   padding: 1em 2em;
 }
-[id$="/[attachment]/"] main .attachment.list:before {
+[id$="/[revision]"] main .revisions:before,
+[id$="/[attachment]"] main .attachment.list:before {
   content: '';
   position: absolute;
   top: 0; bottom: 0; left: 0; right: 0;
@@ -74,7 +76,7 @@ main article,
 
 /* === Editor === */
 
-body.editor textarea {
+body[id$="/[edit]"] textarea {
   width: 100%;
   min-height: 20em; min-height: 70vh;
   font-family: monospace;
@@ -102,6 +104,11 @@ body.editor textarea {
   margin-right: 1em;
 }
 
+.revisions li { margin: 1em 0; }
+.revisions li span.hash,
+.revisions li span.date {
+  margin-right: 1em;
+}
 
 /* === Macros === */