if ($this->extras) {
$html = '<span class="extra" id="'.$this->name.'">'.$this->out($value).'</span>';
} elseif (strpos($this->type,'Zbool') !== false) {
- $html = '<input type="checkbox" name="'.$this->name.'" value="1">Yes <input type="checkbox" name="'.$this->name.'" value="0">No';
+ $html .= '<label>Yes</label><input type="checkbox" name="'.$this->name.'" value="1">';
+ $html .= '<label>Yes</label><input type="checkbox" name="'.$this->name.'" value="0">';
} else {
$html = '<'.$tag
.' name="'.$this->name.'"'
return $this->db()->exec($sql);
}
- # dbq t=nb.mime_type a=table.update type=application/rss+xml name='RSS - Really Simple Syndication' ext=rss debug=2
public function update($post,&$info=[]) {
-# NB 30.01.17 if (empty($info['values'])) $info['values'] = [];
$keys = [];
$keys_values = [];
$fields = [];
$fields_values = [];
- #$update = [];
- #$where = [];
-
foreach ($this->fields() as $name => $field) {
if (!isset($post[$name])) {
$_value = isset($post[self::$key_preff.$name]) ? $post[self::$key_preff.$name] : null;
- if ($_value) {# and $_value !== $value) {
+ if ($_value) {
$fields[] = $name;
$fields_values[] = $value;
$keys_values[] = $_value;
}
#return $sql;
- #bye($info);
if (self::p('debug')) {
$this->debug($info,1);
return false;
#bye($info);
#return true;
#debug($execute);
- return $query->rowCount();
+ return $info['rowCount'];
}
$values = $add ? array_fill(0,count($keys),'') : explode($this->param_args_sep,$this->params['args']);
- $this->table->html_edit(array_combine($keys,$values),$this->table->base.'/'.($add ? 'insert' : 'update'.'/'.$this->params['args']).'/',$add);
+ $this->table->html_edit(array_combine($keys,$values),
+ $this->table->base . '/' . ($add ? 'insert' : 'update' . '/' . urlencode($this->params['args'])) . '/'
+ ,$add);
}
public function table_rw() {
-function form_clean(e){var t;for(i=0;i<e.length;i++)t=e.elements[i],"none"!=t.style.display&&("text"==t.type?t.value="":!t.type.match(/^select/)||"limit"!=t.name&&"format"!=t.name||(t.selectedIndex=0))}function form_submit_clean(e){var t=0,n="",o=e.getAttribute("action");if("get"!=e.getAttribute("method"))return!0;for(t=0;t<e.length;t++){var r=e[t];r.name&&(""!=r.value&&"undefined"!=r.value&&(n+=(n?"&":"?")+encodeURI(r.name)+"="+encodeURI(r.value)))}return n=("?"==o?"":o)+n,e.reset(),window.location=n,!1}document.addEventListener("DOMContentLoaded",function(){NodeList.prototype.forEach=Array.prototype.forEach,document.querySelectorAll("form").forEach(function(e){e.onsubmit=function(){if(this.elements.limit){var e=this.elements.limit;"undefined"!=window._dbq.default_limit&&e.value==window._dbq.default_limit&&e.removeAttribute("value")}return form_submit_clean(this)}}),document.querySelectorAll("form.menu").forEach(function(e){e.setAttribute("action",window.location.toString().replace(/\?.*$/,"")),e.querySelectorAll("form.menu select.format").forEach(function(e){e.removeAttribute("name"),e.onchange=function(){return this.form.setAttribute("action",window._dbq["table.base"]+"."+this.value),this.form.onsubmit()}}),e.querySelectorAll("form.menu select.tables").forEach(function(e){e.removeAttribute("name"),e.onchange=function(){return this.form.setAttribute("action",window._dbq["db.base"]+"/"+this.value+".html"),this.form.onsubmit()}}),e.querySelectorAll("form.menu select.limit").forEach(function(e){e.onchange=function(){return this.form.onsubmit()}})}),document.querySelector(".nav.bottom")&&document.querySelector("table.rows")&&document.querySelector("table.rows").insertAdjacentHTML("beforebegin",'<div class="nav top">'+document.querySelector(".nav.bottom").innerHTML+"</div>"),document.querySelectorAll("table").forEach(function(e){parseInt(e.offsetWidth)>parseInt(window.innerWidth)&&(e.className=e.className.replace(/(^| +)fixed($| )/,"")+" fixed",e.className=e.className.trim())}),window._dbq.perm<window._dbq.perms.write&&(document.querySelectorAll("form.edit").forEach(function(e){e.setAttribute("onsubmit","return false")}),document.querySelectorAll("form.edit input[type=submit],form.edit input[type=reset]").forEach(function(e){e.setAttribute("style","display:none")})),document.querySelectorAll("form.menu input[type=submit]").forEach(function(e){e.insertAdjacentHTML("afterend",' <input type="button" class="clear '+e.className+'" onclick="form_clean(this.form)" value="'+window._dbq["text.clear"]+'" />'+(window._dbq.perm>=window._dbq.perms.write?' <input type="button" class="add '+e.className+'" onclick="window.location=\''+window._dbq["table.base"]+'/add/\'" value="'+window._dbq["text.add"]+'"/>':""))})});
+function form_clean(e){var t;for(i=0;i<e.length;i++)"none"!=(t=e.elements[i]).style.display&&("text"==t.type?t.value="":!t.type.match(/^select/)||"limit"!=t.name&&"format"!=t.name||(t.selectedIndex=0))}function form_submit_clean(e){var t=0,n="",o=e.getAttribute("action");if("get"!=e.getAttribute("method"))return!0;for(t=0;t<e.length;t++){var r=e[t];r.name&&(""!=r.value&&"undefined"!=r.value&&(n+=(n?"&":"?")+encodeURI(r.name)+"="+encodeURI(r.value)))}return n=("?"==o?"":o)+n,e.reset(),window.location=n,!1}document.addEventListener("DOMContentLoaded",function(){NodeList.prototype.forEach=Array.prototype.forEach,document.querySelectorAll("form").forEach(function(e){e.onsubmit=function(){if(this.elements.limit){var e=this.elements.limit;"undefined"!=window._dbq.default_limit&&e.value==window._dbq.default_limit&&e.removeAttribute("value")}return form_submit_clean(this)}}),document.querySelectorAll("form.menu").forEach(function(e){e.setAttribute("action",window.location.toString().replace(/\?.*$/,"")),e.querySelectorAll("form.menu select.format").forEach(function(e){e.removeAttribute("name"),e.onchange=function(){return this.form.setAttribute("action",window._dbq["table.base"]+"."+this.value),this.form.onsubmit()}}),e.querySelectorAll("form.menu select.tables").forEach(function(e){e.removeAttribute("name"),e.onchange=function(){return this.form.setAttribute("action",window._dbq["db.base"]+"/"+this.value+".html"),this.form.onsubmit()}}),e.querySelectorAll("form.menu select.limit").forEach(function(e){e.onchange=function(){return this.form.onsubmit()}})}),document.querySelector(".nav.bottom")&&document.querySelector("table.rows")&&document.querySelector("table.rows").insertAdjacentHTML("beforebegin",'<div class="nav top">'+document.querySelector(".nav.bottom").innerHTML+"</div>"),document.querySelectorAll("table").forEach(function(e){parseInt(e.offsetWidth)>parseInt(window.innerWidth)&&(e.className=e.className.replace(/(^| +)fixed($| )/,"")+" fixed",e.className=e.className.trim())}),window._dbq.perm<window._dbq.perms.write&&(document.querySelectorAll("form.edit").forEach(function(e){e.setAttribute("onsubmit","return false")}),document.querySelectorAll("form.edit input[type=submit],form.edit input[type=reset]").forEach(function(e){e.setAttribute("style","display:none")})),document.querySelectorAll("form.menu input[type=submit]").forEach(function(e){e.insertAdjacentHTML("afterend",' <input type="button" class="clear '+e.className+'" onclick="form_clean(this.form)" value="'+window._dbq["text.clear"]+'" />'+(window._dbq.perm>=window._dbq.perms.write?' <input type="button" class="add '+e.className+'" onclick="window.location=\''+window._dbq["table.base"]+'/add/\'" value="'+window._dbq["text.add"]+'"/>':""))})});