Subversion Repositories DevTools

Rev

Rev 171 | Blame | Compare with Previous | Last modification | View Log | RSS feed

<%@LANGUAGE="VBSCRIPT"%>
<%
Option explicit
Response.Expires = 0   ' always load the page, dont store
%>
<%
'=====================================================
'           Update a Project's Code Review Base URL and Jira Key
'=====================================================
%>
<!--#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/common_dbedit.asp"-->
<!--#include file="common/_popup_window_common.asp"-->
<%
' Set rfile parameter. This is a return page after Login
Call objPMod.StoreParameter ( "rfile", "fixed_issues.asp" )
'------------ ACCESS CONTROL ------------------
%>
<!--#include file="_access_control_login.asp"-->
<!--#include file="_access_control_general.asp"-->
<!--#include file="_access_control_project.asp"-->
<%
'------------ Variable Definition -------------
Dim parProj_id
Dim baseURL
Dim jiraKey
'------------ Constants Declaration -----------
'------------ Variable Init -------------------
parProj_id = Request("proj_id")
'----------------------------------------------
%>
<%
'-----------------------------------------------------------------------------------------------------------------------------
Sub Get_Project_Config ( NNproj_id, out_base_url, out_jira_key )
   Dim rsTemp, Query_String

   Query_String = _
   " SELECT base_url, jira_key "&_
   "   FROM projects pr "&_
  "  WHERE pr.proj_id = "& NNproj_id

   Set rsTemp = OraDatabase.DbCreateDynaset( Query_String, cint(0))

   out_base_url = rsTemp("base_url")
   out_jira_key = rsTemp("jira_key")

   rsTemp.Close()
   Set rsTemp = nothing
End Sub
'-----------------------------------------------------------------------------------------------------------------------------------
Sub Update_Project_Config ( nProj_id, sBaseURL, sJiraKey)

   Dim sTempURL
   sTempURL = sBaseURL

   If (sTempURL <> "") and (Right(sTempURL, 1) <> "/") Then sTempURL = sTempURL & "/"

   OraDatabase.Parameters.Add "PROJ_ID",        nProj_id,          ORAPARM_INPUT,    ORATYPE_NUMBER
   OraDatabase.Parameters.Add "BASE_URL",       sTempURL,          ORAPARM_INPUT,    ORATYPE_VARCHAR2
   OraDatabase.Parameters.Add "JIRA_KEY",       sJiraKey,          ORAPARM_INPUT,    ORATYPE_VARCHAR2

   objEH.TryORA ( OraSession )
   On Error Resume Next

   OraDatabase.ExecuteSQL _
   "BEGIN PK_PROJECT.Update_Project_Config ( :PROJ_ID, :BASE_URL, :JIRA_KEY );  END;"

   objEH.CatchORA ( OraSession )

   OraDatabase.Parameters.Remove "PROJ_ID"
   OraDatabase.Parameters.Remove "BASE_URL"
   OraDatabase.Parameters.Remove "JIRA_KEY"

End Sub
'-----------------------------------------------------------------------------------------------------------------------------------
%>
<%
'-----------------------------------------------------------------------------------------------------------------------------------
Function ValidateURL ( sBaseURL )

   Dim oExp
   Set oExp = new RegExp

   oExp.Global = False
   oExp.Pattern = "(^https?:\/\/[a-z1-9])|(^$)"

   ValidateURL = oExp.Test(sBaseURL)
End Function

'-----------------------------------------------------------------------------------------------------------------------------------
Function ValidateJiraKey ( sJiraKey )

   Dim oExp
   Set oExp = new RegExp

   oExp.Global = False
   oExp.Pattern = "^[A-Za-z0-9]*$"

   ValidateJiraKey = oExp.Test(sJiraKey)
End Function
'-----------------------------------------------------------------------------------------------------------------------------------
%>
<%
'------------ Action Requirements -------------------
'Process submition
If CBool(Request("action")) AND objAccessControl.UserLogedIn Then
   If ValidateURL (Request("base_url")) and ValidateJiraKey (Request("jira_key")) Then
      Call Update_Project_Config ( parProj_id, Request("base_url"), Request("jira_key") )
      Call OpenInParentWindow ("admin_projects.asp" )
      Call CloseWindow
   End If
End If

Call Get_Project_Config ( parProj_id, baseURL, jiraKey )

%>
<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>
      <!-- TIPS -->
      <script language="JavaScript" src="images/tipster.js"></script>
      <script language="JavaScript" src="images/_help_tips.js"></script>
   </head>
   <body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" onload="self.focus();">
      <!-- TIPS LAYERS -------------------------------------->
      <div id="formTipsLayer" style="position: absolute; z-index: 1000; visibility: hidden; left:0; top: 0; width: 10">&nbsp;</div>
      <!----------------------------------------------------->
      <form action="_wform_edit_projects.asp" method="post" name="baseurl" onsubmit="MM_validateForm('base_url','Base URL','isURL','jira_key','JIRA Key','isAlphaNum');return document.MM_returnValue;">
         <table width="100%" border="0" cellspacing="0" cellpadding="2" height="100%">
         <tr>
            <td width="1%" background="images/lbox_bg_orange.gif"><img src="images/s_code_review_off.gif" width="21" height="23" hspace="5" border="0"></td>
            <td width="50%" background="images/lbox_bg_blue.gif" nowrap class="wform_ttl">&nbsp;Project Configuration for
               <%=Get_Proj_Name(parProj_id)%>
            </td>
            <td width="50%" background="images/lbox_bg_blue.gif" align="right" nowrap class="wform_ttl">
               <input type="submit" name="btn" value="Save" class="form_btn"> <input type="reset" name="btn" value="Close" class="form_btn" onclick="self.close()">
            </td>
            <td background="images/lbox_bg_blue.gif" align="right" width="1%" nowrap><img src="images/h_trsp_dot.gif" width="5" height="22"></td>
         </tr>
         <tr>
            <td height="100%" width="1%">&nbsp;</td>
            <td valign="top" nowrap colspan="3" class="wform_ttl" background="images/bg_form_lightgray.gif">
               <br>
               <br>
               <table width="100%" border="0" cellspacing="0" cellpadding="0">
               <tr>
                  <td width="1%"><img src="images/h_trsp_dot.gif" width="10" height="30"></td>
                  <td width="100%">
                     <table width="100%" border="0" cellspacing="1" cellpadding="4">
                     <tr>
                        <td nowrap background="images/bg_form_lightbluedark.gif" class="form_field">Code
                           Review Base URL</td>
                        <td nowrap background="images/bg_form_lightbluedark.gif" class="form_item" colspan="3" width="100%">
                           <input name="base_url" type="text" size="78" maxlength="200" class="form_item" value='<%=baseURL%>'></td>
                     </tr>
                     <tr>
                        <td nowrap background="images/bg_form_lightbluedark.gif" class="form_field">JIRA Key</td>
                        <td nowrap background="images/bg_form_lightbluedark.gif" class="form_item" colspan="3" width="100%">
                           <input name="jira_key" type="text" size="78" maxlength="200" class="form_item" value='<%=jiraKey%>'></td>
                     </tr>
                     </table>
                  </td>
               </tr>
               </table>
               <input type="hidden" name="action" value="true">
               <input type="hidden" name="proj_id" value="<%=parProj_id%>">
               <br>
               <br>
            </td>
         </tr>
         <tr>
            <td height="1%" width="1%"><img src="images/h_trsp_dot.gif" width="5" height="5"></td>
            <td valign="top" nowrap colspan="3" class="wform_ttl" background="images/lbox_bg_blue.gif"></td>
         </tr>
         </table>
      </form>
   </body>
</html>
<!-- DESTRUCTOR ------->
<!--#include file="common/destructor.asp"-->