[opencms-dev] Fwd: OpenCms9: Categories and Detail-Names get mixed up
Christoph Fröhlich
cfauto at folge2.de
Fri Jul 4 21:32:34 CEST 2014
For the records:
we fixed this issues for us by extending CmsDefaultLinkSubstitutionHandler
This is our class:
-----------------------------------
package f3.cms.staticexport;
import org.opencms.file.CmsObject;
import org.opencms.staticexport.CmsDefaultLinkSubstitutionHandler;
public class F3LinkSubstitutionHandler extends CmsDefaultLinkSubstitutionHandler {
@Override
public String getRootPath(CmsObject cms, String targetUri, String basePath) {
String result = getSimpleRootPath(cms, targetUri, basePath);
if (result == null) {
result = super.getRootPath(cms, targetUri, basePath);
}
return result;
}
}
-----------------------------------
and configured it in opencms-importexport.xml
<linksubstitutionhandler>f3.cms.staticexport.F3LinkSubstitutionHandler</linksubstitutionhandler>
Regards
c
Anfang der weitergeleiteten Nachricht:
> Von: Christoph Fröhlich <cfauto at folge2.de>
> Betreff: [opencms-dev] Fwd: OpenCms9: Categories and Detail-Names get mixed up
> Datum: 4. Juli 2014 13:46:02 MESZ
> An: The OpenCms mailing list <opencms-dev at opencms.org>
> Antwort an: The OpenCms mailing list <opencms-dev at opencms.org>
>
> For all who are interested in this bug I created an issue on github
>
> https://github.com/alkacon/opencms-core/issues/268
>
> I also added a jsp which allows you to reproduce the bug.
>
> Regards
> Christoph
>
>
> Anfang der weitergeleiteten Nachricht:
>
>> Von: Christoph Fröhlich <cfauto at folge2.de>
>> Betreff: Aw: [opencms-dev] OpenCms9: Categories and Detail-Names get mixed up
>> Datum: 3. Juli 2014 16:16:53 MESZ
>> An: The OpenCms mailing list <opencms-dev at opencms.org>
>> Antwort an: The OpenCms mailing list <opencms-dev at opencms.org>
>>
>> Hi Patric,
>>
>> thanks for your support. I'm answering inline
>>
>> Am 03.07.2014 um 10:24 schrieb Patric Dosch <patric.dosch at virtual-identity.com>:
>>
>>> Hey Christoph,
>>>
>>> now I have better understood the problem. Unfortunately, I do not the answer.
>>>
>>> <%= OpenCms.getLinkManager().getRootPath(cms, "/.categories/news/category/financial-press/") %>
>>> <%= OpenCms.getLinkManager().getRootPath(cms, "/.categories/section/") %>
>>>
>>> That works for me, even if I take a category that is called as a content type (section).
>>>
>> The problem only arises if there is a matching detail name. If you have a section with a detail name of "financial-press" then
>> the line
>> <%= OpenCms.getLinkManager().getRootPath(cms, "/.categories/news/category/financial-press/") %>
>>
>> would return
>> "/sites/default/.categories/section/financial-press/"
>>
>> Which means that you ask for the root path of particular resource and a totally different resource is returned
>>
>>
>>> A question, for which you need the rootpath with /sites/default/ for a category?
>>>
>> I don't call it explicitly but CmsCategoryWidget uses it implicitly. The calls are in org.opencms.xml.types.CmsXmlCategoryValue / org.opencms.xml.types.CmsXmlVfsFileValue.
>>
>> Regards
>> c
>>
>>
>>
>>
>>> Regards, Patric
>>>
>>>
>>> -----Ursprüngliche Nachricht-----
>>> Von: opencms-dev-bounces at opencms.org [mailto:opencms-dev-bounces at opencms.org] Im Auftrag von Christoph Fröhlich
>>> Gesendet: Mittwoch, 2. Juli 2014 19:50
>>> An: The OpenCms mailing list
>>> Betreff: Re: [opencms-dev] OpenCms9: Categories and Detail-Names get mixed up
>>>
>>> Hi Patric,
>>>
>>> thanks for the hint. I didn't know about the new basename, but we had set the old one in opencms-workplace.xml and this overwrites the setting in CmsCategoryService.
>>> At least as far as I understand the code. Nevertheless I changed the basename in workplace and in opencms-workplace.xml to "/.categories" but unfortunately with no effect.
>>>
>>> To narrow my problem down
>>> 1) We have an arbitrary xml content. Lets say "/.content/articles/foo" with the detail name "foo"
>>> 2) We have a category with a similar name. Lets say "/_categories/maincategory/foo"
>>> 3) When we call
>>> OpenCms.getLinkManager().getRootPath(cms, "/_categories/maincategory/foo"); it returns
>>> "/sites/default/.content/articles/foo"
>>> and not
>>> "/sites/default/_categories/maincategory/foo"
>>>
>>> If this is meaningful behavior, it is beyond my understanding :) If someone else did encounter this and knows about a workaround, I would be really grateful for some advice
>>>
>>>
>>> Thanks and regards
>>> Christoph
>>> Am 02.07.2014 um 18:18 schrieb Patric Dosch <patric.dosch at virtual-identity.com>:
>>>
>>>> Hey Christoph,
>>>>
>>>> I cannot quite understand your problem, but I've renamed the folder when updating from 9.0 to 9.1. The new name is ".categories".
>>>> public static final String REPOSITORY_BASE_FOLDER = "/.categories /."
>>>> in org.opencms.relations.CmsCategoryService
>>>>
>>>> I think this has solved my problems. But it was only a test and not a real project.
>>>>
>>>>
>>>> Oh maybe here
>>>> org.opencms.relations.CmsCategoryService.getRepositoryBaseFolderName(C
>>>> msObject) You can configure it in opencms-workplace.xml =>
>>>> categoryfolder.
>>>> See org.opencms.configuration.CmsWorkplaceConfiguration line 889.
>>>>
>>>>
>>>> I hope I could help you, but I have not tested :)
>>>>
>>>> Best Regards, Patric
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> -----Ursprüngliche Nachricht-----
>>>> Von: opencms-dev-bounces at opencms.org
>>>> [mailto:opencms-dev-bounces at opencms.org] Im Auftrag von Christoph
>>>> Fröhlich
>>>> Gesendet: Mittwoch, 2. Juli 2014 17:31
>>>> An: The OpenCms mailing list
>>>> Betreff: [opencms-dev] OpenCms9: Categories and Detail-Names get mixed
>>>> up
>>>>
>>>> Dear all,
>>>>
>>>> after migrating a major installation from OpenCms 8 to 9 there are some categories that can not be saved in a content type anymore.
>>>>
>>>> The underlying problem is that OpenCms9 takes a category with the name
>>>> "/_categories/Fach-Kategorien/Interkulturelle-Arbeit/"
>>>>
>>>> erroneously for an article with a similar name
>>>> "/sites/default/.content/articleprof/migration-interkulturelle-arbeit.html"
>>>>
>>>>
>>>> The problematic code is on line 295 of
>>>> ---------------------------------------------------
>>>> org.opencms.xml.types.CmsXmlCategoryValue.setStringValue(CmsObject,
>>>> String)
>>>> ---------------------------------------------------
>>>>
>>>>
>>>> It reads:
>>>> ---------------------------------------------------
>>>> path = OpenCms.getLinkManager().getRootPath(cms, path);
>>>> ---------------------------------------------------
>>>>
>>>> It translates "path" from
>>>> "/_categories/Fach-Kategorien/Interkulturelle-Arbeit/"
>>>> to
>>>> "/sites/default/.content/articleprof/migration-interkulturelle-arbeit.html"
>>>>
>>>>
>>>> The translation seems to be a new "feature" of LinkManager, who tries too avidly finding a detail url where none is desired.
>>>>
>>>> This seems to be a major problem to us, since we use categories heavily in this installation.
>>>>
>>>> Furthermore I'm a bit scared about this bug. LinkManager.getRootPath() seems to be a widely used method and this behavior is rather unpredictable.
>>>> I could replace LinkManager with a custom implementation but I do not overview in which situation the current behavior may make sense.
>>>>
>>>> Did others encounter this bug as well? Did you manage to workaround it?
>>>>
>>>>
>>>> Thanks and regards
>>>>
>>>> Christoph
>>>>
>>>>
>>>>
>>>> PS
>>>> The bug happens in the old StandardEditor as well as in the new Acacia-Editor.
>>>> And it is totally agnostic to whether we configure the field as
>>>> "OpenCmsCategory" or as "OpenCmsVfsFile" (CmsXmlVfsFileValue uses the
>>>> same call to LinkManager)
>>>>
>>>>
>>>> _______________________________________________
>>>> This mail is sent to you from the opencms-dev mailing list To change
>>>> your list options, or to unsubscribe from the list, please visit
>>>> http://lists.opencms.org/cgi-bin/mailman/listinfo/opencms-dev
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> This mail is sent to you from the opencms-dev mailing list To change
>>>> your list options, or to unsubscribe from the list, please visit
>>>> http://lists.opencms.org/cgi-bin/mailman/listinfo/opencms-dev
>>>>
>>>>
>>>>
>>>
>>> _______________________________________________
>>> This mail is sent to you from the opencms-dev mailing list To change your list options, or to unsubscribe from the list, please visit http://lists.opencms.org/cgi-bin/mailman/listinfo/opencms-dev
>>>
>>>
>>>
>>> _______________________________________________
>>> This mail is sent to you from the opencms-dev mailing list
>>> To change your list options, or to unsubscribe from the list, please visit
>>> http://lists.opencms.org/cgi-bin/mailman/listinfo/opencms-dev
>>>
>>>
>>>
>>
>> _______________________________________________
>> This mail is sent to you from the opencms-dev mailing list
>> To change your list options, or to unsubscribe from the list, please visit
>> http://lists.opencms.org/cgi-bin/mailman/listinfo/opencms-dev
>>
>>
>>
>
> _______________________________________________
> This mail is sent to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://lists.opencms.org/cgi-bin/mailman/listinfo/opencms-dev
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20140704/59915290/attachment.htm>
More information about the opencms-dev
mailing list