Subversion Repositories DevTools

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
119 ghuddy 1
<%
2
'=====================================================
151 ghuddy 3
'                 NEW VERSION
4
'                      PAGE
119 ghuddy 5
'=====================================================
6
%>
7
<!--#include file="_tabs.asp"-->
121 hknight 8
<!--#include file="_drawExtensionSelectBox.asp"-->
151 ghuddy 9
<!--#include file="class/classSortHelper.asp"-->
119 ghuddy 10
<%
11
'------------ Variable Definition -------------
151 ghuddy 12
Dim parAuto
119 ghuddy 13
Dim parPv_id
14
Dim rsLocRel
15
Dim parPage_title
16
Dim objPkgInfo
121 hknight 17
Dim rsTemp2
151 ghuddy 18
Dim rsLatest
19
Dim aVersions
20
Dim lastRow, i
21
Dim objSortHelper
119 ghuddy 22
'------------ Constants Declaration -----------
23
'------------ Variable Init -------------------
24
parPv_id = QStrPar("pv_id")
151 ghuddy 25
parAuto =  QStrPar("auto")
119 ghuddy 26
parPage_title = "NEW VERSION"
27
Set objPkgInfo = CreateObject("Scripting.Dictionary")
28
'-----------------------------------------------------------------------------------------------------------------------------
121 hknight 29
Function Get_Projects
151 ghuddy 30
   Get_Projects = _
31
   " SELECT * FROM projects ORDER BY proj_name ASC"
121 hknight 32
End Function
33
'-----------------------------------------------------------------------------------------------------------------------------
119 ghuddy 34
Sub GetPackageInfo( nPvId, outPkgInfo )
151 ghuddy 35
   Dim rsTemp, Query_String
36
   If IsEmpty(nPvId) Then Exit Sub
121 hknight 37
 
151 ghuddy 38
   Query_String = _
39
   " SELECT pv.pv_id, pkg.pkg_id, pkg.pkg_name, pv.pkg_version, pv.v_ext"&_
40
   "  FROM packages pkg, package_versions pv"&_
41
   " WHERE pkg.pkg_id = pv.pkg_id  AND pv.pv_id ="& nPvId
121 hknight 42
 
151 ghuddy 43
   Set rsTemp = OraDatabase.DbCreateDynaset( Query_String, cint(0))
121 hknight 44
 
151 ghuddy 45
   If ((NOT rsTemp.BOF) AND (NOT rsTemp.EOF)) Then
46
      outPkgInfo.Item("pv_id") = rsTemp.Fields("pv_id")
47
      outPkgInfo.Item("pkg_id") = rsTemp.Fields("pkg_id")
48
      outPkgInfo.Item("pkg_name") = rsTemp.Fields("pkg_name")
49
      outPkgInfo.Item("pkg_version") = rsTemp.Fields("pkg_version")
50
      outPkgInfo.Item("v_ext") = rsTemp.Fields("v_ext")
51
   End If
121 hknight 52
 
151 ghuddy 53
   rsTemp.Close
54
   Set rsTemp = nothing
119 ghuddy 55
End Sub
56
'-----------------------------------------------------------------------------------------------------------------------------
151 ghuddy 57
Function Get_Latest_All_Ext ( NNpkg_id, nPv_id )
58
	Get_Latest_All_Ext = _
59
	" SELECT pv.pkg_version, pv.dlocked,"&_
60
	"        DECODE ( pv.pv_id, "& nPv_id &", 'selected', NULL ) AS selected"&_
61
	"    FROM PACKAGES pkg, package_versions pv"&_
62
	"   WHERE pkg.pkg_id = pv.pkg_id  AND  pkg.pkg_id = "& NNpkg_id
63
End Function
64
'-----------------------------------------------------------------------------------------------------------------------------
119 ghuddy 65
%>
66
<%
67
'===================== MAIN LINE ============================
68
Call GetPackageInfo( parPv_id, objPkgInfo )
151 ghuddy 69
 
70
If IsNull(parAuto) OR parAuto = "" Then
71
   parAuto = "1"
72
End If
119 ghuddy 73
'============================================================
74
%>
75
<script language="JavaScript" type="text/JavaScript">
76
<!--
121 hknight 77
 
78
/*
79
Summary of Javascript functionality implemented by Haydon Knight for DEVI-044075 and DEVI-043066:
80
 
81
The form 'NEWVersion' invokes _new_version.asp when submitted.  The value of the FRnewver input box (which is hidden)  is passed
151 ghuddy 82
through to _new_version.asp.  This value stores the full version number+extension.
121 hknight 83
The full version (that displayed and that stored in FRnewver) is updated by updateFullVersion(), which is invoked whenever the user
84
changes the version base-number or version extension via any of:
85
 
151 ghuddy 86
1. altering the value of the 'inputVersionNumber' text entry box
87
2. changing the extension via the 'v_ext' select pull-down menu.
121 hknight 88
 
89
The radio button to select auto/manual is 'build_type', and a value of 'M' = manual and 'A' = auto.  Changing what is selected
151 ghuddy 90
invokes changeToAutoVersionNumberAssignment() or changeToManualVersionNumberAssignment(), which re-builds the form on the server
91
with the appropriate query string value to indicate the build type.
121 hknight 92
*/
93
 
94
window.onload = function()
95
{
151 ghuddy 96
   var fullVersion = "<%=objPkgInfo.Item("pkg_version")%>";
97
   var versionExt  = "<%=objPkgInfo.Item("v_ext")%>";
121 hknight 98
 
151 ghuddy 99
   var isAutobuild = document.NEWversion.build_type[0].checked;
100
   if (!isAutobuild)
101
   {
102
      // We only update inputVersionNumber field on page load, for manual builds
103
      if (versionExt.length == 0)
104
      {
105
         // is probably an old package version that was made in the days before we enforced all package versions
106
         // to have an extension.
107
         document.all['inputVersionNumber'].value = fullVersion;
108
      }
109
      else
110
      {
111
         // strip extension
112
         document.all['inputVersionNumber'].value = fullVersion.replace( /(.*)\..*/, "$1");
113
      }
114
   }
115
 
116
   // update FRnewver field from inputVersionNumber and v_ext fields
117
   updateFullVersion();
119 ghuddy 118
}
121 hknight 119
 
120
//////////////////////////////////////////////////////////////////
121
// Function: updateFullVersion
122
//
123
// Purpose: Updates the version displayed at the bottom of the window, as well as the FRnewver field that is
124
// passed through to the _new_version.asp script
125
//
126
// Arguments: none
127
//
128
// Returns: none
129
//
130
// Notes: When the user updates the "version base" text field this function is called
131
//
132
function updateFullVersion()
133
{
151 ghuddy 134
   document.all['FRnewver'].value = getFullVersion();
121 hknight 135
}
136
 
137
 
138
//////////////////////////////////////////////////////////////////
139
// Function: getVersionBase
140
//
141
// Purpose: Works out what the version base is based on user input
142
//
143
// Arguments: none
144
//
145
// Returns: versionBase - a number of the form n.n.n where 'n' is an integer (.e.g. 1.2.3000)
146
//
147
// Notes: If auto just returns ("auto")
148
//
149
function getVersionBase()
150
{
151 ghuddy 151
   var isAutobuild = document.NEWversion.build_type[0].checked;
121 hknight 152
 
151 ghuddy 153
   if( isAutobuild )
121 hknight 154
      return "(auto)";
155
 
151 ghuddy 156
   return document.all['inputVersionNumber'].value;
121 hknight 157
}
158
 
159
 
160
//////////////////////////////////////////////////////////////////
161
// Function: getFullVersion
162
//
163
// Purpose: Returns the full version based on the user input
164
//
165
// Arguments: none
166
//
167
// Returns: fullVersion - e.g. "1.2.3.cr"
168
//
169
// Notes:
170
//
171
function getFullVersion()
172
{
151 ghuddy 173
   var versionBase = getVersionBase();
174
   var versionExt = document.all['v_ext'].value;
175
   return versionBase + versionExt;
121 hknight 176
}
177
 
178
 
179
//////////////////////////////////////////////////////////////////
151 ghuddy 180
// Function: changeToAutoVersionNumberAssignment
121 hknight 181
//
151 ghuddy 182
// Purpose: Re-loads the form for use in auto version number assignment
121 hknight 183
//
151 ghuddy 184
// Arguments: None
121 hknight 185
//
186
// Returns: none
187
//
151 ghuddy 188
function changeToAutoVersionNumberAssignment()
189
{
190
   window.location.href = 'form_new_version.asp?rtag_id=<%=parRtag_id%>&pv_id=<%=parPv_id%>&auto=1';
191
}
192
 
193
//////////////////////////////////////////////////////////////////
194
// Function: changeToManualVersionNumberAssignment
121 hknight 195
//
151 ghuddy 196
// Purpose: Re-loads the form for use in manual version number assignment
197
//
198
// Arguments: None
199
//
200
// Returns: none
201
//
202
function changeToManualVersionNumberAssignment()
121 hknight 203
{
151 ghuddy 204
   window.location.href = 'form_new_version.asp?rtag_id=<%=parRtag_id%>&pv_id=<%=parPv_id%>&auto=0';
121 hknight 205
}
206
 
151 ghuddy 207
 
121 hknight 208
// Do not remove these next few lines, otherwise the page does not load properly in Microsoft IE.
119 ghuddy 209
//-->
210
</script>
211
 
212
<script>
121 hknight 213
 
214
 
119 ghuddy 215
function Dependency()
216
{
151 ghuddy 217
   parent.window.location.href="dependencies.asp?rtag_id=<%=parRtag_id%>&pv_id=<%=parPv_id%>";
119 ghuddy 218
}
121 hknight 219
 
151 ghuddy 220
////////////////////////////////////////////////////////////////////////////////////////////////////////
221
// This function returns true if version is ok, else false
222
////////////////////////////////////////////////////////////////////////////////////////////////////////
121 hknight 223
function checkVersion()
224
{
151 ghuddy 225
   var fullVersion = document.all['FRnewver'].value;
121 hknight 226
 
151 ghuddy 227
   var versionBase = fullVersion.replace( /(.*)(\..*)/, "$1");
228
   var versionExt =  fullVersion.replace( /(.*)(\..*)/, "$2");
121 hknight 229
 
151 ghuddy 230
   var isAutobuild = document.NEWversion.build_type[0].checked;
121 hknight 231
 
151 ghuddy 232
   return MM_ValidateVersion(null, versionBase, versionExt, isAutobuild, false);
233
}
121 hknight 234
 
151 ghuddy 235
////////////////////////////////////////////////////////////////////////////////////////////////////////
236
// This function returns true if form validation passes, else false
237
// It is called when a user hits the submit button.
238
////////////////////////////////////////////////////////////////////////////////////////////////////////
239
function validateFormNEWversion()
240
{
241
   var f = document.getElementById('NEWversion');
121 hknight 242
 
151 ghuddy 243
   if (f == null)
244
      alert('Failed To Get NEWversion');   // should never happen unless a coding/rendering mistake is made?
245
   else
246
   {
247
      // check the version number is good
248
      document.MM_returnValue = checkVersion();
249
      if (document.MM_returnValue)
250
      {
251
         // check the reason for change is good
252
         // NOTE: MM_validateForm returns its result through MM_returnValue : true if validation passes, else false
253
         MM_validateForm('FRreason','Reason for This Version','maxLength:4000');
254
         if (document.MM_returnValue)
255
         {
256
            f.action='_new_version.asp';
257
            parent.window.location.href='dependencies.asp?rtag_id=<%=parRtag_id%>&pv_id=<%=parPv_id%>';
258
 
259
            return true; // let the submit happen
260
         }
261
      }
262
   }
263
   return false; // prevent the submit
121 hknight 264
}
151 ghuddy 265
 
119 ghuddy 266
</script>
267
 
268
<table width="650" border="0" cellspacing="0" cellpadding="0">
151 ghuddy 269
   <tr>
270
      <td>
271
         <table width="100%" border="0" cellspacing="0" cellpadding="0">
272
            <tr>
273
               <td width="1%">&nbsp;</td>
274
               <td align="right"><img src="images/h_trsp_dot.gif" width="30" height="30"></td>
275
               <td width="1%">&nbsp;</td>
276
            </tr>
277
            <tr>
278
               <td width="1%">&nbsp;</td>
279
               <td>
280
                  <table width="100%" border="0" cellspacing="0" cellpadding="0">
281
                     <tr>
282
                        <td nowrap class="form_ttl"><%=parPage_title%></td>
283
                        <td align="right" valign="bottom">
284
                           <!-- TABS -->
285
                           &nbsp;
286
                        </td>
287
                     </tr>
288
                  </table>
289
               </td>
290
               <td width="1%">&nbsp;</td>
291
            </tr>
292
            <tr>
293
               <td align="left" valign="top" width="1%" background="images/lbox_bg_blue.gif"><img src="images/lbox_tl_cnr_b.gif" width="13" height="13"></td>
294
               <td background="images/lbox_bg_blue.gif"><!-- Heading --><img src="images/h_trsp_dot.gif" width="1" height="20"><!-- END Heading --></td>
295
               <td align="right" valign="top" width="1%" background="images/lbox_bg_blue.gif"><img src="images/lbox_tr_cnr_b.gif" width="13" height="13"></td>
296
            </tr>
297
            <tr>
298
               <td width="1%" bgcolor="#FFFFFF"><img src="images/h_trsp_dot.gif" width="10" height="100"></td>
299
               <td bgcolor="#FFFFFF" valign="top">
300
                  <!-- Body -->
301
                  <table width="100%" border="0" cellspacing="1" cellpadding="2">
302
                     <form id="NEWversion"  name="NEWversion" method="post">
303
                        <tr>
304
                           <td width="1%"><img src="images/h_trsp_dot.gif" width="1" height="10"></td>
305
                           <td width="1%" nowrap class="form_group" valign="bottom"></td>
306
                           <td nowrap width="100%" align="right" class="form_step"></td>
307
                        </tr>
308
                        <tr>
309
                           <td width="1%">&nbsp;</td>
310
                           <td colspan="2" width="1%" nowrap class="form_field">
311
                              <table width="100%" border="0" cellspacing="1" cellpadding="5">
312
                                 <tr>
313
                                    <td background="images/bg_form_lightbluedark.gif" width="20%" class="form_field">Package Name</td>
314
                                    <td background="images/bg_form_lightgray.gif" class="form_field"><%=objPkgInfo.Item("pkg_name")%></td>
315
                                 </tr>
316
                                 <tr>
317
                                    <td background="images/bg_form_lightbluedark.gif" width="20%" class="form_field">Version Number Assignment</td>
318
                                    <td background="images/bg_form_lightgray.gif" class="form_txt">
121 hknight 319
 
151 ghuddy 320
                                       <%If parAuto = "1" Then%>
321
                                          <input name="build_type" id="build_type" type="radio" value="A" checked onclick="changeToAutoVersionNumberAssignment();"> Auto
322
                                          <input name="build_type" id="build_type" type="radio" value="M"         onclick="changeToManualVersionNumberAssignment();"> Manual
323
                                       <%Else%>
324
                                          <input name="build_type" id="build_type" type="radio" value="A"         onclick="changeToAutoVersionNumberAssignment();"> Auto
325
                                          <input name="build_type" id="build_type" type="radio" value="M" checked onclick="changeToManualVersionNumberAssignment();"> Manual
326
                                       <%End If%>
327
                                    </td>
328
                                 </tr>
329
                              </table>
330
 
331
                              <table width="100%" border="0" cellspacing="0" cellpadding="5">
332
                                 <tr>
333
                                    <td background="images/bg_form_lightbluedark.gif"  width="20%" class="form_field">New Version Number</td>
334
                                    <td background="images/bg_form_lightgray.gif" class="form_item">
335
                                       <%If parAuto = "0" Then%>
