From 66552bba1bec8cc8565e009907f5a4ccce4698c7 Mon Sep 17 00:00:00 2001 From: tianshujie Date: Tue, 25 Oct 2022 13:45:42 +0800 Subject: [PATCH] * 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;