* adjust prompt audit to exit.
This commit is contained in:
+11
-4
@@ -495,13 +495,20 @@ class ai extends control
|
||||
/**
|
||||
* Audit prompt modal.
|
||||
*
|
||||
* @param int $promptId
|
||||
* @param int $objectId
|
||||
* @param int $promptId
|
||||
* @param int $objectId
|
||||
* @param bool $exit
|
||||
* @access public
|
||||
* @return void
|
||||
* @return void|int
|
||||
*/
|
||||
public function promptAudit($promptId, $objectId)
|
||||
public function promptAudit($promptId, $objectId, $exit)
|
||||
{
|
||||
if(!empty($exit))
|
||||
{
|
||||
unset($_SESSION['auditPrompt']);
|
||||
return $this->send(array('result' => 'success', 'locate' => $this->inlink('promptview', "promptID=$promptId")));
|
||||
}
|
||||
|
||||
$prompt = $this->ai->getPromptByID($promptId);
|
||||
|
||||
if($_POST)
|
||||
|
||||
@@ -124,6 +124,7 @@
|
||||
<script>
|
||||
(function() {
|
||||
const isAudit = <?php echo $isAudit ? 'true' : 'false';?>;
|
||||
const promptId = '<?php echo $prompt->id;?>';
|
||||
|
||||
<?php if(isset($config->ai->injectAuditButton->locations[$module][$method])) :?>
|
||||
function injectAuditAction()
|
||||
@@ -185,6 +186,24 @@
|
||||
});
|
||||
}
|
||||
|
||||
const auditExitButton = document.getElementById('promptAuditExit');
|
||||
if(auditExitButton)
|
||||
{
|
||||
auditExitButton.addEventListener('click', function(e)
|
||||
{
|
||||
e.preventDefault();
|
||||
|
||||
const container = auditExitButton.ownerDocument.defaultView.parent.document.querySelector('.load-indicator');
|
||||
if(container) container.classList.toggle('loading', true);
|
||||
|
||||
const aTag = document.createElement('a');
|
||||
aTag.href = createLink('ai', 'promptAudit', 'promptId=' + promptId + '&objectId=0' + '&exit=true');
|
||||
aTag.style.display = 'none';
|
||||
document.body.appendChild(aTag);
|
||||
aTag.click();
|
||||
});
|
||||
}
|
||||
|
||||
const regenerateButton = document.getElementById('promptRegenerate');
|
||||
if(regenerateButton)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user