Subversion Repositories DevTools

Rev

Rev 6676 | Rev 6696 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
5549 dpurdie 1
<%@LANGUAGE="VBSCRIPT"%>
2
<%
3
'=====================================================
5560 dpurdie 4
'   wAddDaemonInstruction.asp
5
'   
6
'   This page is designed to be loaded into an iframe
7
'
5549 dpurdie 8
'=====================================================
9
%>
10
<%
11
Option explicit
12
Response.Expires = 0
13
%>
14
<!--#include file="common/conf.asp"-->
15
<!--#include file="common/globals.asp"-->
16
<!--#include file="common/formating.asp"-->
17
<!--#include file="common/qstr.asp"-->
18
<!--#include file="common/common_subs.asp"-->
19
<!--#include file="common/_form_window_common.asp"-->
20
<!--#include file="common/common_dbedit.asp"-->
21
<!--#include file="common/daemon_instructions.asp"-->
22
<%
23
'------------ ACCESS CONTROL ------------------
24
%>
6181 dpurdie 25
<!--#include file="_access_control_login_optional.asp"-->
5549 dpurdie 26
<!--#include file="_access_control_general.asp"-->
27
<%
28
'------------ VARIABLE DEFINITION -------------
29
Dim sMessage, sMessageType
5560 dpurdie 30
Dim parProj_id
5549 dpurdie 31
Dim parPv_id
32
Dim parOp_code
5560 dpurdie 33
Dim parRepeat
34
Dim parInst_id
35
Dim parSchDateTime
5549 dpurdie 36
Dim parRfile
5560 dpurdie 37
Dim bHideRepeat
38
Dim bHidePackages
5549 dpurdie 39
Dim bPreventSubmit
5560 dpurdie 40
Dim parSortOrder
41
Dim ReleaseMode
5549 dpurdie 42
 
43
'------------ VARIABLE INIT -------------------
44
sMessage = NULL
45
sMessageType = 3
46
bPreventSubmit = False
47
 
48
' collect all parameters from query string
5560 dpurdie 49
parOp_code = Request("op_code")
50
parProj_id = Request("proj_id")
5549 dpurdie 51
parPv_id = Request("pv_id")
5560 dpurdie 52
parRepeat = Request("repeat")
53
parInst_id = Request("inst_id")
54
parSchDateTime = Request("sdt")
5549 dpurdie 55
parRfile = Request("rfile")
6695 dpurdie 56
parSortOrder = RequestDefault("sort",0)
57
 
58
If parSchDateTime = "" Then
59
   parSchDateTime = DisplayShortDateTimeSecs(Now())
60
End If
61
 
5560 dpurdie 62
ReleaseMode = GetReleaseMode(parRtag_id)
63
 
64
parSortOrder = Request("sort")
65
If IsNull(parSortOrder) OR parSortOrder = "" Then
66
   parSortOrder = "0"
67
End If
68
 
5549 dpurdie 69
Set objFormCollector = CreateObject("Scripting.Dictionary")
70
'------------------------------------------------------------------------------------------------------------------------------------------
5560 dpurdie 71
'
72
' Add a line of text to the System Message
73
'
74
Sub sMessageAdd(eLevel, text)
75
    If NOT isNull(sMessage) Then
76
        sMessage = sMessage & "<br>"
77
    End If
78
    sMessage = sMessage & text
79
 
80
    If eLevel < sMessageType  Then
81
        sMessageType = eLevel
82
    End If
83
End Sub
84
'------------------------------------------------------------------------------------------------------------------------------------------
85
' For the specified project ID, get a list of all that project's releases that are not closed/archived.
86
' Return True if at least one release was found, else False
87
'------------------------------------------------------------------------------------------------------------------------------------------
88
Function ReleasesAvailable(NNproj_id)
89
   Dim rsTemp, Query_String
90
 
91
   ReleasesAvailable = True
92
   Query_String = "SELECT rtag_id, rtag_name "&_
93
                  "  FROM release_tags rt"&_
94
                  " WHERE rt.proj_id = "& NNproj_id &_
95
                  "   AND ((rt.official = 'N') OR (rt.official = 'C') OR (rt.official = 'R'))"
96
 
97
	Set rsTemp = OraDatabase.DbCreateDynaset( Query_String, cint(0))
98
   If rsTemp.RecordCount = 0 Then
99
      ReleasesAvailable = False
100
   End If
101
 
102
   rsTemp.Close
103
   Set rsTemp = nothing
104
End Function
105
'------------------------------------------------------------------------------------------------------------------------------------------
5549 dpurdie 106
' For the specified Release, get a list of all that release's daemon configurations.
107
' Return True if at least one daemon configuration was found, else False
108
'------------------------------------------------------------------------------------------------------------------------------------------
109
Function DaemonsAvailable(NNrtag_id)
110
   Dim rsTemp, Query_String
111
 
