tazbug annotate web/plugins/dashboard/dashboard.cgi @ rev 100

Small fixes and improvments to plugins
author Christophe Lincoln <pankso@slitaz.org>
date Fri Feb 10 16:51:39 2017 +0100 (2017-02-10)
parents f3aff0cd7229
children 8bda6c6b79a6
rev   line source
pankso@49 1 #!/bin/sh
pankso@49 2 #
pankso@66 3 # TazBug Plugin - Dashboard
pankso@49 4 #
pankso@49 5
pankso@82 6 if [ "$(GET dashboard)" ]; then
pankso@100 7 d="Dashboard"
pankso@100 8 header
pankso@100 9 html_header
pankso@100 10 user_box
pankso@100 11 if ! check_auth; then
pankso@100 12 gettext "You must be logged in to view the dashboard"
pankso@100 13 exit 0
pankso@100 14 fi
pankso@100 15 users=$(ls -1 $PEOPLE | wc -l)
pankso@100 16 bugs=$(ls -1 $bugdir | wc -l)
pankso@100 17 bugsize=$(du -sh $bugdir | awk '{print $1}')
pankso@100 18 # Source all plugins.conf to get DASHBOARD_TOOLS and ADMIN_TOOLS
pankso@100 19 ADMIN_TOOLS=""
pankso@100 20 DASHBOARD_TOOLS=""
pankso@100 21 for p in $(ls $plugins)
pankso@100 22 do
pankso@100 23 . $plugins/$p/$p.conf
pankso@100 24 done
pankso@100 25 if check_auth && ! admin_user; then
pankso@67 26 ADMIN_TOOLS=""
pankso@100 27 fi
pankso@100 28 cat << EOT
pankso@49 29 <h2>Dashboard</h2>
pankso@65 30
pankso@65 31 <div id="tools">
pankso@66 32 $DASHBOARD_TOOLS $ADMIN_TOOLS
pankso@65 33 </div>
pankso@65 34
pankso@49 35 <pre>
pankso@49 36 Users : $users
pankso@54 37 Bugs : $bugs
pankso@49 38 Bugsize : $bugsize
pankso@49 39 </pre>
pankso@49 40 EOT
pankso@99 41 # List all plugins
pankso@99 42 cat << EOT
pankso@99 43 <h3>$(gettext "Plugins")</h3>
pankso@99 44 <pre>
pankso@99 45 EOT
pankso@100 46 for p in $(ls -1 $plugins)
pankso@100 47 do
pankso@100 48 . $plugins/$p/$p.conf
pankso@100 49 echo "<a href='?$p'>$PLUGIN</a> - $SHORT_DESC"
pankso@100 50 done
pankso@100 51 echo '</pre>'
pankso@100 52
pankso@100 53 # Get the list of administrators
pankso@100 54 echo "<h3>Admin users</h3>"
pankso@100 55 for u in $(ls $PEOPLE)
pankso@100 56 do
pankso@100 57 user=${u}
pankso@100 58 if admin_user; then
pankso@100 59 echo "<a href='?user=$u'>$u</a>"
pankso@100 60 fi
pankso@100 61 done
pankso@100 62 html_footer && exit 0
pankso@82 63 fi