tazbug annotate 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 |
rev | line source |
---|---|
pankso@140 | 1 #!/bin/sh |
pankso@140 | 2 # |
pankso@144 | 3 # TinyCM/TazBug Plugin - List bugs and messages for a given user |
pankso@140 | 4 # |
pankso@140 | 5 |
pankso@140 | 6 if [ "$(GET mybugs)" ]; then |
pankso@140 | 7 d="My bugs" |
pankso@140 | 8 header |
pankso@140 | 9 html_header |
pankso@140 | 10 user_box |
pankso@140 | 11 if ! check_auth; then |
pankso@144 | 12 echo "You must be logged to view user bugs" |
pankso@140 | 13 html_footer && exit 0 |
pankso@140 | 14 fi |
pankso@144 | 15 if [ "$(GET user)" ]; then |
pankso@144 | 16 user="$(GET user)" |
pankso@144 | 17 . $PEOPLE/$user/account.conf |
pankso@144 | 18 fi |
pankso@141 | 19 echo "<h2><a href='?user=$USER'>$(get_gravatar "$MAIL" 48)</a> $NAME</h2>" |
pankso@144 | 20 |
pankso@144 | 21 if fgrep -q -l "CREATOR=\"$user\"" ${bugdir}/*/*/bug.conf; then |
pankso@144 | 22 echo "<h3>$(gettext 'My bugs')</h3>" |
pankso@144 | 23 echo "<pre>" |
pankso@144 | 24 for bug in $(fgrep -l "CREATOR=\"$user\"" ${bugdir}/*/*/bug.conf | \ |
pankso@144 | 25 xargs ls -lt | awk '{print $9}' | head -n 4) |
pankso@144 | 26 do |
pankso@144 | 27 . ${bug} |
pankso@144 | 28 id=$(basename $(dirname $bug)) |
pankso@144 | 29 cat << EOT |
pankso@144 | 30 <img src='images/bug.png' alt='' /> \ |
pankso@144 | 31 Bug $id: <a href="?id=$id">$BUG</a> <span class="date">- $DATE</span> |
pankso@144 | 32 EOT |
pankso@144 | 33 done |
pankso@144 | 34 echo "</pre>" |
pankso@144 | 35 fi |
pankso@144 | 36 |
pankso@144 | 37 if fgrep -q -l "USER=\"$user\"" ${bugdir}/*/*/msg.*; then |
pankso@144 | 38 echo "<h3>Debug messages</h3>" |
pankso@144 | 39 echo "<pre>" |
pankso@144 | 40 for msg in $(fgrep -l "USER=\"$user\"" ${bugdir}/*/*/msg.* | \ |
pankso@144 | 41 xargs ls -lt | awk '{print $9}' | head -n 4) |
pankso@144 | 42 do |
pankso@144 | 43 . ${msg} |
pankso@144 | 44 id=$(basename $(dirname $msg)) |
pankso@144 | 45 cat << EOT |
pankso@144 | 46 <img src='images/bug.png' alt='' /> \ |
pankso@144 | 47 <a href="?id=$id">Bug $id:</a> <span class="date">$DATE</span> \ |
pankso@144 | 48 <a href="?id=$id#msg${msgid}">$(echo $MSG | cut -c 1-40)...</a> |
pankso@144 | 49 EOT |
pankso@144 | 50 done |
pankso@144 | 51 echo "</pre>" |
pankso@144 | 52 fi |
pankso@144 | 53 |
pankso@140 | 54 html_footer && exit 0 |
pankso@140 | 55 fi |