Fix: use template for best visibility
This commit is contained in:
parent
d9e3a941de
commit
bd6f5c4ca7
@ -2217,8 +2217,6 @@ class Form
|
||||
$more.='</table>'."\n";
|
||||
}
|
||||
|
||||
$formconfirm.= "\n<!-- begin form_confirm page=".$page." -->\n";
|
||||
|
||||
if ($useajax && $conf->use_javascript_ajax)
|
||||
{
|
||||
$autoOpen=true;
|
||||
@ -2244,81 +2242,12 @@ class Form
|
||||
}
|
||||
|
||||
// New code using jQuery only
|
||||
$formconfirm.= '<div id="'.$dialogconfirm.'" title="'.dol_escape_htmltag($title).'" style="display: none;">';
|
||||
if (! empty($more)) $formconfirm.= '<p>'.$more.'</p>';
|
||||
$formconfirm.= img_help('','').' '.$question;
|
||||
$formconfirm.= '</div>'."\n";
|
||||
$formconfirm.= '<script type="text/javascript">
|
||||
/* Warning: This function is loaded once and not overwritten if loaded by another ajax page */
|
||||
$(function() {
|
||||
$( "#'.$dialogconfirm.'" ).dialog({
|
||||
autoOpen: '.($autoOpen?'true':'false').',
|
||||
resizable: false,
|
||||
height:'.$height.',
|
||||
width:'.$width.',
|
||||
modal: true,
|
||||
closeOnEscape: false,
|
||||
close: function(event, ui) {
|
||||
if (choice == \'ok\') {
|
||||
var options="";
|
||||
var inputok='.json_encode($inputok).';
|
||||
var pageyes=\''.dol_escape_js($pageyes?$pageyes:'').'\';
|
||||
if (inputok.length>0) {
|
||||
$.each(inputok, function() {
|
||||
var inputname = this; var more = \'\';
|
||||
if ($("#" + this).attr("type") == \'checkbox\') { more = \':checked\'; }
|
||||
var inputvalue = $("#" + this + more).val();
|
||||
if (typeof inputvalue == \'undefined\') { inputvalue=\'\'; }
|
||||
options += \'&\' + inputname + \'=\' + inputvalue;
|
||||
});
|
||||
}
|
||||
var urljump=pageyes + (pageyes.indexOf(\'?\')<0?\'?\':\'\') + options;
|
||||
//alert(urljump);
|
||||
if (pageyes.length > 0) { location.href=urljump; }
|
||||
}
|
||||
if (choice == \'ko\') {
|
||||
var options="";
|
||||
var inputko='.json_encode($inputko).';
|
||||
var pageno=\''.dol_escape_js($pageno?$pageno:'').'\';
|
||||
if (inputko.length>0) {
|
||||
$.each(inputko, function() {
|
||||
var inputname = this; var more = \'\';
|
||||
if ($("#" + this).attr("type") == \'checkbox\') { more = \':checked\'; }
|
||||
var inputvalue = $("#" + this + more).val();
|
||||
if (typeof inputvalue == \'undefined\') { inputvalue=\'\'; }
|
||||
options += \'&\' + inputname + \'=\' + inputvalue;
|
||||
});
|
||||
}
|
||||
var urljump=pageno + (pageno.indexOf(\'?\')<0?\'?\':\'\') + options;
|
||||
//alert(urljump);
|
||||
if (pageno.length > 0) { location.href=urljump; }
|
||||
}
|
||||
},
|
||||
buttons: {
|
||||
\''.dol_escape_js($langs->transnoentities("Yes")).'\': function() {
|
||||
choice=\'ok\';
|
||||
$(this).dialog(\'close\');
|
||||
},
|
||||
\''.dol_escape_js($langs->transnoentities("No")).'\': function() {
|
||||
choice=\'ko\';
|
||||
$(this).dialog(\'close\');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var button=\''.$button.'\';
|
||||
if (button.length > 0) {
|
||||
$( "#" + button ).click(function() {
|
||||
$("#'.$dialogconfirm.'").dialog(\'open\');
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>';
|
||||
|
||||
$formconfirm.= "\n";
|
||||
include(DOL_DOCUMENT_ROOT.'/core/tpl/ajax/formconfirm.tpl.php');
|
||||
}
|
||||
else
|
||||
{
|
||||
$formconfirm.= "\n<!-- begin form_confirm page=".$page." -->\n";
|
||||
|
||||
$formconfirm.= '<form method="POST" action="'.$page.'" class="notoptoleftroright">'."\n";
|
||||
$formconfirm.= '<input type="hidden" name="action" value="'.$action.'">';
|
||||
$formconfirm.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'."\n";
|
||||
@ -2350,9 +2279,10 @@ class Form
|
||||
|
||||
$formconfirm.= "</form>\n";
|
||||
$formconfirm.= '<br>';
|
||||
|
||||
$formconfirm.= "<!-- end form_confirm -->\n";
|
||||
}
|
||||
|
||||
$formconfirm.= "<!-- end form_confirm -->\n";
|
||||
return $formconfirm;
|
||||
}
|
||||
|
||||
|
||||
84
htdocs/core/tpl/ajax/formconfirm.tpl.php
Normal file
84
htdocs/core/tpl/ajax/formconfirm.tpl.php
Normal file
@ -0,0 +1,84 @@
|
||||
<?php
|
||||
/* Copyright (C) 2011-2012 Regis Houssin <regis@dolibarr.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
?>
|
||||
|
||||
<!-- START TEMPLATE FORMCONFIRM PAGE="<?php echo $page; ?>" -->
|
||||
<div id="<?php echo $dialogconfirm; ?>" title="<?php echo dol_escape_htmltag($title); ?>" style="display: none;">
|
||||
<?php if (! empty($more)) { ?>
|
||||
<p><?php echo $more; ?></p>
|
||||
<?php } ?>
|
||||
<?php echo img_help('','').' '.$question; ?>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
$( "#<?php echo $dialogconfirm; ?>" ).dialog({
|
||||
autoOpen: <?php echo ($autoOpen ? 'true' : 'false'); ?>,
|
||||
resizable: false,
|
||||
height: '<?php echo $height; ?>',
|
||||
width: '<?php echo $width; ?>',
|
||||
modal: true,
|
||||
closeOnEscape: false,
|
||||
buttons: {
|
||||
'<?php echo dol_escape_js($langs->transnoentities("Yes")); ?>': function() {
|
||||
var options="";
|
||||
var inputok = <?php echo json_encode($inputok); ?>;
|
||||
var pageyes = '<?php echo dol_escape_js($pageyes?$pageyes:''); ?>';
|
||||
if (inputok.length>0) {
|
||||
$.each(inputok, function(i, inputname) {
|
||||
var more = '';
|
||||
if ($("#" + inputname).attr("type") == 'checkbox') { more = ':checked'; }
|
||||
var inputvalue = $("#" + inputname + more).val();
|
||||
if (typeof inputvalue == 'undefined') { inputvalue=''; }
|
||||
options += '&' + inputname + '=' + inputvalue;
|
||||
});
|
||||
}
|
||||
var urljump = pageyes + (pageyes.indexOf('?') < 0 ? '?' : '') + options;
|
||||
//alert(urljump);
|
||||
if (pageyes.length > 0) { location.href = urljump; }
|
||||
$(this).dialog('close');
|
||||
},
|
||||
'<?php echo dol_escape_js($langs->transnoentities("No")); ?>': function() {
|
||||
var options = '';
|
||||
var inputko = <?php echo json_encode($inputko); ?>;
|
||||
var pageno='<?php echo dol_escape_js($pageno?$pageno:''); ?>';
|
||||
if (inputko.length>0) {
|
||||
$.each(inputko, function(i, inputname) {
|
||||
var more = '';
|
||||
if ($("#" + inputname).attr("type") == 'checkbox') { more = ':checked'; }
|
||||
var inputvalue = $("#" + inputname + more).val();
|
||||
if (typeof inputvalue == 'undefined') { inputvalue=''; }
|
||||
options += '&' + inputname + '=' + inputvalue;
|
||||
});
|
||||
}
|
||||
var urljump=pageno + (pageno.indexOf('?') < 0 ? '?' : '') + options;
|
||||
//alert(urljump);
|
||||
if (pageno.length > 0) { location.href = urljump; }
|
||||
$(this).dialog('close');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var button = '<?php echo $button; ?>';
|
||||
if (button.length > 0) {
|
||||
$( "#" + button ).click(function() {
|
||||
$("#<?php echo $dialogconfirm; ?>").dialog('open');
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<!-- END TEMPLATE FORM CONFIRM -->
|
||||
Loading…
Reference in New Issue
Block a user