From b1df65cdfe415fedb18d785231e0b278b5a446d4 Mon Sep 17 00:00:00 2001 From: Miles Lott Date: Tue, 23 Jan 2001 13:40:42 +0000 Subject: [PATCH] Another template update to allow for better customization in index.php. --- addressbook/acl_preferences.php | 89 +++++++++++++++++++ addressbook/import.php | 2 +- .../inc/class.addressbook_ldap.inc.php | 6 +- addressbook/inc/class.addressbook_sql.inc.php | 6 +- addressbook/inc/hook_preferences.inc.php | 7 +- addressbook/index.php | 4 +- addressbook/templates/default/header.tpl | 26 +++++- addressbook/templates/justweb/header.tpl | 26 +++++- addressbook/templates/verdilak/header.tpl | 26 +++++- 9 files changed, 174 insertions(+), 18 deletions(-) create mode 100755 addressbook/acl_preferences.php diff --git a/addressbook/acl_preferences.php b/addressbook/acl_preferences.php new file mode 100755 index 0000000000..5793c10489 --- /dev/null +++ b/addressbook/acl_preferences.php @@ -0,0 +1,89 @@ + "addressbook", "enable_addressbook_class" => True, "enable_nextmatchs_class" => True, "noappheader" => True, "noappfooter" => True); + + if(isset($submit) && $submit) { + $phpgw_info["flags"]["noheader"] = True; + $phpgw_info["flags"]["nonavbar"] = True; + } + + include("../header.inc.php"); + + function display_row($bg_color,$label,$id,$name) { + global $p; + + $p->set_var('row_color',$bg_color); + $p->set_var('user',$name); + $p->set_var('read',$label.'addressbook['.$id.'][read]'); + $p->set_var('add',$label.'[ddressbook'.$id.'][add]'); + $p->set_var('edit',$label.'addressbook['.$id.'][edit]'); + $p->set_var('delete',$label.'addressbook['.$id.'][delete]'); + $p->parse('row','acl_row',True); + } + + if ($submit) { +// $phpgw->db->query("DELETE FROM phpgw_acl WHERE acl_appname='addressbook' AND "); +// $phpgw->preferences->change("addressbook","defaultaddressbook"); +// $phpgw->preferences->change("addressbook","defaultfilter"); +// if ($mainscreen_showevents) { +// $phpgw->preferences->change("addressbook","mainscreen_showevents"); +// } else { +// $phpgw->preferences->delete("addressbook","mainscreen_showevents"); +// } +// $phpgw->preferences->commit(); + + header("Location: ".$phpgw->link($phpgw_info["server"]["webserver_url"]."/preferences/index.php")); + $phpgw->common->phpgw_exit(); + } + + $p = CreateObject('phpgwapi.Template',$phpgw_info["server"]["app_tpl"]); + $p->set_file(array('preferences' => 'preference_acl.tpl', + 'row_colspan' => 'preference_colspan.tpl', + 'acl_row' => 'preference_acl_row.tpl')); + + $p->set_var('errors','

This does nothing at this time!
Strictly as a template for use!
'); + $p->set_var('title','

'.lang("Addressbook preferences").' - '.lang("acl").':


'); + + $p->set_var('action_url',$phpgw->link('')); + $p->set_var('bg_color',$phpgw_info["theme"]["th_bg"]); + $p->set_var('submit_lang',lang('submit')); + $p->set_var('string',lang('Groups')); + $p->set_var('read_lang',lang('Read')); + $p->set_var('add_lang',lang('Add')); + $p->set_var('edit_lang',lang('Edit')); + $p->set_var('delete_lang',lang('Delete')); + $p->parse('row','row_colspan',True); + + $groups = $phpgw->accounts->read_group_names($phpgw->info["user"]["account_id"]); + while(list(,$group) = each($groups)) { + $tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color); + display_row($tr_color,'g_',$group[0],$group[1]); + } + + $db = $phpgw->db; + + $db->query("select account_id from accounts ORDER BY account_lastname, account_firstname, account_lid",__LINE__,__FILE__); + if($db->num_rows()) { + $p->set_var('string',ucfirst(lang('Users'))); + $p->parse('row','row_colspan',True); + $tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color); + while($db->next_record()) { + $tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color); + $id = $db->f("account_id"); + display_row($tr_color,'u_',$id,$phpgw->common->grab_owner_name($id)); + } + } + $p->pparse('out','preferences'); + $phpgw->common->phpgw_footer(); +?> diff --git a/addressbook/import.php b/addressbook/import.php index d98ce58e8a..7f3c4da36e 100644 --- a/addressbook/import.php +++ b/addressbook/import.php @@ -53,7 +53,7 @@ $t->set_var("cancel_url",$phpgw->link("index.php")); $t->set_var("navbar_bg",$phpgw_info["theme"]["navbar_bg"]); $t->set_var("navbar_text",$phpgw_info["theme"]["navbar_text"]); - $t->set_var("import_text",lang("Import from Outlook")); + $t->set_var("import_text",lang("Import from Outlook or LDIF")); $t->set_var("action_url",$phpgw->link("import.php")); $t->set_var("tsvfilename",""); $t->set_var("conv",$conv); diff --git a/addressbook/inc/class.addressbook_ldap.inc.php b/addressbook/inc/class.addressbook_ldap.inc.php index 93ed7304e1..fc4acd90dc 100644 --- a/addressbook/inc/class.addressbook_ldap.inc.php +++ b/addressbook/inc/class.addressbook_ldap.inc.php @@ -293,10 +293,10 @@ while ($column = each($abc)) { if (isset($phpgw_info["user"]["preferences"]["addressbook"][$column[0]]) && $phpgw_info["user"]["preferences"]["addressbook"][$column[0]]) { - $this->cols .= ''; - $this->cols .= ''; + $this->cols .= " \n"; + $this->cols .= ' '; $this->cols .= $phpgw->nextmatchs->show_sort_order($sort,"ab_" . $column[0],$order,"index.php",lang($column[1])); - $this->cols .= ''; + $this->cols .= "\n "; $this->cols .= "\n"; // To be used when displaying the rows diff --git a/addressbook/inc/class.addressbook_sql.inc.php b/addressbook/inc/class.addressbook_sql.inc.php index 93ed7304e1..fc4acd90dc 100644 --- a/addressbook/inc/class.addressbook_sql.inc.php +++ b/addressbook/inc/class.addressbook_sql.inc.php @@ -293,10 +293,10 @@ while ($column = each($abc)) { if (isset($phpgw_info["user"]["preferences"]["addressbook"][$column[0]]) && $phpgw_info["user"]["preferences"]["addressbook"][$column[0]]) { - $this->cols .= ''; - $this->cols .= ''; + $this->cols .= " \n"; + $this->cols .= ' '; $this->cols .= $phpgw->nextmatchs->show_sort_order($sort,"ab_" . $column[0],$order,"index.php",lang($column[1])); - $this->cols .= ''; + $this->cols .= "\n "; $this->cols .= "\n"; // To be used when displaying the rows diff --git a/addressbook/inc/hook_preferences.inc.php b/addressbook/inc/hook_preferences.inc.php index b4a281290e..624e516af5 100644 --- a/addressbook/inc/hook_preferences.inc.php +++ b/addressbook/inc/hook_preferences.inc.php @@ -25,8 +25,11 @@ } section_start("Address Book",$imgpath); - $pg = $phpgw->link($phpgw_info["server"]["webserver_url"]."/addressbook/preferences.php"); - echo "" . lang("Addressbook preferences") . ""; + $pg = $phpgw->link($phpgw_info["server"]["webserver_url"]."/".$appname."/preferences.php"); + echo "" . lang("Addressbook preferences") . "
"; + + $pg = $phpgw->link($phpgw_info["server"]["webserver_url"]."/".$appname."/acl_preferences.php"); + echo "" . lang("Grant Addressbook Access") . ""; section_end(); } diff --git a/addressbook/index.php b/addressbook/index.php index 6150b2a9af..8ec3c4562a 100755 --- a/addressbook/index.php +++ b/addressbook/index.php @@ -23,7 +23,6 @@ $t = new Template($phpgw_info["server"]["app_tpl"]); $t->set_file(array( "addressbook_header" => "header.tpl", - "searchfilter" => "searchfilter.tpl", "column" => "column.tpl", "row" => "row.tpl", "addressbook_footer" => "footer.tpl" )); @@ -66,7 +65,6 @@ $t->set_var("cols",$this->cols); $t->pparse("out","addressbook_header"); - $t->pparse("out","searchfilter"); for ($i=0;$i<$limit;$i++) { // each entry $t->set_var(columns,""); @@ -90,7 +88,7 @@ } $data=$coldata.""; } else { // But these do not - $ref=" "; $data=$coldata; + $ref=""; $data=$coldata; } $t->set_var(col_data,$ref.$data); $t->parse("columns","column",True); diff --git a/addressbook/templates/default/header.tpl b/addressbook/templates/default/header.tpl index cd3767f0d0..df87217575 100644 --- a/addressbook/templates/default/header.tpl +++ b/addressbook/templates/default/header.tpl @@ -1,5 +1,27 @@ -

{lang_addressbook}
{lang_showing} -
{searchreturn} +
{lang_addressbook} +
{lang_showing} +
{searchreturn} +{search_filter} + + + +{cols} + + + + diff --git a/addressbook/templates/justweb/header.tpl b/addressbook/templates/justweb/header.tpl index cd3767f0d0..df87217575 100644 --- a/addressbook/templates/justweb/header.tpl +++ b/addressbook/templates/justweb/header.tpl @@ -1,5 +1,27 @@ -
{lang_addressbook}
{lang_showing} -
{searchreturn} +
{lang_addressbook} +
{lang_showing} +
{searchreturn} +{search_filter} + +
+ + {lang_view} + + + + {lang_vcard} + + + + {lang_edit} + +
+ +{cols} + + + + diff --git a/addressbook/templates/verdilak/header.tpl b/addressbook/templates/verdilak/header.tpl index cd3767f0d0..df87217575 100644 --- a/addressbook/templates/verdilak/header.tpl +++ b/addressbook/templates/verdilak/header.tpl @@ -1,5 +1,27 @@ -
{lang_addressbook}
{lang_showing} -
{searchreturn} +
{lang_addressbook} +
{lang_showing} +
{searchreturn} +{search_filter} + +
+ + {lang_view} + + + + {lang_vcard} + + + + {lang_edit} + +
+ +{cols} + + + +
+ + {lang_view} + + + + {lang_vcard} + + + + {lang_edit} + +