diff options
Diffstat (limited to 'extensions/REMO')
16 files changed, 1849 insertions, 0 deletions
diff --git a/extensions/REMO/Config.pm b/extensions/REMO/Config.pm new file mode 100644 index 000000000..625e2afd9 --- /dev/null +++ b/extensions/REMO/Config.pm @@ -0,0 +1,34 @@ +# -*- Mode: perl; indent-tabs-mode: nil -*- +# +# 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 Bugzilla Extension. +# +# 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. +# +# Contributor(s): +# Byron Jones <glob@mozilla.com> +# David Lawrence <dkl@mozilla.com> + +package Bugzilla::Extension::REMO; +use strict; + +use constant NAME => 'REMO'; + +use constant REQUIRED_MODULES => [ +]; + +use constant OPTIONAL_MODULES => [ +]; + +__PACKAGE__->NAME; diff --git a/extensions/REMO/Extension.pm b/extensions/REMO/Extension.pm new file mode 100644 index 000000000..3df35357a --- /dev/null +++ b/extensions/REMO/Extension.pm @@ -0,0 +1,233 @@ +# -*- Mode: perl; indent-tabs-mode: nil -*- +# +# 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 Bugzilla Extension. +# +# 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. +# +# Contributor(s): +# Byron Jones <glob@mozilla.com> +# David Lawrence <dkl@mozilla.com> + +package Bugzilla::Extension::REMO; +use strict; +use base qw(Bugzilla::Extension); + +use Bugzilla::Constants; +use Bugzilla::Util qw(trick_taint trim detaint_natural); +use Bugzilla::Token; +use Bugzilla::Error; + +our $VERSION = '0.01'; + +sub page_before_template { + my ($self, $args) = @_; + my $page = $args->{'page_id'}; + my $vars = $args->{'vars'}; + + if ($page eq 'remo-form-payment.html') { + _remo_form_payment($vars); + } +} + +sub _remo_form_payment { + my ($vars) = @_; + my $input = Bugzilla->input_params; + + my $user = Bugzilla->login(LOGIN_REQUIRED); + + if ($input->{'action'} eq 'commit') { + my $template = Bugzilla->template; + my $cgi = Bugzilla->cgi; + my $dbh = Bugzilla->dbh; + + my $bug_id = $input->{'bug_id'}; + detaint_natural($bug_id); + my $bug = Bugzilla::Bug->check($bug_id); + + # Detect if the user already used the same form to submit again + 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 + || $old_attach_id !~ "^remo_form_payment:") + { + # The token is invalid. + ThrowUserError('token_does_not_exist'); + } + + $old_attach_id =~ s/^remo_form_payment://; + if ($old_attach_id) { + 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", + { 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') + { + 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) + || ThrowTemplateError($template->error()); + $bug->add_comment($comment, { isprivate => 0 }); + + # Attach expense report + # FIXME: Would be nice to be able to have the above prefilled comment and + # the following attachments all show up under a single comment. But the longdescs + # table can only handle one attach_id per comment currently. At least only one + # email is sent the way it is done below. + my $attachment; + 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, + }); + + # Insert comment for attachment + $bug->add_comment('', { isprivate => 0, + type => CMT_ATTACHMENT_CREATED, + extra_data => $attachment->id }); + } + + # Attach receipts file + if (defined $cgi->upload("receipts")) { + # Determine content-type + 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, + }); + + # Insert comment for attachment + $bug->add_comment('', { isprivate => 0, + type => CMT_ATTACHMENT_CREATED, + extra_data => $attachment->id }); + } + + $bug->update($timestamp); + + if ($token) { + trick_taint($token); + $dbh->do('UPDATE tokens SET eventdata = ? WHERE token = ?', undef, + ("remo_form_payment:" . $attachment->id, $token)); + } + + $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()); + exit; + } + else { + $vars->{'token'} = issue_session_token('remo_form_payment:'); + } +} + +sub post_bug_after_creation { + my ($self, $args) = @_; + my $vars = $args->{vars}; + my $bug = $vars->{bug}; + my $template = Bugzilla->template; + + if (Bugzilla->input_params->{format} + && 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; + $template->process("bug/create/create-remo-swag.xml.tmpl", {}, \$xml) + || ThrowTemplateError($template->error()); + + $attachment = Bugzilla::Attachment->create( + { bug => $bug, + creation_ts => $bug->creation_ts, + data => $xml, + description => 'Remo Swag Request (XML)', + filename => 'remo-swag.xml', + ispatch => 0, + isprivate => 0, + isurl => 0, + mimetype => 'text/xml', + store_in_file => 0, + }); + }; + + if ($attachment) { + # Insert comment for attachment + $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); + } +} + +__PACKAGE__->NAME; diff --git a/extensions/REMO/template/en/default/bug/create/comment-mozreps.txt.tmpl b/extensions/REMO/template/en/default/bug/create/comment-mozreps.txt.tmpl new file mode 100644 index 000000000..29544d669 --- /dev/null +++ b/extensions/REMO/template/en/default/bug/create/comment-mozreps.txt.tmpl @@ -0,0 +1,81 @@ +[%# 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 Bugzilla 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): Byron Jones <glob@mozilla.com> + #%] +[% USE Bugzilla %] +[% cgi = Bugzilla.cgi %] +First Name: +[%+ cgi.param('first_name') %] + +Last Name: +[%+ cgi.param('last_name') %] + +Under 18 years old: +[%+ IF cgi.param('underage') %]Yes[% ELSE %]No[% END %] + +Sex: +[%+ cgi.param('sex') %] + +City: +[%+ cgi.param('city') %] + +Country: +[%+ cgi.param('country') %] + +Local Community: +[% IF cgi.param('community') %] +[%+ cgi.param('community') %] +[% ELSE %] +- +[% END %] + +IM: +[% IF cgi.param('im') %] +[%+ cgi.param('im') %] +[% ELSE %] +- +[% END %] + +References: +[% IF cgi.param('references') %] +[%+ cgi.param('references') %] +[% ELSE %] +- +[% END %] + +Currently Involved with Mozilla: +[% IF cgi.param('involved') %] +[%+ cgi.param('involved') %] +[% ELSE %] +- +[% END %] + +Languages Spoken: +[%+ cgi.param('languages') %] + +How did you lean about Mozilla Reps: +[%+ cgi.param('learn') %] + +What motivates you most about joining Mozilla Reps: +[%+ cgi.param('motivation') %] + +Comments: +[% IF cgi.param('comments') %] +[%+ cgi.param('comments') %] +[% ELSE %] +- +[% END %] diff --git a/extensions/REMO/template/en/default/bug/create/comment-remo-budget.txt.tmpl b/extensions/REMO/template/en/default/bug/create/comment-remo-budget.txt.tmpl new file mode 100644 index 000000000..9486c56fe --- /dev/null +++ b/extensions/REMO/template/en/default/bug/create/comment-remo-budget.txt.tmpl @@ -0,0 +1,64 @@ +[%# 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 Bugzilla Bug Tracking System. + # + # The Initial Developer of the Original Code is Netscape Communications + # Corporation. Portions created by Netscape are + # Copyright (C) 1998 Netscape Communications Corporation. All + # Rights Reserved. + # + # Contributor(s): Gervase Markham <gerv@gerv.net> + #%] +[%# INTERFACE: + # This template has no interface. + # + # Form variables from a bug submission (i.e. the fields on a template from + # enter_bug.cgi) can be access via Bugzilla.cgi.param. It can be used to + # pull out various custom fields and format an initial Description entry + # from them. + #%] +[% USE Bugzilla %] +[% cgi = Bugzilla.cgi %] + +Requester info: + +Requester: [% cgi.param('firstname') %] [%+ cgi.param('lastname') %] +Wiki user profile: [% cgi.param('wikiprofile') %] +Event wiki page: [% cgi.param('wikipage') %] +Advance payment needed: [% IF cgi.param('advancepayment') %]Yes[% ELSE %]No[% END %] + +Budget breakdown: + +Total amount requested in $USD: [% cgi.param('budgettotal') %] +Costs per service: +Service 1: [% cgi.param('service1') %] Cost: [% cgi.param('cost1') %] +Service 2: [% cgi.param('service2') %] Cost: [% cgi.param('cost2') %] +Service 3: [% cgi.param('service3') %] Cost: [% cgi.param('cost3') %] +Service 4: [% cgi.param('service4') %] Cost: [% cgi.param('cost4') %] +Service 5: [% cgi.param('service5') %] Cost: [% cgi.param('cost5') %] + +Additional costs: (add comment box) +[% cgi.param('costadditional') %] + +Success measurement: + +How will the event help push the Mozilla project forward? +[%+ cgi.param('successmeasure') %] + +Metric 1: [% cgi.param('metric1') %] Success scenario: [% cgi.param('success1') %] +Metric 2: [% cgi.param('metric2') %] Success scenario: [% cgi.param('success2') %] +Metric 3: [% cgi.param('metric3') %] Success scenario: [% cgi.param('success3') %] + +Additional information: +[%+ cgi.param('successadditional') %] + +[%+ cgi.param("comment") IF cgi.param("comment") %] + diff --git a/extensions/REMO/template/en/default/bug/create/comment-remo-swag.txt.tmpl b/extensions/REMO/template/en/default/bug/create/comment-remo-swag.txt.tmpl new file mode 100644 index 000000000..3c628b536 --- /dev/null +++ b/extensions/REMO/template/en/default/bug/create/comment-remo-swag.txt.tmpl @@ -0,0 +1,72 @@ +[%# 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 Bugzilla Bug Tracking System. + # + # The Initial Developer of the Original Code is Netscape Communications + # Corporation. Portions created by Netscape are + # Copyright (C) 1998 Netscape Communications Corporation. All + # Rights Reserved. + # + # Contributor(s): Gervase Markham <gerv@gerv.net> + #%] +[%# INTERFACE: + # This template has no interface. + # + # Form variables from a bug submission (i.e. the fields on a template from + # enter_bug.cgi) can be access via Bugzilla.cgi.param. It can be used to + # pull out various custom fields and format an initial Description entry + # from them. + #%] +[% USE Bugzilla %] +[% cgi = Bugzilla.cgi %] + +Requester info: + +First name: [% cgi.param('firstname') %] +Last name: [% cgi.param('lastname') %] +Wiki user profile: [% cgi.param('wikiprofile') %] +Event name: [% cgi.param('eventname') %] +Event wiki page: [% cgi.param('wikipage') %] +Estimated attendance: [% cgi.param('attendance') %] + +Shipping details: + +Ship swag before: [% cgi.param('cf_due_date') %] + +First name: [% cgi.param("shiptofirstname") %] +Last name: [% cgi.param("shiptolastname") %] +Address line 1: [% cgi.param("shiptoaddress1") %] +Address line 2: [% cgi.param("shiptoaddress2") %] +City: [% cgi.param("shiptocity") %] +State/Region: [% cgi.param("shiptostate") %] +Postal code: [% cgi.param("shiptopcode") %] +Country: [% cgi.param("shiptocountry") %] +Phone: [% cgi.param("shiptophone") %] +[%+ IF cgi.param("shiptoidrut") %]Custom reference: [% cgi.param("shiptoidrut") %][% END %] + +Addition information for delivery person: +[%+ cgi.param('shipadditional') %] + +Swag requested: + +Stickers: [% IF cgi.param('stickers') %]Yes[% ELSE %]No[% END %] +Buttons: [% IF cgi.param('buttons') %]Yes[% ELSE %]No[% END %] +Posters: [% IF cgi.param('posters') %]Yes[% ELSE %]No[% END %] +Lanyards: [% IF cgi.param('lanyards') %]Yes[% ELSE %]No[% END %] +T-shirts: [% IF cgi.param('tshirts') %]Yes[% ELSE %]No[% END %] +Roll-up banners: [% IF cgi.param('rollupbanners') %]Yes[% ELSE %]No[% END %] +Horizontal banner: [% IF cgi.param('horizontalbanner') %]Yes[% ELSE %]No[% END %] +Booth cloth: [% IF cgi.param('boothcloth') %]Yes[% ELSE %]No[% END %] +Pens: [% IF cgi.param('pens') %]Yes[% ELSE %]No[% END %] +Other: [% IF cgi.param('otherswag') %][% cgi.param('otherswag') %][% ELSE %]No[% END %] + +[%+ cgi.param("comment") IF cgi.param("comment") %] + diff --git a/extensions/REMO/template/en/default/bug/create/create-mozreps.html.tmpl b/extensions/REMO/template/en/default/bug/create/create-mozreps.html.tmpl new file mode 100644 index 000000000..2a7be0ab2 --- /dev/null +++ b/extensions/REMO/template/en/default/bug/create/create-mozreps.html.tmpl @@ -0,0 +1,205 @@ +[%# 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 Bugzilla 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): Byron Jones <glob@mozilla.com> + #%] + +[% PROCESS global/variables.none.tmpl %] + +[% PROCESS global/header.html.tmpl + title = "Mozilla Reps - Application Form" + style_urls = [ "extensions/REMO/web/styles/moz_reps.css" ] +%] + +[% USE Bugzilla %] +[% mandatory = '<span class="mandatory" title="Required">*</span>' %] + +<script type="text/javascript"> +var Dom = YAHOO.util.Dom; + +function mandatory(ids) { + result = true; + for (i in ids) { + id = ids[i]; + el = Dom.get(id); + + if (el.type.toString() == "checkbox") { + value = el.checked; + } else { + value = el.value.replace(/^\s\s*/, '').replace(/\s\s*$/, ''); + el.value = value; + } + + if (value == '') { + Dom.addClass(id, 'missing'); + result = false; + } else { + Dom.removeClass(id, 'missing'); + } + } + return result; +} + +function submitForm() { + if (!mandatory([ 'first_name', 'last_name', 'sex', 'city', 'country', + 'languages', 'learn', 'motivation', 'privacy' ]) + ) { + alert('Please enter all the required fields.'); + return false; + } + + Dom.get('short_desc').value = + "Application Form: " + Dom.get('first_name').value + ' ' + Dom.get('last_name').value; + + return true; +} + +</script> + +<noscript> +<h1>Javascript is required to use this form.</h1> +</noscript> + +<h1>Mozilla Reps - Application Form</h1> + +<form method="post" action="post_bug.cgi" id="tmRequestForm"> +<input type="hidden" name="product" value="Mozilla Reps"> +<input type="hidden" name="component" value="Mentorship"> +<input type="hidden" name="bug_severity" value="normal"> +<input type="hidden" name="rep_platform" value="All"> +<input type="hidden" name="priority" value="--"> +<input type="hidden" name="op_sys" value="Other"> +<input type="hidden" name="version" value="unspecified"> +<input type="hidden" name="groups" value="mozilla-reps"> +<input type="hidden" name="format" value="[% format FILTER html %]"> +<input type="hidden" name="created-format" value="[% format FILTER html %]"> +<input type="hidden" name="comment" id="comment" value=""> +<input type="hidden" name="short_desc" id="short_desc" value=""> +<input type="hidden" name="token" value="[% token FILTER html %]"> + +<table id="reps-form"> + +<tr class="odd"> + <th>First Name:[% mandatory FILTER none %]</th> + <td><input id="first_name" name="first_name" size="40" placeholder="John"></td> +</tr> + +<tr class="even"> + <th>Last Name:[% mandatory FILTER none %]</th> + <td><input id="last_name" name="last_name" size="40" placeholder="Doe"></td> +</tr> + +<tr class="odd"> + <th>Are you under 18 years old?:</th> + <td><input type="checkbox" id="underage" name="underage" value="1"></td> +</tr> + +<tr class="even"> + <th>Sex:[% mandatory FILTER none %]</th> + <td> + <select id="sex" name="sex"> + <option value="Male">Male</option> + <option value="Female">Female</option> + <option value="Other">Other</option> + </select> + </td> +</tr> + +<tr class="odd"> + <th>City:[% mandatory FILTER none %]</th> + <td><input id="city" name="city" size="40" placeholder="Your city"></td> +</tr> + +<tr class="even"> + <th>Country:[% mandatory FILTER none %]</th> + <td><input id="country" name="country" size="40" placeholder="Your country"></td> +</tr> + +<tr class="odd"> + <th>Local Community you participate in:</th> + <td><input id="community" name="community" size="40" placeholder="Name of your community"></td> +</tr> + +<tr class="even"> + <th>IM (specify service):</th> + <td><input id="im" name="im" size="40"></td> +</tr> + +<tr class="odd"> + <th colspan="2"> + References: + </th> +</tr> +<tr class="odd"> + <td colspan="2"> + <textarea id="references" name="references" rows="4" + placeholder="Add contact info of people referencing you."></textarea> + </td> +</tr> + +<tr class="even"> + <th colspan="2"> + How are you involved with Mozilla? + </th> +</tr> +<tr class="even"> + <td colspan="2"> + <textarea id="involved" name="involved" rows="4" placeholder="Add-ons, l10n, SUMO, QA, ..."></textarea> + </td> +</tr> + +<tr class="odd"> + <th>Languages Spoken:[% mandatory FILTER none %]</th> + <td><input id="languages" name="languages" size="40"></td> +</tr> + +<tr class="even"> + <th>How did you learn about Mozilla Reps?[% mandatory FILTER none %]</th> + <td><input id="learn" name="learn" size="40"></td> +</tr> + +<tr class="odd"> + <th colspan="2">What motivates you most about joining Mozilla Reps?[% mandatory FILTER none %]</th> +</tr> +<tr class="odd"> + <td colspan="2"><textarea id="motivation" name="motivation" rows="4"></textarea></td> +</tr> + +<tr class="even"> + <th colspan="2">Comments:</th> +</tr> +<tr class="even"> + <td colspan="2"><textarea id="comments" name="comments" rows="4"></textarea></td> +</tr> + +<tr class="odd"> + <th> + I have read the + <a href="http://www.mozilla.com/en-US/privacy-policy" target="_blank">Mozilla Privacy Policy</a>:[% mandatory FILTER none %] + </th> + <td><input id="privacy" type="checkbox"></td> +</tr> + +<tr class="even"> + <td> </td> + <td align="right"><input type="submit" value="Submit" onclick="return submitForm()"></td> +</tr> + +</table> + +</form> + +[% PROCESS global/footer.html.tmpl %] diff --git a/extensions/REMO/template/en/default/bug/create/create-remo-budget.html.tmpl b/extensions/REMO/template/en/default/bug/create/create-remo-budget.html.tmpl new file mode 100644 index 000000000..685d3eaeb --- /dev/null +++ b/extensions/REMO/template/en/default/bug/create/create-remo-budget.html.tmpl @@ -0,0 +1,255 @@ +[%# 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/ + # + # 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> + #%] + +[% PROCESS global/variables.none.tmpl %] + +[% PROCESS global/header.html.tmpl + title = "Mozilla Reps Budget Request 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' ] +%] + +[% IF user.in_group("mozilla-reps") %] + +<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> + +<script language="javascript" type="text/javascript"> +function trySubmit() { + var firstname = document.getElementById('firstname').value; + var lastname = document.getElementById('lastname').value; + var wikipage = document.getElementById('wikipage').value; + var shortdesc = 'Budget Request - ' + firstname + ' ' + lastname + ' - ' + wikipage; + document.getElementById('short_desc').value = shortdesc; + return true; +} + +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('successmeasure')) alert_text += "Please enter how you will measure the success of the event.\n"; + if(!isFilledOut('budgettotal')) alert_text += "Please enter the total budget for the event.\n"; + if(!isFilledOut('service1') || !isFilledOut('cost1')) alert_text += "Please enter at least one service and cost value.\n"; + if(!isFilledOut('metric1') || !isFilledOut('success1')) alert_text += "Please enter at least one metric and success scenario.\n"; + + //Everything required is filled out..try to submit the form! + if(alert_text == '') { + return trySubmit(); + } + + //alert text, stay here on the pagee + alert(alert_text); + return false; +} + +function togglePaymentInfo (e) { + var div = document.getElementById('paymentinfo'); + if (e.checked == true) { + div.style.display = 'block'; + } + else { + div.style.display = 'none'; + } +} + +</script> + +<h1>Mozilla Reps - Budget Request Form</h1> + +<form method="post" action="post_bug.cgi" id="swagRequestForm" enctype="multipart/form-data" + onSubmit="return validateAndSubmit();"> + + <input type="hidden" name="format" value="remo-budget"> + <input type="hidden" name="product" value="Mozilla Reps"> + <input type="hidden" name="component" value="Budget Requests"> + <input type="hidden" name="rep_platform" value="All"> + <input type="hidden" name="op_sys" value="Other"> + <input type="hidden" name="priority" value="--"> + <input type="hidden" name="version" value="unspecified"> + <input type="hidden" name="bug_severity" id="bug_severity" value="normal"> + <input type="hidden" name="short_desc" id="short_desc" value=""> + <input type="hidden" name="groups" value="mozilla-reps"> + <input type="hidden" name="token" value="[% token FILTER html %]"> + +<table id="reps-form"> + +<tr class="odd"> + <td><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" placeholder="http://wiki.mozilla.org/JohnDoe"> + </td> +</tr> + +<tr class="odd"> + <td><!--spacer--> </td> + <td><!--spacer--> </td> +</tr> + +<tr class="even"> + <td colspan="2"> + <strong>Is advance payment needed?</strong> + <input type="checkbox" name="advancepayment" id="advancepayment" value="1" + onchange="togglePaymentInfo(this);"> + <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><!--spacer--> </td> + <td><!--spacer--> </td> +</tr> + +<tr class="even"> + <td colspan="2"> + <strong>Budget breakdown:</strong><br> + Total amount requested in $USD: <span style="color: red;">*</span> + <input type="text" name="budgettotal" id="budgettotal" value="" size="40"><br> + Costs per service: + <table> + <tr> + <td>Service 1: <span style="color: red;">*</span></td> + <td><input type="text" id="service1" name="service1" size="30"></td> + <td>Cost 1: <span style="color: red;">*</span></td> + <td><input type="text" id="cost1" name="cost1" size="30"></td> + </tr> + <tr> + <td>Service 2:</td> + <td><input type="text" id="service2" name="service2" size="30"></td> + <td>Cost 2:</td> + <td><input type="text" id="cost2" name="cost2" size="30"></td> + </tr> + <tr> + <td>Service 3:</td> + <td><input type="text" id="service3" name="service3" size="30"></td> + <td>Cost 3:</td> + <td><input type="text" id="cost3" name="cost3" size="30"></td> + </tr> + <tr> + <td>Service 4:</td> + <td><input type="text" id="service4" name="service4" size="30"></td> + <td>Cost 4:</td> + <td><input type="text" id="cost4" name="cost4" size="30"></td> + </tr> + <tr> + <td>Service 5:</td> + <td><input type="text" id="service5" name="service5" size="30"></td> + <td>Cost 5:</td> + <td><input type="text" id="cost5" name="cost5" size="30"></td> + </tr> + </table> + Additional costs:<br> + <textarea id="costadditional" name="costadditional" rows="5" cols="50"></textarea> + </td> +</tr> + +<tr class="odd"> + <td><!--spacer--> </td> + <td><!--spacer--> </td> +</tr> + +<tr class="even"> + <td colspan="2"> + <strong>Success measurement:</strong><br> + How will the event help push the Mozilla project forward? + <span style="color: red;">*</span><br> + <textarea id="successmeasure" name="successmeasure" rows="5" cols="50"></textarea> + <table> + </tr> + <td>Metric 1: <span style="color: red;">*</span></td> + <td><input type="text" id="metric1" name="metric1" size="30"> + <td>Success scenario: <span style="color: red;">*</span></td> + <td><input type="text" id="success1" name="success1" size="30"> + </tr> + <tr> + <td>Metric 2:</td> + <td><input type="text" id="metric2" name="metric2" size="30"> + <td>Success scenario:</td> + <td><input type="text" id="success2" name="success2" size="30"> + </tr> + <tr> + <td>Metric 3:</td> + <td><input type="text" id="metric3" name="metric3" size="30"> + <td>Success scenario:</td> + <td><input type="text" id="success3" name="success3" size="30"> + </tr> + </table> + Additional information:<br> + <textarea id="successadditional" name="successadditional" rows="5" cols="50"></textarea> + </td> +</tr> + +<tr class="odd"> + <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> + +[% 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.html.tmpl b/extensions/REMO/template/en/default/bug/create/create-remo-swag.html.tmpl new file mode 100644 index 000000000..e5f0cadaf --- /dev/null +++ b/extensions/REMO/template/en/default/bug/create/create-remo-swag.html.tmpl @@ -0,0 +1,306 @@ +[%# 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/ + # + # 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> + #%] + +[% PROCESS global/variables.none.tmpl %] + +[% PROCESS global/header.html.tmpl + 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/util.js' ] + style_urls = [ "extensions/REMO/web/styles/moz_reps.css" ] + yui = [ 'calendar' ] +%] + +[% IF user.in_group("mozilla-reps") %] + +<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> + +<script language="javascript" type="text/javascript"> +function trySubmit() { + var eventname = document.getElementById('eventname').value; + var shortdesc = 'Swag Request - ' + eventname; + document.getElementById('short_desc').value = shortdesc; + return true; +} + +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 your wiki user profile\n"; + if(!isFilledOut('eventname')) alert_text += "Please enter your event name\n"; + if(!isFilledOut('wikipage')) alert_text += "Please enter the event wiki page.\n"; + if(!isFilledOut('attendance')) alert_text += "Please enter the estimated attendance.\n"; + if(!isFilledOut('shiptofirstname')) alert_text += "Please enter the shipping first name\n"; + if(!isFilledOut('shiptolastname')) alert_text += "Please enter the shipping last name\n"; + if(!isFilledOut('shiptoaddress1')) alert_text += "Please enter the ship to address\n"; + if(!isFilledOut('shiptocity')) alert_text += "Please enter the ship to city\n"; + 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(); + } + + //alert text, stay here on the pagee + alert(alert_text); + return false; +} + +</script> + +<h1>Mozilla Reps - Swag Request Form</h1> + +<form method="post" action="post_bug.cgi" id="swagRequestForm" enctype="multipart/form-data" + onSubmit="return validateAndSubmit();"> + + <input type="hidden" name="format" value="remo-swag"> + <input type="hidden" name="product" value="Mozilla Reps"> + <input type="hidden" name="component" value="Swag Requests"> + <input type="hidden" name="rep_platform" value="All"> + <input type="hidden" name="op_sys" value="Other"> + <input type="hidden" name="priority" value="--"> + <input type="hidden" name="version" value="unspecified"> + <input type="hidden" name="bug_severity" id="bug_severity" value="normal"> + <input type="hidden" name="short_desc" id="short_desc" value=""> + <input type="hidden" name="groups" value="mozilla-reps"> + <input type="hidden" name="token" value="[% token FILTER html %]"> + +<table id="reps-form"> + +<tr class="odd"> + <td><strong>First Name: <span style="color: red;" title="Required">*</span></strong></td> + <td> + <input type="text" name="firstname" id="firstname" placeholder="John" size="40"> + </td> +</tr> + +<tr class="even"> + <td><strong>Last Name: <span style="color: red;" title="Required">*</span></strong></td> + <td> + <input type="text" name="lastname" id="lastname" placeholder="Doe" size="40"> + </td> +</tr> + +<tr class="odd"> + <td><strong>Wiki User Profile: <span style="color: red;" title="Required">*</span></strong></td> + <td> + <input type="text" name="wikiprofile" id="wikiprofile" size="40"> + </td> +</tr> + +<tr class="even"> + <td><strong>Event Name: <span style="color: red;" title="Required">*</span></strong></td> + <td> + <input type="text" name="eventname" id="eventname" size="40"> + </td> +</tr> + +<tr class="odd"> + <td><strong>Event Wiki Page: <span style="color: red;" title="Required">*</span></strong></td> + <td> + <input type="text" name="wikipage" id="wikipage" size="40"> + </td> +</tr> + +<tr class="even"> + <td><strong>Estimated Attendance: <span style="color: red;" title="Required">*</span></strong></td> + <td> + <select id="attendance" name="attendance"> + <option value="1-50">1-50</option> + <option value="51-200">51-200</option> + <option value="201-500">201-500</option> + <option value="501-1000+">501-1000+</option> + </select> + </td> +</tr + +<tr class="odd"> + <td><!--spacer--> </td> + <td><!--spacer--> </td> +</tr> + +<tr class="even"> + <td colspan="2"><strong>Shipping Details:</strong></td> +</tr> + +<tr class="odd"> + <td><strong>Ship Before:</strong> + <td> + [% INCLUDE bug/field.html.tmpl + bug = default, + field = bug_fields.cf_due_date + value = default.cf_due_date, + editable = 1, + no_tds = 1 + %] + </td> +</tr> + +<tr class="even"> + <td><strong>First Name: <span style="color: red;" title="Required">*</span></strong></td> + <td><input name="shiptofirstname" id="shiptofirstname" placeholder="John" size="40"></td> +</tr> + +<tr class="odd"> + <td><strong>Last Name: <span style="color: red;" title="Required">*</span></strong></td> + <td><input name="shiptolastname" id="shiptolastname" placeholder="Doe" size="40"></td> +</tr> + +<tr class="even"> + <td><strong>Address Line 1: <span style="color: red;" title="Required">*</span></strong></td> + <td><input name="shiptoaddress1" id="shiptoaddress1" placeholder="123 Main St." size="40"></td> +</tr> + +<tr class="odd"> + <td><strong>Address Line 2:</strong></td> + <td><input name="shiptoaddress2" id="shiptoaddress2" size="40"></td> +</tr> + +<tr class="even"> + <td><strong>City: <span style="color: red;" title="Required">*</span></strong></td> + <td><input name="shiptocity" id="shiptocity" size="40" placeholder="Anytown"></td> +</tr> + +<tr class="odd"> + <td><strong>State/Region (if applicable):</strong></td> + <td><input name="shiptostate" id="shiptostate" placeholder="CA" size="40"></td> +</tr> + +<tr class="even"> + <td><strong>Country: <span style="color: red;" title="Required">*</span></strong></td> + <td><input name="shiptocountry" id="shiptocountry" placeholder="USA" size="40"></td> +</tr> + +<tr class="odd"> + <td><strong>Postal Code: <span style="color: red;" title="Required">*</span></strong></td> + <td><input name="shiptopcode" id="shiptopcode" placeholder="90210" size="40"></td> +</tr> + +<tr class="even"> + <td><strong>Phone (including country code): <span style="color: red;" title="Required">*</span></strong></td> + <td><input name="shiptophone" id="shiptophone" placeholder="919-555-1212" size="40"></td> +</tr> + +<tr class="odd"> + <td><strong>Custom Reference (Fiscal or VAT-number, if known):</strong><br><small>(if your country requires this)</small></td> + <td><input name="shiptoidrut" id="shiptoidrut" size="40"></td> +</tr> + +<tr class="even"> + <td colspan="2"> + <strong>Addition information for delivery person:</strong><br> + <textarea id="shipadditional" name="shipadditional" rows="4"></textarea> + </td> +</tr> + +<tr class="even"> + <td><!--spacer--> </td> + <td><!--spacer--> </td> +</tr> + +<tr class="odd"> + <td colspan="2"><strong>Swag Requested:</strong></td> +</tr> + +<tr class="even"> + <td><strong>Stickers:</strong></td> + <td><input type="checkbox" id="stickers" name="stickers" value="1"></td> +</tr> + +<tr class="odd"> + <td><strong>Buttons:</strong></td> + <td><input type="checkbox" id="buttons" name="buttons" value="1"></td> +</tr> + +<tr class="even"> + <td><strong>Posters:</strong></td> + <td><input type="checkbox" id="posters" name="posters" value="1"></td> +</tr> + +<tr class="odd"> + <td><strong>Lanyards:</strong></td> + <td><input type="checkbox" id="lanyards" name="lanyards" value="1"></td> +</tr> + +<tr class="even"> + <td><strong>T-Shirts:</strong></td> + <td><input type="checkbox" id="tshirts" name="tshirts" value="1"></td> +</tr> + +<tr class="odd"> + <td><strong>Roll-Up Banners:</strong></td> + <td><input type="checkbox" id="rollupbanners" name="rollupbanners" value="1"></td> +</tr> + +<tr class="even"> + <td><strong>Horizontal Banner:</strong></td> + <td><input type="checkbox" id="horizontalbanner" name="horizontalbanner" value="1"></td> +</tr> + +<tr class="odd"> + <td><strong>Booth Cloth:</strong></td> + <td><input type="checkbox" id="boothcloth" name="boothcloth" value="1"></td> +</tr> + +<tr class="even"> + <td><strong>Pens:</strong></td> + <td><input type="checkbox" id="pens" name="pens" value="1"></td> +</tr> + +<tr class="odd"> + <td><strong>Other:</strong> (please specify)</td> + <td><input type="text" id="otherswag" name="otherswag" size="40"></td> +</tr> + +<tr class="even"> + <td> </td> + <td align="right"> + <input type="submit" id="commit" value="Submit Request"> + </td> +</tr> + +</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 + month before desired delivery date. +</p> + +<p> + <strong><span style="color: red;">*</span></strong> - Required field<br /> + Thanks for contacting us. + 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 new file mode 100644 index 000000000..7e43de664 --- /dev/null +++ b/extensions/REMO/template/en/default/bug/create/create-remo-swag.xml.tmpl @@ -0,0 +1,116 @@ +[%# 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 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> + #%] + +[% 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, + attendance, + shipping, + swagrequested)> +<!ELEMENT firstname (#PCDATA)> +<!ELEMENT lastname (#PCDATA)> +<!ELEMENT wikiprofile (#PCDATA)> +<!ELEMENT eventname (#PCDATA)> +<!ELEMENT wikipage (#PCDATA)> +<!ELEMENT attendance (#PCDATA)> +<!ELEMENT shipping (shipbeforedate, + shiptofirstname, + shiptolastname, + shiptoaddress1, + shiptoaddress2, + shiptocity, + shiptostate, + shiptopcode, + shiptocountry, + shiptophone, + shiptoidrut, + shipadditional)> +<!ELEMENT shipbeforedate (#PCDATA)> +<!ELEMENT shiptofirstname (#PCDATA)> +<!ELEMENT shiptolastname (#PCDATA)> +<!ELEMENT shiptoaddress1 (#PCDATA)> +<!ELEMENT shiptoaddress2 (#PCDATA)> +<!ELEMENT shiptocity (#PCDATA)> +<!ELEMENT shiptostate (#PCDATA)> +<!ELEMENT shiptopcode (#PCDATA)> +<!ELEMENT shiptocountry (#PCDATA)> +<!ELEMENT shiptophone (#PCDATA)> +<!ELEMENT shiptoidrut (#PCDATA)> +<!ELEMENT shipadditional (#PCDATA)> +<!ELEMENT swagrequested (stickers, + buttons, + posters, + lanyards, + tshirts, + rollupbanners, + horizontalbanner, + boothcloth, + pens, + otherswag)> +<!ELEMENT stickers (#PCDATA)> +<!ELEMENT buttons (#PCDATA)> +<!ELEMENT posters (#PCDATA)> +<!ELEMENT lanyards (#PCDATA)> +<!ELEMENT tshirts (#PCDATA)> +<!ELEMENT rollupbanners (#PCDATA)> +<!ELEMENT horizontalbanners (#PCDATA)> +<!ELEMENT boothcloth (#PCDATA)> +<!ELEMENT pens (#PCDATA)> +<!ELEMENT otherswag (#PCDATA)>]> +<remoswag> + <firstname>[% cgi.param('firstname') FILTER xml %]</firstname> + <lastname>[% cgi.param('lastname') FILTER xml %]</lastname> + <wikiprofile>[% cgi.param('wikiprofile') FILTER xml %]</wikiprofile> + <eventname>[% cgi.param('eventname') FILTER xml %]</eventname> + <wikipage>[% cgi.param('wikipage') FILTER xml %]</wikipage> + <attendance> [% cgi.param('attendance') FILTER xml %]</attendance> + <shipping> + <shipbeforedate>[% cgi.param('cf_due_date') FILTER xml %]</shipbeforedate> + <shiptofirstname>[% cgi.param("shiptofirstname") FILTER xml %]</shiptofirstname> + <shiptolastname>[% cgi.param("shiptolastname") FILTER xml %]</shiptolastname> + <shiptoaddress1>[% cgi.param("shiptoaddress1") FILTER xml %]</shiptoaddress1> + <shiptoaddress2>[% cgi.param("shiptoaddress2") FILTER xml %]</shiptoaddress2> + <shiptocity>[% cgi.param("shiptocity") FILTER xml %]</shiptocity> + <shiptostate>[% cgi.param("shiptostate") FILTER xml %]</shiptostate> + <shiptopcode>[% cgi.param("shiptopcode") FILTER xml %]</shiptopcode> + <shiptocountry>[% cgi.param("shiptocountry") FILTER xml %]</shiptocountry> + <shiptophone>[% cgi.param("shiptophone") FILTER xml %]</shiptophone> + <shiptoidrut>[% cgi.param("shiptoidrut") FILTER xml %]</shiptoidrut> + <shipadditional>[% cgi.param('shipadditional') || '' FILTER xml %]</shipadditional> + </shipping> + <swagrequested> + <stickers>[% (cgi.param('stickers') ? 1 : 0) FILTER xml %]</stickers> + <buttons>[% (cgi.param('buttons') ? 1 : 0) FILTER xml %]</buttons> + <posters>[% (cgi.param('posters') ? 1 : 0) FILTER xml %]</posters> + <lanyards>[% (cgi.param('lanyards') ? 1 : 0) FILTER xml %]</lanyards> + <tshirts>[% (cgi.param('tshirts') ? 1 : 0) FILTER xml %]</tshirts> + <rollupbanners>[% (cgi.param('rollupbanners') ? 1 : 0) FILTER xml %]</rollupbanners> + <horizontalbanner>[% (cgi.param('horizontalbanner') ? 1 : 0) FILTER xml %]</horizontalbanner> + <boothcloth>[% (cgi.param('boothcloth') ? 1 : 0) FILTER xml %]</boothcloth> + <pens>[% (cgi.param('pens') ? 1 : 0) FILTER xml %]</pens> + <otherswag>[% cgi.param('otherswag') || '' FILTER xml %]</otherswag> + </swagrequested> +</remoswag> diff --git a/extensions/REMO/template/en/default/bug/create/created-mozreps.html.tmpl b/extensions/REMO/template/en/default/bug/create/created-mozreps.html.tmpl new file mode 100644 index 000000000..a8a3ca112 --- /dev/null +++ b/extensions/REMO/template/en/default/bug/create/created-mozreps.html.tmpl @@ -0,0 +1,38 @@ +[%# 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 Bugzilla 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): Byron Jones <glob@mozilla.com> + #%] + +[% PROCESS global/variables.none.tmpl %] + +[% PROCESS global/header.html.tmpl + title = "Mozilla Reps - Application Form" + +%] + +<h1>Thank you!</h1> + +<p> +Thank you for submitting your Mozilla Reps Application Form. A Mozilla Rep +mentor will contact you shortly at your bugzilla email address. +</p> + +<p style="font-size: x-small"> +Reference: <a href="show_bug.cgi?id=[% id FILTER uri %]">#[% id FILTER html %]</a> +</p> + +[% PROCESS global/footer.html.tmpl %] diff --git a/extensions/REMO/template/en/default/hook/global/user-error-errors.html.tmpl b/extensions/REMO/template/en/default/hook/global/user-error-errors.html.tmpl new file mode 100644 index 000000000..200e678be --- /dev/null +++ b/extensions/REMO/template/en/default/hook/global/user-error-errors.html.tmpl @@ -0,0 +1,40 @@ +[%# 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): + # Byron Jones <bjones@mozilla.com> + # David Lawrence <dkl@mozilla.com> + #%] + +[% IF error == "remo_payment_invalid_product" %] + [% title = "Mozilla Reps Payment Invalid Bug" %] + You can only attach budget payment information to [% terms.bugs %] under + the product 'Mozilla Reps' and component 'Budget Requests'. + +[% ELSIF error == "remo_payment_bug_edit_denied" %] + [% title = "Mozilla Reps Payment Bug Edit Denied" %] + You do not have permission to edit [% terms.bug %] '[% bug_id FILTER html %]'. + +[% ELSIF error == "remo_payment_cancel_dupe" %] + [% title = "Already filed payment request" %] + You already used the form to file + <a href="[% urlbase FILTER html %]attachment.cgi?id=[% attachid FILTER uri %]&action=edit"> + attachment [% attachid FILTER uri %]</a>.<br> + <br> + You can either <a href="[% urlbase FILTER html %]page.cgi?id=remo-form-payment.html"> + create a new payment request</a> or [% "go back to $terms.bug $bugid" FILTER bug_link(bugid) FILTER none %]. + +[% END %] diff --git a/extensions/REMO/template/en/default/pages/comment-remo-form-payment.txt.tmpl b/extensions/REMO/template/en/default/pages/comment-remo-form-payment.txt.tmpl new file mode 100644 index 000000000..95c0af6e8 --- /dev/null +++ b/extensions/REMO/template/en/default/pages/comment-remo-form-payment.txt.tmpl @@ -0,0 +1,37 @@ +[%# 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> + #%] + +[% USE Bugzilla %] +[% cgi = Bugzilla.cgi %] + +Mozilla Reps Payment Request +---------------------------- + +Requester info: + +First name: [% cgi.param('firstname') %] +Last name: [% cgi.param('lastname') %] +Wiki user profile: [% cgi.param('wikiprofile') %] +Event wiki page: [% cgi.param('wikipage') %] +Budget request [% terms.bug %]: [% cgi.param('bug_id') %] +Have you already received payment for this event? [% IF cgi.param('receivedpayment') %]Yes[% ELSE %]No[% END %] + +[%+ cgi.param("comment") IF cgi.param("comment") %] + diff --git a/extensions/REMO/template/en/default/pages/remo-form-payment.html.tmpl b/extensions/REMO/template/en/default/pages/remo-form-payment.html.tmpl new file mode 100644 index 000000000..0f5f206d3 --- /dev/null +++ b/extensions/REMO/template/en/default/pages/remo-form-payment.html.tmpl @@ -0,0 +1,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 %] diff --git a/extensions/REMO/web/js/form_validate.js b/extensions/REMO/web/js/form_validate.js new file mode 100644 index 000000000..6c8fa6f07 --- /dev/null +++ b/extensions/REMO/web/js/form_validate.js @@ -0,0 +1,21 @@ +/** + * Some Form Validation and Interaction + **/ +//Makes sure that there is an '@' in the address with a '.' +//somewhere after it (and at least one character in between them + +function isValidEmail(email) { + var at_index = email.indexOf("@"); + var last_dot = email.lastIndexOf("."); + return at_index > 0 && last_dot > (at_index + 1); +} + +//Takes a DOM element id and makes sure that it is filled out +function isFilledOut(elem_id) { + var str = document.getElementById(elem_id).value; + return str.length>0 && str!="noneselected"; +} + +function isChecked(elem_id) { + return document.getElementById(elem_id).checked; +} diff --git a/extensions/REMO/web/js/swag.js b/extensions/REMO/web/js/swag.js new file mode 100644 index 000000000..47886b2a9 --- /dev/null +++ b/extensions/REMO/web/js/swag.js @@ -0,0 +1,60 @@ +/** + * Swag Request Form Functions + * Form Interal Swag Request Form + * dtran + * 7/6/09 + **/ + + +function evalToNumber(numberString) { + if(numberString=='') return 0; + return parseInt(numberString); +} + +function evalToNumberString(numberString) { + if(numberString=='') return '0'; + return numberString; +} +//item_array should be an array of DOM element ids +function getTotal(item_array) { + var total = 0; + for(var i in item_array) { + total += evalToNumber(document.getElementById(item_array[i]).value); + } + return total; +} + +function calculateTotalSwag() { + document.getElementById('Totalswag').value = + getTotal( new Array('Lanyards', + 'Stickers', + 'Bracelets', + 'Tattoos', + 'Buttons', + 'Posters')); + +} + + +function calculateTotalMensShirts() { + document.getElementById('mens_total').value = + getTotal( new Array('mens_s', + 'mens_m', + 'mens_l', + 'mens_xl', + 'mens_xxl', + 'mens_xxxl')); + +} + + +function calculateTotalWomensShirts() { + document.getElementById('womens_total').value = + getTotal( new Array('womens_s', + 'womens_m', + 'womens_l', + 'womens_xl', + 'womens_xxl', + 'womens_xxxl')); + +} diff --git a/extensions/REMO/web/styles/moz_reps.css b/extensions/REMO/web/styles/moz_reps.css new file mode 100644 index 000000000..989733c41 --- /dev/null +++ b/extensions/REMO/web/styles/moz_reps.css @@ -0,0 +1,44 @@ +#reps-form { + width: 700px; + border-spacing: 0px; + border: 4px solid #e0e0e0; +} + +#reps-form th, #reps-form td { + padding: 5px; +} + +#reps-form .even th, #reps-form .even td { + background: #e0e0e0; +} + +#reps-form th { + text-align: left; +} + +#reps-form textarea { + font-family: Verdana, sans-serif; + font-size: small; + width: 590px; +} + +#reps-form .mandatory { + color: red; + font-size: 80%; +} + +#reps-form .missing { + box-shadow: #FF0000 0 0 1.5px 1px; +} + +#reps-form .hidden { + display: none; +} + +#reps-form .subTH { + padding-left: 2em; +} + +#reps-form .missing { + background: #FFC1C1; +} |