Problem with oxy_browser Form Control

Having trouble deploying Oxygen XML Web Author? Got a bug to report? Post it all here.
aujunior
Posts: 28
Joined: Thu Feb 16, 2023 11:00 pm

Problem with oxy_browser Form Control

Post by aujunior »

Good afternoon!

We are trying to use oxy_browser on Oxygen Web and have had some problems.

We create a .html inside the CSS folder that is calling oxy_browser. We called this html via CSS and the first error we noticed was the message "file protocol is disabled". Then we discovered that the "enable.file.protocol" option should be changed in the Administration tab.

After this configuration, instead of the HTML being plotted on the screen and its javascript activated, Oxygen Web started downloading the HTML. And besides the download, it kept the iframe blank.

We carried out a test via Oxygen Desktop and noticed that it is working correctly.

Are we perhaps doing something wrong or forgetting some configuration?

Our intention is that whenever you open the XML, the system brings information from our CMS and includes it within the tags without having to save the content in the file. And from the description of oxy_browser this would be possible.

Another important detail worth highlighting. If we switch from oxy_browser to oxy_htmlContent, Oxygen renders the content perfectly on the screen, even passing the same HTML as a parameter.

Code: Select all

/* CSS for all CIR Elements */

accessPointRef{

    content:
        oxy_browser(
          href, 'teste.html',
          width, 600px,
          height, 400px);


    -oxy-foldable: true;
}

CSS Code
zoneRef{
    content:
        oxy_browser(
          href, 'teste.html',
          width, 600px,
          height, 400px);

        -oxy-foldable: true;

        /*
        WORKING!!
    content:
            oxy_htmlContent(
                href, 'teste2.html',
                id, "main",
                width, 400px);

    -oxy-foldable: true;
    */
}
HTML File

Code: Select all

<!DOCTYPE html>
<html>
<head>

    <script type="text/javascript">
        function bridgeReady() {
            initialize();
        }

        function initialize() {
            var main = document.getElementById("main");
             var p = document.createElement('p');
             p.style.color = 'black';
             p.textContent = 'I was appended to the div';
             main.appendChild(p);

            console.log("test");
        }
    </script>
</head>
<body>
<div id="main">
    <h3>TESTING HTML CONTENT FROM CSS DIR</h3>
</div>
</body>
</html>
Desktop working fine
image.png
image.png (8.38 KiB) Viewed 710 times
Oxygen Web downloading HTML Page
image.png
image.png (67.24 KiB) Viewed 710 times
Test before protocol option
image.png
image.png (21.44 KiB) Viewed 710 times
Bogdan Dumitru
Site Admin
Posts: 142
Joined: Tue Mar 20, 2018 5:28 pm

Re: Problem with oxy_browser Form Control

Post by Bogdan Dumitru »

Hello,

Please see the note from the Oxygen XML Web Author Form Controls page: "This form control only loads external pages that do not pass through Web Author to load (i.e. files from a CMS).". This means that you can not use oxy_browser form control in Web Author to render HTML files from the server disk.

One solution would be to upload the HTML files to a different server and refer it in the oxy_browser. Another solution would be to define a REST endpoint in Web Author by using ro.sync.ecss.extensions.api.webapp.plugin.ServletPluginExtension extension point and return the HTML files from that endpoint, and the oxy_browser should point to something like this: "https://[your-domain].com/oxygen-xml-web-author/plugins-dispatcher/html-files/test.html".
Bogdan Dumitru
http://www.oxygenxml.com
aujunior
Posts: 28
Joined: Thu Feb 16, 2023 11:00 pm

Re: Problem with oxy_browser Form Control

Post by aujunior »

Thank you Bogdan Dumitru for the reply.

We decided to implement a StylesFilter to change the Form Control Dynamically.

We managed to implement it in a certain way, but we noticed that Oxygem Web is returning the error "Form Control cannot be Rendered" even though the correct result is plotted on the screen.
image.png
image.png (28.71 KiB) Viewed 512 times

When we send "TYPE_HTML_CONTENT" as a property type, Oxygem doesn't even open.
image.png
image.png (10.06 KiB) Viewed 512 times

Code: Select all

formControlArgs.put(InplaceEditorArgumentKeys.PROPERTY_HTML_EMBEDDED_CONTENT, htmlContent);
formControlArgs.put(InplaceEditorArgumentKeys.PROPERTY_TYPE, InplaceEditorArgumentKeys.TYPE_HTML_CONTENT);
StaticContent[] mixedContent = new StaticContent[] {new EditorContent(formControlArgs)};
styles.setProperty(Styles.KEY_MIXED_CONTENT, mixedContent);

We believe we are creating the HTML Content Form Control incorrectly via Java. Could you please show us how to create this Form Control correctly?

We have another doubt.

Is there any way to collect a parameter sent by the file opening URL via JAVA?

I read this tutorial https://www.oxygenxml.com/doc/versions/ ... Cparameter which shows some parameters to be included when opening a file. We would like to know if it is possible to send a customized parameter and retrieve it via JAVA. We need to send this information as a parameter for a REST call.

Could you tell us how to do this?

the ideia is to send "&project=PROJECT_NAME" in the URL and collect it via JAVA.

http://localhost:8008/oxygenxml-web-aut ... Module.xml &project=PROJECT_NAME

Thank you very much.
Bogdan Dumitru
Site Admin
Posts: 142
Joined: Tue Mar 20, 2018 5:28 pm

Re: Problem with oxy_browser Form Control

Post by Bogdan Dumitru »

Hi,
Changing the form control dynamically using a StylesFilter seems to be an overcomplicated solution.
Your initial problem was that the oxyBrowser form control doesn't allow loading files from the server disk, you encountered the "file protocol is disabled" message.
Why don't you simply serve those files via a ServletPluginExtension and refer them with http(s) protocol, somewhat like this: https://[your-domain].com/oxygen-xml-web-author/plugins-dispatcher/html-files/test.html? Please let us know if you have any questions/difficulties with this approach!
Bogdan Dumitru
http://www.oxygenxml.com
Post Reply