112
   DaemonsAvailable = True
113
   Query_String = "SELECT * "&_
114
                  "  FROM release_config rc"&_
115
                  " WHERE rc.rtag_id = "& NNrtag_id
116
	Set rsTemp = OraDatabase.DbCreateDynaset( Query_String, cint(0))
117
   If rsTemp.RecordCount = 0 Then
118
      DaemonsAvailable = False
119
   End If
120
 
121
   rsTemp.Close
122
   Set rsTemp = nothing
123
End Function
5560 dpurdie 124
'------------------------------------------------------------------------------------------------------------------------------------------
125
' Formulate the HTML for a combo box listing all the daemon instruction operations, and select the one that matches
126
' the op-code passed in as a parameter. If the parameter value could not be found, correct it to the first valid op-code
127
' in the list.
128
'------------------------------------------------------------------------------------------------------------------------------------------
129
Function Get_OpCodes ( NNop_code )
130
   Dim op_code_str_array
131
   Dim op_code_str
132
   Dim op_code_val
133
	Dim selectedFound
134
   Dim s
5549 dpurdie 135
 
5560 dpurdie 136
   selectedFound = False
5549 dpurdie 137
 
5560 dpurdie 138
   ' Get the op-codes in terms of human readable string names - these will be used in the drop down select list
139
   Call GetDaemonInstructionOperationNameArray(op_code_str_array)
5549 dpurdie 140
 
5560 dpurdie 141
   s = "<td width='20%' align='left' class='nowrap'>Operation</td>"
6695 dpurdie 142
   s = s + "<td align='left'><select name='op_code' id='op_code' class='form_item' onchange='Refresh_Page()'>"
5560 dpurdie 143
 
144
   For each op_code_str in op_code_str_array
145
 
146
      ' get equivalent op-code value for this op-code string
147
      op_code_val = DaemonInstructionOperationValue(op_code_str)
148
 
149
      If ((NNop_code = op_code_val) OR (NNop_code = "0")) AND (selectedFound = False) Then
6695 dpurdie 150
         s = s + "<option value='"& op_code_val &"' selected>"& op_code_str &"</option>"
5560 dpurdie 151
         selectedFound = True
152
         NNop_code = op_code_val
153
      Else
6695 dpurdie 154
         s = s + "<option value='"& op_code_val &"'>"& op_code_str &"</option>"
5560 dpurdie 155
      End If
156
   Next
157
 
158
   s = s + "</select></td>"
159
   Get_OpCodes = s
160
End Function
161
'------------------------------------------------------------------------------------------------------------------------------------------
162
' Formulate the HTML for a combo box listing all the Projects, and select the one that matches
163
' the proj-id passed in as a parameter. If the parameter value could not be found, correct it to the first valid proj-id
164
' in the list.
165
'------------------------------------------------------------------------------------------------------------------------------------------
166
Function Get_Projects ( NNproj_id )
6695 dpurdie 167
   Dim rsTemp, Query_String, projName, selectedFound, s
5560 dpurdie 168
 
169
   selectedFound = False
170
   Query_String = "SELECT * FROM projects ORDER BY  UPPER( proj_name )"
171
 
172
   Set rsTemp = OraDatabase.DbCreateDynaset( Query_String, cint(0))
173
 
174
   s = "<td class='nowrap'>Project</td>"
6695 dpurdie 175
   s = s + "<td><select id='proj_id' name='proj_id' class='form_item' onChange='Refresh_Page()'>"
176
   If NNproj_id <= 0 Then
177
        s = s + "<option value='0' disabled selected>Select Project</option>"
178
   End If
5560 dpurdie 179
 
180
   While ((NOT rsTemp.BOF) AND (NOT rsTemp.EOF))
181
      projName = UCase(rsTemp.Fields("proj_name"))
182
 
6695 dpurdie 183
      If (Cstr(NNproj_id) = Cstr(rsTemp.Fields("proj_id"))) AND (selectedFound = False) Then
184
         s = s + "<option value='"& Cstr(rsTemp.Fields("proj_id")) &"' selected>"& projName &"</option>"
5560 dpurdie 185
         selectedFound = True
186
         NNproj_id = CStr(rsTemp.Fields("proj_id"))
187
      Else
6695 dpurdie 188
         s = s + "<option value='"& Cstr(rsTemp.Fields("proj_id")) &"'>"& projName &"</option>"
5560 dpurdie 189
      End If
190
 
191
      rsTemp.MoveNext
192
   WEnd
193
   s = s + "</select>"
194
 
195
   rsTemp.Close
196
   Set rsTemp = nothing
197
 
198
   s = s + "</td>"
199
 
200
   Get_Projects = s
201
End Function
202
 
203
'------------------------------------------------------------------------------------------------------------------------------------------
204
' Formulate the HTML for a combo box listing all the Release for a specified project, and select the one that matches
205
' the release-tag passed in as a parameter. If the parameter value could not be found, correct it to the first valid release-tag
206
' in the list.
207
'------------------------------------------------------------------------------------------------------------------------------------------
208
Function Get_Releases ( NNproj_id, NNrtag_id )
6695 dpurdie 209
   Dim rsTemp, Query_String, releaseName, val, selectedFound, s, numReleases
5560 dpurdie 210
 
211
   selectedFound = False
212
   numReleases = 0
213
 
214
   Query_String = "SELECT rtag_id, rtag_name "&_
215
                  "  FROM release_tags rt"&_
216
                  " WHERE rt.proj_id = "& NNproj_id &_
217
                  "   AND ((rt.official = 'N') OR (rt.official = 'C') OR (rt.official = 'R'))"&_
218
                  " ORDER BY UPPER(rtag_name)"
219
	Set rsTemp = OraDatabase.DbCreateDynaset( Query_String, cint(0))
220
 
221
   s = "<td class='nowrap'>Release</td>"
6695 dpurdie 222
   s = s + "<td><select id='rtag_id' name='rtag' class='form_item' onChange='Refresh_Page()'>"
223
   If NNrtag_id <= 0 Then
224
        s = s + "<option value='0' disabled selected>Select Release</option>"
225
   End If
5560 dpurdie 226
 
227
   While ((NOT rsTemp.BOF) AND (NOT rsTemp.EOF))
228
      releaseName = rsTemp.Fields("rtag_name")
6695 dpurdie 229
      val = CStr(rsTemp.Fields("rtag_id"))
5560 dpurdie 230
 
6695 dpurdie 231
      If ((Cstr(NNrtag_id) = val)  AND selectedFound = False) Then
232
            s = s + "<option value='"& val &"' selected>"& releaseName &"</option>"
5560 dpurdie 233
         selectedFound = True
6695 dpurdie 234
         NNrtag_id = val
5560 dpurdie 235
      Else
6695 dpurdie 236
         s = s + "<option value='"& val  &"'>"& releaseName &"</option>"
5560 dpurdie 237
      End If
238
 
239
      numReleases = numReleases + 1
240
 
241
      rsTemp.MoveNext
242
   WEnd
243
   s = s + "</select>"
244
 
245
   ' If no releases were found then replace drop down list with some warning text and disable form submission
246
   If numReleases = 0 Then
247
      bPreventSubmit = True
6695 dpurdie 248
      s = "<td class='nowrap'>Release</td>"
249
      If NNproj_id > 0 Then
250
        s = s + "<td><a style=color:Red>WARNING: No active releases found. The operation cannot be performed.</a></td>"
251
      End If
5560 dpurdie 252
   Else
253
      ' If the selected release does not have a daemon configuration, append some warning text to the right of the drop down list.
6695 dpurdie 254
      If NNrtag_id > 0 AND DaemonsAvailable(NNrtag_id) = False Then
255
         s = s + "<br><a style=color:Red>WARNING: Release has no build daemon(s)</a>"
5560 dpurdie 256
      End If
257
   End If
258
 
259
   rsTemp.Close
260
   Set rsTemp = nothing
261
 
262
   s = s + "</td>"
263
 
264
   Get_Releases = s
265
End Function
266
'------------------------------------------------------------------------------------------------------------------------------------------
267
' Formulate the HTML for a combo box listing all the Package Versions in a specified release, and select the one that matches
268
' the pv_id passed in as a parameter. If the parameter value could not be found, correct it to the first valid pv_id
269
' in the list.
270
' This function must deal with op-codes that want to read package versions from the work_in_progress table, and op-codes
271
' that need to read package versions from the release_content table.
272
' The function should only be called if a package versions drop down list is required for the form.
273
'------------------------------------------------------------------------------------------------------------------------------------------
274
Function Get_Packages ( NNrtag_id, NNpv_id, NNop_code )
6695 dpurdie 275
   Dim rsTemp, Query_String, pkgName, val, selectedFound, s, numPackages
5560 dpurdie 276
 
277
   selectedFound = False
278
 
279
   numPackages = 0
280
 
281
   If (NNop_code = OP_CODE_1_TEST_BUILD_PACKAGE) Then
282
      ' Get list of packages from from work_in_progress table
283
      Query_String = "SELECT pk.pkg_id, pk.pkg_name, pv.pkg_version, wip.pv_id "&_
284
                     "  FROM work_in_progress wip, release_tags rt, packages pk, package_versions pv "&_
285
                     " WHERE wip.rtag_id = "& Cstr(NNrtag_id) &_
286
                     "   AND wip.rtag_id = rt.rtag_id"&_
287
                     "   AND ((rt.official = 'N') OR (rt.official = 'C') OR (rt.official = 'R'))"&_
288
                     "   AND wip.pv_id = pv.pv_id"&_
