📄 editlog.asp
字号:
<%@ LANGUAGE = VBScript %>
<% Option Explicit %>
<!-- #include virtual="include/DataEnvi.asp" -->
<%
Sub Main()
Dim strTodaytime, intID
intID = Request.QueryString("ID")
Dim ObjDB
Dim ObjRS, strSQL
Dim strPageTitle
Dim strTitle, strPlace, strStartDate, strEndDate, strRemark, strRemind
strTitle = ""
strPlace = ""
strStartDate = Request.QueryString("StartDate")
strEndDate = Request.QueryString("EndDate")
strRemark = ""
strRemind = "15"
If intID <> "" Then
intID = CLng(intID)
Set ObjDB = Server.CreateObject("ADODB.Connection")
OpenDB ObjDB
strSQL = "SELECT ID, Title, Place, CONVERT(NVARCHAR, StartDate, 120) AS StartDate, " & _
"CONVERT(NVARCHAR, EndDate, 120) AS EndDate, Remark, Remind " & _
"FROM t_OA_Private_Log WHERE ID = " & intID
Set ObjRS = ObjDB.Execute(strSQL)
If Not (ObjRS.EOF And ObjRS.BOF) Then
strTitle = ObjRS("Title")
strPlace = ObjRS("Place")
'将 yyyy-mm-dd hh:mm:ss 格式换成 yyyy/mm/dd hh:mm:ss
'以便javascript能够解释
strStartDate = Replace(ObjRS("StartDate"), "-", "/")
strEndDate = Replace(ObjRS("EndDate"), "-", "/")
strRemark = ObjRS("Remark")
strRemind = ObjRS("Remind")
Else
intID = ""
End If
strPageTitle = "修改计划"
Else
strPageTitle = "添加计划"
End If
%>
<html>
<head>
<title><%= strPageTitle %></title>
<link rel = "stylesheet" href = "CssLib/mwToc.css">
<link rel="stylesheet" type="text/css" href="<%=Application("ROOTPATH")%>Templet/Main.css">
<Script Language="JavaScript" src="../include/MSAlert.js"></Script>
<Script Language="JavaScript" src="../include/function.js"></Script>
<Script language ="JavaScript">
var strStartDate = new Date("<%= strStartDate %>");
var strEndDate = new Date("<%= strEndDate %>");
var strRemind = "<%= strRemind %>";
//var intTime = parseInt();
function writeYears()
{
intYear = strStartDate.getYear();
for (i = 0; i < 5; i++)
{
document.write("<option value=\"" + (intYear + i) + "\">" + (intYear + i) + "</option>");
}
}
function writeMonths()
{
document.write("<option value=\"1\">1</option>");
document.write("<option value=\"2\">2</option>");
document.write("<option value=\"3\">3</option>");
document.write("<option value=\"4\">4</option>");
document.write("<option value=\"5\">5</option>");
document.write("<option value=\"6\">6</option>");
document.write("<option value=\"7\">7</option>");
document.write("<option value=\"8\">8</option>");
document.write("<option value=\"9\">9</option>");
document.write("<option value=\"10\">10</option>");
document.write("<option value=\"11\">11</option>");
document.write("<option value=\"12\">12</option>");
}
function writeDays()
{
for (i = 1; i <= 31; i++)
{
document.write("<option value=\"" + i + "\">" + i + "</option>");
}
}
function writeHours()
{
for (i = 0; i < 24; i++)
{
strDaypart = (i > 11)?" PM":" AM";
intHour = (i > 11)?(i - 12):i;
intHour = (intHour == 0)?0:intHour;
if (intHour < 10)
strHour = "0" + intHour;
else
strHour = new String(intHour);
if (i < 10)
strAbsHour = "0" + i;
else
strAbsHour = new String(i);
strHour1 = strHour + ":00" + strDaypart;
strHour2 = strHour + ":30" + strDaypart;
document.write("<option value=\"" + strAbsHour + ":00\">" + strHour1 + "\n");
document.write("<option value=\"" + strAbsHour + ":30\">" + strHour2 + "\n");
}
}
function writeRemind()
{
document.write("<option value=\"0\">0分钟\n");
document.write("<option value=\"5\">5分钟\n");
document.write("<option value=\"10\">10分钟\n");
document.write("<option value=\"15\" selected>15分钟\n");
document.write("<option value=\"30\">30分钟\n");
for (i = 1; i < 12; i++)
{
document.write("<option value=\"" + (i * 60) + "\">" + i + "小时\n");
}
document.write("<option value=\"720\">半天\n");
document.write("<option value=\"1080\">18小时\n");
document.write("<option value=\"1440\">1天\n");
document.write("<option value=\"2880\">2天\n");
document.write("<option value=\"4320\">3天\n");
}
function DoSelect()
{
//选定正确的日期和时间
intMonth = strStartDate.getMonth();
intDay = strStartDate.getDate() - 1;
intHour = strStartDate.getHours();
intMinute = strStartDate.getMinutes();
intTime = (intHour * 2) + (intMinute == 0?0:1);
thisForm._StartYear.selectedIndex = 0;
thisForm._StartMonth.selectedIndex = intMonth;
thisForm._StartDay.selectedIndex = intDay;
thisForm._StartHour.selectedIndex = intTime;
intMonth = strEndDate.getMonth();
intDay = strEndDate.getDate() - 1;
intHour = strEndDate.getHours();
intMinute = strEndDate.getMinutes();
intTime = (intHour * 2) + (intMinute == 0?0:1);
thisForm._EndYear.selectedIndex = 0;
thisForm._EndMonth.selectedIndex = intMonth;
thisForm._EndDay.selectedIndex = intDay;
thisForm._EndHour.selectedIndex = intTime;
if (strRemind != "")
{
for (i = 0; i < thisForm._Remind.options.length; i++)
{
if (strRemind == thisForm._Remind.options[i].value)
{
thisForm._Remind.selectedIndex = i;
break;
}
}
}
else
{
thisForm._chkRemind.checked = false;
thisForm._Remind.disabled = "disabled";
}
}
function Save()
{
if ((thisForm._Title.value) == '')
{
alert( "请输入计划名称");
thisForm._Title.focus();
return false;
}
if (thisForm._Remark.value.length > 2000)
{
alert( "备注不能大于2000字符");
thisForm.Remark.focus();
return false;
}
var strStartDate = thisForm._StartYear.value + '/' + thisForm._StartMonth.value + '/' + thisForm._StartDay.value + ' ' + thisForm._StartHour.value + ':00';
var strEndDate = thisForm._EndYear.value + '/' + thisForm._EndMonth.value + '/' + thisForm._EndDay.value + ' ' + thisForm._EndHour.value + ':00';
//alert(strStartDate);
if (Date.parse(strStartDate) > Date.parse(strEndDate))
{
alert( "起始时间不能大于结束时间");
thisForm._Remark.focus();
return false;
}
thisForm._StartDate.value = strStartDate;
thisForm._EndDate.value = strEndDate;
thisForm.action = "EditLogHandle.asp";
thisForm.submit();
}
function DoChange()
{
if (thisForm._chkRemind.checked)
thisForm._Remind.disabled = "";
else
thisForm._Remind.disabled = "disabled";
}
function Close()
{
window.close();
}
function Delete()
{
window.navigate("DeleteLog.asp?ID=" + thisForm._ID.value);
}
</Script>
</head>
<body class="bodymain" onload="document.all._Title.focus()" style = "margin:0px">
<form id="thisForm" name="thisForm" method="post" style="font:14px">
<input type="hidden" name="_ID" value="<%= intID %>">
<input type="hidden" name="_StartDate">
<input type="hidden" name="_EndDate">
<table border="0" cellspacing="0" cellpadding="1" width="100%" style="font:14px">
<tr height="30">
<td height="" colspan="2" align="center" style="font:14px">
<%= strPageTitle %>
</td>
</tr>
<tr>
<td style="font:14px" align="right"> 计划名称: </td>
<td>
<input name="_Title" size=45 maxlength="50" value="<%= strTitle %>">
</td>
</tr>
<tr>
<td style="font:14px" align="right"> 地 点: </td>
<td><input name="_Place" size=45 maxlength ="100" value="<%= strPlace %>"></td>
</tr>
<tr>
<td style="font:14px" align="right"> 开始时间: </td>
<td style="font:14px" NOWRAP>
<select name="_StartYear" style="font:14px">
<script language="javascript">writeYears();</script>
</select>年
<select name="_StartMonth" style="font:14px">
<script language="javascript" style="font:14px">writeMonths();</script>
</select>月
<select name="_StartDay" style="font:14px">
<script language="javascript">writeDays();</script>
</select>日
<select name="_StartHour" style="font:14px">
<script language="javascript">writeHours();</script>
</select>
</td>
</tr>
<tr>
<td style="font:14px" align="right"> 结束时间: </td>
<td style="font:14px" NOWRAP>
<select name="_EndYear" style="font:14px">
<script language="javascript">writeYears();</script>
</select>年
<select name="_EndMonth" style="font:14px">
<script language="javascript">writeMonths();</script>
</select>月
<select name="_EndDay" style="font:14px">
<script language="javascript">writeDays();</script>
</select>日
<select name="_EndHour" style="font:14px">
<script language="javascript">writeHours();</script>
</select>
</td>
</tr>
<tr>
<td style="font:14px" align="right" valign="top"> 备 注: </td>
<td valign="top"><TEXTAREA cols=37 name="_Remark" rows=12 wrap=PHYSICAL><%= strRemark %></TEXTAREA>
</td>
</tr>
<tr>
<td style="font:14px" align="right"> 提 醒: </td>
<td nowrap>
<input type="checkbox" name="_chkRemind" onclick="DoChange()" checked>
提前 <select name="_Remind" style="font:14px">
<script language="javascript">writeRemind();</script>
</select>
</td>
</tr>
<script language="javascript">DoSelect();</script><br>
<tr>
<td colspan=3 align = center>
<% If intID <> "" Then %>
<button class="button" name="_btnSet" onclick="Delete()" title="删除已安排的计划,关闭本窗口"
><font color="#000000"> 删 除 </font></button>
<% End If %>
<button class="button" name="_btnSet" onclick="Save()" title="保存已安排的计划,关闭本窗口"
><font color="#000000"> 保 存 </font></button>
<button class="button" name="_btnSet" onclick="Close()" title="取消安排计划,关闭本窗口"
><font color="#000000"> 取 消 </font></button>
</td>
</tr>
</table>
</form>
</body>
</html>
<%
End Sub
%>
<!-- #include file="Templet.asp" -->
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -