]> git.plutz.net Git - busy/commitdiff
implemented cgi backend for admin page
authorpaul <paul@plutz.net>
Tue, 27 Mar 2012 01:42:28 +0000 (01:42 +0000)
committerpaul <paul@plutz.net>
Tue, 27 Mar 2012 01:42:28 +0000 (01:42 +0000)
svn path=/trunk/; revision=37

Admin.page
Settings.page [new file with mode: 0644]
project.meta
write/projectmeta.cgi [new file with mode: 0755]

index c3ec24eeeb790ff813371a4b824fc128b7fe5923..f7bacc2bb9b413810c972bee4d3abcb00c6166ec 100644 (file)
@@ -11,7 +11,7 @@ else
   echo "
   <div id='LEFT'></div>
   <div id='MAIN'>
-    <div class='section'><form method='post' accept-charset='utf-8' action='write/$($LOGIN && echo user_)projectadmin.cgi'>
+    <div class='section'><form method='post' accept-charset='utf-8' action='write/$($LOGIN && echo user_)projectmeta.cgi'>
       <h1>General</h1>
 
       <fieldset><legend>Title Display</legend>
@@ -36,6 +36,7 @@ else
        <div class='key'><input type='checkbox' name='usePaypal' value='yes' $(grep -q usePaypal=yes $metafile && echo checked)>Paypal Address</div>
           <div class='value'><input type='text' name='paypalAddress' value='$(sed -rn 's:^paypalAddress=(.*)$:\1:p' "$metafile")'></div><br>
       </fieldset>
+      <input type='submit'>
     </form></div>
 
   </div>
diff --git a/Settings.page b/Settings.page
new file mode 100644 (file)
index 0000000..f7df9c2
--- /dev/null
@@ -0,0 +1 @@
+#!/bin/zsh
index 533c9b44169d4fab8acf94321ed8a58d996fa110..b985f72f666d3a88b937e2901f2b41dd4805b79c 100644 (file)
@@ -2,5 +2,11 @@ name=Busy
 slogan=Letting You do the Work.
 repoType=svn
 svnRepo=http://svn.plutz.net/busy
+gitRepo=
 useFlattr=yes
 flattrThingURL=http://flattr.com/thing/599434/Busy-Software-Project-Management
+usePaypal=
+paypalAddress=
+useBitcoin=
+btcAddress=
+
diff --git a/write/projectmeta.cgi b/write/projectmeta.cgi
new file mode 100755 (executable)
index 0000000..7f95dfd
--- /dev/null
@@ -0,0 +1,49 @@
+#!/bin/zsh
+
+# Copyright 2012 Paul Hänsch
+# This file is part of Busy
+#
+# Busy is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Busy is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with Busy.  If not, see <http://www.gnu.org/licenses/>.
+
+metafile="../project.meta"
+
+[ "$HTTPS" = "on" ] && proto=https || proto=http
+. ../auth/permissions.sh
+$ACL_ADMIN || echo "Location: ${proto}://${HTTP_HOST}/?p=Error&i=noaccess\n\n"
+$ACL_ADMIN || exit 0 
+
+if [ -n "${CONTENT_LENGTH}" -a "${CONTENT_LENGTH}" -gt 0 ]; then
+(head -c "${CONTENT_LENGTH}"; echo)|sed 's/&/\n/g' \
+  |sed -rn '/^((appName|appSlogan|svnRepo|gitRepo|flattrThingURL|paypalAddress|btcAddress)=.*|repoType=(svn|git)|(useFlattr|usePaypal|useBitcoin)=yes)$/{
+            s:\+: :g;s:%:\\x:g;s:^([a-zA-Z0-9_+-]+)=(.*)$:\1='"'\2'"':;p}' \
+  |while line="$(line)"; do
+    eval "$(echo -e "$line" |tr -d '\n\r')"
+  done
+fi
+
+echo "\
+name=$appName
+slogan=$appSlogan
+repoType=$repoType
+svnRepo=$svnRepo
+gitRepo=$gitRepo
+useFlattr=$useFlattr
+flattrThingURL=$flattrThingURL
+usePaypal=$usePaypal
+paypalAddress=$paypalAddress
+useBitcoin=$useBitcoin
+btcAddress=$btcAddress
+" >"$metafile"
+
+echo -n "Location: ${proto}://${HTTP_HOST}/?p=Admin\n\n"