wiki:TracQuery

Trac Ticket Queries

In addition to reports, Trac provides support for custom ticket queries, used to display lists of tickets meeting a specified set of criteria.

To configure and execute a custom query, switch to the View Tickets module from the navigation bar, and select the Custom Query link.

Filters

When you first go to the query page the default filter will display tickets relevant to you:

  • If logged in then all open tickets it will display open tickets assigned to you.
  • If not logged in but you have specified a name or email address in the preferences then it will display all open tickets where your email (or name if email not defined) is in the CC list.
  • If not logged and no name/email defined in the preferences then all open issues are displayed.

Current filters can be removed by clicking the button to the left with the minus sign on the label. New filters are added from the pulldown lists at the bottom corners of the filters box ('And' conditions on the left, 'Or' conditions on the right). Filters with either a text box or a pulldown menu of options can be added multiple times to perform an or of the criteria.

You can use the fields just below the filters box to group the results based on a field, or display the full description for each ticket.

Once you've edited your filters click the Update button to refresh your results.

Clicking on one of the query results will take you to that ticket. You can navigate through the results by clicking the Next Ticket or Previous Ticket links just below the main menu bar, or click the Back to Query link to return to the query page.

You can safely edit any of the tickets and continue to navigate through the results using the Next/Previous/Back to Query links after saving your results. When you return to the query any tickets which were edited will be displayed with italicized text. If one of the tickets was edited such that it no longer matches the query criteria the text will also be greyed. Lastly, if a new ticket matching the query criteria has been created, it will be shown in bold.

The query results can be refreshed and cleared of these status indicators by clicking the Update button again.

Saving Queries

Trac allows you to save the query as a named query accessible from the reports module. To save a query ensure that you have Updated the view and then click the Save query button displayed beneath the results. You can also save references to queries in Wiki content, as described below.

Note: one way to easily build queries like the ones below, you can build and test the queries in the Custom report module and when ready - click Save query. This will build the query string for you. All you need to do is remove the extra line breaks.

You may want to save some queries so that you can come back to them later. You can do this by making a link to the query from any Wiki page.

[query:status=new|assigned|reopened&version=1.0 Active tickets against 1.0]

Which is displayed as:

Active tickets against 1.0

This uses a very simple query language to specify the criteria (see Query Language).

Alternatively, you can copy the query string of a query and paste that into the Wiki link, including the leading ? character:

[query:?status=new&status=assigned&status=reopened&group=owner Assigned tickets by owner]

Which is displayed as:

Assigned tickets by owner

Using the [[TicketQuery]] Macro

The  TicketQuery macro lets you display lists of tickets matching certain criteria anywhere you can use WikiFormatting.

Example:

[[TicketQuery(version=0.6|0.7&resolution=duplicate)]]

This is displayed as:

No results

Just like the query: wiki links, the parameter of this macro expects a query string formatted according to the rules of the simple ticket query language.

A more compact representation without the ticket summaries is also available:

[[TicketQuery(version=0.6|0.7&resolution=duplicate, compact)]]

This is displayed as:

No results

Finally, if you wish to receive only the number of defects that match the query, use the count parameter.

[[TicketQuery(version=0.6|0.7&resolution=duplicate, count)]]

This is displayed as:

0

Customizing the table format

You can also customize the columns displayed in the table format (format=table) by using col=<field> - you can specify multiple fields and what order they are displayed by placing pipes (|) between the columns like below:

[[TicketQuery(max=3,status=closed,order=id,desc=1,format=table,col=resolution|summary|owner|reporter)]]

This is displayed as:

Results (1 - 3 of 372)

Ticket Resolution Summary Owner Reporter
#375 已处理 家居网论坛新功能需求BBS7.2.2 dingjianyong liweiling
#374 已处理 汽车、家居、电脑、亲子论坛活动帖优化需求 dingjianyong liweiling
#373 已处理 亲子、家居、电脑网图片贴需求修正 dingjianyong luohuimin

Full rows

In table format you can also have full rows by using rows=<field> like below:

[[TicketQuery(max=3,status=closed,order=id,desc=1,format=table,col=resolution|summary|owner|reporter,rows=description)]]

This is displayed as:

Results (1 - 3 of 372)

Ticket Resolution Summary Owner Reporter
#375 已处理 家居网论坛新功能需求BBS7.2.2 dingjianyong liweiling

Reported by liweiling, 10 years ago.

Description

一、需求概述 1、wap端图片回帖 2、pc端扫码传图 3、后台功能优化:报表(增加来源区分)、用户管理(增加用户角色查询等)

二、项目排期 http://img.pchouse.com.cn/images/upload/upc/tx/housebbs6/1603/16/c4/19271985_1458119580177_1024x1024.png 设计稿: http://192.168.50.176/2016.2/house-BBS7.2.2/house01.html 制作稿: 测试地址:

三、需求详细内容 1、wap图片回帖

Wap端帖子页回帖功能增加可插入图片,即回帖内容可以包括:文字内容、插入图片(拍照、照片图库)、插入表情。表情可插入到文字当中,图片只能插入到回帖文字内容后面。

##图片要求说明: 1)每张图片大小不超过5M 2)支持jpg.jpeg.gif.png格式图片 3)一个帖子回帖插入图片数量不超过10张

##插入图片回帖操作: 1)点击图片图标弹出手机自带的照片功能(拍照、照片图库、取消) http://img.pchouse.com.cn/images/upload/upc/tx/housebbs6/1603/10/c2/19066305_1457598701760_1024x1024.png

2)选择拍照或选取照片图库照片插入图片后效果 http://img.pchouse.com.cn/images/upload/upc/tx/housebbs6/1603/10/c2/19066342_1457598703012_1024x1024.png

3)点击图片右上角可删除图片,点击+号或插入图片图标,均可继续插入图片 http://img.pchouse.com.cn/images/upload/upc/tx/housebbs6/1603/10/c2/19066306_1457598703775_1024x1024.png

2、pc端扫码传图

pc端发帖页,图片上传增加扫码传图功能,可快速上传手机相册照片到pc端进行回帖。

##扫码传图操作: 1)pc端发帖页二维码效果 http://img.pchouse.com.cn/images/upload/upc/tx/housebbs6/1603/10/c0/19051521_1457580639050_1024x1024.png

2)扫码后wap端界面 http://img.pchouse.com.cn/images/upload/upc/tx/housebbs6/1603/10/c0/19051528_1457580642944_1024x1024.png

3)点击传图,可进行拍照或录像、选取现有的、取消 http://img.pchouse.com.cn/images/upload/upc/tx/housebbs6/1603/10/c0/19051553_1457580651405_1024x1024.png

4)上传后wap端效果,可删除已上传图片,可继续点击传图 http://img.pchouse.com.cn/images/upload/upc/tx/housebbs6/1603/10/c0/19051562_1457580652233_1024x1024.png

5)上传完之后,点击同步到PC版,上传成功提示 http://img.pchouse.com.cn/images/upload/upc/tx/housebbs6/1603/10/c0/19051558_1457580658942_1024x1024.png

6)扫码传图同步到pc端效果,也可再次扫码继续传图 http://img.pchouse.com.cn/images/upload/upc/tx/housebbs6/1603/10/c0/19051565_1457580660003_1024x1024.png

3、后台功能优化:报表(增加来源区分)、用户管理(增加用户角色查询等) 1)报表功能,增加来源区分:pc端、wap端、家居杂志ios版、家居杂志Android版。 以下7项统计增加来源区分统计。 http://img.pchouse.com.cn/images/upload/upc/tx/housebbs6/1603/10/c0/19052086_1457581264014_1024x1024.png

