Subversion Repositories DevTools

Rev

Blame | Last modification | View Log | RSS feed

<%@LANGUAGE="VBSCRIPT"%>
<%
'=====================================================
'|                                                   |
'|                                     NEW                                                   |
'|                                        PACKAGE                                            |
'|                                                   |
'=====================================================
%>
<%
Option explicit
' Good idea to set when using redirect
Response.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"-->

<%
'------------ ACCESS CONTROL ------------------
%>
<!--#include file="_access_control_login.asp"-->
<!--#include file="_access_control_general.asp"-->
<%
'------------ Variable Definition -------------
Dim parAdd_type
Dim parPv_id
Dim retPKG_ID
Dim parUpdate_type
Dim parErrMsg
Dim parPkg_name
'------------ Constants Declaration -----------
'------------ Variable Init -------------------
parAdd_type = Request("add_type")
parUpdate_type = Request("update_type")
parPv_id = Request("pv_id")
parRtag_id = Request("rtag_id")
parErrMsg = Request("errmsg")
parPkg_name = Request.Cookies( COOKIE_NAME )( "pkgfind" )
'----------------------------------------------
%>
<%
Sub Create_Package_Name ( SSpkg_name, retPKG_ID )
        OraDatabase.Parameters.Add "PKG_NAME", Trim(SSpkg_name), ORAPARM_INPUT, ORATYPE_VARCHAR2
        OraDatabase.Parameters.Add "retPKG_ID", 0, ORAPARM_OUTPUT, ORATYPE_NUMBER

        OraSession.BeginTrans

        OraDatabase.ExecuteSQL "BEGIN New_Package_Name ( :PKG_NAME, :retPKG_ID ); END;"

        retPKG_ID = OraDatabase.Parameters("retPKG_ID").Value

        OraSession.CommitTrans
End Sub
'-----------------------------------------------------------------------------------------------------------------------------
Function Package_Name_Is_Valid ( SSpkg_name )
        Dim objRegExpr
        Set objRegExpr = New regexp

        objRegExpr.Pattern = "^[a-z][a-z0-9_-]*[a-z0-9]$"
        objRegExpr.IgnoreCase = True

        Package_Name_Is_Valid = objRegExpr.Test(SSpkg_name)
End Function
'-----------------------------------------------------------------------------------------------------------------------------
Function Package_Name_Exists ( SSpkg_name )
        Dim sqlStr, rsQry

        sqlStr = "SELECT pkg_name FROM packages WHERE UPPER(pkg_name) = UPPER('" & Trim(SSpkg_name) & "')"

        Set rsQry = OraDatabase.DbCreateDynaset( sqlStr, cint(0))

        Package_Name_Exists = rsQry.recordCount > 0
End Function
%>
<%
If CBool(Request("action")) Then
        ' Process Form
        If Package_Name_Exists(Request("pkg_name")) Then
                Response.Redirect ( scriptName &"?rtag_id="& parRtag_id &"&add_type="& parAdd_type &"&errmsg=exists" )
        ElseIf Package_Name_Is_Valid(Request("pkg_name")) Then
                Call Create_Package_Name ( Request("pkg_name"), retPKG_ID )
                Response.Redirect ( "form_add_pkg_versions.asp?pv_id="& parPv_id &"&rtag_id="& parRtag_id &"&add_type="& parAdd_type &"&pkg_list="& retPKG_ID)
        Else
                Response.Redirect ( scriptName &"?rtag_id="& parRtag_id &"&add_type="& parAdd_type &"&errmsg=invalid" )
        End If
End If
%>
<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">
<!--
        function trimString(elementId)
        {
                var element = document.getElementById(elementId);
                if (element.value == null || element.value == "") return null;
                element.value = element.value.replace(/^(\s+)?(.*\S)(\s+)?$/, '$2');
        }
