topic field backend
%STARTSECTION{"select2::topic"}%<literal>
%DBQUERY{
"%IF{
"defined form"
then="form=~'\b%URLPARAM{"form"}%\b' AND "
}%%IF{
"defined topicType"
then="(TopicType=~'\b%URLPARAM{"topicType"}%\b' OR @Target.TopicType=~'\b%URLPARAM{"topicType"}%\b') AND "
}%%FORMATLIST{
"%IF{
"'%URLPARAM{"q"}%'=''"
then="."
else="%URLPARAM{"q"}%"
}%"
split="\s+"
format="lc(%URLPARAM{"property" default="topictitle"}%)=~lc('$1')" separator=" AND "
}%"
web="%URLPARAM{"baseWeb"}%"
skip="%CALCULATE{"$EVAL(%URLPARAM{"limit" default="10"}%*(%URLPARAM{"page" default="1"}%-1))"}%"
limit="%URLPARAM{"limit" default="10"}%"
format=" {
\"id\":\"$topic\",
\"text\":\"$expand(topictitle)\"
$percntATTACHMENTS{\"$web.$topic\"
name=\".*\.(jpe?g|gif|png|JE?PG|GIF|PNG)\"
warn=\"off\"
limit=\"1\"
sort=\"comment:name\"
hidenull=\"off\"
format=\", \\"thumbnail\\":\\"%SCRIPTURLPATH{"rest"}%/ImagePlugin/resize?topic=$web.$topic&file=$dollarname&size=32x32>&crop=west\\"\"
DIS_nullformat=\"%SCRIPTURLPATH{"rest"}%/ImagePlugin/resize?topic=%SYSTEMWEB%.MetaCommentPlugin&file=nobody.gif&size=32x32>\"
}$percnt
}"
separator=",$n"
header="{\"results\":[$n"
footer="$n], \"total\":$count}"
}%</literal>%ENDSECTION{"select2::topic"}%
user field backend
%STARTSECTION{"select2::user"}%<literal>%DBQUERY{
"form=~'^(%IF{
"defined form"
then="%URLPARAM{"form"}%"
else=".*UserForm"
}%)$' AND %FORMATLIST{
"%IF{
"'%URLPARAM{"q"}%'=''"
then="."
else="%URLPARAM{"q"}%"
}%"
split="\s+"
format="lc(%URLPARAM{"property" default="topictitle"}%)=~lc('$1')" separator=" AND "
}%"
web="%USERSWEB%"
skip="%CALCULATE{"$EVAL(%URLPARAM{"limit" default="10"}%*(%URLPARAM{"page" default="1"}%-1))"}%"
limit="%URLPARAM{"limit" default="10"}%"
format=" {
\"id\":\"$topic\",
\"text\":\"$expand(topictitle)\",
\"thumbnail\":\"$percntATTACHMENTS{\"$web.$topic\"
name=\".*\.(jpe?g|gif|png|JE?PG|GIF|PNG)\"
warn=\"off\"
limit=\"1\"
sort=\"comment:name\"
hidenull=\"off\"
format=\"%SCRIPTURLPATH{"rest"}%/ImagePlugin/resize?topic=$web.$topic&file=$dollarname&size=32x32>\"
nullformat=\"%SCRIPTURLPATH{"rest"}%/ImagePlugin/resize?topic=%SYSTEMWEB%.MetaCommentPlugin&file=nobody.gif&size=32x32>&crop=west\"
}$percnt\"
}"
separator=",$n"
header="{\"results\":[$n"
footer="$n], \"total\":$count}"
}%</literal>%ENDSECTION{"select2::user"}%