diff --git a/lib/zin/func.php b/lib/zin/func.php index 90f9b75db0..826922c879 100644 --- a/lib/zin/func.php +++ b/lib/zin/func.php @@ -1063,3 +1063,71 @@ function formItemDropdown() { return createWg('formItemDropdown', func_get_args()); } + +/** + * Zentao editor wg. + * + * string name + * ?string id + * ?string class + * ?string value + * ?bool required + * ?string placeholder + * ?int rows + * ?int cols + */ +function editor() +{ + return createWg('editor', func_get_args()); +} + +/** + * Zentao comment button wg. + * + * ?string dataTarget + * ?string dataUrl + * ?string dataType + * ?string icon + * ?string text + * ?bool square + * ?bool disabled + * ?bool active + * ?string url + * ?string target + * ?string trailingIcon + * ?string hint + * ?string type + * ?string btnType + * string|int|null size + * string|bool|null caret + */ +function commentBtn() +{ + return createWg('commentBtn', func_get_args()); +} + +/** + * + * Zentao comment dialog wg. + * + * ?string title, + * ?string url + * ?string name='comment' + * ?string method='POST' + */ +function commentDialog() +{ + return createWg('commentDialog', func_get_args()); +} + +/** + * Zentao comment form wg. + * + * ?string url + * ?string name='comment' + * ?string method='POST' + */ +function commentForm() +{ + return createWg('commentForm', func_get_args()); +} diff --git a/lib/zin/wg/commentbtn/v1.php b/lib/zin/wg/commentbtn/v1.php index 3f15227b77..609f01dc62 100644 --- a/lib/zin/wg/commentbtn/v1.php +++ b/lib/zin/wg/commentbtn/v1.php @@ -5,8 +5,9 @@ namespace zin; class commentBtn extends btn { static $defineProps = array( + 'dataTarget?:string', 'dataUrl?:string', - 'dataType?:string="html"', + 'dataType?:string', 'icon?:string', 'iconClass?:string', 'text?:string', @@ -26,14 +27,15 @@ class commentBtn extends btn protected function getProps(): array { - $dataUrl = $this->prop('dataUrl'); - $dataType = $this->prop('dataType'); - $props = parent::getProps(); + $dataTarget = $this->prop('dataTarget'); + $dataUrl = $this->prop('dataUrl'); + $dataType = $this->prop('dataType'); + $props = parent::getProps(); $props['data-toggle'] = 'modal'; - $props['data-type'] = 'ajax'; - $props['data-data-type'] = $dataType; + $props['data-type'] = $dataType; $props['data-url'] = $dataUrl; + $props['data-target'] = $dataTarget; return $props; } diff --git a/lib/zin/wg/commentdialog/v1.php b/lib/zin/wg/commentdialog/v1.php new file mode 100644 index 0000000000..885d2c1306 --- /dev/null +++ b/lib/zin/wg/commentdialog/v1.php @@ -0,0 +1,35 @@ +prop('title'); + $name = $this->prop('name'); + $url = $this->prop('url'); + $method = $this->prop('method'); + if(empty($title)) $title = $lang->action->create; + + return modal + ( + set::id('comment-dialog'), + set::title($title), + commentForm + ( + set::url($url), + set::method($method), + set::name($name), + ) + ); + } +} diff --git a/lib/zin/wg/commentform/v1.php b/lib/zin/wg/commentform/v1.php new file mode 100644 index 0000000000..64bd237b9b --- /dev/null +++ b/lib/zin/wg/commentform/v1.php @@ -0,0 +1,40 @@ +prop('url'); + $name = $this->prop('name'); + $method = $this->prop('method'); + if(empty($name)) $name = 'comment'; + + return form + ( + set::url($url), + set::method($method), + setClass('comment-form'), + editor + ( + setID($name), + set::name($name) + ), + set::actions + ( + array( + 'submit', + array('data-dismiss' => 'modal', 'text' => $lang->close) + ) + ) + ); + } +}