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
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
|
[%# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is the REMO Extension
#
# The Initial Developer of the Original Code is the Mozilla Foundation
# Portions created by the Initial Developers are Copyright (C) 2011 the
# Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Dave Lawrence <dkl@mozilla.com>
#%]
[% PROCESS global/variables.none.tmpl %]
[% PROCESS global/header.html.tmpl
title = "Mozilla Reps Payment Form"
style_urls = [ 'extensions/REMO/web/styles/moz_reps.css' ]
javascript_urls = [ 'extensions/REMO/web/js/form_validate.js',
'js/util.js',
'js/field.js' ]
yui = ['connection', 'json']
%]
<script language="javascript" type="text/javascript">
var bug_cache = {};
function validateAndSubmit() {
var alert_text = '';
if(!isFilledOut('firstname')) alert_text += "Please enter your first name\n";
if(!isFilledOut('lastname')) alert_text += "Please enter your last name\n";
if(!isFilledOut('wikiprofile')) alert_text += "Please enter a wiki user profile.\n";
if(!isFilledOut('wikipage')) alert_text += "Please enter a wiki page address.\n";
if(!isFilledOut('bug_id')) alert_text += "Please enter a valid [% terms.bug %] id to attach this additional information to.\n";
if(!isFilledOut('expenseform')) alert_text += "Please enter an expense form to upload.\n";
if(!isFilledOut('receipts')) alert_text += "Please enter a receipts file to upload.\n";
if (alert_text) {
alert(alert_text);
return false;
}
return true;
}
function togglePaymentInfo (e) {
var div = document.getElementById('paymentinfo');
if (e.checked == false) {
div.style.display = 'block';
}
else {
div.style.display = 'none';
}
}
function getBugInfo (e, div) {
var bug_id = e.value;
div = document.getElementById(div);
if (!bug_id) {
div.innerHTML = "";
return true;
}
div.style.display = 'block';
if (bug_cache[bug_id]) {
div.innerHTML = bug_cache[bug_id];
e.disabled = false;
return true;
}
e.disabled = true;
div.innerHTML = 'Getting [% terms.bug %] info...';
YAHOO.util.Connect.setDefaultPostHeader('application/json', true);
YAHOO.util.Connect.asyncRequest(
'POST',
'jsonrpc.cgi',
{
success: function(res) {
var bug_message = "";
data = YAHOO.lang.JSON.parse(res.responseText);
if (data.error) {
bug_message = "Get [% terms.bug %] failed: " + data.error.message;
}
else if (data.result) {
if (data.result.bugs[0].product !== 'Mozilla Reps'
|| data.result.bugs[0].component !== 'Budget Requests')
{
bug_message = "You can only attach budget payment " +
"information to [% terms.bugs %] under the product " +
"'Mozilla Reps' and component 'Budget Requests'.";
}
else {
bug_message = "[% terms.Bug %] " + bug_id + " - " + data.result.bugs[0].status +
" - " + data.result.bugs[0].summary;
}
}
else {
bug_message = "Get [% terms.bug %] failed: " + res.responseText;
}
div.innerHTML = bug_message;
bug_cache[bug_id] = bug_message;
e.disabled = false;
},
failure: function(res) {
if (res.responseText) {
div.innerHTML = "Get [% terms.bug %] failed: " + res.responseText;
}
}
},
YAHOO.lang.JSON.stringify({
version: "1.1",
method: "Bug.get",
id: bug_id,
params: {
ids: [ bug_id ],
include_fields: [ 'product', 'component', 'status', 'summary' ]
}
})
);
}
</script>
<h1>Mozilla Reps - Payment Form</h1>
<form method="post" action="page.cgi" id="paymentForm" enctype="multipart/form-data"
onSubmit="return validateAndSubmit();">
<input type="hidden" id="id" name="id" value="remo-form-payment.html">
<input type="hidden" id="token" name="token" value="[% token FILTER html %]">
<input type="hidden" id="action" name="action" value="commit">
<table id="reps-form">
<tr class="odd">
<td width="25%"><strong>First Name: <span style="color: red;">*</span></strong></td>
<td>
<input type="text" name="firstname" id="firstname" value="" size="40" placeholder="John">
</td>
</tr>
<tr class="even">
<td><strong>Last Name: <span style="color: red;">*</span></strong></td>
<td>
<input type="text" name="lastname" id="lastname" value="" size="40" placeholder="Doe">
</td>
</tr>
<tr class="odd">
<td><strong>Wiki user profile:<span style="color: red;">*</span></strong></td>
<td>
<input type="text" name="wikiprofile" id="wikiprofile" value="" size="40" placeholder="JohnDoe">
</td>
</tr>
<tr class="even">
<td><strong>Event wiki page: <span style="color: red;">*</span></strong></td>
<td>
<input type="text" name="wikipage" id="wikipage" value="" size="40">
</td>
</tr>
<tr class="odd">
<td><strong>Budget request [% terms.bug %]: <span style="color: red;">*</span></strong></td>
<td>
<input type="text" name="bug_id" id="bug_id" value="" size="40"
onblur="getBugInfo(this,'bug_info');")>
</td>
</tr>
<tr class="odd">
<td colspan="2">
<div id="bug_info" style="display:none;"></div>
</td>
</tr>
<tr class="even">
<td colspan="2">
<strong>Have you already received payment for this event?</strong>
<input type="checkbox" name="receivedpayment" id="receivedpayment" value="1"
onchange="togglePaymentInfo(this);" checked="true">
<div id="paymentinfo" style="display:none;">
Please send an email to William at mozilla.com with all the information below:<br>
<br>
Payment information:<br>
Bank name:<br>
Bank address: <br>
IBAN:<br>
Swift code/BIC:<br>
Additional bank details (if necessary):
</div>
</td>
</tr>
<tr class="odd">
<td colspan="2">
<strong>Expense form and scanned receipts/invoices:</strong>
</td>
</tr>
<tr class="odd">
<td>Expense Form: <span style="color: red;">*</span></td>
<td><input type="file" id="expenseform" name="expenseform" size="40"></td>
</tr>
<tr class="odd">
<td valign="top">Receipts File: <span style="color: red;">*</span></td>
<td>
<input type="file" id="receipts" name="receipts" size="40"><br>
<font style="color:red;">
Please black out any bank account information included<br>
on receipts before attaching them.
</font>
</td>
</tr>
<tr class="even">
<td> </td>
<td align="right">
<input type="submit" id="commit" value="Submit Request">
</td>
</tr>
</table>
</form>
<p>
<strong><span style="color: red;">*</span></strong> - Required field<br>
Thanks for contacting us.
</p>
[% PROCESS global/footer.html.tmpl %]
|