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

Small fixes and improvments to plugins
author Christophe Lincoln <pankso@slitaz.org>
date Fri Feb 10 16:51:39 2017 +0100 (2017-02-10)
parents f3aff0cd7229
children 8bda6c6b79a6
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 users=$(ls -1 $PEOPLE | wc -l)
16 bugs=$(ls -1 $bugdir | wc -l)
17 bugsize=$(du -sh $bugdir | awk '{print $1}')
18 # Source all plugins.conf to get DASHBOARD_TOOLS and ADMIN_TOOLS
19 ADMIN_TOOLS=""
20 DASHBOARD_TOOLS=""
21 for p in $(ls $plugins)
22 do
23 . $plugins/$p/$p.conf
24 done
25 if check_auth && ! admin_user; then
26 ADMIN_TOOLS=""
27 fi
28 cat << EOT
29 <h2>Dashboard</h2>
31 <div id="tools">
32 $DASHBOARD_TOOLS $ADMIN_TOOLS
33 </div>
35 <pre>
36 Users : $users
37 Bugs : $bugs
38 Bugsize : $bugsize
39 </pre>
40 EOT
41 # List all plugins
42 cat << EOT
43 <h3>$(gettext "Plugins")</h3>
44 <pre>
45 EOT
46 for p in $(ls -1 $plugins)
47 do
48 . $plugins/$p/$p.conf
49 echo "<a href='?$p'>$PLUGIN</a> - $SHORT_DESC"
50 done
51 echo '</pre>'
53 # Get the list of administrators
54 echo "<h3>Admin users</h3>"
55 for u in $(ls $PEOPLE)
56 do
57 user=${u}
58 if admin_user; then
59 echo "<a href='?user=$u'>$u</a>"
60 fi
61 done
62 html_footer && exit 0
63 fi