⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 alarmadd.jsp

📁 这是一个法律事务所系统源码
💻 JSP
字号:
<%--
模块名称:个人助理
模块功能:提醒增加
版    本:V1.0
著 作 人:蔡静
著作日期:2001-11-12
使用说明:
主要技术说明:
参考文献:法律事务设计书
修改历史:= = = = = = = = = = = = = = = = = = = = = = = = = =
	修改日期:2001-11-25
	修 改 人:Celts
	修改理由:t_alerted表插入出错
	修改出处:
	= = = = = = = = = = = = = = = = = = = = = = = = = =

--%>
<%@ page contentType= "text/html; charset=gb2312" %>
<%@ page language="java" import="java.sql.*" %>
<%@ page import="system.*" %>
<jsp:useBean id="db" class="dbconnection.DbConnection" scope="page" />
<%
  Security auth = new Security();
  String employeeid = (String)session.getAttribute("employee_id");
  if(employeeid == null || employeeid.equals(""))
  {
    response.sendRedirect(response.encodeRedirectURL("../Error/nonlogin.htm"));
  }
  String modelid = "Per010";
  int authflag = auth.popedom(employeeid, modelid);
  if(authflag == 0 || authflag == 2 || authflag == -1)
  {
%>
  <jsp:forward page="../inc/noauth.jsp" >
  </jsp:forward>
<%
  }
%>
<%
  GetID gid = new GetID();
  ExtendString es = new ExtendString();
  String alertid = "JS" + es.digitToString(gid.getIDNumber("alert_id")+1);
  String str = request.getParameter("save");
  if (str!=null) {
    String alert_id, alert_title, alert_thing, alert_fromtime, alert_totime;
    alert_id = request.getParameter("alert_id");
    alert_title = es.getStr(request.getParameter("alert_title"));
    alert_thing = es.getStr(request.getParameter("alert_thing"));
    alert_fromtime = request.getParameter("alert_fromtime") + " ";
    alert_fromtime = alert_fromtime + request.getParameter("fromhour") + ":";
    alert_fromtime = alert_fromtime + request.getParameter("fromminute");
    alert_totime = request.getParameter("alert_totime") + " ";
    alert_totime = alert_totime + request.getParameter("tohour") + ":";
    alert_totime = alert_totime + request.getParameter("tominute");
    String alerteds = request.getParameter("alertedlist");
    String alerted[] = new String[20];
    alerted = es.Split(";",alerteds);
    String sql = "insert into t_alert(alert_id, alert_title, alert_thing,";
    sql = sql + "alert_person, alert_fromtime, alert_totime) values ('";
    sql = sql + alert_id + "','" + alert_title + "','" + alert_thing;
    sql = sql + "','" + employeeid + "','" + alert_fromtime + "','";
    sql = sql + alert_totime + "')";    
    int num = db.executeUpdate(sql);
    if (num <= 0) {%>  
		<script language="javascript">
  		alert("新增失败!");
		</script>
  	<%}else {
      gid.setIDNumber("alert_id", gid.getIDNumber("alert_id")+1);
      alertid = "JS" + es.digitToString(gid.getIDNumber("alert_id")+1);
    }
    for (int i=0; i<es.length; i++) {
      sql = "insert into t_alerted(alert_id, alerted_person,alert_state) values ('";
      sql = sql + alert_id + "','" + alerted[i] + "','1')";
      db.executeUpdate(sql);      
    }
  }
