File: sn_make_inv.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 (227 lines) | stat: -rw-r--r-- 7,213 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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
<?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>
    <vm:header>
      <vm:title>Send Invitation</vm:title>
    </vm:header>
    <vm:pagewrapper>
      <vm:variable name="sne_id" type="int" default="0" />
      <v:variable name="fmail" type="varchar" default="''" param-name="fmail"/>
      <!--<vm:navigation on="home"/>
      <vm:navigation1 on="sn"/>-->
      <vm:navigation-new on="home"/>
      <vm:navigation2 on="sn_sent_inv"/>
      <vm:rawheader caption="Invite your Friends, Colleagues and Family to <?V self.banner ?>"/>
      <vm:body>
        <vm:login redirect="index.vspx"/>
        <div id="container">
	      <v:local-variable name="lv1">
		<v:after-data-bind>

		  select sne_id into self.sne_id from sn_entity where sne_name = self.u_name;

		</v:after-data-bind>
	      </v:local-variable>
	       <v:form name="invf" method="POST" type="simple">
		  <?vsp
		    declare sne_cnt int;
		    select count(*) into sne_cnt from sn_invitation where sni_from = self.sne_id and sni_status = 0;
	          ?>
		  <table border="0" class="ctl_grp">
		    <tr>
		      <td colspan="3">
			<div>Personalize your invitation to make it more inviting. Add a few words of your own
			  to the standard invite and share a bit more of yourself.</div>
		      </td>
		    </tr>

		    <tr>
		      <th colspan="3">
			Invitations
		      </th>
		    </tr>
		    <tr>
		      <td>
		      </td>
		      <td colspan="2">You currently have <?V sne_cnt ?> outstanding invites</td>
		    </tr>
		    <vm:if test="sne_cnt > 0">
		      <tr>
			<td>
			</td>
			<td colspan="2"><v:url value="View Past Invites" name="past_invit" url="sn_sent_inv.vspx"/></td>
		      </tr>
		    </vm:if>
		    <tr>
		      <th>From</th>
		      <td colspan="2">
			<v:label name="em_fr" value="--coalesce(self.u_e_mail, '')" />
		      </td>
		    </tr>
		    <tr>
		      <th colspan="3">To:</th>
		    </tr>

		    <tr>
		      <td colspan="3">
			<v:text name="em_to" value="--coalesce(self.fmail,'')" xhtml_size="90"/>
			<?vsp
			 if (exists (select 1 from SYS_LDAP_SERVERS)) {
			?>
			<v:button action="browse" name="ldapbt" value="Browse..." selector="ldap_search.vspx"
			  child-window-options="scrollbar=yes,resizable=yes,menubar=no,height=600,width=600"
			  >
			  <v:field name="em_to"/>
			</v:button>
			<?vsp } ?>
			<br/>
			<small>Separate email addresses with commas.</small>
		      </td>
		    </tr>
			<tr>
			  <th colspan="3">
			    Add a Personal Message:
			  </th>
		      </tr>
			<tr>
			  <td colspan="3">
			    <v:textarea name="txt2" value=""
			      xhtml_rows="10" xhtml_cols="100"
			      xhtml_class="fm_ctl_em"
				/>
			    </td>
			  </tr>
			  <tr>
			    <td colspan="3">
			      Send your friends this email and they will be automatically added to your
			      friends list when they join.
			    </td>
			</tr>
			<tr>
			  <td colspan="3">
			    <span class="fm_ctl_btn">
			      <v:button action="simple" name="bt2" value="Cancel">
				<v:on-post><![CDATA[
				   self.vc_redirect ('sn_connections.vspx');
				     ]]></v:on-post>
			      </v:button>
			      <v:button action="simple" name="bt1" value="Send Invitation">
				<v:on-post><![CDATA[
				  declare i, uids, sn_id, msg, tmpl_msg, url, txt1 any;
				  declare copy varchar;

				  {
				      declare msg, url any;
				      url := WS.WS.EXPAND_URL (HTTP_URL_HANDLER (), 'login.vspx?URL=sn_rec_inv.vspx');
				      msg := WA_GET_EMAIL_TEMPLATE('SN_INV_TEMPLATE');
				      msg := replace (msg, '%user%', wa_wide_to_utf8 (self.u_full_name));
				      msg := replace (msg, '%app%', self.banner);
				      msg := replace (msg, '%url%', url);
				      tmpl_msg := msg;
				  }

				  --tmpl_msg := self.txt1.ufl_value;
				  url := WS.WS.EXPAND_URL (HTTP_URL_HANDLER (), 'login.vspx?URL=sn_rec_inv.vspx');

		                  copy := (select top 1 WS_WEB_TITLE from WA_SETTINGS);
                	          if (copy = '' or copy is null)
				    copy := sys_stat ('st_host_name');

				  tmpl_msg := replace (tmpl_msg, '%app%', copy);
				  tmpl_msg := replace (tmpl_msg, '%invitation%', self.txt2.ufl_value);

				  uids := get_keyword ('em_to',  e.ve_params);

				  uids := split_and_decode (uids, 0, '\0\0,');

				  if (not length (uids))
				    {
				      self.vc_is_valid := 0;
				      self.vc_error_message := 'Please enter at least one mail address';
				      return;
				    }

				  i := 0;

				  foreach (any mail in uids) do
				    {
				      mail := trim (mail);
				      msg := replace (tmpl_msg, '%name%', mail);
				      msg := replace (msg, '%url%', url);

				      insert soft sn_invitation (sni_from, sni_to, sni_status)
				      values (self.sne_id, mail, 0);

				      if (row_count () > 0)
				        {
				          declare exit handler for sqlstate '*'
					  {
					    rollback work;
					    self.vc_is_valid := 0;
					    if (__SQL_STATE not like 'WA%')
					      {
					        self.vc_error_message :=
					        'The e-mail address(es) is not valid and mail cannot be sent.' ||
						'Please enter correct value and re-try.';
					      }
					    else
					      self.vc_error_message := __SQL_MESSAGE;
					    return;
					  };
					  WA_SEND_MAIL (self.u_e_mail,mail,'Join my network', msg);
					  commit work;
					  i := i + 1;
					}
				    }

				   if (i <> length (uids))
				     {
				       self.vc_is_valid := 0;
				       self.vc_error_message := 'Some of the e-mail addresses entered already have a pending invitation, the mail was not sent to he/she. Press Cancel to return to the previous page.';
				       return;
				     }

				   self.vc_redirect ('sn_sent_inv.vspx');
				     ]]></v:on-post>
				 </v:button>

				 <v:button action="browse" name="bt3" value="Preview Invitation" selector="mail_preview.vspx"
				   child-window-options="scrollbar=yes,resizable=yes,menubar=no,height=350,width=450"
				   >
				   <v:field name="em_to" />
				   <v:field name="txt2" />
				 </v:button>
			    </span>
			    </td>
			</tr>
		    </table>
		</v:form>
        </div>
      </vm:body>
    </vm:pagewrapper>
  </vm:page>
</v:page>