UI: handle roots in the permanode page, show attribute debug at bottom.

Change-Id: Id95b478b7a8c1f3825187ea7b291331be4dbe3f5
This commit is contained in:
Brad Fitzpatrick 2011-07-02 10:36:32 -07:00
parent 5b583ee6e8
commit 66c0e430d0
2 changed files with 32 additions and 5 deletions

View File

@ -62,6 +62,7 @@
<select id='type'>
<option value=''>(None / auto)</option>
<option value='_other'>(Other)</option>
<option value="root">Root (of a hierarchy)</option>
<option value="file">File</option>
<option value="collection">File Collection / Gallery</option>
<option value="microblog">Microblog Post</option>
@ -81,5 +82,8 @@
<pre id="info"></pre>
</div>
<h3>Current object attributes</h3>
<pre id="debugattrs" style="font-size: 8pt"></pre>
</body>
</html>

View File

@ -42,6 +42,7 @@ function handleFormTitleSubmit(e) {
setTimeout(function() {
inputTitle.disabled = false;
btnSaveTitle.disabled = false;
buildPermanodeUi();
}, Math.max(250 - elapsedMs, 0));
},
fail: function(msg) {
@ -155,7 +156,7 @@ function deleteTagFunc(tag, strikeEle, removeEle) {
};
}
function onTypeChange(e) {
function onTypeChange() {
var sel = document.getElementById("type");
var dnd = document.getElementById("dnd");
@ -347,11 +348,33 @@ function onBlobDescribed(jres) {
return;
}
document.getElementById("debugattrs").innerText = JSON.stringify(permanodeObject.attr, null, 2);
var attr = function(name) {
if (!(name in permanodeObject.attr)) {
return null;
}
if (permanodeObject.attr[name].length == 0) {
return null;
}
return permanodeObject.attr[name][0];
};
var disablePublish = false;
var selType = document.getElementById("type");
if (attr("camliRoot")) {
selType.value = "root";
onTypeChange();
disablePublish = true; // can't give a URL to a root with a claim
}
document.getElementById("selectPublishRoot").disabled = disablePublish;
document.getElementById("publishSuffix").disabled = disablePublish;
document.getElementById("btnSavePublish").disabled = disablePublish;
var inputTitle = document.getElementById("inputTitle");
inputTitle.value =
(permanodeObject.attr.title && permanodeObject.attr.title.length == 1) ?
permanodeObject.attr.title[0] :
"";
inputTitle.value = attr("title") ? attr("title") : "";
inputTitle.disabled = false;
var spanTags = document.getElementById("spanTags");