%>
<html>
<head>
<title>提醒增加</title>
<%@ include file="../inc/config.jsp" %>
<script language="javascript">
function copyToList(from,to) //from表示:包含可选择项目的select对象名字 to表示:列出可选择项目的select对象名字 //你可以根据你的具体情况修改
{
  fromList = eval("document.forms[0]." + from);
  toList = eval("document.forms[0]." + to);
  var sel = false;
  for (i=0;i<fromList.options.length;i++)
  {
    var current = fromList.options[i];
    if (current.selected)
    {
      sel = true;
      if (current.value == "temp")
      {
        alert ("你不能选择这个项目!");
        return;
      }
      txt = current.text;
      val = current.value;
      if (toList.options.length > 0 && toList.options[0].value == 'temp')
      {
        toList.options.length = 0;
      }
      toList.options[toList.length] = new Option(txt,val);
      fromList.options[i] = null;
      i--;
    }
  }
  if (!sel) alert ("你还没有选择任何项目");
}
function allSelect() //这是当用户按下提交按钮时,对列出选择的select对象执行全选工作,让递交至的后台程序能取得相关数据
{
  List = document.form1.chosen;
  alertedlist = "";
  for (i=0; i<List.length; i++)
  {
     if (alertedlist == "")
       alertedlist = List.options[i].value;
     else
       alertedlist = alertedlist + ";" + List.options[i].value;
  }
  document.form1.alertedlist.value = alertedlist;
}

</script>
</head>

<body class=page>
<script language="javascript">
  function checkForm() {
    if (document.form1.alert_title.value == "") {
      alert("请输入提醒标题!");
      document.form1.alert_title.focus();
      return false;
    }
    if (document.form1.alert_fromtime.value == "") {
      alert("请输入提醒开始时间!");
      return false;
    }
    if (document.form1.alert_totime.value == "") {
      alert("请输入提醒结束时间!");
      return false;
    }
    if (document.form1.alert_fromtime.value > document.form1.alert_totime.value) {
      alert("提醒开始时间要小于提醒结束时间!");
      document.form1.alert_fromtime.value = "";
      document.form1.alert_totime.value = "";
      return false;
    }
    else {
      if (document.form1.alert_fromtime.value == document.form1.alert_totime.value) {
        if (document.form1.fromhour.value > document.form1.tohour.value) {
          alert("提醒开始时间要小于提醒结束时间!");
          return false;
        }
        else {
          if (document.form1.fromhour.value == document.form1.tohour.value) {
            if (document.form1.fromminute.value > document.form1.tominute.value) {
              alert("提醒开始时间要小于提醒结束时间!");
              return false;
            }
          }
        }
      }
    }
    if ((document.form1.chosen.length == 0) ||
      (document.form1.chosen.length == 1 && document.form1.chosen.options[0].value == "temp")) {
      alert("请选择被提醒人!");
      return false;
    }
    if (document.form1.alert_thing.value == "") {
      alert("请输入提醒内容!");
      document.form1.alert_thing.focus();
      return false;
    }
    List = document.form1.chosen;
    var alertedlist = "";
    for (i=0; i<List.length; i++) {
     if (alertedlist == "")
       alertedlist = List.options[i].value;
     else
       alertedlist = alertedlist + ";" + List.options[i].value;
    }
    document.form1.alertedlist.value = alertedlist;
    return true;
  }
</script>
<!--显示工具条-->
<table width="98%" align="center" cellspacing="1">
  <tr>
    <td><a href="Alarm1.jsp"><img src="../images/alarm.gif" width="88" height="22" border="0"></a>
    <a href="Alarm1all.jsp"><img src="../images/alarm_all.gif" height="22" border="0" width="88"></a>
    <a href="AlarmAdd.jsp"><img src="../images/add.gif" alt="增加内容" width="79" height="22" border="0"></a>
    <img src="../images/delete.gif" alt="删除选中的内容" style="cursor:hand" width="79" height="22">
    <a href="Alarmall.jsp"><img src="../images/alarm_2.gif" width="88" height="22" border="0"></a></td>
    <td align="right"><img src="../images/back.gif" width="50" height="22" onClick="window.history.back()" style="cursor:hand" alt="返回"></td>
  </tr>
</table>
<table width="98%" background="../images/line.gif" border="0" cellspacing="0" cellpadding="0" height="12" align="center">
  <tr>
    <td>&nbsp;</td>
  </tr>
