diff --git a/module/ai/control.php b/module/ai/control.php index 082050becf..db24312651 100644 --- a/module/ai/control.php +++ b/module/ai/control.php @@ -467,14 +467,21 @@ class ai extends control * Publish prompt, set status to active. * * @param int $id + * @param bool $backToTestingLocation * @access public * @return void */ - public function promptPublish($id) + public function promptPublish($id, $backToTestingLocation = false) { $this->ai->togglePromptStatus($id, 'active'); if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError())); + if($backToTestingLocation) + { + $prompt = $this->ai->getPromptByID($id); + return $this->send(array('result' => 'success', 'message' => $this->lang->ai->prompts->action->publishSuccess, 'locate' => $this->ai->getTestingLocation($prompt))); + } + return $this->send(array('result' => 'success')); } diff --git a/module/ai/lang/en.php b/module/ai/lang/en.php index 21af4fea59..f934a47ed7 100644 --- a/module/ai/lang/en.php +++ b/module/ai/lang/en.php @@ -51,6 +51,7 @@ $lang->ai->prompts->action->publish = 'Publish'; $lang->ai->prompts->action->unpublish = 'Unpublish'; $lang->ai->prompts->action->delete = 'Delete'; $lang->ai->prompts->action->deleteConfirm = 'Deleted prompts will be no longer available. Are you sure you want to proceed?'; +$lang->ai->prompts->action->publishSuccess = 'Publish Success'; /* Steps of prompt creation. */ $lang->ai->prompts->assignRole = 'Assign Role'; diff --git a/module/ai/lang/zh-cn.php b/module/ai/lang/zh-cn.php index 24a0344094..8e551d668f 100644 --- a/module/ai/lang/zh-cn.php +++ b/module/ai/lang/zh-cn.php @@ -51,6 +51,8 @@ $lang->ai->prompts->action->publish = '发布'; $lang->ai->prompts->action->unpublish = '下架'; $lang->ai->prompts->action->delete = '删除'; $lang->ai->prompts->action->deleteConfirm = '删除后,提词将不能继续使用,您确定要删除吗?'; +$lang->ai->prompts->action->publishSuccess = '发布成功'; + /* Steps of prompt creation. */ $lang->ai->prompts->assignRole = '指定角色'; diff --git a/module/ai/view/inputinject.html.php b/module/ai/view/inputinject.html.php index f2c737315e..edb47db414 100644 --- a/module/ai/view/inputinject.html.php +++ b/module/ai/view/inputinject.html.php @@ -74,4 +74,22 @@ }); + diff --git a/module/ai/view/promptaudit.html.php b/module/ai/view/promptaudit.html.php index 6ff9ba2575..2a3883bd58 100644 --- a/module/ai/view/promptaudit.html.php +++ b/module/ai/view/promptaudit.html.php @@ -121,7 +121,8 @@ }); })(); - function reloadPrompt(promptId, objectId) { + function reloadPrompt(promptId, objectId) + { let link = createLink('ai', 'promptexecute', 'promptId=' + promptId + '&objectId=' + objectId); link = link.replace('onlybody=yes', ''); const aTag = document.createElement('a'); diff --git a/module/story/view/change.html.php b/module/story/view/change.html.php index 97da168d79..10a1218077 100644 --- a/module/story/view/change.html.php +++ b/module/story/view/change.html.php @@ -104,12 +104,15 @@ - + ai->prompts->action->publish, "id='promptPublish' data-promptId=$prompt->id" ,'btn btn-primary btn-wide');?> + lastEditedDate); echo html::commonButton($lang->save, "id='saveButton'", 'btn btn-primary btn-wide'); echo html::commonButton($lang->story->doNotSubmit, "id='saveDraftButton'", 'btn btn-secondary btn-wide'); if(!isonlybody()) echo html::backButton(); ?> +