From 53a89ed1b970db21dcec91a5c1367775aff5a158 Mon Sep 17 00:00:00 2001 From: caoyanyi Date: Tue, 18 Jul 2023 14:59:24 +0800 Subject: [PATCH] + Add new page for project dynamic. --- module/project/css/dynamic.ui.css | 9 +++ module/project/js/dynamic.ui.js | 12 ++++ module/project/ui/dynamic.html.php | 107 +++++++++++++++++++++++++++++ 3 files changed, 128 insertions(+) create mode 100644 module/project/css/dynamic.ui.css create mode 100644 module/project/js/dynamic.ui.js create mode 100644 module/project/ui/dynamic.html.php diff --git a/module/project/css/dynamic.ui.css b/module/project/css/dynamic.ui.css new file mode 100644 index 0000000000..24ca6ecfc3 --- /dev/null +++ b/module/project/css/dynamic.ui.css @@ -0,0 +1,9 @@ +.date-block {max-height: 60px;} +.date-block .btn-link {background-color: var(--nav-active-bg); width: 28px; height: 28px;} +.date-block:after {content: ' '; display: block; position: relative; right: -1.6rem; top: 0px; height: 2px; width: 1rem; background-color: rgb(var(--color-gray-200-rgb));} +.date-block.border-secondary:after {background-color: rgba(var(--color-secondary-500-rgb),var(--tw-border-opacity));} + +.timeline .collapsed .icon {transform: rotate(270deg);} +.timeline .collapsed .alert {display: none;} + +.timeline > li + li:after {position: absolute; top: 90px; bottom: 20px; left: 40px; z-index: 1; display: block; content: ' '; border-left: 2px solid #eee;} diff --git a/module/project/js/dynamic.ui.js b/module/project/js/dynamic.ui.js new file mode 100644 index 0000000000..4b7036c8d8 --- /dev/null +++ b/module/project/js/dynamic.ui.js @@ -0,0 +1,12 @@ +window.changeUser = function() +{ + const picker = $('#user').zui('picker'); + const user = picker ? picker.$.value : ''; + const type = user ? 'account' : 'today'; + loadPage($.createLink('project', 'dynamic', `productID=${projectID}&type=${type}¶m=${user}`)); +} + +window.toggleCollapse = function() +{ + $(this).parent().toggleClass('collapsed'); +} diff --git a/module/project/ui/dynamic.html.php b/module/project/ui/dynamic.html.php new file mode 100644 index 0000000000..3fd0c18201 --- /dev/null +++ b/module/project/ui/dynamic.html.php @@ -0,0 +1,107 @@ + + * @package project + * @link https://www.zentao.net + */ +namespace zin; + +jsVar('projectID', $projectID); +/* zin: Define the feature bar on main menu. */ +featureBar +( + set::current($type), + set::linkParams("projectID={$projectID}&type={key}"), + li + ( + setClass('w-40'), + picker + ( + setID('user'), + set::name('user'), + set::placeholder($lang->execution->viewByUser), + set::items($userIdPairs), + set::value($param), + on::change('changeUser'), + ), + ), +); + +$content = null; +if(empty($dateGroups)) +{ + $content = div + ( + setClass('flex items-center justify-center h-64'), + span + ( + setClass('text-gray'), + $lang->action->noDynamic + ), + ); +} +else +{ + $content = array(); + $firstAction = ''; + foreach($dateGroups as $date => $actions) + { + $isToday = date(DT_DATE4) == $date; + $content[] = li + ( + div + ( + setClass('my-4 cursor-pointer'), + icon('angle-down text-primary border-2 rounded-full toolbar z-10 bg-canvas'), + span + ( + setClass('article-h3 ml-2'), + $isToday ? $lang->action->dynamic->today : $date, + ), + on::click('toggleCollapse') + ), + div + ( + setClass('flex-auto mx-6 mt-2 px-4 alert lighter'), + setClass($type == 'today' ? 'border-secondary' : ''), + dynamic + ( + set::dynamics($actions), + set::users($accountPairs), + ) + ) + ); + } + + $content = ul + ( + setClass('timeline'), + $content + ); +} + + +panel($content); + +if(!empty($firstAction)) +{ + $firstDate = date('Y-m-d', strtotime($firstAction->originalDate) + 24 * 3600); + $lastDate = substr($action->originalDate, 0, 10); + $hasPre = $this->action->hasPreOrNext($firstDate, 'pre'); + $hasNext = $this->action->hasPreOrNext($lastDate, 'next'); + $preLink = $hasPre ? inlink('dynamic', "projectID=$projectID&type=$type¶m=$param&recTotal={$pager->recTotal}&date=" . strtotime($firstDate) . '&direction=pre') : 'javascript:;'; + $nextLink = $hasNext ? inlink('dynamic', "projectID=$projectID&type=$type¶m=$param&recTotal={$pager->recTotal}&date=" . strtotime($lastDate) . '&direction=next') : 'javascript:;'; + + if($hasPre || $hasNext) + { + floatPreNextBtn + ( + empty($hasPre) ? null : set::preLink($preLink), + empty($hasNext) ? null : set::nextLink($nextLink) + ); + } +}