diff --git a/module/api/control.php b/module/api/control.php index b6b7e883ec..23ebbad7de 100755 --- a/module/api/control.php +++ b/module/api/control.php @@ -414,8 +414,6 @@ class api extends control */ public function createLib($type = 'product', $objectID = 0) { - if(!in_array($type, array('product', 'project'))) $type = 'product'; - if(!empty($_POST)) { $libID = $this->doc->createApiLib(); @@ -433,7 +431,8 @@ class api extends control return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->createLink('api', 'index', "libID=$libID"))); } - $this->lang->api->aclList['default'] = sprintf($this->lang->api->aclList['default'], $this->lang->{$type}->common); + $defaultAclLang = in_array($type, array('product', 'product')) ? $this->lang->{$type}->common : $this->lang->product->common; + $this->lang->api->aclList['default'] = sprintf($this->lang->api->aclList['default'], $defaultAclLang); $this->view->type = $type; $this->view->objectID = $objectID; diff --git a/module/api/css/createlib.css b/module/api/css/createlib.css index 4b4ded1749..6d28a95d3c 100644 --- a/module/api/css/createlib.css +++ b/module/api/css/createlib.css @@ -3,3 +3,4 @@ form {margin-bottom: 100px;} table {width: 90% !important;} #whiteListBox div.input-group {margin-bottom: 2px;} #whiteListBox .input-group:last-child {margin-top: 10px;} +#aclBox > th {vertical-align: top; padding-top: 18px;} diff --git a/module/api/js/createlib.js b/module/api/js/createlib.js index 02a964d4fa..bdc608f4cb 100644 --- a/module/api/js/createlib.js +++ b/module/api/js/createlib.js @@ -1,4 +1,4 @@ -$(document).ready(function() +$(function() { $('#apiForm').ajaxForm({ success: (data) => { @@ -10,4 +10,6 @@ $(document).ready(function() } } }) + + toggleLibType(libType); }); diff --git a/module/api/view/createlib.html.php b/module/api/view/createlib.html.php index 1f90647228..d73e1e5428 100644 --- a/module/api/view/createlib.html.php +++ b/module/api/view/createlib.html.php @@ -79,4 +79,5 @@ productCommon);?> projectCommon);?> + diff --git a/module/api/view/index.html.php b/module/api/view/index.html.php index fd5a30f46c..2b24026b20 100644 --- a/module/api/view/index.html.php +++ b/module/api/view/index.html.php @@ -26,7 +26,7 @@ if($libTree and common::hasPriv('api', 'releases')) echo html::a($this->createLink('api', 'releases', "libID=$libID", 'html', true), " " . $lang->api->releases, '', "class='btn btn-link iframe' data-width='800px'"); if($libTree and common::hasPriv('api', 'createRelease')) echo html::a($this->createLink('api', 'createRelease', "libID=$libID"), " " . $lang->api->createRelease, '', "class='btn btn-link iframe' data-width='800px'"); if($libTree and common::hasPriv('api', 'export') and $config->edition != 'open') echo html::a($this->createLink('api', 'export', "libID=$libID&version=$version&release=$release", 'html', true), " " . $lang->export, '', "class='btn btn-link export' data-width='480px' id='export'"); - if(common::hasPriv('api', 'createLib')) echo html::a($this->createLink('api', 'createLib', "type=" . ($objectType == 'project' ? 'project' : 'product') . "&objectID=$objectID"), ' ' . $lang->api->createLib, '', 'class="btn btn-secondary iframe" data-width="800px"'); + if(common::hasPriv('api', 'createLib')) echo html::a($this->createLink('api', 'createLib', "type=" . ($objectType ? $objectType : 'nolink') . "&objectID=$objectID"), ' ' . $lang->api->createLib, '', 'class="btn btn-secondary iframe" data-width="800px"'); if($libTree and common::hasPriv('api', 'create')) echo html::a($this->createLink('api', 'create', "libID=$libID&moduleID=$moduleID"), ' ' . $lang->api->createApi, '', 'class="btn btn-primary"'); ?> @@ -37,7 +37,7 @@
doc->noLib;?> ' . $lang->api->createLib, '', 'class="btn btn-info iframe" data-width="800px"'); + if(common::hasPriv('api', 'createLib')) echo html::a(helper::createLink('api', 'createLib', "type=" . ($objectType ? $objectType : 'nolink')), ' ' . $lang->api->createLib, '', 'class="btn btn-info iframe" data-width="800px"'); ?>