Index: openacs-4/packages/xowiki/xowiki.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/xowiki.info,v diff -u -r1.39 -r1.40 --- openacs-4/packages/xowiki/xowiki.info 3 Jan 2007 23:13:39 -0000 1.39 +++ openacs-4/packages/xowiki/xowiki.info 7 Jan 2007 21:52:37 -0000 1.40 @@ -50,7 +50,7 @@ - + Index: openacs-4/packages/xowiki/tcl/xowiki-portlet-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/Attic/xowiki-portlet-procs.tcl,v diff -u -r1.11 -r1.12 --- openacs-4/packages/xowiki/tcl/xowiki-portlet-procs.tcl 6 Jan 2007 03:27:07 -0000 1.11 +++ openacs-4/packages/xowiki/tcl/xowiki-portlet-procs.tcl 7 Jan 2007 21:52:38 -0000 1.12 @@ -45,7 +45,9 @@ $title\
[next]
" } +} +namespace eval ::xowiki::portlet { ############################################################################# # rss button # @@ -61,6 +63,25 @@ my get_parameters return "RSS" } + + ############################################################################# + # set-parameter "includelet" + # + Class create set-parameter \ + -superclass ::xowiki::Portlet \ + -parameter {{__decoration plain}} + + set-parameter instproc render {} { + my get_parameters + set pl [my set __caller_parameters] + if {[llength $pl] % 2 == 1} { + error "no even number of parameters '$pl'" + } + foreach {att value} $pl { + ::xo::cc set_parameter $att $value + } + return "NO" + } } namespace eval ::xowiki::portlet { @@ -520,6 +541,8 @@ $pages mixin add ::xo::OrderedComposite::IndexCompare $pages orderby page_order + my set jsobjs "" + foreach o [$pages children] { $o instvar page_order title page_id name title @@ -529,7 +552,9 @@ regsub {^[^.]+[.]} $displayed_page_order "" displayed_page_order } set label "$displayed_page_order $title" - set jsobj obj[set node($page_order) tmpNode[incr node_cnt]] + set id tmpNode[incr node_cnt] + set node($page_order) $id + set jsobj TocTree.objs\[$node_cnt\] set page_name($node_cnt) $name if {![regexp {^(.*)[.]([^.]+)} $page_order _ parent]} {set parent ""} @@ -557,20 +582,173 @@ } } set parent_node [expr {[info exists node($parent)] ? $node($parent) : "root"}] + set refvar [expr {[my set ajax] ? "ref" : "href"}] append js \ - "var $jsobj = {label: \"$label\", href:\"$href\"};" \ - "var $node($page_order) = new YAHOO.widget.TextNode($jsobj, $parent_node, $expand);\n" + "$jsobj = {label: \"$label\", id: \"$id\", $refvar: \"$href\", c: $node_cnt};" \ + "var $node($page_order) = new YAHOO.widget.TextNode($jsobj, $parent_node, $expand);\n" \ + "" + my lappend jsobjs $jsobj + } set navigation(count) $node_cnt my log "--COUNT=$node_cnt" return $js } + toc instproc ajax_tree {js_tree_cmds} { + return "
+ +
" + } + + toc instproc tree {js_tree_cmds} { + return "
+ +
" + } + + toc instproc render {} { my initialize -parameter { {-style ""} {-open_page ""} {-book_mode false} + {-ajax true} {-expand_all false} {-remove_levels 0} } @@ -583,26 +761,27 @@ ::xowiki::Page requireCSS "/resources/ajaxhelper/yui/treeview/assets/${s}tree.css" ::xowiki::Page requireJS "/resources/ajaxhelper/yui/yahoo/yahoo.js" ::xowiki::Page requireJS "/resources/ajaxhelper/yui/event/event.js" + if {$ajax} { + ::xowiki::Page requireJS "/resources/ajaxhelper/yui/dom/dom.js" ;# ANIM + ::xowiki::Page requireJS "/resources/ajaxhelper/yui/connection/connection.js" + ::xowiki::Page requireJS "/resources/ajaxhelper/yui/animation/animation.js" ;# ANIM + } ::xowiki::Page requireJS "/resources/ajaxhelper/yui/treeview/treeview.js" + #::xowiki::Page requireJS "http://www.json.org/json.js" ;# for toJSONString + my set book_mode $book_mode if {!$book_mode} { - my set book_mode [[my set __including_page] exists __is_book_page] + ###### my set book_mode [[my set __including_page] exists __is_book_page] + } elseif $ajax { + #my log "--warn: cannot use bookmode with ajax, resetting ajax" + set ajax 0 } + my set ajax $ajax + set js_tree_cmds [my get_nodes $open_page $package_id $expand_all $remove_levels] - return "
- -
" + return [expr {$ajax ? [my ajax_tree $js_tree_cmds ] : [my tree $js_tree_cmds ]}] } ############################################################################# Index: openacs-4/packages/xowiki/tcl/xowiki-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/xowiki-procs.tcl,v diff -u -r1.68 -r1.69 --- openacs-4/packages/xowiki/tcl/xowiki-procs.tcl 5 Jan 2007 21:22:20 -0000 1.68 +++ openacs-4/packages/xowiki/tcl/xowiki-procs.tcl 7 Jan 2007 21:52:38 -0000 1.69 @@ -209,10 +209,11 @@ } set outer_join [expr {[string first s. $attribute_selection] > -1 ? "left outer join syndication s on s.object_id = p.revision_id" : ""}] - - return "select $attribute_selection from xowiki_pagei p $outer_join, cr_items ci $extra_from_clause \ + set sql "select $attribute_selection from xowiki_pagei p $outer_join, cr_items ci $extra_from_clause \ where ci.parent_id = $folder_id and ci.item_id = p.item_id and \ ci.live_revision = p.page_id $where_clause $extra_where_clause $order_clause $pagination" + #my log "--SQL=$sql" + return $sql } @@ -643,7 +644,10 @@ if {[$page exists __decoration] && [$page set __decoration] ne "plain"} { $page mixin add ::xowiki::portlet::decoration=[$page set __decoration] } - return [$page render] + if {[catch {set html [$page render]} errorMsg]} { + set html "

Error in includelet '$page_name' $errorMsg

\n" + } + return $html } else { return "

Error: includelet '$page_name' unknown

\n" } Index: openacs-4/packages/xowiki/www/view-book.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/Attic/view-book.adp,v diff -u -r1.4 -r1.5 --- openacs-4/packages/xowiki/www/view-book.adp 5 Jan 2007 12:11:02 -0000 1.4 +++ openacs-4/packages/xowiki/www/view-book.adp 7 Jan 2007 21:52:38 -0000 1.5 @@ -28,21 +28,6 @@ - -
- Previous + + Previous - No Previous + + + No Previous + - +
@book_relpos@
@book_relpos@
- + - - Next + + Next - No Next + + + No Next +
- -@page_title;noquote@ - -@content;noquote@ +
+ +
Index: openacs-4/packages/xowiki/www/view-book.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/Attic/view-book.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/xowiki/www/view-book.tcl 6 Jan 2007 03:27:07 -0000 1.2 +++ openacs-4/packages/xowiki/www/view-book.tcl 7 Jan 2007 21:52:38 -0000 1.3 @@ -1,11 +1,12 @@ - +set title [[$package_id folder_id] title] #ns_log notice "--including_page= $__including_page, portlet=$portlet" set toc [$page include_portlet [list toc -open_page $name -decoration plain -remove_levels 1]] set i [$page set __last_includelet] my log "--last includelet = [$page set __last_includelet] [$page exists __is_book_page]" if {$i ne "" && ![$page exists __is_book_page]} { set p [$i position] set count [$i count] + if {$count == 0} {set count 1} set book_relpos [format %.2f%% [expr {100.0 * $p / $count}]] if {$p>1} {set book_prev_link [$package_id pretty_link [$i page_name [expr {$p - 1}]]]} if {$p<$count} {set book_next_link [$package_id pretty_link [$i page_name [expr {$p + 1}]]]} Index: openacs-4/packages/xowiki/www/view-page.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/Attic/view-page.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xowiki/www/view-page.adp 7 Jan 2007 21:52:38 -0000 1.1 @@ -0,0 +1,25 @@ + Index: openacs-4/packages/xowiki/www/view-page.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/Attic/view-page.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xowiki/www/view-page.tcl 7 Jan 2007 21:52:38 -0000 1.1 @@ -0,0 +1 @@ +set page_title "[$page set page_order] [$page set title]" \ No newline at end of file Index: openacs-4/packages/xowiki/www/prototypes/book.page =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/prototypes/book.page,v diff -u -r1.1 -r1.2 --- openacs-4/packages/xowiki/www/prototypes/book.page 29 Dec 2006 11:01:37 -0000 1.1 +++ openacs-4/packages/xowiki/www/prototypes/book.page 7 Jan 2007 21:52:38 -0000 1.2 @@ -1,5 +1,6 @@ ::xowiki::Page new -title "Book" -text { -

+{{set-parameter template_file view-default}} +

>>left-col25<< {{toc -decoration plain -book_mode 1 -expand_all 1}} >><< Index: openacs-4/packages/xowiki/www/resources/xowiki.css =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/resources/xowiki.css,v diff -u -r1.9 -r1.10 --- openacs-4/packages/xowiki/www/resources/xowiki.css 5 Jan 2007 21:22:21 -0000 1.9 +++ openacs-4/packages/xowiki/www/resources/xowiki.css 7 Jan 2007 21:52:38 -0000 1.10 @@ -56,6 +56,8 @@ #page-body .box {border: 1px solid #a1a5a9; padding: 0 5px 5px 5px; margin: 0 0 1.25em 0;} #page-body .errorMsg {color: red; font-weight: bold;} +#bookNavBar { top: 0px; height: 2px; background-color: #859db8; } + #content .box h2 {border-bottom: 1px solid #a1a5a9; padding: 5px; background: #f2f2f2; margin: 0 -5px 5px -5px; font-size: 12px;} #sidebar {float: right; top: 0px; width: 29%; font: 10px 'Lucida Grande', Geneva, Verdana, Arial, sans-serif;} #sidebar h2 {font-size: 12px; margin: 0;}