From d3374a96ca21bdcac411e7b83a23c3c9a462a9f2 Mon Sep 17 00:00:00 2001 From: skeeter Date: Tue, 23 Jan 2001 03:13:46 +0000 Subject: [PATCH] beginning ACL preferences for calendar --- calendar/acl_preferences.php | 92 +++++++++++++++++++ calendar/inc/hook_preferences.inc.php | 5 +- calendar/templates/default/preference_acl.tpl | 10 ++ .../templates/default/preference_acl_row.tpl | 8 ++ .../templates/default/preference_colspan.tpl | 7 ++ .../templates/verdilak/preference_acl.tpl | 10 ++ .../templates/verdilak/preference_acl_row.tpl | 8 ++ .../templates/verdilak/preference_colspan.tpl | 7 ++ setup/phpgw_en.lang | 3 + 9 files changed, 149 insertions(+), 1 deletion(-) create mode 100755 calendar/acl_preferences.php create mode 100755 calendar/templates/default/preference_acl.tpl create mode 100755 calendar/templates/default/preference_acl_row.tpl create mode 100755 calendar/templates/default/preference_colspan.tpl create mode 100755 calendar/templates/verdilak/preference_acl.tpl create mode 100755 calendar/templates/verdilak/preference_acl_row.tpl create mode 100755 calendar/templates/verdilak/preference_colspan.tpl diff --git a/calendar/acl_preferences.php b/calendar/acl_preferences.php new file mode 100755 index 0000000000..64bf1fe253 --- /dev/null +++ b/calendar/acl_preferences.php @@ -0,0 +1,92 @@ + "calendar", "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.'calendar['.$id.'][read]'); + $p->set_var('add',$label.'calendar['.$id.'][add]'); + $p->set_var('edit',$label.'calendar['.$id.'][edit]'); + $p->set_var('delete',$label.'calendar['.$id.'][delete]'); + $p->parse('row','acl_row',True); + } + + if ($submit) { +// $phpgw->db->query("DELETE FROM phpgw_acl WHERE acl_appname='calendar' AND "); +// $phpgw->preferences->change("calendar","weekdaystarts"); +// $phpgw->preferences->change("calendar","workdaystarts"); +// $phpgw->preferences->change("calendar","workdayends"); +// $phpgw->preferences->change("calendar","defaultcalendar"); +// $phpgw->preferences->change("calendar","defaultfilter"); +// if ($mainscreen_showevents) { +// $phpgw->preferences->change("calendar","mainscreen_showevents"); +// } else { +// $phpgw->preferences->delete("calendar","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("Calendar 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/calendar/inc/hook_preferences.inc.php b/calendar/inc/hook_preferences.inc.php index 7546c89b3b..a44045b1bd 100644 --- a/calendar/inc/hook_preferences.inc.php +++ b/calendar/inc/hook_preferences.inc.php @@ -28,7 +28,10 @@ section_start(ucfirst($appname),$imgpath); $pg = $phpgw->link($phpgw_info["server"]["webserver_url"]."/".$appname."/preferences.php"); - echo "" . lang("Calendar preferences") . ""; + echo "" . lang("Calendar preferences") . "
"; + + $pg = $phpgw->link($phpgw_info["server"]["webserver_url"]."/".$appname."/acl_preferences.php"); + echo "" . lang("Grant Calendar Access") . ""; section_end(); } diff --git a/calendar/templates/default/preference_acl.tpl b/calendar/templates/default/preference_acl.tpl new file mode 100755 index 0000000000..31d74f516b --- /dev/null +++ b/calendar/templates/default/preference_acl.tpl @@ -0,0 +1,10 @@ +{errors} +{title} +

+ +{row} +
+
+
+ + diff --git a/calendar/templates/default/preference_acl_row.tpl b/calendar/templates/default/preference_acl_row.tpl new file mode 100755 index 0000000000..9c194b41ef --- /dev/null +++ b/calendar/templates/default/preference_acl_row.tpl @@ -0,0 +1,8 @@ + + + {user} + + + + + diff --git a/calendar/templates/default/preference_colspan.tpl b/calendar/templates/default/preference_colspan.tpl new file mode 100755 index 0000000000..edc175ca04 --- /dev/null +++ b/calendar/templates/default/preference_colspan.tpl @@ -0,0 +1,7 @@ + + {string} + {read_lang} + {add_lang} + {edit_lang} + {delete_lang} + diff --git a/calendar/templates/verdilak/preference_acl.tpl b/calendar/templates/verdilak/preference_acl.tpl new file mode 100755 index 0000000000..31d74f516b --- /dev/null +++ b/calendar/templates/verdilak/preference_acl.tpl @@ -0,0 +1,10 @@ +{errors} +{title} +
+ +{row} +
+
+
+ + diff --git a/calendar/templates/verdilak/preference_acl_row.tpl b/calendar/templates/verdilak/preference_acl_row.tpl new file mode 100755 index 0000000000..9c194b41ef --- /dev/null +++ b/calendar/templates/verdilak/preference_acl_row.tpl @@ -0,0 +1,8 @@ + + + {user} + + + + + diff --git a/calendar/templates/verdilak/preference_colspan.tpl b/calendar/templates/verdilak/preference_colspan.tpl new file mode 100755 index 0000000000..edc175ca04 --- /dev/null +++ b/calendar/templates/verdilak/preference_colspan.tpl @@ -0,0 +1,7 @@ + + {string} + {read_lang} + {add_lang} + {edit_lang} + {delete_lang} + diff --git a/setup/phpgw_en.lang b/setup/phpgw_en.lang index eee85ee08b..0c6719e495 100644 --- a/setup/phpgw_en.lang +++ b/setup/phpgw_en.lang @@ -10,6 +10,7 @@ account has been created common en Account has been created account has been deleted common en Account has been deleted account has been updated common en Account has been updated account preferences common en Account Preferences +acl common en ACL active admin en Active add common en Add add a single phrase transy en Add a single phrase @@ -164,6 +165,7 @@ global public common en Global Public global public and group public calendar en Global Public and group public global public only calendar en Global Public Only go! calendar en Go! +grant calendar access calendar en Grant Calendar Access group access common en Group Access group has been added common en Group has been added group has been deleted common en Group has been deleted @@ -306,6 +308,7 @@ project description todo en Project Description re-edit event calendar en Re-Edit Event re-enter password admin en Re-enter password re-enter your password preferences en Re-Enter your password +read common en Read record access addressbook en Record Access record owner addressbook en Record owner remove all users from this group admin en Remove all users from this group