Skip to content

Commit

Permalink
Master 435 (#2080)
Browse files Browse the repository at this point in the history
1. Audit log was recoding errors in incorrect time zone.
2. Subjects now can be pinned and be shown on Pending/Bot/Active/My Chats widgets chats
3. Incoming webhook fixes for base64decode files
4. Department stats were missing if department group was not used.
5. Audit log now has an export function.
6. Audit log time filter was fixed.

execute doc/update_db/update_306.sql for update
  • Loading branch information
remdex committed Apr 9, 2024
1 parent e8f38a7 commit 9ecac84
Show file tree
Hide file tree
Showing 34 changed files with 323 additions and 40 deletions.
12 changes: 11 additions & 1 deletion lhc_web/design/defaulttheme/css/app.css
Expand Up @@ -2460,4 +2460,14 @@ html {

#full-online-visitors .panel-list{
max-height: inherit!important;
}
}

.subject-custom .color {
display: inline-block;
width: 14px;
height: 14px;
margin-top: -1px;
margin-right: 2px;
vertical-align: middle;
border-radius: 7px;
}

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lhc_web/design/defaulttheme/js/svelte/public/build/main.js

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Expand Up @@ -372,6 +372,7 @@
<span><img src={www_dir_flags + "/" + chat.country_code + ".png"} alt={chat.country_name} title={chat.country_name} /></span>
{/if}


