www.gusucode.com > 站长俱乐部新闻发布系统精简版 1.01源码程序 > admin/admin_cat_edit_link.asp

    <!--#include file="admin_scripts.asp" -->
<!--#include file="admin_top.asp" -->
<%
' *** Edit Operations: declare variables

' set the form action variable
dim MM_editAction
MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (Request.QueryString <> "") Then
  MM_editAction = MM_editAction & "?" & Request.QueryString
End If

' boolean to abort record edit
dim MM_abortEdit
MM_abortEdit = false

' query string to execute
dim MM_editQuery
MM_editQuery = ""
%>
<%
' *** Update Record: set variables
If (CStr(Request("MM_update")) = "form1" And CStr(Request("MM_recordId")) <> "") Then

  dim MM_editConnection, MM_editTable, MM_editColumn, MM_recordId, MM_editRedirectUrl, MM_fieldsStr, MM_columnsStr
  MM_editConnection = MM_oConn_STRING
  MM_editTable  = "ac_category"
  MM_editColumn = "ID"
  'MM_recordId = "'" + Request.Form("MM_recordId") + "'"
  MM_recordId = Request.Form("MM_recordId")
  MM_editRedirectUrl = "default.asp"
  MM_fieldsStr  = "Name|value|VerticalPosition|value|Type|value|URL|value"
  MM_columnsStr = "Name|',none,''|VerticalPosition|none,none,NULL|Type|',none,''|URL|',none,NULL"

  ' create the MM_fields and MM_columns arrays
  dim MM_fields, MM_columns
  MM_fields = Split(MM_fieldsStr, "|")
  MM_columns = Split(MM_columnsStr, "|")
  
  ' set the form values
  dim MM_i
  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
%>

<%
' *** Update Record: construct a sql update statement and execute it

If (CStr(Request("MM_update")) <> "" And CStr(Request("MM_recordId")) <> "") Then

  ' create the sql update statement
  dim MM_formVal, MM_typeArray, MM_delim, MM_altVal, MM_emptyVal, MM_editCmd
  MM_editQuery = "update " & MM_editTable & " set "
  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_editQuery = MM_editQuery & ","
    End If
    MM_editQuery = MM_editQuery & MM_columns(MM_i) & " = " & MM_formVal
  Next
  MM_editQuery = MM_editQuery & " where " & MM_editColumn & " = " & MM_recordId
  
  If (Not MM_abortEdit) Then
    ' execute the update
    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 myParam
myParam = "1"
if (Request.Form("ID") <> "") then
  myParam = Request.Form("ID")
end if
%>
<%
dim CategoryEdit
set CategoryEdit = Server.CreateObject("ADODB.Recordset")
CategoryEdit.ActiveConnection = MM_oConn_STRING
CategoryEdit.Source = "SELECT * FROM ac_category WHERE ID = "& myParam & ""
CategoryEdit.CursorType = 0
CategoryEdit.CursorLocation = 2
CategoryEdit.LockType = 1
CategoryEdit.Open()

'check that the user is allowed to edit this page
if (Session("MM_UserAuthorization") = 3) then 
	Response.Redirect(MM_authFailedURL)
end if

dim myCatName,myCatPos
'fix problem with displaying apostrophes
myCatName = CategoryEdit.Fields.Item("Name").Value
myCatName = Replace(myCatName,"'","&#180")

myCatPos = CategoryEdit.Fields.Item("VerticalPosition").Value
%>

<table width="100%" border="0" cellpadding="5" cellspacing="0" class="ac_admin_main">
  <tr> 
  <td><img src="images/blank.gif" width="4" height="12"></td></tr>
  <tr valign="baseline"><td><%= adminHeading(2,lang_admin_default_001,"icons/window_edit_24.gif",lang_admin_cat_edit_001,"#") %></td></tr>
  <tr>
    <td class='contentarea' colspan=4>
