gfse: somewhat simplified configuration/installation

This commit is contained in:
hallgren
2011-03-28 15:04:43 +00:00
parent 06a29cb573
commit d1b95cef99
3 changed files with 34 additions and 11 deletions

View File

@@ -4,7 +4,7 @@ h1,h2,h3,h4,small { font-family: sans-serif; }
h1:first-child, h2:first-child { margin-top: 0; margin-bottom: 1ex; } h1:first-child, h2:first-child { margin-top: 0; margin-bottom: 1ex; }
#editor { max-width: 50em; } #editor { max-width: 50em; }
div.grammar { border: 1px solid black; background: white; background: #9df; } div.grammar { border: 1px solid black; background: #9df; }
div.files { margin: 0 8px 8px 8px; } div.files { margin: 0 8px 8px 8px; }
div#file { border: 2px solid #009; border-top-width: 0; } div#file { border: 2px solid #009; border-top-width: 0; }

View File

@@ -0,0 +1,19 @@
#!/bin/bash
echo "Content-Type: text/javascript"
echo ""
case "$QUERY_STRING" in
jsonp=*) prefix="${QUERY_STRING#jsonp=}("; suffix=")" ;;
*) prefix=""; suffix=""
esac
echo -n "$prefix"
sep="["
for g in *.pgf ; do
echo -n "$sep\"$g\""
sep=", "
done
echo "]$suffix"
#echo "/*"
#set
#echo "*/"

View File

@@ -6,15 +6,16 @@ charset="UTF-8"
AUTOHEADER=no AUTOHEADER=no
. $bin/cgistart.sh . $bin/cgistart.sh
PATH=$PATH:/Users/hallgren/.cabal/bin
export LC_CTYPE="UTF-8" export LC_CTYPE="UTF-8"
style_url="editor.css" style_url="editor.css"
tmp="$documentRoot/tmp"
make_dir() { make_dir() {
dir="$(mktemp -d "$tmp/gfse.XXXXXXXX")" dir="$(mktemp -d "$tmp/gfse.XXXXXXXX")"
# chmod a+rxw "$dir" # chmod a+rxw "$dir"
chmod a+rx "$dir" chmod a+rx "$dir"
ln "$grammars/grammars.cgi" "$dir" cp "grammars.cgi" "$dir"
} }
@@ -31,9 +32,9 @@ check_grammar() {
end end
h3 OK h3 OK
begin dl begin dl
[ -z "$minibar" ] || { dt; echo "▸"; link "$minibar?/tmp/${dir##*/}/" "Minibar"; } [ -z "$minibar_url" ] || { dt; echo "▸"; link "$minibar_url?/tmp/${dir##*/}/" "Minibar"; }
[ -z "$transquiz" ] || { dt; echo "▸"; link "$transquiz?/tmp/${dir##*/}/" "Translation Quiz"; } [ -z "$transquiz_url" ] || { dt; echo "▸"; link "$transquiz_url?/tmp/${dir##*/}/" "Translation Quiz"; }
[ -z "$gfshell" ] || { dt; echo "▸"; link "$gfshell?dir=${dir##*/}" "GF Shell"; } [ -z "$gfshell_url" ] || { dt; echo "▸"; link "$gfshell_url?dir=${dir##*/}" "GF Shell"; }
dt ; echo "◂"; link "javascript:history.back()" "Back to Editor" dt ; echo "◂"; link "javascript:history.back()" "Back to Editor"
end end
@@ -55,12 +56,15 @@ check_grammar() {
endall endall
} }
if [ -z "$tmp" ] || [ -z "$grammars" ] || if [ -z "$tmp" ] || ! [ -d "$tmp" ] ; then
! [ -d "$tmp" ] || ! [ -d "$grammars" ] ; then
pagestart "Error" pagestart "Error"
echo "upload.cgi is not properly configured" begin pre
echo "upload.cgi is not properly configured:"
# cgiconfig.sh must define tmp and grammars. if [ -z "$tmp" ] ; then
echo "cgiconfig.sh must define tmp"
elif [ ! -d "$tmp" ] || [ ! -w "$tmp" ] ; then
echo "$tmp must be a writeable directory"
fi
# cgiconfig.sh should define minibar & gfshell to allow grammars to be tested. # cgiconfig.sh should define minibar & gfshell to allow grammars to be tested.
endall endall
else else