tazbug diff web/plugins/dashboard/dashboard.cgi @ rev 66
Add users plugin (splited from dashboard) and improve it. This plugin is compatible with TinyCM
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Tue Jan 07 23:17:19 2014 +0100 (2014-01-07) |
parents | 17bc5f665bf5 |
children | 6144a840e058 |
line diff
1.1 --- a/web/plugins/dashboard/dashboard.cgi Tue Jan 07 22:41:49 2014 +0100 1.2 +++ b/web/plugins/dashboard/dashboard.cgi Tue Jan 07 23:17:19 2014 +0100 1.3 @@ -1,66 +1,10 @@ 1.4 #!/bin/sh 1.5 # 1.6 -# TinyCM/TazBug Plugin - Dashboard 1.7 +# TazBug Plugin - Dashboard 1.8 # 1.9 . /usr/lib/slitaz/httphelper 1.10 1.11 case " $(GET) " in 1.12 - *\ users\ *) 1.13 - d="Users" 1.14 - header 1.15 - html_header 1.16 - user_box 1.17 - if check_auth && ! admin_user; then 1.18 - gettext "You must be admin to manage users." 1.19 - exit 0 1.20 - fi 1.21 - users=$(ls -1 $PEOPLE | wc -l) 1.22 - cat << EOT 1.23 -<h2>Users: $users</h2> 1.24 -<div id="tools"> 1.25 - <a href="$script?dashboard">Dashboard</a> 1.26 -</div> 1.27 -<pre> 1.28 -EOT 1.29 - for u in $(ls $PEOPLE) 1.30 - do 1.31 - . "${PEOPLE}/${u}/account.conf" 1.32 - cat << EOT 1.33 -$(get_gravatar $MAIL 24) <a href="?user=$USER">$USER</a> | $NAME | $MAIL 1.34 -EOT 1.35 -# deluser link 1.36 -#: <a href="?users&deluser=$USER">$(gettext "delete")</a> 1.37 - unset NAME USER 1.38 - done 1.39 - echo "</pre>" && exit 0 ;; 1.40 - 1.41 - *\ online\ *) 1.42 - # Show online users based on sessions files. 1.43 - d="Online users" 1.44 - header 1.45 - html_header 1.46 - user_box 1.47 - if ! check_auth; then 1.48 - gettext "You must be logged in to view online user" 1.49 - exit 0 1.50 - fi 1.51 - cat << EOT 1.52 -<h2>Online users</h2> 1.53 -<div id="tools"> 1.54 - <a href="$script?dashboard">Dashboard</a> 1.55 -</div> 1.56 -<pre> 1.57 -EOT 1.58 - for u in $(ls $sessions) 1.59 - do 1.60 - . "${PEOPLE}/${u}/account.conf" 1.61 - cat << EOT 1.62 -$(get_gravatar $MAIL 24) <a href="?user=$USER">$USER</a> | $NAME 1.63 -EOT 1.64 - done 1.65 - echo "</pre>" 1.66 - html_footer && exit 0 ;; 1.67 - 1.68 *\ dashboard\ *) 1.69 d="Dashboard" 1.70 users=$(ls -1 $PEOPLE | wc -l) 1.71 @@ -73,15 +17,19 @@ 1.72 gettext "You must be logged in to view the dashboard" 1.73 exit 0 1.74 fi 1.75 - if check_auth && admin_user; then 1.76 - admintools="<a href='?users'>List users</a>" 1.77 + # Source all plugins configs to get DASHBOARD_TOOLS and ADMIN_TOOLS 1.78 + for p in $(ls $plugins) 1.79 + do 1.80 + . $plugins/$p/$p.conf 1.81 + done 1.82 + if check_auth && ! admin_user; then 1.83 + ADMIN_TOOLS="" 1.84 fi 1.85 cat << EOT 1.86 <h2>Dashboard</h2> 1.87 1.88 <div id="tools"> 1.89 - <a href='?online'>Online users</a> 1.90 - $admintools 1.91 + $DASHBOARD_TOOLS $ADMIN_TOOLS 1.92 </div> 1.93 1.94 <pre> 1.95 @@ -104,12 +52,12 @@ 1.96 <h3>$(gettext "Plugins")</h3> 1.97 <pre> 1.98 EOT 1.99 + # List all plugins 1.100 for p in $(ls -1 $plugins) 1.101 do 1.102 . $plugins/$p/$p.conf 1.103 echo "<a href='?$p'>$PLUGIN</a> - $SHORT_DESC" 1.104 done 1.105 echo '</pre>' 1.106 - html_footer 1.107 - exit 0 ;; 1.108 + html_footer && exit 0 ;; 1.109 esac