289
                     "   AND pk.pkg_id = pv.pkg_id"&_
290
                     " ORDER BY UPPER(pkg_name)"
291
 
292
   Else
293
      ' Get list of packages from from release_content table
294
      Query_String = "SELECT pk.pkg_id, pk.pkg_name, pv.pkg_version, rc.pv_id "&_
295
                     "  FROM release_content rc, release_tags rt, packages pk, package_versions pv "&_
296
                     " WHERE rc.rtag_id = "& Cstr(NNrtag_id) &_
297
                     "   AND rc.rtag_id = rt.rtag_id"&_
298
                     "   AND ((rt.official = 'N') OR (rt.official = 'C') OR (rt.official = 'R'))"&_
299
                     "   AND rc.pv_id = pv.pv_id"&_
300
                     "   AND pk.pkg_id = pv.pkg_id"&_
301
                     " ORDER BY UPPER(pkg_name)"
302
   End If
303
 
304
	Set rsTemp = OraDatabase.DbCreateDynaset( Query_String, cint(0))
305
 
306
   ' modify the control heading to indicate the source of the package version list
307
   If (NNop_code = OP_CODE_1_TEST_BUILD_PACKAGE) Then
308
      s = "<td class='nowrap'>WIP Package</td>"
309
   Else
310
      s = "<td class='nowrap'>Released Package</td>"
311
   End If
312
 
6695 dpurdie 313
   s = s + "<td><select id='pv_id' name='pv_id' class='form_item' onchange='Refresh_Page()'>"
314
   If NNpv_id <= 0 Then
315
        s = s + "<option value='0' disabled selected>Select Package</option>"
316
   End If
5560 dpurdie 317
   While ((NOT rsTemp.BOF) AND (NOT rsTemp.EOF))
318
      pkgName = rsTemp.Fields("pkg_name") & " " & rsTemp.Fields("pkg_version")
6695 dpurdie 319
      val = rsTemp.Fields("pv_id")
5560 dpurdie 320
 
6695 dpurdie 321
      If ((NNpv_id = val) AND selectedFound = False) Then
322
         s = s + "<option value='"& val &"' selected>"& pkgName &"</option>"
5560 dpurdie 323
         selectedFound = True
6695 dpurdie 324
         NNpv_id = val
5560 dpurdie 325
      Else
6695 dpurdie 326
         s = s + "<option value='"& val &"'>"& pkgName &"</option>"
5560 dpurdie 327
      End If
328
 
329
      numPackages = numPackages + 1
330
 
331
      rsTemp.MoveNext
332
   WEnd
333
   s = s + "</select></td>"
334
 
6695 dpurdie 335
   If NNrtag_id > 0 Then
336
       ' replace drop down list with a warning if no package versions were found, and ensure that the user cannot submit the form
337
       If numPackages = 0 Then
338
          bPreventSubmit = True
339
          If (NNop_code = OP_CODE_1_TEST_BUILD_PACKAGE) Then
340
             s = "<td>Package</td><td><a style=color:Red>WARNING: No WIP package versions found. The operation cannot be performed.</a></td>"
341
          Else
342
             s = "<td>Package</td><td><a style=color:Red>WARNING: No released package versions found. The operation cannot be performed.</a></td>"
343
          End If
344
       End If
345
   Else
346
        s = "<td>Package</td><td></td>"
5560 dpurdie 347
   End If
348
 
349
   rsTemp.Close
350
   Set rsTemp = nothing
351
 
352
   Get_Packages = s
353
End Function
354
 
355
'------------------------------------------------------------------------------------------------------------------------------------------
356
' This function will be called if and only if the form is first opened in circumstances where the user is editing an existing record
357
' 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
358
' and the relevant parameters assigned from the record fields
359
'------------------------------------------------------------------------------------------------------------------------------------------
360
Sub Get_All_Params_From_Inst_Id(NNInstId)
361
   Dim rsTemp, Query_String
362
 
363
   Query_String = "SELECT op_code, rtag_id, pv_id, repeat_secs, "&_
364
                  "  TO_CHAR(scheduled_datetime, 'DD-MM-YYYY HH24:MI:SS') AS schedDate "&_
365
                  "  FROM DAEMON_INSTRUCTIONS "&_
366
                  " WHERE DAEMON_INSTRUCTIONS_ID = " & NNInstId
367
	Set rsTemp = OraDatabase.DbCreateDynaset( Query_String, cint(0))
368
   If rstemp.RecordCount = 0 Then
369
      Call sMessageAdd(1, "Attempt to Edit a non-existent record")
370
      Exit Sub
371
   End If
372
 
373
   ' assign record fields to global parameters
374
   parOp_code = rsTemp("op_code")
375
   parRtag_id = rsTemp("rtag_id")
376
   parPv_id   = rsTemp("pv_id")
377
   parRepeat  = rsTemp("repeat_secs")
