Advertisement
Guest User

HTML Javascript

a guest
Aug 4th, 2016
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 4.55 KB | None | 0 0
  1. <html>
  2.   <head>
  3.     <title>LS User Acceptance Test Configurator</title>
  4.     <!-- Latest compiled and minified CSS -->
  5.     <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
  6.  
  7.     <!-- Optional theme -->
  8.     <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css">
  9.  
  10.     <script src="https://code.jquery.com/jquery-1.11.3.js"></script>
  11.  
  12.     <!-- Latest compiled and minified JavaScript -->
  13.     <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
  14.   </head>
  15.  
  16.  
  17.   <body style="margin: 20px">
  18.    
  19.    
  20.     <div class="container">
  21.     <form action="/test_configurator_kerstner/index.cgi" method="GET" class="form-inline" role="form">
  22.          <div class="form-group">
  23.             <label for="name">Name:</label>
  24.             <input type="text" value="[% newname %]" name="newname" class="form-control" id="name" placeholder="Enter name">
  25.          </div>
  26.          <div class="form-group">
  27.             <label for="email">Email:</label>
  28.             <input type="email" value="[% newemail %]" name="newemail" class="form-control" id="email" placeholder="Enter email">
  29.          </div>
  30.          <div class="form-group">
  31.             <label for="pwd">Password:</label>
  32.             <input type="text" value="[% newpass %]" name="newpass" class="form-control" id="pass" placeholder="Enter password">
  33.          </div>
  34.          <input type="submit" value="New User" class="btn btn-primary btn-info">
  35.     </form>
  36.     </div>
  37.    
  38.    
  39.    
  40.     <form action="/test_configurator_kerstner/index.cgi" method="GET">
  41.     <div class="form-group">
  42.         <label for="host">Host:</label>
  43.         <input type="text" class="form-control" name="host" value="[% host %]">  <br>
  44.     </div>
  45.  
  46.     <table id="myTable" class="table table-bordered table-condensed table-hover table-striped" >
  47.    
  48.     <tr>
  49.         <td>Tests\User(s)</td>
  50.         [% FOREACH user IN users %]
  51.         <td data-username="[% user.name %]"><p align="center">[% user.name %]</p></td>
  52.         [% END %]
  53.     </tr>
  54.        
  55.     [% FOREACH test IN tests %]  
  56.         [% FOREACH testMethod IN test.testMethods %]
  57.         <tr>
  58.             <td data-testmethodname="[% test.name %].[% testMethod %]"><b>[% test.name %]</b> [% testMethod.name %]</td>
  59.             [% FOREACH user IN users %]
  60.             <td align="center"> Run: <input type="checkbox" id="[% test.name %]_[% user.name %]_run" name="expectedResult[[% test.name %]][run][[% user.name %]]" [% IF expectedResults.${test.name}.run.${user.name} %]checked[% END %]/> </td>
  61.             [% END %]
  62.         </tr>
  63.        
  64.             <td data-testmethodname="[% test.name %].shouldSucceed">shouldSucceed</td>
  65.             [% FOREACH user IN users %]
  66.             <td align="center"><input type="checkbox" id="[% test.name %]_[% user.name %]_-shouldSucceed" name="expectedResult[[% test.name %]][[% testMethod.name %]][shouldSucceed][[% user.name %]]" [% IF expectedResults.${test.name}.${testMethod.name}.shouldSucceed.${user.name} %]checked[% END %]/></td>
  67.             [% END %]
  68.  
  69.             [% FOREACH parameter IN testMethod.parameters %]
  70.             <tr>
  71.                 <td data-parametername="[% test.name %].[% testMethod.name %].[% parameter %]">[% parameter %]</td>
  72.                 [% FOREACH user IN users %]
  73.                 <td align="center"><input type="checkbox" id="[% test.name %]_[% user.name %]_-[% parameter %]" name="expectedResult[[% test.name %]][[% testMethod.name %]][[% parameter %]][[% user.name %]]" [% IF expectedResults.${test.name}.${testMethod.name}.${parameter}.${user.name} %]checked[% END %]/></td>
  74.                 [% END %]
  75.             </tr>
  76.    
  77.             [% END %]
  78.  
  79.         [% END %]
  80.     [% END %]
  81.     </table>
  82.  
  83.  
  84.     <input type="submit" value="Submit" class="btn btn-primary">
  85.     </form>
  86.    
  87.    
  88.    
  89. <script>
  90. $(document).ready(function()
  91. {
  92.     var runElements = $("[id*='run']");
  93.     for (i=0; i<runElements.size(); i++)
  94.     {
  95.         if (!runElements.eq(i).prop('checked'))
  96.         {      
  97.             var str = (runElements.eq(i)).attr('id');
  98.             var splitting = str.split("_", 2);
  99.             var testname = splitting[0]+"_"+splitting[1]+"_-";
  100.             $("[id*="+testname+"]").prop( "disabled", true );
  101.         }
  102.     }
  103.    
  104.     $("input[name*='[run]']").click(function()
  105.     {
  106.             var str = $(this).attr('id');
  107.             var splitting = str.split("_", 2);
  108.             var testname = splitting[0]+"_"+splitting[1]+"_-";
  109.             var checkbox = $("[id*="+testname+"]");
  110.             checkbox.prop( "disabled", !checkbox.prop("disabled") );
  111.     });
  112. });
  113. </script>
  114.    
  115.    
  116.   </body>
  117. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement