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

📄 admin_exercise_content_add.asp

📁 《学校机房作业管理系统》采用ASP+Aceesss+ ServU构架
💻 ASP
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<% 
'=========================================================
' 学校机房作业管理系统 V 1.0 [创建于200812122100]
' 授权发布网站:清远ABC-http://www.qyabc.com/
' 客服QQ:418322257   E-Mail:qystu@163.com
' 注意:如想得到关于本程序免费的技术支持,
' 必须承诺使用一周后,用平邮回寄“相关文件”文件夹中的“学校机房作业管理系统调查反馈表”表格。
' 作者博客:http://www.qyabc.com/u/qin/Default.aspx
'=========================================================
%>

<!--#include file="inc/config.asp" -->
<!--#include file="Connections/master.asp" -->
<%
' *** Restrict Access To Page: Grant or deny access to this page
MM_authorizedUsers="5,6,7"
MM_authFailedURL="login.asp?error=3"
MM_grantAccess=false
If session("QYABC_userid") <> "" Then
  If (false Or CStr(Session("MM_UserAuthorization"))="") Or _
         (InStr(1,MM_authorizedUsers,Session("MM_UserAuthorization"))>=1) Then
    MM_grantAccess = true
  End If
End If
If Not MM_grantAccess Then
  MM_qsChar = "?"
  If (InStr(1,MM_authFailedURL,"?") >= 1) Then MM_qsChar = "&"
  MM_referrer = Request.ServerVariables("URL")
  if (Len(Request.QueryString()) > 0) Then MM_referrer = MM_referrer & "?" & Request.QueryString()
  MM_authFailedURL = MM_authFailedURL & MM_qsChar & "accessdenied=" & Server.URLEncode(MM_referrer)
  Response.Redirect(MM_authFailedURL)
End If
%>
<%
' *** Edit Operations: declare variables

Dim MM_editAction
Dim MM_abortEdit
Dim MM_editQuery
Dim MM_editCmd

Dim MM_editConnection
Dim MM_editTable
Dim MM_editRedirectUrl
Dim MM_editColumn
Dim MM_recordId

Dim MM_fieldsStr
Dim MM_columnsStr
Dim MM_fields
Dim MM_columns
Dim MM_typeArray
Dim MM_formVal
Dim MM_delim
Dim MM_altVal
Dim MM_emptyVal
Dim MM_i

MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (Request.QueryString <> "") Then
  MM_editAction = MM_editAction & "?" & Server.HTMLEncode(Request.QueryString)
End If

' boolean to abort record edit
MM_abortEdit = false

' query string to execute
MM_editQuery = ""
%>
<%
' *** Insert Record: set variables

If (CStr(Request("MM_insert")) = "form1") Then

  MM_editConnection = MM_master_STRING
  MM_editTable = "exercise_content"
  MM_editRedirectUrl = "admin_exercise_content_add_success.asp"
  MM_fieldsStr  = "select|value|content_title|value|content|value|teachername|value|teachernum|value|add_ip|value"
  MM_columnsStr = "subject_id|',none,''|content_title|',none,''|content|',none,''|teachername|',none,''|teachernum|',none,''|add_ip|',none,''"

  ' create the MM_fields and MM_columns arrays
  MM_fields = Split(MM_fieldsStr, "|")
  MM_columns = Split(MM_columnsStr, "|")
  
  ' set the form values
  For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
    MM_fields(MM_i+1) = CStr(Request.Form(MM_fields(MM_i)))
  Next

  ' append the query string to the redirect URL
  If (MM_editRedirectUrl <> "" And Request.QueryString <> "") Then
    If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then
      MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
    Else
      MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
    End If
  End If

End If
%>
<%
' *** Insert Record: construct a sql insert statement and execute it

Dim MM_tableValues
Dim MM_dbValues

If (CStr(Request("MM_insert")) <> "") Then

  ' create the sql insert statement
  MM_tableValues = ""
  MM_dbValues = ""
  For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
    MM_formVal = MM_fields(MM_i+1)
    MM_typeArray = Split(MM_columns(MM_i+1),",")
    MM_delim = MM_typeArray(0)
    If (MM_delim = "none") Then MM_delim = ""
    MM_altVal = MM_typeArray(1)
    If (MM_altVal = "none") Then MM_altVal = ""
    MM_emptyVal = MM_typeArray(2)
    If (MM_emptyVal = "none") Then MM_emptyVal = ""
    If (MM_formVal = "") Then
      MM_formVal = MM_emptyVal
    Else
      If (MM_altVal <> "") Then
        MM_formVal = MM_altVal
      ElseIf (MM_delim = "'") Then  ' escape quotes
        MM_formVal = "'" & Replace(MM_formVal,"'","''") & "'"
      Else
        MM_formVal = MM_delim + MM_formVal + MM_delim
      End If
    End If
    If (MM_i <> LBound(MM_fields)) Then
      MM_tableValues = MM_tableValues & ","
      MM_dbValues = MM_dbValues & ","
    End If
    MM_tableValues = MM_tableValues & MM_columns(MM_i)
    MM_dbValues = MM_dbValues & MM_formVal
  Next
  MM_editQuery = "insert into " & MM_editTable & " (" & MM_tableValues & ") values (" & MM_dbValues & ")"

  If (Not MM_abortEdit) Then
    ' execute the insert
    Set MM_editCmd = Server.CreateObject("ADODB.Command")
    MM_editCmd.ActiveConnection = MM_editConnection
    MM_editCmd.CommandText = MM_editQuery
    MM_editCmd.Execute
    MM_editCmd.ActiveConnection.Close

    If (MM_editRedirectUrl <> "") Then
      Response.Redirect(MM_editRedirectUrl)
    End If
  End If

