W3C home > Mailing lists > Public > www-validator-cvs@w3.org > November 2007

2006/unicorn/conf/templates/index en_parameters.js.vm,NONE,1.1 en_index.html.vm,NONE,1.1

From: Hiep Duong via cvs-syncmail <cvsmail@w3.org>
Date: Thu, 29 Nov 2007 10:50:30 +0000
To: www-validator-cvs@w3.org
Message-Id: <E1IxgyU-0000yu-NG@lionel-hutz.w3.org>

Update of /sources/public/2006/unicorn/conf/templates/index
In directory hutz:/tmp/cvs-serv3626/conf/templates/index

Added Files:
	en_parameters.js.vm en_index.html.vm 
Log Message:


--- NEW FILE: en_index.html.vm ---

#macro(genTasklist $i)
	<div>
		Task :
		<select name="ucn_task" onchange="javascript:taskChanged(this.options[this.options.selectedIndex].value, $i);">
			#foreach( $task in $tasklist ) 
				<option value="$task.getID()">$task.getLongName("en")</option> 
			#end
		</select>
	</div>
#end

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

	<head>
		<title>Unicorn</title>
		<link rev="start" href="./" title="Home Page" />
		<style type="text/css" media="all">@import "style/base.css";</style>
		<script type="text/javascript" src="tabtastic/addclasskillclass.js"></script>
		<script type="text/javascript" src="tabtastic/attachevent.js"></script>
		<script type="text/javascript" src="tabtastic/addcss.js"></script>
		<script type="text/javascript" src="tabtastic/tabtastic.js"></script>
		<script type="text/javascript" src="en_parameters.js"></script>
	</head>

	<body onload="init()">

		<div id="banner">
			<h1 id="title">
				<a href="http://www.w3.org/">
					<img height="48" alt="W3C" id="logo" src="http://www.w3.org/Icons/WWW/w3c_home_nb" />
				</a>
				<img src="images/unicorn.png" alt="Unicorn" />
			</h1>
		</div>

		<p id="tagline">the Web's Universal Conformance Checker - <strong>ALPHA Test Version</strong></p>

		<div id="frontforms">
			<ul class="tabset_tabs">
				<li><a href="#validate-by-uri" class="active">by URI</a></li><!--
				--><li><a href="#validate-by-upload">by File Upload</a></li><!--
				--><li><a href="#validate-by-input">by direct Input</a></li>
			</ul>
		    <div id="fields">

			<fieldset id="validate-by-uri" class="tabset_content front">
				<legend class="tabset_label">Validate by URI</legend>
				<form method="get" action="observe">
					#genTasklist(0)
					<p class="instructions">Enter the URI of a document you would like checked:</p>
					<p>
						<label title="Address of page to Validate" for="ucn_uri">
							Address:
							<input type="text" name="ucn_uri" id="ucn_uri" size="45" />
						</label>
					</p>
					<fieldset id="opt_uri" class="options">
						<p title="Simple options">Simple options</p>
						<div class="simpleParamList"></div>
					</fieldset>
					<fieldset id="extra_opt_uri" class="moreoptions">
						<p class="toggle closed" title="Show/Hide extra options" onclick="expand()">More Options</p>
						<!-- invisible -->
						<div class="advancedParamList"></div>
						<!-- / invisible -->
					</fieldset>
					<p class="submit_button">
						<label title="Submit file for validation"><input type="submit" value="Check" /></label>
					</p>
				</form>
			</fieldset>

			<fieldset id="validate-by-upload"  class="tabset_content front">
				<legend class="tabset_label">Validate by File Upload</legend>
				<form method="post" enctype="multipart/form-data" action="observe">
					#genTasklist(1)
					<p class="instructions">Choose the document you would like validated:</p>
					<p>
						<label title="Choose a Local File to Upload and Validate" for="ucn_file">
							Local file:
							<input type="file" id="ucn_file" name="ucn_file" size="30" />
						</label>
					</p>
					<fieldset id="opt_upload" class="options">
						<p title="Simple options">Simple options</p>
						<div class="simpleParamList"></div>
					</fieldset>
					<fieldset id="extra_opt_upload" class="moreoptions">
						<p class="toggle closed" title="Show/Hide extra options" onclick="expand()">More Options</p>
						<!-- invisible -->
						<div class="advancedParamList"></div>
						<!-- / invisible -->
					</fieldset>
					<p class="submit_button">
						<label title="Submit file for validation">
							<input type="submit" value="Check" />
						</label>
					</p>
				</form>
			</fieldset>

			<fieldset id="validate-by-input"  class="tabset_content front">
				<legend class="tabset_label">Validate by direct input</legend>
				<form action="observe" method="get">
					#genTasklist(2)
					<p class="instructions">Enter the document you would like checked:</p>
					<p>
						<textarea name="ucn_text" rows="12" cols="70"></textarea>
						<span id="ucn_text_mime"></span>
					</p>      
					<fieldset id="opt_direct" class="options">
						<p title="Simple options">Simple options</p>
						<div class="simpleParamList"></div>
					</fieldset>
					<fieldset id="extra_opt_direct" class="moreoptions">
						<p class="toggle closed" title="Show/Hide extra options" onclick="expand()">More Options</p>
						<!-- invisible -->
						<div class="advancedParamList"></div>
						<!-- / invisible -->
					</fieldset>
					<p class="submit_button">
						<label title="Submit file for validation">
							<input type="submit" value="Check" />
						</label>
					</p>
				</form>
			</fieldset>
		    </div><!-- fiends -->
		</div><!-- end div id = frontforms -->
<h2>Latest News</h2>
<h3>7 September 2006: public preview</h3>
<p>Welcome to the public preview of the unicorn tool. To learn more about this tool
or how you can provide feedback for this preview, check the <a href="http://www.w3.org/QA/2006/09/unicorn_public_preview.html">W3C QA Weblog</a>.</p>
<p><strong>Note</strong>: You need to enable Javascript to be able to check documents</a>.</p>

		<ul class="navbar"  id="menu">
			<li><a href="http://www.w3.org/QA/2006/obs_framework/" title="Documentation about this service and the software behind it">Documentation</a> <span class="hideme">|</span></li>
			<li><a href="http://dev.w3.org/cvsweb/2006/unicorn/" title="Download the source for this service">Download</a> <span class="hideme">|</span></li>
			<li><a href="mailto:public-qa-dev@w3.org" title="send us your thoughts and bug reports on the PUBLIC development mailing-list">Feedback</a> <span class="hideme">|</span></li>
		</ul>

		<p id="activity_logos">
			<a href="http://www.w3.org/QA/" title="W3C's Quality Assurance Activity, bringing you free Web quality tools and more">
				<img src="http://www.w3.org/QA/2002/12/qa.png" alt="QA" />
			</a>
			<a href="http://www.w3.org/Style/CSS/learning" title="Learn more about Cascading Style Sheets"></a>
		</p>

		<p id="support_logo">
			Support this tool, become a<br />
			<a href="http://www.w3.org/Consortium/supporters">
				<img src="http://www.w3.org/Consortium/supporter-logos/csupporter.png" alt="W3C Supporter" />
			</a>
		</p>

		<p class="copyright">
			<a rel="Copyright" href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> &copy; 1994-2006
			<a href="http://www.w3.org/"><acronym title="World Wide Web Consortium">W3C</acronym></a>&reg;

			(<a href="http://www.csail.mit.edu/"><acronym title="Massachusetts Institute of Technology">MIT</acronym></a>,
			<a href="http://www.ercim.org/"><acronym title="European Research Consortium for Informatics and Mathematics">ERCIM</acronym></a>,
			<a href="http://www.keio.ac.jp/">Keio</a>),
			All Rights Reserved.
			W3C <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
			<a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>,
			<a rel="Copyright" href="http://www.w3.org/Consortium/Legal/copyright-documents">document use</a>
			and <a rel="Copyright" href="http://www.w3.org/Consortium/Legal/copyright-software">software licensing</a>

			rules apply. Your interactions with this site are in accordance
			with our <a href="http://www.w3.org/Consortium/Legal/privacy-statement#Public">public</a> and
			<a href="http://www.w3.org/Consortium/Legal/privacy-statement#Members">Member</a> privacy
			statements.
		</p>

	</body>

</html>

--- NEW FILE: en_parameters.js.vm ---
#macro(createDropdown $param)
  #set($defaults = $param.getMapOfDefaultValue())
  '    $param.getLongName("en") : ' +
  '<select name="$param.Name">' +
     #foreach ($value in $param.getMapOfValue())
  '   <option value="$value.Name"#if($defaults.containsKey($value.getName())) selected="selected" #end>$value.getLongName("en")</option>' +
  #end
  '</select>' +
#end

#macro(createRadio $param)
  #set($defaults = $param.getMapOfDefaultValue())
  '    $param.getLongName("en") : ' +
  #foreach ($value in $param.getMapOfValue())
    '    <input type="radio" name="$param.Name" value="$value.getName()"#if($defaults.containsKey($value.getName())) checked="checked" #end/> $value.getLongName("en")' +
  #end
#end

#macro(createCheckbox $param)
  #set($defaults = $param.getMapOfDefaultValue())
  '    $param.getLongName("en") : ' +
  '    <input type="checkbox" name="$param.getName()"#if($defaults.containsKey($value.getName())) checked="checked" #end/>' +
#end

#macro(createCheckboxList $param)
  #set($defaults = $param.getMapOfDefaultValue())
  '    $param.getLongName("en") : ' +
  #foreach ($value in $param.getMapOfValue())
  '    <input type="checkbox" name="$param.getName()" value="$value.getName()"#if($defaults.containsKey($value.getName())) checked="checked" #end/> $value.getLongName("en")' +
  #end
#end

#macro(createTextarea $param)
  #set($defaults = $param.getDefaultValue())
  '    $param.getLongName("en") : ' +
  '    <textarea name="$param.Name">#foreach($default in $defaults)$default.Name#end</textarea>' +
#end

#macro(createTextfield $param)
  #set($defaults = $param.getDefaultValue())
  '    $param.getLongName("en") : ' +
  '    <input type="textfield" name="$param.Name" value="#foreach($default in $defaults)$default.Name#end"/>' +
#end

#macro(createParameter $param)
  #set($type = $param.getType())
  #if($type == $checkbox)
    #createCheckbox($param)
  #elseif($type == $checkboxlist)
    #createCheckboxList($param)
  #elseif($type == $radio)
    #createRadio($param)
  #elseif($type == $textarea)
    #createTextarea($param)
  #elseif($type == $textfield)
    #createTextfield($param)
  #else
    #createDropdown($param)
  #end
#end

#macro(createParameters $task)
  #foreach ($param in $task.getMapOfParameter())
    #if($param.UiLevel == $simple)
     simpleParameters["$task.getID()"] +=
     '  <li>' +
        #createParameter($param)
     '  </li>'
    #elseif($param.UiLevel == $advanced)
     advancedParameters["$task.getID()"] +=
     '  <li>' +
        #createParameter($param)
     '  </li>'
    #end
  #end
#end

#macro(createMimes $task)
	#set($alreadyPresent = [])
	'<select name="ucn_text_mime">' +
	#foreach($obs in $task.getMapOfObservation())  
		#foreach($mime in $obs.getMapOfMimeTypePriority().keySet())
			#set($sMime = $mime.toString())
			#if(!$alreadyPresent.contains($sMime))
				'<option value="$mime">$mime</option>' +
				## if to avoid output print from add function call
				#if($alreadyPresent.add($mime.toString())) #end
			#end
		#end
	#end
	'</select>'
#end

var simpleParameters = new Array();
var advancedParameters = new Array();
var mimeContainer = new Array();
      
#foreach($task in $tasklist)
  simpleParameters["$task.getID()"] = '<ul>';
  advancedParameters["$task.getID()"] = '<ul>';
  #createParameters($task);
  simpleParameters["$task.getID()"] += '</ul>';
  advancedParameters["$task.getID()"] += '</ul>';
  mimeContainer["$task.getID()"] = #createMimes($task);
#end

function getElementsByClass(val) {
  var all = document.getElementsByTagName('*');
  var arr = [];

  for(var k = 0; k < all.length; k++) {      
    className = all[k].className;
    if(className && className.indexOf(val) > -1) {
      arr[arr.length] = all[k];
      //alert(attribute);
    }
  }
  return arr;
} 

function taskChanged(value, method) {
	var simpleParamsContainers = getElementsByClass("simpleParamList");
	var advancedParamsContainers = getElementsByClass("advancedParamList");

	simpleParamsContainers[method].innerHTML = simpleParameters[value];
	advancedParamsContainers[method].innerHTML = advancedParameters[value];

	if(simpleParameters[value] == '<ul></ul>') {
		simpleParamsContainers[method].parentNode.style.display = 'none';
	}
	else {      
		simpleParamsContainers[method].parentNode.style.display = 'block';
	}
	if(advancedParameters[value] == '<ul></ul>') {
		advancedParamsContainers[method].parentNode.style.display = 'none';
	}
	else {      
		advancedParamsContainers[method].parentNode.style.display = 'block';
	}

	// mimetypes dropdown
	if(method == 2) {
		document.getElementById("ucn_text_mime").innerHTML = mimeContainer[value];
	}
}

function init() {
  var tasklists = document.getElementsByName('ucn_task');
  for(var i = 0; i < tasklists.length; i++) {
    taskChanged(tasklists[i].options[tasklists[i].options.selectedIndex].value, i);
  }
}

function expand() {
  var adv = this.getElementsByClass("advancedParamList");
  for(var i = 0; i < adv.length; i++) {
    adv[i].style.display = (adv[i].style.display == 'block') ? 'none' : 'block';
  }
}
Received on Thursday, 29 November 2007 10:50:42 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 26 April 2012 12:54:59 GMT