]> git.plutz.net Git - busy/blob - templates/frame.html.sh
porting busy to confetti framework
[busy] / templates / frame.html.sh
1 # Copyright 2011 - 2014 Paul Hänsch
2 #
3 # This file is part of Busy
4
5 # Busy is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU Affero General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
9
10 # Busy is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 # GNU Affero General Public License for more details.
14
15 # You should have received a copy of the GNU Affero General Public License
16 # along with Busy. If not, see <http://www.gnu.org/licenses/>. 
17
18 list_accounts(){
19   btcAddress="$(sed -rn 's:^btcAddress=(.*)$:\1:p' project.meta)"
20   flattrThingURL=$(sed -rn 's:^flattrThingURL=(.*)$:\1:p' project.meta)
21
22   grep -q 'useBitcoin=yes' project.meta \
23   && [ \! -f "QRcodes/bitcoin:${btcAddress}.png" ] \
24   && qrencode -o "QRcodes/bitcoin:${btcAddress}.png" "bitcoin:${btcAddress}"
25   grep -q 'useBitcoin=yes' project.meta \
26   && cat <<PageEND
27   <a href="#" onclick="javascript:show_screen('btcqr')"><img src="http://bitcoin.it/img/bc_logo_135.png" height="60"></a>
28   <div id="btcqr" style="display:none;">
29     <a href="#" onclick="javascript:hide_screen('btcqr')">close</a><br>
30     <img src="QRcodes/bitcoin:${btcAddress}.png"><br>
31     Address:<br><a href="bitcoin:${btcAddress}">$btcAddress</a>
32   </div>
33 PageEND
34
35   grep -q 'useFlattr=yes' project.meta \
36   && cat <<PageEND
37   <a class="FlattrButton" style="display:none;" href="http://${HTTP_HOST}"></a>
38   <noscript> <a href="${flattrThingURL}" target="_blank">
39     <img src="http://api.flattr.com/button/flattr-badge-large.png" alt="Flattr this" title="Flattr this" border="0" />
40   </a></noscript>
41 PageEND
42 }
43
44 cat <<EOF
45 <!Doctype HTML>
46
47 <html>
48   <head>
49     <title>$(sed -rn 's:^name=(.*)$:\1:p' $_DATA/project.meta) - Busy $(. $PAGE title)</title>
50     <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
51     <style type="text/css"><!-- 
52     $(cat $_EXEC/templates/busy.css)
53     $(cat $_EXEC/templates/wikitext.css)
54     $(. $PAGE css)
55     --></style>
56
57     <script type="text/javascript">
58     <!--
59       function show_screen(id){
60         document.getElementById(id).style.display = "inline";
61       }
62       function hide_screen(id){
63         document.getElementById(id).style.display = "none";
64       }
65     -->
66     </script>
67     
68     <!-- Script for Flattr Button -->
69     <script type="text/javascript">
70     /* <![CDATA[ */
71         (function() {
72             var s = document.createElement('script'), t = document.getElementsByTagName('script')[0];
73             s.type = 'text/javascript';
74             s.async = true;
75             s.src = 'http://api.flattr.com/js/0.6/load.js?mode=auto';
76             t.parentNode.insertBefore(s, t);
77         })();
78     /* ]]> */</script>
79
80   </head>
81
82   <body onload="init();">
83     <div id="TITLE">
84       <h1 id="NAME">$(egrep '^name=.*$' project.meta |cut -d= -f2-)</h1>
85       <span id="SLOGAN">$(egrep '^slogan=.*$' project.meta |cut -d= -f2-)</span>
86     </div>
87     <div id="USERMENU">
88       $( $LOGIN || echo '<form action="/?action=login" method="post" accept-charset="UTF-8">
89                            Login:<br>
90                            <input type="text" name="user" value placeholder="Username"><br>
91                            <input type="password" name="pass" value placeholder="Password"><br>
92                            <input type="submit" value="Go!">
93                          </form>')
94       $( $LOGIN && echo "You are loggeed in as <b>${USER}</b><br>")
95       $( $LOGIN && $ACL_ADMIN && echo '<a href="?p=Admin">Admin</a><br>')
96       $( $LOGIN && echo '<a href="?p=Settings">My Settings</a><br>')
97       $( $LOGIN && echo '<a href="?action=logout">Log Out</a><br>')
98       $sess_msg
99     </div>
100     <div id="ACCOUNTING">
101       $(list_accounts)
102     </div>
103     <div id="MENU">
104       <a href='/?p=Home'>Home</a>
105       <a href='/?p=Wiki'>Wiki</a>
106       <a href='/?p=Subversion'>Code</a>
107       <a href='/?p=Tasks'>Tasks</a>
108     </div>
109
110     $(. $PAGE body)
111   </body>
112 </html>
113 EOF
114
115 # vi:set filetype=html: