| ... |
... |
@@ -1,81 +1,10 @@ |
| 1 |
|
-{{velocity output="false"}} |
|
1 |
+{{velocity filter="indent" wiki="false"}} |
| 2 |
2 |
$response.setContentType('application/json') |
| 3 |
3 |
#set($query = $services.query.xwql("from doc.object(Collaboratory.Apps.Membership.MembershipRequest.Code.MembershipRequestClass) as requests")) |
| 4 |
4 |
#set($memberships = $query.execute()) |
|
5 |
+#set($map = {}) |
|
6 |
+#set($rows = []) |
|
7 |
+#set($ok = $rows.add("toto")) |
|
8 |
+$jsontool.serialize(${rows}) |
| 5 |
5 |
{{/velocity}} |
| 6 |
|
-{{velocity wiki="false"}} |
| 7 |
|
-{ |
| 8 |
|
- "row": [ |
| 9 |
|
- ##foreach($membershipDoc of $memberships) |
| 10 |
|
- ##set($m = $xwiki.getDocument($membershipDoc)) |
| 11 |
|
- ##{ |
| 12 |
|
- ##hello: "world" |
| 13 |
|
- ##"title": "$m.title", |
| 14 |
|
- ##"target": "$m.target", |
| 15 |
|
- ##username: '$m.username', |
| 16 |
|
- ##"status": "$m.status", |
| 17 |
|
- ##"date": "$m.date" |
| 18 |
|
- ##}#if( $foreach.hasNext ), #end |
| 19 |
|
- ##end |
| 20 |
|
- ] |
| 21 |
|
-} |
| 22 |
|
-{{/velocity}} |
| 23 |
|
-{{velocity wiki="false"}} |
| 24 |
|
-#if("$!{request.xpage}" == 'plain') |
| 25 |
|
- $response.setContentType('application/json') |
| 26 |
|
-#end |
| 27 |
|
-##============================== |
| 28 |
|
-## Offset = item # at which to start displaying data |
| 29 |
|
-##============================== |
| 30 |
|
-#set($offset = $numbertool.toNumber($request.get('offset'))) |
| 31 |
|
-## offset starts from 0 in velocity and 1 in javascript |
| 32 |
|
-#set($offset = $offset - 1) |
| 33 |
|
-#if($offset < 0) |
| 34 |
|
- #set($offset = 0) |
| 35 |
|
-#end |
| 36 |
|
-##================== |
| 37 |
|
-## Limit = # of items to display |
| 38 |
|
-##================== |
| 39 |
|
-#set($limit = $numbertool.toNumber($request.get('limit'))) |
| 40 |
|
-##================== |
| 41 |
|
-## Tag = one parameter per tag |
| 42 |
|
-##================== |
| 43 |
|
-#if($request.tag) |
| 44 |
|
- #foreach($tag in $request.getParameterValues('tag')) |
| 45 |
|
- ## TODO: Add code to filter items based on the selected tags |
| 46 |
|
- #end |
| 47 |
|
-#end |
| 48 |
|
-##========== |
| 49 |
|
-## Sort direction |
| 50 |
|
-##========== |
| 51 |
|
-#set($order = "$!request.sort") |
| 52 |
|
-#if($order != '') |
| 53 |
|
- #set($orderDirection = "$!{request.get('dir').toLowerCase()}") |
| 54 |
|
- #if("$!orderDirection" != '' && "$!orderDirection" != 'asc') |
| 55 |
|
- #set($orderDirection = 'desc') |
| 56 |
|
- #end |
| 57 |
|
-#end |
| 58 |
|
-## =========== |
| 59 |
|
-## Filter Data here... |
| 60 |
|
-## =========== |
| 61 |
|
-## TODO: Add code to filter data |
| 62 |
|
-## Each column can be filtered and the filter for a column can be retrieved with: |
| 63 |
|
-## #set($filterValue = "$!{request.get(<columnname>)}") |
| 64 |
64 |
|
| 65 |
|
-## === |
| 66 |
|
-## JSON |
| 67 |
|
-## === |
| 68 |
|
-{ |
| 69 |
|
-"totalrows": 1, |
| 70 |
|
-"matchingtags": {}, |
| 71 |
|
-"tags" : [], |
| 72 |
|
-"returnedrows": 1, |
| 73 |
|
-"offset": 1, |
| 74 |
|
-"reqNo": $util.parseInt($request.reqNo), |
| 75 |
|
-"rows": [{ |
| 76 |
|
- "doc_viewable" : true, |
| 77 |
|
- "user" : "vincent", |
| 78 |
|
- "message" : "my message" |
| 79 |
|
-}] |
| 80 |
|
-} |
| 81 |
|
-{{/velocity}} |