Subversion Repositories DevTools

Rev

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

<%@LANGUAGE="VBSCRIPT"%>
<%
'=====================================================
'                 ADD NEW Public View
'                 --- 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", "members_public_view.asp" )
'------------ ACCESS CONTROL ------------------
%>
<!--#include file="_access_control_login.asp"-->
<!--#include file="_access_control_general.asp"-->
<%
'------------ Variable Definition -------------
Dim parViewName
Dim parPkgInc
'------------ Constants Declaration -----------
'------------ Variable Init -------------------
parViewName = QStrPar("FRviewname")
parPkgInc = QStrPar("FRpkginc")
'----------------------------------------------
%>
<%
Function Create_New_View ( SSviewname, SSPkgInc )
   Dim SEQ_view_id
   SEQ_view_id = Get_From_DUAL("SEQ_VIEW_ID.nextval")

   ' Create new view
   On Error Resume Next
   objEH.TryORA ( OraSession )

   OraDatabase.ExecuteSQL _
      " INSERT INTO views (view_id, view_name, owner_id, base_view, public_read)"&_
      " VALUES ("& SEQ_view_id &", '"& SSviewname &"', 0, 'N', 'Y')"
   objEH.CatchORA ( OraSession )

   If objEH.LastOraFailed = FALSE Then

      objEH.TryORA ( OraSession )

      ' Set view_setting to SHOW new view
      OraDatabase.ExecuteSQL _
         " INSERT INTO view_settings (user_id, view_id)"&_
         " VALUES ( 0, "& SEQ_view_id &")"

      ' Set view definition
      If SSPkgInc <> "" Then
         OraDatabase.ExecuteSQL _
            " INSERT INTO view_def"&_
            " SELECT TO_NUMBER('"& SEQ_view_id &"') AS view_id, pkg_id FROM packages WHERE pkg_id IN ("& SSPkgInc &")"
      End If

      objEH.CatchORA ( OraSession )
   End If
End Function

%>
<%
'-----------------------  MAIN LINE  ---------------------------

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

   ' report errors if found
   If View_Name_Exists( parViewName, 0 ) Then
      Session("reqParam") = ""
      Session("ERRlog") = ""
      Session("ERRlogFULL") = ""
      Session("AdditionalParams") = "$PUBLICVIEWNAME$,"& parViewName
      Response.Redirect("message.asp?msg=202-13")
   End If

   'COMPLETE THE REQUEST...
   Call Create_New_View ( parViewName, parPkgInc)

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

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