{#each custom_icons as iconData}
{#if iconData.icon_attr_type == 'bool' || iconData.icon_attr_type == 'cmp'}
{#if (
Expand Down Expand Up @@ -492,6 +493,12 @@
{chat.nick ? chat.nick : ''}<small>{(type == 'pending_chats' || type == 'subject_chats') && chat.plain_user_name !== undefined ? ' | ' + chat.plain_user_name : ''}</small>
{/if}

{#if chat.subject_list && (type == 'pending_chats' || type == 'bot_chats' || type == 'active_chats' || type == 'my_chats')}
{#each chat.subject_list as subjectitem}
<span class="badge bg-info fs12 me-1" style:background-color|important={subjectitem.c ? '#'+subjectitem.c : null}>{subjectitem.n}</span>
{/each}
{/if}

{/if}

</div>
Expand All @@ -515,7 +522,7 @@
<td>
{#if chat.subject_list}
{#each chat.subject_list as subjectitem}
<span class="badge bg-info fs12 me-1" >{subjectitem}</span>
<span class="badge bg-info fs12 me-1" style:background-color|important={subjectitem.c ? '#'+subjectitem.c : null}>{subjectitem.n}</span>
{/each}
{/if}
</td>
Expand Down
23 changes: 23 additions & 0 deletions lhc_web/design/defaulttheme/tpl/lhabstract/custom/subject.tpl.php
Expand Up @@ -9,6 +9,29 @@
<?php echo erLhcoreClassAbstract::renderInput('name', $fields['name'], $object)?>
</div>

<div class="form-group">
<label><?php echo $fields['color']['trans'];?></label>
<?php echo erLhcoreClassAbstract::renderInput('color', $fields['color'], $object)?>
</div>

<div class="form-group">
<label class="mb-0"><?php echo erLhcoreClassAbstract::renderInput('pinned', $fields['pinned'], $object)?> <?php echo $fields['pinned']['trans'];?></label>
<p><small><i><?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/subject','Will appear as very first items to select for the subject');?></i></small></p>
</div>

<div class="form-group">
<label class="mb-0"><?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('abstract/chatsubject','Choose in what widgets this subject will be visible directly');?></label>
<div class="row">
<div class="col-6"><label><input type="checkbox" <?php if ($object->widgets & 1) : ?>checked="checked"<?php endif; ?> name="widgets[]" value="1"> Pending chat</label></div>
<div class="col-6"><label><input type="checkbox" <?php if ($object->widgets & 2) : ?>checked="checked"<?php endif; ?> name="widgets[]" value="2"> Active chat</label></div>
<div class="col-6"><label><input type="checkbox" <?php if ($object->widgets & 4) : ?>checked="checked"<?php endif; ?> name="widgets[]" value="4"> Bot chats</label></div>
<div class="col-6"><label><input type="checkbox" <?php if ($object->widgets & 8) : ?>checked="checked"<?php endif; ?> name="widgets[]" value="8"> My active pending chats</label></div>
<?php /*<div class="col-6"><label><input type="checkbox" <?php if ($object->widgets & 16) : ?>checked="checked"<?php endif; ?> name="widgets[]" value="16"> Active mails</label></div>
<div class="col-6"><label><input type="checkbox" <?php if ($object->widgets & 32) : ?>checked="checked"<?php endif; ?> name="widgets[]" value="32"> New mails</label></div>*/ ?>
</div>
</div>
<hr>

<div class="form-group">
<label class="mb-0"><?php echo erLhcoreClassAbstract::renderInput('internal', $fields['internal'], $object)?>&nbsp;<?php echo $fields['internal']['trans'];?></label>
<?php include(erLhcoreClassDesign::designtpl('lhabstract/custom/subject/internal_explain.tpl.php'));?>
Expand Down
Expand Up @@ -125,6 +125,7 @@
<option value="incoming_webhook_parse">Incoming webhook parse failures</option>
<option value="incoming_webhook">Incoming webhook request</option>
<option value="extract_department">Invalid department argument</option>
<option value="text_msg">Text message, logged from bot</option>
<?php include(erLhcoreClassDesign::designtpl('lhabstract/filter/audit/category_list_multiinclude.tpl.php'));?>
</datalist>
</div>
Expand All @@ -149,8 +150,10 @@
</div>

<div class="col-md-12">
<div class="form-group">
<input type="submit" class="btn btn-sm btn-secondary" value="<?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/lists/search_panel','Search');?>" name="doSearch">&nbsp;<input type="button" onclick="lhc.revealModal({'url':WWW_DIR_JAVASCRIPT+'genericbot/help/cannedreplacerules'});" class="btn btn-sm btn-secondary" value="<?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/lists/search_panel','Debug chat attributes');?>" name="debugChat">
<div class="btn-group">
<button type="submit" class="btn btn-sm btn-primary" name="doSearch"><span class="material-icons">search</span><?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/lists/search_panel','Search');?></button>
<button type="button" onclick="lhc.revealModal({'url':WWW_DIR_JAVASCRIPT+'genericbot/help/cannedreplacerules'});" class="btn btn-outline-secondary btn-sm" name="debugChat"><span class="material-icons">code</span><?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/lists/search_panel','Debug chat attributes');?></button>
<button type="submit" class="btn btn-outline-secondary btn-sm" name="doExport"><span class="material-icons">file_download</span><?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/lists/search_panel','Export');?></button>
</div>
</div>
</div>
Expand Down
Expand Up @@ -7,7 +7,7 @@
</h6>

<?php $subjectsChat = erLhAbstractModelSubjectChat::getList(array('filter' => array('chat_id' => $chat->id)));
foreach ($subjectsChat as $subject) : ?><button class="btn btn-xs btn-outline-info"><?php echo htmlspecialchars($subject)?></button>&nbsp;<?php endforeach; ?>
foreach ($subjectsChat as $subject) : ?><span class="badge bg-info fs12" <?php if (is_object($subject->subject) && $subject->subject->color != '') : ?>style="background-color:#<?php echo htmlspecialchars($subject->subject->color)?>!important;" <?php endif;?> ><?php echo htmlspecialchars($subject)?></span>&nbsp;<?php endforeach; ?>

<?php foreach($chat->aicons as $aicon) : ?>
<span class="material-icons" title="<?php print isset($aicon['t']) ? htmlspecialchars($aicon['t']) : htmlspecialchars($aicon['i'])?>" <?php if (isset($aicon['c']) && $aicon['c'] != '') : ?>style="color:<?php echo htmlspecialchars($aicon['c'])?>"<?php endif; ?> ><?php echo htmlspecialchars(is_array($aicon) && isset($aicon['i']) ? $aicon['i'] : $aicon)?></span>
Expand Down
3 changes: 1 addition & 2 deletions lhc_web/design/defaulttheme/tpl/lhchat/lists.tpl.php
Expand Up @@ -84,10 +84,9 @@
$seconds = ($diff - ($hours * 3600) - ($minits * 60));
?> | <b><?php echo $hours?> <?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/syncadmininterface','h.');?> <?php echo $minits ?> <?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/syncadmininterface','m.');?> <?php echo $seconds?> <?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/syncadmininterface','s.');?> <?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/syncadmininterface','ago');?>.</b>
<?php endif;?>

<?php if (is_array($chat->subjects)) : ?>
<?php foreach ($chat->subjects as $subject) : ?>
<span class="badge bg-info mx-1"><?php echo htmlspecialchars($subject)?></span>
<span class="badge bg-info mx-1" <?php if ($subject->color != '') : ?>style="background-color:#<?php echo htmlspecialchars($subject->color)?>!important;" <?php endif;?>><?php echo htmlspecialchars($subject)?></span>
<?php endforeach; ?>
<?php endif; ?>
</td>
Expand Down
28 changes: 24 additions & 4 deletions lhc_web/design/defaulttheme/tpl/lhchat/subject.tpl.php
@@ -1,9 +1,10 @@
<?php $modalHeaderTitle = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/subject','Set a subject')?>
<?php include(erLhcoreClassDesign::designtpl('lhkernel/modal_header.tpl.php'));?>

<div role="alert" class="alert alert-info alert-dismissible fade show">
<div role="alert" class="alert alert-info alert-dismissible m-0 mb-2 p-1 fade show">
<div id="subject-message-<?php echo $chat->id?>"><?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/subject','Choose a subject')?></div>
</div>

<?php
$subjects = erLhAbstractModelSubjectDepartment::getList(array(
'limit' => false,
Expand All @@ -17,11 +18,30 @@
foreach ($subjectsChat as $subject) {
$selectedSubjects[] = $subject->subject_id;
}
$hasPinned = false;
foreach ($subjects as $subject) {
if ($subject->subject->pinned == 1) {
$hasPinned = true;
break;
}
}
?>

<?php if ($hasPinned) : ?>
<h5><?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/subject','Pinned')?></h5>
<div class="row">
<?php foreach($subjects as $subject) : ?>
<?php if ($subject->subject->pinned == 1) : ?>
<div class="col-3"><label <?php if ($subject->subject->color != '') : ?> class="subject-custom"<?php endif;?> ><input type="checkbox" onchange="lhinst.setSubject($(this),<?php echo $chat->id?>)" name="subject" value="<?php echo $subject->subject_id?>" <?php if (in_array($subject->subject_id,$selectedSubjects)) : ?>checked="checked"<?php endif?> >&nbsp;<?php if ($subject->subject->color != '') : ?><span class="color" style="margin-top:-3px;background-color:#<?php echo $subject->subject->color?>"></span><?php endif;?><?php echo htmlspecialchars($subject)?></label></div>
<?php endif; endforeach; ?>
</div>
<hr>
<h5><?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/subject','Standard')?></h5>
<?php endif; ?>
<div class="row">
<?php foreach($subjects as $subject) : ?>
<div class="col-3"><label><input type="checkbox" onchange="lhinst.setSubject($(this),<?php echo $chat->id?>)" name="subject" value="<?php echo $subject->subject_id?>" <?php if (in_array($subject->subject_id,$selectedSubjects)) : ?>checked="checked"<?php endif?> >&nbsp;<?php echo htmlspecialchars($subject)?></label></div>
<?php endforeach; ?>
<?php foreach($subjects as $subject) : if ($subject->subject->pinned == 0) : ?>
<div class="col-3"><label <?php if ($subject->subject->color != '') : ?> class="subject-custom"<?php endif;?> ><input type="checkbox" onchange="lhinst.setSubject($(this),<?php echo $chat->id?>)" name="subject" value="<?php echo $subject->subject_id?>" <?php if (in_array($subject->subject_id,$selectedSubjects)) : ?>checked="checked"<?php endif?> >&nbsp;<?php if ($subject->subject->color != '') : ?><span class="color" style="margin-top:-3px;background-color:#<?php echo $subject->subject->color?>"></span><?php endif;?><?php echo htmlspecialchars($subject)?></label></div>
<?php endif; endforeach; ?>
</div>

<?php include(erLhcoreClassDesign::designtpl('lhkernel/modal_footer.tpl.php'));?>
Expand Up @@ -13,6 +13,7 @@
<table class="table" cellpadding="0" cellspacing="0" width="100%" ng-non-bindable>
<thead>
<tr>
<th nowrap="nowrap"><?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('webhooks/module','Name');?></th>
<th nowrap="nowrap"><?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('webhooks/module','Event');?></th>
<th nowrap="nowrap"><?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('webhooks/module','Bot');?></th>
<th nowrap="nowrap"><?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('webhooks/module','Trigger');?></th>
Expand All @@ -23,6 +24,7 @@
</thead>
<?php foreach ($items as $item) : ?>
<tr>
<td><?php echo htmlspecialchars($item->name)?></td>
<td nowrap="nowrap">
<?php if ($item->type == 0) : ?>
<?php echo htmlspecialchars($item->event)?>
Expand Down
5 changes: 5 additions & 0 deletions lhc_web/design/defaulttheme/tpl/lhwebhooks/form.tpl.php
@@ -1,3 +1,8 @@
<div class="form-group" ng-non-bindable>
<label><?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/webhooks','Name');?></label>
<input maxlength="50" type="text" class="form-control form-control-sm" placeholder="<?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/webhooks','Name for personal reasons');?>" name="name" value="<?php echo htmlspecialchars($item->name);?>" />
</div>

<ul class="nav nav-tabs mb-3" role="tablist">
<li role="presentation" class="nav-item"><a href="#hooks-settings" class="nav-link active" aria-controls="hooks-settings" role="tab" data-bs-toggle="tab" aria-selected="false"><?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/webhooks','Hooks events')?></a></li>
<li role="presentation" class="nav-item"><a class="nav-link" href="#chooks-settings" aria-controls="chooks-settings" role="tab" data-bs-toggle="tab" aria-selected="true"><?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/webhooks','Continuous chat events')?></a></li>
Expand Down
11 changes: 11 additions & 0 deletions lhc_web/doc/CHANGELOG.txt
@@ -1,3 +1,14 @@
4.35v

1. Audit log was recoding errors in incorrect time zone.
2. Subjects now can be pinned and be shown on Pending/Bot/Active/My Chats widgets chats
3. Incoming webhook fixes for base64decode files
4. Department stats were missing if department group was not used.
5. Audit log now has an export function.
6. Audit log time filter was fixed.

execute doc/update_db/update_306.sql for update

4.34v

1. Notification for assigned pending chat was missing.
Expand Down

0 comments on commit 9ecac84

Please sign in to comment.