Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Insert a link "Add page"

Gustav Stresemann October 9, 2011

Hello,

I would like to insert the link "Add page" in a different place than the menu. The link will be displayed if you have editing rights, otherwise the link will not be displayed. For the links "Edit", "export", "side information" and "space admin", it already works.
Either the link is displayed regardless of the permissions all the time or not.

#set ($spaceKey = $helper.spaceKey)

#if ($permissionHelper.canCreatePage($remoteUser, $space))
## if user currently viewing a page, add page automatically creates a new page with that page is the parent
#if ($helper.page.pageId && !$helper.page.postingDay)
<a href="$req.contextPath/pages/createpage.action?spaceKey=$generalUtil.urlEncode($spaceKey)&fromPageId=$helper.page.id">$action.getText('add.page')</a>

#else
<a href="$req.contextPath/pages/createpage.action?spaceKey=$generalUtil.urlEncode($spaceKey)">$action.getText('add.page')</a>
#end
#end

Where is my mistake in the code? In this case the link does not appear.

Thank you!

1 answer

1 accepted

0 votes
Answer accepted
Gustav Stresemann October 11, 2011

The challenge is solved! I've done it and it works.

Jo-Anne MacLeod
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 11, 2011

what was the problem?

In case anyone comes across this same problem in the future, then they will also know (or have some ideas) as to how to resolve it.

Gustav Stresemann October 12, 2011

This is obviously a good idea. I was looking for a way to make a link "add page" insert into my theme. The link should be displayed in dependence on the user rights. I've now solved it like this:

#set ($pageId = $sitemeshPage.getProperty("page.pageId"))

#if ($sitemeshPage && $req && $pageId != 0 && $permissionCheckDispatcher.isPermitted("/pages/createpage.action?spaceKey=$generalUtil.urlEncode($spaceKey)&fromPageId=$pageId"))
				      <a class="newpage" href="$req.contextPath/pages/createpage.action?spaceKey=$generalUtil.urlEncode($spaceKey)&fromPageId=$pageId" title="$action.getText("de.vw.wiki.theme.kgkui.action.newpage")">$action.getText("de.vw.wiki.theme.kgkui.action.newpage")</a>   
                      #end


Exactly what I wanted.

Gustav Stresemann October 12, 2011

This is obviously a good idea. I was looking for a way to make a link "add page" insert into my theme. The link should be displayed in dependence on the user rights. I've now solved it like this:

#set ($pageId = $sitemeshPage.getProperty("page.pageId"))

 #if ($sitemeshPage && $req && $pageId != 0 && $permissionCheckDispatcher.isPermitted("/pages/createpage.action?spaceKey=$generalUtil.urlEncode($spaceKey)&fromPageId=$pageId"))
				      <a class="newpage" href="$req.contextPath/pages/createpage.action?spaceKey=$generalUtil.urlEncode($spaceKey)&fromPageId=$pageId" title="$action.getText("xx.xx.xxxx.xxxxx.xxxxx.action.newpage")">$action.getText("xx.xx.xxxx.xxxxx.xxxxx.action.newpage")</a>   
                      #end

Exactly what I wanted.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events