Index: openacs-4/packages/lars-blogger/www/entry-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/www/entry-edit.tcl,v diff -u -r1.19 -r1.20 --- openacs-4/packages/lars-blogger/www/entry-edit.tcl 28 Jan 2004 18:22:17 -0000 1.19 +++ openacs-4/packages/lars-blogger/www/entry-edit.tcl 4 Feb 2004 20:50:56 -0000 1.20 @@ -82,6 +82,12 @@ } } +# SWC (Site-wide categories): +category::ad_form::add_widgets \ + -container_object_id $package_id \ + -categorized_object_id [value_if_exists entry_id] \ + -form_name entry + ad_form -extend -name entry -form { {content:richtext(richtext) {html {cols 80 rows 20}} @@ -133,6 +139,11 @@ set entry_date [element get_value entry entry_date] set draft_p [element get_value entry draft_p] set draft_p [ad_decode $draft_p "" "f" $draft_p] + + # SWC Collect categories from all the category widgets + set category_ids [category::ad_form::get_categories \ + -object_id $package_id] + } \ -new_data { lars_blogger::entry::new \ @@ -145,6 +156,13 @@ -content_format $content_format \ -entry_date $entry_date \ -draft_p "$draft_p" + + # SWC + category::map_object \ + -remove_old \ + -object_id $entry_id \ + $category_ids + } \ -edit_data { lars_blogger::entry::edit \ @@ -156,6 +174,12 @@ -content_format $content_format \ -entry_date $entry_date \ -draft_p $draft_p + + # SWC + category::map_object \ + -remove_old \ + -object_id $entry_id \ + $category_ids } \ -after_submit { if {"$draft_p" == "t"} { Index: openacs-4/packages/lars-blogger/www/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/www/index.tcl,v diff -u -r1.18 -r1.19 --- openacs-4/packages/lars-blogger/www/index.tcl 17 Dec 2003 16:28:06 -0000 1.18 +++ openacs-4/packages/lars-blogger/www/index.tcl 4 Feb 2004 20:50:56 -0000 1.19 @@ -6,6 +6,7 @@ } { {screen_name:optional {}} {category_short_name:optional {}} + {sw_category_id:integer,optional {}} year:optional,string_length_range(4|4) month:optional,string_length_range(2|2) day:optional,string_length_range(2|2) @@ -41,6 +42,20 @@ set category_id "" } +# SWC + +if { ![empty_string_p $sw_category_id] } { + set sw_category_name [category::get_name $sw_category_id] + if { [empty_string_p $sw_category_name] } { + ad_return_error "No such category" "Site-wide Category with ID \ + $sw_category_id doesn't exist" + return + } + # Show Category in context bar + append context_base_url /swcat/$sw_category_id + lappend context [list $context_base_url $sw_category_name] +} + # Set up the elements for the HTML
# 3 items - RSS, RSD and stylesheet. set rss_file_url "" Index: openacs-4/packages/lars-blogger/www/index.vuh =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/www/index.vuh,v diff -u -r1.2 -r1.3 --- openacs-4/packages/lars-blogger/www/index.vuh 17 Nov 2003 13:58:51 -0000 1.2 +++ openacs-4/packages/lars-blogger/www/index.vuh 4 Feb 2004 20:50:56 -0000 1.3 @@ -19,32 +19,56 @@ } else { - if { [regexp {/(u|user)/([^/]+)/?} $url ignore ignore2 screen_name] } { - rp_form_put screen_name $screen_name + if { [regexp {^/+(u|user)/+([^/]+)(/*.*)} $url \ + ignore_whole ignore_user screen_name rest_url] } { + rp_form_put screen_name $screen_name + # This is a /user/joe - style URL. If there was something + # after /user/joe it is now stored in rest_url + } else { + # This is not a /user/joe style URL. + set rest_url $url } - if { [regexp {/(c|cat|category)/([^/]+)/?} $url ignore ignore2 category_short_name] } { - rp_form_put category_short_name $category_short_name - } + if {[regexp {^/+(c|cat|category)/+([^/]+)/*$} $rest_url \ + ignore_whole ignore_cat category_short_name]} { + rp_form_put category_short_name $category_short_name + } elseif {[regexp {^/+(a|archive)/*([0-9]*)/*([0-9]*)/*([0-9]*)/*$} \ + $rest_url ignore_whole ignore_a year month day]} { + if {[empty_string_p $year] && [empty_string_p $month] && \ + [empty_string_p $day]} { + # get year, month, day + set date_list [dt_ansi_to_list [dt_sysdate]] + set year [lindex $date_list 0] + set month [format "%02d" [lindex $date_list 1]] + + rp_form_put year $year + rp_form_put month $month + rp_form_put day $day + } + } elseif {[regexp {^/+swcat/+([^/]+)/*} $rest_url \ + ignore_whole sw_category_id]} { - if { [regexp {/(a|archive)/?([0-9]*)/?([0-9]*)/?([0-9]*)/?} $url ignore ignore2 year month day] } { - if { [empty_string_p $year] && [empty_string_p $month] && [empty_string_p $day] } { - # get year, month, day - set date_list [dt_ansi_to_list [dt_sysdate]] - set year [lindex $date_list 0] - set month [format "%02d" [lindex $date_list 1]] - } + # SWC (Site-wide categories) + # As the categories package currently doesn't have short names we + # are using IDs. We don't check whether this is a valid integer here + # because index.tcl will take care of that. + rp_form_put sw_category_id $sw_category_id - rp_form_put year $year - rp_form_put month $month - rp_form_put day $day - } + } elseif { [regexp {one-entry$} $url] } { + # Backwards compatibility with user/