//-->
</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" onLoad="window.document.newpkg.pkgname.focus();">
<!-- 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">&nbsp;</div>
<!----------------------------------------------------->
<!-- HEADER -->
<!--#include file="_header.asp"-->
<!-- BODY ---->
<table width="100%" height="80%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td align="center" valign="top" background="images/bg_lght_gray.gif">
        <!-- MIDDLE ---------------------------------------->
        <table width="650" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td>
              <table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td width="1%"></td>
                  <td align="right"><img src="images/h_trsp_dot.gif" width="30" height="30"></td>
                  <td width="1%"></td>
                </tr>
                <tr>
                  <td width="1%"></td>
                  <td>
                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                      <tr>
                          <td nowrap class="form_ttl">NEW package name</td>
                        <td align="right" valign="bottom"></td>
                      </tr>
                    </table>
                  </td>
                  <td width="1%"></td>
                </tr>
                <tr>
                  <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>
                  <td background="images/lbox_bg_blue.gif" class="lbox_ttl_w"><!-- Heading --><img src="images/h_trsp_dot.gif" width="1" height="20"><!-- END Heading --></td>
                  <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>
                </tr>
                <tr>
                  <td width="1%" bgcolor="#FFFFFF"><img src="images/h_trsp_dot.gif" width="10" height="100"></td>
                  <td bgcolor="#FFFFFF" valign="top">
                    <!-- Body -->
                    <table width="100%" border="0" cellspacing="1" cellpadding="2">
                    <form name="newpkg" method="post" action="<%=scriptName%>" onSubmit="trimString('pkgname');MM_validateForm('pkg_name','Package Name','R<%If parAdd_type = Cstr(enum_ADD_RUNTIME_DEPENDENCIES) Then%>notHTML<%Else%>isPackage<%End If%>');return document.MM_returnValue">
                      <tr>
                        <td width="100%" colspan="3" nowrap align="center" class="form_group">
                        <%If parErrMsg = "invalid" Then
                            Call DisplayInfo( "PKG_NAME_INVALID", 420 )
                          ElseIf parErrMsg = "exists" Then
                            Call DisplayInfo( "PKG_NAME_EXISTS", 300 )
                          End If%>
                        </td>
                      </tr>
                      <tr>
                        <td width="1%">&nbsp;</td>
                        <td width="1%" nowrap class="form_field" background="images/bg_form_lightbluedark.gif"><br>Package Name<br><br></td>
                        <td nowrap width="100%" background="images/bg_form_lightbluedark.gif" class="body_txt"><br><input name="pkg_name" type="text" class="form_item" id="pkgname" size="40" value="<%=parPkg_name%>"><br><br></td>
                      </tr>
                      <tr>
                        <td width="1%">&nbsp;</td>
                        <td width="1%" nowrap class="form_field"><img src="images/h_trsp_dot.gif" width="1" height="1"></td>
                        <td nowrap width="100%">
                        <input type="submit" name="btn" value="Create" class="form_btn">
                        <input type="reset" name="btn" value="Cancel" class="form_btn" onClick="history.back();">
                        <br><br>
                        </td>
                      </tr>
                    <input type="hidden" name="pv_id" value="<%=parPv_id%>">
                    <input type="hidden" name="rtag_id" value="<%=parRtag_id%>">
                    <input type="hidden" name="add_type" value="<%=parAdd_type%>">
                    <input type="hidden" name="action" value="true">
                    </form>
                    </table>
                    <!-- END Body-->
                  </td>
                  <td width="1%" background="images/lbox_bgside_white.gif">&nbsp;</td>
                </tr>
                <tr>
                  <td width="1%" 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 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>
                </tr>
              </table>
            </td>
          </tr>
        </table>
        <!-------------------------------------------------->
        </td>
        </tr>
        <tr>
          <td valign="bottom" background="images/bg_lght_gray.gif">
        <!-- FOOTER -->
        <!--#include file="_footer.asp"-->
          </td>
  </tr>
</table>
</body>
</html>
<%
Call Destroy_All_Objects
%>