Announcement

Collapse
No announcement yet.

HELP: NAB: use renderer to open a file from IFS

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

  • HELP: NAB: use renderer to open a file from IFS

    i'm a little stuck with adding a field to the the grid where in the render coding i added an href so that when the users clicks, the file gets opened.

    i've tried several combinations already but none were successful till now..

    as i test i want to open an xml that is stored on the ifs : '\\MYAS400\FILEXFER\OPTIMAT\PALLETBON\BACKUP\PB.XM L'

    in the renderer i've added
    Code:
    return '<a href="file:/OptimaTPB/pb.xml">XML<a>'
    but no luck..

    ps. i also tried file:\\//MYAS400/filexfer/optimat/palletbon/backup.pb.xml and other combiniations.. they all didn't work, or the console returned me the error that the url was not allowed.


    in the apache config i've added
    Code:
    Alias /OptimaTPB /filexfer/optimaT/Palletbon/Backup
     <Directory /filexfer/optimaT/Palletbon/Backup>
       Order Allow,Deny
       allow from all
     </Directory>
    i've tried several combinations already but none were successful till now..

    strange thing is that when i type in the url-directly in the browser, the file gets displayed correctly... i want to try the same from an NAB-app


    can you help me in clarifying what the best practice is for this..

    thx

    thierry



  • #2
    Try:

    Code:
     
     return '<a href="file:///OptimaTPB/pb.xml">XML<a>'

    Comment


    • #3
      just tried this: but doesn't work

      i receive : not allowed to load local resource: file:///OptimaTPB/pb.xml

      am i something missing in the apache config ?

      the alias /optimaTPB is referred to /filexfer/optimat/palletbon/backup

      Comment


      • #4
        I would look at the network traffic (in developer tools) to see what is actually being attempted and how is it different than when you enter it directly in the browser.

        Comment


        • #5
          when i try with file:///OptimatPB/pb.xml
          i receive the error: Not allowed to load local resource


          When i try with the full path that is working fine in the browser :
          file://myas400/filexfer/optimaT/Palletbon/Backup/PB.xml

          i get :
          Not allowed to load local resource

          ps. in my apache config i have

          Code:
          # cms resource directives
          Alias /OptimaTPB /filexfer/optimaT/Palletbon/Backup
          <Directory /filexfer/optimaT/Palletbon/Backup>
              Order Allow,Deny
              allow from all
          </Directory>




          Comment


          • #6
            OK, how about this. Assuming that "v" represents a field that contains the filename and its value is "pb.xml".

            Code:
            renderer : function(v){
               var markup = '<a href="file://{0}/OptimaTPB/{1}">XML</a>';
            
               return Ext.String.format(markup,window.location.host,v);
            }
            The above code should create:

            Code:
            <a href="file://YOUR_HOST:YOUR_PORT/OptimaTPB/pb.xml">XML</a>

            Comment


            • #7
              Hi Sean,


              thx for the response.. but unfortunately .. still no luck

              so entering the following url directly in the browser works

              file://MY_HOST/filexfer/optimat/Palletbon/Backup/PB.xml

              but i cant make it opened from Valence

              what ive tried so far;

              in the renderer:
              Code:
              var markup = '<a href="{1}" target ="_blank">XML</a>';
              
              return Ext.String.format(markup, window.location.host, v)
              when i do inspect in browser; it is translated into :

              Code:
              <a href="file://MY_HOST/filexfer/optimat/Palletbon/Backup/PB18104098______________.xml" target="_blank" data-tabindex-value="none" tabindex="-1" data-tabindex-counter="1">XML</a>

              in the console i get: 'Not allowed to local resource: file://....'

              with the directory alias

              in the renderer:

              Code:
              var markup = '<a href="file://{0}/OptimaTPB/{1}" target ="_blank">XML</a>';
              
              return Ext.String.format(markup, window.location.host, v);
              when i do inspect in browser; it is translated into :

              Code:
              <a href="file://MY_HOST_IPADDRESS:7052/OptimaTPB/file://CMIS001/filexfer/optimat/Palletbon/Backup/PB18104098______________.xml" target="_blank" data-tabindex-value="none" tabindex="-1" data-tabindex-counter="1">XML</a>

              i get a new tab in chrome with just the title: about _blank but nothing is displayed and i get no errors in the console


              also tried it with other browsers (I.E / EDGE /FFOX..) none of them worked...

              also tried to move the & open the file from /resources/images/Nabexamples ...
              but resulted in the same errors



              thierry

              Comment


              • #8
                Thierry - based on your last code block...it looks like your value of "v" is:

                "file://CMIS001/filexfer/optimat/Palletbon/Backup/PB18104098.xml".

                The code I suggested assumed that "v" contained just the name of the file. If that is the case, extract the filename from your string and pass that to Ext.String.format.

                Comment


                • #9
                  Hi Sean,

                  sorry to bother you again...


                  i mistyped when copying it to the forum.. but in my v- value it was already ok

                  the href is exactly what you say:

                  file://MY_HOST_IP:7052/OptimatPB/PB.XML
                  i dont receive a console error, but only thing i get is a blank screen

                  Comment

                  Working...
                  X