Added minor edit filter to Special:Log
authorDan
Fri, 15 May 2009 14:16:22 -0400
changeset 981 888502d761b4
parent 980 d13fad911955
child 982 bd349add2697
Added minor edit filter to Special:Log
language/english/tools.json
plugins/SpecialLog.php
--- a/language/english/tools.json	Fri May 15 14:03:54 2009 -0400
+++ b/language/english/tools.json	Fri May 15 14:16:22 2009 -0400
@@ -178,6 +178,9 @@
       form_filtertype_within: 'Within',
       form_filtertype_page: 'Page',
       form_filtertype_action: 'Action',
+      form_filtertype_minor: 'Minor edit',
+      form_filtertype_minor_yes: 'Show only minor edits',
+      form_filtertype_minor_no: 'Hide minor edits',
       formaction_rename: 'Rename',
       formaction_create: 'Create page',
       formaction_delete: 'Delete page',
--- a/plugins/SpecialLog.php	Fri May 15 14:03:54 2009 -0400
+++ b/plugins/SpecialLog.php	Fri May 15 14:16:22 2009 -0400
@@ -62,18 +62,21 @@
         $value = strval(intval($_POST['value']['within'])) . $_POST['value']['withinunits'];
       else
         $value = $_POST['value'][$type];
-        
-      $value = str_replace('/', '.2f', sanitize_page_id($value));
-        
-      if ( empty($value) || ( $type == 'within' && intval($value) == 0 ) )
+      
+      if ( !ctype_digit($value) )
+        $value = str_replace('/', '.2f', sanitize_page_id($value));
+      
+      if ( $value !== '0' && (empty($value) || ( $type == 'within' && intval($value) == 0 )) )
       {
         $adderror = $lang->get('log_err_addfilter_field_empty');
       }
-      
-      $append = ( !empty($_POST['existing_filters']) ) ? "{$_POST['existing_filters']}/" : '';
-      $url = makeUrlNS('Special', "Log/{$append}{$type}={$value}");
-      
-      redirect($url, '', '', 0);
+      else
+      {
+        $append = ( !empty($_POST['existing_filters']) ) ? "{$_POST['existing_filters']}/" : '';
+        $url = makeUrlNS('Special', "Log/{$append}{$type}={$value}");
+        
+        redirect($url, '', '', 0);
+      }
     }
     $params = explode('/', $params);
     foreach ( $params as $i => $param )
@@ -210,6 +213,7 @@
             <option value="page"><?php echo $lang->get('log_form_filtertype_page'); ?></option>
             <option value="within"><?php echo $lang->get('log_form_filtertype_within'); ?></option>
             <option value="action"><?php echo $lang->get('log_form_filtertype_action'); ?></option>
+            <option value="minor"><?php echo $lang->get('log_form_filtertype_minor'); ?></option>
           </select>
         </td>
         <td class="row1" style="width: 50%; text-align: left;">
@@ -239,6 +243,16 @@
               <option value="edit"><?php echo $lang->get('log_formaction_votereset'); ?></option>
             </select>
           </div>
+          <div class="log_addfilter" id="log_addform_minor">
+            <label>
+              <input type="radio" name="value[minor]" value="1" checked="checked" />
+              <?php echo $lang->get('log_form_filtertype_minor_yes'); ?>
+            </label>
+            <label>
+              <input type="radio" name="value[minor]" value="0" />
+              <?php echo $lang->get('log_form_filtertype_minor_no'); ?>
+            </label>
+          </div>
         </td>
       </tr>
       <tr>
@@ -322,6 +336,9 @@
         $action = ( $lang->get("log_formaction_{$value}") === "log_formaction_{$value}" ) ? $lang->get("log_action_{$value}") : $lang->get("log_formaction_{$value}");
         $crumb = $lang->get('log_breadcrumb_action', array('action' => htmlspecialchars($action)));
         break;
+      case 'minor':
+        $crumb = $value == '1' ? $lang->get('log_form_filtertype_minor_yes') : $lang->get('log_form_filtertype_minor_no');
+        break;
       case 'within':
         $value = intval($value);
         if ( $value % 31536000 == 0 )