slitaz-forge rev 655

scn: use mybug user.sh script for user profile
author Christophe Lincoln <pankso@slitaz.org>
date Thu Feb 23 01:50:43 2017 +0100 (2017-02-23)
parents 3e8cfa56fb9c
children 9337285a6bfb
files scn/images/bug.png scn/images/fb.png scn/images/logo.png scn/images/twitter.png scn/plugins/mybugs/README scn/plugins/mybugs/bugdir.conf scn/plugins/mybugs/user.sh scn/style.css tank/tank
line diff
     1.1 Binary file scn/images/bug.png has changed
     2.1 Binary file scn/images/fb.png has changed
     3.1 Binary file scn/images/logo.png has changed
     4.1 Binary file scn/images/twitter.png has changed
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/scn/plugins/mybugs/README	Thu Feb 23 01:50:43 2017 +0100
     5.3 @@ -0,0 +1,7 @@
     5.4 +mybugs - TinyCM/SCN plugin
     5.5 +--------------------------------------------------------------------------------
     5.6 +
     5.7 +user.sh is sourced in users profile page. The original script is in the
     5.8 +tazbug Hg repository: web/plugins/mybugs
     5.9 +
    5.10 +bugdir.conf: set path to bug database. On Tank: /home/slitaz/www/bugs/bug
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/scn/plugins/mybugs/bugdir.conf	Thu Feb 23 01:50:43 2017 +0100
     6.3 @@ -0,0 +1,1 @@
     6.4 +bugdir="/home/pankso/Public/cgi-bin/tazbug/web/bug"
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/scn/plugins/mybugs/user.sh	Thu Feb 23 01:50:43 2017 +0100
     7.3 @@ -0,0 +1,58 @@
     7.4 +#!/bin/sh
     7.5 +#
     7.6 +# This script display bug for a given user. A copy is used on SCN to
     7.7 +# display user bugs on profile page with a custom config file to set
     7.8 +# $bugdir.
     7.9 +#
    7.10 +[ -f "$plugins/mybugs/bugdir.conf" ] && . $plugins/mybugs/bugdir.conf
    7.11 +[ "$(GET user)" ] && user="$(GET user)"
    7.12 +url="http://bugs.slitaz.org/"
    7.13 +
    7.14 +if fgrep -q -l "CREATOR=\"$user\"" ${bugdir}/*/*/bug.conf; then
    7.15 +	show_more="0"
    7.16 +	echo "<h3>Latest bugs</h3>"
    7.17 +	echo "<pre>"
    7.18 +	for bug in $(fgrep -l "CREATOR=\"$user\"" ${bugdir}/*/*/bug.conf | \
    7.19 +		xargs ls -lt | awk '{print $9}' | head -n 4)
    7.20 +	do
    7.21 +		. ${bug}
    7.22 +		id=$(basename $(dirname $bug))
    7.23 +		cat << EOT
    7.24 +<img src='images/bug.png' alt='' /> \
    7.25 +Bug $id: <a href="${url}?id=$id">$BUG</a> <span class="date">- $DATE</span>
    7.26 +EOT
    7.27 +	done
    7.28 +	echo "</pre>"
    7.29 +fi
    7.30 +
    7.31 +if fgrep -q -l "USER=\"$user\"" ${bugdir}/*/*/msg.*; then
    7.32 +	show_more="0"
    7.33 +	echo "<h3>Latest debug messages</h3>"
    7.34 +	echo "<pre>"
    7.35 +	
    7.36 +	for msg in $(fgrep -l "USER=\"$user\"" ${bugdir}/*/*/msg.* | \
    7.37 +		xargs ls -lt | awk '{print $9}' | head -n 4)
    7.38 +	do
    7.39 +		. ${msg}
    7.40 +		id=$(basename $(dirname $msg))
    7.41 +		msgid=$(echo $msg | cut -d "." -f 2)
    7.42 +		message="$(fgrep MSG= $msg | cut -d \" -f 2 | cut -c 1-40)"
    7.43 +		cat << EOT
    7.44 +<img src='images/bug.png' alt='' /> \
    7.45 +<a href="?id=$id">Bug $id:</a> <span class="date">$DATE</span> \
    7.46 +<a href="?id=$id#msg${msgid}">${message}...</a>
    7.47 +EOT
    7.48 +	done
    7.49 +	echo "</pre>"
    7.50 +fi
    7.51 +
    7.52 +if [ "$show_more" ]; then
    7.53 +	echo "<p>"
    7.54 +	if [ "$HTTP_HOST" == "bugs.slitaz.org" ]; then
    7.55 +		echo "<a href='?mybugs&user=$user'>$(gettext 'View all my bugs and messages')</a>"
    7.56 +	else
    7.57 +		echo "$(gettext 'View all my bugs and debug messages on:') "
    7.58 +		echo "<a href='?mybugs&user=$user'>bugs.slitaz.org</a>"
    7.59 +	fi
    7.60 +	echo "</p>"
    7.61 +fi
     8.1 --- a/scn/style.css	Tue Feb 21 17:03:12 2017 +0100
     8.2 +++ b/scn/style.css	Thu Feb 23 01:50:43 2017 +0100
     8.3 @@ -6,6 +6,7 @@
     8.4  h1 a { color: #fff; text-decoration: none; }
     8.5  h2 { color: #444; } h3 { color: #666; font-size: 140%; }
     8.6  a { text-decoration: underline; color: #215090; }
     8.7 +pre a { text-decoration: none; }
     8.8  a:hover { text-decoration: none; }
     8.9  img { border: 0pt none; vertical-align: middle; }
    8.10  pre {
     9.1 --- a/tank/tank	Tue Feb 21 17:03:12 2017 +0100
     9.2 +++ b/tank/tank	Thu Feb 23 01:50:43 2017 +0100
     9.3 @@ -152,6 +152,7 @@
     9.4  		cd $REPOS/slitaz-forge && hg pull -u
     9.5  		cp -f scn/style* $WWW/scn
     9.6  		cp -f scn/header.html $WWW/scn/lib
     9.7 +		rm -rf $WWW/scn/images && cp -a scn/images $WWW/scn
     9.8  		cp -a scn/plugins $WWW/scn
     9.9  		# Use TinyCM cmdline tool
    9.10  		cd $REPOS/tinycm && hg pull -u