2)用户管理-用户角色及管理, 查询条件:用户ID、用户名、管理角色、对应版块 用户列表:序号 用户ID 用户名 会员角色 积分/贡献 管理角色-对应版块 操作:积分调整、管理角色设置 http://img.pchouse.com.cn/images/upload/upc/tx/housebbs6/1603/10/c0/19052103_1457581265721_1024x1024.png

积分调整: http://img.pchouse.com.cn/images/upload/upc/tx/housebbs6/1603/10/c1/19052088_1457581266554_1024x1024.png

用户管理角色设置: http://img.pchouse.com.cn/images/upload/upc/tx/housebbs6/1603/10/c1/19052104_1457581269552_1024x1024.png

#374 已处理 汽车、家居、电脑、亲子论坛活动帖优化需求 dingjianyong liweiling

Reported by liweiling, 10 years ago.

Description

一、主要优化概述 1、流程优化:审核、评奖流程合并 2、流程优化:获奖后填收货地址改为报名时填写 3、增加功能:审核列表增加检索功能,可根据查询条件导出数据 4、导出报表优化:所在城市、收货地址两个字段信息合并为一列 5、移动端Wap、App提交报名表单对应优化(亲子网新增此功能)

排期 http://img.pcbaby.com.cn/images/upload/upc/tx/kidsbbs6/1511/17/c6/15360517_1447750826593_1024x1024.jpg

制作稿: 汽车网  http://zzsvn.pcauto.com.cn/svn/pcauto/pc/2015/bbs/20151110-hdyh/shenhe.html# 家居网  http://zztest.pcauto.com.cn/svn/pchouse/pc/2015/bbs/20151110-hdyh/shenhe.html 电脑网  http://192.168.51.163/ztztztztzt/pc/20151123pclonlinebbshd/index.html 电脑网wap  http://192.168.51.106/ztztztztzt/pc/20151123pclonlinebbshd/wap.html 亲子网  http://zzb.pcauto.com.cn/tools/gongdan/plan.php?id=159

设计稿: 亲子网  http://192.168.50.231/2014/2015.11.24/02.html


活动帖优化详细内容 1、发帖页 活动信息填写保持不变 ‘活动奖品’改为可更改,不可更改文案删除 http://img.pcbaby.com.cn/images/upload/upc/tx/kidsbbs6/1511/18/c8/15404150_1447835060851_1024x1024.png

2、帖子页-报名 #根据活动帖是否含有‘活动奖品’判断,决定报名需填写信息

有‘活动奖品’----‘所在城市’改为必填项,在其后增加必填项‘收货地址’ 无‘活动奖品’----删除‘所在城市’

#增加QQ为非必填项(管理数据在导出报表显示,审核列表考虑显示宽度暂不露出) #移动端Wap、App提交报名表单对应修改

汽车网 wap、app 电脑网 wap、app 家居网 wap 亲子网 新增wap、app活动帖报名功能

http://img.pcbaby.com.cn/images/upload/upc/tx/kidsbbs6/1511/18/c8/15404271_1447835223813_1024x1024.png 有活动奖品报名填写信息

#增加收货地址确认提示: 从用户体验角度考虑,减少弹出窗口,直接修改填写框的默认提示即可,‘填写详细收货地址’改为‘收货地址请仔细填写,确保可送达’。 #增加记录用户收货地址功能:

记录用户参加活动报名填写的所在城市、收货地址,再次报名时默认显示上一次提交的所在城市、收货地址,可修改。

http://img.pcbaby.com.cn/images/upload/upc/tx/kidsbbs6/1511/18/c8/15404510_1447835358775_1024x1024.png 无活动奖品报名填写信息

3、普通用户查看报名获奖信息 普通用户 http://img.pcbaby.com.cn/images/upload/upc/tx/kidsbbs6/1511/18/c8/15404589_1447835444117_1024x1024.png

【报名人数】查看,与原来一致,表单标题统一为‘活动报名名单’ http://img.pcbaby.com.cn/images/upload/upc/tx/kidsbbs6/1511/25/c1/15675606_1448418384711_1024x1024.png

