tazbug view web/plugins/dashboard/dashboard.cgi @ rev 64
Only logged users can see online users
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Tue Jan 07 22:32:00 2014 +0100 (2014-01-07) |
parents | 1fa682f972c9 |
children | 17bc5f665bf5 |
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="Users"
10 header
11 html_header
12 user_box
13 if check_auth && ! admin_user; then
14 gettext "You must be admin to manage users."
15 exit 0
16 fi
17 users=$(ls -1 $PEOPLE | wc -l)
18 cat << EOT
19 <h2>Users: $users</h2>
20 <div id="tools">
21 <a href="$script?dashboard">Dashboard</a>
22 </div>
23 <pre>
24 EOT
25 for u in $(ls $PEOPLE)
26 do
27 . "${PEOPLE}/${u}/account.conf"
28 cat << EOT
29 $(get_gravatar $MAIL 24) <a href="?user=$USER">$USER</a> | $NAME | $MAIL
30 EOT
31 # deluser link
32 #: <a href="?users&deluser=$USER">$(gettext "delete")</a>
33 unset NAME USER
34 done
35 echo "</pre>" && exit 0 ;;
37 *\ online\ *)
38 # Show online users based on sessions files.
39 d="Online users"
40 header
41 html_header
42 user_box
43 if ! check_auth; then
44 gettext "You must be logged in to view online user"
45 exit 0
46 fi
47 cat << EOT
48 <h2>Online users</h2>
49 <div id="tools">
50 <a href="$script?dashboard">Dashboard</a>
51 </div>
52 <pre>
53 EOT
54 for u in $(ls $sessions)
55 do
56 . "${PEOPLE}/${u}/account.conf"
57 cat << EOT
58 $(get_gravatar $MAIL 24) <a href="?user=$USER">$USER</a> | $NAME
59 EOT
60 done
61 echo "</pre>"
62 html_footer && exit 0 ;;
64 *\ dashboard\ *)
65 d="Dashboard"
66 users=$(ls -1 $PEOPLE | wc -l)
67 bugs=$(ls -1 $bugdir | wc -l)
68 bugsize=$(du -sh $bugdir | awk '{print $1}')
69 header
70 html_header
71 user_box
72 if ! check_auth; then
73 gettext "You must be logged in to view the dashboard"
74 exit 0
75 fi
76 if check_auth && admin_user; then
77 admintools="<a href='?users'>List users</a>"
78 fi
79 cat << EOT
80 <h2>Dashboard</h2>
81 <pre>
82 Users : $users
83 Bugs : $bugs
84 Bugsize : $bugsize
85 </pre>
86 <div id="tools">
87 <a href='?online'>Online users</a>
88 $admintools
89 </div>
90 <h3>Admin users</h3>
91 EOT
92 # Get the list of administrators
93 for u in $(ls $PEOPLE)
94 do
95 user=${u}
96 if admin_user; then
97 echo "<a href='?user=$u'>$u</a>"
98 fi
99 done
100 cat << EOT
101 <h3>$(gettext "Plugins")</h3>
102 <pre>
103 EOT
104 for p in $(ls -1 $plugins)
105 do
106 . $plugins/$p/$p.conf
107 echo "<a href='?$p'>$PLUGIN</a> - $SHORT_DESC"
108 done
109 echo '</pre>'
110 html_footer
111 exit 0 ;;
112 esac