403Webshell
Server IP : 172.67.187.206  /  Your IP : 172.71.28.156
Web Server : Apache/2.4.25 (Win32) OpenSSL/1.0.2j PHP/5.6.30
System : Windows NT WIN-ECQAAA40806 6.2 build 9200 (Windows Server 2012 Standard Edition) i586
User : SYSTEM ( 0)
PHP Version : 5.6.30
Disable Function : NONE
MySQL : ON  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  E:/Inetpub/www/myschool/triamudom/check/RGraph/docs/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : E:/Inetpub/www/myschool/triamudom/check/RGraph/docs/annotate_persist.html
<!DOCTYPE html >
<html>
<head>
    <meta http-equiv="X-UA-Compatible" content="chrome=1">
    <!--
        /**
        * o------------------------------------------------------------------------------o
        * | This file is part of the RGraph package - you can learn more at:             |
        * |                                                                              |
        * |                          http://www.rgraph.net                               |
        * |                                                                              |
        * | This package is licensed under the RGraph license. For all kinds of business |
        * | purposes there is a small one-time licensing fee to pay and for non          |
        * | commercial  purposes it is free to use. You can read the full license here:  |
        * |                                                                              |
        * |                      http://www.rgraph.net/LICENSE.txt                       |
        * o------------------------------------------------------------------------------o
        */
    -->
    <title>Making annotations shareable cross browser</title>

    <meta name="keywords" content="rgraph html5 canvas chart docs annotating shareable cross browser" />
    <meta name="description" content="Making annotations shareable cross browser" />
    
    <meta property="og:title" content="RGraph: HTML5 Javascript charts library" />
    <meta property="og:description" content="A chart library based on the HTML5 canvas tag" />
    <meta property="og:image" content="http://www.rgraph.net/images/logo.png"/>

    <link rel="stylesheet" href="../css/website.css" type="text/css" media="screen" />
    <link rel="icon" type="image/png" href="../images/favicon.png">
    
    <!-- Place this tag in your head or just before your close body tag -->
    <script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>

    <script src="../libraries/RGraph.common.core.js"></script>
    <script src="../libraries/RGraph.common.annotate.js"></script>
    <script src="../libraries/RGraph.common.context.js"></script>
    <script src="../libraries/RGraph.line.js"></script>
    <!--[if lt IE 9]><script src="../excanvas/excanvas.original.js"></script><![endif]-->
    
    <script>
        /**
        * The function that loads the annotations from the server
        */
        function LoadAnnotations ()
        {
            var canvasPosition = RGraph.getCanvasXY(g.canvas);
            var div = document.createElement('DIV');

            div.style.backgroundColor = 'white';
            div.style.padding = '3px';
            div.style.position = 'absolute';
            div.style.left = canvasPosition[0] + 5 + 'px';
            div.style.top  = canvasPosition[1] + 5 + 'px';
            div.style.color = 'gray';
            div.style.opacity = 1;
            div.style.border = '2px solid black';
            div.style.zIndex = 99;
            div.innerHTML  = 'Loading annotations...';
            document.body.appendChild(div);
            
            div2 = document.createElement('DIV');
            div2.style.backgroundColor = 'gray';
            div2.style.opacity = 0.5;
            div2.style.position = 'absolute';
            div2.style.left = canvasPosition[0] + 'px';
            div2.style.top  = canvasPosition[1] + 'px';
            div2.style.width = g.canvas.width + 'px';
            div2.style.height = g.canvas.height + 'px';
            //div2.style.zIndex = 98;
            document.body.appendChild(div2);

            window.localStorage['__rgraph_annotations_cvs__'] = '';
            AjaxGet('annotate_persist.html?getannotations=12',

            function ()
            {
                if (this.readyState == 4 && this.status == 200) {
                    window.localStorage['__rgraph_annotations_cvs__'] = this.responseText;
                    
                    RGraph.ReplayAnnotations(g);
                    
                    setTimeout(function () {div.style.opacity = 0.8; div2.style.opacity = 0.4;}, 50);
                    setTimeout(function () {div.style.opacity = 0.6;div2.style.opacity = 0.3;}, 100);
                    setTimeout(function () {div.style.opacity = 0.4;div2.style.opacity = 0.2;}, 150);
                    setTimeout(function () {div.style.opacity = 0.2;div2.style.opacity = 0.1;}, 200);
                    setTimeout(function () {div.style.opacity = 0;div2.style.opacity = 0;}, 250);
                    setTimeout(function () {div.style.display = 'none';div2.style.display = 'none';}, 300);
                }
            }
            );
        }



        /**
        * The function that saves annotations to the server
        */
        function SaveAnnotations ()
        {
            var canvasPosition = RGraph.getCanvasXY(g.canvas);
            var div = document.createElement('DIV');

            div.style.backgroundColor = 'white';
            div.style.padding = '3px';
            div.style.position = 'absolute';
            div.style.left = canvasPosition[0] + 5 + 'px';
            div.style.top  = canvasPosition[1] + 5 + 'px';
            div.style.color = 'gray';
            div.style.opacity = 1;
            div.style.border = '2px solid black';
            div.style.zIndex = 99;
            div.innerHTML  = 'Saving annotations...';
            document.body.appendChild(div);

            AjaxPost('annotate_persist.html', 'data=' + window.localStorage['__rgraph_annotations_cvs__']);
            
            setTimeout(function () {div.style.opacity = 0.8}, 50);
            setTimeout(function () {div.style.opacity = 0.6}, 100);
            setTimeout(function () {div.style.opacity = 0.4}, 150);
            setTimeout(function () {div.style.opacity = 0.2}, 200);
            setTimeout(function () {div.style.opacity = 0; div.style.display = 'none';}, 250);
        }



        /**
        * Makes an AJAX POST.
        */
        function AjaxPost (url, data)
        {
            // Mozilla, Safari, ...
            if (window.XMLHttpRequest) {
                var httpRequest = new XMLHttpRequest();
            
            // MSIE
            } else if (window.ActiveXObject) {
                var httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
            }
            
            //httpRequest.onreadystatechange = callback;
            
            httpRequest.open('POST', url, true);
            httpRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); 
            httpRequest.send(data);
        }

        /**
        * Makes an AJAX call. It calls the given callback (a function) when ready
        * 
        * @param string   url      The URL to retrieve
        * @param function callback A function object that is called when the response is ready, there's an example below
        *                          called "myCallback".
        */
        function AjaxGet (url, callback)
        {
            // Mozilla, Safari, ...
            if (window.XMLHttpRequest) {
                var httpRequest = new XMLHttpRequest();
            
            // MSIE
            } else if (window.ActiveXObject) {
                var httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
            }
            
            httpRequest.onreadystatechange = callback;
            
            httpRequest.open('GET', url, true);
            httpRequest.send();
        }



        window.onload = function (e)
        {
            /**
            * This clears the locally stored annotations so that they can be loaded from server
            */            
            window.localStorage['__rgraph_annotations_cvs__'] = '';

            // Purposefully a global
            g = new RGraph.Line('cvs', [5,6,3,4,8,6,7,5,9]);
            g.Set('chart.tickmarks', 'endcircle');
            g.Set('chart.hmargin', 5);
            g.Set('chart.annotatable', RGraph.isOld() ? false : true);
            g.Set('chart.labels', ['Ben','Olga','Jeff','Indigo','Kev','Pete','Lou','Fred','John']);
            g.Set('chart.contextmenu', RGraph.isOld() ? null : [['Show palette', RGraph.Showpalette], ['Clear', function () {RGraph.Clear(g.canvas);g.Draw();}]]);
            g.Set('chart.shadow', true);
            g.Set('chart.linewidth', 1.01);
            g.Set('chart.ylabels.count', 10);
            g.Draw();
            
            LoadAnnotations();
            
            RGraph.AddCustomEventListener(g, 'onannotateend', function (obj) {SaveAnnotations();});
            RGraph.AddCustomEventListener(g, 'onannotateclear', function (obj) {SaveAnnotations();});
        }
    </script>


    <script>
      var _gaq = _gaq || [];
      _gaq.push(['_setAccount', 'UA-54706-2']);
      _gaq.push(['_trackPageview']);
    
      (function() {
        var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
        ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
      })();
    </script>
