mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 11:05:53 +02:00
BUG: Fix add new button not passing the correct parent ID.
The `%s` parent ID placeholder was being URL encoded, so it was not being replaced properly when adding a new page. This fix separately adds placeholder parameters to the URL to avoid this issue. The fix is not ideal, but there is no easy way to indicate that some URL parameters should be URL encoded and others should not while still correctly constructing the URL.
This commit is contained in:
parent
c3e25e9e07
commit
b7476f2a46
@ -202,10 +202,18 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
||||
return $link;
|
||||
}
|
||||
|
||||
public function LinkPageAdd($extraArguments = null) {
|
||||
public function LinkPageAdd($extra = null, $placeholders = null) {
|
||||
$link = singleton("CMSPageAddController")->Link();
|
||||
$this->extend('updateLinkPageAdd', $link);
|
||||
if($extraArguments) $link = Controller::join_links ($link, $extraArguments);
|
||||
|
||||
if($extra) {
|
||||
$link = Controller::join_links ($link, $extra);
|
||||
}
|
||||
|
||||
if($placeholders) {
|
||||
$link .= (strpos($link, '?') === false ? "?$placeholders" : "&$placeholders");
|
||||
}
|
||||
|
||||
return $link;
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,7 @@ $ExtraTreeTools
|
||||
</div>
|
||||
<% end_if %>
|
||||
|
||||
<div class="cms-tree" data-url-tree="$Link(getsubtree)" data-url-savetreenode="$Link(savetreenode)" data-url-updatetreenodes="$Link(updatetreenodes)" data-url-addpage="{$LinkPageAdd('AddForm/?action_doAdd=1')}&ParentID=%s&PageType=%s" data-url-editpage="$LinkPageEdit('%s')" data-url-duplicate="{$Link('duplicate/%s')}" data-url-duplicatewithchildren="{$Link('duplicatewithchildren/%s')}" data-url-listview="{$Link('?view=list')}" data-hints="$SiteTreeHints.XML" data-extra-params="SecurityID=$SecurityID">
|
||||
<div class="cms-tree" data-url-tree="$Link(getsubtree)" data-url-savetreenode="$Link(savetreenode)" data-url-updatetreenodes="$Link(updatetreenodes)" data-url-addpage="{$LinkPageAdd('AddForm/?action_doAdd=1', 'ParentID=%s&PageType=%s')}" data-url-editpage="$LinkPageEdit('%s')" data-url-duplicate="{$Link('duplicate/%s')}" data-url-duplicatewithchildren="{$Link('duplicatewithchildren/%s')}" data-url-listview="{$Link('?view=list')}" data-hints="$SiteTreeHints.XML" data-extra-params="SecurityID=$SecurityID">
|
||||
$SiteTreeAsUL
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<div class="cms-actions-row">
|
||||
<a class="cms-page-add-button ss-ui-button ss-ui-action-constructive" data-icon="add" href="$LinkPageAdd" data-url-addpage="{$LinkPageAdd('?ParentID=%s')}"><% _t('CMSMain.AddNewButton', 'Add new') %></a>
|
||||
<a class="cms-page-add-button ss-ui-button ss-ui-action-constructive" data-icon="add" href="$LinkPageAdd" data-url-addpage="{$LinkPageAdd('', 'ParentID=%s')}"><% _t('CMSMain.AddNewButton', 'Add new') %></a>
|
||||
<button href="$LinkPagesWithSearch" class="cms-tree-expand-trigger cms-panel-link ss-button" data-icon="pencil">
|
||||
<% _t('CMSMain.EditTree', 'Edit Tree') %>
|
||||
</button>
|
||||
|
Loading…
Reference in New Issue
Block a user