Here are patches against ACS Tcl 4.2. The authors of this code are: Ed Avis , Tom Fotherby , Simon Buckle and Sarah Ewen . ********************************************************************** Bugfix to acs-admin package, apm_higher_version_installed_p (, ). diff -ru acs42/packages/acs-admin/tcl/apm-admin-procs.tcl hta_copy/packages/acs-admin/tcl/apm-admin-procs.tcl --- acs42/packages/acs-admin/tcl/apm-admin-procs.tcl Mon Sep 3 13:14:29 2001 +++ hta_copy/packages/acs-admin/tcl/apm-admin-procs.tcl Mon Sep 3 13:14:33 2001 @@ -183,18 +183,38 @@ ad_proc -private apm_higher_version_installed_p {package_key version_name} { @return 1 if there is a higher version installed than the one in question. @param package_key The package in question. - @param version_name The name of the currently installed version. + @param version_name The name of the new version. } { - - return [db_exec_plsql apm_higher_version_installed_p { - declare - v_version_name varchar(4000); + db_transaction { + db_0or1row get_curr_vers { + select version_name as curr_version_name + from apm_package_versions where + version_id = apm_package.highest_version(:package_key) + } + if {! [exists_and_not_null curr_version_name]} { + set result 0 + } else { + set result [db_exec_plsql apm_higher_version_installed_p { begin - select version_name into v_version_name - from apm_package_versions where - version_id = apm_package.highest_version(:package_key); - :1 := apm_package_version.version_name_greater(:version_name, v_version_name); + :1 := apm_package_version.version_name_greater( + :version_name, :curr_version_name + ); end; - }] + }] + if {$result == 1} { + # :version_name > :curr_version_name + set result 0 + } elseif {$result == 0} { + # :version_name == :curr_version_name + set result 0 + } elseif {$result == -1} { + # :curr_version_name > :version_name + set result 1 + } else { + error \ +"bad result from PL/SQL apm_package_version.version_name_greater: $result" + } + } + } + return $result } - ********************************************************************** For a client site we used several acs-subsite instances with mounted packages underneath them to have several 'instances' of the site we were building. In other words, the product was not a single package but a collection of packages mounted under an acs-subsite. (The patch to site-nodes-procs.tcl is also to help with this.) But the root of an acs-subsite package itself is not a very friendly URL, so we added a parameter to make acs-subsite redirect somewhere: diff -ru acs42/packages/acs-subsite/acs-subsite.info hta_copy/packages/acs-subsite/acs-subsite.info --- acs42/packages/acs-subsite/acs-subsite.info Mon Sep 3 13:14:30 2001 +++ hta_copy/packages/acs-subsite/acs-subsite.info Mon Sep 3 13:14:34 2001 @@ -6,7 +6,7 @@ ACS Subsite Services f - + oracle-8.1.6 @@ -14,8 +14,9 @@ Rafael Schloming Oumi Mehrotra Michael Bryzek + Ed Avis Provides the ability to create subsite within the ArsDigita Community System. - 2001-03-06 + 2001-06-20 ArsDigita Corporation Aware of parties, groups, users, portraits, ... @@ -345,6 +346,7 @@ + diff -ru acs42/packages/acs-subsite/www/admin/index.tcl hta_copy/packages/acs-subsite/www/admin/index.tcl --- acs42/packages/acs-subsite/www/admin/index.tcl Mon Sep 3 13:14:30 2001 +++ hta_copy/packages/acs-subsite/www/admin/index.tcl Mon Sep 3 13:14:34 2001 @@ -21,6 +21,8 @@ where p.package_id = :package_id } -default "Subsite"] + + # Return the first available link to the ACS Admin page. if {[db_0or1row acs_admin_url_get { select site_node.url(node_id) acs_admin_url, instance_name diff -ru acs42/packages/acs-subsite/www/index.tcl hta_copy/packages/acs-subsite/www/index.tcl --- acs42/packages/acs-subsite/www/index.tcl Mon Sep 3 13:14:30 2001 +++ hta_copy/packages/acs-subsite/www/index.tcl Mon Sep 3 13:14:34 2001 @@ -4,6 +4,7 @@ @author rhs@mit.edu @author mbryzek@mit.edu + @author ed@membled.com @creation-date 2000-09-18 } { @@ -12,6 +13,12 @@ subsite_name:onevalue nodes:multirow admin_p:onevalue +} + +set redirect_to [ad_parameter RedirectTo [db_null]] +if {[exists_and_not_null redirect_to]} { + template::forward $redirect_to + return } set context_bar {} diff -ru acs42/packages/acs-subsite/www/user/basic-info-update-2.tcl hta_copy/packages/acs-subsite/www/user/basic-info-update-2.tcl --- acs42/packages/acs-subsite/www/user/basic-info-update-2.tcl Mon Sep 3 13:14:30 2001 +++ hta_copy/packages/acs-subsite/www/user/basic-info-update-2.tcl Mon Sep 3 13:14:34 2001 @@ -9,7 +9,7 @@ email url screen_name - bio + bio:html {return_url ""} {user_id ""} } ********************************************************************** Improvements to acs-tcl: installation of packages gives the -o flag to tar so that files get the correct permissions; ad_context_bar adds the attribute 'class="context_bar"' (by default) to the HTML, to help CSS styling, and supports a -nocontext flag; a new site_node_closest_package_url which is finds the closest instance of a package, not limited to ancestors; new utility proc paste_uri; use ad_urlencode instead of ns_urlencode; fixes to util_AnsiDatetoPrettyDate (). diff -ru acs42/packages/acs-tcl/tcl/apm-file-procs.tcl hta_copy/packages/acs-tcl/tcl/apm-file-procs.tcl --- acs42/packages/acs-tcl/tcl/apm-file-procs.tcl Mon Sep 3 13:14:30 2001 +++ hta_copy/packages/acs-tcl/tcl/apm-file-procs.tcl Mon Sep 3 13:14:34 2001 @@ -101,7 +101,7 @@ file mkdir $dir # cd, gunzip, and untar all in the same subprocess (to avoid having to # chdir first). - exec sh -c "cd $dir ; [apm_gunzip_cmd] -c $apm_file | [apm_tar_cmd] xf -" + exec sh -c "cd $dir ; [apm_gunzip_cmd] -c $apm_file | [apm_tar_cmd] xfo -" file delete $apm_file } diff -ru acs42/packages/acs-tcl/tcl/navigation-procs.tcl hta_copy/packages/acs-tcl/tcl/navigation-procs.tcl --- acs42/packages/acs-tcl/tcl/navigation-procs.tcl Mon Sep 3 13:14:30 2001 +++ hta_copy/packages/acs-tcl/tcl/navigation-procs.tcl Mon Sep 3 13:14:34 2001 @@ -33,61 +33,99 @@ #} ad_proc ad_context_bar { args } { + Returns a Yahoo-style hierarchical navbar. Includes + "Your Workspace" or "Administration" if applicable, and the + subsite if not global. + + There are two options which should be given before the other + arguments. + + @param -class 'class' attribute of elements in HTML - the + elements have this too, so you can assign them + styles overriding the default style for . + Defaults to "context_bar". - Returns a Yahoo-style hierarchical navbar. Includes "Your Workspace" or "Administration" - if applicable, and the subsite if not global. - + @param -nocontext don't automatically include the parents of this + node in the context bar. } { - - set context [list] - - set display_main_p 1 - if {[ad_conn user_id] != 0} { - if {[string match /pvt/home* [ad_conn url]]} { - set display_main_p 0 - } else { - lappend context [list "/pvt/home" "Your Workspace"] + set class "contextbar" + set show_context 1 + # Maybe there is a suitable arg parser already written? + # i think ad_proc breaks it. sewen. + while {[llength $args]} { + set first [lindex $args 0] + if {! [regsub {^-} $first "" option]} { + # End of options. + break + } + set args [lrange $args 1 end] + switch -- $option { + "class" { + set class [lindex $args 0] + set args [lrange $args 1 end] + } + "nocontext" { + set show_context 0 + } + default { + error "bad option $option" + } + } } - } - set node_id [ad_conn node_id] - db_foreach context { - select site_node.url(node_id) as url, object_id, - acs_object.name(object_id) as object_name, - level - from site_nodes - start with node_id = :node_id - connect by prior parent_id = node_id - order by level desc - } { - if {$display_main_p || $url != "/"} { - lappend context [list $url $object_name] + set context [list] + if {$show_context} { + set display_main_p 1 + if {[ad_conn user_id] != 0} { + if {[string match /pvt/home* [ad_conn url]]} { + set display_main_p 0 + } else { + lappend context [list "/pvt/home" "Your Workspace"] + } + } + + set node_id [ad_conn node_id] + db_foreach context { + select site_node.url(node_id) as url, object_id, + acs_object.name(object_id) as object_name, + level + from site_nodes + start with node_id = :node_id + connect by prior parent_id = node_id + order by level desc + } { + if {$display_main_p || $url != "/"} { + lappend context [list $url $object_name] + } + } + + if { [string match admin/* [ad_conn extra_url]] } { + lappend context [list "[ad_conn package_url]admin/" \ + "Administration"] + } } - } + set elems [concat $context $args] - if { [string match admin/* [ad_conn extra_url]] } { - lappend context [list "[ad_conn package_url]admin/" \ - "Administration"] - } - - set context [concat $context $args] - - set out [list] - - for { set i 0 } { $i < [llength $context] } { incr i } { - set element [lindex $context $i] - if { $i == [llength $context] - 1 } { - if {[llength $args] == 0} { - lappend out [lindex $element 1] - } else { - lappend out $element - } - } else { - lappend out "[lindex $element 1]" - } - } + set out [list] + + for { set i 0 } { $i < [llength $elems] } { incr i } { + set element [lindex $elems $i] + if { $i == [llength $elems] - 1 } { + if {[llength $args] == 0} { + lappend out [lindex $element 1] + } else { + lappend out $element + } + } else { + set href [lindex $element 0] + set text [lindex $element 1] + if {![empty_string_p $text]} { + lappend out "$text" + } + } + } - return [join $out " : "] + return "[join $out { : }]" } # a context bar, rooted at the workspace diff -ru acs42/packages/acs-tcl/tcl/site-nodes-procs.tcl hta_copy/packages/acs-tcl/tcl/site-nodes-procs.tcl --- acs42/packages/acs-tcl/tcl/site-nodes-procs.tcl Mon Sep 3 13:14:30 2001 +++ hta_copy/packages/acs-tcl/tcl/site-nodes-procs.tcl Mon Sep 3 13:14:34 2001 @@ -194,6 +194,100 @@ } -default ""] } + +ad_proc -public url_distance { a b } { + Compute 'distance' between two URLs. This is the number of hops + up the URL tree plus the number of hops down again to get from one + URL to the other. +} { + proc no_emptys { list } { + set r {} + foreach e $list { + if {$e != ""} { + lappend r $e + } + } + return $r + } + set a_elems [no_emptys [split $a "/"]] + set a_len [llength $a_elems] + set b_elems [no_emptys [split $b "/"]] + set b_len [llength $b_elems] + + # Work out the number of leading path elements in common. + set min $a_len; if {$b_len < $min} { set min $b_len } + for {set i 0} {$i < $min} {incr i} { + if {[lindex $a_elems $i] != [lindex $b_elems $i]} { + break + } + } + return [expr $a_len + $b_len - 2 * $i] +} + + +ad_proc -public site_node_closest_package_url { + { -default "" } + { -url "" } + { -package_key "acs-subsite" } +} { + Finds the closest mounted instance of a particular package. The + search is not restricted to ancestors - it will try to go up and + down the tree. The measure of closeness is how many hops up the + tree and then down are needed to get to the package from the + specified URL. +

+ Usage: +

+        # Find the package_id of a mounted instance of general-comments
+        set pkg_id [site_node_closest_package "general-comments"]
+    
+ + @author Ed Avis (ed@membled.com) + @creation-date 2001-06-15 + + @param default The value to return if no package can be found. If + "" or not given, an 'installation error' is + produced when no instance of the required package + can be found. + @param url URL of the node from which to start the search + (defaults to [ad_conn url] if "") + @param package_key The type of the package for which we are looking + + @return URL of closest mounted instance (if two equally close, + picks one arbitrarily). Returns $default, or produces a + user error, if no such package can be found. +} { + if {[empty_string_p $url]} { set url [ad_conn url] } + + db_foreach get_any_instance { + select site_node.url(node_id) as instance_url + from apm_packages, site_nodes + where package_key = :package_key + and site_nodes.object_id = package_id + } { + set distance [url_distance $url $instance_url] + if {! [info exists best_url]} { + set best_url $instance_url + set best_distance $distance + } elseif {$distance < $best_distance} { + set best_url $instance_url + set best_distance $distance + } + } + if {[info exists best_url]} { return $best_url } + + # Nothing found. + if {! [exists_and_not_null default]} { + ad_return_complaint 1 " +
  • Installation error for $package_key: the package +$package_key must be installed, enabled and mounted in the +site map.
  • + " + } + return $default; +} + + ad_proc -public site_node_create_package_instance { { -package_id 0 } { -sync_p "t" } @@ -229,6 +323,7 @@ return $package_id } + ad_proc -public site_node_mount_application { { -sync_p "t" } diff -ru acs42/packages/acs-tcl/tcl/uri-procs.tcl hta_copy/packages/acs-tcl/tcl/uri-procs.tcl --- acs42/packages/acs-tcl/tcl/uri-procs.tcl Mon Sep 3 13:14:30 2001 +++ hta_copy/packages/acs-tcl/tcl/uri-procs.tcl Mon Sep 3 13:14:34 2001 @@ -14,6 +14,7 @@ See the GNU website for more information.

    @author Aaron Swartz + @author Ed Avis @creation-date 2001-2-13 } @@ -227,3 +228,30 @@ } return 1 } + + +ad_proc -public paste_uri { + bits +} { + Joins together bits of this=that&that=theother into a single URI, + picking ? or & as the joining character as appropriate. + + Example: [paste_uri [list "http://foo/bar" "womble=cholet" "target=%2f"]] +} { + set r "" + foreach bit $bits { + if {$r != ""} { + if {[regexp {\?[^/]*$} $r]} { + append r "&" + } elseif {[regexp {/[^/?]*$} $r]} { + append r "?" + } + } + if {$bit != ""} { + append r $bit + } + } + return $r +} + + diff -ru acs42/packages/acs-tcl/tcl/utilities-procs.tcl hta_copy/packages/acs-tcl/tcl/utilities-procs.tcl --- acs42/packages/acs-tcl/tcl/utilities-procs.tcl Mon Sep 3 13:14:30 2001 +++ hta_copy/packages/acs-tcl/tcl/utilities-procs.tcl Mon Sep 3 13:14:35 2001 @@ -6,6 +6,16 @@ @date 13 April 2000 } +ad_proc -public ad_urlencode { string } { + The same as ns_urlencode except that dash and underscore are left + unencoded. +} { + set encoded_string [ns_urlencode $string] + regsub -all {%2d} $encoded_string {-} encoded_string + regsub -all {%5f} $encoded_string {_} ad_encoded_string + return $ad_encoded_string +} + # Let's define the nsv arrays out here, so we can call nsv_exists # on their keys without checking to see if it already exists. # we create the array by setting a bogus key. @@ -313,7 +323,7 @@ if {$arg_form!=""} { set form_counter_i 0 while {$form_counter_i<[ns_set size $arg_form]} { - append query_return "[ns_set key $arg_form $form_counter_i]=[ns_urlencode [ns_set value $arg_form $form_counter_i]]&" + append query_return "[ns_set key $arg_form $form_counter_i]=[ad_urlencode [ns_set value $arg_form $form_counter_i]]&" incr form_counter_i } set query_return [string trim $query_return &] @@ -409,8 +419,10 @@ } -proc_doc util_AnsiDatetoPrettyDate {sql_date} "Converts 1998-09-05 to September 5, 1998" { - if ![regexp {(.*)-(.*)-(.*)$} $sql_date match year month day] { +proc_doc util_AnsiDatetoPrettyDate {sql_date} { + Converts '1998-09-05', or '1998-09-05 14:23', to 'September 5, 1998' +} { + if ![regexp {(\d+)-(\d+)-(\d+)(?:\s|T|$)} $sql_date match year month day] { return "" } else { set allthemonths {January February March April May June July August September October November December} @@ -973,7 +985,7 @@ if { $url_p } { set export_list [list] for { set i 0 } { $i < $export_size } { incr i } { - lappend export_list "[ns_urlencode [ns_set key $export_set $i]]=[ns_urlencode [ns_set value $export_set $i]]" + lappend export_list "[ad_urlencode [ns_set key $export_set $i]]=[ad_urlencode [ns_set value $export_set $i]]" } set export_string [join $export_list "&"] } else { @@ -1123,7 +1135,7 @@ if { !$form_p } { set export_list [list] foreach varname [array names export] { - lappend export_list "[ns_urlencode $varname]=[ns_urlencode $export($varname)]" + lappend export_list "[ad_urlencode $varname]=[ad_urlencode $export($varname)]" } return [join $export_list &] } else { @@ -1226,7 +1238,7 @@ set value [ns_set value $setid $set_counter_i] if {[lsearch $exclusion_list $name] == -1 && ![empty_string_p $name]} { if {$format == "url"} { - lappend return_list "[ns_urlencode $name]=[ns_urlencode $value]" + lappend return_list "[ad_urlencode $name]=[ad_urlencode $value]" } else { lappend return_list " name=\"[ad_quotehtml $name]\" value=\"[ad_quotehtml $value]\"" } @@ -1255,7 +1267,7 @@ Instead of naming a variable you can also say name=value. Note that the value here is not the name of a variable but the literal value you want to export e.g., - export_url_vars [ns_urlencode foo]=[ns_urlencode $the_value]. + export_url_vars [ad_urlencode foo]=[ad_urlencode $the_value].

    @@ -1286,7 +1298,7 @@ set value [lindex $var_spec_pieces 1] lappend params "$var=$value" if { $sign_p } { - lappend params "[ns_urlencode [ns_urldecode $var]:sig]=[ns_urlencode [ad_sign [ns_urldecode $value]]]" + lappend params "[ad_urlencode [ns_urldecode $var]:sig]=[ad_urlencode [ad_sign [ns_urldecode $value]]]" } } else { set var_spec_pieces [split $var_spec ":"] @@ -1298,15 +1310,15 @@ switch $type { multiple { foreach item $upvar_value { - lappend params "[ns_urlencode $var]=[ns_urlencode $item]" + lappend params "[ad_urlencode $var]=[ad_urlencode $item]" } } default { - lappend params "[ns_urlencode $var]=[ns_urlencode $upvar_value]" + lappend params "[ad_urlencode $var]=[ad_urlencode $upvar_value]" } } if { $sign_p } { - lappend params "[ns_urlencode "$var:sig"]=[ns_urlencode [ad_sign $upvar_value]]" + lappend params "[ad_urlencode "$var:sig"]=[ad_urlencode [ad_sign $upvar_value]]" } } } @@ -1333,7 +1345,7 @@ $vars_to_passthrough == "" || ([lsearch -exact $vars_to_passthrough $varname] != -1) } { - lappend params "[ns_urlencode $varname]=[ns_urlencode $varvalue]" + lappend params "[ad_urlencode $varname]=[ad_urlencode $varvalue]" } } return [join $params "&"] @@ -2122,13 +2134,6 @@ } else { return [lindex $to_list $index] } -} - -proc_doc ad_urlencode { string } "same as ns_urlencode except that dash and underscore are left unencoded." { - set encoded_string [ns_urlencode $string] - regsub -all {%2d} $encoded_string {-} encoded_string - regsub -all {%5f} $encoded_string {_} ad_encoded_string - return $ad_encoded_string } ad_proc ad_get_cookie { ********************************************************************** Bypassed unnecessary check in acs-templating for file upload: diff -ru acs42/packages/acs-templating/tcl/data-procs.tcl hta_copy/packages/acs-templating/tcl/data-procs.tcl --- acs42/packages/acs-templating/tcl/data-procs.tcl Mon Sep 3 13:14:31 2001 +++ hta_copy/packages/acs-templating/tcl/data-procs.tcl Mon Sep 3 13:14:35 2001 @@ -50,6 +50,11 @@ upvar 2 $message_ref message $value_ref value + # FIXME: a Unix filename can have any character except NUL. So why + # the regexp below? It's only the _client's_ filename anyhow. + # + return 1 + set result [regexp {^[a-zA-Z0-9_-]+$} $value] if { ! $result } { ********************************************************************** Changes to bboard. I didn't make these changes myself so I can't fully explain the rationale for them, but they are pretty self-explanatory. diff -ru acs42/packages/bboard/www/forum-by-category.tcl hta_copy/packages/bboard/www/forum-by-category.tcl --- acs42/packages/bboard/www/forum-by-category.tcl Mon Sep 3 13:14:32 2001 +++ hta_copy/packages/bboard/www/forum-by-category.tcl Mon Sep 3 14:12:13 2001 @@ -95,7 +95,7 @@ db_multirow messages messages_select_by_cat " select message_id, title, num_replies, - first_names||' '||last_name as full_name, + first_names||' '||last_name as full_name, persons.person_id, to_char(last_reply_date,'MM/DD/YY hh12:Mi am') as last_updated from bboard_messages_by_category b, persons where person_id = sender diff -ru acs42/packages/bboard/www/forum.tcl hta_copy/packages/bboard/www/forum.tcl --- acs42/packages/bboard/www/forum.tcl Mon Sep 3 13:14:32 2001 +++ hta_copy/packages/bboard/www/forum.tcl Mon Sep 3 14:12:13 2001 @@ -28,13 +28,16 @@ ad_require_permission $forum_id bboard_read_forum -db_1row forum_info { +if {![db_0or1row forum_info { select short_name as forum_name, moderated_p, acs_permission.permission_p(:forum_id, :user_id, 'admin') as admin_p, acs_permission.permission_p(:forum_id, :user_id, 'bboard_create_category') as category_create_p from bboard_forums where forum_id = :forum_id +}]} { +#FIXME not sure what to here. +ad_return_error "Couldn't find this forum" "Fault Report" } set moderator_p 0 @@ -57,8 +60,8 @@ set last_n_days "0" } } - -set context_bar [list $forum_name] +set context_bar [ad_context_bar] +set context_bar [ad_context_bar $forum_name] set title $forum_name set package_id [ad_conn package_id] @@ -67,7 +70,7 @@ db_multirow messages messages_select { select message_id, title, num_replies, - first_names||' '||last_name as full_name, + first_names||' '||last_name as full_name, person_id, to_char(last_reply_date,'MM/DD/YY hh12:Mi am') as last_updated from bboard_messages_all b, persons where forum_id = :forum_id @@ -102,7 +105,7 @@ db_multirow messages messages_select_approved { select message_id, title, num_replies, - first_names||' '||last_name as full_name, + first_names||' '||last_name as full_name, person_id, to_char(last_reply_date,'MM/DD/YY hh12:Mi am') as last_updated from bboard_messages_all b, persons where forum_id = :forum_id diff -ru acs42/packages/bboard/www/index.adp hta_copy/packages/bboard/www/index.adp --- acs42/packages/bboard/www/index.adp Mon Sep 3 13:14:32 2001 +++ hta_copy/packages/bboard/www/index.adp Mon Sep 3 14:12:13 2001 @@ -1,6 +1,6 @@ @context_bar@ -Forums +Discussion Forums [Manage Subscriptions] @@ -9,6 +9,8 @@ +

    Listed below are the discussions people have been having on local issues. Click on them to see what is being said and join in the discussion. E-mail us if you would like us to set up a new forum. +

    • @forums.short_name@ diff -ru acs42/packages/bboard/www/index.tcl hta_copy/packages/bboard/www/index.tcl --- acs42/packages/bboard/www/index.tcl Mon Sep 3 13:14:32 2001 +++ hta_copy/packages/bboard/www/index.tcl Mon Sep 3 14:12:13 2001 @@ -14,7 +14,7 @@ set package_id [ad_conn package_id] -set context_bar {} +set context_bar [ad_context_bar] set user_id [ad_verify_and_get_user_id] diff -ru acs42/packages/bboard/www/master.adp hta_copy/packages/bboard/www/master.adp --- acs42/packages/bboard/www/master.adp Mon Sep 3 13:14:32 2001 +++ hta_copy/packages/bboard/www/master.adp Mon Sep 3 14:12:13 2001 @@ -1,9 +1,7 @@ @title@ +@context_bar@

      @title@

      - - <%= [eval ad_context_bar $context_bar] %> -
      diff -ru acs42/packages/bboard/www/message-list.adp hta_copy/packages/bboard/www/message-list.adp --- acs42/packages/bboard/www/message-list.adp Mon Sep 3 13:14:32 2001 +++ hta_copy/packages/bboard/www/message-list.adp Mon Sep 3 14:12:13 2001 @@ -34,7 +34,7 @@ @messages.title@ - @messages.full_name@ + @messages.full_name@ <%= [expr @messages.num_replies@-1] %> diff -ru acs42/packages/bboard/www/messages-by-user.tcl hta_copy/packages/bboard/www/messages-by-user.tcl --- acs42/packages/bboard/www/messages-by-user.tcl Mon Sep 3 13:14:32 2001 +++ hta_copy/packages/bboard/www/messages-by-user.tcl Mon Sep 3 14:12:13 2001 @@ -34,7 +34,7 @@ if [string equal $moderated_p f] { db_multirow messages messages_select { - select title, num_replies, message_id, + select title, num_replies, message_id, person_id, first_names||' '||last_name as full_name from bboard_messages_all, persons where sender = :user_id @@ -43,7 +43,7 @@ } } else { db_multirow messages messages_select { - select title, num_replies, message_id, + select title, num_replies, message_id, person_id, first_names||' '||last_name as full_name from bboard_messages_all, persons where sender = :user_id ********************************************************************** The chat package. I've heard stuff on the bboards about scrapping this altogether, but if you are keeping the aD package for a bit longer you might want these fixes. They are to tidy up the interface and make it a bit friendlier. In particular it is possible to avoid the confusing 'HTML Chat' and 'Java Chat' links. diff -ru acs42/packages/chat/chat.info hta_copy/packages/chat/chat.info --- acs42/packages/chat/chat.info Mon Sep 3 13:14:32 2001 +++ hta_copy/packages/chat/chat.info Mon Sep 3 13:14:36 2001 @@ -6,13 +6,14 @@ Chats f - + oracle-8.1.6 David Dao + Ed Avis This is a chat application - 2001-01-18 + 2001-06-21 ArsDigita Corporation ACS Chat is now support both HTML client and Java applet client. @@ -126,6 +127,8 @@ + + diff -ru acs42/packages/chat/tcl/chat-procs.tcl hta_copy/packages/chat/tcl/chat-procs.tcl --- acs42/packages/chat/tcl/chat-procs.tcl Mon Sep 3 13:14:32 2001 +++ hta_copy/packages/chat/tcl/chat-procs.tcl Mon Sep 3 13:14:36 2001 @@ -362,6 +362,21 @@ } +ad_proc -public chat_room_archive_p { + room_id +} { + Return the archiving status of this chat room. +} { + set archive_p [db_string get_chat_room_archive { + select archive_p + from chat_rooms + where room_id = :room_id + }] + + return $archive_p + +} + ad_proc -public chat_user_name { user_id } { diff -ru acs42/packages/chat/www/chat.tcl hta_copy/packages/chat/www/chat.tcl --- acs42/packages/chat/www/chat.tcl Mon Sep 3 13:14:32 2001 +++ hta_copy/packages/chat/www/chat.tcl Mon Sep 3 13:14:36 2001 @@ -20,6 +20,8 @@ height:onevalue host:onevalue port:onevalue + moderate_room_p:onevalue + archive_room_p:onevalue moderator_p:onevalue msgs:multirow } @@ -37,6 +39,7 @@ set ban_p [ad_permission_p $room_id "chat_ban"] set moderate_room_p [chat_room_moderate_p $room_id] +set archive_room_p [chat_room_archive_p $room_id] if { $moderate_room_p == "t" } { set moderator_p [ad_permission_p $room_id "chat_moderator"] diff -ru acs42/packages/chat/www/html-chat.adp hta_copy/packages/chat/www/html-chat.adp --- acs42/packages/chat/www/html-chat.adp Mon Sep 3 13:14:32 2001 +++ hta_copy/packages/chat/www/html-chat.adp Mon Sep 3 13:14:36 2001 @@ -1,8 +1,30 @@ @context_bar@ @room_name@ - -[Log off] +

      + Type in a message below and press 'Send/Refresh'. The message will + be seen by anyone else viewing this web page, so it is not private. + People will see that the message comes from '@user_name@'. +

      +

      + + + This room is moderated. + + + This room is not moderated. + +

      +

      + + Messages posted here will be archived. + + + The site owner is not keeping a record of what's posted here. + +

      +[ leave this room ] +

      Chat: diff -ru acs42/packages/chat/www/index.adp hta_copy/packages/chat/www/index.adp --- acs42/packages/chat/www/index.adp Mon Sep 3 13:14:32 2001 +++ hta_copy/packages/chat/www/index.adp Mon Sep 3 13:14:36 2001 @@ -2,11 +2,19 @@ Display a list of available rooms. @author David Dao (ddao@arsidigta.com) + @author Ed Avis (ed@membled.com) @creation-date November 13, 2000 --> @context_bar@ -Chat main page +Chat Rooms + + + To use the chat rooms, you need to + log in so the + system knows who you are. + + [Create a new room] @@ -20,14 +28,34 @@

      @rooms.pretty_name@ - - [HTML chat] - [Java chat] - [room admin] + + [ + + + +HTML chat +| Java +chat + + + +chat + + + + +chat + + + +| room admin + + ] @rooms.description@ + diff -ru acs42/packages/chat/www/index.tcl hta_copy/packages/chat/www/index.tcl --- acs42/packages/chat/www/index.tcl Mon Sep 3 13:14:32 2001 +++ hta_copy/packages/chat/www/index.tcl Mon Sep 3 13:14:36 2001 @@ -11,25 +11,69 @@ user_id:onevalue room_create_p:onevalue rooms:multirow + show_html:onevalue + show_java:onevalue } set package_id [ad_conn package_id] - set context_bar [ad_context_bar] - set user_id [ad_conn user_id] +if {$user_id == 0} { + # The template page will tell the user to log in. + ad_return_template + return +} set room_create_p [ad_permission_p $package_id chat_room_create] -db_multirow rooms rooms_list { - select rm.room_id, rm.pretty_name, rm.description, rm.moderated_p, rm.active_p, rm.archive_p, - acs_permission.permission_p(room_id, :user_id, 'chat_room_admin') as admin_p +# Which chat interfaces to show: HTML and/or Java +set show_html [ad_parameter ShowHTMLChat 1] +set show_java [ad_parameter ShowJavaChat 1] +if {! $show_html && ! $show_java} { + ad_return_error "No chat interfaces enabled" " + Both the ShowHTMLChat and ShowJavaChat parameters are false. + At least one chat interface must be enabled. Please go and set + the parameters for this instance. + " +} + +# Number of rooms in total +set count 0 + +# Whether any admin functionality is available to this user +set any_admin $room_create_p + +# Datasource for template page +template::multirow create rooms \ + room_id pretty_name description moderated_p archive_p admin_p + +db_foreach rooms_list { + select rm.room_id, rm.pretty_name, rm.description, + rm.moderated_p, rm.archive_p, + acs_permission.permission_p(room_id, :user_id, 'chat_room_admin') + as admin_p from chat_rooms rm, acs_objects obj where obj.context_id = :package_id and rm.room_id = obj.object_id order by rm.pretty_name +} { + incr count + if {$admin_p == "t"} { set any_admin 1 } + template::multirow append rooms \ + $room_id $pretty_name $description $moderated_p $archive_p $admin_p } +# If only one chat room, only one interface, and no admin functions, +# then jump straight to that chat room. +# +if {$count == 1 && ! $any_admin} { + if {$show_html && ! $show_java} { + template::forward "room-enter?room_id=$room_id&client=html" + } elseif {! $show_html && $show_java} { + template::forward "room-enter?room_id=$room_id&client=java" + } +} ad_return_template diff -ru acs42/packages/chat/www/master.adp hta_copy/packages/chat/www/master.adp --- acs42/packages/chat/www/master.adp Mon Sep 3 13:14:32 2001 +++ hta_copy/packages/chat/www/master.adp Mon Sep 3 13:14:36 2001 @@ -1,9 +1,9 @@ Chat: @title@ +@context_bar@

      @title@

      -@context_bar@
      diff -ru acs42/packages/chat/www/message-delete.tcl hta_copy/packages/chat/www/message-delete.tcl --- acs42/packages/chat/www/message-delete.tcl Mon Sep 3 13:14:32 2001 +++ hta_copy/packages/chat/www/message-delete.tcl Mon Sep 3 13:14:36 2001 @@ -15,10 +15,12 @@ ad_require_permission $room_id chat_room_delete -set context_bar [ad_context_bar [list "room?room_id=$room_id" "Room information"] "Delete messages"] +set context_bar [ad_context_bar \ + [list "room?room_id=$room_id" "Room information"] \ + "Delete messages"] set pretty_name [chat_room_name $room_id] set message_count [chat_message_count $room_id] -ad_return_template \ No newline at end of file +ad_return_template diff -ru acs42/packages/chat/www/moderator-revoke.tcl hta_copy/packages/chat/www/moderator-revoke.tcl --- acs42/packages/chat/www/moderator-revoke.tcl Mon Sep 3 13:14:32 2001 +++ hta_copy/packages/chat/www/moderator-revoke.tcl Mon Sep 3 13:14:36 2001 @@ -12,10 +12,12 @@ ad_require_permission $room_id chat_moderator_revoke -set context_bar [ad_context_bar [list "room?room_id=$room_id" "Room information"] "Revoke moderator"] +set context_bar [ad_context_bar \ + [list "room?room_id=$room_id" "Room information"] \ + "Revoke moderator"] set party_pretty_name [db_string get_party_name "select acs_object.name(:party_id) from dual"] set pretty_name [chat_room_name $room_id] -ad_return_template \ No newline at end of file +ad_return_template diff -ru acs42/packages/chat/www/room-enter.tcl hta_copy/packages/chat/www/room-enter.tcl --- acs42/packages/chat/www/room-enter.tcl Mon Sep 3 13:14:32 2001 +++ hta_copy/packages/chat/www/room-enter.tcl Mon Sep 3 13:14:36 2001 @@ -4,11 +4,13 @@ Perform initialize before chat "Need to change this comment" @author David Dao (ddao@arsdigita.com) + @author Ed Avis (ed@membled.com) @creation-date November 22, 2000 } { room_id:integer,notnull client:trim } +ad_maybe_redirect_for_registration chat_start_server set user_id [ad_conn user_id] diff -ru acs42/packages/chat/www/room-exit.tcl hta_copy/packages/chat/www/room-exit.tcl --- acs42/packages/chat/www/room-exit.tcl Mon Sep 3 13:14:32 2001 +++ hta_copy/packages/chat/www/room-exit.tcl Mon Sep 3 13:14:36 2001 @@ -20,7 +20,7 @@ ad_returnredirect unauthorized } -chat_message_post $room_id $user_id "has leaved the room." "1" +chat_message_post $room_id $user_id "has left the room." "1" +ad_returnredirect [ad_parameter LeavingURL ".."] -ad_returnredirect index diff -ru acs42/packages/chat/www/transcript-new.tcl hta_copy/packages/chat/www/transcript-new.tcl --- acs42/packages/chat/www/transcript-new.tcl Mon Sep 3 13:14:32 2001 +++ hta_copy/packages/chat/www/transcript-new.tcl Mon Sep 3 13:14:36 2001 @@ -16,7 +16,9 @@ ad_require_permission $room_id chat_transcript_create -set context_bar [ad_context_bar [list "room?room_id=$room_id" "Room Information"] "Create transcript"] +set context_bar [ad_context_bar \ + [list "room?room_id=$room_id" "Room Information"] \ + "Create transcript"] set transcript_id "" set transcript_name "Untitled" diff -ru acs42/packages/chat/www/unauthorized.adp hta_copy/packages/chat/www/unauthorized.adp --- acs42/packages/chat/www/unauthorized.adp Mon Sep 3 13:14:32 2001 +++ hta_copy/packages/chat/www/unauthorized.adp Mon Sep 3 13:14:36 2001 @@ -8,4 +8,6 @@ @context_bar@ Unauthorized -You don't have permission to enter this chat room. +I'm sorry, this chat room is unavaliable to you. + + diff -ru acs42/packages/chat/www/unauthorized.tcl hta_copy/packages/chat/www/unauthorized.tcl --- acs42/packages/chat/www/unauthorized.tcl Mon Sep 3 13:14:32 2001 +++ hta_copy/packages/chat/www/unauthorized.tcl Mon Sep 3 13:14:36 2001 @@ -10,4 +10,4 @@ set context_bar [ad_context_bar "Unauthorized privilege"] -ad_return_template \ No newline at end of file +ad_return_template diff -ru acs42/packages/chat/www/user-revoke.tcl hta_copy/packages/chat/www/user-revoke.tcl --- acs42/packages/chat/www/user-revoke.tcl Mon Sep 3 13:14:32 2001 +++ hta_copy/packages/chat/www/user-revoke.tcl Mon Sep 3 13:14:36 2001 @@ -12,7 +12,9 @@ ad_require_permission $room_id chat_user_revoke -set context_bar [ad_context_bar [list "room?room_id=$room_id" "Room information"] "Revoke user"] +set context_bar [ad_context_bar \ + [list "room?room_id=$room_id" "Room information"] \ + "Revoke user"] set party_pretty_name [db_string get_party_name "select acs_object.name(:party_id) from dual"] diff -ru acs42/packages/chat/www/user-unban.tcl hta_copy/packages/chat/www/user-unban.tcl --- acs42/packages/chat/www/user-unban.tcl Mon Sep 3 13:14:32 2001 +++ hta_copy/packages/chat/www/user-unban.tcl Mon Sep 3 13:14:36 2001 @@ -12,10 +12,12 @@ ad_require_permission $room_id chat_user_unban -set context_bar [ad_context_bar [list "room?room_id=$room_id" "Room information"] "Unban user"] +set context_bar [ad_context_bar \ + [list "room?room_id=$room_id" "Room information"] \ + "Unban user"] set party_pretty_name [db_string get_party_name "select acs_object.name(:party_id) from dual"] set pretty_name [chat_room_name $room_id] -ad_return_template \ No newline at end of file +ad_return_template ********************************************************************** News package. I tried to give users the traditional choice between 'plain text', 'preformatted text' and HTML, and generally introduce some sanity to the content type of news items. I may not have fully succeeded but it is better than before. See also the new Page package we wrote. The other changes to news are parameters to let the admin customize the front page of headlines, and working context bars. diff -ru acs42/packages/news/news.info hta_copy/packages/news/news.info --- acs42/packages/news/news.info Mon Sep 3 13:14:32 2001 +++ hta_copy/packages/news/news.info Mon Sep 3 13:14:39 2001 @@ -6,13 +6,14 @@ News f - + oracle-8.1.6 Stefan Deusch + Ed Avis News application - 2001-03-07 + 12-JUN-01 ArsDigita Corporation News publication tool for corporate and website news in HTML and plain text format. Beta release. @@ -66,14 +67,17 @@ + + - + + diff -ru acs42/packages/news/sql/news-create.sql hta_copy/packages/news/sql/news-create.sql --- acs42/packages/news/sql/news-create.sql Mon Sep 3 13:14:32 2001 +++ hta_copy/packages/news/sql/news-create.sql Mon Sep 3 13:14:39 2001 @@ -722,7 +722,7 @@ cr.title as publish_title, content.blob_to_string(cr.content) as publish_body, cr.content as content, - decode(cr.mime_type, 'text/html','t','f') as html_p, + cr.mime_type as mime_type, to_char(cr.publish_date, 'Mon dd, yyyy') as pretty_publish_date, cr.publish_date, ao.creation_user, @@ -753,7 +753,7 @@ to_char(cn.archive_date,'MM-DD-yyyy') as archive_date, cr.title as publish_title, content.blob_to_string(cr.content) as publish_body, - decode(cr.mime_type, 'text/html','t','f') as html_p, + cr.mime_type as mime_type, ao.creation_user, ps.first_names || ' ' || ps.last_name as item_creator, ao.creation_date, @@ -819,7 +819,6 @@ cr.publish_date as publish_date, cn.archive_date as archive_date, cr.description as log_entry, - decode(cr.mime_type,'text/html','t','f') as html_p, cr.mime_type as mime_type, cn.package_id, ao.creation_date as creation_date, @@ -876,7 +875,7 @@ revision_id, title as publish_title, content.blob_to_string(cr.content) as publish_body, - decode(cr.mime_type,'text/html','t','f') as html_p, + cr.mime_type as mime_type, cr.publish_date, cn.archive_date, news.status(cr.revision_id) as status, @@ -897,6 +896,21 @@ and cr.revision_id = cn.news_id and ci.item_id = ao.object_id and ao.creation_user = ps.person_id; + +-- The text/x-wrappable MIME type, for text that can be wrapped to fit +-- the line length (see comments elsewhere). +-- +insert into cr_mime_types (label, mime_type, file_extension) ( + select 'Wrappable text' as label, + 'text/x-wrappable' as mime_type, + 'txt' as file_extension + from dual + where not exists ( + select 0 + from cr_mime_types + where mime_type = 'text/x-wrappable' + ) +); -- plsql to create keywords for news items diff -ru acs42/packages/news/www/admin/approve.tcl hta_copy/packages/news/www/admin/approve.tcl --- acs42/packages/news/www/admin/approve.tcl Mon Sep 3 13:14:32 2001 +++ hta_copy/packages/news/www/admin/approve.tcl Mon Sep 3 13:14:39 2001 @@ -24,7 +24,7 @@ set title "Approve item(s)" -set context_bar [list $title] +set context_bar [ad_context_bar $title] # pre-set date widgets with defaults diff -ru acs42/packages/news/www/admin/index.tcl hta_copy/packages/news/www/admin/index.tcl --- acs42/packages/news/www/admin/index.tcl Mon Sep 3 13:14:32 2001 +++ hta_copy/packages/news/www/admin/index.tcl Mon Sep 3 13:14:39 2001 @@ -57,7 +57,7 @@ set title "Administration" -set context_bar {} +set context_bar [ad_context_bar] # administrator sees all news items @@ -67,7 +67,7 @@ content_item.get_best_revision(item_id) as revision_id, content_revision.get_number(news_id) as revision_no, publish_title, - html_p, + mime_type, publish_date, archive_date, creation_user, diff -ru acs42/packages/news/www/admin/item.adp hta_copy/packages/news/www/admin/item.adp --- acs42/packages/news/www/admin/item.adp Mon Sep 3 13:14:32 2001 +++ hta_copy/packages/news/www/admin/item.adp Mon Sep 3 13:14:39 2001 @@ -56,4 +56,4 @@ - +

      If you have finished reviewing the revisions, you can navigate the site using the links on the left. diff -ru acs42/packages/news/www/admin/item.tcl hta_copy/packages/news/www/admin/item.tcl --- acs42/packages/news/www/admin/item.tcl Mon Sep 3 13:14:32 2001 +++ hta_copy/packages/news/www/admin/item.tcl Mon Sep 3 13:14:39 2001 @@ -33,7 +33,7 @@ set title "One Item" -set context_bar [list $title] +set context_bar [ad_context_bar $title] set hidden_vars [export_form_vars item_id return_url] diff -ru acs42/packages/news/www/admin/master.adp hta_copy/packages/news/www/admin/master.adp --- acs42/packages/news/www/admin/master.adp Mon Sep 3 13:14:32 2001 +++ hta_copy/packages/news/www/admin/master.adp Mon Sep 3 13:14:39 2001 @@ -1,9 +1,6 @@ @title@ - -

      @title@

      - -<%= [eval ad_context_bar $context_bar] %> -
      +@context_bar@ +

      @title@

      diff -ru acs42/packages/news/www/admin/process.tcl hta_copy/packages/news/www/admin/process.tcl --- acs42/packages/news/www/admin/process.tcl Mon Sep 3 13:14:32 2001 +++ hta_copy/packages/news/www/admin/process.tcl Mon Sep 3 13:14:39 2001 @@ -41,7 +41,7 @@ } set title "Confirm Action: $action" -set context_bar [list $title] +set context_bar [ad_context_bar $title] # produce bind_id_list diff -ru acs42/packages/news/www/admin/revision-add-3.tcl hta_copy/packages/news/www/admin/revision-add-3.tcl --- acs42/packages/news/www/admin/revision-add-3.tcl Mon Sep 3 13:14:32 2001 +++ hta_copy/packages/news/www/admin/revision-add-3.tcl Mon Sep 3 13:14:39 2001 @@ -12,7 +12,7 @@ item_id:integer publish_title:notnull publish_body:notnull,allhtml,trim - html_p:notnull + mime_type:notnull revision_log:notnull publish_date_ansi:notnull archive_date_ansi:notnull @@ -33,11 +33,12 @@ set creation_ip [ad_conn "peeraddr"] set creation_user [ad_conn "user_id"] -# set mime_type -if {[string match $html_p t]} { - set mime_type "text/html" -} else { - set mime_type "text/plain" +# Check mime_type. Maybe this should move into a check {} block? +case -- $mime_type { + text/plain {} + text/x-wrappable {} + text/html {} + default { error "unrecognized mime_type $mime_type" } } # make new revision the active revision diff -ru acs42/packages/news/www/admin/revision-add.adp hta_copy/packages/news/www/admin/revision-add.adp --- acs42/packages/news/www/admin/revision-add.adp Mon Sep 3 13:14:32 2001 +++ hta_copy/packages/news/www/admin/revision-add.adp Mon Sep 3 13:14:39 2001 @@ -35,15 +35,50 @@ + The text is formatted as - - Plain Text  - HTML - - - Plain Text  - HTML - + + checked + + > Text + + + checked + + > Preformatted text + + + checked + + > HTML diff -ru acs42/packages/news/www/admin/revision-add.tcl hta_copy/packages/news/www/admin/revision-add.tcl --- acs42/packages/news/www/admin/revision-add.tcl Mon Sep 3 13:14:32 2001 +++ hta_copy/packages/news/www/admin/revision-add.tcl Mon Sep 3 13:14:39 2001 @@ -21,7 +21,7 @@ publish_date_desc:onevalue publish_title:onevalue publish_body:onevalue - html_p:onevalue + mime_type:onevalue archive_date:onevalue never_checkbox:onevalue hidden_vars:onevalue @@ -38,7 +38,7 @@ } set title "One Item - add revision" -set context_bar [list $title] +set context_bar [ad_context_bar $title] # get active revision of news item db_1row item " @@ -47,7 +47,7 @@ package_id, revision_id, publish_title, - html_p, + mime_type, publish_date, NVL(archive_date, sysdate+[ad_parameter ActiveDays "news" 14]) as archive_date, status diff -ru acs42/packages/news/www/admin/revision.tcl hta_copy/packages/news/www/admin/revision.tcl --- acs42/packages/news/www/admin/revision.tcl Mon Sep 3 13:14:32 2001 +++ hta_copy/packages/news/www/admin/revision.tcl Mon Sep 3 13:14:39 2001 @@ -19,7 +19,6 @@ item_exist_p:onevalue publish_title:onevalue publish_body:onevalue - html_p:onevalue creator_link:onevalue } @@ -33,7 +32,7 @@ revision_id, content_revision.get_number(:revision_id) as revision_no, publish_title, - html_p, + mime_type, publish_date, archive_date, creation_ip, @@ -53,15 +52,27 @@ where revision_id = :revision_id"] # text-only body - if {[info exists html_p] && ![string equal $html_p "t"]} { - set publish_body "
      [ad_quotehtml $publish_body]
      " + case -- $mime_type { + text/plain { + set publish_body "
      [ad_quotehtml $publish_body]
      " + } + text/x-wrappable { + set publish_body [ad_quotehtml [wrap_string $publish_body]] + } + text/html { + # set publish_body $publish_body :-) + } + default { + error "unhandled mime_type $mime_type" + } } + set title "One Item" - set context_bar [list $title] + set context_bar [ad_context_bar $title] } else { set context_bar {} set title "Error" } -ad_return_template \ No newline at end of file +ad_return_template diff -ru acs42/packages/news/www/doc/design.html hta_copy/packages/news/www/doc/design.html --- acs42/packages/news/www/doc/design.html Mon Sep 3 13:14:32 2001 +++ hta_copy/packages/news/www/doc/design.html Mon Sep 3 13:14:39 2001 @@ -74,8 +74,9 @@ If someone submits a news body with inconsistent HTML tags, the News application attempts to close these tags in the preview page. -

      The news body can have a MIME format of "text/plain" or -"text/html". Using HTML, the publisher can hyperlink images, audio- +

      The news body can have a MIME format of "text/plain", +"text/x-wrappable" (may be line-wrapped) or "text/html". Using HTML, +the publisher can hyperlink images, audio- and video files into the publication body from other sites or from the local file storage module. This way, the news application does not need its own content management. For instance, one can @@ -338,6 +339,9 @@ approved immediately, wait means approval by the administrator.

    • ShowSearchInterfaceP...[0,1] whether we show a 'Search Box' for searching news items with site-wide-search (must be installed). +
    • ShowFirstItemP...[0,1] whether the first news item is + displayed in full on the main news page - as opposed to just + a headline like all the others.
    • SolicitCommentsP...[1,0] whether we allow comments on a news item or not
    diff -ru acs42/packages/news/www/index.adp hta_copy/packages/news/www/index.adp --- acs42/packages/news/www/index.adp Mon Sep 3 13:14:32 2001 +++ hta_copy/packages/news/www/index.adp Mon Sep 3 14:26:24 2001 @@ -32,12 +32,22 @@ + +

    Most recent news article

    + +
    +

    Previous articles

    +

    Controls

    @@ -64,4 +74,4 @@

    • @view_switch_link@
    - \ No newline at end of file + diff -ru acs42/packages/news/www/index.tcl hta_copy/packages/news/www/index.tcl --- acs42/packages/news/www/index.tcl Mon Sep 3 13:14:32 2001 +++ hta_copy/packages/news/www/index.tcl Mon Sep 3 13:14:39 2001 @@ -13,27 +13,26 @@ {view:trim "live"} } -properties { - - title:onevalue context_bar:onevalue news_admin_p:onevalue news_create_p:onevalue news_items:multirow allow_search_p:onevalue + show_first_item_p:onevalue pagination_link:onevalue item_create_link:onevalue view_switch_link:onevalue + first_item_id:onevalue + first_publish_title:onevalue + first_publish_body:onevalue + first_creator_link:onevalue } - +set context_bar [ad_context_bar] set package_id [ad_conn package_id] ad_require_permission $package_id news_read - -set context_bar {} - - # switches for privilege-enabled links: admin for news_admin, submit for registered users set news_admin_p [ad_permission_p $package_id news_admin] set news_create_p [ad_permission_p $package_id news_create] @@ -42,11 +41,13 @@ # switch for showing interface to site-wide-search for news set allow_search_p [ad_parameter ShowSearchInterfaceP "news" 1] +# switch for showing the first news story inline +set show_first_item_p [ad_parameter ShowFirstItemP "news" 1] # view switch in live | archived news if { [string equal "live" $view] } { - set title "News" + set title "Project News - What's New" set view_clause " publish_date < sysdate and (archive_date is null or archive_date > sysdate)" @@ -110,6 +111,29 @@ if { $count >= [expr $start + $max_dspl] } break } + +if {$show_first_item_p} { + db_0or1row get_first_item " + select item_id as first_item_id, + publish_title as first_publish_title, + publish_body as first_publish_body, + '' || item_creator || '' + as first_creator_link + from ( + select * + from news_items_approved + where $view_clause + and package_id = :package_id + order by publish_date desc, item_id desc + ) where rownum = 1 + " + + if {! [info exists first_item_id]} { + # There isn't a first item - don't show it after all. + set show_first_item_p 0 + } +} # make paging links if { $count < [expr $start + $max_dspl] } { diff -ru acs42/packages/news/www/item-create-3.tcl hta_copy/packages/news/www/item-create-3.tcl --- acs42/packages/news/www/item-create-3.tcl Mon Sep 3 13:14:32 2001 +++ hta_copy/packages/news/www/item-create-3.tcl Mon Sep 3 13:14:39 2001 @@ -13,7 +13,7 @@ publish_body:notnull,allhtml,trim {publish_date_ansi:trim "[db_null]"} {archive_date_ansi:trim "[db_null]"} - html_p:notnull + mime_type:notnull permanent_p:notnull } -properties { @@ -21,7 +21,7 @@ title:onevalue context_bar:onevalue } - +set context_bar "" # news_create permissions set package_id [ad_conn package_id] @@ -55,11 +55,12 @@ set user_id [ad_conn "user_id"] -# set mime_type -if {[string match $html_p t]} { - set mime_type "text/html" -} else { - set mime_type "text/plain" +# Check mime_type. Maybe this should move into a check {} block? +case -- $mime_type { + text/plain {} + text/x-wrappable {} + text/html {} + default { error "unrecognized mime_type $mime_type" } } @@ -94,7 +95,7 @@ if { ![string equal "open" [ad_parameter ApprovalPolicy "news" "wait"]] } { # case: user submitted news item, is returned to a Thank-you page set title "News item submitted" - set context_bar [list $title] + set context_bar [ad_context_bar $title] ad_return_template item-create-thankyou } } else { diff -ru acs42/packages/news/www/item-create.adp hta_copy/packages/news/www/item-create.adp --- acs42/packages/news/www/item-create.adp Mon Sep 3 13:14:32 2001 +++ hta_copy/packages/news/www/item-create.adp Mon Sep 3 13:14:39 2001 @@ -33,9 +33,13 @@ - The text is formatted as   - Plain Text  - HTML + The text is formatted as +  Text + +  Preformatted text + +  HTML diff -ru acs42/packages/news/www/item-create.tcl hta_copy/packages/news/www/item-create.tcl --- acs42/packages/news/www/item-create.tcl Mon Sep 3 13:14:32 2001 +++ hta_copy/packages/news/www/item-create.tcl Mon Sep 3 13:14:39 2001 @@ -33,7 +33,7 @@ } set title "Create News Item" -set context_bar [list $title] +set context_bar [ad_context_bar $title] set proj_archival_date [db_string week "select sysdate + [ad_parameter ActiveDays "news" 14] from dual"] diff -ru acs42/packages/news/www/item.tcl hta_copy/packages/news/www/item.tcl --- acs42/packages/news/www/item.tcl Mon Sep 3 13:14:32 2001 +++ hta_copy/packages/news/www/item.tcl Mon Sep 3 13:14:39 2001 @@ -17,7 +17,7 @@ publish_title:onevalue publish_date:onevalue publish_body:onevalue - html_p:onevalue + mime_type:onevalue creator_link:onevalue comments:onevalue comment_link:onevalue @@ -32,7 +32,7 @@ select item_id, live_revision, publish_title, - html_p, + mime_type, publish_date, '' || item_creator || '' as creator_link from news_items_live_or_submitted @@ -50,8 +50,21 @@ # text-only body - if {[info exists html_p] && [string equal $html_p "f"]} { - set publish_body "
    [ad_quotehtml $publish_body]
    " + + # FIXME commonize this + switch -- $mime_type { + text/plain { + set publish_body "
    [ad_quotehtml $publish_body]
    " + } + text/x-wrappable { + set publish_body " +
    [ad_quotehtml [wrap_string $publish_body]]
    + " + } + text/html {} + default { + error "unhandled mime_type $mime_type" + } } if { [ad_parameter SolicitCommentsP "news" 0] && @@ -65,10 +78,10 @@ } set title $publish_title - set context_bar [list $title] + set context_bar [ad_context_bar $title] } else { - set context_bar {} + set context_bar "" set title "Error" } diff -ru acs42/packages/news/www/master.adp hta_copy/packages/news/www/master.adp --- acs42/packages/news/www/master.adp Mon Sep 3 13:14:32 2001 +++ hta_copy/packages/news/www/master.adp Mon Sep 3 13:14:39 2001 @@ -1,11 +1,7 @@ @title@ - +@context_bar@

    @title@

    - -<%= [eval ad_context_bar $context_bar] %> -
    - diff -ru acs42/packages/news/www/preview.tcl hta_copy/packages/news/www/preview.tcl --- acs42/packages/news/www/preview.tcl Mon Sep 3 13:14:32 2001 +++ hta_copy/packages/news/www/preview.tcl Mon Sep 3 13:14:39 2001 @@ -12,7 +12,7 @@ publish_title:notnull,trim {publish_body:allhtml,trim ""} {revision_log: ""} - html_p:notnull,trim + mime_type:notnull,trim {text_file:trim ""} {text_file.tmpfile:tmpfile ""} {publish_date:array ""} @@ -26,14 +26,19 @@ } -validate { - content_html -requires {publish_body html_p} { - if { [string equal $html_p "t"] } { - set complaint [ad_check_for_naughty_html $publish_body] - if { ![empty_string_p $complaint] } { - ad_complain $complaint - return - } - } + content_html -requires {publish_body mime_type} { + case -- $mime_type { + text/plain {} + text/x-wrappable {} + text/html { + set complaint [ad_check_for_naughty_html $publish_body] + if { ![empty_string_p $complaint] } { + ad_complain $complaint + return + } + } + default { error "unhandled mime_type $mime_type" } + } } check_revision_log -requires {action revision_log} { @@ -65,9 +70,18 @@ } } - -} -properties { - + date_check -requires {publish_date archive_date} { + set pda "$publish_date(year)-$publish_date(month)-$publish_date(day)" + set ada "$archive_date(year)-$archive_date(month)-$archive_date(day)" + + if {[catch {dt_interval_check $pda $pda} result]} { + ad_complain "The publishing date you entered ($pda) is invalid." + } + if {[catch {dt_interval_check $ada $ada} result]} { + ad_complain "The archiving date you entered ($ada) is invalid." + } + } +} -properties { title:onevalue context_bar:onevalue publish_title:onevalue @@ -75,7 +89,7 @@ publish_location:onevalue hidden_vars:onevalue permanent_p:onevalue - html_p:onevalue + mime_type:onevalue news_admin_p:onevalue form_action:onevalue } @@ -91,7 +105,7 @@ set news_admin_p [ad_permission_p $package_id news_admin] set title "Preview $action" -set context_bar [list $title] +set context_bar [ad_context_bar $title] # deal with Dates, granularity is 'day' @@ -115,7 +129,9 @@ set publish_body [read [open ${text_file.tmpfile}]] } -# close any open HTML tags in any case +# close any open HTML tags in any case. FIXME this really should +# happen only for HTML (and preferably only on display, not storage). +# set publish_body [util_close_html_tags $publish_body] @@ -123,14 +139,14 @@ # form variables for confirmation step set hidden_vars [export_form_vars publish_title publish_body \ - publish_date_ansi archive_date_ansi html_p permanent_p] + publish_date_ansi archive_date_ansi mime_type permanent_p] set form_action "" } else { # Form vars to carry through Confirmation Page set hidden_vars [export_form_vars item_id revision_log publish_title publish_body \ - publish_date_ansi archive_date_ansi permanent_p html_p] + publish_date_ansi archive_date_ansi permanent_p mime_type] set form_action "" } @@ -143,8 +159,20 @@ where user_id = :user_id"] set creator_link "$creator_name" -if { [info exists html_p] && [string match $html_p "f"] } { - set publish_body "
    [ad_quotehtml $publish_body]
    " +# FIXME commonize this +switch -- $mime_type { + text/plain { + set publish_body "
    [ad_quotehtml $publish_body]
    " + } + text/x-wrappable { + set publish_body " +
    [ad_quotehtml [wrap_string $publish_body]]
    + " + } + text/html {} + default { + error "unhandled mime_type $mime_type" + } } ad_return_template ********************************************************************** The Page package got completely rewritten, I've sent an APM separately. No point making diffs. Simple survey has not been completely rewritten, but it's still different enough to merit just sending the whole package. ********************************************************************** Small changes to ticket tracker to let you make a slightly friendlier interface. diff -ru acs42/packages/ticket-tracker/ticket-tracker.info hta_copy/packages/ticket-tracker/ticket-tracker.info --- acs42/packages/ticket-tracker/ticket-tracker.info Mon Sep 3 13:14:33 2001 +++ hta_copy/packages/ticket-tracker/ticket-tracker.info Mon Sep 3 13:14:39 2001 @@ -6,19 +6,21 @@ Ticket Trackers f - + oracle-8.1.6 Tony Tseng Phong Nguyen - Ticket Tracker 4.0 - 2001-2-15 + Ed Avis + Ticket Tracker 4.1 + 2001-06-22 ArsDigita Corporation + @@ -93,7 +95,8 @@ - + + diff -ru acs42/packages/ticket-tracker/www/ticket-view.tcl hta_copy/packages/ticket-tracker/www/ticket-view.tcl --- acs42/packages/ticket-tracker/www/ticket-view.tcl Mon Sep 3 13:14:33 2001 +++ hta_copy/packages/ticket-tracker/www/ticket-view.tcl Mon Sep 3 13:14:39 2001 @@ -96,7 +96,10 @@ } # get the comments from general comments -set comments [general_comments_get_comments "$ticket_id" "[ad_conn package_url]ticket-view?ticket_id=$ticket_id"] +set comments [general_comments_get_comments \ + -print_content_p [ad_parameter ShowCommentsContent 0] \ + $ticket_id \ + "[ad_conn package_url]ticket-view?ticket_id=$ticket_id"] ad_return_template