/**Schedule控制
*制作者:William
*作用:
*开始时间:2006-11-29
*完成时间:
*修改者:
*修改时间:
*完成时间:
*/
/********************************************************************************************************************************************/
var ZM_UI100010ScheduleReadCreate = Class.create();
ZM_UI100010ScheduleReadCreate.prototype = {
initialize:function(UserId,UserName,PageCode,BeginDateTime,EndDateTime,ScheduleUsersID){
/*属性*/
this.options = Object.extend({
//最小的间隔
ScheduleMinHeight:30,
//显示的最大列数
ScheduleXMaxCount:5,
//头高度
ScheduleTitleHeight:20,
//AllDay高度
ScheduleAllDayHeight:20,
//ToDo高度
ScheduleToDoHeight:20,
//页面布局表格的ID
ScheduleLayoutTableID:"ContainerTable",
//Schedule容器表格的ID
ScheduleMaxTableID:"__schedule_max_table",
//Frame
ScheduleFrame1ID:"DataFrame1",
ScheduleFrame2ID:"DataFrame2",
ScheduleFrame3ID:"DataFrame3",
//头ID
ScheduleTitleID:"__schedule_div_title",
ScheduleTdTitleID:"__schedule_td_title",
//AllDayID
ScheduleLeftAllDayID:"allday_left",
ScheduleAllDayID:"__schedule_div_allday",
ScheduleTdAllDayID:"__schedule_td_allday",
//TODOID
ScheduleLeftToDoID:"todo_left",
ScheduleToDoID:"__schedule_div_todo",
ScheduleTdToDoID:"__schedule_td_todo",
//ScheduleID
ScheduleTdScheduleID:"__schedule_td_content"
},arguments[6]||{});
/******/
//ScheduleDiv类的创建
var ScheduleDivTypeCreate = new ZM_ScheduleDivTypeCreate();
this.ScheduleDivTypeCreate = ScheduleDivTypeCreate;
/*接受传入参数*/
this.UserId = UserId;
this.UserName = UserName;
this.PageCode = PageCode;
this.BeginDateTime = BeginDateTime;
this.EndDateTime = EndDateTime;
this.ScheduleUsersID = ScheduleUsersID;
/*************/
/*分割符号的定义*/
this.MinSplit="(|^v^|)";
this.MiddleSplit="[|>.<|]";
this.MaxSplit=")|*.*|(";
/****************/
/*接受传入属性*/
//页面布局表格的ID
this.ScheduleLayoutTableID = this.options.ScheduleLayoutTableID;
//Schedule容器表格的ID
this.ScheduleMaxTableID = this.options.ScheduleMaxTableID;
//头ID
this.ScheduleTitleID = this.options.ScheduleTitleID;
this.ScheduleTdTitleID = this.options.ScheduleTdTitleID;
//Frame
this.ScheduleFrame1ID = this.options.ScheduleFrame1ID;
this.ScheduleFrame2ID = this.options.ScheduleFrame2ID;
this.ScheduleFrame3ID = this.options.ScheduleFrame3ID;
//AllDayID
this.ScheduleLeftAllDayID = this.options.ScheduleLeftAllDayID;
this.ScheduleAllDayID = this.options.ScheduleAllDayID;
this.ScheduleTdAllDayID = this.options.ScheduleTdAllDayID;
//TODOID
this.ScheduleLeftToDoID = this.options.ScheduleLeftToDoID;
this.ScheduleToDoID = this.options.ScheduleToDoID;
this.ScheduleTdToDoID = this.options.ScheduleTdToDoID;
this.ScheduleTdScheduleID = this.options.ScheduleTdScheduleID;
//相关高度宽度及最大容纳列
this.ScheduleMinHeight = this.options.ScheduleMinHeight;
this.ScheduleXMaxCount = this.options.ScheduleXMaxCount;
this.SchedlueXMinWidth = 100/this.ScheduleXMaxCount;
this.ScheduleTitleHeight = this.options.ScheduleTitleHeight;
this.ScheduleAllDayHeight = this.options.ScheduleAllDayHeight;
this.ScheduleToDoHeight = this.options.ScheduleToDoHeight;
/***********/
/*辅助解析属性*/
//TODO的ID
this.ConTractID = null;
//UPDATE的参数字符串
this.UpdateScheduleParam = null;
//DELETE的参数字符串
this.DeleteScheduleParam = null;
//DELETETODO的参数字符串
this.DeleteToDoParam = null;
//UPDATEScheduleTilte参数字符串
this.UpdateScheduleTitleParam = null;
//UPDATEToDoTitle参数字符串
this.UpdateToDoTitleParam = null;
//UPDATEScheduleConfim参数字符串
this.ScheduleConfimParam = null;
/*************/
},
/*该类的辅助函数*/
//获取ScheduleUserID数组
getScheduleUsersID:function(){
return CreateSchedule.ScheduleUsersID.split(CreateSchedule.MinSplit);
},
//获取DivFrame2的宽度
getDivFrame2Width:function(){
//(100/显示的最大列数)*人员数得到宽度
if(CreateSchedule.getScheduleUsersID().length>CreateSchedule.ScheduleXMaxCount){
return (100/CreateSchedule.ScheduleXMaxCount)*CreateSchedule.getScheduleUsersID().length;
}
else{
return 100;
}
},
//设置DivFrame2的宽度
setDivFrame2Width:function(){
//调用getDivFrame2Width()方法+"%"得到宽度百分数
$(CreateSchedule.ScheduleFrame2ID).style.width = CreateSchedule.getDivFrame2Width() + "%";
},
//获取一般的宽度(ALLDAY或TODO的每列的宽度)
getNormal:function(intValue){
//SchedlueXMinWidth = 100/显示的最大列数
var tempWidth = CreateSchedule.SchedlueXMinWidth;
//如果显示的总列小于最大列数
if(intValue<CreateSchedule.ScheduleXMaxCount){
tempWidth = 100/intValue;
}
return tempWidth;
},
//获取一般的宽度的百分比(ALLDAY或TODO的每列的宽度的百分比)
getNormalWidth:function(intValue){
var tempWidth = CreateSchedule.getNormal(intValue);
return tempWidth+"%";
},
//获取一般LEFT位置的百分比(ALLDAY或TODO的每列的LEFT位置的百分比)
getNormalSite:function(intValue,intSite){
var tempLeft = CreateSchedule.getNormal(intValue);
tempLeft = tempLeft*intSite;
return tempLeft+"%";
},
//获取全天的CSS样式
getAllDayCss:function(tempUserId,firstValue,secondValue){
var tempCss = "green";
if(CreateSchedule.UserId!=tempUserId){
tempCss = "purple";
}
else{
if(firstValue!=tempUserId){
if(secondValue!="1"){
tempCss = "red";
}
else{
tempCss = "blue";
}
}
}
return tempCss;
},
/*********/
/*遍历解析的辅助方法*/
/*ALLDAY遍历解析的辅助方法*/
//重新设置相关ALLDAY的HEIGHT
setAllDayResetHeight:function(count){
if(count==1){
count=2;
}
$(CreateSchedule.ScheduleTdAllDayID).style.height = (count-1)*CreateSchedule.ScheduleAllDayHeight+"px";
$(CreateSchedule.ScheduleAllDayID).style.height = (count-1)*CreateSchedule.ScheduleAllDayHeight+"px";
$(CreateSchedule.ScheduleLeftAllDayID).style.height = (count-1)*CreateSchedule.ScheduleAllDayHeight+4+"px";
},
//ALLDAY排序添加到相应容器
setAllDaySortAndAddToContainer:function(containerDiv,contents){
var tempUserId = contents[0];
for(var i = 0;i<contents.length;i++){
if(i!=0){
var tempArrContent = contents[i].split(CreateSchedule.MinSplit);
var tempTop = CreateSchedule.ScheduleAllDayHeight*(i-1);
var tempDiv = "";
if(tempArrContent[12]=="0"){
var tempCss = CreateSchedule.getAllDayCss(tempUserId,tempArrContent[1],tempArrContent[2]);
tempDiv = CreateSchedule.ScheduleDivTypeCreate.setAllDayDiv(tempUserId,tempArrContent[0],"__schedule_div_allday_"+tempUserId+"_"+tempArrContent[0],tempTop+"px"+" 0 0 0",CreateSchedule.ScheduleAllDayHeight+"px",tempCss,tempArrContent[1],tempArrContent[3],tempArrContent[6],tempArrContent[7],tempArrContent[8],tempArrContent[4],tempArrContent[5],tempArrContent[9],tempArrContent[10],tempArrContent[11]);
}
else{
tempDiv = CreateSchedule.ScheduleDivTypeCreate.setHolidayDiv(tempTop+"px"+" 0 0 0",CreateSchedule.ScheduleAllDayHeight+"px",tempArrContent[3]);
}
containerDiv.appendChild(tempDiv);
}
}
},
//ALLDAYINSERT排序添加到相应容器
setAllDayInsertSortAndAddToContainer:function(contents){
var tempUserId = contents[0];
for(var i = 0;i<contents.length;i++){
if(i!=0){
var tempArrContent = contents[i].split(CreateSchedule.MinSplit);
var tempCss = CreateSchedule.getAllDayCss(tempUserId,tempArrContent[1],tempArrContent[2]);
var tempTop = CreateSchedule.ScheduleAllDayHeight*(i-1);
//如果不存在就添加
if(!$("__schedule_div_allday_"+tempUserId+"_"+tempArrContent[0])){
var tempAllDayDiv = CreateSchedule.ScheduleDivTypeCreate.setAllDayDiv(tempUserId,tempArrContent[0],"__schedule_div_allday_"+tempUserId+"_"+tempArrContent[0],tempTop+"px"+" 0 0 0",CreateSchedule.ScheduleAllDayHeight+"px",tempCss,tempArrContent[1],tempArrContent[3],tempArrContent[6],tempArrContent[7],tempArrContent[8],tempArrContent[4],tempArrContent[5],tempArrContent[9],tempArrContent[10],tempArrContent[11]);
$("__schedule_div_allday_container_"+tempUserId).appendChild(tempAllDayDiv);
}
//如果存在就修改margin属性
else{
$("__schedule_div_allday_"+tempUserId+"_"+tempArrContent[0]).style.margin = tempTop+"px"+" 0 0 0";
}
}
}
},
//ALLDAY的删除
setAllDayRemove:function(tempUserId,firstValue){
if($("__schedule_div_allday_"+tempUserId+"_"+firstValue)){
var tempDelDiv = $("__schedule_div_allday_"+tempUserId+"_"+firstValue);
$("__schedule_div_allday_container_"+tempUserId).removeChild(tempDelDiv);
}
},
//ALLDAY的MARGIN的设置
setAllDayEndConfigMargin:function(contents){
var tempUserId = contents[0];
for(var i = 0;i<contents.length;i++){
if(i!=0){
var tempArrContent = contents[i].split(CreateSchedule.MinSplit);
var tempCss = CreateSchedule.getAllDayCss(tempUserId,tempArrContent[1],tempArrContent[2]);
var tempTop = CreateSchedule.ScheduleAllDayHeight*(i-1);
$("__schedule_div_allday_"+tempUserId+"_"+tempArrContent[0]).style.margin = tempTop+"px"+" 0 0 0";
}
}
},
/*********************/
/*TODO遍历解析的辅助方法*/
//重新设置相关TODO的HEIGHT
setToDoResetHeight:function(count){
if(count==1){
count=2;
}
$(CreateSchedule.ScheduleTdToDoID).style.height = (count-1)*CreateSchedule.ScheduleToDoHeight+50+"px";
$(CreateSchedule.ScheduleToDoID).style.height = (count-1)*CreateSchedule.ScheduleToDoHeight+50+"px";
$(CreateSchedule.ScheduleLeftToDoID).style.height = (count-1)*CreateSchedule.ScheduleToDoHeight+4+50+"px";
},
//TODO排序添加到相应容器
setToDoSortAndAddToContainer:function(containerDiv,contents){
var tempUserId = contents[0];
for(var i = 0;i<contents.length;i++){
if(i!=0){
var tempArrContent = contents[i].split(CreateSchedule.MinSplit);
var tempTop = CreateSchedule.ScheduleToDoHeight*(i-1);
var tempToDoDiv = CreateSchedule.ScheduleDivTypeCreate.setToDoDiv(tempUserId,tempArrContent[0],"__schedule_div_todo_"+tempUserId+"_"+tempArrContent[0],tempTop+"px"+" 0 0 0",CreateSchedule.ScheduleToDoHeight+"px",tempArrContent[1],tempArrContent[2],tempArrContent[5],tempArrContent[6],tempArrContent[3],tempArrContent[4],tempArrContent[8],tempArrContent[9],tempArrContent[7],tempArrContent[10],tempArrContent[11]);
containerDiv.appendChild(tempToDoDiv);
}
}
},
/************************/
/*Schedule遍历解析的辅助方法*/
//SCHEDULE排序添加到相应容器
setScheduleSortAndAddToContainer:function(containerDiv,contents){
var tempUserId = contents[0];
for(var i = 0;i<contents.length;i++){
if(i!=0){
var tempArrContent = contents[i].split(CreateSchedule.MinSplit);
var tempScheduleDiv = CreateSchedule.ScheduleDivTypeCreate.setScheduleDiv(tempUserId,tempArrContent[0],"__schedule_div_schedule_"+tempUserId+"_"+tempArrContent[0],tempArrContent[19]+" 0 0 "+tempArrContent[20],tempArrContent[17],tempArrContent[18],tempArrContent[14],tempArrContent[1],tempArrContent[3],tempArrContent[8],tempArrContent[9],tempArrContent[10],tempArrContent[4],tempArrContent[5],tempArrContent[6],tempArrContent[7],tempArrContent[11],tempArrContent[12],tempArrContent[13],tempArrContent[21]);
containerDiv.appendChild(tempScheduleDiv);
}
}
},
//SCHEDULEINSERT排序添加到相应容器
setScheduleInsertSortAndAddToContainer:function(contents){
var tempUserId = contents[0];
for(var i = 0;i<contents.length;i++){
if(i!=0){
var tempArrContent = contents[i].split(CreateSchedule.MinSplit);
if(!$("__schedule_div_schedule_"+tempUserId+"_"+tempArrContent[0])){
var tempScheduleDiv = CreateSchedule.ScheduleDivTypeCreate.setScheduleDiv(tempUserId,tempArrContent[0],"__schedule_div_schedule_"+tempUserId+"_"+tempArrContent[0],tempArrContent[19]+" 0 0 "+tempArrContent[20],tempArrContent[17],tempArrContent[18],tempArrContent[14],tempArrContent[1],tempArrContent[3],tempArrContent[8],tempArrContent[9],tempArrContent[10],tempArrContent[4],tempArrContent[5],tempArrContent[6],tempArrContent[7],tempArrContent[11],tempArrContent[12],tempArrContent[13],tempArrContent[21]);
$("__schedule_div_schedule_container_"+tempUserId).appendChild(tempScheduleDiv);
}
else
{
$("__schedule_div_schedule_"+tempUserId+"_"+tempArrContent[0]).style.margin = tempArrContent[19]+" 0 0 "+tempArrContent[20];
$("__schedule_div_schedule_"+tempUserId+"_"+tempArrContent[0]).style.width = tempArrContent[17];
}
}
}
},
//SCHEDULE的删除
setScheduleRemove:function(tempUserId,firstValue){
if($("__schedule_div_schedule_"+tempUserId+"_"+firstValue)){
var tempDelDiv = $("__schedule_div_schedule_"+tempUserId+"_"+firstValue);
$("__schedule_div_schedule_container_"+tempUserId).removeChild(tempDelDiv);
}
},
//SCHEDULE的MARGIN的设置
setScheduleEndConfigMargin:function(contents){
var tempUserId = contents[0];
for(var i = 0;i<contents.length;i++){
if(i!=0){
var tempArrContent = contents[i].split(CreateSchedule.MinSplit);
$("__schedule_div_schedule_"+tempUserId+"_"+tempArrContent[0]).style.margin = tempArrContent[19]+" 0 0 "+tempArrContent[20];
$("__schedule_div_schedule_"+tempUserId+"_"+tempArrContent[0]).style.width = tempArrContent[17];
}
}
},
/*********************/
/*********************/
//初始化
init:function(){
CreateSchedule.setDivFrame2Width();
CreateSchedule.getUsers();
CreateSchedule.getAllDay();
CreateSchedule.getToDo();
CreateSchedule.getSchedule();
},
//日期的选择变化
resetSelectedDateTime:function(dateTime){
LinkParam.setLinkEabled("0|0|0");
PopupTextArea.TextAreaPopUpUnload();
CreateSchedule.BeginDateTime = dateTime;
CreateSchedule.EndDateTime = dateTime;
$(CreateSchedule.ScheduleAllDayID).innerHTML = "";
$(CreateSchedule.ScheduleToDoID).innerHTML = "";
$(CreateSchedule.ScheduleTdScheduleID).innerHTML = "";
$(CreateSchedule.ScheduleFrame1ID).style.height="10px";
$(CreateSchedule.ScheduleFrame2ID).style.height="10px";
$(CreateSchedule.ScheduleFrame3ID).style.height="70px";
CreateSchedule.setDivFrame2Width();
CreateSchedule.getUsers();
CreateSchedule.getAllDay();
CreateSchedule.getToDo();
CreateSchedule.getSchedule();
},
//重新加载
resetInit:function(){
LinkParam.setLinkEabled("0|0|0");
PopupTextArea.TextAreaPopUpUnload();
$(CreateSchedule.ScheduleAllDayID).innerHTML = "";
$(CreateSchedule.ScheduleToDoID).innerHTML = "";
$(CreateSchedule.ScheduleTdScheduleID).innerHTML = "";
$(CreateSchedule.ScheduleFrame1ID).style.height="10px";
$(CreateSchedule.ScheduleFrame2ID).style.height="10px";
$(CreateSchedule.ScheduleFrame3ID).style.height="70px";
CreateSchedule.setDivFrame2Width();
CreateSchedule.getUsers();
CreateSchedule.getAllDay();
CreateSchedule.getToDo();
CreateSchedule.getSchedule();
},
//动态设置宽度
setWidth:function(){
//var tempWidth = 512;
//if(document.body.clientWidth -250>512){
//tempWidth = document.body.clientWidth -250;
//}
// $(CreateSchedule.ScheduleTitleID).style.width = "0px";
// $(CreateSchedule.ScheduleAllDayID).style.width = "0px";
// $(CreateSchedule.ScheduleToDoID).style.width = "0px";
// $(CreateSchedule.ScheduleTdTitleID).style.width = tempWidth + "px";
// $(CreateSchedule.ScheduleTdAllDayID).style.width = tempWidth + "px";
// $(CreateSchedule.ScheduleTdToDoID).style.width = tempWidth + "px";
// $(CreateSchedule.ScheduleTitleID).style.width = $(CreateSchedule.ScheduleTdTitleID).clientWidth + "px";
// $(CreateSchedule.ScheduleAllDayID).style.width = $(CreateSchedule.ScheduleTdAllDayID).clientWidth + "px";
// $(CreateSchedule.ScheduleToDoID).style.width = $(CreateSchedule.ScheduleTdToDoID).clientWidth + "px";
},
//动态设置高度
setHeight:function(){
//var tempHtml = $(CreateSchedule.ScheduleFrame2ID).innerHTML;
var tempHeight1 = 512;
//if(document.body.clientHeight-100>512){
tempHeight1= document.body.clientHeight - 130;
//}
var tempHeight2 = parseInt($(CreateSchedule.ScheduleLeftAllDayID).style.height);
var tempHeight3 = parseInt($(CreateSchedule.ScheduleLeftToDoID).style.height);
var tempHeight4 = tempHeight1 - tempHeight2 - tempHeight3 - 50;
//$(CreateSchedule.ScheduleLayoutTableID).style.height = tempHeight1 + "px";
$(CreateSchedule.ScheduleFrame1ID).style.height = tempHeight4 +"px";
$(CreateSchedule.ScheduleFrame2ID).style.height = tempHeight4 +"px";
$(CreateSchedule.ScheduleFrame3ID).style.height = tempHeight4 + 73 +"px";
//$(CreateSchedule.ScheduleMaxTableID).style.height = "100%";
//$(CreateSchedule.ScheduleFrame2ID).innerHTML = tempHtml;
},
/*处理要显示的人员*/
//获得显示人名的字符串
getUsers:function(){
ScheduleService.GetUI100010ScheduleUsers(CreateSchedule.UserId,CreateSchedule.UserName,CreateSchedule.PageCode,CreateSchedule.setUsers);
},
//处理显示人名的字符串的返回值
setUsers:function(returnValue){
var tempArr = returnValue.split(CreateSchedule.MaxSplit);
var ScheduleUsersID = tempArr[0];
var ScheduleUsersName =tempArr[1];
//处理显示人名的字符串并解析成DIV并且排序
CreateSchedule.setUsersSortAndAdd(ScheduleUsersID,ScheduleUsersName);
},
//处理显示人名的字符串并解析成DIV并且排序
setUsersSortAndAdd:function(sortValue,sortText){
var tempArrValue = sortValue.split(CreateSchedule.MinSplit);
var tempArrText = sortText.split(CreateSchedule.MinSplit);
//获取一般的宽度的百分比(ALLDAY或TODO的每列的宽度的百分比)
var tempWidth = CreateSchedule.getNormalWidth(tempArrValue.length);
//遍历并添加USERDIV的排序
for(var i = 0;i<tempArrValue.length;i++){
//获取一般LEFT位置的百分比
var tempLeft = CreateSchedule.getNormalSite(tempArrValue.length,i);
var tempClass = 1;
//如果是SIGNINUSERID
if(CreateSchedule.UserId==tempArrValue[i]){
tempClass = 0;
}
//创建USERDIV
var tempDiv = CreateSchedule.ScheduleDivTypeCreate.setUserDiv("__schedule_username_"+tempArrValue[i],"0 0 0 "+tempLeft,tempWidth,CreateSchedule.ScheduleTitleHeight+"px",tempClass,tempArrText[i]);
//向TITLE容器中添加USERDIV
$(CreateSchedule.ScheduleTitleID).appendChild(tempDiv);
}
},
/**********/
/*全天的读入解析过程*/
//获得全天
getAllDay:function(){
ScheduleService.GetUI100010ScheduleAllDay(CreateSchedule.ScheduleUsersID,CreateSchedule.BeginDateTime,CreateSchedule.EndDateTime,CreateSchedule.setAllDay);
},
//处理全天
setAllDay:function(returnValue){
var tempArr = returnValue.split(CreateSchedule.MaxSplit);
CreateSchedule.setAllDaySortAndAdd(tempArr);
},
//全天排序并且添加
setAllDaySortAndAdd:function(sortText){
//获取ScheduleUserID数组
var tempArrUserId = CreateSchedule.getScheduleUsersID();
//设置ALLDAY容器的宽度
var tempContainerWidth = CreateSchedule.getNormalWidth(tempArrUserId.length);
var tempCount = 0;
for(var i = 0;i<tempArrUserId.length;i++)
{
//设置ALLDAY容器的LEFT位置
var tempContainerLeft = CreateSchedule.getNormalSite(tempArrUserId.length,i);
//创建ALLDAY容器
var tempContainerDiv = CreateSchedule.ScheduleDivTypeCreate.setAllDayContainerDiv("__schedule_div_allday_container_"+tempArrUserId[i],tempArrUserId[i],"0 0 0 "+tempContainerLeft,tempContainerWidth);
//解析记录
var tempArrContents = sortText[i].split(CreateSchedule.MiddleSplit);
//记录数大于tempCount
if(tempArrContents.length>tempCount){
tempCount = tempArrContents.length;
}
/*ALLDAY遍历解析的辅助方法*/
CreateSchedule.setAllDaySortAndAddToContainer(tempContainerDiv,tempArrContents);
$(CreateSchedule.ScheduleAllDayID).appendChild(tempContainerDiv);
}
CreateSchedule.setAllDayResetHeight(tempCount);
},
/*****************/
/*TODO的读入解析过程*/
//获得TODO
getToDo:function(){
ScheduleService.GetUI100010ToDo(CreateSchedule.ScheduleUsersID,CreateSchedule.BeginDateTime,CreateSchedule.EndDateTime,CreateSchedule.BeginDateTime,CreateSchedule.setToDo);
},
//设置TODO
setToDo:function(returnValue){
var tempArr = returnValue.split(CreateSchedule.MaxSplit);
CreateSchedule.setToDoSortAndAdd(tempArr);
},
//TODO排序并且添加
setToDoSortAndAdd:function(sortText){
//获取ScheduleUserID数组
var tempArrUserId = CreateSchedule.getScheduleUsersID();
//设置ToDo容器的宽度
var tempContainerWidth = CreateSchedule.getNormalWidth(tempArrUserId.length);
var tempCount = 0;
for(var i = 0;i<tempArrUserId.length;i++)
{
//设置ToDo容器的LEFT位置
var tempContainerLeft = CreateSchedule.getNormalSite(tempArrUserId.length,i);
//创建ToDo容器
var tempContainerDiv = CreateSchedule.ScheduleDivTypeCreate.setToDoContainerDiv("__schedule_div_todo_container_"+tempArrUserId[i],tempArrUserId[i],"0 0 0 "+tempContainerLeft,tempContainerWidth);
//解析记录
var tempArrContents = sortText[i].split(CreateSchedule.MiddleSplit);
if(tempArrContents.length>tempCount){
tempCount = tempArrContents.length;
}
/*ALLDAY遍历解析的辅助方法*/
CreateSchedule.setToDoSortAndAddToContainer(tempContainerDiv,tempArrContents);
$(CreateSchedule.ScheduleToDoID).appendChild(tempContainerDiv);
}
CreateSchedule.setToDoResetHeight(tempCount);
},
//ToDo的删除
setToDoRemove:function(tempUserId,firstValue){
if($("__schedule_div_todo_"+tempUserId+"_"+firstValue)){
var tempDelToDoDiv = $("__schedule_div_todo_"+tempUserId+"_"+firstValue);
$("__schedule_div_todo_container_"+tempUserId).removeChild(tempDelToDoDiv);
}
},
//ToDo的MARGIN的设置
setToDoEndConfigMargin:function(contents){
var tempUserId = contents[0];
for(var i = 0;i<contents.length;i++){
if(i!=0){
var tempArrContent = contents[i].split(CreateSchedule.MinSplit);
var tempTop = CreateSchedule.ScheduleToDoHeight*(i-1);
$("__schedule_div_todo_"+tempUserId+"_"+tempArrContent[0]).style.margin = tempTop+"px 0 0 0";
}
}
},
/*****************/
/*Schedule的读入解析过程*/
//获得Schedule
getSchedule:function(){
ScheduleService.GetUI100010Schedule(CreateSchedule.ScheduleUsersID,CreateSchedule.BeginDateTime,CreateSchedule.EndDateTime,CreateSchedule.setSchedule);
},
//处理Schedule
setSchedule:function(returnValue){
var tempArr = returnValue.split(CreateSchedule.MaxSplit);
CreateSchedule.setScheduleSortAndAdd(tempArr);
},
//Schedule排序并且添加
setScheduleSortAndAdd:function(sortText){
//设置高度
if(CreateSchedule.PageCode=="UI100010"){
CreateSchedule.setHeight();
}
//获取ScheduleUserID数组
var tempArrUserId = CreateSchedule.getScheduleUsersID();
//设置容器的宽度
var tempContainerWidth =100/tempArrUserId.length - CreateSchedule.getDivFrame2Width()/10000;//(100/tempArrUserId.length)/(CreateSchedule.getDivFrame2Width()/100);
for(var i = 0;i<tempArrUserId.length;i++)
{
var tempScheduleBackGroundDiv = CreateSchedule.ScheduleDivTypeCreate.setScheduleBackGroundDiv("0 0 0 "+i*tempContainerWidth+"%",tempContainerWidth+"%");
var tempScheduleContainerDiv = CreateSchedule.ScheduleDivTypeCreate.setScheduleContainerDiv("__schedule_div_schedule_container_"+tempArrUserId[i],tempArrUserId[i],"0 0 0 "+i*tempContainerWidth+"%",tempContainerWidth+"%");
var tempArrContents = sortText[i].split(CreateSchedule.MiddleSplit);
/*Schedule遍历解析的辅助方法*/
CreateSchedule.setScheduleSortAndAddToContainer(tempScheduleContainerDiv,tempArrContents);
$(CreateSchedule.ScheduleTdScheduleID).appendChild(tempScheduleBackGroundDiv);
$(CreateSchedule.ScheduleTdScheduleID).appendChild(tempScheduleContainerDiv);
}
},
/*****************/
/*ToDoCheck的处理过程*/
//对CHECKEDTODO进行更新,返回更新字符串
setScheduleToDo:function(checkId){
var temp=checkId.split('_');
//对辅助解析的TODOID属性进行赋值
CreateSchedule.ConTractID = checkId;
ScheduleService.SetUI100010ToDo(temp[4],temp[5],$(checkId).checked,CreateSchedule.getScheduleToDo);
},
//对更新后的TODO进行解析
getScheduleToDo:function(returnValue){
//如果返回FALSE表示失败,那么还原原来的TODO
if(returnValue = false){
$(CreateSchedule.ConTractID).checked = !$(CreateSchedule.ConTractID).checked;
}
else{
//是否需要联动
var temp = CreateSchedule.ConTractID.replace("__checkbox_todo_","__hidden_todo_drags_");
//如果需要联动
if($(temp).value==1){
var tempID = CreateSchedule.ConTractID.split('_');
tempID = tempID[5];
var tempArr =CreateSchedule.getScheduleUsersID();
//遍历所有的该ID的TODO
for(var i = 0;i<tempArr.length;i++){
//如果该对象存在
if($("__checkbox_todo_"+tempArr[i] +"_"+tempID)){
//如果该对象不是点击的TODO
if($("__checkbox_todo_"+tempArr[i] +"_"+tempID)!=$(CreateSchedule.ConTractID))
{
$("__checkbox_todo_"+tempArr[i] +"_"+tempID).checked = $(CreateSchedule.ConTractID).checked;
}
}
}
}
}
},
/*****************/
/*ScheduleINSERT的处理过程*/
//对Schedule进行INSERT操作
setScheduleInsert:function(scheduleID,changeUserId,isAllDay,beginDate,beginTime,elapseTime){
ScheduleService.SetUI100010InsertSchedule(CreateSchedule.UserId,scheduleID,changeUserId,isAllDay,beginDate,beginTime,elapseTime,CreateSchedule.getScheduleInsert);
},
//获得ScheduleINSERT的返回值
getScheduleInsert:function(returnValue){
if(returnValue!="error"&&returnValue!="errorFacilities"){
var temp = returnValue.split(CreateSchedule.MinSplit);
//ALLDAY
if(temp[1]=="1"){
ScheduleService.GetUI100010ScheduleAllDay(parseInt(temp[0]),CreateSchedule.BeginDateTime,CreateSchedule.EndDateTime,CreateSchedule.setScheduleInsertAllDay);
}
//SCHEDULE
else{
ScheduleService.GetUI100010Schedule(parseInt(temp[0]),CreateSchedule.BeginDateTime,CreateSchedule.EndDateTime,CreateSchedule.setScheduleInsertSchedule);
}
}
else{
if(returnValue=="errorFacilities"){
showConfirmDialogBySize(300,200,["ER10007002"],["BTN000003"],["closeConfirmDialog();"]);
}
else{
showConfirmDialogBySize(300,200,["ER10001003"],["BTN000003"],["closeConfirmDialog();"]);
}
}
},
//处理ScheduleInsertAllDay
setScheduleInsertAllDay:function(returnValue){
//var tempArr = returnValue.split(CreateSchedule.MaxSplit);
CreateSchedule.setInsertAllDaySortAndAdd(returnValue);
},
//处理ScheduleInsertSchedule
setScheduleInsertSchedule:function(returnValue){
//var tempArr = returnValue.split(CreateSchedule.MaxSplit);
CreateSchedule.setInsertScheduleSortAndAdd(returnValue);
},
//ScheduleInsertAllDay排序并添加
setInsertAllDaySortAndAdd:function(sortText){
var tempArrContents = sortText.split(CreateSchedule.MiddleSplit);
var tempCount = tempArrContents.length;
/*ALLDAY遍历解析的辅助方法*/
CreateSchedule.setAllDayInsertSortAndAddToContainer(tempArrContents);
if(parseInt($(CreateSchedule.ScheduleAllDayID).style.height)<tempCount*CreateSchedule.ScheduleAllDayHeight){
CreateSchedule.setAllDayResetHeight(tempCount);
CreateSchedule.setHeight();
}
ConfigIframe("../Dialog/UID060.aspx",585,420);
},
//ScheduleInsertSchedule排序并添加
setInsertScheduleSortAndAdd:function(sortText){
var tempArrContents = sortText.split(CreateSchedule.MiddleSplit);
/*SCHEDULE遍历解析的辅助方法*/
CreateSchedule.setScheduleInsertSortAndAddToContainer(tempArrContents);
ConfigIframe("../Dialog/UID060.aspx",585,420);
},
/****************/
/*ScheduleUPDATE处理过程*/
//Schedule更新选择
setScheduleUpdate:function(scheduleID,changeUsersId,isAllDay,beginTime,elapseTime,needDrags,needCol){
CreateSchedule.UpdateScheduleParam = scheduleID+CreateSchedule.MiddleSplit+changeUsersId+CreateSchedule.MiddleSplit+isAllDay+CreateSchedule.MiddleSplit+beginTime+CreateSchedule.MiddleSplit+elapseTime+CreateSchedule.MiddleSplit+needCol;
if(needDrags==1){
showConfirmDialogBySize(500,200,["ER10001001"],["BTN000001","BTN000002","BTN000003"],["CreateSchedule.setScheduleConfigCutUpdate();closeConfirmDialog();","CreateSchedule.setScheduleConfigNotCutUpdate();closeConfirmDialog();","DragDrop.backUp();closeConfirmDialog();"]);
}
else{
CreateSchedule.setScheduleConfigNotCutUpdate();
}
},
//Schedule切割更新(更新当天)
setScheduleConfigCutUpdate:function(){
var temp = CreateSchedule.UpdateScheduleParam.split(CreateSchedule.MiddleSplit);
ScheduleService.SetUI100010UpdateSchedule(CreateSchedule.UserId,temp[0],temp[1],temp[2],CreateSchedule.BeginDateTime,temp[3],temp[4],1,temp[5],CreateSchedule.getEndConfigScheduleUpdate);
},
//Schedule无切割更新(更新全部)
setScheduleConfigNotCutUpdate:function(){
var temp = CreateSchedule.UpdateScheduleParam.split(CreateSchedule.MiddleSplit);
ScheduleService.SetUI100010UpdateSchedule(CreateSchedule.UserId,temp[0],temp[1],temp[2],CreateSchedule.BeginDateTime,temp[3],temp[4],0,temp[5],CreateSchedule.getEndConfigScheduleUpdate);
},
//获取UPDATE后的返回字符串
getEndConfigScheduleUpdate:function(returnValue){
if(returnValue!="error"&&returnValue!="errorFacilities"){
var temp = returnValue.split(CreateSchedule.MiddleSplit);
if(temp[1]=="1"){
ScheduleService.GetUI100010ScheduleAllDay(temp[0],CreateSchedule.BeginDateTime,CreateSchedule.EndDateTime,CreateSchedule.setUpdateAllDay);
ScheduleService.GetUI100010Schedule(temp[0],CreateSchedule.BeginDateTime,CreateSchedule.EndDateTime,CreateSchedule.setUpdateSchedule);
}
else{
ScheduleService.GetUI100010Schedule(temp[0],CreateSchedule.BeginDateTime,CreateSchedule.EndDateTime,CreateSchedule.setUpdateSchedule);
}
}
else{
if(returnValue=="errorFacilities"){
showConfirmDialogBySize(300,200,["ER10007002"],["BTN000003"],["closeConfirmDialog();"]);
}
else{
showConfirmDialogBySize(300,200,["ER10001003"],["BTN000003"],["closeConfirmDialog();"]);
}
}
},
//获取ALLDAYUPDATE后的返回字符串
setUpdateAllDay:function(returnValue){
var tempArr = returnValue.split(CreateSchedule.MaxSplit);
CreateSchedule.setUpdateAllDaySortAndAdd(tempArr);
},
//获取SCHEDULEUPDATE后的返回字符串
setUpdateSchedule:function(returnValue){
var tempArr = returnValue.split(CreateSchedule.MaxSplit);
CreateSchedule.setUpdateScheduleSortAndAdd(tempArr);
},
//解析ALLDAYUPDATE的返回字符串
setUpdateAllDaySortAndAdd:function(sortText){
var tempNeedConfig = CreateSchedule.UpdateScheduleParam.split(CreateSchedule.MiddleSplit);
var tempUserIds = tempNeedConfig[1].split(CreateSchedule.MinSplit);
for(var i = 0;i<tempUserIds.length;i++){
var tempArrContents = sortText[i].split(CreateSchedule.MiddleSplit);
var tempUserId = tempArrContents[0];
var tempCount = tempArrContents.length;
/*ALLDAY遍历解析的辅助方法*/
CreateSchedule.setAllDayRemove(tempUserId,tempNeedConfig[0]);
CreateSchedule.setAllDayInsertSortAndAddToContainer(tempArrContents);
if(parseInt($(CreateSchedule.ScheduleAllDayID).style.height)<tempCount*CreateSchedule.ScheduleAllDayHeight){
CreateSchedule.setAllDayResetHeight(tempCount);
CreateSchedule.setHeight();
}
}
ConfigIframe("../Dialog/UID060.aspx",585,420);
},
//解析SCHEDULEUPDATE的返回字符串
setUpdateScheduleSortAndAdd:function(sortText){
var tempNeedConfig = CreateSchedule.UpdateScheduleParam.split(CreateSchedule.MiddleSplit);
var tempUserIds = tempNeedConfig[1].split(CreateSchedule.MinSplit);
for(var i = 0;i<tempUserIds.length;i++){
var tempArrContents = sortText[i].split(CreateSchedule.MiddleSplit);
var tempUserId = tempArrContents[0];
/*SCHEDULE遍历解析的辅助方法*/
CreateSchedule.setScheduleRemove(tempUserId,tempNeedConfig[0]);
CreateSchedule.setScheduleInsertSortAndAddToContainer(tempArrContents);
}
ConfigIframe("../Dialog/UID060.aspx",585,420);
},
/**************/
/*ScheduleDELETE处理过程*/
//schedule删除
setScheduleDel:function(scheduleId,changeUsersId,type,cssClass){
CreateSchedule.DeleteScheduleParam = scheduleId+CreateSchedule.MiddleSplit+changeUsersId+CreateSchedule.MiddleSplit+type;
PopupTextArea.TextAreaPopUpUnload();
var tempId = changeUsersId.split(CreateSchedule.MinSplit);
if(cssClass=="blue"){
showConfirmDialogBySize(500,200,["ER10001002"],["BTN000001","BTN000002","BTN000003"],["CreateSchedule.setScheduleConfigDelSelf();closeConfirmDialog();","CreateSchedule.setScheduleConfigDelAll();closeConfirmDialog();","closeConfirmDialog();"]);
}
else{
if(cssClass=="red"){
CreateSchedule.setScheduleConfigDelSelf();
}
if(cssClass=="green"){
CreateSchedule.setScheduleConfigDelAll();
}
if(cssClass=="purple"){
CreateSchedule.setScheduleConfigDelAll();
}
}
},
//只删除自己
setScheduleConfigDelSelf:function(){
var temp = CreateSchedule.DeleteScheduleParam.split(CreateSchedule.MiddleSplit);
ScheduleService.SetUI100010DeleteSchedule(temp[0],CreateSchedule.UserId,temp[2],0,CreateSchedule.getEndConfigScheduleDelete);
},
//删除所有
setScheduleConfigDelAll:function(){
var temp = CreateSchedule.DeleteScheduleParam.split(CreateSchedule.MiddleSplit);
ScheduleService.SetUI100010DeleteSchedule(temp[0],temp[1],temp[2],1,CreateSchedule.getEndConfigScheduleDelete);
},
//获取删除SCHEDULE返回字符串
getEndConfigScheduleDelete:function(returnValue){
if(returnValue!="error"){
CreateSchedule.DeleteScheduleParam = returnValue;
var temp = returnValue.split(CreateSchedule.MiddleSplit);
if(temp[2]=="schedule"){
CreateSchedule.getDeleteSchedule(temp[1]);
}
else{
CreateSchedule.getDeleteAllDay(temp[1]);
}
}
else{
showConfirmDialogBySize(300,200,["ER10001002"],["BTN000003"],["closeConfirmDialog();"]);
}
},
//获取删除SCHEDULEALLDAY返回字符串
getDeleteAllDay:function(returnValue){
ScheduleService.GetUI100010ScheduleAllDay(returnValue,CreateSchedule.BeginDateTime,CreateSchedule.EndDateTime,CreateSchedule.setDeleteAllDay);
},
//获取删除SCHEDULEALLDAY返回字符串
setDeleteAllDay:function(returnValue){
var tempArr = returnValue.split(CreateSchedule.MaxSplit);
CreateSchedule.setDeleteAllDaySortAndAdd(tempArr);
},
//解析SCHEDULEALLDAYDELETE的返回字符串
setDeleteAllDaySortAndAdd:function(sortText){
var tempNeedConfig = CreateSchedule.DeleteScheduleParam.split(CreateSchedule.MiddleSplit);
for(var i = 0;i<sortText.length;i++){
var tempArrContents = sortText[i].split(CreateSchedule.MiddleSplit);
var tempUserId = tempArrContents[0];
var tempCount = sortText.length;
/*ALLDAY遍历解析的辅助方法*/
CreateSchedule.setAllDayRemove(tempUserId,tempNeedConfig[0]);
CreateSchedule.setAllDayEndConfigMargin(tempArrContents);
/**************************/
LinkParam.setLinkEabled("0|0|0");
/**************************/
if(parseInt($(CreateSchedule.ScheduleAllDayID).style.height)<tempCount*CreateSchedule.ScheduleAllDayHeight){
CreateSchedule.setAllDayResetHeight(tempCount);
CreateSchedule.setHeight();
}
}
if(tempNeedConfig[3]=="1"){
ConfigIframe("../Dialog/UID060.aspx",585,420);
}
},
//获取删除SCHEDULESCHEDULE返回字符串
getDeleteSchedule:function(returnValue){
ScheduleService.GetUI100010Schedule(returnValue,CreateSchedule.BeginDateTime,CreateSchedule.EndDateTime,CreateSchedule.setDeleteSchedule);
},
//获取删除SCHEDULESCHEDULE返回字符串
setDeleteSchedule:function(returnValue){
var tempArr = returnValue.split(CreateSchedule.MaxSplit);
CreateSchedule.setDeleteScheduleSortAndAdd(tempArr);
},
//解析SCHEDULESCHEDULEDELETE的返回字符串
setDeleteScheduleSortAndAdd:function(sortText){
var tempNeedConfig = CreateSchedule.DeleteScheduleParam.split(CreateSchedule.MiddleSplit);
for(var i = 0;i<sortText.length;i++){
var tempArrContents = sortText[i].split(CreateSchedule.MiddleSplit);
var tempUserId = tempArrContents[0];
/*SCHEDULE遍历解析的辅助方法*/
CreateSchedule.setScheduleRemove(tempUserId,tempNeedConfig[0]);
CreateSchedule.setScheduleEndConfigMargin(tempArrContents);
/**************************/
LinkParam.setLinkEabled("0|0|0");
/**************************/
}
if(tempNeedConfig[3]=="1"){
ConfigIframe("../Dialog/UID060.aspx",585,420);
}
},
/****************/
/*ToDoDELETE处理过程*/
//schedule删除
setToDoDel:function(scheduleId,changeUsersId,cssClass){
CreateSchedule.DeleteToDoParam = scheduleId+CreateSchedule.MiddleSplit+changeUsersId;
PopupTextArea.TextAreaPopUpUnload();
var tempId = changeUsersId.split(CreateSchedule.MinSplit);
if(cssClass=="blue"){
showConfirmDialogBySize(500,200,["ER10001002"],["BTN000001","BTN000002","BTN000003"],["CreateSchedule.setToDoConfigDelSelf();closeConfirmDialog();","CreateSchedule.setToDoConfigDelAll();closeConfirmDialog();","closeConfirmDialog();"]);
}
else{
if(cssClass=="green"){
CreateSchedule.setToDoConfigDelAll();
}
if(cssClass=="purple"){
CreateSchedule.setToDoConfigDelAll();
}
}
},
//只删除自己
setToDoConfigDelSelf:function(){
var temp = CreateSchedule.DeleteToDoParam.split(CreateSchedule.MiddleSplit);
ScheduleService.SetUI100010DeleteToDo(temp[0],CreateSchedule.UserId,0,CreateSchedule.getEndConfigToDoDelete);
},
//删除所有
setToDoConfigDelAll:function(){
var temp = CreateSchedule.DeleteToDoParam.split(CreateSchedule.MiddleSplit);
ScheduleService.SetUI100010DeleteToDo(temp[0],temp[1],1,CreateSchedule.getEndConfigToDoDelete);
},
//获取删除ToDo返回字符串
getEndConfigToDoDelete:function(returnValue){
if(returnValue!="error"){
CreateSchedule.DeleteToDoParam = returnValue;
var temp = returnValue.split(CreateSchedule.MiddleSplit);
CreateSchedule.getDeleteToDo(temp[1]);
}
else{
showConfirmDialogBySize(300,200,["ER10001002"],["BTN000003"],["closeConfirmDialog();"]);
}
},
//获取删除TODO返回字符串
getDeleteToDo:function(returnValue){
ScheduleService.GetUI100010ToDo(returnValue,CreateSchedule.BeginDateTime,CreateSchedule.EndDateTime,CreateSchedule.BeginDateTime,CreateSchedule.setDeleteToDo);
},
//获取删除TODO返回字符串
setDeleteToDo:function(returnValue){
var tempArr = returnValue.split(CreateSchedule.MaxSplit);
CreateSchedule.setDeleteToDoSortAndAdd(tempArr);
},
//解析TODODELETE的返回字符串
setDeleteToDoSortAndAdd:function(sortText){
var tempNeedConfig = CreateSchedule.DeleteToDoParam.split(CreateSchedule.MiddleSplit);
for(var i = 0;i<sortText.length;i++){
var tempArrContents = sortText[i].split(CreateSchedule.MiddleSplit);
var tempUserId = tempArrContents[0];
/*SCHEDULE遍历解析的辅助方法*/
CreateSchedule.setToDoRemove(tempUserId,tempNeedConfig[0]);
CreateSchedule.setToDoEndConfigMargin(tempArrContents);
/**************************/
LinkParam.setLinkEabled("0|0|0");
/**************************/
}
if(tempNeedConfig[2]=="1"){
ConfigIframe("../Dialog/UID060.aspx",585,420);
}
},
/****************/
/*更新SCHEDULETITLE*/
//获取更新SCHEDULETITLE后的返回值
setScheduleTitle:function(scheduleId,type){
CreateSchedule.UpdateScheduleTitleParam = scheduleId+CreateSchedule.MiddleSplit+type;
if($("textareabox").value!=""){
ScheduleService.SetUI100010ScheduleTitle(scheduleId,$("textareabox").value,CreateSchedule.getScheduleTitle);
}
else{
showConfirmDialogBySize(300,200,["ER10002001"],["BTN000003"],["closeConfirmDialog();"]);
}
},
//解析SCHEDULETITLEEDIT返回字符串
getScheduleTitle:function(returnValue){
if(returnValue!="error"){
PopupTextArea.TextAreaUnload();
var temp = CreateSchedule.UpdateScheduleTitleParam.split(CreateSchedule.MiddleSplit);
var tempUserIds = CreateSchedule.getScheduleUsersID();
for(var i = 0;i<tempUserIds.length;i++){
if($("__schedule_div_"+temp[1]+"_"+tempUserIds[i]+"_"+temp[0])){
var tempValue = returnValue;
if(temp[1]=="schedule"){
tempValue = $("__schedule_"+temp[1]+"_table_middle_td_"+tempUserIds[i]+"_"+temp[0]).innerHTML.split('<BR>');
tempValue = tempValue[0] + "<br>"+ returnValue;
}
$("__schedule_"+temp[1]+"_table_middle_td_"+tempUserIds[i]+"_"+temp[0]).innerHTML =tempValue;
$("__hidden_title_"+tempUserIds[i]+"_"+temp[0]).value = returnValue;
}
}
ConfigIframe("../Dialog/UID060.aspx",585,420);
}
else{
showConfirmDialogBySize(300,200,["ER10001002"],["BTN000003"],["closeConfirmDialog();"]);
}
},
/**********/
/*更新ToDoTITLE*/
//获取更新ToDoTITLE后的返回值
setToDoTitle:function(scheduleId){
CreateSchedule.UpdateToDoTitleParam = scheduleId;
if($("textareabox").value!=""){
ScheduleService.SetUI100010ToDoTitle(scheduleId,$("textareabox").value,CreateSchedule.getToDoTitle);
}
else{
showConfirmDialogBySize(300,200,["ER10002002"],["BTN000003"],["closeConfirmDialog();"]);
}
},
//解析ToDoTITLE返回字符串
getToDoTitle:function(returnValue){
if(returnValue!="error"){
PopupTextArea.TextAreaUnload();
var temp = CreateSchedule.UpdateToDoTitleParam;
var tempUserIds = CreateSchedule.getScheduleUsersID();
for(var i = 0;i<tempUserIds.length;i++){
if($("__schedule_div_todo_"+tempUserIds[i]+"_"+temp)){
var tempValue = returnValue;
$("__schedule_todo_table_right_td_"+tempUserIds[i]+"_"+temp).innerHTML =tempValue;
$("__hidden_todo_title_"+tempUserIds[i]+"_"+temp).value = returnValue;
}
}
ConfigIframe("../Dialog/UID060.aspx",585,420);
}
else{
showConfirmDialogBySize(300,200,["ER10001002"],["BTN000003"],["closeConfirmDialog();"]);
}
},
/**********/
/*更新REDSCHEDULE*/
//获取更新REDSCHEDULE后的返回值
setScheduleConfim:function(parentId,scheduleId,type){
CreateSchedule.ScheduleConfimParam = parentId+CreateSchedule.MiddleSplit+scheduleId+CreateSchedule.MiddleSplit+type;
ScheduleService.SetUI100010ScheduleConfim(scheduleId,parentId,CreateSchedule.getScheduleConfim);
},
getScheduleConfim:function(returnValue){
if(returnValue!="error"){
PopupTextArea.PopUpUnload();
var temp = CreateSchedule.ScheduleConfimParam.split(CreateSchedule.MiddleSplit);
if($("__schedule_div_"+temp[2]+"_"+temp[0]+"_"+temp[1])){
$("__schedule_div_"+temp[2]+"_"+temp[0]+"_"+temp[1]).className = "schedule_drag_drop_div_"+returnValue;
$("__schedule_schedule_table_left_td_"+temp[0]+"_"+temp[1]).className = "schedule_drag_drop_table_left_td_"+returnValue;
if(temp[2]!="allday"){
$("__schedule_schedule_table_top_td_"+temp[0]+"_"+temp[1]).className = "schedule_drag_drop_table_top_td_"+returnValue;
$("__schedule_schedule_table_bottom_td_"+temp[0]+"_"+temp[1]).className = "schedule_drag_drop_table_bottom_td_"+returnValue;
}
$("__schedule_schedule_table_middle_td_"+temp[0]+"_"+temp[1]).className = "schedule_drag_drop_table_middle_td_"+returnValue;
$("__hidden_todo_type_"+temp[0]+"_"+temp[1]).value = 2;
}
}
else{
showConfirmDialogBySize(300,200,["ER10001002"],["BTN000003"],["closeConfirmDialog();"]);
}
},
/*****************/
/*设置SESSION*/
// setScheduleUserId:function(userId){
// ScheduleService.SetUI100030SessionUserId(userId,CreateSchedule.getScheduleUserId);
// },
// getScheduleUserId:function(returnValue){
// CreateSchedule.UserId = parseInt(returnValue);
// CreateSchedule.resetUser(parseInt(returnValue));
// },
setScheduleSelectedDateTime:function(dateTime){
ScheduleService.SetUI100010SessionSelectedDateTime(dateTime,CreateSchedule.getScheduleSelectedDateTime);
},
getScheduleSelectedDateTime:function(returnValue){
CreateSchedule.SelectedDateTime = returnValue;
CreateSchedule.resetSelectedDateTime(returnValue);
}
/***********************/
}
/********************************************************************************************************************************************/
/********************************************************************************************************************************************/
var ZM_ScheduleDragDrop = Class.create();
ZM_ScheduleDragDrop.prototype = {
initialize:function(XScrollID,YScrollID,SiteID,XYSiteID,YSiteID){
//X滚动条
this.XScrollID=XScrollID;
//Y滚动条
this.YScrollID =YScrollID;
//用于计算右边越界
this.SiteID = SiteID;
//用于计算下左边越界
this.XYSiteID = XYSiteID;
//用于计算上边边界
this.YSiteID = YSiteID;
//记录ID
this.DataID="";
//父类ID
this.ParentID="";
//区分是ALLDAY还是SCHEDULE
this.FlagString="";
this.DragDivObject = null;
this.DragDivObjectOverTop = null;
this.DragOverTop=false;
this.MinTop = null;
this.OverTopHeight = null;
this.InContainerSite = null;
this.Dragged = false;
this.LastX = null;
this.LastY = null;
this.LastLeft = null;
this.LastTop = null;
this.DragType=null;
this.BeginDrapHeight=null;
this.BeginMargin = null;
this.BeginHeight = null;
this.init();
},
init:function() {
this.eventOnDrag = this.DivOnDrag.bindAsEventListener(this);
Event.observe(document,"mousemove",this.eventOnDrag);
this.eventDragEnd = this.DivDragEnd.bindAsEventListener(this);
Event.observe(document,"mouseup",this.eventDragEnd);
},
isOverTop:function(){
if(this.DragDivObjectOverTop!=null){
var temp = this.DragDivObjectOverTop.split('||');
for(var i = 0;i<temp.length;i++){
if(this.DragDivObject.id == temp[i]){
this.DragOverTop=true;
break;
}
}
}
},
//得到第一种拖拽类别下生成DIV的高度和TOP(只对SCHEDULE有效)
getDragTypeOneTopOrHeight:function(getWhich,type){
var tempHeight = this.DragDivObject.offsetHeight;
var tempTop = this.getTop(event,1);
if(type=="schedule"){
if(tempTop<GetInfo($(CreateSchedule.ScheduleFrame2ID)).top){
tempHeight = tempHeight - (GetInfo($(CreateSchedule.ScheduleFrame2ID)).top - tempTop);
tempTop = GetInfo($(CreateSchedule.ScheduleFrame2ID)).top;
}
if(tempTop+tempHeight>GetInfo($(CreateSchedule.ScheduleFrame2ID)).bottom){
tempHeight = GetInfo($(CreateSchedule.ScheduleFrame2ID)).bottom - tempTop;
}
}
if(getWhich=="top"){
return tempTop;
}
else{
if(getWhich=="height"){
return tempHeight;
}
else{
alert("Please gave me a param!");
}
}
},
//获取拖拽DIV的高度
getTop:function(event,num){
if(num==1){
return GetInfo(this.DragDivObject).top;
}
else{
return Event.pointerY(event) - (this.LastY - parseInt(this.LastTop));
}
},
getLeft:function(event){
return Event.pointerX(event) - 4;
},
getBottom:function(event,num){
if(num==1){
return GetInfo(this.DragDivObject).bottom;
}
else{
return Event.pointerY(event) - (this.LastY - parseInt(this.LastTop)) + this.DragDivObject.offsetHeight;
}
},
getRight:function(event){
return Event.pointerX(event) + this.DragDivObject.offsetWidth;
},
getChangeDivID:function(){
return "__schedule_div_"+this.FlagString+"_"+this.ParentID+"_"+this.DataID;
},
getChangeMiddleTD:function(){
return "__schedule_schedule_table_middle_td_"+this.ParentID+"_"+this.DataID;
},
getBeginChangeContainerDivID:function(){
return "__schedule_div_"+this.FlagString+"_container_"+this.ParentID;
},
getHeight:function(){
return parseInt(this.DragDivObject.style.height);
},
getMaginTop:function(){
var temp = this.DragDivObject.style.margin.split(' ');
return temp[0];
},
setNewMagin:function(top){
var height = this.getHeight();
if(top<0){
top = 0;
}
if(height<=30){
top = this.MinTop;
}
var temp = this.DragDivObject.style.margin.split(' ');
this.DragDivObject.style.margin = top +"px "+temp[1] + " " + temp[2] +" "+temp[3];
},
//变态,变态,变态
setNewHeight:function(height){
var maginTop = parseInt(this.getMaginTop());
//if(this.DragOverTop==false||maginTop!=0){
if(maginTop+height>1440){
height =1440 - maginTop;
}
if(height<30){
height = 30;
}
this.DragDivObject.style.height = height + "px";
if(maginTop==0){
this.DragOverTop=true;
this.DragDivObjectOverTop +=this.DragDivObject.id + "||";
}
else{
this.DragOverTop=false;
if(this.DragDivObjectOverTop!=null){
this.DragDivObjectOverTop.replace(this.DragDivObject.id +"||","");
}
}
//}
},
setNewMiddleTDHeight:function(){
$(this.getChangeMiddleTD()).style.height = (parseInt(this.DragDivObject.style.height)-8)+"px";
},
getHeightWidthScroll1:function(tY){
return GetInfo($(CreateSchedule.ScheduleTdAllDayID)).bottom - tY;
},
getHeightWidthScroll2:function(tY){
return GetInfo($(CreateSchedule.ScheduleTdToDoID)).top - tY
},
//在哪个大范围内
getInMaxSite:function(){
this.InContainerSite = 3;
var tempTop = GetInfo(this.DragDivObject).top;
var tempBottom = GetInfo(this.DragDivObject).bottom;
//在ALLDAY区域
if(tempTop>=GetInfo($(CreateSchedule.ScheduleAllDayID)).top&&tempTop<=GetInfo($(CreateSchedule.ScheduleAllDayID)).bottom){
this.InContainerSite = 1;
}
// //在TODO区域
// if(tempBottom>GetInfo($(CreateSchedule.ScheduleToDoID)).top&&tempBottom<GetInfo($(CreateSchedule.ScheduleToDoID)).bottom){
// this.InContainerSite = 2;
// }
//在SCHEDULE区域
if(tempTop>=GetInfo($(CreateSchedule.ScheduleFrame2ID)).top&&tempTop<=GetInfo($(CreateSchedule.ScheduleFrame2ID)).bottom){
this.InContainerSite = 2;
}
},
//在哪个小范围内
getInMinSite:function(){
this.getInMaxSite();
switch(this.InContainerSite){
case 1:
return this.getChangeContainerDivId("allday");
break;
case 2:
return this.getChangeContainerDivId("schedule");
break;
//case 3:
//break;
case 3:
return null;
break;
}
},
getChangeContainerDivId:function(type){
var tempContainerId = null;
var tempIDs = CreateSchedule.ScheduleUsersID;
var containerDivs = tempIDs.split(CreateSchedule.MinSplit);
var tempLeft = GetInfo(this.DragDivObject).left;
for(var i = 0;i<containerDivs.length;i++){
var tempContainer = "__schedule_div_"+type+"_container_"+containerDivs[i];
if(tempLeft>=GetInfo($(tempContainer)).left-$(this.XScrollID).scrollLeft&&tempLeft<=GetInfo($(tempContainer)).right-$(this.XScrollID).scrollLeft){
tempContainerId = tempContainer;
break;
}
}
return tempContainerId;
},
getBeginTime:function(container,num){
var beginTime = 0;
if(num==1){
beginTime = GetInfo(this.DragDivObject).top - GetInfo($(container)).top;
}
else{
beginTime = parseInt(this.getMaginTop());
}
var tempHour = parseInt(beginTime/60);
var checkMinute = beginTime%60;
var tempMinute = "00";
if(checkMinute!=0){
if(checkMinute<30){
tempMinute = "00";
}
else{
tempMinute = "30";
}
}
if(tempHour<10){
tempHour = "0"+tempHour;
}
return tempHour+":"+tempMinute;
},
getChangeType:function(beginChangeSite,changeSite){
var tempBeginChange = beginChangeSite.split('_');
var tempChange = changeSite.split('_');
var temp1="0";
var temp2="0";
var temp3="0";
if(tempBeginChange[4]=="allday"){
temp1 = "1";
}
if(tempBeginChange[4]=="schedule"){
temp1 = "2";
}
if(tempChange[4]=="allday"){
temp2 = "1";
}
if(tempChange[4]=="schedule"){
temp2 = "2";
}
if(tempBeginChange[6]==tempChange[6]){
temp3 = "1";
}
else{
temp3 = "2";
}
return parseInt(temp1 + temp2 + temp3)+"_"+tempBeginChange[6]+"_"+tempChange[6];
},
removeTempDiv:function(){
document.body.removeChild($("__temp_drag_drop_div"));
},
getNeedDragContainers:function(){
var tempIDs = CreateSchedule.ScheduleUsersID.split(CreateSchedule.MinSplit);
var tempdragContainers = "";
for(var i = 0;i<tempIDs.length;i++){
if($("__hidden_data_"+tempIDs[i] +"_"+this.DataID)){
tempdragContainers += tempIDs[i]+CreateSchedule.MinSplit;
}
}
return tempdragContainers.substring(0,tempdragContainers.length - 7);
},
getIsMine:function(dragIDs){
var tempIDs = dragIDs.split(CreateSchedule.MinSplit);
for(var i = 0;i<tempIDs.length;i++){
if(CreateSchedule.UserId == tempIDs[i]){
return true;
break;
}
}
return false;
},
getIsChangeSite:function(dragIDs,changeSiteUserId){
var tempIDs = dragIDs.split(CreateSchedule.MinSplit);
for(var i = 0;i<tempIDs.length;i++){
if(changeSiteUserId==tempIDs[i]){
return true;
break;
}
}
return false;
},
getIsRepeat:function(){
var tempIsRepeat = 0;
if($("__hidden_drags_"+this.ParentID+"_"+this.DataID).value == "1"){
tempIsRepeat = 1;
}
return tempIsRepeat;
},
//还原
backUp:function(){
this.DragDivObject.style.margin = this.BeginMargin;
this.DragDivObject.style.height = this.BeginHeight;
},
//VERY IMPORTMENT
setWhichWayToDo:function(toDoType,changeSite,num){
var tempToDoType = toDoType.split('_');
switch(parseInt(tempToDoType[0])){
//ALLDAY TO ALLDAY SELF
case 111:
//showMessageByMsgID("ER000001");
break;
//ALLDAY TO ALLDAY NOTSELF
case 112:
CreateSchedule.setScheduleInsert(this.DataID,parseInt(tempToDoType[2]),1,CreateSchedule.BeginDateTime,"00:00",1440);
break;
//SCHEDULE TO ALLDAY SELF
case 211:
var tempType = parseInt($("__hidden_type_"+tempToDoType[1]+"_"+this.DataID).value);
var temp = this.getNeedDragContainers();
//红色,本人没参加的PUBLIC
if(tempType==3||tempType==4){
//执行INSERT
CreateSchedule.setScheduleInsert(this.DataID,parseInt(tempToDoType[2]),1,CreateSchedule.BeginDateTime,"00:00",1440);
}
else{
//执行UPDATE
CreateSchedule.setScheduleUpdate(this.DataID,temp,1,"00:00",1440,this.getIsRepeat(),1);
}
break;
//SCHEDULE TO ALLDAY NOTSELF
case 212:
CreateSchedule.setScheduleInsert(this.DataID,parseInt(tempToDoType[2]),1,CreateSchedule.BeginDateTime,"00:00",1440);
break;
//SCHEDULE TO SCHEDULE SELF
case 221:
var tempBeginTime = this.getBeginTime(changeSite,num);
var tempElispTime = parseInt(parseInt(this.DragDivObject.style.height)/30)*30;
var tempType = parseInt($("__hidden_type_"+tempToDoType[1]+"_"+this.DataID).value);
var temp = this.getNeedDragContainers();
//红色,本人没参加的PUBLIC
if(tempType==3||tempType==4){
CreateSchedule.setScheduleInsert(this.DataID,parseInt(tempToDoType[2]),0,CreateSchedule.BeginDateTime,tempBeginTime,tempElispTime);
}
else{
//执行UPDATE
CreateSchedule.setScheduleUpdate(this.DataID,temp,0,tempBeginTime,tempElispTime,this.getIsRepeat(),0);
}
break;
//SCHEDULE TO SCHEDULE NOTSELF
case 222:
var tempBeginTime = this.getBeginTime(changeSite,num);
var tempElispTime = parseInt(parseInt(this.DragDivObject.style.height)/30)*30;
CreateSchedule.setScheduleInsert(this.DataID,parseInt(tempToDoType[2]),0,CreateSchedule.BeginDateTime,tempBeginTime,tempElispTime);
break;
//ALLDAY TO SCHEDULE SELF
case 121:
var tempBeginTime = this.getBeginTime(changeSite,num);
var tempType = parseInt($("__hidden_type_"+tempToDoType[1]+"_"+this.DataID).value);
var temp = this.getNeedDragContainers();
//红色,本人没参加的PUBLIC
if(tempType==3||tempType==4){
CreateSchedule.setScheduleInsert(this.DataID,parseInt(tempToDoType[2]),0,CreateSchedule.BeginDateTime,tempBeginTime,30);
}
else{
//执行UPDATE
CreateSchedule.setScheduleUpdate(this.DataID,temp,0,tempBeginTime,30,this.getIsRepeat(),1);
}
break;
//ALLDAY TO SCHEDULE NOTSELF
case 122:
var tempBeginTime = this.getBeginTime(changeSite,num);
CreateSchedule.setScheduleInsert(this.DataID,parseInt(tempToDoType[2]),0,CreateSchedule.BeginDateTime,tempBeginTime,30);
break;
}
},
DivDragStart:function(event,dragType){
PopupTextArea.TextAreaPopUpUnload();
this.DragDivObject = Event.element(event);
this.DragType=dragType;
var tempIDArr = this.DragDivObject.id.split('_');
this.DataID = tempIDArr[tempIDArr.length-1];
this.ParentID = tempIDArr[tempIDArr.length-2];
this.FlagString = tempIDArr[tempIDArr.length-6];
this.DragDivObject = $(this.getChangeDivID());
this.BeginMargin = this.DragDivObject.style.margin;
this.BeginHeight = this.DragDivObject.style.height;
this.LastX = Event.pointerX(event);
this.LastY = Event.pointerY(event);
if(this.DragType==1){
var ScheduleDivTypeCreate = new ZM_ScheduleDivTypeCreate();
var tempHeight = this.getDragTypeOneTopOrHeight("height",this.FlagString);
var tempTop = this.getDragTypeOneTopOrHeight("top",this.FlagString);
var tempDiv = ScheduleDivTypeCreate.setTempDiv(tempHeight,this.DragDivObject.offsetWidth,tempTop,this.getLeft(event),this.DragDivObject.className,this.DragDivObject.innerHTML);
this.LastLeft = tempDiv.style.left;
this.LastTop = tempDiv.style.top;
this.DragDivObject = tempDiv;
document.body.appendChild(this.DragDivObject);
}
else{
this.isOverTop();
this.LastTop = this.getMaginTop();
this.BeginDrapHeight = this.getHeight();
this.MinTop = parseInt(this.LastTop) + this.BeginDrapHeight -30;
this.OverTopHeight = parseInt(this.LastTop) + this.BeginDrapHeight;
}
this.DragDivObject.style.zIndex = "10000000";
this.Dragged = true;
/*阻止浏览器执行与事件相关的默认动作*/
if(Event.element(event).preventDefault) {
Event.element(event).preventDefault();
}else{
Event.element(event).returnValue = false;
}
},
DivOnDrag:function(event){
if((!this.Dragged) || this.DragDivObject == null) {
return false;
}
document.body.onselectstart = function(){return false;};
//this.DragDivObject.focus();
var tX = Event.pointerX(event);
var tY = Event.pointerY(event);
var ScrollsMove = new ZM_ScrollsMove();
switch(this.DragType){
case 1:
//左右越界
if(this.getRight(event)>GetInfo($(this.SiteID)).right||this.getLeft(event)<GetInfo($(this.XYSiteID)).left){
ScrollsMove.setXscroll($(this.XScrollID),tX);
if(this.getRight(event)>GetInfo($(this.SiteID)).right){
this.DragDivObject.style.left = GetInfo($(this.SiteID)).right - this.DragDivObject.offsetWidth - 20 + "px";
}
else{
this.DragDivObject.style.left = GetInfo($(this.XYSiteID)).left + "px";
}
}
else{
this.DragDivObject.style.left = parseInt(this.LastLeft) + tX - this.LastX + "px";
}
//上下越界
if(this.getBottom(event,2)>GetInfo($(this.XYSiteID)).bottom||this.getTop(event,2)<GetInfo($(this.YSiteID)).top){
ScrollsMove.setYscroll($(this.YScrollID),tY);
if(this.getBottom(event,2)>GetInfo($(this.XYSiteID)).bottom){
this.DragDivObject.style.top = GetInfo($(this.XYSiteID)).bottom - this.DragDivObject.offsetHeight + "px";
}
else{
this.DragDivObject.style.top = GetInfo($(this.YSiteID)).top + "px";
}
}
else{
this.DragDivObject.style.top = parseInt(this.LastTop) + tY - this.LastY + "px";
}
break;
//变态,变态,变态
case 2:
//越界
var allDayBottom = GetInfo($(CreateSchedule.ScheduleAllDayID)).bottom;
var toDoTop = GetInfo($(CreateSchedule.ScheduleToDoID)).top;
if(tY<allDayBottom||tY>toDoTop){
if(tY<allDayBottom){
ScrollsMove.setYscroll1($(this.YScrollID),tY,$(CreateSchedule.ScheduleTdAllDayID));
this.setNewMagin(parseInt(this.getMaginTop()) - this.getHeightWidthScroll1(tY));
this.setNewHeight(this.getHeight() + this.getHeightWidthScroll1(tY));
this.LastY = tY;
}
else{
ScrollsMove.setYscroll2($(this.YScrollID),tY,$(CreateSchedule.ScheduleTdToDoID));
this.setNewMagin(parseInt(this.getMaginTop()) - this.getHeightWidthScroll2(tY));
this.setNewHeight(this.getHeight() + this.getHeightWidthScroll2(tY));
this.LastY = GetInfo(this.DragDivObject).top;
}
this.LastTop = this.getMaginTop();
this.BeginDrapHeight = this.getHeight();
}
else{
this.setNewMagin(parseInt(this.LastTop) + (tY-this.LastY));
this.setNewHeight(this.BeginDrapHeight - (tY-this.LastY));
}
this.setNewMiddleTDHeight();
break;
//变态,变态,变态
case 3:
//越界
var allDayBottom = GetInfo($(CreateSchedule.ScheduleAllDayID)).bottom;
var toDoTop = GetInfo($(CreateSchedule.ScheduleToDoID)).top;
if(tY<allDayBottom||tY>toDoTop){
if(tY<allDayBottom){
ScrollsMove.setYscroll1($(this.YScrollID),tY,$(CreateSchedule.ScheduleTdAllDayID));
this.setNewHeight(this.getHeight() - this.getHeightWidthScroll1(tY));
this.LastY = GetInfo(this.DragDivObject).top + this.getHeight();
}
else{
ScrollsMove.setYscroll2($(this.YScrollID),tY,$(CreateSchedule.ScheduleTdToDoID));
this.setNewHeight(this.getHeight() - this.getHeightWidthScroll2(tY));
this.LastY = tY;
}
this.LastTop = this.getMaginTop();
this.BeginDrapHeight = this.getHeight();
}
else{
this.setNewHeight(this.BeginDrapHeight + (tY-this.LastY));
}
this.setNewMiddleTDHeight();
break;
}
},
DivDragEnd:function(){
if(!this.Dragged) {
return;
}
this.Dragged = false;
if(this.DragType==1){
var beginChangeSite = this.getBeginChangeContainerDivID();
var changeSite = this.getInMinSite();
if(beginChangeSite!=null&&changeSite!=null){
var changeType = this.getChangeType(beginChangeSite,changeSite);
this.setWhichWayToDo(changeType,changeSite,1);
this.removeTempDiv();
}
else{
this.removeTempDiv();
showConfirmDialogBySize(300,200,["ER10001001"],["BTN000003"],["closeConfirmDialog();"]);
}
}
else{
var changeSite = this.getBeginChangeContainerDivID();
if(changeSite!=null){
var changeType = this.getChangeType(changeSite,changeSite);
this.setWhichWayToDo(changeType,changeSite,0);
}
else{
this.removeTempDiv();
showConfirmDialogBySize(300,200,["ER10001001"],["BTN000003"],["closeConfirmDialog();"]);
}
}
}
}
/********************************************************************************************************************************************/
/********************************************************************************************************************************************/
var ZM_ScrollsMove = Class.create();
ZM_ScrollsMove.prototype = {
initialize:function(){},
setXscroll:function(xScrollObj,tX){
xScrollObj.scrollLeft += tX - GetInfo(xScrollObj).left;
},
setYscroll:function(yScrollObj,tY){
yScrollObj.scrollTop += tY - GetInfo(yScrollObj).top;
},
setYscroll1:function(yScrollObj,tY,Obj){
yScrollObj.scrollTop += tY - GetInfo(Obj).bottom;
},
setYscroll2:function(yScrollObj,tY,Obj){
yScrollObj.scrollTop += tY - GetInfo(Obj).top;
}
}
/********************************************************************************************************************************************/
/********************************************************************************************************************************************/
var ZM_ScheduleDivTypeCreate = Class.create();
ZM_ScheduleDivTypeCreate.prototype = {
initialize:function(){},
setTempDiv:function(height,width,top,left,className,innerHtml){
var tempDiv = document.createElement("div");
tempDiv.id = "__temp_drag_drop_div";
tempDiv.style.height = height + "px";
tempDiv.style.width = width + "px";
tempDiv.style.top = top +"px";
tempDiv.style.left = left +"px";
tempDiv.className = className;
tempDiv.innerHTML = innerHtml;
return tempDiv;
},
isMine:function(parentId){
var isM = CreateSchedule.ScheduleUsersID.split(CreateSchedule.MinSplit);
var isM = isM[0];
if(isM==parentId){
return true;
}
else{
return false;
}
},
//是否是我创建的
isCreateUser:function(createUserId){
if(CreateSchedule.UserId==parseInt(createUserId)){
return true;
}
else{
return false;
}
},
//Member是否存在我
isInMembers:function(memberUserIds){
var isIn = false;
var tempMemberUsers = memberUserIds.split(',');
for(var i = 0;i<tempMemberUsers.length;i++){
if(CreateSchedule.UserId==parseInt(tempMemberUsers[i])){
isIn = true;
break;
}
}
return isIn;
},
//获取CssClass
getCssClass:function(parentId,createUserId){
var cssClass = "green";
//当前USER是我
if(this.isMine(parentId)){
//如果不是我自己创建的
if(this.isCreateUser(createUserId)==false){
cssClass = "blue";
}
}
else{
cssClass = "purple";
}
return cssClass;
},
// //获取是否加载ONCLICK事件
// getNeedOnClickAndDisplay:function(createUserId,membersId,isPublic){
// if(this.isCreateUser(createUserId)||this.isInMembers(membersId)||isPublic=="1"){
// return true;
// }
// else{
// return false;
// }
// },
//解析是何种类型
getType:function(createUserId,memberUserIds,cssClass,isPublic){
//自己创建
if(this.isCreateUser(createUserId)){
//自己参加
if(this.isInMembers(memberUserIds)){
return 1;
}
else{
return 5;
}
}
//不是自己创建
if(this.isCreateUser(createUserId)==false){
//自己参加
if(this.isInMembers(memberUserIds)){
//别人指定但我没接受
if(cssClass=="red"){
return 3;
}
else{
return 2;
}
}
else{
if(isPublic=="1"){
return 4;
}
else{
return 6;
}
}
}
},
setUserDiv:function(id,margin,width,height,cssClass,textString){
var tempClass = "schedule_div_title_other";
var tempHtml = "";
if(cssClass==0){
tempClass = "schedule_div_title_self";
}
tempHtml = "<div class=/""+tempClass+"/">"+textString+"</div>";
var userDiv = document.createElement("div");
userDiv.id = id;
userDiv.style.margin = margin;
userDiv.style.width = width;
userDiv.style.height = height;
userDiv.className = "schedule_div_title_container";
userDiv.innerHTML = tempHtml;
return userDiv;
},
setHolidayDiv:function(margin,height,textString){
var holidayDiv = document.createElement("div");
holidayDiv.style.width = "100%";
holidayDiv.style.margin = margin;
holidayDiv.style.height = height;
holidayDiv.className = "schedule_holiday";
holidayDiv.innerHTML = textString;
return holidayDiv;
},
setAllDayContainerDiv:function(id,dataId,margin,width){
var AllDayContainerDiv = document.createElement("div");
AllDayContainerDiv.id = id;
AllDayContainerDiv.style.margin = margin;
AllDayContainerDiv.style.width = width;
AllDayContainerDiv.className = "schedule_div_allday_container";
AllDayContainerDiv.onclick = PopupTextArea.AllUnload;
AllDayContainerDiv.ondblclick = function(){LinkParam.setLinkParam2(null,dataId,null,"allday",null,-1);LinkParam.setNewSchedule();};
return AllDayContainerDiv;
},
setAllDayDiv:function(parentId,scheduleId,id,margin,height,cssClass,createUserId,textString,detailString,personString,facilityString,beginDate,endDate,needDrags,isPublic,membersId){
var tempType = this.getType(createUserId,membersId,cssClass,isPublic);
var msgDateTime = beginDate;
if(endDate!=""){
msgDateTime = msgDateTime +"-"+endDate;
}
var allDayDiv = document.createElement("div");
allDayDiv.id = id;
allDayDiv.style.width = "100%";
allDayDiv.style.margin = margin;
allDayDiv.style.height = height;
allDayDiv.className = "schedule_drag_drop_div";
var tempHtml = "<table border=/"0/" cellspacing=/"0/" padding=/"0/" width=/"100%/" height=/"100%/" style=/"table-layout:fixed;/" id=/"__schedule_allday_table_" + parentId + "_" + scheduleId + "/">/n";
tempHtml = tempHtml+"<tr>/n";
tempHtml = tempHtml+"<td id=/"__schedule_allday_table_left_td_" + parentId + "_" + scheduleId + "/" class=/"schedule_drag_drop_table_left_td_" + cssClass + "/"";
//获取是否加载ONCLICK事件
if(tempType!=6){
tempHtml = tempHtml+" onMouseDown=/"DragDrop.DivDragStart(event,1);/">/n";
}
else{
tempHtml = tempHtml+">";
}
tempHtml = tempHtml+"<input id=/"__hidden_data_" + parentId + "_" + scheduleId + "/" type=/"hidden/" value=/"" + scheduleId + "/"/>";
tempHtml = tempHtml+"<input id=/"__hidden_begin_date_" + parentId + "_" + scheduleId + "/" type=/"hidden/" value=/"" + beginDate + "/"/>";
tempHtml = tempHtml+"<input id=/"__hidden_end_date_" + parentId + "_" + scheduleId + "/" type=/"hidden/" value=/"" + endDate + "/"/>"
tempHtml = tempHtml+"<input id=/"__hidden_begin_time_" + parentId + "_" + scheduleId + "/" type=/"hidden/" value=/"0:00/"/>";
tempHtml = tempHtml+"<input id=/"__hidden_end_time_" + parentId + "_" + scheduleId + "/" type=/"hidden/" value=/"0:00/"/>"
tempHtml = tempHtml+"<input id=/"__hidden_title_" + parentId + "_" + scheduleId + "/" type=/"hidden/" value=/"" + textString + "/"/>";
tempHtml = tempHtml+"<input id=/"__hidden_detail_" + parentId + "_" + scheduleId + "/" type=/"hidden/" value=/"" + detailString +" "+ personString +" "+ facilityString + "/"/>";
tempHtml = tempHtml+"<input id=/"__hidden_drags_" + parentId + "_" + scheduleId + "/" type=/"hidden/" value=/"" + needDrags + "/"/>";
tempHtml = tempHtml+"<input id=/"__hidden_public_" + parentId + "_" + scheduleId + "/" type=/"hidden/" value=/"" + isPublic + "/"/>";
tempHtml = tempHtml+"<input id=/"__hidden_is_over_oneday_" + parentId + "_" + scheduleId + "/" type=/"hidden/" value=/"0/"/>";
tempHtml = tempHtml+"<input id=/"__hidden_type_" + parentId + "_" + scheduleId + "/" type=/"hidden/" value=/"" + tempType + "/"/>";
tempHtml = tempHtml+"</td>/n";
tempHtml = tempHtml+"<td nowrap id=/"__schedule_allday_table_middle_td_"+parentId+"_"+scheduleId+"/" class=/"schedule_drag_drop_table_middle_td_"+cssClass+"/"";
//获取是否加载ONCLICK事件
if(tempType!=6){
tempHtml = tempHtml+" οnclick=/"PopupTextArea.DivOnclick("+parentId+","+scheduleId+",'"+id+"','allday','__hidden_title_"+parentId+"_"+scheduleId+"','"+msgDateTime+"','"+detailString +"<br>"+ personString +"<br>"+ facilityString+"','"+cssClass+"');/"";
if(tempType==1||tempType==2||tempType==5){
tempHtml = tempHtml+" οndblclick=/"LinkParam.CanNew=0;LinkParam.ScheduleId='"+scheduleId+"';LinkParam.Type='allday';LinkParam.setEditScheduleToDoDetail2();/"";
}
else{
tempHtml = tempHtml+" οndblclick=/"LinkParam.CanNew=0;/"";
}
}
tempHtml = tempHtml+">";
//获取是否显示
if(tempType!=6){
if(needDrags=="1"){
tempHtml = tempHtml+"<img align=/"right/" src=/"../../Images/Repeat_Mark.gif/"/>";
}
tempHtml = tempHtml+textString;
}
else{
if(needDrags=="1"){
tempHtml = tempHtml+"<img align=/"right/" src=/"../../Images/Repeat_Mark.gif/"/>";
}
tempHtml = tempHtml+"private";
}
tempHtml = tempHtml+"</td>/n";
tempHtml = tempHtml+"</tr>/n";
tempHtml = tempHtml+"</table>/n";
allDayDiv.innerHTML = tempHtml;
return allDayDiv;
},
setScheduleBackGroundDiv:function(margin,width){
var scheduleBackGroundDiv = document.createElement("div");
scheduleBackGroundDiv.style.margin = margin;
scheduleBackGroundDiv.style.width = width;
scheduleBackGroundDiv.style.height = "1440px";
scheduleBackGroundDiv.className = "schedule_div_background_container";
scheduleBackGroundDiv.innerHTML = "<table cellspacing=/"0/" class=/"schedule_table_middle/">"
+"<tbody>"
+"<tr><td class=/"schedule_td_line/"><hr color=/"#D0D0D0/" width=/"100%/" size=/"1/"></td></tr>"
+"<tr><td class=/"schedule_td_line/"><hr color=/"#D0D0D0/" width=/"100%/" size=/"1/"></td></tr>"
+"<tr><td class=/"schedule_td_line/"><hr color=/"#D0D0D0/" width=/"100%/" size=/"1/"></td></tr>"
+"<tr><td class=/"schedule_td_line/"><hr color=/"#D0D0D0/" width=/"100%/" size=/"1/"></td></tr>"
+"<tr><td class=/"schedule_td_line/"><hr color=/"#D0D0D0/" width=/"100%/" size=/"1/"></td></tr>"
+"<tr><td class=/"schedule_td_line/"><hr color=/"#D0D0D0/" width=/"100%/" size=/"1/"></td></tr>"
+"<tr><td class=/"schedule_td_line/"><hr color=/"#D0D0D0/" width=/"100%/" size=/"1/"></td></tr>"
+"<tr><td class=/"schedule_td_line/"><hr color=/"#D0D0D0/" width=/"100%/" size=/"1/"></td></tr>"
+"<tr><td class=/"schedule_td_line/"><hr color=/"#D0D0D0/" width=/"100%/" size=/"1/"></td></tr>"
+"<tr><td class=/"schedule_td_line/"><hr color=/"#D0D0D0/" width=/"100%/" size=/"1/"></td></tr>"
+"<tr><td class=/"schedule_td_line/"><hr color=/"#D0D0D0/" width=/"100%/" size=/"1/"></td></tr>"
+"<tr><td class=/"schedule_td_line/"><hr color=/"#D0D0D0/" width=/"100%/" size=/"1/"></td></tr>"
+"<tr><td class=/"schedule_td_line/"><hr color=/"#D0D0D0/" width=/"100%/" size=/"1/"></td></tr>"
+"<tr><td class=/"schedule_td_line/"><hr color=/"#D0D0D0/" width=/"100%/" size=/"1/"></td></tr>"
+"<tr><td class=/"schedule_td_line/"><hr color=/"#D0D0D0/" width=/"100%/" size=/"1/"></td></tr>"
+"<tr><td class=/"schedule_td_line/"><hr color=/"#D0D0D0/" width=/"100%/" size=/"1/"></td></tr>"
+"<tr><td class=/"schedule_td_line/"><hr color=/"#D0D0D0/" width=/"100%/" size=/"1/"></td></tr>"
+"<tr><td class=/"schedule_td_line/"><hr color=/"#D0D0D0/" width=/"100%/" size=/"1/"></td></tr>"
+"<tr><td class=/"schedule_td_line/"><hr color=/"#D0D0D0/" width=/"100%/" size=/"1/"></td></tr>"
+"<tr><td class=/"schedule_td_line/"><hr color=/"#D0D0D0/" width=/"100%/" size=/"1/"></td></tr>"
+"<tr><td class=/"schedule_td_line/"><hr color=/"#D0D0D0/" width=/"100%/" size=/"1/"></td></tr>"
+"<tr><td class=/"schedule_td_line/"><hr color=/"#D0D0D0/" width=/"100%/" size=/"1/"></td></tr>"
+"<tr><td class=/"schedule_td_line/"><hr color=/"#D0D0D0/" width=/"100%/" size=/"1/"></td></tr>"
+"<tr><td class=/"schedule_td_line/"><hr color=/"#D0D0D0/" width=/"100%/" size=/"1/"></td></tr>"
+"</tbody>"
+"</table>";
return scheduleBackGroundDiv;
},
setScheduleContainerDiv:function(id,dataId,margin,width){
var scheduleContainerDiv = document.createElement("div");
scheduleContainerDiv.id = id;
scheduleContainerDiv.style.margin = margin;
scheduleContainerDiv.style.width = width;
scheduleContainerDiv.style.height = "1440px";
scheduleContainerDiv.className = "schedule_div_schedule_container";
scheduleContainerDiv.onclick = PopupTextArea.AllUnload;
scheduleContainerDiv.ondblclick = function(ev){ev =ev||window.event;LinkParam.setLinkParam2(null,dataId,null,"schedule",null,(Event.pointerY(ev)-GetInfo($(CreateSchedule.ScheduleTdScheduleID)).top)+$(DragDrop.YScrollID).scrollTop);LinkParam.setNewSchedule();};
return scheduleContainerDiv;
},
setScheduleDiv:function(parentId,scheduleId,id,margin,width,height,cssClass,createUserId,textString,detailString,personString,facilityString,beginDate,endDate,beginTime,endTime,needDrags,isPublic,isOverOneDay,membersId){
var tempTdMiddleHeight = (parseInt(height)-8) + "px";
var tempType = this.getType(createUserId,membersId,cssClass,isPublic);
var msgDateTime = beginDate+" "+beginTime+"-";
if(endDate!=""){
msgDateTime = msgDateTime +endDate+" "+endTime;
}
else{
msgDateTime = msgDateTime+endTime;
}
var scheduleDiv = document.createElement("div");
scheduleDiv.id = id;
scheduleDiv.style.width = width;
scheduleDiv.style.margin = margin;
scheduleDiv.style.height = height;
scheduleDiv.style.zIndex = "100000";
scheduleDiv.className = "schedule_drag_drop_div";
var tempHtml = "<table border=/"0/" cellspacing=/"0/" padding=/"0/" width=/"100%/" height=/"100%/" style=/"table-layout:fixed;/" id=/"__schedule_schedule_table_" + parentId + "_" + scheduleId + "/">/n";
tempHtml = tempHtml+"<tr>/n";
tempHtml = tempHtml+"<td nowrap rowspan=/"3/" id=/"__schedule_schedule_table_left_td_" + parentId + "_" + scheduleId + "/" class=/"schedule_drag_drop_table_left_td_" + cssClass + "/"";
//获取是否加载ONCLICK事件
if(tempType!=6){
tempHtml = tempHtml+" onMouseDown=/"DragDrop.DivDragStart(event,1);/"";
}
tempHtml = tempHtml+">/n";
tempHtml = tempHtml+"<input id=/"__hidden_data_" + parentId + "_" + scheduleId + "/" type=/"hidden/" value=/"" + scheduleId + "/"/>";
tempHtml = tempHtml+"<input id=/"__hidden_begin_date_" + parentId + "_" + scheduleId + "/" type=/"hidden/" value=/"" + beginDate + "/"/>";
tempHtml = tempHtml+"<input id=/"__hidden_end_date_" + parentId + "_" + scheduleId + "/" type=/"hidden/" value=/"" + endDate + "/"/>"
tempHtml = tempHtml+"<input id=/"__hidden_begin_time_" + parentId + "_" + scheduleId + "/" type=/"hidden/" value=/"" + beginTime + "/"/>";
tempHtml = tempHtml+"<input id=/"__hidden_end_time_" + parentId + "_" + scheduleId + "/" type=/"hidden/" value=/"" + endTime + "/"/>";
tempHtml = tempHtml+"<input id=/"__hidden_title_" + parentId + "_" + scheduleId + "/" type=/"hidden/" value=/"" + textString + "/"/>";
tempHtml = tempHtml+"<input id=/"__hidden_detail_" + parentId + "_" + scheduleId + "/" type=/"hidden/" value=/"" + detailString +" "+ personString +" "+ facilityString + "/"/>";
tempHtml = tempHtml+"<input id=/"__hidden_drags_" + parentId + "_" + scheduleId + "/" type=/"hidden/" value=/"" + needDrags + "/"/>";
tempHtml = tempHtml+"<input id=/"__hidden_public_" + parentId + "_" + scheduleId + "/" type=/"hidden/" value=/"" + isPublic + "/"/>";
tempHtml = tempHtml+"<input id=/"__hidden_is_over_oneday_" + parentId + "_" + scheduleId + "/" type=/"hidden/" value=/""+isOverOneDay+"/"/>";
tempHtml = tempHtml+"<input id=/"__hidden_type_" + parentId + "_" + scheduleId + "/" type=/"hidden/" value=/"" + tempType + "/"/>";
tempHtml = tempHtml+"</td>/n";
tempHtml = tempHtml+"<td nowrap id=/"__schedule_schedule_table_top_td_" + parentId + "_" + scheduleId + "/" class=/"schedule_drag_drop_table_top_td_" + cssClass + "/"";
//获取是否加载ONCLICK事件
if(tempType!=6){
tempHtml = tempHtml+" onMouseDown=/"DragDrop.DivDragStart(event,2);/"";
}
tempHtml = tempHtml+"></td>/n";
tempHtml = tempHtml+"</tr>/n";
tempHtml = tempHtml+"<tr>/n";
tempHtml = tempHtml+"<td style=/"height:"+tempTdMiddleHeight+";/" id=/"__schedule_schedule_table_middle_td_"+parentId+"_"+scheduleId+"/" class=/"schedule_drag_drop_table_middle_td_"+cssClass+"/"";
//获取是否加载ONCLICK事件
if(tempType!=6){
tempHtml = tempHtml+" οnclick=/"PopupTextArea.DivOnclick("+parentId+","+scheduleId+",'"+id+"','schedule','__hidden_title_"+parentId+"_"+scheduleId+"','"+msgDateTime+"','"+detailString +"<br>"+ personString +"<br>"+ facilityString+"','"+cssClass+"');/"";
if(tempType==1||tempType==2||tempType==5){
tempHtml = tempHtml+" οndblclick=/"LinkParam.CanNew=0;LinkParam.ScheduleId='"+scheduleId+"';LinkParam.Type='schedule';LinkParam.setEditScheduleToDoDetail2();/"";
}
else{
tempHtml = tempHtml+" οndblclick=/"LinkParam.CanNew=0;/"";
}
}
tempHtml = tempHtml+">";
//获取是否显示
if(tempType!=6){
if(needDrags=="1"){
tempHtml = tempHtml+"<img align=/"right/" src=/"../../Images/Repeat_Mark.gif/"/>";
}
tempHtml = tempHtml+beginTime +"<br>" +textString;
}
else{
if(needDrags=="1"){
tempHtml = tempHtml+"<img align=/"right/" src=/"../../Images/Repeat_Mark.gif/"/>";
}
tempHtml = tempHtml+beginTime +"<br>" +textString;
}
tempHtml = tempHtml+"</td>/n";
tempHtml = tempHtml+"</tr>/n";
tempHtml = tempHtml+"<tr>/n";
tempHtml = tempHtml+"<td nowrap id=/"__schedule_schedule_table_bottom_td_" + parentId + "_" + scheduleId + "/" class=/"schedule_drag_drop_table_bottom_td_" + cssClass + "/"";
//获取是否加载ONCLICK事件
if(tempType!=6){
tempHtml = tempHtml+" onMouseDown=/"DragDrop.DivDragStart(event,3);/"";
}
tempHtml = tempHtml+"></td>/n";
tempHtml = tempHtml+"</tr>/n";
tempHtml = tempHtml+"</table>/n";
scheduleDiv.innerHTML = tempHtml;
return scheduleDiv;
},
setToDoContainerDiv:function(id,dataId,margin,width){
var ToDoContainerDiv = document.createElement("div");
ToDoContainerDiv.id = id;
ToDoContainerDiv.style.margin = margin;
ToDoContainerDiv.style.width = width;
ToDoContainerDiv.className = "schedule_div_todo_container";
ToDoContainerDiv.onclick = PopupTextArea.AllUnload;
ToDoContainerDiv.ondblclick = function(){LinkParam.setLinkParam2(null,dataId,null,"todo",null,-1);LinkParam.setNewToDo();};
return ToDoContainerDiv;
},
setToDoDiv:function(parentId,toDoId,id,margin,height,createUserId,textString,detailString,personString,beginDate,endDate,isProgress,isPublic,isEnd,membersId,lineCss){
//设置CssClass
var cssClass = this.getCssClass(parentId,createUserId);
var tempType = this.getType(createUserId,membersId,cssClass,isPublic);
var msgDateTime = beginDate;
if(endDate!=""){
msgDateTime = msgDateTime +"-"+endDate;
}
var toDoDiv = document.createElement("div");
toDoDiv.id = id;
toDoDiv.style.width = "100%";
toDoDiv.style.margin = margin;
toDoDiv.style.height = height;
toDoDiv.className = "schedule_drag_drop_div_todo";
var tempHtml = "<table border=/"0/" cellspacing=/"0/" padding=/"0/" width=/"100%/" height=/"100%/" style=/"table-layout:fixed;/" id=/"__schedule_todo_table_" + parentId + "_" + toDoId + "/">/n";
tempHtml = tempHtml+"<tr>/n";
tempHtml = tempHtml+"<td id=/"__schedule_todo_table_left_td_"+ parentId + "_" + toDoId +"/" nowrap valign=/"middle/" style=/"width:20px;/">/n";
tempHtml = tempHtml+"<input id=/"__hidden_todo_data_" + parentId + "_" + toDoId + "/" type=/"hidden/" value=/"" + toDoId + "/"/>";
tempHtml = tempHtml+"<input id=/"__hidden_todo_begin_date_" + parentId + "_" + toDoId + "/" type=/"hidden/" value=/"" + beginDate + "/"/>";
tempHtml = tempHtml+"<input id=/"__hidden_todo_end_date_" + parentId + "_" + toDoId + "/" type=/"hidden/" value=/"" + endDate + "/"/>";
tempHtml = tempHtml+"<input id=/"__hidden_todo_begin_time_" + parentId + "_" + toDoId + "/" type=/"hidden/" value=/"/"/>";
tempHtml = tempHtml+"<input id=/"__hidden_todo_end_time_" + parentId + "_" + toDoId + "/" type=/"hidden/" value=/"/"/>";
tempHtml = tempHtml+"<input id=/"__hidden_todo_title_" + parentId + "_" + toDoId + "/" type=/"hidden/" value=/"" + textString + "/"/>";
tempHtml = tempHtml+"<input id=/"__hidden_todo_detail_" + parentId + "_" + toDoId + "/" type=/"hidden/" value=/"" + detailString +" "+ personString + "/"/>";
tempHtml = tempHtml+"<input id=/"__hidden_todo_drags_" + parentId + "_" + toDoId + "/" type=/"hidden/" value=/""+isProgress+"/"/>";
tempHtml = tempHtml+"<input id=/"__hidden_todo_public_" + parentId + "_" + toDoId + "/" type=/"hidden/" value=/"" + isPublic + "/"/>";
tempHtml = tempHtml+"<input id=/"__hidden_todo_type_" + parentId + "_" + toDoId + "/" type=/"hidden/" value=/"" + tempType + "/"/>";
tempHtml = tempHtml+"<input type=/"checkbox/" id=/"__checkbox_todo_"+parentId+"_"+toDoId+"/" οnclick=/"CreateSchedule.setScheduleToDo(this.id);/"";
if(isEnd=="1"){
tempHtml = tempHtml+" checked";
}
//如果当前不是我并且MEMBER中没有我
if(this.isMine()==false&&this.isInMembers(membersId)==false){
tempHtml = tempHtml+ " disabled";
}
tempHtml = tempHtml+"/>";
tempHtml = tempHtml+"</td>/n";
tempHtml = tempHtml+"<td class=/""+lineCss+"/" id=/"__schedule_todo_table_right_td_"+ parentId + "_" + toDoId +"/" valign=/"middle/" nowrap style=/"overflow:hidden;text-overflow:clip;/"";
//获取是否加载ONCLICK事件
if(tempType!=6){
tempHtml = tempHtml+" οnclick=/"PopupTextArea.DivOnclick('"+parentId+"',"+toDoId+",'__schedule_todo_table_" + parentId + "_" + toDoId +"','todo','__hidden_todo_title_"+parentId+"_"+toDoId+"','"+msgDateTime+"','"+detailString +"<br>"+ personString +"','"+cssClass+"');/"";
if(tempType==1||tempType==2||tempType==5){
tempHtml = tempHtml+" οndblclick=/"LinkParam.CanNew=0;LinkParam.ScheduleId='"+toDoId+"';LinkParam.Type='todo';LinkParam.setEditScheduleToDoDetail2();/"";
}
else{
tempHtml = tempHtml+" οndblclick=/"LinkParam.CanNew=0;/"";
}
}
tempHtml = tempHtml+">";
//获取是否显示
if(tempType!=6){
tempHtml = tempHtml + textString;
}
else{
tempHtml = tempHtml+"private";
}
tempHtml = tempHtml+"</td>/n";
tempHtml = tempHtml+"</tr>/n";
tempHtml = tempHtml+"</table>/n";
toDoDiv.innerHTML = tempHtml;
return toDoDiv;
}
}
/********************************************************************************************************************************************/
/********************************************************************************************************************************************/
var ZM_SchedulePopupTextArea = Class.create();
ZM_SchedulePopupTextArea.prototype = {
initialize:function(MaxBottomTableID,MinTopTableID,NeedCutDivID){
this.MaxBottomTableID = MaxBottomTableID;//GetInfo($(MaxBottomTableID).bottom;
this.MinTopTableID = MinTopTableID; //GetInfo($(MinTopTableID).top;
this.NeedCutDivID = NeedCutDivID;
this.NowObject = null;
this.PreObject = null;
this.PreObjectType = null;
},
TextAreaUnload:function(){
if(textareabox){
textareabox.remove();
}
},
PopUpUnload:function(){
if(popupbox){
popupbox.remove();
}
},
TextAreaPopUpUnload:function(){
PopupTextArea.PopUpUnload();
PopupTextArea.TextAreaUnload();
},
AllUnload:function(ev){
ev =ev||window.event;
var target = ev.srcElement||ev.target;
if(target.tagName=="DIV"){
PopupTextArea.TextAreaPopUpUnload();
}
},
//是否显示POPUP和TEXTAREA(只对SCHEDULE有效)
needPopAndTextArea:function(divId,type){
if(type=="schedule"){
var minTop = GetInfo($(this.MinTopTableID)).top;
if(GetInfo($(divId)).top<minTop){
return false
}
else{
return true;
}
}
else{
return true;
}
},
//获取TextArea要显示的高度(只对SCHEDULE有效)
getTextAreaHeight:function(divId,type){
var tempTop = GetInfo($(divId)).top;
var tempHeight = $(divId).offsetHeight;
var tempBottom = tempTop + tempHeight;
//如果是SCHEDULE
if(type=="schedule"){
var maxBottom = GetInfo($(this.MaxBottomTableID)).bottom;
if(tempBottom>maxBottom){
tempHeight = tempHeight - (tempBottom - maxBottom);
}
}
return tempHeight;
},
//获取要删除的项的容器编号
getDeleteContainerId:function(scheduleId,type){
var tempContainerId = "";
var tempIDs = CreateSchedule.ScheduleUsersID;
var parents = tempIDs.split(CreateSchedule.MinSplit);
for(var i = 0;i<parents.length;i++){
var temp = "__schedule_div_"+type+"_"+parents[i]+"_"+scheduleId;
if($(temp)){
if(tempContainerId==""){
tempContainerId = parents[i];
}
else{
tempContainerId = tempContainerId+CreateSchedule.MinSplit+parents[i];
}
}
}
return tempContainerId;
},
//获取操作DIV的TYPE
getDivType:function(parentId,scheduleId,type){
var tempTypeId = "";
if(type=="todo"){
tempTypeId = "__hidden_todo_type_" + parentId +"_" +scheduleId;
}
else{
tempTypeId = "__hidden_type_" + parentId +"_" +scheduleId;
}
return parseInt($(tempTypeId).value);
},
DivOnclick:function(parentId,scheduleId,divId,type,title,dateTime,detail,cssClass){
this.NowObject= $(divId);
if(this.PreObject!=this.NowObject){
if(type=="todo"){
this.NowObject.className = "schedule_drag_drop_div_todo_select";
}
else{
this.NowObject.className = "schedule_drag_drop_div_"+cssClass;
}
if(this.PreObject!=null){
if(this.PreObjectType=="todo"){
this.PreObject.className = "schedule_drag_drop_div_todo";
}
else{
this.PreObject.className = "schedule_drag_drop_div";
}
}
this.TextAreaUnload();
//是否显示POPUP和TEXTAREA(只对SCHEDULE有效)
if(this.needPopAndTextArea(divId,type)){
if(cssClass=="purple"){
popupbox=new PopUpBox("popupbox",$(title).value,dateTime,detail,cssClass,{x:parseInt(GetInfo($(divId)).left+$(divId).offsetWidth)-$(this.NeedCutDivID).scrollLeft,y:GetInfo($(divId)).top});
var tempContainerId = this.getDeleteContainerId(scheduleId,type);
var tempValue = this.getDivType(parentId,scheduleId,type);
if(tempValue==1||tempValue==5){
LinkParam.setLinkParam2(scheduleId,parentId,tempContainerId,type,cssClass,null);
LinkParam.setLinkEabled("1|1|1");
}
else{
LinkParam.setLinkEabled("0|0|0");
}
}else{
var tempContainerId = this.getDeleteContainerId(scheduleId,type);
var tempValue = this.getDivType(parentId,scheduleId,type);
if(tempValue==1||tempValue==2||tempValue==3||tempValue==5){
LinkParam.setLinkParam2(scheduleId,parentId,tempContainerId,type,cssClass,null);
if(tempValue==3){
LinkParam.setLinkEabled("0|1|0");
}
else{
LinkParam.setLinkEabled("1|1|1");
}
}
else{
LinkParam.setLinkEabled("0|0|0");
}
if(cssClass=="red"){
popupbox=new PopUpBox("popupbox",$(title).value,dateTime,detail,cssClass,{x:parseInt(GetInfo($(divId)).left+$(divId).offsetWidth)-$(this.NeedCutDivID).scrollLeft,y:GetInfo($(divId)).top},function(){CreateSchedule.setScheduleConfim(scheduleId,type);},function(){CreateSchedule.setScheduleDel(scheduleId,tempContainerId,type,cssClass);});
}
else{
if(type=="todo"){
popupbox=new PopUpBox("popupbox",$(title).value,dateTime,detail,cssClass,{x:parseInt(GetInfo($(divId)).left+$(divId).offsetWidth)-$(this.NeedCutDivID).scrollLeft,y:GetInfo($(divId)).top},function(){LinkParam.Type ="todo";LinkParam.ScheduleId = scheduleId;LinkParam.setEditScheduleToDo2();},function(){CreateSchedule.setToDoDel(scheduleId,tempContainerId,cssClass);});
}
else{
popupbox=new PopUpBox("popupbox",$(title).value,dateTime,detail,cssClass,{x:parseInt(GetInfo($(divId)).left+$(divId).offsetWidth)-$(this.NeedCutDivID).scrollLeft,y:GetInfo($(divId)).top},function(){LinkParam.Type ="schedule";LinkParam.ScheduleId = scheduleId;LinkParam.setEditScheduleToDo2();},function(){CreateSchedule.setScheduleDel(scheduleId,tempContainerId,type,cssClass);});
}
}
}
}
else{
this.PopUpUnload();
}
this.PreObject = $(divId);
this.PreObjectType = type;
}
else{
this.PopUpUnload();
document.body.onselectstart = function(){return true;};
//是否显示POPUP和TEXTAREA(只对SCHEDULE有效)
if(this.needPopAndTextArea(divId,type)){
if(type=="todo"){
this.NowObject.className = "schedule_drag_drop_div_todo_select";
}
else{
this.NowObject.className = "schedule_drag_drop_div_"+cssClass;
}
//如果是紫色
var tempHeight = this.getTextAreaHeight(divId,type);
if(cssClass!="purple"){
var tempValue = this.getDivType(parentId,scheduleId,type);
if(tempValue==1||tempValue==2||tempValue==5){
if(type=="todo"){
textareabox = new TextAreaBox("textareabox",$(title).value,"grey",{x:parseInt(GetInfo($(divId)).left-$(this.NeedCutDivID).scrollLeft)+4,y:GetInfo($(divId)).top+2},$(divId).offsetWidth-4,tempHeight-6,function(){CreateSchedule.setToDoTitle(scheduleId);});
}
else{
textareabox = new TextAreaBox("textareabox",$(title).value,cssClass,{x:parseInt(GetInfo($(divId)).left-$(this.NeedCutDivID).scrollLeft)+4,y:GetInfo($(divId)).top+2},$(divId).offsetWidth-4,tempHeight-6,function(){CreateSchedule.setScheduleTitle(scheduleId,type);});
}
$("textareabox").focus();
$("textareabox").select();
}
}
else{
var tempValue = this.getDivType(parentId,scheduleId,type);
if(tempValue==1||tempValue==2||tempValue==5){
if(type=="todo"){
textareabox = new TextAreaBox("textareabox",$(title).value,"grey",{x:parseInt(GetInfo($(divId)).left-$(this.NeedCutDivID).scrollLeft)+4,y:GetInfo($(divId)).top+2},$(divId).offsetWidth-4,tempHeight-6,function(){CreateSchedule.setToDoTitle(scheduleId);});
}
else{
textareabox = new TextAreaBox("textareabox",$(title).value,cssClass,{x:parseInt(GetInfo($(divId)).left-$(this.NeedCutDivID).scrollLeft)+4,y:GetInfo($(divId)).top+2},$(divId).offsetWidth-4,tempHeight-6,function(){CreateSchedule.setScheduleTitle(scheduleId,type);});
}
$("textareabox").focus();
$("textareabox").select();
}
}
//this.PreObject = null;
}
else{
this.TextAreaUnload();
}
}
}
}
/********************************************************************************************************************************************/
/********************************************************************************************************************************************/
//LINK中参数类
var ZM_LinkParam = Class.create()
ZM_LinkParam.prototype = {
initialize:function(defaultStartTime){
this.ScheduleId = null;
this.ContainerId = null;
this.Type = null;
/*****************/
this.IsAllDay = 0;
this.ParentId = null;
/*****************/
this.CssClass = null;
this.SelectedDateTime = null;
this.PageCode = null;
/*****************/
this.StartTime = null;
this.DefaultStartTime = parseInt(defaultStartTime);
/*****************/
this.CanNew = 1;
},
//设置参数
setLinkParam1:function(){
LinkParam.SelectedDateTime = CreateSchedule.BeginDateTime;
LinkParam.PageCode = CreateSchedule.PageCode;
LinkParam.StartTime = LinkParam.DefaultStartTime;
},
setLinkParam2:function(scheduleId,parentId,containerId,type,cssClass,startTime){
LinkParam.ScheduleId = scheduleId;
LinkParam.Type = type;
/*******************/
LinkParam.ParentId = parentId;
if(startTime!=null){
LinkParam.StartTime = startTime;
}
else{
LinkParam.StartTime = LinkParam.DefaultStartTime;
}
if(type=="allday"){
LinkParam.IsAllDay = 1;
}
else{
LinkParam.IsAllDay = 0;
}
/***********************/
LinkParam.ContainerId = containerId;
LinkParam.CssClass = cssClass;
LinkParam.setLinkParam1();
},
//设置是否可点击
setLinkEabled:function(enabledString){
var tempArr = enabledString.split('|');
if(tempArr[0]=="1"){
$("hrfEditScheduleToDo").disabled = false;
}
else{
$("hrfEditScheduleToDo").disabled = true;
}
if(tempArr[1]=="1"){
$("hrfDeleteScheduleToDo").disabled = false;
}
else{
$("hrfDeleteScheduleToDo").disabled = true;
}
if(tempArr[2]=="1"){
$("hrfEditScheduleToDoDetail").disabled = false;
}
else{
$("hrfEditScheduleToDoDetail").disabled = true;
}
},
getSchedule:function(returnValue){
window.location.href = "UI100070.aspx";
},
getToDo:function(returnValue){
window.location.href = "UI100080.aspx";
},
getScheduleDetail:function(returnValue){
window.location.href = "UI100090.aspx";
},
getToDoDetail:function(returnValue){
window.location.href = "UI100100.aspx";
},
setIframe:function(){
ScheduleService.SetUI100010SessionDilog(CreateSchedule.UserId,CreateSchedule.PageCode,LinkParam.getIframe);
},
getIframe:function(returnValue){
ConfigIframe("../../Pages/Dialog/UID050.aspx","500","370");
},
getSchedulePrint:function(returnValue){
ConfigIframe("../../Pages/Dialog/UID190.aspx","500","250");
},
//新的预定
setNewSchedule:function(){
if(LinkParam.CanNew==1){
LinkParam.setLinkParam1();
ScheduleService.SetUI100010SessionNewSchedule(LinkParam.PageCode,LinkParam.SelectedDateTime,LinkParam.StartTime,LinkParam.ParentId,LinkParam.IsAllDay,LinkParam.ParentId,LinkParam.getSchedule);
}
else{
LinkParam.CanNew=1;
}
},
//新的TODO
setNewToDo:function(){
if(LinkParam.CanNew==1){
LinkParam.setLinkParam1();
ScheduleService.SetUI100010SessionNewToDo(LinkParam.PageCode,LinkParam.SelectedDateTime,LinkParam.ParentId,LinkParam.ParentId,LinkParam.getToDo);
}
else{
LinkParam.CanNew=1;
}
},
//预定TODO编辑
setEditScheduleToDo:function(obj){
if(obj.disabled==false){
if(LinkParam.Type=="todo"){
ScheduleService.SetUI100010SessionToDoEdit(LinkParam.PageCode,LinkParam.SelectedDateTime,LinkParam.ScheduleId,LinkParam.getToDo);
}
else{
ScheduleService.SetUI100010SessionScheduleEdit(LinkParam.PageCode,LinkParam.SelectedDateTime,LinkParam.ScheduleId,LinkParam.getSchedule);
}
}
},
setEditScheduleToDo2:function(){
if(LinkParam.Type=="todo"){
ScheduleService.SetUI100010SessionToDoEdit(LinkParam.PageCode,LinkParam.SelectedDateTime,LinkParam.ScheduleId,LinkParam.getToDo);
}
else{
ScheduleService.SetUI100010SessionScheduleEdit(LinkParam.PageCode,LinkParam.SelectedDateTime,LinkParam.ScheduleId,LinkParam.getSchedule);
}
},
//预定TODO详细编辑
setEditScheduleToDoDetail:function(obj){
if(obj.disabled==false){
if(LinkParam.Type=="todo"){
ScheduleService.SetUI100010SessionToDoEditDetail(LinkParam.PageCode,LinkParam.SelectedDateTime,LinkParam.ScheduleId,LinkParam.getToDoDetail);
}
else{
ScheduleService.SetUI100010SessionScheduleEditDetail(LinkParam.PageCode,LinkParam.SelectedDateTime,LinkParam.ScheduleId,LinkParam.getScheduleDetail);
}
}
},
//预定TODO详细编辑
setEditScheduleToDoDetail2:function(){
LinkParam.setLinkParam1();
if(LinkParam.Type=="todo"){
ScheduleService.SetUI100010SessionToDoEditDetail(LinkParam.PageCode,LinkParam.SelectedDateTime,LinkParam.ScheduleId,LinkParam.getToDoDetail);
}
else{
ScheduleService.SetUI100010SessionScheduleEditDetail(LinkParam.PageCode,LinkParam.SelectedDateTime,LinkParam.ScheduleId,LinkParam.getScheduleDetail);
}
},
//预定TODO的删除
setDeleteScheduleToDo:function(obj){
if(obj.disabled==false){
if(LinkParam.Type=="todo"){
}
else{
CreateSchedule.setScheduleDel(LinkParam.ScheduleId,LinkParam.ContainerId,LinkParam.Type,LinkParam.CssClass);
}
}
},
setPrintScheduleToDo:function(){
LinkParam.setLinkParam1();
ScheduleService.SetUID190SessionSelectedDateTime(LinkParam.SelectedDateTime,LinkParam.getSchedulePrint);
}
}
/********************************************************************************************************************************************/
/********************************************************************************************************************************************/
function GetInfo(o) {
var to = new Object();
to.left = to.right = to.top = to.bottom = 0;
var twidth = o.offsetWidth;
var theight = o.offsetHeight;
while(o) {
to.left += o.offsetLeft;
to.top += o.offsetTop;
o = o.offsetParent;
}
to.right = to.left + twidth;
to.bottom = to.top + theight;
return to;
}
/********************************************************************************************************************************************/
/********************************************************************************************************************************************/
function OnLoadSetScroll(top){
$("DataFrame3").scrollTop = top;
}
/********************************************************************************************************************************************/
/********************************************************************************************************************************************/
function OnLoadSetCurrentTime(top){
$("FlagTime").style.top = top +"px";
}
/********************************************************************************************************************************************/
/********************************************************************************************************************************************/
function SetCurrentTime(){
LinkParam.setLinkEabled("0|0|0");
CreateSchedule.resetInit();
var tempTop = parseInt(parseInt($("FlagTime").style.top) + 15);
if(tempTop>1440){
tempTop = 0;
}
$("FlagTime").style.top = tempTop +"px";
}
/********************************************************************************************************************************************/