tazbug 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 | b49ba342d157 |
children | b964fe0ab828 |
files | web/bugs.cgi web/plugins/mybugs/mybugs.cgi web/plugins/mybugs/mybugs.conf web/plugins/mybugs/user.sh web/style.css |
line diff
1.1 --- a/web/bugs.cgi Wed Feb 22 21:43:02 2017 +0100 1.2 +++ b/web/bugs.cgi Wed Feb 22 23:24:52 2017 +0100 1.3 @@ -278,6 +278,7 @@ 1.4 # Usage: list_msg path 1.5 list_msg() { 1.6 msg="$1" 1.7 + msgid=$(echo $msg | cut -d "." -f 2) 1.8 dir=$(dirname $msg) 1.9 id=$(basename $dir) 1.10 . ${msg} 1.11 @@ -285,7 +286,8 @@ 1.12 . ${PEOPLE}/${USER}/account.conf 1.13 cat << EOT 1.14 <a href="?user=$USER">$(get_gravatar "$MAIL" 24)</a> \ 1.15 -<a href="?id=$id">Bug $id</a>: by $USER <span class="date">- $DATE</span> 1.16 +<a href="?id=$id">Bug $id</a>: <span class="date">$DATE</span> \ 1.17 +$USER: <a href="?id=$id#msg${msgid}">$(echo $MSG | cut -c 1-40)...</a> 1.18 EOT 1.19 unset CREATOR USER MAIL 1.20 } 1.21 @@ -362,10 +364,10 @@ 1.22 del="" 1.23 # User can delete his post as well as admin. 1.24 if [ "$user" == "$USER" ] || admin_user; then 1.25 - del="<a href=\"?id=$id&delmsg=$msgid\">delete</a>" 1.26 + del="- <a href=\"?id=$id&delmsg=$msgid\">delete</a>" 1.27 fi 1.28 cat << EOT 1.29 -<p><strong>$USER</strong> $DATE $del</p> 1.30 +<h4 id="msg${msgid}">$(gettext "By:") <a href="?user=$USER">$USER</a> on $DATE $del</h4> 1.31 <pre> 1.32 $(echo "$MSG" | wiki_parser) 1.33 </pre> 1.34 @@ -881,7 +883,7 @@ 1.35 cat << EOT 1.36 </div> 1.37 1.38 -<h3>$(gettext "Latest Bugs")</h3> 1.39 +<h3>$(gettext "Latest bugs")</h3> 1.40 EOT 1.41 # List last 4 bugs 1.42 echo "<pre>" 1.43 @@ -892,7 +894,7 @@ 1.44 echo "</pre>" 1.45 1.46 # List last 4 messages 1.47 - echo "<h3>$(gettext "Latest Messages")</h3>" 1.48 + echo "<h3>$(gettext "Latest messages")</h3>" 1.49 echo "<pre>" 1.50 for msg in $(ls -lt $bugdir/*/*/msg.* | awk '{print $9}' | head -n 4) 1.51 do
2.1 --- a/web/plugins/mybugs/mybugs.cgi Wed Feb 22 21:43:02 2017 +0100 2.2 +++ b/web/plugins/mybugs/mybugs.cgi Wed Feb 22 23:24:52 2017 +0100 2.3 @@ -1,6 +1,6 @@ 2.4 #!/bin/sh 2.5 # 2.6 -# TinyCM/TazBug Plugin - List bugs for a user 2.7 +# TinyCM/TazBug Plugin - List bugs and messages for a given user 2.8 # 2.9 2.10 if [ "$(GET mybugs)" ]; then 2.11 @@ -9,10 +9,47 @@ 2.12 html_header 2.13 user_box 2.14 if ! check_auth; then 2.15 - echo "You must logged to view user bugs" 2.16 + echo "You must be logged to view user bugs" 2.17 html_footer && exit 0 2.18 fi 2.19 + if [ "$(GET user)" ]; then 2.20 + user="$(GET user)" 2.21 + . $PEOPLE/$user/account.conf 2.22 + fi 2.23 echo "<h2><a href='?user=$USER'>$(get_gravatar "$MAIL" 48)</a> $NAME</h2>" 2.24 - . $plugins/mybugs/user.sh 2.25 + 2.26 + if fgrep -q -l "CREATOR=\"$user\"" ${bugdir}/*/*/bug.conf; then 2.27 + echo "<h3>$(gettext 'My bugs')</h3>" 2.28 + echo "<pre>" 2.29 + for bug in $(fgrep -l "CREATOR=\"$user\"" ${bugdir}/*/*/bug.conf | \ 2.30 + xargs ls -lt | awk '{print $9}' | head -n 4) 2.31 + do 2.32 + . ${bug} 2.33 + id=$(basename $(dirname $bug)) 2.34 + cat << EOT 2.35 +<img src='images/bug.png' alt='' /> \ 2.36 +Bug $id: <a href="?id=$id">$BUG</a> <span class="date">- $DATE</span> 2.37 +EOT 2.38 + done 2.39 + echo "</pre>" 2.40 + fi 2.41 + 2.42 + if fgrep -q -l "USER=\"$user\"" ${bugdir}/*/*/msg.*; then 2.43 + echo "<h3>Debug messages</h3>" 2.44 + echo "<pre>" 2.45 + for msg in $(fgrep -l "USER=\"$user\"" ${bugdir}/*/*/msg.* | \ 2.46 + xargs ls -lt | awk '{print $9}' | head -n 4) 2.47 + do 2.48 + . ${msg} 2.49 + id=$(basename $(dirname $msg)) 2.50 + cat << EOT 2.51 +<img src='images/bug.png' alt='' /> \ 2.52 +<a href="?id=$id">Bug $id:</a> <span class="date">$DATE</span> \ 2.53 +<a href="?id=$id#msg${msgid}">$(echo $MSG | cut -c 1-40)...</a> 2.54 +EOT 2.55 + done 2.56 + echo "</pre>" 2.57 + fi 2.58 + 2.59 html_footer && exit 0 2.60 fi
3.1 --- a/web/plugins/mybugs/mybugs.conf Wed Feb 22 21:43:02 2017 +0100 3.2 +++ b/web/plugins/mybugs/mybugs.conf Wed Feb 22 23:24:52 2017 +0100 3.3 @@ -7,3 +7,4 @@ 3.4 # Authenticated users 3.5 PLUGINS_TOOLS="${PLUGINS_TOOLS} <a href="?mybugs">My bugs</a>" 3.6 DASHBOARD_TOOLS="${DASHBOARD_TOOLS} <a href="?mybugs">My bugs</a>" 3.7 +PROFILE_TOOLS="${PROFILE_TOOLS} <a href="?mybugs">My bugs</a>"
4.1 --- a/web/plugins/mybugs/user.sh Wed Feb 22 21:43:02 2017 +0100 4.2 +++ b/web/plugins/mybugs/user.sh Wed Feb 22 23:24:52 2017 +0100 4.3 @@ -6,18 +6,51 @@ 4.4 # 4.5 [ -f "$plugins/mybugs/bugdir.conf" ] && . $plugins/mybugs/bugdir.conf 4.6 [ "$(GET user)" ] && user="$(GET user)" 4.7 +url="http://bugs.slitaz.org/" 4.8 4.9 -if fgrep -q -l "$user" ${bugdir}/*/*/bug.conf; then 4.10 - echo "<h3>My bugs</h3>" 4.11 +if fgrep -q -l "CREATOR=\"$user\"" ${bugdir}/*/*/bug.conf; then 4.12 + show_more="0" 4.13 + echo "<h3>Latest bugs</h3>" 4.14 echo "<pre>" 4.15 - for bug in $(fgrep -l $user ${bugdir}/*/*/bug.conf | xargs ls -lt | awk '{print $9}') 4.16 + for bug in $(fgrep -l "CREATOR=\"$user\"" ${bugdir}/*/*/bug.conf | \ 4.17 + xargs ls -lt | awk '{print $9}' | head -n 4) 4.18 do 4.19 . ${bug} 4.20 id=$(basename $(dirname $bug)) 4.21 cat << EOT 4.22 <img src='images/bug.png' alt='' /> \ 4.23 -Bug $id: <a href="?id=$id">$BUG</a> <span class="date">- $DATE</span> 4.24 +Bug $id: <a href="${url}/?id=$id">$BUG</a> <span class="date">- $DATE</span> 4.25 EOT 4.26 done 4.27 echo "</pre>" 4.28 fi 4.29 + 4.30 +if fgrep -q -l "USER=\"$user\"" ${bugdir}/*/*/msg.*; then 4.31 + show_more="0" 4.32 + echo "<h3>Latest debug messages</h3>" 4.33 + echo "<pre>" 4.34 + for msg in $(fgrep -l "USER=\"$user\"" ${bugdir}/*/*/msg.* | \ 4.35 + xargs ls -lt | awk '{print $9}' | head -n 4) 4.36 + do 4.37 + . ${msg} 4.38 + id=$(basename $(dirname $msg)) 4.39 + msgid=$(echo $msg | cut -d "." -f 2) 4.40 + cat << EOT 4.41 +<img src='images/bug.png' alt='' /> \ 4.42 +<a href="${url}/?id=$id">Bug $id:</a> <span class="date">$DATE</span> \ 4.43 +<a href="${url}/?id=$id#msg${msgid}">$(echo $MSG | cut -c 1-40)...</a> 4.44 +EOT 4.45 + done 4.46 + echo "</pre>" 4.47 +fi 4.48 + 4.49 +if [ "$show_more" ]; then 4.50 + echo "<p>" 4.51 + if [ "$HTTP_HOST" == "bugs.slitaz.org" ]; then 4.52 + echo "<a href='?mybugs&user=$user'>$(gettext 'View all bugs and messages')</a>" 4.53 + else 4.54 + echo "$(gettext 'View all my bugs and debug messages on:') " 4.55 + echo "<a href='?mybugs&user=$user'>bugs.slitaz.org</a>" 4.56 + fi 4.57 + echo "</p>" 4.58 +fi
5.1 --- a/web/style.css Wed Feb 22 21:43:02 2017 +0100 5.2 +++ b/web/style.css Wed Feb 22 23:24:52 2017 +0100 5.3 @@ -4,7 +4,8 @@ 5.4 body { font: 13px sans-serif, vernada, arial; margin: 0; } 5.5 h1 { margin: 0; padding: 8px; color: #fff; font-size: 20px; } 5.6 h1 a { color: #fff; text-decoration: none; } 5.7 -h2 { color: #444; } h3 { color: #666; font-size: 140%; } 5.8 +h2 { color: #444; } h3 { font-size: 140%; } 5.9 +h3, h4 { color: #666; } 5.10 a { text-decoration: none; color: #215090; } 5.11 a:hover { text-decoration: underline; } 5.12 img { border: 0pt none; vertical-align: middle; }