Subversion Repositories DevTools

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
119 ghuddy 1
<%@LANGUAGE="VBSCRIPT"%>
2
<%
3
'=====================================================
129 ghuddy 4
'                 ADD NEW Public View
5
'                 --- PROCESS FORM ---
119 ghuddy 6
'=====================================================
7
%>
8
<%
9
Option explicit
10
' Good idea to set when using redirect
129 ghuddy 11
Response.Expires = 0   ' always load the page, dont store
119 ghuddy 12
%>
13
 
14
<!--#include file="common/conf.asp"-->
15
<!--#include file="common/globals.asp"-->
16
<!--#include file="common/formating.asp"-->
17
<!--#include file="common/qstr.asp"-->
18
<!--#include file="common/common_subs.asp"-->
19
<!--#include file="common/common_dbedit.asp"-->
20
<%
21
' Set rfile parameter. This is a return page after Login
22
Call objPMod.StoreParameter ( "rfile", "members_public_view.asp" )
23
'------------ ACCESS CONTROL ------------------
24
%>
25
<!--#include file="_access_control_login.asp"-->
26
<!--#include file="_access_control_general.asp"-->
27
<%
28
'------------ Variable Definition -------------
29
Dim parViewName
30
Dim parPkgInc
31
'------------ Constants Declaration -----------
32
'------------ Variable Init -------------------
33
parViewName = QStrPar("FRviewname")
34
parPkgInc = QStrPar("FRpkginc")
35
'----------------------------------------------
36
%>
37
<%
38
Function Create_New_View ( SSviewname, SSPkgInc )
129 ghuddy 39
   Dim SEQ_view_id
40
   SEQ_view_id = Get_From_DUAL("SEQ_VIEW_ID.nextval")
41
 
42
   ' Create new view
43
   On Error Resume Next
44
   objEH.TryORA ( OraSession )
45
 
46
   OraDatabase.ExecuteSQL _
47
      " INSERT INTO views (view_id, view_name, owner_id, base_view, public_read)"&_
48
      " VALUES ("& SEQ_view_id &", '"& SSviewname &"', 0, 'N', 'Y')"
49
   objEH.CatchORA ( OraSession )
50
 
51
   If objEH.LastOraFailed = FALSE Then
52
 
53
      objEH.TryORA ( OraSession )
54
 
55
      ' Set view_setting to SHOW new view
56
      OraDatabase.ExecuteSQL _
57
         " INSERT INTO view_settings (user_id, view_id)"&_
58
         " VALUES ( 0, "& SEQ_view_id &")"
59
 
60
      ' Set view definition
61
      If SSPkgInc <> "" Then
62
         OraDatabase.ExecuteSQL _
63
            " INSERT INTO view_def"&_
64
            " SELECT TO_NUMBER('"& SEQ_view_id &"') AS view_id, pkg_id FROM packages WHERE pkg_id IN ("& SSPkgInc &")"
65
      End If
66
 
67
      objEH.CatchORA ( OraSession )
68
   End If
119 ghuddy 69
End Function
70
 
71
%>
72
<%
73
'-----------------------  MAIN LINE  ---------------------------
74
 
75
'--- Process submition ---
76
If (parViewName <> "") Then
1376 dpurdie 77
   ' All mandatory parameters FOUND
129 ghuddy 78
 
79
   ' report errors if found
80
   If View_Name_Exists( parViewName, 0 ) Then
81
      Session("reqParam") = ""
82
      Session("ERRlog") = ""
83
      Session("ERRlogFULL") = ""
84
      Session("AdditionalParams") = "$PUBLICVIEWNAME$,"& parViewName
85
      Response.Redirect("message.asp?msg=202-13")
86
   End If
87
 
88
   'COMPLETE THE REQUEST...
89
   Call Create_New_View ( parViewName, parPkgInc)
90
 
91
   Response.Redirect("members_public_view.asp")
119 ghuddy 92
Else
1376 dpurdie 93
   Response.write "Some mandatory parameters are missing!" & "<br>" 'TODO
4955 dpurdie 94
   Response.write QSTR_FullQuery
119 ghuddy 95
End If
96
%>
97
 
98
<!-- DESTRUCTOR ------->
129 ghuddy 99
<!--#include file="common/destructor.asp"-->