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

Add a small dashboard plugin and misc fixes
author Christophe Lincoln <pankso@slitaz.org>
date Sun Jan 05 00:01:34 2014 +0100 (2014-01-05)
parents
children 02a11d8d636e
line source
1 #!/bin/sh
2 #
3 # TinyCM/TazBug Plugin - Dashboard
4 #
5 . /usr/lib/slitaz/httphelper
7 case " $(GET) " in
8 *\ users\ *)
9 d="Dashboard"
10 header
11 html_header
12 user_box
13 if ! admin_user; then
14 gettext "You must be admin in to manage users."
15 exit 0
16 fi
17 users=$(ls -1 $PEOPLE | wc -l)
18 cat << EOT
19 <h2>Users: $users</h2>
20 <pre>
21 EOT
22 for u in $(ls $PEOPLE)
23 do
24 #. ${PEOPLE}/${u}/account.conf
25 . "${PEOPLE}/${u}/account.conf"
26 cat << EOT
27 <img src="images/avatar.png" /> <a href="?user=$USER">$USER</a> | $NAME
28 EOT
29 # deluser link
30 #: <a href="?users&amp;deluser=$USER">$(gettext "delete")</a>
31 unset NAME USER
32 done
33 echo "</pre>" && exit 0 ;;
35 *\ dashboard\ *)
36 d="Dashboard"
37 header
38 html_header
39 user_box
40 if ! check_auth; then
41 gettext "You must be logged in to view the dashboard."
42 exit 0
43 fi
44 if admin_user; then
45 admintools="<a href='?users'>Users</a>"
46 fi
47 users=$(ls -1 $PEOPLE | wc -l)
48 bugsize=$(du -sh $bugdir | awk '{print $1}')
49 cat << EOT
50 <h2>Dashboard</h2>
51 <pre>
52 Users : $users
53 Bugsize : $bugsize
54 </pre>
55 <div id="tools">
56 $admintools
57 </div>
58 <h3>Admin users</h3>
59 EOT
60 # Get the list of administrators
61 for u in $(ls $PEOPLE)
62 do
63 user=${u}
64 if admin_user; then
65 echo "<a href='?user=$u'>$u</a>"
66 fi
67 done
68 cat << EOT
69 <h3>$(gettext "Plugins")</h3>
70 <pre>
71 EOT
72 for p in $(ls -1 $plugins)
73 do
74 . $plugins/$p/$p.conf
75 echo "<a href='?$p'>$PLUGIN</a> - $SHORT_DESC"
76 done
77 echo '</pre>'
78 html_footer
79 exit 0 ;;
80 esac