Find file
Fetching contributors…
Cannot retrieve contributors at this time
182 lines (172 sloc) 7.51 KB
<title>Your Web ID</title>
<link rel="stylesheet" href=""/>
<style type="text/css">
.answer { font-style: italic; color: #00c; text-decoration: underline; }
.tip { font-style: normal; color: #333; margin: 1em;}
.success {background-color: #efe }
.failure {background-color: #fee ; border: 0.1em red}
div.unknown { display:none }
div.yes > div.negative { display: none } > div.affirmative { display: none }
<script type="text/javascript">
gotOne = function() {
var form = document.getElementById("gotWebID");
var webid = form.webid.value;
var tabulator = document.tabulator;
// var tabulator = Components.classes[";1"].getService(Components.interfaces.nsISupports).wrappedJSObject;
tabulator.preferences.set('me', webid);
alert("You ID has been set to "+webid);
tryFoaf = function() {
document.getElementById("saveStatus").className = "unknown";
var form = document.getElementById("socialBootForm");
//alert("Saving to: "+form.fileuri.value);
// Construct the initial FOAF file when the form bellow is submitted
var targetURI = form.fileuri.value;
var foafname = form.foafname.value;
var nick = form.nick.value;
var initials = form.initials.value;
var webid;
var contents = "<rdf:RDF xmlns=''\n"+
" xmlns:rdf=''\n" +
" xmlns:foaf=''>";
if (nick.length > 0) {
webid = targetURI + "#" + nick;
contents += "<Person rdf:about='#"+nick+"'>";
contents += "<nick>"+nick+"</nick>\n";
} else {
webid = targetURI + "#" + initials;
contents += "<Person rdf:about='#"+initials+"'>";
contents += "<name>"+foafname+"</name>\n";
contents += " </Person>\n</rdf:RDF>\n";
// The following only works when this is in chrome://tabultor/content/
var tabulator = Components.classes[";1"].getService(Components.interfaces.nsISupports).wrappedJSObject;
var content_type = "application/rdf+xml";
var xhr = tabulator.util.XMLHTTPFactory();
var doc = document;
xhr.onreadystatechange = function (){
if (xhr.readyState == 4){
//alert('Result: '+xhr.status);
var result = xhr.status
var ele = doc.getElementById("saveStatus");
if (result == '201' || result == '204') {
ele.className = "success";
ele.innerHTML="<p>Success! A new, empty, profile has been created."+
"<br/>Your Web ID is now <br/><b><a target='me' href='"+webid+"'>"+webid+"</a></b>."+
"<br/>You can add more information to your public profile any time.</p>";
tabulator.preferences.set("me", webid);
} else {
ele.className = "failure";
ele.innerHTML="<p>There was a problem saving your public profile." +
"It has not been created." +
"<table>" +
"<tr><td>Status:</td><td>"+result+"</td></tr>" +
"<tr><td>Status text:</td><td>"+xhr.statusText+"</td></tr>" +
"</table>" +
"If you can work out what was wrong with the URI, " +
"you can change it and try again.</p>";
};'PUT', targetURI, true);
//assume the server does PUT content-negotiation.
xhr.setRequestHeader('Content-type', content_type);//OK?
xhr.send(contents);"sending "+"["+contents+"] to +"+targetURI);
<p>Please click on the appropriate answer.</p>
<p>Do you have <a target="explain" href="" >
web ID</a>?<br/>
<p class="answer" onclick="document.getElementById('WebIdHelp').className='tip'">
What is A Web ID?</p>
<div id="WebIdHelp" class="unknown">
<p>A Web ID is a URL for you.
It allows you to set up a public profile, with friends, pictures and all kinds of things.
It works like having an account on a social networking site,
but it isn't restricted to just that site.
It is very open because the information can connect to other people,
organizations and projects and so on, without everyon having to join the same
social networking site.
All you need is some place on the web where you can save a file to.
(<a target='explain' href="">More on the wiki</a>)
<li class="answer" onclick="document.getElementById('WhetherWebId').className='yes'">
Yes, I have a web ID
<li class="answer" onclick="document.getElementById('WhetherWebId').className='no'">
No, I would like to make one
<div id="WhetherWebId" class="unknown">
<div class="affirmative">
<p>What is your Web ID?</p>
<form id="gotWebID" action="none:">
<input name="webid" type="text" size="80" value="http:"/>
<input type="button" value="Use this ID" onclick="gotOne()"/>
<div class="negative">
<p>Ok, Let's make one. Would you like to use your real name, or make it anonymous?</p>
<li class="answer" onclick="document.getElementById('WhetherAnon').className='no'">
I would like to use my real name. (Recommended, for example, for professionals who have
and want public visibility).
<li class="answer" onclick="document.getElementById('WhetherAnon').className='yes'">
I would like to be anonymous. (If you are a child, use this.)
<form id="socialBootForm" action="none:">
<div id="WhetherAnon" class="unknown">
<div class="affirmative">
<p>Think of a handle, or screen name by which you would like to be known.
Or one by which you are already known online.
<input name="nick" type="text" size="40" id="nick_input"/>
<div class="negative">
<p>What is your name? (A full name in the normal order in which you prefer it,
such as Bill Gates, or Marie-Claire Forgue. Normally people omit
prefixes, like Dr., and suffixes, like PhD, but it is up to you.)
<br/><input name="foafname" type="text" size="40" id="foafname_input"/>
<p>Your initials? (These will be used as part of your web ID)
<br/><input name="initials" type="text" size="10" id="initials_input"/>
<p>You need the URI of a file which you can write to on the web.
(The general public should be able to read it but not change it.
The server should support the <em>WebDAV</em> protocol.)<br/>
<!-- -->
<input name="fileuri" type="text" size="80" id="fileuri_input"
<input id="tryFoafButton" type="button" value="Create my new profile" onclickOFF ="tryFoaf()"/>
<div id="saveStatus" class="unknown">