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

small fix to dashboard plugin
author Christophe Lincoln <pankso@slitaz.org>
date Fri Feb 17 13:56:41 2017 +0100 (2017-02-17)
parents 4418f0315c8e
children d6c0da38715f
line source
1 #!/bin/sh
2 #
3 # TinyCM Plugin - Users and admin Dashboard.
4 #
6 if [ "$(GET dashboard)" ]; then
7 d="Dashboard"
8 header
9 html_header
10 user_box
11 docs=$(find $wiki -type f | wc -l)
12 wikisize="$(du -sh $wiki | awk '{print $1}')"
13 cachesize="$(du -sh $cache | awk '{print $1}')"
14 [ "$HG" != "yes" ] && hg=$(gettext "disabled")
15 [ "$HG" == "yes" ] && hg=$(gettext "enabled")
16 # Source all plugins.conf to get DASHBOARD_TOOLS and ADMIN_TOOLS
17 ADMIN_TOOLS=""
18 DASHBOARD_TOOLS=""
19 for p in $(ls $plugins)
20 do
21 . $plugins/$p/$p.conf
22 done
23 if check_auth && ! admin_user; then
24 ADMIN_TOOLS=""
25 fi
26 if check_auth; then
27 cat << EOT
28 <div id="tools">
29 <a href='$script?log'>Activity log</a>
30 <a href='$script?ls'>Pages list</a>
31 $DASHBOARD_TOOLS
32 $ADMIN_TOOLS
33 </div>
35 <h2>$d</h2>
37 <pre>
38 Wiki docs : $docs ($wikisize)
39 Cache size : $cachesize
40 Mercurial : $hg
41 </pre>
43 <h3>Admin users</h3>
44 EOT
45 # Get the list of administrators
46 fgrep -l "ADMIN_USER=" $PEOPLE/*/account.conf | while read file;
47 do
48 . ${file}
49 echo "<a href='?user=$USER'>$USER</a>"
50 unset NAME USER
51 done
53 # Only for admins
54 if check_auth && admin_user; then
55 # List all plugins
56 cat << EOT
57 <h3>$(gettext "Plugins")</h3>
58 <table>
59 <thead>
60 <td>$(gettext "Name")</td>
61 <td>$(gettext "Description")</td>
62 <td>$(gettext "Action")</td>
63 </thead>
64 EOT
65 for p in $(ls -1 $plugins)
66 do
67 . $plugins/$p/$p.conf
68 cat << EOT
69 <tr>
70 <td><a href='?$p'>$PLUGIN</a></td>
71 <td>$SHORT_DESC</td>
72 <td>TODO</td>
73 </tr>
74 EOT
75 done
76 echo "</table>"
77 fi
78 else
79 gettext "You must be logged in to view the dashboard"
80 fi
81 html_footer && exit 0
82 fi