No announcement yet.

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

  • 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
    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
    Alias /OptimaTPB /filexfer/optimaT/Palletbon/Backup
     <Directory /filexfer/optimaT/Palletbon/Backup>
       Order Allow,Deny
       allow from all
    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..



  • #2

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


    • #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


      • #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.


        • #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 :

          i get :
          Not allowed to load local resource

          ps. in my apache config i have

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


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

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

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


            • #7
              Hi Sean,

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

              so entering the following url directly in the browser works


              but i cant make it opened from Valence

              what ive tried so far;

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

              <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:

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

              <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



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


                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.


                • #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:

                  i dont receive a console error, but only thing i get is a blank screen


                  • #10
                    Hi Thierry. Was reading some posts during lunch and this got my curiosity up because I had run into this but did not try to defeat it like you are. From what I've read on general issue, all modern browsers will not link to local file systems for security reasons. What I've had to do to open links to IFS docs is run an HTTP instance allowing the IFS location to be served. So when I build link it looks like this:

                    wrklink = '//atnsr520'                     
                           + %TRIM(ILPUBLNK)                   
                           + %TRIM(sqlRec.IMDOCNO)             
                           + %TRIM(sqlRec.IMCURREV)            
                           + '.'                               
                           + %TRIM(sqlRec.IMPUBSFX);           
                       DocRecords(count).IMDOCNO =             
                           '<a target='+DQ+'_blank'+DQ+' href='
                           + %TRIM(wrklink)                    
                           + '>'+%trim(sqlRec.IMDOCNO)+'</a>';
                    These files, mostly PDF but some Excel, live in an IFS folder /iso/publish. But the link in Valence app only works if this HTTP instance is running. I've known this for a long time but didn't know why until I saw your post and looked into it. Hope this helps.


                    • #11
                      Hi Terry..
                      thx a lot for thinking together for this option..

                      not really sure if i understand what you .. this "http instance is running"

                      i would really appreciate if you could provide me more info on this..

                      thx a lot


                      • #12
                        Hi Thierry, I just created a non Valence related i5 HTTP server which listens on port 80. atnsr520 is the DNS name of my i5 here. So in that HTTP config, you can serve whatever IFS directories you want to allow access to. I was actually using this technique long before Valence came along when writing browser apps.

                        2 Listen *:80
                        3 DocumentRoot /www/vcprod/htdocs
                        4 Options -ExecCGI -FollowSymLinks -SymLinksIfOwnerMatch -Includes -IncludesNoExec -Indexes
                        5 LogFormat "%h %T %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
                        6 LogFormat "%{Cookie}n \"%r\" %t" cookie
                        7 LogFormat "%{User-agent}i" agent
                        8 LogFormat "%{Referer}i -> %U" referer
                        9 LogFormat "%h %l %u %t \"%r\" %>s %b" common
                        10 CustomLog logs/access_log combined
                        11 LogMaint logs/access_log 7 0
                        12 LogMaint logs/error_log 7 0
                        13 AccessFileName .htaccess
                        14 SetEnvIf "User-Agent" "Mozilla/2" nokeepalive
                        15 SetEnvIf "User-Agent" "JDK/1\.0" force-response-1.0
                        16 SetEnvIf "User-Agent" "Java/1\.0" force-response-1.0
                        17 SetEnvIf "User-Agent" "RealPlayer 4\.0" force-response-1.0
                        18 SetEnvIf "User-Agent" "MSIE 4\.0b2;" nokeepalive
                        19 SetEnvIf "User-Agent" "MSIE 4\.0b2;" force-response-1.0
                        20 MultiviewsMatch Any
                        21 AddType application/winword docx
                        22 DirectoryIndex index.html
                        23 <Directory />
                        24 Order Deny,Allow
                        25 Deny From all
                        26 </Directory>
                        27 <Directory /www/vcprod/htdocs>
                        28 Order Allow,Deny
                        29 Allow From all
                        30 </Directory>
                        31 <Directory /iso/*>
                        32 Order Allow,Deny
                        33 Allow From all
                        34 </Directory>
                        35 Alias /iso /iso/
                        36 <Directory /ap/*>
                        37 Order Allow,Deny
                        38 Allow From all
                        39 </Directory>
                        40 Alias /ap /ap/
                        I'm sure you could also run this thru the Valence HTTP config but it makes figuring out how to construct the URL more difficult (relative to root of your application itself). Like I said, back when I started doing this it predated Valence so I had no other HTTP servers running. One great thing about i5 HTTP servers, they do not implement PUT and DELETE so it makes security concerns almost non-existent.