2015/12/08 报名信息列表显示字段修改为: 电脑网 pc:申请者、报名时间、状态 wap/app:申请者、状态

家居网 pc:申请者、参与人数、报名时间、状态 wap:申请者、人数

亲子网 pc:申请者、参与人数、报名时间、状态 wap/app:申请者、状态

【审核人数/获奖人数】 根据活动是否有活动奖品判断: 有活动奖品显示为【获奖人数】 点击查看,可查看详细名单

活动审核通过名单 申请者(不加密显示)、获得奖项 http://img.pcbaby.com.cn/images/upload/upc/tx/kidsbbs6/1511/18/c8/15404750_1447835570888_1024x1024.png

无活动奖品显示为【审核人数】 点击查看,可查看详细名单 活动审核通过名单 申请者(不加密显示) http://img.pcbaby.com.cn/images/upload/upc/tx/kidsbbs6/1511/18/c8/15404879_1447835649324_1024x1024.png

4、管理员审核--报名人数下‘查看’(原查看、审核、评奖、导出功能合并入口) 管理员 http://img.pcbaby.com.cn/images/upload/upc/tx/kidsbbs6/1511/25/c1/15676161_1448418774677_1024x1024.png

电脑网需求:审核列表改为一页显示10条数据。

进入审核列表 #操作: 查询(条件:申请者、真实姓名、电话、报名时间、状态[全部、未审核、审核通过、审核不通过]、获得奖项) 导出(可根据查询条件导出数据报表) 批准(审核通过,有活动奖品的直接弹出评奖,支持批量操作,批量只能评为获得同一奖项) 拒绝(审核不通过) 删除(删除记录) 修改(真实姓名、电话、所在城市、收货地址) http://img.pcbaby.com.cn/images/upload/upc/tx/kidsbbs6/1511/25/c1/15673652_1448417019130_1024x1024.png

#获奖系统通知消息: 恭喜您在“xxx”获得奖品oooo ,如收货信息有误请于24小时内与 YYY 联系,以便我们及时为您派奖。”

汽车网:PCauto活动公告 添加链接: http://my.pcauto.com.cn/24573236 家居网:花花 添加链接: http://my.pchouse.com.cn/32499485 电脑网:版主 (各论坛版块分开管理,没有统一负责的,所以与版主联系即可,不用添加链接) 亲子网:活动负责小编或版主 (不用添加链接)

#导出报表 http://img.pcbaby.com.cn/images/upload/upc/tx/kidsbbs6/1511/25/c1/15673285_1448416782883_1024x1024.png 改为: http://img.pcbaby.com.cn/images/upload/upc/tx/kidsbbs6/1511/25/c1/15673176_1448416783779_1024x1024.png

#发表者报名默认审核通过取消 活动发表者自己报名参加活动,原流程是默认审核通过的,新流程取消,默认为未审核状态。

5、发奖 审核评奖后, 工作人员进入活动订单系统进行发货 用户进入个人中心-我的论坛-我的奖品进行查看订单、确认收货 与原有流程一致。


补充:报名状态-系统通知消息-旧数据兼容

#报名状态 http://img.pcbaby.com.cn/images/upload/upc/tx/kidsbbs6/1511/18/c9/15405591_1447836180171_1024x1024.png 修改为:

不论活动是否结束,只要审核通过就按以下显示:

无活动奖品:【活动申请已通过】 有活动奖品:获积分奖品【已中奖XX积分】

获实物奖品【已中奖品:XXX,详细信息可在个人中心查看】

#报名信息查看权限 未登录状态:只能看到报名人数、审核人数,没有查看权限。 登录状态:

普通用户,报名人数-查看权限,审核人数-查看。 管理员,报名人数-管理审核权限,审核人数-查看。

#系统通知消息 旧流程: http://img.pcbaby.com.cn/images/upload/upc/tx/kidsbbs6/1511/18/c9/15405993_1447836502422_1024x1024.png

