Subversion Repositories DevTools

Rev

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

<%@LANGUAGE="VBSCRIPT"%>
<%
'=====================================================
'   wAddDaemonInstruction.asp
'   
'   This page is designed to be loaded into an iframe
'
'=====================================================
%>
<%
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"-->
<!--#include file="common/common_dbedit.asp"-->
<!--#include file="common/daemon_instructions.asp"-->
<%
'------------ ACCESS CONTROL ------------------
%>
<!--#include file="_access_control_login.asp"-->
<!--#include file="_access_control_general.asp"-->
<%
'------------ VARIABLE DEFINITION -------------
Dim sMessage, sMessageType
Dim parProj_id
Dim parPv_id
Dim parOp_code
Dim parRepeat
Dim parInst_id
Dim parSchDateTime
Dim parRfile
Dim bHideRepeat
Dim bHidePackages
Dim bPreventSubmit
Dim parSortOrder
Dim ReleaseMode

'------------ VARIABLE INIT -------------------
sMessage = NULL
sMessageType = 3
bPreventSubmit = False

' collect all parameters from query string
parOp_code = Request("op_code")
parProj_id = Request("proj_id")
parPv_id = Request("pv_id")
parRepeat = Request("repeat")
parInst_id = Request("inst_id")
parSchDateTime = Request("sdt")
parRfile = Request("rfile")
ReleaseMode = GetReleaseMode(parRtag_id)

parSortOrder = Request("sort")
If IsNull(parSortOrder) OR parSortOrder = "" Then
   parSortOrder = "0"
End If

Set objFormCollector = CreateObject("Scripting.Dictionary")

'------------------------------------------------------------------------------------------------------------------------------------------
'
' Add a line of text to the System Message
'
Sub sMessageAdd(eLevel, text)
    If NOT isNull(sMessage) Then
        sMessage = sMessage & "<br>"
    End If
    sMessage = sMessage & text

    If eLevel < sMessageType  Then
        sMessageType = eLevel
    End If
End Sub
'------------------------------------------------------------------------------------------------------------------------------------------
' For the specified project ID, get a list of all that project's releases that are not closed/archived.
' Return True if at least one release was found, else False
'------------------------------------------------------------------------------------------------------------------------------------------
Function ReleasesAvailable(NNproj_id)
   Dim rsTemp, Query_String

   ReleasesAvailable = True
   Query_String = "SELECT rtag_id, rtag_name "&_
                  "  FROM release_tags rt"&_
                  " WHERE rt.proj_id = "& NNproj_id &_
                  "   AND ((rt.official = 'N') OR (rt.official = 'C') OR (rt.official = 'R'))"

        Set rsTemp = OraDatabase.DbCreateDynaset( Query_String, cint(0))
   If rsTemp.RecordCount = 0 Then
      ReleasesAvailable = False
   End If

   rsTemp.Close
   Set rsTemp = nothing
End Function
'------------------------------------------------------------------------------------------------------------------------------------------
' For the specified Release, get a list of all that release's daemon configurations.
' Return True if at least one daemon configuration was found, else False
'------------------------------------------------------------------------------------------------------------------------------------------
Function DaemonsAvailable(NNrtag_id)
   Dim rsTemp, Query_String

   DaemonsAvailable = True
   Query_String = "SELECT * "&_
                  "  FROM release_config rc"&_
                  " WHERE rc.rtag_id = "& NNrtag_id
        Set rsTemp = OraDatabase.DbCreateDynaset( Query_String, cint(0))
   If rsTemp.RecordCount = 0 Then
      DaemonsAvailable = False
   End If

   rsTemp.Close
   Set rsTemp = nothing
End Function
'------------------------------------------------------------------------------------------------------------------------------------------
' Formulate the HTML for a combo box listing all the daemon instruction operations, and select the one that matches
' the op-code passed in as a parameter. If the parameter value could not be found, correct it to the first valid op-code
' in the list.
'------------------------------------------------------------------------------------------------------------------------------------------
Function Get_OpCodes ( NNop_code )
   Dim op_code_str_array
   Dim op_code_str
   Dim op_code_val
        Dim selectedFound
   Dim tempLINK
   Dim s

   selectedFound = False

   ' Get the op-codes in terms of human readable string names - these will be used in the drop down select list
   Call GetDaemonInstructionOperationNameArray(op_code_str_array)

   s = "<td width='20%' align='left' class='nowrap'>Operation</td>"
   s = s + "<td align='left'><select name='op_code_list' id='op_code_list' class='form_item' onchange=""MM_jumpMenu('document',this,0)"">"

   For each op_code_str in op_code_str_array

      ' get equivalent op-code value for this op-code string
      op_code_val = DaemonInstructionOperationValue(op_code_str)

      tempLINK = scriptName & "?inst_id="& parInst_id &_
                              "&op_code="& op_code_val &_
                              "&rtag_id=" & parRtag_id &_
                              "&pv_id=" & parPv_id &_
                              "&sort=" & parSortOrder &_
                              "&sdt="& parSchDateTime &_
                              "&repeat="& parRepeat &_
                              "&rfile="& parRfile

      If ((NNop_code = op_code_val) OR (NNop_code = "0")) AND (selectedFound = False) Then
         s = s + "<option value='"& tempLINK &"' selected>"& op_code_str &"</option>"
         selectedFound = True
         NNop_code = op_code_val
      Else
         s = s + "<option value='"& tempLINK &"'>"& op_code_str &"</option>"
      End If
   Next

   s = s + "</select></td>"
   Get_OpCodes = s
End Function
'------------------------------------------------------------------------------------------------------------------------------------------
' Formulate the HTML for a combo box listing all the Projects, and select the one that matches
' the proj-id passed in as a parameter. If the parameter value could not be found, correct it to the first valid proj-id
' in the list.
'------------------------------------------------------------------------------------------------------------------------------------------
Function Get_Projects ( NNproj_id )
   Dim rsTemp, Query_String, projName, tempLINK, selectedFound, s

   selectedFound = False
   Query_String = "SELECT * FROM projects ORDER BY  UPPER( proj_name )"

   Set rsTemp = OraDatabase.DbCreateDynaset( Query_String, cint(0))

   s = "<td class='nowrap'>Project</td>"
   s = s + "<td><select id='proj_id_list' name='proj_id_list' class='form_item' onChange=""MM_jumpMenu('document',this,0)"">"

   While ((NOT rsTemp.BOF) AND (NOT rsTemp.EOF))
      projName = UCase(rsTemp.Fields("proj_name"))

      tempLINK = scriptName & "?inst_id="& parInst_id &_
                              "&op_code="& parOp_code &_
                              "&proj_id=" & rsTemp.Fields("proj_id") &_
                              "&sdt="& parSchDateTime &_
                              "&repeat="& parRepeat &_
                              "&sort=" & parSortOrder &_
                              "&rfile="& parRfile

      If ((NNproj_id = Cstr(rsTemp.Fields("proj_id"))) OR (NNproj_id = "0")) AND (selectedFound = False) Then
         s = s + "<option value='"& tempLINK &"' selected>"& projName &"</option>"
         selectedFound = True
         NNproj_id = CStr(rsTemp.Fields("proj_id"))
      Else
         s = s + "<option value='"& tempLINK &"'>"& projName &"</option>"
      End If

      rsTemp.MoveNext
   WEnd
   s = s + "</select>"

   ' Correct for a situation where selectedFound is still FALSE.
   If NOT selectedFound Then
      rsTemp.MoveFirst
      If ((NOT rsTemp.BOF) AND (NOT rsTemp.EOF)) Then
         NNproj_id = CStr(rsTemp.Fields("proj_id"))
      Else
         NNproj_id = "0"
      End If
   End If

   rsTemp.Close
   Set rsTemp = nothing

   s = s + "</td>"

   Get_Projects = s
End Function

