Test: not reload page with dialog confirm
This commit is contained in:
parent
5cda28b6c6
commit
632d8dde95
@ -2038,19 +2038,28 @@ class Form
|
||||
|
||||
if ($useajax && $conf->use_javascript_ajax && $conf->global->MAIN_CONFIRM_AJAX)
|
||||
{
|
||||
$autoOpen=true;
|
||||
$dialogconfirm='dialog-confirm';
|
||||
if (! is_int($useajax)) {
|
||||
list($useajax,$button) = explode(',',$useajax);
|
||||
$autoOpen=false;
|
||||
$dialogconfirm.='-'.$button;
|
||||
}
|
||||
$pageyes=$page.'&action='.$action.'&confirm=yes';
|
||||
$pageno=($useajax == 2?$page.'&confirm=no':'');
|
||||
|
||||
// New code using jQuery only
|
||||
$formconfirm.= '<div id="dialog-confirm" title="'.dol_escape_htmltag($title).'">';
|
||||
$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">
|
||||
$(function() {
|
||||
var choice=\'ko\';
|
||||
var $inputarray='.json_encode($inputarray).';
|
||||
jQuery("#dialog-confirm").dialog({
|
||||
autoOpen: true,
|
||||
|
||||
$("#'.$dialogconfirm.'").dialog({
|
||||
autoOpen: '.($autoOpen?'true':'false').',
|
||||
resizable: false,
|
||||
height:'.$height.',
|
||||
width:'.$width.',
|
||||
@ -2073,15 +2082,20 @@ class Form
|
||||
},
|
||||
buttons: {
|
||||
\''.dol_escape_js($langs->transnoentities("Yes")).'\': function() {
|
||||
choice=\'ok\';
|
||||
jQuery(this).dialog(\'close\');
|
||||
choice=\'ok\';
|
||||
$(this).dialog(\'close\');
|
||||
},
|
||||
\''.dol_escape_js($langs->transnoentities("No")).'\': function() {
|
||||
choice=\'ko\';
|
||||
jQuery(this).dialog(\'close\');
|
||||
choice=\'ko\';
|
||||
$(this).dialog(\'close\');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$( "#'.$button.'" ).click(function() {
|
||||
$( "#'.$dialogconfirm.'" ).dialog( \'open\' );
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
|
||||
$formconfirm.= "\n";
|
||||
|
||||
@ -1328,10 +1328,10 @@ else
|
||||
|
||||
|
||||
// Confirm delete third party
|
||||
if ($action == 'delete')
|
||||
if ($action == 'delete' || ($conf->use_javascript_ajax && $conf->global->MAIN_CONFIRM_AJAX))
|
||||
{
|
||||
$html = new Form($db);
|
||||
$ret=$html->form_confirm($_SERVER["PHP_SELF"]."?socid=".$soc->id,$langs->trans("DeleteACompany"),$langs->trans("ConfirmDeleteCompany"),"confirm_delete",'',0,1);
|
||||
$ret=$html->form_confirm($_SERVER["PHP_SELF"]."?socid=".$soc->id,$langs->trans("DeleteACompany"),$langs->trans("ConfirmDeleteCompany"),"confirm_delete",'',0,"1,action-delete");
|
||||
if ($ret == 'html') print '<br>';
|
||||
}
|
||||
|
||||
@ -1690,29 +1690,36 @@ else
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
print '<div class="tabsAction">';
|
||||
print '<div class="tabsAction">'."\n";
|
||||
|
||||
if ($user->rights->societe->creer)
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?socid='.$soc->id.'&action=edit">'.$langs->trans("Modify").'</a>';
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?socid='.$soc->id.'&action=edit">'.$langs->trans("Modify").'</a>'."\n";
|
||||
}
|
||||
|
||||
if ($user->rights->societe->contact->creer)
|
||||
{
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/contact/fiche.php?socid='.$soc->id.'&action=create">'.$langs->trans("AddContact").'</a>';
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/contact/fiche.php?socid='.$soc->id.'&action=create">'.$langs->trans("AddContact").'</a>'."\n";
|
||||
}
|
||||
|
||||
if ($conf->projet->enabled && $user->rights->projet->creer)
|
||||
{
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/projet/fiche.php?socid='.$socid.'&action=create">'.$langs->trans("AddProject").'</a>';
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/projet/fiche.php?socid='.$socid.'&action=create">'.$langs->trans("AddProject").'</a>'."\n";
|
||||
}
|
||||
|
||||
if ($user->rights->societe->supprimer)
|
||||
{
|
||||
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?socid='.$soc->id.'&action=delete">'.$langs->trans('Delete').'</a>';
|
||||
if ($conf->use_javascript_ajax && $conf->global->MAIN_CONFIRM_AJAX)
|
||||
{
|
||||
print '<span id="action-delete" class="butActionDelete">'.$langs->trans('Delete').'</span>'."\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?socid='.$soc->id.'&action=delete">'.$langs->trans('Delete').'</a>'."\n";
|
||||
}
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
print '</div>'."\n";
|
||||
print '<br>';
|
||||
|
||||
print '<table width="100%"><tr><td valign="top" width="50%">';
|
||||
|
||||
@ -955,7 +955,7 @@ span.tabspan {
|
||||
|
||||
/* Nouvelle syntaxe a utiliser */
|
||||
|
||||
a.butAction:link, a.butAction:visited, a.butAction:hover, a.butAction:active, a.butActionDelete, a.butActionDelete:link, a.butActionDelete:visited, a.butActionDelete:hover, a.butActionDelete:active {
|
||||
.butAction:link, .butAction:visited, .butAction:hover, .butAction:active, .butActionDelete, .butActionDelete:link, .butActionDelete:visited, .butActionDelete:hover, .butActionDelete:active {
|
||||
font-family: <?php print $fontlist ?>;
|
||||
font-weight: bold;
|
||||
background: white;
|
||||
@ -967,19 +967,19 @@ a.butAction:link, a.butAction:visited, a.butAction:hover, a.butAction:active, a.
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
a.butAction:hover {
|
||||
.butAction:hover {
|
||||
background: #dee7ec;
|
||||
}
|
||||
|
||||
a.butActionDelete {
|
||||
.butActionDelete {
|
||||
border: 1px solid red;
|
||||
}
|
||||
|
||||
a.butActionDelete:link, a.butActionDelete:visited, a.butActionDelete:hover, a.butActionDelete:active {
|
||||
.butActionDelete:link, .butActionDelete:visited, .butActionDelete:hover, .butActionDelete:active {
|
||||
border: 1px solid #997777;
|
||||
}
|
||||
|
||||
a.butActionDelete:hover {
|
||||
.butActionDelete:hover {
|
||||
background: #FFe7ec;
|
||||
}
|
||||
|
||||
@ -996,6 +996,9 @@ a.butActionDelete:hover {
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
span.butActionDelete {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/* ============================================================================== */
|
||||
/* Tables */
|
||||
|
||||
Loading…
Reference in New Issue
Block a user