Ankündigung

Einklappen
Keine Ankündigung bisher.

- √ - Recalling a list from within the Visu

Einklappen
X
 
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

    #16
    ok there you go.

    this is a cross browser xmlHTTPRequest
    Code:
    function getHTTPobj() {
        try {
            return new XMLHttpRequest();
        } catch (e) {
            try {
              return new ActiveXObject('Msxml2.XMLHTTP');
            } catch (e) {
                try { 
      return new ActiveXObject('Microsoft.XMLHTTP');
                } catch (e) {
                  return false;
                }
            }
        }
    }
    here is an asyncronous call (script is not waiting for answer)

    Code:
     var URL="http:/something.somehwere.org/data.xml";
     var ajax = getHTTPobj();
       //  Method,URL,Async 
           ajax.open('GET',URL,true);
           ajax.setRequestHeader("Pragma", "no-cache");
           ajax.setRequestHeader("Cache-Control", "must-revalidate");
           ajax.setRequestHeader("If-Modified-since", document.lastModified);
           // this is the function that is called when the xml data is downloaded complete
           ajax.onreadystatechange=function() {
          // readyState 4 = complete  
             if(ajax.readyState==4) {
                // HTTP Status 200 OK
                if(ajax.status == 200) {
                var xml = ajax.responseXML
                // check if returning XML is an Archiv list
                 if(xml.getElementsByTagName('LIST')[0] != undefined) {
               // grab an HTML Element (<div id='yourTextBoxID' />
               document.getElementById('yourTextBoxID').innerText = xml.xml;
             } else {
            // do some error checking
          }
      } else {
         // do some error checking
      }
    Nils

    aktuelle Bausteine:
    BusAufsicht - ServiceCheck - Pushover - HS-Insight

    Kommentar


      #17
      Zitat von Warichet Beitrag anzeigen
      I used to put Java Script in a web page, but here ?!? no idea as where to put it. I guess the pages of the Visu have somehow to be translated in standard html ? before applying any JS ?
      just place it somewhere in your html with
      Code:
      (<div id='yourTextBoxID'  />
      <script type='text/javascript'> ...... </script>
      to translate the archive output xml you can write a while loop for each ITEM (row) and parse it.
      Code:
        var HTML = "";
        var Items = xml.getElementsByTagName('LIST')[0].firstChild;
        // Loop through ITEMS
        while(Items) {
           if(Items.hasChildNodes()) {
                   HTML = HTML + "<p>" + Items.nodeValue + "</p>";
       
           }
           Items = Items.nextSibling;
        }
      Nils

      aktuelle Bausteine:
      BusAufsicht - ServiceCheck - Pushover - HS-Insight

      Kommentar


        #18
        Zitat von NilsS Beitrag anzeigen
        just place it somewhere in your html with
        Ouups sorry, I didn't make myself very clear.
        I've no problem putting a piece of JS in an existing web page. I've done this many times before.
        My problem is much more basic: how do I get the very first web page ?
        In other words: how do I start ? or, what is the very first step migrating to AJAX.

        Is there a procedure to convert an existing Visu into standard html code or do I have to rewrite the whole stuff from scratch (in which case I don't see the benefits ).
        Also, from the doc I understand that both systems (the std Visu and the AJAX visu) can co-exist, but it's not mentionned how.

        Thank you for trying do educate an AJAX dummy (although it might take a sizeable amount of time & patience )

        Kommentar


          #19
          to use the AjaxVisu just download
          http://www.dacom-homeautomation.de/l...d=60&Itemid=81
          Nils

          aktuelle Bausteine:
          BusAufsicht - ServiceCheck - Pushover - HS-Insight

          Kommentar


            #20
            Zitat von Warichet Beitrag anzeigen
            how do I start ? or, what is the very first step migrating to AJAX.
            Raymond, I think, we had this discussion before, finally you seemed very frustrated (or angry ?) last time.

            It's a lot more easy than you might think.

            Switching to ajax has primarily nothing in common with "digging in the ajax file(s)". You just have to dowload and install the ajax package from Dacom.
            After installing it to your Experte PC, simply transfer your *existing*, *unmodified* visu to the HS again. In fact, the Experte will in addition only transfer the AJAX-support files to the HS, the firmware 2.2.x knows what to do with these files. That's it for the start !

            I think, you've already done this in the past.

            Having done this, you can access your Visu in two different ways:
            - The "old" way as http://<HS-IP>/hs
            - The ajax way as http://<HS-IP>/opt/hsav/start.htm

            Via the "old" way, the HS is creating and delivering HTML-pages to your browser. In the "ajax" way, there is a script "ajax.js" running in your browser and creating the browser output with ajax / javascript itself.

            Now, you could start modify your existing Visu to get a ajax-only visu (including popup windows, changing the style, using special "XXPAGE" boxes to size it, ...). At this point, you have to decide either to get a "ajax-only" Visu with its enhancements or use two different Visu settings (old for one group of users, Ajax for another).


            But again: Creating a Ajax-Visu is completly the same doing in the Experte as creating a standard Visu. All additional stuff like "Ajax Framework" or "hacking the ajax.js" is only secondary.


            Regards,
            Hartmut

            Kommentar


              #21
              Zitat von HartmutB Beitrag anzeigen
              I think, we had this discussion before
              This proves, if needed, that you have an excellent memory

              Zitat von HartmutB Beitrag anzeigen
              finally you seemed very frustrated (or angry ?) last time.
              Indeed, (it's not an "or", it's an "and") up to a point that I droped the project, all together.

              Zitat von HartmutB Beitrag anzeigen
              I think, you've already done this in the past.
              Yes, and ended up in a pile of frustration.

              Zitat von HartmutB Beitrag anzeigen
              - The "old" way as http://<HS-IP>/hs
              - The ajax way as http://<HS-IP>/opt/hsav/start.htm
              Now, the AJAX syntax brings me to a black browser window, where I can login and see my Visu, almost as usual (the bottom of the display is missing, I guess I can fix it).
              You might ask "how come ?". No idea. No, no, it's not the full transfer and reboot, I've done it 10 times.

              Zitat von HartmutB Beitrag anzeigen
              Via the "old" way, the HS is creating and delivering HTML-pages to your browser. In the "ajax" way, there is a script "ajax.js" running in your browser and creating the browser output with ajax / javascript itself.

              Now, you could start modify your existing Visu to get a ajax-only visu (including popup windows, changing the style, using special "XXPAGE" boxes to size it, ...). At this point, you have to decide either to get a "ajax-only" Visu with its enhancements or use two different Visu settings (old for one group of users, Ajax for another).
              Very clear explanation, thanks.
              I was mainly interested by the new function "pop-up". I was thinking about using the pop-up to display detailed information about certain conditions (i.e. RTR status) where it wouldn't make sense to display all details at once, which would clutter the display to almost unreadable.

              Zitat von HartmutB Beitrag anzeigen
              But again: Creating a Ajax-Visu is completly the same doing in the Experte as creating a standard Visu. All additional stuff like "Ajax Framework" or "hacking the ajax.js" is only secondary.
              OK, I've a much better understanding now.
              Nevertheless, it brings new questions.
              You mention above, that "there is a script "ajax.js" running in your browser". How come this script landed in my PC ? during the AJAX installation process I guess. But then, if I communicate the Ajax URL to someone else, it will not work ? unless the remote site install Ajax as well. Is this correct ?
              If it is, it removes some benefit/interest of the solution.
              My experience is with JS embeded in web pages, hence downloaded from the server at display time (not a separate script).
              The Java primitives are available on many PC (if not, they can be easily downloaded), so I was hoping for a "generic" solution. I mean: I convert my current Visu to the Ajax version, anyone else can benefit from the new features (... a dream falling down).
              You mention above "Creating a Ajax-Visu is completly the same doing in the Experte", OK, but I guess there must be some tools to use the new features ? Maybe a practical example about how to implement the "pop up".
              For other functions, I understand it needs some extra code as you pointed me to Alfred's sample code.

              If I get you right, I'll have to split the Visu development (and hence maintain 2 separate versions): one for the classic way and another the Ajax way, where I can implement new functions.

              Many thanks for this detailed reply.

              PS:
              Could it be that this "ajax.js" is only needed at the Experte PC ? and that it takes care of modifying the generated html pages by embedding the necessary functions on the fly ?

              Kommentar


                #22
                Zitat von Warichet Beitrag anzeigen
                .
                You mention above, that "there is a script "ajax.js" running in your browser". How come this script landed in my PC ? during the AJAX installation process I guess. But then, if I communicate the Ajax URL to someone else, it will not work ? unless the remote site install Ajax as well. Is this correct ?
                PS:
                Could it be that this "ajax.js" is only needed at the Experte PC ? and that it takes care of modifying the generated html pages by embedding the necessary functions on the fly ?
                The HS is the Remote Site you talking bout.
                When you install the AjaxVisu it installs in your Experte Programdir under hsupload. This path is uploaded to your HS and is served by the HS under the path /opt. So all files that you put in this directory will get uploaded next time you transfer your project to your HS.

                The ajax.js is only a file that is placed in the path /opt/hsav/js which is the same as in HSProgdir/hsupload/hsav/js you can modify as much as you like it only uses scripted http request(xmlhttprequest) and do the same as you would login in your /shs it will be launched by the start.htm file under /opt/hsav/start.htm which emebeds in the head the external JS Script ajax.js and calls the function startClient with the optinal parameters username,password,design,refresh. In this html file you can also add custom JS or even vbscript or activeX if your clientpc that will show the visu will accept it.

                Your Visu can stay the same as before but when you make popups for your visu you can only use these inside the ajaxvisu. If you access them with the HSClient or the nonajax /shs you will only see the icons that will limit the Popups or Pages as usual dots and the page shows up as a common Visupage. you can use access-rights on the pages that contain the XXPop or XXPage icons to restrict access to ajaxvisu users.
                Nils

                aktuelle Bausteine:
                BusAufsicht - ServiceCheck - Pushover - HS-Insight

                Kommentar


                  #23
                  Zitat von Warichet Beitrag anzeigen
                  Now, the AJAX syntax brings me to a black browser window, where I can login and see my Visu, almost as usual (the bottom of the display is missing, I guess I can fix it).
                  You might ask "how come ?". No idea. No, no, it's not the full transfer and reboot, I've done it 10 times.
                  OK, here we go. Good start.

                  Basically: I don't know NilsS background, but he seems to be very familiar with Ajax and those things. I'm only speaking as a HS user with some "let's try it" experience. My first (and only) Visu is a ajax based PocketVisu, built while getting more and more insight into "how it is supposed to work":

                  There are two special symbols, you have to define *once*. Create two simple boxes (lets say, 20x20 points, red) in a graphics software of your choice (paint, paint.net, ...). Import them into the Experte and (now it's important) give them the *IDs* (not only the name) of "XXPAGE" and "XXPOPUP".
                  The XXPAGE symbol defines the lower right hand corner of your Visu size.
                  It doesn't matter if your using Gira1024 or something different (as long it is "big" enough", only the area limited from 0,0 to the position of the XXPAGE symbol will be shown. Try it to unterstand it, no risk. Position the symbol on a few pages on different positions. Only the area "marked" will be drawn on the visu.


                  Zitat von Warichet Beitrag anzeigen
                  You mention above, that "there is a script "ajax.js" running in your browser". How come this script landed in my PC ? during the AJAX installation process I guess. But then, if I communicate the Ajax URL to someone else, it will not work ? unless the remote site install Ajax as well. Is this correct ?
                  You are wrong and NilsS already explained it. The ajax.js is downloaded and started to *any* browser the moment you login to the visu (see it as a "HS bridge head" in the browser).

                  Zitat von Warichet Beitrag anzeigen
                  Maybe a practical example about how to implement the "pop up".
                  No problem. Create a visu page of your choice (or use an existing one). Have an icon with "go to visu page - name of your page" set up elsewhere. Create a "Navigation back" button on your "pop up" page to get back (or here: close the popup).
                  And the only trick is: Use the "XXPOPUP" symbol created before (see above) instead of the "XXPAGE" in the lower right hand corner to make it to a popup window. That's all. Again, simply give it a try !


                  Zitat von Warichet Beitrag anzeigen
                  For other functions, I understand it needs some extra code as you pointed me to Alfred's sample code.
                  With a Ajax visu, you *can* get involved in a lot more things by modifying the ajax.js, but there is basically no need to do it. See it as "Level 2 and above".


                  Zitat von Warichet Beitrag anzeigen
                  If I get you right, I'll have to split the Visu development (and hence maintain 2 separate versions): one for the classic way and another the Ajax way, where I can implement new functions.
                  There is a point, where you should decide which way to go. Pros and Cons are:

                  Traditional: + Use Browser or HS-Client
                  Traditional: - poor Refresh in Browser
                  Traditional: - no Popup's

                  Ajax: + excellent refresh even in Browser
                  Ajax: - limited to ajax capable browsers (IE6, better IE7) or FF 3.x
                  Ajax: + Popup's
                  Ajax: + Easy to resize designs

                  Addition: The "HSAjax-Framework" is simply a tool to start up a IE browser window without all its buttons, symbols etc. So if you finally like the idea of a AJAX visu, you would use it instead of calling a browser window ot the HS client on your Panel PC.


                  Zitat von Warichet Beitrag anzeigen
                  Many thanks for this detailed reply.
                  You are welcome.

                  Zitat von Warichet Beitrag anzeigen
                  Could it be that this "ajax.js" is only needed at the Experte PC ? and that it takes care of modifying the generated html pages by embedding the necessary functions on the fly ?
                  Definitly a NO.


                  Regards,
                  Hartmut

                  Kommentar


                    #24
                    Zitat von HartmutB Beitrag anzeigen
                    The XXPAGE symbol defines the lower right hand corner of your Visu size.
                    It doesn't matter if your using Gira1024 or something different (as long it is "big" enough", only the area limited from 0,0 to the position of the XXPAGE symbol will be shown. Try it to unterstand it, no risk. Position the symbol on a few pages on different positions. Only the area "marked" will be drawn on the visu.
                    I've practiced a bit, but I don't get exactly the expected result. Maybe I've done something wrong ?
                    The original Gira1024 is bigger than the Ajax equivalent, although the marquer has been put in the bottom right corner.

                    I hope I can correct it ?

                    Zitat von HartmutB Beitrag anzeigen
                    With a Ajax visu, you *can* get involved in a lot more things by modifying the ajax.js, but there is basically no need to do it. See it as "Level 2 and above".
                    OK
                    I've found 2 instances of ajax.js
                    I guess the one to modify is C:\Program Files\GIRA\HS+FS\exp22\hsupload\hsav\js\ajax.js

                    Maybe taking a backup before messing around
                    Angehängte Dateien

                    Kommentar


                      #25
                      Zitat von Warichet Beitrag anzeigen
                      The original Gira1024 is bigger than the Ajax equivalent, although the marquer has been put in the bottom right corner.
                      Hmm, everything seems OK for me (according to your screen dumps), only your browser window is to small (the ajax visu disables the scroll bars). Enlargen your browser window (type Alt-Ctrl-F11 for a full screen test), everything should work. The XXPAGE itsself won't be displayed, so you either have to make it smaller and put it "in the corner" or resize your Visu wallpaper (might be difficult). See screen dumps (of my PocketVisu) for an example.

                      Zitat von Warichet Beitrag anzeigen
                      I've found 2 instances of ajax.js
                      I guess the one to modify is C:\Program Files\GIRA\HS+FS\exp22\hsupload\hsav\js\ajax.js
                      The ajax.js file mentioned is the "master" file. If there is no other ajax.js file in the proj subfolder, then it is used. If there is an ajax.js in your proj folder, this file is used. You can use project based (different) ajax.js files this way.

                      Regards,
                      Hartmut
                      Angehängte Dateien

                      Kommentar


                        #26
                        So, I can now call an external URL from within the Ajax Visu , after implementig Alfred's hack mentionned above .
                        The purpose was to launch a new window displaying a HS List containing measurement history.
                        Quite quick this switch to the new URL !

                        A big many thanks to Hartmut for his endless patience and hand-holding session .

                        Kommentar


                          #27
                          Zitat von HartmutB Beitrag anzeigen
                          The XXPAGE symbol defines the lower right hand corner of your Visu size.
                          It doesn't matter if your using Gira1024 or something different (as long it is "big" enough", only the area limited from 0,0 to the position of the XXPAGE symbol will be shown.
                          So far so good.

                          Zitat von HartmutB Beitrag anzeigen
                          Try it to unterstand it
                          That's a serious challenge .
                          I've still an understanding problem

                          Extract from the doc:
                          XXPAGE Setzt man dieses Symbol auf eine Visu-Seite, so definiert man damit die untere rechte Ecke.
                          XXPOPUP Setzt man dieses Symbol auf eine Visu-Seite, so definiert man damit die untere rechte Ecke und gleichzeitig diese Seite als PopUp.
                          The definitions are very similar. Both have to be put in "untere rechte Ecke."
                          So, I understand I need the XXPOPUP, anyway, in order to creare a pop-up. No problem, it works fine.
                          But then ? when use the one rather then the other ? or, when use the XXPAGE alone ? Maybe it has nothing to do with XXPOPUP and is used in another context ? for small Visus ?

                          How do I call a pop-up ? Is it via the classical "seite aufrufen" or is there any Java trick underneath ? (mouse-over or the like).

                          Sorry to be a pain.

                          Kommentar


                            #28
                            Zitat von NilsS Beitrag anzeigen
                            This path is uploaded to your HS and is served by the HS under the path /opt. So all files that you put in this directory will get uploaded next time you transfer your project to your HS.
                            Fine!
                            How can I clean-up ? I mean deleting a file ? (besides uploading a file with same name and 0 length, not very clean)

                            Kommentar


                              #29
                              The directory on the hs is a copy of the hsupload directory. If a file is not on your local drive, it won't be on hs.
                              Gruß Matthias
                              EIB übersetzt meine Frau mit "Ehepaar Ist Beschäftigt"
                              - PN nur für PERSÖNLICHES!

                              Kommentar


                                #30
                                Zitat von MatthiasS Beitrag anzeigen
                                If a file is not on your local drive, it won't be on hs.
                                Nice !
                                Thank you

                                Kommentar

                                Lädt...
                                X