新流程: http://img.pcbaby.com.cn/images/upload/upc/tx/kidsbbs6/1511/18/c9/15405975_1447836501651_1024x1024.png

#旧数据兼容 1、状态 未审核----未审核 已审核----状态都显示为审核通过,旧数据管理员可进行批准评奖。 无奖品活动,审核通过 有奖品活动,新流程上线前,提醒编辑操作:活动还没结束,不要对报名信息进行审核,如已审核请直接评奖。 已拒绝----审核不通过 已获奖----审核通过

2、流程处理 正在进行的活动,已获奖,但用户未填写收货地址。新流程上线后,没有入口给用户进行填写地址,只能让编辑通过其他方式联系用户提供。

#373 已处理 亲子、家居、电脑网图片贴需求修正 dingjianyong luohuimin

Reported by luohuimin, 11 years ago.

Description

框架: http://192.168.50.132/luohuimin/pcgroup-picture/ 设计稿: http://192.168.50.88/2015_zym/1009/pcbaby.html 制作稿:待定 美图flash:  http://www1.pcbaby.com.cn/flash/150804/meitu/qinzi_840X620_llx.swf(亲子)、  http://www1.pchouse.com.cn/flash/150901/jjwmt/840X620_llx.swf(家居)、  http://www1.pconline.com.cn/flash/150901/dnwmt/840X620_llx.swf(电脑

排期: http://img.pcbaby.com.cn/images/upload/upc/tx/kidsbbs6/1509/24/c2/13121454_1443073973560_1024x1024.jpg


一、发帖页: 1、发帖页--页面展示: 1)图片贴作为一种新的帖子类型呈现; 2)编辑器上传图片外链功能隐藏; 3)编辑器编辑源码功能仅开放给管理员权限用户; 4)编辑器右侧显示图片上传区域 5)编辑器下方新增图片模块(一个图片模块由一张图片、一个文本输入框、一个关闭按钮组成); 6)图片模块仅在网友已上传并点选图片时显示,帖子无图时隐藏图片模块。 7)图片模块中,有“美化图片”按钮。 8)图片模块中,文本输入框内,有提示文案:“请在此输入200字内的图片描述...”(图片描述改为非必填项)

2、发帖流程: 1)网友进入图片贴发帖页,以正常流程输入帖子标题、选择分类、输入帖子正文(编辑器)。 2)点击图片上传区域中的“从电脑中选图片”按钮,从目录里选择单张或多张图片上传 http://img.pcbaby.com.cn/images/upload/upc/tx/kidsbbs6/1507/15/c2/9793975_1436933676970_1024x1024.png 3)上传成功的图片,显示在右侧“图片上传”区域中。 http://img.pcbaby.com.cn/images/upload/upc/tx/kidsbbs6/1509/08/c1/12322247_1441678962939_1024x1024.png 3)点选区域图片,则在左侧编辑器下方,对应新增一图片模块,网友可在图片模块里编辑图片、输入图片描述、以及上下拖动模块以调整模块顺序。 http://img.pcbaby.com.cn/images/upload/upc/tx/kidsbbs6/1509/08/c1/12326293_1441681583607_1024x1024.png 4)整理好帖子后,点击“发表帖子”发布。

3、补充说明: 1)“上传图片”区域内: ---鼠标指向图片时,显示“删除”按钮 ---点击“删除”按钮则删除该张图片(此功能仅为删除右侧“上传图片”区域内的图片,并不影响已插入正文的图片。比如,图a已经加载到帖子里,则在“上传图片”区域里删除图a,后,帖子里的图a并不会一并删除) 2)左侧编辑器下方的帖子图片模块: ---鼠标长按并上下拖动图片模块时,可调换模块位置,但帖子正文(编辑器)位置固定在最顶不变。(帖子正文在前、所有图片模块在后)指针指向图片+描述模块时,指针改为十字形,以便网友知悉模块可拖动。 ---图片模块固定显示“美化图片”提示,点击图片后,弹出图片编辑框。 ---编辑图片新增旋转、裁剪功能 旋转:左转90°、右转90°、水平翻转、垂直翻转 裁剪:自由裁剪、固定裁剪1:1、4:3、3:4 (可以上下左右调整裁剪区域,可取消或完成,显示宽高) ---当网友美化图片并保存后,图片模块中的缩略图也实时更新。(但优化不影响右侧“图片上传”区域内的图片缩略图) ---图片模块右上角有删除按钮,点击后可删除整个图片模块。(但不会影响右侧“图片上传”区域内的图片)

