Subversion Repositories DevTools

Rev

Rev 7225 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

<%@LANGUAGE="VBSCRIPT"%>
<%
'=====================================================
'       wAddBuildPlatform.asp
'=====================================================
%>
<%
Option explicit
Response.Expires = 0
%>
<!--#include file="common/conf.asp"-->
<!--#include file="common/globals.asp"-->
<!--#include file="common/formating.asp"-->
<!--#include file="common/qstr.asp"-->
<!--#include file="common/common_subs.asp"-->
<!--#include file="common/_form_window_common.asp"-->


<%
'------------ ACCESS CONTROL ------------------
%>
<!--#include file="_access_control_login.asp"-->
<!--#include file="_access_control_general.asp"-->
<%
'------------ VARIABLE DEFINITION -------------
Dim rsQry
Dim sMessage
Dim Query_String

Dim name
Dim bp_id
Dim active, activeChecked
Dim description

'------------ CONSTANTS DECLARATION -----------
'------------ VARIABLE INIT -------------------
sMessage = NULL
Set objFormCollector = CreateObject("Scripting.Dictionary")
'------------ CONDITIONS ----------------------
'----------------------------------------------
'--------------------------------------------------------------------------------------------------------------------------
Function GetMachType ()
    Dim rsQry, query
    Dim selectData

    OraDatabase.Parameters.Add "BP_ID",                 Request("bp_id"),             ORAPARM_INPUT, ORATYPE_NUMBER

    ' Where to get the selection data
    ' If this is a form re-display, then its comming from a Request
    If CBool(Request("action")) Then
        selectData = "," & Request("machType") & ","
        selectData = Replace(selectData," ","",1,-1)
    Else
        selectData = ""
        query = "SELECT bfc.gbe_id FROM build_platforms_config bfc WHERE  bfc.bp_id = :BP_ID"
        Set rsQry = OraDatabase.DbCreateDynaset( query, ORADYN_DEFAULT )
        While (NOT rsQry.BOF) AND (NOT rsQry.EOF)
            selectData = selectData & "," & rsQry("GBE_ID") 
           rsQry.MoveNext
        Wend
        rsQry.Close()
        Set rsQry = Nothing
        selectData = selectData & ","
    End If

   GetMachType = "<table>"
   query = "SELECT gm.gbe_id,gm.gbe_value FROM gbe_machtype gm ORDER BY gbe_value"

   Set rsQry = OraDatabase.DbCreateDynaset( query, ORADYN_DEFAULT )
   While (NOT rsQry.BOF) AND (NOT rsQry.EOF)
       Dim checkText
           If InStr(selectData, "," & rsQry("GBE_ID") & ",") > 0 Then
        checkText = "checked"
       else 
        checkText = ""
       End If
       GetMachType = GetMachType & "<tr class=body_txt>"
       GetMachType = GetMachType & "<td> <input type=checkbox name=machType value='"& rsQry("GBE_ID") &"' "& checkText &">" & rsQry("GBE_VALUE") & "</td>"
       GetMachType = GetMachType & "</tr>"

       rsQry.MoveNext
   Wend
   rsQry.Close()
   Set rsQry = Nothing

   OraDatabase.Parameters.Remove "BP_ID"
   GetMachType = GetMachType & "</table>"

End Function
%>
<%
'------------ RUN BEFORE PAGE RENDER ----------

