tazbug view web/plugins/dashboard/dashboard.cgi @ rev 123

Use new admin config and up users plugins from TinyCM
author Christophe Lincoln <pankso@slitaz.org>
date Tue Feb 21 00:51:31 2017 +0100 (2017-02-21)
parents b19dbd851223
children f07cd117feed
line source
1 #!/bin/sh
2 #
3 # TazBug Plugin - Dashboard
4 #
6 if [ "$(GET dashboard)" ]; then
7 d="Dashboard"
8 header
9 html_header
10 user_box
11 if ! check_auth; then
12 gettext "You must be logged in to view the dashboard"
13 exit 0
14 fi
15 bugs=$(ls -1 $bugdir | wc -l)
16 bugsize=$(du -sh $bugdir | awk '{print $1}')
17 # Source all plugins.conf to get DASHBOARD_TOOLS and ADMIN_TOOLS
18 ADMIN_TOOLS=""
19 DASHBOARD_TOOLS=""
20 for p in $(ls $plugins)
21 do
22 . $plugins/$p/$p.conf
23 done
24 if check_auth && ! admin_user; then
25 ADMIN_TOOLS=""
26 fi
27 if check_auth; then
28 cat << EOT
29 <div id="tools">
30 $DASHBOARD_TOOLS $ADMIN_TOOLS
31 </div>
32 <h2>Dashboard</h2>
33 <pre>
34 Bugs count : $bugs
35 Database size : $bugsize
36 Server uptime :$(uptime | cut -d "," -f 1-2)
37 </pre>
38 EOT
40 # Only for admins
41 if check_auth && admin_user; then
42 # List all plugins
43 cat << EOT
44 <h3>$(gettext "Plugins:") $(ls $plugins | wc -l)</h3>
45 <div id="plugins">
46 <table>
47 <thead>
48 <td>$(gettext "Name")</td>
49 <td>$(gettext "Description")</td>
50 <td>$(gettext "Action")</td>
51 </thead>
52 EOT
53 for p in $(ls -1 $plugins)
54 do
55 . $plugins/$p/$p.conf
56 cat << EOT
57 <tr>
58 <td><a href='?$p'>$PLUGIN</a></td>
59 <td>$SHORT_DESC</td>
60 <td>TODO</td>
61 </tr>
62 EOT
63 done
64 echo "</table></div>"
65 fi
66 else
67 gettext "You must be logged in to view the dashboard"
68 fi
69 html_footer && exit 0
70 fi