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

Remove ashism ==
author Pascal Bellard <pascal.bellard@slitaz.org>
date Tue Feb 26 12:26:25 2019 +0100 (2019-02-26)
parents 3b1e2a5f6d85
children
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 if [ -f "$plugins/${p}/${p}.conf" ]; then
61 . $plugins/${p}/${p}.conf
62 cat << EOT
63 <tr>
64 <td><a href='?$p'>$PLUGIN</a></td>
65 <td>$SHORT_DESC</td>
66 <td>TODO</td>
67 </tr>
68 EOT
69 fi
70 done
71 echo "</table></div>"
72 fi
73 else
74 gettext "You must be logged in to view the dashboard"
75 fi
76 html_footer && exit 0
77 fi