If CBool(Request("action")) Then

        If Len(Request("name")) <= 0 Then
                sMessage = "Platform name must be specified"
        ElseIf Len(Request("name")) <= 3 Then
                sMessage = "Platform name is too short"
        Else
        If Request("bp_id") <> "" Then
            ' UPDATE an existing entry

            OraDatabase.Parameters.Add "BP_ID",                 Request("bp_id"),             ORAPARM_INPUT, ORATYPE_NUMBER
            OraDatabase.Parameters.Add "NAME",                          Request("name"),                  ORAPARM_INPUT, ORATYPE_VARCHAR2
            OraDatabase.Parameters.Add "DESCRIPTION",           Request("description"),       ORAPARM_INPUT, ORATYPE_VARCHAR2
            OraDatabase.Parameters.Add "ACTIVE",                Request("active"),            ORAPARM_INPUT, ORATYPE_CHAR
            OraDatabase.Parameters.Add "MACHTYPE",              Request("machType"),          ORAPARM_INPUT, ORATYPE_VARCHAR2

            Query_String = "SELECT * FROM BUILD_PLATFORMS WHERE BP_ID <> :BP_ID AND UPPER(BP_NAME) = UPPER(:NAME)"
            Set rsQry = OraDatabase.DbCreateDynaset( Query_String, cint(0))
            If rsQry.RecordCount = 0 Then

                objEH.ErrorRedirect = FALSE
                objEH.TryORA ( OraSession )
                On Error Resume Next

                OraDatabase.ExecuteSQL _
                "BEGIN  PK_BUILDAPI.UPDATE_BUILD_PLATFORM(:BP_ID, :NAME, :DESCRIPTION, :ACTIVE, :MACHTYPE);  END;"

                objEH.CatchORA ( OraSession )

            Else
                sMessage = "A Platform of that name already exists"
            End If

            OraDatabase.Parameters.Remove "BP_ID"
            OraDatabase.Parameters.Remove "NAME"
            OraDatabase.Parameters.Remove "DESCRIPTION"
            OraDatabase.Parameters.Remove "ACTIVE"
            OraDatabase.Parameters.Remove "MACHTYPE"

            rsQry.Close
            Set rsQry = nothing

            If IsNULL(sMessage) Then
                If objEH.Finally Then
                    Call OpenInParentWindow ("admin_build_platforms.asp?bp_id="&Request("bp_id"))
                    Call CloseWindow()
                End If
            End If

        Else
            ' Add A new entry
            OraDatabase.Parameters.Add "NAME",            Request("name"),          ORAPARM_INPUT, ORATYPE_VARCHAR2
            OraDatabase.Parameters.Add "DESCRIPTION",     Request("description"),   ORAPARM_INPUT, ORATYPE_VARCHAR2
            OraDatabase.Parameters.Add "ACTIVE",          Request("active"),        ORAPARM_INPUT, ORATYPE_CHAR
            OraDatabase.Parameters.Add "MACHTYPE",        Request("machType"),      ORAPARM_INPUT, ORATYPE_VARCHAR2

            Query_String = "SELECT * FROM BUILD_PLATFORMS WHERE UPPER(BP_NAME) = UPPER(:NAME)"
            Set rsQry = OraDatabase.DbCreateDynaset( Query_String, cint(0))
            If rsQry.RecordCount = 0 Then

                objEH.ErrorRedirect = FALSE
                objEH.TryORA ( OraSession )
                On Error Resume Next

                OraDatabase.ExecuteSQL _
                "BEGIN  PK_BUILDAPI.ADD_BUILD_PLATFORM(:NAME, :DESCRIPTION, :ACTIVE, :MACHTYPE);  END;"

                objEH.CatchORA ( OraSession )

            Else
                sMessage = "A Platform of that name already exists"
            End If

            OraDatabase.Parameters.Remove "NAME"
            OraDatabase.Parameters.Remove "DESCRIPTION"
            OraDatabase.Parameters.Remove "ACTIVE"
            OraDatabase.Parameters.Remove "MACHTYPE"

            rsQry.Close
            Set rsQry = nothing

            If IsNULL(sMessage) Then
              If objEH.Finally Then
                 Call OpenInParentWindow ("admin_build_platforms.asp")
                 Call CloseWindow()
              End If
            End If
        End If
    End If
