<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi Arturo,<div><br></div><div>I think getStartingCategory is called, when an editor starts to edit a content type which uses this widget.</div><div>Whereas setConfiguration is called sometimes while the system is initialised. Did you try to edit a content which uses the new widget?</div><div><br></div><div>Regards</div><div>c</div><div><br></div><div><br><div><div>Am 18.02.2013 um 12:28 schrieb Arturo Martín Lladó <<a href="mailto:arturo.martin.llado@gmail.com">arturo.martin.llado@gmail.com</a>>:</div><br class="Apple-interchange-newline"><blockquote type="cite">Hi again, Christoph:<br><br>Thank you for your help!<br><br>Now more things are happening, but the method getStartingCategory()<br>stills not being called.<br>I see that the methods that are being called using the widget are:<br><br>- Empty constructor.<br>- setConfiguration(java.lang.String configuration)<br>- getConfiguration()<br><br>I guess that I can do what I need inside setConfiguration. I'll keep<br>you posted :-)<br><br>Kind regards,<br>Arturo.<br><br>2013/2/18 Christoph Fröhlich <<a href="mailto:cfauto@folge2.de">cfauto@folge2.de</a>>:<br><blockquote type="cite">Hi Arturo,<br><br>sorry. I forgot that you have to overwrite<br><br>newInstance()<br><br>as well.<br><br>/**<br>* @see org.opencms.widgets.I_CmsWidget#newInstance()<br>*/<br>public I_CmsWidget newInstance() {<br><br>return new CmsLocaleCategoryWidget();<br>}<br><br>I hope this should do the trick.<br><br>Regards<br>Christoph<br><br>Am 18.02.2013 um 12:05 schrieb Arturo Martín Lladó<br><<a href="mailto:arturo.martin.llado@gmail.com">arturo.martin.llado@gmail.com</a>>:<br><br>Hi, Christoph:<br><br>It's really wierd. I have subclassed the widget like this:<br><br>[...]<br><br>public class CmsLocaleCategoryWidget extends CmsCategoryWidget {<br><br>private static Log LOG = CmsLog.getLog(CmsLocaleCategoryWidget.class);<br><br>public String getStartingCategory(CmsObject cms, java.lang.String<br>referencePath) {<br><br>LOG.error("== getStartingCategory, referencePath =>" + referencePath);<br>LOG.error("== getStartingCategory =>" +<br>super.getStartingCategory(cms, referencePath));<br>return super.getStartingCategory(cms, referencePath);<br><br>}<br><br>}<br><br>I also changed the XSD and opencms-vfs.xml in order to use the new widget.<br><br>The "new" widget is rendered ok, showing categories, but I see no<br>output in opencms.log. Even starting Tomcat on debug mode and adding a<br>breakpoint on the method does not trigger anything. No stop in the<br>method. It seems the method is not being called. I just don't get<br>it...<br><br>Thank you anyway for the help, Christoph. It is very welcome :-)<br><br>Cheers.<br><br>2013/2/16 Christoph Fröhlich <<a href="mailto:cfauto@folge2.de">cfauto@folge2.de</a>>:<br><br>HI Arturo,<br><br>maybe you can create a custom widget by subclassing<br> org.opencms.widgets.CmsCategoryWidget<br><br><br>In the method<br> getStartingCategory(CmsObject, String)<br><br>you have access to the current locale. I think this should enable you to<br>construct locale dependent starting categories.<br><br>Regards<br>Christoph<br><br>Am 15.02.2013 um 17:51 schrieb Rüdiger Kurz <<a href="mailto:r.kurz@alkacon.com">r.kurz@alkacon.com</a>>:<br><br>Hi,<br><br>OK, enable the content managers to create categories and localize the<br>display values is an argument. Anyway it would be better using the same<br>taxonomy.<br><br>If you have only two locales an 'ugly' workaround would be using two<br>properties: simple and straight, but technical not clean. So why don't<br>create an 'config' XSD that has multiple nested elements holding a category<br>together with its display name. This will make it easy to edit the localized<br>display values in a comfortable way for content managers and it would be<br>technically clean.<br><br>You could initialize this content with a Java Bean or what ever you need to<br>make access easier than writing scriplet code.<br><br>@Tobias, sorry but your mail comes in while I've already used the word<br>'ugly', anyway the property variant is simple and straight.<br><br>regards<br>Rüdiger<br><br><br>Am 15.02.2013 17:18, schrieb Arturo Martín Lladó:<br><br>Hi, Rüdiger.<br><br>I can say it's a very original solution :-)<br><br>Unfortunately, the categories should be administrated (and localized,<br>they are siblings with different Title property) by the final users,<br>and the edition of a Java properties file it's not a solution suitable<br>for them.<br><br>That's why we have a categories taxonomy like this:<br><br>=====<br>/_categories<br>   ca<br>       categories with locale "ca" configured as property by the parent<br>       [...]<br>   es<br>       categories with locale "es" configured as property by the parent<br>       [...]<br>=====<br><br>and that's why we'd like to offer to the final user a default category<br>pointed using de "configuration" attribute of the CategoryWidget.<br><br>Thank you anyway, Rüdiger. I really appreciate your help and any other<br>tip about this problem will be very welcome.<br><br>I guess that support for macros processing on the "configuration"<br>attribute of the layout widgets could be part of the wishlist of the<br>next release of OpenCms :-)<br><br>Again, thanks for your help and have a nice weekend.<br><br>Regards.<br><br>2013/2/15 Rüdiger Kurz <<a href="mailto:r.kurz@alkacon.com">r.kurz@alkacon.com</a>>:<br><br>Hi,<br><br>think you are right with your assumption. What you're trying to archive is<br>localization of categories. I might be wrong, but I think that localizing<br>categories,tags,facets,... does not make that much sense, since the 'tags'<br>should be the same for one content. (Categories are assigned to VFS<br>resources not to the real-localized content).<br><br>However, I would try to use the same taxonomy for all languages and then<br>localize its output at rendering time: The messages.properties could have<br>entries per category path, using dots instead slashes and then on JSP side<br>you will replace the slashes pf the category path with dotes and try then to<br>receive the localized value.<br><br>What do you think?<br><br>Am 15.02.2013 16:49, schrieb Arturo Martín Lladó:<br><br>Hi, Rüdiger.<br><br>I tried with this:<br><br>           <resourcebundles><br>                <xmlbundle name="element.workplace.xml"><br>                    <bundle locale="ca"><br>                        <resource<br>key="package.element.language">ca</resource><br>                    </bundle><br>                    <bundle locale="es"><br>                        <resource<br>key="package.element.language">es</resource><br>                    </bundle><br>                </xmlbundle><br>            </resourcebundles><br><br>The value stored in %(key.package.element.language) is displayed OK in<br>the default values of OpenCmsString fields, but it seems to be ignored<br>in the attribute "configuration" of a CategoryWidget.<br><br>Is this the expected behaviour? Maybe macros are not processed in<br><layout> elements?<br><br>Kind regards.<br><br>2013/2/15 Rüdiger Kurz <<a href="mailto:r.kurz@alkacon.com">r.kurz@alkacon.com</a>>:<br><br><br>Hi,<br><br>it's me again. You can access localized message bundles with:<br>%(key.your.label)<br><br>imagine a XSD:<br><br><resourcebundle name="your.package.workplace"/><br>[...]<br><layout element="Elem"<br>        widget="CategoryWidget"<br>        configuration="... %(key.language) ..." /><br><br>and a workplace_en.properties<br>containing:<br>language=en<br><br>and a workplace_de.properties<br>containing:<br>language=de<br><br>This should do the trick.<br><br>regards<br>Rüdiger<br><br><br>Am 15.02.2013 14:39, schrieb Rüdiger Kurz:<br><br>sorry not quiet sure if this works inside the XSD, but inside the<br>content editor you can use it.<br><br>Am 15.02.2013 14:37, schrieb Rüdiger Kurz:<br><br><br><br>yes, %(request.locale)<br><br>Am 15.02.2013 14:27, schrieb Arturo Martín Lladó:<br><br><br><br>Hi, list.<br><br>Is there available any locale macro for using it in XSD schemas?<br><br>I'd like to do something like this:<br><br>    <layouts><br>                 [...]<br>                 <layout element="Categoria" widget="CategoryWidget"<br><br><br>configuration="category=/_categories/__LOCALE_MACRO___/tipoDocumento/|onlyleafs=true"/><br><br><br>    </layouts><br><br>This is because our categories tree is organized this way:<br>/sites/default/_categories/__LOCALE__/...<br><br>Kind regards.<br><br><br><br><br><br>--<br>Rüdiger Kurz<br><br>-------------------<br><br>Alkacon Software GmbH - The OpenCms Experts<br>Rüdiger Kurz<br>An der Wachsfabrik 13<br>50996 Koeln, DE<br><br>Tel: +49 (0)2236 3826-16<br>Fax: +49 (0)2236 3826-20<br>Email: <a href="mailto:r.kurz@alkacon.com">r.kurz@alkacon.com</a><br><br><a href="http://www.alkacon.com">http://www.alkacon.com</a><br>http://www.opencms.org<br><br>Geschäftsführer: Alexander Kandzior, Amtsgericht Köln, HRB 54613<br>_______________________________________________<br>This mail is sent to you from the opencms-dev mailing list<br>To change your list options, or to unsubscribe from the list, please visit<br>http://lists.opencms.org/cgi-bin/mailman/listinfo/opencms-dev<br><br><br><br><br><br><br><br><br>_______________________________________________<br>This mail is sent to you from the opencms-dev mailing list<br>To change your list options, or to unsubscribe from the list, please visit<br>http://lists.opencms.org/cgi-bin/mailman/listinfo/opencms-dev<br><br><br><br><br><br><br><br>--<br>Arturo Martín Lladó<br><br><br>-------------------------------------------------<br>Christoph Fröhlich<br>Folge 3 GmbH<br>Neuer Pferdemarkt 1<br>20359 Hamburg<br><br>+49 +40  79 69 48 78<br>cf@folge3.de<br>http://www.folge3.de<br>-------------------------------------------------<br>Geschäftsführer: Christoph Fröhlich, Anja Künzel<br>Handelsregister: HRB 105806, Amtsgericht Hamburg<br><br><br><br><br><br><br><br></blockquote><br><br><br>-- <br>Arturo Martín Lladó<br></blockquote></div><br><div apple-content-edited="true">
<div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; border-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; ">-------------------------------------------------<br><div style="margin: 0px; ">Christoph Fröhlich</div>Folge 3 GmbH<br style="font-size: medium; ">Neuer Pferdemarkt 1<br style="font-size: medium; ">20359 Hamburg<br><br>+49 +40  79 69 48 78<br><a href="mailto:cf@folge3.de">cf@folge3.de</a><div style="margin: 0px; ">http://www.folge3.de</div><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; border-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; border-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; border-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="margin: 0px; ">-------------------------------------------------<br>Geschäftsführer: Christoph Fröhlich, Anja Künzel<br>Handelsregister: HRB 105806, Amtsgericht Hamburg </div></span></span><br class="Apple-interchange-newline"></span><br class="Apple-interchange-newline"></div></span><br class="Apple-interchange-newline"></span><br class="Apple-interchange-newline"></div><br class="Apple-interchange-newline"><br class="Apple-interchange-newline">
</div>
<br></div></body></html>