'image/x-portable-graymap' => 'pgm',
'application/x-chess-pgn' => 'pgn',
'application/pgp-signature' => 'pgp',
+'text/x-php' => 'php',
'image/x-pict' => 'pic',
'application/pkixcmp' => 'pki',
'application/pkix-pkipath' => 'pkipath',
// Write output
$this->page_colors();
$this->page->headers_no_cache();
+ $this->page->js_code = trim('
+function form_submit_clean(form) {
+ form_clean(form);
+ form.submit();
+}
+function form_clean(form) {
+ var e;
+ for(i=0;i<form.length;i++) {
+ e = form.elements[i];
+ if (e.style.display == "none") continue;
+ if (e.type != "text") continue;
+ e.value = ""
+ }
+}
+document.addEventListener("DOMContentLoaded", function() {
+ for (var e of document.querySelectorAll(".menu select.limit")) {
+ e.onchange = function() {
+ this.form.submit();
+ return false;
+ };
+ }
+ for (var e of document.querySelectorAll(".menu select.tables, .menu select.format")) {
+ e.onchange = function() {
+ window.location = "./" + this.form.elements["table"].value + "." + this.form.elements["format"].value;
+ return false;
+ };
+ }
+});
+ ');
$this->page->begin();
}
public function table_rows($fct=null) {
+ if ($this->page->is('html')) {
+ #debug($this->page->content_type());
+ }
$opt = ($this->page->is('html')
and ($this->perm >= self::VIEW)
and $this->table->type() != 'sql'
) ? [
'buttons' => join(' ',[
'<input type="submit" class="button button-small" value="GO"/>',
- #'<input type="button" class="button button-small" onclick="f=this.parentElement.parentElement; f.elements[\'action\'].value=\'edit\'; f.setAttribute(\'method\',\'POST\'); f.submit();" value="Add"/>',
'<input type="button" class="button button-small" onclick="window.location=\''.$this->table->base.'add/'.'\'" value="Add"/>',
+ '<input type="button" class="button button-small" onclick="form_clean(this.form)" value="X"/>',
]),
'row_parse_pre' => function(&$r){
if ($format == 'html') $format = 'table';
$this->params['format'] = $format;
+ $this->db->formats = [
+ 'table',
+ 'csv',
+ 'json',
+ 'yaml',
+ 'sh',
+ ];
$this->db->format = $format;
// Then content type