%META:TOPICINFO{author="TWikiContributor" date="1432943037" format="1.1" version="3"}% %META:TOPICPARENT{name="TWikiUserMappingContrib"}% ---+!! TWiki User Reports
%TOC{ title="Page contents" depth="2" }%
This page contains user reports you can use in TWiki application. Create appealing TWiki applications in a no time! Reports are of format =%USERREPORT{ action="..." ... }%=, where the action determines the kind of report. Each report supports additional parameters. ---++ Action: user_list Show a simple list of registered users. The output is a comma-space delimited sorted list of WikiWords of users (without web prefix), which can be used as input for other reports on this page. * Action "user_list": Show a list of users as comma-space delimited list of !WikiWords. * Parameter =search=: Apply filter by searching all form fields, but not the main topic text. Optional; all users are returned if missing. * Parameter =limit=: Limits the number of users returned. Optional; all users are returned if missing. * Parameter =sort=: Sort the result by the topic name, topic creation date, last modified date, last editor, or named field of TWikiForms. For details see =sort= parameter of [[VarSEARCH][SEARCH]]. * Parameter =reverse=: Reverse the direction of the search result This report also sets a ="UserReports_users"= variable to the number of users found. To retrieve, write =%GET{UserReports_users}%=.
* Set limit = 100 %STARTSECTION{"user_list" disablefixlinks="on"}%%SET{ "UserReports_users" value="0" }%%SET{ "UserReports_%IF{ "defined 'limit'" then="%limit%" else="all" }%_users" value="%SEARCH{ "META:FORM.*[U]serForm%IF{ "defined 'search'" then=";META:FIELD.*value=.*$percntsearch$percnt" }%" web="%USERSWEB%" type="regex" limit="%IF{ "defined 'limit'" then="%limit%" }%" sort="%IF{ "defined 'sort'" then="%sort%" }%" reverse="%IF{ "defined 'reverse'" then="%reverse%" }%" nonoise="on" excludetopic="UserList*, *Template" format="$topic" separator=", " footer="$percntSET{ \"UserReports_users\" value=\"$ntopics\" }$percnt" }%" }%%GET{UserReports_%IF{ "defined 'limit'" then="%limit%" else="all" }%_users}%%ENDSECTION{user_list}% %SET{ "UserReports_5_users" value="%CALCULATE{$LISTTRUNCATE(5, %GET{UserReports_100_users}%)}%" }%
*Usage example:*
%USERREPORT{ action="user_list" search="jane" limit="5" }%
*Sample output:* %BR% %GET{UserReports_5_users}% ---++ Action: profile_picture Show the profile picture image of a user. A default image is returned in case the image is not defined in the Image form field of the user. The output is an =<img />= tag that can be embedded in other tags such as links. * Action "profile_picture": Show the profile picture image of a user. * Parameter =user=: !WikiWord of user, required. * Parameter =width=: Width of image, optional. * Parameter =height=: Height of image, optional. The aspect ratio is preserved unless width and height are specified. If width and height are missing, a height of 100 pixels is used. * Parameter =title=: Title parameter of img tag, optional. *Usage example:*
%USERREPORT{ action="profile_picture" user="%WIKINAME%" height="40" title="%WIKINAME%" }%
%USERREPORT{ action="profile_picture" user="AmandaBoris" height="40" title="AmandaBoris" }%
*Sample output:* %BR% %USERREPORT{ action="profile_picture" user="%WIKINAME%" height="40" title="%WIKINAME%" }% %CALCULATE{$LISTJOIN($sp, $LISTMAP(  $NOP(%)INCLUDE{ "%SYSTEMWEB%.UserReports" section="profile_picture" user="$item" height="40" title="$item" }$NOP(%), %GET{UserReports_5_users}%))}%
%STARTSECTION{"profile_picture"}%%ENDSECTION{"profile_picture"}%
---++ Action: user_sig Show a user signature with profile picture, optionally followed by a date or other text. A default image is shown in case the image is not defined in the Image form field of the user. * Action "user_sig": Show a user signature with profile picture. * Parameter =user=: !WikiWord of user, required. Optionally followed by a date or other text. * Parameter =width=: Width of image, optional. * Parameter =height=: Height of image, optional. The aspect ratio is preserved unless width and height are specified. If width and height are missing, a height of 18 pixels is used. In addition, a USERSIG preferences setting is defined as a shortcut, so that a simple =%USERSIG{%WIKINAME%}%= can be used. *Usage example:*
-- %USERREPORT{ action="user_sig" user="%WIKINAME% - %DATE%" }%

-- %USERSIG{%WIKINAME%}%

-- %USERSIG{%WIKINAME% - %DATE%}%
*Sample output:* %BR% -- %USERREPORT{ action="user_sig" user="%WIKINAME% - %DATE%" }% -- %USERSIG{%WIKINAME%}% -- %USERSIG{%WIKINAME% - %DATE%}%
%STARTSECTION{"user_sig"}%%CALCULATE{$SET(sPos, $FIND( , %user%))$IF($GET(sPos)>0, $SET(sUser, $LEFTSTRING(%user%, $INT($GET(sPos)-1)))$SET(sExtra, $RIGHTSTRING(%user%, $INT($LENGTH(%user%)-$GET(sPos)))), $SET(sUser, %user%)$SET(sExtra,))$SET(sPos, $FIND(., $GET(sUser)))$IF($GET(sPos)>0, $SET(sUser, $RIGHTSTRING($GET(sUser), $INT($LENGTH($GET(sUser))-$GET(sPos)))),)$IF($EXACT($GET(sUserSigStyleSet),),$SET(sUserSigStyleSet, 1))}% [[%USERSWEB%.%CALCULATE{$GET(sUser)}%][ %FORMFIELD{ "FirstName" topic="%USERSWEB%.%CALCULATE{$GET(sUser)}%" default="%SPACEOUT{%CALCULATE{$GET(sUser)}%}%" alttext="%SPACEOUT{%CALCULATE{$GET(sUser)}%}%" }% %FORMFIELD{ "LastName" topic="%USERSWEB%.%CALCULATE{$GET(sUser)}%" }% %CALCULATE{$GET(sExtra)}%]] %ENDSECTION{"user_sig"}%
---++ Action: bubble_sig Show a faded comment bubble and user signature with profile picture, optionally followed by a date or other text. A default image is shown in case the image is not defined in the Image form field of the user. This is used for CommentPlugin signatures. * Action "bubble_sig": Show a user signature with profile picture. * Parameter =user=: !WikiWord of user, required. Optionally followed by a date or other text. In addition, a BUBBLESIG preferences setting is defined as a shortcut, so that a simple =%BUBBLESIG{%WIKINAME%}%= can be used. *Usage example:*
Test comment using USERREPORT

-- %USERREPORT{ action="bubble_sig" user="%WIKINAME% - %DATE%" }%

Test comment using BUBBLESIG

-- %BUBBLESIG{%WIKINAME% - %DATE%}%
*Sample output:* %BR% Test comment using USERREPORT -- %USERREPORT{ action="bubble_sig" user="%WIKINAME% - %DATE%" }% Test comment using BUBBLESIG -- %BUBBLESIG{%WIKINAME% - %DATE%}%
%STARTSECTION{"bubble_sig"}%%CALCULATE{$SET(sPos, $FIND( , %user%))$IF($GET(sPos)>0, $SET(sUser, $LEFTSTRING(%user%, $INT($GET(sPos)-1)))$SET(sExtra, $RIGHTSTRING(%user%, $INT($LENGTH(%user%)-$GET(sPos)))), $SET(sUser, %user%)$SET(sExtra,))$SET(sPos, $FIND(., $GET(sUser)))$IF($GET(sPos)>0, $SET(sUser, $RIGHTSTRING($GET(sUser), $INT($LENGTH($GET(sUser))-$GET(sPos)))),)$IF($EXACT($GET(sUserSigStyleSet),),$SET(sUserSigStyleSet, 1))}% [[%USERSWEB%.%CALCULATE{$GET(sUser)}%][ %FORMFIELD{ "FirstName" topic="%USERSWEB%.%CALCULATE{$GET(sUser)}%" default="%SPACEOUT{%CALCULATE{$GET(sUser)}%}%" alttext="%SPACEOUT{%CALCULATE{$GET(sUser)}%}%" }% %FORMFIELD{ "LastName" topic="%USERSWEB%.%CALCULATE{$GET(sUser)}%" }% %CALCULATE{$GET(sExtra)}%]]
%ENDSECTION{"bubble_sig"}%
---++ Action: slim_box
Slim box example
Show slim, one line height user boxes. Several actions are provided: * Action "slim_box_css": Defines the style sheets of the slim boxes. Optionally include it once per page; it is done for you by the "slim_box_start" action if needed. * Action "slim_box_start": Defines the start of a set of slim boxes. * Parameter =style=: Optional, overrides the css of the container div of slim boxes. Default: =padding:0 5px 0 5px; background-color:#f0f0f4;=. * Action "slim_box": Show a single slim box. * Parameter =user=: Specify the !WikiWord of a single user. * Parameter =style=: Optional, overrides the css of the slim box. Default: =float: left; width: 130px; border: solid 1px #d0d0d8; background-color: #f8f8fb;=. * Action "slim_box_list": Show a set of slim boxes. * Parameter =users=: Specify a list of !WikiWords of users. The list may be provided by including the "user_list" action. * Parameter =style=: Optional, same as action "slim_box". * Action "slim_box_end": Defines the end of a set of slim boxes. *Usage example:*
%USERREPORT{ action="slim_box_start" }%
  %USERREPORT{ action="slim_box" user="%WIKINAME%" }%
  %USERREPORT{ action="slim_box" user="JaneSmith" }%
%USERREPORT{ action="slim_box_end" }%
%USERREPORT{ action="slim_box_start" style="background-color: #f0f0e8;" }%
  %USERREPORT{ action="slim_box_list" users="UserOne, UserTwo, UserThree" }%
%USERREPORT{ action="slim_box_end" }%
*Sample output:* %BR% %USERREPORT{ action="slim_box_start" }% %USERREPORT{ action="slim_box" user="%WIKINAME%" }% %USERREPORT{ action="slim_box_list" users="%GET{UserReports_5_users}%" }% %USERREPORT{ action="slim_box_end" }%
%STARTSECTION{slim_box_css}%%SET{ "UserReports_slim_box_css_set" value="1" }%%ENDSECTION{slim_box_css}% %STARTSECTION{slim_box_start}%%IF{ "'%GET{UserReports_slim_box_css_set}%'='1'" else="$percntINCLUDE{ \"%SYSTEMWEB%.UserReports\" section=\"slim_box_css\" }$percnt" }%
%ENDSECTION{slim_box_start}% %STARTSECTION{slim_box_end}%
%ENDSECTION{slim_box_end}% %STARTSECTION{slim_box_list}%%CALCULATE{$LISTJOIN($sp, $LISTMAP($NOP(%)INCLUDE{ "%SYSTEMWEB%.UserReports" section="slim_box" user="$item" }$NOP(%), %users%))}%%ENDSECTION{slim_box_list}% %STARTSECTION{slim_box}%%ENDSECTION{slim_box}%
---++ Action: small_box
Small box example
Show small, two line height user boxes. Several actions are provided: * Action "small_box_css": Defines the style sheets of the small boxes. Optionally include it once per page; it is done for you by the "small_box_start" action if needed. * Action "small_box_start": Defines the start of a set of small boxes. * Parameter =style=: Optional, overrides the css of the container div of small boxes. Default: =padding:0 5px 0 5px; background-color:#f0f0f4;=. * Action "small_box": Show a single small box. * Parameter =user=: Specify the !WikiWord of a single user. * Parameter =style=: Optional, overrides the css of the small box. Default: =float: left; width: 130px; border: solid 1px #d0d0d8; background-color: #f8f8fb;=. * Action "small_box_list": Show a set of small boxes. * Parameter =users=: Specify a list of !WikiWords of users. The list may be provided by including the "user_list" action. * Parameter =style=: Optional, same as action "small_box". * Action "small_box_end": Defines the end of a set of small boxes. *Usage example:*
%USERREPORT{ action="small_box_start" }%
  %USERREPORT{ action="small_box" user="%WIKINAME%" }%
  %USERREPORT{ action="small_box" user="JaneSmith" }%
%USERREPORT{ action="small_box_end" }%
%USERREPORT{ action="small_box_start" style="background-color: #f0f0e8;" }%
  %USERREPORT{ action="small_box_list" users="UserOne, UserTwo, UserThree" }%
%USERREPORT{ action="small_box_end" }%
*Sample output:* %BR% %USERREPORT{ action="small_box_start" }% %USERREPORT{ action="small_box" user="%WIKINAME%" }% %USERREPORT{ action="small_box_list" users="%GET{UserReports_5_users}%" }% %USERREPORT{ action="small_box_end" }%
%STARTSECTION{small_box_css}%%SET{ "UserReports_small_box_css_set" value="1" }%%ENDSECTION{small_box_css}% %STARTSECTION{small_box_start}%%IF{ "'%GET{UserReports_small_box_css_set}%'='1'" else="$percntINCLUDE{ \"%SYSTEMWEB%.UserReports\" section=\"small_box_css\" }$percnt" }%
%ENDSECTION{small_box_start}% %STARTSECTION{small_box_end}%
%ENDSECTION{small_box_end}% %STARTSECTION{small_box_list}%%CALCULATE{$LISTJOIN($sp, $LISTMAP($NOP(%)INCLUDE{ "%SYSTEMWEB%.UserReports" section="small_box" user="$item" }$NOP(%), %users%))}%%ENDSECTION{small_box_list}% %STARTSECTION{small_box}%%ENDSECTION{small_box}%
---++ Action: business_card
Business card example
Show users in business card format. Several actions are provided: * Action "business_card_css": Defines the style sheets of the business cards. Optionally include it once per page; it is done for you by the "business_card_start" action if needed. * Action "business_card_start": Defines the start of a set of business cards. * Parameter =style=: Optional, overrides the css of the container div of business cards. Default: =padding:10px 15px 1px 15px; background-color:#f0f0f4;=. * Action "business_card": Show a single business card. * Parameter =user=: Specify the !WikiWord of a single user. * Parameter =style=: Optional, overrides the css of the business card. Default: =float: left; width: 410px; border: solid 1px #d0d0d8; background-color: #fff;=. * Action "business_card_list": Show a set of business cards. * Parameter =users=: Specify a list of !WikiWords of users. The list may be provided by including the "user_list" action. * Parameter =style=: Optional, same as action "business_card". * Action "business_card_end": Defines the end of a set of business cards. *Usage examples:*
%USERREPORT{ action="business_card_start" }%
  %USERREPORT{ action="business_card" user="%WIKINAME%" }%
  %USERREPORT{ action="business_card" user="JaneSmith" }%
%USERREPORT{ action="business_card_end" }%
%USERREPORT{ action="business_card_start" style="background-color: #f0f0e8;" }%
  %USERREPORT{ action="business_card_list" users="UserOne, UserTwo, UserThree" }%
%USERREPORT{ action="business_card_end" }%
*Sample output:* %USERREPORT{ action="business_card_start" style="background-color: #f0f0e8;" }% %USERREPORT{ action="business_card_list" users="%GET{UserReports_5_users}%" }% %USERREPORT{ action="business_card_end" }%
%STARTSECTION{business_card_css}% %SET{ "UserReports_business_card_css_set" value="1" }%%ENDSECTION{business_card_css}% %STARTSECTION{business_card_start}%%IF{ "'%GET{UserReports_business_card_css_set}%'='1'" else="$percntINCLUDE{ \"%SYSTEMWEB%.UserReports\" section=\"business_card_css\" }$percnt" }%
%ENDSECTION{business_card_start}% %STARTSECTION{business_card_end}%
%ENDSECTION{business_card_end}% %STARTSECTION{business_card_list}%%CALCULATE{$LISTJOIN($sp, $LISTMAP($NOP(%)INCLUDE{ "%SYSTEMWEB%.UserReports" section="business_card" user="$item" }$NOP(%), %users%))}%%ENDSECTION{business_card_list}% %STARTSECTION{business_card}%
%FORMFIELD{ "FirstName" topic="%USERSWEB%.%user%" }% %FORMFIELD{ "LastName" topic="%USERSWEB%.%user%" }% %BR% %FORMFIELD{ "Titles" topic="%USERSWEB%.%user%" }%%IF{ "'%FORMFIELD{ "Titles" topic="%USERSWEB%.%user%" }%'!='' AND '%FORMFIELD{ "Department" topic="%USERSWEB%.%user%" }%'!=''" then=', '}% %FORMFIELD{ "Department" topic="%USERSWEB%.%user%" }% %BR% %FORMFIELD{ "Organization" topic="%USERSWEB%.%user%" }%, %FORMFIELD{ "Location" topic="%USERSWEB%.%user%" }%, %FORMFIELD{ "Country" topic="%USERSWEB%.%user%" }% %BR% %ICON{mail}% %FORMFIELD{ "Email" topic="%USERSWEB%.%user%" }% %IF{ "'%FORMFIELD{ "Telephone" topic="%USERSWEB%.%user%" }%'!=''" then='%BR% %ICON{phone}% %FORMFIELD{ "Telephone" topic="%USERSWEB%.%user%" }%' }% %IF{ "'%FORMFIELD{ "Mobile" topic="%USERSWEB%.%user%" }%'!=''" then='%BR% %ICON{mobile}% %FORMFIELD{ "Mobile" topic="%USERSWEB%.%user%" }%' }%
%ENDSECTION{business_card}%
---++ Action: select_one_user Show a selector to pick a user, for use in HTML forms. * Action "select_one_user": Selector to pick a user. * Parameter =name=: Name of form field, required. * Parameter =selected=: !WikiWord name of a user, optional. * Parameter =users=: Specify a list of !WikiWords of users, optional. The list may be provided by including the "user_list" action. All registered users are shown if the parameter is missing. * Parameter =firstoption=: Label of first option, optional. Default: =Select...= * Parameter =firstvalue=: Value of first option, optional. Default: empty value *Usage example:*
<form>
%USERREPORT{ action="select_one_user" name="Owner" selected="%WIKINAME%" }%
</form>
*Sample output:* %BR%
%USERREPORT{ action="select_one_user" name="Owner" selected="%WIKINAME%" users="%GET{UserReports_100_users}%" }%
%STARTSECTION{select_one_user}%%ENDSECTION{select_one_user}%
---++ Action: select_users
Select users example
Show rows of checkboxes to select users, for use in HTML forms. * Action "select_users": Set of checkboxes to select users. * Parameter =name=: Name of form field, required. * Parameter =selected=: List of !WikiWord names indicating the selected users, optional. * Parameter =users=: Specify a list of !WikiWords of users, optional. The list may be provided by including the "user_list" action. All registered users are shown if the parameter is missing. * Parameter =colums=: Define number of columns, optional. Default: =5= * Parameter =style=: Set the css of the container div, optional. Default: =margin: 0; border: 1px solid transparent;= *Usage example:*
<form>
%USERREPORT{ action="select_users" name="Members" selected="%WIKINAME%, AmandaBoris" }%
</form>
*Sample output:* %BR%
%USERREPORT{ action="select_users" name="Members" selected="%WIKINAME%, AmandaBoris" users="%GET{UserReports_100_users}%" style="background-color: #f0f0f4;" }%
%STARTSECTION{select_users}% %IF{ "defined 'users'" then="$percntSET{ \"UserReports_the_users\" value=\"%users%\" }$percnt" else="%IF{ "'%GET{UserReports_all_users}%'=''" then="$percntSET{ \"UserReports_all_users\" value=\"$percntINCLUDE{ $quot%SYSTEMWEB%.UserReports$quot section=$quotuser_list$quot }$percnt\" }$percnt" }%$percntSET{ \"UserReports_the_users\" value=\"%GET{UserReports_all_users}%\" }$percnt" }%
%CALCULATE{$SET(selected_sp, $LISTJOIN($sp, %selected%))$SET(rows, $INT($EVAL(0.99999+$MAX(1, $LISTSIZE(%GET{UserReports_the_users}%))/%IF{ "defined 'columns'" then="%columns%" else="5" }%))) $LISTJOIN($sp, $LISTMAP(
$IF($MOD($index, $GET(rows)), ,
), %GET{UserReports_the_users}%))}%
%ENDSECTION{select_users}%
__Note to Maintainer:__ * This topic has user report sections intended for TWiki application developers. * This topic uses more user friendly ParameterizedVariables =%USERREPORT{ action="foo" ... }%= instead of the more verbose parameterized include =%INCLUDE{ "%SYSTEMWEB%.UserReports" section="foo" ... }%=. * If you add a section to this topic, or add a parameter to a section, make sure to keep the parameterized variables settings in TWikiPreferences#ParameterizedVariables in sync. %INCLUDE{%USERSWEB%.UserListHeader}%, VarUSERREPORT, TWikiUserMappingContrib -- TWiki:Main.PeterThoeny - 2014-10-04 %META:FILEATTACHMENT{name="business-card-example.png" attachment="business-card-example.png" attr="h" comment="" date="1338678337" path="business-card-example.png" size="42890" user="TWikiContributor" version="1"}% %META:FILEATTACHMENT{name="faded-bubble.png" attachment="faded-bubble.png" attr="h" comment="Faded bubble for BUBBLESIG comments" date="1360196652" path="faded-bubble.png" size="12985" user="TWikiContributor" version="1"}% %META:FILEATTACHMENT{name="small-box-example.png" attachment="small-box-example.png" attr="h" comment="" date="1343433327" path="small-box-example.png" size="28290" user="TWikiContributor" version="2"}% %META:FILEATTACHMENT{name="slim-box-example.png" attachment="slim-box-example.png" attr="h" comment="" date="1343432567" path="slim-box-example.png" size="16868" user="TWikiContributor" version="1"}% %META:FILEATTACHMENT{name="select-users-example.png" attachment="select-users-example.png" attr="h" comment="" date="1343446655" path="select-users-example.png" size="30862" user="TWikiContributor" version="1"}%