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