r76818 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r76817‎ | r76818 | r76819 >
Date:18:55, 16 November 2010
Author:kaldari
Status:deferred
Tags:
Comment:
testing
Modified paths:
  • /trunk/extensions/DonationInterface/payflowpro_gateway/forms/TwoStepTwoColumnLetter3.php (modified) (history)
  • /trunk/extensions/DonationInterface/payflowpro_gateway/validate_input.js (modified) (history)

Diff [purge]

Index: trunk/extensions/DonationInterface/payflowpro_gateway/validate_input.js
@@ -59,16 +59,6 @@
6060 if ( document.payment.country.value != '840' ) {
6161 document.payment.state.value = 'XX';
6262 }
63 -
64 - // validate name
65 - /*
66 - if (document.getElementById('fname').style.color == '#999999') {
67 - output += payflowproGatewayErrorMsgJs + ' ' + window['payflowproGatewayErrorMsg' + msg['Fname']] + '.\r\n';
68 - }
69 - if (document.getElementById('lname').style.color == '#999999') {
70 - output += payflowproGatewayErrorMsgJs + ' ' + window['payflowproGatewayErrorMsg' + msg['Lname']] + '.\r\n';
71 - }
72 - */
7363
7464 // validate email address
7565 var apos = document.payment.emailAdd.value.indexOf("@");
Index: trunk/extensions/DonationInterface/payflowpro_gateway/forms/TwoStepTwoColumnLetter3.php
@@ -57,6 +57,44 @@
5858 }
5959 }
6060 addEvent( window, 'load', loadPlaceholders );
 61+
 62+function formCheck( ccform ) {
 63+ var msg = [ 'EmailAdd', 'Fname', 'Lname', 'Street', 'City', 'State', 'Zip', 'CardNum', 'Cvv' ];
 64+
 65+ var fields = ["emailAdd","fname","lname","street","city","state","zip","card_num","cvv" ],
 66+ numFields = fields.length,
 67+ i,
 68+ output = '',
 69+ currField = '';
 70+
 71+ for( i = 0; i < numFields; i++ ) {
 72+ if( document.getElementById( fields[i] ).value == '' ) {
 73+ currField = window['payflowproGatewayErrorMsg'+ msg[i]];
 74+ output += payflowproGatewayErrorMsgJs + ' ' + currField + '.\r\n';
 75+ }
 76+ }
 77+
 78+ //set state to "outside us"
 79+ if ( document.payment.country.value != '840' ) {
 80+ document.payment.state.value = 'XX';
 81+ }
 82+
 83+ // validate email address
 84+ var apos = document.payment.emailAdd.value.indexOf("@");
 85+ var dotpos = document.payment.emailAdd.value.lastIndexOf(".");
 86+
 87+ if( apos < 1 || dotpos-apos < 2 ) {
 88+ output += payflowproGatewayErrorMsgEmail;
 89+ }
 90+
 91+ if( output ) {
 92+ alert( output );
 93+ return false;
 94+ } else {
 95+ document.payment.submit();
 96+ return true;
 97+ }
 98+}
6199 </script>
62100 EOT;
63101 $wgOut->addHeadItem( 'placeholders', $js );
@@ -123,7 +161,7 @@
124162 // submit button
125163 $form .= Xml::openElement( 'div', array( 'id' => 'mw-donate-submit-button' ) );
126164 // $form .= Xml::submitButton( wfMsg( 'payflowpro_gateway-submit-button' ));
127 - $form .= '&nbsp;<br/>' . Xml::element( 'input', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/payflowpro_gateway/includes/submit-donation-button.png", 'alt' => 'Submit donation', 'onclick' => 'submit_form( this )', 'type' => 'image' ) );
 165+ $form .= '&nbsp;<br/>' . Xml::element( 'input', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/payflowpro_gateway/includes/submit-donation-button.png", 'alt' => 'Submit donation', 'onclick' => 'formCheck( this )', 'type' => 'image' ) );
128166 $form .= Xml::closeElement( 'div' ); // close div#mw-donate-submit-button
129167 $form .= Xml::openElement( 'div', array( 'class' => 'mw-donate-submessage', 'id' => 'payflowpro_gateway-donate-submessage' ) ) .
130168 Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/payflowpro_gateway/includes/padlock.gif", 'style' => 'vertical-align:baseline;margin-right:4px;' ) ) . 'Your credit / debit card will be securely processed.';

Status & tagging log