Subversion Repositories DevTools

Rev

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

<%@LANGUAGE="VBSCRIPT"%>
<%
'=====================================================
'                 ADD NEW Project
'               --- PROCESS FORM ---
'=====================================================
%>
<%
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"-->
<!--#include file="common/common_dbedit.asp"-->
<%
' Set rfile parameter. This is a return page after Login
Call objPMod.StoreParameter ( "rfile", "index.asp" )
'------------ ACCESS CONTROL ------------------
%>
<!--#include file="_access_control_login.asp"-->
<!--#include file="_access_control_general.asp"-->
<%
'------------ Variable Definition -------------
Dim parProj
'------------ Constants Declaration -----------
'------------ Variable Init -------------------
parProj = QStrPar("FRproj")
'----------------------------------------------
%>
<%
Function Create_New_Project( SSprojectname )
   Dim SEQ_proj_id
   SEQ_proj_id = Get_From_DUAL("SEQ_PROJ_ID.nextval")
   objEH.TryORA ( OraSession )
   On Error Resume Next
   OraDatabase.ExecuteSQL _
      " INSERT INTO projects (proj_id, proj_name)"&_
      " VALUES ("& SEQ_proj_id &", '"& UCase(SSprojectname) &"')"
   objEH.CatchORA ( OraSession )
End Function

Function Project_Name_Exists ( SSprojectname )
   Dim rsTemp, Query_String
   Query_String = _
   " SELECT proj_name"&_
   "  FROM projects"&_
   " WHERE proj_name = '"& UCase(SSprojectname) &"'"
   Set rsTemp = OraDatabase.DbCreateDynaset( Query_String, cint(0))
   If rsTemp.RecordCount > 0 Then
      Project_Name_Exists = TRUE
   Else
      Project_Name_Exists = FALSE
   End If
   rsTemp.Close
   Set rsTemp = nothing
End Function
%>
<%
'-----------------------  MAIN LINE  ---------------------------

'--- Process submition ---
If (parProj <> "") Then
   ' All mandatory parameters FOUND

   ' report errors if found
   If Project_Name_Exists( parProj ) Then
      Session("reqParam") = ""
      Session("ERRlog") = ""
      Session("ERRlogFULL") = ""
      Session("AdditionalParams") = "$PROJECTNAME$,"& parProj
      Response.Redirect("message.asp?msg=202-7")
   End If

   'COMPLETE THE REQUEST...
   Call Create_New_Project ( parProj )

   Response.Redirect("index.asp")
Else
   Response.write "Some mandatory parameters are missing!" & "<br>" 'TODO
   Response.write QSTR_All
End If
%>

<!-- DESTRUCTOR ------->
<!--#include file="common/destructor.asp"-->