commit: added template, css, and js files for init task

changeset:   1217:7241f9c88845
user:        Thomas Gambet <tgambet@w3.org>
date:        Sat Jun 12 23:39:11 2010 -0400
files:       WebContent/WEB-INF/resources/templates/init.vm WebContent/scripts/w3c_unicorn_init.js WebContent/style/init.css
description:
added template, css, and js files for init task


diff -r 47e665677735 -r 7241f9c88845 WebContent/WEB-INF/resources/templates/init.vm
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/WebContent/WEB-INF/resources/templates/init.vm	Sat Jun 12 23:39:11 2010 -0400
@@ -0,0 +1,17 @@
+#set ($title = "Unicorn")
+#set ($css = ['base_ucn-yc.css', 'init.css'])
+#set ($js = ['mootools-1.2.3-core-more-yc.js', 'w3c_unicorn_init.js'])
+#parse('head.vm')
+
+<div id="init">
+	<h1>Hi ${user}!</h1>
+	<ul>
+		<li><a href="init?task=all" class="init">Initialize all</a></li>
+		<li><a href="init?task=languages" class="init">Reload languages</a></li>
+		<li><a href="init?task=observers" class="init">Reload observers</a></li>
+		<li><a href="init?task=tasklist" class="init">Reload tasklist</a></li>
+	</ul>
+	<textarea name="result" id="result" cols="30" rows="10" disabled="disabled"></textarea>
+</div>
+
+#parse('footer.vm')
\ No newline at end of file
diff -r 47e665677735 -r 7241f9c88845 WebContent/scripts/w3c_unicorn_init.js
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/WebContent/scripts/w3c_unicorn_init.js	Sat Jun 12 23:39:11 2010 -0400
@@ -0,0 +1,80 @@
+// Author: Thomas GAMBET.
+// (c) COPYRIGHT MIT, ERCIM and Keio, 2009.
+var W3C = {
+	
+	start: function(){
+		
+		/*W3C.Tabs = $('tabset_tabs');
+		W3C.TabLinks = W3C.Tabs.getChildren('li a');
+		
+		W3C.TaskSelect = $('tasks');
+		W3C.TaskOptions = W3C.TaskSelect.getChildren('option');
+		W3C.TaskDescrip = $('task_descrip');
+		W3C.TaskInputs = $$('input.task');
+		
+		W3C.LangParameter = $$('html').getProperty('lang')[0];
+		
+		W3C.Forms = $$('form.ucn_form');
+		W3C.Action = W3C.Forms[0].getProperty('action');
+		
+		// index of selected tab
+		W3C.SelectedTab = 0;
+		// index of selected task
+		W3C.SelectedTask = W3C.TaskOptions.getProperty('value').indexOf(W3C.TaskInputs[0].value);
+		// boolean: expand options
+		W3C.WithOptions = false;
+		
+		W3C.Loader = new Element('img', {'src': '/unicorn/images/ajax-loader.gif', 'class': 'loader'});
+		W3C.prepareDocument();
+		W3C.parseHash();
+		//W3C.updateHash();
+		
+		W3C.showTab(W3C.SelectedTab, false);
+		W3C.selectTask(W3C.SelectedTask, false);
+		W3C.toggleOptions(false);
+		W3C.addOptionEvents();*/
+		
+		W3C.Loader = new Element('img', {'src': '/unicorn/images/ajax-loader.gif', 'class': 'loader'});
+		
+		$$('a.init').each(function(link, i) {
+			link.addEvent('click', function (event) {
+				event.stop();
+				W3C.init(link.get('href'));
+			});
+		});
+		
+	},
+	
+	init: function(task) {
+		
+		var req = new Request.HTML({url: task,
+			method: 'get',
+			/*onRequest: function() {
+				W3C.Loader.injectBefore(W3C.Forms[W3C.SelectedTab].getElement('div.submit'));
+			},*/
+			onSuccess: function(responseTree, responseElements, responseHTML, responseJavaScript) {
+				$('result').set('text', responseHTML);
+				return true;
+			},
+			onFailure: function() {
+				// TODO
+				return false;
+			}
+		});
+		var queryString = ''; 
+		req.send(queryString);
+	},
+	
+	setHash: function(hash){
+		if (window.webkit419){
+			W3C.FakeForm = W3C.FakeForm || new Element('form', {'method': 'get'}).injectInside(document.body);
+			W3C.FakeForm.setProperty('action', '#' + hash).submit();
+		} else {
+			window.location.replace('#' + hash);
+			//window.location.hash = '#' + hash;
+		}
+	}
+	
+};
+
+window.addEvent('domready', W3C.start);
\ No newline at end of file
diff -r 47e665677735 -r 7241f9c88845 WebContent/style/init.css
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/WebContent/style/init.css	Sat Jun 12 23:39:11 2010 -0400
@@ -0,0 +1,18 @@
+#init {
+	margin:0 33px;
+}
+#init h1 {
+	/*font-weight:bold;*/
+	font-size:1.2em;
+	margin-bottom:0.2em;
+}
+#init ul {
+	/*margin-left:0.2em;;*/
+	margin-bottom:0.5em;
+}
+#init ul li:before {
+	content:'-';
+}
+#init ul li a {
+	margin-left:0.2em;
+}
\ No newline at end of file

Received on Monday, 14 June 2010 13:25:06 UTC