# HG changeset patch # User Pascal Bellard # Date 1302779674 -7200 # Node ID b5df231d1010fe4dc724c6eea26f096568f97f09 # Parent 67f880abcf5e1bb679531d66500d4f4f8532f179 index.cgi: add edit button diff -r 67f880abcf5e -r b5df231d1010 index.cgi --- a/index.cgi Thu Apr 14 04:32:43 2011 +0200 +++ b/index.cgi Thu Apr 14 13:14:34 2011 +0200 @@ -39,17 +39,40 @@ xhtml_header file="$(GET file)" echo "

$file

" - echo '
'
-		# Handle file type by extension as a Web Server does it.
-		case "$file" in
-			*.conf|*.lst)
-				syntax_highlighter conf ;;
-			*.sh|*.cgi)
-				syntax_highlighter sh ;;
-			*)
-				cat ;;
-		esac < $file
-		echo '
' ;; + if [ "$(GET action)" == "edit" ]; then + cat < + + + + +EOT + else + [ -n "$(POST content)" ] && + sed "s/`echo -en '\r'` /\n/g" > $file < + + `gettext "Edit"` + + +
+EOT
+			# Handle file type by extension as a Web Server does it.
+			case "$file" in
+				*.conf|*.lst)
+					syntax_highlighter conf ;;
+				*.sh|*.cgi)
+					syntax_highlighter sh ;;
+				*)
+					cat ;;
+			esac < $file
+			echo '
' + fi ;; *\ debug\ *) TITLE="- Debug" xhtml_header