Subversion Repositories DevTools

Rev

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

<%@LANGUAGE="VBSCRIPT"%>
<%
'=====================================================
'|                                                   |
'|                                wAddNode                                               |
'|                                                   |
'=====================================================
%>
<%
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"-->
<%
'------------ ACCESS CONTROL ------------------
%>
<!--#include file="_access_control_general.asp"-->
<%
'------------ VARIABLE DEFINITION -------------
Dim objFormCollector
Dim parNode_id_list
Dim parNode_type_id
'------------ CONSTANTS DECLARATION -----------
'------------ VARIABLE INIT -------------------

Call GetMainDBParameters ( dbPARproj_id, dbPARbranch_id, dbPARbom_id, dbPARnode_id, dbPARos_id, dbPARprod_id )
parBom_id = dbPARbom_id
parNode_id_list = Request("node_id_list")
parNode_type_id = Request("node_type_id")
Set objFormCollector = CreateObject("Scripting.Dictionary")
'------------ CONDITIONS ----------------------
'----------------------------------------------
%>
<%
'--------------------------------------------------------------------------------------------------------------------------
Sub GetFormDetails ( nNodeId, ByRef outobjDetails )
        Dim rsQry, query
        
        If nNodeId <> "" Then
                OraDatabase.Parameters.Add "NODE_ID", nNodeId,  ORAPARM_INPUT, ORATYPE_NUMBER 
                Set rsQry = OraDatabase.DbCreateDynaset( "SELECT * FROM NETWORK_NODES WHERE NODE_ID = :NODE_ID", ORADYN_DEFAULT )
                OraDatabase.Parameters.Remove "NODE_ID"

                If ((NOT rsQry.BOF) AND (NOT rsQry.EOF)) Then
                        outobjDetails.Item ("node_id") = rsQry("node_id")
                        outobjDetails.Item ("node_name") = rsQry("node_name")
                        outobjDetails.Item ("node_comments") = rsQry("node_comments")
                        outobjDetails.Item ("node_type_id") = rsQry("node_type_id")
                        outobjDetails.Item ("node_version") = rsQry("node_version")
                        outobjDetails.Item ("node_life_cycle") = rsQry("node_life_cycle")
                        outobjDetails.Item ("not_xml") = rsQry("not_xml")
                Else
                        Err.Raise 8, "Sub GetFormDetails", "Empty record set returned. nNodeId="& nNodeId
                        
                End If
                
                rsQry.Close
                Set rsQry = Nothing
        End If
        
        
        If parNode_type_id <> "" Then
                
                OraDatabase.Parameters.Add "NODE_TYPE_ID", parNode_type_id,     ORAPARM_INPUT, ORATYPE_NUMBER 
                
                Set rsQry = OraDatabase.DbCreateDynaset( GetQuery("NetworkNodeTypeDetails.sql"), ORADYN_DEFAULT )
                
                If ((NOT rsQry.BOF) AND (NOT rsQry.EOF)) Then
                        outobjDetails.Item ("node_type_id")   = rsQry("node_type_id")
                        outobjDetails.Item ("node_type")   = rsQry("node_type")
                        outobjDetails.Item ("node_icon")   = rsQry("node_icon")
                        
                End If
                OraDatabase.Parameters.Remove "NODE_TYPE_ID"
                
                rsQry.Close
                Set rsQry = Nothing
        End If
        
        
End Sub
'--------------------------------------------------------------------------------------------------------------------------
Function GetNodeTypeList ( nNodeTypeId )
        Dim rsQry, query
        
        OraDatabase.Parameters.Add "NODE_TYPE_ID", nNodeTypeId,         ORAPARM_INPUT, ORATYPE_NUMBER 
        
        Set rsQry = OraDatabase.DbCreateDynaset( GetQuery ("NetworkNodeTypeCombo.sql"), ORADYN_DEFAULT )
        
        If rsQry.RecordCount > 0 Then
                GetNodeTypeList = rsQry.GetRows()
                
        Else
                GetNodeTypeList = NULL
                
        End If
        
        OraDatabase.Parameters.Remove "NODE_TYPE_ID"
        
        rsQry.Close
        Set rsQry = Nothing
