12 Replies Latest reply on Nov 1, 2013 11:43 PM by Malcolm

    Anyone using fmi_iwp.js as a standard library?

    Malcolm

      It appears as though most of the heavy lifting in IWP is done by fmi_iwp.js.

       

      Has anyone taken a copy of this library and used it to build an environment that lets them build their own web pages which can communicate intelligently with IWP?

       

      malcolm

        • 1. Re: Anyone using fmi_iwp.js as a standard library?
          steve_ssh

          Hello Malcolm,

           

          While I have not specifically targeted  fmi_iwp.js  to interact with IWP, I have created a whole world which allows for intelligent and (once you get the hang of it) fairly easy interaction with IWP.

           

           

          Just As a Fun Challenge:

           

          I wrote a library which interacts with, and extends what sort of functionality is possible with IWP ( v.11 and v.12 ).

           

          With a few exceptions, I have kept this project to myself because I think, for most developers, a better course with respect to IWP would be to stick to using it more or less as FMI intended for it to be used.

           

          That said, I am more than happy to share any of what I learned, including the complete library if anyone feels that they could benefit from using it.

           

           

           

          As An Example:

           

          I noticed that in one of your other posts, you mentioned being able to route an IWP user to a particular layout based on the URL that they use to access the database.

           

          To illustrate one application of the library, I'll attach a sample file to this post which demonstrates being able to do this.

           

          Upon hosting the demo file, the following URLs can be used to access the file and target a specific layout:

           

              http://<IWP_HOSTNAME>/fmi/iwp/cgi?-db=ConditionalLayout&-loadframes#student

           

              http://<IWP_HOSTNAME>/fmi/iwp/cgi?-db=ConditionalLayout&-loadframes#staff

           

              http://<IWP_HOSTNAME>/fmi/iwp/cgi?-db=ConditionalLayout&-loadframes#admin

           

           

           

           

          Additional Notes:

           

          The library is a .js file of code which is downloaded (and hopefully cached) by any IWP page that uses it.

           

          As such, it needs to be hosted on a webserver somewhere.

           

          For purposes of this demo, the demo file points to a version that I have hosted on my own webspace.

           

          The first time that the browser downloads it, it may take a moment, as I'm using basic webhosting, i.e. no redundancy across the globe, etc.

           

           

           

          Very kind regards,

           

          -steve

           

           

          p.s.  Regardless of whether or not the demo/library interests you, I would be interested in hearing any details that you wish to provide about the objectives motivating your post.

           

          Message was edited by: steve_ssh:  Updated attached demo file to utilize a longer timeout value when downloading library.

          • 2. Re: Anyone using fmi_iwp.js as a standard library?
            Malcolm

            Hi Steve,

             

            We're providing support to a solo FileMaker developer who has developed a membership service for people running classes, like dance, sport, etc. The club managers access the system via IWP. The dev is now being asked if he can integrate his system with other web sites. They want public access to the solution so that people can sign themselves up for dance classes, etc. If he can provide them with a URL that displays the correct layout, it reduces the overhead for the user as they no longer need to arrive at the home page then drill down through the system.

             

            The ability to go directly to a layout is a real boon. It is such a highly desirable action that I'm surprised that there wasn't a provision for it in the code.

             

            I can read javascript much better than I write it. While I was fairly sure that there would be a way to manipulate IWP via javaScript I wasn't confident that I was the best one for the job.

             

            Malcolm

            • 3. Re: Anyone using fmi_iwp.js as a standard library?
              LyndsayHowarth

              I have a number of solutions which, when accessed by IWP take the users to different layouts depending on account and associated privileges. Years ago I did some forms which embedded the logon details.

              I never put the two scenarios together, but I can't see that they wouldn't work.

              Embedding username and password in URLs works fine too... except in Explorer (http://username:password@Hostname/fmi/iwp......)

               

              Mind you... PHP would be the better option.

               

              I am interested in what Steve has done. If only I had a bit more time ;-)

               

              - Lyndsay

              • 4. Re: Anyone using fmi_iwp.js as a standard library?
                Malcolm

                In this case there aren't any logins, only anonymous users who will never have a user account. However, you're suggestion to setup user accounts and pass them in the URL is a very good one.

                 

                 

                Malcolm

                • 5. Re: Anyone using fmi_iwp.js as a standard library?
                  steve_ssh

                  Hi Malcolm and Lyndsay,

                   

                  If it is the case that number of possible destination layouts is finite and fairly static, then, hands down I think that Lyndsay's suggestion of branching based off of a user account is the best way to go with solving this.

                   

                  AFAIK, there is no means built in to IWP for passing in "command parameters" to invoke specific actions on the server -- with IWP, one pretty much plays within the IWP sandbox without being able to do the sorts of things that we know are possible in the worlds of CWP or CDML.

                   

                  As such, the only ways that I've seen for passing in a little extra configuration to IWP are:

                   

                    1) The user manually enters it (which we seek to avoid)

                   

                    2) The configuration gets conveyed via association with an account name/privilege set (Lyndsay's point -- and the most elegant, in my opinion).

                   

                    3) The IWP page gets hacked enough to squeeze some extra data through the IWP connection in a more subversive fashion (the library I mentioned -- less elegant, though not without certain merits for variations on this scenario)

                   

                   

                  Hopefully the particular scenario you are looking at will fit well with the account name technique.  For now, it's the best option that I can see.

                   

                  Thanks for elaborating on the details & very best,

                   

                  -steve

                  • 6. Re: Anyone using fmi_iwp.js as a standard library?
                    Malcolm

                    Lyndsay,

                     

                    Are you using this method with IWP? I tried it today and I'm getting a warning from the browser saying that the web site doesn't require authentication and that there could be a trick.

                     

                    Malcolm

                    • 7. Re: Anyone using fmi_iwp.js as a standard library?
                      LyndsayHowarth

                      Hi Malcolm,

                       

                      I haven't tried it for a couple of years... but I have tried it with my FMSA9 which is still running. It used to work and now it doesn't in any of the Mac browsers.

                      Safari says it is phishing and FireFox doublechecks that you really mean to go there. Both now chop off the un:pw@ bit and leave you with the FMI IWP logon

                       

                      Sorry for the old garden path I was leading you down. I am an old gardener!

                       

                      - Lyndsay

                       

                      OnePhish.png

                      • 8. Re: Anyone using fmi_iwp.js as a standard library?
                        jormond

                        Maybe I'm over thinking this. But doesn't this URL Syntax take you to the desired layout? You still need to work out authentication, or have data entry layouts open to guests. But all you need to know is the layout number.  You may be able to figure out using the layout name, but I haven't tried that.

                         

                        http://<domain>/fmi/iwp/cgi?-db=<databasename>&-lay=<layoutnumber>&-gotolayout

                        Malcolm wrote:

                         

                        They want public access to the solution so that people can sign themselves up for dance classes, etc. If he can provide them with a URL that displays the correct layout, it reduces the overhead for the user as they no longer need to arrive at the home page then drill down through the system.

                         

                        The ability to go directly to a layout is a real boon. It is such a highly desirable action that I'm surprised that there wasn't a provision for it in the code.

                        1 of 1 people found this helpful
                        • 9. Re: Anyone using fmi_iwp.js as a standard library?
                          steve_ssh

                          Josh!!!!!

                           

                          This is brilliant!  -- Thank you!

                           

                          I just tried your suggestion, and, at first, I found that simply loading the URL into the page rendered the page with the desired layout, but button functionality on the page was broken and, as a user, I was pretty much stranded on the page.

                           

                          I checked to see what was going wrong, and it seemed that the only thing broken was that (because the page had been loaded outside of an IWP frameset) some of the necessary IWP resources were unavailable.

                           

                           

                          Possible Solution:

                           

                          We write our own frameset parent html page, which uses the URL format that you proposed in your post in the content frame:

                           

                                 /fmi/iwp/cgi?-db=<databasename>&-lay=<layoutnumber>&-gotolayout

                           

                           

                          I just gave this a go using FMPA to serve IWP, and this seems to work fine.  I haven't tested with FMS yet, and probably won't have a chance to do so for another day, but it looks like you may have nailed the key to solving the problem.

                           

                           

                          Caveat:

                           

                          I guess the one thing worth mentioning here is that I've got my sample file configured so that the Guest account is enabled, and it is the only account with IWP access.  Were this not the case, I imagine that one would quite likely run into a login screen -- I don't know; haven't tested that yet.

                           

                           

                           

                           

                          Last Thoughts:

                           

                          In a server environment, if the webserver used to serve the parent frameset page is PHP enabled, then it should be possible to write a single page which responds to a particular URL and serves back the proper HTML to go to the target layout.

                           

                          It might even be possible to do a little bit of browser sniffing (even though it's frowned upon) to try to direct users on smaller mobile devices to a more suitable layout, though I don't think that I would go down that particular path at this time.

                           

                          I had always believed that we couldn't prompt IWP with commands, but you have proven me wrong and have possibly opened up a bunch of doors.  While I don't intend to walk through most of those doors at this point, I think that the -gotolayout command is one worth investigating, i.e. see if there are any unexpected side-effects of using this particular trick with IWP.

                           

                          Bravo!

                           

                           

                           

                           

                          Attached File:

                           

                          I'll attach a copy of the file that I used to try to get this to work.  In the file there is a comment to indicate which line needs to be modified to target a particular database and layout.

                           

                          For FMP/A use on OSX, this file needs to be placed in the Web folder of the FMP/A application folder.  I don't know what the equivalent location is on Windows.

                           

                          For FMS/A use, this file should go somewhere in the www document root hierarchy -- I'm not sure if it matters where.  I don't think it does, but I have not tried this option yet.

                           

                           

                          Best regards to all,

                           

                          -steve

                          1 of 1 people found this helpful
                          • 10. Re: Anyone using fmi_iwp.js as a standard library?
                            LyndsayHowarth

                            I am ashamed! For someone who has done web stuff since version 2.0 where I use URLs with embedded layout attributes all the time... I should have thought of that!

                            Joshua had his thinking cap on! My only excuse is perhaps the painkillers I have taken for a sore jaw...

                             

                            Bravo, Joshua!

                            - Lyndsay

                            • 11. Re: Anyone using fmi_iwp.js as a standard library?
                              jormond

                              haha...I actually slept for a full 8 hours last night. This sleep stuff is amazing!!!

                              • 12. Re: Anyone using fmi_iwp.js as a standard library?
                                Malcolm

                                i'm not able follow up because i've just had surgery and only have on active arm at present. where did you get the -gotolayout command, where can i track that down?