378
   parSchDateTime = rsTemp("schedDate")
379
 
380
   ' derive project id since that is not stored in the table
381
   If NOT IsNull(parRtag_id) AND parRtag_id <> "" Then
382
      parProj_id = Get_Proj_ID(parRtag_id)
383
   Else
384
      parProj_id = "0"
385
   End If
386
 
387
   rsTemp.Close
388
   Set rsTemp = nothing
389
End Sub
390
'------------------------------------------------------------------------------------------------------------------------------------------
391
'   Perform any form callback actions
392
'   This is implemented in a subroutine to simplify error handling
393
'
394
Sub performActions
395
    ' Check if form submit is happening
396
    If CBool(Request("action")) Then
397
 
5549 dpurdie 398
       Dim RepeatSeconds
399
       Dim ScheduledDateTime
6184 dpurdie 400
       Dim sErrorMsg
5549 dpurdie 401
 
5560 dpurdie 402
       ' determine if insert/update is enabled by permissions
403
       If NOT UserCanAddOrEditThisDaemonInst(parProj_id, ReleaseMode, parOp_code) Then
404
          ' redirect to an error message
405
          Call sMessageAdd (1, "You have been denied permission to add/update daemon instructions for the specified release.")
406
          Exit Sub
5549 dpurdie 407
       End If
408
 
5560 dpurdie 409
       ' do daemon instruction validation, continuing only if it passes
6184 dpurdie 410
       If ValidateDaemonInstruction(parOp_code, parRtag_id, parPv_id, sErrorMsg) = True Then
5549 dpurdie 411
 
5560 dpurdie 412
          ' Setup the repeat seconds count according to the radio button value
413
          If IsNull(Request("repeat_inst")) OR Request("repeat_inst") = "" OR Request("repeat_inst") = "No" Then
414
             RepeatSeconds = 0
415
          Else
416
             RepeatSeconds = 86400
417
          End If
5549 dpurdie 418
 
5560 dpurdie 419
          ' If user has not entered a scheduled time, set the scheduled date/time to now
420
          ScheduledDateTime = Request("scheduled_time")
421
          If IsNull(ScheduledDateTime) OR ScheduledDateTime = "" Then
5549 dpurdie 422
             ScheduledDateTime = ORA_SYSDATETIME
5560 dpurdie 423
          Else
5638 dpurdie 424
             ScheduledDateTime = "TO_DATE( '"& ScheduledDateTime &"','DY DD-MON-YYYY HH24:MI' )"
5560 dpurdie 425
          End If
5549 dpurdie 426
 
5560 dpurdie 427
          ' nullify parPv_id for the SQL, if the instruction op-code does not require one
428
          If bHidePackages Then
429
             parPv_id = "NULL"
430
          End If
5549 dpurdie 431
 
5560 dpurdie 432
 
433
         objEH.ErrorRedirect = FALSE
434
         objEH.TryORA ( OraSession )
435
         On Error Resume Next
436
 
437
          ' if the page has been provided an inst_id, we must be editing an existing record so we do an update
438
          If (NOT IsNull(parInst_id)) AND (parInst_id <> "") Then
439
             ' We are updating an existing record
440
             OraDatabase.ExecuteSQL "BEGIN PK_BUILDAPI.update_daemon_inst( "& parInst_id & ", " &_
441
                                                                            parOp_code & ", " &_
442
                                                                            parRtag_id & ", " &_
443
                                                                            parPv_id & ", " &_
444
                                                                            ScheduledDateTime & ", " &_
445
                                                                            CStr(RepeatSeconds) & ", " &_
446
                                                                            ORA_SYSDATETIME & ", " &_
447
                                                                            objAccessControl.UserId & "); END;"
448
          Else ' We are adding a new record
5549 dpurdie 449
             OraDatabase.ExecuteSQL "BEGIN PK_BUILDAPI.insert_daemon_inst( "& parOp_code & ", " &_
450
                                                                            parRtag_id & ", " &_
451
                                                                            parPv_id & ", " &_
452
                                                                            ScheduledDateTime & ", " &_
453
                                                                            CStr(RepeatSeconds) & ", " &_
454
                                                                            ORA_SYSDATETIME & ", " &_
455
                                                                            objAccessControl.UserId & "); END;"
5560 dpurdie 456
          End If
457
 
458
         objEH.CatchORA ( OraSession )
459
 
460
         '  If the operation was succesful, then redirect the parent
461
         '  This will also close the iframe
462
         '
463
         '  If an error has occured, then an error message will be displayed within the iframe
464
         ' via the _msg_inline.asp processing when the page is re-displayed
465
         '
466
         If objEH.Finally Then
467
            If parRfile = "admin_daemon_instructions.asp" Then
5590 dpurdie 468
               Call OpenInParentWindow (parRfile & "?sort=" & parSortOrder)
5560 dpurdie 469
            Else
5590 dpurdie 470
               Call OpenInParentWindow (parRfile & "?rtag_id=" & parRtag_id & "&pv_id=" & parPv_id)
5560 dpurdie 471
            End If
5590 dpurdie 472
            Call CloseWindow
5560 dpurdie 473
         End If
6184 dpurdie 474
       Else
475
        sMessage = sErrorMsg
476
        sMessageType = 1 
5549 dpurdie 477
       End If
478
    End If
5560 dpurdie 479
End Sub
480
%>
481
<%
482
'------------ RUN BEFORE PAGE RENDER ----------
483
'
484
' Access Control
485
If NOT objAccessControl.UserLogedIn Then
486
    Call sMessageAdd ( 1, "User is no longer logged in")
487
ElseIf NOT UserCanAddOrEditThisDaemonInst(DB_PROJ_ID, ReleaseMode, parOp_code) Then
488
    Call sMessageAdd ( 1, "You have been denied permission to add/update daemon instructions for the specified release." )
5549 dpurdie 489
End If
490
 
5560 dpurdie 491
' Are we in edit mode? If so, populate all parameters from the record being edited
492
If (NOT IsNull(parInst_id)) AND (parInst_id <> "") AND (Request("edit") = "true") Then
493
   If NOT DaemonInstructionInProgress(Request("inst_id")) Then
494
      Call Get_All_Params_From_Inst_Id(parInst_id)
495
   Else
496
      Call sMessageAdd(1,"Cannot edit an instruction that is currently being processed by a Daemon")
497
   End If
498
End If
5549 dpurdie 499
 
5560 dpurdie 500
' Make sure we dont have any null strings or empty strings for our parameters
501
If IsNull(parOp_code) OR parOp_code = "" Then
502
   parOp_code = "0"
503
End If
504
If IsNull(parProj_id) OR parProj_id = "" Then
505
   parProj_id = "0"
506
End If
507
If IsNull(parRtag_id) OR parRtag_id = "" Then
508
   parRtag_id = "0"
509
End If
510
If IsNull(parPv_id) OR parPv_id = "" Then
511
   parPv_id = "0"
512
End If
513
If IsNull(parRepeat) OR parRepeat = "" Then
514
   parRepeat = "0"
515
End If
516
If IsNull(parRfile) OR parRfile = "" Then
517
   parRfile = "admin_daemon_instructions.asp"
518
End If
519
 
520
If IsNull(parSchDateTime) OR parSchDateTime = "" Then
5684 dpurdie 521
   parSchDateTime = DisplayShortDateTimeSecs(Now())
5560 dpurdie 522
End If
523
 
524
' If this form is opened with an OP_CODE, RTAG_ID and PV_ID only, then we need to derive the PROJ_ID before
525
' calling Get_Projects() to generate the project drop down list.
526
If parProj_id = "0" AND NOT IsNull(parRtag_id) AND parRtag_id <> "" AND parRtag_id <> "0" Then
6695 dpurdie 527
   parProj_id = DB_PROJ_ID
5560 dpurdie 528
End If
529
 
530
' Hide the Package drop-down list if the Daemon Instruction does not require it
531
If DaemonInstructionNeedsPV_ID(parOp_code) Then
532
   bHidePackages = False
5549 dpurdie 533
Else
5560 dpurdie 534
   bHidePackages = True
535
   parPv_id = "0"
5549 dpurdie 536
End If
5560 dpurdie 537
' NOTE: from this moment on, any real use of parPv_id has to be guarded by examination of bHidePackages
5549 dpurdie 538
 
5560 dpurdie 539
 
540
' Hide the Repeat buttons if the Daemon Instruction does not require them
541
If DaemonInstructionNeedsRepeat(parOp_code) Then
542
   bHideRepeat = False
543
Else
544
   bHideRepeat = True
5549 dpurdie 545
End If
546
 
5560 dpurdie 547
' Call some 'Get' procedures without HTML generation to determine the values of parProj_id, par_Rtag_id, and parPv_id
548
' in case they are not currently present in the query string. This will then allow the use of the ReleasesAvailable() and
549
' DaemonsAvailable() functions further below to hide the form submit button.
550
' It will also support the submit action itself when it takes place during the editing of an existing record where
551
' the user changes (for example) the project without making any changes to release or package and so those items
552
' are nullified and must be reset to something other than their original values that came through the query string
553
' when the edit form was just opened.
6695 dpurdie 554
'Call Get_Projects(parProj_id)                  ' Ensures parProj_id has a good value
555
'Call Get_Releases(parProj_id, parRtag_id)      ' Ensures parRtag_id has a good value
5560 dpurdie 556
 
6695 dpurdie 557
'If NOT bHidePackages Then
558
'   Call Get_Packages (parRtag_id, parPv_id, parOp_code)
559
'End If
5560 dpurdie 560
 
561
' Perform any required actions
562
Call performActions
563
 
