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

Improve mybugs plugin
author Christophe Lincoln <pankso@slitaz.org>
date Wed Feb 22 21:18:03 2017 +0100 (2017-02-22)
parents f07cd117feed
children
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 # Source all plugins.conf to get DASHBOARD_TOOLS and ADMIN_TOOLS
16 ADMIN_TOOLS=""
17 DASHBOARD_TOOLS=""
18 for p in $(ls $plugins)
19 do
20 . $plugins/$p/$p.conf
21 done
22 if check_auth && ! admin_user; then
23 ADMIN_TOOLS=""
24 fi
25 if check_auth; then
26 cat << EOT
27 <h2>Dashboard</h2>
28 <pre>
29 Bugs count : $(ls_bugs | wc -l)
30 Messages count : $(find $bugdir -name msg.* | wc -l)
31 Database size : $(du -sh $bugdir | awk '{print $1}')
32 </pre>
33 <div id="tools">
34 $DASHBOARD_TOOLS $ADMIN_TOOLS
35 </div>
36 EOT
38 # Only for admins
39 if check_auth && admin_user; then
40 # List all plugins
41 cat << EOT
42 <h3>$(gettext "Plugins:") $(ls $plugins | wc -l)</h3>
43 <div id="plugins">
44 <table>
45 <thead>
46 <td>$(gettext "Name")</td>
47 <td>$(gettext "Description")</td>
48 <td>$(gettext "Action")</td>
49 </thead>
50 EOT
51 for p in $(ls -1 $plugins)
52 do
53 . $plugins/$p/$p.conf
54 cat << EOT
55 <tr>
56 <td><a href='?$p'>$PLUGIN</a></td>
57 <td>$SHORT_DESC</td>
58 <td>TODO</td>
59 </tr>
60 EOT
61 done
62 echo "</table></div>"
63 fi
64 else
65 gettext "You must be logged in to view the dashboard"
66 fi
67 html_footer && exit 0
68 fi