Subversion Repositories DevTools

Rev

Blame | Last modification | View Log | RSS feed

<%@LANGUAGE="VBSCRIPT"%>
<%
'=====================================================
'                                  ADD NEW Personal 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_personal_view.asp" )
'------------ ACCESS CONTROL ------------------
%>
<!--#include file="_access_control_login.asp"-->
<!--#include file="_access_control_general.asp"-->
<%
'------------ Variable Definition -------------
Dim parViewName
Dim parPkgInc
Dim parPubread
'------------ Constants Declaration -----------
'------------ Variable Init -------------------
parViewName = QStrPar("FRviewname")
parPkgInc = QStrPar("FRpkginc")
parPubread = QStrPar("FRpubread")
'----------------------------------------------
%>
<%
Function Create_New_View ( SSviewname, SSPkgInc, NNpubread )
        Dim SEQ_view_id
        If NNpubread = "" Then NNpubread = "N"
        SEQ_view_id = Get_From_DUAL("SEQ_VIEW_ID.nextval")
        ' Create new view
        OraSession.BeginTrans
        OraDatabase.ExecuteSQL _
                " INSERT INTO views (view_id, view_name, owner_id, base_view, public_read)"&_
                " VALUES ("& SEQ_view_id &", '"& SSviewname &"', "& objAccessControl.UserId &", 'N', '"& NNpubread &"')"
        OraSession.CommitTrans
        
        ' Set view_setting to SHOW new view
        OraSession.BeginTrans
        OraDatabase.ExecuteSQL _
                " INSERT INTO view_settings (user_id, view_id)"&_
                " VALUES ("& objAccessControl.UserId &", "& SEQ_view_id &")"
        OraSession.CommitTrans
        
        ' Set view definition
        If SSPkgInc <> "" Then
                OraSession.BeginTrans
                OraDatabase.ExecuteSQL _
                        " INSERT INTO view_def"&_
                        " SELECT TO_NUMBER('"& SEQ_view_id &"') AS view_id, pkg_id FROM packages WHERE pkg_id IN ("& SSPkgInc &")"
                OraSession.CommitTrans
        End If
End Function

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

'--- Process submition ---
If (parViewName <> "") Then
        ' All mendatory parameters FOUND
        
        ' report errors if found
        If View_Name_Exists( parViewName, objAccessControl.UserId ) Then 
                Session("reqParam") = ""
                Session("ERRlog") = ""
                Session("ERRlogFULL") = ""
                Session("AdditionalParams") = "$PERSONALVIEWNAME$,"& parViewName
                Response.Redirect("message.asp?msg=202-9")
        End If
        
        'COMPLETE THE REQUEST...
        Call Create_New_View ( parViewName, parPkgInc, parPubread )
        
        Response.Redirect("members_personal_view.asp")
Else
        Response.write "Some mendatory parameters are missing!" & "<br>" 'TODO
        Response.write QSTR_All 
End If
%>

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