# HG changeset patch # User Christophe Lincoln # Date 1487802292 -3600 # Node ID d98dc7dce8d423ea585e31b24bcb82074aa6323f # Parent b49ba342d1574d2f17df38e7b42fab8eb9142caa mybugs plugin: sho user messages (latest on profile page and full with dedicated page) diff -r b49ba342d157 -r d98dc7dce8d4 web/bugs.cgi --- a/web/bugs.cgi Wed Feb 22 21:43:02 2017 +0100 +++ b/web/bugs.cgi Wed Feb 22 23:24:52 2017 +0100 @@ -278,6 +278,7 @@ # Usage: list_msg path list_msg() { msg="$1" + msgid=$(echo $msg | cut -d "." -f 2) dir=$(dirname $msg) id=$(basename $dir) . ${msg} @@ -285,7 +286,8 @@ . ${PEOPLE}/${USER}/account.conf cat << EOT $(get_gravatar "$MAIL" 24) \ -Bug $id: by $USER - $DATE +Bug $id: $DATE \ +$USER: $(echo $MSG | cut -c 1-40)... EOT unset CREATOR USER MAIL } @@ -362,10 +364,10 @@ del="" # User can delete his post as well as admin. if [ "$user" == "$USER" ] || admin_user; then - del="delete" + del="- delete" fi cat << EOT -

$USER $DATE $del

+

$(gettext "By:") $USER on $DATE $del

 $(echo "$MSG" | wiki_parser)
 
@@ -881,7 +883,7 @@ cat << EOT -

$(gettext "Latest Bugs")

+

$(gettext "Latest bugs")

EOT # List last 4 bugs echo "
"
@@ -892,7 +894,7 @@
 		echo "
" # List last 4 messages - echo "

$(gettext "Latest Messages")

" + echo "

$(gettext "Latest messages")

" echo "
"
 		for msg in $(ls -lt $bugdir/*/*/msg.* | awk '{print $9}' | head -n 4)
 		do
diff -r b49ba342d157 -r d98dc7dce8d4 web/plugins/mybugs/mybugs.cgi
--- a/web/plugins/mybugs/mybugs.cgi	Wed Feb 22 21:43:02 2017 +0100
+++ b/web/plugins/mybugs/mybugs.cgi	Wed Feb 22 23:24:52 2017 +0100
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# TinyCM/TazBug Plugin - List bugs for a user
+# TinyCM/TazBug Plugin - List bugs and messages for a given user
 #
 
 if [ "$(GET mybugs)" ]; then
@@ -9,10 +9,47 @@
 	html_header
 	user_box
 	if ! check_auth; then
-		echo "You must logged to view user bugs" 
+		echo "You must be logged to view user bugs" 
 		html_footer && exit 0
 	fi
+	if [ "$(GET user)" ]; then
+		user="$(GET user)"
+		. $PEOPLE/$user/account.conf
+	fi
 	echo "

$(get_gravatar "$MAIL" 48) $NAME

" - . $plugins/mybugs/user.sh + + if fgrep -q -l "CREATOR=\"$user\"" ${bugdir}/*/*/bug.conf; then + echo "

$(gettext 'My bugs')

" + echo "
"
+		for bug in $(fgrep -l "CREATOR=\"$user\"" ${bugdir}/*/*/bug.conf | \
+			xargs ls -lt | awk '{print $9}' | head -n 4)
+		do
+			. ${bug}
+			id=$(basename $(dirname $bug))
+			cat << EOT
+ \
+Bug $id: $BUG - $DATE
+EOT
+		done
+		echo "
" + fi + + if fgrep -q -l "USER=\"$user\"" ${bugdir}/*/*/msg.*; then + echo "

Debug messages

