Version 3, changed by TimJones. 03/06/2006. Show version history
sys/templateAlternateView for this page is set to view-raw -- this strips all the chrome off to make this page smaller. It's loaded using a dojo.io.bind() call when a tag is clicked.
These pages are available as a package you can install, too.
The "tag this page" link shows a hidden div with a form in it:
<div id="relatedtags-editBox" style="display:none">
<form action="javascript:void()" onSubmit="saveTags(pageTags.value)">
<input type="text" name="pageTags" value="${translate(page/main/tags, '[]', '')}" />
<input type="submit" value="Update tags" />
</form>
</div>
When the submit button is clicked, a dojo call posts the form:
function saveTags(newValue) {
var arr = new Array();
arr["pname1"] = "main/tags";
arr["pvalue1"] = newValue;
var thisPath = "${page/path}";
arr["path"] = thisPath;
arr["form"] = "/TagForm";
dojo.io.bind({
url: dojo.uri.joinPath(djConfig.wikiRootPath, "/_/cmd/saveForm"),
method: "post",
content: arr,
handler: function(type, resp, e) {
if (e) {
window.location.reload(true); //refresh the page
}
},
mimetype: "text/plain"
});
}
When a tag is clicked, a function called updateTagDisplay() gets called, and updates the list of highlighted tags. Then another dojo.io.bind call retrieves the list of pages and inserts it into the document:
function displayRelatedPages (theTags, displayDiv) {
var arr = new Array();
arr["tag"] = theTags;
arr["page"] = "${page/path}";
dojo.io.bind({
url: dojo.uri.joinPath(djConfig.wikiRootPath, "/MultiTagPivot"),
method: "post",
content: arr,
mimetype: "text/xml",
handler: function(type, xml, e) {
if(type == 'load') {
// just throw the whole response text into the div's innerHTML...
// this isn't really ideal, but I had trouble getting at the response in IE otherwise.
document.getElementById(displayDiv).innerHTML = e.responseText;
// make sure the div is visible.
document.getElementById(displayDiv).style.display = 'block';
}
}
});
}