'------------------------------------------------------------------------------------------------------------------------------------------
' Formulate the HTML for a combo box listing all the Release for a specified project, and select the one that matches
' the release-tag passed in as a parameter. If the parameter value could not be found, correct it to the first valid release-tag
' in the list.
'------------------------------------------------------------------------------------------------------------------------------------------
Function Get_Releases ( NNproj_id, NNrtag_id )
   Dim rsTemp, Query_String, releaseName, tempLINK, selectedFound, s, numReleases

   selectedFound = False

   numReleases = 0

   Query_String = "SELECT rtag_id, rtag_name "&_
                  "  FROM release_tags rt"&_
                  " WHERE rt.proj_id = "& NNproj_id &_
                  "   AND ((rt.official = 'N') OR (rt.official = 'C') OR (rt.official = 'R'))"&_
                  " ORDER BY UPPER(rtag_name)"
        Set rsTemp = OraDatabase.DbCreateDynaset( Query_String, cint(0))

   s = "<td class='nowrap'>Release</td>"
   s = s + "<td><select id='rtag_id_list' name='rtag_id_list' class='form_item' onChange=""MM_jumpMenu('document',this,0)"">"

   While ((NOT rsTemp.BOF) AND (NOT rsTemp.EOF))
      releaseName = rsTemp.Fields("rtag_name")

      tempLINK = scriptName & "?inst_id="& parInst_id &_
                              "&op_code="& parOp_code &_
                              "&proj_id="& NNproj_id &_
                              "&rtag_id="& rsTemp.Fields("rtag_id") &_
                              "&sdt="& parSchDateTime &_
                              "&repeat="& parRepeat &_
                              "&sort=" & parSortOrder &_
                              "&rfile="& parRfile

      If ((NNrtag_id = CStr(rsTemp.Fields("rtag_id"))) OR (NNrtag_id = "0")) AND (selectedFound = False) Then
            s = s + "<option value='"& tempLINK &"' selected>"& releaseName &"</option>"
         selectedFound = True
         NNrtag_id = Cstr(rsTemp.Fields("rtag_id"))
      Else
         s = s + "<option value='"& tempLINK &"'>"& releaseName &"</option>"
      End If

      numReleases = numReleases + 1

      rsTemp.MoveNext
   WEnd
   s = s + "</select>"

   ' Correct for a situation where selectedFound is still FALSE.
   If NOT selectedFound Then
      rsTemp.MoveFirst
      If ((NOT rsTemp.BOF) AND (NOT rsTemp.EOF)) Then
         NNrtag_id = CStr(rsTemp.Fields("rtag_id"))
      Else
         NNrtag_id = "0"
      End If
   End If

   ' If no releases were found then replace drop down list with some warning text and disable form submission
   If numReleases = 0 Then
      bPreventSubmit = True
      s = "<td class='nowrap'>Release</td><td><a style=color:Red>WARNING: No active releases found. The operation cannot be performed.</a></td>"
   Else
      ' If the selected release does not have a daemon configuration, append some warning text to the right of the drop down list.
      If DaemonsAvailable(NNrtag_id) = False Then
         s = s + "<a style=color:Red>WARNING: Release has no build daemon(s)</a>"
      End If
   End If

   rsTemp.Close
   Set rsTemp = nothing

   s = s + "</td>"

   Get_Releases = s
