Index: openacs-4/packages/xowiki/tcl/category-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/category-procs.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/xowiki/tcl/category-procs.tcl 3 Mar 2006 18:58:16 -0000 1.3 +++ openacs-4/packages/xowiki/tcl/category-procs.tcl 18 Apr 2006 00:06:14 -0000 1.4 @@ -1,64 +1,112 @@ namespace eval ::xowiki { - Class CatTree -superclass ::xo::OrderedComposite -parameter order_items_by + # + # ::xowiki::CatTree (category tree) + # + Class CatTree -superclass ::xo::OrderedComposite -parameter {name ""} + CatTree instproc add_to_category { - -category_id - -itemobj - {-pos 0} + -category + -orderby + -itemobj + {-increasing:boolean true} {-open_item:boolean false} } { - set catobj [self]::$category_id - if {![my isobject $catobj]} { - ::xo::OrderedComposite create $catobj - if {[my exists order_items_by]} { - $catobj orderby [my set order_items_by] + set items ${category}::items + if {![my isobject $items]} { + ::xo::OrderedComposite create $items + if {[info exists orderby]} { + set direction [expr {$increasing?"increasing":"decreasing"}] + $items orderby -order $direction $orderby } - $catobj set pos $pos - $catobj set open_requests 0 - my add $catobj } + $items add $itemobj if {$open_item} { - $catobj incr open_requests + $category openTree $itemobj set open_item 1 } - $catobj add $itemobj } + CatTree instproc openTree {} {;} - CatTree instproc render {} { + CatTree instproc render {{-tree_style:boolean false}} { + if {$tree_style} { + #::xowiki::Page requireCSS "/resources/acs-templating/mktree.css" + ::xowiki::Page requireCSS "/resources/xowiki/cattree.css" + ::xowiki::Page requireJS "/resources/acs-templating/mktree.js" + + foreach c [my children] {append content [$c render] \n} + return "
" \ - $cat_content "\n" + foreach c [my children] {append cat_content [$c render] \n} + append content [my render_category -open [expr {[my set open_requests]>0}] $cat_content] } return $content } - CatTree instproc render-li {} { - ::xowiki::Page requireCSS "/resources/acs-templating/mktree.css" - ::xowiki::Page requireJS "/resources/acs-templating/mktree.js" - set content "
\ +
$cat_content\n" + } + + } 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.27 -r1.28 --- openacs-4/packages/xowiki/tcl/xowiki-procs.tcl 16 Apr 2006 19:32:04 -0000 1.27 +++ openacs-4/packages/xowiki/tcl/xowiki-procs.tcl 18 Apr 2006 00:06:14 -0000 1.28 @@ -16,7 +16,7 @@ ::Generic::Attribute new -attribute_name page_title -datatype text \ -pretty_name "Page Title" ::Generic::Attribute new -attribute_name creator -datatype text \ - -pretty_name "Creator" + -pretty_name "Creator" } \ -form ::xowiki::WikiForm @@ -30,16 +30,16 @@ ::Generic::CrClass create PageTemplate -superclass Page \ -pretty_name "XoWiki Page Template" -pretty_plural "XoWiki Page Templates" \ -table_name "xowiki_page_template" -id_column "page_template_id" \ - -form ::xowiki::WikiForm - + -form ::xowiki::WikiForm + ::Generic::CrClass create PageInstance -superclass Page \ -pretty_name "XoWiki Page Instance" -pretty_plural "XoWiki Page Instances" \ -table_name "xowiki_page_instance" -id_column "page_instance_id" \ -cr_attributes { ::Generic::Attribute new -attribute_name page_template -datatype integer \ -pretty_name "Page Template" ::Generic::Attribute new -attribute_name instance_attributes -datatype text \ - -pretty_name "Instance Attributes" + -pretty_name "Instance Attributes" } \ -form ::xowiki::PageInstanceForm \ -edit_form ::xowiki::PageInstanceEditForm @@ -64,7 +64,7 @@ if {![db_0or1row check-xowiki-references-table \ "select tablename from pg_tables where tablename = 'xowiki_references'"]} { db_dml create-xowiki-references-table "create table xowiki_references( - reference integer references cr_items(item_id) on delete cascade, + reference integer references cr_items(item_id) on delete cascade, link_type text, page integer references cr_items(item_id) on delete cascade)" db_dml create-xowiki-references-index \ @@ -73,7 +73,7 @@ if {![db_0or1row check-xowiki-last-visited-table \ "select tablename from pg_tables where tablename = 'xowiki_last_visited'"]} { db_dml create-xowiki-last-visited-table "create table xowiki_last_visited( - page_id integer references cr_items(item_id) on delete cascade, + page_id integer references cr_items(item_id) on delete cascade, package_id integer, user_id integer, count integer, @@ -94,12 +94,12 @@ {-from_version_name:required} {-to_version_name:required} } { - - Callback for upgrading + Callback for upgrading + @author Gustaf Neumann (neumann@wu-wien.ac.at) } { - ns_log notice "-- UPGRADE $from_version_name -> $to_version_name" + ns_log notice "-- UPGRADE $from_version_name -> $to_version_name" if {$to_version_name eq "0.13"} { ns_log notice "-- upgrading to 0.13" @@ -157,7 +157,7 @@ db_1row refresh "select content_type__refresh_view('::xowiki::PageInstance') from dual" db_1row refresh "select content_type__refresh_view('::xowiki::Object') from dual" } - + if {[apm_version_names_compare $from_version_name "0.22"] == -1 && [apm_version_names_compare $to_version_name "0.22"] > -1} { ns_log notice "-- upgrading to 0.22" @@ -167,7 +167,7 @@ set folder_id [db_string get_folder_id "select f.folder_id from cr_items c, cr_folders f \ where c.name = 'xowiki: $package_id' and c.item_id = f.folder_id"] if {$folder_id ne ""} { - db_dml update_package_id {update cr_folders set package_id = :package_id + db_dml update_package_id {update cr_folders set package_id = :package_id where folder_id = :folder_id} lappend folder_ids $folder_id lappend package_ids $package_id @@ -185,31 +185,31 @@ Class create WikiForm -superclass ::Generic::Form \ -parameter { - {field_list {item_id title page_title creator text description nls_language}} - {f.item_id + {field_list {item_id title page_title creator text description nls_language}} + {f.item_id {item_id:key}} - {f.title + {f.title {title:text {label #xowiki.name#} {html {size 80}} }} {f.page_title {page_title:text {label #xowiki.title#} {html {size 80}} }} {f.creator {creator:text,optional {label #xowiki.creator#} {html {size 80}} }} - {f.text - {text:richtext(richtext),nospell,optional - {label #xowiki.content#} + {f.text + {text:richtext(richtext),nospell,optional + {label #xowiki.content#} {options {editor xinha plugins { GetHtml CharacterMap ContextMenu FullScreen ListType TableOperations EditTag LangMarks Abbreviation OacsFs } height 350px}} {html {rows 15 cols 50 style {width: 100%}}}} } - {f.description + {f.description {description:text,optional {label #xowiki.description#}} } - {f.nls_language - {nls_language:text(select),optional {label Language} + {f.nls_language + {nls_language:text(select),optional {label Language} {options \[xowiki::locales\]}}} - {validate + {validate {{title {\[::xowiki::validate_title\]} {Item with this name exists already}}}} {with_categories true} {submit_link "view"} @@ -220,7 +220,7 @@ set __fields "" foreach __field [my field_list] { set __spec [my set f.$__field] - if {[string first "richtext" [lindex $__spec 0]] > -1 + if {[string first "richtext" [lindex $__spec 0]] > -1 && [my folderspec] ne ""} { # we have a richtext widget. append the folder spec to its options set __newspec [list [lindex $__spec 0]] @@ -284,14 +284,14 @@ my instvar data array set __tmp [ns_set array [ns_getform]] if {[info exists __tmp(text.format)]} { - $data set mime_type $__tmp(text.format) + $data set mime_type $__tmp(text.format) } } WikiForm instproc update_references {} { my instvar data if {![my istype PageInstanceForm]} { - ### danger: update references does an ad_eval, which breaks the [template::adp_level] - ### ad_form! don't do it in pageinstanceforms. + ### danger: update references does an ad_eval, which breaks the [template::adp_level] + ### ad_form! don't do it in pageinstanceforms. $data render_adp false $data render -update_references } @@ -332,9 +332,9 @@ Class create PlainWikiForm -superclass WikiForm \ -parameter { - {f.text - {text:text(textarea),nospell,optional - {label #xowiki.content#} + {f.text + {text:text(textarea),nospell,optional + {label #xowiki.content#} {html {cols 80 rows 10}}}} } @@ -344,9 +344,9 @@ Class create ObjectForm -superclass PlainWikiForm \ -parameter { - {f.text - {text:text(textarea),nospell,optional - {label #xowiki.content#} + {f.text + {text:text(textarea),nospell,optional + {label #xowiki.content#} {html {cols 80 rows 15}}}} {with_categories false} } @@ -382,7 +382,7 @@ -privilege "admin" next } - + ObjectForm instproc edit_data {} { my instvar data $data set_payload [$data set text] @@ -395,9 +395,9 @@ Class create PageInstanceForm -superclass WikiForm \ -parameter { - {field_list {item_id title page_template description nls_language}} - {f.page_template - {page_template:text(select) + {field_list {item_id title page_template description nls_language}} + {f.page_template + {page_template:text(select) {label "Page Template"} {options \[xowiki::page_templates\]}} } @@ -407,7 +407,7 @@ my instvar folder_id data set __vars {folder_id item_id page_template} set object_type [[$data info class] object_type] - my log "-- data=$data cl=[$data info class] ot=$object_type" + my log "-- data=$data cl=[$data info class] ot=$object_type" set item_id [$data set item_id] set page_template [ns_set get [ns_getform] page_template] my submit_link [export_vars -base edit {folder_id object_type item_id page_template}] @@ -430,7 +430,7 @@ Class create PageInstanceEditForm -superclass WikiForm \ -parameter { - {field_list {item_id title page_title creator page_template description nls_language}} + {field_list {item_id title page_title creator page_template description nls_language}} {f.title {title:text(inform)}} {f.page_template {page_template:text(hidden)}} {f.nls_language {nls_language:text(hidden)}} @@ -441,8 +441,8 @@ PageInstanceEditForm instproc new_data {} { set __vars {folder_id item_id page_template} set object_type [[[my set data] info class] object_type] - my log "-- cl=[[my set data] info class] ot=$object_type" - foreach __v $__vars {set $__v [ns_queryget $__v]} + my log "-- cl=[[my set data] info class] ot=$object_type" + foreach __v $__vars {set $__v [ns_queryget $__v]} set item_id [next] my submit_link [export_vars -base edit $__vars] my log "-- submit_link = [my submit_link]" @@ -475,7 +475,7 @@ } PageInstanceEditForm instproc init {} { - my instvar data page_instance_form_atts + my instvar data page_instance_form_atts set item_id [ns_queryget item_id] set page_template [ns_queryget page_template] if {$page_template eq ""} { @@ -503,8 +503,8 @@ } } - + namespace eval ::xowiki { Page proc requireCSS name {set ::need_css($name) 1} @@ -541,7 +541,7 @@ Page proc pretty_link {-lang -package_id title} { my instvar url_prefix folder_id - + if {![info exists package_id]} {set package_id [$folder_id set package_id]} if {![info exists url_prefix($package_id)]} { set url_prefix($package_id) [site_node::get_url_from_object_id -object_id $package_id] @@ -620,8 +620,8 @@ # page instances have references to page templates, add these first if {[$o istype ::xowiki::PageInstance]} continue set item [CrItem lookup -title [$o set title] -parent_id $folder_id] - if {$item != 0 && $replace} { ;# we delete the original - ::Generic::CrItem delete -item_id $item + if {$item != 0 && $replace} { ;# we delete the original + ::Generic::CrItem delete -item_id $item set item 0 incr replaced } @@ -636,7 +636,7 @@ db_transaction { set item [CrItem lookup -title [$o set title] -parent_id $folder_id] if {$item != 0 && $replace} { ;# we delete the original - ::Generic::CrItem delete -item_id $item + ::Generic::CrItem delete -item_id $item set item 0 incr replaced } @@ -661,17 +661,17 @@ # Page parameter { - page_id + page_id {revision_id 0} - object_type - {folder_id -100} - {lang_links ""} + object_type + {folder_id -100} + {lang_links ""} {lang de} {render_adp 1} } Page set recursion_count 0 Page array set RE { - include {{{(.+)}}[ \n\r]*} + include {{{(.+)}}[ \n\r]*} anchor {\\\[\\\[([^\]]+)\\\]\\\]} div { *(
[string map {> > < <} [my set text]]" } } - + Object instproc initialize_loaded_object {} { my set_payload [my set text] next Index: openacs-4/packages/xowiki/www/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/Attic/index.adp,v diff -u -r1.2 -r1.3 --- openacs-4/packages/xowiki/www/index.adp 30 Dec 2005 00:09:58 -0000 1.2 +++ openacs-4/packages/xowiki/www/index.adp 18 Apr 2006 00:06:14 -0000 1.3 @@ -2,8 +2,7 @@