tazbug 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 be910dd6a36c
files web/plugins/dashboard/dashboard.cgi web/plugins/pkgs/pkgs.cgi web/plugins/skel/skel.cgi web/plugins/users/users.conf
line diff
     1.1 --- a/web/plugins/dashboard/dashboard.cgi	Fri Feb 10 15:27:11 2017 +0100
     1.2 +++ b/web/plugins/dashboard/dashboard.cgi	Fri Feb 10 16:51:39 2017 +0100
     1.3 @@ -4,28 +4,28 @@
     1.4  #
     1.5  
     1.6  if [ "$(GET dashboard)" ]; then
     1.7 -		d="Dashboard"
     1.8 -		users=$(ls -1 $PEOPLE | wc -l)
     1.9 -		bugs=$(ls -1 $bugdir | wc -l)
    1.10 -		bugsize=$(du -sh $bugdir | awk '{print $1}')
    1.11 -		header
    1.12 -		html_header
    1.13 -		user_box
    1.14 -		if ! check_auth; then
    1.15 -			gettext "You must be logged in to view the dashboard"
    1.16 -			exit 0
    1.17 -		fi
    1.18 -		# Source all plugins.conf to get DASHBOARD_TOOLS and ADMIN_TOOLS
    1.19 +	d="Dashboard"
    1.20 +	header
    1.21 +	html_header
    1.22 +	user_box
    1.23 +	if ! check_auth; then
    1.24 +		gettext "You must be logged in to view the dashboard"
    1.25 +		exit 0
    1.26 +	fi
    1.27 +	users=$(ls -1 $PEOPLE | wc -l)
    1.28 +	bugs=$(ls -1 $bugdir | wc -l)
    1.29 +	bugsize=$(du -sh $bugdir | awk '{print $1}')
    1.30 +	# Source all plugins.conf to get DASHBOARD_TOOLS and ADMIN_TOOLS
    1.31 +	ADMIN_TOOLS=""
    1.32 +	DASHBOARD_TOOLS=""
    1.33 +	for p in $(ls $plugins)
    1.34 +	do
    1.35 +		. $plugins/$p/$p.conf
    1.36 +	done
    1.37 +	if check_auth && ! admin_user; then
    1.38  		ADMIN_TOOLS=""
    1.39 -		DASHBOARD_TOOLS=""
    1.40 -		for p in $(ls $plugins)
    1.41 -		do
    1.42 -			. $plugins/$p/$p.conf
    1.43 -		done
    1.44 -		if check_auth && ! admin_user; then
    1.45 -			ADMIN_TOOLS=""
    1.46 -		fi
    1.47 -		cat << EOT
    1.48 +	fi
    1.49 +	cat << EOT
    1.50  <h2>Dashboard</h2>
    1.51  
    1.52  <div id="tools">
    1.53 @@ -43,21 +43,21 @@
    1.54  <h3>$(gettext "Plugins")</h3>
    1.55  <pre>
    1.56  EOT
    1.57 -		for p in $(ls -1 $plugins)
    1.58 -		do
    1.59 -			. $plugins/$p/$p.conf
    1.60 -			echo "<a href='?$p'>$PLUGIN</a> - $SHORT_DESC"
    1.61 -		done
    1.62 -		echo '</pre>'
    1.63 -		
    1.64 -		# Get the list of administrators
    1.65 -		echo "<h3>Admin users</h3>"
    1.66 -		for u in $(ls $PEOPLE)
    1.67 -		do
    1.68 -			user=${u}
    1.69 -			if admin_user; then
    1.70 -				echo "<a href='?user=$u'>$u</a>"
    1.71 -			fi
    1.72 -		done
    1.73 -		html_footer && exit 0
    1.74 +	for p in $(ls -1 $plugins)
    1.75 +	do
    1.76 +		. $plugins/$p/$p.conf
    1.77 +		echo "<a href='?$p'>$PLUGIN</a> - $SHORT_DESC"
    1.78 +	done
    1.79 +	echo '</pre>'
    1.80 +	
    1.81 +	# Get the list of administrators
    1.82 +	echo "<h3>Admin users</h3>"
    1.83 +	for u in $(ls $PEOPLE)
    1.84 +	do
    1.85 +		user=${u}
    1.86 +		if admin_user; then
    1.87 +			echo "<a href='?user=$u'>$u</a>"
    1.88 +		fi
    1.89 +	done
    1.90 +	html_footer && exit 0
    1.91  fi
     2.1 --- a/web/plugins/pkgs/pkgs.cgi	Fri Feb 10 15:27:11 2017 +0100
     2.2 +++ b/web/plugins/pkgs/pkgs.cgi	Fri Feb 10 16:51:39 2017 +0100
     2.3 @@ -1,6 +1,6 @@
     2.4  #!/bin/sh
     2.5  #
     2.6 -# TazBug Plugin - Skeleton
     2.7 +# TazBug Plugin - List packages
     2.8  #
     2.9  
    2.10  if [ "$(GET packages)" ] || [ "$(GET pkg)" ]; then
     3.1 --- a/web/plugins/skel/skel.cgi	Fri Feb 10 15:27:11 2017 +0100
     3.2 +++ b/web/plugins/skel/skel.cgi	Fri Feb 10 16:51:39 2017 +0100
     3.3 @@ -8,8 +8,13 @@
     3.4  	header
     3.5  	html_header
     3.6  	user_box
     3.7 -	echo "<h2>Plugin Skel</h2>"
     3.8 -	echo $(date)
     3.9 +	cat << EOT
    3.10 +<h2>Plugin Skel</h2>
    3.11 +<div id="tools">
    3.12 +	<a href="$script?dashboard">Dashboard</a>
    3.13 +</div>
    3.14 +EOT
    3.15 +	echo "<p>$(date)</p>"
    3.16  	
    3.17  	# Say we use files in $DATA/skel, sort them by date and simply cat
    3.18  	# the files, this will create a simple blog :-) We may add post via
     4.1 --- a/web/plugins/users/users.conf	Fri Feb 10 15:27:11 2017 +0100
     4.2 +++ b/web/plugins/users/users.conf	Fri Feb 10 16:51:39 2017 +0100
     4.3 @@ -6,7 +6,7 @@
     4.4  
     4.5  # Authenticated users
     4.6  PLUGINS_TOOLS="${PLUGINS_TOOLS}"
     4.7 -DASHBOARD_TOOLS="<a href='?logged'>Logged users</a>"
     4.8 +DASHBOARD_TOOLS="${DASHBOARD_TOOLS} <a href='?logged'>Logged users</a>"
     4.9  
    4.10  # Admin only in Dashboard
    4.11  ADMIN_TOOLS="${ADMIN_TOOLS} <a href='?users'>List users</a>"