Index: openacs-4/packages/acs-tcl/tcl/text-html-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/text-html-procs.tcl,v diff -u -r1.76 -r1.77 --- openacs-4/packages/acs-tcl/tcl/text-html-procs.tcl 4 Feb 2018 00:59:29 -0000 1.76 +++ openacs-4/packages/acs-tcl/tcl/text-html-procs.tcl 3 Mar 2018 20:42:33 -0000 1.77 @@ -1856,57 +1856,73 @@ # #################### +if {![info commands ns_reflow_text] ne ""} { + ad_proc ns_reflow_text {{-width 80} {-prefix ""} input} { -ad_proc wrap_string {input {threshold 80}} { - wraps a string to be no wider than 80 columns by inserting line breaks -} { - set result_rows [list] - set start_of_line_index 0 - while 1 { - set this_line [string range $input $start_of_line_index [expr {$start_of_line_index + $threshold - 1}]] - if { $this_line eq "" } { - return [join $result_rows "\n"] - } - set first_new_line_pos [string first "\n" $this_line] - if { $first_new_line_pos != -1 } { - # there is a newline - lappend result_rows [string range $input $start_of_line_index [expr {$start_of_line_index + $first_new_line_pos - 1}]] - set start_of_line_index [expr {$start_of_line_index + $first_new_line_pos + 1}] - continue - } - if { $start_of_line_index + $threshold + 1 >= [string length $input] } { - # we're on the last line and it is < threshold so just return it - lappend result_rows $this_line - return [join $result_rows "\n"] - } - set last_space_pos [string last " " $this_line] - if { $last_space_pos == -1 } { - # no space found! Try the first space in the whole rest of the string - set next_space_pos [string first " " [string range $input $start_of_line_index end]] - set next_newline_pos [string first "\n" [string range $input $start_of_line_index end]] - if {$next_space_pos == -1} { - set last_space_pos $next_newline_pos - } elseif {$next_space_pos < $next_newline_pos} { - set last_space_pos $next_space_pos - } else { - set last_space_pos $next_newline_pos + Reflow a plain text to the given width and prefix every line + optionally wiith the provided string + + } { + set result_rows [list] + set start_of_line_index 0 + while 1 { + set this_line [string range $input $start_of_line_index [expr {$start_of_line_index + $width - 1}]] + if { $this_line eq "" } { + set result [join $result_rows "\n"] + break } + set first_new_line_pos [string first "\n" $this_line] + if { $first_new_line_pos != -1 } { + # there is a newline + lappend result_rows [string range $input $start_of_line_index \ + [expr {$start_of_line_index + $first_new_line_pos - 1}]] + set start_of_line_index [expr {$start_of_line_index + $first_new_line_pos + 1}] + continue + } + if { $start_of_line_index + $width + 1 >= [string length $input] } { + # we're on the last line and it is < width so just return it + lappend result_rows $this_line + break + } + set last_space_pos [string last " " $this_line] if { $last_space_pos == -1 } { - # didn't find any more whitespace, append the whole thing as a line - lappend result_rows [string range $input $start_of_line_index end] - return [join $result_rows "\n"] + # no space found! Try the first space in the whole rest of the string + set next_space_pos [string first " " [string range $input $start_of_line_index end]] + set next_newline_pos [string first "\n" [string range $input $start_of_line_index end]] + if {$next_space_pos == -1} { + set last_space_pos $next_newline_pos + } elseif {$next_space_pos < $next_newline_pos} { + set last_space_pos $next_space_pos + } else { + set last_space_pos $next_newline_pos + } + if { $last_space_pos == -1 } { + # didn't find any more whitespace, append the whole thing as a line + lappend result_rows [string range $input $start_of_line_index end] + break + } } + # OK, we have a last space pos of some sort + set real_index_of_space [expr {$start_of_line_index + $last_space_pos}] + lappend result_rows [string range $input $start_of_line_index $real_index_of_space-1] + set start_of_line_index [expr {$start_of_line_index + $last_space_pos + 1}] } - # OK, we have a last space pos of some sort - set real_index_of_space [expr {$start_of_line_index + $last_space_pos}] - lappend result_rows [string range $input $start_of_line_index $real_index_of_space-1] - set start_of_line_index [expr {$start_of_line_index + $last_space_pos + 1}] + return $prefix[join $result_rows "\n$prefix"] } } +ad_proc -deprecated wrap_string {input {width 80}} { + wraps a string to be no wider than 80 columns by inserting line breaks + @see ns_reflow_text +} { + return [ns_reflow_text -width $width -prefix "" $input] +} + + + #################### # # Wrappers to make it easier to write generic code @@ -2080,7 +2096,7 @@ set text [ad_text_to_html -- $text] } text/plain { - set text [wrap_string $text $maxlen] + set text [ns_reflow_text -width $maxlen -- $text] } } } @@ -2090,7 +2106,7 @@ set text "
[ad_text_to_html -no_lines -- $text]
" } text/plain { - set text [wrap_string $text $maxlen] + set text [ns_reflow_text -width $maxlen -- $text] } } } @@ -2110,7 +2126,7 @@ set text "
[ad_text_to_html -no_lines -- $text]
" } text/plain { - set text [wrap_string $text $maxlen] + set text [ns_reflow_text -width $maxlen -- $text] } } } Index: openacs-4/packages/faq/faq.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/faq/faq.info,v diff -u -r1.28 -r1.29 --- openacs-4/packages/faq/faq.info 7 Aug 2017 23:48:10 -0000 1.28 +++ openacs-4/packages/faq/faq.info 3 Mar 2018 20:42:33 -0000 1.29 @@ -7,7 +7,7 @@ f f - + Nima Mazloumi Jennie Kim Housman Elizabeth Wirth @@ -18,9 +18,9 @@ 2 #faq.FAQs# - + - + Index: openacs-4/packages/faq/tcl/q-and-a-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/faq/tcl/q-and-a-procs.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/faq/tcl/q-and-a-procs.tcl 7 Aug 2017 23:48:10 -0000 1.3 +++ openacs-4/packages/faq/tcl/q-and-a-procs.tcl 3 Mar 2018 20:42:33 -0000 1.4 @@ -26,7 +26,7 @@ append text_version "Faq: $faq_name Author: $name ($email)\n\n" - append text_version [wrap_string $q_a_text] + append text_version [ns_reflow_text -- $q_a_text] append text_version "\n\n-- To view the entire FAQ go to: $faq_url Index: openacs-4/packages/sloan-bboard/sloan-bboard.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/sloan-bboard/sloan-bboard.info,v diff -u -r1.5 -r1.6 --- openacs-4/packages/sloan-bboard/sloan-bboard.info 19 Oct 2016 09:00:04 -0000 1.5 +++ openacs-4/packages/sloan-bboard/sloan-bboard.info 3 Mar 2018 20:42:33 -0000 1.6 @@ -7,7 +7,7 @@ f f - + oracle postgresql @@ -19,8 +19,9 @@ 2004-03-10 OpenACS This is the release candidate for bboard version 4.0.2. This package provides customizable discussion forums for a community of users. - + + Index: openacs-4/packages/sloan-bboard/tcl/bboard-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/sloan-bboard/tcl/bboard-procs.tcl,v diff -u -r1.6 -r1.7 --- openacs-4/packages/sloan-bboard/tcl/bboard-procs.tcl 20 Apr 2004 21:13:55 -0000 1.6 +++ openacs-4/packages/sloan-bboard/tcl/bboard-procs.tcl 3 Mar 2018 20:42:33 -0000 1.7 @@ -952,11 +952,11 @@ where forum_id = :forum_id } - if {[string equal $mime_type "text/plain"]} { + if {$mime_type eq "text/plain"} { set result $content - } elseif {[string equal $mime_type "text/plain; format=flowed"]} { - set result [wrap_string $content] - } elseif {[string equal $mime_type "text/html"]} { + } elseif {$mime_type eq "text/plain; format=flowed"} { + set result [ns_reflow_text -- $content] + } elseif {$mime_type eq "text/html"} { set result [ad_html_to_text -- $content] } else { set result "Error display bboard posting as email! Index: openacs-4/packages/sloan-bboard/www/forum-entry.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/sloan-bboard/www/forum-entry.adp,v diff -u -r1.7 -r1.8 --- openacs-4/packages/sloan-bboard/www/forum-entry.adp 29 Mar 2002 19:35:47 -0000 1.7 +++ openacs-4/packages/sloan-bboard/www/forum-entry.adp 3 Mar 2018 20:42:33 -0000 1.8 @@ -43,7 +43,7 @@ --> Index: openacs-4/packages/sloan-bboard/www/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/sloan-bboard/www/index.adp,v diff -u -r1.6 -r1.7 --- openacs-4/packages/sloan-bboard/www/index.adp 29 Mar 2002 19:35:47 -0000 1.6 +++ openacs-4/packages/sloan-bboard/www/index.adp 3 Mar 2018 20:42:33 -0000 1.7 @@ -32,7 +32,7 @@
  • @forums.short_name@ - + (moderated) Index: openacs-4/packages/sloan-bboard/www/message-threaded.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/sloan-bboard/www/message-threaded.adp,v diff -u -r1.3 -r1.4 --- openacs-4/packages/sloan-bboard/www/message-threaded.adp 11 May 2005 13:51:48 -0000 1.3 +++ openacs-4/packages/sloan-bboard/www/message-threaded.adp 3 Mar 2018 20:42:33 -0000 1.4 @@ -28,7 +28,7 @@ - + [Subscribe to replies] Index: openacs-4/packages/sloan-bboard/www/message.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/sloan-bboard/www/message.adp,v diff -u -r1.6 -r1.7 --- openacs-4/packages/sloan-bboard/www/message.adp 29 Mar 2002 19:35:47 -0000 1.6 +++ openacs-4/packages/sloan-bboard/www/message.adp 3 Mar 2018 20:42:33 -0000 1.7 @@ -30,7 +30,7 @@ [Move Thread] - + [Subscribe to replies] Index: openacs-4/packages/webmail/webmail.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/webmail/webmail.info,v diff -u -r1.4 -r1.5 --- openacs-4/packages/webmail/webmail.info 11 Dec 2003 21:40:15 -0000 1.4 +++ openacs-4/packages/webmail/webmail.info 3 Mar 2018 20:42:33 -0000 1.5 @@ -6,7 +6,7 @@ Webmail t - + oracle @@ -15,8 +15,10 @@ 2001-02-15 OpenACS Provides a web-based email service for ACS 4.x, uses the database for message storage. Broken and oracle only. + + Index: openacs-4/packages/webmail/www/message-printable.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/webmail/www/message-printable.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/webmail/www/message-printable.tcl 1 Mar 2005 00:01:45 -0000 1.2 +++ openacs-4/packages/webmail/www/message-printable.tcl 3 Mar 2018 20:42:33 -0000 1.3 @@ -77,7 +77,7 @@ } -set final_msg_body [wrap_string $final_msg_body 80] +set final_msg_body [ns_reflow_text -width 80 -- $final_msg_body] ad_return_template Index: openacs-4/packages/webmail/www/message-send-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/webmail/www/message-send-2.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/webmail/www/message-send-2.tcl 1 Mar 2005 00:01:45 -0000 1.3 +++ openacs-4/packages/webmail/www/message-send-2.tcl 3 Mar 2018 20:42:33 -0000 1.4 @@ -83,7 +83,7 @@ ################### START THE TRANSACTION ################### db_transaction { - set cleaned_body [wrap_string $body] + set cleaned_body [ns_reflow_text -- $body] db_dml wm_update_message_body { UPDATE wm_outgoing_messages SET body = empty_clob() Index: openacs-4/packages/webmail/www/message.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/webmail/www/message.adp,v diff -u -r1.2 -r1.3 --- openacs-4/packages/webmail/www/message.adp 22 May 2003 15:18:38 -0000 1.2 +++ openacs-4/packages/webmail/www/message.adp 3 Mar 2018 20:42:33 -0000 1.3 @@ -1,158 +1,158 @@ - -@context;noquote@ - - - -
    - - - - - - - - - - -
    - - - - - @nav_links.name@ - - @nav_links.name@ - - - - - This message is currently filed in: @mailbox_name@ - -
    - - - - - - - -     - -     - - Printable view - - -
    - Reply - - Reply All - - Forward as Attachment - - Forward Inline -
    -
    -
    - - - - From: ><%=[ad_quotehtml @headers.value@]%>
    -
    - - Subject: <%=[ad_quotehtml @headers.value@]%>
    -
    - - @headers.name@: <%=[ad_quotehtml @headers.value@]%>
    -
    -
    - - - - References: - - @refs.count@ -
    -
    -   - - - Show all headers - - Hide headers - - - - -   |   - - - - Show unparsed message - - Show decoded message - -
    -
    - -

    -@final_msg_body@ -

    - -
    - - - - - - - - -
    - Reply - - Reply All - - Forward as Attachment - - Forward Inline -
    - - - - - -     - -     - - Printable view -
    - - - - - @nav_links.name@ - - @nav_links.name@ - - -
    -
    - - - - - - + +@context;noquote@ + + + +
    + + + + + + + + + + +
    + + - + + @nav_links.name@ + + @nav_links.name@ + + + + + This message is currently filed in: @mailbox_name@ + +
    + + + + + + + +     + +     + + Printable view + + +
    + Reply - + Reply All - + Forward as Attachment - + Forward Inline +
    +
    +
    + + + + From: ><%=[ad_quotehtml @headers.value@]%>
    +
    + + Subject: <%=[ad_quotehtml @headers.value@]%>
    +
    + + @headers.name@: <%=[ad_quotehtml @headers.value@]%>
    +
    +
    + + + + References: + + @refs.count@ +
    +
    +   + + + Show all headers + + Hide headers + + + + +   |   + + + + Show unparsed message + + Show decoded message + +
    +
    + +

    +@final_msg_body@ +

    + +
    + + + + + + + + +
    + Reply - + Reply All - + Forward as Attachment - + Forward Inline +
    + + + + + +     + +     + + Printable view +
    + + - + + @nav_links.name@ + + @nav_links.name@ + + +
    +
    + + + + + + Index: openacs-4/packages/webmail/www/preferences.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/webmail/www/preferences.adp,v diff -u -r1.2 -r1.3 --- openacs-4/packages/webmail/www/preferences.adp 22 May 2003 15:18:38 -0000 1.2 +++ openacs-4/packages/webmail/www/preferences.adp 3 Mar 2018 20:42:33 -0000 1.3 @@ -1,95 +1,95 @@ - - - -@context;noquote@ - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    How many messages should we display per page?
    From Name: (as you would like it to appear in the from field of messages)
    Reply-to: (if different from your Webmail address)
    Automatically save sent messages? - checked> Yes   - checked> No -
    Give confirmation page for sent messages? - checked> Yes   - checked> No -
    Use signature as default? - checked> Yes   - checked> No -    -
    Move to index upon message delete? - checked> Yes   - checked> No -
    Forward Address:
    Turn forwarding to the above address on? - checked> Yes   - checked> No -
    What timezone are you in? - -
    - -
    -
    + + + +@context;noquote@ + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    How many messages should we display per page?
    From Name: (as you would like it to appear in the from field of messages)
    Reply-to: (if different from your Webmail address)
    Automatically save sent messages? + checked> Yes   + checked> No +
    Give confirmation page for sent messages? + checked> Yes   + checked> No +
    Use signature as default? + checked> Yes   + checked> No +    +
    Move to index upon message delete? + checked> Yes   + checked> No +
    Forward Address:
    Turn forwarding to the above address on? + checked> Yes   + checked> No +
    What timezone are you in? + +
    + +
    +
    Index: openacs-4/packages/webmail/www/util-pages/constraint-form.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/webmail/www/util-pages/constraint-form.adp,v diff -u -r1.1 -r1.2 --- openacs-4/packages/webmail/www/util-pages/constraint-form.adp 20 Apr 2001 20:51:24 -0000 1.1 +++ openacs-4/packages/webmail/www/util-pages/constraint-form.adp 3 Mar 2018 20:42:33 -0000 1.2 @@ -1,6 +1,6 @@ Match:  -checked
    > all constraints   -checked
    > any constraint
    +checked
    > all constraints   +checked> any constraint