End Function
'------------------------------------------------------------------------------------------------------------------------------------------
' Formulate the HTML for a combo box listing all the Package Versions in a specified release, and select the one that matches
' the pv_id passed in as a parameter. If the parameter value could not be found, correct it to the first valid pv_id
' in the list.
' This function must deal with op-codes that want to read package versions from the work_in_progress table, and op-codes
' that need to read package versions from the release_content table.
' The function should only be called if a package versions drop down list is required for the form.
'------------------------------------------------------------------------------------------------------------------------------------------
Function Get_Packages ( NNrtag_id, NNpv_id, NNop_code )
   Dim rsTemp, Query_String, pkgName, tempLINK, selectedFound, s, numPackages

   selectedFound = False

   numPackages = 0

   If (NNop_code = OP_CODE_1_TEST_BUILD_PACKAGE) Then
      ' Get list of packages from from work_in_progress table
      Query_String = "SELECT pk.pkg_id, pk.pkg_name, pv.pkg_version, wip.pv_id "&_
                     "  FROM work_in_progress wip, release_tags rt, packages pk, package_versions pv "&_
                     " WHERE wip.rtag_id = "& Cstr(NNrtag_id) &_
                     "   AND wip.rtag_id = rt.rtag_id"&_
                     "   AND ((rt.official = 'N') OR (rt.official = 'C') OR (rt.official = 'R'))"&_
                     "   AND wip.pv_id = pv.pv_id"&_
                     "   AND pk.pkg_id = pv.pkg_id"&_
                     " ORDER BY UPPER(pkg_name)"

   Else
      ' Get list of packages from from release_content table
      Query_String = "SELECT pk.pkg_id, pk.pkg_name, pv.pkg_version, rc.pv_id "&_
                     "  FROM release_content rc, release_tags rt, packages pk, package_versions pv "&_
                     " WHERE rc.rtag_id = "& Cstr(NNrtag_id) &_
                     "   AND rc.rtag_id = rt.rtag_id"&_
                     "   AND ((rt.official = 'N') OR (rt.official = 'C') OR (rt.official = 'R'))"&_
                     "   AND rc.pv_id = pv.pv_id"&_
                     "   AND pk.pkg_id = pv.pkg_id"&_
                     " ORDER BY UPPER(pkg_name)"
   End If

        Set rsTemp = OraDatabase.DbCreateDynaset( Query_String, cint(0))

   ' modify the control heading to indicate the source of the package version list
   If (NNop_code = OP_CODE_1_TEST_BUILD_PACKAGE) Then
      s = "<td class='nowrap'>WIP Package</td>"
   Else
      s = "<td class='nowrap'>Released Package</td>"
   End If

   s = s + "<td><select id='pv_id_list' name='pv_id_list' class='form_item' onChange=""MM_jumpMenu('document',this,0)"">"
   While ((NOT rsTemp.BOF) AND (NOT rsTemp.EOF))
      pkgName = rsTemp.Fields("pkg_name") & " " & rsTemp.Fields("pkg_version")

      tempLINK = scriptName & "?inst_id="& parInst_id &_
                              "&op_code="& NNop_code &_
                              "&proj_id="& parProj_id &_
                              "&rtag_id="& NNrtag_id &_
                              "&pv_id="&   rsTemp.Fields("pv_id") &_
                              "&sdt="& parSchDateTime &_
                              "&repeat="& parRepeat &_
                              "&sort=" & parSortOrder &_
                              "&rfile="& parRfile

      If ((NNpv_id = Cstr(rsTemp.Fields("pv_id"))) OR (NNpv_id = "0")) AND (selectedFound = False) Then
         s = s + "<option value='"& tempLINK &"' selected>"& pkgName &"</option>"
         selectedFound = True
         NNpv_id = CStr(rsTemp.Fields("pv_id"))
      Else
         s = s + "<option value='"& tempLINK &"'>"& pkgName &"</option>"
      End If

      numPackages = numPackages + 1

      rsTemp.MoveNext
   WEnd
   s = s + "</select></td>"

   ' Correct for a situation where selectedFound is still FALSE.
   If NOT selectedFound Then
      rsTemp.MoveFirst
      If ((NOT rsTemp.BOF) AND (NOT rsTemp.EOF)) Then
         NNpv_id = Cstr(rsTemp.Fields("pv_id"))
      Else
         NNpv_id = "0"
      End If
   End If

   ' replace drop down list with a warning if no package versions were found, and ensure that the user cannot submit the form
   If numPackages = 0 Then
      bPreventSubmit = True
      If (NNop_code = OP_CODE_1_TEST_BUILD_PACKAGE) Then
         s = "<td>Package</td><td><a style=color:Red>WARNING: No WIP package versions found. The operation cannot be performed.</a></td>"
      Else
         s = "<td>Package</td><td><a style=color:Red>WARNING: No released package versions found. The operation cannot be performed.</a></td>"
      End If
   End If

   rsTemp.Close
   Set rsTemp = nothing

   Get_Packages = s
