Formatting

This commit is contained in:
Miles Lott 2001-05-21 08:18:40 +00:00
parent 2f3662b936
commit 19eec8895a
4 changed files with 63 additions and 44 deletions

View File

@ -11,7 +11,7 @@
\**************************************************************************/ \**************************************************************************/
/* $Id$ */ /* $Id$ */
$phpgw_info["flags"]["currentapp"] = 'addressbook'; $phpgw_info['flags']['currentapp'] = 'addressbook';
include('../header.inc.php'); include('../header.inc.php');
if(!$phpgw->acl->check('run',1,'admin')) if(!$phpgw->acl->check('run',1,'admin'))
@ -27,7 +27,8 @@
$t->set_block('form','add','addhandle'); $t->set_block('form','add','addhandle');
$t->set_block('form','edit','edithandle'); $t->set_block('form','edit','edithandle');
if ($submit) { if ($submit)
{
$errorcount = 0; $errorcount = 0;
if (!$field_name) if (!$field_name)

View File

@ -26,8 +26,8 @@
} }
$this = CreateObject('phpgwapi.contacts'); $this = CreateObject('phpgwapi.contacts');
$fields = $this->read_single_entry($ab_id,array("owner" => "owner")); $fields = $this->read_single_entry($ab_id,array('owner' => 'owner'));
//$record_owner = $fields[0]["owner"]; //$record_owner = $fields[0]['owner'];
if (! $this->check_perms($this->grants[$fields[0]['owner']],PHPGW_ACL_DELETE) && $fields[0]['owner'] != $phpgw_info['user']['account_id']) if (! $this->check_perms($this->grants[$fields[0]['owner']],PHPGW_ACL_DELETE) && $fields[0]['owner'] != $phpgw_info['user']['account_id'])
{ {
@ -37,26 +37,30 @@
} }
$t = new Template(PHPGW_APP_TPL); $t = new Template(PHPGW_APP_TPL);
$t->set_file(array("delete" => "delete.tpl")); $t->set_file(array('delete' => 'delete.tpl'));
if ($confirm != "true") { if ($confirm != 'true')
{
$phpgw->common->phpgw_header(); $phpgw->common->phpgw_header();
echo parse_navbar(); echo parse_navbar();
$t->set_var(lang_sure,lang("Are you sure you want to delete this entry ?")); $t->set_var('lang_sure',lang('Are you sure you want to delete this entry ?'));
$t->set_var(no_link,$phpgw->link("/addressbook/index.php", $t->set_var('no_link',$phpgw->link('/addressbook/index.php',
"ab_id=$ab_id&order=$order&sort=$sort&filter=$filter&start=$start&query=$query&cat_id=$cat_id")); "ab_id=$ab_id&order=$order&sort=$sort&filter=$filter&start=$start&query=$query&cat_id=$cat_id"));
$t->set_var(lang_no,lang("NO")); $t->set_var('lang_no',lang('NO'));
$t->set_var(yes_link,$phpgw->link("/addressbook/delete.php", $t->set_var('yes_link',$phpgw->link('/addressbook/delete.php',
"ab_id=$ab_id&confirm=true&order=$order&sort=$sort&filter=$filter&start=$start&query=$query&cat_id=$cat_id")); "ab_id=$ab_id&confirm=true&order=$order&sort=$sort&filter=$filter&start=$start&query=$query&cat_id=$cat_id"));
$t->set_var(lang_yes,lang("YES")); $t->set_var('lang_yes',lang('YES'));
$t->pparse("out","delete"); $t->pparse('out','delete');
$phpgw->common->phpgw_footer(); $phpgw->common->phpgw_footer();
} else { }
$this->account_id=$phpgw_info["user"]["account_id"]; else
{
$this->account_id = $phpgw_info['user']['account_id'];
$this->delete($ab_id); $this->delete($ab_id);
@Header("Location: " . $phpgw->link("/addressbook/index.php",
@Header('Location: ' . $phpgw->link('/addressbook/index.php',
"cd=16&order=$order&sort=$sort&filter=$filter&start=$start&query=$query&cat_id=$cat_id")); "cd=16&order=$order&sort=$sort&filter=$filter&start=$start&query=$query&cat_id=$cat_id"));
} }
?> ?>

View File

