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)
|
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';
|
$pageyes=$page.'&action='.$action.'&confirm=yes';
|
||||||
$pageno=($useajax == 2?$page.'&confirm=no':'');
|
$pageno=($useajax == 2?$page.'&confirm=no':'');
|
||||||
|
|
||||||
// New code using jQuery only
|
// 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>';
|
if (! empty($more)) $formconfirm.= '<p>'.$more.'</p>';
|
||||||
$formconfirm.= img_help('','').' '.$question;
|
$formconfirm.= img_help('','').' '.$question;
|
||||||
$formconfirm.= '</div>'."\n";
|
$formconfirm.= '</div>'."\n";
|
||||||
$formconfirm.= '<script type="text/javascript">
|
$formconfirm.= '<script type="text/javascript">
|
||||||
|
$(function() {
|
||||||
var choice=\'ko\';
|
var choice=\'ko\';
|
||||||
var $inputarray='.json_encode($inputarray).';
|
var $inputarray='.json_encode($inputarray).';
|
||||||
jQuery("#dialog-confirm").dialog({
|
|
||||||
autoOpen: true,
|
$("#'.$dialogconfirm.'").dialog({
|
||||||
|
autoOpen: '.($autoOpen?'true':'false').',
|
||||||
resizable: false,
|
resizable: false,
|
||||||
height:'.$height.',
|
height:'.$height.',
|
||||||
width:'.$width.',
|
width:'.$width.',
|
||||||
@ -2074,14 +2083,19 @@ class Form
|
|||||||
buttons: {
|
buttons: {
|
||||||
\''.dol_escape_js($langs->transnoentities("Yes")).'\': function() {
|
\''.dol_escape_js($langs->transnoentities("Yes")).'\': function() {
|
||||||
choice=\'ok\';
|
choice=\'ok\';
|
||||||
jQuery(this).dialog(\'close\');
|
$(this).dialog(\'close\');
|
||||||
},
|
},
|
||||||
\''.dol_escape_js($langs->transnoentities("No")).'\': function() {
|
\''.dol_escape_js($langs->transnoentities("No")).'\': function() {
|
||||||
choice=\'ko\';
|
choice=\'ko\';
|
||||||
jQuery(this).dialog(\'close\');
|
$(this).dialog(\'close\');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$( "#'.$button.'" ).click(function() {
|
||||||
|
$( "#'.$dialogconfirm.'" ).dialog( \'open\' );
|
||||||
|
});
|
||||||
|
});
|
||||||
</script>';
|
</script>';
|
||||||
|
|
||||||
$formconfirm.= "\n";
|
$formconfirm.= "\n";
|
||||||
|
|||||||
@ -1328,10 +1328,10 @@ else
|
|||||||
|
|
||||||
|
|
||||||
// Confirm delete third party
|
// Confirm delete third party
|
||||||
if ($action == 'delete')
|
if ($action == 'delete' || ($conf->use_javascript_ajax && $conf->global->MAIN_CONFIRM_AJAX))
|
||||||
{
|
{
|
||||||
$html = new Form($db);
|
$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>';
|
if ($ret == 'html') print '<br>';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1690,29 +1690,36 @@ else
|
|||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
print '<div class="tabsAction">';
|
print '<div class="tabsAction">'."\n";
|
||||||
|
|
||||||
if ($user->rights->societe->creer)
|
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)
|
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)
|
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)
|
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 '<br>';
|
||||||
|
|
||||||
print '<table width="100%"><tr><td valign="top" width="50%">';
|
print '<table width="100%"><tr><td valign="top" width="50%">';
|
||||||
|
|||||||
@ -955,7 +955,7 @@ span.tabspan {
|
|||||||
|
|
||||||
/* Nouvelle syntaxe a utiliser */
|
/* 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-family: <?php print $fontlist ?>;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
background: white;
|
background: white;
|
||||||
@ -967,19 +967,19 @@ a.butAction:link, a.butAction:visited, a.butAction:hover, a.butAction:active, a.
|
|||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
a.butAction:hover {
|
.butAction:hover {
|
||||||
background: #dee7ec;
|
background: #dee7ec;
|
||||||
}
|
}
|
||||||
|
|
||||||
a.butActionDelete {
|
.butActionDelete {
|
||||||
border: 1px solid red;
|
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;
|
border: 1px solid #997777;
|
||||||
}
|
}
|
||||||
|
|
||||||
a.butActionDelete:hover {
|
.butActionDelete:hover {
|
||||||
background: #FFe7ec;
|
background: #FFe7ec;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -996,6 +996,9 @@ a.butActionDelete:hover {
|
|||||||
cursor: not-allowed;
|
cursor: not-allowed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
span.butActionDelete {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
/* ============================================================================== */
|
/* ============================================================================== */
|
||||||
/* Tables */
|
/* Tables */
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user