Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
X
xwiki-platform
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
XWiki
xwiki-platform
Commits
2fc20891
Commit
2fc20891
authored
2 years ago
by
Michael Hamann
Browse files
Options
Downloads
Patches
Plain Diff
XWIKI-19857: Modernize the menu macro and add escaping
parent
d9099502
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
xwiki-platform-core/xwiki-platform-menu/xwiki-platform-menu-ui/src/main/resources/Menu/MenuMacro.xml
+38
-15
38 additions, 15 deletions
...ki-platform-menu-ui/src/main/resources/Menu/MenuMacro.xml
with
38 additions
and
15 deletions
xwiki-platform-core/xwiki-platform-menu/xwiki-platform-menu-ui/src/main/resources/Menu/MenuMacro.xml
+
38
−
15
View file @
2fc20891
...
...
@@ -20,7 +20,7 @@
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-->
<xwikidoc
version=
"1.
3
"
reference=
"Menu.MenuMacro"
locale=
""
>
<xwikidoc
version=
"1.
5
"
reference=
"Menu.MenuMacro"
locale=
""
>
<web>
Menu
</web>
<name>
MenuMacro
</name>
<language/>
...
...
@@ -41,15 +41,21 @@
= Horizontal Menu =
{{velocity}}
#set ($menuTemplateDoc = $xwiki.getDocument('MenuTemplate'))
{{code language="none"}}
{{menu type="horizontal fixedWidth"}}
$xwiki.getDocument('MenuTemplate').content
## No way to escape content in the code macro, so just remove {, see https://jira.xwiki.org/browse/XRENDERING-13.
$menuTemplateDoc.content.replace('{', '')
{{/menu}}
{{/code}}
{{/velocity}}
{{menu type="horizontal fixedWidth"}}
{{include reference="MenuTemplate" /}}
{{velocity}}
## Include the content of the menu template.
## Escape {{ in the rendered content to be sure that the HTML macro is not closed unintentionally.
{{html}}$menuTemplateDoc.displayDocument().replace('{{', '
&
amp;#123;
&
amp;#123;'){{/html}}
{{/velocity}}
{{/menu}}
= Vertical Menu =
...
...
@@ -63,7 +69,11 @@
{{/velocity}}
{{menu type="vertical"}}
{{include reference="MenuTemplate" /}}
{{velocity}}
## Include the content of the menu template.
## Escape {{ in the rendered content to be sure that the HTML macro is not closed unintentionally.
{{html}}$menuTemplateDoc.displayDocument().replace('{{', '
&
amp;#123;
&
amp;#123;'){{/html}}
{{/velocity}}
{{/menu}}
</content>
<object>
<name>
Menu.MenuMacro
</name>
...
...
@@ -962,7 +972,7 @@
<displayFormType>
select
</displayFormType>
<displayType/>
<name>
async_cached
</name>
<number>
1
2
</number>
<number>
1
3
</number>
<prettyName>
Cached
</prettyName>
<unmodifiable>
0
</unmodifiable>
<classType>
com.xpn.xwiki.objects.classes.BooleanClass
</classType>
...
...
@@ -975,14 +985,14 @@
<largeStorage>
0
</largeStorage>
<multiSelect>
1
</multiSelect>
<name>
async_context
</name>
<number>
1
3
</number>
<number>
1
4
</number>
<prettyName>
Context elements
</prettyName>
<relationalStorage>
0
</relationalStorage>
<separator>
</separator>
<separator>
,
</separator>
<separators>
|,
</separators>
<size>
5
</size>
<unmodifiable>
0
</unmodifiable>
<values>
doc.reference=Document|icon.theme=Icon theme|locale=Language|request.base=Request base URL|request.parameters=Request parameters|request.url=Request URL|request.wiki=Request wiki|user=User|wiki=Wiki
</values>
<values>
action=Action|
doc.reference=Document|icon.theme=Icon theme|locale=Language|
rendering.defaultsyntax=Default syntax|rendering.restricted=Restricted|rendering.targetsyntax=Target syntax|
request.base=Request base URL|request.
cookies|request.
parameters=Request parameters|request.url=Request URL|request.wiki=Request wiki|user=User|wiki=Wiki
</values>
<classType>
com.xpn.xwiki.objects.classes.StaticListClass
</classType>
</async_context>
<async_enabled>
...
...
@@ -991,7 +1001,7 @@
<displayFormType>
select
</displayFormType>
<displayType/>
<name>
async_enabled
</name>
<number>
1
1
</number>
<number>
1
2
</number>
<prettyName>
Asynchronous rendering
</prettyName>
<unmodifiable>
0
</unmodifiable>
<classType>
com.xpn.xwiki.objects.classes.BooleanClass
</classType>
...
...
@@ -1096,6 +1106,16 @@
<unmodifiable>
0
</unmodifiable>
<classType>
com.xpn.xwiki.objects.classes.StringClass
</classType>
</name>
<priority>
<disabled>
0
</disabled>
<name>
priority
</name>
<number>
11
</number>
<numberType>
integer
</numberType>
<prettyName>
Priority
</prettyName>
<size>
10
</size>
<unmodifiable>
0
</unmodifiable>
<classType>
com.xpn.xwiki.objects.classes.NumberClass
</classType>
</priority>
<supportsInlineMode>
<disabled>
0
</disabled>
<displayFormType>
select
</displayFormType>
...
...
@@ -1149,7 +1169,7 @@
(% role="navigation" class="menu-horizontal-toggle" %)(((
(% class="navbar-header" %)(((
{{html}}
<
button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#$!{id}" aria-expanded="false"
>
<
button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#$!{
escapetool.xml($
id
)
}" aria-expanded="false"
>
<
span class="sr-only"
><
/span
>
<
span class="icon-bar"
><
/span
>
<
span class="icon-bar"
><
/span
>
...
...
@@ -1157,13 +1177,13 @@
<
/button
>
{{/html}}
)))
(% id="$
{id}" class="menu menu-$!type
collapse navbar-collapse" %)(((
$xcontext.
macro
.
content
(% id="$
!{services.rendering.escape($id, 'xwiki/2.1')}" class="menu menu-${services.rendering.escape($!type, 'xwiki/2.1')}
collapse navbar-collapse" %)(((
{{wiki
macrocontent
/}}
)))
)))
#else
(% #if ("$!id" != '') id="$
id"#end class="menu menu-$!type
" %)(((
$xcontext.
macro
.
content
(% #if ("$!id" != '') id="$
{services.rendering.escape($id, 'xwiki/2.1')}"#end class="menu menu-${services.rendering.escape($!type, 'xwiki/2.1')}
" %)(((
{{wiki
macrocontent
/}}
)))
#end
{{/velocity}}
</code>
...
...
@@ -1172,7 +1192,7 @@
<contentDescription>
Define the menu structure using wiki syntax. Each menu item should be a list item and should contain the menu item label or link. You can use nested lists for sub-menu items.
</contentDescription>
</property>
<property>
<contentJavaType
/
>
<contentJavaType
>
Wiki
</contentJavaType
>
</property>
<property>
<contentType>
Mandatory
</contentType>
...
...
@@ -1189,6 +1209,9 @@
<property>
<name>
Menu
</name>
</property>
<property>
<priority/>
</property>
<property>
<supportsInlineMode>
0
</supportsInlineMode>
</property>
...
...
This diff is collapsed.
Click to expand it.
Git Mirror User
@gitmirror
mentioned in commit
59ccca24
·
2 years ago
mentioned in commit
59ccca24
mentioned in commit 59ccca24a8465a19f40c51d65fcc2c09c1edea16
Toggle commit list
Git Mirror User
@gitmirror
mentioned in commit
11cd47c3
·
2 years ago
mentioned in commit
11cd47c3
mentioned in commit 11cd47c33a59c3ab75cd71de12032680659add14
Toggle commit list
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment