Merge branch 'master' of ssh://camlistore.org:29418/camlistore

This commit is contained in:
Brett Slatkin 2012-12-23 17:52:13 -08:00
commit eb7cfb5a95
14 changed files with 122 additions and 148 deletions

View File

@ -16,8 +16,8 @@ limitations under the License.
// Gets the |p| query parameter, assuming that it looks like a blobref.
function getBlobParam() {
var blobRef = getQueryParam('b');
return (blobRef && isPlausibleBlobRef(blobRef)) ? blobRef : null;
var blobRef = Camli.getQueryParam('b');
return (blobRef && Camli.isPlausibleBlobRef(blobRef)) ? blobRef : null;
}
function blobInfoUpdate(bmap) {
@ -38,7 +38,7 @@ function blobInfoUpdate(bmap) {
if (binfo.camliType || (binfo.type && binfo.type.indexOf("text/") == 0)) {
camliGetBlobContents(blobref, {
success: function(data) {
document.getElementById("blobdata").innerHTML = linkifyBlobRefs(data);
document.getElementById("blobdata").innerHTML = Camli.linkifyBlobRefs(data);
var bb = document.getElementById('blobbrowse');
if (binfo.camliType != "directory") {
bb.style.visibility = 'hidden';
@ -77,7 +77,7 @@ function blobInfoUpdate(bmap) {
claims.style.visibility = "";
camliGetPermanodeClaims(blobref, {
success: function(data) {
document.getElementById("claims").innerHTML = linkifyBlobRefs(JSON.stringify(data, null, 2));
document.getElementById("claims").innerHTML = Camli.linkifyBlobRefs(JSON.stringify(data, null, 2));
},
fail: function(msg) {
alert(msg);

View File

@ -15,7 +15,9 @@ limitations under the License.
*/
// Camli namespace.
var Camli = {};
if (!window.Camli) {
window.Camli = {};
}
function $(id) {
return document.getElementById(id);
@ -43,7 +45,7 @@ function onConfiguration(config) {
Camli.config = config;
}
function saneOpts(opts) {
Camli.saneOpts = function(opts) {
if (!opts) {
opts = {}
}
@ -54,7 +56,7 @@ function saneOpts(opts) {
opts.fail = function() {};
}
return opts;
}
};
// Format |dateVal| as specified by RFC 3339.
function dateToRfc3339String(dateVal) {
@ -75,13 +77,13 @@ function camliDescribeBlob(blobref, opts) {
var path = Camli.config.searchRoot +
"camli/search/describe?blobref=" + blobref;
if (opts.thumbnails != null) {
path = makeURL(path, {thumbnails: opts.thumbnails});
path = Camli.makeURL(path, {thumbnails: opts.thumbnails});
}
xhr.open("GET", path, true);
xhr.send();
}
function makeURL(base, map) {
Camli.makeURL = function(base, map) {
for (var key in map) {
if (base.indexOf("?") == -1) {
base += "?";
@ -91,11 +93,11 @@ function makeURL(base, map) {
base += key + "=" + encodeURIComponent(map[key]);
}
return base;
}
};
function camliPermanodeOfSignerAttrValue(signer, attr, value, opts) {
var xhr = camliJsonXhr("camliPermanodeOfSignerAttrValue", opts);
var path = makeURL(Camli.config.searchRoot + "camli/search/signerattrvalue",
var path = Camli.makeURL(Camli.config.searchRoot + "camli/search/signerattrvalue",
{ signer: signer, attr: attr, value: value });
xhr.open("GET", path, true);
xhr.send();
@ -119,7 +121,7 @@ function camliGetPermanodeClaims(permanode, opts) {
}
function camliGetBlobContents(blobref, opts) {
opts = saneOpts(opts);
opts = Camli.saneOpts(opts);
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
if (xhr.readyState != 4) { return; }
@ -142,7 +144,7 @@ function camliDescribeBlogURL(blobref) {
}
function camliSign(clearObj, opts) {
opts = saneOpts(opts);
opts = Camli.saneOpts(opts);
var sigConf = Camli.config.signing;
if (!sigConf || !sigConf.publicKeyBlobRef) {
camliCondCall(opts.fail, "Missing Camli.config.signing.publicKeyBlobRef");
@ -214,7 +216,7 @@ function camliUploadFile(file, opts) {
// - success: function(fileBlobRef) of the server-validated or
// just-uploaded file schema blob.
function camliUploadFileHelper(file, contentsBlobRef, opts) {
opts = saneOpts(opts);
opts = Camli.saneOpts(opts);
if (!Camli.config.uploadHelper) {
opts.fail("no uploadHelper available");
return
@ -275,7 +277,7 @@ function camliUploadFileHelper(file, contentsBlobRef, opts) {
}
function camliUploadString(s, opts) {
opts = saneOpts(opts);
opts = Camli.saneOpts(opts);
var blobref = "sha1-" + Crypto.SHA1(s);
var parts = [s];
@ -301,7 +303,7 @@ function camliUploadString(s, opts) {
}
function camliCreateNewPermanode(opts) {
opts = saneOpts(opts);
opts = Camli.saneOpts(opts);
var json = {
"camliVersion": 1,
"camliType": "permanode",
@ -326,7 +328,7 @@ function camliCreateNewPermanode(opts) {
// Returns the first value from the query string corresponding to |key|.
// Returns null if the key isn't present.
function getQueryParam(key) {
Camli.getQueryParam = function(key) {
var params = document.location.search.substring(1).split('&');
for (var i = 0; i < params.length; ++i) {
var parts = params[i].split('=');
@ -334,14 +336,14 @@ function getQueryParam(key) {
return decodeURIComponent(parts[1]);
}
return null;
}
};
function camliGetRecentlyUpdatedPermanodes(opts) {
// opts.thumbnails is the maximum size of the thumbnails we want,
// or 0 if no thumbnail.
var path = Camli.config.searchRoot + "camli/search/recent";
if (opts.thumbnails != null) {
path = makeURL(path, {thumbnails: opts.thumbnails});
path = Camli.makeURL(path, {thumbnails: opts.thumbnails});
}
var xhr = camliJsonXhr("camliGetRecentlyUpdatedPermanodes", opts);
xhr.open("GET", path, true);
@ -350,14 +352,14 @@ function camliGetRecentlyUpdatedPermanodes(opts) {
function camliGetPermanodesWithAttr(signer, attr, value, fuzzy, opts) {
var xhr = camliJsonXhr("camliGetPermanodesWithAttr", opts);
var path = makeURL(Camli.config.searchRoot + "camli/search/permanodeattr",
var path = Camli.makeURL(Camli.config.searchRoot + "camli/search/permanodeattr",
{ signer: signer, attr: attr, value: value, fuzzy: fuzzy });
xhr.open("GET", path, true);
xhr.send();
}
function camliXhr(name, opts) {
opts = saneOpts(opts);
opts = Camli.saneOpts(opts);
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
if (xhr.readyState != 4) { return; }
@ -371,7 +373,7 @@ function camliXhr(name, opts) {
}
function camliJsonXhr(name, opts) {
opts = saneOpts(opts);
opts = Camli.saneOpts(opts);
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
if (xhr.readyState != 4) { return; }
@ -409,19 +411,19 @@ function camliFindExistingFileSchemas(wholeDigestRef, opts) {
}
// Returns true if the passed-in string might be a blobref.
function isPlausibleBlobRef(blobRef) {
Camli.isPlausibleBlobRef = function(blobRef) {
return /^\w+-[a-f0-9]+$/.test(blobRef);
}
};
function linkifyBlobRefs(schemaBlob) {
Camli.linkifyBlobRefs = function(schemaBlob) {
var re = /(\w{3,6}-[a-f0-9]{30,})/g;
return schemaBlob.replace(re, "<a href='./?b=$1'>$1</a>");
}
};
// Helper function for camliNewSetAttributeClaim() (and eventually, for
// similar functions to add or delete attributes).
function changeAttribute(permanode, claimType, attribute, value, opts) {
opts = saneOpts(opts);
opts = Camli.saneOpts(opts);
var json = {
"camliVersion": 1,
"camliType": "claim",

View File

@ -20,8 +20,8 @@ var CamliFileTree = {};
// Gets the |d| query parameter, assuming that it looks like a blobref.
function getPermanodeParam() {
var blobRef = getQueryParam('d');
return (blobRef && isPlausibleBlobRef(blobRef)) ? blobRef : null;
var blobRef = Camli.getQueryParam('d');
return (blobRef && Camli.isPlausibleBlobRef(blobRef)) ? blobRef : null;
}
function newPermWithContent(content) {

View File

@ -17,8 +17,8 @@ limitations under the License.
// Gets the |g| query parameter, assuming that it looks like a blobref.
function getPermanodeParam() {
var blobRef = getQueryParam('g');
return (blobRef && isPlausibleBlobRef(blobRef)) ? blobRef : null;
var blobRef = Camli.getQueryParam('g');
return (blobRef && Camli.isPlausibleBlobRef(blobRef)) ? blobRef : null;
}
// pn: child permanode

View File

@ -17,8 +17,8 @@ limitations under the License.
// Gets the |p| query parameter, assuming that it looks like a blobref.
function getPermanodeParam() {
var blobRef = getQueryParam('p');
return (blobRef && isPlausibleBlobRef(blobRef)) ? blobRef : null;
var blobRef = Camli.getQueryParam('p');
return (blobRef && Camli.isPlausibleBlobRef(blobRef)) ? blobRef : null;
}
function handleFormTitleSubmit(e) {

View File

@ -20,9 +20,9 @@ function getSearchParams() {
CamliSearch.query = "";
CamliSearch.type = "";
CamliSearch.fuzzy = "";
CamliSearch.query = getQueryParam('q') || "";
CamliSearch.type = getQueryParam('t') || "";
CamliSearch.fuzzy = getQueryParam('f') || "";
CamliSearch.query = Camli.getQueryParam('q') || "";
CamliSearch.type = Camli.getQueryParam('t') || "";
CamliSearch.fuzzy = Camli.getQueryParam('f') || "";
}
function hideAllResThings() {
@ -237,12 +237,12 @@ function addToCollection(createNew) {
} else {
var pn = document.getElementById("inputCollec").value;
//TODO(mpl): allow a collection title (instead of a hash) as input
if (!isPlausibleBlobRef(pn)) {
if (!Camli.isPlausibleBlobRef(pn)) {
alert("Not a valid collection permanode hash");
return;
}
var returnPn = function(opts) {
opts = saneOpts(opts);
opts = Camli.saneOpts(opts);
opts.success(pn);
}
returnPn(cnpcb);

View File

@ -7,7 +7,7 @@ import "time"
import "camlistore.org/pkg/fileembed"
func init() {
Files.Add("blobinfo.js", 4238, fileembed.String("/*\n"+
Files.Add("blobinfo.js", 4262, fileembed.String("/*\n"+
"Copyright 2011 Google Inc.\n"+
"\n"+
"Licensed under the Apache License, Version 2.0 (the \"License\");\n"+
@ -25,8 +25,8 @@ func init() {
"\n"+
"// Gets the |p| query parameter, assuming that it looks like a blobref.\n"+
"function getBlobParam() {\n"+
" var blobRef = getQueryParam('b');\n"+
" return (blobRef && isPlausibleBlobRef(blobRef)) ? blobRef : null;\n"+
" var blobRef = Camli.getQueryParam('b');\n"+
" return (blobRef && Camli.isPlausibleBlobRef(blobRef)) ? blobRef : null;\n"+
"}\n"+
"\n"+
"function blobInfoUpdate(bmap) {\n"+
@ -47,8 +47,8 @@ func init() {
" if (binfo.camliType || (binfo.type && binfo.type.indexOf(\"text/\") == 0)) {\n"+
" camliGetBlobContents(blobref, {\n"+
" success: function(data) {\n"+
" document.getElementById(\"blobdata\").innerHTML = linkifyBlobRe"+
"fs(data);\n"+
" document.getElementById(\"blobdata\").innerHTML = Camli.linkify"+
"BlobRefs(data);\n"+
" var bb = document.getElementById('blobbrowse');\n"+
" if (binfo.camliType != \"directory\") {\n"+
" bb.style.visibility = 'hidden';\n"+
@ -91,8 +91,8 @@ func init() {
" claims.style.visibility = \"\";\n"+
" camliGetPermanodeClaims(blobref, {\n"+
" success: function(data) {\n"+
" document.getElementById(\"claims\").innerHTML = linkifyBlobRefs"+
"(JSON.stringify(data, null, 2));\n"+
" document.getElementById(\"claims\").innerHTML = Camli.linkifyBl"+
"obRefs(JSON.stringify(data, null, 2));\n"+
" },\n"+
" fail: function(msg) {\n"+
" alert(msg);\n"+
@ -123,5 +123,5 @@ func init() {
"}\n"+
"\n"+
"window.addEventListener(\"load\", blobInfoOnLoad);\n"+
""), time.Unix(0, 1355268804490766485))
""), time.Unix(0, 1356312744000000000))
}

View File

@ -7,7 +7,7 @@ import "time"
import "camlistore.org/pkg/fileembed"
func init() {
Files.Add("camli.js", 18039, fileembed.String("/*\n"+
Files.Add("camli.js", 17153, fileembed.String("/*\n"+
"Copyright 2011 Google Inc.\n"+
"\n"+
"Licensed under the Apache License, Version 2.0 (the \"License\");\n"+
@ -24,14 +24,14 @@ func init() {
"*/\n"+
"\n"+
"// Camli namespace.\n"+
"var Camli = {};\n"+
"if (!window.Camli) {\n"+
" window.Camli = {};\n"+
"}\n"+
"\n"+
"function $(id) {\n"+
" return document.getElementById(id);\n"+
"}\n"+
"\n"+
"var disco = null; // TODO: kill this in favor of Camli.config.\n"+
"\n"+
"// innerText is not W3C compliant and does not work with firefox.\n"+
"// textContent does not work with IE.\n"+
"// setTextContent should work with all browsers.\n"+
@ -51,11 +51,10 @@ func init() {
"\n"+
"// Method 1 to get discovery information (JSONP style):\n"+
"function onConfiguration(config) {\n"+
" Camli.config = disco = config;\n"+
" console.log(\"Got config: \" + JSON.stringify(config));\n"+
" Camli.config = config;\n"+
"}\n"+
"\n"+
"function saneOpts(opts) {\n"+
"Camli.saneOpts = function(opts) {\n"+
" if (!opts) {\n"+
" opts = {}\n"+
" }\n"+
@ -66,7 +65,7 @@ func init() {
" opts.fail = function() {};\n"+
" }\n"+
" return opts;\n"+
"}\n"+
"};\n"+
"\n"+
"// Format |dateVal| as specified by RFC 3339.\n"+
"function dateToRfc3339String(dateVal) {\n"+
@ -77,46 +76,25 @@ func init() {
" numStr = \"0\" + numStr;\n"+
" }\n"+
" return numStr;\n"+
" }\n"+
" };\n"+
" return dateVal.getUTCFullYear() + \"-\" + pad(dateVal.getUTCMonth() + 1, 2) + \""+
"-\" + pad(dateVal.getUTCDate(), 2) + \"T\" +\n"+
" pad(dateVal.getUTCHours(), 2) + \":\" + pad(dateVal.getUTCMinutes(), 2) "+
"+ \":\" + pad(dateVal.getUTCSeconds(), 2) + \"Z\";\n"+
"}\n"+
"\n"+
"var cachedCamliSigDiscovery;\n"+
"\n"+
"// opts.success called with discovery object\n"+
"// opts.fail called with error text\n"+
"function camliSigDiscovery(opts) {\n"+
" opts = saneOpts(opts);\n"+
" if (cachedCamliSigDiscovery) {\n"+
" opts.success(cachedCamliSigDiscovery);\n"+
" return;\n"+
" }\n"+
" var cb = {};\n"+
" cb.success = function(sd) {\n"+
" cachedCamliSigDiscovery = sd;\n"+
" opts.success(sd);\n"+
" };\n"+
" cb.fail = opts.fail;\n"+
" var xhr = camliJsonXhr(\"camliSigDiscovery\", cb);\n"+
" xhr.open(\"GET\", Camli.config.jsonSignRoot + \"/camli/sig/discovery\", true);\n"+
" xhr.send();\n"+
"}\n"+
"\n"+
"function camliDescribeBlob(blobref, opts) {\n"+
" var xhr = camliJsonXhr(\"camliDescribeBlob\", opts);\n"+
" var path = Camli.config.searchRoot +\n"+
" \"camli/search/describe?blobref=\" + blobref;\n"+
" if (opts.thumbnails != null) {\n"+
" path = makeURL(path, {thumbnails: opts.thumbnails});\n"+
" path = Camli.makeURL(path, {thumbnails: opts.thumbnails});\n"+
" }\n"+
" xhr.open(\"GET\", path, true);\n"+
" xhr.send();\n"+
"}\n"+
"\n"+
"function makeURL(base, map) {\n"+
"Camli.makeURL = function(base, map) {\n"+
" for (var key in map) {\n"+
" if (base.indexOf(\"?\") == -1) {\n"+
" base += \"?\";\n"+
@ -126,11 +104,12 @@ func init() {
" base += key + \"=\" + encodeURIComponent(map[key]);\n"+
" }\n"+
" return base;\n"+
"}\n"+
"};\n"+
"\n"+
"function camliPermanodeOfSignerAttrValue(signer, attr, value, opts) {\n"+
" var xhr = camliJsonXhr(\"camliPermanodeOfSignerAttrValue\", opts);\n"+
" var path = makeURL(Camli.config.searchRoot + \"camli/search/signerattrvalue\",\n"+
" var path = Camli.makeURL(Camli.config.searchRoot + \"camli/search/signerattrva"+
"lue\",\n"+
" { signer: signer, attr: attr, value: value });\n"+
" xhr.open(\"GET\", path, true);\n"+
" xhr.send();\n"+
@ -154,7 +133,7 @@ func init() {
"}\n"+
"\n"+
"function camliGetBlobContents(blobref, opts) {\n"+
" opts = saneOpts(opts);\n"+
" opts = Camli.saneOpts(opts);\n"+
" var xhr = new XMLHttpRequest();\n"+
" xhr.onreadystatechange = function() {\n"+
" if (xhr.readyState != 4) { return; }\n"+
@ -177,36 +156,28 @@ func init() {
"}\n"+
"\n"+
"function camliSign(clearObj, opts) {\n"+
" opts = saneOpts(opts);\n"+
" opts = Camli.saneOpts(opts);\n"+
" var sigConf = Camli.config.signing;\n"+
" if (!sigConf || !sigConf.publicKeyBlobRef) {\n"+
" camliCondCall(opts.fail, \"Missing Camli.config.signing.publicKeyBlobRef\");\n"+
" return;\n"+
" }\n"+
"\n"+
" camliSigDiscovery(\n"+
" {\n"+
" success: function(sigConf) {\n"+
" if (!sigConf.publicKeyBlobRef) {\n"+
" opts.fail(\"Missing sigConf.publicKeyBlobRef\");\n"+
" return;\n"+
" }\n"+
" clearObj.camliSigner = sigConf.publicKeyBlobRef;\n"+
" clearText = JSON.stringify(clearObj, null, 2);\n"+
" clearObj.camliSigner = sigConf.publicKeyBlobRef;\n"+
" clearText = JSON.stringify(clearObj, null, 2);\n"+
"\n"+
" var xhr = new XMLHttpRequest();\n"+
" xhr.onreadystatechange = function() {\n"+
" if (xhr.readyState != 4) { return; }\n"+
" if (xhr.status != 200) {\n"+
" opts.fail(\"got status \" + xhr.status);\n"+
" return;\n"+
" }\n"+
" opts.success(xhr.responseText);\n"+
" };\n"+
" xhr.open(\"POST\", sigConf.signHandler, true);\n"+
" xhr.setRequestHeader(\"Content-Type\", \"application/x-www-form-urle"+
"ncoded\");\n"+
" xhr.send(\"json=\" + encodeURIComponent(clearText));\n"+
" },\n"+
" fail: function(errMsg) {\n"+
" opts.fail(errMsg);\n"+
" }\n"+
" });\n"+
" var xhr = new XMLHttpRequest();\n"+
" xhr.onreadystatechange = function() {\n"+
" if (xhr.readyState != 4) { return; }\n"+
" if (xhr.status != 200) {\n"+
" opts.fail(\"got status \" + xhr.status);\n"+
" return;\n"+
" }\n"+
" opts.success(xhr.responseText);\n"+
" };\n"+
" xhr.open(\"POST\", sigConf.signHandler, true);\n"+
" xhr.setRequestHeader(\"Content-Type\", \"application/x-www-form-urlencoded\");\n"+
" xhr.send(\"json=\" + encodeURIComponent(clearText));\n"+
"}\n"+
"\n"+
"// camliUploadFile uploads a file and returns a file schema. It does not create\n"+
@ -261,7 +232,7 @@ func init() {
"// - success: function(fileBlobRef) of the server-validated or\n"+
"// just-uploaded file schema blob.\n"+
"function camliUploadFileHelper(file, contentsBlobRef, opts) {\n"+
" opts = saneOpts(opts);\n"+
" opts = Camli.saneOpts(opts);\n"+
" if (!Camli.config.uploadHelper) {\n"+
" opts.fail(\"no uploadHelper available\");\n"+
" return\n"+
@ -327,7 +298,7 @@ func init() {
"}\n"+
"\n"+
"function camliUploadString(s, opts) {\n"+
" opts = saneOpts(opts);\n"+
" opts = Camli.saneOpts(opts);\n"+
" var blobref = \"sha1-\" + Crypto.SHA1(s);\n"+
" var parts = [s];\n"+
"\n"+
@ -353,7 +324,7 @@ func init() {
"}\n"+
"\n"+
"function camliCreateNewPermanode(opts) {\n"+
" opts = saneOpts(opts);\n"+
" opts = Camli.saneOpts(opts);\n"+
" var json = {\n"+
" \"camliVersion\": 1,\n"+
" \"camliType\": \"permanode\",\n"+
@ -378,7 +349,7 @@ func init() {
"\n"+
"// Returns the first value from the query string corresponding to |key|.\n"+
"// Returns null if the key isn't present.\n"+
"function getQueryParam(key) {\n"+
"Camli.getQueryParam = function(key) {\n"+
" var params = document.location.search.substring(1).split('&');\n"+
" for (var i = 0; i < params.length; ++i) {\n"+
" var parts = params[i].split('=');\n"+
@ -386,14 +357,14 @@ func init() {
" return decodeURIComponent(parts[1]);\n"+
" }\n"+
" return null;\n"+
"}\n"+
"};\n"+
"\n"+
"function camliGetRecentlyUpdatedPermanodes(opts) {\n"+
" // opts.thumbnails is the maximum size of the thumbnails we want,\n"+
" // or 0 if no thumbnail.\n"+
" var path = Camli.config.searchRoot + \"camli/search/recent\";\n"+
" if (opts.thumbnails != null) {\n"+
" path = makeURL(path, {thumbnails: opts.thumbnails});\n"+
" path = Camli.makeURL(path, {thumbnails: opts.thumbnails});\n"+
" }\n"+
" var xhr = camliJsonXhr(\"camliGetRecentlyUpdatedPermanodes\", opts);\n"+
" xhr.open(\"GET\", path, true);\n"+
@ -402,7 +373,8 @@ func init() {
"\n"+
"function camliGetPermanodesWithAttr(signer, attr, value, fuzzy, opts) {\n"+
" var xhr = camliJsonXhr(\"camliGetPermanodesWithAttr\", opts);\n"+
" var path = makeURL(Camli.config.searchRoot + \"camli/search/permanodeattr\",\n"+
" var path = Camli.makeURL(Camli.config.searchRoot + \"camli/search/permanodeatt"+
"r\",\n"+
" { signer: signer, attr: attr, value: value, fuzzy: fuzzy }"+
");\n"+
" xhr.open(\"GET\", path, true);\n"+
@ -410,7 +382,7 @@ func init() {
"}\n"+
"\n"+
"function camliXhr(name, opts) {\n"+
" opts = saneOpts(opts);\n"+
" opts = Camli.saneOpts(opts);\n"+
" var xhr = new XMLHttpRequest();\n"+
" xhr.onreadystatechange = function() {\n"+
" if (xhr.readyState != 4) { return; }\n"+
@ -425,7 +397,7 @@ func init() {
"}\n"+
"\n"+
"function camliJsonXhr(name, opts) {\n"+
" opts = saneOpts(opts);\n"+
" opts = Camli.saneOpts(opts);\n"+
" var xhr = new XMLHttpRequest();\n"+
" xhr.onreadystatechange = function() {\n"+
" if (xhr.readyState != 4) { return; }\n"+
@ -466,19 +438,19 @@ func init() {
"}\n"+
"\n"+
"// Returns true if the passed-in string might be a blobref.\n"+
"function isPlausibleBlobRef(blobRef) {\n"+
"Camli.isPlausibleBlobRef = function(blobRef) {\n"+
" return /^\\w+-[a-f0-9]+$/.test(blobRef);\n"+
"}\n"+
"};\n"+
"\n"+
"function linkifyBlobRefs(schemaBlob) {\n"+
"Camli.linkifyBlobRefs = function(schemaBlob) {\n"+
" var re = /(\\w{3,6}-[a-f0-9]{30,})/g;\n"+
" return schemaBlob.replace(re, \"<a href='./?b=$1'>$1</a>\");\n"+
"}\n"+
"};\n"+
"\n"+
"// Helper function for camliNewSetAttributeClaim() (and eventually, for\n"+
"// similar functions to add or delete attributes).\n"+
"function changeAttribute(permanode, claimType, attribute, value, opts) {\n"+
" opts = saneOpts(opts);\n"+
" opts = Camli.saneOpts(opts);\n"+
" var json = {\n"+
" \"camliVersion\": 1,\n"+
" \"camliType\": \"claim\",\n"+
@ -567,5 +539,5 @@ func init() {
" }\n"+
" fn.apply(null, Array.prototype.slice.call(arguments, 1));\n"+
"}\n"+
""), time.Unix(0, 1355276661678717406))
""), time.Unix(0, 1356312734000000000))
}

View File

@ -7,7 +7,7 @@ import "time"
import "camlistore.org/pkg/fileembed"
func init() {
Files.Add("debug.js", 2615, fileembed.String("/*\n"+
Files.Add("debug.js", 2645, fileembed.String("/*\n"+
"Copyright 2011 Google Inc.\n"+
"\n"+
"Licensed under the Apache License, Version 2.0 (the \"License\");\n"+
@ -67,9 +67,9 @@ func init() {
" }\n"+
" formSearch.addEventListener(\"submit\", handleFormSearch);\n"+
"\n"+
" if (disco && disco.uploadHelper) {\n"+
" if (Camli && Camli.config && Camli.config.uploadHelper) {\n"+
" var uploadForm = document.getElementById(\"uploadform\");\n"+
" uploadForm.action = disco.uploadHelper;\n"+
" uploadForm.action = Camli.config.uploadHelper;\n"+
" document.getElementById(\"fileinput\").disabled = false;\n"+
" document.getElementById(\"filesubmit\").disabled = false;\n"+
" }\n"+
@ -90,5 +90,5 @@ func init() {
"}\n"+
"\n"+
"window.addEventListener(\"load\", indexOnLoad);\n"+
""), time.Unix(0, 1355269608387953882))
""), time.Unix(0, 1356311931000000000))
}

View File

@ -7,7 +7,7 @@ import "time"
import "camlistore.org/pkg/fileembed"
func init() {
Files.Add("filetree.js", 4703, fileembed.String("/*\n"+
Files.Add("filetree.js", 4715, fileembed.String("/*\n"+
"Copyright 2011 Google Inc.\n"+
"\n"+
"Licensed under the Apache License, Version 2.0 (the \"License\");\n"+
@ -29,8 +29,8 @@ func init() {
"// Gets the |d| query parameter, assuming that it looks like a blobref.\n"+
"\n"+
"function getPermanodeParam() {\n"+
" var blobRef = getQueryParam('d');\n"+
" return (blobRef && isPlausibleBlobRef(blobRef)) ? blobRef : null;\n"+
" var blobRef = Camli.getQueryParam('d');\n"+
" return (blobRef && Camli.isPlausibleBlobRef(blobRef)) ? blobRef : null;\n"+
"}\n"+
"\n"+
"function newPermWithContent(content) {\n"+
@ -175,5 +175,5 @@ func init() {
"}\n"+
"\n"+
"window.addEventListener(\"load\", treePageOnLoad);\n"+
""), time.Unix(0, 1351526710072999389))
""), time.Unix(0, 1356312762000000000))
}

View File

@ -7,7 +7,7 @@ import "time"
import "camlistore.org/pkg/fileembed"
func init() {
Files.Add("gallery.js", 3012, fileembed.String("/*\n"+
Files.Add("gallery.js", 3024, fileembed.String("/*\n"+
"Copyright 2011 Google Inc.\n"+
"\n"+
"Licensed under the Apache License, Version 2.0 (the \"License\");\n"+
@ -26,8 +26,8 @@ func init() {
"// Gets the |g| query parameter, assuming that it looks like a blobref.\n"+
"\n"+
"function getPermanodeParam() {\n"+
" var blobRef = getQueryParam('g');\n"+
" return (blobRef && isPlausibleBlobRef(blobRef)) ? blobRef : null;\n"+
" var blobRef = Camli.getQueryParam('g');\n"+
" return (blobRef && Camli.isPlausibleBlobRef(blobRef)) ? blobRef : null;\n"+
"}\n"+
"\n"+
"// pn: child permanode\n"+
@ -108,5 +108,5 @@ func init() {
"}\n"+
"\n"+
"window.addEventListener(\"load\", galleryPageOnLoad);\n"+
""), time.Unix(0, 1349725494193783184))
""), time.Unix(0, 1356312768000000000))
}

View File

@ -367,5 +367,5 @@ func init() {
"};\n"+
"\n"+
"window.addEventListener(\"load\", CamliIndexPage.onLoad);\n"+
""), time.Unix(0, 1355283166976208867))
""), time.Unix(0, 1356311255000000000))
}

View File

@ -7,7 +7,7 @@ import "time"
import "camlistore.org/pkg/fileembed"
func init() {
Files.Add("permanode.js", 21256, fileembed.String("/*\n"+
Files.Add("permanode.js", 21268, fileembed.String("/*\n"+
"Copyright 2011 Google Inc.\n"+
"\n"+
"Licensed under the Apache License, Version 2.0 (the \"License\");\n"+
@ -26,8 +26,8 @@ func init() {
"// Gets the |p| query parameter, assuming that it looks like a blobref.\n"+
"\n"+
"function getPermanodeParam() {\n"+
" var blobRef = getQueryParam('p');\n"+
" return (blobRef && isPlausibleBlobRef(blobRef)) ? blobRef : null;\n"+
" var blobRef = Camli.getQueryParam('p');\n"+
" return (blobRef && Camli.isPlausibleBlobRef(blobRef)) ? blobRef : null;\n"+
"}\n"+
"\n"+
"function handleFormTitleSubmit(e) {\n"+
@ -681,5 +681,5 @@ func init() {
"}\n"+
"\n"+
"window.addEventListener(\"load\", permanodePageOnLoad);\n"+
""), time.Unix(0, 1354837534181168310))
""), time.Unix(0, 1356312773000000000))
}

View File

@ -7,7 +7,7 @@ import "time"
import "camlistore.org/pkg/fileembed"
func init() {
Files.Add("search.js", 7604, fileembed.String("/*\n"+
Files.Add("search.js", 7634, fileembed.String("/*\n"+
"Copyright 2011 Google Inc.\n"+
"\n"+
"Licensed under the Apache License, Version 2.0 (the \"License\");\n"+
@ -29,9 +29,9 @@ func init() {
" CamliSearch.query = \"\";\n"+
" CamliSearch.type = \"\";\n"+
" CamliSearch.fuzzy = \"\";\n"+
" CamliSearch.query = getQueryParam('q') || \"\";\n"+
" CamliSearch.type = getQueryParam('t') || \"\";\n"+
" CamliSearch.fuzzy = getQueryParam('f') || \"\";\n"+
" CamliSearch.query = Camli.getQueryParam('q') || \"\";\n"+
" CamliSearch.type = Camli.getQueryParam('t') || \"\";\n"+
" CamliSearch.fuzzy = Camli.getQueryParam('f') || \"\";\n"+
"}\n"+
"\n"+
"function hideAllResThings() {\n"+
@ -252,12 +252,12 @@ func init() {
" } else {\n"+
" var pn = document.getElementById(\"inputCollec\").value;\n"+
"//TODO(mpl): allow a collection title (instead of a hash) as input\n"+
" if (!isPlausibleBlobRef(pn)) {\n"+
" if (!Camli.isPlausibleBlobRef(pn)) {\n"+
" alert(\"Not a valid collection permanode hash\");\n"+
" return;\n"+
" }\n"+
" var returnPn = function(opts) {\n"+
" opts = saneOpts(opts);\n"+
" opts = Camli.saneOpts(opts);\n"+
" opts.success(pn);\n"+
" }\n"+
" returnPn(cnpcb);\n"+
@ -288,5 +288,5 @@ func init() {
"}\n"+
"\n"+
"window.addEventListener(\"load\", indexOnLoad);\n"+
""), time.Unix(0, 1353028462610912719))
""), time.Unix(0, 1356312785000000000))
}