# HG changeset patch # User Christophe Lincoln # Date 1487793106 -3600 # Node ID 49fa101e75f53a8cefc411b6a1407917ac414a64 # Parent 3a17904702fc10164f18865994c9f2403df546da Add 'mybugs' plugin with user profile support diff -r 3a17904702fc -r 49fa101e75f5 web/images/bug.png Binary file web/images/bug.png has changed diff -r 3a17904702fc -r 49fa101e75f5 web/plugins/mybugs/mybugs.cgi --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/plugins/mybugs/mybugs.cgi Wed Feb 22 20:51:46 2017 +0100 @@ -0,0 +1,18 @@ +#!/bin/sh +# +# TinyCM/TazBug Plugin - List bugs for a user +# + +if [ "$(GET mybugs)" ]; then + d="My bugs" + header + html_header + user_box + if ! check_auth; then + echo "You must logged to view user bugs" + html_footer && exit 0 + fi + echo "

$(get_gravatar "$MAIL" 48) $USER

" + . $plugins/mybugs/user.sh + html_footer && exit 0 +fi diff -r 3a17904702fc -r 49fa101e75f5 web/plugins/mybugs/mybugs.conf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/plugins/mybugs/mybugs.conf Wed Feb 22 20:51:46 2017 +0100 @@ -0,0 +1,15 @@ +# TinyCM/TazBug Plugin configuration + +PLUGIN="My bugs" +SHORT_DESC="Show bugs for a user (also on profile page)" +MAINTAINER="devel@slitaz.org" + +# All users +BUGS_TOOLS="${BUGS_TOOLS} My bugs" + +# Authenticated users +PLUGINS_TOOLS="${PLUGINS_TOOLS}" +DASHBOARD_TOOLS="${DASHBOARD_TOOLS}" + +# Admin only in Dashboard +ADMIN_TOOLS="${ADMIN_TOOLS}" diff -r 3a17904702fc -r 49fa101e75f5 web/plugins/mybugs/user.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/plugins/mybugs/user.sh Wed Feb 22 20:51:46 2017 +0100 @@ -0,0 +1,20 @@ +#!/bin/sh +# +# This script display bug for a given user. A copy is used on SCN to +# display user bugs on profile page with a custom config file to set +# $bugdir. +# +[ -f "$plugins/mybugs/user.conf" ] && . $plugins/mybugs/user.conf + +echo "

My bugs

" +echo "
"
+for bug in $(fgrep -l $user ${bugdir}/*/*/bug.conf | xargs ls -lt | awk '{print $9}')
+do
+	. ${bug}
+	id=$(basename $(dirname $bug))
+	cat << EOT
+ \
+Bug $id: $BUG - $DATE
+EOT
+done
+echo "
" diff -r 3a17904702fc -r 49fa101e75f5 web/plugins/users/users.cgi --- a/web/plugins/users/users.cgi Wed Feb 22 19:03:30 2017 +0100 +++ b/web/plugins/users/users.cgi Wed Feb 22 20:51:46 2017 +0100 @@ -176,14 +176,26 @@ user_box account_config="$PEOPLE/$(GET user)/account.conf" profile_config="$PEOPLE/$(GET user)/profile.conf" + # account.conf if [ ! -f "$account_config" ]; then echo "No user profile for: $(GET user)" html_footer && exit 0 else . ${account_config} fi - [ -f "$profile_config" ] && . ${profile_config} -cat << EOT + # Init profile.conf + if [ -f "${profile_config}" ]; then + . ${profile_config} + else + cat > $PEOPLE/$user/profile.conf << EOT +# User profile +WEBSITE="$website" +FACEBOOK="$facebook" +TWITTER="$twitter" +EOT + chmod 0600 $PEOPLE/$user/profile.conf + fi + cat << EOT

$(get_gravatar $MAIL) $NAME

@@ -198,22 +210,17 @@
 			public_people
 		fi
 		
-		# Messages plugin integration
-		if [ -x "$plugins/messages/messages.cgi" ]; then
-			if check_auth && [ "$(GET user)" != "$user" ]; then
-				cat << EOT
-
-EOT
-			fi
-		fi
-		
 		# Display personal user profile
 		if [ -f "$PEOPLE/$USER/profile.txt" ]; then
 			echo "

$(gettext "About me")

" cat $PEOPLE/$USER/profile.txt | wiki_parser fi + + # Run user.sh that plugins can provide to add content to a profile + for script in $(ls $plugins/*/user.sh); do + . ${script} + done + html_footer && exit 0 ;; *\ modprofile\ *)