r75159 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r75158‎ | r75159 | r75160 >
Date:17:04, 21 October 2010
Author:awjrichards
Status:deferred
Tags:
Comment:
Minor style adjustments; Moved OWA js inclusion to Form.php (we always want the JS to load if OWA enabled); Fixed field name references in OWA js; Fixed call to get OWA ref id to use correct method name ;)
Modified paths:
  • /branches/fundraising/OWA/DonationInterface/payflowpro_gateway/forms/Form.php (modified) (history)
  • /branches/fundraising/OWA/DonationInterface/payflowpro_gateway/forms/OneStepTwoColumn.php (modified) (history)
  • /branches/fundraising/OWA/DonationInterface/payflowpro_gateway/forms/TwoStepTwoColumn.php (modified) (history)
  • /branches/fundraising/OWA/DonationInterface/payflowpro_gateway/owa_get_info.js (modified) (history)
  • /branches/fundraising/OWA/DonationInterface/payflowpro_gateway/payflowpro_gateway.body.php (modified) (history)

Diff [purge]

Index: branches/fundraising/OWA/DonationInterface/payflowpro_gateway/payflowpro_gateway.body.php
@@ -925,7 +925,15 @@
926926 wfSetupSession();
927927 }
928928
929 - function get_owa_ref_id($ref){
 929+ /**
 930+ * Fetches ID for reference URL for OWA tracking
 931+ *
 932+ * In the event that the URL is not already in the database, insert it
 933+ * and return it's id. Otehrewise, just return its id.
 934+ * @param string $ref The reference URL
 935+ * @return int The id for the reference URL - 0 if not found
 936+ */
 937+ function get_owa_ref_id( $ref ) {
930938 // Replication lag means sometimes a new event will not exist in the table yet
931939 $dbw = contributionTrackingConnection();
932940 $id_num = $dbw->selectField(
@@ -956,9 +964,10 @@
957965 public function fnGetFormData( $amount, $numAttempt, $token, $order_id ) {
958966 global $wgPayflowGatewayTest, $wgRequest;
959967
960 - $owa_ref = $wgRequest->getText( 'owa_ref', null);
961 - if($owa_ref != null && !is_numeric($owa_ref)){
962 - $owa_ref = $this->get_owa_ref($owa_ref);
 968+ // fetch ID for the url reference for OWA tracking
 969+ $owa_ref = $wgRequest->getText( 'owa_ref', null );
 970+ if( $owa_ref != null && !is_numeric( $owa_ref )){
 971+ $owa_ref = $this->get_owa_ref_id( $owa_ref );
963972 }
964973
965974 // if we're in testing mode and an action hasn't yet be specified, prepopulate the form
Index: branches/fundraising/OWA/DonationInterface/payflowpro_gateway/forms/TwoStepTwoColumn.php
@@ -10,10 +10,6 @@
1111 // we only want to load this JS if the form is being rendered
1212 $this->loadValidateJs(); // validation JS
1313
14 - if(defined('OWA')){
15 - $this->loadOwaJs();
16 - }
17 -
1814 $first = wfMsg( 'payflowpro_gateway-first' );
1915 $last = wfMsg( 'payflowpro_gateway-last' );
2016 $js = <<<EOT
Index: branches/fundraising/OWA/DonationInterface/payflowpro_gateway/forms/Form.php
@@ -64,7 +64,18 @@
6565 if ( !strlen( $this->getStylePath())) {
6666 $this->setStylePath();
6767 }
 68+
6869 $wgOut->addExtensionStyle( $this->getStylePath() );
 70+
 71+ /**
 72+ * if OWA is enabled, load the JS.
 73+ *
 74+ * We do this here (rather than in individual forms) because if OWA is
 75+ * enabled, we ALWAYS want to make sure it gets included.
 76+ */
 77+ if(defined('OWA')){
 78+ $this->loadOwaJs();
 79+ }
6980 }
7081
7182 /**
Index: branches/fundraising/OWA/DonationInterface/payflowpro_gateway/forms/OneStepTwoColumn.php
@@ -15,12 +15,8 @@
1616 $this->loadValidateJs(); // validation JS
1717
1818 $this->loadApiJs(); // API/Ajax JS
19 -
20 - if(defined('OWA')){
21 - $this->loadOwaJs();
22 - }
2319 }
24 -
 20+
2521 /**
2622 * Required method for constructing the entire form
2723 *
Index: branches/fundraising/OWA/DonationInterface/payflowpro_gateway/owa_get_info.js
@@ -6,8 +6,8 @@
77 //NOTE: This only works as long as sid is the last param in the OWA cookie
88 if(owaS_start_index >= 0){
99 var owaSessionID = owa_s_val.substr(owaS_start_index + owa_s_ident.length);
10 - if(document.getElementById("owa_session_id") &&
11 - document.getElementById("owa_pageref")){
 10+ if(document.getElementById("owa_session") &&
 11+ document.getElementById("owa_ref")){
1212 document.getElementById("owa_session").value = owaSessionID;
1313 document.getElementById("owa_ref").value = encode(window.location);
1414 }

Status & tagging log