#!/bin/sh
+l10n_immutablepage >/dev/null \
+|| l10n_immutablepage(){ #TRANSLATION
+ cat <<-EOF
+ <h1>Immutable Page</h1>
+ This is a core page of the wiki system. Its name and position cannot be changed.
+ You may however update this page and you can use ACLs to hide it from various listings.
+ EOF
+}
+
case "${PATH_INFO}" in
*/\[move\]|*/\[rename\]|*/\[delete\])
page="${PATH_INFO%\[*\]}"
theme_page - <<-EOF
<article>
<p class=error>
- <h1>Immutable Page</h1>
- This is a core page of the wiki system. Its name and position cannot be changed.
- You may however update this page and you can use ACLs to hide it from various listings.
+ $(l10n_immutablepage)
</p>
</article>
EOF
*) return 1;;
esac
-if [ "$REQUEST_METHOD" = POST ]; then
- action="$(POST action)"
- newname="$(POST newname |grep -m1 -xE '[^#/]*')"
- newlocation="$(POST newlocation |grep -m1 -xE '/[^#]*')"
-else case "${PATH_INFO}" in
- */\[move\])
- location="${page%/}" location="${location%/*}/"
- theme_page - <<-EOF
- <form method=POST id=movepage>
- <input type=hidden name=session_id value="$SESSION_KEY">
+l10n_movepage >/dev/null \
+|| l10n_movepage(){ # TRANSLATION
+ cat <<-EOF
<h1>Move Page</h1>
<p class="pageid">$(HTML "${page}")</p>
<input name="newlocation" value="$(HTML "$location")" placeholder="New Location">
</ul>
<button type=submit name=action value=move>Move</button>
<button type=submit name=action value=cancel>Cancel</button>
- </form>
EOF
- return 0
- ;;
- */\[rename\])
- name="${page%/}" name="${name##*/}"
- theme_page - <<-EOF
- <form method=POST id=renamepage>
- <input type=hidden name=session_id value="$SESSION_KEY">
+}
+l10n_renamepage >/dev/null \
+|| l10n_renamepage(){ # TRANSLATION
+ cat <<-EOF
<h1>Rename Page</h1>
<p class="pageid">$(HTML "${page}")</p>
<input name="newname" value="$(HTML "$name")" placeholder="New Name">
</ul>
<button type=submit name=action value=rename>Rename</button>
<button type=submit name=action value=cancel>Cancel</button>
- </form>
EOF
- return 0
- ;;
- */\[delete\])
- theme_page - <<-EOF
- <form method=POST id=deletepage>
- <input type=hidden name=session_id value="$SESSION_KEY">
+}
+l10n_deletepage >/dev/null \
+|| l10n_deletepage(){ # TRANSLATION
+ cat <<-EOF
<h1>Delete Page</h1>
<p class="pageid">$(HTML "${page}")</p>
<p>This page and its attachments will be deleted</p>
</ul>
<button type=submit name=action value=delete>Delete</button>
<button type=submit name=action value=cancel>Cancel</button>
+ EOF
+}
+
+if [ "$REQUEST_METHOD" = POST ]; then
+ action="$(POST action)"
+ newname="$(POST newname |grep -m1 -xE '[^#/]*')"
+ newlocation="$(POST newlocation |grep -m1 -xE '/[^#]*')"
+else case "${PATH_INFO}" in
+ */\[move\])
+ location="${page%/}" location="${location%/*}/"
+ theme_page - <<-EOF
+ <form method=POST id=movepage>
+ <input type=hidden name=session_id value="$SESSION_KEY">
+ $(l10n_movepage)
+ </form>
+ EOF
+ return 0
+ ;;
+ */\[rename\])
+ name="${page%/}" name="${name##*/}"
+ theme_page - <<-EOF
+ <form method=POST id=renamepage>
+ <input type=hidden name=session_id value="$SESSION_KEY">
+ $(l10n_renamepage)
+ </form>
+ EOF
+ return 0
+ ;;
+ */\[delete\])
+ theme_page - <<-EOF
+ <form method=POST id=deletepage>
+ <input type=hidden name=session_id value="$SESSION_KEY">
+ $(l10n_deletepage)
</form>
EOF
return 0