tazbug rev 106

List last messages on main page
author Christophe Lincoln <pankso@slitaz.org>
date Fri Feb 10 19:24:09 2017 +0100 (2017-02-10)
parents 5102774d2794
children 2055649f54ed
files web/bugs.cgi web/plugins/pkgs/pkgs.cgi web/plugins/users/users.cgi web/style.css
line diff
     1.1 --- a/web/bugs.cgi	Fri Feb 10 18:12:00 2017 +0100
     1.2 +++ b/web/bugs.cgi	Fri Feb 10 19:24:09 2017 +0100
     1.3 @@ -241,7 +241,7 @@
     1.4  	. ${PEOPLE}/${CREATOR}/account.conf
     1.5  	cat << EOT
     1.6  <a href="?user=$USER">$(get_gravatar "$MAIL" 24)</a> \
     1.7 -ID: $id <a href="?id=$id">$BUG</a> <span class="date">$DATE</span>
     1.8 +ID: $id <a href="?id=$id">$BUG</a> <span class="date">- $DATE</span>
     1.9  EOT
    1.10  	unset CREATOR USER MAIL
    1.11  }
    1.12 @@ -262,7 +262,7 @@
    1.13  					. ${PEOPLE}/${CREATOR}/account.conf
    1.14  				cat << EOT
    1.15  <a href="?user=$USER">$(get_gravatar "$MAIL" 24)</a> \
    1.16 -ID: $id <a href="?id=$id">$BUG</a> <span class="date">$DATE</span>
    1.17 +ID: $id <a href="?id=$id">$BUG</a> <span class="date">- $DATE</span>
    1.18  EOT
    1.19  			fi
    1.20  			unset CREATOR USER MAIL
    1.21 @@ -270,6 +270,22 @@
    1.22  	done
    1.23  }
    1.24  
    1.25 +# Usage: list_msg path
    1.26 +list_msg() {
    1.27 +	msg="$1"
    1.28 +	dir=$(dirname $msg)
    1.29 +	id=$(basename $dir)
    1.30 +	. ${msg}
    1.31 +	[ -f "${PEOPLE}/${USER}/account.conf" ] && \
    1.32 +	. ${PEOPLE}/${USER}/account.conf
    1.33 +	cat << EOT
    1.34 +<a href="?user=$USER">$(get_gravatar "$MAIL" 24)</a> \
    1.35 +ID: <a href="?id=$id">Bug $id</a> <span class="date">- $DATE</span>
    1.36 +$MSG
    1.37 +EOT
    1.38 +	unset CREATOR USER MAIL
    1.39 +}
    1.40 +
    1.41  # Stripped down Wiki parser for bug desc and messages which are simply
    1.42  # displayed in <pre>
    1.43  wiki_parser() {
    1.44 @@ -294,6 +310,7 @@
    1.45  </p>
    1.46  <p>
    1.47  	$(gettext "Date:") $DATE -
    1.48 +	$(gettext "Creator:") <a href="?user=$CREATOR">$CREATOR</a> -
    1.49  	$(eval_gettext 'Priority $PRIORITY') -
    1.50  	$(eval_ngettext '$msgs message' '$msgs messages' $msgs)
    1.51  </p>
    1.52 @@ -312,7 +329,7 @@
    1.53  		# Only original user and admin can edit a bug
    1.54  		if [ "$user" == "$CREATOR" ] || admin_user; then
    1.55  			cat << EOT
    1.56 -<a href="?edit=$id">$(gettext "Edit bug")</a>
    1.57 +<a href="?editbug=$id">$(gettext "Edit bug")</a>
    1.58  EOT
    1.59  		fi
    1.60  		else
    1.61 @@ -463,7 +480,7 @@
    1.62  	fi
    1.63  	cat << EOT
    1.64  <h2>$(eval_gettext 'Edit Bug $bug')</h2>
    1.65 -<div id="edit">
    1.66 +<div id="editbug">
    1.67  
    1.68  <form method="get" action="$script">
    1.69  	<input type="hidden" name="savebug" />
    1.70 @@ -730,9 +747,9 @@
    1.71  			new_bug
    1.72  			js_redirection_to "$script?id=$count"
    1.73  		fi ;;
    1.74 -	*\ edit\ *)
    1.75 +	*\ editbug\ *)
    1.76  		# Edit existing bug
    1.77 -		id="$(GET edit)"
    1.78 +		id="$(GET editbug)"
    1.79  		header
    1.80  		html_header
    1.81  		user_box
    1.82 @@ -893,13 +910,21 @@
    1.83  
    1.84  <h3>$(gettext "Latest Bugs")</h3>
    1.85  EOT
    1.86 -		# List last 3 bugs
    1.87 +		# List last 5 bugs
    1.88  		echo "<pre>"
    1.89 -		for lb in $(ls ${bugdir} | sort -r -n | head -n 3)
    1.90 +		for lb in $(ls ${bugdir} | sort -r -n | head -n 5)
    1.91  		do
    1.92  			list_bug ${lb}
    1.93  		done
    1.94  		echo "</pre>"
    1.95 +		# List last 3 messages
    1.96 +		echo "<h3>$(gettext "Latest Messages")</h3>"
    1.97 +		echo "<pre>"
    1.98 +		for msg in $(ls -t ${bugdir}/*/msg.* | head -n 3)
    1.99 +		do
   1.100 +			list_msg ${msg}
   1.101 +		done
   1.102 +		echo "</pre>"
   1.103  		list_bugs OPEN
   1.104  		echo "</pre>"
   1.105  		html_footer ;;
     2.1 --- a/web/plugins/pkgs/pkgs.cgi	Fri Feb 10 18:12:00 2017 +0100
     2.2 +++ b/web/plugins/pkgs/pkgs.cgi	Fri Feb 10 19:24:09 2017 +0100
     2.3 @@ -1,6 +1,6 @@
     2.4  #!/bin/sh
     2.5  #
     2.6 -# TazBug Plugin - List packages
     2.7 +# TazBug Plugin - Buggy packages plugins
     2.8  #
     2.9  
    2.10  if [ "$(GET packages)" ] || [ "$(GET pkg)" ]; then
     3.1 --- a/web/plugins/users/users.cgi	Fri Feb 10 18:12:00 2017 +0100
     3.2 +++ b/web/plugins/users/users.cgi	Fri Feb 10 19:24:09 2017 +0100
     3.3 @@ -1,6 +1,6 @@
     3.4  #!/bin/sh
     3.5  #
     3.6 -# TinyCM/TazBug Plugin - Users Admin
     3.7 +# TinyCM/TazBug Plugin - Users profile and admin
     3.8  #
     3.9  
    3.10  case " $(GET) " in
     4.1 --- a/web/style.css	Fri Feb 10 18:12:00 2017 +0100
     4.2 +++ b/web/style.css	Fri Feb 10 19:24:09 2017 +0100
     4.3 @@ -116,9 +116,8 @@
     4.4  	max-width: 720px;
     4.5  }
     4.6  
     4.7 -#newbug textarea, #edit textarea { width: 490px; height: 180px; }
     4.8 +#newbug textarea, #editbug textarea { width: 490px; height: 180px; }
     4.9  
    4.10 -/* #edit textarea { width: 100%; height: 240px; } */
    4.11  
    4.12  .box, pre, #login, #account-info {
    4.13  	background-color: #f8f8f8;