convert donate modal to ajax request
This commit is contained in:
parent
467e75a11c
commit
d2963fe28f
|
@ -18,10 +18,7 @@
|
|||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
//
|
||||
|
||||
if ( !canEdit('System') ) {
|
||||
$view = 'error';
|
||||
return;
|
||||
}
|
||||
if ( !canEdit('System') ) return;
|
||||
|
||||
$options = array(
|
||||
'go' => translate('DonateYes'),
|
||||
|
@ -45,7 +42,11 @@ $options = array(
|
|||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form name="contentForm" id="contentForm" method="post" action="?">
|
||||
<form name="contentForm" id="donateForm" method="post" action="?">
|
||||
<?php
|
||||
// We have to manually insert the csrf key into the form when using a modal generated via ajax call
|
||||
echo getCSRFinputHTML();
|
||||
?>
|
||||
<input type="hidden" name="view" value="donate"/>
|
||||
<input type="hidden" name="action" value="donate"/>
|
||||
<p>
|
||||
|
@ -54,16 +55,12 @@ $options = array(
|
|||
<p>
|
||||
<?php echo buildSelect('option', $options); ?>
|
||||
</p>
|
||||
<div id="contentButtons">
|
||||
<button type="submit"><?php echo translate('Apply') ?></button>
|
||||
<button type="button" data-on-click="closeWindow"><?php echo translate('Close') ?></button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
||||
<button type="button" class="btn btn-primary">Understood</button>
|
||||
<button type="submit" class="btn btn-primary" id="donateApplyBtn"><?php echo translate('Apply') ?></button>
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal"><?php echo translate('Close') ?></button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -49,6 +49,6 @@ if ( $action == 'donate' && isset($_REQUEST['option']) ) {
|
|||
Warning("Unknown value for option in donate: $option");
|
||||
break;
|
||||
} // end switch option
|
||||
$view = 'none';
|
||||
$redirect = '?view=console';
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -438,7 +438,5 @@ for( $monitor_i = 0; $monitor_i < count($displayMonitors); $monitor_i += 1 ) {
|
|||
</form>
|
||||
<?php
|
||||
include('function.php');
|
||||
// Include Donate Modal
|
||||
include('donate.php');
|
||||
xhtmlFooter();
|
||||
?>
|
||||
|
|
|
@ -133,7 +133,24 @@ function initPage() {
|
|||
window.location.assign('?view=version');
|
||||
}
|
||||
if ( showDonatePopup ) {
|
||||
$j.getJSON(thisUrl + '?request=modal&modal=donate')
|
||||
.done(function(data) {
|
||||
if ( $j('#donate').length ) {
|
||||
$j('#donate').replaceWith(data.html);
|
||||
} else {
|
||||
$j("body").append(data.html);
|
||||
}
|
||||
$j('#donate').modal('show');
|
||||
// Manage the Apply button
|
||||
$j('#donateApplyBtn').click(function(evt) {
|
||||
evt.preventDefault();
|
||||
$j('#donateForm').submit();
|
||||
});
|
||||
})
|
||||
.fail(function(jqxhr, textStatus, error) {
|
||||
console.log("Request Failed: " + textStatus + ", " + error);
|
||||
console.log("Response Text: " + jqxhr.responseText);
|
||||
});
|
||||
}
|
||||
|
||||
// Makes table sortable
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
if ( action == 'donate' && option == 'go' ) {
|
||||
zmWindow('/donate/');
|
||||
}
|
|
@ -1,2 +0,0 @@
|
|||
var action = '<?php echo isset($_REQUEST['action'])?validJsStr($_REQUEST['action']):'' ?>';
|
||||
var option = '<?php echo isset($_REQUEST['option'])?validJsStr($_REQUEST['option']):'' ?>';
|
Loading…
Reference in New Issue