From fefb1d6cbd5cef625f477936778e683899ebce86 Mon Sep 17 00:00:00 2001 From: Chenjianyu Date: Tue, 8 Aug 2023 15:21:47 +0800 Subject: [PATCH] * hide some functions when the zentao version is the open source version. --- module/ai/view/prompts.html.php | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/module/ai/view/prompts.html.php b/module/ai/view/prompts.html.php index 6987d15b4a..2859410083 100644 --- a/module/ai/view/prompts.html.php +++ b/module/ai/view/prompts.html.php @@ -23,17 +23,20 @@ $executable = $this->ai->isExecutable($prompt); $published = $prompt->status == 'active'; - /* Design button. */ - if(common::hasPriv('ai', 'promptassignrole')) $html .= html::a(helper::createLink('ai', 'promptassignrole', "prompt=$prompt->id"), '', '', "class='btn" . ($published ? ' disabled' : '') . "' title='{$lang->ai->prompts->action->design}'"); + if($this->config->edition != 'open') + { + /* Design button. */ + if(common::hasPriv('ai', 'promptassignrole')) $html .= html::a(helper::createLink('ai', 'promptassignrole', "prompt=$prompt->id"), '', '', "class='btn" . ($published ? ' disabled' : '') . "' title='{$lang->ai->prompts->action->design}'"); - /* Test / audit button. */ - if(common::hasPriv('ai', 'promptaudit')) $html .= html::a($executable ? $this->ai->getTestingLocation($prompt) : '#', '', '', "id='prompt-audit-button-$prompt->id' class='btn" . ($executable && !$published ? '' : ' disabled') . "' title='{$lang->ai->prompts->action->test}'" . ($executable ? '' : " data-toggle='modal' data-target='#designConfirmModal'")); + /* Test / audit button. */ + if(common::hasPriv('ai', 'promptaudit')) $html .= html::a($executable ? $this->ai->getTestingLocation($prompt) : '#', '', '', "id='prompt-audit-button-$prompt->id' class='btn" . ($executable && !$published ? '' : ' disabled') . "' title='{$lang->ai->prompts->action->test}'" . ($executable ? '' : " data-toggle='modal' data-target='#designConfirmModal'")); - /* Edit button. */ - if(common::hasPriv('ai', 'promptedit')) $html .= html::a(helper::createLink('ai', 'promptedit', "prompt=$prompt->id"), '', '', "class='btn' title='{$lang->ai->prompts->action->edit}'"); + /* Edit button. */ + if(common::hasPriv('ai', 'promptedit')) $html .= html::a(helper::createLink('ai', 'promptedit', "prompt=$prompt->id"), '', '', "class='btn' title='{$lang->ai->prompts->action->edit}'"); - /* Divider. */ - if(common::hasPriv('ai', 'promptpublish') || common::hasPriv('ai', 'promptunpublish')) $html .= '
'; + /* Divider. */ + if(common::hasPriv('ai', 'promptpublish') || common::hasPriv('ai', 'promptunpublish')) $html .= '
'; + } /* Publish button. */ if(common::hasPriv('ai', 'promptpublish')) $html .= html::a(!$published && $executable ? "javascript:togglePromptStatus($prompt->id)" : '#', '', '', "class='btn" . (!$published && $executable ? '' : ' disabled') . "' title='{$lang->ai->prompts->action->publish}'" . ($executable ? '' : " data-toggle='modal' data-target='#designConfirmModal'")); @@ -60,7 +63,7 @@ ?>
- createLink('ai', 'createprompt'), " " . $lang->ai->prompts->create, '', "class='btn btn-primary iframe'");?> + config->edition != 'open' && common::hasPriv('ai', 'createprompt')) echo html::a($this->createLink('ai', 'createprompt'), " " . $lang->ai->prompts->create, '', "class='btn btn-primary iframe'");?>
@@ -78,7 +81,7 @@

ai->prompts->emptyList;?> - createLink('ai', 'createprompt'), " " . $lang->ai->prompts->create, '', "class='btn btn-info iframe'");?> + config->edition != 'open' && common::hasPriv('ai', 'createprompt')) echo html::a($this->createLink('ai', 'createprompt'), " " . $lang->ai->prompts->create, '', "class='btn btn-info iframe'");?>