Index: openacs-4/packages/recruiting/tcl/dotlrn-recruiting-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/recruiting/tcl/dotlrn-recruiting-procs-postgresql.xql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/recruiting/tcl/dotlrn-recruiting-procs-postgresql.xql 30 Jul 2002 22:38:34 -0000 1.2 +++ openacs-4/packages/recruiting/tcl/dotlrn-recruiting-procs-postgresql.xql 31 Jul 2002 23:53:37 -0000 1.3 @@ -25,6 +25,17 @@ + + + update recruiting_status_types + set short_desc = :short_desc, + long_desc = :long_desc, + enabled_p = :enabled_p, + package_id = :package_id + where status_type_id = :status_type_id + + + select recruiting_criteria__disable(:criteria_id); @@ -48,6 +59,16 @@ + + + update recruiting_criteria + set package_id = :package_id, + criteria_name = :criteria_name, + description = :description + where criteria_id = :criteria_id + + + delete from recruiting_ratings rr Index: openacs-4/packages/recruiting/tcl/dotlrn-recruiting-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/recruiting/tcl/dotlrn-recruiting-procs.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/recruiting/tcl/dotlrn-recruiting-procs.tcl 30 Jul 2002 22:38:34 -0000 1.3 +++ openacs-4/packages/recruiting/tcl/dotlrn-recruiting-procs.tcl 31 Jul 2002 23:53:37 -0000 1.4 @@ -68,7 +68,7 @@ } ad_proc -public get { - {-message_id required} + {-status_type_id:required} } { get a status type } { @@ -82,7 +82,18 @@ return [array get status_type] } - + + ad_proc -public update_status_type { + {-status_type_id:required} + {-package_id ""} + {-short_desc:required} + {-long_desc:required} + {-enabled_p "t"} + } { + set a status type + } { + db_dml update_status_type {} + } } namespace eval recruiting_criteria { @@ -142,6 +153,17 @@ return [array get recruiting_criteria] } + ad_proc -public update_criteria_type { + {-criteria_id:required} + {-criteria_name:required} + {-description:required} + {-enabled_p:required} + {-package_id ""} + } { + update a criteria type + } { + db_dml update_criteria {} + } } namespace eval recruiting_candidate { @@ -166,7 +188,7 @@ if {[empty_string_p $package_id]} { set package_id [ad_conn package_id] } - + set extra_vars [ns_set create] ns_set put $extra_vars package_id $package_id ns_set put $extra_vars first_name $first_name @@ -197,10 +219,18 @@ } ad_proc -public get { - db_1row get_recruiting_candidate + {-candidate_id:required} + } { + get a candidate + } { + db_1row get_recruiting_candidate {} + + array set the_status [recruiting_status_type::get -status_type_id $status] + set recruiting_candidate(candidate_id) $candidate_id set recruiting_candidate(package_id) $package_id set recruiting_candidate(first_name) $first_name + set recruiting_candidate(last_name) $last_name set recruiting_candidate(address1) $address1 set recruiting_candidate(address2) $address2 set recruiting_candidate(city) $city @@ -209,7 +239,7 @@ set recruiting_candidate(zip_plus_four) $zip_plus_four set recruiting_candidate(country) $country set recruiting_candidate(email) $email - set recruiting_candidate(status) $status + set recruiting_candidate(status) $the_status(short_desc) return [array get recruiting_candidate] } Index: openacs-4/packages/recruiting/tcl/table-sorter-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/recruiting/tcl/Attic/table-sorter-procs.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/recruiting/tcl/table-sorter-procs.tcl 31 Jul 2002 23:53:37 -0000 1.1 @@ -0,0 +1,327 @@ +# Dan Chak (chak@mit.edu) +# 4/26/2000 +# Functions to create a sortable table +# ascending or descending by any column + +# setSortableHeadings +# expects +# the table_name and a list of column headings + +namespace eval table { + + proc initColors {} { + upvar bordercolor bordercolor + upvar innercolor innercolor + upvar color1 color1 + upvar color2 color2 + upvar curclr curclr + upvar titleclr titleclr + set titleclr "#dcdcdc" + set bordercolor "black" + set innercolor "#CCCC00" + set color1 "#DDDDDD" + set color2 "#CCCCCC" + set curclr $color1 + } + + proc startTable {{title ""} {width "100%"} {spacing 0}} { + upvar bordercolor bordercolor + upvar innercolor innercolor + upvar color1 color1 + upvar color2 color2 + if {$width != ""} { + set widthstr "width=$width" + } else { + set widthstr "" + } + set text "" + if {$title != ""} { + append text "" + } + append text " +
  $title  
