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

Small fix to dashboard
author Christophe Lincoln <pankso@slitaz.org>
date Thu Feb 23 02:50:40 2017 +0100 (2017-02-23)
parents 35354740250d
children 3b1e2a5f6d85
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 [ -f "$plugins/$p/$p.conf" ] && . $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 Users account : $(ls $PEOPLE | wc -l)
41 Mercurial : $hg
42 </pre>
43 EOT
45 # Only for admins
46 if admin_user; then
47 # List all plugins
48 cat << EOT
49 <h3>$(gettext "Plugins:") $(ls $plugins | wc -l)</h3>
50 <div id="plugins">
51 <table>
52 <thead>
53 <td>$(gettext "Name")</td>
54 <td>$(gettext "Description")</td>
55 <td>$(gettext "Action")</td>
56 </thead>
57 EOT
58 for p in $(ls -1 $plugins)
59 do
60 . $plugins/$p/$p.conf
61 cat << EOT
62 <tr>
63 <td><a href='?$p'>$PLUGIN</a></td>
64 <td>$SHORT_DESC</td>
65 <td>TODO</td>
66 </tr>
67 EOT
68 done
69 echo "</table></div>"
70 fi
71 else
72 gettext "You must be logged in to view the dashboard"
73 fi
74 html_footer && exit 0
75 fi