Switch to use of Save/Apply/Cancel for save and edit pages. Fix array close in boaddressbook.

This commit is contained in:
Miles Lott 2005-07-17 16:46:36 +00:00
parent fc99dbd57f
commit 29cfef66be
6 changed files with 34 additions and 21 deletions

View File

@ -23,7 +23,7 @@
'add_vcard' => True,
'add_email' => True,
'update_entry' => True,
'delete_entry' => True,
'delete_entry' => True
);
var $xml_functions = array();
@ -56,7 +56,7 @@
'customfields' => array(
'in' => array('array'),
'out'=> array('struct')
),
)
);
var $debug = False;

View File

@ -710,7 +710,7 @@
function add()
{
if($_POST['submit'])
if($_POST['save'] || $_POST['apply'])
{
$fields = $this->get_form();
@ -726,7 +726,7 @@
}
// $ab_id = $this->bo->get_lastid();
if(!$errors)
if(!$errors && $_POST['save'])
{
Header('Location: '
. $GLOBALS['egw']->link('/index.php','menuaction=addressbook.uiaddressbook.view&ab_id=' . $ab_id . '&referer=' . $referer));
@ -754,6 +754,7 @@
$GLOBALS['egw']->template->set_var('errors',implode(',',$errors));
}
$GLOBALS['egw']->template->set_var('lang_save',lang('Save'));
$GLOBALS['egw']->template->set_var('lang_apply',lang('Apply'));
$GLOBALS['egw']->template->set_var('lang_cancel',lang('Cancel'));
$GLOBALS['egw']->template->set_var('cancel_url',$GLOBALS['egw']->link('/index.php','menuaction=addressbook.uiaddressbook.index'));
$GLOBALS['egw']->template->parse('out','add');
@ -762,7 +763,7 @@
function edit()
{
if($_POST['submit'])
if($_POST['save'] || $_POST['apply'])
{
$_fields = $this->get_form();
/* _debug_array($_fields);exit; */
@ -782,12 +783,14 @@
$this->bo->update_entry($_fields);
if($_POST['save'])
{
Header('Location: '
. $GLOBALS['egw']->link('/index.php','menuaction=addressbook.uiaddressbook.view&ab_id=' . $_fields['ab_id'] . '&referer=' . $referer)
);
$GLOBALS['egw']->common->phpgw_exit();
}
}
/* First, make sure they have permission to this entry */
$check = $this->bo->read_entry(array('id' => (int) $_GET['ab_id'], 'fields' => array('owner' => 'owner','tid' => 'tid')));
@ -824,6 +827,7 @@
$GLOBALS['egw']->template->set_var('tid',$check[0]['tid']);
$GLOBALS['egw']->template->set_var('referer',$referer);
$GLOBALS['egw']->template->set_var('lang_save',lang('Save'));
$GLOBALS['egw']->template->set_var('lang_apply',lang('Apply'));
$GLOBALS['egw']->template->set_var('lang_cancel',lang('Cancel'));
$GLOBALS['egw']->template->set_var('cancel_link','<form method="POST" action="'
. $GLOBALS['egw']->link('/index.php','menuaction=addressbook.uiaddressbook.index') . '">');
@ -940,7 +944,8 @@
function view()
{
$ab_id = (int) $_GET['ab_id'];
$submit = $_POST['submit'];
$save = $_POST['save'];
$apply = $_POST['apply'];
$referer = $this->rebuild_referer($_GET['referer']);
/* First, make sure they have permission to this entry */
@ -949,7 +954,7 @@
Header('Location: ' . $GLOBALS['egw']->link('/index.php','menuaction=addressbook.uiaddressbook.index'));
$GLOBALS['egw']->common->phpgw_exit();
}
elseif(!$submit && $ab_id)
elseif(!($save || $apply) && $ab_id)
{
$GLOBALS['egw_info']['flags']['app_header'] = lang('Address book - view');
$GLOBALS['egw']->common->phpgw_header();
@ -1334,6 +1339,7 @@
$GLOBALS['egw']->template->set_var('lang_other',lang('Other').' '.lang('Fields'));
$GLOBALS['egw']->template->set_var('lang_otherprefs',lang('Other').' '.lang('Preferences'));
$GLOBALS['egw']->template->set_var('lang_save',lang('Save'));
$GLOBALS['egw']->template->set_var('lang_apply',lang('Apply'));
$GLOBALS['egw']->template->set_var('lang_cancel',lang('Cancel'));
$GLOBALS['egw']->template->set_var('th_bg', $GLOBALS['egw_info']['theme']['th_bg']);
$GLOBALS['egw']->template->set_var('th_text',$GLOBALS['egw_info']['theme']['th_text']);

View File

@ -3,7 +3,10 @@
<!--<table border="0" cellPadding="0" cellSpacing="0" width="77%">-->
<tr>
<td width="10%">
<input type="submit" name="submit" value="{lang_save}">&nbsp;
<input type="submit" name="save" value="{lang_save}">&nbsp;
</td>
<td width="10%">
<input type="submit" name="apply" value="{lang_apply}">&nbsp;
</td>
</form>
<form action="{cancel_url}" method="post">

View File

@ -6,8 +6,11 @@
<!-- <table border="0" cellPadding="1" cellSpacing="1" width="95%" align="center">-->
<tr valign="top">
<td align="left" width="10%">
<input type="submit" name="submit" value="{lang_save}"></form>
</TD>
<input type="submit" name="save" value="{lang_save}">
</td>
<td align="left" width="10%">
<input type="submit" name="apply" value="{lang_apply}"></form>
</td>
<td align="left" colspan="3">
{cancel_link}
&nbsp;<input type="submit" name="cancel" value="{lang_cancel}"></form>

View File

@ -136,6 +136,7 @@
<tr height="40">
<td colspan="6">
<input type="submit" name="save" value="{lang_save}"> &nbsp;
<input type="submit" name="apply" value="{lang_apply}"> &nbsp;
<input type="submit" name="cancel" value="{lang_cancel}">
</td>
</tr>