5549 dpurdie 564
'----------------------------------------------
565
%>
5560 dpurdie 566
<script language="JavaScript" type="text/javascript">
567
<!--
568
 
6695 dpurdie 569
// This function is designed to be called when one of the controls is updated
570
// It will be refresh the page with the current set of values
571
function Refresh_Page()
5560 dpurdie 572
{
6695 dpurdie 573
 
574
    function defVal(el, def) {
575
        if(el) {
576
            return el.value;
577
        }
578
        return def;
579
    }
580
 
581
    function getValDef(name, def) {
582
        return defVal(document.getElementById(name), def);
583
    }
584
 
5560 dpurdie 585
   var s;
586
   s  = '<%=scriptName%>';
6695 dpurdie 587
   s += '?inst_id=' + getValDef('inst_id',0);
588
   s += '&op_code=' + getValDef('op_code',0);
589
   s += '&proj_id=' + getValDef('proj_id',0);
590
   s += '&rtag_id=' + getValDef('rtag_id',0);
591
   s += '&pv_id='   + getValDef('pv_id',0);
592
   s += '&sdt='     + getValDef('scheduled_time','').substr(4);
593
   s += '&repeat='  + defVal(document.querySelector('input[name="repeat_inst"]:checked'),0);
594
   s += '&rfile='   + getValDef('rfile','');
5560 dpurdie 595
 
596
   document.location = s;
597
}
598
 
599
//-->
600
</script>
601
 
5549 dpurdie 602
<html>
603
   <head>
604
      <title>Release Manager</title>
605
      <link rel="shortcut icon" href="<%=FavIcon%>"/>
606
      <meta HTTP-EQUIV="Pragma" CONTENT="no-cache">
607
      <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
6579 dpurdie 608
      <link href="images/release_manager_style.css?ver=<%=VixVerNum%>" rel="stylesheet" type="text/css">
6676 dpurdie 609
      <script language="JavaScript" src="scripts/common.js?ver=<%=VixVerNum%>"></script>
5636 dpurdie 610
      <%bJqueryTimePicker = TRUE%>
611
      <!--#include file="_jquery_includes.asp"-->
612
    <script>
613
    $(document).ready(function(){
614
    	var myDateTimePicker = null;
615
        $('#scheduled_time').datetimepicker({
616
    		timeFormat: "HH:mm",
617
            dateFormat: "D dd-M-yy",
618
    		controlType: 'select',
619
    		oneLine: true,
620
    		timeInput: true,
621
            constrainInput: true,
622
            showOn: 'both',
623
            buttonImageOnly : true,
624
            buttonImage: "images/cal.gif",
625
            buttonText: "Select Date and Time",
626
            minDate : 0,
627
    		onClose : function(p1,p2){
628
    			 //console.log("scheduled_time", p1 );
629
    			},
630
    	    });
631
    	})
632
    </script>
633
    <style>
634
        #ui-datepicker-div {
635
            position: absolute !important;
636
            top: 0px !important;
637
            left: 0px !important;
638
            }
6695 dpurdie 639
        .ui-datepicker-trigger{
640
			vertical-align: top;
641
			padding-left: 3px;
642
		}
5636 dpurdie 643
    </style>
5549 dpurdie 644
   </head>
645
 
6695 dpurdie 646
   <body leftmargin="0" topmargin="0" >
5549 dpurdie 647
         <%
648
         '-- FROM START --------------------------------------------------------------------------------------------------------------
649
         objFormComponent.FormName = "DaemonInstruction"
5590 dpurdie 650
         objFormComponent.FormClass = "form_tight"
5549 dpurdie 651
         objFormComponent.Action = ScriptName &_
5560 dpurdie 652
                                   "?inst_id="& parInst_id &_
653
                                   "&op_code="& parOp_code &_
654
                                   "&proj_id="& parProj_id &_
5549 dpurdie 655
                                   "&rtag_id="& parRtag_id &_
5560 dpurdie 656
                                   "&pv_id="&   parPv_id &_
657
                                   "&sort="&    parSortOrder &_
658
                                   "&rfile="& parRfile
5549 dpurdie 659
         objFormComponent.OnSubmit = "ShowProgress();"
660
         Call objFormComponent.FormStart()
661
         %>
6695 dpurdie 662
      <table class="full_table">
5549 dpurdie 663
         <tr>
664
            <td>
5560 dpurdie 665
               <!-- MESSAGE +++++++++++++++++++++++++++++++++++++++++++++++ -->
5549 dpurdie 666
               <%Call Messenger ( sMessage , sMessageType, "100%" )%>
667
               <!-- MESSAGE +++++++++++++++++++++++++++++++++++++++++++++++++++ -->
668
               <!--#include file="messages/_msg_inline.asp"-->
6695 dpurdie 669
               <table class="full_table form_item form_field_bg">
