tazbug rev 55

List 3 latest bug after summary
author Christophe Lincoln <pankso@slitaz.org>
date Tue Jan 07 18:59:47 2014 +0100 (2014-01-07)
parents e38bfadddc2f
children a8b2767870a7
files Makefile web/bugs.cgi
line diff
     1.1 --- a/Makefile	Tue Jan 07 15:35:49 2014 +0100
     1.2 +++ b/Makefile	Tue Jan 07 18:59:47 2014 +0100
     1.3 @@ -47,13 +47,12 @@
     1.4  	install -m 0777 -d $(DESTDIR)/etc/slitaz
     1.5  	install -m 0700 -d $(DESTDIR)$(VAR)/people
     1.6  	install -m 0700 -d $(DESTDIR)$(VAR)/auth
     1.7 -	install -m 0777 -d $(DESTDIR)$(PREFIX)/share/doc/tazbug
     1.8  	install -m 0777 -d $(DESTDIR)$(WEB)/bugs
     1.9  	install -m 0644 tazbug.conf $(DESTDIR)/etc/slitaz
    1.10  	touch $(DESTDIR)$(VAR)/auth/people
    1.11  	chmod 0600 $(DESTDIR)$(VAR)/auth/people
    1.12  	cp -a web/* $(DESTDIR)$(WEB)/bugs
    1.13 -	cp README $(DESTDIR)$(PREFIX)/share/doc/tazbug
    1.14 +	cp README $(DESTDIR)$(WEB)/bugs
    1.15  	chown -R www.www $(DESTDIR)$(VAR)/*
    1.16  	chown -R www.www $(DESTDIR)$(WEB)/bugs/bug
    1.17  
     2.1 --- a/web/bugs.cgi	Tue Jan 07 15:35:49 2014 +0100
     2.2 +++ b/web/bugs.cgi	Tue Jan 07 18:59:47 2014 +0100
     2.3 @@ -238,10 +238,25 @@
     2.4  EOT
     2.5  }
     2.6  
     2.7 +# Usage: list_bug ID
     2.8 +list_bug() {
     2.9 +	id="$1"
    2.10 +	. ${bugdir}/${id}/bug.conf
    2.11 +	[ -f "${PEOPLE}/${CREATOR}/account.conf" ] && \
    2.12 +		. ${PEOPLE}/${CREATOR}/account.conf
    2.13 +	cat << EOT
    2.14 +<a href="?user=$USER">$(get_gravatar "$MAIL" 24)</a> \
    2.15 +ID: $id  <strong><a href="?id=$id">$BUG</a></strong> \
    2.16 +<span class="date">$DATE</span>
    2.17 +EOT
    2.18 +	unset CREATOR USER MAIL
    2.19 +		
    2.20 +}
    2.21 +
    2.22  # Usage: list_bugs STATUS
    2.23  list_bugs() {
    2.24 -	bug="$1"
    2.25 -	echo "<h3>$(eval_gettext '$bug Bug')</h3>"
    2.26 +	status="$1"
    2.27 +	echo "<h3>$(eval_gettext '$status Bugs')</h3>"
    2.28  	echo "<pre>"
    2.29  	for pr in critical standard
    2.30  	do
    2.31 @@ -593,7 +608,11 @@
    2.32  		user_box
    2.33  		echo '<h2>README</h2>'
    2.34  		echo '<pre>'
    2.35 -		cat /usr/share/doc/tazbug/README
    2.36 +		if [ -f "README" ]; then
    2.37 +			cat README
    2.38 +		else
    2.39 +			cat /usr/share/doc/tazbug/README
    2.40 +		fi
    2.41  		echo '</pre>'
    2.42  		html_footer ;;
    2.43  	*\ closed\ *)
    2.44 @@ -808,7 +827,16 @@
    2.45  		fi
    2.46  		cat << EOT
    2.47  </div>
    2.48 +
    2.49 +<h3>$(gettext "Latest Bugs")</h3>
    2.50  EOT
    2.51 +		# List last 3 bugs
    2.52 +		echo "<pre>"
    2.53 +		for lb in $(ls -r ${bugdir} | head -n 3)
    2.54 +		do
    2.55 +			list_bug ${lb}
    2.56 +		done
    2.57 +		echo "</pre>"
    2.58  		list_bugs OPEN
    2.59  		echo "</pre>"
    2.60  		html_footer ;;