egroupware/addressbook/deletefield.php

74 lines
3.1 KiB
PHP
Raw Normal View History

2001-04-21 16:51:05 +02:00
<?php
/**************************************************************************\
2001-04-23 05:13:03 +02:00
* phpGroupWare - Addressbook *
2001-04-21 16:51:05 +02:00
* (http://www.phpgroupware.org) *
2001-05-21 10:18:40 +02:00
* Written by Bettina Gille [ceb@phpgroupware.org] *
2001-04-21 16:51:05 +02:00
* ----------------------------------------------- *
* 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. *
\**************************************************************************/
/* $Id$ */
$GLOBALS['phpgw_info'] = array();
2001-12-04 02:04:21 +01:00
if ($HTTP_POST_VARS['confirm'])
2001-05-21 10:18:40 +02:00
{
2001-12-04 02:04:21 +01:00
$GLOBALS['phpgw_info']['flags'] = array(
2001-04-21 16:51:05 +02:00
'noheader' => True,
'nonavbar' => True
);
}
2001-12-04 02:04:21 +01:00
$GLOBALS['phpgw_info']['flags']['currentapp'] = 'addressbook';
2001-04-21 16:51:05 +02:00
include('../header.inc.php');
2001-12-04 02:04:21 +01:00
if (!$HTTP_POST_VARS['field'])
2001-05-21 10:18:40 +02:00
{
2001-12-04 02:04:21 +01:00
Header('Location: ' . $GLOBALS['phpgw']->link('/addressbook/fields.php'));
2001-04-21 16:51:05 +02:00
}
2001-12-04 02:04:21 +01:00
$field = $HTTP_POST_VARS['field'];
$field_id = $HTTP_POST_VARS['field_id'] ? $HTTP_POST_VARS['field_id'] : $HTTP_GET_VARS['field_id'];
$start = $HTTP_POST_VARS['start'];
$query = $HTTP_POST_VARS['query'];
$sort = $HTTP_POST_VARS['sort'];
if ($HTTP_POST_VARS['confirm'])
2001-05-21 10:18:40 +02:00
{
2001-04-21 16:51:05 +02:00
save_custom_field($field);
2001-12-04 02:04:21 +01:00
Header('Location: ' . $GLOBALS['phpgw']->link('/addressbook/fields.php',"start=$start&query=$query&sort=$sort"));
2001-04-21 16:51:05 +02:00
}
else
{
2001-05-21 10:18:40 +02:00
$hidden_vars = '<input type="hidden" name="sort" value="' . $sort . '">' . "\n"
. '<input type="hidden" name="order" value="' . $order .'">' . "\n"
. '<input type="hidden" name="query" value="' . $query .'">' . "\n"
. '<input type="hidden" name="start" value="' . $start .'">' . "\n"
. '<input type="hidden" name="field" value="' . $field .'">' . "\n";
2001-04-21 16:51:05 +02:00
2001-12-04 02:04:21 +01:00
$GLOBALS['phpgw']->template->set_file(array('field_delete' => 'delete_common.tpl'));
$GLOBALS['phpgw']->template->set_var('messages',lang('Are you sure you want to delete this field?'));
2001-04-21 16:51:05 +02:00
2001-12-04 02:04:21 +01:00
$nolinkf = $GLOBALS['phpgw']->link('/addressbook/fields.php',"field_id=$field_id&start=$start&query=$query&sort=$sort");
2001-05-21 10:18:40 +02:00
$nolink = '<a href="' . $nolinkf . '">' . lang('No') . '</a>';
2001-12-04 02:04:21 +01:00
$phpgw->template->set_var('no',$nolink);
2001-04-21 16:51:05 +02:00
2001-12-04 02:04:21 +01:00
$yeslinkf = $GLOBALS['phpgw']->link('/addressbook/deletefield.php','field_id=' . $field_id . '&confirm=True');
$yeslinkf = '<form method="POST" name="yesbutton" action="' . $GLOBALS['phpgw']->link('/addressbook/deletefield.php') . '\">'
2001-04-21 16:51:05 +02:00
. $hidden_vars
2001-05-21 10:18:40 +02:00
. '<input type="hidden" name="field_id" value="' . $field_id . '">'
. '<input type="hidden" name="confirm" value="True">'
. '<input type="submit" name="yesbutton" value="Yes">'
. '</form><script>document.yesbutton.yesbutton.focus()</script>';
2001-04-21 16:51:05 +02:00
2001-05-21 10:18:40 +02:00
$yeslink = '<a href="' . $yeslinkf . '">' . lang('Yes') . '</a>';
2001-04-21 16:51:05 +02:00
$yeslink = $yeslinkf;
2001-12-04 02:04:21 +01:00
$GLOBALS['phpgw']->template->set_var('yes',$yeslink);
2001-04-21 16:51:05 +02:00
2001-12-04 02:04:21 +01:00
$GLOBALS['phpgw']->template->pparse('out','field_delete');
2001-04-21 16:51:05 +02:00
}
2001-12-04 02:04:21 +01:00
$GLOBALS['phpgw']->common->phpgw_footer();
2001-04-21 16:51:05 +02:00
?>