]> git.plutz.net Git - busy/blobdiff - templates/frame.html.sh
porting busy to confetti framework
[busy] / templates / frame.html.sh
diff --git a/templates/frame.html.sh b/templates/frame.html.sh
new file mode 100755 (executable)
index 0000000..9695122
--- /dev/null
@@ -0,0 +1,115 @@
+# Copyright 2011 - 2014 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/>. 
+
+list_accounts(){
+  btcAddress="$(sed -rn 's:^btcAddress=(.*)$:\1:p' project.meta)"
+  flattrThingURL=$(sed -rn 's:^flattrThingURL=(.*)$:\1:p' project.meta)
+
+  grep -q 'useBitcoin=yes' project.meta \
+  && [ \! -f "QRcodes/bitcoin:${btcAddress}.png" ] \
+  && qrencode -o "QRcodes/bitcoin:${btcAddress}.png" "bitcoin:${btcAddress}"
+  grep -q 'useBitcoin=yes' project.meta \
+  && cat <<PageEND
+  <a href="#" onclick="javascript:show_screen('btcqr')"><img src="http://bitcoin.it/img/bc_logo_135.png" height="60"></a>
+  <div id="btcqr" style="display:none;">
+    <a href="#" onclick="javascript:hide_screen('btcqr')">close</a><br>
+    <img src="QRcodes/bitcoin:${btcAddress}.png"><br>
+    Address:<br><a href="bitcoin:${btcAddress}">$btcAddress</a>
+  </div>
+PageEND
+
+  grep -q 'useFlattr=yes' project.meta \
+  && cat <<PageEND
+  <a class="FlattrButton" style="display:none;" href="http://${HTTP_HOST}"></a>
+  <noscript> <a href="${flattrThingURL}" target="_blank">
+    <img src="http://api.flattr.com/button/flattr-badge-large.png" alt="Flattr this" title="Flattr this" border="0" />
+  </a></noscript>
+PageEND
+}
+
+cat <<EOF
+<!Doctype HTML>
+
+<html>
+  <head>
+    <title>$(sed -rn 's:^name=(.*)$:\1:p' $_DATA/project.meta) - Busy $(. $PAGE title)</title>
+    <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
+    <style type="text/css"><!-- 
+    $(cat $_EXEC/templates/busy.css)
+    $(cat $_EXEC/templates/wikitext.css)
+    $(. $PAGE css)
+    --></style>
+
+    <script type="text/javascript">
+    <!--
+      function show_screen(id){
+        document.getElementById(id).style.display = "inline";
+      }
+      function hide_screen(id){
+        document.getElementById(id).style.display = "none";
+      }
+    -->
+    </script>
+    
+    <!-- Script for Flattr Button -->
+    <script type="text/javascript">
+    /* <![CDATA[ */
+        (function() {
+            var s = document.createElement('script'), t = document.getElementsByTagName('script')[0];
+            s.type = 'text/javascript';
+            s.async = true;
+            s.src = 'http://api.flattr.com/js/0.6/load.js?mode=auto';
+            t.parentNode.insertBefore(s, t);
+        })();
+    /* ]]> */</script>
+
+  </head>
+
+  <body onload="init();">
+    <div id="TITLE">
+      <h1 id="NAME">$(egrep '^name=.*$' project.meta |cut -d= -f2-)</h1>
+      <span id="SLOGAN">$(egrep '^slogan=.*$' project.meta |cut -d= -f2-)</span>
+    </div>
+    <div id="USERMENU">
+      $( $LOGIN || echo '<form action="/?action=login" method="post" accept-charset="UTF-8">
+                           Login:<br>
+                          <input type="text" name="user" value placeholder="Username"><br>
+                          <input type="password" name="pass" value placeholder="Password"><br>
+                          <input type="submit" value="Go!">
+                        </form>')
+      $( $LOGIN && echo "You are loggeed in as <b>${USER}</b><br>")
+      $( $LOGIN && $ACL_ADMIN && echo '<a href="?p=Admin">Admin</a><br>')
+      $( $LOGIN && echo '<a href="?p=Settings">My Settings</a><br>')
+      $( $LOGIN && echo '<a href="?action=logout">Log Out</a><br>')
+      $sess_msg
+    </div>
+    <div id="ACCOUNTING">
+      $(list_accounts)
+    </div>
+    <div id="MENU">
+      <a href='/?p=Home'>Home</a>
+      <a href='/?p=Wiki'>Wiki</a>
+      <a href='/?p=Subversion'>Code</a>
+      <a href='/?p=Tasks'>Tasks</a>
+    </div>
+
+    $(. $PAGE body)
+  </body>
+</html>
+EOF
+
+# vi:set filetype=html: