Subversion Repositories DevTools

Rev

Rev 5897 | Rev 5957 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5897 Rev 5899
Line 1... Line 1...
1
<%@LANGUAGE="VBSCRIPT"%>
1
<%@LANGUAGE="VBSCRIPT"%>
2
<%
2
<%
3
'=====================================================
3
'=====================================================
4
'|  form_edit_deps.asp
4
'|  form_edit_deps.asp
5
'|	Used by JATS and ANT import pages to sanitize the package versions to be used
5
'|  Used by JATS and ANT import pages to sanitize the package versions to be used
6
'|  	Do not allow user to name packages that do not exist
6
'|      Do not allow user to name packages that do not exist
7
'|  	Do not allow the user to name package-versions that do not exist
7
'|      Do not allow the user to name package-versions that do not exist
8
'|	Used by Edit Dependencies button
8
'|  Used by Edit Dependencies button
9
'|		Restrict users to versions that exist
9
'|      Restrict users to versions that exist
10
'|	
10
'|  
11
'=====================================================
11
'=====================================================
12
%>
12
%>
13
<%
13
<%
14
Option explicit
14
Option explicit
15
' Good idea to set when using redirect
15
' Good idea to set when using redirect
16
Response.Expires = 0	' always load the page, dont store
16
Response.Expires = 0    ' always load the page, dont store
17
%>
17
%>
18
<!--#include file="common/conf.asp"-->
18
<!--#include file="common/conf.asp"-->
19
<!--#include file="common/globals.asp"-->
19
<!--#include file="common/globals.asp"-->
20
<!--#include file="common/formating.asp"-->
20
<!--#include file="common/formating.asp"-->
21
<!--#include file="common/qstr.asp"-->
21
<!--#include file="common/qstr.asp"-->
22
<!--#include file="common/common_subs.asp"-->
22
<!--#include file="common/common_subs.asp"-->
23
<%
23
<%
24
' Make sure rtag_id is always present
24
' Make sure rtag_id is always present
25
If Request("pv_id") = "" Then
25
If Request("pv_id") = "" Then
26
	Response.Redirect("index.asp")
26
    Response.Redirect("index.asp")
27
End If
27
End If
28
%>
28
%>
29
<%
29
<%
30
'------------ ACCESS CONTROL ------------------
30
'------------ ACCESS CONTROL ------------------
31
%>
31
%>
Line 83... Line 83...
83
   '    AntStyle('PackageName','PackageVersion');
83
   '    AntStyle('PackageName','PackageVersion');
84
 
84
 
85
   re.Pattern = "(^|\n)\s*([_A-Za-z0-9]+)\s*\(\s*\'([^\']*)\'\s*\,\s*\'([^\']*)\'\s*\)"
85
   re.Pattern = "(^|\n)\s*([_A-Za-z0-9]+)\s*\(\s*\'([^\']*)\'\s*\,\s*\'([^\']*)\'\s*\)"
86
   Set Matches = re.Execute(SSdep_import)
86
   Set Matches = re.Execute(SSdep_import)
87
 
87
 
88
	Query_String = ReadFile( rootPath & "queries\form_edit_import_deps.sql" )
88
    Query_String = ReadFile( rootPath & "queries\form_edit_import_deps.sql" )
89
	OraDatabase.Parameters.Add "RTAG_ID", parRtag_id, ORAPARM_INPUT, ORATYPE_NUMBER
89
    OraDatabase.Parameters.Add "RTAG_ID", parRtag_id, ORAPARM_INPUT, ORATYPE_NUMBER
90
	OraDatabase.Parameters.Add "PKG_NAME", pkg_name , ORAPARM_INPUT, ORATYPE_STRING
90
    OraDatabase.Parameters.Add "PKG_NAME", pkg_name , ORAPARM_INPUT, ORATYPE_STRING
91
	OraDatabase.Parameters.Add "PKG_VERSION", pkg_version, ORAPARM_INPUT, ORATYPE_STRING
91
    OraDatabase.Parameters.Add "PKG_VERSION", pkg_version, ORAPARM_INPUT, ORATYPE_STRING
92
	Set OraParameter = OraDatabase.Parameters
92
    Set OraParameter = OraDatabase.Parameters
93
 
93
 
94
   recCnt=0
94
   recCnt=0
95
   For Each Match in Matches
95
   For Each Match in Matches
96
     build_type = Match.SubMatches(1)
96
     build_type = Match.SubMatches(1)
97
     pkg_name = Match.SubMatches(2)
97
     pkg_name = Match.SubMatches(2)
Line 120... Line 120...
120
 
120
 
121
         Set rsDeps = OraDatabase.DbCreateDynaset( Query_String, cint(0))
121
         Set rsDeps = OraDatabase.DbCreateDynaset( Query_String, cint(0))
122
         If rsDeps.RecordCount <> 0 Then
122
         If rsDeps.RecordCount <> 0 Then
123
            SShtml_pkg_list = SShtml_pkg_list & GenerateEntry( recCnt, rsDeps("pkg_id"), rsDeps("pv_id"), rsDeps("pkg_name"), rsDeps("pkg_version"), builtTypeEnum, rsDeps("lpkg_version"))
123
            SShtml_pkg_list = SShtml_pkg_list & GenerateEntry( recCnt, rsDeps("pkg_id"), rsDeps("pv_id"), rsDeps("pkg_name"), rsDeps("pkg_version"), builtTypeEnum, rsDeps("lpkg_version"))
124
            recCnt = recCnt + 1
124
            recCnt = recCnt + 1
125
		    DataFound = true
125
            DataFound = true
126
         End If
126
         End If
-
 
127
         rsDeps.Close
-
 
128
         Set rsDeps = Nothing
127
     End If
129
     End If
128
   Next
130
   Next
129
 
131
 
130
	OraDatabase.Parameters.Remove "RTAG_ID"
132
    OraDatabase.Parameters.Remove "RTAG_ID"
131
	OraDatabase.Parameters.Remove "PKG_NAME"
133
    OraDatabase.Parameters.Remove "PKG_NAME"
132
	OraDatabase.Parameters.Remove "PKG_VERSION"
134
    OraDatabase.Parameters.Remove "PKG_VERSION"
133
    Set OraParameter = Nothing
135
    Set OraParameter = Nothing
134
 
136
 
135
    rsDeps.Close
-
 
136
    Set rsDeps = Nothing
-
 
137
 
-
 
138
End Sub
137
End Sub
139
'-------------------------------------------------
138
'-------------------------------------------------
140
' Function:     Populate_from_Package
139
' Function:     Populate_from_Package
141
' Description:  Generate the body of the display based on package-versions in the current package
140
' Description:  Generate the body of the display based on package-versions in the current package
142
'
141
'
143
Sub Populate_from_Package( NNpv_id, nRtag_id, SShtml_pkg_list, BBDataFound )
142
Sub Populate_from_Package( NNpv_id, nRtag_id, SShtml_pkg_list, BBDataFound )
144
	Dim rsDeps, Query_String
143
    Dim rsDeps, Query_String
145
 
144
 
146
    BBDataFound = FALSE
145
    BBDataFound = FALSE
147
    recCnt = 0
146
    recCnt = 0
148
	Query_String = ReadFile( rootPath & "queries\edit_dependencies.sql" )
147
    Query_String = ReadFile( rootPath & "queries\edit_dependencies.sql" )
149
 
148
 
150
	OraDatabase.Parameters.Add "RTAG_ID", nRtag_id, ORAPARM_INPUT, ORATYPE_NUMBER
149
    OraDatabase.Parameters.Add "RTAG_ID", nRtag_id, ORAPARM_INPUT, ORATYPE_NUMBER
151
	OraDatabase.Parameters.Add "PV_ID", NNpv_id, ORAPARM_INPUT, ORATYPE_NUMBER
150
    OraDatabase.Parameters.Add "PV_ID", NNpv_id, ORAPARM_INPUT, ORATYPE_NUMBER
152
 
151
 
153
	Set rsDeps = OraDatabase.DbCreateDynaset( Query_String, cint(0))
152
    Set rsDeps = OraDatabase.DbCreateDynaset( Query_String, cint(0))
154
	While ((NOT rsDeps.BOF) AND (NOT rsDeps.EOF))
153
    While ((NOT rsDeps.BOF) AND (NOT rsDeps.EOF))
155
        SShtml_pkg_list = SShtml_pkg_list & GenerateEntry( recCnt, rsDeps("pkg_id"), rsDeps("pv_id"), rsDeps("pkg_name"), rsDeps("pkg_version"), rsDeps("build_type"), rsDeps("lpkg_version"))
154
        SShtml_pkg_list = SShtml_pkg_list & GenerateEntry( recCnt, rsDeps("pkg_id"), rsDeps("pv_id"), rsDeps("pkg_name"), rsDeps("pkg_version"), rsDeps("build_type"), rsDeps("lpkg_version"))
156
        recCnt = recCnt + 1
155
        recCnt = recCnt + 1
157
        BBDataFound = TRUE
156
        BBDataFound = TRUE
158
		rsDeps.MoveNext
157
        rsDeps.MoveNext
159
	WEnd
158
    WEnd
160
 
159
 
161
	OraDatabase.Parameters.Remove "RTAG_ID"
160
    OraDatabase.Parameters.Remove "RTAG_ID"
162
	OraDatabase.Parameters.Remove "PV_ID"
161
    OraDatabase.Parameters.Remove "PV_ID"
163
End Sub
162
End Sub
164
 
163
 
165
'-------------------------------------------------
164
'-------------------------------------------------
166
' Function:    GenerateEntry
165
' Function:    GenerateEntry
167
' Description: Generate one line of the import display
166
' Description: Generate one line of the import display
Line 224... Line 223...
224
If (Request("action") = "TextImport") Then
223
If (Request("action") = "TextImport") Then
225
    Call Populate_from_Import ( Request("FRdeps"), HTML_pkg_list, DataFound )
224
    Call Populate_from_Import ( Request("FRdeps"), HTML_pkg_list, DataFound )
226
Else
225
Else
227
    Call Populate_from_Package ( parPv_id, parRtag_id, HTML_pkg_list, DataFound )
226
    Call Populate_from_Package ( parPv_id, parRtag_id, HTML_pkg_list, DataFound )
228
    If Not DataFound Then
227
    If Not DataFound Then
229
       	Response.Redirect ("form_search_pkgs.asp?pv_id="& parPv_id &"&rtag_id="& parRtag_id &"&add_type="& enum_ADD_DEPENDENCIES)
228
        Response.Redirect ("form_search_pkgs.asp?pv_id="& parPv_id &"&rtag_id="& parRtag_id &"&add_type="& enum_ADD_DEPENDENCIES)
230
    End If
229
    End If
231
End If
230
End If
232
%>
231
%>
233
<html>
232
<html>
234
<head>
233
<head>
Line 250... Line 249...
250
// When the page is loaded
249
// When the page is loaded
251
window.onload = scanBadData;
250
window.onload = scanBadData;
252
 
251
 
253
// ValidateForm
252
// ValidateForm
254
function ValidateForm(){
253
function ValidateForm(){
255
	return scanBadData();
254
    return scanBadData();
256
}
255
}
257
 
256
 
258
//	Scan the form for bad entries and update the 'Update' button accordingly
257
//  Scan the form for bad entries and update the 'Update' button accordingly
259
function scanBadData() {
258
function scanBadData() {
260
	var elem = MM_findObj("btn_update")
259
    var elem = MM_findObj("btn_update")
261
	var rv = false;
260
    var rv = false;
262
	if (elem) {
261
    if (elem) {
263
		rv = document.getElementsByClassName("badPackage").length == 0;
262
        rv = document.getElementsByClassName("badPackage").length == 0;
264
		elem.disabled = !rv;
263
        elem.disabled = !rv;
265
	}
264
    }
266
}
265
}
267
 
266
 
268
//  Update all packages to latest version
267
//  Update all packages to latest version
269
function MergeAll() {
268
function MergeAll() {
270
    var recId;
269
    var recId;
271
    for (recId=0; recId<<%=recCnt%>;recId++) {
270
    for (recId=0; recId<<%=recCnt%>;recId++) {
272
		Merge_Version(recId);
271
        Merge_Version(recId);
273
	}
272
    }
274
}
273
}
275
 
274
 
276
// Restore original value
275
// Restore original value
277
function Merge_Version (recId) {
276
function Merge_Version (recId) {
278
    endEditVerNum(recId);
277
    endEditVerNum(recId);
279
    var ediv = MM_findObj("divLPV"+ recId.toString() );
278
    var ediv = MM_findObj("divLPV"+ recId.toString() );
280
    var epkg = MM_findObj("pkgn"+ recId.toString() );
279
    var epkg = MM_findObj("pkgn"+ recId.toString() );
281
 
280
 
282
	var lpkg_version;
281
    var lpkg_version;
283
	el = MM_findObj( "lp" + recId.toString() );
282
    el = MM_findObj( "lp" + recId.toString() );
284
	if (el) {
283
    if (el) {
285
		lpkg_version = el.value;
284
        lpkg_version = el.value;
286
		if(epkg) epkg.value = lpkg_version;
285
        if(epkg) epkg.value = lpkg_version;
287
	}
286
    }
288
    if(ediv) ediv.style.display = "none";
287
    if(ediv) ediv.style.display = "none";
289
 
288
 
290
    var ebad = MM_findObj("divBver"+ recId.toString() );
289
    var ebad = MM_findObj("divBver"+ recId.toString() );
291
    if(ebad) ebad.parentElement.removeChild(ebad);
290
    if(ebad) ebad.parentElement.removeChild(ebad);
292
	scanBadData();
291
    scanBadData();
293
}
292
}
294
 
293
 
295
// Highlight diff between release and user selection
294
// Highlight diff between release and user selection
296
function Compare_Version ( recId ) {
295
function Compare_Version ( recId ) {
297
	var cv, lv, el;
296
    var cv, lv, el;
298
 
297
 
299
    el = MM_findObj( "pkgn" + recId.toString() );
298
    el = MM_findObj( "pkgn" + recId.toString() );
300
	cv = (el) ? el.value : 0;
299
    cv = (el) ? el.value : 0;
301
 
300
 
302
	el = MM_findObj( "lp" + recId.toString() );
301
    el = MM_findObj( "lp" + recId.toString() );
303
	if (el)
302
    if (el)
304
	{
303
    {
305
		lv = el.value;
304
        lv = el.value;
306
		var ediv = MM_findObj("divLPV"+ recId.toString() );
305
        var ediv = MM_findObj("divLPV"+ recId.toString() );
307
		if (ediv)
306
        if (ediv)
308
		{
307
        {
309
			ediv.style.display = (cv == lv) ? 'none' : 'block';
308
            ediv.style.display = (cv == lv) ? 'none' : 'block';
310
		}
309
        }
311
	}
310
    }
312
}
311
}
313
 
312
 
314
// Edit the version number
313
// Edit the version number
315
var editData = new Object();
314
var editData = new Object();
316
function editVerNum(NNpkg_id, recId)
315
function editVerNum(NNpkg_id, recId)
Line 330... Line 329...
330
 
329
 
331
    // Show edit element and hide the fixed text
330
    // Show edit element and hide the fixed text
332
    elem.style.display = 'none';
331
    elem.style.display = 'none';
333
    elemed.style.display = '';
332
    elemed.style.display = '';
334
 
333
 
335
	// Delete the bad version indication
334
    // Delete the bad version indication
336
    var ebad = MM_findObj("divBver"+ recId.toString() );
335
    var ebad = MM_findObj("divBver"+ recId.toString() );
337
    if(ebad) ebad.parentElement.removeChild(ebad);
336
    if(ebad) ebad.parentElement.removeChild(ebad);
338
 
337
 
339
    // Populate essential fields
338
    // Populate essential fields
340
    elemed.onchange = function(){editUpdate(recId);}
339
    elemed.onchange = function(){editUpdate(recId);}
Line 354... Line 353...
354
    np.elem = elem;
353
    np.elem = elem;
355
    np.Value = elem.value;
354
    np.Value = elem.value;
356
 
355
 
357
    // Load version data into this new element
356
    // Load version data into this new element
358
    getVersions(NNpkg_id, recId);
357
    getVersions(NNpkg_id, recId);
359
	scanBadData();
358
    scanBadData();
360
}
359
}
361
 
360
 
362
function editUpdate(recId)
361
function editUpdate(recId)
363
{
362
{
364
    var sd = editData[recId];
363
    var sd = editData[recId];
365
    sd.elem.value = sd.edit.value;
364
    sd.elem.value = sd.edit.value;
366
    Compare_Version(recId);
365
    Compare_Version(recId);
367
	scanBadData();
366
    scanBadData();
368
}
367
}
369
 
368
 
370
// Globals are used to save state information
369
// Globals are used to save state information
371
function endEditVerNum(recId)
370
function endEditVerNum(recId)
372
{
371
{
Line 376... Line 375...
376
        sd.edit.style.display = 'none';
375
        sd.edit.style.display = 'none';
377
        sd.elem.style.display = '';
376
        sd.elem.style.display = '';
378
 
377
 
379
        delete editData[recId];
378
        delete editData[recId];
380
    }
379
    }
381
	scanBadData();
380
    scanBadData();
382
}
381
}
383
 
382
 
384
// Allow the user to populate the version selector box
383
// Allow the user to populate the version selector box
385
// Enables the selector once its been populated
384
// Enables the selector once its been populated
386
// Uses AJAX to populate the item on demand
385
// Uses AJAX to populate the item on demand
Line 494... Line 493...
494
              <tr>
493
              <tr>
495
                <td width="1%" bgcolor="#FFFFFF"><img src="images/h_trsp_dot.gif" width="10" height="100"></td>
494
                <td width="1%" bgcolor="#FFFFFF"><img src="images/h_trsp_dot.gif" width="10" height="100"></td>
496
                <td bgcolor="#FFFFFF" valign="top">
495
                <td bgcolor="#FFFFFF" valign="top">
497
                  <!-- Body -->
496
                  <!-- Body -->
498
                  <table width="100%" border="0" cellspacing="1" cellpadding="2">
497
                  <table width="100%" border="0" cellspacing="1" cellpadding="2">
499
				    <form name="editdep" method="post" action="_update_dependencies.asp" onSubmit="return ValidateForm();">
498
                    <form name="editdep" method="post" action="_update_dependencies.asp" onSubmit="return ValidateForm();">
500
				      <tr>
499
                      <tr>
501
                        <td colspan="2" width="1%" nowrap class="form_field"><%=pkgInfoHash.Item ("pkg_name")%>&nbsp;<%=pkgInfoHash.Item ("pkg_version")%></td>
500
                        <td colspan="2" width="1%" nowrap class="form_field"><%=pkgInfoHash.Item ("pkg_name")%>&nbsp;<%=pkgInfoHash.Item ("pkg_version")%></td>
502
                      </tr>
501
                      </tr>
503
                      <tr>
502
                      <tr>
504
                        <td colspan="2" width="1%" nowrap class="form_field">
503
                        <td colspan="2" width="1%" nowrap class="form_field">
505
                          <table width="100%" border="0" cellspacing="1" cellpadding="2">
504
                          <table width="100%" border="0" cellspacing="1" cellpadding="2">
506
                            <tr>
505
                            <tr>
507
                              <td background="images/bg_form_lightbluedark.gif" nowrap width="1%" class="form_field">Package Name<img src="images/h_trsp_dot.gif" width="1" height="20" align="absmiddle"></td>
506
                              <td background="images/bg_form_lightbluedark.gif" nowrap width="1%" class="form_field">Package Name<img src="images/h_trsp_dot.gif" width="1" height="20" align="absmiddle"></td>
508
                              <td background="images/bg_form_lightbluedark.gif" nowrap width="50%" class="form_field">Version</td>
507
                              <td background="images/bg_form_lightbluedark.gif" nowrap width="50%" class="form_field">Version</td>
509
							  <td background="images/bg_form_lightbluedark.gif" nowrap width="50%" class="form_field">
508
                              <td background="images/bg_form_lightbluedark.gif" nowrap width="50%" class="form_field">
510
                                <a href='javascript:;' onClick='MergeAll();'><img src='images/bt_move_left.gif' border='0' title='Update all to released version' hspace='2' align='absmiddle'></a>
509
                                <a href='javascript:;' onClick='MergeAll();'><img src='images/bt_move_left.gif' border='0' title='Update all to released version' hspace='2' align='absmiddle'></a>
511
								Released
510
                                Released
512
                             </td>
511
                             </td>
513
                            </tr>
512
                            </tr>
514
                      		<%=HTML_pkg_list%>
513
                            <%=HTML_pkg_list%>
515
                            <tr>
514
                            <tr>
516
                              <td nowrap><img src="images/h_trsp_dot.gif" width="120" height="1"></td>
515
                              <td nowrap><img src="images/h_trsp_dot.gif" width="120" height="1"></td>
517
                              <td></td>
516
                              <td></td>
518
							  <td></td>
517
                              <td></td>
519
                            </tr>
518
                            </tr>
520
                          </table></td>
519
                          </table></td>
521
                      </tr>
520
                      </tr>
522
                      <tr>
521
                      <tr>
523
                        <td colspan="2" nowrap>
522
                        <td colspan="2" nowrap>
524
						  <input type="reset" name="btn" value="&laquo; Back" class="form_btn" onClick="history.back();">
523
                          <input type="reset" name="btn" value="&laquo; Back" class="form_btn" onClick="history.back();">
525
                          <input name="btn" type="reset" class="form_btn" value="Cancel" onClick="window.location='dependencies.asp?pv_id=<%=Request("pv_id")%>&rtag_id=<%=Request("rtag_id")%>';">
524
                          <input name="btn" type="reset" class="form_btn" value="Cancel" onClick="window.location='dependencies.asp?pv_id=<%=Request("pv_id")%>&rtag_id=<%=Request("rtag_id")%>';">
526
                          <input type="submit" name="btn" value="Update" class="form_btn" id="btn_update">
525
                          <input type="submit" name="btn" value="Update" class="form_btn" id="btn_update">
527
                          <SPAN id="ProgressBar" name="ProgressBar" style="visibility:hidden;" class="body_scol"><img src="images/i_processing.gif" width="11" height="17" align="absmiddle" hspace="3">Processing...</SPAN>
526
                          <SPAN id="ProgressBar" name="ProgressBar" style="visibility:hidden;" class="body_scol"><img src="images/i_processing.gif" width="11" height="17" align="absmiddle" hspace="3">Processing...</SPAN>
528
                        </td>
527
                        </td>
529
                      </tr>
528
                      </tr>
530
                      <%If HTML_pkg_list = "" Then%>
529
                      <%If HTML_pkg_list = "" Then%>
531
                      <tr>
530
                      <tr>
532
                          <td colspan=3 background='images/bg_form_lightgray.gif' class='form_item err_alert'>No Packages Specified. All dependencies will be deleted</td> 
531
                          <td colspan=3 background='images/bg_form_lightgray.gif' class='form_item err_alert'>No Packages Specified. All dependencies will be deleted</td> 
533
                      </tr>
532
                      </tr>
534
                      <%End If%> 
533
                      <%End If%> 
535
					  <input type="hidden" name="update_type" value="edit_import">
534
                      <input type="hidden" name="update_type" value="edit_import">
536
					  <input type="hidden" name="pv_id" value="<%=parPv_id%>">
535
                      <input type="hidden" name="pv_id" value="<%=parPv_id%>">
537
                      <input type="hidden" name="rtag_id" value="<%=parRtag_id%>">
536
                      <input type="hidden" name="rtag_id" value="<%=parRtag_id%>">
538
                    </form>
537
                    </form>
539
                  </table>
538
                  </table>
540
                  <!-- END Body-->
539
                  <!-- END Body-->
541
                </td>
540
                </td>
Line 552... Line 551...
552
      <!-------------------------------------------------->
551
      <!-------------------------------------------------->
553
    </td>
552
    </td>
554
  </tr>
553
  </tr>
555
  <tr>
554
  <tr>
556
    <td valign="bottom" background="images/bg_lght_gray.gif">
555
    <td valign="bottom" background="images/bg_lght_gray.gif">
557
	<!-- FOOTER -->
556
    <!-- FOOTER -->
558
	<!--#include file="_footer.asp"-->
557
    <!--#include file="_footer.asp"-->
559
	</td>
558
    </td>
560
  </tr>
559
  </tr>
561
</table>
560
</table>
562
</body>
561
</body>
563
</html>
562
</html>
564
<%
563
<%