End If
%>
<%
Dim subject_list__MMColParam
subject_list__MMColParam = "1"
If (session("QYABC_userid") <> "") Then 
  subject_list__MMColParam = session("QYABC_userid")
End If
%>
<%
Dim subject_list
Dim subject_list_numRows

Set subject_list = Server.CreateObject("ADODB.Recordset")
subject_list.ActiveConnection = MM_master_STRING
subject_list.Source = "SELECT * FROM exercise_subject WHERE teachernum = '" + Replace(subject_list__MMColParam, "'", "''") + "'"
subject_list.CursorType = 0
subject_list.CursorLocation = 2
subject_list.LockType = 1
subject_list.Open()

subject_list_numRows = 0
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>发布作业-<%=WebName%></title>
<link rel="SHORTCUT ICON" href="favicon.ico"/>
<link href="<%= SysCss %>" rel="stylesheet" type="text/css">
<script language="JavaScript">
<!--
function checkform(){
if(document.form1.content_title.value=="")
  {
   alert("必须填写作业名称!");
   document.form1.content_title.focus();
   return false;
   }
if(eWebEditor1.getHTML()=="")
  {
   alert("必须填写作业内容!");
   return false;
   }

}
//-->
</script>
</head>

<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="16%" valign="top"><table width="97%" border="0" align="center" cellpadding="5" cellspacing="0" bgcolor="#FFFFFF">
      <tr>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td align="center"><a href="admin_exercise_subject_add.asp">添加科目</a><a href="admin_news_index.asp"></a></td>
      </tr>
      <tr>
        <td align="center"><a href="admin_exercise_subject_mylist.asp">我的科目</a><a href="admin_news_index.asp"></a></td>
      </tr>
      <tr>
        <td align="center"><a href="admin_exercise_content_add.asp">发布作业</a><a href="admin_news_add.asp"></a></td>
      </tr>
      <tr>
        <td align="center"><a href="admin_exercise_content_mylist.asp">我的作业</a><a href="admin_news_add.asp"></a></td>
      </tr>
      <tr>
        <td align="center"><a href="admin_news_add.asp"></a></td>
      </tr>
    </table></td>
    <td width="84%" align="center" valign="middle"><% If subject_list.EOF And subject_list.BOF Then %>
        你现在还没有添加科目,请先添加科目,否则不能发布作业。<a href="admin_exercise_subject_add.asp">添加科目</a><a href="admin_news_index.asp"></a>
  <% End If ' end subject_list.EOF And subject_list.BOF %>
      <% If Not subject_list.EOF Or Not subject_list.BOF Then %>
  <form action="<%=MM_editAction%>" method="POST" name="form1" target="_self" onSubmit="return checkform()">
    <table align="center">
      <tr valign="baseline">
        <td nowrap align="right">所属科目:</td>
              <td><select name="select">
                  <%
While (NOT subject_list.EOF)
%>
                  <option value="<%=(subject_list.Fields.Item("subject_id").Value)%>"><%=(subject_list.Fields.Item("subject_name").Value)%></option>
                  <%
  subject_list.MoveNext()
Wend
If (subject_list.CursorType > 0) Then
  subject_list.MoveFirst
Else
  subject_list.Requery
End If
%>
              </select></td>
            </tr>
      <tr valign="baseline">
        <td nowrap align="right">作业名称:</td>
              <td><input name="content_title" type="text" id="content_title" value="" size="60">              </td>
            </tr>
      <tr>
        <td nowrap align="right" valign="top">作业内容:</td>
              <td valign="baseline"><textarea name="content" style="display:none"></textarea>
                <iframe ID="eWebEditor1" src="editor/ewebeditor.asp?id=content&style=exercise_system&originalfilename=d_originalfilename&savefilename=d_savefilename&savepathfilename=d_savepathfilename" frameborder="0" scrolling="no" width="650" HEIGHT="350"></iframe></td>
            </tr>
      <tr valign="baseline">
        <td nowrap align="right">&nbsp;</td>
              <td align="right"><input name="submit" type="submit" value="发布作业">              </td>
            </tr>
    </table>
    <input type="hidden" name="teachername" value="<%= session("QYABC_username") %>" >
    <input type="hidden" name="teachernum" value="<%= session("QYABC_userid") %>" >
    <input type="hidden" name="add_ip" value="<%= Request.ServerVariables("Remote_Addr") %>" >
    <input type="hidden" name="MM_insert" value="form1">
  </form>
  <% End If ' end Not subject_list.EOF Or NOT subject_list.BOF %></td>
  </tr>
</table>
<!--#include file="inc/bot.asp" -->
</body>
</html>
<%
subject_list.Close()
Set subject_list = Nothing
%>

⌨️ 快捷键说明

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