private function table_rows($fct=null) {
$ropt = [
- #'html_menu' => empty($this->_nopage),
-
# With limit or criterias or page next
'is_html' => $this->is_html,
-
- # Without limit or criterias or page next
-# NB 20.06.18 'is_html' => ($this->is_html and empty($this->_nopage)),
-
];
$this->db->is_html = $ropt['is_html'];
$this->db->limit = empty($ropt['html_menu']) ? $this->limit() : null;
//
// h1 to select links
//
-// NB 03.10.18 if (document.querySelector("body.no-db"))
document.querySelectorAll("body > h1 a.title-nav-db, body > h1 a.title-nav-table").forEach(function(e) {
+ var title = e.innerHTML;
//console.log(e.className+': '+window._dbq[e.className+'.base']);
var cname = e.className.replace('title-nav-','')
var base = window._dbq[cname+'.base'].replace(/\/[^\/]+$/,'');
-// NB 11.06.18 var url = base + (base == '' ? '/ls' : '') + '.json';
var url = base + '/ls' + '.json';
var fields = cname == 'db' ? ['id','id'] : ['name','name'];
// NB 11.06.18 console.log(url+' | '+cname);
dbqGet(url,function(o){
//console.log(window._dbq['body.no-db param.'+cname]);
+ //console.log(o);
+
var s = o.select(fields[0],fields[1], window._dbq['param.'+cname]);
+
+ // Add missing is action is not db
+ var exists = 0;
+ for (const option of s.options) {
+ console.log(title + ' <> ' + option.value);
+ if (option.value != title && option.innerHTML != title) continue;
+ exists = 1;
+ break;
+ }
+ if (!exists) {
+ var opt = document.createElement('option');
+ opt.value = title;
+ opt.innerHTML = dbqPrettyText(title);
+ }
+ s.prepend(opt);
+
+ //console.log(s);
s.onchange = function() {
window.location = base + '/' + this.value + ext;
//console.log(base + '/' + this.value + ext);
};
+
var crit = document.getElementById(cname);
if (crit) crit.parentNode.style.display = 'none';
s.className = e.className;