-
-
Notifications
You must be signed in to change notification settings - Fork 697
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2092 from LiveHelperChat/master-escalation
4.37v
- Loading branch information
Showing
28 changed files
with
354 additions
and
21 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
lhc_web/design/defaulttheme/css/css_static/30dc84470e88171e4fca9847c8266705.css
Large diffs are not rendered by default.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
lhc_web/design/defaulttheme/css/css_static/520698f54a44f8d39fb59228eb9aa54c.css
Large diffs are not rendered by default.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
lhc_web/design/defaulttheme/css/css_static/7cbe4925e60a571caa14ad54f6c9948f.css
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
lhc_web/design/defaulttheme/css/css_static/df02810f25cccd650d034c5d99fa1fb5.css
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
2 changes: 2 additions & 0 deletions
2
lhc_web/design/defaulttheme/js/js_static/69dd0a45af3af232b46fb9ee986ca329.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
lhc_web/design/defaulttheme/js/js_static/69dd0a45af3af232b46fb9ee986ca329.js.map
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
$(document).ready(function() { | ||
$('#add-field-row button[name="custom_field_add"]').click(function(){ | ||
botCommandFields.push({ | ||
'name': document.getElementById('custom_field_name').value, | ||
'placeholder': document.getElementById('custom_field_placeholder').value, | ||
'type': document.getElementById('custom_field_type').value, | ||
'rows': document.getElementById('custom_field_rows').value, | ||
'required': document.getElementById('custom_field_required').value, | ||
}); | ||
renderPeriods() | ||
}); | ||
|
||
var entityMap = { | ||
'&': '&', | ||
'<': '<', | ||
'>': '>', | ||
'"': '"', | ||
"'": ''', | ||
'/': '/', | ||
'`': '`', | ||
'=': '=' | ||
}; | ||
|
||
ee.addListener('delete_custom_command_field',function (index) { | ||
botCommandFields.splice(index,1); | ||
renderPeriods(); | ||
}); | ||
|
||
function escapeHtml (string) { | ||
return String(string).replace(/[&<>"'`=\/]/g, function fromEntityMap (s) { | ||
return entityMap[s]; | ||
}); | ||
} | ||
|
||
function renderPeriods(){ | ||
let periodList = document.getElementById('field-rows-container'); | ||
periodList.innerHTML = ''; | ||
botCommandFields.forEach((item, index) => { | ||
periodList.innerHTML += '<div class="row pt-1"><div class="col-3"><b>'+periodList.getAttribute('name-field')+'</b> - '+escapeHtml(item.name)+'<br><span class="text-muted fs12"> {args.arg_' + (index+1) +'} or {arg_' + (index+1) +'} in bot, in Rest API {{args.arg_' + (index+1) +'}}</span></div>'+ | ||
'<div class="col-2"><b>'+periodList.getAttribute('placeholder-field')+'</b> - '+escapeHtml(item.placeholder) + '</div>'+ | ||
'<div class="col-2"><b>'+periodList.getAttribute('type-field')+'</b> - '+escapeHtml(item.type) + '</div>'+ | ||
'<div class="col-2"><b>'+periodList.getAttribute('rows-field')+'</b> - '+escapeHtml(item.rows ? item.rows : 1) + '</div>'+ | ||
'<div class="col-2"><b>'+periodList.getAttribute('required-field')+'</b> - '+escapeHtml(item.required ? item.required : 'required') + '</div>'+ | ||
'<div class="col-1"><button class="btn btn-danger btn-sm w-100" type="button" onclick="ee.emitEvent(\'delete_custom_command_field\',['+index+'])">'+periodList.getAttribute('remove-action')+'</button></div>'+ | ||
'<input type="hidden" name="custom_field_name[]" value="'+escapeHtml(item.name)+'">' + | ||
'<input type="hidden" name="custom_field_placeholder[]" value="'+escapeHtml(item.placeholder)+'">' + | ||
'<input type="hidden" name="custom_field_type[]" value="'+escapeHtml(item.type)+'">' + | ||
'<input type="hidden" name="custom_field_rows[]" value="'+escapeHtml(item.rows)+'"></div>'+ | ||
'<input type="hidden" name="custom_field_required[]" value="'+escapeHtml(item.required ? item.required : 'required')+'"></div>'; | ||
}); | ||
} | ||
renderPeriods(); | ||
}); |
16 changes: 16 additions & 0 deletions
16
lhc_web/design/defaulttheme/tpl/lhchat/chat_tabs/actions/escalations.tpl.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php if (erLhcoreClassUser::instance()->hasAccessTo('lhchatcommand','use')) : ?> | ||
<?php $escalationCommands = erLhcoreClassModelGenericBotCommand::getList(['customfilter' => ['(dep_id = 0 OR dep_id = ' . (int)$chat->dep_id . ')'], 'filter' => ['enabled_display' => 1]]); ?> | ||
<?php if (!empty($escalationCommands)): ?> | ||
<div class="col-6 pb-1" id="escalation-<?php echo $chat->id?>"> | ||
<div class="dropdown"> | ||
<button class="btn btn-sm dropdown-toggle text-muted p-1 pt-0 pb-0 ps-0" type="button" data-bs-toggle="dropdown" aria-expanded="false"> | ||
<span class="material-icons">keyboard_command_key</span><?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/adminchat','Bot commands')?> | ||
</button> | ||
<ul class="dropdown-menu pt-1 pb-1 fs13"> | ||
<?php foreach ($escalationCommands as $escalationCommand): ?> | ||
<li><a class="dropdown-item text-muted action-icon pt-1 pb-1" onclick="lhc.revealModal({'url':WWW_DIR_JAVASCRIPT+'chatcommand/command/<?php echo $chat->id?>/<?php echo $escalationCommand->id?>'})" title="!<?php echo htmlspecialchars($escalationCommand->command)?>" ><?php echo htmlspecialchars($escalationCommand->name);?></a></li> | ||
<?php endforeach; ?> | ||
</ul> | ||
</div> | ||
</div> | ||
<?php endif;endif; ?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
lhc_web/design/defaulttheme/tpl/lhchatcommand/command.tpl.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php $modalHeaderTitle = htmlspecialchars($command->name);$modalSize = 'xs';$modalHeaderClass = 'p-1';?> | ||
<?php include(erLhcoreClassDesign::designtpl('lhkernel/modal_header.tpl.php'));?> | ||
|
||
<form action="<?php echo erLhcoreClassDesign::baseurl('chatcommand/command')?>/<?php echo $chat->id?>/<?php echo $command->id?>" method="post" onsubmit="return lhinst.submitModalForm($(this))"> | ||
|
||
<?php if (isset($commandExecution)) : $msg = erTranslationClassLhTranslation::getInstance()->getTranslation('user/account','Processed!');$hideSuccessButton = true; ?> | ||
<?php include(erLhcoreClassDesign::designtpl('lhkernel/alert_success.tpl.php'));?> | ||
<?php endif; ?> | ||
|
||
<?php if (isset($errors)) : $hideErrorButton = true;?> | ||
<?php include(erLhcoreClassDesign::designtpl('lhkernel/validation_error.tpl.php'));?> | ||
<?php endif; ?> | ||
|
||
<?php foreach ($command->fields_array as $fieldIndex => $field) : ?> | ||
<div class="form-group"> | ||
<label><?php echo htmlspecialchars($field['name'])?><?php if ((isset($field['required']) && $field['required'] == 'required') || !isset($field['required'])) : ?>*<?php endif;?></label> | ||
<?php if ($field['type'] == 'textarea') : ?> | ||
<textarea class="form-control form-control-sm<?php if (isset($errors['field_'.$fieldIndex])) : ?> is-invalid<?php endif;?>" name="field_<?php echo $fieldIndex?>" placeholder="<?php echo htmlspecialchars($field['placeholder'] ?? '')?>" rows="<?php echo isset($field['rows']) && (int)$field['rows'] > 0 ? (int)$field['rows'] : 2?>"><?php if (isset($commandArguments['field_' . $fieldIndex])) : ?><?php echo htmlspecialchars($commandArguments['field_' . $fieldIndex])?><?php endif;?></textarea> | ||
<?php else : ?> | ||
<input type="text" name="field_<?php echo $fieldIndex?>" placeholder="<?php echo htmlspecialchars($field['placeholder'] ?? '')?>" class="form-control form-control-sm<?php if (isset($errors['field_'.$fieldIndex])) : ?> is-invalid<?php endif;?>" value="<?php if (isset($commandArguments['field_' . $fieldIndex])) : ?><?php echo htmlspecialchars($commandArguments['field_' . $fieldIndex])?><?php endif;?>" /> | ||
<?php endif; ?> | ||
</div> | ||
<?php endforeach; ?> | ||
|
||
<?php if (isset($commandExecution)) : ?> | ||
<script> | ||
lhinst.addmsgadmin(<?php echo $chat->id?>,<?php echo json_encode($commandExecution)?>); | ||
setTimeout(function(){$('#myModal').modal('hide');},2000); | ||
</script> | ||
<?php endif;?> | ||
|
||
<div class="d-flex align-items-center justify-content-center"> | ||
<button type="submit" name="ProcessCommand" <?php if (isset($commandExecution)) : ?>disabled="disabled"<?php endif;?> class="btn btn-primary btn-sm modal-submit-disable"><i class="material-icons">done</i><?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/adminchat','Accept')?></button> | ||
</div> | ||
|
||
</form> | ||
|
||
<?php include(erLhcoreClassDesign::designtpl('lhkernel/modal_footer.tpl.php'));?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.