Index: openacs-4/packages/curriculum-central/www/admin/staff-ae-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum-central/www/admin/staff-ae-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/curriculum-central/www/admin/staff-ae-postgresql.xql 4 Dec 2005 06:50:31 -0000 1.1 @@ -0,0 +1,16 @@ + + + + postgresql7.4 + + + + UPDATE cc_staff + SET title = :title, + position = :position, + department_id = :department_id + WHERE staff_id = :staff_id + + + + Index: openacs-4/packages/curriculum-central/www/admin/staff-ae.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum-central/www/admin/staff-ae.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/curriculum-central/www/admin/staff-ae.adp 4 Dec 2005 06:50:31 -0000 1.1 @@ -0,0 +1,6 @@ + +@page_title;noquote@ +@context;noquote@ +staff.staff_id + + \ No newline at end of file Index: openacs-4/packages/curriculum-central/www/admin/staff-ae.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum-central/www/admin/staff-ae.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/curriculum-central/www/admin/staff-ae.tcl 4 Dec 2005 06:50:31 -0000 1.1 @@ -0,0 +1,75 @@ +ad_page_contract { + Add/Edit a staff member. + + @author Nick Carroll (nick.c@rroll.net) + @creation-date 2005-11-20 + @cvs-id $Id: staff-ae.tcl,v 1.1 2005/12/04 06:50:31 ncarroll Exp $ +} { + staff_id:integer,optional + {return_url "staff"} +} + +if { [info exists staff_id] } { + # Edit mode. + set page_title [_ curriculum-central.edit_staff_details] + + # Create form with user's name. + ad_form -name staff -cancel_url $return_url -form { + {staff_id:key,integer(hidden) {value $staff_id} } + {staff_name:string(inform) + {label "#curriculum-central.staff_name#"} + {value "[person::name -person_id $staff_id]" } + } + } +} else { + # Add mode. + set page_title [_ curriculum-central.add_staff_details] + + # Create form with drop-down list of users. + ad_form -name staff -cancel_url $return_url -form { + {staff_id:key,integer(select) + {label "#curriculum-central.staff_name#" } + {options [curriculum_central::users_get_options] } + {help_text "[_ curriculum-central.help_select_staff_member]"} + } + } + +} + +set context [list $page_title] +set package_id [ad_conn package_id] + + +ad_form -extend -name staff -form { + {return_url:text(hidden) {value $return_url}} + {title:text + {html {size 50}} + {label "#curriculum-central.staff_title#" } + {help_text "[_ curriculum-central.help_enter_staff_title]"} + } + {position:text + {html {size 50}} + {label "#curriculum-central.staff_position#" } + {help_text "[_ curriculum-central.help_enter_staff_position]"} + } + {department_id:integer(select) + {label "#curriculum-central.department#" } + {options [curriculum_central::departments_get_options] } + {help_text "[_ curriculum-central.help_select_staff_member_department]"} + } +} -select_query { + SELECT title, position, department_id + FROM cc_staff WHERE staff_id = :staff_id +} -new_data { + package_instantiate_object \ + -var_list [list [list staff_id $staff_id] \ + [list title $title] \ + [list position $position] \ + [list department_id $department_id]] \ + -form_id staff cc_staff +} -edit_data { + db_dml staff_update {} +} -after_submit { + ad_returnredirect $return_url + ad_script_abort +} Index: openacs-4/packages/curriculum-central/www/admin/staff-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum-central/www/admin/staff-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/curriculum-central/www/admin/staff-postgresql.xql 4 Dec 2005 06:50:31 -0000 1.1 @@ -0,0 +1,20 @@ + + + + postgresql7.4 + + + + SELECT s.title || ' ' || u.first_names || ' ' || u.last_name + AS staff_name, s.staff_id, + s.position, s.department_id, d.department_name, d.faculty_id, + (SELECT faculty_name FROM cc_faculty f + WHERE f.faculty_id = d.faculty_id) as faculty_name + FROM cc_users u, cc_staff s, cc_department d + WHERE s.staff_id = u.user_id + AND d.department_id = s.department_id + [template::list::orderby_clause -orderby -name "staff"] + + + + Index: openacs-4/packages/curriculum-central/www/admin/staff.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum-central/www/admin/staff.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/curriculum-central/www/admin/staff.adp 4 Dec 2005 06:50:31 -0000 1.1 @@ -0,0 +1,6 @@ + +@page_title;noquote@ +@context;noquote@ + + + Index: openacs-4/packages/curriculum-central/www/admin/staff.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum-central/www/admin/staff.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/curriculum-central/www/admin/staff.tcl 4 Dec 2005 06:50:31 -0000 1.1 @@ -0,0 +1,66 @@ +ad_page_contract { + Page for displaying a list of staff members for each faculty. + + @author Nick Carroll (nick.c@rroll.net) + @creation-date 2005-11-20 + @cvs-id $Id: staff.tcl,v 1.1 2005/12/04 06:50:31 ncarroll Exp $ +} { + {orderby "faculty_name,asc"} +} + +set page_title "[_ curriculum-central.staff_admin]" +set context [list [_ curriculum-central.staff_admin]] +set package_id [ad_conn package_id] + +# Check if any faculties have been created, otherwise redirect if there +# are none. +if { ![curriculum_central::faculty::faculties_exist_p] } { + ad_return_template "no-faculties" + return +} + +set elements { + edit { + sub_class narrow + display_template { + + } + link_url_eval {[export_vars -base staff-ae { staff_id }]} + link_html {title "#curriculum-central.edit_staff_info#"} + } + staff_name { + label "#curriculum-central.name#" + } + department_name { + label "#curriculum-central.department#" + } + faculty_name { + label "#curriculum-central.faculty#" + link_url_eval {[export_vars -base faculty-depts { faculty_id }]} + link_html {title "#curriculum-central.view_faculty_depts#"} + } + delete { + sub_class narrow + display_template { + + } + link_url_eval {[export_vars -base staff-del { staff_id }]} + link_html {title "#curriculum-central.delete_staff#" onclick "return confirm(\'[_ curriculum-central.want_to_delete_staff]\');"} + } +} + +template::list::create \ + -name staff \ + -multirow staff \ + -no_data "#curriculum-central.no_staff#" \ + -elements $elements \ + -actions [list "#curriculum-central.add_staff_member#" [export_vars -base staff-ae {}] "#curriculum-central.add_staff_to_list#"] \ + -orderby { + staff_name {orderby {lower(last_name)}} + department_name {orderby {lower(department_name)}} + faculty_name {orderby {faculty_id}} + } + +db_multirow staff staff {} + +ad_return_template