</head>
<body>
    
    <!-- Social networking buttons -->
        <?php
            $prefix = substr($_SERVER['SERVER_NAME'], 0, 3);
            require("/rgraph.{$prefix}/social.html");
        ?>
    <!-- Social networking buttons -->

    <div id="breadcrumb">
        <a href="../index.html">RGraph: HTML5 Javascript charts library</a>
        >
        <a href="./index.html">Documentation</a>
        >
        Cross-browser annotations
    </div>

    <h1>Making <span>annotations shareable cross browser</span></h1>

    <div style="text-align: center">
        <div class="warning" style="display: inline-block">
            This example does not work offline - you must use a website. Annotations are removed every five minutes.
        </div>
    </div>

    <script>
        if (RGraph.isOld()) {
            document.write('<div style="background-color: #fee; border: 2px dashed red; padding: 5px"><b>Important</b><br /><br /> Internet Explorer does not natively support the HTML5 canvas tag, so if you want to see the charts, you can either:<ul><li>Install <a href="http://code.google.com/chrome/chromeframe/">Google Chrome Frame</a></li><li>Use ExCanvas. This is provided in the RGraph Archive.</li><li>Use another browser entirely. Your choices are Firefox 3.5+, Chrome 2+, Safari 4+ or Opera 10.5+. </li></ul> <b>Note:</b> Internet Explorer 9 fully supports the canvas tag.</div>');
        }
    </script>

    <canvas id="cvs" width="600" height="250" style="float: right">[No canvas support]</canvas>

    <p>
        Combining a little AJAX and some very simple server side scripting, you can easily make an annotation system that can persist
        across different browsers and computers. You an either use Load/Save buttons to trigger the loading and saving, or like the
        example to the right you can make use of the custom RGraph onannotateend event to make it happen automatically.
    </p>
    
    <p>
        This simple example uses a small PHP server side script that loads and saves the annotation data to a file on the server, 
        and that looks like this:
    </p>

    <br clear="all" />

    <pre class="code">
&lt;?php
    $file = '/tmp/annotation_data';

    /**
    * Save the annotations to a tmp file
    */
    if (isset($_POST) && isset($_POST['data'])) {
        file_put_contents($file, $_POST['data']);
        exit;
    }


    /**
    * Load the annotations
    */
    if (!empty($_GET['getannotations']) && $_GET['getannotations'] == 1) {
        $contents = file_get_contents($file);
        print($contents);
        exit;
    }
?&gt;
</pre>

    <p>
        By making the Javascript Save/Load functions repeat themselves every few seconds, you could easily make a presentation/demo system
        that can be used when paticipants are in differing locations - in a similar fashion to Google Docs - or when you want one persons
        annotations to be viewable by multiple PCs. On this page  though, the Save function is triggered by the custom RGraph event
        <i>onannotateend</i>.
    </p>

</body>
</html>

Youez - 2016 - github.com/yon3zu
LinuXploit