End Function

'------------------------------------------------------------------------------------------------------------------------------------------
' This function will be called if and only if the form is first opened in circumstances where the user is editing an existing record
' and all of the form's parameters must be set to the values found in that record. The database record must be obtained using a query
' and the relevant parameters assigned from the record fields
'------------------------------------------------------------------------------------------------------------------------------------------
Sub Get_All_Params_From_Inst_Id(NNInstId)
   Dim rsTemp, Query_String

   Query_String = "SELECT op_code, rtag_id, pv_id, repeat_secs, "&_
                  "  TO_CHAR(scheduled_datetime, 'DD-MM-YYYY HH24:MI:SS') AS schedDate "&_
                  "  FROM DAEMON_INSTRUCTIONS "&_
                  " WHERE DAEMON_INSTRUCTIONS_ID = " & NNInstId
        Set rsTemp = OraDatabase.DbCreateDynaset( Query_String, cint(0))
   If rstemp.RecordCount = 0 Then
      Call sMessageAdd(1, "Attempt to Edit a non-existent record")
      Exit Sub
   End If

   ' assign record fields to global parameters
   parOp_code = rsTemp("op_code")
   parRtag_id = rsTemp("rtag_id")
   parPv_id   = rsTemp("pv_id")
   parRepeat  = rsTemp("repeat_secs")
   parSchDateTime = rsTemp("schedDate")

   ' derive project id since that is not stored in the table
   If NOT IsNull(parRtag_id) AND parRtag_id <> "" Then
      parProj_id = Get_Proj_ID(parRtag_id)
   Else
      parProj_id = "0"
   End If

   rsTemp.Close
   Set rsTemp = nothing
End Sub
'------------------------------------------------------------------------------------------------------------------------------------------
'   Perform any form callback actions
'   This is implemented in a subroutine to simplify error handling
'
Sub performActions
    ' Check if form submit is happening
    If CBool(Request("action")) Then

       Dim RepeatSeconds
       Dim ScheduledDateTime

       ' determine if insert/update is enabled by permissions
       If NOT UserCanAddOrEditThisDaemonInst(parProj_id, ReleaseMode, parOp_code) Then
          ' redirect to an error message
          Call sMessageAdd (1, "You have been denied permission to add/update daemon instructions for the specified release.")
          Exit Sub
       End If

       ' do daemon instruction validation, continuing only if it passes
       If ValidateDaemonInstruction(parOp_code, parRtag_id, parPv_id) = True Then

          ' Setup the repeat seconds count according to the radio button value
          If IsNull(Request("repeat_inst")) OR Request("repeat_inst") = "" OR Request("repeat_inst") = "No" Then
             RepeatSeconds = 0
          Else
             RepeatSeconds = 86400
          End If

          ' If user has not entered a scheduled time, set the scheduled date/time to now
          ScheduledDateTime = Request("scheduled_time")
          If IsNull(ScheduledDateTime) OR ScheduledDateTime = "" Then
             ScheduledDateTime = ORA_SYSDATETIME
          Else
             ScheduledDateTime = "TO_DATE( '"& ScheduledDateTime &"','DY DD-MON-YYYY HH24:MI' )"
          End If

          ' nullify parPv_id for the SQL, if the instruction op-code does not require one
          If bHidePackages Then
             parPv_id = "NULL"
          End If


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

          ' if the page has been provided an inst_id, we must be editing an existing record so we do an update
          If (NOT IsNull(parInst_id)) AND (parInst_id <> "") Then
             ' We are updating an existing record
             OraDatabase.ExecuteSQL "BEGIN PK_BUILDAPI.update_daemon_inst( "& parInst_id & ", " &_
                                                                            parOp_code & ", " &_
                                                                            parRtag_id & ", " &_
                                                                            parPv_id & ", " &_
                                                                            ScheduledDateTime & ", " &_
                                                                            CStr(RepeatSeconds) & ", " &_
                                                                            ORA_SYSDATETIME & ", " &_
                                                                            objAccessControl.UserId & "); END;"
          Else ' We are adding a new record
             OraDatabase.ExecuteSQL "BEGIN PK_BUILDAPI.insert_daemon_inst( "& parOp_code & ", " &_
                                                                            parRtag_id & ", " &_
                                                                            parPv_id & ", " &_
                                                                            ScheduledDateTime & ", " &_
                                                                            CStr(RepeatSeconds) & ", " &_
                                                                            ORA_SYSDATETIME & ", " &_
                                                                            objAccessControl.UserId & "); END;"
          End If

         objEH.CatchORA ( OraSession )

         '  If the operation was succesful, then redirect the parent
         '  This will also close the iframe
         '
         '  If an error has occured, then an error message will be displayed within the iframe
         ' via the _msg_inline.asp processing when the page is re-displayed
         '
         If objEH.Finally Then
            If parRfile = "admin_daemon_instructions.asp" Then
               Call OpenInParentWindow (parRfile & "?sort=" & parSortOrder)
            Else
               Call OpenInParentWindow (parRfile & "?rtag_id=" & parRtag_id & "&pv_id=" & parPv_id)
            End If
            Call CloseWindow
         End If
       End If
    End If
