%@LANGUAGE="VBSCRIPT"%> <% Option explicit Response.Expires = 0 ' always load the page, dont store %> <% '===================================================== ' New Project '===================================================== %> <% '------------ ACCESS CONTROL ------------------ %> <% '------------ Variable Definition ------------- Dim parProj Dim sMessage Dim bCanEdit '------------ Constants Declaration ----------- '------------ Variable Init ------------------- parProj = QStrPar("FRproj") sMessage = NULL bCanEdit = canActionControl("CreateNewProject") '---------------------------------------------- %> <% Function Create_New_Project( SSprojectname ) Dim SEQ_proj_id SEQ_proj_id = Get_From_DUAL("SEQ_PROJ_ID.nextval") objEH.ErrorRedirect = FALSE 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 ) If objEH.Finally Then Call OpenInParentWindow ("rtree.asp?proj_id="&SEQ_proj_id) Call CloseWindow() End If 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 %> <% 'Process submition If CBool(QStrPar("action")) Then If NOT objAccessControl.UserLogedIn Then sMessage = "User is no longer logged in" ElseIf NOT bCanEdit Then sMessage = "User is no longer authorised to create a new Projects" ElseIf NOT parProj <> "" Then sMessage = "No Project name specified" ElseIf LEN(parProj) < 4 Then sMessage = "Project Name is too short." ElseIf Project_Name_Exists( parProj ) Then sMessage = "Project Name already exists" Else Call Create_New_Project ( parProj ) End If Else If NOT objAccessControl.UserLogedIn Then sMessage = "User is not logged in and can't create a new Project" ElseIf NOT bCanEdit Then sMessage = "User is not authorised to create a new Projects" End If End If %>