End Function
'--------------------------------------------------------------------------------------------------------------------------
Sub AddNode ()
        On Error Resume Next
        
        OraDatabase.Parameters.Add "NODE_NAME",         Request("node_name"),           ORAPARM_INPUT, ORATYPE_STRING 
        OraDatabase.Parameters.Add "NODE_TYPE_ID",      Request("node_type_id"),        ORAPARM_INPUT, ORATYPE_NUMBER 
        OraDatabase.Parameters.Add "NODE_COMMENTS", Request("node_comments"),   ORAPARM_INPUT, ORATYPE_STRING 
        OraDatabase.Parameters.Add "BOM_ID",            Request("bom_id"),                      ORAPARM_INPUT, ORATYPE_NUMBER 
        OraDatabase.Parameters.Add "NOT_XML",           Request("not_xml"),     ORAPARM_INPUT, ORATYPE_VARCHAR2 
        OraDatabase.Parameters.Add "USER_ID",           objAccessControl.UserId,        ORAPARM_INPUT, ORATYPE_NUMBER 
        
        objEH.TryORA ( OraSession )
        
        OraDatabase.ExecuteSQL _
        "BEGIN pk_Network_Node.Add_Node ( :NODE_NAME, :NODE_TYPE_ID, :NODE_COMMENTS, :BOM_ID, :USER_ID, :NOT_XML ); END;"       
        
        objEH.CatchORA ( OraSession )
        
        
        OraDatabase.Parameters.Remove "NODE_NAME"
        OraDatabase.Parameters.Remove "NODE_TYPE_ID"
        OraDatabase.Parameters.Remove "NODE_COMMENTS"
        OraDatabase.Parameters.Remove "BOM_ID"
        OraDatabase.Parameters.Remove "NOT_XML"
        OraDatabase.Parameters.Remove "USER_ID"
        
End Sub
'--------------------------------------------------------------------------------------------------------------------------
Sub UpdateNode ()
        On Error Resume Next
        
        OraDatabase.Parameters.Add "NODE_ID",                           Request("node_id_list"),                ORAPARM_INPUT, ORATYPE_NUMBER 
        OraDatabase.Parameters.Add "NODE_NAME",                         Request("node_name"),           ORAPARM_INPUT, ORATYPE_STRING 
        OraDatabase.Parameters.Add "NODE_TYPE_ID",                      Request("node_type_id"),        ORAPARM_INPUT, ORATYPE_NUMBER 
        OraDatabase.Parameters.Add "NODE_COMMENTS",             Request("node_comments"),       ORAPARM_INPUT, ORATYPE_STRING 
        OraDatabase.Parameters.Add "USER_ID",                           objAccessControl.UserId,        ORAPARM_INPUT, ORATYPE_NUMBER 
        OraDatabase.Parameters.Add "NODE_LIFE_CYCLE",           Request("node_life_cycle"),     ORAPARM_INPUT, ORATYPE_NUMBER   
        OraDatabase.Parameters.Add "NOT_XML",                           Request("not_xml"),     ORAPARM_INPUT, ORATYPE_VARCHAR2 
                
        objEH.TryORA ( OraSession )
        
        OraDatabase.ExecuteSQL _
        "BEGIN pk_Network_Node.Update_Node ( :NODE_ID, :NODE_NAME, :NODE_TYPE_ID, :NODE_COMMENTS, :USER_ID, :NODE_LIFE_CYCLE, :NOT_XML ); END;" 
        
        objEH.CatchORA ( OraSession )
        
        
        OraDatabase.Parameters.Remove "NODE_ID"
        OraDatabase.Parameters.Remove "NODE_NAME"
        OraDatabase.Parameters.Remove "NODE_TYPE_ID"
        OraDatabase.Parameters.Remove "NODE_COMMENTS"
        OraDatabase.Parameters.Remove "USER_ID" 
        OraDatabase.Parameters.Remove "NODE_LIFE_CYCLE"
        OraDatabase.Parameters.Remove "NOT_XML"
        
End Sub
'--------------------------------------------------------------------------------------------------------------------------
%>
<%
'------------ RUN BEFORE PAGE RENDER ----------
' --- Get Form details from DB ---
Call GetFormDetails ( parNode_id_list, objFormCollector )

' --- Load Validation Rules ---
Call objForm.LoadValidationRules ( Array("node_name","node_comments"), OraDatabase )            ' Load Validation Rules

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

If CBool(Request("action")) Then
        If objForm.IsValidOnPostBack Then
                ' --- Form is Valid ---
                If parNode_id_list <> "" Then
                        Call UpdateNode()
                Else
                        Call AddNode()
                End If
                
                
                
                If objEH.Finally Then
                        Call OpenInParentWindow ( Request("rfile") &"?DONE=OK"& objPMod.ComposeURLWithout("rfile") )
                        Call CloseWindow()
                End If
                
        End If
End If

'----------------------------------------------
%>
<html>
<head>
<title>Deployment 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/deployment_manager.css?ver=<%=VixVerNum%>" rel="stylesheet" type="text/css">
<script language="JavaScript" src="scripts/common.js?ver=<%=VixVerNum%>"></script>
</head>

