Index: openacs-4/packages/xowiki/xowiki.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/xowiki.info,v diff -u -N -r1.32 -r1.33 --- openacs-4/packages/xowiki/xowiki.info 2 Dec 2006 19:08:23 -0000 1.32 +++ openacs-4/packages/xowiki/xowiki.info 19 Dec 2006 13:16:28 -0000 1.33 @@ -8,44 +8,46 @@ f xowiki - + Gustaf Neumann A more generic xotcl-based wikis example with object types and subtypes based on the content repository (with category support) - 2006-12-02 + 2006-12-19 XoWiki is a wiki implementation for OpenACS in xotcl. Instead of trying to implement the full set of wiki markup commands of systems like MediaWiki, XoWiki is based on a rich text editor and focuses more on integration with oacs (e.g categories, general comments, adp-includes). XoWiki combines aspects of wikis (ease of page-creation) with aspects of a content management system (revisions, re-usable items, multiple languages). Furthermore, XoWiki allows to define different types of links such -one could define book-structures (where a navigation structure could be built on the fly) or glossaries with differnt kind of word relationships (like synonyms, etc.). XoWiki supports pages in multiple languages and is localized (currently only for English and German). Currently, richtext and plaintext type entries are supported. Included support for adp-substitution in wiki pages and a file-selector. 0.13 supports page templates and uses the new generic form interface. Use of the oo layer for the content repository, reduced number of database interactions.0.18 supports text/enhanced, nice page names, import/export. Support for search (::xowiki::Page and ::xowiki::PlainPage); 0.20 support ::xowiki::Object, directory object, rss generation into syndication table, improved admin pages; 0.21: ajax-ased chat added, new attributes creator and page_title for all xowiki::Pages; 0.22 improved permission checking. 0.24 provides link-types, more includeletes (most-recently viewed, most frequently accessed pages). 0.26 provides Weblog support. 0.27: alignment with xotcl-core 0.38 (use cr_item.name instead of cr_revisions.title), change page_title to title (potential incompatibility) to rely more strictly to the CR data model (most files are effected). 0.28: tag and improved weblog support. 0.30: symbolic oo interface, nicer links, permission management. 0.31: per package search. 0.32: new class ::xowiki::File for [[file:readme.pdf]] and [[image:picture.jpg]] 0.33: direct inclusion of xowiki pages via {{en:mypage}}, simpler default pages (see xowiki/www/default-pages). 0.34: notifications; 0.36: prototypes, direct includes, context handling; 0.37: initial reqression testing (118 tests); 0.38: production_mode, virtual presence, google-sitemap +one could define book-structures (where a navigation structure could be built on the fly) or glossaries with differnt kind of word relationships (like synonyms, etc.). XoWiki supports pages in multiple languages and is localized (currently only for English and German). Currently, richtext and plaintext type entries are supported. Included support for adp-substitution in wiki pages and a file-selector. 0.13 supports page templates and uses the new generic form interface. Use of the oo layer for the content repository, reduced number of database interactions.0.18 supports text/enhanced, nice page names, import/export. Support for search (::xowiki::Page and ::xowiki::PlainPage); 0.20 support ::xowiki::Object, directory object, rss generation into syndication table, improved admin pages; 0.21: ajax-ased chat added, new attributes creator and page_title for all xowiki::Pages; 0.22 improved permission checking. 0.24 provides link-types, more includeletes (most-recently viewed, most frequently accessed pages). 0.26 provides Weblog support. 0.27: alignment with xotcl-core 0.38 (use cr_item.name instead of cr_revisions.title), change page_title to title (potential incompatibility) to rely more strictly to the CR data model (most files are effected). 0.28: tag and improved weblog support. 0.30: symbolic oo interface, nicer links, permission management. 0.31: per package search. 0.32: new class ::xowiki::File for [[file:readme.pdf]] and [[image:picture.jpg]] 0.33: direct inclusion of xowiki pages via {{en:mypage}}, simpler default pages (see xowiki/www/default-pages). 0.34: notifications; 0.36: prototypes, direct includes, context handling; 0.37: initial reqression testing (118 tests); 0.38: production_mode, virtual presence, google-sitemap. 0.39: version diff, provide image properties in xowiki-pages, specify how links can be generated BSD-Style 0 - + + - + - + + Index: openacs-4/packages/xowiki/tcl/package-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/package-procs.tcl,v diff -u -N -r1.25 -r1.26 --- openacs-4/packages/xowiki/tcl/package-procs.tcl 9 Dec 2006 22:02:21 -0000 1.25 +++ openacs-4/packages/xowiki/tcl/package-procs.tcl 19 Dec 2006 13:16:29 -0000 1.26 @@ -56,25 +56,42 @@ return [ns_urldecode $string] } + Package instproc default_language {} { + if {[ns_conn isconnected] && [my get_parameter use_connection_locale 0]} { + # we are connected, return the connection locale + set locale [lang::conn::locale] + } else { + # return either the package locale or the site-wide locale + set locale [lang::system::locale -package_id [my id]] + } + return [string range $locale 0 1] + } + Package instproc pretty_link { {-anchor ""} {-absolute:boolean false} {-lang ""} name } { #my log "--u name=<$name>" + set default_lang [my default_language] if {$lang eq ""} { if {![regexp {^(..):(.*)$} $name _ lang name]} { - regexp {^(file|image):(.*)$} $name _ lang name + if {![regexp {^(file|image):(.*)$} $name _ lang name]} { + set lang $default_lang + } } } - if {$lang eq "" && ![regexp {^(:|(file|image))} $name]} { - #my log "--u name=<$name> need lang" - set lang [string range [lang::conn::locale -package_id [my id]] 0 1] - } - set host [expr {$absolute ? [ad_url] : ""}] - if {$lang ne ""} { - return $host[my package_url]$lang/[ad_urlencode $name][expr {$anchor ne "" ? "\#${anchor}" : ""}] + if {$anchor ne ""} {set anchor \#$anchor} + #my log "--LINK $lang == $default_lang [expr {$lang ne $default_lang}] $name" + + set package_prefix [my get_parameter package_prefix [my package_url]] + if {$package_prefix eq "/" && [string length $lang]>2} { + # don't compact the the path for images etc. to avoid conflicts with e.g. //../image/* + set package_prefix [my package_url] + } + if {$lang ne $default_lang} { + return ${host}${package_prefix}${lang}/[ad_urlencode $name]$anchor } else { - return $host[my package_url][ad_urlencode $name][expr {$anchor ne "" ? "#${anchor}" : ""}] + return ${host}${package_prefix}[ad_urlencode $name]$anchor } } @@ -226,10 +243,8 @@ if {[info exists $key]} { set lang [set $key] } else { - # for now, we assume en is the default local for search - my log "--we need lang string and locale [ns_conn isconnected]" - set lang [expr {[ns_conn isconnected] ? - [string range [lang::conn::locale] 0 1] : "en"}] + # we can't determine lang from name, or query parameter, so take default + set lang [my default_language] } set local_name $path }