+ " + return $text + } + + proc newRow {{flags ""} {extra ""}} { + upvar color1 color1 + upvar color2 color2 + upvar curclr curclr + if {![regexp {nochange} $flags match match]} { + if {$curclr == $color1} { + set curclr $color2 + } else { + set curclr $color1 + } + } + set text "" + return $text + } + + proc endRow {} { + set text "" + return $text + } + + proc endTable {} { + set text "
" + return $text + } + + proc titleRow {{extra ""}} { + upvar titleclr titleclr + set text "" + return $text + } + + proc titleEntry {txt {align "left"} {extra ""}} { + return "$txt" + } + + proc titleSortEntry {txt url {align "left"} {extra ""}} { + return "$txt" + } + + proc ui_columns {cell_list {tableoptions ""}} { + set cell_start "" + return "$cell_start[join $cell_list "$cell_start"]
" + } + + proc ui_equal_columns {cell_list {width 100%}} { + set cell_width [expr 100 / [llength $cell_list]] + set cell_start "" + return "$cell_start[join $cell_list "$cell_start"]
" + } + proc is_number {text} { + regexp {[0-9]*\.[0-9]*} $text match + return [info exist match] + } + + + ## + ## sortable table procs + ## + + proc setTitle {table_name table_title} { + upvar $table_name\_title title + set title $table_title + } + + proc setForm {table_name action_url {options ""}} { + upvar $table_name\_form form_action_url + regexp {.*-file.*} $options match + if {[info exists match]} { + set form_action_url "action=$action_url enctype=multipart/form-data method=post" + } else { + set form_action_url "action=$action_url method=post" + } + } + + proc setColumnHeadings {table_name heading_list} { + upvar $table_name\_headings headings + upvar $table_name\_max_columns max_columns + set headings $heading_list + if {![info exist max_columns]} {set max_columns 0} + if {[llength $heading_list] > $max_columns} { + set max_columns [llength $heading_list] + } + } + + proc setColumnAlignment {table_name align_list} { + ns_log notice "set align list to $align_list" + upvar $table_name\_aligns aligns + set aligns $align_list + } + + proc setColumnWidths {table_name width_list} { + upvar $table_name\_widths widths + set widths $width_list + } + + proc setExportVars {table_name vars} { + upvar $table_name\_export_vars table_export_vars + set table_export_vars "$vars&" + } + + # addSortableRow + # table_name is the name of the table we are creating + # row is a list of the row elements + proc addSortableRow {table_name row} { + upvar $table_name the_table + upvar $table_name\_max_columns max_columns + if {![info exists the_table]} { + # set the_table "" + } + set the_table [lappend the_table $row] + + if {![info exist max_columns]} {set max_columns 0} + if {[llength $row] > $max_columns} { + set max_columns [llength $row] + } + } + + proc addUnsortedRow {table_name row} { + upvar $table_name\_unsorted unsorted + upvar $table_name\_max_columns max_columns + set unsorted [lappend unsorted $row] + + if {![info exist max_columns]} {set max_columns 0} + if {[llength $row] > $max_columns} { + set max_columns [llength $row] + } + } + + proc outputTable {table_name {table_title ""} {width "100%"}} { + # _sort_column and _sort_order should exist + # otherwise no sorting + + upvar $table_name\_sort_column sort_column + upvar $table_name\_sort_order sort_order + upvar $table_name the_table + upvar $table_name\_unsorted unsorted + upvar $table_name\_title the_title + upvar $table_name\_headings headings + upvar $table_name\_aligns aligns + upvar $table_name\_widths widths + upvar $table_name\_form form_action_url + upvar $table_name\_max_columns max_columns + upvar $table_name\_export_vars table_export_vars + + if {![info exists sort_column]} { + set sort_column 0 + } + if {![info exists sort_order]} { + set sort_order increasing + } + # kludge until all tables are updated for titling... + if {[info exists the_title]} { + set table_title $the_title + } + if {![info exists table_export_vars]} { + set table_export_vars "" + } + initColors + + if {![info exists the_table] && ![info exists unsorted]} { + return " + [startTable $table_title "$width"] + [newRow] + No data. + [endRow]\n + [endTable]" + } + + # sort + ad_page_variables "\"$table_name\_sort_column 0\" \"$table_name\_sort_order increasing\"" + if {[info exists the_table]} { + set the_table [lsort -dictionary -[set $table_name\_sort_order] -index [set $table_name\_sort_column] $the_table] + } + + if {[info exists form_action_url]} { + append txt "
" + } + + append txt " + [startTable $table_title "$width"]" + set i 0 + + if {[info exists headings]} { + append txt "[titleRow]" + foreach heading $headings { + if {"$i" == "[set $table_name\_sort_column]"} { + if {"[set $table_name\_sort_order]" == "increasing"} { + set order_txt "decreasing" + } else { + set order_txt "increasing" + } + } else { + set order_txt "increasing" + } + if {[info exist aligns]} { + set this_align [lindex $aligns $i] + } else { + set this_align left + } + if {[info exist widths]} { + set this_width "width=[lindex $widths $i]" + } else { + set this_width "" + } + append txt " + [titleEntry "$heading" $this_align $this_width]" + incr i + } + for {set j $i} {$j < $max_columns} {incr j} { + append txt "[titleEntry " "]" + } + append txt "[endRow]\n" + } + + + if {[info exists the_table]} { + ns_log notice "table $table_name contains sortable rows" + foreach row $the_table { + append txt "[newRow]" + set i 0 + foreach element $row { + if {[info exist aligns]} { + set this_align [lindex $aligns $i] + } else { + set this_align left + } + if {[string compare "$element" ""] == 0} { + set element " " + } + if {[info exist widths]} { + set this_width "width=[lindex $widths $i]" + } else { + set this_width "" + } + append txt "$element" + incr i + } + for {set j $i} {$j < $max_columns} {incr j} { + append txt "[titleEntry " "]" + } + append txt "[endRow]\n" + } + } + + # and the unsorted part + if {[info exists unsorted]} { + foreach row $unsorted { + append txt "[newRow]" + set i 0 + foreach element $row { + if {[info exist aligns]} { + set this_align [lindex $aligns $i] + } else { + set this_align left + } + if {[string compare "$element" ""] == 0} { + set element " " + } + if {[info exist widths]} { + set this_width "width=[lindex $widths $i]" + } else { + set this_width "" + } + append txt "$element" + incr i + } + for {set j $i} {$j < $max_columns} {incr j} { + append txt "[titleEntry " "]" + } + append txt "[endRow]\n" + } + } + + append txt "[endTable]" + if {[info exist form_action_url]} { + append txt "
" + } + return $txt + } + +}