File: join.vspx

package info (click to toggle)
virtuoso-opensource 7.2.5.1%2Bdfsg1-0.3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 285,240 kB
  • sloc: ansic: 641,220; sql: 490,413; xml: 269,570; java: 83,893; javascript: 79,900; cpp: 36,927; sh: 31,653; cs: 25,702; php: 12,690; yacc: 10,227; lex: 7,601; makefile: 7,129; jsp: 4,523; awk: 1,697; perl: 1,013; ruby: 1,003; python: 326
file content (150 lines) | stat: -rw-r--r-- 6,363 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
<?xml version="1.0"?>
<!--
 -
 -  $Id$
 -
 -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 -  project.
 -
 -  Copyright (C) 1998-2018 OpenLink Software
 -
 -  This project is free software; you can redistribute it and/or modify it
 -  under the terms of the GNU General Public License as published by the
 -  Free Software Foundation; only version 2 of the License, dated June 1991.
 -
 -  This program is distributed in the hope that it will be useful, but
 -  WITHOUT ANY WARRANTY; without even the implied warranty of
 -  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 -  General Public License for more details.
 -
 -  You should have received a copy of the GNU General Public License along
 -  with this program; if not, write to the Free Software Foundation, Inc.,
 -  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 -
-->
<v:page name="blog-home-page"
        xmlns:vm="http://www.openlinksw.com/vspx/ods/"
        xmlns:v="http://www.openlinksw.com/vspx/"
        style="index.xsl"
        doctype="-//W3C//DTD XHTML 1.0 Transitional//EN"
        doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  <vm:page>
    <v:on-init>
      <![CDATA[
        select WAI_INST, WAI_DESCRIPTION into self.inst, self.idesc from WA_INSTANCE where WAI_ID = self.iid;
      ]]>
    </v:on-init>
    <vm:header>
      <vm:title>Join Application</vm:title>
    </vm:header>
    <vm:pagewrapper>
      <vm:variable name="inst" type="db.dba.web_app" default="null" persist="0"/>
      <vm:variable name="iid" type="int" default="null" persist="0" param-name="wai_id"/>
      <vm:variable name="jid" type="varchar" default="null" persist="0" param-name="join_id"/>
      <vm:variable name="idesc" type="varchar" default="null" persist="0"/>
      <vm:variable name="chk" type="int" default="1" persist="0"/>
      <vm:navigation on="settings"/>
      <vm:navigation1 on="admin"/>
      <vm:navigation2 on="application"/>
      <vm:rawheader caption="Join Application"/>
      <vm:body>
        <vm:login redirect="login.vspx"/>
        <div class="box">
	  <v:form type="simple" method="POST" name="jform1">
	    <v:before-data-bind>
	      <![CDATA[
	      if (length (self.sid))
	        {
		  declare member_model int;
		  declare exit handler for not found {
		    self.chk := 0;
		    goto endf;
		  };
		  select WAI_MEMBER_MODEL into member_model from WA_INSTANCE where WAI_ID = self.iid;
		  if (self.jid is not null or member_model = 2)
		    {
		      update VSPX_SESSION set VS_EXPIRY = now () where VS_SID = self.jid and VS_REALM = 'wa';
		      self.chk := row_count ();
		    }
		  endf:;
		}
	      ]]>
	    </v:before-data-bind>
	    <v:template type="simple" name="no_inv" condition="self.chk = 0">
	      <h2>Invalid request</h2>
	      <div>
		The join request is not valid or expired.
	      </div>
	    </v:template>
	    <v:template type="simple" name="yes_inv" condition="self.chk = 1">
            <h2>Confirmation</h2>
            <p>Do you wish to join to <vm:label value="--self.idesc" /></p>
            <!--p>Select membership type
            <v:data-list name="membership_type_select"
                         sql="select WMT_NAME, WMT_ID from WA_MEMBER_TYPE, WA_INSTANCE where WAI_TYPE_NAME = WMT_APP and WAI_ID = self.iid"
                         key-column="WMT_ID"
                         value-column="WMT_NAME">
            </v:data-list>
            </p-->
            <v:button action="simple" value="Yes" name="join_request">
              <v:on-post>
                <![CDATA[
                  declare _wai_name, acc_type, app_type any;
                  declare exit handler for sqlstate '*', not found
                  {
                    self.vc_is_valid := 0;
		    declare _use_sys_errors, _sys_error, _error any;
		    if (isstring (__SQL_STATE))
		      _sys_error := WA_RETRIEVE_MESSAGE(concat(__SQL_STATE,' ',__SQL_MESSAGE));
		    else
		      _sys_error := '';
                    _error := 'Due to a transient problem in the system, your join request could not be
                        processed at the moment. The system administrators have been notified. Please
                        try again later';
                    _use_sys_errors := (select top 1 WS_SHOW_SYSTEM_ERRORS from WA_SETTINGS);
                    if (_use_sys_errors)
                      self.vc_error_message := _error || ' ' || _sys_error;
                    else
                      self.vc_error_message := _error;
                    rollback work;
                    return;
		  };

		  select WAI_NAME, WAI_TYPE_NAME into _wai_name, app_type from WA_INSTANCE where WAI_ID = self.iid;

		  acc_type := (select max(WMT_ID) from WA_MEMBER_TYPE where WMT_APP = app_type);

                  insert into WA_MEMBER
                    (WAM_USER, WAM_INST, WAM_MEMBER_TYPE, WAM_STATUS)
                  values
                    (self.u_id, _wai_name, acc_type, 3);
                  declare _msg, _result any;
                  _result := connection_get('join_result');
                  if (_result = 'approved')
                    _msg := 'Your join request approved.';
                  else if (_result = 'ownerwait')
                    _msg := 'Application owner notified about your join request. You will get e-mail message after approval.';
		  delete from VSPX_SESSION where VS_SID = self.jid and VS_REALM = 'wa';
		  delete from WA_INVITATIONS where WI_SID = self.jid;
                  http_request_status('HTTP/1.1 302 Found');
                  http_header(sprintf('Location: services.vspx?msg=%s&sid=%s&realm=%s\r\n', _msg, self.sid, self.realm));
                ]]>
              </v:on-post>
            </v:button>
            <v:button action="simple" value="No" name="not_join">
              <v:on-post>
                <![CDATA[
		  delete from VSPX_SESSION where VS_SID = self.jid and VS_REALM = 'wa';
		  update WA_INVITATIONS set WI_STATUS = 'rejected' where WI_SID = self.jid;
                  http_request_status ('HTTP/1.1 302 Found');
                  http_header (sprintf ('Location: admin.vspx?sid=%s&realm=%s\r\n', self.sid, self.realm));
                ]]>
              </v:on-post>
            </v:button>
	</v:template>
          </v:form>
        </div>
      </vm:body>
    </vm:pagewrapper>
  </vm:page>
</v:page>