mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-11 04:52:14 +09:00
_rx_ajax_form 파라미터로 폼 제출 종류를 구분할 수 있도록 변경
This commit is contained in:
parent
085b74b7db
commit
3efc2a6b13
3 changed files with 8 additions and 10 deletions
|
|
@ -167,7 +167,6 @@ class Context
|
||||||
'_rx_ajax_compat' => true,
|
'_rx_ajax_compat' => true,
|
||||||
'_rx_ajax_form' => true,
|
'_rx_ajax_form' => true,
|
||||||
'_rx_csrf_token' => true,
|
'_rx_csrf_token' => true,
|
||||||
'_rx_target_iframe' => true,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -945,7 +945,7 @@ class ModuleHandler extends Handler
|
||||||
if(!isset($methodList[Context::getRequestMethod()]))
|
if(!isset($methodList[Context::getRequestMethod()]))
|
||||||
{
|
{
|
||||||
// Handle iframe form submissions.
|
// Handle iframe form submissions.
|
||||||
if(isset($_POST['_rx_target_iframe']) && starts_with('_rx_temp_', $_POST['_rx_target_iframe']))
|
if(isset($_POST['_rx_ajax_form']) && starts_with('_rx_temp_iframe_', $_POST['_rx_ajax_form']))
|
||||||
{
|
{
|
||||||
$script = '';
|
$script = '';
|
||||||
if(!$oModule->toBool())
|
if(!$oModule->toBool())
|
||||||
|
|
@ -964,7 +964,7 @@ class ModuleHandler extends Handler
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
echo sprintf('<html><head></head><body><script>%s window.parent.remove_iframe(%s);</script></body></html>', $script, json_encode($_POST['_rx_target_iframe']));
|
echo sprintf('<html><head></head><body><script>%s window.parent.remove_iframe(%s);</script></body></html>', $script, json_encode($_POST['_rx_ajax_form']));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -393,7 +393,7 @@
|
||||||
}
|
}
|
||||||
// Set _rx_ajax_form flag
|
// Set _rx_ajax_form flag
|
||||||
if (!form.find('input[name=_rx_ajax_form]').size()) {
|
if (!form.find('input[name=_rx_ajax_form]').size()) {
|
||||||
form.append('<input type="hidden" name="_rx_ajax_form" value="true" />');
|
form.append('<input type="hidden" name="_rx_ajax_form" value="json" />');
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
form.find('input[name=_rx_ajax_form]').remove();
|
form.find('input[name=_rx_ajax_form]').remove();
|
||||||
}, 1000);
|
}, 1000);
|
||||||
|
|
@ -401,18 +401,17 @@
|
||||||
// If the form has file uploads, use a hidden iframe to submit. Otherwise use exec_json.
|
// If the form has file uploads, use a hidden iframe to submit. Otherwise use exec_json.
|
||||||
var has_files = form.find('input[type=file][name!=Filedata]').size();
|
var has_files = form.find('input[type=file][name!=Filedata]').size();
|
||||||
if (has_files) {
|
if (has_files) {
|
||||||
var iframe_id = '_rx_temp_' + (new Date()).getTime();
|
var iframe_id = '_rx_temp_iframe_' + (new Date()).getTime();
|
||||||
$('<iframe id="' + iframe_id + '" name="' + iframe_id + '" style="display:none"></iframe>').appendTo($(document.body));
|
$('<iframe id="' + iframe_id + '" name="' + iframe_id + '" style="display:none"></iframe>').appendTo($(document.body));
|
||||||
form.attr('method', 'POST').attr('enctype', 'multipart/form-data');
|
form.attr('method', 'POST').attr('enctype', 'multipart/form-data').attr('target', iframe_id);
|
||||||
form.attr('target', iframe_id).find('input[name=_rx_target_iframe]').remove();
|
form.find('input[name=_rx_ajax_form]').val(iframe_id);
|
||||||
form.append('<input type="hidden" name="_rx_target_iframe" value="' + iframe_id + '" />');
|
|
||||||
window.remove_iframe = function(iframe_id) {
|
window.remove_iframe = function(iframe_id) {
|
||||||
if (iframe_id.match(/^_rx_temp_[0-9]+$/)) {
|
if (iframe_id.match(/^_rx_temp_iframe_[0-9]+$/)) {
|
||||||
$('iframe#' + iframe_id).remove();
|
$('iframe#' + iframe_id).remove();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
form.removeAttr('target').find('input[name=_rx_target_iframe]').remove();
|
form.removeAttr('target');
|
||||||
}, 1000);
|
}, 1000);
|
||||||
form.submit();
|
form.submit();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue