summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhallgren <hallgren@chalmers.se>2011-03-28 15:04:43 +0000
committerhallgren <hallgren@chalmers.se>2011-03-28 15:04:43 +0000
commitd1b95cef99c0c7d699987d090fd203e138b18223 (patch)
treecd838b05bcf2de348516fdec49e8b9f8395d35ff
parent06a29cb5733b5523d6102eabe9578460d64d32d1 (diff)
gfse: somewhat simplified configuration/installation
-rw-r--r--src/editor/simple/editor.css2
-rw-r--r--src/editor/simple/grammars.cgi19
-rw-r--r--src/editor/simple/upload.cgi24
3 files changed, 34 insertions, 11 deletions
diff --git a/src/editor/simple/editor.css b/src/editor/simple/editor.css
index a1f48d32c..7bce43c3f 100644
--- a/src/editor/simple/editor.css
+++ b/src/editor/simple/editor.css
@@ -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; }
#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#file { border: 2px solid #009; border-top-width: 0; }
diff --git a/src/editor/simple/grammars.cgi b/src/editor/simple/grammars.cgi
new file mode 100644
index 000000000..9f1aa22a6
--- /dev/null
+++ b/src/editor/simple/grammars.cgi
@@ -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 "*/"
diff --git a/src/editor/simple/upload.cgi b/src/editor/simple/upload.cgi
index b9fcc8d3a..9ef113ebf 100644
--- a/src/editor/simple/upload.cgi
+++ b/src/editor/simple/upload.cgi
@@ -6,15 +6,16 @@ charset="UTF-8"
AUTOHEADER=no
. $bin/cgistart.sh
-PATH=$PATH:/Users/hallgren/.cabal/bin
export LC_CTYPE="UTF-8"
style_url="editor.css"
+tmp="$documentRoot/tmp"
+
make_dir() {
dir="$(mktemp -d "$tmp/gfse.XXXXXXXX")"
# chmod a+rxw "$dir"
chmod a+rx "$dir"
- ln "$grammars/grammars.cgi" "$dir"
+ cp "grammars.cgi" "$dir"
}
@@ -31,9 +32,9 @@ check_grammar() {
end
h3 OK
begin dl
- [ -z "$minibar" ] || { dt; echo "▸"; link "$minibar?/tmp/${dir##*/}/" "Minibar"; }
- [ -z "$transquiz" ] || { dt; echo "▸"; link "$transquiz?/tmp/${dir##*/}/" "Translation Quiz"; }
- [ -z "$gfshell" ] || { dt; echo "▸"; link "$gfshell?dir=${dir##*/}" "GF Shell"; }
+ [ -z "$minibar_url" ] || { dt; echo "▸"; link "$minibar_url?/tmp/${dir##*/}/" "Minibar"; }
+ [ -z "$transquiz_url" ] || { dt; echo "▸"; link "$transquiz_url?/tmp/${dir##*/}/" "Translation Quiz"; }
+ [ -z "$gfshell_url" ] || { dt; echo "▸"; link "$gfshell_url?dir=${dir##*/}" "GF Shell"; }
dt ; echo "◂"; link "javascript:history.back()" "Back to Editor"
end
@@ -55,12 +56,15 @@ check_grammar() {
endall
}
-if [ -z "$tmp" ] || [ -z "$grammars" ] ||
- ! [ -d "$tmp" ] || ! [ -d "$grammars" ] ; then
+if [ -z "$tmp" ] || ! [ -d "$tmp" ] ; then
pagestart "Error"
- echo "upload.cgi is not properly configured"
-
- # cgiconfig.sh must define tmp and grammars.
+ begin pre
+ echo "upload.cgi is not properly configured:"
+ 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.
endall
else