$size = ($this->size() and is_scalar($this->size())) ? $this->size() : 0;
$tag = ( ($size>$this->textarea_size) or preg_match('/^(text|binary|blob)/i',$this->type) ) ? 'textarea' : 'input';
+ $html = '';
+ 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';
+ } else {
+ $html = '<'.$tag
+ .' name="'.$this->name.'"'
+ .' id="'.$this->name.'"'
+ .( ($size and $tag != 'textarea') ? ' size="'.$size.'"' : '')
+ #.' value="'.$value.'"'
+ .($tag == 'textarea' ? '>'.$value.'</textarea>' : ' type="'
+ .($type ? $type : $this->html_type())
+ .'" value="'.$value.'" />')
+ ;
+ }
+
return '<div class="label '.$this->name.'"><label for="'.$this->name.'">'.htmlspecialchars(prettyText($this->name)).'</label>'
- .($this->extras
- ? '<span class="extra" id="'.$this->name.'">'.$this->out($value).'</span>'
- : '<'.$tag
- .' name="'.$this->name.'"'
- .' id="'.$this->name.'"'
- .( ($size and $tag != 'textarea') ? ' size="'.$size.'"' : '')
- #.' value="'.$value.'"'
- .($tag == 'textarea' ? '>'.$value.'</textarea>' : ' type="'
- .($type ? $type : $this->html_type())
- .'" value="'.$value.'" />')
- )
+ .$html
.'</div>'.NB_EOL;
}
$params = $this->params;
$ext = $this->ext;
- $title = array_filter(array_unique(array_slice(array_values($params),1)),
+ $title = array_filter(array_unique(array_slice(array_values($params),1,3)),
function($v){
return(in_array($v,self::ACTIONS_NO_TITLE) ? '' : trim($v));
}
$nav[] = [$v,'/'];
} else {
- $nav[] = [$this->prettyText($v),"$path$v.".$ext];
- $path .= "$v/";
+ $nav[] = [$this->prettyText($v),"$path".urlencode($v).".".$ext];
+ $path .= $v."/";
}
$this->page($info);
} elseif ($action == 'update' and $this->perm >= self::WRITE) {
- # NB 19.12.16: TODO NOT WORKING with update using replace
if (!$this->table->update($_POST,$info)) $this->error('update: '.print_r($info,true));
header('Location: '.$this->table->base.'/');
$this->page($info);