_spBodyOnLoadFunctionNames.push("hideMenuItems");
function hideMenuItems() {
//alert("hideMenuItems");
var contenttype = document.getElementById('<%=hdnCType.ClientID %>').value;
//gets content type menu items
var menuid = getTagFromIdentifierAndTitle("menu", "ServerMenu", "toolBarTbl_RptControls");
if (menuid != null) {
var menu = document.getElementById(menuid);
for (var i = 0; i < menu.childNodes.length; i++) {
var child = menu.childNodes[i];
if (child.text == contenttype) {
//it wont hide matching content type
}
else {
//menu.removeChild(child);
// if (child.text != 'Folder') {
child.hidden = true; // hides all content types
// }
}
}
}
}
function getTagFromIdentifierAndTitle(tagName, identifier, title) {
var len = identifier.length;
var tags = document.getElementsByTagName(tagName);
for (var i = 0; i < tags.length; i++) {
var tempString = tags[i].id;
if (tempString.match(title)) {
return tags[i].id;
}
}
return null;
}
No comments:
Post a Comment