plone / plone.app.widgets

Integrating plone.widgets into plone
Other
7 stars 38 forks source link

Malfunction of link browser involving VHM #204

Open Rudd-O opened 3 years ago

Rudd-O commented 3 years ago

I have a setup (with multilingual language folders, capable of acting as navigation roots, but this seems unrelated) which causes the link browser in the TinyMCE editor to fail. The proxy URL mapping is set up so that a root language folder is used as the navigation root (VHM is used for this).

When the editor loads, the @@getVocabulary XHR fails with an error "not allowed".

Here is what I have noticed, based on the JSON object embedded in the page, depending on how I set up the proxy URL mapping.

MY SETUP (ROOT IS LANGUAGE FOLDER) DOES NOT WORK

/VirtualHostBase/https/rudd-o.com/Rudd-O.com/en/VirtualHostRoot/abc/edit

The values commented with a pound sign below appear to be correct. However, the other values appear to have the wrong site root / base path.

#'base_url': 'https://rudd-o.com/abc',
#'contextPath': '/Rudd-O.com/en/abc', 
{'vocabularyUrl': 'https://rudd-o.com/abc/@@getVocabulary?name=plone.app.vocabularies.Catalog',
'rootUrl': 'https://rudd-o.com/abc', 
'basePath': '/Rudd-O.com/en/abc', 
'rootPath': '/Rudd-O.com/en/abc'

It bears noting that if I tell my proxy to munge https://rudd-o.com/abc/@@getVocabulary? into https://rudd-o.com/@@getVocabulary?, XHR begins working correctly (search for container via UID works), but then text box searches in the link editor gives no useful search results.

ALTERED SETUP (ROOT IS SITE) WORKS

/VirtualHostBase/https/rudd-o.com/Rudd-O.com/VirtualHostRoot/en/abc/edit

Seems okay and works with the link searchbox.

#'base_url':'https://rudd-o.com/en/abc',
#'contextPath': '/Rudd-O.com/en/abc',
'vocabularyUrl': 'https://rudd-o.com/@@getVocabulary?name=plone.app.vocabularies.Catalog',
'rootUrl': 'https://rudd-o.com',
'basePath': '/Rudd-O.com/en/abc',
'rootPath': '/Rudd-O.com'

PASSTHROUGH WITHOUT SUBFOLDER ROOT WORKS

VirtualHostBase/https/rudd-o.com/VirtualHostRoot/_vh_stagingpython2/_vh_zope/Rudd-O.com/en/abc/edit

Seems okay and works with the link searchbox.

#'base_url': 'https://rudd-o.com/stagingpython2/zope/Rudd-O.com/en/abc',
#'contextPath': '/Rudd-O.com/en/abc',
{'vocabularyUrl': 'https://rudd-o.com/stagingpython2/zope/Rudd-O.com/@@getVocabulary?name=plone.app.vocabularies.Catalog',
'rootUrl': 'https://rudd-o.com/stagingpython2/zope/Rudd-O.com',
'basePath': '/Rudd-O.com/en/abc',
'rootPath': '/Rudd-O.com',

Ultimately the impact is that the editor's link edit search box simply does not work under the specific (first) scenario above -- search does not work, the breadcrumb bar shows only the house icon, clicking on the icon does nothing. The scenario, to recap, is using a root language folder as the navigation root by way of VHM.

Rudd-O commented 3 years ago

I traced the above JSON generation all the way to def get_relateditems_options() here: https://github.com/plone/plone.app.widgets/blob/master/plone/app/widgets/utils.py#L113 -- it looks like VHM use causes the navigation root to be wrong.

I am on version 3.0.3.