var fImglibJssLoaded=true;
var fImglibDefautlView=false;
var L_DeleteSingleItem_Text="Are you sure you want to delete this item?";
var L_RecycleSingleItem_Text="Are you sure you want to send this item to the site Recycle Bin?";
var L_DeleteMultipleItems_Text="Are you sure you want to delete these items?";
var L_RecycleMultipleItems_Text="Are you sure you want to send these items to the site Recycle Bin?";
var L_ListStyle_Text=" Details";
var L_ThumbnailStyle_Text=" Thumbnails";
var L_FilmstripStyle_Text=" Filmstrip";
var L_FileName_Text="Name";
var L_Title_Text="Title";
var L_Description_Text="Description";
var L_ImageSize_Text="Picture Size";
var L_ImageCreateDate_Text="Date Picture Taken";
var L_ImgAlt_Text="Picture";
var L_DocumentAlt_Text="Document";
var L_FolderAlt_Text="Folder";
var L_AltViewProperty_Text="Click here to view the picture properties.";
var L_GotoFolder_Text="Click here to go to the folder.";
var L_Picture_Text="Picture";
var L_Of_Text="of";
var L_NoImageSelected_Text="There are no pictures selected. Select one or more pictures and try again.";
var L_IEOnlyFeature_Text="This feature requires Internet Explorer version 5.5 or greater for Windows to work.";
var L_NotAvailableOnWebPart_Text="This operation cannot be completed from a web part. Please go to the Picture Library and try again.";
var L_NoPreview_Text="No Preview Available";
var L_OpenItem_Text="Open item";
var L_SelectAll_Text="Select|Unselect all";
var L_PreviousPicture_Text="Previous picture";
var L_NextPicture_Text="Next picture";
var L_SelectedViewError_Text="Selected Images View requires Internet Explorer 6.0 or greater for Windows.";
var L_ExceedSelectionLimit_Text="You have selected the maximum number of items. Switch to the Selected Pictures view to review your selections.";
var L_SlideShowPlayButton_Text="Play";
var L_SlideShowPauseButton_Text="Pause";
var L_SlideShowStopButton_Text="Stop";
var L_SlideShowPrevButton_Text="Previous";
var L_SlideShowNextButton_Text="Next";
var items=new Array;
var firstId=-1;
var fSelectFieldAppeared=false;
var previewedId=0;
var currentRecursiveViewStyle="";
var currentRootFolder="";
var ids=new Array;
var fAllSelected=false;
var selectedIdsStr="";
var filterIdsStr="";
var fSelectedView=false;
var currentViewGuid="";
var fInitSelection=false;
var detailStyleText="";
var currentViewStyle="";
var selectedViewLink=null;
var vCurrentListID="";
var vCurrentListUrlAsHTML="";
var vCurrentWebUrl="";
var urlCmdForDisplay="";
var fNewItem=false;
var fInit=false;
var tbImg=null;
var tbTitle=null;
var tbPreview=null;
var hilitedRow=null;
var previewTimer=-1;
var timedItem=-1;
var currentPicture=0;
var currentStrip=0;
var stripSize=5;
var listDirection="ltr";
var lastMenuId="";
var firstIdWithCheckbox=-1;
var fInitAttempted=false;
var fRecursive=false;
var fRTL=false;
var fEmptyView=false;
var fWebFldrView=false;
var fFilterOn=false;
var fInitViewStyle=false;
var fNextImageLoaded=false;
var fNeedReload=false;
var fEditingInProcess=false;
var listInfo=null;
var fIsInGroupByView=false;
var picturePreviewAlt=null;
var unverifiedSelectionIdsCount=0;
var verifiedSelectionIdsCount=0;
var selectionLimit=200;
function CListInfo(webWidth, webHeight, thumbSize)
{
if (webWidth >=160 && webWidth < 1280)
{
this.webImageWidth=webWidth;
}
else
{
this.webImageWidth=640;
}
if (webHeight >=160 && webHeight < 1280)
{
this.webImageHeight=webHeight;
}
else
{
this.webImageHeight=640;
}
if (thumbSize >=20 && thumbSize <=this.webImageWidth && thumbSize <=this.webImageHeight)
{
this.thumbnailSize=thumbSize;
}
else
{
this.thumbnailSize=160;
}
}
function CreateDerivedImageUrl(originalImageUrl, subdirStr)
{
var url=originalImageUrl.replace(/\.([^\.]+)$/, "_$1");
url=url+".jpg";
url=url.replace(/\/([^\/]+)$/, subdirStr+"$1");
return url;
}
function EncodedThumbnailImage(id)
{
if (id==null || items[id]==null)
return;
if (items[id].objType==1)
{
return items[id].thumbnail;
}
else if (items[id].fUnknownImageType==true)
{
return items[id].thumbnail;
}
else
{
var thumbnailUrl=CreateDerivedImageUrl(items[id].originalImg, "/_t/");
return thumbnailUrl;
}
}
function GetAltText(id)
{
if (id==null || items[id]==null)
return;
return items[id].alt;
}
function EncodedWebImage(id)
{
if (id==null || items[id]==null)
return;
if (items[id].objType==1)
{
return items[id].webimage;
}
else if (items[id].fUnknownImageType==true)
{
return items[id].webimage;
}
else
{
var webimgUrl=CreateDerivedImageUrl(items[id].originalImg, "/_w/");
return webimgUrl;
}
}
function ViewEmptyScript( webImageWidth, webImageHeight, thumbnailSize)
{
listInfo=new CListInfo(webImageWidth, webImageHeight, thumbnailSize);
fEmptyView=true;
InitViewUrls();
InitItems();
AddSelectAllCheckbox();
return;
}
function WebFolderViewInit(listGuid)
{
if (browseris.ie5up && browseris.win32)
{
fWebFldrView=true;
InitViewUrls();
vCurrentListID=listGuid;
InitSelection();
}
}
function GotoInfoPage(reason)
{
if (reason==null || reason=="")
return;
var infopageUrl=GetLayoutUrl()+"infopage.aspx?List="+vCurrentListID;
infopageUrl+="&reason="+reason;
var rootFolder=GetUrlKeyValue("RootFolder", true);
if (rootFolder !="")
infopageUrl+="&RootFolder="+rootFolder;
window.location.href=infopageUrl;
}
function MakeFullUrl(folderUrl, siteUrl)
{
var unescapedFolderUrl=unescapeProperly(folderUrl);
if (0==unescapedFolderUrl.indexOf("http://") || 0==unescapedFolderUrl.indexOf("https://"))
return unescapedFolderUrl;
else
return siteUrl+unescapedFolderUrl;
}
function StartOIS(cmdLine)
{
var fClientInstalled=false;
try
{
var OISClientLauncher=new ActiveXObject("OISCTRL.OISClientLauncher");
if (OISClientLauncher)
{
fClientInstalled=true;
OISClientLauncher.LaunchOIS(cmdLine)
}
}
catch (e)
{
}
return fClientInstalled;
}
function PLMultipleUploadView()
{
if (vCurrentListUrlAsHTML=="")
return false;
var strListDir=vCurrentListUrlAsHTML.substring(0, vCurrentListUrlAsHTML.length - 1);
var subwebPos=strListDir.lastIndexOf("/");
if (subwebPos==-1)
return false;
var subwebStr=strListDir.substring(0, subwebPos);
var colonSlashSlashIndex=subwebStr.indexOf("://");
if (colonSlashSlashIndex==-1)
return false;
var siteUrl=subwebStr;
var nextSlashPos=subwebStr.indexOf("/", colonSlashSlashIndex+3);
if (nextSlashPos !=-1)
siteUrl=subwebStr.substring(0, nextSlashPos);
var destinationFolder;
var rootFolder="";
if (document.getElementById("destination") !=null)
destinationFolder=document.getElementById("destination").value;
if (destinationFolder==null || destinationFolder=="")
rootFolder=GetUrlKeyValue("RootFolder", true);
var fUploadStarted=false;
if (destinationFolder !="")
{
fUploadStarted=StartOIS("ois.exe /upload \""+MakeFullUrl(destinationFolder, siteUrl)+"\"");
}
else if (rootFolder !="")
{
fUploadStarted=StartOIS("ois.exe /upload \""+MakeFullUrl(rootFolder, siteUrl)+"\"");
}
else
{
fUploadStarted=StartOIS("ois.exe /upload \""+vCurrentListUrlAsHTML+"\"");
}
if (!fUploadStarted)
return false;
GotoInfoPage("uploading");
return true;
}
function _EditSelectedImages()
{
if (!browseris.ie || !browseris.win32)
{
alert(L_IEOnlyFeature_Text);
return;
}
if (!fImglibDefautlView)
{
alert(L_NotOurView_Text);
return;
}
if (tbPreview==null)
{
alert( L_NotAvailableOnWebPart_Text);
return;
}
var ids=MakeSelectionStr();
ids=ids.replace(/\;/g, " ");
if (ids=="")
{
alert(L_NoImageSelected_Text);
return;
}
if (vCurrentListUrlAsHTML=="")
return;
var cmdLine="ois.exe /editSP ";
cmdLine+="\""+vCurrentListUrlAsHTML+"\" "+ids;
if (StartOIS(cmdLine))
{
fEditingInProcess=true;
SaveSelection();
GotoInfoPage("editing");
}
else
GotoInfoPage("noclient");
}
function EditSingleImage(id)
{
if (!browseris.ie || !browseris.win32)
{
alert(L_IEOnlyFeature_Text);
return;
}
if (id=="")
return;
if (vCurrentListUrlAsHTML=="")
return;
var cmdLine="ois.exe /editSP ";
cmdLine+="\""+vCurrentListUrlAsHTML+"\" "+id;
if (StartOIS(cmdLine))
{
fEditingInProcess=true;
SaveSelection();
GotoInfoPage("editing");
}
else
GotoInfoPage("noclient");
}
function SendImagesCore(selectionIds, strListDir)
{
if (!browseris.ie || !browseris.win32)
{
alert(L_IEOnlyFeature_Text);
return true;
}
if (selectionIds=="")
{
alert(L_NoImageSelected_Text);
return true;
}
var cmdLine="ois.exe /sendto \""+strListDir+"\" "+selectionIds;
return StartOIS(cmdLine);
}
function _SendImages()
{
if (!browseris.ie || !browseris.win32)
{
alert(L_IEOnlyFeature_Text);
return;
}
if (!fImglibDefautlView)
{
alert(L_NotOurView_Text);
return;
}
if (tbPreview==null)
{
alert( L_NotAvailableOnWebPart_Text);
return;
}
var selectionIds=MakeSelectionStr();
if (selectionIds=="")
{
alert(L_NoImageSelected_Text);
return;
}
if (vCurrentListUrlAsHTML=="")
return;
if (!SendImagesCore(selectionIds, vCurrentListUrlAsHTML))
GotoInfoPage("noclient");
}
function _DownloadImages()
{
if (!browseris.ie || !browseris.win32)
{
alert(L_IEOnlyFeature_Text);
return;
}
if (!fImglibDefautlView)
{
alert(L_NotOurView_Text);
return;
}
if (tbPreview==null)
{
alert( L_NotAvailableOnWebPart_Text);
return;
}
var selectionIds=MakeSelectionStr();
if (selectionIds=="")
{
alert(L_NoImageSelected_Text);
return;
}
var advancedAspxUrl=GetLayoutUrl()+"Dladvopt.aspx?List="+vCurrentListID+"&SelectedIds="+selectionIds+"&ViewUI=1";
var rootFolder=GetUrlKeyValue("RootFolder", true);
if (rootFolder !="")
advancedAspxUrl+="&RootFolder="+rootFolder;
window.location.href=advancedAspxUrl;
}
function GetLayoutUrl()
{
if (vCurrentWebUrl !="")
return vCurrentWebUrl+"/_layouts/";
return "../../_layouts/";
}
function DownloadOriginalImage(id)
{
if (tbPreview==null)
{
alert( L_NotAvailableOnWebPart_Text);
return;
}
if (id==null || items[id]==null || items[id].objType !=0)
return;
var downloadHref=GetLayoutUrl()+"download.aspx?List="+vCurrentListID+"&ItemId="+id+"&Version=0";
window.location.href=downloadHref;
}
function GetLinks(lnkId)
{
if (browseris.ie)
return document.getElementById(lnkId);
else
return document.links[lnkId];
}
function InitImglibView(listID, languageText)
{
vCurrentListID=listID;
}
function RedirectToCorrectSelectView()
{
fRecursive=true;
fSelectedView=false;
InitSelection();
LoadSelection();
var currentUrl=window.location.href;
var qmarkPosition=currentUrl.indexOf("?");
var suffix="";
var viewUrl="";
if (qmarkPosition !=-1)
{
suffix=currentUrl.substring(qmarkPosition+1, currentUrl.length);
viewUrl=currentUrl.substring(0, qmarkPosition);
}
else
{
viewUrl=currentUrl;
}
sortField=/SortField=[^&]*/i;
sortDir=/SortDir=[^&]*/i;
var sortFieldStr=suffix.match(sortField);
var sortDirStr=suffix.match(sortDir);
var idsStr=MakeSelectionStr();
if (idsStr=="")
idsStr="none";
viewUrl+="?"+"View="+currentViewGuid+"&FilterName=ID&FilterMultiValue="+idsStr;
if (sortFieldStr !=null && sortDirStr !=null)
{
viewUrl+="&"+sortFieldStr+"&"+sortDirStr;
}
window.open(viewUrl, "_self", "", true);
}
function InitViewUrls()
{
var currentUrl=window.location.href;
var qmarkPosition=currentUrl.indexOf("?");
var suffix="";
var viewUrl="";
if (qmarkPosition !=-1)
{
suffix=currentUrl.substring(qmarkPosition+1, currentUrl.length);
viewUrl=currentUrl.substring(0, qmarkPosition);
}
else
{
viewUrl=currentUrl;
}
if (!browseris.ie5up || !browseris.win32)
{
if (fSelectedView)
{
alert(L_SelectedViewError_Text);
var newViewUrl=viewUrl.replace(/\/forms\/[^\/]*$/i, "/");
window.location.href=newViewUrl;
return;
}
}
currentRootFolder=suffix.match(/RootFolder=[^&]*/);
var queryVariables=suffix.split("&");
var filterSubstr=suffix.match(/View=([^&]*)&FilterName=ID&FilterMultiValue=([^&]*)/);
var fIncompleteSelectedView=false;
if (fSelectedView)
{
if (filterSubstr !=null)
{
filterIdsStr=filterSubstr[1];
}
else
{
RedirectToCorrectSelectView();
}
}
suffix="";
for (var i=0; i < queryVariables.length; i++)
{
if (queryVariables[i].match(/Filter=1/))
{
fFilterOn=true;
}
}
}
function SwitchViewStyle(style)
{
if (style==currentViewStyle || fEmptyView)
return;
if (tbPreview !=null)
{
if (style=="filmstrip")
{
document.getElementById("contentfilmstrip").style.display="block";
document.getElementById("contentthumbnail").style.display="none";
document.getElementById("selectionCacheMgr").parentNode.parentNode.style.display="none";
if (stripSize > 0)
{
var frmImg=document.getElementById("fstb0");
if (frmImg !=null)
frmImg.focus();
}
}
else if (style=="thumbnail")
{
document.getElementById("contentfilmstrip").style.display="none";
document.getElementById("contentthumbnail").style.display="block";
document.getElementById("selectionCacheMgr").parentNode.parentNode.style.display="none";
}
else
{
document.getElementById("contentfilmstrip").style.display="none";
document.getElementById("contentthumbnail").style.display="none";
document.getElementById("selectionCacheMgr").parentNode.parentNode.style.display="block";
}
currentViewStyle=style;
if (currentViewStyle=="list")
tbPreview.style.display="block";
else
tbPreview.style.display="none";
}
InitSelection();
}
function NextSelectionOverLimit( newCount )
{
if (( unverifiedSelectionIdsCount+verifiedSelectionIdsCount+newCount ) > selectionLimit)
return true;
return false;
}
function ToggleSelection(id)
{
if (tbPreview==null)
return;
if (id < 0 || items[id]==null)
return;
if (items[id].fSelected==false)
{
if (NextSelectionOverLimit(1))
{
UIChange(id, false);
alert(L_ExceedSelectionLimit_Text);
return false;
}
else
{
items[id].fSelected=true;
verifiedSelectionIdsCount++;
UIChange(id, true);
}
}
else
{
items[id].fSelected=false;
verifiedSelectionIdsCount --;
UIChange(id, false);
}
SaveSelection();
ConstructSelectionHref();
}
function ToggleSelectionAll()
{
if (tbPreview==null)
return;
var i;
var fSelect=!fAllSelected;
var selectionChangeCount=0;
for (i=0; i < ids.length; i++)
{
if (items[ids[i]].objType !=1 &&
items[ids[i]].fSelected !=fSelect)
{
selectionChangeCount++;
}
}
if (fSelect)
{
if (NextSelectionOverLimit(selectionChangeCount))
{
alert(L_ExceedSelectionLimit_Text);
return;
}
verifiedSelectionIdsCount=verifiedSelectionIdsCount+selectionChangeCount;
}
else
{
verifiedSelectionIdsCount=verifiedSelectionIdsCount - selectionChangeCount;
}
for (i=0; i < ids.length; i++)
{
if (items[ids[i]].objType !=1)
{
items[ids[i]].fSelected=fSelect;
UIChange(ids[i], fSelect);
}
}
SaveSelection();
ConstructSelectionHref();
}
function ConstructSelectionHref()
{
var selectionStr=MakeSelectionStr();
if (selectionStr=="")
selectionStr="none";
var imgSelectAll=document.getElementById("cbxSelectAll");
if (imgSelectAll !=null)
{
if (fAllSelected)
imgSelectAll.src=ctx.imagesPath+"checkall.gif";
else
imgSelectAll.src=ctx.imagesPath+"unchecka.gif";
}
}
function LoadSelection()
{
if (!fInitSelection)
{
//@cc_on
//@if (@_jscript_version >=5)
//@ try {
//@ selectionCacheMgr.load("OISSelectionStore");
//@ } catch (e) {
//@ return;
//@ };
//@else
return;
//@end
}
selectedIdsStr="";
var fWrongList=false;
if (selectionCacheMgr.getAttribute("listGuid") && vCurrentListID !="")
{
savedListGuid=selectionCacheMgr.getAttribute("listGuid");
if (savedListGuid !=vCurrentListID)
{
fWrongList=true;
}
}
if (selectionCacheMgr.getAttribute("cachedValue") && !fWrongList)
{
selectedIdsStr=selectionCacheMgr.getAttribute("cachedValue");
selectionCacheMgr.innerText=selectedIdsStr;
var selIds=selectedIdsStr.split(";");
var selNum=selIds.length;
selectedIdsStr="";
unverifiedSelectionIdsCount=0;
verifiedSelectionIdsCount=0;
for (var i=0; i < selNum; i++)
{
var selId=parseInt(selIds[i]);
var fIdMatched=false;
var j;
if (isNaN(selId))
{
continue;
}
for (j=0; j < ids.length; j++)
{
if (ids[j]==selId)
{
if (!NextSelectionOverLimit(1))
{
items[ids[j]].fSelected=true;
verifiedSelectionIdsCount++;
UIChange(selId, true);
}
fIdMatched=true;
break;
}
}
if (!fIdMatched && !fSelectedView)
{
if (!NextSelectionOverLimit(1))
{
if (selectedIdsStr=="")
selectedIdsStr=selIds[i];
else
selectedIdsStr+=";"+selIds[i];
unverifiedSelectionIdsCount++;
}
}
}
}
var needReload=selectionCacheMgr.getAttribute("Reload");
if (needReload=="1")
fNeedReload=true;
}
function InitSelection()
{
//@cc_on
//@if (@_jscript_version >=5)
//@ try {
//@ selectionCacheMgr.load("OISSelectionStore");
//@ } catch (e) {
//@ if (!fInitAttempted) {fInitAttempted=true; setTimeout("InitSelection()", 500);} return;
//@ };
//@else
return;
//@end
fInitSelection=true;
if (!fInitViewStyle)
{
fInitViewStyle=true;
var viewStyle="thumbnail";
if (selectionCacheMgr.getAttribute("viewStyle"))
{
var viewStyle=selectionCacheMgr.getAttribute("viewStyle");
if (viewStyle !="list" && viewStyle !="filmstrip")
{
viewStyle="thumbnail";
}
if (fFilterOn || fIsInGroupByView)
viewStyle="list";
}
if (!fWebFldrView)
{
if (!fRecursive)
{
SwitchViewStyle(viewStyle);
if (viewStyle=="filmstrip")
ClickFrame(currentPicture);
}
else
{
currentViewStyle=viewStyle;
}
}
else
{
currentViewStyle=viewStyle;
}
}
LoadSelection();
var fReloadPending=fNeedReload;
fNeedReload=false;
SaveSelection();
if (fReloadPending)
window.location.reload(true);
ConstructSelectionHref();
return;
}
function ClearSelections()
{
if (!fInitSelection)
return;
selectedIdsStr="";
var i;
for (i=0; i < ids.length; i++)
{
items[ids[i]].fSelected=false;
UIChange(ids[i], false);
}
SaveSelection();
ConstructSelectionHref();
}
function GetSelectionCount()
{
var count=0;
var i;
for (i=0; i < ids.length; i++)
{
if (items[ids[i]].fSelected==true)
{
count++;
}
}
return count;
}
function MakeSelectionStr()
{
var newSelStr=selectedIdsStr;
var i;
fAllSelected=true;
for (i=0; i < ids.length; i++)
{
if (items[ids[i]].fSelected==true)
{
if (newSelStr=="")
{
newSelStr=""+ids[i];
}
else
{
newSelStr+=";"+ids[i];
}
}
else if (items[ids[i]].objType==0)
{
fAllSelected=false;
}
}
return newSelStr;
}
var expirationInMilSeconds=604800000;
function SaveSelection()
{
if (browseris.ie5up && browseris.win32 && fInitSelection)
{
selectionCacheMgr.setAttribute("cachedValue", MakeSelectionStr());
selectionCacheMgr.setAttribute("viewStyle", currentViewStyle);
selectionCacheMgr.setAttribute("listGuid", vCurrentListID);
if (fEditingInProcess)
selectionCacheMgr.setAttribute("Reload", "1");
else
selectionCacheMgr.setAttribute("Reload", "0");
var oTimeNow=new Date();
oTimeNow.setTime(oTimeNow.getTime()+expirationInMilSeconds);
var sExpirationDate=oTimeNow.toUTCString();
selectionCacheMgr.expires=sExpirationDate;
selectionCacheMgr.save("OISSelectionStore");
}
return;
}
function CreateRootFolderHref(id)
{
if (id==null || items[id]==null)
return "";
if (items[id].objType !=1)
return "";
var currentHref=window.location.href;
if (!ctx.recursiveView)
{
var folderHref="RootFolder="+escapeProperly(unescapeProperly(items[id].originalImg));
if (-1==currentHref.indexOf("?"))
{
currentHref=currentHref+"?"+folderHref;
}
else if (currentHref.match(/RootFolder=/))
{
currentHref=currentHref.replace(/RootFolder=[^&]*/, folderHref);
}
else
{
currentHref=currentHref+"&"+folderHref;
}
}
currentHref=currentHref.replace(/&p_\w+=[^&]*/g, "");
currentHref=currentHref.replace(/&PageFirstRow=[^&]*/, "");
currentHref=currentHref.replace(/&View=[^&]*/, "");
currentHref=currentHref.replace(/\?Paged=TRUE&/, "?");
if (-1==currentHref.indexOf("?"))
return currentHref+"?View="+currentViewGuid;
else
return currentHref+"&View="+currentViewGuid;
}
function DisplayItemUrl(id)
{
if (id==null || items[id]==null)
return "";
if (items[id].objType==1)
{
return CreateRootFolderHref(id);
}
else if (items[id].fUnknownImageType==true)
{
return items[id].originalImg;
}
else
{
var cmd="";
if (urlCmdForDisplay==null)
return;
cmd=urlCmdForDisplay+"&ID="+id;
cmd+="&Source="+GetSource();
var menuTR=document.getElementById("title"+id);
if (menuTR !=null)
{
var fileDir=GetAttributeFromItemTable(menuTR.parentNode.parentNode, "DRef","FileDirRef");
if (fileDir !=null && fileDir !="")
{
fileDir=escapeProperly("/"+fileDir);
cmd=cmd.replace(/RootFolder=[^&]*&/, "");
cmd=cmd+"&RootFolder="+fileDir;
}
}
return cmd;
}
}
function CallDisplayItem(id)
{
if (id==null || items[id]==null)
return;
window.location.href=DisplayItemUrl(id);
}
function DisplayItemOnFileRef(id)
{
if (!browseris.ie5up || !browseris.win32)
{
CallDisplayItem(id);
return false;
}
event.cancelBubble=true;
if (browseris.ie55up)
{
CallDisplayItem(id);
return false;
}
else
{
CallDisplayItem(id);
return true;
}
}
function CallEditItem(id)
{
var cmd="";
if (urlCmdForDisplay==null)
return;
cmd=urlCmdForDisplay+"&ID="+id;
cmd+="&Source="+GetSource();
var menuTR=document.getElementById("title"+id);
if (menuTR !=null)
{
var fileDir=GetAttributeFromItemTable(menuTR.parentNode.parentNode, "DRef","FileDirRef");
if (fileDir !=null && fileDir !="")
{
fileDir=escapeProperly("/"+fileDir);
cmd=cmd.replace(/RootFolder=[^&]*&/, "");
cmd=cmd+"&RootFolder="+fileDir;
}
}
var editUrl=cmd.replace(/dispform\.aspx/i, "EditForm.aspx");
if (editUrl !="")
window.location.href=editUrl;
}
function _DeleteImages()
{
if (tbPreview==null)
{
alert( L_NotAvailableOnWebPart_Text);
return;
}
if (!fImglibDefautlView)
{
alert(L_NotOurView_Text);
return;
}
var selectionStr=MakeSelectionStr();
if (selectionStr=="")
{
alert(L_NoImageSelected_Text);
return;
}
if (GetLayoutUrl()=="")
return;
var confirmed=false;
if (GetSelectionCount() > 1)
{
if (confirm(ctx.RecycleBinEnabled ? L_RecycleMultipleItems_Text : L_DeleteMultipleItems_Text))
confirmed=true;
}
else
{
if (confirm(ctx.RecycleBinEnabled ? L_RecycleSingleItem_Text : L_DeleteSingleItem_Text))
confirmed=true;
}
if (confirmed)
{
var deleteUrl=GetLayoutUrl()+"DeleteMu.aspx";
deleteUrl+="?List="+vCurrentListID+ "&SelectedIds="+MakeSelectionStr()+ "&Source="+GetSource();
var form=document.forms[MSOWebPartPageFormName];
if (null !=form)
{
ClearSelections();
form.action=deleteUrl;
form.method="POST";
form.submit();
}
}
}
function GetUint(str)
{
var ui=parseInt(str.replace(/,/g, ""));
if (ui > 0)
return ui;
return 0;
}
function GetScaleRatio(w, h, spaceW, spaceH)
{
var ratio1=(spaceW * 1.) / w;
var ratio2=(spaceH * 1.) / h;
var ratio=(ratio1 > ratio2) ? ratio2 : ratio1;
if (ratio > 1)
ratio=1;
return ratio;
}
function GetHeight(w, h, spaceW, spaceH)
{
if (w==0 || h==0)
return spaceH;
var result=h * GetScaleRatio(w, h, spaceW, spaceH);
if (result < 1.0)
return 1;
else
return result;
}
function GetWidth(w, h, spaceW, spaceH)
{
if (w==0 || h==0)
return spaceH;
var result=w * GetScaleRatio(w, h, spaceW, spaceH);
if (result < 1.0)
return 1;
else
return result;
}
function UIChangeList(id, fSelected)
{
if (id < 0 || items[id]==null)
return;
if (items[id].objType !=0)
return;
var chkBox=document.getElementById("cbx_"+id);
if (chkBox !=null)
{
chkBox.checked=fSelected;
}
if (!browseris.ie5up || !browseris.win32)
return;
var row=document.getElementById("row"+id);
if (row !=null)
{
if (fSelected==true)
row.className="ms-imglibselectedrow";
else
row.className="";
}
}
function MouseOverRow(id)
{
if (tbPreview==null)
return;
if (FILIsMenuShown()==1)
return;
if (timedItem !=id)
{
if (previewTimer >=0) clearTimeout(previewTimer);
previewTimer=setTimeout("HiLiteRow("+id+")", 200);
timedItem=id;
}
}
function MouseOutRow(id)
{
if (tbPreview==null)
return;
if (FILIsMenuShown()==1)
return;
if (previewTimer >=0 && timedItem==id)
{
clearTimeout(previewTimer);
previewTimer=-1;
timedItem=-1;
}
}
function HiLiteRow(id)
{
if (!fImglibDefautlView) return;
if (fInit==false)
{
InitItems();
fInit=true;
}
if (id < 0 || items[id]==null)
return;
if (tbPreview==null)
return;
previewedId=id;
if (tbImg)
{
tbImg.src=EncodedThumbnailImage(id);
if (items[id].alt==null || items[id].alt=="")
{
tbImg.alt=picturePreviewAlt;
}
else
{
tbImg.alt=items[id].alt;
}
tbImg.width=GetWidth(items[id].imgWidth, items[id].imgHeight, 120, 90);
tbImg.height=GetHeight(items[id].imgWidth, items[id].imgHeight, 120, 90);
}
if (tbTitle)
{
tbTitle.innerHTML=items[id].caption;
}
if (!browseris.ie5up || !browseris.win32)
return;
var row=document.getElementById("title"+id);
if (row !=null)
{
if (hilitedRow==row)
return;
else if (hilitedRow !=null)
{
hilitedRow.children[1].style.visibility="hidden";
hilitedRow.parentNode.parentNode.className="ms-unselectedtitle";
}
hilitedRow=row;
row.children[1].className="ms-menuimagecell";
row.children[1].style.visibility="visible";
row.parentNode.parentNode.className="ms-selectedtitle";
}
}
function ClickRow(id)
{
if (!fImglibDefautlView) return;
if (tbPreview==null)
return;
if (id < 0 || items[id]==null)
return;
if (browseris.ie)
event.cancelBubble=true;
HiLiteRow(id);
ILShowMenu(id);
}
function ContextMenuOnRow(id)
{
if (!browseris.ie55up || !browseris.win32)
return true;
if (event.srcElement.tagName=="A" )
return true;
ClickRow(id);
return false;
}
function FILIsMenuShown()
{
if (!browseris.ie5up || !browseris.win32)
return false;
if (lastMenuId=="")
return 0;
var m=document.getElementById(lastMenuId);
if (m !=null)
{
var fIsOpen=false;
//@cc_on
//@if (@_jscript_version >=5)
//@ try {
//@ fIsOpen=m.isOpen();
//@ } catch (e) {};
//@else
//@end
if (!fIsOpen)
lastMenuId="";
return fIsOpen;
}
return 0;
}
function ILShowMenu(itemID)
{
if (!browseris.ie5up || !browseris.win32)
return;
if (!browseris.ie55up)
{
CallEditItem(itemID);
return;
}
var menuId="plmenu_"+itemID;
var m=document.getElementById(menuId);
if (m==null)
{
m=CMenu(menuId);
}
else
{
m.innerHTML="";
}
currentItemID=itemID;
currentItemFileUrl=items[itemID].originalImg;
currentItemFSObjType=items[itemID].objType;
currentItemPermMaskH=null;
itemId=itemID;
var menuTR=document.getElementById("title"+itemID);
if (menuTR !=null)
{
currentItemCheckedOutUserId=menuTR.COUId;
itemTable=menuTR.parentNode.parentNode;
if (items[itemID].fUnknownImageType==false)
{
itemTable.IsImage="1";
}
else if (items[itemID].objType !=1)
{
itemTable.IsImage="";
}
}
ctx.isWebEditorPreview=0;
AddDocLibMenuItems(m, ctx);
lastMenuId=menuId;
if (menuTR !=null)
{
OMenu(m, menuTR.parentNode.parentNode);
}
else
{
OMenu(m, window.event.srcElement.parentNode);
}
}
function InitItems()
{
tbImg=document.getElementById("ImgPreviewThumbnail");
if (tbImg!=null)
picturePreviewAlt=tbImg.alt;
if (browseris.ie)
{
tbPreview=document.getElementById("ImgPreviewTable");
tbTitle=document.getElementById("lnkPreviewTitle");
}
else
{
if (browseris.nav6up)
{
tbPreview=document.getElementById("ImgPreviewTable");
if (tbPreview !=null)
tbPreview.style.display="block";
}
tbTitle=document.anchors["lnkPreviewTitle"];
}
}
function AddSelectAllCheckbox()
{
var chkBox=document.getElementById("diidHeaderImageSelectedFlag");
if (chkBox==null)
return;
var tdHeadChkBox=null;
if (browseris.nav6up)
tdHeadChkBox=chkBox.parentNode;
else
tdHeadChkBox=chkBox.parentNode;
if (tdHeadChkBox==null || tdHeadChkBox.tagName.toLowerCase() !="th")
return;
if (firstIdWithCheckbox==-1)
tdHeadChkBox.innerHTML="";
else
{
tdHeadChkBox.innerHTML="";
var chkBoxs=document.getElementsByName("selectionCheckBox");
if (chkBoxs==null)
return;
for (i=0; i < chkBoxs.length; i++)
{
var chkBox=chkBoxs[i];
if (chkBox !=null)
{
chkBox.disabled=false;
chkBox.style.visibility="visible";
if (browseris.ie)
{
chkBox.parentNode.width=30;
chkBox.style.height=18;
}
}
}
}
}
function ClickPreview()
{
CallDisplayItem(previewedId);
}
function ClickThumbnail(id)
{
CallDisplayItem(id);
}
function UIChangeThumbnail(id, fSelected)
{
if (items[id]==null || items[id].objType !=0)
return;
var tbImg=document.getElementById("tb_"+id);
if (null==tbImg)
return;
var chkBox=document.getElementById("cbxTB_"+id);
if (chkBox !=null)
{
chkBox.checked=fSelected;
}
if (fSelected)
{
tbImg.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.style.background="#99BBFF";
}
else
{
tbImg.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.style.background="";
}
}
function CreateTile(id)
{
var cellSize=listInfo.thumbnailSize+10;
var str="";
if (!browseris.ie)
{
return;
}
else
{
str="\n";
document.write(str);
}
}
function UIChangeFilmstrip(id, fSelected)
{
var item;
for (item=currentPicture; item < currentPicture+stripSize; item++)
{
if (ids[item]==id)
break;
}
if (item >=currentPicture+stripSize)
return;
var cbxObj=document.getElementById("cbxFS_"+(item - currentPicture));
if (cbxObj !=null && cbxObj.tagName.toLowerCase()=="input")
cbxObj.checked=fSelected;
}
function LoadNextPicture(fAccending)
{
event.cancelBubble=true;
if (ids.length <=stripSize)
return;
var frmImg=null;
if (currentStrip >=0 && currentStrip < stripSize)
{
frmImg=document.getElementById("fstb"+currentStrip);
if (frmImg !=null)
{
frmImg.parentNode.className="";
frmImg.parentNode.style.borderWidth="0px";
}
}
if (fAccending==1)
{
if (currentPicture+stripSize >=ids.length)
return;
currentPicture=currentPicture+1;
currentStrip=currentStrip - 1;
}
else
{
if (currentPicture <=0)
return;
currentPicture=currentPicture - 1;
currentStrip=currentStrip+1;
}
for (var i=0; i < stripSize; i++)
{
var currentId=ids[currentPicture+i];
var frmImg=document.getElementById("fstb"+i);
if (frmImg !=null)
{
frmImg.src=EncodedThumbnailImage(currentId);
frmImg.height=GetHeight(items[currentId].imgWidth, items[currentId].imgHeight, 96, 96);
frmImg.width=GetWidth(items[currentId].imgWidth, items[currentId].imgHeight, 96, 96);
if (items[currentId].alt !="")
{
frmImg.alt=items[currentId].alt;
}
else if (items[currentId].objType !=0)
{
frmImg.alt=L_FolderAlt_Text;
}
else if (items[currentId].fUnknownImageType==true)
{
frmImg.alt=L_DocumentAlt_Text;
}
else
{
frmImg.alt=L_ImgAlt_Text;
}
}
var cbxObj=document.getElementById("cbxFS_"+i);
if (cbxObj !=null && cbxObj.tagName.toLowerCase()=="input")
{
if (items[currentId].objType !=0)
{
cbxObj.style.display="none";
cbxObj.checked=false;
}
else
{
cbxObj.style.display="inline";
cbxObj.checked=items[currentId].fSelected;
}
}
var titleObj=document.getElementById("title_"+i);
if (titleObj !=null)
titleObj.innerHTML=items[currentId].caption;
}
var backGif;
var forwardGif;
if (fRTL)
{
backGif=ctx.imagesPath+"plslforw.gif";
forwardGif=ctx.imagesPath+"plslback.gif";
}
else
{
backGif=ctx.imagesPath+"plslback.gif";
forwardGif=ctx.imagesPath+"plslforw.gif";
}
if (currentPicture==0)
{
document.getElementById("backgif").parentNode.parentNode.style.display="none";
}
else
{
document.getElementById("backgif").parentNode.parentNode.style.display="block";
}
if (currentPicture+stripSize >=ids.length)
{
document.getElementById("forwardgif").parentNode.parentNode.style.display="none";
}
else
{
document.getElementById("forwardgif").parentNode.parentNode.style.display="block";
}
if (currentStrip >=0 && currentStrip < stripSize)
{
frmImg=document.getElementById("fstb"+currentStrip);
if (frmImg !=null)
{
frmImg.parentNode.className="ms-imglibthumbnail";
frmImg.parentNode.style.borderWidth="3px";
}
}
return false;
}
function ClickFrame(frame)
{
if (frame < 0 || frame >=stripSize)
return false;
var currentId=ids[currentPicture+frame];
previewedId=currentId;
var frmImg=null;
if (currentStrip >=0 && currentStrip < stripSize)
{
frmImg=document.getElementById("fstb"+currentStrip);
if (frmImg !=null)
{
frmImg.parentNode.className="";
frmImg.parentNode.style.borderWidth="0";
}
}
currentStrip=frame;
frmImg=document.getElementById("fstb"+currentStrip);
if (frmImg !=null)
{
frmImg.parentNode.className="ms-imglibthumbnail";
frmImg.parentNode.style.borderWidth="3px";
frmImg.focus();
}
var imgCur=document.getElementById('CurrentPic');
if (imgCur !=null)
{
var fDelay=0;
imgCur.style.visibility="hidden";
if (browseris.ie55up && browseris.win32 && items[currentId].objType !=1 && !items[currentId].fUnknownImageType)
{
var imgSyncer=document.getElementById("webImageSyncer");
if (imgSyncer !=null && imgSyncer.imagedata !=null)
{
imgSyncer.imagedata.src=EncodedWebImage(currentId);
fDelay=1;
}
}
if (fDelay==0)
{
imgCur.src=EncodedWebImage(currentId);
imgCur.alt=GetAltText(currentId);
}
else
{
window.setTimeout("document.getElementById('CurrentPic').src=EncodedWebImage("+currentId+"); document.getElementById('CurrentPic').alt=GetAltText("+currentId+");", 500);
}
imgCur.height=GetHeight(items[currentId].imgWidth, items[currentId].imgHeight, 448, 448);
imgCur.width=GetWidth(items[currentId].imgWidth, items[currentId].imgHeight, 448, 448);
}
var origPicLink=GetLinks("OriginalPicLink");
var openItemLnk=GetLinks("OpenItemLink");
if (origPicLink !=null)
{
if (items[currentId].objType==1)
{
var newHref=CreateRootFolderHref(currentId);
if (newHref !="")
origPicLink.href=newHref;
document.getElementById("descrRow").style.visibility="hidden";
imgCur.alt=L_GotoFolder_Text;
}
else
{
origPicLink.href=items[currentId].originalImg;
document.getElementById("descrRow").style.visibility="visible";
if (items[currentId].alt !="")
imgCur.alt=items[currentId].alt;
else
imgCur.alt=L_AltViewProperty_Text;
}
origPicLink.href=DisplayItemUrl(currentId);
}
if (openItemLnk !=null)
{
openItemLnk.href=DisplayItemUrl(currentId);
}
document.getElementById("titleSpan").innerHTML=items[currentId].caption;
document.getElementById("descrSpan").innerHTML=items[currentId].description;
if (items[currentId].fUnknownImageType && items[currentId].objType==0)
{
imgCur.style.display="none";
document.getElementById("noPreviewSpan").style.display="block";
}
else
{
imgCur.style.display="block";
document.getElementById("noPreviewSpan").style.display="none";
}
return false;
}
function ToggleSelectedItem(i)
{
if (i < 0 || i >=stripSize)
return;
if (currentPicture+i < ids.length)
ToggleSelection(ids[currentPicture+i]);
}
function FilmstripTbKeyPressed(frame)
{
if (event.keyCode !=13)
return true;
event.cancelBubble=true;
ClickFrame(frame);
return false;
}
function FilmstripKeyPressed()
{
var step;
if (event.keyCode==37)
{
if (fRTL)
step=1;
else
step=-1;
}
else if (event.keyCode==39)
{
if (fRTL)
step=-1;
else
step=1;
}
else
return;
if (currentStrip < 0 || currentStrip >=stripSize)
{
if (step > 0)
ClickFrame(stripSize - 1);
else
ClickFrame(0);
return;
}
var nextStrip=currentStrip+step;
if (nextStrip < 0 || nextStrip >=stripSize)
{
LoadNextPicture(step==1);
}
nextStrip=currentStrip+step;
if (nextStrip < 0 || nextStrip >=stripSize)
{
if (step > 0)
ClickFrame(stripSize - 1);
else
ClickFrame(0);
return;
}
ClickFrame(nextStrip);
}
function CreateStrip()
{
var str1;
var str11=")' onkeydown='Javascript:FilmstripTbKeyPressed(";
var str113=");'>
ids.length)
stripSize=ids.length;
document.write("");
for (var i=0; i < stripSize; i++)
{
strOut=str1+i+str11+i+str113;
if (i==currentStrip)
strOut+=" class=ms-imglibthumbnail border:3";
strOut+=str115+i+str2+i+str200;
if (items[ids[i]].alt !="")
strOut+=STSHtmlEncode(items[ids[i]].alt);
else if (items[ids[i]].objType==1)
strOut+=L_FolderAlt_Text;
else if (items[ids[i]].fUnknownImageType==true)
strOut+=L_DocumentAlt_Text;
else
strOut+=L_ImgAlt_Text;
strOut+=str20+GetHeight(items[ids[i]].imgWidth, items[ids[i]].imgHeight, 96, 96)+str21+i+str3+items[ids[i]].thumbnail+str4+i;
strOut+=" onclick=ToggleSelectedItem("+i+")";
if (items[ids[i]].objType==1)
strOut+=hideCheckBox;
strOut+=str5+i+str6+i+str6b+items[ids[i]].caption+str7;
document.write(strOut);
}
document.write(" ");
}
function UIChange(item, fSelected)
{
if (browseris.ie && tbPreview !=null)
{
UIChangeThumbnail(item, fSelected);
UIChangeFilmstrip(item, fSelected);
}
UIChangeList(item, fSelected);
}
function GenerateFooterContent(viewStyle, fVisible)
{
if (viewStyle=="thumbnail")
{
if (browseris.ie)
{
var str="";
else
str+=" dir=ltr>";
document.write(str);
for (j=0; j < ids.length; j++)
CreateTile(ids[j]);
document.write(" | ");
}
}
else if (viewStyle=="filmstrip")
{
if (currentPicture+stripSize > ids.length)
currentPicture=ids.length - stripSize;
if (currentPicture < 0)
currentPicture=0;
currentStrip=0;
var currentId=ids[currentPicture+currentStrip];
previewedId=currentId;
var strScript="";
var backGif;
var forwardGif;
var blankGif="/blank.gif";
if (fRTL)
{
backGif="/forward.gif";
forwardGif="/back.gif";
}
else
{
backGif="/back.gif";
forwardGif="/forward.gif";
}
strScript+="";
strScript+="";
document.write(strScript);
CreateStrip();
strScript=" | ";
strScript+=" ";
document.write(strScript);
strScript="";
strScript=strScript+"";
strScript=strScript+""+L_NoPreview_Text+" "+L_OpenItem_Text+"";
strScript=strScript+" | "+L_FileName_Text+": | | ";
strScript=strScript+""+items[currentId].caption+" | ";
strScript=strScript+L_Description_Text+": | | "+items[currentId].description+" |
|
| ";
document.write(strScript);
}
}
function ViewHeaderScript(viewStyle, webImageWidth, webImageHeight, thumbnailSize)
{
if (viewStyle=="list" || viewStyle=="filmstrip")
{
currentViewStyle=viewStyle;
}
else
{
currentViewStyle="thumbnail";
}
listInfo=new CListInfo(webImageWidth, webImageHeight, thumbnailSize);
InitViewUrls();
}
function ViewFooterScript()
{
InitItems();
if (!browseris.ie5up || !browseris.win32)
{
if (firstId !=-1)
{
var scriptStr="HiLiteRow("+firstId+")";
window.setTimeout(scriptStr, 200);
}
if (fSelectFieldAppeared)
{
if (tbPreview !=null)
AddSelectAllCheckbox();
}
return;
}
fInit=true;
if (tbPreview !=null)
{
listDirection=document.getElementById("selectionCacheMgr").parentNode.parentNode.parentNode.currentStyle.direction;
if (listDirection !="rtl" && listDirection !="RTL")
listDirection="ltr";
else
{
fRTL=true;
var previewTitleLink=GetLinks("lnkPreviewTitle");
if (previewTitleLink !=null)
{
previewTitleLink.style.direction="RTL";
}
}
if (currentViewStyle=="thumbnail")
{
GenerateFooterContent("thumbnail", true);
GenerateFooterContent("filmstrip", false);
document.getElementById("selectionCacheMgr").parentNode.parentNode.style.display="none";
}
else if (currentViewStyle=="filmstrip")
{
GenerateFooterContent("thumbnail", false);
GenerateFooterContent("filmstrip", true);
document.getElementById("selectionCacheMgr").parentNode.parentNode.style.display="none";
}
else
{
GenerateFooterContent("thumbnail", false);
GenerateFooterContent("filmstrip", false);
}
}
if (firstId !=-1)
{
HiLiteRow(firstId);
if (tbPreview !=null)
{
if (currentViewStyle=="list")
tbPreview.style.display="block";
else
tbPreview.style.display="none";
}
if (fSelectFieldAppeared)
{
if (tbPreview !=null)
AddSelectAllCheckbox();
}
}
if (tbPreview !=null)
{
if (browseris.verIEFull >=5.5 && browseris.iever < 6 && browseris.win32)
setTimeout("InitSelection()", 500);
else if (browseris.ie5up && browseris.win32)
InitSelection();
}
}
function ViewPreBodyScript(id)
{
document.write(" |
");
}
function ViewPostBodyScript(id)
{
document.write("
");
}
var bTranState=0;
var slideshowInterval=5000;
var slideshowIncremental=500;
var timerId=-1;
var fAutoRun=false;
var fRepeat=false;
var fRetry=0;
var fRetryLimit=2;
function LoadNextSlide()
{
if (fNextImageLoaded==false && (fRetry < fRetryLimit))
{
fRetry++;
return;
}
fRetry=0;
if (currentPicture >=ids.length)
{
if (!fRepeat)
{
return;
}
else
{
currentPicture=0;
}
}
pic1=document.getElementById("thisPic");
if (browseris.ie5up && browseris.win32)
pic1.style.visibility="hidden";
pic1.src=EncodedWebImage(ids[currentPicture]);
pic1.alt=GetAltText(ids[currentPicture]);
pic1.height=GetHeight(items[ids[currentPicture]].imgWidth, items[ids[currentPicture]].imgHeight, listInfo.webImageWidth, listInfo.webImageHeight);
pic1.width=GetWidth(items[ids[currentPicture]].imgWidth, items[ids[currentPicture]].imgHeight, listInfo.webImageWidth, listInfo.webImageHeight);
document.getElementById("tdCaption").innerHTML=items[ids[currentPicture]].caption+"
";
document.getElementById("tdDesc").innerHTML=items[ids[currentPicture]].description+"
";
document.getElementById("tdImgDate").innerHTML=items[ids[currentPicture]].createdDate+"
";
currentPicture++;
document.getElementById("currentCount").innerHTML=""+currentPicture;
if ((currentPicture+1) < ids.length)
{
if (browseris.ie5up && browseris.win32)
fNextImageLoaded=false;
pic2=document.getElementById("nextPic");
pic2.src=EncodedWebImage(ids[currentPicture+1]);
}
}
function AutoRun()
{
if (fAutoRun)
{
LoadNextSlide();
timerId=setTimeout("AutoRun()", slideshowInterval);
}
}
function StartSlideShow()
{
if (fAutoRun)
return;
fAutoRun=true;
timerId=setTimeout("AutoRun()", slideshowInterval);
}
function StopSlideShow()
{
PauseSlideShow();
currentPicture=0;
LoadNextSlide();
}
function PauseSlideShow()
{
if (fAutoRun)
{
if (timerId !=-1)
{
clearTimeout(timerId);
timerId=-1;
}
fAutoRun=false;
}
}
function ToggleRepeat()
{
fRepeat=!fRepeat;
}
function NextSlide()
{
if (browseris.ie)
event.bubble=false;
PauseSlideShow();
if (currentPicture < ids.length)
{
if (currentPicture >=0)
{
fRetry=fRetryLimit;
LoadNextSlide();
}
}
}
function PreviousSlide()
{
if (browseris.ie)
event.bubble=false;
PauseSlideShow();
if (currentPicture > 1)
{
currentPicture --;
currentPicture --;
fRetry=fRetryLimit;
LoadNextSlide();
}
}
function HiliteButton()
{
if (!browseris.ie)
return;
var img=event.srcElement;
var imgSrc=img.src;
imgSrc=imgSrc.replace(/1.gif$/g, "2.gif");
img.src=imgSrc;
}
function DemoteButton()
{
if (!browseris.ie)
return;
var img=event.srcElement;
var imgSrc=img.src;
imgSrc=imgSrc.replace(/2.gif$/g, "1.gif");
img.src=imgSrc;
}
function ShowSlidePic()
{
if (browseris.ie5up && browseris.win32)
{
var pic1=document.getElementById("thisPic");
if (pic1 !=null)
pic1.style.visibility="visible";
}
}
function SortIds()
{
var currentUrl=window.location.href;
var qmarkPosition=currentUrl.indexOf("?");
var suffix="";
if (qmarkPosition !=-1)
suffix=currentUrl.substring(qmarkPosition+1, currentUrl.length);
else
return;
var queryVariables=suffix.split("&");
var filterSubstr=suffix.match(/InstanceID=all&FilterName=ID&FilterMultiValue=([^&]*)/);
if (filterSubstr !=null)
filterIdsStr=filterSubstr[1];
if (filterIdsStr=="" || filterIdsStr==null)
return;
var filterIds=new Array;
var idsSubStrs=filterIdsStr.split(";");
for (i=0, j=0; i < idsSubStrs.length; i++)
{
var id=parseInt(idsSubStrs[i]);
if (id >=0 && items[id] !=null)
filterIds[filterIds.length]=id;
}
ids=filterIds;
filterIds=null;
}
function SlideShowContent()
{
if (ids.length==0)
return;
SortIds();
if (currentPicture < 0)
currentPicture=0;
if (currentPicture >=ids.length)
currentPicture=ids.length - 1;
var str="";
str+="";
str+=" | ";
str+="";
str+="";
var preloadStr="";
str+=preloadStr;
str+=" | ";
str+=" | | "
str+="
";
document.write(str);
}
function RecursiveViewHeaderScript(viewStyle, webImageWidth, webImageHeight, thumbnailSize)
{
fRecursive=true;
listInfo=new CListInfo(webImageWidth, webImageHeight, thumbnailSize);
if (viewStyle=="details")
{
currentRecursiveViewStyle=viewStyle;
document.write("");
}
else
{
currentRecursiveViewStyle="slideshow";
document.write("");
}
}
function RecursiveViewFooterScript()
{
if (!browseris.ie5up || !browseris.win32)
return;
listDirection=document.getElementById("selectionCacheMgr").parentNode.parentNode.parentNode.currentStyle.direction;
if (listDirection !="rtl" && listDirection !="RTL")
listDirection="ltr";
else
fRTL=true;
if (browseris.verIEFull >=5.5 && browseris.iever < 6 && browseris.win32)
setTimeout("InitSelection()", 500);
else if (browseris.ie5up && browseris.win32)
InitSelection();
}
function CItem(originalImageUrl, id, baseName, extension, imgWidthStr, imgHeightStr, titleStr, descriptionStr, objectType, iconUrl, fNewItem)
{
this.baseName=baseName;
this.title=titleStr;
this.originalImg=originalImageUrl;
this.imgWidth=GetUint(imgWidthStr);
this.imgHeight=GetUint(imgHeightStr);
this.id=id;
this.fSelected=false;
this.fNewItem=fNewItem;
this.description=STSHtmlEncode(descriptionStr);
this.description=this.description.replace(/\r?\n/g, "
\n");
this.alt=descriptionStr;
this.objType=objectType;
this.fUnknownImageType=true;
this.iconUrl=iconUrl;
this.caption=baseName;
if (objectType==1)
{
if ("" !=extension)
this.caption+="."+extension;
this.thumbnail=this.webimage=ctx.imagesPath+"/fldrnew.gif";
this.imgWidth=this.imgHeight=37;
return;
}
if (originalImageUrl=="")
return;
var lastSlashIndex=originalImageUrl.lastIndexOf("/");
if (lastSlashIndex <=0)
return;
var originalLocation=originalImageUrl.substring(0, lastSlashIndex+1);
if (this.imgWidth > 0 && this.imgHeight > 0)
{
baseName=escapeProperly(baseName);
this.thumbnail=originalLocation+"_t/"+baseName+"_"+extension+".jpg";
this.webimage=originalLocation+"_w/"+baseName+"_"+extension+".jpg";
this.fUnknownImageType=false;
}
else
{
this.thumbnail=this.webimage=ctx.imagesPath+"/"+iconUrl;
this.imgWidth=this.imgHeight=32;
}
}
function InsertItem(originalImageUrl, id, baseName, extension, imgWidthStr, imgHeightStr, titleStr, descriptionStr, objectType, iconUrl, fNewItem)
{
if (originalImageUrl=="")
return;
items[id]=new CItem(originalImageUrl, id, baseName, extension, imgWidthStr, imgHeightStr, titleStr, descriptionStr, objectType, iconUrl, fNewItem);
if (firstId==-1) firstId=id;
ids[ids.length]=id;
}
function TryLaunchPictureLibrary(listId, listUrl, webUrl)
{
vCurrentListID=listId;
vCurrentListUrlAsHTML=listUrl;
vCurrentWebUrl=webUrl;
var fUploadStarted=StartOIS("ois.exe /upload \""+listUrl+"\"");
if (!fUploadStarted)
return false;
GotoInfoPage("uploading");
return true;
}
function ViewSlideShow(url, webImageWidth, webImageHeight)
{
var slideShowUrl=url+"slidshow.aspx?ViewStyle=slideshow";
var rootFolder=GetUrlKeyValue("RootFolder", true );
if (rootFolder !="")
slideShowUrl+="&RootFolder="+rootFolder;
var width=240+webImageWidth;
var height=160+webImageHeight;
var win=window.open(slideShowUrl, "slideshow", "height="+height+",width="+width+",toolbar=no,menubar=no,scrollbars=no");
if (win !=null)
win.focus();
}