Hi,

I've generated a livetable.
See code below:

It works good!
It will generated a livetable and extend the table with collumns to the right 
based on a query.
Now the header of the column will be _gben, _eses,  _nlnl (etcetera for all 
country/language combinations in our wiki)
In the translation table (it is a multilanguage wiki) it will be translated to 
gben, eses, nlnl etcetera...

My question is how I can replace these headers with images of countryflags (if 
at all?)
Could I put a url in the translations file that will render intime?

What piece of code in the default lifetable will take care of the header

Gerritjan
{{include document="CdLSATEPublic.TranslationMatrixHeader"/}}
{{include document="CdLSCountries.Macros"/}}

{{velocity}}
#set($columns =[])
#set($discard = $columns.add("AlphabetSort"))
#set($discard = $columns.add("subject"))
#set($discard = $columns.add("topics"))
#set($discard = $columns.add("SACApproved"))
#set($discard = $columns.add("CountryCode"))
#set($columnsProperties = {
      "AlphabetSort" : { "type" : "text", "link" : "view", "size" : 1, 
"filterable" : true, "sortable": true },
      "subject" : { "type" : "text", "link" : "view", "size" : 10, "filterable" 
: true, "sortable": true },
      "topics" : { "type" : "text", "link" : "view", "size" : 10, "filterable" 
: true, "sortable": true },
      "question" : { "type" : "text", "link" : "view", "size" : 10, 
"filterable" : true, "sortable": true },
      "language" : { "type" : "hidden", "link" : "none", "size" : 1, 
"filterable" : false, "sortable": false },
      "CountryCode" : { "type" : "hidden", "link" : "view", "size" : 2, 
"filterable" : false, "sortable": false },
      "answer" : { "type" : "text", "link" : "view", "size" : 10, "filterable" 
: true, "sortable": true },
      "SACApproved" : { "type" : "text", "link" : "view", "size" : 4, 
"filterable" : true, "sortable": true },
      "_avatar" : { "type" : "none", "link" : "none", "html" : "true", 
"sortable":false },
      "_images" : { "type" : "none", "link" : "none", "html" : "true", 
"sortable":false },
      "_attachments" : { "type" : "none", "link" : "none", "html" : "true", 
"sortable":false },
      "_actions" : { "type" : "none", "link" : "none", "html" : "true", 
"sortable":false },
      "doc.name" : { "type" : "text", "link" : "view", "size" : "10", 
"filterable" : true, "sortable": true },
      "doc.space" : { "type" : "text", "link" : "view", "size" : "10", 
"filterable" : true, "sortable": true },
      "doc.fullName" : { "type" : "text", "link" : "view", "size" : "10", 
"filterable" : true, "sortable": true },
      "doc.author" : { "type" : "text", "link" : "view", "size" : "10", 
"filterable" : true, "sortable": true },
      "doc.date" : { "type" : "text", "link" : "view", "size" : "10", 
"filterable" : true, "sortable": true },
      "doc.creator" : { "type" : "text", "link" : "view", "size" : "10", 
"filterable" : true, "sortable": true },
      "doc.creationDate" : { "type" : "text", "link" : "view", "size" : "10", 
"filterable" : true, "sortable": true },
      "doc.title" : { "type" : "text", "link" : "view", "size" : "20", 
"filterable" : true, "sortable": true }
})
#set($options = { 
"className":"CdlsatdCode.CdLSATEPublicQAClass",   
"translationPrefix" : "cdlsatepublicqa.livetable.",  
"topFilters": '<input type="hidden" size="${columnsProperties.size}" 
name="language"value="en"/>',
"topFilters": '<input type="hidden" size="${columnsProperties.size}" 
name="CountryCode"value="us"/>',
"tagCloud" : false,  
"rowCount": 15,  
"maxPages" : 50, 
"selectedColumn" : "AlphabetSort", 
"defaultOrder" : "asc" 
})
##
## Find the associations
##
#set ($associationQuery = ", 
                BaseObject as associations 
        where associations.name=doc.fullName 
        and associations.className='CdLSAssociations.CdLSAssociationsClass' 
        and associations.name<>'CdLSAssociations.CdLSAssociationsTemplate'
        ")
#set($associationList = $xwiki.searchDocuments($associationQuery))
#foreach ($association in $associationList)
   #set ($associationDoc = $xwiki.getDocument($association))
   #set($discard = 
$associationDoc.use('CdLSAssociations.CdLSAssociationsClass'))
   #set($countriesSupported = $associationDoc.getValue('CountriesServed'))
   #set($languagesSupported = $associationDoc.getValue('languagesSupported'))
   #foreach ($country in $countriesSupported)
      #foreach($language in $languagesSupported)
         #set($CollumnCode = $country + $language)
         #if($CollumnCode != "usen")
           #set($extraCollumn = "_" + ${CollumnCode})
           #set($discard = $columns.add(${extraCollumn}))
           #set($discard = $columnsProperties.put(${extraCollumn} , { "type" : 
"text", "link" : "view", "size" : "5", "filterable" : false, "sortable": false 
}))
         #end
      #end
   #end
#end

#livetable("cdlsatepublicqa" $columns $columnsProperties $options)
{{/velocity}}
_______________________________________________
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users

Reply via email to