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

web: plugins dont need to source httphelper.sh
author Christophe Lincoln <pankso@slitaz.org>
date Mon Feb 17 23:16:08 2014 +0100 (2014-02-17)
parents 6144a840e058
children f3aff0cd7229
line source
1 #!/bin/sh
2 #
3 # TazBug Plugin - Dashboard
4 #
6 if [ "$(GET dashboard)" ]; then
7 d="Dashboard"
8 users=$(ls -1 $PEOPLE | wc -l)
9 bugs=$(ls -1 $bugdir | wc -l)
10 bugsize=$(du -sh $bugdir | awk '{print $1}')
11 header
12 html_header
13 user_box
14 if ! check_auth; then
15 gettext "You must be logged in to view the dashboard"
16 exit 0
17 fi
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>
41 <h3>Admin users</h3>
42 EOT
43 # Get the list of administrators
44 for u in $(ls $PEOPLE)
45 do
46 user=${u}
47 if admin_user; then
48 echo "<a href='?user=$u'>$u</a>"
49 fi
50 done
51 cat << EOT
52 <h3>$(gettext "Plugins")</h3>
53 <pre>
54 EOT
55 # List all plugins
56 for p in $(ls -1 $plugins)
57 do
58 . $plugins/$p/$p.conf
59 echo "<a href='?$p'>$PLUGIN</a> - $SHORT_DESC"
60 done
61 echo '</pre>'
62 html_footer && exit 0
63 fi