</table>
<!--显示工具条结束-->
<form name="form1" method="post" action="AlarmAdd.jsp">
  <table width="98%" border="0" cellspacing="1" cellpadding="5" class="table_bg" align="center">
  <tr>
    <td width="21%" class="title_bg" align="right"> 提醒标题:</td>
    <td width="79%" class="tr_bg1">
      <input type="text" name="alert_title" size="70" class="input" maxlength="70">  
      <font color="#FF0000">*</font>
    </td>
  </tr>
  <tr>
    <td width="21%" class="title_bg" height="4" align="right"> 提醒开始时间:</td>
    <td width="79%" class="tr_bg1" height="-2">
      <input type="text" name="alert_fromtime" maxlength="10" size="10" value="" class="input"  readOnly>
      <img src="../images/datetime.gif" border="0" align="absmiddle"
                  alt="弹出日历下拉菜单" onClick="fPopUpCalendarDlg(alert_fromtime);return false">
      <select name="fromhour" class="select">
      <%String temp = "";
        for (int i=0; i<24; i++) {
          if (i < 10)
            temp = "0" + i;
          else
            temp = String.valueOf(i);
          out.print("<option value=\""+temp+"\">"+temp+"</option>");
        }
      %>
      </select>
      <select name="fromminute" class="select">
        <option value="00">00</option>
        <option value="10">10</option>
        <option value="20">20</option>
        <option value="30">30</option>
        <option value="40">40</option>
        <option value="50">50</option>
      </select>   
      <font color="#FF0000">*</font>
    </td>
  </tr>
  <tr>
    <td width="21%" class="title_bg" height="4" align="right"> 提醒结束时间:</td>
    <td width="79%" class="tr_bg1" height="0">
      <input type="text" name="alert_totime" maxlength="10" size="10" value="" class="input"  readOnly>
      <img src="../images/datetime.gif" border="0" align="absmiddle"
                  alt="弹出日历下拉菜单" onClick="fPopUpCalendarDlg(alert_totime);return false">
      <select name="tohour" class="select">
      <%
        for (int i=0; i<24; i++) {
          if (i < 10)
            temp = "0" + i;
          else
            temp = String.valueOf(i);
          out.print("<option value=\""+temp+"\">"+temp+"</option>");
        }
      %>
      </select>
      <select name="tominute" class="select">
        <option value="00">00</option>
        <option value="10">10</option>
        <option value="20">20</option>
        <option value="30">30</option>
        <option value="40">40</option>
        <option value="50">50</option>
      </select>              
      <font color="#FF0000">*</font>
    </td>
  </tr>
  <tr>
    <td width="21%" class="title_bg" height="9" align="right">被提醒人:</td>
    <td width="79%" class="tr_bg1" height="9">
      <table border="0" width="60%">
        <tr>
          <td>已经选择</td>
          <td> </td>
          <td>没有选择</td>
        </tr>
        <tr>
          <td>
            <select name="chosen" size="4" multiple
              width=200 style="width: 158; height: 100" class="select">
              <option value="temp">从右边选择要提醒的人</option>
            </select>
          </td>
          <td>
            <input onClick="javascript:copyToList('possible','chosen')" type="button" value="<<添加" name="B5" class="button">
            <br>
            <input onClick="javascript:copyToList('chosen','possible')" type="button" value="删除>>" name="B6" class="button">
          </td>
          <td>
            <select name="possible" size="4" multiple
	       width=200 style="width: 148; height: 97" class="select">
            <%
              String employee_id, employee_name;
              String sql = "select employee_id, employee_name from t_employee";
              sql = sql + " order by employee_id";
              ResultSet rs = db.executeQuery(sql);
              while (rs.next()) {
                employee_id = rs.getString("employee_id");
                employee_name = rs.getString("employee_name");
                out.print("<option value=\"" + employee_id + "\">" + employee_name + "</option>");
              }
            %>
            </select>
          </td>
        </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td width="21%" class="title_bg"  align="right"> 提醒内容:</td>
    <td width="79%" class="tr_bg1">
      <textarea name="alert_thing" rows="5" cols="70" class="input"></textarea>    
      <font color="#FF0000">*</font>
    </td>
  </tr>
</table>
<div align="center">
  <input type="submit" name="save" value="保存" class="button" onClick="return checkForm()">
  <input type="reset" name="reset" value="重写" class="button">
  <br>
</div>
  <input type="hidden" name="alert_id" value=<%=alertid%>>
  <input type="hidden" name="alertedlist">
</form>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -