Fix the selection of cats

This commit is contained in:
Miles Lott 2001-03-29 15:39:10 +00:00
parent 966cc127e0
commit 8f786be9f5
8 changed files with 24 additions and 23 deletions

View File

@ -151,7 +151,7 @@
$fields["access"] = 'public';
}
$fields["cat_id"] = $ncat_id;
$fields["cat_id"] = $cat_id;
addressbook_add_entry($phpgw_info["user"]["account_id"],$fields,$fields["access"],$fields["cat_id"]);
$ab_id = addressbook_get_lastid();

View File

@ -32,7 +32,7 @@
if (! $this->check_perms($this->grants[$fields[0]['owner']],PHPGW_ACL_DELETE) && $fields[0]['owner'] != $phpgw_info['user']['account_id'])
{
Header('Location: '
. $phpgw->link('/addressbook/index.php',"cd=16&order=$order&sort=$sort&filter=$filter&start=$start&query=$query&ncat_id=$cat_id"));
. $phpgw->link('/addressbook/index.php',"cd=16&order=$order&sort=$sort&filter=$filter&start=$start&query=$query&cat_id=$cat_id"));
$phpgw->common->phpgw_exit();
}
@ -45,7 +45,7 @@
$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",
"ab_id=$ab_id&order=$order&sort=$sort&filter=$filter&start=$start&query=$query&ncat_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(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"));
@ -57,6 +57,6 @@
$this->account_id=$phpgw_info["user"]["account_id"];
$this->delete($ab_id);
@Header("Location: " . $phpgw->link("/addressbook/index.php",
"cd=16&order=$order&sort=$sort&filter=$filter&start=$start&query=$query&ncat_id=$cat_id"));
"cd=16&order=$order&sort=$sort&filter=$filter&start=$start&query=$query&cat_id=$cat_id"));
}
?>

View File

@ -27,7 +27,7 @@
// First, make sure they have permission to this entry
$check = addressbook_read_entry($ab_id,array('owner' => 'owner'));
if (! $this->check_perms($this->grants[$check[0]['owner']],PHPGW_ACL_EDIT) && $check[0]['owner'] != $phpgw_info['user']['account_id'])
if ( !$this->check_perms($this->grants[$check[0]['owner']],PHPGW_ACL_EDIT) && ($check[0]['owner'] != $phpgw_info['user']['account_id']) )
{
Header("Location: "
. $phpgw->link('/addressbook/index.php',"cd=16&order=$order&sort=$sort&filter=$filter&start=$start&query=$query&cat_id=$cat_id"));
@ -158,7 +158,7 @@
$fields["access"] = 'public';
}
$fields["cat_id"] = $ncat_id;
$fields["cat_id"] = $cat_id;
$userid = $phpgw_info["user"]["account_id"];

View File

@ -52,7 +52,7 @@
$t->set_var("lang_cancel",lang("Cancel"));
$t->set_var("lang_cat",lang("Select Category"));
$t->set_var("cat_link",cat_option($cat_id,'ncat_id',True));
$t->set_var("cat_link",cat_option($cat_id,'cat_id',True));
$t->set_var("cancel_url",$phpgw->link("/addressbook/index.php"));
$t->set_var("navbar_bg",$phpgw_info["theme"]["navbar_bg"]);
$t->set_var("navbar_text",$phpgw_info["theme"]["navbar_text"]);
@ -95,7 +95,7 @@
$this->qfields = $this->stock_contact_fields;# + $extrafields;# + $customfields;
}
$buffer = $this->export_start_file($buffer,$ncat_id);
$buffer = $this->export_start_file($buffer,$cat_id);
for ($i=0;$i<count($this->ids);$i++) {
$buffer = $this->export_start_record($buffer);
@ -122,7 +122,7 @@
echo $buffer;
echo "\n</pre>\n";
echo '<a href="'.$phpgw->link("/addressbook/index.php",
"sort=$sort&order=$order&filter=$filter&start=$start&query=$query&ncat_id=$cat_id")
"sort=$sort&order=$order&filter=$filter&start=$start&query=$query&cat_id=$cat_id")
. '">'.lang("OK").'</a>';
$phpgw->common->phpgw_footer();
}

View File

@ -174,14 +174,14 @@
} else {
echo "<pre>$buffer</pre>";
echo '<a href="'.$phpgw->link("/addressbook/index.php",
"sort=$sort&order=$order&filter=$filter&start=$start&query=$query&ncat_id=$cat_id")
"sort=$sort&order=$order&filter=$filter&start=$start&query=$query&cat_id=$cat_id")
. '">'.lang("OK").'</a>';
$phpgw->common->phpgw_footer();
}
} else {
echo "<pre>$buffer</pre>";
echo '<a href="'.$phpgw->link("/addressbook/index.php",
"sort=$sort&order=$order&filter=$filter&start=$start&query=$query&ncat_id=$cat_id")
"sort=$sort&order=$order&filter=$filter&start=$start&query=$query&cat_id=$cat_id")
. '">'.lang("OK").'</a>';
$phpgw->common->phpgw_footer();
}