" + echo "
"
+		for msg in $(fgrep -l "USER=\"$user\"" ${bugdir}/*/*/msg.* | \
+			xargs ls -lt | awk '{print $9}' | head -n 4)
+		do
+			. ${msg}
+			id=$(basename $(dirname $msg))
+			cat << EOT
+ \
+Bug $id: $DATE \
+$(echo $MSG | cut -c 1-40)...
+EOT
+		done
+		echo "
" + fi + html_footer && exit 0 fi diff -r b49ba342d157 -r d98dc7dce8d4 web/plugins/mybugs/mybugs.conf --- a/web/plugins/mybugs/mybugs.conf Wed Feb 22 21:43:02 2017 +0100 +++ b/web/plugins/mybugs/mybugs.conf Wed Feb 22 23:24:52 2017 +0100 @@ -7,3 +7,4 @@ # Authenticated users PLUGINS_TOOLS="${PLUGINS_TOOLS} My bugs" DASHBOARD_TOOLS="${DASHBOARD_TOOLS} My bugs" +PROFILE_TOOLS="${PROFILE_TOOLS} My bugs" diff -r b49ba342d157 -r d98dc7dce8d4 web/plugins/mybugs/user.sh --- a/web/plugins/mybugs/user.sh Wed Feb 22 21:43:02 2017 +0100 +++ b/web/plugins/mybugs/user.sh Wed Feb 22 23:24:52 2017 +0100 @@ -6,18 +6,51 @@ # [ -f "$plugins/mybugs/bugdir.conf" ] && . $plugins/mybugs/bugdir.conf [ "$(GET user)" ] && user="$(GET user)" +url="http://bugs.slitaz.org/" -if fgrep -q -l "$user" ${bugdir}/*/*/bug.conf; then - echo "

My bugs

" +if fgrep -q -l "CREATOR=\"$user\"" ${bugdir}/*/*/bug.conf; then + show_more="0" + echo "

Latest bugs

" echo "
"
-	for bug in $(fgrep -l $user ${bugdir}/*/*/bug.conf | xargs ls -lt | awk '{print $9}')
+	for bug in $(fgrep -l "CREATOR=\"$user\"" ${bugdir}/*/*/bug.conf | \
+		xargs ls -lt | awk '{print $9}' | head -n 4)
 	do
 		. ${bug}
 		id=$(basename $(dirname $bug))
 		cat << EOT
  \
-Bug $id: $BUG - $DATE
+Bug $id: $BUG - $DATE
 EOT
 	done
 	echo "
" fi + +if fgrep -q -l "USER=\"$user\"" ${bugdir}/*/*/msg.*; then + show_more="0" + echo "

Latest debug messages

" + echo "
"
+	for msg in $(fgrep -l "USER=\"$user\"" ${bugdir}/*/*/msg.* | \
+		xargs ls -lt | awk '{print $9}' | head -n 4)
+	do
+		. ${msg}
+		id=$(basename $(dirname $msg))
+		msgid=$(echo $msg | cut -d "." -f 2)
+		cat << EOT
+ \
+Bug $id: $DATE \
+$(echo $MSG | cut -c 1-40)...
+EOT
+	done
+	echo "
" +fi + +if [ "$show_more" ]; then + echo "

" + if [ "$HTTP_HOST" == "bugs.slitaz.org" ]; then + echo "$(gettext 'View all bugs and messages')" + else + echo "$(gettext 'View all my bugs and debug messages on:') " + echo "bugs.slitaz.org" + fi + echo "

" +fi diff -r b49ba342d157 -r d98dc7dce8d4 web/style.css --- a/web/style.css Wed Feb 22 21:43:02 2017 +0100 +++ b/web/style.css Wed Feb 22 23:24:52 2017 +0100 @@ -4,7 +4,8 @@ body { font: 13px sans-serif, vernada, arial; margin: 0; } h1 { margin: 0; padding: 8px; color: #fff; font-size: 20px; } h1 a { color: #fff; text-decoration: none; } -h2 { color: #444; } h3 { color: #666; font-size: 140%; } +h2 { color: #444; } h3 { font-size: 140%; } +h3, h4 { color: #666; } a { text-decoration: none; color: #215090; } a:hover { text-decoration: underline; } img { border: 0pt none; vertical-align: middle; }