From f507abf379824960802b25b4be6697fd76dba617 Mon Sep 17 00:00:00 2001 From: zhujinyong Date: Wed, 19 Oct 2022 10:15:30 +0800 Subject: [PATCH 001/523] * Init zin. --- framework/base/control.class.php | 73 ++++++++++++++++++++- framework/control.class.php | 7 +- module/program/control.php | 3 +- zin/block.class.php | 35 ++++++++++ zin/page.class.php | 107 +++++++++++++++++++++++++++++++ zin/wg.class.php | 13 ++++ zin/wg.func.php | 12 ++++ zin/wg/button/v1.php | 12 ++++ zin/wg/tab/v1.php | 30 +++++++++ zin/wg/toolbar/v1.php | 24 +++++++ 10 files changed, 309 insertions(+), 7 deletions(-) create mode 100644 zin/block.class.php create mode 100644 zin/page.class.php create mode 100644 zin/wg.class.php create mode 100644 zin/wg.func.php create mode 100644 zin/wg/button/v1.php create mode 100644 zin/wg/tab/v1.php create mode 100644 zin/wg/toolbar/v1.php diff --git a/framework/base/control.class.php b/framework/base/control.class.php index 1576843b29..c83a61d294 100644 --- a/framework/base/control.class.php +++ b/framework/base/control.class.php @@ -366,19 +366,20 @@ class baseControl * * @param string $moduleName module name * @param string $methodName method name + * @param string $viewDir * @access public * @return string the view file */ - public function setViewFile($moduleName, $methodName) + public function setViewFile($moduleName, $methodName, $viewDir = 'view') { $moduleName = strtolower(trim($moduleName)); $methodName = strtolower(trim($methodName)); $modulePath = $this->app->getModulePath($this->appName, $moduleName); - $viewExtPath = $this->app->getModuleExtPath($this->appName, $moduleName, 'view'); + $viewExtPath = $this->app->getModuleExtPath($this->appName, $moduleName, $viewDir); $viewType = $this->viewType == 'mhtml' ? 'html' : $this->viewType; - $mainViewFile = $modulePath . 'view' . DS . $this->devicePrefix . $methodName . '.' . $viewType . '.php'; + $mainViewFile = $modulePath . $viewDir . DS . $this->devicePrefix . $methodName . '.' . $viewType . '.php'; $viewFile = $mainViewFile; if(!empty($viewExtPath)) @@ -893,6 +894,72 @@ class baseControl echo $this->output; } + /** + * 向浏览器输出内容。 + * Print the content of the view. + * + * @param string $moduleName module name + * @param string $methodName method name + * @access public + * @return void + */ + public function render($moduleName = '', $methodName = '') + { + if(empty($moduleName)) $moduleName = $this->moduleName; + if(empty($methodName)) $methodName = $this->methodName; + + include $this->app->getBasePath() . 'zin' . DS . 'wg.func.php'; + include $this->app->getBasePath() . 'zin' . DS . 'block.class.php'; + include $this->app->getBasePath() . 'zin' . DS . 'page.class.php'; + + /** + * 设置视图文件。(PHP7有一个bug,不能直接$viewFile = $this->setViewFile())。 + * Set viewFile. (Can't assign $viewFile = $this->setViewFile() directly because one php7's bug.) + */ + $results = $this->setViewFile($moduleName, $methodName, 'ui'); + + $viewFile = $results; + if(is_array($results)) extract($results); + + /** + * 获得当前页面的CSS和JS。 + * Get css and js codes for current method. + */ + $css = $this->getCSS($moduleName, $methodName); + $js = $this->getJS($moduleName, $methodName); + if($css) $this->view->pageCSS = $css; + if($js) $this->view->pageJS = $js; + + /** + * 切换到视图文件所在的目录,以保证视图文件里面的include语句能够正常运行。 + * Change the dir to the view file to keep the relative paths work. + */ + $currentPWD = getcwd(); + chdir(dirname($viewFile)); + + /** + * 使用extract安定ob方法渲染$viewFile里面的代码。 + * Use extract and ob functions to eval the codes in $viewFile. + */ + extract((array)$this->view); + include $viewFile; + /* + extract((array)$this->view); + ob_start(); + if(isset($hookFiles)) foreach($hookFiles as $hookFile) if(file_exists($hookFile)) include $hookFile; + $this->output .= ob_get_contents(); + ob_end_clean(); + */ + + /** + * 渲染完毕后,再切换回之前的路径。 + * At the end, chang the dir to the previous. + */ + chdir($currentPWD); + + echo $this->output; + } + /** * 直接输出data数据,通常用于ajax请求中。 * Send data directly, for ajax requests. diff --git a/framework/control.class.php b/framework/control.class.php index 209cf5fb76..d9d612c023 100644 --- a/framework/control.class.php +++ b/framework/control.class.php @@ -167,19 +167,20 @@ class control extends baseControl * * @param string $moduleName module name * @param string $methodName method name + * @param string $viewDir * @access public * @return string the view file */ - public function setViewFile($moduleName, $methodName) + public function setViewFile($moduleName, $methodName, $viewDir = 'view') { $moduleName = strtolower(trim($moduleName)); $methodName = strtolower(trim($methodName)); $modulePath = $this->app->getModulePath($this->appName, $moduleName); - $viewExtPath = $this->app->getModuleExtPath($this->appName, $moduleName, 'view'); + $viewExtPath = $this->app->getModuleExtPath($this->appName, $moduleName, $viewDir); $viewType = ($this->viewType == 'mhtml' or $this->viewType == 'xhtml') ? 'html' : $this->viewType; - $mainViewFile = $modulePath . 'view' . DS . $this->devicePrefix . $methodName . '.' . $viewType . '.php'; + $mainViewFile = $modulePath . $viewDir . DS . $this->devicePrefix . $methodName . '.' . $viewType . '.php'; /* If the main view file doesn't exist, set the device prefix to empty and reset the main view file. */ if(!file_exists($mainViewFile) and $this->app->clientDevice != 'mobile') diff --git a/module/program/control.php b/module/program/control.php index 7aebc08e59..989c66e343 100644 --- a/module/program/control.php +++ b/module/program/control.php @@ -99,7 +99,8 @@ class program extends control $this->view->progressList = $this->program->getProgressList(); $this->view->hasProject = $hasProject; - $this->display(); + // $this->display(); + $this->render(); } /** diff --git a/zin/block.class.php b/zin/block.class.php new file mode 100644 index 0000000000..340004b6c5 --- /dev/null +++ b/zin/block.class.php @@ -0,0 +1,35 @@ +lang = $lang; + $this->config = $config; + $this->app = $app; + $this->type = $type; + } + + public function __set($attr, $value) + { + $this->children[$attr] = $value; + } + + public function x() + { + foreach($this->children as $key => $child) + { + echo $child->toString(); + } + } +} + +function block($type) +{ + return new block($type); +} diff --git a/zin/page.class.php b/zin/page.class.php new file mode 100644 index 0000000000..0c0fab2485 --- /dev/null +++ b/zin/page.class.php @@ -0,0 +1,107 @@ +layout[$attr] = $value; + } +} + +class page +{ + public $top; + public $left; + public $right; + public $bottom; + + public function __construct($layout) + { + global $app, $config; + $this->app = $app; + $this->view = $app->control->view; + $this->config = $config; + $this->cookie = $app->cookie; + + $this->top = new region(); + $this->left = new region(); + $this->right = new region(); + $this->bottom = new region(); + } + + /** + * 获取某一个视图文件的扩展。 + * Get the extension file of an view. + * + * @param string $viewFile + * @access public + * @return string|bool If extension view file exists, return the path. Else return fasle. + */ + public function getExtViewFile($viewFile) + { + return $this->app->control->getExtViewFile($viewFile); + } + + /** + * 加载指定模块的model文件。 + * Load the model file of one module. + * + * @param string $moduleName 模块名,如果为空,使用当前模块。The module name, if empty, use current module's name. + * @param string $appName The app name, if empty, use current app's name. + * @access public + * @return object|bool 如果没有model文件,返回false,否则返回model对象。If no model file, return false, else return the model object. + */ + public function loadModel($moduleName = '', $appName = '') + { + return $this->app->control->loadModel($moduleName, $appName); + } + + public function x() + { + extract((array)$this->app->control->view); + + ob_start(); + + /* Header. */ + if(isset($hookFiles)) foreach($hookFiles as $hookFile) if(file_exists($hookFile)) include $hookFile; + include $this->app->getModuleRoot() . 'common' . DS . 'view' . DS . 'header.html.php'; + + /* Body. */ + if(!empty($this->top->layout)) + { + echo ''; + } + + echo '
'; + if(!empty($this->left->layout)) + { + echo ''; + } + + if(!empty($this->right->layout)) + { + echo '
'; + foreach($this->right->layout as $key => $block) $block->x(); + echo '
'; + } + echo '
'; + + /* Footer. */ + include $this->app->getModuleRoot() . 'common' . DS . 'view' . DS . 'footer.html.php'; + + $output .= ob_get_contents(); + ob_end_clean(); + + echo $output; + } +} + +function page($layout) +{ + return new page($layout); +} diff --git a/zin/wg.class.php b/zin/wg.class.php new file mode 100644 index 0000000000..7106914903 --- /dev/null +++ b/zin/wg.class.php @@ -0,0 +1,13 @@ +getBasePath() . 'zin' . DS . 'wg' . DS . $wgType . DS . 'v1.php'; + return new $wgType($text); +} + +function button($text = '', $v = 0) {return wgFactory('button', $text);} +function select($text = '', $v = 0) {return wgFactory('select', $text);} +function tab($text = '', $v = 0) {return wgFactory('tab', $text);} +function toolbar($text = '', $v = 0) {return wgFactory('toolbar', $text);} diff --git a/zin/wg/button/v1.php b/zin/wg/button/v1.php new file mode 100644 index 0000000000..fcc12c3840 --- /dev/null +++ b/zin/wg/button/v1.php @@ -0,0 +1,12 @@ + + } +} diff --git a/zin/wg/tab/v1.php b/zin/wg/tab/v1.php new file mode 100644 index 0000000000..595621e844 --- /dev/null +++ b/zin/wg/tab/v1.php @@ -0,0 +1,30 @@ +text = $text; + } + + public function active($isActive) + { + $this->isActive = $isActive; + return $this; + } + + public function link($link) + { + $this->link = $link; + return $this; + } + + public function toString() + { + $active = $this->isActive ? 'btn-active-text' : ''; + return html::a($link, $this->text, '', "class='btn btn-link $active'"); + } +} diff --git a/zin/wg/toolbar/v1.php b/zin/wg/toolbar/v1.php new file mode 100644 index 0000000000..c30a6bd1f5 --- /dev/null +++ b/zin/wg/toolbar/v1.php @@ -0,0 +1,24 @@ +children[] = $item; + } + + public function toString() + { + $html = '
'; + foreach($this->children as $child) + { + $html .= $child->toString(); + } + return $html . '
'; + } +} From 05b038218067c60319ed8ac9fd07f07b9c05fa00 Mon Sep 17 00:00:00 2001 From: zhujinyong Date: Wed, 19 Oct 2022 13:05:00 +0800 Subject: [PATCH 002/523] * Add ui for program. --- module/program/ui/browse.html.php | 18 ++++++++++++++++++ zin/wg/tab/v1.php | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 module/program/ui/browse.html.php diff --git a/module/program/ui/browse.html.php b/module/program/ui/browse.html.php new file mode 100644 index 0000000000..b255b96162 --- /dev/null +++ b/module/program/ui/browse.html.php @@ -0,0 +1,18 @@ +lang->program->featureBar['browse'] as $key => $label) +{ + $tab = tab($label)->link(inlink('browse', "status=$key&orderBy=$orderBy"))->active($key == $status); + $toolbar->append($tab); +} + +$menu = block('h'); +$menu->toolbar = $toolbar; +//$menu->actionbar = '
actionbar
'; + +$page = page('list'); +$page->top->menu = $menu; + +$page->x(); diff --git a/zin/wg/tab/v1.php b/zin/wg/tab/v1.php index 595621e844..2df770a6ef 100644 --- a/zin/wg/tab/v1.php +++ b/zin/wg/tab/v1.php @@ -25,6 +25,6 @@ class tab public function toString() { $active = $this->isActive ? 'btn-active-text' : ''; - return html::a($link, $this->text, '', "class='btn btn-link $active'"); + return html::a($this->link, $this->text, '', "class='btn btn-link $active'"); } } From fe4a7cf221771a8ddf561479c5fc6450d6991209 Mon Sep 17 00:00:00 2001 From: Lufei Date: Wed, 19 Oct 2022 15:18:45 +0800 Subject: [PATCH 003/523] + Add actionbar. --- module/program/ui/browse.html.php | 19 +++++++++++++++- zin/wg.func.php | 1 + zin/wg/actionbar/v1.php | 29 +++++++++++++++++++++++ zin/wg/button/v1.php | 38 +++++++++++++++++++++++++++---- zin/wg/toolbar/v1.php | 5 ++++ 5 files changed, 87 insertions(+), 5 deletions(-) create mode 100644 zin/wg/actionbar/v1.php diff --git a/module/program/ui/browse.html.php b/module/program/ui/browse.html.php index b255b96162..dd1bfcedfe 100644 --- a/module/program/ui/browse.html.php +++ b/module/program/ui/browse.html.php @@ -8,9 +8,26 @@ foreach($this->lang->program->featureBar['browse'] as $key => $label) $toolbar->append($tab); } +if(common::hasPriv('project', 'batchEdit') and $programType != 'bygrid' and $hasProject === true) +{ + $toolbar->append(html::checkbox('editProject', array('1' => $lang->project->edit), '', $this->cookie->editProject ? 'checked=checked' : '')); +} +$toolbar->append(' ' . $lang->user->search . ''); + +$actionbar = actionbar(); +if(common::hasPriv('project', 'create')) +{ + $button = button(' ' . $this->lang->project->create)->link($this->createLink('project', 'createGuide', "programID=0&from=PGM"))->misc('class="btn btn-secondary" data-toggle="modal" data-target="#guideDialog"'); + $actionbar->append($button); +} +if(isset($lang->pageActions)) +{ + $actionbar->append($lang->pageActions); +} + $menu = block('h'); $menu->toolbar = $toolbar; -//$menu->actionbar = '
actionbar
'; +$menu->actionbar = $actionbar; $page = page('list'); $page->top->menu = $menu; diff --git a/zin/wg.func.php b/zin/wg.func.php index dc56a04aba..3e32663218 100644 --- a/zin/wg.func.php +++ b/zin/wg.func.php @@ -10,3 +10,4 @@ function button($text = '', $v = 0) {return wgFactory('button', $text);} function select($text = '', $v = 0) {return wgFactory('select', $text);} function tab($text = '', $v = 0) {return wgFactory('tab', $text);} function toolbar($text = '', $v = 0) {return wgFactory('toolbar', $text);} +function actionbar($text = '', $v = 0) {return wgFactory('actionbar', $text);} diff --git a/zin/wg/actionbar/v1.php b/zin/wg/actionbar/v1.php new file mode 100644 index 0000000000..886d7e0c16 --- /dev/null +++ b/zin/wg/actionbar/v1.php @@ -0,0 +1,29 @@ +children[] = $item; + } + + public function toString() + { + $html = '
'; + foreach($this->children as $child) + { + if(is_string($child)) + { + $html .= $child; + continue; + } + $html .= $child->toString(); + } + return $html . '
'; + } +} diff --git a/zin/wg/button/v1.php b/zin/wg/button/v1.php index fcc12c3840..c967280eb4 100644 --- a/zin/wg/button/v1.php +++ b/zin/wg/button/v1.php @@ -1,12 +1,42 @@ text = $text; } - public function label() + public function link($link) { - $this-> + $this->link = $link; + return $this; + } + + public function target($target = '') + { + $this->target = $target; + return $this; + } + + public function misc($misc) + { + $this->misc = $misc; + return $this; + } + + public function newline($newline = true) + { + $this->newline = $newline; + return $this; + } + + public function toString() + { + return html::a($this->link, $this->text, $this->target, $this->misc, $this->newline); } } diff --git a/zin/wg/toolbar/v1.php b/zin/wg/toolbar/v1.php index c30a6bd1f5..68a449e7b4 100644 --- a/zin/wg/toolbar/v1.php +++ b/zin/wg/toolbar/v1.php @@ -17,6 +17,11 @@ class toolbar $html = '
'; foreach($this->children as $child) { + if(is_string($child)) + { + $html .= $child; + continue; + } $html .= $child->toString(); } return $html . '
'; From c53f1463ec43f2f13070c0648df4000f007f2d69 Mon Sep 17 00:00:00 2001 From: zhujinyong Date: Thu, 20 Oct 2022 13:17:53 +0800 Subject: [PATCH 004/523] + Add dtable. --- module/program/ui/browse.html.php | 55 ++++++++++++++++++++++++++++- zin/block.class.php | 2 +- zin/wg.func.php | 1 + zin/wg/dtable/v1.php | 58 +++++++++++++++++++++++++++++++ 4 files changed, 114 insertions(+), 2 deletions(-) create mode 100644 zin/wg/dtable/v1.php diff --git a/module/program/ui/browse.html.php b/module/program/ui/browse.html.php index dd1bfcedfe..6e5e93ebc5 100644 --- a/module/program/ui/browse.html.php +++ b/module/program/ui/browse.html.php @@ -1,6 +1,7 @@ lang->program->featureBar['browse'] as $key => $label) { @@ -29,7 +30,59 @@ $menu = block('h'); $menu->toolbar = $toolbar; $menu->actionbar = $actionbar; +/* Table. */ +$table = dtable(); +$table->col('name', $this->lang->nameAB)->flex(1); +$table->col('status', $this->lang->program->status)->width(60)->type('html'); +$table->col('pm', $this->lang->program->PM)->width(100)->type('html'); +$table->col('budget', $this->lang->project->budget)->width(60); +$table->col('begin', $this->lang->project->begin)->width(60); +$table->col('end', $this->lang->project->end)->width(60); +$table->col('progress', $this->lang->project->progress)->width(100)->type('html'); +$table->col('actions', $this->lang->actions)->width(60); + +$rows = array(); +$this->loadModel('project'); +foreach($programs as $program) +{ + $row = new stdclass(); + $row->name = $program->name; + $row->status = '' . zget($lang->project->statusList, $program->status, '') . ''; + $row->parent = $program->parent; + + $row->pm = ''; + if(!empty($program->PM)) + { + $userName = zget($users, $program->PM); + $row->pm .= html::smallAvatar(array('avatar' => $usersAvatar[$program->PM], 'account' => $program->PM, 'name' => $userName), (($program->type == 'program' and $program->grade == 1 )? 'avatar-circle avatar-top avatar-' : 'avatar-circle avatar-') . zget($userIdPairs, $program->PM)); + $userID = isset($PMList[$program->PM]) ? $PMList[$program->PM]->id : ''; + $row->pm .= html::a($this->createLink('user', 'profile', "userID=$userID", '', true), $userName, '', "title='{$userName}' data-toggle='modal' data-type='iframe' data-width='600'"); + } + + $programBudget = $this->project->getBudgetWithUnit($program->budget); + $row->budget = $program->budget != 0 ? zget($lang->project->currencySymbol, $program->budgetUnit) . ' ' . $programBudget : $this->lang->project->future; + $row->begin = $program->begin; + $row->end = $program->end == LONG_TIME ? $lang->program->longTime : $program->end; + + $row->progress = ''; + if(isset($progressList[$program->id])) + { + $row->progress = "
"; + $row->progress = "
" . round($progressList[$program->id]) . "
"; + } + + $row->actions = array(); + + $rows[] = $row; +} +$table->data($rows); + +$content = block(); +$content->table = $table; + +/* Layout. */ $page = page('list'); -$page->top->menu = $menu; +$page->top->menu = $menu; +$page->right->content = $content; $page->x(); diff --git a/zin/block.class.php b/zin/block.class.php index 340004b6c5..5db0c3eae0 100644 --- a/zin/block.class.php +++ b/zin/block.class.php @@ -29,7 +29,7 @@ class block } } -function block($type) +function block($type = 'v') { return new block($type); } diff --git a/zin/wg.func.php b/zin/wg.func.php index 3e32663218..755ca367e3 100644 --- a/zin/wg.func.php +++ b/zin/wg.func.php @@ -11,3 +11,4 @@ function select($text = '', $v = 0) {return wgFactory('select', $text);} function tab($text = '', $v = 0) {return wgFactory('tab', $text);} function toolbar($text = '', $v = 0) {return wgFactory('toolbar', $text);} function actionbar($text = '', $v = 0) {return wgFactory('actionbar', $text);} +function dtable($text = '', $v = 0) {return wgFactory('dtable', $text);} diff --git a/zin/wg/dtable/v1.php b/zin/wg/dtable/v1.php new file mode 100644 index 0000000000..53f60bf342 --- /dev/null +++ b/zin/wg/dtable/v1.php @@ -0,0 +1,58 @@ +name = $name; + $this->title = $title; + } + + public function width($width) + { + $this->width = $width; + return $this; + } + + public function type($type) + { + $this->type = $type; + return $this; + } + + public function flex($width) + { + $this->flex = $width; + return $this; + } + +} + +class dtable +{ + public $cols = array(); + + public function __construct($text = '') + { + $this->text = $text; + } + + public function col($name, $title) + { + $col = new column($name, $title); + $this->cols[] = $col; + return $col; + } + + public function data($data) + { + $this->data = $data; + } + + public function toString() + { + $html = '
'; + $html .= ''; + + return $html; + } +} From 3b4ff285e34e7d9ad37c10d544ed0df0923b0032 Mon Sep 17 00:00:00 2001 From: Lufei Date: Thu, 20 Oct 2022 13:58:18 +0800 Subject: [PATCH 005/523] * Support serach. --- module/program/ui/browse.html.php | 1 + zin/wg/dtable/v1.php | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/module/program/ui/browse.html.php b/module/program/ui/browse.html.php index 6e5e93ebc5..16f49df1b4 100644 --- a/module/program/ui/browse.html.php +++ b/module/program/ui/browse.html.php @@ -75,6 +75,7 @@ foreach($programs as $program) $rows[] = $row; } +$table->search($status, $moduleName); $table->data($rows); $content = block(); diff --git a/zin/wg/dtable/v1.php b/zin/wg/dtable/v1.php index 53f60bf342..26b95af326 100644 --- a/zin/wg/dtable/v1.php +++ b/zin/wg/dtable/v1.php @@ -31,6 +31,8 @@ class dtable { public $cols = array(); + public $search = ''; + public function __construct($text = '') { $this->text = $text; @@ -48,9 +50,17 @@ class dtable $this->data = $data; } + public function search($status, $module) + { + $this->search = '
'; + return $this; + } + public function toString() { - $html = '
'; + $html = ''; + if(!empty($this->search)) $html .= $this->search; + $html .= '
'; $html .= ''; return $html; From b4c7fcd75e8827328805777962c9f60d3284ed05 Mon Sep 17 00:00:00 2001 From: zhujinyong Date: Mon, 24 Oct 2022 08:58:23 +0800 Subject: [PATCH 006/523] + Add ZUI3 flag. --- framework/base/control.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/framework/base/control.class.php b/framework/base/control.class.php index c83a61d294..fb76806e3b 100644 --- a/framework/base/control.class.php +++ b/framework/base/control.class.php @@ -912,6 +912,8 @@ class baseControl include $this->app->getBasePath() . 'zin' . DS . 'block.class.php'; include $this->app->getBasePath() . 'zin' . DS . 'page.class.php'; + define('ZUI3', 'zui3'); + /** * 设置视图文件。(PHP7有一个bug,不能直接$viewFile = $this->setViewFile())。 * Set viewFile. (Can't assign $viewFile = $this->setViewFile() directly because one php7's bug.) From 058e4ecf73ed047347f5eed81863bcfabb2a2ed6 Mon Sep 17 00:00:00 2001 From: tianshujie Date: Mon, 24 Oct 2022 16:00:11 +0800 Subject: [PATCH 007/523] * Finish task #73291. --- module/common/view/header.lite.html.php | 18 ++++-- module/program/config.php | 42 ++++++++++++++ module/program/lang/de.php | 1 + module/program/lang/en.php | 1 + module/program/lang/fr.php | 1 + module/program/lang/zh-cn.php | 1 + module/program/model.php | 73 +++++++++++++++++++++++++ module/program/ui/browse.html.php | 52 ++++++------------ 8 files changed, 149 insertions(+), 40 deletions(-) mode change 100755 => 100644 module/common/view/header.lite.html.php diff --git a/module/common/view/header.lite.html.php b/module/common/view/header.lite.html.php old mode 100755 new mode 100644 index d6aa8a5340..12989f6419 --- a/module/common/view/header.lite.html.php +++ b/module/common/view/header.lite.html.php @@ -1,4 +1,4 @@ -getExtViewFile(__FILE__)){include $extView; return helper::cd();} $clientLang = $app->getClientLang(); $webRoot = $this->app->getWebRoot(); @@ -25,16 +25,24 @@ $commonLang = array('zh-cn', 'zh-tw', 'en', 'fr', 'de'); $timestamp = time(); css::import($themeRoot . 'zui/css/min.css?t=' . $timestamp); - css::import($defaultTheme . 'style.css?t=' . $timestamp); + if(defined('ZUI3')) + { + css::import('https://ztui.sh.oop.cc/assets/style.4d294030.css'); + css::import('https://ztui.sh.oop.cc/zui/zui.css'); + } + css::import($defaultTheme . 'style.css?t=' . $timestamp); css::import($langTheme); + if(strpos($clientTheme, 'default') === false) css::import($clientTheme . 'style.css?t=' . $timestamp); js::import($jsRoot . 'jquery/lib.js'); js::import($jsRoot . 'zui/min.js?t=' . $timestamp); + + if(defined('ZUI3')) js::import('https://ztui.sh.oop.cc/zui/zui.umd.cjs'); + if(!in_array($clientLang, $commonLang)) js::import($jsRoot . 'zui/lang.' . $clientLang . '.min.js?t=' . $timestamp); js::import($jsRoot . 'my.full.js?t=' . $timestamp); - } else { @@ -81,10 +89,10 @@ $xuanExtFile = $extensionRoot . 'xuan/common/ext/view/header.xuanxuan.html.hook. if(file_exists($xuanExtFile)) include $xuanExtFile; ?> -app->getViewType() == 'xhtml' ? 'allow-self-open' : ''; if(isset($pageBodyClass)) $bodyClass = $bodyClass . ' ' . $pageBodyClass; -if($this->moduleName == 'index' && $this->methodName == 'index') $bodyClass .= ' menu-' . ($this->cookie->hideMenu ? 'hide' : 'show'); +if($this->app->moduleName == 'index' && $this->app->methodName == 'index') $bodyClass .= ' menu-' . ($this->cookie->hideMenu ? 'hide' : 'show'); if(strpos($_SERVER['HTTP_USER_AGENT'], 'xuanxuan') !== false) $bodyClass .= ' xxc-embed'; ?> diff --git a/module/program/config.php b/module/program/config.php index 15afcb8278..82617bc9a5 100644 --- a/module/program/config.php +++ b/module/program/config.php @@ -50,3 +50,45 @@ $config->program->search['params']['lastEditedDate'] = array('operator' => '=', $config->program->search['params']['realBegan'] = array('operator' => '=', 'control' => 'input', 'values' => '', 'class' => 'date'); $config->program->search['params']['realEnd'] = array('operator' => '=', 'control' => 'input', 'values' => '', 'class' => 'date'); $config->program->search['params']['closedDate'] = array('operator' => '=', 'control' => 'input', 'values' => '', 'class' => 'date'); + +/* Data table field config. */ +global $lang; +$config->program->dtable = new stdclass(); + +$config->program->dtable->fieldList['name']['name'] = 'name'; +$config->program->dtable->fieldList['name']['title'] = $lang->nameAB; +$config->program->dtable->fieldList['name']['type'] = 'html'; +$config->program->dtable->fieldList['name']['flex'] = 1; + +$config->program->dtable->fieldList['status']['name'] = 'status'; +$config->program->dtable->fieldList['status']['title'] = $lang->program->status; +$config->program->dtable->fieldList['status']['width'] = 65; +$config->program->dtable->fieldList['status']['type'] = 'html'; + +$config->program->dtable->fieldList['pm']['name'] = 'pm'; +$config->program->dtable->fieldList['pm']['title'] = $lang->program->PM; +$config->program->dtable->fieldList['pm']['width'] = 100; +$config->program->dtable->fieldList['pm']['type'] = 'html'; + +$config->program->dtable->fieldList['budget']['name'] = 'budget'; +$config->program->dtable->fieldList['budget']['title'] = $lang->program->budget; +$config->program->dtable->fieldList['budget']['width'] = 100; + +$config->program->dtable->fieldList['begin']['name'] = 'begin'; +$config->program->dtable->fieldList['begin']['title'] = $lang->program->begin; +$config->program->dtable->fieldList['begin']['width'] = 100; + +$config->program->dtable->fieldList['end']['name'] = 'end'; +$config->program->dtable->fieldList['end']['title'] = $lang->program->end; +$config->program->dtable->fieldList['end']['width'] = 100; + +$config->program->dtable->fieldList['progress']['name'] = 'progress'; +$config->program->dtable->fieldList['progress']['title'] = $lang->program->progressAB; +$config->program->dtable->fieldList['progress']['width'] = 100; +$config->program->dtable->fieldList['progress']['type'] = 'circleProgress'; + +$config->program->dtable->fieldList['actions']['name'] = 'actions'; +$config->program->dtable->fieldList['actions']['title'] = $lang->actions; +$config->program->dtable->fieldList['actions']['width'] = 160; +$config->program->dtable->fieldList['actions']['type'] = 'html'; +$config->program->dtable->fieldList['actions']['fixed'] = 'right'; diff --git a/module/program/lang/de.php b/module/program/lang/de.php index eee8d70de7..cb566bc543 100644 --- a/module/program/lang/de.php +++ b/module/program/lang/de.php @@ -84,6 +84,7 @@ $lang->program->exRateNotNegative = 'The『exchange rate』should not be n $lang->program->changePRJUnit = 'Update the budget unit of the project'; $lang->program->progress = 'Progress'; +$lang->program->progressAB = 'Progress'; $lang->program->children = 'Child'; $lang->program->allInvest = 'Input'; $lang->program->teamCount = 'Team'; diff --git a/module/program/lang/en.php b/module/program/lang/en.php index 62c84da556..4a9576a94a 100644 --- a/module/program/lang/en.php +++ b/module/program/lang/en.php @@ -84,6 +84,7 @@ $lang->program->exRateNotNegative = 'The『exchange rate』should not be n $lang->program->changePRJUnit = 'Update the budget unit of the project'; $lang->program->progress = 'Progress'; +$lang->program->progressAB = 'Progress'; $lang->program->children = 'Add Child'; $lang->program->allInvest = 'Input'; $lang->program->teamCount = 'Team'; diff --git a/module/program/lang/fr.php b/module/program/lang/fr.php index 395d896a50..ecef17d4f9 100644 --- a/module/program/lang/fr.php +++ b/module/program/lang/fr.php @@ -84,6 +84,7 @@ $lang->program->exRateNotNegative = 'The『exchange rate』should not be n $lang->program->changePRJUnit = 'Update the budget unit of the project'; $lang->program->progress = 'Progress'; +$lang->program->progressAB = 'Progress'; $lang->program->children = 'Child'; $lang->program->allInvest = 'Input'; $lang->program->teamCount = 'Team'; diff --git a/module/program/lang/zh-cn.php b/module/program/lang/zh-cn.php index be8d971ddc..0f1c22ae01 100644 --- a/module/program/lang/zh-cn.php +++ b/module/program/lang/zh-cn.php @@ -84,6 +84,7 @@ $lang->program->exRateNotNegative = '『汇率』不能是负数。'; $lang->program->changePRJUnit = '更新项目预算单位'; $lang->program->progress = '项目进度'; +$lang->program->progressAB = '进度'; $lang->program->children = '添加子项目集'; $lang->program->allInvest = '项目集总投入'; $lang->program->teamCount = '总人数'; diff --git a/module/program/model.php b/module/program/model.php index 6f75035472..f4ad85f3e3 100644 --- a/module/program/model.php +++ b/module/program/model.php @@ -1593,4 +1593,77 @@ class programModel extends model } return $menu; } + + /** + * Build datatable cell. + * + * @param array $field + * @param object $program + * @param array $users + * @param array $userIdPairs + * @param array $PMList + * @param array $progressList + * @access public + * @return string + */ + public function buildCell($field, $program, $users, $usersAvatar, $userIdPairs, $PMList, $progressList) + { + $id = $field['name']; + $html = ''; + switch($id) + { + case 'name': + if($program->type == 'program') $icon = ' icon-program'; + if($program->type == 'project') $icon = ' icon-common icon-' . $program->model; + $class = $program->type == 'program' ? ' table-nest-toggle' : ''; + $html = ""; + + if($program->type == 'program') + { + $html .= ""; + $html .= ($this->app->user->admin or strpos(",{$this->app->user->view->programs},", ",$program->id,") !== false) ? html::a(helper::createLink('program', 'product', "programID=$program->id"), $program->name) : $program->name; + } + else + { + $projectType = $this->lang->project->{$program->model}; + $html .= html::a(helper::createLink('project', 'index', "projectID=$program->id", '', '', $program->id), $program->name, '', "class='text-ellipsis text-primary' title='{$program->name} ($projectType)'"); + + if($program->status != 'done' and $program->status != 'closed' and $program->status != 'suspended') + { + $delay = helper::diffDate(helper::today(), $program->end); + if($delay > 0) $html .= "{$this->lang->project->statusList['delay']}"; + } + } + break; + case 'status': + $html = "" . zget($this->lang->project->statusList, $program->status, '') . ''; + break; + case 'pm': + if(!empty($program->PM)) + { + $userName = zget($users, $program->PM); + $html = html::smallAvatar(array('avatar' => $usersAvatar[$program->PM], 'account' => $program->PM, 'name' => $userName), (($program->type == 'program' and $program->grade == 1 )? 'avatar-circle avatar-top avatar-' : 'avatar-circle avatar-') . zget($userIdPairs, $program->PM)); + $userID = isset($PMList[$program->PM]) ? $PMList[$program->PM]->id : ''; + $html .= html::a(helper::createLink('user', 'profile', "userID=$userID", '', true), $userName, '', "title='{$userName}' data-toggle='modal' data-type='iframe' data-width='600'"); + } + break; + case 'budget': + $programBudget = $this->project->getBudgetWithUnit($program->budget); + $html = $program->budget != 0 ? zget($this->lang->project->currencySymbol, $program->budgetUnit) . ' ' . $programBudget : $this->lang->project->future; + break; + case 'begin': + $html = $program->begin; + break; + case 'end': + $html = $program->end == LONG_TIME ? $this->lang->program->longTime : $program->end; + break; + case 'progress': + $html = round($progressList[$program->id]); + break; + case 'actions': + $html = $this->buildOperateMenu($program, 'browse'); + break; + } + return $html; + } } diff --git a/module/program/ui/browse.html.php b/module/program/ui/browse.html.php index 16f49df1b4..a7bcdd66cf 100644 --- a/module/program/ui/browse.html.php +++ b/module/program/ui/browse.html.php @@ -1,6 +1,5 @@ lang->program->featureBar['browse'] as $key => $label) @@ -21,6 +20,7 @@ if(common::hasPriv('project', 'create')) $button = button(' ' . $this->lang->project->create)->link($this->createLink('project', 'createGuide', "programID=0&from=PGM"))->misc('class="btn btn-secondary" data-toggle="modal" data-target="#guideDialog"'); $actionbar->append($button); } + if(isset($lang->pageActions)) { $actionbar->append($lang->pageActions); @@ -32,49 +32,23 @@ $menu->actionbar = $actionbar; /* Table. */ $table = dtable(); -$table->col('name', $this->lang->nameAB)->flex(1); -$table->col('status', $this->lang->program->status)->width(60)->type('html'); -$table->col('pm', $this->lang->program->PM)->width(100)->type('html'); -$table->col('budget', $this->lang->project->budget)->width(60); -$table->col('begin', $this->lang->project->begin)->width(60); -$table->col('end', $this->lang->project->end)->width(60); -$table->col('progress', $this->lang->project->progress)->width(100)->type('html'); -$table->col('actions', $this->lang->actions)->width(60); +$table->buildCols($this->config->program->dtable->fieldList); $rows = array(); $this->loadModel('project'); foreach($programs as $program) { $row = new stdclass(); - $row->name = $program->name; - $row->status = '' . zget($lang->project->statusList, $program->status, '') . ''; + foreach($this->config->program->dtable->fieldList as $field) + { + $fieldName = $field['name']; + $row->$fieldName = $this->program->buildCell($field, $program, $users, $usersAvatar, $userIdPairs, $PMList, $progressList); + } + $row->parent = $program->parent; - - $row->pm = ''; - if(!empty($program->PM)) - { - $userName = zget($users, $program->PM); - $row->pm .= html::smallAvatar(array('avatar' => $usersAvatar[$program->PM], 'account' => $program->PM, 'name' => $userName), (($program->type == 'program' and $program->grade == 1 )? 'avatar-circle avatar-top avatar-' : 'avatar-circle avatar-') . zget($userIdPairs, $program->PM)); - $userID = isset($PMList[$program->PM]) ? $PMList[$program->PM]->id : ''; - $row->pm .= html::a($this->createLink('user', 'profile', "userID=$userID", '', true), $userName, '', "title='{$userName}' data-toggle='modal' data-type='iframe' data-width='600'"); - } - - $programBudget = $this->project->getBudgetWithUnit($program->budget); - $row->budget = $program->budget != 0 ? zget($lang->project->currencySymbol, $program->budgetUnit) . ' ' . $programBudget : $this->lang->project->future; - $row->begin = $program->begin; - $row->end = $program->end == LONG_TIME ? $lang->program->longTime : $program->end; - - $row->progress = ''; - if(isset($progressList[$program->id])) - { - $row->progress = "
"; - $row->progress = "
" . round($progressList[$program->id]) . "
"; - } - - $row->actions = array(); - $rows[] = $row; } + $table->search($status, $moduleName); $table->data($rows); @@ -87,3 +61,11 @@ $page->top->menu = $menu; $page->right->content = $content; $page->x(); + +js::set('status', $status); +js::set('orderBy', $orderBy); +js::set('edit', $lang->edit); +js::set('selectAll', $lang->selectAll); +js::set('hasProject', $hasProject); +js::set('checkedProjects', $lang->program->checkedProjects); +js::set('cilentLang', $this->app->getClientLang()); From 12420621d8f96aecb87648e06d16a42983b140f2 Mon Sep 17 00:00:00 2001 From: tianshujie Date: Mon, 24 Oct 2022 16:00:54 +0800 Subject: [PATCH 008/523] * Modify the encapsulation of the data table. --- zin/wg/dtable/v1.php | 39 ++++++++++++++++++++++++++++++++++++++- zin/wg/tab/v1.php | 3 ++- 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/zin/wg/dtable/v1.php b/zin/wg/dtable/v1.php index 26b95af326..fc12082c77 100644 --- a/zin/wg/dtable/v1.php +++ b/zin/wg/dtable/v1.php @@ -13,6 +13,13 @@ class column return $this; } + /** + * Set the column output type. + * + * @param string $type link|avatar|circleProgress|html + * @access public + * @return object + */ public function type($type) { $this->type = $type; @@ -25,6 +32,12 @@ class column return $this; } + public function fixed($position) + { + $this->fixed = $position; + return $this; + } + } class dtable @@ -33,9 +46,14 @@ class dtable public $search = ''; + public $config; + public function __construct($text = '') { - $this->text = $text; + global $config; + + $this->config = $config; + $this->text = $text; } public function col($name, $title) @@ -45,6 +63,25 @@ class dtable return $col; } + /** + * Build columns of table. + * + * @param array $fieldList + * @access public + * @return void + */ + public function buildCols($fieldList) + { + foreach($fieldList as $field) + { + $col = $this->col($field['name'], $field['title']); + foreach($field as $attr => $value) + { + if(in_array($attr, $this->config->dtable->colVars)) $col->$attr($value); + } + } + } + public function data($data) { $this->data = $data; diff --git a/zin/wg/tab/v1.php b/zin/wg/tab/v1.php index 2df770a6ef..4bbbb9a77d 100644 --- a/zin/wg/tab/v1.php +++ b/zin/wg/tab/v1.php @@ -25,6 +25,7 @@ class tab public function toString() { $active = $this->isActive ? 'btn-active-text' : ''; - return html::a($this->link, $this->text, '', "class='btn btn-link $active'"); + $label = "{$this->text}"; + return html::a($this->link, $label, '', "class='btn btn-link $active'"); } } From 66552bba1bec8cc8565e009907f5a4ccce4698c7 Mon Sep 17 00:00:00 2001 From: tianshujie Date: Tue, 25 Oct 2022 13:45:42 +0800 Subject: [PATCH 009/523] * Finish task #73291. --- config/zentaopms.php | 5 ++- module/program/js/browse.js | 22 +++++++------ module/program/ui/browse.html.php | 4 +++ zin/wg/dtable/v1.php | 55 +++++++++++++++++++++++++++++++ 4 files changed, 75 insertions(+), 11 deletions(-) diff --git a/config/zentaopms.php b/config/zentaopms.php index 5e57c970f7..2af32b18bf 100644 --- a/config/zentaopms.php +++ b/config/zentaopms.php @@ -402,4 +402,7 @@ $config->waterfallModules = array('workestimation', 'durationestimation', 'budge $config->showMainMenu = true; $config->maxPriValue = '256'; -$config->importWhiteList = array('user', 'task', 'story', 'bug', 'testcase', 'feedback'); \ No newline at end of file +$config->importWhiteList = array('user', 'task', 'story', 'bug', 'testcase', 'feedback'); + +$config->dtable = new stdclass(); +$config->dtable->colVars = array('width', 'type', 'flex', 'fixed'); diff --git a/module/program/js/browse.js b/module/program/js/browse.js index 1bf95edd1f..1e159d9da6 100644 --- a/module/program/js/browse.js +++ b/module/program/js/browse.js @@ -79,24 +79,26 @@ function showEditCheckbox(show) { $('.icon-project,.icon-waterfall,.icon-scrum,.icon-kanban').each(function() { - $this = $(this); - $tr = $(this).closest('tr'); - projectID = $tr.attr('data-id'); + var $this = $(this); + var $tr = $(this).closest('dtable-row'); + var projectID = $tr.attr('data-id'); + var $firstDiv = $tr.find('.dtable-flexable div:first'); if(show) { - var marginLeft = $tr.find('td:first').find('span.table-nest-icon').css('margin-left'); + var marginLeft = $firstDiv.find('span.table-nest-icon').css('margin-left'); - $tr.find('td:first').prepend("
"); - $tr.find('td:first').find('.checkbox-primary').css('margin-left', marginLeft).css('width', '14'); - $tr.find('td:first').find('span.table-nest-icon').css('margin-left', '0'); + $firstDiv.prepend("
"); + $firstDiv.find('.checkbox-primary').css('margin-left', marginLeft).css('width', '14'); + $firstDiv.find('span.table-nest-icon').css('margin-left', '0'); } else { - var marginLeft = $tr.find('td:first').find('.checkbox-primary').css('margin-left'); - $tr.find('td:first').find('span.table-nest-icon').css('margin-left', marginLeft); - $tr.find('td:first').find('[name^="projectIdList"]').parent().remove(); + var marginLeft = $firstDiv.find('.checkbox-primary').css('margin-left'); + $firstDiv.find('span.table-nest-icon').css('margin-left', marginLeft); + $firstDiv.find('[name^="projectIdList"]').parent().remove(); } }); + if(show && hasProject) { var tableFooter = "
"; diff --git a/module/program/ui/browse.html.php b/module/program/ui/browse.html.php index a7bcdd66cf..c269cfde6c 100644 --- a/module/program/ui/browse.html.php +++ b/module/program/ui/browse.html.php @@ -50,6 +50,7 @@ foreach($programs as $program) } $table->search($status, $moduleName); +$table->form('programForm', 'main-table', "data-preserve-nested='true'"); $table->data($rows); $content = block(); @@ -60,6 +61,9 @@ $page = page('list'); $page->top->menu = $menu; $page->right->content = $content; +$hide = $status == 'bySearch' ? 'hide' : ''; +$table->footer($status != 'bySearch' ? $pager : '', $hide, $summary, 'programSummary'); + $page->x(); js::set('status', $status); diff --git a/zin/wg/dtable/v1.php b/zin/wg/dtable/v1.php index fc12082c77..c9a9bd215e 100644 --- a/zin/wg/dtable/v1.php +++ b/zin/wg/dtable/v1.php @@ -46,6 +46,10 @@ class dtable public $search = ''; + public $footer = ''; + + public $form = ''; + public $config; public function __construct($text = '') @@ -93,11 +97,62 @@ class dtable return $this; } + /** + * Set the table footer. + * + * @param object $pager + * @param string $class + * @param string $summary + * @param string $summaryID + * @access public + * @return void + */ + public function footer($pager = null, $class = '', $summary = '', $summaryID = '') + { + $footerHtml = "'; + + $this->footer = $footerHtml; + } + + /** + * Set form. + * + * @param string $formID + * @param string $class + * @param string $attr + * @access public + * @return void + */ + public function form($formID = '', $class = '', $attr = '') + { + $this->form = "
"; + } + + /** + * Print datatable. + * + * @access public + * @return string + */ public function toString() { $html = ''; if(!empty($this->search)) $html .= $this->search; + if(!empty($this->form)) $html .= $this->form; + $html .= '
'; + + if(!empty($this->footer)) $html .= $this->footer; + if(!empty($this->form)) $html .= '
'; + $html .= ''; return $html; From ed3340e442b882e53fe9776b9f05afc5388fe1d7 Mon Sep 17 00:00:00 2001 From: Lufei Date: Tue, 25 Oct 2022 14:34:24 +0800 Subject: [PATCH 010/523] * Support htmx. --- framework/base/control.class.php | 1 + module/common/view/header.lite.html.php | 6 +- zin/wg.class.php | 74 +++++++++++++++++++++++-- zin/wg/actionbar/v1.php | 2 +- zin/wg/button/v1.php | 2 +- zin/wg/dtable/v1.php | 2 +- zin/wg/tab/v1.php | 2 +- zin/wg/toolbar/v1.php | 2 +- 8 files changed, 80 insertions(+), 11 deletions(-) diff --git a/framework/base/control.class.php b/framework/base/control.class.php index fb76806e3b..ecd12c3a64 100644 --- a/framework/base/control.class.php +++ b/framework/base/control.class.php @@ -908,6 +908,7 @@ class baseControl if(empty($moduleName)) $moduleName = $this->moduleName; if(empty($methodName)) $methodName = $this->methodName; + include $this->app->getBasePath() . 'zin' . DS . 'wg.class.php'; include $this->app->getBasePath() . 'zin' . DS . 'wg.func.php'; include $this->app->getBasePath() . 'zin' . DS . 'block.class.php'; include $this->app->getBasePath() . 'zin' . DS . 'page.class.php'; diff --git a/module/common/view/header.lite.html.php b/module/common/view/header.lite.html.php index 12989f6419..6300251a86 100644 --- a/module/common/view/header.lite.html.php +++ b/module/common/view/header.lite.html.php @@ -39,7 +39,11 @@ $commonLang = array('zh-cn', 'zh-tw', 'en', 'fr', 'de'); js::import($jsRoot . 'jquery/lib.js'); js::import($jsRoot . 'zui/min.js?t=' . $timestamp); - if(defined('ZUI3')) js::import('https://ztui.sh.oop.cc/zui/zui.umd.cjs'); + if(defined('ZUI3')) + { + js::import('https://ztui.sh.oop.cc/zui/zui.umd.cjs'); + js::import('https://unpkg.com/htmx.org@1.8.2'); + } if(!in_array($clientLang, $commonLang)) js::import($jsRoot . 'zui/lang.' . $clientLang . '.min.js?t=' . $timestamp); js::import($jsRoot . 'my.full.js?t=' . $timestamp); diff --git a/zin/wg.class.php b/zin/wg.class.php index 7106914903..a757e01e08 100644 --- a/zin/wg.class.php +++ b/zin/wg.class.php @@ -1,13 +1,77 @@ method = __FUNCTION__; + $this->url = $url; + $this->trigger = $trigger; + $this->target = $target; + return $this; } + + public function post($url, $trigger = '', $target = '') + { + $this->method = __FUNCTION__; + $this->url = $url; + $this->trigger = $trigger; + $this->target = $target; + + return $this; + } + + public function trigger($trigger) + { + $this->trigger = $trigger; + return $this; + } + + public function target($target) + { + $this->target = $target; + return $this; + } + + public function swap($swap) + { + $this->swap = $swap; + return $this; + } + + public function include($include) + { + $this->include = $include; + return $this; + } + + public function params($params = '*') + { + $this->params = $params; + return $this; + } + + public function toHx() + { + $html = ''; + $prefix = 'hx-'; + + $properties = array_keys(get_class_vars(__CLASS__)); + + foreach($properties as $property) + { + if(empty($this->$property)) continue; + $html .= "{$prefix}{$property}='{$this->$property}' "; + } + + return $html; + } } diff --git a/zin/wg/actionbar/v1.php b/zin/wg/actionbar/v1.php index 886d7e0c16..97d28ec43c 100644 --- a/zin/wg/actionbar/v1.php +++ b/zin/wg/actionbar/v1.php @@ -1,5 +1,5 @@ Date: Tue, 25 Oct 2022 14:55:31 +0800 Subject: [PATCH 011/523] * Finish task #73291. --- config/zentaopms.php | 2 +- module/program/config.php | 39 +++++++++++++++++-------------- module/program/js/browse.js | 31 ++++++++++++++---------- module/program/ui/browse.html.php | 1 + zin/wg/dtable/v1.php | 20 +++++++++++++++- 5 files changed, 62 insertions(+), 31 deletions(-) diff --git a/config/zentaopms.php b/config/zentaopms.php index 6f0ba59987..34ee5b8713 100644 --- a/config/zentaopms.php +++ b/config/zentaopms.php @@ -407,4 +407,4 @@ $config->maxPriValue = '256'; $config->importWhiteList = array('user', 'task', 'story', 'bug', 'testcase', 'feedback', 'ticket'); $config->dtable = new stdclass(); -$config->dtable->colVars = array('width', 'type', 'flex', 'fixed'); +$config->dtable->colVars = array('width', 'type', 'flex', 'fixed', 'sortType', 'checkbox'); diff --git a/module/program/config.php b/module/program/config.php index 82617bc9a5..a1fc04c086 100644 --- a/module/program/config.php +++ b/module/program/config.php @@ -60,27 +60,32 @@ $config->program->dtable->fieldList['name']['title'] = $lang->nameAB; $config->program->dtable->fieldList['name']['type'] = 'html'; $config->program->dtable->fieldList['name']['flex'] = 1; -$config->program->dtable->fieldList['status']['name'] = 'status'; -$config->program->dtable->fieldList['status']['title'] = $lang->program->status; -$config->program->dtable->fieldList['status']['width'] = 65; -$config->program->dtable->fieldList['status']['type'] = 'html'; +$config->program->dtable->fieldList['status']['name'] = 'status'; +$config->program->dtable->fieldList['status']['title'] = $lang->program->status; +$config->program->dtable->fieldList['status']['width'] = 65; +$config->program->dtable->fieldList['status']['type'] = 'html'; +$config->program->dtable->fieldList['status']['sortType'] = 1; -$config->program->dtable->fieldList['pm']['name'] = 'pm'; -$config->program->dtable->fieldList['pm']['title'] = $lang->program->PM; -$config->program->dtable->fieldList['pm']['width'] = 100; -$config->program->dtable->fieldList['pm']['type'] = 'html'; +$config->program->dtable->fieldList['pm']['name'] = 'pm'; +$config->program->dtable->fieldList['pm']['title'] = $lang->program->PM; +$config->program->dtable->fieldList['pm']['width'] = 100; +$config->program->dtable->fieldList['pm']['type'] = 'html'; +$config->program->dtable->fieldList['pm']['sortType'] = 1; -$config->program->dtable->fieldList['budget']['name'] = 'budget'; -$config->program->dtable->fieldList['budget']['title'] = $lang->program->budget; -$config->program->dtable->fieldList['budget']['width'] = 100; +$config->program->dtable->fieldList['budget']['name'] = 'budget'; +$config->program->dtable->fieldList['budget']['title'] = $lang->program->budget; +$config->program->dtable->fieldList['budget']['width'] = 100; +$config->program->dtable->fieldList['budget']['sortType'] = 1; -$config->program->dtable->fieldList['begin']['name'] = 'begin'; -$config->program->dtable->fieldList['begin']['title'] = $lang->program->begin; -$config->program->dtable->fieldList['begin']['width'] = 100; +$config->program->dtable->fieldList['begin']['name'] = 'begin'; +$config->program->dtable->fieldList['begin']['title'] = $lang->program->begin; +$config->program->dtable->fieldList['begin']['width'] = 100; +$config->program->dtable->fieldList['begin']['sortType'] = 1; -$config->program->dtable->fieldList['end']['name'] = 'end'; -$config->program->dtable->fieldList['end']['title'] = $lang->program->end; -$config->program->dtable->fieldList['end']['width'] = 100; +$config->program->dtable->fieldList['end']['name'] = 'end'; +$config->program->dtable->fieldList['end']['title'] = $lang->program->end; +$config->program->dtable->fieldList['end']['width'] = 100; +$config->program->dtable->fieldList['end']['sortType'] = 1; $config->program->dtable->fieldList['progress']['name'] = 'progress'; $config->program->dtable->fieldList['progress']['title'] = $lang->program->progressAB; diff --git a/module/program/js/browse.js b/module/program/js/browse.js index 1e159d9da6..b8d9613c40 100644 --- a/module/program/js/browse.js +++ b/module/program/js/browse.js @@ -6,8 +6,15 @@ $(function() $.cookie('editProject', editProject, {expires:config.cookieLife, path:config.webRoot}); showEditCheckbox(editProject); }); + if($.cookie('editProject') == 1) $('input#editProject1').prop('checked', 'true'); - if($('input#editProject1').prop('checked')) showEditCheckbox(true); + if($('input#editProject1').prop('checked')) + { + setTimeout(function() + { + showEditCheckbox(true); + }, 100); + } $(document).on('click', ":checkbox[name^='projectIdList']", function() { @@ -79,23 +86,23 @@ function showEditCheckbox(show) { $('.icon-project,.icon-waterfall,.icon-scrum,.icon-kanban').each(function() { - var $this = $(this); - var $tr = $(this).closest('dtable-row'); - var projectID = $tr.attr('data-id'); - var $firstDiv = $tr.find('.dtable-flexable div:first'); + var $this = $(this); + var $row = $(this).closest('.dtable-row'); + var projectID = $row.attr('data-id'); + var $firstCell = $row.find('.dtable-flexable .dtable-cell-content').first().find('.dtable-cell-html'); if(show) { - var marginLeft = $firstDiv.find('span.table-nest-icon').css('margin-left'); + var marginLeft = $firstCell.find('span.table-nest-icon').css('margin-left'); - $firstDiv.prepend("
"); - $firstDiv.find('.checkbox-primary').css('margin-left', marginLeft).css('width', '14'); - $firstDiv.find('span.table-nest-icon').css('margin-left', '0'); + $firstCell.prepend("
"); + $firstCell.find('.checkbox-primary').css('margin-left', marginLeft).css('width', '14'); + $firstCell.find('span.table-nest-icon').css('margin-left', '0'); } else { - var marginLeft = $firstDiv.find('.checkbox-primary').css('margin-left'); - $firstDiv.find('span.table-nest-icon').css('margin-left', marginLeft); - $firstDiv.find('[name^="projectIdList"]').parent().remove(); + var marginLeft = $firstCell.find('.checkbox-primary').css('margin-left'); + $firstCell.find('span.table-nest-icon').css('margin-left', marginLeft); + $firstCell.find('[name^="projectIdList"]').parent().remove(); } }); diff --git a/module/program/ui/browse.html.php b/module/program/ui/browse.html.php index c269cfde6c..6e40494d5a 100644 --- a/module/program/ui/browse.html.php +++ b/module/program/ui/browse.html.php @@ -45,6 +45,7 @@ foreach($programs as $program) $row->$fieldName = $this->program->buildCell($field, $program, $users, $usersAvatar, $userIdPairs, $PMList, $progressList); } + $row->id = $program->id; $row->parent = $program->parent; $rows[] = $row; } diff --git a/zin/wg/dtable/v1.php b/zin/wg/dtable/v1.php index c9a9bd215e..557f0ab253 100644 --- a/zin/wg/dtable/v1.php +++ b/zin/wg/dtable/v1.php @@ -38,6 +38,24 @@ class column return $this; } + /** + * Set sortType. + * + * @param string|bool $type up|down|true|false + * @access public + * @return void + */ + public function sortType($type) + { + $this->sortType = $type; + return $this; + } + + public function checkbox() + { + $this->checkbox = 1; + return $this; + } } class dtable @@ -153,7 +171,7 @@ class dtable if(!empty($this->footer)) $html .= $this->footer; if(!empty($this->form)) $html .= ''; - $html .= ''; + $html .= ''; return $html; } From 33c5ea5773b8952aaa48e6d704134e4265bb9288 Mon Sep 17 00:00:00 2001 From: Lufei Date: Tue, 25 Oct 2022 17:17:05 +0800 Subject: [PATCH 012/523] * Optimize htmx. --- zin/wg.class.php | 57 ++++++++++++++++++++++------------------- zin/wg/actionbar/v1.php | 1 + zin/wg/button/v1.php | 3 ++- zin/wg/dtable/v1.php | 1 + zin/wg/tab/v1.php | 1 + zin/wg/toolbar/v1.php | 1 + 6 files changed, 36 insertions(+), 28 deletions(-) diff --git a/zin/wg.class.php b/zin/wg.class.php index a757e01e08..47ac09a63f 100644 --- a/zin/wg.class.php +++ b/zin/wg.class.php @@ -1,75 +1,78 @@ hxProperties = new stdClass(); + } public function get($url, $trigger = '', $target = '') { - $this->method = __FUNCTION__; - $this->url = $url; - $this->trigger = $trigger; - $this->target = $target; + $this->hxProperties->method = __FUNCTION__ ; + $this->hxProperties->url = $url; + $this->hxProperties->trigger = $trigger; + $this->hxProperties->target = $target; return $this; } public function post($url, $trigger = '', $target = '') { - $this->method = __FUNCTION__; - $this->url = $url; - $this->trigger = $trigger; - $this->target = $target; + $this->hxProperties->method = __FUNCTION__ ; + $this->hxProperties->url = $url; + $this->hxProperties->trigger = $trigger; + $this->hxProperties->target = $target; return $this; } public function trigger($trigger) { - $this->trigger = $trigger; + $this->hxProperties->trigger = $trigger; return $this; } - public function target($target) + public function targetHx($target) { - $this->target = $target; + $this->hxProperties->target = $target; return $this; } public function swap($swap) { - $this->swap = $swap; + $this->hxProperties->swap = $swap; return $this; } public function include($include) { - $this->include = $include; + $this->hxProperties->include = $include; return $this; } public function params($params = '*') { - $this->params = $params; + $this->hxProperties->params = $params; return $this; } public function toHx() { - $html = ''; - $prefix = 'hx-'; + $properties = $this->hxProperties; + $prefix = 'hx-'; - $properties = array_keys(get_class_vars(__CLASS__)); + if(empty($properties->method) || empty($properties->url)) return ''; - foreach($properties as $property) + $html = "{$prefix}{$properties->method}='{$properties->url}'"; + + unset($properties->method, $properties->url); + + foreach($properties as $property => $item) { - if(empty($this->$property)) continue; - $html .= "{$prefix}{$property}='{$this->$property}' "; + if(empty($item)) continue; + $html .= "{$prefix}{$property}='{$item}' "; } return $html; diff --git a/zin/wg/actionbar/v1.php b/zin/wg/actionbar/v1.php index 97d28ec43c..3cfd2f1302 100644 --- a/zin/wg/actionbar/v1.php +++ b/zin/wg/actionbar/v1.php @@ -5,6 +5,7 @@ class actionbar extends wg public function __construct($text = '') { + parent::__construct(); } public function append($item) diff --git a/zin/wg/button/v1.php b/zin/wg/button/v1.php index 0f7fa53f37..596bf0017f 100644 --- a/zin/wg/button/v1.php +++ b/zin/wg/button/v1.php @@ -8,6 +8,7 @@ class button extends wg public function __construct($text) { + parent::__construct(); $this->text = $text; } @@ -37,6 +38,6 @@ class button extends wg public function toString() { - return html::a($this->link, $this->text, $this->target, $this->misc, $this->newline); + return html::a($this->link, $this->text, $this->target, $this->misc . $this->toHx(), $this->newline); } } diff --git a/zin/wg/dtable/v1.php b/zin/wg/dtable/v1.php index 3a163a8eeb..3814b543de 100644 --- a/zin/wg/dtable/v1.php +++ b/zin/wg/dtable/v1.php @@ -3,6 +3,7 @@ class column extends wg { public function __construct($name, $title) { + parent::__construct(); $this->name = $name; $this->title = $title; } diff --git a/zin/wg/tab/v1.php b/zin/wg/tab/v1.php index 2c50cc5957..a42396b943 100644 --- a/zin/wg/tab/v1.php +++ b/zin/wg/tab/v1.php @@ -7,6 +7,7 @@ class tab extends wg public function __construct($text) { + parent::__construct(); $this->text = $text; } diff --git a/zin/wg/toolbar/v1.php b/zin/wg/toolbar/v1.php index 76a8cc02f7..99d023eba7 100644 --- a/zin/wg/toolbar/v1.php +++ b/zin/wg/toolbar/v1.php @@ -5,6 +5,7 @@ class toolbar extends wg public function __construct($text = '') { + parent::__construct(); } public function append($item) From f2d45b25063251b8136235e6da0a8757a803832e Mon Sep 17 00:00:00 2001 From: Lufei Date: Wed, 26 Oct 2022 15:59:19 +0800 Subject: [PATCH 013/523] * Update htmx code. --- zin/wg.class.php | 46 +++++++++++++++++++++++++++++++--------------- 1 file changed, 31 insertions(+), 15 deletions(-) diff --git a/zin/wg.class.php b/zin/wg.class.php index 47ac09a63f..cb8c90004f 100644 --- a/zin/wg.class.php +++ b/zin/wg.class.php @@ -1,6 +1,10 @@ hxProperties = new stdClass(); } - public function get($url, $trigger = '', $target = '') + /** + * Issues a GET request to the given URL. + * + * @param string $url + * @param string $target + * + * @return $this + */ + public function get($url, $target = '') { - $this->hxProperties->method = __FUNCTION__ ; - $this->hxProperties->url = $url; - $this->hxProperties->trigger = $trigger; - $this->hxProperties->target = $target; + $this->hxProperties->method = __FUNCTION__; + $this->hxProperties->url = $url; + $this->hxProperties->target = $target; return $this; } - public function post($url, $trigger = '', $target = '') + /** + * Issues a POST request to the given URL. + * + * @param string $url + * @param string $target + * + * @return $this + */ + public function post($url, $target = '') { - $this->hxProperties->method = __FUNCTION__ ; - $this->hxProperties->url = $url; - $this->hxProperties->trigger = $trigger; - $this->hxProperties->target = $target; + $this->hxProperties->method = __FUNCTION__; + $this->hxProperties->url = $url; + $this->hxProperties->target = $target; return $this; } @@ -31,30 +49,28 @@ class wg public function trigger($trigger) { $this->hxProperties->trigger = $trigger; - return $this; - } - public function targetHx($target) - { - $this->hxProperties->target = $target; return $this; } public function swap($swap) { $this->hxProperties->swap = $swap; + return $this; } public function include($include) { $this->hxProperties->include = $include; + return $this; } public function params($params = '*') { $this->hxProperties->params = $params; + return $this; } From d15ed1e77dd765bce321930c736f7e053e4dc1e2 Mon Sep 17 00:00:00 2001 From: tianshujie Date: Tue, 1 Nov 2022 08:37:15 +0800 Subject: [PATCH 014/523] * Modify the progress field of the program. --- module/program/model.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/program/model.php b/module/program/model.php index f4ad85f3e3..4d2bc7af88 100644 --- a/module/program/model.php +++ b/module/program/model.php @@ -1658,7 +1658,7 @@ class programModel extends model $html = $program->end == LONG_TIME ? $this->lang->program->longTime : $program->end; break; case 'progress': - $html = round($progressList[$program->id]); + $html = isset($progressList[$program->id]) ? round($progressList[$program->id]) : 0; break; case 'actions': $html = $this->buildOperateMenu($program, 'browse'); From 86e76aef335f0c026f1ffb66bf807b2aa0f6a566 Mon Sep 17 00:00:00 2001 From: tianshujie Date: Tue, 1 Nov 2022 12:10:43 +0800 Subject: [PATCH 015/523] * Add comment of zin and program. --- module/program/ui/browse.html.php | 5 ++- zin/wg/actionbar/v1.php | 49 ++++++++++++++++++--- zin/wg/button/v1.php | 71 +++++++++++++++++++++++++++++++ zin/wg/tab/v1.php | 56 ++++++++++++++++++++++++ zin/wg/toolbar/v1.php | 48 ++++++++++++++++++--- 5 files changed, 214 insertions(+), 15 deletions(-) diff --git a/module/program/ui/browse.html.php b/module/program/ui/browse.html.php index 6e40494d5a..ffb7e48ec3 100644 --- a/module/program/ui/browse.html.php +++ b/module/program/ui/browse.html.php @@ -1,6 +1,7 @@ lang->program->featureBar['browse'] as $key => $label) { @@ -12,8 +13,10 @@ if(common::hasPriv('project', 'batchEdit') and $programType != 'bygrid' and $has { $toolbar->append(html::checkbox('editProject', array('1' => $lang->project->edit), '', $this->cookie->editProject ? 'checked=checked' : '')); } + $toolbar->append(' ' . $lang->user->search . ''); +/* Set actionbar. */ $actionbar = actionbar(); if(common::hasPriv('project', 'create')) { diff --git a/zin/wg/actionbar/v1.php b/zin/wg/actionbar/v1.php index 3cfd2f1302..092092c052 100644 --- a/zin/wg/actionbar/v1.php +++ b/zin/wg/actionbar/v1.php @@ -1,29 +1,64 @@ + * @package actionbar + * @version $Id + * @link https://www.zentao.net + */ class actionbar extends wg { - private $children = array(); + /** + * Action list. + * + * @var array + * @access private + */ + private $actions = array(); - public function __construct($text = '') + /** + * Construct function. + * + * @access public + * @return void + */ + public function __construct() { parent::__construct(); } + /** + * Set action data. + * + * @param object $item + * @access public + * @return void + */ public function append($item) { - $this->children[] = $item; + $this->actions[] = $item; } + /** + * Get actionbar html. + * + * @access public + * @return string + */ public function toString() { $html = '
'; - foreach($this->children as $child) + foreach($this->actions as $action) { - if(is_string($child)) + if(is_string($action)) { - $html .= $child; + $html .= $action; continue; } - $html .= $child->toString(); + + $html .= $action->toString(); } return $html . '
'; } diff --git a/zin/wg/button/v1.php b/zin/wg/button/v1.php index 596bf0017f..26925d9f50 100644 --- a/zin/wg/button/v1.php +++ b/zin/wg/button/v1.php @@ -1,35 +1,106 @@ + * @package button + * @version $Id + * @link https://www.zentao.net + */ class button extends wg { + /** + * Button url. + * + * @var string + * @access public + */ public $link = ''; + + /** + * Jump mode. + * + * @var string + * @access public + */ public $target = ''; + + /** + * Miscellaneous. + * + * @var string + * @access public + */ public $misc = ''; + + /** + * Whether to wrap. + * + * @var bool + * @access public + */ public $newline = true; + /** + * Construct function, init tab data. + * + * @param string $text + * @access public + * @return void + */ public function __construct($text) { parent::__construct(); $this->text = $text; } + /** + * Set Button url. + * + * @param string $link + * @access public + * @return object + */ public function link($link) { $this->link = $link; return $this; } + /** + * Set button jump mode. + * + * @param string $target + * @access public + * @return object + */ public function target($target = '') { $this->target = $target; return $this; } + /** + * Set attribute. + * + * @param string $misc + * @access public + * @return object + */ public function misc($misc) { $this->misc = $misc; return $this; } + /** + * Set button newline. + * + * @param bool $newline + * @access public + * @return object + */ public function newline($newline = true) { $this->newline = $newline; diff --git a/zin/wg/tab/v1.php b/zin/wg/tab/v1.php index a42396b943..d9968b77e9 100644 --- a/zin/wg/tab/v1.php +++ b/zin/wg/tab/v1.php @@ -1,28 +1,84 @@ + * @package tab + * @version $Id + * @link https://www.zentao.net + */ class tab extends wg { + /** + * Tab content. + * + * @var string + * @access private + */ private $text; + /** + * Active status. + * + * @var bool + * @access private + */ private $isActive; + /** + * Tab url. + * + * @var string + * @access private + */ + private $link; + + /** + * Construct function, init tab data. + * + * @param string $text + * @access public + * @return void + */ public function __construct($text) { parent::__construct(); $this->text = $text; } + /** + * Set active status. + * + * @param bool $isActive + * @access public + * @return object + */ public function active($isActive) { $this->isActive = $isActive; return $this; } + /** + * Set tab url. + * + * @param string $link + * @access public + * @return object + */ public function link($link) { $this->link = $link; return $this; } + /** + * Get tab html. + * + * @access public + * @return string + */ public function toString() { $active = $this->isActive ? 'btn-active-text' : ''; diff --git a/zin/wg/toolbar/v1.php b/zin/wg/toolbar/v1.php index 99d023eba7..1b06955958 100644 --- a/zin/wg/toolbar/v1.php +++ b/zin/wg/toolbar/v1.php @@ -1,29 +1,63 @@ + * @package toolbar + * @version $Id + * @link https://www.zentao.net + */ class toolbar extends wg { - private $children = array(); + /** + * Tool list. + * + * @var array + * @access private + */ + private $tools = array(); - public function __construct($text = '') + /** + * Construct function. + * + * @access public + * @return void + */ + public function __construct() { parent::__construct(); } + /** + * Set tools data. + * + * @param object $item + * @access public + * @return void + */ public function append($item) { - $this->children[] = $item; + $this->tools[] = $item; } + /** + * Get toolbar html. + * + * @access public + * @return string + */ public function toString() { $html = '
'; - foreach($this->children as $child) + foreach($this->tools as $tool) { - if(is_string($child)) + if(is_string($tool)) { - $html .= $child; + $html .= $tool; continue; } - $html .= $child->toString(); + $html .= $tool->toString(); } return $html . '
'; } From 5127bcec3a162323c40385ecf5c004edcdbdac89 Mon Sep 17 00:00:00 2001 From: tianshujie Date: Wed, 2 Nov 2022 08:42:00 +0800 Subject: [PATCH 016/523] * Add comment of zin. --- module/program/ui/browse.html.php | 5 +- zin/block.class.php | 60 ++++++++++++++-- zin/wg/actionbar/v1.php | 2 +- zin/wg/button/v1.php | 8 ++- zin/wg/dtable/v1.php | 114 ++++++++++++++++++++++++++++-- 5 files changed, 173 insertions(+), 16 deletions(-) diff --git a/module/program/ui/browse.html.php b/module/program/ui/browse.html.php index ffb7e48ec3..c4e875726a 100644 --- a/module/program/ui/browse.html.php +++ b/module/program/ui/browse.html.php @@ -24,9 +24,10 @@ if(common::hasPriv('project', 'create')) $actionbar->append($button); } -if(isset($lang->pageActions)) +if(common::hasPriv('program', 'create')) { - $actionbar->append($lang->pageActions); + $button = html::a($this->createLink('program', 'create'), " " . $this->lang->program->create, '', "class='btn btn-primary create-program-btn'"); + $actionbar->append($button); } $menu = block('h'); diff --git a/zin/block.class.php b/zin/block.class.php index 5db0c3eae0..7db519b2a1 100644 --- a/zin/block.class.php +++ b/zin/block.class.php @@ -1,11 +1,39 @@ + * @package block + * @version $Id + * @link https://www.zentao.net + */ class block { - public $children = array(); + /** + * Menu list. + * + * @var array + * @access public + */ + public $menus = array(); + /** + * Block type. + * + * @var string vertical(v)|horizon(h) + * @access private + */ private $type = 'v'; - public function __contruct($type) + /** + * Construct function, init block data. + * + * @param string $type + * @access public + * @return void + */ + public function __construct($type) { global $app, $config, $lang; @@ -15,20 +43,38 @@ class block $this->type = $type; } + /** + * Set menus. + * + * @param string $attr + * @param object $value + * @access public + * @return void + */ public function __set($attr, $value) { - $this->children[$attr] = $value; + $this->menus[$attr] = $value; } + /** + * Print menu. + * + * @access public + * @return void + */ public function x() { - foreach($this->children as $key => $child) - { - echo $child->toString(); - } + foreach($this->menus as $key => $menu) echo $menu->toString(); } } +/** + * Get block object. + * + * @param string $type vertical(v)|horizon(h) + * @access public + * @return object + */ function block($type = 'v') { return new block($type); diff --git a/zin/wg/actionbar/v1.php b/zin/wg/actionbar/v1.php index 092092c052..cf7061999c 100644 --- a/zin/wg/actionbar/v1.php +++ b/zin/wg/actionbar/v1.php @@ -32,7 +32,7 @@ class actionbar extends wg /** * Set action data. * - * @param object $item + * @param object|string $item * @access public * @return void */ diff --git a/zin/wg/button/v1.php b/zin/wg/button/v1.php index 26925d9f50..2657b76e55 100644 --- a/zin/wg/button/v1.php +++ b/zin/wg/button/v1.php @@ -43,7 +43,7 @@ class button extends wg public $newline = true; /** - * Construct function, init tab data. + * Construct function, init button data. * * @param string $text * @access public @@ -107,6 +107,12 @@ class button extends wg return $this; } + /** + * Get button html. + * + * @access public + * @return string + */ public function toString() { return html::a($this->link, $this->text, $this->target, $this->misc . $this->toHx(), $this->newline); diff --git a/zin/wg/dtable/v1.php b/zin/wg/dtable/v1.php index 3814b543de..505ea66939 100644 --- a/zin/wg/dtable/v1.php +++ b/zin/wg/dtable/v1.php @@ -1,6 +1,23 @@ + * @package dtable + * @version $Id + * @link https://www.zentao.net + */ class column extends wg { + /** + * Construct function, init table data. + * + * @param string $name + * @param string $title + * @access public + * @return void + */ public function __construct($name, $title) { parent::__construct(); @@ -8,6 +25,13 @@ class column extends wg $this->title = $title; } + /** + * Set column width. + * + * @param int $width + * @access public + * @return object + */ public function width($width) { $this->width = $width; @@ -27,12 +51,26 @@ class column extends wg return $this; } - public function flex($width) + /** + * Set flex attribute of column. + * + * @param int $growValue + * @access public + * @return object + */ + public function flex($growValue) { - $this->flex = $width; + $this->flex = (int)$growValue; return $this; } + /** + * Set fixed attribute of column. + * + * @param string $position left|right + * @access public + * @return object + */ public function fixed($position) { $this->fixed = $position; @@ -44,7 +82,7 @@ class column extends wg * * @param string|bool $type up|down|true|false * @access public - * @return void + * @return object */ public function sortType($type) { @@ -52,6 +90,12 @@ class column extends wg return $this; } + /** + * Set checkbox. + * + * @access public + * @return void + */ public function checkbox() { $this->checkbox = 1; @@ -61,16 +105,53 @@ class column extends wg class dtable { + /** + * Columns. + * + * @var array + * @access public + */ public $cols = array(); + /** + * Search. + * + * @var string + * @access public + */ public $search = ''; + /** + * Footer. + * + * @var string + * @access public + */ public $footer = ''; + /** + * Form. + * + * @var string + * @access public + */ public $form = ''; + /** + * System config. + * + * @var object + * @access public + */ public $config; + /** + * Construct function, init dtable data. + * + * @param string $text + * @access public + * @return void + */ public function __construct($text = '') { global $config; @@ -79,6 +160,14 @@ class dtable $this->text = $text; } + /** + * Get column object. + * + * @param string $name + * @param string $title + * @access public + * @return object + */ public function col($name, $title) { $col = new column($name, $title); @@ -105,11 +194,26 @@ class dtable } } + /** + * Set table data. + * + * @param array $data + * @access public + * @return void + */ public function data($data) { $this->data = $data; } + /** + * Set search html. + * + * @param string $status + * @param string $module + * @access public + * @return object + */ public function search($status, $module) { $this->search = '
'; @@ -142,7 +246,7 @@ class dtable } /** - * Set form. + * Set form html. * * @param string $formID * @param string $class @@ -156,7 +260,7 @@ class dtable } /** - * Print datatable. + * Get datatable. * * @access public * @return string From a7fcdacd16f2b1ae1a809bcfce664bd8ca99f442 Mon Sep 17 00:00:00 2001 From: tianshujie Date: Wed, 2 Nov 2022 09:30:20 +0800 Subject: [PATCH 017/523] * Adjust toolbar for zui3. --- zin/block.class.php | 24 ++++++++++++++++++++++++ zin/page.class.php | 2 +- zin/wg/tab/v1.php | 4 ++-- zin/wg/toolbar/v1.php | 4 ++-- 4 files changed, 29 insertions(+), 5 deletions(-) diff --git a/zin/block.class.php b/zin/block.class.php index 7db519b2a1..2ddcf6e0b8 100644 --- a/zin/block.class.php +++ b/zin/block.class.php @@ -26,6 +26,30 @@ class block */ private $type = 'v'; + /** + * Global language. + * + * @var object + * @access private + */ + private $lang; + + /** + * Global config. + * + * @var object + * @access private + */ + private $config; + + /** + * Global app. + * + * @var object + * @access private + */ + private $app; + /** * Construct function, init block data. * diff --git a/zin/page.class.php b/zin/page.class.php index 0c0fab2485..a797a8b28f 100644 --- a/zin/page.class.php +++ b/zin/page.class.php @@ -70,7 +70,7 @@ class page /* Body. */ if(!empty($this->top->layout)) { - echo '