var StrNewNamespace="http://schemas.microsoft.com/WebPart/v2"; function SplitIndex(Index) { var sPropURN=""; var sPropName=""; var pos=Index.lastIndexOf("#"); if( -1==pos ) { pos=Index.lastIndexOf(":"); } if( -1==pos ) { sPropName=Index; } else { sPropName=Index.substring(pos+1, Index.length); sPropURN=Index.substring(0, pos); } var Splitted={PropURN : sPropURN, PropName : sPropName}; return Splitted; } function String2XML(Value) { var XMLString=""; var re=/&/g; XMLString=Value.replace(re,"&"); re=//g; XMLString=XMLString.replace(re,">"); re=/"/g; XMLString=XMLString.replace(re,"""); re=/'/g; XMLString=XMLString.replace(re,"'"); return XMLString; } function URL2Unicode(strURL) { return Utf8ToUnicode(unescape(strURL)); } function Unicode2URL(strUnicode) { return URLEncode(strUnicode); } function URLEncode(strURL) { var strSpecialUrl=" <>\"#%{}|^~[]`'&?+="; var strEncode=""; var i; var chUrl; var iCode; strURL+=""; for (i=0; i=(1<>1; BitLen+=5; ByteLen++; } for( i=0; i < ByteLen; i++) { var Code=0x80 | (UniCode & 0x3f); UniCode=UniCode >>> 6; if( i==ByteLen-1 ) { Code |=FirstByte; } UTFCode="%"+Code.toString(16).toUpperCase()+UTFCode; } return UTFCode; } function Utf8ToUnicode(strUtf8) { if(strUtf8==null) { return ""; } var bstr=""; var nTotalChars=strUtf8.length; var nOffset=0; var nRemainingBytes=nTotalChars; var nOutputPosition=0; var iCode, iCode1, iCode2; while (nOffset < nTotalChars) { iCode=strUtf8.charCodeAt(nOffset); if ((iCode & 0x80)==0) { if ( nRemainingBytes < 1 ) { break; } bstr+=String.fromCharCode(iCode & 0x7F); nOffset++; nRemainingBytes -=1; } else if ((iCode & 0xE0)==0xC0) { iCode1=strUtf8.charCodeAt(nOffset+1); if ( nRemainingBytes < 2 || (iCode1 & 0xC0) !=0x80 ) { break; } bstr+=String.fromCharCode(((iCode & 0x3F) << 6) | (iCode1 & 0x3F)); nOffset+=2; nRemainingBytes -=2; } else if ((iCode & 0xF0)==0xE0) { iCode1=strUtf8.charCodeAt(nOffset+1); iCode2=strUtf8.charCodeAt(nOffset+2); if ( nRemainingBytes < 3 || (iCode1 & 0xC0) !=0x80 || (iCode2 & 0xC0) !=0x80 ) { break; } bstr+=String.fromCharCode(((iCode & 0x0F) << 12) | ((iCode1 & 0x3F) << 6) | (iCode2 & 0x3F)); nOffset+=3; nRemainingBytes -=3; } else { break; } } if (0 !=nRemainingBytes) { bstr=""; } return bstr; } function SPSoapRequestBuilder(functionName) { var object=new Object(); function AddParameter(parameterName, parameterValue) { var index=this.parameterNameList.length; this.parameterNameList[index]=parameterName; this.parameterValueList[index]=parameterValue; } function SendSOAPMessage(xmlhttp) { var funcName=this.functionName; var paramNames=this.parameterNameList; var paramValues=this.parameterValueList; xmlhttp.setRequestHeader("Content-Type", "text/xml; charset=utf-8"); xmlhttp.setRequestHeader("SOAPAction", "http://microsoft.com/sharepoint/webpartpages/"+funcName); var soapData=''+ ''+ ''+ '<'+funcName+' xmlns="http://microsoft.com/sharepoint/webpartpages">'; for(var i=0; i < paramNames.length; i++) { var soapParam=(typeof(paramValues[i])=="string") ? String2XML(paramValues[i]) : paramValues[i]; soapData+='<'+paramNames[i]+'>'+soapParam+''; } soapData+=''+ ''+ '' xmlhttp.Send(soapData); return xmlhttp; } object.functionName=functionName; object.parameterNameList=new Array(); object.parameterValueList=new Array(); object.AddParameter=AddParameter; object.SendSOAPMessage=SendSOAPMessage; return object; } function Collection() { function Item(Index) { var Obj=null; if(Index !=null) { var realIndex=parseInt(Index); if (!isNaN(realIndex) && realIndex >=0 && realIndex < this.length) Obj=this[realIndex]; } return Obj; } function Find(Object) { var i; var obj=null; for (i=0; i=0 && realIndex < this.length) { for (i=realIndex; i"+String2XML(propertyNode.Value.toString())+""; } function Save(async, callBack) { if(!this.Properties.PropertiesLoaded) { return; } var partXml=null; if (this.Properties.IsWebPartFile) { var xmlDoc=this.Properties.ResponseXML; if (null !=xmlDoc) { var propertiesElement=xmlDoc.selectSingleNode("\webParts/webPart/data/properties") if (null !=propertiesElement) { var properties=propertiesElement.selectNodes("\property"); if (null !=properties) { var index=properties.length; while(index > 0) { --index; propertiesElement.removeChild(properties[index]); } } for(var index=0; index < this.Properties.length; index++) { var propNode=this.Properties[index]; var xmlAttribute; var propertyElement=xmlDoc.createElement("property"); xmlAttribute=xmlDoc.createAttribute("name"); xmlAttribute.value=String2XML(propNode.SchemaElement); propertyElement.setAttributeNode(xmlAttribute); if (null !=propNode.Type) { xmlAttribute=xmlDoc.createAttribute("type"); xmlAttribute.value=String2XML(propNode.Type); propertyElement.setAttributeNode(xmlAttribute); } xmlAttribute=xmlDoc.createAttribute("xmlns"); xmlAttribute.value="http://schemas.microsoft.com/WebPart/v3"; propertyElement.setAttributeNode(xmlAttribute); propertyElement.text=String2XML(propNode.Value.toString()); propertiesElement.appendChild(propertyElement); } } partXml=xmlDoc.xml; } } else { partXml=""+ GetPropertyDwpXmlString(this.Properties.AssemblyInfo)+ GetPropertyDwpXmlString(this.Properties.TypeNameInfo); for(var index=0; index < this.Properties.length; index++) { partXml+=GetPropertyDwpXmlString(this.Properties[index]); } partXml+=""; } try { var varPart=eval('varPart'+this.WebPartQualifier); var xmlhttp=new ActiveXObject('Microsoft.XMLHTTP'); this.xmlhttp=xmlhttp; varPart.callBackUsed=false; var postDataUrl=GetUrlFromWebUrlAndWebRelativeUrl( WPSC.WebPartPage.WebServerRelativeURL, "_vti_bin/WebPartPages.asmx"); xmlhttp.Open('POST', postDataUrl,(async !=true) ? false : true); if (callBack !=null) { this.callBackFunction=callBack; xmlhttp.onreadystatechange=new Function("varPart"+this.WebPartQualifier+".SaveHandler()"); } var soapBuilder=SPSoapRequestBuilder("SaveWebPart2"); soapBuilder.AddParameter("pageUrl", document.location.href); soapBuilder.AddParameter("storageKey", this.StorageKey); soapBuilder.AddParameter("webPartXml", partXml); soapBuilder.AddParameter("storage", 'None'); soapBuilder.AddParameter("allowTypeChange", 'false'); soapBuilder.SendSOAPMessage(xmlhttp); } catch(exception) { var varPart=eval('varPart'+this.WebPartQualifier); if(callBack !=null && varPart.callBackUsed !=true) { callBack(false, ""); varPart.callBackUsed=true; } } } function SaveHandler() { var varPart=eval('varPart'+this.WebPartQualifier); if(this.xmlhttp.readyState==4 && this.callBackFunction !=null && varPart.callBackUsed !=true) { var saveSucceeded=(this.xmlhttp.responseXML.getElementsByTagName("SaveWebPart2Response")[0] !=null); var soapStatus=this.xmlhttp.status; var soapExceptionText=""; if(!saveSucceeded) { var soapException=this.xmlhttp.responseXML.getElementsByTagName("soap:Fault")[0]; if(soapException !=null) { var soapExceptionTextXml=soapException.getElementsByTagName("detail")[0]; if(soapExceptionTextXml !=null) { soapExceptionText=soapExceptionTextXml.text; } } } varPart.callBackUsed=true; this.callBackFunction(saveSucceeded, soapExceptionText, soapStatus); } } this.SaveHandler=SaveHandler; this.DOMObject=DOMObject; this.WebPartQualifier=WebPartQualifier; this.StorageKey=StorageKey; this.Properties=new PropColDef(); this.Properties.Owner=this; this.Save=Save; } function PropertyDef(URN, SchemaElement, Value,Type) { this.OriginalValue=Value; this.NamespaceURN=URN; this.SchemaElement=SchemaElement; this.Value=Value; this.Type=Type; } function PropColDef() { var PropCol=new Collection(); function GetPropCol(ItemID, bGlobal) { var returnValues=new Array(); try { var xmlhttp=new ActiveXObject('Microsoft.XMLHTTP'); if (xmlhttp==null) return; var postDataUrl=GetUrlFromWebUrlAndWebRelativeUrl( WPSC.WebPartPage.WebServerRelativeURL, "_vti_bin/WebPartPages.asmx"); xmlhttp.Open('POST', postDataUrl, false); var soapBuilder=SPSoapRequestBuilder("GetWebPart2"); soapBuilder.AddParameter("pageurl", document.location.href); soapBuilder.AddParameter("storageKey", ItemID); soapBuilder.AddParameter("storage", 'None'); soapBuilder.AddParameter("behavior", 'Version3'); soapBuilder.SendSOAPMessage(xmlhttp); xmlhttp.responseXML.loadXML(xmlhttp.responseXML.text); var dwpWebPartElement=null; var isDwpFile=false; var webPartWebPartElement=null; var isWebPartFile=false; var dwpWebPartElements=xmlhttp.responseXML.getElementsByTagName("WebPart"); if (null !=dwpWebPartElements && dwpWebPartElements.length > 0) { dwpWebPartElement=dwpWebPartElements[0]; if (dwpWebPartElement.namespaceURI=="http://schemas.microsoft.com/WebPart/v2") { isDwpFile=true; } } if (false==isDwpFile) { var webPartWebPartElements=xmlhttp.responseXML.getElementsByTagName("webPart"); if (null !=webPartWebPartElements && webPartWebPartElements.length > 0) { webPartWebPartElement=webPartWebPartElements[0]; if (webPartWebPartElement.namespaceURI=="http://schemas.microsoft.com/WebPart/v3") { isWebPartFile=true; } } } returnValues.IsWebPartFile=isWebPartFile; if (isWebPartFile) { var propertiesElement=webPartWebPartElement.selectSingleNode("\data/properties"); if (null !=propertiesElement) { var properties=propertiesElement.selectNodes("\property"); if (null !=properties) { for(var index=0; index < properties.length; index++) { var property=properties[index]; var nameAttributeValue=property.getAttributeNode("name").value; var typeAttributeValue=null; var typeAttribute=property.getAttributeNode("type"); if (null !=typeAttribute) { typeAttributeValue=typeAttribute.value; } var nodeValue=property.nodeTypedValue; var prop=new PropertyDef("" ,nameAttributeValue,nodeValue,typeAttributeValue); returnValues[returnValues.length]=prop; } } } returnValues.ResponseXML=xmlhttp.responseXML; } else if(isDwpFile) { var propertiesListXML=dwpWebPartElement.childNodes; for(var index=0; index < propertiesListXML.length; index++) { var node=propertiesListXML.item(index); var prop=new PropertyDef(node.namespaceURI, node.baseName, node.nodeTypedValue,null); returnValues[returnValues.length]=prop; } } else { alert(MSOStrings.GetPropertiesFailure); } } catch (e) { alert(MSOStrings.GetPropertiesFailure); } return returnValues; } function FindProp(Index) { var nIndex=-1; var property=null; if (isNaN(Index)) { var Splitted=SplitIndex(Index); var PropURN=Splitted.PropURN; var PropName=Splitted.PropName; var i; for (i=0; i=PropCol.Count()) { nIndex=-1; property=null; } else { nIndex=Index; property=PropCol[Index] } } return property; } function Item(Index) { var Property=null; if(Index !=null) { if(!(this.PropertiesLoaded)) { this.LoadProperties(); } Property=FindProp(Index); } return Property; } function Init(Properties, Owner) { this.Owner=Owner; this.IsWebPartFile=Properties.IsWebPartFile; this.ResponseXML=Properties.ResponseXML; for(var i=0; i < Properties.length; i++) { var node=Properties[i]; if(node.SchemaElement=="Assembly" && !Properties.IsWebPartFile) { this.AssemblyInfo=node; } else if(node.SchemaElement=="TypeName" && !Properties.IsWebPartFile) { this.TypeNameInfo=node; } else { this[this.length]=node; } } } function Count() { if(!(this.PropertiesLoaded)) { this.LoadProperties(); } return this.length; } function LoadProperties() { this.Init(GetPropCol(this.Owner.StorageKey, false), this.Owner); this.PropertiesLoaded=true; } PropCol.Owner=null; PropCol.Item=Item; PropCol.Init=Init; PropCol.Count=Count; PropCol.LoadProperties=LoadProperties; PropCol.PropertiesLoaded=false; PropCol.AssemblyInfo=null; PropCol.TypeNameInfo=null; PropCol.IsWebPartFile=false; PropCol.ResponseXML=null; return PropCol; } function PartColDef() { var ThisPartCol=new Collection(); function FindPart(Index) { var nIndex=-1; if (isNaN(Index)) { var i; for (i=0; i=ThisPartCol.Count()) nIndex=-1; else nIndex=Index; } return nIndex; } function Item(Index) { var Part=null; if(Index !=null) { var PartIndex=FindPart(Index); if (PartIndex >=0) Part=ThisPartCol.Item(PartIndex); } return Part; } function Register(WebPartQualifier, StorageKey, DOMPart) { var NewPart; var PartIndex=FindPart(WebPartQualifier); if (PartIndex >=0) { NewPart=ThisPartCol.Item(PartIndex); } else { NewPart=new PartDef(WebPartQualifier, StorageKey, DOMPart); ThisPartCol.Add(NewPart); this.Count=ThisPartCol.Count(); } return NewPart; } function UnRegister(Index) { ThisPartCol.Remove(FindPart(Index)); this.Count=ThisPartCol.Count(); } this.Item=Item; this.Register=Register; this.UnRegister=UnRegister; this.Count=ThisPartCol.Count(); } function WebPartPageDef(DOMObj) { this.Parts=new PartColDef(); this.DOMObject=DOMObj; this.Properties=new PropColDef(); } function EventDef(EventName) { var EventHandlers=new Collection(); function FindEventHandler(CallbackFunction) { return EventHandlers.Find(CallbackFunction); } function AddHandler(CallbackFunction) { return EventHandlers.Add(CallbackFunction); } function RemoveHandler(CallbackFunction) { EventHandlers.RemoveObject(CallbackFunction); } function Raise(Param) { var i; for (i=0; i 0) { var i; var prompt=false; for (i=0;i 0) for (var i=0; i < paramProps.length; i++) for (var j=0; j < params.length; j++) if ((paramProps[i]).ParameterName==params[j]) paramsIndex[j]=i; } function Row2ParamsIn_RowProviderInit(sender,args) { var fields=args.FieldList; if (fields !=null && fields.length > 0) for (var i=0; i < fields.length; i++) for (var j=0; j < fieldNames.length; j++) if (fields[i]==fieldNames[j]) fieldsIndex[j]=i; } function Row2ParamsIn_ParamsInReadyArgs(value) { this.ParameterValues=value; } function Row2ParamsIn_RowReady(sender,args) { var rs=args.Rows; if (args.SelectionStatus=="Standard" || args.SelectionStatus=="New") { if (rs !=null) { rs.MoveFirst(); var paramValues=new Array(paramsLength); for (var i=0; i < paramsLength; i++) { var found=false; try { for (var j=0; j < paramsIndex.length; j++) if (paramsIndex[j]==i) { if (rs.Fields.Item(fieldsIndex[j]).Value !=null) { var type=rs.Fields.Item(fieldsIndex[j]).Type; var varValue=rs.Fields.Item(fieldsIndex[j]).Value; paramValues[i]=String(varValue); if (type==12) { if (typeof(varValue)=="date") { paramValues[i]=P2P_DateToString(paramValues[i]); } } else if (type==7 || type==133 || type==134 || type==135) { paramValues[i]=P2P_DateToString(paramValues[i]); } } else { paramValues[i]=""; } found=true; } } catch( e ) { found=false; } if (!found) paramValues[i]=""; } WPSC.RaiseConnectionEvent(name, "ParametersInReady", new Row2ParamsIn_ParamsInReadyArgs(paramValues)); } } else WPSC.RaiseConnectionEvent(name, "NoParametersIn", null); } } function Row2Cell_GetRow(cellIntName,xform) { var field=xform; var index=-1; var name=cellIntName; this.RowProviderInit=Row2Cell_RowProviderInit; this.RowReady=Row2Cell_RowReady; function Row2Cell_RowProviderInit(sender,args) { var fields=args.FieldList; var fieldDisplayList=args.FieldDisplayList; if (fields !=null && fields.length > 0) for (var i=0; i < fields.length; i++) if (fields[i]==field) { index=i; var displayField=null; if (fieldDisplayList !=null && fieldDisplayList.length > i) { displayField=fieldDisplayList[i]; } WPSC.RaiseConnectionEvent(name, "CellProviderInit", new Row2Cell_CellInitArgs(field, displayField)); } } function Row2Cell_CellInitArgs(name, displayName) { this.FieldName=name; this.FieldDisplayName=displayName; } function Row2Cell_CellReadyArgs(value) { this.Cell=value; } function Row2Cell_RowReady(sender,args) { var rs=args.Rows; if (rs !=null) { rs.MoveFirst(); if (args.SelectionStatus && (args.SelectionStatus=="Standard" || args.SelectionStatus=="New") && index !=-1 && rs.Fields !=null && rs.Fields.Item(index) !=null) WPSC.RaiseConnectionEvent(name, "CellReady", new Row2Cell_CellReadyArgs(rs.Fields.Item(index).Value)); else WPSC.RaiseConnectionEvent(name, "CellReady", new Row2Cell_CellReadyArgs(null)); } } } function Row2Cell_GetCell() { this.CellConsumerInit=Row2Cell_CellInit; function Row2Cell_CellInit(sender,args){} } function Row2Filter_GetFilter() { this.FilterConsumerInit=Row2Filter_FilterInit; function Row2Filter_FilterInit(sender,args){} } function Row2Filter_GetRow(filterIntName,fieldFilter,fieldRow) { var field=fieldRow; var filter=fieldFilter; var index=-1; var name=filterIntName; this.RowProviderInit=Row2Filter_RowInit; this.RowReady=Row2Filter_RowReady; function Row2Filter_RowInit(sender,args) { var fields=args.FieldList; if (fields !=null && fields.length > 0) for (var i=0; i < fields.length; i++) if (fields[i]==field) index=i; } function Row2Filter_SetFilterArgs(value) { this.FilterExpression=value; } function P2P_DateToString(dateString) { function MakeNumberTwoDigits(number) { if (number < 10) return "0"+number; else return number; } var date=new Date(Date.parse(dateString)); var newValue=MakeNumberTwoDigits(date.getMonth()+1)+"/"; newValue+=MakeNumberTwoDigits(date.getDate())+"/"; newValue+=date.getFullYear()+" "; newValue+=MakeNumberTwoDigits(date.getHours())+":"; newValue+=MakeNumberTwoDigits(date.getMinutes())+":"; newValue+=MakeNumberTwoDigits(date.getSeconds()); return newValue; } function Row2Filter_RowReady(sender,args) { var rs=args.Rows; if ((args.SelectionStatus=="Standard" || args.SelectionStatus=="New") && index !=-1) { if (rs !=null) { rs.MoveFirst(); var filterValue=""; try { if (rs.Fields.Item(index).Value !=null) { var varValue=rs.Fields.Item(index).Value; var type=rs.Fields.Item(index).Type; filterValue=String(varValue); if (type==12) { if (typeof(varValue)=="date") { filterValue=P2P_DateToString(filterValue); } } else if (type==7 || type==133 || type==134 || type==135) { filterValue=P2P_DateToString(filterValue); } } } catch (e) { } WPSC.RaiseConnectionEvent(name, "SetFilter", new Row2Filter_SetFilterArgs("FilterField1="+WPSC.Convert(filter, "UNICODE", "URL")+"&FilterValue1="+WPSC.Convert(filterValue, "UNICODE", "URL"))); } else { WPSC.RaiseConnectionEvent(name, "SetFilter", new Row2Filter_SetFilterArgs("FilterField1="+WPSC.Convert(filter, "UNICODE", "URL")+"&FilterValue1=")); } } else WPSC.RaiseConnectionEvent(name, "NoFilter", null); } } function ParamsOut2In_GetParamsOut(paramsInIntName, paramsOutNames, paramsInNames) { var paramsInIndex=new Array(paramsInNames.length); var paramsOutIndex=new Array(paramsInNames.length); var paramsIn=paramsInNames; var paramsOut=paramsOutNames; var name=paramsInIntName; var paramsInLength=0; this.ParametersOutProviderInit=ParamsOut2In_ParamsOutProviderInit; this.ParametersOutReady=ParamsOut2In_ParamsOutReady; this.ParametersInConsumerInit=ParamsOut2In_ParamsInInit; this.NoParametersOut=ParametersOut2In_NoParametersOut; function ParametersOut2In_NoParametersOut(sender, args) { WPSC.RaiseConnectionEvent(name, "NoParametersIn", null); } function ParamsOut2In_ParamsInInit(sender, args) { var paramProps=args.ParameterInProperties; paramsInLength=paramProps.length if (paramProps !=null && paramProps.length > 0) for (var i=0; i < paramProps.length; i++) for (var j=0; j < paramsIn.length; j++) if ((paramProps[i]).ParameterName==paramsIn[j]) paramsInIndex[j]=i; } function ParamsOut2In_ParamsOutProviderInit(sender, args) { var paramProps=args.ParameterOutProperties; if (paramProps !=null && paramProps.length > 0) for (var i=0; i < paramProps.length; i++) for (var j=0; j < paramsOut.length; j++) if ((paramProps[i]).ParameterName==paramsOut[j]) paramsOutIndex[j]=i; } function ParamsOut2In_ParamsInReadyArgs(value) { this.ParameterValues=value; } function ParamsOut2In_ParamsOutReady(sender, args) { var tempParams=args.ParameterValues; if (tempParams !=null && tempParams.length > 0) { var paramValues=new Array(paramsInLength); for (var i=0; i < paramsInLength; i++) { var found=false; for (var j=0; j < paramsInIndex.length; j++) { if (paramsInIndex[j]==i) { paramValues[i]=tempParams[paramsOutIndex[j]]; found=true; } } if (!found) paramValues[i]=""; } WPSC.RaiseConnectionEvent(name, "ParametersInReady", new ParamsOut2In_ParamsInReadyArgs(paramValues)); } } } function MSOLayout_MinimizeRestoreDownLevel(webPartGUID,chromeState,source) { var newChromeState=(chromeState=="Minimized") ? "1" : "0"; document.forms[MSOWebPartPageFormName].MSOLayout_LayoutChanges.value=webPartGUID+",chromeState,"+newChromeState; document.forms[MSOWebPartPageFormName].MSOWebPartPage_PostbackSource.value=source; __doPostBack(MSOWebPartPageFormName, ''); } function MSOLayout_RemoveWebPartDownLevel(webPartGUID, isSelected) { document.forms[MSOWebPartPageFormName].MSOLayout_LayoutChanges.value=webPartGUID+",isIncluded,False"; document.forms[MSOWebPartPageFormName].MSOWebPartPage_PostbackSource.value=22; if(isSelected) { MSOTlPn_ShowToolPane2('Browse'); } else { __doPostBack(MSOWebPartPageFormName, ''); } } var MSOTlPn_prevBuilder=null; var MSOTlPn_prevWidth=0; var MSOTlPn_prevHeight=0; var MSOTlPn_shownViewChangeWarning=false; var MSOWebPartPage_hideNextBeforeUnload=false; var MSOWebPartPage_partDeleted=""; var MSOChangeInToolPaneWidth=120; function ConvertToAspPartDisplayMode(view) { var displayMode; switch(view) { case '-1': displayMode='ExtensibleView'; break; case '0': displayMode='Browse'; break; case '1': displayMode='Edit'; break; case '2': displayMode='Catalog'; break; case '3': displayMode='GallerySearch'; break; case '4': displayMode='Navigation'; break; case '5': displayMode='Import'; break; case '6': displayMode='DownLevelWebPartMenu'; break; case '7': displayMode='ToolPaneErr'; break; } return displayMode; } function MSOTlPn_ShowToolPane2(displayModeName) { if (document.forms[MSOWebPartPageFormName].MSOGallery_FilterVisible) document.forms[MSOWebPartPageFormName].MSOGallery_FilterVisible.value='false'; document.forms[MSOWebPartPageFormName].MSOSPWebPartManager_DisplayModeName.value=displayModeName; if (arguments.length > 1) { document.forms[MSOWebPartPageFormName].MSOSPWebPartManager_StartWebPartEditingName.value='true'; document.forms[MSOWebPartPageFormName].MSOTlPn_SelectedWpId.value=arguments[1]; } __doPostBack(MSOWebPartPageFormName,''); } function MSOTlPn_ShowToolPane2Wrapper(displayModeName, source) { document.forms[MSOWebPartPageFormName].MSOWebPartPage_PostbackSource.value=source; if( arguments[2]==null ) MSOTlPn_ShowToolPane2(displayModeName); else MSOTlPn_ShowToolPane2(displayModeName, arguments[2]); } function MSOTlPn_ShowToolPane(view) { if (arguments.length > 1) MSOTlPn_ShowToolPane2(ConvertToAspPartDisplayMode(view), arguments[1]); else MSOTlPn_ShowToolPane2(ConvertToAspPartDisplayMode(view)); } function MSOTlPn_ShowToolPaneWrapper(view, source) { if (arguments[2]==null) MSOTlPn_ShowToolPane2Wrapper(ConvertToAspPartDisplayMode(view), source); else MSOTlPn_ShowToolPane2Wrapper(ConvertToAspPartDisplayMode(view), source, arguments[2]); } function MSOLayout_CheckAndSaveChanges() { if(document.forms[MSOWebPartPageFormName].MSOLayout_LayoutChanges !=null && document.forms[MSOWebPartPageFormName].MSOLayout_LayoutChanges.value !="") { MSOLayout_SaveChanges(); } } function MSOWebPartPage_ExportCheckWarning(address, hasPersonalizations) { var doexport=true; if (hasPersonalizations) { if (!confirm(MSOStrings.ExportPersonalizationDialogText)) { doexport=false; } } if (doexport) { var oldSavePerformed=false; if(typeof(MSOWPSC_SavePerformed)=="boolean") { oldSavePerformed=MSOWPSC_SavePerformed; } MSOWebPartPage_SetWindowLocation(address); if(typeof(MSOWPSC_SavePerformed)=="boolean") { MSOWPSC_SavePerformed=oldSavePerformed; MSOWebPartPage_hideNextBeforeUnload=true; } } } function MSOMode_SetMode(bAllUsers) { var newUrl=MSOMode_GetNewUrl(bAllUsers); MSOLayout_CheckAndSaveChanges(); if(document.forms[MSOWebPartPageFormName].MSOSPWebPartManager_DisplayModeName.value !='Navigation') { document.forms[MSOWebPartPageFormName].MSOSPWebPartManager_DisplayModeName.value='Browse'; var toolPaneViewExpression=/[& | \?]ToolPaneView=[-0-9A-Z]*/ig; var displayModeExpression=/[& | \?]DisplayMode=[a-zA-Z]*/ig; newUrl=MSOMode_RemoveMode(newUrl, toolPaneViewExpression); newUrl=MSOMode_RemoveMode(newUrl, displayModeExpression); } document.forms[MSOWebPartPageFormName].MSOWebPartPage_Shared.value=bAllUsers ? "true" : "false"; document.forms[MSOWebPartPageFormName].action=newUrl; __doPostBack(MSOWebPartPageFormName,''); } function MSOMode_GetNewUrl(bAllUsers, newUrl) { if (newUrl==null) { newUrl=document.location.href; } var personalViewExpression=/[& | \?]PageView=Personal/ig; var allUsersViewExpression=/[& | \?]PageView=Shared/ig; var newMode="PageView="+(bAllUsers ? "Shared" : "Personal"); newUrl=MSOMode_RemoveMode(newUrl, personalViewExpression); newUrl=MSOMode_RemoveMode(newUrl, allUsersViewExpression); newUrl=MSOMode_AddMode(newUrl, allUsersViewExpression, newMode); return newUrl; } function MSOMode_RemoveMode(newUrl, regExpression) { var hashMarkExpression=/\#/; var hashMarkIndex=newUrl.search(hashMarkExpression); if(hashMarkIndex !=-1) { newUrl=newUrl.substring(0, hashMarkIndex); } var questionMarkExpression=/\?/; var questionMarkIndex=newUrl.search(questionMarkExpression); if(questionMarkIndex !=-1) { var pathString=newUrl.substring(0, questionMarkIndex); var queryString=newUrl.substring(questionMarkIndex, newUrl.length); queryString=queryString.replace(regExpression,''); if(queryString.length !=0 && queryString.charAt(0) !='?') { queryString="?"+queryString; } newUrl=pathString+queryString; } return newUrl; } function MSOMode_AddMode(newUrl, regExpression, stringToAdd) { var hashMarkExpression=/\#/; var hashMarkIndex=newUrl.search(hashMarkExpression); if(hashMarkIndex !=-1) { newUrl=newUrl.substring(0, hashMarkIndex); } var questionMarkExpression=/\?/; var questionMarkIndex=newUrl.search(questionMarkExpression); if(questionMarkIndex==-1 ) { newUrl+='?'+stringToAdd; } else { var queryString=newUrl.substring(questionMarkIndex, newUrl.length); if(queryString.search(regExpression)==-1) { newUrl+='&'+stringToAdd; } } return newUrl; } function MSOPGrid_BuilderVisible(builderID) { MSOPGrid_HidePrevBuilder(); MSOTlPn_prevBuilder=null; builderID.style.display='inline'; } function MSOPGrid_HidePrevBuilder() { if(MSOTlPn_prevBuilder !=null) { eval(MSOTlPn_prevBuilder).style.display='none'; } } function MSOPGrid_doBuilder(builderUrl, editorId, dialogFeatures) { var pReturnValue=showModalDialog(builderUrl,editorId,dialogFeatures); editorId.value=pReturnValue; //@cc_on //@if (@_jscript_version >=5) //@ try { editorId.focus(); } catch (exception) {} //@else //@end } function MSOWebPartPage_RestorePageDefault() { if(confirm(MSOStrings.ResetPagePersonalizationDialogText)) { var newInput=document.createElement('INPUT'); //@cc_on //@if (@_jscript_version >=5) //@ try //@else //@end { newInput.type='hidden'; } //@cc_on //@if (@_jscript_version >=5) //@ catch(e){newInput.style.display='none';} //@else //@end newInput.name='MSOWebPartPage_RestorePageDefault'; newInput.value='true'; document.forms[MSOWebPartPageFormName].appendChild(newInput); if(document.forms[MSOWebPartPageFormName].MSOLayout_LayoutChanges !=null) { document.forms[MSOWebPartPageFormName].MSOLayout_LayoutChanges.value=""; } MSOMode_SetMode(false); } } function MSOWebPartPage_RestorePartDefaults(webPartID) { if(confirm(MSOStrings.ResetPartPersonalizationDialogText)) { var newInput=document.createElement('INPUT'); //@cc_on //@if (@_jscript_version >=5) //@ try //@else //@end { newInput.type='hidden'; } //@cc_on //@if (@_jscript_version >=5) //@ catch(e){newInput.style.display='none';} //@else //@end newInput.name='MSO_RestoreSettings'; newInput.value=webPartID; document.forms[MSOWebPartPageFormName].appendChild(newInput); MSOMode_SetMode(false); } } function MSOWebPartPage_MenuDoPostBack(eventTarget, eventArgument) { var theform=document.forms[MSOWebPartPageFormName]; var eventTargetField=theform.__EVENTTARGET; var eventArgumentField=theform.__EVENTARGUMENT; if(eventTargetField==null) { eventTargetField=document.createElement('INPUT'); eventTargetField.style.display='none'; eventTargetField.name='__EVENTTARGET'; document.forms[MSOWebPartPageFormName].appendChild(eventTargetField); } if(eventArgumentField==null) { eventArgumentField=document.createElement('INPUT'); eventArgumentField.style.display='none'; eventArgumentField.name='__EVENTARGUMENT'; document.forms[MSOWebPartPageFormName].appendChild(eventArgumentField); } __doPostBack(eventTarget, eventArgument); } function MSOWebPartPage_SignIn() { var newInput=document.createElement('INPUT'); //@cc_on //@if (@_jscript_version >=5) //@ try //@else //@end { newInput.type='hidden'; } //@cc_on //@if (@_jscript_version >=5) //@ catch(e){newInput.style.display='none';} //@else //@end newInput.name='MSOWebPartPage_AnonymousAccessLogIn'; newInput.value="1"; document.forms[MSOWebPartPageFormName].appendChild(newInput); __doPostBack(MSOWebPartPageFormName,''); } function MSOWebPartPage_SetWindowLocation(newLocation) { var newLocationLowerCase=newLocation.toLowerCase(); if(newLocationLowerCase.indexOf('javascript:')==0 || newLocationLowerCase.indexOf('vbscript:')==0) { MSOWebPartPage_hideNextBeforeUnload=true; } window.location=newLocation; } function MSOWebPartPage_SetNewWindowLocation(helpUrl, helpMode) { if (helpMode==0 || helpMode==1) { if (helpMode==0) { var dialogInfo="edge: Sunken; center: yes; help: no; resizable: yes; status: no"; window.commonShowModalDialog(helpUrl, dialogInfo); } else { window.open(helpUrl, null, "scrollbars=yes,resizable=yes,status=no,toolbar=no,menubar=no,location=no"); } } else if (helpMode==2) { window.location=helpUrl; } } function MSOTlPn_onToolPaneCloseClick() { var DisplayModeBrowse='Browse'; var PostbackSourceSettingsHide='49'; MSOTlPn_ShowToolPane2Wrapper(DisplayModeBrowse, PostbackSourceSettingsHide); } function MSOPGrid_InvokeFPBuilder(type,arguments,editorCtrl) { editorCtrl.value=window.external.InvokeBuilder(type,arguments,editorCtrl.id); editorCtrl.focus(); } function MSOMenu_KeyboardClick(widget) { for(var index=1; index < arguments.length; index++) { if(event.keyCode==arguments[index]) { widget.click(); event.returnValue=false; return; } } } function MSOTlPn_ToggleDisplay(strID,strImgName,strAnchorName,strAltExpandText,strAltCollapseText, strImageAnchorName) { var fieldID=strID+'_STATEFIELD'; var stateFieldValue; var group=document.getElementById(strID); var image=document.getElementById(strImgName); var anchor=document.getElementById(strAnchorName); var imgAnchor=document.getElementById(strImageAnchorName); if( group.style.display=='none' ) { group.style.display=''; image.src='/_layouts/images/TPMin2.gif'; image.alt=strAltCollapseText; imgAnchor.title=strAltCollapseText; anchor.title=strAltCollapseText; stateFieldValue="1"; } else { group.style.display='none'; image.src='/_layouts/images/TPMax2.gif'; image.alt=strAltExpandText; imgAnchor.title=strAltExpandText; anchor.title=strAltExpandText; stateFieldValue="0"; } var field=document.getElementById(fieldID); if(field !=null) { field.value=stateFieldValue; } } function MSOTlPn_onToolPaneMaxClick() { var mod=1; var minMaxIcon=document.all['MSOTlPn_minMaxIcon']; var newSrc=minMaxIcon.src.substring(0, minMaxIcon.src.lastIndexOf('/')+1); if (document.forms[MSOWebPartPageFormName].MSOTlPn_Maximized.value=="False") { document.all['MSOTlPn_Tbl'].style.width=(parseInt(document.all['MSOTlPn_Tbl'].offsetWidth)+MSOChangeInToolPaneWidth).toString()+"px"; newSrc+=((document.dir=="rtl") ? "tpmax.gif" : "tpmin.gif"); minMaxIcon.title=MSOStrings.ToolPaneShrinkToolTip; minMaxIcon.alt=MSOStrings.ToolPaneShrinkToolTip; minMaxIcon.parentElement.title=MSOStrings.ToolPaneShrinkToolTip; document.forms[MSOWebPartPageFormName].MSOTlPn_Maximized.value="True"; } else { document.all['MSOTlPn_Tbl'].style.width="225px"; newSrc+=((document.dir=="rtl") ? "tpmin.gif" : "tpmax.gif"); minMaxIcon.title=MSOStrings.ToolPaneWidenToolTip; minMaxIcon.alt=MSOStrings.ToolPaneWidenToolTip; minMaxIcon.parentElement.title=MSOStrings.ToolPaneWidenToolTip; mod=-1; document.forms[MSOWebPartPageFormName].MSOTlPn_Maximized.value="False"; } minMaxIcon.src=newSrc; var x=document.all['MSOTlPn_Tbl']; for(var i=0; i < x.all.length; i++) { //@cc_on //@if (@_jscript_version >=5) //@ try //@else //@end { if (x.all(i).getAttribute('ms-TlPnWiden')=="true") { x.all(i).style.pixelWidth+=mod*MSOChangeInToolPaneWidth; } } //@cc_on //@if (@_jscript_version >=5) //@ catch (e) //@else //@end { } } } function MSOTlPn_WindowResize() { var objToolPane=document.all['MSOTlPn_MainTD']; if (objToolPane==null || objToolPane.offsetWidth==0) return; var widthToolPane=objToolPane.offsetWidth; var docFrame=(document.body.offsetWidth - document.body.clientWidth); var spDiv=document.all['MSOTlPn_WebPartPageDiv']; if ((spDiv.offsetWidth+objToolPane.offsetWidth)==document.body.clientWidth) { return; } var widthAncestors=0; var next=spDiv.offsetParent; var elementWidth=0; while (next !=null) { if (document.dir !="rtl") { elementWidth=next.offsetLeft+(next.offsetWidth - (next.clientLeft+next.clientWidth)); if (next.offsetParent !=null) { elementWidth+=next.offsetParent.clientLeft; } } else { elementWidth=(next.offsetParent !=null) ? (next.offsetParent.offsetWidth - (next.offsetLeft+next.offsetWidth)) : 0; } widthAncestors+=elementWidth; next=next.offsetParent; } widthAncestors -=docFrame; var widthCenter=document.body.clientWidth - (widthAncestors+widthToolPane); if (widthCenter < 250) widthCenter=250; document.all['MSO_tblPageBody'].style.pixelWidth=widthCenter+widthToolPane; spDiv.style.pixelWidth=widthCenter; if (window.event.type=="load" && document.all.MSOTlPn_TlPnCaptionSpan!=null) document.all.MSOTlPn_TlPnCaptionSpan.scrollIntoView(false); } function MSOTlPn_CheckUrl() { var toolPaneViewExpression=/[& | \?]ToolPaneView=[-0-9A-Z]*/ig; var displayModeExpression=/[& | \?]DisplayMode=[a-zA-Z]*/ig; var formAction=document.forms[MSOWebPartPageFormName].action; var newUrl; newUrl=MSOMode_RemoveMode(document.forms[MSOWebPartPageFormName].action, toolPaneViewExpression); newUrl=MSOMode_RemoveMode(document.forms[MSOWebPartPageFormName].action, displayModeExpression); document.forms[MSOWebPartPageFormName].action=newUrl; } function MSOTlPn_Resize(obj) { if (MSOTlPn_prevWidth !=obj.clientWidth) { MSOTlPn_prevWidth=obj.clientWidth; MSOTlPn_WindowResize(); } if (MSOTlPn_prevHeight !=document.body.clientHeight) { MSOTlPn_prevHeight=document.body.clientHeight; var spDiv=document.all['MSOTlPn_WebPartPageDiv']; spDiv.style.height="100%"; spDiv.style.height=spDiv.offsetHeight; } } function MSOWebPartPage_SetupFixedWidthWebParts() { var fixedWidthTitles=document.all['MSOFixedWidthTitle']; if(fixedWidthTitles !=null) { if(fixedWidthTitles.length > 0) { for(var elementIndex=0; elementIndex < fixedWidthTitles.length; elementIndex++) { fixedWidthTitles[elementIndex].style.width=MSOWebPartPage_AllocateSpaceForFirstTD(fixedWidthTitles[elementIndex]); } } else { fixedWidthTitles.style.width=MSOWebPartPage_AllocateSpaceForFirstTD(fixedWidthTitles); } } } function MSOWebPartPage_AllocateSpaceForFirstTD(titleDiv) { var tempElement=document.createElement("DIV"); tempElement.style.width=titleDiv.fixedWidth; document.body.appendChild(tempElement); var pixelSize=tempElement.offsetWidth; document.body.removeChild(tempElement); var tempTable=MSOLayout_GetParentTable(titleDiv).cloneNode(true); if(tempTable !=0) { document.body.appendChild(tempTable); var tempTableRow=tempTable.rows(0); for(var index=1; index < tempTableRow.cells.length; index++) { pixelSize -=tempTableRow.cells(index).offsetWidth; } document.body.removeChild(tempTable); } return (pixelSize < 1) ? 1 : pixelSize; } function MSOWebPartPage_FindControlName(name) { var labelcollection=document.all.tags("label"); if (labelcollection !=null) { for (i=0; i < labelcollection.length; i++) { var label=labelcollection[i]; if (label.innerText==name) { if (label.htmlFor.indexOf("_EDITOR") !=-1) { return(label.htmlFor); } } } } return null; } function MSOTlPn_ListViewChange(strWarningText) { if (MSOTlPn_shownViewChangeWarning) return; alert(strWarningText); MSOTlPn_shownViewChangeWarning=true; } function MSOTlPn_CustomWindowResize() { var objToolPane=document.all['MSOTlPn_Tbl']; if (objToolPane==null || objToolPane.offsetWidth==0) return; objToolPane.style.pixelWidth=document.body.clientWidth; } function MSOTlPn_ShowListFilter() { if (document.all['WebPartListFilter'].style.display=='none') { document.all['WebPartListFilter'].style.display='block'; document.forms[MSOWebPartPageFormName].MSOGallery_FilterVisible.value="true"; } else { document.all['WebPartListFilter'].style.display='none'; document.forms[MSOWebPartPageFormName].MSOGallery_FilterVisible.value="false"; } } function MSOGallery_GetCookie(name) { var prefix=name+"="; var cookieStartIndex=document.cookie.indexOf(prefix); if (cookieStartIndex==-1) { return null; } var cookieEndIndex=document.cookie.indexOf(";", cookieStartIndex+prefix.length); if (cookieEndIndex==-1) { cookieEndIndex=document.cookie.length; } return unescape(document.cookie.substring(cookieStartIndex+prefix.length, cookieEndIndex)); } function MSOTlPn_ShowAllUsersToolPane(displayMode, source, storageKey) { MSOLayout_CheckAndSaveChanges(); document.forms[MSOWebPartPageFormName].action=MSOMode_GetNewUrl(true); MSOTlPn_ShowToolPane2Wrapper(displayMode, source, storageKey); } function MSOLayout_MakeInvisibleIfEmpty() { var allElements=document.getElementsByName("_invisibleIfEmpty"); var agt=navigator.userAgent.toLowerCase(); var isNav=((agt.indexOf('mozilla')!=-1)&&((agt.indexOf('spoofer')==-1) && (agt.indexOf('compatible')==-1))); var isIE=(agt.indexOf("msie")!=-1); for (var curElement=0; curElement < allElements.length; curElement++) { if ((isIE && allElements[curElement].childNodes.length==0) || (isNav && allElements[curElement].childNodes.length <=1)) { allElements[curElement].style.display="none"; } } } function MSOLayout_GetParentRow(tableCell) { var parentRow=tableCell.parentElement; while(parentRow.tagName !="TR" && parentRow.tagName !="BODY") parentRow=parentRow.parentElement; if(parentRow.tagName !="TR") { return null; } else { return parentRow; } } function MSOLayout_GetParentTable(TableCell) { for (var currentObject=TableCell; currentObject.tagName !='TABLE'; currentObject=currentObject.parentElement) { if(currentObject==document.body) return 0; } return currentObject; }