index.html 8.3 KB
Newer Older
1 2 3 4 5
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:py="http://genshi.edgewall.org/">
  <head>
    <title>Universal Looking Glass</title>
6
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
7
    <link rel="stylesheet" href="style-horiz.css" />
Alix Guillard's avatar
Alix Guillard committed
8 9 10 11 12

<script type="text/javascript">var NREUMQ=NREUMQ||[];NREUMQ.push(["mark","firstbyte",new Date().getTime()]);</script>
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />


13 14 15
    <py:if test="defined('refresh')">
      <meta http-equiv="refresh" content="$refresh" py:if="defined('refresh') and (refresh>0)" />
    </py:if>
16
    <script type="text/javascript" src="tinybox.js"></script>
17 18 19 20 21 22 23 24 25 26 27 28
    <script type="text/javascript">
      function updateFormParams()
      {
        var rs=document.getElementById("routerselect");
        var cs=document.getElementById("commandselect");

      <py:for each="ridx,router in enumerate(routers)">
	<py:for each="cidx,cmd in enumerate(routers[ridx].listCommands())">
<![CDATA[        if((rs.options[rs.selectedIndex].value==$ridx) && (cs.options[cs.selectedIndex].value==$cidx)) { ]]>

            document.getElementById("paramsect").innerHTML='                                                                            \
            <py:for each="pidx,param in enumerate(routers[ridx].listCommands()[cidx].getParamSpecs())">
Alix Guillard's avatar
Alix Guillard committed
29 30
	        <fieldset>                                                                                                              \
		<label for="param${pidx}">                                                                                              \
31
		  ${pidx+3}. ${param.getName()}:                                                                                        \
Alix Guillard's avatar
Alix Guillard committed
32
		</label>                                                                                                                \
33 34
		<py:choose>
		  <py:when test="param.getType() == 'select'">
Alix Guillard's avatar
Alix Guillard committed
35
		      <select name="param${pidx}" id="param${pidx}">                                                                    \
36
			<py:for each="paridx,partuple in enumerate(param.getOptions())">
37
			  <py:choose>
38 39 40
			    <py:when test="default_routerid == ridx and default_commandid == cidx and defined('default_params') and partuple[0] == default_params[pidx]">
			      <option value="${partuple[0]}" selected="selected">                                                       \
				${partuple[1]}                                                                                          \
41 42
			      </option>                                                                                                 \
			    </py:when>
43 44 45
			    <py:when test="partuple[0] == param.getDefault()">
			      <option value="${partuple[0]}" selected="selected">                                                       \
				${partuple[1]}                                                                                          \
46 47 48
			      </option>                                                                                                 \
			    </py:when>
			    <py:otherwise>
49 50
			      <option value="${partuple[0]}">                                                                           \
				${partuple[1]}                                                                                          \
51 52 53 54 55 56 57 58 59
			      </option>                                                                                                 \
			    </py:otherwise>
			  </py:choose>
			</py:for>
		      </select>                                                                                                         \
		  </py:when>
		  <py:otherwise>
		      <py:choose>
			<py:when test="default_routerid == ridx and default_commandid == cidx and defined('default_params') and pidx &lt; len(default_params)">
Tomas Hlavacek's avatar
Tomas Hlavacek committed
60
	  <input type="text" name="param${pidx}" id="param${pidx}" value="${default_params[pidx]}" onfocus="this.className=\'hover\'" onblur="this.className=\'out\'" />               \
61 62
			</py:when>
			<py:otherwise>
Tomas Hlavacek's avatar
Tomas Hlavacek committed
63
	 <input type="text" name="param${pidx}" id="param${pidx}" value="${param.getDefault()}" onfocus="this.className=\'hover\'" onblur="this.className=\'out\'" />  \
64 65 66 67
			</py:otherwise>
		      </py:choose>
		  </py:otherwise>
		</py:choose>
Alix Guillard's avatar
Alix Guillard committed
68
                </fieldset>                                                                                                             \
69 70 71 72 73 74 75 76 77 78 79
	    </py:for>';
	    }
	</py:for>
      </py:for>
      }

      function updateFormCommands()
      {
        var rs=document.getElementById("routerselect");
      <py:for each="ridx,router in enumerate(routers)">
	if(rs.options[rs.selectedIndex].value==$ridx) {
80 81 82 83 84 85 86 87 88 89 90
	document.getElementById("commandselect").innerHTML='                                                                            \
	<py:for each="cidx,cmd in enumerate(routers[ridx].listCommands())">
	  <py:choose>
	    <py:when test="default_routerid == ridx and default_commandid == cidx">
	      <option value="$cidx" selected="selected">${cmd.getName()}</option>                                                       \
	    </py:when>
	    <py:otherwise>
	      <option value="$cidx">${cmd.getName()}</option>                                                                           \
	    </py:otherwise>
	  </py:choose>
	</py:for>';
91 92 93 94 95 96 97 98 99 100 101 102
	}
      </py:for>

        updateFormParams()
      }
    </script>

  </head>
  <body class="index">
    <script>
      window.onload=updateFormCommands; 
    </script>