@ -11,49 +11,52 @@
\**************************************************************************/ \**************************************************************************/
/* $Id$ */ /* $Id$ */
if ($confirm) { if ($confirm)
$phpgw_info["flags"] = array( {
$phpgw_info['flags'] = array(
'noheader' => True, 'noheader' => True,
'nonavbar' => True 'nonavbar' => True
); );
} }
$phpgw_info["flags"]["currentapp"] = 'addressbook'; $phpgw_info['flags']['currentapp'] = 'addressbook';
include('../header.inc.php'); include('../header.inc.php');
if (!$field) { if (!$field)
{
Header('Location: ' . $phpgw->link('/addressbook/fields.php')); Header('Location: ' . $phpgw->link('/addressbook/fields.php'));
} }
if ($confirm) { if ($confirm)
{
save_custom_field($field); save_custom_field($field);
Header('Location: ' . $phpgw->link('/addressbook/fields.php',"start=$start&query=$query&sort=$sort")); Header('Location: ' . $phpgw->link('/addressbook/fields.php',"start=$start&query=$query&sort=$sort"));
} }
else else
{ {
$hidden_vars = "<input type=\"hidden\" name=\"sort\" value=\"$sort\">\n" $hidden_vars = '<input type="hidden" name="sort" value="' . $sort . '">' . "\n"
. "<input type=\"hidden\" name=\"order\" value=\"$order\">\n" . '<input type="hidden" name="order" value="' . $order .'">' . "\n"
. "<input type=\"hidden\" name=\"query\" value=\"$query\">\n" . '<input type="hidden" name="query" value="' . $query .'">' . "\n"
. "<input type=\"hidden\" name=\"start\" value=\"$start\">\n" . '<input type="hidden" name="start" value="' . $start .'">' . "\n"
. "<input type=\"hidden\" name=\"field\" value=\"$field\">\n"; . '<input type="hidden" name="field" value="' . $field .'">' . "\n";
$t = new Template(PHPGW_APP_TPL); $t = new Template(PHPGW_APP_TPL);
$t->set_file(array('field_delete' => 'delete_common.tpl')); $t->set_file(array('field_delete' => 'delete_common.tpl'));
$t->set_var('messages',lang('Are you sure you want to delete this field?')); $t->set_var('messages',lang('Are you sure you want to delete this field?'));
$nolinkf = $phpgw->link('/addressbook/fields.php',"field_id=$field_id&start=$start&query=$query&sort=$sort"); $nolinkf = $phpgw->link('/addressbook/fields.php',"field_id=$field_id&start=$start&query=$query&sort=$sort");
$nolink = "<a href=\"$nolinkf\">" . lang('No') ."</a>"; $nolink = '<a href="' . $nolinkf . '">' . lang('No') . '</a>';
$t->set_var('no',$nolink); $t->set_var('no',$nolink);
$yeslinkf = $phpgw->link('/addressbook/deletefield.php',"field_id=$field_id&confirm=True"); $yeslinkf = $phpgw->link('/addressbook/deletefield.php','field_id=' . $field_id . '&confirm=True');
$yeslinkf = "<FORM method=\"POST\" name=yesbutton action=\"".$phpgw->link('/addressbook/deletefield.php') . "\">" $yeslinkf = '<form method="POST" name="yesbutton" action="' . $phpgw->link('/addressbook/deletefield.php') . '\">'
. $hidden_vars . $hidden_vars
. "<input type=hidden name=field_id value=$field_id>" . '<input type="hidden" name="field_id" value="' . $field_id . '">'
. "<input type=hidden name=confirm value=True>" . '<input type="hidden" name="confirm" value="True">'
. "<input type=submit name=yesbutton value=Yes>" . '<input type="submit" name="yesbutton" value="Yes">'
. "</FORM><SCRIPT>document.yesbutton.yesbutton.focus()</SCRIPT>"; . '</form><script>document.yesbutton.yesbutton.focus()</script>';
$yeslink = "<a href=\"$yeslinkf\">" . lang('Yes') ."</a>"; $yeslink = '<a href="' . $yeslinkf . '">' . lang('Yes') . '</a>';
$yeslink = $yeslinkf; $yeslink = $yeslinkf;
$t->set_var('yes',$yeslink); $t->set_var('yes',$yeslink);

View File

@ -11,7 +11,7 @@
\**************************************************************************/ \**************************************************************************/
/* $Id$ */ /* $Id$ */
$phpgw_info["flags"]["currentapp"] = 'addressbook'; $phpgw_info['flags']['currentapp'] = 'addressbook';
include('../header.inc.php'); include('../header.inc.php');
if(!$phpgw->acl->check('run',1,'admin')) if(!$phpgw->acl->check('run',1,'admin'))
@ -22,7 +22,8 @@
} }
if (!$field) { if (!$field)
{
Header('Location: ' . $phpgw->link('/addressbook/fields.php',"sort=$sort&query=$query&start=$start")); Header('Location: ' . $phpgw->link('/addressbook/fields.php',"sort=$sort&query=$query&start=$start"));
} }
@ -31,12 +32,13 @@
$t->set_block('form','add','addhandle'); $t->set_block('form','add','addhandle');
$t->set_block('form','edit','edithandle'); $t->set_block('form','edit','edithandle');
$hidden_vars = "<input type=\"hidden\" name=\"sort\" value=\"$sort\">\n" $hidden_vars = '<input type="hidden" name="sort" value="' . $sort . '">' . "\n"
. "<input type=\"hidden\" name=\"query\" value=\"$query\">\n" . '<input type="hidden" name="query" value="' . $query . '">' . "\n"
. "<input type=\"hidden\" name=\"start\" value=\"$start\">\n" . '<input type="hidden" name="start" value="' . $start . '">' . "\n"
. "<input type=\"hidden\" name=\"field\" value=\"$field\">\n"; . '<input type="hidden" name="field" value="' . $field . '">' . "\n";
if ($submit) { if ($submit)
{
$errorcount = 0; $errorcount = 0;
if (!$field_name) { $error[$errorcount++] = lang('Please enter a name for that field!'); } if (!$field_name) { $error[$errorcount++] = lang('Please enter a name for that field!'); }
@ -48,9 +50,18 @@
} }
} }
if ($errorcount) { $t->set_var('message',$phpgw->common->error_list($error)); } if ($errorcount)
if (($submit) && (! $error) && (! $errorcount)) { $t->set_var('message',lang("Field x has been updated !", $field_name)); } {
if ((! $submit) && (! $error) && (! $errorcount)) { $t->set_var('message',''); } $t->set_var('message',$phpgw->common->error_list($error));
}
if (($submit) && (! $error) && (! $errorcount))
{
$t->set_var('message',lang('Field x has been updated !', $field_name));
}
if ((! $submit) && (! $error) && (! $errorcount))
{
$t->set_var('message','');
}
if ($submit) if ($submit)
{ {