<body background="images/bg_bage_0.gif" leftmargin="0" topmargin="0" onLoad="self.focus();FormName.node_name.focus();">
<table width="100%"  border="0" cellspacing="0" cellpadding="10">
  <tr>
    <td bgcolor="#FFFFFF" class="body_txt"><span class="body_h1"><img src="icons/i_linkarrow_black.gif" width="11" height="11" align="absmiddle">&nbsp;Network Node</span> <br>
    Enter Node name and optional comments. 
    </td>
  </tr>
  <%
  '-- FROM START ---------------------------------------------------------------------------------------------------------
  objFormComponent.FormName = "FormName"
  objFormComponent.Action = SCRIPT_NAME
  objFormComponent.OnSubmit = "ShowProgress();"
  Call objFormComponent.FormStart()
  %> 
  <tr>
    <td background="images/bg_login.gif"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td><%=ProgressBar%></td>
        <td align="right"><input name="btn" type="submit" class="form_btn" value="Submit">
          <input name="btn" type="reset" class="form_btn" value="Cancel" onClick="self.close();"></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td>
        <!-- MESSAGE +++++++++++++++++++++++++++++++++++++++++++++++++++ -->    
        <!--#include file="messages/_msg_inline.asp"-->
    <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
        <table width="100%"  border="0" cellspacing="2" cellpadding="0">
      <tr>
        <td valign="top" nowrap class="form_iname">Node Type </td>
        <td valign="top" class="body_txt">
                <%If parNode_type_id <> "" Then%>
                        <img src="icons/<%=objFormCollector.Item ("node_icon")%>" hspace="2" vspace="2" border="0" align="absmiddle"><%=objFormCollector.Item ("node_type")%>
                        <input type="hidden" name="node_type_id" value="<%=parNode_type_id%>">
                <%Else%>
                        <%=objFormComponent.Combo ( "node_type_id", GetNodeTypeList( objForm.GetValue( "node_type_id", objFormCollector.Item("node_type_id") ) ), FALSE, "class='form_ivalue'" )%>
                <%End If%>
                </td>
                <td valign="top"></td>
      </tr>
      <tr>
        <td nowrap class="form_iname" valign="top">Node Name </td>
        <td valign="top"><%=objFormComponent.TextBox ( "node_name", objForm.GetValue( "node_name", objFormCollector.Item("node_name") ), "size='60' class='form_ivalue'" )%></td>
                <td valign="top"><%=objForm.Validate ("node_name")%></td>
      </tr>
<%If objFormCollector.Item("node_version") <> "" Then %>                  
      <tr>
        <td nowrap class="form_iname" valign="top">Node Version </td>
        <td valign="top"><%=objFormComponent.TextBox ( "node_version", objForm.GetValue( "node_version", objFormCollector.Item("node_version") ), "size='60' class='form_ivalue' disabled" )%></td>
      </tr>
      <tr>
        <td nowrap class="form_iname" valign="top">Node LifeCycle </td>
        <td valign="top"><%=objFormComponent.TextBox ( "node_life_cycle", objForm.GetValue( "node_life_cycle", objFormCollector.Item("node_life_cycle") ), "size='60' class='form_ivalue'" )%></td>
      </tr>               
<%End If%>      
          <tr>
        <td nowrap class="form_iname" valign="top">Checked If Not Required In XML</td>
                <%If IsNull(objFormCollector.Item("not_xml")) Then%>
        <td valign="top"><input type="checkbox" name="not_xml"></td>
                <%Else%>
        <td valign="top"><input type="checkbox" name="not_xml" checked></td>
                <%End If%>
                <td valign="top"></td>
      </tr>        
      <tr>
        <td valign="top" nowrap class="form_iname">Comments</td>
        <td valign="top"><%=objFormComponent.TextArea ( "node_comments", objForm.GetValue( "node_comments", objFormCollector.Item("node_comments") ), 10, 60, "class='form_ivalue'" )%></td>
                <td valign="top"><%=objForm.Validate ("node_comments")%></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>
  <%=objPMod.ComposeHiddenTagsWithout("bom_id")%>
  <input type="hidden" name="node_id_list" value="<%=parNode_id_list%>">
  <input type="hidden" name="bom_id" value="<%=parBom_id%>">
  <input type="hidden" name="action" value="true">
  <%
  Call objFormComponent.FormEnd()
  '-- FROM END ----------------------------------------------------------------------------------------------------------------
  %>
</table>
</body>
</html>
<!--#include file="common/globals_destructor.asp"-->