]> git.nbdom.net Git - nb.git/commitdiff
lib/php/db/table.php fix no valid html in html_menu
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Tue, 13 Feb 2024 08:51:30 +0000 (09:51 +0100)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Tue, 13 Feb 2024 08:51:30 +0000 (09:51 +0100)
lib/php/db/table.php
www/dbq/html/default.js

index cb6d623f320c22ec7f911a121c25e81576081d63..68285512bac89b01d463269e093675d6016783d7 100644 (file)
@@ -501,6 +501,7 @@ Class Table extends nb {
                        $params = [];
                        foreach ($keys as $k) {
                                $params[$k] = self::p($k);
+                               $params[$k] = urlencode( $params[$k] ); # NB 13.02.24: could contains qutoe, spaces, ... eg: orderby   
                                if (!isset($params[$k]) or (string)$params[$k] === '') unset($params[$k]);
                        }
                        return $params;
@@ -2139,7 +2140,7 @@ Class Table extends nb {
        public function html_menu($opt=[]) {
                if (isset($opt['html_menu']) and !$opt['html_menu']) return '';
 
-               $buttons = '<span class="btn-group btn-group-sm"><input type="submit" class="button button-small btn btn-primary" value="Go"/></span>';
+               $buttons = '<span class="btn-group btn-group-sm"><input type="submit" class="button button-small btn btn-primary" value="Go"/></span>'.NB_EOL;
                if (!empty($opt['buttons'])) $buttons = $opt['buttons'];
 
                $r = '<form id="db-menu-form" class="menu card d-table list-group-item form-inline" method="get" action="'.$this->request_uri().'">'.NB_EOL;
@@ -2161,7 +2162,7 @@ Class Table extends nb {
                                        'prettyText' => true,
                                        'sort'       => 'natcasesort',
                                ]);
-                               $option_html .= '</span>';
+                               $option_html .= '</span>'.NB_EOL;
                        }
 
                        // Dbs - see default.js if you change class
@@ -2173,7 +2174,7 @@ Class Table extends nb {
                                        'prettyText' => true,
                                        'sort' => 'natcasesort',
                                ]);
-                               $option_html .= '</span>';
+                               $option_html .= '</span>'.NB_EOL;
                        }
 
                        // Format
@@ -2183,7 +2184,7 @@ Class Table extends nb {
                                'selected'   => $this->db()->format,
                                'prettyText' => true,
                        ]);
-                       $option_html .= '</span>';
+                       $option_html .= '</span>'.NB_EOL;
 
                        // Limit
                        if (!empty($this->db()->limits) and count($this->db()->limits)>1) {
@@ -2195,7 +2196,7 @@ Class Table extends nb {
                                        'sort' => 'sort',
                                        'default_value' => $this->db()->limits[0],
                                ]);
-                               $option_html .= '</span>';
+                               $option_html .= '</span>'.NB_EOL;
                        }
 
                        // Submit
@@ -2209,12 +2210,12 @@ Class Table extends nb {
                                'selected'   => $this->p('orderby'),
                                'prettyText' => true,
                        ]);
-                       $option_html .= '</span>';
+                       $option_html .= '</span>'.NB_EOL;
                        */
 
                        $form_hidden_ignore = ['db','table','format','limit'];#,'download'];
 
-                       if ($option_html) $r .= '<div class="options row mb-2">' . $option_html . '</div>';
+                       if ($option_html) $r .= '<div class="options row mb-2">'.NB_EOL . $option_html .NB_EOL. '</div>'.NB_EOL;
 
 
                } else { # // Options
@@ -2226,7 +2227,7 @@ Class Table extends nb {
                //
                // Criterias
                //
-               $r .= '<div class="criterias row">';
+               $r .= '<div class="criterias row">'.NB_EOL;
                if (!isset($opt['fields'])) $opt['fields'] = $this->fields();
                foreach ($opt['fields'] as $k => $f) {
 
@@ -2238,19 +2239,18 @@ Class Table extends nb {
                                . '<label>'.prettyText($k).':</label>'
                                . '<input class="form-control mb-1 mr-1" type="text" id="'.$k.'" name="'.$this->ppreff().$k.'" value="'.$v.'" />'
                                .'</span>'
+                               .NB_EOL
                        ;
 
                }
                if (!$options) $r .= $buttons;
-               $r .= '</div>'; # < Criterias
+               $r .= NB_EOL.'</div>'.NB_EOL; # < Criterias
 
                //
                // Hidden
                //
-               if ($this->show_hidden_params) $r .= ''#.print_r(self::$params,true)
+               if ($this->show_hidden_params) $r .= ''
                        .self::form_hidden($form_hidden_ignore)
-                       // Embed for no html format (rent)
-# NB 08.06.18                          .'<input type="'.($this->p('debug') ? 'text' : 'hidden').'" name="download" value="0"/>';
                ;
 
                //
index de65ad8e18809a83205bab7443d747a282e24915..f0adb46ed3c4e0002825eb5e4da30a86c13b5a2f 100644 (file)
@@ -113,7 +113,7 @@ function dbqLoad(DBQ) {
                        +( window._dbq['perm'] >= window._dbq['perms']['write']
                                ? '<input type="button" class="btn btn-warning add '+e.className+'"'
                                        +' onclick="window.location=\''+window._dbq['table.base']+'/add/\'"'
-                                       +' value="'+window._dbq['text.add']+'"/>'
+                                       +' value="'+window._dbq['text.add']+'" />'
                                : ''
                        )
                );