Rev 6579 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
<%@LANGUAGE="VBSCRIPT"%><%Option explicitResponse.Expires = 0 ' always load the page, dont store%><%'=====================================================' _wform_change_licence.asp'' This form is designed to work within an iframe pop up'=====================================================%><!--#include file="common/conf.asp"--><!--#include file="common/globals.asp"--><!--#include file="common/qstr.asp"--><!--#include file="common/common_subs.asp"--><!--#include file="common/common_dbedit.asp"--><!--#include file="common/_popup_window_common.asp"--><%'------------ ACCESS CONTROL ------------------%><!--#include file="_access_control_login.asp"--><!--#include file="_access_control_general.asp"--><!--#include file="_access_control_project.asp"--><%'------------ Variable Definition -------------Dim parPv_idDim sMessage, sMessageType'------------ Constants Declaration -----------'------------ Variable Init -------------------Set pkgInfoHash = CreateObject("Scripting.Dictionary")parPv_id = QStrPar("pv_id")sMessage = NULLsMessageType = 3'----------------------------------------------%><%'------------------------------------------------------------------------------------------------------------------------------------------'' Add a line of text to the System Message' eLevel - 1 == Critical, 2==Warning, 3==NoteSub sMessageAdd(eLevel, text)If NOT isNull(sMessage) ThensMessage = sMessage & "<br>"End IfsMessage = sMessage & textIf eLevel < sMessageType ThensMessageType = eLevelEnd IfEnd SubSub Get_Pkg_Info_With_Licence ( NNpv_id )Dim rsTemp, Query_StringQuery_String = _" SELECT pkg.pkg_name, pv.pkg_version, NVL(ld.licence, -2) as licence_id"&_" FROM packages pkg, package_versions pv, licencing ld"&_" WHERE pkg.pkg_id = pv.pkg_id"&_" AND pv.pv_id = " & NNpv_id &_" AND ld.pv_id(+) = pv.pv_id"Set rsTemp = OraDatabase.DbCreateDynaset( Query_String, cint(0))If ((NOT rsTemp.BOF) AND (NOT rsTemp.EOF)) ThenpkgInfoHash.Add "pkg_name", (rsTemp.Fields("pkg_name"))pkgInfoHash.Add "pkg_version", (rsTemp.Fields("pkg_version"))pkgInfoHash.Add "licence_id", (rsTemp.Fields("licence_id"))End IfrsTemp.CloseSet rsTemp = nothingEnd SubFunction Licence_List ( )Licence_List = _" SELECT l.licence as licence_id, l.name"&_" FROM licences l "&_" ORDER BY UPPER(l.name)"End FunctionFunction Update_Licence ( NNpv_id, NNlicence_id )Dim rsTemp, Query_String, sCommentsDim licenceTextUpdate_Licence = FALSEIf CInt(NNlicence_id) < 0 ThenUpdate_Licence = TRUEExit FunctionEnd If' Check for a chnageIf CInt(NNlicence_id) = CInt(pkgInfoHash.Item("licence_id")) ThenUpdate_Licence = TRUEExit FunctionEnd If'-- Get licence details. Next text name for loggingQuery_String = _" SELECT licence, name"&_" FROM licences"&_" WHERE licence = "& NNlicence_idSet rsTemp = OraDatabase.CreateDynaset( Query_String, cint(0))licenceText = rsTemp.Fields("name").ValueIf isNUll(licenceText) OR licenceText = "" ThensMessageAdd 1, "Licence text cannot be found"Exit FunctionEnd IfrsTemp.CloseSet rsTemp = nothingQuery_String = _"MERGE INTO LICENCING ld" &_" USING (SELECT "& NNpv_id & " pv_id, "& NNlicence_id & " licence from dual) s" &_" ON (ld.pv_id = s.pv_id)" &_" WHEN MATCHED THEN UPDATE SET ld.licence = s.licence" &_" WHEN NOT MATCHED THEN INSERT (pv_id, licence) VALUES (s.pv_id, s.licence)"sComments = "Set: " & licenceText'-- Update database to change the ownerobjEH.ErrorRedirect = FALSEobjEH.TryORA ( OraSession )On Error Resume Next' Update the licenceOraDatabase.ExecuteSQL Query_StringobjEH.CatchORA ( OraSession )If objEH.LastOraFailed = FALSE Then'-- Log the changeCall Log_Action ( NNpv_id, "software_licence", sComments )Update_Licence = TRUEEnd IfEnd FunctionFunction Delete_Licence ( NNpv_id )Dim rsTemp, Query_String, sCommentsDelete_Licence = FALSE' Delete any exsiting licence' Check for a changeIf CInt(pkgInfoHash.Item("licence_id")) < 0 ThenDelete_Licence = TRUEExit FunctionEnd If'-- Update database to change the ownerobjEH.ErrorRedirect = FALSEobjEH.TryORA ( OraSession )On Error Resume Next' Update the licenceOraDatabase.ExecuteSQL _" DELETE from LICENCING ld "&_" WHERE ld.pv_id = "& NNpv_idobjEH.CatchORA ( OraSession )If objEH.LastOraFailed = FALSE Then'-- Log the changeCall Log_Action ( NNpv_id, "software_licence", "Deleted Licence" )Delete_Licence = TRUEEnd IfEnd Function%><%Call Get_Pkg_Info_With_Licence ( parPv_id )'Process submitionIf CBool(QStrPar("action")) AND objAccessControl.UserLogedIn ThenIf Request("btn") = "Delete" ThenIf Delete_Licence (parPv_id) ThenCall ReloadParentWindowCall CloseWindowEnd IfElseIf Update_Licence ( parPv_id, Request("licence_id") ) ThenCall ReloadParentWindowCall CloseWindowEnd IfEnd IfEnd If%><%If objAccessControl.UserId = "" ThensMessageAdd 1, "No longer logged in"End If%><html><head><title>Release Manager</title><link rel="shortcut icon" href="<%=FavIcon%>"/><meta HTTP-EQUIV="Pragma" CONTENT="no-cache"><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><link 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/tipster.js"></script><script language="JavaScript" src="images/_help_tips.js"></script><script language="JavaScript" src="images/common.js"></script></head><body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" onload="self.focus();"><form name="chowner" method="post" action="<%=scriptName%>" class="form_tight"><table border="0" cellspacing="0" cellpadding="2" width="100%"><tr><td valign="top" nowrap colspan="3" class="wform_ttl" background="images/bg_form_lightgray.gif"><!-- MESSAGE +++++++++++++++++++++++++++++++++++++++++++++++++++ --><%Call Messenger ( sMessage , sMessageType, "100%" )%><!-- MESSAGE +++++++++++++++++++++++++++++++++++++++++++++++++++ --><!--#include file="messages/_msg_inline.asp"--><table width="100%" border="0" cellspacing="1" cellpadding="2"><tr><!-- Package Name and Version --><td width="1%" nowrap class="form_field" background="images/bg_form_lightbluedark.gif">Package</td><td nowrap width="100%" background="images/bg_form_lightbluedark.gif" class="form_txt"><%=pkgInfoHash.Item ("pkg_name") &" "& pkgInfoHash.Item ("pkg_version")%></td></tr><tr><!-- Usage in other versions --><%Dim otherUseSet otherUse = OraDatabase.DbCreateDynaset( _"SELECT ld.NAME, count(*) as count" &_" FROM licencing l," &_" LICENCES ld" &_" WHERE l.pv_id IN" &_" (SELECT pv_id FROM package_versions WHERE pkg_id IN (SELECT pkg_id FROM package_versions WHERE pv_id="&parPv_id&" )" &_" )" &_" AND l.LICENCE = ld.LICENCE" &_" group by ld.NAME" &_" ORDER BY UPPER(ld.NAME)" _, cint(0))%><td width="1%" nowrap class="form_field" background="images/bg_form_lightbluedark.gif">Usage</td><td nowrap width="100%" background="images/bg_form_lightbluedark.gif" class="form_txt"><%If otherUse.RecordCount > 0 Then%><table width="100%" border="0" cellspacing="1" cellpadding="2" ><tr class="form_field"><td>Licence</td><td>Count</td></tr><%While ((NOT otherUse.BOF) AND (NOT otherUse.EOF))%><tr class="form_item"><td><%=otherUse("name")%></td><td><%=otherUse("count")%></td></tr><%otherUse.MoveNextWEndotherUse.Closeset otherUse = nothing%></table><%End If%></td></tr><tr><!-- Package Licence --><td width="1%" nowrap class="form_field" background="images/bg_form_lightbluedark.gif">Licence</td><td nowrap width="100%" background="images/bg_form_lightbluedark.gif"><select name="licence_id" class="form_item"><option value=-2>None Selected</option><%Dim rsLicencesSet rsLicences = OraDatabase.DbCreateDynaset( Licence_List( ), cint(0))While ((NOT rsLicences.BOF) AND (NOT rsLicences.EOF))%><option <%If CInt(rsLicences("licence_id")) = CInt(pkgInfoHash.Item("licence_id")) Then%>selected<%End If%> value="<%=rsLicences.Fields("licence_id")%>"><%=rsLicences.Fields("name")%></option><% rsLicences.MoveNextWEndrsLicences.Closeset rsLicences = nothing%></select><input type="hidden" name="pv_id" value="<%=parPv_id%>"><input type="hidden" name="rtag_id" value="<%=parRtag_id%>"><input type="hidden" name="action" value="true"></td></tr></table></td></tr><tr><td align="right"><input type="submit" name="btn" value="Update" class="form_btn_comp"><input type="submit" name="btn" value="Delete" class="form_btn_comp"><input type="reset" name="btn" value="Cancel" class="form_btn_comp" onclick="parent.closeIFrame();"></td></tr></table></form></body></html><!-- DESTRUCTOR -------><!--#include file="common/destructor.asp"-->