diff --git a/module/common/lang/de.php b/module/common/lang/de.php index 813065cb22..0d498f325c 100644 --- a/module/common/lang/de.php +++ b/module/common/lang/de.php @@ -73,6 +73,8 @@ $lang->goPC = 'PC'; $lang->more = 'Mehr'; $lang->moreLink = 'MORE'; $lang->day = 'Tag'; +$lang->today = 'Today'; +$lang->yesterday = 'Yesterday'; $lang->customConfig = 'Custom Config'; $lang->public = 'Öffentlich'; $lang->trunk = 'Trunk'; diff --git a/module/common/lang/en.php b/module/common/lang/en.php index 4f8cbefa37..4a2e7d9206 100644 --- a/module/common/lang/en.php +++ b/module/common/lang/en.php @@ -73,6 +73,8 @@ $lang->goPC = 'PC'; $lang->more = 'More'; $lang->moreLink = 'MORE'; $lang->day = ' Day'; +$lang->today = 'Today'; +$lang->yesterday = 'Yesterday'; $lang->customConfig = 'Custom Config'; $lang->public = 'Public'; $lang->trunk = 'Trunk'; diff --git a/module/common/lang/fr.php b/module/common/lang/fr.php index a474aec01c..8de62ef132 100644 --- a/module/common/lang/fr.php +++ b/module/common/lang/fr.php @@ -73,6 +73,8 @@ $lang->goPC = 'PC'; $lang->more = 'Plus'; $lang->moreLink = 'MORE'; $lang->day = 'Jour'; +$lang->today = 'Today'; +$lang->yesterday = 'Yesterday'; $lang->customConfig = 'Personnalisation'; $lang->public = 'Public'; $lang->trunk = 'Tronc'; diff --git a/module/common/lang/vi.php b/module/common/lang/vi.php index 9b6f10e1bf..ad6d9c621f 100644 --- a/module/common/lang/vi.php +++ b/module/common/lang/vi.php @@ -57,6 +57,8 @@ $lang->goPC = 'PC'; $lang->more = 'Thêm'; $lang->moreLink = 'MORE'; $lang->day = ' Day'; +$lang->today = 'Today'; +$lang->yesterday = 'Yesterday'; $lang->customConfig = 'Tùy biến cấu hình'; $lang->public = 'Công khai'; $lang->trunk = 'Trunk'; diff --git a/module/common/lang/zh-cn.php b/module/common/lang/zh-cn.php index f707b151c3..3299681d48 100644 --- a/module/common/lang/zh-cn.php +++ b/module/common/lang/zh-cn.php @@ -73,6 +73,8 @@ $lang->goPC = 'PC版'; $lang->more = '更多'; $lang->moreLink = 'More'; $lang->day = '天'; +$lang->today = '今日'; +$lang->yesterday = '昨日'; $lang->customConfig = '自定义'; $lang->public = '公共'; $lang->trunk = '主干'; diff --git a/module/my/js/task.ui.js b/module/my/js/task.ui.js index 00da891752..e43c9e5c08 100644 --- a/module/my/js/task.ui.js +++ b/module/my/js/task.ui.js @@ -45,3 +45,42 @@ window.setStatistics = function(element, checks) if(checks.length) return {html: element.options.checkedSummary.replaceAll('%total%', `${checks.length}`).replaceAll('%wait%', waitCount).replaceAll('%doing%', doingCount).replaceAll('%estimate%', estimate).replaceAll('%consumed%', consumed).replaceAll('%left%', left)}; return zui.formatString(element.options.defaultSummary); } + +/** + * 对截至日期列进行重定义。 + * Redefine the deadline column. + * + * @param array result + * @param array info + * @access public + * @return string|array + */ +window.renderCell = function(result, info) +{ + if(info.col.name == 'deadline') + { + const today = zui.formatDate(zui.createDate(), 'yyyy-MM-dd'); + const yesterday = zui.formatDate(convertStringToDate(today) - 24 * 60 * 60 * 1000, 'yyyy-MM-dd'); + if(result == today) + { + result[0] = {html: '' + todayLabel + ''}; + } + else if(result == yesterday) + { + result[0] = {html: '' + yesterdayLabel + ''}; + } + else if(result < yesterday) + { + result[0] = {html: '' + result + ''}; + } + } + return result; +} + +function convertStringToDate(dateString) +{ + dateString = dateString.split('-'); + dateString = dateString[1] + '/' + dateString[2] + '/' + dateString[0]; + + return Date.parse(dateString); +} diff --git a/module/my/ui/task.html.php b/module/my/ui/task.html.php index 48f7eb465d..8c7321761a 100644 --- a/module/my/ui/task.html.php +++ b/module/my/ui/task.html.php @@ -9,6 +9,8 @@ declare(strict_types=1); * @link https://www.zentao.net */ namespace zin; +jsVar('todayLabel', $lang->today); +jsVar('yesterdayLabel', $lang->yesterday); featureBar ( @@ -32,6 +34,7 @@ dtable set::data($data), set::userMap($users), set::fixedLeftWidth('44%'), + set::onRenderCell(jsRaw('window.renderCell')), set::checkable(true), set::defaultSummary(array('html' => $summary)), set::checkedSummary($lang->execution->checkedSummary),