]> git.nbdom.net Git - nb.git/commitdiff
db
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Wed, 27 Jul 2016 11:19:40 +0000 (13:19 +0200)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Wed, 27 Jul 2016 11:19:40 +0000 (13:19 +0200)
lib/php/db/wp.php

index 5caef81b3fc2d4b5489a63e79eba7eb800d37c21..e2c3a72965e4c94915a6f48d7f1f725b0339063f 100644 (file)
@@ -23,14 +23,17 @@ class html_table extends WP_List_Table {
   }
 
        public function search_box( $text='Search', $input_id='search' ) {
+    $base = preg_replace('/\?.*?(page=\w+).*$/','?\1',$_SERVER['REQUEST_URI']);
     echo ''
       #.'<div id="screen-options-wrap" class="hidden" tabindex="-1" aria-label="Screen Options Tab">'
       .'<div>'
       .'<form id="searchform" role="search" method="get" action="'.$_SERVER['SCRIPT_NAME'].'">'
       .'<fieldset class="screen-options">'
+      #.'<label>Table:</label>'
       .'<h1>Table: '
 
-      .'<select name="table" onchange="if(this.value != \'0\') this.form.submit();">'
+      #.'<select name="table" onchange="if(this.value != \'0\') this.form.submit();">'
+      .'<select name="table" onchange="document.location=\''.$base.'&table=\'+this.value">'
       .join("",array_map(function($a){
         return sprintf('<option%s value="%s">%s</option>',$this->_table->p('table') == $a ? ' selected="selected"' : '',$a
           ,$this->_table->prettyText(preg_replace('/^'.$GLOBALS['wpdb']->prefix.'/','',$a))
@@ -38,7 +41,7 @@ class html_table extends WP_List_Table {
       .'</select>'
 
       #.'<select name="db" onchange="if(this.value != \'0\') this.form.submit();">'
-      .'<select name="db" onchange="document.location=\''.preg_replace('/\?.*?(page=\w+).*$/','?\1',$_SERVER['REQUEST_URI']).'&db=\'+this.value">'
+      .'<select name="db" onchange="document.location=\''.$base.'&db=\'+this.value">'
       #.'<select name="db" onchange="if(this.value != \'0\'){var v=this.value;this.form.reset();this.value=v;this.form.submit();}">'
       .join("",array_map(function($a){
         return sprintf('<option%s value="%s">%s</option>',$this->_table->p('db') == $a ? ' selected="selected"' : '',$a
@@ -57,7 +60,8 @@ class html_table extends WP_List_Table {
 
            .get_submit_button( __( 'Search' ), 'button', '', false, array('id' => 'search-submit') )
       .'<a class="page-title-action" href="/wp-admin/post-new.php?post_type=page&amp;action=edit&amp;table='.($this->_table->db()->p('table')).'">Add New</a>'
-    .'</h1>';
+    .'</h1>'
+    ;
     echo '<p id="search" class="search-box">';
 
     foreach ([