tinycm view plugins/dashboard/dashboard.cgi @ rev 59

Bunch of change, mv dashboard to plugins
author Christophe Lincoln <pankso@slitaz.org>
date Fri Jan 31 00:48:32 2014 +0100 (2014-01-31)
parents
children 854c4a8f0972
line source
1 #!/bin/sh
2 #
3 # TinyCM Plugin - Users and admin Dashboard.
4 #
5 . /usr/lib/slitaz/httphelper
7 if [ "$(GET dashboard)" ]; then
8 d="Dashboard"
9 header
10 html_header
11 user_box
12 users=$(ls -1 $PEOPLE | wc -l)
13 docs=$(find $wiki -type f | wc -l)
14 wikisize="$(du -sh $wiki | awk '{print $1}')"
15 cachesize="$(du -sh $cache | awk '{print $1}')"
16 [ "$HG" != "yes" ] && hg=$(gettext "disabled")
17 [ "$HG" == "yes" ] && hg=$(gettext "enabled")
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 if check_auth; then
29 cat << EOT
30 <div id="tools">
31 <a href='$script?log'>Activity log</a>
32 <a href='$script?ls'>Pages list</a>
33 $DASHBOARD_TOOLS
34 $ADMIN_TOOLS
35 </div>
37 <h2>$d</h2>
39 <pre>
40 Users : $users
41 Wiki : $docs ($wikisize)
42 Cache : $cachesize
43 Mercurial : $hg
44 </pre>
46 <h3>Admin users</h3>
47 EOT
48 # Get the list of administrators
49 for u in $(ls $PEOPLE)
50 do
51 user=${u}
52 if admin_user; then
53 echo "<a href='?user=$u'>$u</a>"
54 fi
55 done
56 cat << EOT
57 <h3>$(gettext "Plugins")</h3>
58 <pre>
59 EOT
60 for p in $(ls -1 $plugins)
61 do
62 . $plugins/$p/$p.conf
63 echo "<a href='?$p'>$PLUGIN</a> - $SHORT_DESC"
64 done
65 echo '</pre>'
66 else
67 gettext "You must be logged in to view the dashboard."
68 fi
69 html_footer
70 exit 0
71 fi