mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-31 02:21:28 +01:00
More efficient displaycol function, and some formatting
This commit is contained in:
parent
5af7116030
commit
17f1114d6d
@ -20,13 +20,18 @@
|
|||||||
|
|
||||||
$grants = $phpgw->acl->get_grants('addressbook');
|
$grants = $phpgw->acl->get_grants('addressbook');
|
||||||
|
|
||||||
if(!isset($owner) || !$owner) {
|
if(!isset($owner) || !$owner)
|
||||||
|
{
|
||||||
$owner = $phpgw_info['user']['account_id'];
|
$owner = $phpgw_info['user']['account_id'];
|
||||||
$rights = PHPGW_ACL_READ + PHPGW_ACL_ADD + PHPGW_ACL_EDIT + PHPGW_ACL_DELETE + 16;
|
$rights = PHPGW_ACL_READ + PHPGW_ACL_ADD + PHPGW_ACL_EDIT + PHPGW_ACL_DELETE + 16;
|
||||||
} else {
|
}
|
||||||
if($grants[$owner]) {
|
else
|
||||||
|
{
|
||||||
|
if($grants[$owner])
|
||||||
|
{
|
||||||
$rights = $grants[$owner];
|
$rights = $grants[$owner];
|
||||||
if (!($rights & PHPGW_ACL_READ)) {
|
if (!($rights & PHPGW_ACL_READ))
|
||||||
|
{
|
||||||
$owner = $phpgw_info['user']['account_id'];
|
$owner = $phpgw_info['user']['account_id'];
|
||||||
$rights = PHPGW_ACL_READ + PHPGW_ACL_ADD + PHPGW_ACL_EDIT + PHPGW_ACL_DELETE + 16;
|
$rights = PHPGW_ACL_READ + PHPGW_ACL_ADD + PHPGW_ACL_EDIT + PHPGW_ACL_DELETE + 16;
|
||||||
}
|
}
|
||||||
@ -82,14 +87,17 @@
|
|||||||
// Return a select form element with the categories option dialog in it
|
// Return a select form element with the categories option dialog in it
|
||||||
function cat_option($cat_id='',$notall=False,$java=True) {
|
function cat_option($cat_id='',$notall=False,$java=True) {
|
||||||
global $phpgw_info;
|
global $phpgw_info;
|
||||||
if ($java) {
|
if ($java)
|
||||||
|
{
|
||||||
$jselect = ' onChange="this.form.submit();"';
|
$jselect = ' onChange="this.form.submit();"';
|
||||||
}
|
}
|
||||||
// Setup all and none first
|
// Setup all and none first
|
||||||
$cats_link = "\n" .'<select name="cat_id"' .$jselect .">\n";
|
$cats_link = "\n" .'<select name="cat_id"' .$jselect .">\n";
|
||||||
if (!$notall) {
|
if (!$notall)
|
||||||
|
{
|
||||||
$cats_link .= '<option value=""';
|
$cats_link .= '<option value=""';
|
||||||
if ($cat_id=="all") {
|
if ($cat_id=="all")
|
||||||
|
{
|
||||||
$cats_link .= ' selected';
|
$cats_link .= ' selected';
|
||||||
}
|
}
|
||||||
$cats_link .= '>'.lang("all").'</option>'."\n";
|
$cats_link .= '>'.lang("all").'</option>'."\n";
|
||||||
@ -103,84 +111,97 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
### SET THE FONT TO DEFAULT IF IT DOESNT EXISTS ###
|
### SET THE FONT TO DEFAULT IF IT DOESNT EXISTS ###
|
||||||
function set_font() {
|
function set_font()
|
||||||
if($phpgw_info["user"]["preferences"]["notes"]["notes_font"] == "") {
|
{
|
||||||
|
if($phpgw_info["user"]["preferences"]["notes"]["notes_font"] == "")
|
||||||
|
{
|
||||||
$font = "Arial";
|
$font = "Arial";
|
||||||
return $font;
|
return $font;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
$font = $phpgw_info["user"]["preferences"]["notes"]["notes_font"];
|
$font = $phpgw_info["user"]["preferences"]["notes"]["notes_font"];
|
||||||
return $font;
|
return $font;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
### SET FONT SIZE ####
|
### SET FONT SIZE ####
|
||||||
function set_font_size() {
|
function set_font_size()
|
||||||
|
{
|
||||||
if($phpgw_info["user"]["preferences"]["notes"]["notes_font_size"] == "") {
|
if($phpgw_info["user"]["preferences"]["notes"]["notes_font_size"] == "") {
|
||||||
$font_size = "3";
|
$font_size = "3";
|
||||||
return $font_size;
|
return $font_size;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
$font_size = $phpgw_info["user"]["preferences"]["notes"]["notes_font_size"];
|
$font_size = $phpgw_info["user"]["preferences"]["notes"]["notes_font_size"];
|
||||||
return $font_size;
|
return $font_size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// this cleans up the fieldnames for display
|
// this cleans up the fieldnames for display
|
||||||
function display_name($column) {
|
function display_name($column)
|
||||||
|
{
|
||||||
$abc = array(
|
$abc = array(
|
||||||
"fn" => "full name",
|
'fn' => 'full name',
|
||||||
"sound" => "Sound",
|
'sound' => 'Sound',
|
||||||
"org_name" => "company name",
|
'org_name' => 'company name',
|
||||||
"org_unit" => "department",
|
'org_unit' => 'department',
|
||||||
"title" => "title",
|
'title' => 'title',
|
||||||
"n_prefix" => "prefix",
|
'n_prefix' => 'prefix',
|
||||||
"n_given" => "first name",
|
'n_given' => 'first name',
|
||||||
"n_middle" => "middle name",
|
'n_middle' => 'middle name',
|
||||||
"n_family" => "last name",
|
'n_family' => 'last name',
|
||||||
"n_suffix" => "suffix",
|
'n_suffix' => 'suffix',
|
||||||
"label" => "label",
|
'label' => 'label',
|
||||||
"adr_one_street" => "business street",
|
'adr_one_street' => 'business street',
|
||||||
"adr_one_locality" => "business city",
|
'adr_one_locality' => 'business city',
|
||||||
"adr_one_region" => "business state",
|
'adr_one_region' => 'business state',
|
||||||
"adr_one_postalcode" => "business zip code",
|
'adr_one_postalcode' => 'business zip code',
|
||||||
"adr_one_countryname" => "business country",
|
'adr_one_countryname' => 'business country',
|
||||||
"adr_one_type" => "business address type",
|
'adr_one_type' => 'business address type',
|
||||||
"adr_two_street" => "home street",
|
'adr_two_street' => 'home street',
|
||||||
"adr_two_locality" => "home city",
|
'adr_two_locality' => 'home city',
|
||||||
"adr_two_region" => "home state",
|
'adr_two_region' => 'home state',
|
||||||
"adr_two_postalcode" => "home zip code",
|
'adr_two_postalcode' => 'home zip code',
|
||||||
"adr_two_countryname" => "home country",
|
'adr_two_countryname' => 'home country',
|
||||||
"adr_two_type" => "home address type",
|
'adr_two_type' => 'home address type',
|
||||||
"tz" => "time zone",
|
'tz' => 'time zone',
|
||||||
"geo" => "geo",
|
'geo' => 'geo',
|
||||||
"tel_work" => "business phone",
|
'tel_work' => 'business phone',
|
||||||
"tel_home" => "home phone",
|
'tel_home' => 'home phone',
|
||||||
"tel_voice" => "voice phone",
|
'tel_voice' => 'voice phone',
|
||||||
"tel_msg" => "message phone",
|
'tel_msg' => 'message phone',
|
||||||
"tel_fax" => "fax",
|
'tel_fax' => 'fax',
|
||||||
"tel_pager" => "pager",
|
'tel_pager' => 'pager',
|
||||||
"tel_cell" => "mobile phone",
|
'tel_cell' => 'mobile phone',
|
||||||
"tel_bbs" => "bbs phone",
|
'tel_bbs' => 'bbs phone',
|
||||||
"tel_modem" => "modem phone",
|
'tel_modem' => 'modem phone',
|
||||||
"tel_isdn" => "isdn phone",
|
'tel_isdn' => 'isdn phone',
|
||||||
"tel_car" => "car phone",
|
'tel_car' => 'car phone',
|
||||||
"tel_video" => "video phone",
|
'tel_video' => 'video phone',
|
||||||
|
|
||||||
"tel_prefer" => "preferred phone",
|
'tel_prefer' => 'preferred phone',
|
||||||
"email" => "business email",
|
'email' => 'business email',
|
||||||
"email_type" => "business email type",
|
'email_type' => 'business email type',
|
||||||
"email_home" => "home email",
|
'email_home' => 'home email',
|
||||||
"email_home_type" => "home email type",
|
'email_home_type' => 'home email type',
|
||||||
"address2" => "address line 2",
|
'address2' => 'address line 2',
|
||||||
"address3" => "address line 3",
|
'address3' => 'address line 3',
|
||||||
"ophone" => "Other Phone",
|
'ophone' => 'Other Phone',
|
||||||
"bday" => "birthday",
|
'bday' => 'birthday',
|
||||||
"url" => "url",
|
'url' => 'url',
|
||||||
"pubkey" => "public key",
|
'pubkey' => 'public key',
|
||||||
"note" => "notes"
|
'note' => 'notes'
|
||||||
);
|
);
|
||||||
|
|
||||||
while($name = each($abc) ) {
|
if ($abc[$column])
|
||||||
if ($column == $name[0]) { return lang($name[1]); }
|
{
|
||||||
|
return lang($abc[$column]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -333,14 +354,19 @@
|
|||||||
|
|
||||||
$cats_link = cat_option($cat_id,True);
|
$cats_link = cat_option($cat_id,True);
|
||||||
|
|
||||||
if ($access == 'private') {
|
if ($access == 'private')
|
||||||
|
{
|
||||||
$access_check = ' checked';
|
$access_check = ' checked';
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
$access_check = '';
|
$access_check = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($customfields) {
|
if ($customfields)
|
||||||
while(list($name,$value) = each($customfields)) {
|
{
|
||||||
|
while(list($name,$value) = each($customfields))
|
||||||
|
{
|
||||||
$custom .= '
|
$custom .= '
|
||||||
<tr>
|
<tr>
|
||||||
<td></td>
|
<td></td>
|
||||||
@ -357,13 +383,16 @@
|
|||||||
|
|
||||||
$this = CreateObject("phpgwapi.contacts");
|
$this = CreateObject("phpgwapi.contacts");
|
||||||
|
|
||||||
if ($format != "view") {
|
if ($format != "view")
|
||||||
|
{
|
||||||
// Preferred phone number radio buttons
|
// Preferred phone number radio buttons
|
||||||
$pref[0] = "<font size=\"-2\">";
|
$pref[0] = "<font size=\"-2\">";
|
||||||
$pref[1] = "(".lang('pref').")</font>";
|
$pref[1] = "(".lang('pref').")</font>";
|
||||||
while (list($name,$val) = each($this->tel_types)) {
|
while (list($name,$val) = each($this->tel_types))
|
||||||
|
{
|
||||||
$str[$name] = "\n".' <input type="radio" name="tel_prefer" value="'.$name.'"';
|
$str[$name] = "\n".' <input type="radio" name="tel_prefer" value="'.$name.'"';
|
||||||
if ($name == $preferred) {
|
if ($name == $preferred)
|
||||||
|
{
|
||||||
$str[$name] .= ' checked';
|
$str[$name] .= ' checked';
|
||||||
}
|
}
|
||||||
$str[$name] .= '>';
|
$str[$name] .= '>';
|
||||||
@ -371,7 +400,8 @@
|
|||||||
$t->set_var("pref_".$name,$str[$name]);
|
$t->set_var("pref_".$name,$str[$name]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strlen($bday) > 2) {
|
if (strlen($bday) > 2)
|
||||||
|
{
|
||||||
list( $month, $day, $year ) = split( '/', $bday );
|
list( $month, $day, $year ) = split( '/', $bday );
|
||||||
$temp_month[$month] = "SELECTED";
|
$temp_month[$month] = "SELECTED";
|
||||||
$bday_month = "<select name=bday_month>"
|
$bday_month = "<select name=bday_month>"
|
||||||
@ -391,7 +421,9 @@
|
|||||||
. "</select>";
|
. "</select>";
|
||||||
$bday_day = '<input maxlength="2" name="bday_day" value="' . $day . '" size="2">';
|
$bday_day = '<input maxlength="2" name="bday_day" value="' . $day . '" size="2">';
|
||||||
$bday_year = '<input maxlength="4" name="bday_year" value="' . $year . '" size="4">';
|
$bday_year = '<input maxlength="4" name="bday_year" value="' . $year . '" size="4">';
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
$bday_month = "<select name=bday_month>"
|
$bday_month = "<select name=bday_month>"
|
||||||
. "<option value=\"\" SELECTED> </option>"
|
. "<option value=\"\" SELECTED> </option>"
|
||||||
. "<option value=1>" . lang("january") . "</option>"
|
. "<option value=1>" . lang("january") . "</option>"
|
||||||
@ -412,19 +444,27 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
$time_zone = "<select name=\"timezone\">\n";
|
$time_zone = "<select name=\"timezone\">\n";
|
||||||
for ($i = -23; $i<24; $i++) {
|
for ($i = -23; $i<24; $i++)
|
||||||
|
{
|
||||||
$time_zone .= "<option value=\"$i\"";
|
$time_zone .= "<option value=\"$i\"";
|
||||||
if ($i == $timezone)
|
if ($i == $timezone)
|
||||||
|
{
|
||||||
$time_zone .= " selected";
|
$time_zone .= " selected";
|
||||||
|
}
|
||||||
if ($i < 1)
|
if ($i < 1)
|
||||||
|
{
|
||||||
$time_zone .= ">$i</option>\n";
|
$time_zone .= ">$i</option>\n";
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
$time_zone .= ">+$i</option>\n";
|
$time_zone .= ">+$i</option>\n";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
$time_zone .= "</select>\n";
|
$time_zone .= "</select>\n";
|
||||||
|
|
||||||
$email_type = '<select name=email_type>';
|
$email_type = '<select name=email_type>';
|
||||||
while ($type = each($this->email_types)) {
|
while ($type = each($this->email_types))
|
||||||
|
{
|
||||||
$email_type .= '<option value="'.$type[0].'"';
|
$email_type .= '<option value="'.$type[0].'"';
|
||||||
if ($type[0] == $emailtype) { $email_type .= ' selected'; }
|
if ($type[0] == $emailtype) { $email_type .= ' selected'; }
|
||||||
$email_type .= '>'.$type[1].'</option>';
|
$email_type .= '>'.$type[1].'</option>';
|
||||||
@ -433,7 +473,8 @@
|
|||||||
|
|
||||||
reset($this->email_types);
|
reset($this->email_types);
|
||||||
$hemail_type = '<select name=hemail_type>';
|
$hemail_type = '<select name=hemail_type>';
|
||||||
while ($type = each($this->email_types)) {
|
while ($type = each($this->email_types))
|
||||||
|
{
|
||||||
$hemail_type .= '<option value="'.$type[0].'"';
|
$hemail_type .= '<option value="'.$type[0].'"';
|
||||||
if ($type[0] == $hemailtype) { $hemail_type .= ' selected'; }
|
if ($type[0] == $hemailtype) { $hemail_type .= ' selected'; }
|
||||||
$hemail_type .= '>'.$type[1].'</option>';
|
$hemail_type .= '>'.$type[1].'</option>';
|
||||||
@ -441,7 +482,8 @@
|
|||||||
$hemail_type .= "</select>";
|
$hemail_type .= "</select>";
|
||||||
|
|
||||||
reset($this->adr_types);
|
reset($this->adr_types);
|
||||||
while (list($type,$val) = each($this->adr_types)) {
|
while (list($type,$val) = each($this->adr_types))
|
||||||
|
{
|
||||||
$badrtype .= "\n".'<INPUT type="checkbox" name="one_'.$type.'"';
|
$badrtype .= "\n".'<INPUT type="checkbox" name="one_'.$type.'"';
|
||||||
$ot = 'one_'.$type;
|
$ot = 'one_'.$type;
|
||||||
eval("
|
eval("
|
||||||
@ -453,7 +495,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
reset($this->adr_types);
|
reset($this->adr_types);
|
||||||
while (list($type,$val) = each($this->adr_types)) {
|
while (list($type,$val) = each($this->adr_types))
|
||||||
|
{
|
||||||
$hadrtype .= "\n".'<INPUT type="checkbox" name="two_'.$type.'"';
|
$hadrtype .= "\n".'<INPUT type="checkbox" name="two_'.$type.'"';
|
||||||
$tt = 'two_'.$type;
|
$tt = 'two_'.$type;
|
||||||
eval("
|
eval("
|
||||||
@ -467,18 +510,24 @@
|
|||||||
$notes = '<TEXTAREA cols="60" name="notes" rows="4">' . $notes . '</TEXTAREA>';
|
$notes = '<TEXTAREA cols="60" name="notes" rows="4">' . $notes . '</TEXTAREA>';
|
||||||
$label = '<TEXTAREA cols="60" name="label" rows="6">' . $label . '</TEXTAREA>';
|
$label = '<TEXTAREA cols="60" name="label" rows="6">' . $label . '</TEXTAREA>';
|
||||||
$pubkey = '<TEXTAREA cols="60" name="pubkey" rows="6">' . $pubkey . '</TEXTAREA>';
|
$pubkey = '<TEXTAREA cols="60" name="pubkey" rows="6">' . $pubkey . '</TEXTAREA>';
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
$notes = "<form><TEXTAREA cols=\"60\" name=\"notes\" rows=\"4\">"
|
$notes = "<form><TEXTAREA cols=\"60\" name=\"notes\" rows=\"4\">"
|
||||||
. $notes . "</TEXTAREA></form>";
|
. $notes . "</TEXTAREA></form>";
|
||||||
if ($bday == "//")
|
if ($bday == "//")
|
||||||
|
{
|
||||||
$bday = "";
|
$bday = "";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($action) {
|
if ($action)
|
||||||
|
{
|
||||||
echo '<FORM action="' . $phpgw->link('/addressbook/' . $action, 'referer='.urlencode($referer)).'" method="post">';
|
echo '<FORM action="' . $phpgw->link('/addressbook/' . $action, 'referer='.urlencode($referer)).'" method="post">';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! ereg("^http://",$url)) {
|
if (!ereg("^http://",$url))
|
||||||
|
{
|
||||||
$url = "http://". $url;
|
$url = "http://". $url;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -594,10 +643,13 @@
|
|||||||
|
|
||||||
$t->set_var('lang_cats',lang('Category'));
|
$t->set_var('lang_cats',lang('Category'));
|
||||||
$t->set_var('cats_link',$cats_link);
|
$t->set_var('cats_link',$cats_link);
|
||||||
if ($customfields) {
|
if ($customfields)
|
||||||
|
{
|
||||||
$t->set_var('lang_custom',lang('Custom Fields').':');
|
$t->set_var('lang_custom',lang('Custom Fields').':');
|
||||||
$t->set_var("custom",$custom);
|
$t->set_var("custom",$custom);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
$t->set_var("lang_custom",'');
|
$t->set_var("lang_custom",'');
|
||||||
$t->set_var("custom",'');
|
$t->set_var("custom",'');
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user