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.377 -r1.378 --- openacs-4/packages/xowiki/tcl/xowiki-procs.tcl 23 Nov 2009 13:51:26 -0000 1.377 +++ openacs-4/packages/xowiki/tcl/xowiki-procs.tcl 25 Nov 2009 12:28:21 -0000 1.378 @@ -1324,16 +1324,11 @@ #my msg el=$element-assume_folder=$assume_folder set (form) "" - if {[regexp {^(file|image|js|css|swf|folder):(.+)$} $element _ \ + if {[regexp {^(file|image|js|css|swf):(.+)$} $element _ \ (link_type) (stripped_name)]} { # (typed) file links - if {$(link_type) ne "folder"} { - set (prefix) file - set name file:$(stripped_name) - } else { - set (prefix) "" - set name $(stripped_name) - } + set (prefix) file + set name file:$(stripped_name) } elseif {[regexp {^(..):([^:]{3,}?):(..):(.+)$} $element _ form_lang form (prefix) (stripped_name)]} { array set "" [list link_type "link" form "$form_lang:$form"] set name $(prefix):$(stripped_name) @@ -1354,11 +1349,11 @@ array set "" [list link_type "link"] set name $(prefix):$(stripped_name) } elseif {[regexp {^(.+)\0$} $element _ (stripped_name)]} { - set name $(stripped_name) - array set "" [list link_type "folder" prefix ""] + array set "" [list link_type "link" form "$default_lang:folder" prefix $default_lang] + set name $default_lang:$(stripped_name) } elseif {$assume_folder} { - array set "" [list link_type "folder" prefix "" stripped_name $element] - set name $element + array set "" [list link_type "link" form "$default_lang:folder" prefix $default_lang stripped_name $element] + set name $default_lang:$element } else { array set "" [list link_type "link" prefix $default_lang stripped_name $element] set name $default_lang:$element @@ -1384,14 +1379,15 @@ set item_id [[my package_id] lookup -name $name -parent_id $parent_id] if {$item_id == 0} { #my log "element '$element', name=$name, item_id=$item_id $assume_folder && $(link_type)" - if {!$assume_folder && $(link_type) eq "link"} { - # try again, maybe element is folder, default-assumption was wrong - set item_id [[my package_id] lookup -name $(stripped_name) -parent_id $parent_id] - if {$item_id > 0} {array set "" [list link_type "folder" prefix ""]} - } elseif {$assume_folder && $(link_type) eq "folder"} { - # try again, maybe element is page, default-assumption was wrong - set item_id [[my package_id] lookup -name $default_lang:$(stripped_name) -parent_id $parent_id] - if {$item_id > 0} {array set "" [list link_type "link" prefix $default_lang]} + #if {!$assume_folder && $(link_type) eq "link"} { + # # try again, maybe element is folder, default-assumption was wrong + # set item_id [[my package_id] lookup -name $(stripped_name) -parent_id $parent_id] + # if {$item_id > 0} {array set "" [list link_type "folder" prefix ""]} + #} else + if {$assume_folder && $(link_type) eq "link" && $default_lang ne "en"} { + # try again, maybe element is folder in a different language + set item_id [[my package_id] lookup -name en:$(stripped_name) -parent_id $parent_id] + if {$item_id > 0} {array set "" [list link_type "link" prefix en]} } if {$item_id == 0 && [string match *.* $element]} { # The item is still unknown, try name-based lookup. Does the Index: openacs-4/packages/xowiki/www/admin/test.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/admin/Attic/test.tcl,v diff -u -r1.23 -r1.24 --- openacs-4/packages/xowiki/www/admin/test.tcl 16 Nov 2009 09:55:23 -0000 1.23 +++ openacs-4/packages/xowiki/www/admin/test.tcl 25 Nov 2009 12:28:22 -0000 1.24 @@ -638,13 +638,13 @@ # "require_folder" and "require_page" are here just for testing proc require_folder {name parent_id package_id} { - set item_id [::xo::db::CrClass lookup -name $name -parent_id $parent_id] - if {$item_id == 0} { - set f [::xo::db::CrFolder new -name $name -label $name -description "" \ - -parent_id $parent_id -package_id $package_id] - $f save_new - set item_id [$f folder_id] - } + set form_id [::xowiki::Weblog instantiate_forms -forms en:folder -package_id $package_id] + set f [$form_id create_form_page_instance \ + -name en:$name \ + -nls_language en_US \ + -default_variables [list title "Folder $name" parent_id $parent_id package_id $package_id]] + $f save_new + set item_id [$f item_id] test hint " $name => $item_id\n" return $item_id } @@ -699,8 +699,8 @@ set l "folder:foldername" set test [label "item_ref" "existing topfolder" $l] - array set "" [p item_ref -default_lang de -parent_id $folder_id $l] - ? {expr {$(link_type) eq "folder" && $(prefix) eq "" && $(stripped_name) eq "foldername" + array set "" [p item_ref -default_lang en -parent_id $folder_id $l] + ? {expr {$(link_type) eq "link" && $(prefix) eq "en" && $(stripped_name) eq "foldername" && $(parent_id) eq $folder_id && $(item_id) == $foldername_id}} 1 "\n$test:\n [array get {}]\n " set l "de:parentpage" @@ -711,14 +711,14 @@ set l "foldername/" set test [label "item_ref" "existing topfolder short" $l] - array set "" [p item_ref -default_lang de -parent_id $folder_id $l] - ? {expr {$(link_type) eq "folder" && $(prefix) eq "" && $(stripped_name) eq "foldername" + array set "" [p item_ref -default_lang en -parent_id $folder_id $l] + ? {expr {$(link_type) eq "link" && $(prefix) eq "en" && $(stripped_name) eq "foldername" && $(parent_id) eq $folder_id && $(item_id) == $foldername_id}} 1 "\n$test:\n [array get {}]\n " set l "foldername";# this works, since "foldername" exists set test [label "item_ref" "existing topfolder short + lookup" $l] - array set "" [p item_ref -default_lang de -parent_id $folder_id $l] - ? {expr {$(link_type) eq "folder" && $(prefix) eq "" && $(stripped_name) eq "foldername" + array set "" [p item_ref -default_lang en -parent_id $folder_id $l] + ? {expr {$(link_type) eq "link" && $(prefix) eq "en" && $(stripped_name) eq "foldername" && $(parent_id) eq $folder_id && $(item_id) == $foldername_id}} 1 "\n$test:\n [array get {}]\n " set l "page1";# last item per default page @@ -792,14 +792,14 @@ set l "./foldername/" set test [label "item_ref" "existing topfolder short, relative" $l] - array set "" [p item_ref -default_lang de -parent_id $folder_id $l] - ? {expr {$(link_type) eq "folder" && $(prefix) eq "" && $(stripped_name) eq "foldername" + array set "" [p item_ref -default_lang en -parent_id $folder_id $l] + ? {expr {$(link_type) eq "link" && $(prefix) eq "en" && $(stripped_name) eq "foldername" && $(parent_id) eq $folder_id && $(item_id) == $foldername_id}} 1 "\n$test:\n [array get {}]\n " set l "./foldername";# this works, since "foldername" exists set test [label "item_ref" "existing topfolder short + lookup, relative" $l] - array set "" [p item_ref -default_lang de -parent_id $folder_id $l] - ? {expr {$(link_type) eq "folder" && $(prefix) eq "" && $(stripped_name) eq "foldername" + array set "" [p item_ref -default_lang en -parent_id $folder_id $l] + ? {expr {$(link_type) eq "link" && $(prefix) eq "en" && $(stripped_name) eq "foldername" && $(parent_id) eq $folder_id && $(item_id) == $foldername_id}} 1 "\n$test:\n [array get {}]\n " set l "./page1";# last item per default page @@ -809,9 +809,9 @@ && $(parent_id) eq $folder_id && $(item_id) == 0}} 1 "\n$test:\n [array get {}]\n " set l "./parentpage/" - set test [label "item_ref" "non existing folder (with same name of existing page) in root_folder, relative" $l] + set test [label "item_ref" "not existing folder (with same name of existing page) in root_folder, relative" $l] array set "" [p item_ref -default_lang de -parent_id $folder_id $l] - ? {expr {$(link_type) eq "folder" && $(prefix) eq "" && $(stripped_name) eq "parentpage" + ? {expr {$(link_type) eq "link" && $(prefix) eq "de" && $(stripped_name) eq "parentpage" && $(parent_id) eq $folder_id && $(item_id) == 0}} 1 "\n$test:\n [array get {}]\n " set l "./" ;# stripped name will be the name of the root folder, omit from test @@ -831,8 +831,8 @@ set l "./foldername/." set test [label "item_ref" "existing topfolder short, relative" $l] - array set "" [p item_ref -default_lang de -parent_id $folder_id $l] - ? {expr {$(link_type) eq "folder" && $(prefix) eq "" && $(stripped_name) eq "foldername" + array set "" [p item_ref -default_lang en -parent_id $folder_id $l] + ? {expr {$(link_type) eq "link" && $(prefix) eq "en" && $(stripped_name) eq "foldername" && $(parent_id) eq $folder_id && $(item_id) == $foldername_id}} 1 "\n$test:\n [array get {}]\n " set l "./parentpage/." @@ -846,44 +846,44 @@ set l "folder:foldername/folder:f3" set test [label "item_ref" "existing subfolder" $l] - array set "" [p item_ref -default_lang de -parent_id $folder_id $l] - ? {expr {$(link_type) eq "folder" && $(prefix) eq "" && $(stripped_name) eq "f3" + array set "" [p item_ref -default_lang en -parent_id $folder_id $l] + ? {expr {$(link_type) eq "link" && $(prefix) eq "en" && $(stripped_name) eq "f3" && $(parent_id) eq $foldername_id && $(item_id) == $f3_id}} 1 "\n$test:\n [array get {}]\n " set l "folder:foldername/f3/" set test [label "item_ref" "existing subfolder short" $l] - array set "" [p item_ref -default_lang de -parent_id $folder_id $l] - ? {expr {$(link_type) eq "folder" && $(prefix) eq "" && $(stripped_name) eq "f3" + array set "" [p item_ref -default_lang en -parent_id $folder_id $l] + ? {expr {$(link_type) eq "link" && $(prefix) eq "en" && $(stripped_name) eq "f3" && $(parent_id) eq $foldername_id && $(item_id) == $f3_id}} 1 "\n$test:\n [array get {}]\n " set l "./folder:foldername/folder:f3/" set test [label "item_ref" "existing subfolder with prefix and trailing slash" $l] - array set "" [p item_ref -default_lang de -parent_id $folder_id $l] - ? {expr {$(link_type) eq "folder" && $(prefix) eq "" && $(stripped_name) eq "f3" + array set "" [p item_ref -default_lang en -parent_id $folder_id $l] + ? {expr {$(link_type) eq "link" && $(prefix) eq "en" && $(stripped_name) eq "f3" && $(parent_id) eq $foldername_id && $(item_id) == $f3_id}} 1 "\n$test:\n [array get {}]\n " set l "foldername/f3/" set test [label "item_ref" "existing subfolder short short" $l] - array set "" [p item_ref -default_lang de -parent_id $folder_id $l] - ? {expr {$(link_type) eq "folder" && $(prefix) eq "" && $(stripped_name) eq "f3" + array set "" [p item_ref -default_lang en -parent_id $folder_id $l] + ? {expr {$(link_type) eq "link" && $(prefix) eq "en" && $(stripped_name) eq "f3" && $(parent_id) eq $foldername_id && $(item_id) == $f3_id}} 1 "\n$test:\n [array get {}]\n " set l "folder:foldername1/folder:f3" set test [label "item_ref" "not existing folder with subfolder" $l] - array set "" [p item_ref -default_lang de -parent_id $folder_id $l] - ? {expr {$(link_type) eq "folder" && $(prefix) eq "" && $(stripped_name) eq "foldername1" + array set "" [p item_ref -default_lang en -parent_id $folder_id $l] + ? {expr {$(link_type) eq "link" && $(prefix) eq "en" && $(stripped_name) eq "foldername1" && $(parent_id) eq $folder_id && $(item_id) == 0}} 1 "\n$test:\n [array get {}]\n " set l "foldername1/folder/" set test [label "item_ref" "not existing folder with subfolder short short" $l] - array set "" [p item_ref -default_lang de -parent_id $folder_id $l] - ? {expr {$(link_type) eq "folder" && $(prefix) eq "" && $(stripped_name) eq "foldername1" + array set "" [p item_ref -default_lang en -parent_id $folder_id $l] + ? {expr {$(link_type) eq "link" && $(prefix) eq "en" && $(stripped_name) eq "foldername1" && $(parent_id) eq $folder_id && $(item_id) == 0}} 1 "\n$test:\n [array get {}]\n " set l "foldername/folder1/" set test [label "item_ref" "existing folder with not existing subfolder short short" $l] - array set "" [p item_ref -default_lang de -parent_id $folder_id $l] - ? {expr {$(link_type) eq "folder" && $(prefix) eq "" && $(stripped_name) eq "folder1" + array set "" [p item_ref -default_lang en -parent_id $folder_id $l] + ? {expr {$(link_type) eq "link" && $(prefix) eq "en" && $(stripped_name) eq "folder1" && $(parent_id) eq $foldername_id && $(item_id) == 0}} 1 "\n$test:\n [array get {}]\n " set l "foldername/page1" @@ -894,26 +894,26 @@ set l "folder:foldername/folder:f3/folder:subf3" set test [label "item_ref" "existing subsubfolder" $l] - array set "" [p item_ref -default_lang de -parent_id $folder_id $l] - ? {expr {$(link_type) eq "folder" && $(prefix) eq "" && $(stripped_name) eq "subf3" + array set "" [p item_ref -default_lang en -parent_id $folder_id $l] + ? {expr {$(link_type) eq "link" && $(prefix) eq "en" && $(stripped_name) eq "subf3" && $(parent_id) eq $f3_id && $(item_id) == $subf3_id}} 1 "\n$test:\n [array get {}]\n " set l "foldername/f3/subf3" set test [label "item_ref" "existing subsubfolder short" $l] - array set "" [p item_ref -default_lang de -parent_id $folder_id $l] - ? {expr {$(link_type) eq "folder" && $(prefix) eq "" && $(stripped_name) eq "subf3" + array set "" [p item_ref -default_lang en -parent_id $folder_id $l] + ? {expr {$(link_type) eq "link" && $(prefix) eq "en" && $(stripped_name) eq "subf3" && $(parent_id) eq $f3_id && $(item_id) == $subf3_id}} 1 "\n$test:\n [array get {}]\n " set l "foldername/f3/subf3/." set test [label "item_ref" "existing subsubfolder short" $l] - array set "" [p item_ref -default_lang de -parent_id $folder_id $l] - ? {expr {$(link_type) eq "folder" && $(prefix) eq "" && $(stripped_name) eq "subf3" + array set "" [p item_ref -default_lang en -parent_id $folder_id $l] + ? {expr {$(link_type) eq "link" && $(prefix) eq "en" && $(stripped_name) eq "subf3" && $(parent_id) eq $f3_id && $(item_id) == $subf3_id}} 1 "\n$test:\n [array get {}]\n " set l "folder:foldername/folder:f99" set test [label "item_ref" "not existing folder in folder" $l] - array set "" [p item_ref -default_lang de -parent_id $folder_id $l] - ? {expr {$(link_type) eq "folder" && $(prefix) eq "" && $(stripped_name) eq "f99" + array set "" [p item_ref -default_lang en -parent_id $folder_id $l] + ? {expr {$(link_type) eq "link" && $(prefix) eq "en" && $(stripped_name) eq "f99" && $(parent_id) eq $foldername_id && $(item_id) == 0}} 1 "\n$test:\n [array get {}]\n " set l "folder:foldername/de:testpage" @@ -945,26 +945,26 @@ set l "de:parentpage/folder:childfolder" set test [label "item_ref" "existing folder under page" $l] - array set "" [p item_ref -default_lang de -parent_id $folder_id $l] - ? {expr {$(link_type) eq "folder" && $(prefix) eq "" && $(stripped_name) eq "childfolder" + array set "" [p item_ref -default_lang en -parent_id $folder_id $l] + ? {expr {$(link_type) eq "link" && $(prefix) eq "en" && $(stripped_name) eq "childfolder" && $(parent_id) eq $parentpage_id && $(item_id) == $childfolder_id}} 1 "\n$test:\n [array get {}]\n " set l "de:parentpage/folder:childfolder/" set test [label "item_ref" "existing folder under page with prefix and trailing slash" $l] - array set "" [p item_ref -default_lang de -parent_id $folder_id $l] - ? {expr {$(link_type) eq "folder" && $(prefix) eq "" && $(stripped_name) eq "childfolder" + array set "" [p item_ref -default_lang en -parent_id $folder_id $l] + ? {expr {$(link_type) eq "link" && $(prefix) eq "en" && $(stripped_name) eq "childfolder" && $(parent_id) eq $parentpage_id && $(item_id) == $childfolder_id}} 1 "\n$test:\n [array get {}]\n " set l "de:parentpage/folder:childfolder1" set test [label "item_ref" "not existing folder under page" $l] array set "" [p item_ref -default_lang de -parent_id $folder_id $l] - ? {expr {$(link_type) eq "folder" && $(prefix) eq "" && $(stripped_name) eq "childfolder1" + ? {expr {$(link_type) eq "link" && $(prefix) eq "de" && $(stripped_name) eq "childfolder1" && $(parent_id) eq $parentpage_id && $(item_id) == 0}} 1 "\n$test:\n [array get {}]\n " set l "de:parentpage/folder:childfolder1/" set test [label "item_ref" "not existing folder under page with prefix and trailing slash" $l] array set "" [p item_ref -default_lang de -parent_id $folder_id $l] - ? {expr {$(link_type) eq "folder" && $(prefix) eq "" && $(stripped_name) eq "childfolder1" + ? {expr {$(link_type) eq "link" && $(prefix) eq "de" && $(stripped_name) eq "childfolder1" && $(parent_id) eq $parentpage_id && $(item_id) == 0}} 1 "\n$test:\n [array get {}]\n " set l "de:parentpage/de:childpage" @@ -997,25 +997,25 @@ set l "foldername/f3/subf3/.." set test [label "item_ref" "existing subsubfolder dot dot" $l] array set "" [p item_ref -default_lang de -parent_id $folder_id $l] - ? {expr {$(link_type) eq "folder" && $(prefix) eq "" && $(stripped_name) eq "f3" + ? {expr {$(link_type) eq "link" && $(prefix) eq "en" && $(stripped_name) eq "f3" && $(parent_id) eq $foldername_id && $(item_id) == $f3_id}} 1 "\n$test:\n [array get {}]\n " set l "foldername/f3/subf3/../" set test [label "item_ref" "existing subsubfolder dot dot slash" $l] array set "" [p item_ref -default_lang de -parent_id $folder_id $l] - ? {expr {$(link_type) eq "folder" && $(prefix) eq "" && $(stripped_name) eq "f3" + ? {expr {$(link_type) eq "link" && $(prefix) eq "en" && $(stripped_name) eq "f3" && $(parent_id) eq $foldername_id && $(item_id) == $f3_id}} 1 "\n$test:\n [array get {}]\n " set l "foldername/f3/subf3/../." set test [label "item_ref" "existing subsubfolder dot dot slash dot" $l] array set "" [p item_ref -default_lang de -parent_id $folder_id $l] - ? {expr {$(link_type) eq "folder" && $(prefix) eq "" && $(stripped_name) eq "f3" + ? {expr {$(link_type) eq "link" && $(prefix) eq "en" && $(stripped_name) eq "f3" && $(parent_id) eq $foldername_id && $(item_id) == $f3_id}} 1 "\n$test:\n [array get {}]\n " set l "foldername/f3/subf3/../.." set test [label "item_ref" "existing subsubfolder dot dot slash dot dot" $l] array set "" [p item_ref -default_lang de -parent_id $folder_id $l] - ? {expr {$(link_type) eq "folder" && $(prefix) eq "" && $(stripped_name) eq "foldername" + ? {expr {$(link_type) eq "link" && $(prefix) eq "en" && $(stripped_name) eq "foldername" && $(parent_id) eq $folder_id && $(item_id) == $foldername_id}} 1 "\n$test:\n [array get {}]\n " set l "parentpage/childpage/.." Index: openacs-4/packages/xowiki/www/prototypes/folder.page =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/prototypes/Attic/folder.page,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xowiki/www/prototypes/folder.page 25 Nov 2009 12:28:31 -0000 1.1 @@ -0,0 +1,24 @@ +# -*- tcl-*- +::xowiki::Form new \ + -set name en:folder \ + -title "Folder" \ + -set anon_instances t \ + -set text {