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

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 ""} {
}]