View File

@ -41,15 +41,12 @@
}
}
if($ncat_id || ($ncat_id==0)) {
$cat_id = $ncat_id;
}
if ($cat_id=='') {
if (!isset($cat_id)) {
$cat_id = $phpgw_info["user"]["preferences"]["addressbook"]["default_category"];
}
if ($phpgw_info["user"]["preferences"]["addressbook"]["autosave_category"]) {
$phpgw->preferences->delete("addressbook","default_category");
$phpgw->preferences->add("addressbook","default_category",$ncat_id);
$phpgw->preferences->add("addressbook","default_category",$cat_id);
}
$phpgw->preferences->save_repository();
@ -119,9 +116,9 @@
}
} elseif($filter == "private") {
if ($cat_id == "all") {
$qfilter = 'tid=n,owner='.$phpgw_info["user"]["account_id"];
$qfilter = 'tid=n,access=private,owner='.$phpgw_info["user"]["account_id"];
} else {
$qfilter = 'tid=n,owner='.$phpgw_info["user"]["account_id"].',cat_id='.$cat_id;
$qfilter = 'tid=n,access=private,owner='.$phpgw_info["user"]["account_id"].',cat_id='.$cat_id;
}
} else {
if ($cat_id == "all") {

View File

@ -50,10 +50,12 @@
/* First name and last must be in the vcard. */
if($lastname == "") {
/* Run away here. */
Header("Location: " . $phpgw->link("/addressbook/vcardout.php","nolname=1&ab_id=$ab_id&start=$start&order=$order&filter=" . "$filter&query=$query&sort=$sort"));
Header("Location: " . $phpgw->link("/addressbook/vcardout.php",
"nolname=1&ab_id=$ab_id&start=$start&order=$order&filter=$filter&query=$query&sort=$sort&cat_id=$cat_id"));
}
if($firstname == "" ) {
Header("Location: " . $phpgw->link("/addressbook/vcardout.php","nofname=1&ab_id=$ab_id&start=$start&order=$order&filter=" . "$filter&query=$query&sort=$sort"));
Header("Location: " . $phpgw->link("/addressbook/vcardout.php",
"nofname=1&ab_id=$ab_id&start=$start&order=$order&filter=$filter&query=$query&sort=$sort&cat_id=$cat_id"));
}
header("Content-type: text/x-vcard");
@ -85,7 +87,8 @@
echo "<BR><BR><CENTER>";
echo lang("This person's first name was not in the address book.") ."<BR>";
echo lang("Vcards require a first name entry.") . "<BR><BR>";
echo "<a href=" . $phpgw->link("/addressbook/index.php","order=$order&start=$start&filter=$filter&query=$query&sort=$sort") . ">OK</a>";
echo "<a href=" . $phpgw->link("/addressbook/index.php",
"order=$order&start=$start&filter=$filter&query=$query&sort=$sort&cat_id=$cat_id") . ">OK</a>";
echo "</CENTER>";
}
@ -93,7 +96,8 @@
echo "<BR><BR><CENTER>";
echo lang("This person's last name was not in the address book.") . "<BR>";
echo lang("Vcards require a last name entry.") . "<BR><BR>";
echo "<a href=" . $phpgw->link("/addressbook/index.php","order=$order&start=$start&filter=$filter&query=$query&sort=$sort") . ">OK</a>";
echo "<a href=" . $phpgw->link("/addressbook/index.php",
"order=$order&start=$start&filter=$filter&query=$query&sort=$sort&cat_id=$cat_id") . ">OK</a>";
echo "</CENTER>";
}

View File

@ -27,7 +27,7 @@
// First, make sure they have permission to this entry
$check = addressbook_read_entry($ab_id,array('owner' => 'owner'));
if (! $this->check_perms($this->grants[$check[0]['owner']],PHPGW_ACL_READ) && $check[0]['owner'] != $phpgw_info['user']['account_id'])
if (! ($this->check_perms($this->grants[$check[0]['owner']],PHPGW_ACL_READ) || $check[0]['owner'] != $phpgw_info['user']['account_id']) )
{
Header("Location: "
. $phpgw->link('/addressbook/index.php',"cd=16&order=$order&sort=$sort&filter=$filter&start=$start&query=$query&cat_id=$cat_id"));