Subversion Repositories DevTools

Rev

Blame | Last modification | View Log | RSS feed

<%@LANGUAGE="VBSCRIPT"%>
<%
'=====================================================
'|                                                   |
'|                   wAddProjectExtension            |
'|                                                   |
'=====================================================
%>
<%
Option explicit
Response.Expires = 0
%>
<!--#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"-->
<!-- #INCLUDE FILE="common/adovbs.inc" -->


<%
'------------ ACCESS CONTROL ------------------
%>
<!--#include file="_access_control_general.asp"-->
<!--#include file="_access_control_login.asp"-->
<%
'------------ VARIABLE DEFINITION -------------
Dim rsQry
Dim sMessage
Dim Query_String

'------------ CONSTANTS DECLARATION -----------
'------------ VARIABLE INIT -------------------
sMessage = NULL


Set objFormCollector = CreateObject("Scripting.Dictionary")
'------------ CONDITIONS ----------------------
'----------------------------------------------
function showCheck (val)
    if val = "Y" Then
        showCheck = "checked"
    Else
        showCheck = ""
    End If
End Function

function niceBool (val)
    if val = "Y" Then
        niceBool = "Y"
    Else
        niceBool = "N"
    End If
End Function

Sub checkExt (val)
   Dim objRegExpr
   Set objRegExpr = New regexp

   objRegExpr.Pattern = "^\.[a-z]{2,4}$"
   objRegExpr.IgnoreCase = False
   If NOT objRegExpr.Test(val) Then
        sMessage = "New project extension is not suitable. Must start with a 'dot' and must be between 2 and 4 lowercase characters"
   End If
End Sub

Sub performAction
    Dim rowCount
    rowCount = -1

    '
    ' Determine if the named project suffix exists
    ' Count the rows in the query
    '
    If Request("newext") <> "" Then

        checkExt(Request("newext"))
        If not isNull (sMessage) then Exit Sub

        Query_String = "SELECT EXT_NAME from PROJECT_EXTENTIONS WHERE EXT_NAME = '" & Request("newext") & "'"
            Set rsQry = OraDatabase.DbCreateDynaset( Query_String, ORADYN_DEFAULT )
        rowCount = rsQry.RecordCount
                rsQry.Close()
                Set rsQry = nothing
    Else
        sMessage = "No Project Extension specified"
        Exit Sub
    End If

   If Request("ext") <> "" Then
    '
    '   Update an existing entry
    '
    If (rowCount > 0) AND ( Request("ext") <> Request("newext")) Then
        sMessage = "Cannot rename the project extension to an existing value"
    Else
        Query_String = "SELECT * from PROJECT_EXTENTIONS WHERE EXT_NAME = '" & Request("ext") & "'"
            Set rsQry = OraDatabase.DbCreateDynaset( Query_String, ORADYN_DEFAULT )
        rsQry.Edit
        rsQry.Fields("EXT_NAME").Value = Request("newext")
        rsQry.Fields("UCOMMENT").Value = Request("comment")
        rsQry.Fields("IS_COTS").Value = niceBool(Request("isCots"))
        rsQry.Fields("IS_VISIBLE").Value = niceBool(Request("isVis"))
        rsQry.Update
        rsQry.Close
        Set rsQry = Nothing
        Call OpenInParentWindow ("admin_project_suffix.asp?ext="&Request("newext"))
        Call CloseWindow()
    End If
   Else
    '
    ' Insert a new entry into the table
    '
    If rowCount > 0 Then
        sMessage = "Project extension already exists"
    ElseIf rowCount < 0 Then
        sMessage = "No Project Extension specified"
    Else
        Query_String = "SELECT * from PROJECT_EXTENTIONS"
            Set rsQry = OraDatabase.DbCreateDynaset( Query_String, ORADYN_DEFAULT )
        rsQry.AddNew
        rsQry.Fields("EXT_NAME").Value = Request("newext")
        rsQry.Fields("UCOMMENT").Value = Request("comment")
        rsQry.Fields("IS_COTS").Value = niceBool(Request("isCots"))
        rsQry.Fields("IS_VISIBLE").Value = niceBool(Request("isVis"))
        rsQry.Update
        rsQry.Close
        Set rsQry = Nothing
        Call OpenInParentWindow ("admin_project_suffix.asp?ext="&Request("newext"))
        Call CloseWindow()
    End If
   End If

End Sub

%>
<%
'------------ RUN BEFORE PAGE RENDER ----------