End Sub
%>
<%
'------------ RUN BEFORE PAGE RENDER ----------
'
' Access Control
If NOT objAccessControl.UserLogedIn Then
    Call sMessageAdd ( 1, "User is no longer logged in")
ElseIf NOT UserCanAddOrEditThisDaemonInst(DB_PROJ_ID, ReleaseMode, parOp_code) Then
    Call sMessageAdd ( 1, "You have been denied permission to add/update daemon instructions for the specified release." )
End If

' Are we in edit mode? If so, populate all parameters from the record being edited
If (NOT IsNull(parInst_id)) AND (parInst_id <> "") AND (Request("edit") = "true") Then
   If NOT DaemonInstructionInProgress(Request("inst_id")) Then
      Call Get_All_Params_From_Inst_Id(parInst_id)
   Else
      Call sMessageAdd(1,"Cannot edit an instruction that is currently being processed by a Daemon")
   End If
End If

' Make sure we dont have any null strings or empty strings for our parameters
If IsNull(parOp_code) OR parOp_code = "" Then
   parOp_code = "0"
End If
If IsNull(parProj_id) OR parProj_id = "" Then
   parProj_id = "0"
End If
If IsNull(parRtag_id) OR parRtag_id = "" Then
   parRtag_id = "0"
End If
If IsNull(parPv_id) OR parPv_id = "" Then
   parPv_id = "0"
End If
If IsNull(parRepeat) OR parRepeat = "" Then
   parRepeat = "0"
End If
If IsNull(parRfile) OR parRfile = "" Then
   parRfile = "admin_daemon_instructions.asp"
End If

If IsNull(parSchDateTime) OR parSchDateTime = "" Then
   parSchDateTime = DisplayShortDateTimeSecs(Now())
End If

' If this form is opened with an OP_CODE, RTAG_ID and PV_ID only, then we need to derive the PROJ_ID before
' calling Get_Projects() to generate the project drop down list.
If parProj_id = "0" AND NOT IsNull(parRtag_id) AND parRtag_id <> "" AND parRtag_id <> "0" Then
   parProj_id = Get_Proj_ID(parRtag_id)
End If

' Hide the Package drop-down list if the Daemon Instruction does not require it
If DaemonInstructionNeedsPV_ID(parOp_code) Then
   bHidePackages = False
Else
   bHidePackages = True
   parPv_id = "0"
