From 3dfc9bb03fb1df1956df82ee8fd20b20055ac281 Mon Sep 17 00:00:00 2001 From: qixinzhi Date: Mon, 23 Dec 2024 07:38:26 +0000 Subject: [PATCH] * [story#69412,0.5h] add zentao list display. --- module/doc/control.php | 32 +++++++++++++++++++------------ module/doc/css/zentaolist.ui.css | 1 + module/doc/js/zentaolist.ui.js | 8 +++++--- module/doc/ui/zentaolist.html.php | 6 ++++++ 4 files changed, 32 insertions(+), 15 deletions(-) diff --git a/module/doc/control.php b/module/doc/control.php index 9ecf685eec..bc1ec35395 100755 --- a/module/doc/control.php +++ b/module/doc/control.php @@ -110,16 +110,18 @@ class doc extends control * @access public * @return void */ - public function zentaoList(string $type) + public function zentaoList(string $type, int $blockID) { - list($url, $idList, $cols, $data) = $this->docZen->formFromSession($type); + $blockData = $this->dao->select('*')->from(TABLE_DOCBLOCK)->where('id')->eq($blockID)->fetch(); + $content = json_decode($blockData->content, true); - $this->view->title = sprintf($this->lang->doc->insertTitle, $this->lang->doc->zentaoList[$type]); - $this->view->type = $type; - $this->view->url = $url; - $this->view->idList = $idList; - $this->view->cols = $cols; - $this->view->data = $data; + $this->view->title = sprintf($this->lang->doc->insertTitle, $this->lang->doc->zentaoList[$type]); + $this->view->type = $type; + $this->view->settings = $blockData->settings; + $this->view->idList = $content['idList']; + $this->view->cols = $content['cols']; + $this->view->data = $content['data']; + $this->view->users = $this->loadModel('user')->getPairs('noletter|pofirst|nodeleted'); $this->display(); } @@ -132,12 +134,18 @@ class doc extends control * @access public * @return void */ - public function buildZentaoList(string $type) + public function buildZentaoList(int $docID, string $type) { - $sessionName = 'zentaoList' . $type; - $this->session->set($sessionName, $_POST); + $docblock = new stdClass(); + $docblock->doc = $docID; + $docblock->type = $type; + $docblock->settings = $this->post->url; + $docblock->content = json_encode(array('cols' => json_decode($this->post->cols), 'data' => json_decode($this->post->data), 'idList' => $this->post->idList)); - return print(json_encode(array('result' => 'success'))); + $this->dao->insert(TABLE_DOCBLOCK)->data($docblock)->exec(); + if(dao::isError()) return print(json_encode(array('result' => 'fail', 'message' => dao::getError()))); + + return print(json_encode(array('result' => 'success', 'blockID' => $this->dao->lastInsertId()))); } /** diff --git a/module/doc/css/zentaolist.ui.css b/module/doc/css/zentaolist.ui.css index 4e9a3ec05f..88dfdb03cb 100644 --- a/module/doc/css/zentaolist.ui.css +++ b/module/doc/css/zentaolist.ui.css @@ -1,3 +1,4 @@ .p-0-important {padding: 0 !important;} .mb-0-important {margin-bottom: 0 !important;} .w-22 {width: 88px;} +html {overflow: hidden;} diff --git a/module/doc/js/zentaolist.ui.js b/module/doc/js/zentaolist.ui.js index d25ec6f152..2ab5a3a30f 100644 --- a/module/doc/js/zentaolist.ui.js +++ b/module/doc/js/zentaolist.ui.js @@ -62,9 +62,11 @@ function checkForm(form, formData) window.backToSet = function() { - const formData = getSettings(true); - formData.append('action', 'preview'); - loadWithForm(formData, 'setting'); + const settings = $('#previewForm').data('settings'); + parent.zui.Modal.open({ + size: 'lg', + url: settings + }); } window.toggleCheckRows = function() diff --git a/module/doc/ui/zentaolist.html.php b/module/doc/ui/zentaolist.html.php index 434bca59cc..9bfd8ab652 100644 --- a/module/doc/ui/zentaolist.html.php +++ b/module/doc/ui/zentaolist.html.php @@ -9,6 +9,7 @@ declare(strict_types=1); * @link https://www.zentao.net */ namespace zin; +set::zui(true); $cols = array_values($cols); $data = array_values($data); @@ -21,6 +22,7 @@ formPanel ( setID('previewForm'), setClass('mb-0-important'), + set('data-settings', $settings), set::bodyClass('p-0-important'), set::actions(array()), div @@ -37,7 +39,9 @@ formPanel set::bordered(true), set::cols($cols), set::data($data), + set::userMap($users), set::emptyTip($lang->doc->previewTip), + set::checkable(false), /* set::afterRender(jsRaw('toggleCheckRows')) */ ), div @@ -61,3 +65,5 @@ formPanel ) ) ); + +render('pagebase');