<
From version < 19.1 >
edited by Thomas Mortagne
on 2012/04/04
To version < 20.1 >
edited by Marius Dumitru Florea
on 2012/04/04
>
Change comment: There is no comment for this version

Summary

Details

Page properties
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.ThomasMortagne
1 +XWiki.mflorea
Content
... ... @@ -41,8 +41,49 @@
41 41  
42 42  == New Velocity tool to serialize Java objects to JSON format ==
43 43  
44 -{{todo/}}
44 +We introduced a new Velocity tool to be able to serialize Java objects to the JSON format. Checkout the [[documentation>>doc:extensions:Extension.Velocity Module||anchor="HJSONTool"]]. Here's an example that shows how to serialize a Map object:
45 45  
46 +{{code}}
47 +{{velocity}}
48 +#set($map = {'name': 'xwiki', 'values': [1, 2, 3], 'enabled': true})
49 +$jsontool.serialize($map)
50 +{{/velocity}}
51 +{{/code}}
52 +
53 +The result is:
54 +
55 +{{code language="none"}}
56 +{"name":"xwiki","values":[1,2,3],"enabled":true}
57 +{{/code}}
58 +
59 +We also refactored ##XWiki.LiveTableResultsMacros## page to generate the live table JSON in memory using a Map, which is serialized in the end using the new JSON tool. This makes it easier to customize the live table JSON. For example this is how the JSON for the AppWithinMinutes applications live table is generated:
60 +
61 +{{code}}
62 +{{include document="XWiki.LiveTableResultsMacros" /}}
63 +
64 +{{velocity}}
65 +#if($xcontext.action == 'get' && "$!{request.outputSyntax}" == 'plain')
66 + $response.setContentType('application/json')
67 + #set($map = {})
68 + #gridresult_buildJSON("$!request.classname" $request.collist.split(',') $map)
69 + ## Change the URL and permission for the edit and delete actions:
70 + ## * edit action must trigger the AppWithinMinutes wizard.
71 + ## * delete action must delete the application space.
72 + #foreach($row in $map.get('rows'))
73 + #set($editQueryString = "appName=$escapetool.url($row.get('doc_space'))")
74 + #set($discard = $row.put('doc_edit_url', $xwiki.getURL('AppWithinMinutes.CreateApplication', 'view', $editQueryString)))
75 + #if($row.get('doc_hasdelete'))
76 + ## Deleting an application requires space administration rights.
77 + #set($discard = $row.put('doc_hasdelete', $xwiki.hasAccessLevel('admin', $xcontext.user, "${row.get('doc_space')}.WebPreferences")))
78 + #end
79 + #set($rowDocRef = $services.model.createDocumentReference($row.get('doc_wiki'), $row.get('doc_space'), $row.get('doc_name')))
80 + #set($discard = $row.put('doc_delete_url', $xwiki.getURL($rowDocRef, 'deletespace', '')))
81 + #end
82 + $jsontool.serialize($map)
83 +#end
84 +{{/velocity}}
85 +{{/code}}
86 +
46 46  == ColorThemes gradients customizable from ColorTheme Wizard ==
47 47  
48 48  In version [[3.4>>xwiki:ReleaseNotes.ReleaseNotesXWikiEnterprise34]] we deprecated the old default bundled ColorThemes (because of incompatible variable mix). In version 4.0 this is no longer the case, old default bundled ColorThemes (like [[Bordo>>extensions:Extension.Bordo ColorTheme]], [[Nature>>extensions:Extension.Nature ColorTheme]], etc.) are now being compatible with the 3.4 Colibri Skin changes. We fixed this by adding new gradient ColorThemes variables. All these gradient ColorTheme variables are now changeble from the ColorTheme Wizard.

Get Connected