our sharepoint project is integrated into documentum portal. they have some links where they can redirect to sharepoint site. according to ur req when they click on link we redirect to our custom page and build the sharepoint url based on parameters
(when u enable metadata navigation u can filter based on folder or content type..we r building sharepoint url same as like this).
(when u enable metadata navigation u can filter based on folder or content type..we r building sharepoint url same as like this).
Response.Redirect(oSiteUrl + "/_layouts/ops/opsdocumentview.aspx?RootFolder=" + oList.ParentWebUrl + "/" + oList.Title + "/" + oRootFolder + "&TreeField=ContentTypeId&TreeValue=" + oList.ContentTypes[sContentType].Id.ToString() + "#ServerFilter=FilterField1=ContentTypeId-FilterValue1=" + oList.ContentTypes[sContentType].Id.ToString() + "-TreeField=ContentTypeId-TreeValue=" + oList.ContentTypes[sContentType].Id.ToString() + "-OverrideScope=RecursiveAll-ProcessQStringToCAML=1" );
they pass paremeters like foldername and contenttype name. usually editform.aspx shows all content types in the dropdown (u can see edit form after uploading a document in the doc library). here i need to set content type based on parameter.
document library
===================
it has some content types like this
folder1 -- contentype1
contentype2
folder2 -- contentype2
folder3 -- contentype3
_spBodyOnLoadFunctionNames.push("SetContentTypeInDropDown");
//find content type dropdown and returns id
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('ContentTypeChoice')) //get content type id from dropdown
{
return tags[i].id;
}
}
return null;
}
function SetContentTypeInDropDown() {
var cid = querySt("FilterValue1"); //u can see "FilterValue1" when u enable //metadata navigation for doc library
if (cid != null) {
//alert("cid" + cid);
var dropdownid = getTagFromIdentifierAndTitle("select", "Choice", "Content Type");
// alert("dropdownid" + dropdownid);
var dropdown = document.getElementById(dropdownid);
// alert("dropdown"+ dropdown);
if (cid != null) {
for (var i = 0; i < dropdown.options.length; i++) {
if (dropdown.options[i].value == cid) {
dropdown.selectedIndex = i;
dropdown.disabled = true;
this.CustomChangeContentType(dropdownid);
break;
}
else {
//
}
}
}
}
}
//if refreshes the pages when dropdown content types index changes and get the correspoding attributes.
function CustomChangeContentType(d) {
ULSrLq: ;
var b = document.getElementById(d), a = window.location.href, e = a.indexOf("?");
if (a.indexOf("?") <= 0) a = a + "?ContentTypeId=" + b.value;
else if (a.indexOf("&ContentTypeId=") <= 0) a = a + "&ContentTypeId=" + b.value;
else {
var c = /&ContentTypeId=[^&]*/i; a = a.replace(c, "&ContentTypeId=" + b.value)
}
if (a.indexOf("&customparam=1") > 0) {
return false;
}
STSNavigate(a + "&customparam=1");
return false;
}
function querySt(ji) {
//hu = window.location.search.substring(1);
hu = window.parent.location.search.substring(1);
//alert(hu);
gy = hu.split("&");
for (i = 0; i < gy.length; i++) {
ft = gy[i].split("=");
if (ft[0] == ji) {
return ft[1];
}
}
}
No comments:
Post a Comment