<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">

<!--

   Licensed to the Apache Software Foundation (ASF) under one or more
   contributor license agreements.  See the NOTICE file distributed with
   this work for additional information regarding copyright ownership.
   The ASF licenses this file to You under the Apache License, Version 2.0
   (the "License"); you may not use this file except in compliance with
   the License.  You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.

-->
<!-- ========================================================================= -->
<!-- Checks that access to critical functions is not allowed.                  -->
<!-- Specifically, this test checks that:                                      -->
<!--                                                                           -->
<!-- - access to local files is denied.                                        -->
<!-- - access to the network via sockets is denied.                            -->
<!-- - access to audio is denied.                                              -->
<!-- - access to logging is denied.                                            -->
<!-- - access to network features is denied.                                   -->
<!-- - access to system properties is denied.                                  -->
<!-- - access to serialization is denied.                                      -->
<!-- - access to SQL log is denied.                                            -->
<!-- - access to SSL is denied.                                                -->
<!--                                                                           -->
<!-- @author vincent.hardy@sun.com                                             -->
<!-- @version $Id$   -->
<!-- ========================================================================= -->

<?xml-stylesheet type="text/css" href="../../resources/style/test.css" ?>

<svg xmlns="http://www.w3.org/2000/svg" 
     xmlns:xlink="http://www.w3.org/1999/xlink" 
     width="450" height="500" viewBox="0 0 450 500">
<title>Check Security Settings on Load</title>

    <script type="text/ecmascript" xlink:href="../../resources/script/scrollbar.js"/>
    <script type="text/ecmascript" xlink:href="../../resources/script/common.js"/>
    <script type="text/ecmascript" xlink:href="../../resources/script/rhinoSecurity.js" />

    <style type="text/css"><![CDATA[
        .cellLabel {
            fill: white;
            stroke: black;
            shape-rendering: crispEdges;
        }

        .cellStatus {
            stroke: black;
            shape-rendering: crispEdges;
        }

        .label {
            font-size: 12;
            font-family: sans-serif;
            fill: black;
            text-anchor: middle;
        }

        .passedTest {
            fill: rgb(0,200,50);
            stroke: none;
            shape-rendering: crispEdges;
        }

        .failedTest {
            fill: crimson;
            stroke: none;
            shape-rendering: crispEdges;
        }

        #table {
            stroke: black;
        }

        .untested {
            fill: gray;
            stroke: none;
            shapeRendering: crispEdges;
        }

        .tableCell {
            fill: none;
            stroke: black;
            shapeRendering: crispEdges;
        }
    ]]>
    </style>

    <!-- ============================================================= -->
    <!-- Test content                                                  -->
    <!-- ============================================================= -->
    <g id="testContent">
        <text x="225" y="30" class="title">
            ECMA Script Security Check
        </text>

        <defs>
            <g id="row" fill="gray">
                <rect id="rowLabel" class="cellLabel" x="0" y="0" width="150" height="20"/>
                <rect id="rowStatus" class="cellStatus" x="150" y="0" width="20"
                      height="20"/>
            </g>
        </defs>

        <defs>
            <clipPath id="clipA">
                <use xlink:href="#contentClipRect"/>
            </clipPath>

            <rect id="contentClipRect" x="50" y="70" width="350" height="375"/>

             <g id="upArrow" >
                <circle cx="6" cy="6" r="6" fill="gray" />
                <polygon points="0 0, -1 1, 1 1" 
                         transform="translate(6, 4) scale(3)"/>
            </g>

            <g id="downArrow" >
                <circle cx="6" cy="6" r="6" fill="gray" />
                <polygon points="0 0, -1 1, 1 1" 
                         transform="translate(6, 8) scale(3) rotate(180)"/>
            </g>

            <g id="cursor">
                <polygon points="0 0, -1 1, 1 1" 
                         transform="translate(2) scale(6) translate(0, 1) rotate(-90)"/>
            </g>


        </defs>

        <g id="securityTableTitle" fill="none" stroke="black" shape-rendering="crispEdges">
            <rect x="50" y="50" width="330" height="20" fill="lightgray"/>
            <g>
                <desc>Test Result</desc>
                <polygon points="383,53 397,53 383,67" fill="crimson" stroke="none" />
                <polygon points="383,67 397,67 397,53" fill="rgb(0,200,50)" stroke="none" />
            </g>
            <rect x="380" y="50" width="20" height="20" />
            <text x="215" y="65" text-anchor="middle" stroke="none" fill="black">Security Check Type</text>
        </g>

        <g transform="translate(0, 0)">
            <g id="scrolledArea">
                <g id="clippedArea"
                   onload="new ScrollBar('securityResults', 30, 400, 70, 375, 1200, 12, '#upArrow', '#downArrow', '#cursor', 12)"
                   clip-path="url(#clipA)">
                    <g id="securityResults">
                        <!-- Here is where the security results will be appended -->
                    </g>
                </g>
            </g>
        </g>

        <use xlink:href="#contentClipRect" stroke="rgb(64,64,64)" fill="none"/>

        <!-- =========================================== -->
        <!-- Button for starting the security check      -->
        <!-- =========================================== -->
        <g transform="translate(90, 470)" onmouseover="setAttribute('runTest', 'fill', 'gold')"
                  onmouseout="setAttribute('runTest', 'fill', 'lightgray')"
                  onclick="runEcmascriptSecurityTest()">
            <rect id="runTest" x="-40" y="-10" width="80" height="20" 
                    stroke="black" fill="lightgray" />

            <text x="0" y="5" text-anchor="middle">Run Test</text>
        </g>

        <!-- =========================================== -->
        <!-- Used to display the overall status          -->
        <!-- =========================================== -->
        <g id="globalStatusGroup">
            <rect x="380" y="460" width="20" height="20" 
                  class="tableCell" />
            <rect id="globalStatus" 
                  x="383" y="463" width="14" height="14"
                  class="untested" />
            <text id="successRatio" x="375" y="475" text-anchor="end">not run</text>
        </g>

    </g>


    
</svg>