3、注: 1)图片贴发帖权限,后台归入到“用户”-“普通权限”的配置中,上线时默认对普通网友开放,各网可根据运营需要自行修改权限配置。 2)图片描述字数,限制在每张图片200字内。 3)对同一个帖子内的图片,上传数量不作限制。 4)对图片贴内的图片大小尺寸控制,与普通贴的图片保持一致。 5)图片编辑:在电脑网图片编辑功能的基础上,增加马赛克功能;并优化文字工具功能(在文字编辑的状态下,可更改已输入的文字颜色及大小)

二、帖子页: 1、页面展示: 1)帖子内容显示顺序:正文--图片1及图片1描述--图片2及图片2描述...以此类推 2)图片及其图片描述,合拼为一整体模块,显示在帖子页当中: http://img.pcbaby.com.cn/images/upload/upc/tx/kidsbbs6/1507/30/c4/10440359_1438239138179_1024x1024.png

三、列表页 1、帖子类型筛选,增加“图片贴”筛选项 http://img.pcbaby.com.cn/images/upload/upc/tx/kidsbbs6/1507/23/c5/10139665_1437643225931_1024x1024.png 2、发帖类型选项,增加“图片贴”发帖项 http://img.pcbaby.com.cn/images/upload/upc/tx/kidsbbs6/1507/23/c5/10139639_1437643224824_1024x1024.png 3、贴子类型icon,增加图片贴icon http://img.pcbaby.com.cn/images/upload/upc/tx/kidsbbs6/1507/23/c5/10139666_1437643229573_1024x1024.png

四、帖子图集: 1、页面展示: 1)图片下方新增图片描述,包含图片页数和图片描述内容 http://img.pcbaby.com.cn/images/upload/upc/tx/kidsbbs6/1507/15/c2/9794016_1436933757574_1024x1024.png 2)图片描述浮层,默认显示两行,若描述内容超过两行,则当网友鼠标指向描述框时,自动向上展开剩余的隐藏部分。

Query Language

query: TracLinks and the [[TicketQuery]] macro both use a mini “query language” for specifying query filters. Basically, the filters are separated by ampersands (&). Each filter then consists of the ticket field name, an operator, and one or more values. More than one value are separated by a pipe (|), meaning that the filter matches any of the values. To include a literal & or | in a value, escape the character with a backslash (\).

The available operators are:

= the field content exactly matches one of the values
~= the field content contains one or more of the values
^= the field content starts with one of the values
$= the field content ends with one of the values

All of these operators can also be negated:

!= the field content matches none of the values
!~= the field content does not contain any of the values
!^= the field content does not start with any of the values
!$= the field content does not end with any of the values

The date fields created and modified can be constrained by using the = operator and specifying a value containing two dates separated by two dots (..). Either end of the date range can be left empty, meaning that the corresponding end of the range is open. The date parser understands a few natural date specifications like "3 weeks ago", "last month" and "now", as well as Bugzilla-style date specifications like "1d", "2w", "3m" or "4y" for 1 day, 2 weeks, 3 months and 4 years, respectively. Spaces in date specifications can be left out to avoid having to quote the query string.

created=2007-01-01..2008-01-01 query tickets created in 2007
created=lastmonth..thismonth query tickets created during the previous month
modified=1weekago.. query tickets that have been modified in the last week
modified=..30daysago query tickets that have been inactive for the last 30 days

See also: TracTickets, TracReports, TracGuide