Commit 38d5de1f authored by Frank Bergmann's avatar Frank Bergmann

- OpenACS 5.9

parent c833d47f
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -25,7 +25,12 @@ if {![info exists css]} {
set fn [get_server_root]/packages/xowiki/www/resources/xowiki.css
set F [open $fn]; set css [read $F]; close $F
set css "<style type='text/css'>$css</style>"
# set html $css$html
set html $css$html
}
# Local variables:
# mode: tcl
# tcl-indent-level: 2
# indent-tabs-mode: nil
# End:
This diff is collapsed.
::xo::library doc {
bootstrap procs: provide some (initial) support for bootstrap library
@creation-date 2014-04-14
@author Günter Ernst
@author Gustaf Neumann
@cvs-id $Id$
}
::xo::library require menu-procs
namespace eval ::xowiki {
# minimal implementation of Bootstrap "navbar"
# currently only "dropdown" elements are supported within the navbar
# TODO: add support to include:
# - forms
# - buttons
# - text
# - Non-nav links
# - component alignment
# - navbar positioning
# - navbar inverting
::xo::tdom::Class create BootstrapNavbar \
-superclass Menu \
-parameter {
{autorender false}
{containerClass "container"}
{navbarClass "navbar navbar-default navbar-static-top"}
}
BootstrapNavbar instproc init {} {
::xo::Page requireJS "/resources/xowiki/jquery/jquery.min.js"
set css [parameter::get_global_value -package_key xowiki -parameter BootstrapCSS]
set js [parameter::get_global_value -package_key xowiki -parameter BootstrapJS]
foreach url $css {::xo::Page requireCSS $url}
foreach url $js {::xo::Page requireJS $url}
next
}
BootstrapNavbar ad_instproc render {} {
http://getbootstrap.com/components/#navbar
} {
html::nav -class [my navbarClass] -role "navigation" {
html::div -class [my containerClass] {
foreach dropdownmenu [my children] {
$dropdownmenu render
}
}
}
}
#
# BootstrapNavbarDropdownMenu
#
::xo::tdom::Class create BootstrapNavbarDropdownMenu \
-superclass Menu \
-parameter {
text
header
{brand false}
}
BootstrapNavbarDropdownMenu ad_instproc render {} {doku} {
# TODO: Add support for group-headers
# get group header
set group 1
html::ul -class "nav navbar-nav" {
html::li -class "dropdown" {
set class "dropdown-toggle"
if {[my brand]} {lappend class "navbar-brand"}
html::a -href "\#" -class $class -data-toggle "dropdown" {
html::t [my text]
html::b -class "caret"
}
html::ul -class "dropdown-menu" {
foreach dropdownmenuitem [my children] {
if {[$dropdownmenuitem set group] ne "" && [$dropdownmenuitem set group] ne $group } {
html::li -class "divider"
set group [$dropdownmenuitem set group]
}
$dropdownmenuitem render
}
}
}
}
}
#
# BootstrapNavbarDropdownMenuItem
#
::xo::tdom::Class create BootstrapNavbarDropdownMenuItem \
-superclass MenuItem \
-parameter {
{href "#"}
helptext
}
BootstrapNavbarDropdownMenuItem ad_instproc render {} {doku} {
html::li -class [expr {[my set href] eq "" ? "disabled": ""}] {
html::a [my get_attributes target href title] {
html::t [my text]
}
}
}
# --------------------------------------------------------------------------
# render it
# --------------------------------------------------------------------------
::xowiki::MenuBar instproc render-bootstrap {} {
set M [my content]
set mb [::xowiki::BootstrapNavbar \
-id [my get_prop $M id] {
foreach {menu_att menu} $M {
if {$menu_att eq "id"} continue
#
# set default properties and
#
set props {brand false}
if {[llength $menu_att] > 1} {
# we expect a dict as second list element
lassign $menu_att menu_att props1
lappend props {*}$props1
}
# currently we render erverthing as a dropdown
::xowiki::BootstrapNavbarDropdownMenu \
-brand [dict get $props brand] \
-text [my get_prop $menu text] {
#ns_log notice "... dropdown menu_att $menu_att menu $menu"
foreach {item_att item} $menu {
if {[string match {[a-z]*} $item_att]} continue
set text [my get_prop $item text]
set url [my get_prop $item url]
set group [my get_prop $item group]
::xowiki::BootstrapNavbarDropdownMenuItem -text $text -href $url -group $group {}
}
}
}
}]
#ns_log notice call-mb-asHTML
return [$mb asHTML]
}
}
###############################################################################
# Bootstrap table
###############################################################################
# TODO Allow renderers from other namespaces in 30-widget-procs
namespace eval ::xo::Table {
Class create ::xowiki::BootstrapTable \
-superclass ::xo::Table \
-parameter {
skin
}
::xowiki::BootstrapTable instproc init {} {
set trn_mixin [expr {[lang::util::translator_mode_p] ?"::xo::TRN-Mode" : ""}]
my render_with BootstrapTableRenderer $trn_mixin
next
}
Class create BootstrapTableRenderer \
-superclass TABLE3 \
-instproc init_renderer {} {
next
my set css.table-class "table table-striped"
my set css.tr.even-class even
my set css.tr.odd-class odd
my set id [::xowiki::Includelet js_name [::xowiki::Includelet html_id [self]]]
}
BootstrapTableRenderer instproc render-body {} {
html::thead {
html::tr -class list-header {
foreach o [[self]::__columns children] {
if {[$o hide]} continue
$o render
}
}
}
set children [my children]
html::tbody {
foreach line [my children] {
html::tr -class [expr {[my incr __rowcount]%2 ? [my set css.tr.odd-class] : [my set css.tr.even-class] }] {
foreach field [[self]::__columns children] {
if {[$field hide]} continue
if {[$field istype HiddenField]} continue
html::td [concat [list class list] [$field html]] {
$field render-data $line
}
}
}
}
}
}
BootstrapTableRenderer instproc render {} {
::xo::Page requireCSS "//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css"
if {![my isobject [self]::__actions]} {my actions {}}
if {![my isobject [self]::__bulkactions]} {my __bulkactions {}}
set bulkactions [[self]::__bulkactions children]
if {[llength $bulkactions]>0} {
set name [[self]::__bulkactions set __identifier]
} else {
set name [::xowiki::Includelet js_name [self]]
}
html::div -id [my set id]_wrapper -class "table-responsive" {
html::form -name $name -id $name -method POST {
html::div -id [my set id]_container {
html::table -id [my set id] -class [my set css.table-class] {
my render-actions
my render-body
}
if {[llength $bulkactions]>0} { my render-bulkactions }
}
}
}
}
#Class create BootstrapTableRenderer::AnchorField -superclass TABLE::AnchorField
Class create BootstrapTableRenderer::AnchorField \
-superclass TABLE::Field \
-ad_doc "
In addition to the standard TableWidget's AnchorField, we also allow the attributes
<ul>
<li>onclick
<li>target
</ul>
" \
-instproc render-data {line} {
set __name [my name]
if {[$line exists $__name.href] &&
[set href [$line set $__name.href]] ne ""} {
# use the CSS class rather from the Field than not the line
my instvar CSSclass
$line instvar [list $__name.title title] \
[list $__name.target target] \
[list $__name.onclick onclick]
html::a [my get_local_attributes href title {CSSclass class} target onclick] {
return "[next]"
}
}
next
}
Class create BootstrapTableRenderer::Action -superclass TABLE::Action
Class create BootstrapTableRenderer::Field -superclass TABLE::Field
Class create BootstrapTableRenderer::HiddenField -superclass TABLE::HiddenField
Class create BootstrapTableRenderer::ImageField -superclass TABLE::ImageField
Class create BootstrapTableRenderer::ImageAnchorField -superclass TABLE::ImageAnchorField
Class create BootstrapTableRenderer::BulkAction -superclass TABLE::BulkAction
}
::xo::library source_dependent
#
# Local variables:
# mode: tcl
# tcl-indent-level: 2
# indent-tabs-mode: nil
# End:
......@@ -20,13 +20,13 @@ namespace eval ::xowiki {
# Return matched category trees matching the specified names (or all)
# provide compatibility with earlier versions of categories
set have_locale [expr {[lsearch [info args category_tree::get_mapped_trees] locale] > -1}]
set have_locale [expr {"locale" in [info args category_tree::get_mapped_trees]}]
set mapped_trees [expr {$have_locale ?
[category_tree::get_mapped_trees $object_id $locale] :
[category_tree::get_mapped_trees $object_id]}]
set trees [list]
foreach tree $mapped_trees {
foreach {tree_id my_tree_name ...} $tree {break}
lassign $tree tree_id my_tree_name ...
# "names" is a list of category names
if {$names ne ""} {
......@@ -49,7 +49,7 @@ namespace eval ::xowiki {
}
# Get the values from info in "tree" into separate variables given by output.
# Note, that the order matters!
foreach $output $tree break
lassign $tree {*}$output
set l [list]
foreach __var $output {lappend l [set $__var]}
lappend trees $l
......@@ -62,13 +62,20 @@ namespace eval ::xowiki {
# provide a common interface to older versions of categories
#
# provide compatibility with earlier versions of categories
set have_locale [expr {[lsearch [info args category_tree::get_tree] locale] > -1}]
#set have_locale [expr {[lsearch [info args category_tree::get_tree] locale] > -1}]
set have_locale 1
set all_arg [expr {$all ? "-all" : ""}]
return [expr {$have_locale ?
[eval category_tree::get_tree $all_arg -subtree_id [list $subtree_id] $tree_id $locale] :
[eval category_tree::get_tree $all_arg -subtree_id [list $subtree_id] $tree_id]}]
[category_tree::get_tree {*}$all_arg -subtree_id $subtree_id $tree_id $locale] :
[category_tree::get_tree {*}$all_arg -subtree_id $subtree_id $tree_id]}]
}
}
::xo::library source_dependent
# Local variables:
# mode: tcl
# tcl-indent-level: 2
# indent-tabs-mode: nil
# End:
::xo::library doc {
XoWiki - chat procs
XoWiki - chat procs
@creation-date 2006-02-02
@author Gustaf Neumann
@cvs-id $Id$
@creation-date 2006-02-02
@author Gustaf Neumann
@cvs-id $Id$
}
namespace eval ::xowiki {
::xo::ChatClass Chat -superclass ::xo::Chat
::xo::ChatClass create Chat -superclass ::xo::Chat
Chat instproc render {} {
my orderby time
set result ""
foreach child [my children] {
set msg [$child msg]
set user_id [$child user_id]
set timelong [clock format [$child time]]
set timeshort [clock format [$child time] -format {[%H:%M:%S]}]
if {$user_id > 0} {
acs_user::get -user_id $user_id -array user
set name [expr {$user(screen_name) ne "" ? $user(screen_name) : $user(name)}]
set url "/shared/community-member?user%5fid=$user_id"
set creator "<a target='_parent' href='$url'>$name</a>"
} else {
set creator "Nobody"
}
append result "<TR><TD class='timestamp'>$timeshort</TD>\
<TD class='user'>[my encode $creator]</TD>\
<TD class='message'>[my encode $msg]</TD></TR>\n"
}
return $result
}
# Chat instproc render {} {
# my orderby time
# set result ""
# foreach child [my children] {
# set msg [$child msg]
# set user_id [$child user_id]
# set timelong [clock format [$child time]]
# set timeshort [clock format [$child time] -format {[%H:%M:%S]}]
# if {$user_id > 0} {
# acs_user::get -user_id $user_id -array user
# set name [expr {$user(screen_name) ne "" ? $user(screen_name) : $user(name)}]
# set url "/shared/community-member?user%5fid=$user_id"
# set creator "<a target='_parent' href='$url'>$name</a>"
# } else {
# set creator "Nobody"
# }
# append result "<TR><TD class='timestamp'>$timeshort</TD>\
# <TD class='user'>[my encode $creator]</TD>\
# <TD class='message'>[my encode $msg]</TD></TR>\n"
# }
# return $result
# }
Chat proc initialize_nsvs {} {;} ;# noop
Chat proc login {-chat_id -package_id -mode} {
my log "--"
Chat proc login {-chat_id -package_id {-mode ""} {-path ""}} {
#my log "--chat"
if {![ns_conn isconnected]} return
auth::require_login
if {![info exists package_id]} {set package_id [ad_conn package_id] }
if {![info exists chat_id]} {set chat_id $package_id }
set context id=$chat_id&s=[ad_conn session_id].[clock seconds]
set path [lindex [site_node::get_url_from_object_id -object_id $package_id] 0]
set session_id [ad_conn session_id].[clock seconds]
set context id=$chat_id&s=$session_id
#my log "chat_id=$chat_id, path=$path"
if {$path eq ""} {
set path [lindex [site_node::get_url_from_object_id -object_id $package_id] 0]
} elseif {[string range $path end end] ne "/"} {
append path /
}
if {![info exists mode]} {
if {$mode eq ""} {
#
# The parameter "mode" was not specified, we try to guess the
# "best" mode known to work for the currently used browser.
#
# The most conservative mode is
# - "polling" (which requires for every connected client polling
# requests), followed by
# - "scripted-streaming" (which opens and "infinitely long" HTML
# files with embedded script tags; very portable, but this
# causes the loading indicator to spin), followed by
# - "streaming" (true streaming, but this requires
# an HTTP stack supporting partial reads).
#
# NOTICE 1: The guessing is based on current versions of the
# browsers. Older versions of the browser might behave
# differently.
#
# NOTICE 2: "streaming" (and to a lesser extend
# "scripted-streaming" - which used chunked encoding) might be
# influenced by the buffering behavior of a reverse proxy, which
# might have to be configured appropriately.
#
# To be independet of the guessing mode, instantiate the chat
# object with "mode" specified.
#
set mode polling
if {[info command ::thread::mutex] ne "" &&
#
# Check, whether we have the tcllibthread and a sufficiently new
# aolserver/naviserver supporting bgdelivery transfers.
#
if {[info commands ::thread::mutex] ne "" &&
![catch {ns_conn contentsentlength}]} {
# we seem to have libthread installed, and the patch for obtaining the tcl-stream
# from a connection thread, so we can use the background delivery thread;
#
# scripted streaming should work everywhere
#
set mode scripted-streaming
if {[regexp (firefox) [string tolower [ns_set get [ns_conn headers] User-Agent]]]} {
# for firefox, we could use the nice mode without the spinning load indicator
# currently, streaming mode seems broken with current firefox...
#set mode streaming
if {![regexp msie|opera [string tolower [ns_set get [ns_conn headers] User-Agent]]]} {
# Explorer doesn't expose partial response until request state != 4, while Opera fires
# onreadystateevent only once. For this reason, for every broser except them, we could
# use the nice mode without the spinning load indicator.
#
set mode streaming
}
}
my log "--chat mode $mode"
}
# small javascript library to obtain a portable ajax request object
::xo::Page requireJS "/resources/xowiki/get-http-object.js"
switch $mode {
polling {
::xo::Page requireJS "/resources/xowiki/get-http-object.js"
set jspath packages/xowiki/www/ajax/chat.js
set login_url ${path}ajax/chat?m=login&$context
set get_update "chatSendCmd(\"$path/ajax/chat?m=get_new&$context\",chatReceiver)"
set get_all "chatSendCmd(\"$path/ajax/chat?m=get_all&$context\",chatReceiver)"
set login_url ${path}ajax/chat?m=login&$context
set get_update "chatSendCmd(\"$path/ajax/chat?m=get_new&$context\",chatReceiver)"
set get_all "chatSendCmd(\"$path/ajax/chat?m=get_all&$context\",chatReceiver)"
}
streaming {
set jspath packages/xowiki/www/ajax/streaming-chat.js
......@@ -75,6 +115,9 @@ namespace eval ::xowiki {
set jspath packages/xowiki/www/ajax/scripted-streaming-chat.js
set subscribe_url ${path}ajax/chat?m=subscribe&$context
}
default {
error "mode $mode unknown, valid are: polling, streaming and scripted-streaming"
}
}
set send_url ${path}ajax/chat?m=add_msg&$context&msg=
......@@ -85,6 +128,18 @@ namespace eval ::xowiki {
my log "--CHAT mode=$mode"
set style {
margin:1.5em 0 1.5em 0;
padding:1em 0 1em 1em;
background-color: #f9f9f9;
border:1px solid #dedede;
height:150px;
font-size:.95em;
line-height:.7em;
color:#333;
overflow:auto;
}
switch $mode {
polling {return "\
<script type='text/javascript' language='javascript'>
......@@ -92,7 +147,7 @@ namespace eval ::xowiki {
setInterval('$get_update',5000)
</script>
<form action='#' onsubmit='chatSendMsg(\"$send_url\",chatReceiver); return false;'>
<iframe name='ichat' id='ichat' frameborder='0' src='$login_url'
<iframe name='ichat' id='ichat' frameborder='0' src='[ns_quotehtml $login_url]'
style='width:90%;' height='150'>
</iframe>
<input type='text' size='40' name='msg' id='chatMsg'>
......@@ -100,44 +155,33 @@ namespace eval ::xowiki {
}
streaming {return "\
streaming {
::xowiki::Chat create c1 -destroy_on_cleanup -chat_id $chat_id -session_id $session_id -mode $mode
set r [ns_urldecode [c1 get_all]]
regsub -all {<[/]?div[^>]*>} $r "" r
return "\
<script type='text/javascript' language='javascript'>$js
var send_url = \"$send_url\";
chatSubscribe(\"$subscribe_url\");
</script>
<div id='messages' style='margin:1.5em 0 1.5em 0;
padding:1em 0 1em 1em;
background-color: #f9f9f9;
border:1px solid #dedede;
height: 70px;
height:150px;
font-size:.95em;
line-height:.7em;
color:#333;
overflow:auto;
'></div>
<div id='messages' style='$style'>$r</div>
<form action='#' onsubmit='chatSendMsg(); return false;'>
<input type='text' size='40' name='msg' id='chatMsg'>"
<input type='text' size='40' name='msg' id='chatMsg'>
</form>"
}
scripted-streaming {return "\
scripted-streaming {
::xowiki::Chat create c1 -destroy_on_cleanup -chat_id $chat_id -session_id $session_id -mode $mode
set r [ns_urldecode [c1 get_all]]
regsub -all {<[/]?div[^>]*>} $r "" r
return "\
<script type='text/javascript' language='javascript'>
$js
var send_url = \"$send_url\";
</script>
<div id='messages' style='margin:1.5em 0 1.5em 0;
padding:1em 0 1em 1em;
background-color: #f9f9f9;
border:1px solid #dedede;
height: 70px;
height:150px;
font-size:.95em;
line-height:.7em;
color:#333;
overflow:auto;
'></div>
<iframe name='ichat' id='ichat' frameborder='0' src='$subscribe_url'
<div id='messages' style='$style'></style>
<iframe name='ichat' id='ichat' frameborder='0' src='[ns_quotehtml $subscribe_url]'
style='width:0px; height:0px; border: 0px'>
</iframe>
<form action='#' onsubmit='chatSendMsg(); return false;'>
......@@ -148,3 +192,9 @@ overflow:auto;
}
}
#
# Local variables:
# mode: tcl
# tcl-indent-level: 2
# indent-tabs-mode: nil
# End:
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -3,148 +3,155 @@
# 'http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/tcllib/tcllib/license.terms'
# for terms and conditions of redistribution.
namespace eval list { namespace export longestCommonSubsequence }
# Do a compatibility version of [lset] for pre-8.4 versions of Tcl.
# This version does not do multi-arg [lset]!
if { [package vcompare [package provide Tcl] 8.4] < 0 } {
proc list::K { x y } { set x }
proc list::lset { var index arg } {
upvar 1 $var list
set list [lreplace [K $list [set list {}]] $index $index $arg]
}
}
# list::longestCommonSubsequence --
#
# Computes the longest common subsequence of two lists.
#
# Parameters:
# sequence1, sequence2 -- Two lists to compare.
#
# Results:
# Returns a list of two lists of equal length.
# The first sublist is of indices into sequence1, and the
# second sublist is of indices into sequence2. Each corresponding
# pair of indices corresponds to equal elements in the sequences;
# the sequence returned is the longest possible.
#
# Side effects:
# None.
proc list::longestCommonSubsequence { sequence1 sequence2 } {
set seta [list]
set setb [list]
# Construct a set of equivalence classes of lines in file 2
set index 0
foreach string $sequence2 {
lappend eqv($string) $index
incr index
}
# K holds descriptions of the common subsequences.
# Initially, there is one common subsequence of length 0,
# with a fence saying that it includes line -1 of both files.
# The maximum subsequence length is 0; position 0 of
# K holds a fence carrying the line following the end
# of both files.
lappend K [list -1 -1 {}]
lappend K [list [llength $sequence1] [llength $sequence2] {}]
set k 0
# Walk through the first file, letting i be the index of the line and
# string be the line itself.
set i 0
foreach string $sequence1 {
# Consider each possible corresponding index j in the second file.
if { [info exists eqv($string)] } {
# c is the candidate match most recently found, and r is the
# length of the corresponding subsequence.
set c [lindex $K 0]
set r 0
foreach j $eqv($string) {
# Perform a binary search to find a candidate common
# subsequence to which may be appended this match.
set max $k
set min $r
set s [expr { $k + 1 }]
while { $max >= $min } {
set mid [expr { ( $max + $min ) / 2 }]
set bmid [lindex [lindex $K $mid] 1]
if { $j == $bmid } {
break
} elseif { $j < $bmid } {
set max [expr {$mid - 1}]
} else {
set s $mid
set min [expr { $mid + 1 }]
}
}
# Go to the next match point if there is no suitable
# candidate.
if { $j == [lindex [lindex $K $mid] 1] || $s > $k} {
continue
}
# s is the sequence length of the longest sequence
# to which this match point may be appended. Make
# a new candidate match and store the old one in K
# Set r to the length of the new candidate match.
set newc [list $i $j [lindex $K $s]]
lset K $r $c
set c $newc
set r [expr {$s + 1}]
# If we've extended the length of the longest match,
# we're done; move the fence.
if { $s >= $k } {
lappend K [lindex $K end]
incr k
break
}
}
namespace eval list { namespace export longestCommonSubsequence }
# Do a compatibility version of [lset] for pre-8.4 versions of Tcl.
# This version does not do multi-arg [lset]!
if { [package vcompare [package provide Tcl] 8.4] < 0 } {
proc list::K { x y } { set x }
proc list::lset { var index arg } {
upvar 1 $var list
set list [lreplace [K $list [set list {}]] $index $index $arg]
}
}
# list::longestCommonSubsequence --
#
# Computes the longest common subsequence of two lists.
#
# Parameters:
# sequence1, sequence2 -- Two lists to compare.
#
# Results:
# Returns a list of two lists of equal length.
# The first sublist is of indices into sequence1, and the
# second sublist is of indices into sequence2. Each corresponding
# pair of indices corresponds to equal elements in the sequences;
# the sequence returned is the longest possible.
#
# Side effects:
# None.
proc list::longestCommonSubsequence { sequence1 sequence2 } {
set seta [list]
set setb [list]
# Construct a set of equivalence classes of lines in file 2
set index 0
foreach string $sequence2 {
lappend eqv($string) $index
incr index
}
# K holds descriptions of the common subsequences.
# Initially, there is one common subsequence of length 0,
# with a fence saying that it includes line -1 of both files.
# The maximum subsequence length is 0; position 0 of
# K holds a fence carrying the line following the end
# of both files.
lappend K [list -1 -1 {}]
lappend K [list [llength $sequence1] [llength $sequence2] {}]
set k 0
# Walk through the first file, letting i be the index of the line and
# string be the line itself.
set i 0
foreach string $sequence1 {
# Consider each possible corresponding index j in the second file.
if { [info exists eqv($string)] } {
# c is the candidate match most recently found, and r is the
# length of the corresponding subsequence.
set c [lindex $K 0]
set r 0
foreach j $eqv($string) {
# Perform a binary search to find a candidate common
# subsequence to which may be appended this match.
set max $k
set min $r
set s [expr { $k + 1 }]
while { $max >= $min } {
set mid [expr { ( $max + $min ) / 2 }]
set bmid [lindex $K $mid 1]
if { $j == $bmid } {
break
} elseif { $j < $bmid } {
set max [expr {$mid - 1}]
} else {
set s $mid
set min [expr { $mid + 1 }]
}
}
# Go to the next match point if there is no suitable
# candidate.
if { $j == [lindex $K $mid 1] || $s > $k} {
continue
}
# s is the sequence length of the longest sequence
# to which this match point may be appended. Make
# a new candidate match and store the old one in K
# Set r to the length of the new candidate match.
set newc [list $i $j [lindex $K $s]]
lset K $r $c
set c $newc
set r [expr {$s + 1}]
# If we've extended the length of the longest match,
# we're done; move the fence.
if { $s >= $k } {
lappend K [lindex $K end]
incr k
break
}
}
# Put the last candidate into the array
lset K $r $c
# Put the last candidate into the array
}
lset K $r $c
incr i
}
}
incr i
set q [lindex $K $k]
}
for { set i 0 } { $i < $k } {incr i } {
lappend seta {}
lappend setb {}
}
while { [lindex $q 0] >= 0 } {
incr k -1
lset seta $k [lindex $q 0]
lset setb $k [lindex $q 1]
set q [lindex $q 2]
}
set q [lindex $K $k]
return [list $seta $setb]
for { set i 0 } { $i < $k } {incr i } {
lappend seta {}
lappend setb {}
}
while { [lindex $q 0] >= 0 } {
incr k -1
lset seta $k [lindex $q 0]
lset setb $k [lindex $q 1]
set q [lindex $q 2]
}
}
return [list $seta $setb]
}
#
# Local variables:
# mode: tcl
# tcl-indent-level: 2
# indent-tabs-mode: nil
# End:
This diff is collapsed.
This diff is collapsed.
......@@ -62,11 +62,11 @@ namespace eval ::xowiki {
namespace eval ::xowiki::notification {
ad_proc -private get_url {id} {
if {[db_0or1row is_package_id "select 1 from apm_packages where package_id = $id"]} {
if {[::xo::dc 0or1row is_package_id {select 1 from apm_packages where package_id = :id}]} {
#
# the specified id is an package_id
#
set node_id [db_string get_node_id "select node_id from site_nodes where object_id = $id"]
set node_id [::xo::dc get_value get_node_id {select node_id from site_nodes where object_id = :id}]
set url [site_node::get_url -node_id $node_id]
return $url
}
......@@ -115,12 +115,14 @@ namespace eval ::xowiki::notification {
#ns_log notice "--n xowiki::notification::do_notifications called for item_id [$page set revision_id] publish_status=[$page set publish_status] XXX"
$page instvar package_id
set link [$page pretty_link -absolute 1]
append html "<p>For more details, see <a href='$link'>[$page set title]</a></p>"
append html "<p>For more details, see <a href='[ns_quotehtml $link]'>[ns_quotehtml [$page set title]]</a></p>"
append text "\nFor more details, see $link ...<hr>\n"
set state [expr {[$page set last_modified] eq [$page set creation_date] ? "New" : "Updated"}]
set instance_name [::$package_id instance_name]
set notif_user_id [expr {[$page exists modifying_user] ? [$page set modifying_user] : [$page set creation_user]}]
#ns_log notice "--n per directory [$page set title] ($state)"
notification::new \
-type_id [notification::type::get_type_id -short_name xowiki_notif] \
......@@ -129,7 +131,7 @@ namespace eval ::xowiki::notification {
-notif_subject "\[$instance_name\] [$page set title] ($state)" \
-notif_text $text \
-notif_html $html \
-notif_user [expr {[$page exists modifying_user] ? [$page set modifying_user] : [$page set creation_user]}]
-notif_user $notif_user_id
#ns_log notice "--n find categories [$page set title] ($state)"
......@@ -138,7 +140,7 @@ namespace eval ::xowiki::notification {
array unset cat
array unset label
foreach category_info [::xowiki::Category get_category_infos -tree_id $tree_id] {
foreach {category_id category_label deprecated_p level} $category_info {break}
lassign $category_info category_id category_label deprecated_p level
set cat($level) $category_id
set label($level) $category_label
if {$category_id == $cat_id} break
......@@ -152,7 +154,7 @@ namespace eval ::xowiki::notification {
-notif_subject "\[$instance_name\] $label($level): [$page set title] ($state)" \
-notif_text $text \
-notif_html $html \
-notif_user [$page set creation_user]
-notif_user $notif_user_id
}
}
}
......@@ -173,3 +175,9 @@ namespace eval ::xowiki::notification {
}
::xo::library source_dependent
#
# Local variables:
# mode: tcl
# tcl-indent-level: 2
# indent-tabs-mode: nil
# End:
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -40,14 +40,18 @@ clude, where it is
} {
# set the stack frame at which the template is being parsed so that
# other procedures can reference variables cleanly
variable parse_level
lappend parse_level [expr {[info level] - $uplevel}]
lappend ::template::parse_level [expr {[info level] - $uplevel}]
set __adp_out [template::adp_parse [template::util::url_to_file $src] $varlist]
# pop off parse level
template::util::lpop parse_level
template::util::lpop ::template::parse_level
return $__adp_out
}
}
\ No newline at end of file
}
# Local variables:
# mode: tcl
# tcl-indent-level: 2
# indent-tabs-mode: nil
# End:
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -2,4 +2,9 @@
# moved to xowiki-procs.tcl
#
#ns_cache create xowiki_cache -size 200000
#
\ No newline at end of file
#
# Local variables:
# mode: tcl
# tcl-indent-level: 2
# indent-tabs-mode: nil
# End:
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
<div id="controls">
<a href="view?revision=@revision@" onclick="window.open(this.href, 'Bildvorschau', 'width=500,height=500,scrollbars,resizable'); return false;"><img src="/resources/acs-subsite/Zoom24.gif" width="24" height="24" border="0" alt="In neuem Fenster öffnen (fullsize)" title="In neuem Fenster öffnen (fullsize)"/></a>
</div>
<div id="img" width="300px">
<img src="view?revision=@revision@"><br/>
</div>
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment