• If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Announcement

Collapse
No announcement yet.

Sending an HTML page to an Ext-js window

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Sending an HTML page to an Ext-js window

    Hi,
    What is the best way to send an HTML page to an Ext-js windows?
    I have a RPG created HTML document that I would like to send out to an app living in our Valence portal. The HTML page should be injected as an HTML element inside window from the response text of an ajax call.
    I looked at using vvOut_data() as a way to send. Is that procedure the right choice? How does the encoding work within the procedure if it is the right choice.
    Thank you.

  • #2
    Is your RPG program creating the HTML markup? If so, I would suggest just having your RPG program create an actual .html document on the IFS. Then your response would just simply send back the location of the new document.

    Then you could just do:
    Code:
    window.open(PATH_TO_DOCUMENT);

    Comment


    • #3
      Sean,
      I would have agreed to your recommendation if the content of the HTML is static. Think showing the content of a sales order as HTML page.

      Originally, I was thinking about sending the data only (not the HTML markup) as json to the Ext-js app and let the js code to create the HTML page using XTemplate but I am not up to the technical level to know how that can be achieved. So the next best thing for me is to use my familiar platform (RPG) to create the HTML markup.

      Besides the "dynamic" nature of the content, there is also the big headache on maintenance: when to clean up those created documents in IFS.

      So, the question remains, can vvOut_data or some other procedures output a large string (encoded perhaps) out to a js app?

      Thanks,

      Comment


      • #4
        Yes, you can use vvOut_data to send back the HTML.

        vvOut_data(yourData:HTML);

        HTML is an already defined constant that you want to pass as your second parameter.

        Comment


        • #5
          Hi Sean,
          The vvOut_data(myData:HTML) works but only in the browser. Meaning I can intercept the html from the result but when I put it into a component within a window, it blanks out and not showing any html content at all. I can see the data (html) correctly transmitted to the client under chrome developer tools.

          So, I tried another route - writing to a file in IFS and let the client Extjs app to pick it up. Again, it works but this time Extjs came back and says "Cannot browse selected file." What can be done to resolve this problem? I read somewhere that Extjs does not like to have content that is not generated by CMD to be injected as a safety precaution. Is that a true statement?

          Error_403.JPG

          Code:
              
              onFileGridCellClick: function(tableview, td, cellIndex, record, tr, rowIndex, e, eOpts) {
                  var ev = Ext.get(e.getTarget()).getAttribute('data-event');
          
                  if (ev === 'b2qk') {
                      var cusn = record.get('CUSNSD'),
                          cuso = record.get('CUSOSD'),
                          ordn = record.get('ORDNSD');
          
                      console.log('cusn: '+cusn+' cuso: '+cuso+' ordn: '+ordn);
                      tableview.getEl().mask('retrieving data...');
          
                      Ext.Ajax.request({
                          url: '/valence/vvcall.pgm',
                          params: {
                              pgm: 'CX0088',
                              action: 'getSalesSummary',
                              cusn: cusn,
                              cuso: cuso,
                              ordn: ordn
                          },
                          success: function(response) {
                              var r = Ext.decode(response.responseText),
                                  file = r.html;
                              console.log('ajax call successful.');
                              tableview.getEl().unmask();
          
                              var popup = Ext.create('Ext.window.Window', {
                                  height: 600,
                                  width: 800,
                                  layout: 'fit',
                                  title: '<b>SALES SUMMARY - CUSTOMER DETAIL</b>',
                                  items: [{
                                      xtype: 'component',
                                      autoEl: {
                                          tag: 'iframe',
                                          src: file
                                      }
                                  }]
                              });
          
                              popup.show();
                          }
          
          
                      });
                  }
          Here's the returned src value: \clix5d\temp\X20181008123115738000.html

          I can launch it into a browser when browsing it via file explorer.
          TempHtml.JPG
          Last edited by Dleong@celsinc.com; 10-08-2018, 08:06 PM.

          Comment


          • #6
            Do you have an apache directive to allow access to this directory?

            Comment


            • #7
              Yes. I have a directive already in place.

              You do not have permission to view this gallery.
              This gallery has 1 photos.

              Comment


              • #8
                So you can go directly to your browser and enter in: http://HOST:PORT/clix5d\temp/X20181008123115738000.html and it works?

                If so, temporarily replace your code to:

                Code:
                window.open(file);
                Does that work?

                Comment


                • #9
                  When using a browser going directly as you described, it says forbidden.

                  Error_1.JPG

                  So, what should be the correct directive in Apache?

                  Comment


                  • #10
                    That error is likely a permissions problem on the actual IFS folder. Do command:

                    wrklnk '/clix5d/temp'

                    Then use option 9 to review and adjust permissions on that folder.

                    Comment


                    • #11
                      This is the setting of that folder:

                      flr_setting.JPG

                      Comment


                      • #12
                        Try these things:

                        1. Check permissions on the /clix5d folder by itself and also check the permissions on the individual files.

                        2. Try your url in the exact case of the directives, in some versions of Apache that matters.

                        3. Adjust your Apache directive block to put back in the original "Order Allow,Deny" and "allow from all" directives and comment out your other directive (i.e., make the directive blocks looks like the other paths that are working).

                        4. Make sure you are editing your Apache config using the web-based HTTPAdmin interface. Making changes directly to http.conf can damage the config file to the point where you would need to remove any lines and re-enter them.

                        5. Try deleting and retyping the directive block by hand--copy and paste can sometimes put unseen characters at the front of the line, making the directive useless.

                        Comment


                        • #13
                          Happy to report that it is working now!

                          Popup.JPG

                          Directives set as:

                          directive_2.JPG

                          However, one thing still puzzles me, if I go direct using on a browser:
                          http://http://192.0.2.99:7052/CLIX5D...115738000.html
                          it returns gobbledygook.

                          Garble.JPG

                          Regardless, thank you all for you help.

                          Comment

                          Working...
                          X