<form method="post" action="<%=MM_editAction%>" name="form1">
        <TABLE width="100%" align=center border=0>
        <TR>
	<TD><IMG height=1 src="images/blank.gif" width=153></TD></TR>
	<TR>
          <tr valign="baseline"> 
            <td align="right" nowrap class="content_titles"><%= lang_admin_cat_add_001 %></td>
            <td class="content_right" width="100%"> <input type="text" name="Name" value="<%=(CategoryEdit.Fields.Item("Name").Value)%>" size="32"> 
            </td>
          </tr>
          <tr valign="baseline"> 
            <td align="right" class="content_titles"><%= lang_admin_cat_add_003 %></td>
            <td class="content_right" width="100%">
            <select name="VerticalPosition">
                <option value="1" <% if myCatPos="1" then response.write("SELECTED") %>>1</option>
                <option value="2" <% if myCatPos="2" then response.write("SELECTED") %>>2</option>
                <option value="3" <% if myCatPos="3" then response.write("SELECTED") %>>3</option>
                <option value="4" <% if myCatPos="4" then response.write("SELECTED") %>>4</option>
                <option value="5" <% if myCatPos="5" then response.write("SELECTED") %>>5</option>
                <option value="6" <% if myCatPos="6" then response.write("SELECTED") %>>6</option>
                <option value="7" <% if myCatPos="7" then response.write("SELECTED") %>>7</option>
                <option value="8" <% if myCatPos="8" then response.write("SELECTED") %>>8</option>
                <option value="9" <% if myCatPos="9" then response.write("SELECTED") %>>9</option>
                <option value="10" <% if myCatPos="10" then response.write("SELECTED") %>>10</option>
                <option value="11" <% if myCatPos="11" then response.write("SELECTED") %>>11</option>
                <option value="12" <% if myCatPos="12" then response.write("SELECTED") %>>12</option>
                <option value="13" <% if myCatPos="13" then response.write("SELECTED") %>>13</option>
                <option value="14" <% if myCatPos="14" then response.write("SELECTED") %>>14</option>
                <option value="15" <% if myCatPos="15" then response.write("SELECTED") %>>15</option>
                <option value="16" <% if myCatPos="16" then response.write("SELECTED") %>>16</option>
                <option value="17" <% if myCatPos="17" then response.write("SELECTED") %>>17</option>
                <option value="18" <% if myCatPos="18" then response.write("SELECTED") %>>18</option>
                <option value="19" <% if myCatPos="19" then response.write("SELECTED") %>>19</option>
                <option value="20" <% if myCatPos="20" then response.write("SELECTED") %>>20</option>
                <option value="21" <% if myCatPos="21" then response.write("SELECTED") %>>21</option>
                <option value="22" <% if myCatPos="22" then response.write("SELECTED") %>>22</option>
                <option value="23" <% if myCatPos="23" then response.write("SELECTED") %>>23</option>
                <option value="24" <% if myCatPos="24" then response.write("SELECTED") %>>24</option>
                <option value="25" <% if myCatPos="25" then response.write("SELECTED") %>>25</option>
                <option value="26" <% if myCatPos="26" then response.write("SELECTED") %>>26</option>
                <option value="27" <% if myCatPos="27" then response.write("SELECTED") %>>27</option>
                <option value="28" <% if myCatPos="28" then response.write("SELECTED") %>>28</option>
                <option value="29" <% if myCatPos="29" then response.write("SELECTED") %>>29</option>
                <option value="30" <% if myCatPos="30" then response.write("SELECTED") %>>30</option>
            </select>
            </td>
          </tr>

    <tr valign="baseline"> 
      <TD class=content_titles noWrap align=right><%= lang_admin_cat_add_004 %></td>
      <TD class=content_right_radio width="100%">
      
    <label>
    <input type="radio" name="Type" value="Normal">
    <%= lang_admin_cat_add_005 %></label>
    <br>
    <label>
    <input type="radio" name="Type" value="Link" checked>
    <%= lang_admin_cat_add_006 %></label>
      
    </td></tr>
     <tr valign="baseline"> 
      <TD class=content_titles noWrap align=right><%= lang_admin_cat_add_007 %></td>
      <TD class=content_right width="100%"><input type="text" name="URL" value="<%=(CategoryEdit.Fields.Item("URL").Value)%>" size="32">
    </td>

  <input type="hidden" name="MM_update" value="form1">
  <input type="hidden" name="MM_recordId" value="<%= CategoryEdit.Fields.Item("ID").Value %>">
  <tr><td align="right" class="content_apply"><%= lang_admin_config_008 %></td><td class="savebg"><INPUT TYPE="image" src="images/save_out.gif" HEIGHT="39" WIDTH="39" BORDER="0" ALT="<%= lang_admin_config_009 %>" value="Update" name="Submit" id="Image1" onMouseOver="MM_swapImage('Image1','','images/save_over.gif',1)" onMouseOut="MM_swapImgRestore()"></td></tr>
</form>
        </table>
     </td> </tr>
    </table>

<p>&nbsp;</p>
<%
  CategoryEdit.Close
%>
<!--#include file="admin_bottom.asp" -->