From 7cd5824a0ef7de3e970f6f61cc2e6eea72cfdbb7 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Fri, 9 Aug 2024 09:19:37 +0800 Subject: [PATCH] * [refac story #49398] Add space field. --- module/doc/config/form.php | 1 + module/doc/js/editlib.ui.js | 9 +++++++++ module/doc/model.php | 4 +++- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/module/doc/config/form.php b/module/doc/config/form.php index 04cfd253e9..3024bba38e 100644 --- a/module/doc/config/form.php +++ b/module/doc/config/form.php @@ -20,6 +20,7 @@ $config->doc->form->createlib['vision'] = array('type' => 'string', 'requir $config->doc->form->createlib['addedBy'] = array('type' => 'string', 'required' => false, 'default' => ''); $config->doc->form->createlib['addedDate'] = array('type' => 'datetime', 'required' => false, 'default' => $now); +$config->doc->form->editlib['space'] = array('type' => 'string', 'required' => true, 'default' => ''); $config->doc->form->editlib['name'] = array('type' => 'string', 'required' => true, 'default' => '', 'filter' => 'trim'); $config->doc->form->editlib['acl'] = array('type' => 'string', 'required' => false, 'default' => ''); $config->doc->form->editlib['groups'] = array('type' => 'array', 'required' => false, 'default' => '', 'filter' => 'join'); diff --git a/module/doc/js/editlib.ui.js b/module/doc/js/editlib.ui.js index 6865f34372..5ae235ea14 100644 --- a/module/doc/js/editlib.ui.js +++ b/module/doc/js/editlib.ui.js @@ -1,3 +1,12 @@ +window.changeSpace = function(e) +{ + let targetSpace = e.target.value; + if((targetSpace == 'mine' && space != 'mine') || (targetSpace != 'mine' && space == 'mine')) + { + loadModal($.createLink('doc', 'editLib', "libID=" + doclibID + "&targetSpace=" + targetSpace)); + } +}; + $(function() { toggleAcl('lib'); diff --git a/module/doc/model.php b/module/doc/model.php index aae38472de..5b1185e060 100644 --- a/module/doc/model.php +++ b/module/doc/model.php @@ -379,11 +379,13 @@ class docModel extends model $this->checkApiLibName($lib, $type, $libID); } - $this->dao->update(TABLE_DOCLIB)->data($lib)->autoCheck() + $this->dao->update(TABLE_DOCLIB)->data($lib, 'space')->autoCheck() ->batchCheck($this->config->doc->editlib->requiredFields, 'notempty') ->where('id')->eq($libID) ->exec(); + $this->moveLib($libID, $lib); + if(dao::isError()) return false; return common::createChanges($oldLib, $lib); }