End If
' NOTE: from this moment on, any real use of parPv_id has to be guarded by examination of bHidePackages


' Hide the Repeat buttons if the Daemon Instruction does not require them
If DaemonInstructionNeedsRepeat(parOp_code) Then
   bHideRepeat = False
Else
   bHideRepeat = True
End If

' Call some 'Get' procedures without HTML generation to determine the values of parProj_id, par_Rtag_id, and parPv_id
' in case they are not currently present in the query string. This will then allow the use of the ReleasesAvailable() and
' DaemonsAvailable() functions further below to hide the form submit button.
' It will also support the submit action itself when it takes place during the editing of an existing record where
' the user changes (for example) the project without making any changes to release or package and so those items
' are nullified and must be reset to something other than their original values that came through the query string
' when the edit form was just opened.
Call Get_Projects(parProj_id)                  ' Ensures parProj_id has a good value
Call Get_Releases(parProj_id, parRtag_id)      ' Ensures parRtag_id has a good value

If NOT bHidePackages Then
   Call Get_Packages (parRtag_id, parPv_id, parOp_code)
End If

' Perform any required actions
Call performActions

'----------------------------------------------
%>
<script language="JavaScript" type="text/javascript">
<!--

// This function is designed to be called when a repeat radio button is pressed. It reloads the page with an updated query string
// to reflect the new setting of the radio button set
function Refresh_Repeat(newRepeat)
{
   var s;
   s  = '<%=scriptName%>';
   s += '?inst_id=' + document.getElementById('inst_id').value;
   s += '&op_code=' + document.getElementById('op_code').value;
   s += '&proj_id=' + document.getElementById('proj_id').value;
   s += '&rtag_id=' + document.getElementById('rtag_id').value;
   s += '&pv_id='   + document.getElementById('pv_id').value;
   s += '&sort='    + document.getElementById('sortOrder').value;
   s += '&sdt='     + document.getElementById('scheduled_time').value;
   s += '&repeat='  + newRepeat;
   s += '&rfile='   + document.getElementById('rfile').value;

   document.location = s;
}

//-->
</script>