5549 dpurdie 670
                  <tr>
5560 dpurdie 671
                     <td width="1%" class="nowrap">
672
                        <%=Get_OpCodes(parOp_code)%>
673
                     </td>
5549 dpurdie 674
                  </tr>
5560 dpurdie 675
                  <tr><td>&nbsp;</td></tr>
5549 dpurdie 676
                  <tr>
5560 dpurdie 677
                     <td class="nowrap">
678
                        <div id="SelectProject" style="visibility:visible">
679
                           <%=Get_Projects(parProj_id)%>
680
                        </div>
681
                     </td>
5549 dpurdie 682
                  </tr>
683
                  <tr>
5560 dpurdie 684
                     <td class="nowrap">
685
                        <div id="SelectRelease" style="visibility:visible">
686
                           <%=Get_Releases(parProj_id, parRtag_id)%>
687
                        </div>
688
                     </td>
5549 dpurdie 689
                  </tr>
5560 dpurdie 690
 
691
                  <%If NOT bHidePackages Then%>
5549 dpurdie 692
                  <tr>
5560 dpurdie 693
                     <td class="nowrap">
694
                        <div id="SelectPackageVersion" style="visibility:visible">
695
                           <%=Get_Packages ( parRtag_id, parPv_id, parOp_code )%>
696
                        </div>
697
                     </td>
5549 dpurdie 698
                  </tr>
5560 dpurdie 699
                  <%End If%>
700
 
701
                  <tr><td>&nbsp;</td></tr>
5549 dpurdie 702
                  <tr>
703
                     <td>
5560 dpurdie 704
                        <td class="nowrap">Scheduled Time</td>
705
                        <td>
5636 dpurdie 706
                           <input type="text" id="scheduled_time" name="scheduled_time" size="25" class="form_ivalue" value="<%=DisplayDateTime(parSchDateTime)%>">
5560 dpurdie 707
                        </td>
708
                     </td>
709
                  </tr>
710
 
711
                  <%If NOT bHideRepeat Then%>
712
                     <tr>
713
                        <td>
714
                           <td>Repeat</td>
715
                           <td>
6695 dpurdie 716
                              <input type="radio" name="repeat_inst" id="repeat_inst_no"     value="0"   <%If parRepeat =     "0" Then%>checked<%End If%> onchange='Refresh_Page()'     >No
717
                              <input type="radio" name="repeat_inst" id="repeat_inst_24hrs"  value="86400"<%If parRepeat = "86400" Then%>checked<%End If%> onchange='Refresh_Page()' >24 Hrs
5560 dpurdie 718
                           </td>
719
                        </td>
720
                     </tr>
721
                  <%End If%>
5636 dpurdie 722
                  <tr>
723
                    <td style="height:100px">
724
                    </td>
725
                  </tr>
5560 dpurdie 726
                 <tr>
6695 dpurdie 727
                    <td class=form_field_hdrgap colspan=3>
5560 dpurdie 728
                       <table class="full_table">
729
                          <tr>
5590 dpurdie 730
                             <td><%=ProgressBar()%></td>
5636 dpurdie 731
                             <td align="right" >
5560 dpurdie 732
                                <%
733
                                Dim disableText : disableText = ""
6695 dpurdie 734
                                If NOT ( (NOT bHidePackages AND parPv_id > 0 )  AND  ReleasesAvailable(parProj_id) AND DaemonsAvailable(parRtag_id) AND NOT bPreventSubmit AND IsNull(sMessage)) Then
5560 dpurdie 735
                                    disableText = "disabled=""disabled"""
736
                                End If
737
                                %>
738
                                <button name="btn" type="submit" <%=disableText%>>Add/Update</button>
5590 dpurdie 739
                                <button name="btn" type="reset" onclick="parent.closeIFrame();">Cancel</button>
5560 dpurdie 740
                             </td>
741
                          </tr>
742
                       </table>
743
                    </td>
744
                 </tr>
5549 dpurdie 745
               </table>
746
            </td>
747
         </tr>
748
      </table>
6695 dpurdie 749
      <input type="hidden" id="inst_id"     name="inst_id"      value="<%=parInst_id%>">
750
      <input type="hidden" id="repeat_secs" name="repeat_secs"  value="<%=parRepeat%>">
751
      <input type="hidden" id="rfile"       name="rfile"        value="<%=parRfile%>">
752
      <input type="hidden"                  name="action"       value="true">
753
      <%
754
      objPMod.ComposeHiddenTags()
755
      Call objFormComponent.FormEnd()
756
      '-- FROM END ----------------------------------------------------------------------------------------------------------------
757
      %>
5549 dpurdie 758
   </body>
759
</html>
760
<%
761
'------------ RUN AFTER PAGE RENDER -----------
762
Set objFormCollector = Nothing
763
'----------------------------------------------
764
Call Destroy_All_Objects
765
%>
766
 
767