103
    <div id="wrapper">
104 105 106 107 108 109 110 111 112 113 114
    <div id="header">
      <py:choose>
	<py:when test="defaults.header">
	  <h1>ULG - $defaults.header</h1>
	</py:when>
	<py:otherwise>
	  <h1>ULG</h1>
	</py:otherwise>
      </py:choose>
    </div>
    <p>Select router to perform operation on, then select a command to perform and add (optional) argument if needed.</p>
115
    <form action="${getFormURL()}" method="post">
116
      <input type="hidden" name="sessionid" value="$default_sessionid" py:if="defined('default_sessionid') and (default_sessionid)" />
117
      <input type="hidden" name="resrange" value="$resrange" py:if="defined('resrange')" />
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145


<div class="form">
<fieldset>
  <legend></legend>
      <label  for="routerselect">1. Router selection:</label>
      <select id="routerselect" name="routerid" onchange="updateFormCommands()">
	<py:for each="ridx,rtr in enumerate(routers)">
	  <py:choose>
	    <py:when test="ridx == default_routerid">
	      <option value="$ridx" selected="selected">
		${rtr.getName()}
	      </option>
	    </py:when>
	    <py:otherwise>
	      <option value="$ridx">
		${rtr.getName()}
	      </option>
	    </py:otherwise>
	  </py:choose>
	</py:for>
      </select>

</fieldset>
<fieldset>


	    <label for="commandselect">2. Command selection:</label> 
146 147
	      <select id="commandselect" name="commandid" onchange="updateFormParams()">
	      </select>
148 149 150 151 152 153

</fieldset>

	<div id="paramsect"> <!-- TODO: change dynamic display -->
	</div>

Alix Guillard's avatar
Alix Guillard committed
154
<fieldset id="submit-">
155
<label>&nbsp;</label> 
156
              <input type="submit" value="Submit" />
157 158
</fieldset>
</div>
159
    </form>
160
<div class="clear"></div>
161 162 163
    <py:choose>
      <py:when test="defined('result') or defined('refresh')">
	<div id="result">
164
	  <py:choose>
165 166
	    <py:when test="defined('result') and result">
	      ${result}
167 168 169 170
	    </py:when>
	    <py:otherwise>
	    </py:otherwise>
	  </py:choose>
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202
	  <p py:if="defined('refresh') and (refresh>0)">
	    <em>Please wait for data from the router...</em><br/>
	    <em>The page is going to be refreshed in $refresh seconds.</em>
	  </p>
	</div>
	<div id="range">
	  <py:if test="defined('resrangeb') and resrangeb">
	    <br/>
	    <p> [
	      <py:for each="rb in resrangeb[:-1]">
		<py:choose>
		  <py:when test="rb[1]">
		    <a href="${rb[1]}">${rb[0]}</a> | 
		  </py:when>
		  <py:otherwise>
		    ${rb[0]} | 
		  </py:otherwise>
		</py:choose>
	      </py:for>
	      <py:choose>
		<py:when test="resrangeb[-1][1]">
		  <a href="${resrangeb[-1][1]}">${resrangeb[-1][0]}</a> ]
		</py:when>
		<py:otherwise>
		  ${resrangeb[-1][0]} ]
		</py:otherwise>
	      </py:choose>
	    </p>
	  </py:if>
	</div>
      </py:when>
    </py:choose>
203 204
<div class="push"></div>
    </div>
205
    <div id="footer">
206
      <a href="http://www.nic.cz/"><img src="images/cznic-logo-bila.png" width="108" height="38" alt="CZ.NIC" /></a>
207
      <p class="legales" align="right"><small>&copy; (CC-BY) 2012 CZ.NIC, z.s.p.o.</small></p>
208 209 210
    </div>
  </body>
</html>