r99215 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r99214‎ | r99215 | r99216 >
Date:16:10, 7 October 2011
Author:awjrichards
Status:ok (Comments)
Tags:
Comment:
Moved logo link override JS into it's own file and resource loader-ified; loading placeholder resource before parent constructor in TwoStepTwoColumn form; Moved placeholder resource position deinition to top
Modified paths:
  • /trunk/extensions/DonationInterface/payflowpro_gateway/forms/Form.php (modified) (history)
  • /trunk/extensions/DonationInterface/payflowpro_gateway/forms/TwoStepTwoColumn.php (modified) (history)
  • /trunk/extensions/DonationInterface/payflowpro_gateway/logolink_override.js (added) (history)
  • /trunk/extensions/DonationInterface/payflowpro_gateway/payflowpro_gateway.body.php (modified) (history)
  • /trunk/extensions/DonationInterface/payflowpro_gateway/payflowpro_gateway.php (modified) (history)
  • /trunk/extensions/DonationInterface/payflowpro_gateway/validate_input.js (modified) (history)

Diff [purge]

Index: trunk/extensions/DonationInterface/payflowpro_gateway/validate_input.js
@@ -1,4 +1,3 @@
2 -//<![CDATA[
32 function addEvent(obj, evType, fn){
43 if (obj.addEventListener){
54 obj.addEventListener(evType, fn, false);
@@ -206,4 +205,3 @@
207206 }
208207
209208 window.onfocus = CloseCVV;
210 -//]]>
Index: trunk/extensions/DonationInterface/payflowpro_gateway/forms/Form.php
@@ -65,6 +65,7 @@
6666 $this->setStylePath();
6767 }
6868 $wgOut->addExtensionStyle( $this->getStylePath() );
 69+
6970 /**
7071 * if OWA is enabled, load the JS.
7172 *
@@ -74,9 +75,20 @@
7576 if(defined('OWA')){
7677 $this->loadOwaJs();
7778 }
 79+
 80+ $this->loadLogoLinkOverride();
7881 }
7982
8083 /**
 84+ * Override the link in the logo to redirec to a particular form
 85+ * rather than the main page
 86+ */
 87+ public function loadLogoLinkOverride() {
 88+ global $wgOut;
 89+ $wgOut->addModules( 'pfp.core.logolink_override' );
 90+ }
 91+
 92+ /**
8193 * Set the path to the CSS file for the form
8294 *
8395 * This should be a full path, perhaps taking advantage of $wgScriptPath.
Index: trunk/extensions/DonationInterface/payflowpro_gateway/forms/TwoStepTwoColumn.php
@@ -5,15 +5,17 @@
66 public function __construct( &$form_data, &$form_errors ) {
77 global $wgOut;
88
 9+ // load validation and placeholder JS
 10+ $this->loadPlaceholders();
 11+
912 parent::__construct( $form_data, $form_errors );
10 -
11 - // load validation and placeholder JS
12 - $this->loadPlaceholders();
1313 }
1414
1515 public function loadPlaceholders() {
1616 global $wgOut;
1717 $wgOut->addModules( 'pfp.form.core.placeholders' );
 18+ //$placeholder_resources = '<script type="text/javascript">mw.loader.load("pfp.form.core.placeholders");</script>';
 19+ //$wgOut->addHtml( $placeholder_resources );
1820 }
1921
2022 /**
Index: trunk/extensions/DonationInterface/payflowpro_gateway/logolink_override.js
@@ -0,0 +1,3 @@
 2+$(document).ready(function() {
 3+ $("div#p-logo a").attr("href","#");
 4+});
Property changes on: trunk/extensions/DonationInterface/payflowpro_gateway/logolink_override.js
___________________________________________________________________
Added: svn:eol-style
15 + native
Index: trunk/extensions/DonationInterface/payflowpro_gateway/payflowpro_gateway.body.php
@@ -74,17 +74,6 @@
7575
7676 $wgOut->addScript( Skin::makeVariablesScript( $scriptVars ) );
7777
78 - // @fixme can this be moved into the form generators?
79 - // @fixme this is broken on MW 1.16, executes before jQuery load
80 - $js = <<<EOT
81 -<script type="text/javascript">
82 -jQuery(document).ready(function() {
83 - jQuery("div#p-logo a").attr("href","#");
84 -});
85 -</script>
86 -EOT;
87 - $wgOut->addHeadItem( 'logolinkoverride', $js );
88 -
8978 // find out if amount was a radio button or textbox, set amount
9079 if ( isset( $_REQUEST['amount'] ) && preg_match( '/^\d+(\.(\d+)?)?$/', $wgRequest->getText( 'amount' ) ) ) {
9180 $amount = $wgRequest->getText( 'amount' );
Index: trunk/extensions/DonationInterface/payflowpro_gateway/payflowpro_gateway.php
@@ -180,6 +180,7 @@
181181
182182 // form placeholders
183183 $wgResourceModules[ 'pfp.form.core.placeholders' ] = array(
 184+ 'position' => 'top',
184185 'scripts' => 'form_placeholders.js',
185186 'dependencies' => 'pfp.form.core.validate',
186187 'messages' => array(
@@ -214,6 +215,14 @@
215216 'remoteExtPath' => 'DonationInterface/payflowpro_gateway'
216217 );
217218
 219+// Logo link override
 220+$wgResourceModules[ 'pfp.core.logolink_override' ] = array(
 221+ 'scripts' => 'logolink_override.js',
 222+ 'localBasePath' => dirname( __FILE__ ),
 223+ 'remoteExtPath' => 'DonationInterface/payflowpro_gateway'
 224+
 225+);
 226+
218227 function payflowGatewayConnection() {
219228 global $wgPayflowGatewayDBserver, $wgPayflowGatewayDBname;
220229 global $wgPayflowGatewayDBuser, $wgPayflowGatewayDBpassword;

Follow-up revisions

RevisionCommit summaryAuthorDate
r100238Merging the fundraising branch of DonationInterface back into trunk....khorn16:57, 19 October 2011

Comments

#Comment by Khorn (WMF) (talk | contribs)   17:28, 10 October 2011

Super-glad to see this move off of the gateway_body files and into the Form class(es). This is another of those, though, that we're going to have to look at closely during the re-merge.

Status & tagging log