/**
* @author Created by: Shan
* @author Updated by: Shan
*
* Description: This JS is consists all the Ajax functions and VO's with regard to A1 page.
*
* (c) Copyright 2008, Scripps Networks Interactive. All rights reserved.
* This software contains confidential information and trade secrets
* of Scripps Networks Interactive. Use, disclosure, or reproduction is
* prohibited without the prior written consent of Scripps Networks Interactive.
*
*/
/* ValueObject Definitions Starts Here */
// Channel Value Objects .....
function Channel(chid,caption,creationdate,siteicon,objectFullcaption, lockuserid, lockpassword, lockuseremail)
{
// Setters ....
this._channelId = chid;
this._channelCaption = caption;
this._channelCreationDate = creationdate;
this._siteIcon=siteicon;
this._objectFullcaption=objectFullcaption;
this._lockuserid=lockuserid;
this._lockpassword=lockpassword;
this._lockuseremail = lockuseremail;
// Getters ....
this.getChannelId = function()
{
return this._channelId;
};
this.getChannelCaption = function()
{
return this._channelCaption;
};
this.getChannelCreationDate = function()
{
return this._channelCreationDate;
};
this.getSiteIcon = function()
{
return this._siteIcon;
};
this.getObjectFullCaption=function()
{
return this._objectFullcaption;
}
this.getLockuserid=function()
{
return this._lockuserid;
}
this.getLockpassword=function()
{
return this._lockpassword;
}
this.getLockuseremail=function()
{
return this._lockuseremail;
}
}
/* ValueObject Definitions Ends Here */
/*
* Global Variable Declarations starts Here ....
*/
var channelObjectArray = new Array();
var totalNoOfChannelsPage = 0;
//var channelPageLen = 5;
var channelPageLen = 10;
var ie=document.all;
// global error constants
var serverError = "You found an opportunity for improvement! Please try again later"
var connectionError = "There appears to be a connectivity problem. Please check your internet connection and try again."
/*
* Global Variable Declarations Ends Here ....
*/
function Split_into_Array(input,seperator)
{
var temp = new Array();
while(input.indexOf(seperator)!=-1)
{
temp[temp.length] = input.substring(0,input.indexOf(seperator));
input = input.substring(input.indexOf(seperator)+1,input.length);
}
temp[temp.length] = input;
return temp;
}
function searchProjects(loadPageNo)
{
//alert("here");
var sy=document.getElementById('start_yyyy').value;
var sd=document.getElementById('start_dd').value;
var sm=document.getElementById('start_mm').value;
var em=document.getElementById('end_mm').value;
var ed=document.getElementById('end_dd').value;
var ey=document.getElementById('end_yyyy').value;
var site=document.getElementById('site').value;
var tags=document.getElementById('tags').value;
var search_text=document.getElementById('search_text').value;
var object_type=document.getElementById('sot').value;
var assetscope=2;
if(document.getElementById('assetscope'))
{
assetscope=document.getElementById('assetscope').value;
}
var sea_status=document.getElementById('Seastatusdrop').value;
//receive_projects(sy,sd,sm,em,ed,ey,site,"asst",loadPageNo, tags, search_text, object_type);
receive_projects(sy,sd,sm,em,ed,ey,site,assetscope,loadPageNo, tags, search_text, object_type,sea_status);
}
function searchWithinContainer()
{
//==
var sy=document.getElementById('start_yyyy').value;
var sd=document.getElementById('start_dd').value;
var sm=document.getElementById('start_mm').value;
var em=document.getElementById('end_mm').value;
var ed=document.getElementById('end_dd').value;
var ey=document.getElementById('end_yyyy').value;
var site=document.getElementById('site').value;
var tags=document.getElementById('tags').value;
var search_text=document.getElementById('search_text').value;
var object_type=document.getElementById('sot').value;
var assetscope=6;
var sea_status=document.getElementById('Seastatusdrop').value;
var channelId = document.getElementById("chSelId").value;
var searchType=document.getElementById('searchType').value;
//==
var query_str =
"start_yyyy="+sy+"&start_mm="+sm+"&start_dd="+sd+
"&end_yyyy="+ey+"&end_mm="+em+"&end_dd="+ed+
"&scope=6"+
"&site="+site+
//"&tags="+tags+
"&search_text="+search_text+
"&sot="+object_type+
"&status="+sea_status+
"&pageNumber="+1+
"&chSelId="+channelId+
"&searchType="+searchType;
//"&sortBy="+sortBy;
document.adminsearchbox.method="POST";
document.adminsearchbox.action="searchProject_p2.do?"+query_str;
document.adminsearchbox.submit();
}
function removeFilterProjects(loadPageNo)
{
document.getElementById('start_yyyy').value = 2008;
document.getElementById('start_dd').value = 1;
document.getElementById('start_mm').value = 1;
document.getElementById('end_mm').value = 12;
document.getElementById('end_dd').value = 31;
document.getElementById('end_yyyy').value = 2009;
var sy=document.getElementById('start_yyyy').value;
var sd=document.getElementById('start_dd').value;
var sm=document.getElementById('start_mm').value;
var em=document.getElementById('end_mm').value;
var ed=document.getElementById('end_dd').value;
var ey=document.getElementById('end_yyyy').value;
document.getElementById('site').value=-1;
document.getElementById('tags').value="";
document.getElementById('search_text').value="";
var object_type=document.getElementById('sot').value;
receive_projects(sy,sd,sm,em,ed,ey,"-1","asst",loadPageNo, "", "", object_type);
}
var GlobalId_Array = new Array();
function loadLibraryOnKeyUp(e)
{
var searchLibrarary = document.getElementById('searchLibrary_txt').value;
var nn6=document.getElementById&&!document.all
var fobj = nn6 ? e.target : event.srcElement
var KeyID = (window.event) ? event.keyCode : e.keyCode
if(KeyID==13)
{
if(searchLibrarary!="")
loadLibrary()
}
}
function loadLibrary()
{
var fromDate="";
var toDate = "";
var parId = document.getElementById('objectId').value;
var objType = "2";
var assetType = document.getElementById('assettype_sel').value;
var channelsite = document.getElementById('channelSite_sel').value;
var producer = document.getElementById('a1a_producer_sel').value;
var searchLibrarary = document.getElementById('searchLibrary_txt').value;
var searchTag = document.getElementById('searchTags_txt').value;
var uploadFromDay = document.getElementById('upload_from_day_sel').value;
var uploadFromMonth = document.getElementById('upload_from_month_sel').value;
var uploadFromYear = document.getElementById('upload_from_year_sel').value;
var uploadToDay = document.getElementById('upload_to_day_sel').value;
var uploadToMonth = document.getElementById('upload_to_month_sel').value;
var uploadToYear = document.getElementById('upload_to_year_sel').value;
var pagNumber = "1";//document.getElementById('librarayPageNum').value;
var copyright = "0"; //document.getElementById('copyright_sel').value;
var sortBy = "0"; //document.getElementById('sortby_sel').value;
var currentTime = new Date();
var hours = currentTime.getHours();
var minutes = currentTime.getMinutes();
var seconds = currentTime.getSeconds();
if(pagNumber==""){
pagNumber="1";
}
fromDate = uploadFromYear+"-"+uploadFromMonth+"-"+uploadFromDay;//+" "+hours+":"+minutes+":"+seconds;
toDate = uploadToYear+"-"+uploadToMonth+"-"+uploadToDay;//+" "+hours+":"+minutes+":"+seconds;
/*
if(assetType=="0" && channelsite=="-1"
&& searchLibrarary=="" && searchTag==""){
fromDate = "null";
toDate = "null";
}
*/
//alert(parId+","+objType+","+pagNumber+","+copyright+","+assetType+","+sortBy+","+searchLibrarary);
//receive_library(parId,objType,'1','1','1','1','');
receive_library(parId,objType,pagNumber,copyright,assetType,sortBy,searchLibrarary,channelsite,fromDate,toDate,searchTag,producer);
}
function loadLibraryWithPage()
{
var fromDate="";
var toDate = "";
var parId = document.getElementById('objectId').value;
var objType = "2";
var assetType = document.getElementById('assettype_sel').value;
var channelsite = document.getElementById('channelSite_sel').value;
var producer = document.getElementById('a1a_producer_sel').value;
var searchLibrarary = document.getElementById('searchLibrary_txt').value;
var searchTag = document.getElementById('searchTags_txt').value;
var uploadFromDay = document.getElementById('upload_from_day_sel').value;
var uploadFromMonth = document.getElementById('upload_from_month_sel').value;
var uploadFromYear = document.getElementById('upload_from_year_sel').value;
var uploadToDay = document.getElementById('upload_to_day_sel').value;
var uploadToMonth = document.getElementById('upload_to_month_sel').value;
var uploadToYear = document.getElementById('upload_to_year_sel').value;
var pagNumber = document.getElementById('librarayPageNum').value;
var copyright = "0"; //document.getElementById('copyright_sel').value;
var sortBy = "0"; //document.getElementById('sortby_sel').value;
var currentTime = new Date();
var hours = currentTime.getHours();
var minutes = currentTime.getMinutes();
var seconds = currentTime.getSeconds();
if(pagNumber==""){
pagNumber="1";
}
fromDate = uploadFromYear+"-"+uploadFromMonth+"-"+uploadFromDay;//+" "+hours+":"+minutes+":"+seconds;
toDate = uploadToYear+"-"+uploadToMonth+"-"+uploadToDay;//+" "+hours+":"+minutes+":"+seconds;
/*
if(assetType=="0" && channelsite=="-1"
&& searchLibrarary=="" && searchTag==""){
fromDate = "null";
toDate = "null";
}
*/
//alert(parId+","+objType+","+pagNumber+","+copyright+","+assetType+","+sortBy+","+searchLibrarary);
//receive_library(parId,objType,'1','1','1','1','');
receive_library(parId,objType,pagNumber,copyright,assetType,sortBy,searchLibrarary,channelsite,fromDate,toDate,searchTag,producer);
}
function closeLibrary()
{
GlobalId_Array = new Array();
}
function receive_library(parentId,objectType,pageNumber,copyright,assetType,sortBy,searchLibrarary,channelsite,fromDate,toDate,searchTag,producer)
{
var request=ie?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest();
//var url=base_Url+"/a1aCollection_p2.do?ajax=Ajax";
var url=base_Url+"/a1aCollectionAddLibrary_p2.do?ajax=Ajax&parentId="+parentId+"&objectType="+objectType+"&pageNumber="+pageNumber+"©right="+copyright+"&assetType="+assetType+"&sortBy="+sortBy+"&searchlibrary="+searchLibrarary;
url += "&site="+channelsite+"&fromdate="+fromDate+"&todate="+toDate+"&searchtag="+searchTag+"&producer="+producer;
request.onreadystatechange=function()
{
if(request.readyState==4)
{
if(request.status==200)
{
document.getElementById('tty').innerHTML = "";
var objectIds = request.responseXML.getElementsByTagName('objectId');
var objectThumbPath = request.responseXML.getElementsByTagName('objectClipThumb');
var objectCaption = request.responseXML.getElementsByTagName('objectCaption');
var objectCurrentPage=request.responseXML.getElementsByTagName('currentPage');
var objectTotalPages=request.responseXML.getElementsByTagName('totalPages');
var objectTotalItems=request.responseXML.getElementsByTagName('totalItems');
var objectStartIndex=request.responseXML.getElementsByTagName('startIndex');
var objectEndIndex=request.responseXML.getElementsByTagName('endIndex');
var currentPage=0;
var totalPages=0;
var totalItems =0;
var startIndex=0;
var endIndex=0;
var imagePath = base_Url+"/skins/main/images/account/buttons/smallAdd.gif";
var inner_contents = "
";
if(objectIds.length==0)
inner_contents += "
No Results Found
";
for(var j=0;j
";
inner_contents += "";
inner_contents += "
";
inner_contents += "
";
inner_contents += "
";
inner_contents += "
";
inner_contents += "
";
inner_contents += " ";
inner_contents += "
";
inner_contents += "
";
inner_contents += "
";
inner_contents += "
";
inner_contents += " ";
}
inner_contents += "";
document.getElementById('addfromlibrary_records').innerHTML = 'Displaying '+startIndex+' to '+endIndex+' of '+totalItems+' matches.';
// Regenerate the pages List ....
//var pagesHtml = "Page "
var pagesHtml = "";
for(j=1;j<=totalPages;j++){
if(currentPage==j)
pagesHtml += ""+j+" ";
else
pagesHtml += ""+j+" ";
}
pagesHtml += " ";
//Append the Html into the pagination container ....
document.getElementById('librarayPageNum').innerHTML = pagesHtml;
document.getElementById('addFromLibMaxPage').innerHTML = totalPages;
document.getElementById('tty').innerHTML = inner_contents;
}
else if(request.status==500)
alert(serverError);
else
alert(connectionError);
}
}
request.open("POST",url,true);
request.setRequestHeader("content-type","application/x-www-form-urlencoded");
request.send('');
}
function addRemoveLibrary(curObj)
{
var imagePath = base_Url+"/skins/main/images/account/buttons/";
var tmpId = curObj.id;
var selId = tmpId.substring(9);
var checkBoxStatus = document.getElementById('objImgId_'+selId).checked;
if(tmpId .indexOf('objThuId')!=-1)
{
if(checkBoxStatus){
document.getElementById('objImgId_'+selId).checked = false;
document.getElementById('divAddRe_'+selId).className = "divAdd";
}
else{
document.getElementById('objImgId_'+selId).checked = true;
document.getElementById('divAddRe_'+selId).className = "divRemove";
}
}
else{
if(checkBoxStatus){
document.getElementById('divAddRe_'+selId).className = "divRemove";
}
else{
document.getElementById('divAddRe_'+selId).className = "divAdd";
}
}
/*
var imageSourcePath = document.getElementById('objImgId_'+selId).src;
if(imageSourcePath.indexOf('Add')!=-1){
document.getElementById('objImgId_'+selId).src = imagePath+"smallRemove.gif";
document.getElementById('divAddRe_'+selId).className = "divRemove";
}
else{
document.getElementById('objImgId_'+selId).src = imagePath+"smallAdd.gif";
document.getElementById('divAddRe_'+selId).className = "divAdd";
}
*/
addLibraryitem(selId);
}
function addLibraryitem(obj)
{
var bool = true;
for(i=0;i0)
{
//var url = "/copyobjects.do?ocl="+GlobalId_Array+"&tctnr="+parId+"&addfromlibrary=true";
var url = base_Url+"/copyobjects.do?ocl="+GlobalId_Array+"&tctnr="+parId+"&addfromlibrary=true&loc_return="+escape(document.location+"");
GlobalId_Array = new Array();
document.getElementById('tty').innerHTML = "";
//simplePost(url,"reloadBodyWithPagination()");
window.location.href = url;
}
}
function receive_upload_id(userid)
{
//alert(document.getElementById('objectId').value);
var url = "/loadXupload_p2.do?parentId="+document.getElementById('objectId').value;
if( document.getElementById('siteId') )
url += "&siteId=" + document.getElementById('siteId').value;
if(document.getElementById('seqnumber'))
url += "&seqnumber="+document.getElementById('seqnumber').value;
//alert(url);
if( document.getElementById('pv_flag'))
url += "&pv_flag="+document.getElementById('pv_flag').value;
if(userid!="" && userid!=undefined && userid!="undefined")//This code is added to handle uploadedby field in upload window Box
url += "&userId="+userid;
simplePost(url,"renderUploader(common_request)");
}
function renderUploader(request)
{
document.getElementById('xupload').innerHTML = request.responseText;
}
function sortBy(sortBy_Val,loadPageNo,asset)
{
var url = "/sortchannel.do?sortBy="+sortBy_Val;
simplePost(url,"displayChannelList(common_request,'"+loadPageNo+"','"+asset+"')");
}
/*
* Copy move filter and search part starts here ....
*/
var cpmvchannelObjectArray = new Array();
var cpmv_objIds ;
var cpmv_captions ;
var cpmv_dates ;
var cpmv_siteicon;
var totalItems;
function copyormove(whateventitis)
{
var prefix = "";
if(whateventitis=='copy')
prefix = "cp_";
else
prefix = "mv_";
var sy=document.getElementById(prefix+'start_yyyy').value;
var sd=document.getElementById(prefix+'start_dd').value;
var sm=document.getElementById(prefix+'start_mm').value;
var em=document.getElementById(prefix+'end_mm').value;
var ed=document.getElementById(prefix+'end_dd').value;
var ey=document.getElementById(prefix+'end_yyyy').value;
var search_text=document.getElementById(prefix+'search_text').value;
if(whateventitis=='copy')
copy_move_receive_projects(sy,sd,sm,em,ed,ey,"-1","asst","1", "", search_text,'channel_container_cp','copy_channelpaginationcontainer','copy')
else
copy_move_receive_projects(sy,sd,sm,em,ed,ey,"-1","asst","1", "", search_text,'channel_container_mv','move_channelpaginationcontainer','move')
}
function cpmv_removeFilterProjects(whateventitis,position)
{
var prefix = "";
if(whateventitis=='copy')
prefix = "cp_";
else
prefix = "mv_";
document.getElementById(prefix+'start_yyyy').value = 2008;
document.getElementById(prefix+'start_dd').value = 1;
document.getElementById(prefix+'start_mm').value = 1;
document.getElementById(prefix+'end_mm').value = 12;
document.getElementById(prefix+'end_dd').value = 31;
document.getElementById(prefix+'end_yyyy').value = 2009;
var sy=document.getElementById(prefix+'start_yyyy').value;
var sd=document.getElementById(prefix+'start_dd').value;
var sm=document.getElementById(prefix+'start_mm').value;
var em=document.getElementById(prefix+'end_mm').value;
var ed=document.getElementById(prefix+'end_dd').value;
var ey=document.getElementById(prefix+'end_yyyy').value;
document.getElementById(prefix+'search_text').value="";
if(whateventitis=='copy')
copy_move_receive_projects(sy,sd,sm,em,ed,ey,"-1","asst","1", "", "",'channel_container_cp'+position,'copy_channelpaginationcontainer'+position,'copy')
else
copy_move_receive_projects(sy,sd,sm,em,ed,ey,"-1","asst","1", "", "",'channel_container_mv'+position,'move_channelpaginationcontainer'+position,'move')
}
function copy_move_receive_projects(syear,sdate,smonth,emonth,edate,eyear,siteId,asset,loadPageNo, tags, search_text,container_name,pagi_container,action)
{
/*
document.getElementById('loading_image').style.left = findPosX(document.getElementById(container_name))+100;
document.getElementById('loading_image').style.top = findPosY(document.getElementById(container_name));
document.getElementById('loading_image').style.display = "block";
*/
showLoading(container_name);
cpmvchannelObjectArray = new Array();
//var url= "/searchProject_p2.do?ajax=Ajax&start_yyyy="+syear+"&start_mm="+smonth+"&start_dd="+sdate+"&end_yyyy="+eyear+"&end_mm="+emonth+"&end_dd="+edate+"&assetType="+asset+"&site="+siteId+"&tags="+tags+"&search_text="+search_text+"©ormove=yes&scope=2";
var url= "/searchProject_CM_p2.do?ajax=Ajax&start_yyyy="+syear+"&start_mm="+smonth+"&start_dd="+sdate+"&end_yyyy="+eyear+"&end_mm="+emonth+"&end_dd="+edate+"&assetType="+asset+"&site="+siteId+"&tags="+tags+"&search_text="+search_text+"&scope=4"+"&pageNumber="+loadPageNo;
if(getParameter("listIndex")!=null && getParameter("listIndex")!="null")
url += "&listIndex="+getParameter("listIndex")
//var a = prompt("test",url);
//alert( url );
simplePost(url,"cpmv_displayChannelList(common_request,"+loadPageNo+",'"+container_name+"','"+pagi_container+"','"+action+"');");
}
function cpmv_displayChannelList(request,loadPageNo,container_name,pagi_container,action)
{
if(isNaN(loadPageNo))
loadPageNo = 1;
//try{
//alert(request.responseText);
totalItems = request.responseXML.getElementsByTagName('totalItems')[0].firstChild.nodeValue;
cpmv_objIds = request.responseXML.getElementsByTagName('objectId');
cpmv_captions = request.responseXML.getElementsByTagName('objectCaption');
cpmv_dates = request.responseXML.getElementsByTagName('objectDate');
cpmv_siteicon=request.responseXML.getElementsByTagName('siteIconUrl');
if(cpmv_objIds.length==0)
{
document.getElementById('loading_image').style.display = "none";
document.getElementById(container_name).innerHTML = "No Results Found
";
}
//calculate total no of pages for channels pagination ....
//totalNoOfChannelsPage = Math.ceil(cpmv_objIds.length/cpmv_channelPageLen);
totalNoOfChannelsPage = Math.ceil(totalItems/cpmv_channelPageLen);
// Regenerate the pages List ....
var pagesHtml = "Page "
var pagesHtml = "Page "
if(pagi_container=='copy_channelpaginationcontainertop')
pagesHtml = "Page "
if(pagi_container=='copy_channelpaginationcontainerbottom')
pagesHtml = "Page "
if(pagi_container=='move_channelpaginationcontainertop')
pagesHtml = "Page "
if(pagi_container=='move_channelpaginationcontainerbottom')
pagesHtml = "Page "
for(j=1;j<=totalNoOfChannelsPage;j++)
pagesHtml += ""+j+" ";
pagesHtml += " of "+totalNoOfChannelsPage;
//Append the Html into the pagination container ....
document.getElementById(pagi_container).innerHTML = pagesHtml;
//Append Channel objects in Channel Array Objects ....
for(i=0;i0)
{
//cpmv_renderChannels(loadPageNo,container_name,action);
if(pagi_container=='copy_channelpaginationcontainertop')
document.getElementById('channelPagescpmv').value = loadPageNo;
if(pagi_container=='copy_channelpaginationcontainerbottom')
document.getElementById('channelPagescpmv_bottom').value = loadPageNo;
if(pagi_container=='move_channelpaginationcontainertop')
document.getElementById('movchannelPagescpmv').value = loadPageNo;
if(pagi_container=='move_channelpaginationcontainerbottom')
document.getElementById('movchannelPagescpmv_bottom').value = loadPageNo;
var inner_Text = "";
document.getElementById(container_name).innerHTML = inner_Text;
document.getElementById('loading_image').style.display = "none";
}
//}catch(e){alert(e.message);}
}
var cpmv_channelPageLen = 10;
function cpmv_renderChannelsPage(pageNo,container_name,pagi_container){
var prefix = "";
document.getElementById(prefix+'start_yyyy').value = 2008;
document.getElementById(prefix+'start_dd').value = 1;
document.getElementById(prefix+'start_mm').value = 1;
document.getElementById(prefix+'end_mm').value = 12;
document.getElementById(prefix+'end_dd').value = 31;
document.getElementById(prefix+'end_yyyy').value = 2009;
var sy=document.getElementById(prefix+'start_yyyy').value;
var sd=document.getElementById(prefix+'start_dd').value;
var sm=document.getElementById(prefix+'start_mm').value;
var em=document.getElementById(prefix+'end_mm').value;
var ed=document.getElementById(prefix+'end_dd').value;
var ey=document.getElementById(prefix+'end_yyyy').value;
document.getElementById(prefix+'search_text').value="";
//copy_move_receive_projects(sy,sd,sm,em,ed,ey,"-1","asst",pageNo, "", "",'channel_container_cp'+position,'copy_channelpaginationcontainer'+position,'copy')
copy_move_receive_projects(sy,sd,sm,em,ed,ey,"-1","asst",pageNo, "", "",container_name,pagi_container,'copy')
}
function cpmv_renderChannels(pageNo,container_name,action)
{
var bot_pagin = "";
document.getElementById('channelPagescpmv').value = pageNo;
var from = (pageNo-1) * cpmv_channelPageLen;
var upto = pageNo * cpmv_channelPageLen;
var bothTrue = false;
/*if(from>1){
bothTrue = true;
bot_pagin += "Previous "
}*/
if(upto > (cpmvchannelObjectArray.length-1))
{
upto = cpmvchannelObjectArray.length;
if(from>1)
{
bot_pagin += "Previous "
}
}else{
if(bothTrue)
bot_pagin += " | ";
bot_pagin += "Next "
}
bot_pagin += "
";
var inner_Text = "";
document.getElementById(container_name).innerHTML = inner_Text;
document.getElementById('loading_image').style.display = "none";
}
function receive_projects(syear,sdate,smonth,emonth,edate,eyear,siteId,asset,loadPageNo, tags, search_text, object_type,sea_status)
{
var searchType=document.getElementById('searchType').value;
var chSelId=document.getElementById('chSelId').value;
var sortBy=document.getElementById('sort_by_channel').value;
//showLoading('channel_container');
showLoading('wholecontainer');
var url= "/asynchronussearchProject_p2.do?start_yyyy="+syear+"&start_mm="+smonth+"&start_dd="+sdate+"&end_yyyy="+eyear+"&end_mm="+emonth+"&end_dd="+edate+"&scope="+asset+"&site="+siteId+"&tags="+tags+"&search_text="+search_text+"&sot="+object_type+"&status="+sea_status+"&pageNumber="+loadPageNo+"&chSelId="+chSelId+"&searchType="+searchType+"&sortBy="+sortBy;
if(!newChannel)
{
simplePost(url,"afterAjaxSearch(common_request)");//afterAjaxSearch is in cmsasset.js
}else
{
simplePost(url,"documenturlLoad()");
}
}
function documenturlLoad()
{
document.location = base_Url+"/loadProjectChildren.do?pId="+maxChId;
}
//NO LONGER USE-IT IS CHANGED INTO JSP
/*
* Copy move filter and search part ends here ....
*/
/*function receive_projects(syear,sdate,smonth,emonth,edate,eyear,siteId,asset,loadPageNo, tags, search_text, object_type,sea_status)
{
/*
document.getElementById('loading_image').style.left = findPosX(document.getElementById('channel_container'))+100;
document.getElementById('loading_image').style.top = findPosY(document.getElementById('channel_container'));
document.getElementById('loading_image').style.display = "block";
*/
/*showLoading('channel_container');
channelObjectArray = new Array();
var url= "/searchProject_p2.do?ajax=Ajax&start_yyyy="+syear+"&start_mm="+smonth+"&start_dd="+sdate+"&end_yyyy="+eyear+"&end_mm="+emonth+"&end_dd="+edate+"&scope="+asset+"&site="+siteId+"&tags="+tags+"&search_text="+search_text+"&sot="+object_type+"&status="+sea_status;
if(getParameter("listIndex")!=null && getParameter("listIndex")!="null")
url += "&listIndex="+getParameter("listIndex")
//alert("url :"+url);
simplePost(url,"sortBy('"+document.getElementById('sort_by_channel').value+"','"+loadPageNo+"','"+asset+"');");
//simplePost(url,"displayChannelList(common_request,'"+loadPageNo+"')");
}
/*function displayChannelList(request,loadPageNo,asset)
{
//var name=prompt("list",request.responseText);
if(isNaN(loadPageNo))
loadPageNo = 1;
try{
//alert(request.responseText);
displayOff('leftPagDiv');
if(request.responseXML.getElementsByTagName('objectId'));
objIds=request.responseXML.getElementsByTagName('objectId');
if(request.responseXML.getElementsByTagName('objectCaption'));
captions=request.responseXML.getElementsByTagName('objectCaption');
if(request.responseXML.getElementsByTagName('objectDate'));
dates=request.responseXML.getElementsByTagName('objectDate');
if(request.responseXML.getElementsByTagName('siteIconUrl'));
siteicon=request.responseXML.getElementsByTagName('siteIconUrl');
if(request.responseXML.getElementsByTagName('objectFullCaption'));
objectFullcaption=request.responseXML.getElementsByTagName('objectFullCaption');
if(request.responseXML.getElementsByTagName('lockuserid'));
lockuserid=request.responseXML.getElementsByTagName('lockuserid');
if(request.responseXML.getElementsByTagName('lockpassword'));
lockpassword=request.responseXML.getElementsByTagName('lockpassword');
if(request.responseXML.getElementsByTagName('lockuseremail'));
lockuseremail=request.responseXML.getElementsByTagName('lockuseremail');
if(objIds.length==0)
{
//alert("objIds.length :"+objIds.length);
document.getElementById('loading_image').style.display = "none";
document.getElementById('channel_container').innerHTML = "No Results Found
";
}
//calculate total no of pages for channels pagination ....
totalNoOfChannelsPage = Math.ceil(objIds.length/channelPageLen);
// Regenerate the pages List ....
var pagesHtml = "Page "
for(j=1;j<=totalNoOfChannelsPage;j++)
pagesHtml += ""+j+" ";
pagesHtml += " of "+totalNoOfChannelsPage;
//Append the Html into the pagination container ....
document.getElementById('channelpaginationcontainer').innerHTML = pagesHtml;
//Append Channel objects in Channel Array Objects ....
for(i=0;i0)
{
renderChannels(loadPageNo,asset);
}
else{
document.getElementById('channel_prev').style.visibility = "hidden";
document.getElementById('channel_nxt').style.visibility = "hidden";
}
}catch(e)
{
if(asset==2)
{
document.getElementById('loading_image').style.display = "none";
document.getElementById('channel_container').innerHTML = "No Results Found
";
asset2();
}else if(asset==3)
{
document.getElementById('loading_image').style.display = "none";
document.getElementById('channel_container').innerHTML = "No Results Found
";
asset3();
}
}
}
*/
/*function asset3()
{
document.getElementById('rail_nav_1').style.display="block";
document.getElementById('rail_nav_2').style.display="none";
document.getElementById('createchannel').style.display="none";
document.getElementById('cmsVisibility').href="javascript: cmsnavigation3();"
document.getElementById('channelVisibility').href="javascript: channelnavigation3();"
}
function asset2()
{
document.getElementById('rail_nav_2').style.display="block";
document.getElementById('rail_nav_1').style.display="none";
document.getElementById('createchannel').style.display="block";
document.getElementById('cmsVisibility').href="javascript: cmsnavigation2();"
document.getElementById('channelVisibility').href="javascript: channelnavigation2();"
}
/*function channelnavigation2()
{
displayOn('rail_nav_2');
displayOn('p2_rail');
displayOff('rail_nav_1');
displayOff('navigation_container');
document.getElementById('assetscope').value=2
//document.getElementById('assetscope').text='For P2 Channels';
javascript:reloadCombo(document.getElementById('assetscope'));
}
/*function cmsnavigation2()
{
/*displayOn('rail_nav_1');
displayOff('rail_nav_2');
displayOff('p2_rail');
displayOn('navigation_container');*/
/*document.getElementById('assetscope').value=3
//document.getElementById('assetscope').text='For CMS Assets';
javascript:reloadCombo(document.getElementById('assetscope'));
document.getElementById("deletechannel").innerHTML='Delete';
document.getElementById("renamechannel").innerHTML='Rename';
cmssearchProjects(1);
}*/
/*function channelnavigation3()
{
/*displayOn('rail_nav_2');
displayOff('p2_rail');
displayOff('rail_nav_1');
displayOn('navigation_container');*/
/*document.getElementById('assetscope').value=2
//document.getElementById('assetscope').text='For P2 Channels';
document.getElementById("deletechannel").innerHTML='Delete';
document.getElementById("renamechannel").innerHTML='Rename';
javascript:reloadCombo(document.getElementById('assetscope'));
searchProjects(1);
}*/
/*function cmsnavigation3()
{
displayOn('rail_nav_1');
displayOff('rail_nav_2');
displayOn('p2_rail');
displayOff('navigation_container');
document.getElementById('assetscope').value=3
//document.getElementById('assetscope').text='For CMS Assets';
javascript:reloadCombo(document.getElementById('assetscope'));
}
*/
function cmsnavigation()
{
var scope = document.getElementById('assetscope').value;
if(scope == 4)
{
document.getElementById('assetscope').value=5;
document.getElementById('scope_id').value=5;
javascript:ChangeCombo(document.getElementById('scope_id'));
}
if(scope == 2)
{
document.getElementById('assetscope').value=3;
}
cmssearchProjects(1);
}
function channelnavigation()
{
var scope = document.getElementById('assetscope').value;
if(scope == 5)
{
document.getElementById('assetscope').value=4;
document.getElementById('scope_id').value=4;
javascript:ChangeCombo(document.getElementById('scope_id'));
}
if(scope == 3)
{
document.getElementById('assetscope').value=2;
}
searchProjects(1);
}
//This method is used to extract a request parameter form a url.....
function getParameter(attribute)
{
var result = null;
var temp_url = document.location+"";
var attributeArr = "";
if(temp_url.indexOf("?")!=-1)
{
temp_url = temp_url.substring(temp_url.indexOf("?")+1,temp_url.length);
attributeArr = Split_into_Array(temp_url,"&");
}
if(attributeArr!="")
{
for(k=0;k1){
displayOn('leftPagDiv');
bothTrue = true;
document.getElementById('channel_prev').href = "javascript:renderChannels("+(pageNo-1)+")";
document.getElementById('channel_prev').style.visibility = "visible";
}else{
displayOff('leftPagDiv');
bothTrue = false;
document.getElementById('channel_prev').style.visibility = "hidden";
}
if(upto > (channelObjectArray.length-1))
{
upto = channelObjectArray.length;
bothTrue = false;
//document.getElementById('channel_nxt').style.visibility = "hidden";
document.getElementById('channel_prev').style.visibility = "hidden";
document.getElementById('channel_nxt').innerHTML = "Previous";
document.getElementById('channel_nxt').href = "javascript:renderChannels("+(parseInt(pageNo)-1)+")";
if(from>1)
{
displayOn('leftPagDiv');
document.getElementById('channel_nxt').style.visibility = "visible";
}
}else{
if(!bothTrue)
bothTrue = false;
displayOn('leftPagDiv');
document.getElementById('channel_nxt').href = "javascript:renderChannels("+(parseInt(pageNo)+1)+")";
document.getElementById('channel_nxt').style.visibility = "visible";
}
if(bothTrue){
document.getElementById('splitter').style.visibility = "visible";
}else{
document.getElementById('splitter').style.visibility = "hidden";
}
/*var maxChId = 0;
var channelsId = new Array();
for(j=0;jDelete'
document.getElementById("renamechannel").innerHTML='Rename '
document.getElementById('pidfordel').value = pid;
}
else
{
inner_Text += "cursor:pointer;background-color: rgb(255, 255, 255); \" onmouseover=\"this.style.backgroundColor='#EBFECB';\" onmouseout=\"this.style.backgroundColor='#ffffff';\"";
}
}
//alert(channelObjectArray[i].getChannelCaption());
inner_Text += " >"+
""+
""+
"
"+
""+
""+
"
"+
"
"+
"
"+
"
"+
"
"+
"
"+
"
";
if(channelObjectArray[i].getLockuserid() != '-1'){
inner_Text +=
"
Locked By: "+channelObjectArray[i].getLockuseremail()+"
";
if(channelObjectArray[i].getLockuserid() == userid){
inner_Text +=
"
";
}
}
inner_Text +=
"
"+
"
"+
"
"+
"
"+
"
"+
"
"+
"";
inner_Text+=""+
"
"+
"
"+
"
"+
"
"+
"
"+
"
"+
"
";
if(channelObjectArray[i].getLockuserid() != '-1'){
inner_Text +=
"
"+
"
";
}
inner_Text +=
"
"+
"
"+
"
"+
"
"+
"
"+
"
";
}
//alert("innerHtml :"+inner_Text);
document.getElementById('channel_container').innerHTML = inner_Text;
document.getElementById('loading_image').style.display = "none";
//alert("asset :"+asset);
if(asset==2)
{
asset2();
}else if(asset==3)
{
asset3();
}
newChannel=false;
}
*/
function deleteChannel()
{
var channelid = document.getElementById("pidfordel").value;
var pass = document.getElementById('realpwd').value;
if(pass.length > 0)
{
var url=base_Url+"/checkpassword_p2.do?password="+pass;
var callBack="afterPasswordCheck(common_request,'"+channelid+"');"
simplePost(url,callBack);
}else{
alert("Please enter the password..");
displayOn("deleteitem");
}
}
function lockChannel(channelId, index){
var password = document.getElementById("lockpassword" + index).value;
var vpassword = document.getElementById("vlockpassword" + index).value;
if(password.length < 6 || password.indexOf(' ') != -1){
alert("Your password must be at least 6 characters long with no spaces.");
}else if(password != vpassword){
alert("Please make sure your password and password verification match.");
}else{
//showLoading('channel_container');
var pageno=document.getElementById('channelPages').value;
showLoading('wholecontainer');
var url=base_Url+"/lockchannel.do?password="+password+"&cid="+channelId+"&action=lock";
var callBack="afterlockchannel(common_request,'"+channelId+"','"+index+"','"+pageno+"');"
simplePost(url,callBack);
}
}
function ulockChannel(channelId, index){
var password = document.getElementById("ulockpassword" + index).value;
if(password.length < 6 || password.indexOf(' ') != -1){
alert("Your password must be at least 6 characters long with no spaces.");
}else{
//showLoading('channel_container');
var pageno=document.getElementById('channelPages').value;
showLoading('wholecontainer');
var url=base_Url+"/lockchannel.do?password="+password+"&cid="+channelId+"&action=unlock";
var callBack="afterulockchannel(common_request,'"+channelId+"','"+index+"','"+pageno+"');"
simplePost(url,callBack);
}
}
function loadlockedchannel(url, channelId, index){
var password = document.getElementById("ullockpassword" + index).value;
if(password.length < 6 || password.indexOf(' ') != -1){
alert("Your password must be at least 6 characters long with no spaces.");
}else{
var aurl=base_Url+"/checkchannellockpassword.do?password="+password+"&cid="+channelId;
var callBack="afterlockpasswordcheck(common_request,'"+url+"','"+channelId + "','"+index+"');"
simplePost(aurl,callBack);
}
}
function afterlockchannel(request,channelId, index,pageno)
{
if(request.responseText=="Failure")
{
alert("There was a problem while locking channel. Please try again.");
document.getElementById('loading_image').style.display = "none";
layerOff("lock"+channelId);
}
layerOff("lock"+channelId);
searchProjects(pageno);
document.getElementById('loading_image').style.display = "none";
}
function afterlockpasswordcheck(request,url, channelId, index)
{
if(request.responseText=="Failure")
{
alert("There was a problem while password. Please try again.");
}else if(request.responseText=="wrongpassword"){
alert("The password you entered was incorrect. Please try again.");
}else{
document.location = url;
}
}
function afterulockchannel(request,channelId, index,pageno)
{
if(request.responseText=="Failure")
{
alert("There was a problem while unlocking channel. Please try again.");
}if(request.responseText=="wrongpassword"){
alert("The password you entered was incorrect. Please try again.");
}
//var pageno=document.getElementById('channelPages').value;
layerOff("ulock"+channelId);
searchProjects(pageno);
document.getElementById('loading_image').style.display = "none";
}
function submitLockOnEnter(inputElement, event, channelId, index){
if (event.keyCode == 13) { // No need to do browser specific checks. It is always 13.
lockChannel(channelId, index);
}
}
function submitULockOnEnter(inputElement, event, channelId, index){
if (event.keyCode == 13) { // No need to do browser specific checks. It is always 13.
ulockChannel(channelId, index);
}
}
function submitLoadOnEnter(inputElement, event, url, channelId, index){
if (event.keyCode == 13) { // No need to do browser specific checks. It is always 13.
loadlockedchannel(url, channelId, index);
}
}
function sendChannelLockPassword(channelId, lockUserEmail, lockUserId){
layerOff("ulock"+channelId);
var url="sendchannellockpasswordmail.do?useremail=" + lockUserEmail + "&userid=" + lockUserId + "&cid=" + channelId;
var callBack="processloackpasswordmail(common_request, '"+lockUserEmail+"');";
simplePost(url,callBack);
}
function processloackpasswordmail(request, useremail){
var text = request.responseText;
if(text == 'Success'){
alert("An email was sent to " + useremail + " with the lock password.");
}
else {
alert("There was a problem in sending mail. Please try again.");
}
}
function confirmDeleteChannel(channelid)
{
document.getElementById('pidfordel').value = channelid;
document.getElementById('realpwd').value = '';
displayOn("deleteitem");
}
function afterPasswordCheck(request,channelid)
{
var objectType="channel";
var locreturn=base_Url+"/searchProject_p2.do";
var resultBoolean="";
var password="";
var pId=0;
resultBoolean = request.responseXML.getElementsByTagName('password');
password = resultBoolean.item(0).firstChild.nodeValue;
if(getParameter("pId")){
pId = getParameter("pId");
pId = pId.replace("#","");
}
if(password=="true")
{
var url=base_Url+"/a1deleteobject_p2.do?odl="+channelid+"&oType="+objectType+"&loc_return="+locreturn+"&pId="+escape(pId);
window.location.href = url;
}
else
{
alert("The password you entered is incorrect. Please try again.");
confirmDeleteChannel(channelid);
}
}
/*if (name==true)
{
var url="a1deleteobject_p2.do?odl="+channelid+"&oType="+objectType+"&loc_return="+locreturn;
obj.href=url;
}*/
function renameChannel(obj,channelCaption,channelid)
{
if(obj=="")
{
document.getElementById('renameChannelresult').innerHTML="";
document.getElementById('renameChannelId').value=channelid;
document.getElementById('renameChannelText').value=unescape(channelCaption);
}else
{
channelid=document.getElementById('renameChannelId').value;
channelCaption=document.getElementById('renameChannelText').value;
if(channelCaption == "")
{
document.getElementById('renameChannelresult').style.visibility ="visible";
document.getElementById('renameChannelresult').innerHTML="Title field Should not be empty";
document.getElementById('renameChannelText').focus();
}
if(channelCaption.length>0)
{
var pageno=document.getElementById('channelPages').value;
var url="renamechannelaction.do?odl="+channelid+"&objCaption="+channelCaption;
var callBack = "AfterRenameChannel(common_request,\""+channelCaption+"\",'"+pageno+"');";
//showLoading('wholecontainer');
//obj.href=url;
simplePost(url,callBack);
//document.getElementById('channelProjectName').innerHTML=channelCaption;
}
}
}
function AfterRenameChannel(request,channelCaption,pageno)
{
if(request.responseText=="alreadyexists")
{
document.getElementById('renameChannelresult').style.visibility ="visible";
document.getElementById('renameChannelresult').innerHTML="A channel with that name already exists.\n Please use a different name.";
document.getElementById('renameChannelText').focus();
}else{
//var pageno=document.getElementById('channelPages').value;
document.getElementById('renameChannelresult').innerHTML="";
searchProjects(pageno);
document.getElementById('channelProjectName').innerHTML=channelCaption;
layerOff('rename');
}
}
function goDivUrl(url){
//It makes the call twice
//window.location.href = url;
}
var currentUrl;
function showLoading(relativeId)
{
try{
/*
var extraWidth = document.getElementById(relativeId).offsetWidth/2;
var extraHeight = document.getElementById(relativeId).offsetHeight/2;
document.getElementById('loading_image').style.display = "block";
document.getElementById('loading_image').style.left = findPosX(document.getElementById(relativeId))+extraWidth;
document.getElementById('loading_image').style.top = findPosY(document.getElementById(relativeId))+extraHeight;
*/
if(document.getElementById('loading_image'))
document.getElementById('loading_image').style.display = "none";
document.getElementById(relativeId).innerHTML = '
';
}catch(e){}
}
function reloadAjax(url,from,customMethod)
{
//alert("reloadajaxurl :"+url);
showLoading('rootcontainer');
//alert("url :"+url);
var callBack = "afterAjaxReload(common_request,'"+url+"','"+from+"');";
if(customMethod!="" && customMethod!=undefined && customMethod!="undefined")
{
callBack += customMethod;
}
simplePost(url,callBack);
}
function reloada1bodyAjax(url,pageParam)
{
showLoading('rootTable');
var callBack = "afterAjaxa1bodyReload(common_request,'"+url+"','"+pageParam+"');";
/*if(customMethod!="" && customMethod!=undefined && customMethod!="undefined")
{
callBack += customMethod;
}*/
simplePost(url,callBack);
}
function recount(_id)
{
try{
if(document.getElementById('count'))
document.getElementById(_id).innerHTML =getStringNumericForm(document.getElementById('count').value);
}catch(e){}
}
var timer_val
function afterAjaxReload(request,url,from,third)
{
//document.getElementById('loading_image').style.display = "block";
currentUrl = url;
//alert("currenturl :"+currentUrl)
if( document.getElementById('rootcontainer') !=null )
{
//var name =prompt("url",request.responseText);
//document.getElementById('rootcontainer').innerHTML = "";
//document.getElementById('rootcontainer').style.display = "none";
//document.getElementById('rootTd').removeChild( document.getElementById('rootcontainer'));
document.getElementById('rootcontainer').innerHTML="";
document.getElementById('rootcontainer').innerHTML = request.responseText;
}
//rootDiv = document.createElement('div');
//rootDiv.id = 'rootcontainer';
//rootDiv.style.width = "600px";
//rootDiv.style.display = "none";
//rootDiv.innerHTML = request.responseText;
//document.body.appendChild(rootDiv);
handleRadio(false);
if(from!="pagi")
reloadPagination()
recount(document.getElementById('a1menutab1').value);
recount(document.getElementById('a1menutab2').value);
renderDelay();
}
function afterAjaxa1bodyReload(request,url,pageParam)
{
//var name=prompt("request responsetext :",request.responseText);
//alert(url);
var finalUrl;
if(url.indexOf("&from")!=-1)
{
finalUrl=url.substring(0,url.indexOf("&from"));
}
//alert("finalurl :"+finalUrl);
currentUrl = finalUrl+"&from="+pageParam;
//alert("currentUrl :"+currentUrl);
if( document.getElementById('rootTable') !=null )
{
document.getElementById('rootTable').innerHTML="";
document.getElementById('rootTable').innerHTML = request.responseText;
}
//alert("here");
reloadPagination();
//recount('total_child_counts');
//recount('total_pv_counts');
recount(document.getElementById('a1menutab1').value);
recount(document.getElementById('a1menutab2').value);
}
function renderDelay()
{
//document.getElementById('rootTd').appendChild(document.getElementById('rootcontainer'));
document.getElementById('rootcontainer').style.display = "block";
document.getElementById('loading_image').style.display = "none";
}
function handleRadio(para)
{
try
{
document.getElementById('collection_option').disabled = para;
document.getElementById('comment_option').disabled = para;
document.getElementById('photo_option').disabled = para;
if(para)
{
document.getElementById('loading_image').style.left = findPosX(document.getElementById('collection_option'))+250;
document.getElementById('loading_image').style.top = findPosY(document.getElementById('collection_option'))+100;
//This code handle by showloading
//document.getElementById('loading_image').style.display = "block";
document.getElementById('loading_image').style.display = "none";
}
else
document.getElementById('loading_image').style.display = "none";
}catch(e){}
}
function reloadBodyAfterChangeStatus(request)
{
//var name=prompt("request",request.responseText);
var featureClipPath="";
var featureImagePath="";
var xmlContent = request.responseText;
//alert("xmlcontent : "+xmlContent)
if(xmlContent.indexOf("featureClipPath")!=-1)
{
//alert("u r here;");
featureClipPath=request.responseXML.getElementsByTagName('featureClipPath');
featureImagePath=featureClipPath.item(0).firstChild.nodeValue;
//alert("fip : "+featureImagePath)
if(featureImagePath != null && featureImagePath != "NO_LIVE_ITEM" && featureImagePath != "N/A" )
{
document.getElementById('changeFeatureItem').style.backgroundImage="url('"+featureImagePath+"')";
document.getElementById('dummayCFIClick').style.display='none';
document.getElementById('changeFeatureItemClick').style.display='block';
document.getElementById('changeFeatureItemLink').style.display='block';
}else if(featureImagePath != null && featureImagePath!= "N/A" && featureImagePath == "NO_LIVE_ITEM")
{
document.getElementById('changeFeatureItem').style.backgroundImage="url(skins/main/images/account/icons/noliveitems.gif)";
document.getElementById('dummayCFIClick').style.display='block';
document.getElementById('changeFeatureItemClick').style.display='none';
//document.getElementById('changeFeatureItemClick').onclick="";
document.getElementById('changeFeatureItemLink').style.display='none';
//document.getElementById('changeFeatureItemLink').innerHTML=" ";
}else
{
document.getElementById('changeFeatureItem').style.backgroundImage="url(skins_p2/main/images/account/emptycollection.gif)";
document.getElementById('dummayCFIClick').style.display='block';
document.getElementById('changeFeatureItemClick').style.display='none';
//document.getElementById('changeFeatureItemClick').onclick="";
document.getElementById('changeFeatureItemLink').style.display='none';
//document.getElementById('changeFeatureItemLink').innerHTML=" ";
}
}
/*var featureClipPath="";
var featureImagePath="";
var featureItemBoolean=request.responseXML.getElementsByTagName('isFeatureItem');
var xmlContent = request.responseText;
//alert("feature outside loop"+featureImagePath);
var deleteArr = new Array();
for(i=0;i 1 ? '.' + x[1] : '';
var rgx = /(\d+)(\d{3})/;
while (rgx.test(x1))
x1 = x1.replace(rgx, '$1' + ',' + '$2');
return prefix + x1 + x2;
}
function reloadPagination(url)
{
if(url!=undefined)
{
currentUrl=url;
}
var totalpages = 1;
var pageno = 1;
if(document.getElementById('total_pages'))
{
totalpages = parseInt(document.getElementById('total_pages').value);
}
if(document.getElementById('totalPages_PVB'))
{
totalpages = parseInt(document.getElementById('totalPages_PVB').value);
}
if(document.getElementById('page_no'))
{
pageno = parseInt(document.getElementById('page_no').value);
}
if(document.getElementById('pageNumber'))
{
pageno = parseInt(document.getElementById('pageNumber').value);
}
var pagesHtml = ""
for(j=1;j<=totalpages;j++)
{
if(j==parseInt(pageno))
pagesHtml += ""+getStringNumericForm(j)+" ";
else
pagesHtml += ""+getStringNumericForm(j)+" ";
}
pagesHtml += " of "+getStringNumericForm(totalpages);
var pagesHtml1 = " "
for(j=1;j<=totalpages;j++)
{
if(j==parseInt(pageno))
pagesHtml1 += ""+getStringNumericForm(j)+" ";
else
pagesHtml1 += ""+getStringNumericForm(j)+" ";
}
pagesHtml1 += " of "+getStringNumericForm(totalpages);
var reloadFlag = false;
if(document.getElementById('pagination_1')){
if(parseInt(pageno)!= parseInt(document.getElementById('pagination_1').value)){
reloadFlag = true;
}
}
document.getElementById('mainpaginationarea').innerHTML = pagesHtml;
//alert("reloadpagination")
document.getElementById('mainpaginationarea2').innerHTML = pagesHtml1;
//alert("reload Flag :"+reloadFlag);
if(reloadFlag){
//alert("reloadflag here")
moveTO(pageno,document.getElementById('pagination_1'));
}
}
function resetSearchvalues()
{
document.getElementById('Seastatusdrop').value=0;
document.getElementById('site').value=-1;
document.getElementById('search_text').value="";
}
var maxChId=0;
function AfterChannelSave(request)
{
if(request.responseText=="alreadyexists")
{
document.getElementById('channelresult').style.display ="block";
//document.getElementById('createcontainer').style.height = "105px";
document.getElementById('channelresult').innerHTML="A channel with that name already exists.\n Please use a different name.";
document.getElementById('channelTitle').focus();
}else{
//alert(request.responseText);
maxChId=request.responseText;
resetSearchvalues();
document.getElementById('channelresult').innerHTML="";
layerOff('wizard_choose');
searchProjects(1);
}
}
var newChannel =false;
function createChannel()
{
//alert("here");
var channeltitle=document.getElementById('channelTitle').value;
var channeltags=document.getElementById('channelTags').value;
var channelsite=document.getElementById('channelSite').value;
if(channeltitle == "")
{
document.getElementById('channelresult').style.display ="block";
document.getElementById('channelresult').innerHTML="Please enter a name.";
document.getElementById('channelTitle').focus();
}
if(channeltitle.length>0)
{
newChannel = true;
var url = "a1createchannel_p2.do?channelTitle="+escape(channeltitle)+"&channelTags="+channeltags+"&channelSite="+channelsite;
simplePost(url,"AfterChannelSave(common_request)");
}
}
function simplePost(url,callBack)
{
var common_request=ie?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest();
common_request.onreadystatechange=function()
{
if(common_request.readyState==4)
{
if(common_request.status==200)
{
try{eval(callBack);}catch(e){}
}
/* else if(common_request.status==500)
alert(serverError);
else
alert(connectionError);*/
}
}
var finalUrl = "";
try{
if(url.indexOf("http://")==-1)
finalUrl = base_Url+"/"+url;
else
finalUrl = url;
}catch(e){finalUrl = url;}
common_request.open("POST",finalUrl,true);
common_request.setRequestHeader("content-type","text/plain;charset=UTF-8");
common_request.send('');
}
function postWithParam(url,callBack, params)
{
var common_request=ie?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest();
common_request.onreadystatechange=function()
{
if(common_request.readyState==4)
{
if(common_request.status==200)
{
try{eval(callBack);}catch(e){}
}
/* else if(common_request.status==500)
alert(serverError);
else
alert(connectionError);*/
}
}
var finalUrl = "";
try{
if(url.indexOf("http://")==-1)
finalUrl = base_Url+"/"+url;
else
finalUrl = url;
}catch(e){finalUrl = url;}
common_request.open("POST",finalUrl,true);
common_request.setRequestHeader("content-type","text/plain;charset=UTF-8");
common_request.send(params);
}
function findPosX(obj)
{
var curleft = 0
if (obj.offsetParent)
{
while (obj.offsetParent)
{
curleft += obj.offsetLeft
obj = obj.offsetParent
}
}
else if (obj.x)
curleft += obj.x
return curleft
}
function findPosY(obj)
{
var curtop = 0
if (obj.offsetParent)
{
while (obj.offsetParent)
{
curtop += obj.offsetTop
obj = obj.offsetParent
}
}
else if (obj.y)
curtop += obj.y
return curtop
}
/*
*This method takes the ajax action url and appends hidden fiels
*used for pagination and sorting.
*/
function createRootContainerUrl(url,lst,from)
{
var listIndex = document.getElementById('listIndex').value;
var objType = document.getElementById('ot').value;
var pageNo = document.getElementById('pageNumber').value;
var sortBy = document.getElementById('sortBy').value;
var sortOrder = document.getElementById('sortOrder').value;
var siteId = document.getElementById('siteId').value;
var parentId=document.getElementById('parentid').value;
var url_final = url+"?listIndex="+listIndex+"&ot="+objType+"&lst="+lst+"&channelPno="+pageNo+"&sortBy="+sortBy+"&sortOrder="+sortOrder+"&siteId="+siteId+"&collectionId="+parentId+"&from="+from+"&pId="+parentId+"&pageNumber="+pageNo;
reloadAjax(url_final);
}
function get_page(url, object,lst){
var page_no = object.options[object.selectedIndex].value;
document.getElementById("pageNumber").value = page_no;
createRootContainerUrl(url,lst);
}
function sort_column(url, sort_by,lst,from){
document.getElementById("sortBy").value = sort_by;
//document.getElementById("sortOrder").value =1;
//createRootContainerUrl(url,lst,from);
toggle_order(url,lst,from);
}
function toggle_order(url,lst,from){
if(document.getElementById("sortOrder").value == 1)
{
document.getElementById("sortOrder").value =2;
}
else
{
document.getElementById("sortOrder").value =1;
}
createRootContainerUrl(url,lst, from);
}
// Project Management
function pm_apply_filter(siteid)
{
var prefix = "cp_";
var sy=document.getElementById(prefix+'start_yyyy').value;
var sd=document.getElementById(prefix+'start_dd').value;
var sm=document.getElementById(prefix+'start_mm').value;
var em=document.getElementById(prefix+'end_mm').value;
var ed=document.getElementById(prefix+'end_dd').value;
var ey=document.getElementById(prefix+'end_yyyy').value;
var search_text=document.getElementById(prefix+'search_text').value;
var tags=document.getElementById(prefix+'search_tag').value;
pm_receive_projects(sy,sd,sm,em,ed,ey,siteid,"asst","1", tags, search_text,'sourceChannelList','move_channelpaginationcontainer','move')
}
function pm_remove_filter(siteid)
{
var prefix = "cp_";
document.getElementById(prefix+'start_yyyy').value = 2008;
document.getElementById(prefix+'start_dd').value = 1;
document.getElementById(prefix+'start_mm').value = 1;
document.getElementById(prefix+'end_mm').value = 12;
document.getElementById(prefix+'end_dd').value = 31;
document.getElementById(prefix+'end_yyyy').value = 2009;
var sy=document.getElementById(prefix+'start_yyyy').value;
var sd=document.getElementById(prefix+'start_dd').value;
var sm=document.getElementById(prefix+'start_mm').value;
var em=document.getElementById(prefix+'end_mm').value;
var ed=document.getElementById(prefix+'end_dd').value;
var ey=document.getElementById(prefix+'end_yyyy').value;
document.getElementById(prefix+'search_text').value="";
document.getElementById(prefix+'search_tag').value="";
pm_receive_projects(sy,sd,sm,em,ed,ey,siteid,"asst","1", "", "",'sourceChannelList','move_channelpaginationcontainer','move')
}
function pm_receive_projects(syear,sdate,smonth,emonth,edate,eyear,siteId,asset,loadPageNo, tags, search_text,container_name,pagi_container,action)
{
document.getElementById('loading_image').style.left = findPosX(document.getElementById(container_name))+100;
document.getElementById('loading_image').style.top = findPosY(document.getElementById(container_name));
document.getElementById('loading_image').style.display = "block";
cpmvchannelObjectArray = new Array();
var url= "/searchProject_p2.do?ajax=Ajax&start_yyyy="+syear+"&start_mm="+smonth+"&start_dd="+sdate+"&end_yyyy="+eyear+"&end_mm="+emonth+"&end_dd="+edate+"&assetType="+asset+"&site="+siteId+"&tags="+tags+"&search_text="+search_text+"©ormove=yes&sot=1&fp=pppm";
//alert(url);
if(getParameter("listIndex")!=null && getParameter("listIndex")!="null")
url += "&listIndex="+getParameter("listIndex")
//var a = prompt("test",url);
simplePost(url,"pm_displayChannelList(common_request,"+loadPageNo+",'"+container_name+"','"+pagi_container+"','"+action+"');");
}
function pm_displayChannelList(request,loadPageNo,container_name,pagi_container,action)
{
if(isNaN(loadPageNo))
loadPageNo = 1;
//try{
//alert(request.responseText);
cpmv_objIds = request.responseXML.getElementsByTagName('objectId');
cpmv_captions = request.responseXML.getElementsByTagName('objectCaption');
cpmv_dates = request.responseXML.getElementsByTagName('objectDate');
cpmv_siteicon=request.responseXML.getElementsByTagName('siteIconUrl');
if(cpmv_objIds.length==0)
{
document.getElementById('loading_image').style.display = "none";
document.getElementById(container_name).innerHTML = "No Results Found
";
}
//calculate total no of pages for channels pagination ....
totalNoOfChannelsPage = Math.ceil(cpmv_objIds.length/cpmv_channelPageLen);
// Regenerate the pages List ....
var pagesHtml = "Page "
for(j=1;j<=totalNoOfChannelsPage;j++)
pagesHtml += ""+j+" ";
pagesHtml += " of "+totalNoOfChannelsPage;
//Append the Html into the pagination container ....
//document.getElementById(pagi_container).innerHTML = pagesHtml;
//Append Channel objects in Channel Array Objects ....
for(i=0;i0)
{
pm_renderChannels(cpmv_objIds.length,container_name,action);
}
//}catch(e){alert(e.message);}
}
function pm_renderChannels(totalList,container_name,action)
{
var from = 0;
var inner_Text = "";
document.getElementById(container_name).innerHTML = inner_Text;
document.getElementById('loading_image').style.display = "none";
}
function beforechangeUploadedBy(pos)
{
//alert(pos);
var total_selected_objs = document.getElementsByName("selected_obj[]");
var total_to_delete = new Array();
for(i=0;i0)
{
changeUploadedBy(total_to_delete,'',pos);
}
else
{
alert("Please select an item to change.");
}
}
//This function is used for A1,A1A,A3 since it requires userid,collectionid.
function changeUploadedBy(collectionIds,fromPage,pos)
{
//alert(collectionIds);
//alert(pos);
var userName=document.getElementById('editup_title_field'+pos).value;
var url= "/changeUploadedBy.do?userName="+userName+"&collectionIds="+collectionIds;
//alert("edituploadedby"+pos);
showLoading('edituploadedby'+pos);
simplePost(url,"AfterchangeUploadedBy(common_request,'"+userName+"','"+fromPage+"','"+pos+"')");
}
function AfterchangeUploadedBy(request,userName,fromPage,pos)
{
if(request.responseText=="nouserfound")
{
document.getElementById('edituploadedby'+pos).style.display ="block";
document.getElementById('edituploadedby'+pos).innerHTML="The email address you entered is not in our system. Please try again.";
}else
{
//document.getElementById('edituploadedby'+pos).style.display ="block";
//document.getElementById('edituploadedby'+pos).innerHTML ="Successfully changed";
if(document.getElementById('uploadedbyemail'))//This is for a1a & a3 page alone
{
document.getElementById('uploadedbyemail').innerHTML=userName;
}
if(document.getElementById('uploadedit'))//This is for a1a & a3 page alone
{
displayOff('uploadedit');
}
if(document.getElementById('upl'+pos))//This is for a1 page alone
{
displayOff('upl'+pos);
}
if(fromPage!='a3')
{
reloadBody();//Not a3 page(a1 & a1a only), Used to reload the body
}
document.getElementById('edituploadedby'+pos).innerHTML="";
}
}
//This function is used for Upload (A1 pages alone) since it requires only userid .doesnt need collectionid.
function changeUploadedByUp()
{
var url="";
var collectionId=document.getElementById('uploadedbycollectionid').value;
var userName=document.getElementById('editup_title_fieldup').value;
var uploadscreen="uploadscreen";
if(collectionId!="" && collectionId!=undefined && collectionId!="undefined")
{
url= "/changeUploadedBy.do?userName="+userName+"&collectionIds="+collectionId+"&uploadedby="+uploadscreen;
}else
{
url= "/changeUploadedBy.do?userName="+userName+"&uploadedby="+uploadscreen;
}
showLoading('edituploadedbyup');
simplePost(url,"AfterchangeUploadedByUp(common_request,'"+userName+"')");
}
function AfterchangeUploadedByUp(request,userName)
{
if(request.responseText=="nouserfound")
{
document.getElementById('edituploadedbyup').style.display ="block";
document.getElementById('edituploadedbyup').innerHTML="The email address you entered is not in our system. Please try again.";
}else
{
var userId=request.responseText;
//document.getElementById('edituploadedbyup').style.display ="block";
//document.getElementById('edituploadedbyup').innerHTML ="Successfully changed";
document.getElementById('edituploadedbyup').innerHTML ="";
if(document.getElementById('uploadedbyemailup'))
document.getElementById('uploadedbyemailup').innerHTML=userName;
displayOff('uploadedit');
showLoading('xupload');
receive_upload_id(userId);
//alert(request.responseText);
}
}