Rev 129 | Blame | Compare with Previous | Last modification | View Log | RSS feed
<%@LANGUAGE="VBSCRIPT"%><%'====================================================='| |'| Eidt Release Licencing Details |'| |'=====================================================Option explicit' Good idea to set when using redirectResponse.Expires = 0 ' always load the page, dont store%><!--#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"--><%' Make sure rtag_id is always presentIf Request("rtag_id") = "" ThenResponse.Redirect("index.asp")End If' Set rfile parameter. This is a return page after LoginCall objPMod.StoreParameter ( "rfile", "dependencies.asp" )'------------ ACCESS CONTROL ------------------%><!--#include file="_access_control_login.asp"--><!--#include file="_access_control_general.asp"--><!--#include file="_access_control_project.asp"--><%'------------ Variable Definition -------------Dim selectedLicenceDim httpReferer'------------ Constants Declaration -----------Const available_licences_query_string = " SELECT * from licences ORDER BY UPPER(name) "'------------ Variable Init -------------------httpReferer = "dependencies.asp?rtag_id="& CStr(parRtag_Id)' Obtain selected licence from parameter list in the URL. If none given, set the default initial' value to -1 to initiate its selection during html page renderingselectedLicence = Request("selected_licence")If (IsNull(selectedLicence) OR selectedLicence = "") ThenselectedLicence = -1End If'--------------------------------------------------------------------------------------------------------------------------' release_licencing_query_string'' DESCRIPTION' Constructs a query string using the provided release tag, designed to elicit' a list of PV_ID's, thier package names, versions and extensions, from the' release'' INPUTS' NNrtag_id : The release tag to be used in the query string'Function release_licencing_query_string(NNrtag_id)release_licencing_query_string = "SELECT * FROM ("&_" SELECT pv.pv_id, pkg.pkg_name, pv.pkg_version, pv.v_ext"&_" FROM release_content rc, package_versions pv, packages pkg "&_" WHERE rc.rtag_id = "& CStr(NNrtag_id) &_" AND pv.pv_id = rc.pv_id "&_" AND pkg.pkg_id = pv.pkg_id "&_" UNION "&_" SELECT pv.pv_id, pkg.pkg_name, pv.pkg_version, pv.v_ext"&_" FROM work_in_progress wip, package_versions pv, packages pkg "&_" WHERE wip.rtag_id = "& CStr(NNrtag_id) &_" AND pv.pv_id = wip.pv_id "&_" AND pkg.pkg_id = pv.pkg_id "&_" UNION "&_" SELECT pv.pv_id, pkg.pkg_name, pv.pkg_version, pv.v_ext"&_" FROM planned pl, package_versions pv, packages pkg"&_" WHERE pl.rtag_id = "& CStr(NNrtag_id) &_" AND pv.pv_id = pl.pv_id "&_" AND pkg.pkg_id = pv.pkg_id "&_" AND (pl.operation IS NULL OR pl.operation = 'R') "&_") ORDER BY UPPER(pkg_name), UPPER(v_ext), pv_id DESC"End Function'--------------------------------------------------------------------------------------------------------------------------' IsLicenced'' DESCRIPTION' Queries the database to determine if a supplied PV_ID is associated with' the provided licence'' INPUTS' NNpv_id : The PV_ID of the package version being examined' NNlicence : The licence to be examined'' OUTPUTS' TRUE if the PV_ID is associated with the licence, else FALSE'Function IsLicenced(NNpv_id, NNlicence)Dim IsLicencedQueryDim IsLicencedQueryResultsIsLicencedQuery = "SELECT * FROM licencing WHERE pv_id=" & CStr(NNpv_id) & " AND licence=" & CStr(NNlicence)Set IsLicencedQueryResults = OraDatabase.DbCreateDynaset( IsLicencedQuery, cint(0))If IsLicencedQueryResults.RecordCount = 0 ThenIsLicenced = FALSEElseIsLicenced = TRUEEnd IfIsLicencedQueryResults.Close()Set IsLicencedQueryResults = nothingEnd Function'--------------------------------------------------------------------------------------------------------------------------' AddLicencing'' DESCRIPTION' Adds a licencing relationship to the database for the supplied PV_ID, and the' supplied Licence'' INPUTS' NNpv_id : The PV_ID of the package version to be used' NNlicence : The licence to be used'Sub AddLicencing(NNpv_id, NNlicence)OraDatabase.Parameters.Add "PV_ID", NNpv_id, ORAPARM_INPUT, ORATYPE_NUMBEROraDatabase.Parameters.Add "LICENCE", NNlicence, ORAPARM_INPUT, ORATYPE_NUMBEROn Error Resume NextobjEH.TryORA( OraSession )OraDatabase.ExecuteSQL ("begin INSERT INTO licencing (pv_id, licence) VALUES (:PV_ID, :LICENCE); end;")objEH.CatchORA( OraSession )OraDatabase.Parameters.Remove "PV_ID"OraDatabase.Parameters.Remove "LICENCE"End Sub'--------------------------------------------------------------------------------------------------------------------------' RemoveLicencing'' DESCRIPTION' Removes a licencing relationship from the database for the supplied PV_ID, and the' supplied Licence'' INPUTS' NNpv_id : The PV_ID of the package version to be used' NNlicence : The licence to be used'Sub RemoveLicencing(NNpv_id, NNlicence)OraDatabase.Parameters.Add "PV_ID", NNpv_id, ORAPARM_INPUT, ORATYPE_NUMBEROraDatabase.Parameters.Add "LICENCE", NNlicence, ORAPARM_INPUT, ORATYPE_NUMBEROn Error Resume NextobjEH.TryORA( OraSession )OraDatabase.ExecuteSQL ("begin DELETE FROM licencing WHERE pv_id=:PV_ID AND licence=:LICENCE; end;")objEH.CatchORA( OraSession )OraDatabase.Parameters.Remove "PV_ID"OraDatabase.Parameters.Remove "LICENCE"End Sub'--------------------------------------------------------------------------------------------------------------------------' initialLicence'' DESCRIPTION' Queries the database for a list of licences, and returns the first one in the list' which will be used as the default licence prior to a user making a specific alternative' selection via the drop down list'' OUTPUTS' The first licence from the list, else -1 if list is empty'Function initialLicenceDim initialLicenceQuerySet initialLicenceQuery = OraDatabase.DbCreateDynaset( available_licences_query_string, cint(0) )If ((initialLicenceQuery.RecordCount > 0) AND (NOT initialLicenceQuery.BOF) AND (NOT initialLicenceQuery.EOF)) TheninitialLicence = CDbl(initialLicenceQuery("licence"))ElseinitialLicence = -1End IfinitialLicenceQuery.Close()Set initialLicenceQuery = nothingEnd Function'--------------------------------------------------------------------------------------------------------------------------' CheckFormEntryConditions'' DESCRIPTION' Checks some conditions of entry to the form and takes action when conditions are not met'Sub CheckFormEntryConditionsDim CheckFormEntryConditionsQuery' Check that at least one licence exists that can be associated with specific package versions. If there are no' licences, then the form cannot be used.Set CheckFormEntryConditionsQuery = OraDatabase.DbCreateDynaset( available_licences_query_string, cint(0) )If CheckFormEntryConditionsQuery.RecordCount = 0 ThenCheckFormEntryConditionsQuery.Close()Set CheckFormEntryConditionsQuery = nothingCall RaiseMsg( enum_MSG_NO_LICENCES_EXIST & "?rtag_id=" & CStr(parRtag_Id), 0 )End IfCheckFormEntryConditionsQuery.Close()Set CheckFormEntryConditionsQuery = nothingEnd Sub'--------------------------------------------------------------------------------------------------------------------------' CheckFormSubmitActions'' DESCRIPTION' Checks for any form submit actions and processes them accordingly'' The form has a number of submit buttons (OK, APPLY, CANCEL)'' The OK and APPLY buttons lead to the checkbox states being used to update the database.' The database updates are not performed when the CANCEL button is pressed.'' Pressing OK or CANCEL takes the user out of the form and back to the original referer page.' Pressing APPLY leaves the user in the form so that they may make further licencing changes.'Sub CheckFormSubmitActionsIf Request("action") <> "" ThenIf objForm.IsValidOnPostBack ThenIf Request("btn_submit") = "Apply" OR Request("btn_submit") = "OK" ThenDim checkedItemsFromFormDim checkedItemsArrayDim itemDim parSelectedLicenceDim checkedItemsDictDim rsQry' Get the selected licence - and cater for situation where user has not changed the selected licence in' the drop down list since first opening the formparSelectedLicence = Request("selected_licence")If (IsNull(parSelectedLicence) OR parSelectedLicence = "") ThenparSelectedLicence = initialLicence()End If' Get the list of checked items from the form. They will be in a CSV format.' Split the list at the commas and read each item into a dictionary so we can use it for testing against the' full set of PV_IDs we get later.Set checkedItemsDict = CreateObject("Scripting.Dictionary")checkedItemsFromForm = Request("checked_pv_id_list")checkedItemsArray = Split(checkedItemsFromForm,",")For Each item in checkedItemsArraycheckedItemsDict.Add Trim(CStr( item )), ""Next' Get the record set for the entire set of PV_IDs in the releaseSet rsQry = OraDatabase.DbCreateDynaset( release_licencing_query_string(parRtag_Id), cint(0) )Do While (NOT rsQry.BOF) AND (NOT rsQry.EOF)' If the user has checked the item, and it does not already exist in the licencing table associated to the selected licence,' then add a new row to the table to create that associatationIf checkedItemsDict.Exists(CStr(rsQry("pv_id"))) ThenIf (NOT IsLicenced(rsQry("pv_id"), parSelectedLicence)) ThenCall AddLicencing(rsQry("pv_id"), parSelectedLicence)End IfElse' Item is not checked, so we need to ensure that any association to the selected licence is removed' from the licencing table.If (IsLicenced(rsQry("pv_id"), parSelectedLicence)) ThenCall RemoveLicencing(rsQry("pv_id"), parSelectedLicence)End IfEnd IfrsQry.MoveNextLoop' destroy objectsrsQry.Close()Set rsQry = nothingcheckedItemsDict.RemoveAllSet checkedItemsDict = nothing' figure out where to go nextIf Request("btn_submit") = "OK" Then' User has finished making licencing changes so go back to the referer pageCall OpenInWindow ( httpReferer )Else' else user pressed Apply, so stay in the form to let user make further licencing changesCall OpenInWindow ( "form_edit_release_licencing.asp?rtag_id=" & Request("rtag_id") & "&selected_licence=" & parSelectedLicence )End IfElse' User has cancelled so go back to the referer pageCall OpenInWindow ( httpReferer )End IfEnd IfEnd IfEnd Sub'--------------------------------------------------------------------------------------------------------------------------' LicenceDropDownHTML'' DESCRIPTION' Constructs the HTML to render the drop down list and whilst doing so, updates the global selectedLicence variable'Function LicenceDropDownHTMLDim rsQryDim html_string' Get the full list of licences availabel from the databaseSet rsQry = OraDatabase.DbCreateDynaset( available_licences_query_string, cint(0) )' Start of select tag' This is designed such that when the user changes the selection, the page is re-rendered with the selected licence value passed' in as a paramter as part of the URL along with the release tagehtml_string = "<select name='selected_licence'"html_string = html_string & " onChange=""Cascaded_Menu('parent','"& scriptName &"?rtag_id="& parRtag_Id &"&selected_licence=',this,0)"""html_string = html_string & " class='form_item'>"' Add each licence to the select, using the option tag, and set the initially selected optionWhile (NOT rsQry.BOF) AND (NOT rsQry.EOF)If CDbl(Request("selected_licence")) = CDbl(rsQry.Fields("licence")) or selectedLicence = -1 Thenhtml_string = html_string & "<option value='"& rsQry.Fields("licence") &"' selected>"& rsQry.Fields("name") &"</option>"selectedLicence = CDbl(rsQry("licence"))Elsehtml_string = html_string & "<option value='"& rsQry.Fields("licence") &"'>"& rsQry.Fields("name") &"</option>"End IfrsQry.MoveNextWEnd' destroy objectsrsQry.Close()Set rsQry = nothing' End of select taghtml_string = html_string & "</select>"' return resultLicenceDropDownHTML = html_stringEnd Function'--------------------------------------------------------------------------------------------------------------------------' PV_ID_ListHTML'' DESCRIPTION' Constructs the HTML to render the rows of checkboxes, package names, versions and extensions'Function PV_ID_ListHTMLDim rsQryDim html_stringSet rsQry = OraDatabase.DbCreateDynaset( release_licencing_query_string(parRtag_Id), cint(0) )'--- Render rows ---Do While (NOT rsQry.BOF) AND (NOT rsQry.EOF)' BEGIN ROWhtml_string = html_string & "<tr>"' CHECKBOXIf (IsLicenced(rsQry("pv_id"), selectedLicence)) Thenhtml_string = html_string & "<td align='center'><input type='checkbox' name='checked_pv_id_list' value=" & rsQry("pv_id") & " checked></td>"Elsehtml_string = html_string & "<td align='center'><input type='checkbox' name='checked_pv_id_list' value=" & rsQry("pv_id") & "></td>"End If' PACKAGE NAMEhtml_string = html_string & "<td nowrap class='body_rowg'>" & rsQry("pkg_name") & "</td>"' PACKAGE VERSIONIf IsNull(rsQry("v_ext")) Thenhtml_string = html_string & "<td nowrap class='body_rowg'>" & rsQry("pkg_version") & "</td>"Elsehtml_string = html_string & "<td nowrap class='body_rowg'>" & Left(rsQry("pkg_version"), Len(rsQry("pkg_version")) - Len(rsQry("v_ext")) ) & "</td>"End If' PACKAGE EXTENSIONhtml_string = html_string & "<td nowrap class='body_rowg'>" & rsQry("v_ext") & "</td>"' END ROWhtml_string = html_string & "</tr>"rsQry.MoveNext' ROW SEPERATORIf (NOT rsQry.BOF) AND (NOT rsQry.EOF) Thenhtml_string = html_string & "<tr><td colspan='8' background='images/bg_table_border.gif'><img src='images/spacer.gif' width='1' height='1'></td></tr>"End IfLoop' destroy objectsrsQry.Close()Set rsQry = nothing' return resultPV_ID_ListHTML = html_stringEnd Function'--------------------------------------------------------------------------------------------------------------------------'--------------------------------------------------------------------------------------------------------------------------'------------ RUN BEFORE PAGE RENDER ----------Call CheckFormEntryConditions()Call CheckFormSubmitActions()'----------------------------------------------%><html><head><title>Release Manager</title><meta HTTP-EQUIV="Pragma" CONTENT="no-cache"><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><link rel="stylesheet" href="images/release_manager_style.css" type="text/css"><link rel="stylesheet" href="images/navigation.css" type="text/css"><script language="JavaScript" src="images/common.js"></script><script language="JavaScript" src="scripts/remote_scripting.js"></script><!-- DROPDOWN MENUS --><!--#include file="_menu_def.asp"--><script language="JavaScript1.2" src="images/popup_menu.js"></script></head><body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0"><!-- MENU LAYERS --------------------------------------><div id="popmenu" class="menuskin" onMouseover="clearhidemenu();highlightmenu(event,'on')" onMouseout="highlightmenu(event,'off');dynamichide(event)"></div><!-- TIPS LAYERS --------------------------------------><div id="formTipsLayer" style="position: absolute; z-index: 1000; visibility: hidden; left:0; top: 0; width: 10"> </div><!-----------------------------------------------------><!-- HEADER --><!--#include file="_header.asp"--><!-- BODY ----><table width="100%" border="0" cellspacing="0" cellpadding="0"><%'-- FROM START ---------------------------------------------------------------------------------------------------------objFormComponent.FormName = "FormName"objFormComponent.Method = "post"objFormComponent.Action = ScriptName & "?rtag_id=" & parRtag_Id & "&selected_licence=" & Request("selected_licence")Call objFormComponent.FormStart()%><tr><td width="1" background="images/bg_home_orange.gif" valign="top"></td><td width="100%" rowspan="2" align="center" valign="top" bgcolor="#EEEFEF"><table width="10" border="0" cellspacing="0" cellpadding="0"><tr><td width="1%"></td><td width="100%"><table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td nowrap class="body_txt"></td></tr></table><table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td nowrap class="form_ttl"><p> </p><p>EDIT RELEASE LICENCING DETAILS</p></td><td align="right" valign="bottom"></td></tr></table></td><td width="1%"></td></tr><tr><td align="left" valign="top" background="images/lbox_bg_blue.gif"><img src="images/lbox_tl_cnr_b.gif" width="13" height="13"></td><td background="images/lbox_bg_blue.gif" class="lbox_ttl_w"><img src="images/h_trsp_dot.gif" width="600" height="15"></td><td align="right" valign="top" background="images/lbox_bg_blue.gif"><img src="images/lbox_tr_cnr_b.gif" width="13" height="13"></td></tr><tr><td bgcolor="#FFFFFF"><img src="images/h_trsp_dot.gif" width="10" height="100"></td><td bgcolor="#FFFFFF" valign="top"><%%><!-- MESSAGE +++++++++++++++++++++++++++++++++++++++++++++++++++ --><!--#include file="messages/_msg_inline.asp"--><!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --><br><table width="100%" border="0" cellspacing="2" cellpadding="0"><tr><td nowrap class="form_iname" valign="top">Select Licence</td><td valign="top" nowrap class="form_iname"><%=LicenceDropDownHTML()%></td><td width="9%" valign="top"></td><tr><td valign="top" nowrap background="images/bg_table_col.gif" class="body_col"></td><td valign="top" nowrap background="images/bg_table_col.gif" class="body_col">Package Name</td><td valign="top" nowrap background="images/bg_table_col.gif" class="body_col">Package Version</td><td valign="top" nowrap background="images/bg_table_col.gif" class="body_col">Package Extension</td><td valign="top"></tr><%=PV_ID_ListHTML()%><tr><td class="form_iname"> </td><td> </td><td class="val_err"></td></tr></tr></table></td><td background="images/lbox_bgside_white.gif"> </td></tr><tr><td background="images/bg_action_norm.gif" ></td><td align="right" background="images/bg_action_norm.gif" ><input name="btn_submit" type="submit" class="form_btn" value="OK"><input name="btn_submit" type="submit" class="form_btn" value="Apply"><input name="btn_submit" type="submit" class="form_btn" value="Cancel"><input type="hidden" name="action" value="true"></td><td background="images/bg_action_norm.gif" ><img src="images/h_trsp_dot.gif" width="5" height="30"></td></tr><tr><td background="images/lbox_bg_blue.gif" valign="bottom"><img src="images/lbox_bl_cnr_b.gif" width="13" height="13"></td><td background="images/lbox_bg_blue.gif"></td><td background="images/lbox_bg_blue.gif" valign="bottom" align="right"><img src="images/lbox_br_cnr_b.gif" width="13" height="13"></td></tr></table></td><td width="1" valign="top"><img src="images/h_trsp_dot.gif" width="1" height="1"></td></tr><tr><td valign="bottom" align="center" background="images/bg_home_orange.gif"><img src="images/img_vtree.gif" width="86" height="99" vspace="20" hspace="30"></td><td background="images/bg_lght_gray.gif" valign="top"><img src="images/h_trsp_dot.gif" width="1" height="500"></td></tr><%Call objFormComponent.FormEnd()'-- FROM END ----------------------------------------------------------------------------------------------------------------%></table><!-- FOOTER --><!--#include file="_footer.asp"--></body></html><%Call Destroy_All_Objects%>