Awight has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/315044

Change subject: Revert "Pager glue for the damaged queue"
......................................................................

Revert "Pager glue for the damaged queue"

See also Ic6f3d21686709c4857c14b5df3de45d80c3d8bb4, where we try to fix the
pager and also support bulk operations.  It's somewhere in that Druply mess,
but hard to get quite right.

This reverts commit 1540aefd117698747cc625a22b445ac835c0c0d5.

Bug: T142058
Change-Id: Id86df619a60ec7e97cc9b65af2d4310c7646d785
---
M sites/all/modules/wmf_common/wmf_common.module
1 file changed, 20 insertions(+), 56 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/44/315044/1

diff --git a/sites/all/modules/wmf_common/wmf_common.module 
b/sites/all/modules/wmf_common/wmf_common.module
index e3306a9..a4f17f6 100644
--- a/sites/all/modules/wmf_common/wmf_common.module
+++ b/sites/all/modules/wmf_common/wmf_common.module
@@ -348,34 +348,15 @@
                );
        }
 
-       // TODO: Chill on the boilerplate.
-       if ( !empty( $_GET['gateway'] ) ) {
-               $gateway = $_GET['gateway'];
-       } elseif ( !empty( $form_state['input']['gateway'] ) ) {
-               $gateway = $form_state['input']['gateway'];
-       } else {
-               $gateway = '';
-       }
-
-       if ( !empty( $_GET['queue'] ) ) {
-               $queue = $_GET['queue'];
-       } elseif ( !empty( $form_state['input']['queue'] ) ) {
-               $queue = $form_state['input']['queue'];
-       } else {
-               $queue = '';
-       }
-
        $form['gateway'] = array(
                '#type' => 'textfield',
                '#title' => 'Gateway',
-               '#value' => $gateway,
                '#maxlength' => 256,
        );
 
        $form['queue'] = array(
                '#type' => 'textfield',
                '#title' => 'Queue',
-               '#value' => $queue,
                '#maxlength' => 256,
        );
 
@@ -386,14 +367,11 @@
 
        $form['#submit'] = array( 'wmf_common_damaged_search_submit' );
 
-       // FIXME: Strip query params cos including GET params in the action is 
burning us.  Crude!
-       $form['#action'] = request_path();
-
        if (
                isset( $form_state['perform_query'] ) ||
                empty( $form_state['input']['op'] ) // Run query on first load
        ) {
-               return wmf_common_damaged_perform_query( $form, $gateway, 
$queue );
+               return wmf_common_damaged_perform_query( $form, $form_state );
        }
 
        return $form;
@@ -413,7 +391,7 @@
        }
 }
 
-function wmf_common_damaged_perform_query( $form, $gateway, $queue ) {
+function wmf_common_damaged_perform_query( $form, &$form_state ) {
        $query = Database::getConnection( 'default', 'smashpig' )
                ->select( 'damaged', 'd' )
                ->fields( 'd', array(
@@ -423,11 +401,12 @@
                ->orderBy( 'damaged_date', 'DESC' )
                ->condition( 'retry_date', null );
 
-       if ( !empty( $gateway ) ) {
-               $query->condition( 'gateway', $gateway );
+       if ( !empty( $form_state['input']['gateway'] ) ) {
+               $query->condition( 'gateway', $form_state['input']['gateway'] );
        }
-       if ( !empty( $queue ) ) {
-               $query->condition( 'original_queue', $queue );
+
+       if ( !empty( $form_state['input']['queue'] ) ) {
+               $query->condition( 'original_queue', 
$form_state['input']['queue'] );
        }
 
        $rows = $query
@@ -440,35 +419,20 @@
                $row['error'] = l( $err, WmfQueueConsumer::itemUrl( $id ) );
        }
 
-    // query parameters to append to the GET string
-    $query_params = array( 'queue' => $queue, 'gateway' => $gateway );
-
-       $table_html = theme_table(
-         array(
-        // FIXME: Are these translated implicitly or shall we wrap in t()?
-        'header' => array(
-          'ID',
-          'Original Date',
-          'Damaged Date',
-          'Original Queue',
-          'Gateway',
-          'Order ID',
-          'Gateway txn ID',
-          'Error',
-        ),
-        'rows' => $rows,
-        'empty' => 'Nothing in the damaged message table!  Be very 
suspicious...',
-        'attributes' => array(),
-        'caption' => t( 'Damaged messages' ),
-        'colgroups' => array(),
-        'sticky' => true,
-      )
-    ).theme( 'pager', array(
-      'parameters' => $query_params,
-    ) );
-
        $form['table'] = array(
-         '#markup' => $table_html,
+               '#type' => 'tableselect',
+               '#header' => array(
+                       'id' => t( 'ID' ),
+                       'original_date' => t( 'Original Date' ),
+                       'damaged_date' => t( 'Damaged Date' ),
+                       'original_queue' => t( 'Original Queue' ),
+                       'gateway' => t( 'Gateway' ),
+                       'order_id' => t( 'Order ID' ),
+                       'gateway_txn_id' => t( 'Gateway txn ID' ),
+                       'error' => t( 'Error' )
+               ),
+               '#options' => $rows,
+               '#empty' => 'Nothing in the damaged message table!  Be very 
suspicious...',
        );
 
        $form['resend'] = array(

-- 
To view, visit https://gerrit.wikimedia.org/r/315044
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id86df619a60ec7e97cc9b65af2d4310c7646d785
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Awight <awi...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to