Announcement

Collapse
No announcement yet.

Monitor viewer cleanup

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

  • Monitor viewer cleanup

    Removes need for trailing "," in urls.

    Code:
    diff --git a/pts-core/functions/pts-functions_monitor.php b/pts-core/functions/pts-functions_monitor.php
    index 76638ab..052a229 100644
    --- a/pts-core/functions/pts-functions_monitor.php
    +++ b/pts-core/functions/pts-functions_monitor.php
    @@ -194,7 +194,7 @@ function pts_monitor_statistics()
                    {
                            if(pts_gd_available())
                            {
    -                               $url = "";
    +                               $image_list = array();
                                    pts_save_user_file();
                                    pts_save_user_file(null, null, "/pts-monitor-viewer/");
                                    pts_copy(RESULTS_VIEWER_DIR . "pts-monitor-viewer.html", PTS_MONITOR_DIR . "pts-monitor-viewer.html");
    @@ -234,10 +234,11 @@ function pts_monitor_statistics()
                                                    $t->loadGraphVersion(PTS_VERSION);
                                                    $t->save_graph(PTS_MONITOR_DIR . THIS_RUN_TIME . '-' . $image_count . ".png");
                                                    $t->renderGraph();
    -                                               $url .= THIS_RUN_TIME . '-' . $image_count . ".png,";
    +                                               $image_list[] = THIS_RUN_TIME . '-' . $image_count . ".png";
                                                    $image_count++;
                                            }
                                    }
    +                               $url = implode($image_list, ",");
                            }
                    }
            }
    diff --git a/pts-core/pts-results-viewer/pts.js b/pts-core/pts-results-viewer/pts.js
    index 2c403a6..9bc4d90 100644
    --- a/pts-core/pts-results-viewer/pts.js
    +++ b/pts-core/pts-results-viewer/pts.js
    @@ -15,28 +15,15 @@ function showObject(i)
     }
     function setImagesFromURL()
     {
    -       var split;
            var html = "";
    -       var segment;
    -       var h = 0;
            var pf = location.href;
            pf = pf.substring(pf.search(/#/) + 1);
    +       var imgarray = pf.split(",");
    
    -       do
    +       for(i=0;i<imgarray.length;i++)
            {
    -               split = pf.search(/,/);
    -               segment = pf.substring(0, split);
    -               pf = pf.substring(split + 1);
    -
    -               if(segment.length > 0)
    -                       html += "<p align=\"center\"><img src=\"" + segment + "\" /></p>";
    -
    -               if(h == 1)
    -                       h = 2;
    -               else if(pf.search(/,/) == -1)
    -                       h = 1;
    +               html += "<p align=\"center\"><img src=\"" + imgarray[i] + "\" /></p>";
            }
    -       while(h != 2);
    
            document.getElementById("pts_monitor").innerHTML = html;
     }

  • #2
    Great, thanks. In git.
    Michael Larabel
    https://www.michaellarabel.com/

    Comment

    Working...
    X