<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" rel="stylesheet" type="text/css">
      <script language="JavaScript" src="scripts/common.js"></script>
      <%bJqueryTimePicker = TRUE%>
      <!--#include file="_jquery_includes.asp"-->
    <script>
    $(document).ready(function(){
        var myDateTimePicker = null;
        $('#scheduled_time').datetimepicker({
                timeFormat: "HH:mm",
            dateFormat: "D dd-M-yy",
                controlType: 'select',
                oneLine: true,
                timeInput: true,
            constrainInput: true,
            showOn: 'both',
            buttonImageOnly : true,
            buttonImage: "images/cal.gif",
            buttonText: "Select Date and Time",
            minDate : 0,
                onClose : function(p1,p2){
                         //console.log("scheduled_time", p1 );
                        },
            });
        })
    </script>
    <style>
        #ui-datepicker-div {
            position: absolute !important;
            top: 0px !important;
            left: 0px !important;
            }
    </style>
   </head>

   <body background="images/bg_bage_0.gif" leftmargin="0" topmargin="0" >
      <table class="full_table">
         <%
         '-- FROM START --------------------------------------------------------------------------------------------------------------
         objFormComponent.FormName = "DaemonInstruction"
         objFormComponent.FormClass = "form_tight"
         objFormComponent.Action = ScriptName &_
                                   "?inst_id="& parInst_id &_
                                   "&op_code="& parOp_code &_
                                   "&proj_id="& parProj_id &_
                                   "&rtag_id="& parRtag_id &_
                                   "&pv_id="&   parPv_id &_
                                   "&sort="&    parSortOrder &_
                                   "&rfile="& parRfile
         objFormComponent.OnSubmit = "ShowProgress();"
         Call objFormComponent.FormStart()
         %>
         <tr>
            <td>
               <!-- MESSAGE +++++++++++++++++++++++++++++++++++++++++++++++ -->
               <%Call Messenger ( sMessage , sMessageType, "100%" )%>
               <!-- MESSAGE +++++++++++++++++++++++++++++++++++++++++++++++++++ -->
               <!--#include file="messages/_msg_inline.asp"-->
               <table class="full_table form_item">
                  <tr>
                     <td width="1%" class="nowrap">
                        <%=Get_OpCodes(parOp_code)%>
                     </td>
                  </tr>
                  <tr><td>&nbsp;</td></tr>
                  <tr>
                     <td class="nowrap">
                        <div id="SelectProject" style="visibility:visible">
                           <%=Get_Projects(parProj_id)%>
                        </div>
                     </td>
                  </tr>
                  <tr>
                     <td class="nowrap">
                        <div id="SelectRelease" style="visibility:visible">
                           <%=Get_Releases(parProj_id, parRtag_id)%>
                        </div>
                     </td>
                  </tr>

                  <%If NOT bHidePackages Then%>
                  <tr>
                     <td class="nowrap">
                        <div id="SelectPackageVersion" style="visibility:visible">
                           <%=Get_Packages ( parRtag_id, parPv_id, parOp_code )%>
                        </div>
                     </td>
                  </tr>
                  <%End If%>

                  <tr><td>&nbsp;</td></tr>
                  <tr>
                     <td>
                        <td class="nowrap">Scheduled Time</td>
                        <td>
                           <input type="text" id="scheduled_time" name="scheduled_time" size="25" class="form_ivalue" value="<%=DisplayDateTime(parSchDateTime)%>">
                        </td>
                     </td>
                  </tr>

                  <%If NOT bHideRepeat Then%>
                     <tr>
                        <td>
                           <td>Repeat</td>
                           <td>
                              <input type="radio" name="repeat_inst" id="repeat_inst_no"     value="No"   <%If parRepeat =     "0" Then%>checked<%End If%> onchange='Refresh_Repeat(0)'     >No
                              <input type="radio" name="repeat_inst" id="repeat_inst_24hrs"  value="24Hrs"<%If parRepeat = "86400" Then%>checked<%End If%> onchange='Refresh_Repeat(86400)' >24 Hrs
                           </td>
                        </td>
                     </tr>
                  <%End If%>
                  <tr>
                    <td style="height:100px">
                    </td>
                  </tr>
                 <tr>
                    <td background="images/bg_login.gif" colspan=3>
                       <table class="full_table">
                          <tr>
                             <td><%=ProgressBar()%></td>
                             <td align="right" >
                                <%
                                Dim disableText : disableText = ""
                                If NOT (ReleasesAvailable(parProj_id) AND DaemonsAvailable(parRtag_id) AND NOT bPreventSubmit AND IsNull(sMessage)) Then
                                    disableText = "disabled=""disabled"""
                                End If
                                %>
                                <button name="btn" type="submit" <%=disableText%>>Add/Update</button>
                                <button name="btn" type="reset" onclick="parent.closeIFrame();">Cancel</button>
                             </td>
                          </tr>
                       </table>
                    </td>
                 </tr>
                  <tr>
                     <td>
                        <input type="hidden" id="inst_id"     name="inst_id"      value="<%=parInst_id%>">
                        <input type="hidden" id="op_code"     name="op_code"      value="<%=parOp_code%>">
                        <input type="hidden" id="proj_id"     name="proj_id"      value="<%=parProj_id%>">
                        <input type="hidden" id="rtag_id"     name="rtag_id"      value="<%=parRtag_id%>">
                        <input type="hidden" id="pv_id"       name="pv_id"        value="<%=parPv_id%>">
                        <input type="hidden" id="repeat_secs" name="repeat_secs"  value="<%=parRepeat%>">
                        <input type="hidden" id="rfile"       name="rfile"        value="<%=parRfile%>">
                        <input type="hidden" id="sortOrder"   name="sortOrder"    value="<%=parSortOrder%>">
                     </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
%>