Forum .LRN Q&A: Re: dotlrn-xowiki and xowiki-portlet available

Collapse
Posted by Gustaf Neumann on
Dear Eduardo,

you are right, that the behaviour should be improved. Actually, one would need an additional option at portlet registration time to tell, whether the added page should be in a specified language (e.g. en), or that the language should be determined dynamically. There are as well some more shortcomings in the current dotlrn portal system (see below).

How to get connection locale specific text pages:

a) set in the package parameter of the community wiki use_conncetion_locale to 1 (you have that already)

b) In portal-element-add.tcl make the change below, which simply strips the language prefix from the page name used for resolving (the include or "resolve_request" do already the "right thing")

After this is done, you will see the pages.

However, the dotlrn portlets are defined in a way such that the title of the dortlrn portlet (pretty_name) is copied typically during registration time. Therefore, the title will be - without further work - always in one language, which is not nice, but might be sufficient for some use cases.

The easiest way out is to use in the xowiki page as title not a text page-title, but instead a language key (e.g. #xowiki.title_of_page1#). The approach with the message keys will work, but some new issues will pop up: (a) this is not nice from the xowiki point of view, (b) one would need a package for the community to provide a base for the message keys.

There is - up to a certain point - support in new-portal for computed titles, since the title of a portal element can be determined via service contract. However, the parameters are cached, and "GetPrettyName" does not get sufficient context to be useful.

I am not sure, whether it is worth to invest resources into this, since the xoportal approach presented in Guatemala does not suffer from these shortcomings.

For the time being, if you can live with single language title, or the message-key approach, the small change below should help you.

best regards
-gustaf neumann

--- admin/portal-element-add.tcl	27 Feb 2008 09:12:07 -0000	1.8
+++ admin/portal-element-add.tcl 31 Mar 2008 08:48:54 -0000
@@ -56,7 +56,8 @@
-package_key "xowiki-portlet"]
]
portal::set_element_param $element_id package_id $package_id
- portal::set_element_param $element_id page_name [$page_id name]
+ regexp {^..:(.*)$} $page_name _ page_name
+ portal::set_element_param $element_id page_name $page_name
}
ad_returnredirect $referer
}

Collapse
Posted by Eduardo Santos on
Hi Gustaf,

Thank you very much for your help again. I was thinking about to do almost the same thing you told but your approach is the best, as usual.

I've seen your presentation video about xoportal and I'm very excited about it. Let me know if I can help somehow.

Thank you for the help again.

Collapse
Posted by Eduardo Santos on
Hi Gustaf,

I've made some tests with your patch and it seems to be working fine. I only had to make some changes in the Portlet Admin Page to make sure you insert only one page, it doesn't matter the locale you are using. Otherwise you could have duplicate content. Check out this patch:

Index: xowiki-portlet/www/xowiki-admin-portlet.tcl
===================================================================
--- xowiki-portlet/www/xowiki-admin-portlet.tcl (revisão 364)
+++ xowiki-portlet/www/xowiki-admin-portlet.tcl (cópia de trabalho)
@@ -55,9 +55,16 @@
      -where_clause "P.page_id = cr.revision_id" \
      -orderby "ci.name" \
      ] {
+      # Clean the locale from the page name
+      regexp {^..:(.*)$} $name _ name2
        if {[regexp {^::[0-9]} $name]} continue
        if {[info exists used_page_id($name)]} continue
-      append options "<option value=\"$name\">$name</option>"
+      # Check if the page without locale is alredy inserted
+      if {[info exists used_page_id($name2)]} continue
+      # Make sure we insert only one locale for the same page
+      if {![string match "*$name2*" $options]} {
+          append options "<option value=\"$name\">$name</option>\n"
+      }
      }

  if {$options ne ""} {
}]