mirror of
https://github.com/silverstripe/silverstripe-userforms.git
synced 2024-10-22 17:05:42 +02:00
Merge pull request #76 from silverstripe-droptables/translatable-compatible
FIX: Build URLs to respect other parameters
This commit is contained in:
commit
31659ed61c
@ -32,6 +32,7 @@ class SubmittedFormReportField extends FormField {
|
|||||||
$list->setCurrentPage($page);
|
$list->setCurrentPage($page);
|
||||||
$list->setPageLength(10);
|
$list->setPageLength(10);
|
||||||
$list->setTotalItems($totalCount);
|
$list->setTotalItems($totalCount);
|
||||||
|
|
||||||
return $list;
|
return $list;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,6 +46,18 @@ class SubmittedFormReportField extends FormField {
|
|||||||
)))->renderWith(array('SubmittedFormReportField'));
|
)))->renderWith(array('SubmittedFormReportField'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getExportLink() {
|
||||||
|
return $this->Link('export?id=' . $this->RecordID());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDeleteSubmissionsLink() {
|
||||||
|
return $this->Link('deletesubmissions?id=' . $this->RecordID());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function LinkContainsParameter() {
|
||||||
|
return strpos($this->Link(), '?') !== FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ID of this forms record
|
* ID of this forms record
|
||||||
*
|
*
|
||||||
|
@ -31,4 +31,9 @@ class SubmittedForm extends DataObject {
|
|||||||
|
|
||||||
parent::onBeforeDelete();
|
parent::onBeforeDelete();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Used in the CMS to join the links properly
|
||||||
|
public function DeleteLink($controllerLink) {
|
||||||
|
return Controller::join_links($controllerLink, 'deletesubmission?id=' . $this->ID);
|
||||||
|
}
|
||||||
}
|
}
|
@ -1,21 +1,20 @@
|
|||||||
<div id="userforms-submissions">
|
<div id="userforms-submissions">
|
||||||
|
|
||||||
<% if Submissions %>
|
<% if Submissions %>
|
||||||
<ul class="userforms-submission-actions">
|
<ul class="userforms-submission-actions">
|
||||||
<li><a href="{$Top.Link}/export/?id={$RecordID}"><% _t('EXPORTSUBMISSIONS', 'Export submissions to CSV') %></a></li>
|
<li><a href="$getExportLink"><% _t('EXPORTSUBMISSIONS', 'Export submissions to CSV') %></a></li>
|
||||||
<li><a href="{$Top.Link}/deletesubmissions/?id={$RecordID}" class="deleteAllSubmissions"><% _t('DELETEALLSUBMISSIONS', 'Delete All Submissions') %></a></li>
|
<li><a href="$getDeleteSubmissionsLink" class="deleteAllSubmissions"><% _t('DELETEALLSUBMISSIONS', 'Delete All Submissions') %></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
<h5>Name: $Name</h5>
|
||||||
|
|
||||||
<% loop Submissions %>
|
<% loop Submissions %>
|
||||||
<div class="userform-submission">
|
<div class="userform-submission">
|
||||||
<h5><% _t('SUBMITTED', 'Submitted at') %> {$Created.Nice} <a href="{$Top.Link}/deletesubmission/?id={$ID}" class="deleteSubmission"><% _t('DELETESUBMISSION', 'Delete Submission') %></a></h5>
|
<h5><% _t('SUBMITTED', 'Submitted at') %> {$Created.Nice} <a href="$DeleteLink($Up.Link)" class="deleteSubmission"><% _t('DELETESUBMISSION', 'Delete Submission') %></a></h5>
|
||||||
<% loop Values %>
|
<% loop Values %>
|
||||||
<div id="Text_readonly" class="field readonly text">
|
<div id="Text_readonly" class="field readonly text">
|
||||||
<label class="left" for="Form_EditForm_Text_readonly">$Title</label>
|
<label class="left" for="Form_EditForm_Text_readonly">$Title</label>
|
||||||
<div class="middleColumn">
|
<div class="middleColumn">
|
||||||
<span id="Form_EditForm_Text_readonly" class="readonly text">$FormattedValue</span>
|
<span id="Form_EditForm_Text_readonly" class="readonly text">$FormattedValue</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<% end_loop %>
|
<% end_loop %>
|
||||||
</div>
|
</div>
|
||||||
@ -30,7 +29,7 @@
|
|||||||
$PageNum
|
$PageNum
|
||||||
<% else %>
|
<% else %>
|
||||||
<% if Link %>
|
<% if Link %>
|
||||||
<a href="{$Top.Link(getMoreSubmissions)}?page=$PageNum">$PageNum</a>
|
<a href="{$Top.Link(getMoreSubmissions)}<% if $Top.LinkContainsParameter %>&<% else %>?<% end_if %>page=$PageNum">$PageNum</a>
|
||||||
<% else %>
|
<% else %>
|
||||||
...
|
...
|
||||||
<% end_if %>
|
<% end_if %>
|
||||||
|
Loading…
Reference in New Issue
Block a user