Subversion Repositories DevTools

Rev

Rev 5354 | Blame | Compare with Previous | Last modification | View Log | RSS feed

<%@LANGUAGE="VBSCRIPT"%>
<%
'=====================================================
'|                                                   |
'|                                wEditControl                                   |
'|                                                   |
'=====================================================
%>
<%
Option explicit
Response.Expires = 0
%>
<!--#include file="common/globals.asp"-->
<!--#include file="common/config.asp"-->
<!--#include file="common/common_subs.asp"-->
<!--#include file="common/_popup_window_common.asp"-->
<!--#include file="common/_user_common.asp"-->
<%
'------------ ACCESS CONTROL ------------------
%>
<!--#include file="_access_control_general.asp"-->
<%
'------------ VARIABLE DEFINITION -------------
Dim objFormCollector
'------------ CONSTANTS DECLARATION -----------
'------------ VARIABLE INIT -------------------
Set objFormCollector = CreateObject("Scripting.Dictionary")
'------------ CONDITIONS ----------------------
'----------------------------------------------
%>
<%
'-----------------------------------------------------------------------------------------------------------------
Sub GetControlDetails ( nObj_id, ByRef outobjDetails )
        Dim rsQry, query
        query = "SELECT *  FROM   CONTROL_OBJECTS  WHERE obj_id = "& nObj_id
        
        Set rsQry = OraDatabase.DbCreateDynaset( query , ORADYN_DEFAULT )

        If ((NOT rsQry.BOF) AND (NOT rsQry.EOF)) Then
                outobjDetails.Item ("obj_id")   = rsQry("obj_id")
                outobjDetails.Item ("obj_name") = rsQry("obj_name")
                outobjDetails.Item ("obj_description") = rsQry("obj_description")
        Else
                Err.Raise 8, "Sub GetControlDetails", "Empty record set returned. nObj_id="& nObj_id
                
        End If
        
        rsQry.Close
        Set rsQry = Nothing
End Sub

'--------------------------------------------------------------------------------------------------------------------------
Sub EditControl ()
        On Error Resume Next
        
        OraDatabase.Parameters.Add "OBJ_NAME",        Request("obj_name"),                      ORAPARM_INPUT, ORATYPE_STRING 
        OraDatabase.Parameters.Add "OBJ_DESCRIPTION", Request("obj_description"),       ORAPARM_INPUT, ORATYPE_STRING 
        OraDatabase.Parameters.Add "OBJ_ID",              Request("obj_id"),                    ORAPARM_INPUT, ORATYPE_STRING 
        
        
        objEH.TryORA ( OraSession )
        
        OraDatabase.ExecuteSQL _
        "BEGIN pk_Control.Update_Control (:OBJ_ID, :OBJ_NAME, :OBJ_DESCRIPTION ); END;" 
        
        objEH.CatchORA ( OraSession )
        
        
        OraDatabase.Parameters.Remove "OBJ_NAME"
        OraDatabase.Parameters.Remove "OBJ_DESCRIPTION"
        OraDatabase.Parameters.Remove "OBJ_ID"
        
End Sub
'--------------------------------------------------------------------------------------------------------------------------
%>
<%
'------------ RUN BEFORE PAGE RENDER ----------
' --- Get Form details from DB (for edit forms only) ---
'-------------------------------------------------------
Dim  parObj_id
parObj_id = Request("obj_id")
Call GetControlDetails ( parObj_id, objUserCollector )

' --- Load Validation Rules ---
Call objForm.LoadValidationRules ( Array("obj_name","obj_description") , OraDatabase )          ' Load Validation Rules

' --- Enter Form Validation Rule Changes here... ----
'----------------------------------------------------

If CBool(Request("action")) Then
        If objForm.IsValidOnPostBack Then
                ' --- Form is Valid ---
                Call EditControl()
                
                If objEH.Finally Then
            If Request("rmode") <> "" Then
                            Call OpenInParentWindow ( Request("rfile") &"?updated=ok"& objPMod.ComposeURLWithout("rfile,rmode") )
            Else
                            Call OpenInParentWindow ( Request("rfile") &"?updated=ok"& objPMod.ComposeURLWithout("rfile,obj_id,rmode") )
            End If
                        Call CloseWindow()
                End If
                
        End If
End If
'----------------------------------------------
%>
<html>
<head>
<title>Access Manager</title>
<link rel="shortcut icon" href="<%=FavIcon%>"/>
<meta HTTP-EQUIV="Pragma" CONTENT="no-cache">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="scripts/access_manager.css" rel="stylesheet" type="text/css">
<script language="JavaScript" src="scripts/common.js"></script>
</head>

<body background="images/bg_bage_pane.gif" leftmargin="0" topmargin="0" onLoad="self.focus();FormName.obj_name.focus();">
<table width="100%"  border="0" cellspacing="0" cellpadding="10">
  <tr>
    <td bgcolor="#FFFFFF" class="body_txt"><span class="body_h1"><img src="images/i_control_lrg.gif" width="13" height="18" hspace="0" align="absmiddle">&nbsp;Edit Control </span> <br>
    Edit Control Name and Description. 
      </td>
  </tr>
  <form name="FormName" method="post" action="<%=SCRIPT_NAME%>">
  <tr>
    <td background="images/bg_drk_bage_pane.gif"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td>&nbsp;</td>
        <td align="right"><input name="btn" type="submit" class="form_btn" value="Update">
          <input name="btn" type="reset" class="form_btn" value="Cancel" onClick="self.close();"></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td background="images/bg_form.gif"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="1%"><img src="images/spacer.gif" width="60" height="200"></td>
        <td width="100%"><table width="100%"  border="0" cellspacing="2" cellpadding="0">
          <!-- MESSAGE +++++++++++++++++++++++++++++++++++++++++++++++++++ -->
          <%If NOT objEH.Finally Then%>
          <tr>
            <td class="form_iname">&nbsp;</td>
            <td>
              <%objEH.DisplayMessage()%>
            </td>
            <td class="val_err"></td>
          </tr>
          <%End If%>
          <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
          <tr>
            <td nowrap class="form_iname" valign="top">Control Name </td>
            <td valign="top"><input name="obj_name" type="text" class="form_ivalue" size="60" value="<%=objUserCollector("obj_name")%>"></td>
            <td valign="top"><%=objForm.Validate ("obj_name")%></td>
          </tr>
          <tr>
            <td valign="top" nowrap class="form_iname">Description</td>
            <td valign="top"><textarea name="obj_description" cols="60" rows="10" class="form_ivalue"><%=objUserCollector("obj_description")%></textarea></td>
            <td valign="top"> <%=objForm.Validate ("obj_description")%> </td>
          </tr>
          <tr>
            <td width="10%" class="form_iname">&nbsp;</td>
            <td width="1%">&nbsp;</td>
            <td width="90%" class="val_err"></td>
          </tr>
        </table></td>
      </tr>
    </table></td>
  </tr>
  <%=objPMod.ComposeHiddenTags()%>
  <input type="hidden" name="action" value="true">
  <input type="hidden" name="rmode" value="<%=Request("rmode")%>">
  </form>
</table>
</body>
</html>
<%
'------------ RUN AFTER PAGE RENDER -----------
Set objFormCollector = Nothing
'----------------------------------------------
%>
<!--#include file="common/globals_destructor.asp"-->