If CBool(Request("action")) Then
    performAction()
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 href="images/release_manager_style.css" rel="stylesheet" type="text/css">
<script language="JavaScript" src="scripts/common.js"></script>
</head>

<body background="images/bg_bage_0.gif" leftmargin="0" topmargin="0" onLoad="self.focus();FormName.display_name.focus();">
<table width="100%"  border="0" cellspacing="0" cellpadding="10">
   <tr>
      <td bgcolor="#FFFFFF" class="body_txt"><span class="body_h1"><img src="icons/i_linkarrow_black.gif" width="11" height="11" align="absmiddle">&nbsp;Add/Update Project Extension</span> <br>
         Add a new Project Extension or edit an existing Project Extension.
      </td>
   </tr>

   <%
   '-- FORM START --------------------------------------------------------------------------------------------------------------
   objFormComponent.FormName = "FormName"
   objFormComponent.Action = ScriptName
   objFormComponent.OnSubmit = "ShowProgress();"
   Call objFormComponent.FormStart()

   %>
   <tr>
      <td background="images/bg_login.gif">
         <table width="50%"  border="0" cellspacing="0" cellpadding="0">
            <tr>
               <td><%=ProgressBar()%></td>
               <td align="right"><input name="btn" type="submit" class="form_btn" value="Add/Update">
                  <input name="btn" type="reset" class="form_btn" value="Cancel" onClick="self.close();">
               </td>
            </tr>
         </table>
      </td>
   </tr>
   <tr>
      <td>
         <!-- NEW PRODUCT ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
         <%Call Messenger ( sMessage , 1, "100%" )%>
         <!-- MESSAGE +++++++++++++++++++++++++++++++++++++++++++++++++++ -->
         <!--#include file="messages/_msg_inline.asp"-->
         <br>
         <%
        Dim extName
        Dim comment
        Dim isaCots
        Dim isVis
         
        If Request("ext") <> "" Then
            %>
            <input type="hidden" name="ext" value="<%=Request("ext")%>">
            <%
            Dim rsTemp

            Query_String = "select * FROM PROJECT_EXTENTIONS " &_
                          " where ext_name = '"& Request("ext") & "'"

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

                extName = rsTemp("EXT_NAME")
                    comment = rsTemp("UCOMMENT")
            isaCots = niceBool(rsTemp("IS_COTS"))
            isVis   = niceBool(rsTemp("IS_VISIBLE"))

            rsTemp.Close()
            Set rsTemp = Nothing      
          Else
            isaCots = "N"
            isVis = "Y"
          End If
          %>
         
         <table width="50%" border="0"  class="body_txt">
            <tr>
               <td>Project Extension</td>
               <td><input name="newext" type="text" class="body_txt" value="<%=extName%>" size=7 maxlength=5></td>
            </tr>

            <tr>
               <td></td>
               <td>The project suffix must start with a '.' and contain 2 to 4 lower case characters.</td>
            </tr>
            
            <tr>
               <td>Comment</td>
               <td><input name="comment" type="text" class="body_txt" value="<%=comment%>" size=80 maxlength=80></td>
            </tr>

            <tr>
               <td></td>
               <td>The comment field will be displayed during the project suffix selection process</td>
            </tr>
            

            <tr>
               <td>Enable Selection</td>
               <td><input name="isVis" type="checkbox" value="Y" <%=showCheck(isVis)%>></td>
            </tr>

            <tr>
               <td></td>
               <td>If selection is not enabled then the Suffix will not be shown and cannot be selected.
               This is useful for legacy projects where multiple extensions have been used. </td>
            </tr>
            
            <tr>
               <td>Free Form Version</td>
               <td><input name="isCots" type="checkbox" value="Y" <%=showCheck(isaCots)%>></td>
            </tr>

            <tr>
               <td></td>
               <td>Free Form Versioning flags packages are allowed to have non-standard version numbers.
               If the version number is in the standard major.minor.patch-build form then the package can be auto-versioned.
               If the version number has only a patch-build field then it can rippled.
               </td>
            </tr>


         </table>
      </td>
   </tr>
   <%=objPMod.ComposeHiddenTags()%>
   <input type="hidden" name="action" value="true">

   <%
   Call objFormComponent.FormEnd()
   '-- FROM END ----------------------------------------------------------------------------------------------------------------
   %>
</table>
</body>
</html>
<%
'------------ RUN AFTER PAGE RENDER -----------
Set objFormCollector = Nothing
'----------------------------------------------
Call Destroy_All_Objects
%>