From b49b0485a84ff441f0e48a0bb0553b0fb5614856 Mon Sep 17 00:00:00 2001 From: tianshujie Date: Fri, 31 Mar 2023 10:30:51 +0800 Subject: [PATCH 1/3] * Code for task #89144. --- module/api/control.php | 15 +++++++++++---- module/api/view/editlib.html.php | 26 +++++++------------------- 2 files changed, 18 insertions(+), 23 deletions(-) diff --git a/module/api/control.php b/module/api/control.php index 62561e69ee..e5cd23e96c 100755 --- a/module/api/control.php +++ b/module/api/control.php @@ -447,8 +447,6 @@ class api extends control */ public function editLib($id) { - $lib = $this->doc->getLibById($id); - if(!empty($_POST)) { $this->doc->updateApiLib($id); @@ -458,9 +456,18 @@ class api extends control return $this->sendSuccess(array('message' => $this->lang->saveSuccess, 'closeModal' => true, 'callback' => "redirectParentWindow($id)")); } + $lib = $this->doc->getLibById($id); $type = 'nolink'; - if(!empty($lib->product)) $type = 'product'; - if(!empty($lib->project)) $type = 'project'; + if(!empty($lib->product)) + { + $type = 'product'; + $this->view->object = $this->loadModel('product')->getByID($lib->product); + } + if(!empty($lib->project)) + { + $type = 'project'; + $this->view->object = $this->loadModel('project')->getById($lib->project); + } if($type != 'nolink') $this->lang->api->aclList['default'] = sprintf($this->lang->doclib->aclList['default'], $this->lang->{$type}->common); if($type == 'nolink') unset($this->lang->api->aclList['default']); diff --git a/module/api/view/editlib.html.php b/module/api/view/editlib.html.php index e7260859bd..f5b0be4632 100644 --- a/module/api/view/editlib.html.php +++ b/module/api/view/editlib.html.php @@ -1,12 +1,12 @@ - * @package doc - * @version $Id: createlib.html.php 975 2010-07-29 03:30:25Z jajacn@126.com $ + * @package api + * @version $Id: editlib.html.php 975 2010-07-29 03:30:25Z jajacn@126.com $ * @link http://www.zentao.net */ ?> @@ -22,24 +22,12 @@
+ - - - - '> - - - - '> - - + + + From 0fc0b37f6ba402a4fb815047c53d0a4971f61493 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Fri, 31 Mar 2023 10:26:45 +0800 Subject: [PATCH 2/3] * code for task #89166. --- module/doc/js/create.js | 1 + module/doc/model.php | 6 +++--- module/doc/view/createtexttype.html.php | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/module/doc/js/create.js b/module/doc/js/create.js index d55329e85b..cf983d3e1f 100644 --- a/module/doc/js/create.js +++ b/module/doc/js/create.js @@ -27,6 +27,7 @@ $(function() $('#status').val('draft'); $('#dataform').submit(); }); + $('#releaseBtn').click(function(){$('#dataform').submit();}); $('#basicInfoLink').click(function() { if($('#editorTitle').val() == '') diff --git a/module/doc/model.php b/module/doc/model.php index f7c9ccac9f..6fee689960 100644 --- a/module/doc/model.php +++ b/module/doc/model.php @@ -80,7 +80,7 @@ class docModel extends model ->beginIF($type == 'all')->andWhere('deleted')->eq(0)->fi() ->beginIF($excludeType)->andWhere('type')->notin($excludeType)->fi() ->andWhere('vision')->eq($this->config->vision) - ->orderBy('`order` asc, id_desc') + ->orderBy('`order`_asc, id_asc') ->query(); } else @@ -91,7 +91,7 @@ class docModel extends model ->beginIF($type)->andWhere('type')->eq($type)->fi() ->beginIF(!$type)->andWhere('type')->ne('api')->fi() ->beginIF($objectID and strpos(',product,project,execution,', ",$type,") !== false)->andWhere($type)->eq($objectID)->fi() - ->orderBy("`order` asc, id_desc")->query(); + ->orderBy("`order`_asc, id_asc")->query(); } $products = $this->loadModel('product')->getPairs(); @@ -137,7 +137,7 @@ class docModel extends model if(!empty($appendLibs)) { - $stmt = $this->dao->select('*')->from(TABLE_DOCLIB)->where('id')->in($appendLibs)->orderBy("`order` asc, id_desc")->query(); + $stmt = $this->dao->select('*')->from(TABLE_DOCLIB)->where('id')->in($appendLibs)->orderBy("`order`_asc, id_asc")->query(); while($lib = $stmt->fetch()) { if(!isset($libPairs[$lib->id]) and $this->checkPrivLib($lib, $extra)) $libPairs[$lib->id] = $lib->name; diff --git a/module/doc/view/createtexttype.html.php b/module/doc/view/createtexttype.html.php index 56651209e6..8a41d5f0cd 100644 --- a/module/doc/view/createtexttype.html.php +++ b/module/doc/view/createtexttype.html.php @@ -128,7 +128,7 @@ From 736bfd226f9c9492e2e6a89518cfd1e7055f25ef Mon Sep 17 00:00:00 2001 From: tianshujie Date: Fri, 31 Mar 2023 10:37:14 +0800 Subject: [PATCH 3/3] * Code for task #89144. --- module/api/js/common.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/module/api/js/common.js b/module/api/js/common.js index dfdff5f1b6..cc7543ab4e 100644 --- a/module/api/js/common.js +++ b/module/api/js/common.js @@ -54,6 +54,9 @@ function toggleLibType(libType) } else { + var acl = $("input[name='acl']:checked").val(); + if(acl == 'default') $("input[id='aclopen']").prop('checked', true); + $('#projectBox').addClass('hidden'); $('#productBox').addClass('hidden'); $('#acldefault').closest('.radio').hide();
api->libType;?> - api->libTypeList, $type, "onchange='toggleLibType(this.value)'")?> -
api->product;?> - product, "class='form-control chosen'")?> -
api->project;?> - project, "class='form-control chosen'")?> - api->{$type};?>name?>
api->name?> name, "class='form-control'");?>
- release->common);?> + release->common, "id='releaseBtn'", 'btn btn-primary btn-wide');?> cancel, "data-dismiss='modal'", "btn btn-wide");?>