End If
'----------------------------------------------
%>
<html>
<head>
<title>Release 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="images/release_manager_style.css?ver=<%=VixVerNum%>" rel="stylesheet" type="text/css">
<script language="JavaScript" src="scripts/common.js?ver=<%=VixVerNum%>"></script>
</head>
<body leftmargin="0" topmargin="0" onLoad="self.focus();FormName.name.focus();">
<table width="100%"  border="0" cellspacing="0" cellpadding="10">
   <tr>
      <td class="body_txt">
         Add a new Build Platform or edit an existing Build Platform.
      </td>
   </tr>
   <%
   '-- FROM START --------------------------------------------------------------------------------------------------------------
   objFormComponent.FormName = "FormName"
   objFormComponent.FormClass = "form_tight"
   objFormComponent.Action = ScriptName
   objFormComponent.OnSubmit = "ShowProgress();"
   Call objFormComponent.FormStart()
   %>
   <tr>
      <td class="form_field_bg" >
         <!-- NEW PRODUCT ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
         <%Call Messenger ( sMessage , 3, "100%" )%>
         <!-- MESSAGE +++++++++++++++++++++++++++++++++++++++++++++++++++ -->
         <!--#include file="messages/_msg_inline.asp"-->
         <br>
         <%
         If CBool(Request("action")) Then

            name            = Request("name")   
            active          = Request("active")   
            description     = Request("description")  
            
         ElseIf Request("bp_id") <> "" Then
            Dim rsTemp
            Query_String = "select * from build_platforms bp where bp.bp_id = "& Request("bp_id")
            Set rsTemp = OraDatabase.DbCreateDynaset( Query_String, cint(0))

            name            =   rsTemp("bp_name")
            active          =   rsTemp("bp_active")
            description     =   rsTemp("bp_description")

            rsTemp.Close()
            Set rsTemp = Nothing      
          Else
            active = "Y"
          End If
                  
          activeChecked = ""
          if active = "Y" Then activeChecked = "checked"

                  If Request("bp_id") <> "" Then%>
                        <input type="hidden" name="bp_id" value="<%=Request("bp_id")%>">
                  <%End If%>
         
         <table width="50%" border="0">
            <tr>
               <td><span class="body_txt nowrap">Platform Name</span></td>
               <td>
                  <input name="name" type="text" class="body_txt" value="<%=name%>" size=50 maxlength=50>
               </td>
            </tr>
            <tr>
               <td><span class="body_txt nowrap">Allow Use</span></td>
               <td>
                  <input type="checkbox" name="active" value="Y" <%=activeChecked%>>
                  <span class="body_txt">Allow users to add this platform to a build filter</span>
               </td>
            </tr>
            <tr>
               <td><span class="body_txt nowrap">Description</span></td>
               <td>
                  <textarea name="Description" cols=50 rows=5 class='body_txt'><%=Description%></textarea>
               </td>
            </tr>
                         <tr>
               <td><span class="body_txt nowrap">Supported<br>MachTypes</span></td>
                                <td style="border: darkgrey 1px solid;">
                                <%=GetMachType()%>
                                </td>
                         </tr>
         </table>
      </td>
   </tr>
   <tr>
      <td>
         <table class="full_table">
            <tr>
               <td><%=ProgressBar()%></td>
               <td align="right">
                  <input name="btn" type="submit" class="form_btn" value="Add/Update">
                  <input name="btn" type="reset" class="form_btn" value="Cancel" onclick="parent.closeIFrame();">
               </td>
            </tr>
         </table>
      </td>
   </tr>
   <%=objPMod.ComposeHiddenTags()%>
   <input type="hidden" name="action" value="true">
   <%
   Call objFormComponent.FormEnd()
   '-- FROM END ----------------------------------------------------------------------------------------------------------------
   %>
</table>
</body>
</html>
<%
'------------ RUN AFTER PAGE RENDER -----------
Set objFormCollector = Nothing
'----------------------------------------------
Call Destroy_All_Objects
%>