ganttTime_wev8.js
7.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
var bShow = false;
var outObject;
/********鼠标点击别处时间控件消失*********/
document.onclick = function (){
if (!bShow) closeLayer();
bShow = false;
}
/*******时间控件消失函数*******/
function closeLayer(){
document.getElementById("meizzDateLayer2").style.display="none";
}
/*********时间控件生成开始**********/
var strFrame2 = "";
var hourLabel = "Hour";
var closeLabel = "Close";
var clearLabel = "Clear";
try{
hourLabel = SystemEnv.getHtmlNoteName(3706);
closeLabel = SystemEnv.getHtmlNoteName(3787);
clearLabel = SystemEnv.getHtmlNoteName(3704);
}catch(e){}
document.writeln('<iframe id=meizzDateLayer2 Author=wayx frameborder=0 style="position: absolute; width:200px; height:251px;z-index:9999;display:none;background:#fff;overflow:hidden;"></iframe>');
strFrame2+='<div style="position:absolute;left:0;top:3;text-align:center; border:1px solid #bbb;padding:2px background-color:#FFFFFF; width:180px;font-size:9pt;" onselectstart="return false">';
strFrame2+='<h1 Author="wayx" style="background-color:#A0EBF1;font-size:12px;font-weight:normal;height:22px;line-height:20px;margin:0px;">';
strFrame2+='<div id=hourid><span style=\"display:inline-block;width:50%;text-align:left;\"> '+hourLabel+':</span><span style=\"display:inline-block;width:50%;text-align:right;\"><select id=hour name=hour>';
strFrame2+='<scr' + 'ipt>';
strFrame2+='document.body.overflow=\"hidden\";';
strFrame2+='var d = new Date();';
strFrame2+=' for (var i=0; i<24; i++){';
strFrame2+=' i<10?j=0+i.toString():j=i;';
strFrame2+=' if (d.getHours().toString()==i)';
strFrame2+=' {';
strFrame2+=' document.writeln("<OPTION VALUE= " + j + " selected>" + j + "</option>");';
strFrame2+=' }else{';
strFrame2+=' document.writeln("<OPTION VALUE= " + j + ">" + j + "</option>");';
strFrame2+=' }';
strFrame2+=' }';
strFrame2+='</scr' + 'ipt>';
strFrame2+='</select> </span></div></h1>';
strFrame2+='<span id="nowhour"></span>';
strFrame2+='</div>';
strFrame2+='<scr' + 'ipt>';
strFrame2+=' function getTime(id) {';
strFrame2+=' var sTime;';
strFrame2+=' var mTime = id.value;';
strFrame2+=' if(mTime<10){mTime = "0" + mTime;};';
strFrame2+=' sTime = document.all.hour.value + ":" +mTime;';
strFrame2+=' parent.meizzDayClick(sTime);';
strFrame2+=' }';
strFrame2+=' function clineTime() {';
strFrame2+=' var temptime;';
strFrame2+=' temptime = 0;';
strFrame2+=' parent.meizzDayClick(temptime);';
strFrame2+=' }';
strFrame2+='var timestr;';
strFrame2+='var m = new Date();';
strFrame2+='timestr = "<div style=\'border:#c5d9e8 1px solid;\' id=TimeLayer>";';
strFrame2+=' timestr+="<table><tr>";';
strFrame2+=' for (var i=1; i<61; i++){';
strFrame2+=' var j;';
strFrame2+=' i<10?j=0+i.toString():j=i;';
strFrame2+=' var t = i-1;';
strFrame2+=' if (i%6 == 0){';
strFrame2+=' if(m.getMinutes().toString()==t){';
strFrame2+=' timestr+="<td width=30 align=center bgcolor=\'#BEEBEE\' style=\'font-size:9pt;FONT-FAMILY: Verdana;cursor:pointer;\' onClick=getTime(minute"+t+")>" + t + "<input type=hidden id=minute"+t+" value="+t+"></td></tr><tr>";';
strFrame2+=' }else{';
strFrame2+=' timestr+="<td width=30 align=center onmouseover=" + " style.backgroundColor=\'#BEEBEE\' " + " onmouseout=" + " style.backgroundColor=\'#fff\' " + " style=\'font-size:9pt;FONT-FAMILY: Verdana;cursor:pointer;\' onClick=getTime(minute"+t+")>" + t + "<input type=hidden id=minute"+t+" value="+t+"></td></tr><tr>";';
strFrame2+=' }';
strFrame2+=' }else{';
strFrame2+=' if(m.getMinutes().toString()==t){';
strFrame2+=' timestr+="<td width=30 align=center bgcolor=\'#BEEBEE\' style=\'font-size:9pt;FONT-FAMILY: Verdana;cursor:pointer;\' onClick=getTime(minute"+t+")>" + t + "<input type=hidden id=minute"+t+" value="+t+"></td>";';
strFrame2+=' }else{';
strFrame2+=' timestr+="<td width=30 align=center onmouseover=" + " style.backgroundColor=\'#BEEBEE\' " + " onmouseout=" + " style.backgroundColor=\'#fff\' " + " style=\'font-size:9pt;FONT-FAMILY: Verdana;cursor:pointer;\' onClick=getTime(minute"+t+")>" + t + "<input type=hidden id=minute"+t+" value="+t+"></td>";';
strFrame2+=' }';
strFrame2+=' }';
strFrame2+=' }';
strFrame2+=' timestr+="</tr><tr></table></div>";';
strFrame2+=' timestr+="<div style=\'text-align:right;margin-top:3px;\'><input type=\'button\' name=\'button\' value=\''+clearLabel+'\' onClick=clineTime() style=\'height:20px;width:45px;border:#ccc 1px solid;padding:2px;FONT-FAMILY: Verdana;\'> ";';
strFrame2+=' timestr+="<input type=\'button\' name=\'button\' value=\''+closeLabel+'\' onClick=parent.closeLayer() style=\'height:20px;width:45px;border:#ccc 1px solid;padding:2px;FONT-FAMILY: Verdana;\'></div><div style=\'text-align:right;margin-top:3px;\'></div>";';
strFrame2+=' document.getElementById("nowhour").innerHTML = timestr;';
strFrame2+='</scr' + 'ipt>';
if(document.getElementById("meizzDateLayer2")&&document.getElementById("meizzDateLayer2").contentWindow){
document.getElementById("meizzDateLayer2").contentWindow.document.writeln(strFrame2);
document.getElementById("meizzDateLayer2").contentWindow.document.close();
}
/*********时间控件生成结束**********/
function onShowStartTime(elementid){
onProjTaskTime(elementid);
}
function onShowEndTime(elementid){
onProjTaskTime(elementid);
}
function onProjTaskTime(inputname){
//alert(document.getElementById(inputname));
var dads = document.getElementById("meizzDateLayer2").style;
setLastSelectTime(document.getElementById(inputname));
var spanname = document.getElementById(inputname);
var th = spanname;
var ttop = spanname.offsetTop;
var thei = spanname.clientHeight;
var tleft = spanname.offsetLeft;
var ttyp = spanname.type;
while (spanname = spanname.offsetParent){
ttop += spanname.offsetTop;
tleft += spanname.offsetLeft;
}
dads.top = ((ttyp == "image") ? ttop + thei : ttop + thei + 0)+"px";
dads.left = tleft+"px";
outObject = th;
dads.display = '';
bShow = true;
}
function setLastSelectTime(inputname)
{
if(inputname.value)
{ //alert(inputname.value);
var inputtime = inputname.value;
var inputhour = inputtime.substring(0,2);
var inputminute = inputtime.substring(3,5);
if(inputminute!=-1)
{
inputminute = inputminute.valueOf()<10?inputminute.substring(1,2):inputminute;
var inputminutetd = jQuery("#meizzDateLayer2")[0].contentWindow.document.getElementById('minute' + inputminute).parentNode;
var inputhourselect = jQuery("#meizzDateLayer2")[0].contentWindow.document.getElementById('hour');
for(var i=1;i<61;i++)
{
var t = i-1;
var otherminute = jQuery("#meizzDateLayer2")[0].contentWindow.document.getElementById('minute'+t).parentNode;
otherminute.bgColor ="";
otherminute.style.backgroundColor='#fff';
//otherminute.fireEvent('onmouseout');
}
var hours = inputhourselect.options;
for(key in hours)
{
if(hours[key]&&hours[key].value)
{
if(hours[key].value==inputhour)
{
hours[key].selected = true;
}
}
}
inputminutetd.bgColor='#BEEBEE';
inputminutetd.style.backgroundColor='#BEEBEE';
}
}
}
function meizzDayClick(n){
//alert(n);
//alert(outObject.value);
outObject.value=n;
closeLayer();
outObject.focus();
}