336
                                          <input type="text" id="inputVersionNumber" name="inputVersionNumber" class="form_item" size="12" onmouseout="updateFullVersion();" onblur="updateFullVersion();" onclick="updateFullVersion();" onmouseup="updateFullVersion();" onchange="updateFullVersion();" onkeyup="updateFullVersion();">
337
                                       <%Else%>
338
                                          <input type="text" id="inputVersionNumber" name="inputVersionNumber" class="form_item" size="12" value="(auto)" disabled>
339
                                       <%End If%>
340
                                    </td>
341
                                    <%If parAuto = "0" Then%>
342
                                       <td background="images/bg_form_lightgray.gif" class="form_item">
343
                                          <select id="FRpkgver"  name="FRpkgver" class="form_item">
344
                                             <option value=""></option>
345
                                             <%
346
                                             Set rsLatest = OraDatabase.DbCreateDynaset( Get_Latest_All_Ext( objPkgInfo.Item("pkg_id"), parPv_id ), cint(0))
347
 
348
                                             If rsLatest.RecordCount > 0 Then
349
                                                aVersions = rsLatest.GetRows()
350
                                                lastRow = UBound( aVersions, 2 )
351
 
352
                                                Set objSortHelper = New SortHelper
353
 
354
                                                ' Sort versions
355
                                                Call objSortHelper.VersionSort( aVersions, 0, lastRow, rsLatest.FieldIndex("pkg_version") )
356
 
357
                                                ' Descending order
358
                                                For i = lastRow To 0 Step -1
359
                                                %>
360
                                                   <option value="<%=aVersions( rsLatest.FieldIndex("pkg_version"), i )%>" <%=aVersions( rsLatest.FieldIndex("selected"), i )%>>
361
                                                      <%If aVersions( rsLatest.FieldIndex("dlocked"), i ) = "Y" Then%>
362
                                                         R&nbsp;
363
                                                      <%Else%>
364
                                                         &nbsp;&nbsp;&nbsp;&nbsp;
365
                                                      <%End If%>
366
                                                      <%=aVersions( rsLatest.FieldIndex("pkg_version"), i )%>
367
                                                   </option>
368
                                                <%
369
                                                Next
370
 
371
                                                Set objSortHelper = nothing
372
 
373
                                             End If
374
                                             %>
375
                                          </select>&nbsp;Existing Versions (For Reference Only)
376
                                       </td>
377
                                    <%End If%>
378
                                 </tr>
379
                              </table>
380
 
381
                              <table width="100%" border="0" cellspacing="1" cellpadding="5">
382
                                 <tr>
383
                                    <td background="images/bg_form_lightbluedark.gif" width="20%" class="form_field">Version Extension</td>
384
                                    <td background="images/bg_form_lightgray.gif" class="form_item">
385
                                       <DIV id="divVersionExt" name="divVersionExt">
386
                                          <select name="v_ext" id="v_ext" onchange="updateFullVersion();">
387
                                             <%
388
                                             Call drawExtensionSelectBox( objPkgInfo.Item("v_ext"), true )
389
                                             %>
390
                                          </select>
391
                                       </DIV>
392
                                    </td>
393
                                 </tr>
394
 
395
                                 <tr>
396
                                    <td background="images/bg_form_lightbluedark.gif" width="20%" class="form_field">Reason For This Version</td>
397
                                    <td background="images/bg_form_lightgray.gif" nowrap width="100%" class="form_field">
398
                                       <textarea name="FRreason" class="form_item" style="width: 420px; height: 150px"></textarea>
399
                                    </td>
400
                                 </tr>
401
                              </table>
402
 
403
                              <%If parAuto = "1" Then%>
404
                                 <table width="100%" border="0" cellspacing="0" cellpadding="5">
405
                                    <tr>
406
                                       <td background="images/bg_form_lightbluedark.gif" nowrap width="20%" class="form_field">Change Type</td>
407
                                       <td background="images/bg_form_lightgray.gif" >
408
                                          <table width="100%" border="0" cellspacing="0" cellpadding="0">
