summaryrefslogtreecommitdiffstats
path: root/extensions/REMO
diff options
context:
space:
mode:
Diffstat (limited to 'extensions/REMO')
-rw-r--r--extensions/REMO/Extension.pm97
-rw-r--r--extensions/REMO/template/en/default/bug/create/create-remo-swag.html.tmpl57
-rw-r--r--extensions/REMO/template/en/default/bug/create/create-remo-swag.xml.tmpl32
3 files changed, 79 insertions, 107 deletions
diff --git a/extensions/REMO/Extension.pm b/extensions/REMO/Extension.pm
index 3df35357a..ed1792f99 100644
--- a/extensions/REMO/Extension.pm
+++ b/extensions/REMO/Extension.pm
@@ -12,7 +12,7 @@
#
# The Original Code is the REMO Bugzilla Extension.
#
-# The Initial Developer of the Original Code is Mozilla Foundation
+# The Initial Developer of the Original Code is Mozilla Foundation
# Portions created by the Initial Developer are Copyright (C) 2011 the
# Initial Developer. All Rights Reserved.
#
@@ -60,8 +60,8 @@ sub _remo_form_payment {
my $token = trim($input->{'token'});
if ($token) {
my ($creator_id, $date, $old_attach_id) = Bugzilla::Token::GetTokenData($token);
- if (!$creator_id
- || $creator_id != $user->id
+ if (!$creator_id
+ || $creator_id != $user->id
|| $old_attach_id !~ "^remo_form_payment:")
{
# The token is invalid.
@@ -70,28 +70,28 @@ sub _remo_form_payment {
$old_attach_id =~ s/^remo_form_payment://;
if ($old_attach_id) {
- ThrowUserError('remo_payment_cancel_dupe',
+ ThrowUserError('remo_payment_cancel_dupe',
{ bugid => $bug_id, attachid => $old_attach_id });
}
}
# Make sure the user can attach to this bug
if (!$bug->user->{'canedit'}) {
- ThrowUserError("remo_payment_bug_edit_denied",
+ ThrowUserError("remo_payment_bug_edit_denied",
{ bug_id => $bug->id });
}
# Make sure the bug is under the correct product/component
- if ($bug->product ne 'Mozilla Reps'
- || $bug->component ne 'Budget Requests')
+ if ($bug->product ne 'Mozilla Reps'
+ || $bug->component ne 'Budget Requests')
{
- ThrowUserError('remo_payment_invalid_product');
+ ThrowUserError('remo_payment_invalid_product');
}
my ($timestamp) = $dbh->selectrow_array("SELECT NOW()");
$dbh->bz_start_transaction;
-
+
# Create the comment to be added based on the form fields from rep-payment-form
my $comment;
$template->process("pages/comment-remo-form-payment.txt.tmpl", $vars, \$comment)
@@ -107,23 +107,21 @@ sub _remo_form_payment {
if (defined $cgi->upload('expenseform')) {
# Determine content-type
my $content_type = $cgi->uploadInfo($cgi->param('expenseform'))->{'Content-Type'};
-
+
$attachment = Bugzilla::Attachment->create(
- { bug => $bug,
- creation_ts => $timestamp,
- data => $cgi->upload('expenseform'),
- description => 'Expense Form',
- filename => scalar $cgi->upload('expenseform'),
- ispatch => 0,
- isprivate => 0,
- isurl => 0,
- mimetype => $content_type,
- store_in_file => 0,
+ { bug => $bug,
+ creation_ts => $timestamp,
+ data => $cgi->upload('expenseform'),
+ description => 'Expense Form',
+ filename => scalar $cgi->upload('expenseform'),
+ ispatch => 0,
+ isprivate => 0,
+ mimetype => $content_type,
});
# Insert comment for attachment
- $bug->add_comment('', { isprivate => 0,
- type => CMT_ATTACHMENT_CREATED,
+ $bug->add_comment('', { isprivate => 0,
+ type => CMT_ATTACHMENT_CREATED,
extra_data => $attachment->id });
}
@@ -133,21 +131,19 @@ sub _remo_form_payment {
my $content_type = $cgi->uploadInfo($cgi->param("receipts"))->{'Content-Type'};
$attachment = Bugzilla::Attachment->create(
- { bug => $bug,
- creation_ts => $timestamp,
- data => $cgi->upload('receipts'),
- description => "Receipts",
- filename => scalar $cgi->upload("receipts"),
- ispatch => 0,
- isprivate => 0,
- isurl => 0,
- mimetype => $content_type,
- store_in_file => 0,
+ { bug => $bug,
+ creation_ts => $timestamp,
+ data => $cgi->upload('receipts'),
+ description => "Receipts",
+ filename => scalar $cgi->upload("receipts"),
+ ispatch => 0,
+ isprivate => 0,
+ mimetype => $content_type,
});
# Insert comment for attachment
- $bug->add_comment('', { isprivate => 0,
- type => CMT_ATTACHMENT_CREATED,
+ $bug->add_comment('', { isprivate => 0,
+ type => CMT_ATTACHMENT_CREATED,
extra_data => $attachment->id });
}
@@ -160,20 +156,20 @@ sub _remo_form_payment {
}
$dbh->bz_commit_transaction;
-
+
# Define the variables and functions that will be passed to the UI template.
$vars->{'attachment'} = $attachment;
$vars->{'bugs'} = [ new Bugzilla::Bug($bug_id) ];
$vars->{'header_done'} = 1;
$vars->{'contenttypemethod'} = 'autodetect';
-
+
my $recipients = { 'changer' => $user };
$vars->{'sent_bugmail'} = Bugzilla::BugMail::Send($bug_id, $recipients);
-
+
print $cgi->header();
# Generate and return the UI (HTML page) from the appropriate template.
$template->process("attachment/created.html.tmpl", $vars)
- || ThrowTemplateError($template->error());
+ || ThrowTemplateError($template->error());
exit;
}
else {
@@ -188,13 +184,13 @@ sub post_bug_after_creation {
my $template = Bugzilla->template;
if (Bugzilla->input_params->{format}
- && Bugzilla->input_params->{format} eq 'remo-swag')
+ && Bugzilla->input_params->{format} eq 'remo-swag')
{
# If the attachment cannot be successfully added to the bug,
# we notify the user, but we don't interrupt the bug creation process.
my $error_mode_cache = Bugzilla->error_mode;
Bugzilla->error_mode(ERROR_MODE_DIE);
-
+
my $attachment;
eval {
my $xml;
@@ -202,30 +198,31 @@ sub post_bug_after_creation {
|| ThrowTemplateError($template->error());
$attachment = Bugzilla::Attachment->create(
- { bug => $bug,
- creation_ts => $bug->creation_ts,
+ { bug => $bug,
+ creation_ts => $bug->creation_ts,
data => $xml,
- description => 'Remo Swag Request (XML)',
+ description => 'Remo Swag Request (XML)',
filename => 'remo-swag.xml',
- ispatch => 0,
- isprivate => 0,
- isurl => 0,
+ ispatch => 0,
+ isprivate => 0,
mimetype => 'text/xml',
- store_in_file => 0,
});
};
+ if ($@) {
+ warn "$@";
+ }
if ($attachment) {
# Insert comment for attachment
- $bug->add_comment('', { isprivate => 0,
- type => CMT_ATTACHMENT_CREATED,
+ $bug->add_comment('', { isprivate => 0,
+ type => CMT_ATTACHMENT_CREATED,
extra_data => $attachment->id });
$bug->update($bug->creation_ts);
}
else {
$vars->{'message'} = 'attachment_creation_failed';
}
-
+
Bugzilla->error_mode($error_mode_cache);
}
}
diff --git a/extensions/REMO/template/en/default/bug/create/create-remo-swag.html.tmpl b/extensions/REMO/template/en/default/bug/create/create-remo-swag.html.tmpl
index cd4fb1a16..e618be726 100644
--- a/extensions/REMO/template/en/default/bug/create/create-remo-swag.html.tmpl
+++ b/extensions/REMO/template/en/default/bug/create/create-remo-swag.html.tmpl
@@ -1,22 +1,9 @@
-[%# 1.0@bugzilla.org %]
-[%# 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/
+[%# This Source Code Form is subject to the terms of the Mozilla Public
+ # License, v. 2.0. If a copy of the MPL was not distributed with this
+ # file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
- # 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 Bugzilla Bug Tracking System.
- #
- # The Initial Developer of the Original Code is Mozilla Corporation.
- # Portions created by Mozilla are Copyright (C) 2008 Mozilla
- # Corporation. All Rights Reserved.
- #
- # Contributor(s): Reed Loden <reed@mozilla.com>
- # David Tran <dtran@mozilla.com>
+ # This Source Code Form is "Incompatible With Secondary Licenses", as
+ # defined by the Mozilla Public License, v. 2.0.
#%]
[% PROCESS global/variables.none.tmpl %]
@@ -25,13 +12,17 @@
title = "Mozilla Reps Swag Request Form"
javascript_urls = [ 'extensions/REMO/web/js/swag.js',
'extensions/REMO/web/js/form_validate.js',
- 'js/field.js',
+ 'js/field.js',
'js/util.js' ]
- style_urls = [ "extensions/REMO/web/styles/moz_reps.css" ]
+ style_urls = [ "extensions/REMO/web/styles/moz_reps.css" ]
yui = [ 'calendar' ]
%]
-[% IF user.in_group("mozilla-reps") %]
+[% IF !user.in_group("mozilla-reps") %]
+ <p>Sorry, you do not have access to this page.</p>
+ [% RETURN %]
+[% END %]
+
<p>These requests will only be visible to the person who submitted the request,
any persons designated in the CC line, and authorized members of the Mozilla Rep team.</p>
@@ -59,7 +50,7 @@ function validateAndSubmit() {
if(!isFilledOut('shiptocountry')) alert_text += "Please enter the ship to country\n";
if(!isFilledOut('shiptopcode')) alert_text += "Please enter the ship to postal code\n";
if(!isFilledOut('shiptophone')) alert_text += "Please enter the ship to contact number\n";
-
+
//Everything required is filled out..try to submit the form!
if(alert_text == '') {
return trySubmit();
@@ -107,7 +98,7 @@ function validateAndSubmit() {
<tr class="odd">
<td>
- <strong>Mozilla Reps Profile Page:
+ <strong>Mozilla Reps Profile Page:
<span style="color: red;" title="Required">*</span></strong>
</td>
<td>
@@ -153,11 +144,11 @@ function validateAndSubmit() {
<tr class="odd">
<td><strong>Ship Before:</strong>
<td>
- [% INCLUDE bug/field.html.tmpl
+ [% INCLUDE bug/field.html.tmpl
bug = default,
- field = bug_fields.cf_due_date
- value = default.cf_due_date,
- editable = 1,
+ field = bug_fields.cf_due_date
+ value = default.cf_due_date,
+ editable = 1,
no_tds = 1
%]
</td>
@@ -286,10 +277,10 @@ function validateAndSubmit() {
</table>
<p>
- Quantities of different swag items requested that will actually be shipped
- depend on stock availability and number of attendees. Mozilla cannot guarantee
- that all items requested will be in stock at the time of shipment and you will
- be notified in case an item cannot be shipped. Please request swag at least 1
+ Quantities of different swag items requested that will actually be shipped
+ depend on stock availability and number of attendees. Mozilla cannot guarantee
+ that all items requested will be in stock at the time of shipment and you will
+ be notified in case an item cannot be shipped. Please request swag at least 1
month before desired delivery date.
</p>
@@ -299,8 +290,4 @@ function validateAndSubmit() {
You will be notified by email of any progress made in resolving your request.
</p>
-[% ELSE %]
- <p>Sorry, you do not have access to this page.</p>
-[% END %]
-
[% PROCESS global/footer.html.tmpl %]
diff --git a/extensions/REMO/template/en/default/bug/create/create-remo-swag.xml.tmpl b/extensions/REMO/template/en/default/bug/create/create-remo-swag.xml.tmpl
index 7e43de664..4308bc5ac 100644
--- a/extensions/REMO/template/en/default/bug/create/create-remo-swag.xml.tmpl
+++ b/extensions/REMO/template/en/default/bug/create/create-remo-swag.xml.tmpl
@@ -1,32 +1,20 @@
-[%# 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/
+[%# This Source Code Form is subject to the terms of the Mozilla Public
+ # License, v. 2.0. If a copy of the MPL was not distributed with this
+ # file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
- # 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 Bugzilla Extension.
- #
- # The Initial Developer of the Original Code is the Mozilla Foundation.
- # Portions created by the Initial Developer are Copyright (C) 2011
- # the Initial Developer. All Rights Reserved.
- #
- # Contributor(s):
- # David Lawrence <dkl@mozilla.com>
+ # This Source Code Form is "Incompatible With Secondary Licenses", as
+ # defined by the Mozilla Public License, v. 2.0.
#%]
[% USE Bugzilla %]
[% cgi = Bugzilla.cgi %]
<?xml version="1.0" [% IF Param('utf8') %]encoding="UTF-8" [% END %]standalone="yes" ?>
<!DOCTYPE remoswag [
-<!ELEMENT remoswag (firstname,
- lastname,
- wikiprofile,
- eventname,
- wikipage,
+<!ELEMENT remoswag (firstname,
+ lastname,
+ wikiprofile,
+ eventname,
+ wikipage,
attendance,
shipping,
swagrequested)>