changed delete-confirmation to use javascript

This commit is contained in:
Ralf Becker 2005-11-23 17:31:50 +00:00
parent 4adc7504f1
commit 5c71cc8378
2 changed files with 6 additions and 5 deletions

View File

@ -524,6 +524,7 @@
$GLOBALS['egw']->template->set_var('export_url',$GLOBALS['egw']->link('/index.php','menuaction=addressbook.uiXport.export')); $GLOBALS['egw']->template->set_var('export_url',$GLOBALS['egw']->link('/index.php','menuaction=addressbook.uiXport.export'));
$GLOBALS['egw']->template->set_var('lang_delete',lang('Delete')); $GLOBALS['egw']->template->set_var('lang_delete',lang('Delete'));
$GLOBALS['egw']->template->set_var('column_count',count($columns_to_display)); $GLOBALS['egw']->template->set_var('column_count',count($columns_to_display));
$GLOBALS['egw']->template->set_var('lang_sure',lang('Are you sure you want to delete these entries ?'));
$GLOBALS['egw']->template->set_var('start',$this->start); $GLOBALS['egw']->template->set_var('start',$this->start);
$GLOBALS['egw']->template->set_var('sort',$this->sort); $GLOBALS['egw']->template->set_var('sort',$this->sort);
@ -606,7 +607,7 @@
'menuaction' => 'addressbook.uiaddressbook.delete', 'menuaction' => 'addressbook.uiaddressbook.delete',
'ab_id' => $entries[$i]['id'] 'ab_id' => $entries[$i]['id']
)) ))
. '"><img src="' . '" onclick="return confirm(\''.lang('Are you sure you want to delete this entry ?').'\');"><img src="'
. $GLOBALS['egw']->common->image('addressbook','delete') . $GLOBALS['egw']->common->image('addressbook','delete')
. '" border="0" title="'.lang('Delete').'"></a>'; . '" border="0" title="'.lang('Delete').'"></a>';
} }
@ -854,7 +855,6 @@
function delete() function delete()
{ {
$ab_id = $_POST['entry']['ab_id'] ? $_POST['entry']['ab_id'] : $_POST['ab_id']; $ab_id = $_POST['entry']['ab_id'] ? $_POST['entry']['ab_id'] : $_POST['ab_id'];
$confirm = $_GET['confirm'] ? $_GET['confirm'] :$_POST['confirm'];
$select = $_POST['select']; $select = $_POST['select'];
if(@is_array($select)) if(@is_array($select))
{ {
@ -880,7 +880,7 @@
{ {
$select[] = $ab_id; $select[] = $ab_id;
} }
foreach($select as $null => $_id) foreach($select as $_id)
{ {
if(!(int)$_id) if(!(int)$_id)
{ {
@ -894,7 +894,7 @@
$GLOBALS['egw']->common->phpgw_exit(); $GLOBALS['egw']->common->phpgw_exit();
} }
} }
/* done via javascript confirmation
$GLOBALS['egw']->template->set_file(array('delete' => 'delete.tpl')); $GLOBALS['egw']->template->set_file(array('delete' => 'delete.tpl'));
if(!$_POST['yes']) if(!$_POST['yes'])
@ -919,6 +919,7 @@
$GLOBALS['egw']->template->pparse('out','delete'); $GLOBALS['egw']->template->pparse('out','delete');
} }
else else
*/
{ {
if(!@is_array($select)) if(!@is_array($select))
{ {

View File

@ -66,7 +66,7 @@ function check_all(which)
<!-- BEGIN delete_block --> <!-- BEGIN delete_block -->
<tr bgcolor="{row_tr_color}"><td colspan="{column_count}">&nbsp;</td> <tr bgcolor="{row_tr_color}"><td colspan="{column_count}">&nbsp;</td>
<td align="right"><input type="submit" name="Delete" value="{lang_delete}"></td> <td align="right"><input type="submit" name="Delete" value="{lang_delete}" onclick="return confirm('{lang_sure}');"></td>
</tr> </tr>
<!-- END delete_block --> <!-- END delete_block -->