409
                                             <tr>
410
                                                <td width="1%">
411
                                                   <input name="change_type" type="radio" value="M">
412
                                                </td>
413
                                                <td nowrap>
414
                                                   <span class="form_field">Major Change</span>
415
                                                </td>
416
                                                <td>&nbsp;</td>
417
                                                <td>
418
                                                   <span class="form_txt">A major number change indicates the contract of the package has changed in a non-backwardly compatible manner.</span>
419
                                                </td>
420
                                             </tr>
421
                                             <tr>
422
                                                <td colspan="4"><hr width="100%" size="1" noshade></td>
423
                                             </tr>
424
                                             <tr>
425
                                                <td width="1%">
426
                                                   <input name="change_type" type="radio" value="N">
427
                                                </td>
428
                                                <td align="center" nowrap>
429
                                                   <span class="form_field">Minor Change</span>
430
                                                </td>
431
                                                <td>&nbsp;</td>
432
                                                <td>
433
                                                   <span class="form_txt">A minor number change indicates the contract of the package has changed in a backwardly compatible manner.</span>
434
                                                </td>
435
                                             </tr>
436
                                             <tr>
437
                                                <td colspan="4"><hr width="100%" size="1" noshade></td>
438
                                             </tr>
439
                                             <tr>
440
                                                <td width="1%">
441
                                                   <input name="change_type" type="radio" value="P" checked>
442
                                                </td>
443
                                                <td nowrap>
444
                                                   <span class="form_field">Patch Change</span>
445
                                                </td>
446
                                                <td>&nbsp;</td>
447
                                                <td>
448
                                                   <span class="form_txt">A patch number change indicates the package has changed internally.</span>
449
                                                </td>
450
                                             </tr>
451
                                          </table>
452
 
453
                                       </td>
454
                                    </tr>
455
                                 </table>
456
                              <%End If%>
457
 
458
                              <table width="100%" border="0" cellspacing="1" cellpadding="0">
459
                                 <tr>
460
                                    <td nowrap><img src="images/h_trsp_dot.gif" width="120" height="1"></td>
461
                                    <td></td>
462
                                 </tr>
463
                                 <input type="hidden" name="FRnewver" id="FRnewver" value="hello">
464
                                 <input type="hidden" name="OLDpv_id" value="<%=parPv_id%>">
465
                                 <input type="hidden" name="rtag_id" value="<%=parRtag_id%>">
466
                                 <input type="hidden" name="page_title" value="<%=parPage_title%>">
467
                              </table>
468
                           </td>
469
                        </tr>
470
                        <tr>
471
                           <td width="1%">&nbsp;</td>
472
                           <td width="1%" nowrap class="form_field"><img src="images/h_trsp_dot.gif" width="1" height="1"></td>
473
                           <td nowrap width="100%" class="body_scol">
474
                              <input type="submit" name="btn" value="Submit" class="form_btn" onClick="return validateFormNEWversion();">
475
                              <input type="reset" name="btn" value="Cancel" class="form_btn" onClick="Dependency();">
476
                              <SPAN id="ProgressBar" name="ProgressBar" style="visibility:hidden;"><img src="images/i_processing.gif" width="11" height="17" align="absmiddle" hspace="3">Processing...</SPAN>
477
                              <br><br>
478
                           </td>
479
                        </tr>
480
                     </form>
481
                  </table>
482
                  <!-- END Body-->
483
               </td>
484
               <td width="1%" background="images/lbox_bgside_white.gif">&nbsp;</td>
485
            </tr>
486
            <tr>
487
               <td width="1%" background="images/lbox_bg_blue.gif" valign="bottom"><img src="images/lbox_bl_cnr_b.gif" width="13" height="13"></td>
488
               <td background="images/lbox_bg_blue.gif"></td>
489
               <td width="1%" background="images/lbox_bg_blue.gif" valign="bottom" align="right"><img src="images/lbox_br_cnr_b.gif" width="13" height="13"></td>
490
            </tr>
491
         </table>
492
      </td>
493
   </tr>
119 ghuddy 494
</table>