On 04/07/2010 03:15 PM, lucaa (SVN) wrote:
> Author: lucaa
> Date: 2010-04-07 15:15:44 +0200 (Wed, 07 Apr 2010)
> New Revision: 28168
>
> Modified:
>
> platform/xwiki-applications/trunk/annotations/src/main/resources/AnnotationCode/CreateForm.xml
>
> platform/xwiki-applications/trunk/annotations/src/main/resources/AnnotationCode/Macros.xml
>
> platform/xwiki-applications/trunk/annotations/src/main/resources/AnnotationCode/Script.xml
> Log:
> XAANNOTATIONS-13: URL Decode annotation target before using it in
> AnnotationService
> * Fixed encoding across all annotations js and velocity scripts
>
>
> Modified:
> platform/xwiki-applications/trunk/annotations/src/main/resources/AnnotationCode/CreateForm.xml
> ===================================================================
> ---
> platform/xwiki-applications/trunk/annotations/src/main/resources/AnnotationCode/CreateForm.xml
> 2010-04-07 08:56:02 UTC (rev 28167)
> +++
> platform/xwiki-applications/trunk/annotations/src/main/resources/AnnotationCode/CreateForm.xml
> 2010-04-07 13:15:44 UTC (rev 28168)
> @@ -12,8 +12,8 @@
> <customClass></customClass>
> <contentAuthor>XWiki.Admin</contentAuthor>
> <creationDate>1265236156000</creationDate>
> -<date>1266926719000</date>
> -<contentUpdateDate>1266926719000</contentUpdateDate>
> +<date>1270643626000</date>
> +<contentUpdateDate>1270643626000</contentUpdateDate>
> <version>1.1</version>
> <title></title>
> <template></template>
> @@ -37,9 +37,9 @@
> {{html}}
> ## get create a hashmap with request data about the selection
> #set($annData = $util.hashMap)
> -#set($dispose = $annData.put("selection",
> $util.decodeURI($!request.selection)))
> -#set($dispose = $annData.put("selectionContext",
> $util.decodeURI($!request.selectionContext)))
> -#set($dispose = $annData.put("selectionOffset",
> $util.decodeURI($!request.selectionOffset)))
> +#set($dispose = $annData.put("selection", $!request.selection))
> +#set($dispose = $annData.put("selectionContext", $!request.selectionContext))
> +#set($dispose = $annData.put("selectionOffset", $!request.selectionOffset))
> ## pretend that annotation author is current user, and annotation date is
> now
> ##Even if they get sent to the server, the server will overwrite with
> anything's logged in in there anyway
> #set($dispose = $annData.put("author", $context.user))
>
> Modified:
> platform/xwiki-applications/trunk/annotations/src/main/resources/AnnotationCode/Macros.xml
> ===================================================================
> ---
> platform/xwiki-applications/trunk/annotations/src/main/resources/AnnotationCode/Macros.xml
> 2010-04-07 08:56:02 UTC (rev 28167)
> +++
> platform/xwiki-applications/trunk/annotations/src/main/resources/AnnotationCode/Macros.xml
> 2010-04-07 13:15:44 UTC (rev 28168)
> @@ -12,8 +12,8 @@
> <customClass></customClass>
> <contentAuthor>XWiki.Admin</contentAuthor>
> <creationDate>1264959390000</creationDate>
> -<date>1267569743000</date>
> -<contentUpdateDate>1267569743000</contentUpdateDate>
> +<date>1270643964000</date>
> +<contentUpdateDate>1270643964000</contentUpdateDate>
> <version>1.1</version>
> <title></title>
> <template></template>
> @@ -47,7 +47,7 @@
> *#
> #macro(displayCreateBox $docWiki $docSpace $docPage $annData)
> <div class="annotation-box annotation-box-create">
> -<form method="POST"
> action="/xwiki/rest/wikis/${docWiki}/spaces/${docSpace}/pages/${docPage}/annotations?media=json">
> +<form method="POST"
> action="/xwiki/rest/wikis/${util.encodeURI($docWiki)}/spaces/${util.encodeURI($docSpace)}/pages/${util.encodeURI($docPage)}/annotations?media=json">
> <div class="hidden">
> #foreach($field in $annData.keySet())
> <input type="hidden" name="${field}"
> value="$!{annData.get(${field})}"/>
> @@ -73,7 +73,7 @@
> <div class="annotation-box annotation-box-edit">
> #if($ann)
> ## TODO: fix this url to be generated less hardcoded
> - #set($editURL = "/xwiki/rest/wikis/" + $docWiki + "/spaces/" +
> $docSpace + "/pages/" + $docPage + "/annotation/" + $util.encodeURI($ann.id)
> + "?method=PUT&media=json")
> + #set($editURL = "/xwiki/rest/wikis/" + $$util.encodeURI($docWiki) +
> "/spaces/" + $util.encodeURI($docSpace) + "/pages/" +
> $util.encodeURI($docPage) + "/annotation/" + $util.encodeURI($ann.id) +
> "?method=PUT&media=json")
> <form method='POST' action="${editURL}">
> #displayAnnotation($ann, 'edit')
> #displayAnnotationBoxButtons('edit')
> @@ -174,7 +174,7 @@
> #macro(displayAnnotationToolbox $ann $mode $docWiki $docSpace $docPage)
> <span class="annotationTools">
> #if($mode != 'create'&& $annotations.canEditAnnotation($ann.id,
> $docWiki, $docSpace, $docPage))
> - #set($editURL = "/xwiki/rest/wikis/" + $docWiki + "/spaces/" +
> $docSpace + "/pages/" + $docPage + "/annotation/" + $util.encodeURI($ann.id)
> + "?method=PUT&media=json")
Instead of $util.encodeURI you should use $escapetool.url
> + #set($editURL = "/xwiki/rest/wikis/" + $util.encodeURI($docWiki) +
> "/spaces/" + $util.encodeURI($docSpace) + "/pages/" +
> $util.encodeURI($docPage) + "/annotation/" + $util.encodeURI($ann.id) +
> "?method=PUT&media=json")
> #if ("$!{ann.state}" == 'UPDATED')
> <span class="tool accept"><a class="validate"
> href="${editURL}"
> title="$msg.get('annotations.action.validate.tooltip')">$msg.get('annotations.action.validate.text')</a></span>
> #end
> @@ -183,7 +183,7 @@
> <span class="tool annotationEdit"><a class="edit"
> href="${editURL}"
> title="$msg.get('annotations.action.edit.tooltip')">$msg.get('annotations.action.edit.text')</a></span>
> #end
> ## TODO: fix this url to be generated less hardcoded
> - #set($deleteURL = "/xwiki/rest/wikis/" + $docWiki + "/spaces/" +
> $docSpace + "/pages/" + $docPage + "/annotation/" + $util.encodeURI($ann.id)
> + "?method=DELETE&media=json")
> + #set($deleteURL = "/xwiki/rest/wikis/" + $util.encodeURI($docWiki) +
> "/spaces/" + $util.encodeURI($docSpace) + "/pages/" +
> $util.encodeURI($docPage) + "/annotation/" + $util.encodeURI($ann.id) +
> "?method=DELETE&media=json")
> <span class="tool delete"><a class="delete"
> href="${deleteURL}"
> title="$msg.get('annotations.action.delete.tooltip')">$msg.get('annotations.action.delete.text')</a></span>
> #end
> </span>
>
> Modified:
> platform/xwiki-applications/trunk/annotations/src/main/resources/AnnotationCode/Script.xml
> ===================================================================
> ---
> platform/xwiki-applications/trunk/annotations/src/main/resources/AnnotationCode/Script.xml
> 2010-04-07 08:56:02 UTC (rev 28167)
> +++
> platform/xwiki-applications/trunk/annotations/src/main/resources/AnnotationCode/Script.xml
> 2010-04-07 13:15:44 UTC (rev 28168)
> @@ -12,8 +12,8 @@
> <customClass></customClass>
> <contentAuthor>XWiki.Admin</contentAuthor>
> <creationDate>1264860755000</creationDate>
> -<date>1270590698000</date>
> -<contentUpdateDate>1270590698000</contentUpdateDate>
> +<date>1270643534000</date>
> +<contentUpdateDate>1270643534000</contentUpdateDate>
> <version>1.1</version>
> <title></title>
> <template></template>
> @@ -847,7 +847,7 @@
>
> fetchAnnotations : function(andShow) {
> // TODO: fixme, get the URL in a less hardcoded way
> - var getAnnotationsURL = '/xwiki/rest/wikis/' + XWiki.currentWiki +
> '/spaces/' + XWiki.currentSpace + '/pages/' +
> $$('meta[name=page]')[0].content + '/annotations?media=json';
> + var getAnnotationsURL = '/xwiki/rest/wikis/' +
> encodeURIComponent(XWiki.currentWiki) + '/spaces/' +
> encodeURIComponent(XWiki.currentSpace) + '/pages/' +
> encodeURIComponent($$('meta[name=page]')[0].content) +
> '/annotations?media=json';
> new Ajax.Request(getAnnotationsURL, {method: 'GET',
> parameters: this.prepareRequestParameters(new Hash()),
> onCreate: function() {
> @@ -1037,9 +1037,9 @@
> new Ajax.Request('$xwiki.getURL("AnnotationCode.EditForm")', {
> parameters: {
> 'xpage' : 'plain',
> - 'wiki' : encodeURIComponent(XWiki.currentWiki),
> - 'space' : encodeURIComponent(XWiki.currentSpace),
> - 'page' : encodeURIComponent($$('meta[name=page]')[0].content),
> + 'wiki' : XWiki.currentWiki,
> + 'space' : XWiki.currentSpace,
$$ is really slow in IE, you should use something faster, like setting
XWiki.currentDocumentName to this value first.
> + 'page' : $$('meta[name=page]')[0].content,
> 'id' : id
> },
> onCreate : function() {
> @@ -1124,9 +1124,9 @@
> parameters: {
> 'id' : annotationId,
> 'xpage' : 'plain',
> - 'wiki' : encodeURIComponent(XWiki.currentWiki),
> - 'space' : encodeURIComponent(XWiki.currentSpace),
> - 'page' : encodeURIComponent($$('meta[name=page]')[0].content)
> + 'wiki' : XWiki.currentWiki,
> + 'space' : XWiki.currentSpace,
> + 'page' : $$('meta[name=page]')[0].content
> },
> onSuccess: function(response) {
> // display the annotation creation form
--
Sergiu Dumitriu
http://purl.org/net/sergiu/
_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs