tazbug diff web/plugins/mybugs/mybugs.cgi @ rev 144
mybugs plugin: sho user messages (latest on profile page and full with dedicated page)
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Wed Feb 22 23:24:52 2017 +0100 (2017-02-22) |
parents | b4700d7f9d42 |
children | b964fe0ab828 |
line diff
1.1 --- a/web/plugins/mybugs/mybugs.cgi Wed Feb 22 21:18:03 2017 +0100 1.2 +++ b/web/plugins/mybugs/mybugs.cgi Wed Feb 22 23:24:52 2017 +0100 1.3 @@ -1,6 +1,6 @@ 1.4 #!/bin/sh 1.5 # 1.6 -# TinyCM/TazBug Plugin - List bugs for a user 1.7 +# TinyCM/TazBug Plugin - List bugs and messages for a given user 1.8 # 1.9 1.10 if [ "$(GET mybugs)" ]; then 1.11 @@ -9,10 +9,47 @@ 1.12 html_header 1.13 user_box 1.14 if ! check_auth; then 1.15 - echo "You must logged to view user bugs" 1.16 + echo "You must be logged to view user bugs" 1.17 html_footer && exit 0 1.18 fi 1.19 + if [ "$(GET user)" ]; then 1.20 + user="$(GET user)" 1.21 + . $PEOPLE/$user/account.conf 1.22 + fi 1.23 echo "<h2><a href='?user=$USER'>$(get_gravatar "$MAIL" 48)</a> $NAME</h2>" 1.24 - . $plugins/mybugs/user.sh 1.25 + 1.26 + if fgrep -q -l "CREATOR=\"$user\"" ${bugdir}/*/*/bug.conf; then 1.27 + echo "<h3>$(gettext 'My bugs')</h3>" 1.28 + echo "<pre>" 1.29 + for bug in $(fgrep -l "CREATOR=\"$user\"" ${bugdir}/*/*/bug.conf | \ 1.30 + xargs ls -lt | awk '{print $9}' | head -n 4) 1.31 + do 1.32 + . ${bug} 1.33 + id=$(basename $(dirname $bug)) 1.34 + cat << EOT 1.35 +<img src='images/bug.png' alt='' /> \ 1.36 +Bug $id: <a href="?id=$id">$BUG</a> <span class="date">- $DATE</span> 1.37 +EOT 1.38 + done 1.39 + echo "</pre>" 1.40 + fi 1.41 + 1.42 + if fgrep -q -l "USER=\"$user\"" ${bugdir}/*/*/msg.*; then 1.43 + echo "<h3>Debug messages</h3>" 1.44 + echo "<pre>" 1.45 + for msg in $(fgrep -l "USER=\"$user\"" ${bugdir}/*/*/msg.* | \ 1.46 + xargs ls -lt | awk '{print $9}' | head -n 4) 1.47 + do 1.48 + . ${msg} 1.49 + id=$(basename $(dirname $msg)) 1.50 + cat << EOT 1.51 +<img src='images/bug.png' alt='' /> \ 1.52 +<a href="?id=$id">Bug $id:</a> <span class="date">$DATE</span> \ 1.53 +<a href="?id=$id#msg${msgid}">$(echo $MSG | cut -c 1-40)...</a> 1.54 +EOT 1.55 + done 1.56 + echo "</pre>" 1.57 + fi 1.58 + 1.59 html_footer && exit 0 1.60 fi