Skip to content

Commit

Permalink
Separate XMPP and offline messages leaving as features for autoamted …
Browse files Browse the repository at this point in the history
…hosting
  • Loading branch information
remdex committed Apr 16, 2015
1 parent 5969126 commit ffe135e
Show file tree
Hide file tree
Showing 13 changed files with 52 additions and 4 deletions.
7 changes: 7 additions & 0 deletions lhc_web/design/defaulttheme/tpl/lhchat/offline_form.tpl.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
<?php include(erLhcoreClassDesign::designtpl('lhchat/part/offline_form_pre.tpl.php'));?>

<?php if ($chat_part_offline_form_enabled == true) : ?>
<p><b>
<?php if (isset($theme) && $theme !== false && $theme->noonline_operators_offline) : ?>
<?php echo htmlspecialchars($theme->noonline_operators_offline)?>
Expand Down Expand Up @@ -93,3 +96,7 @@
</form>
<?php endif;?>

<?php else : ?>
<?php include(erLhcoreClassDesign::designtpl('lhchat/part/offline_form_disabled.tpl.php'));?>
<?php endif;?>

Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
<?php include(erLhcoreClassDesign::designtpl('lhchat/part/offline_from_startchat_pre.tpl.php'));?>

<?php if ($chat_part_offline_form_start_chat_enabled == true) : ?>

<?php if (isset($request_send)) : $msg = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat','Your request was sent!');?>
<?php include(erLhcoreClassDesign::designtpl('lhkernel/alert_success.tpl.php'));?>
<?php else : ?>
Expand Down Expand Up @@ -76,4 +80,8 @@
<input type="hidden" value="1" name="StartChat"/>

</form>
<?php endif;?>

<?php else : ?>
<?php include(erLhcoreClassDesign::designtpl('lhchat/part/offline_form_startchat_disabled.tpl.php'));?>
<?php endif;?>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php
/**
* There can be some error message if offline form is disabled
* */
$errors = array('Offline form is disabled');
?>
<?php include(erLhcoreClassDesign::designtpl('lhkernel/validation_error.tpl.php'));?>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?php $chat_part_offline_form_enabled = true;?>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php
/**
* There can be some error message if offline form is disabled
* */
$errors = array('Offline form is disabled');
?>
<?php include(erLhcoreClassDesign::designtpl('lhkernel/validation_error.tpl.php'));?>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?php $chat_part_offline_form_start_chat_enabled = true;?>
10 changes: 9 additions & 1 deletion lhc_web/design/defaulttheme/tpl/lhdepartament/form.tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@
</div>

<div role="tabpanel" class="tab-pane" id="notifications">

<?php include(erLhcoreClassDesign::designtpl('lhdepartment/xmpp_enabled.tpl.php'));?>

<?php if ($department_xmpp_enabled == true) : ?>
<div class="row form-group">
<div class="col-xs-6">
<label><?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('department/edit','XMPP recipients');?></label>
Expand All @@ -90,10 +94,14 @@
<input type="text" class="form-control" placeholder="<?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('department/edit','E.g [email protected]/LiveChat');?>" title="<?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('department/edit','These messages will be send as group messages');?>" name="XMPPRecipientsGroup" value="<?php echo htmlspecialchars($departament->xmpp_group_recipients);?>" />
</div>
</div>
<?php endif;?>

<h4><?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('department/edit','Inform about new chats using');?></h4>

<?php if ($department_xmpp_enabled == true) : ?>
<label><input type="checkbox" name="inform_options[]" value="xmp" <?php if (in_array('xmp', $departament->inform_options_array)) : ?>checked="checked"<?php endif;?> /> <?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('department/edit','XMPP messages');?></label><br>
<?php endif;?>

<label><input type="checkbox" name="inform_options[]" value="mail" <?php if (in_array('mail', $departament->inform_options_array)) : ?>checked="checked"<?php endif;?> /> <?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('department/edit','Mail messages');?></label>

<div class="form-group">
Expand All @@ -108,7 +116,7 @@

<div class="form-group">
<h4><?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('department/edit','Inform then chat is accepted by one of the staff members using');?></h4>
<label><input type="checkbox" name="inform_options[]" value="xmp_accepted" <?php if (in_array('xmp_accepted', $departament->inform_options_array)) : ?>checked="checked"<?php endif;?> /> <?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('department/edit','XMPP messages');?></label>
<?php if ($department_xmpp_enabled == true) : ?><label><input type="checkbox" name="inform_options[]" value="xmp_accepted" <?php if (in_array('xmp_accepted', $departament->inform_options_array)) : ?>checked="checked"<?php endif;?> /> <?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('department/edit','XMPP messages');?></label><?php endif;?>
<label><input type="checkbox" name="inform_options[]" value="mail_accepted" <?php if (in_array('mail_accepted', $departament->inform_options_array)) : ?>checked="checked"<?php endif;?> /> <?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('department/edit','Mail messages');?></label>
</div>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?php $department_xmpp_enabled = true; ?>
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,7 @@

<?php endif; ?>

<?php if ($currentUser->hasAccessTo('lhxmp','configurexmp')) : ?>
<li><a href="<?php echo erLhcoreClassDesign::baseurl('xmp/configuration')?>"><?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('system/configuration','XMPP settings');?></a></li>
<?php endif; ?>
<?php include(erLhcoreClassDesign::designtpl('lhsystem/configuration_links/xmpp.tpl.php'));?>

<?php include(erLhcoreClassDesign::designtpl('lhsystem/configuration_links/chat_list.tpl.php'));?>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?php include(erLhcoreClassDesign::designtpl('lhsystem/configuration_links/xmpp_pre.tpl.php'));?>
<?php if ($system_configuration_links_xmpp_enabled == true && $currentUser->hasAccessTo('lhxmp','configurexmp')) : ?>
<li><a href="<?php echo erLhcoreClassDesign::baseurl('xmp/configuration')?>"><?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('system/configuration','XMPP settings');?></a></li>
<?php endif; ?>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?php $system_configuration_links_xmpp_enabled = true;?>
3 changes: 3 additions & 0 deletions lhc_web/lib/core/lhxmp/lhxmp.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,9 @@ public static function sendXMPMessage($chat, $params = array()) {

$data = (array) erLhcoreClassModelChatConfig::fetch('xmp_data')->data;

// Allows extension to override xmpp settings, let say disable it :)
erLhcoreClassChatEventDispatcher::getInstance()->dispatch('xml.send_xmp_message',array('params' => & $data));

$templateMessage = 'xmp_message';
if (isset($params['template'])) {
$templateMessage = $params['template'];
Expand Down
2 changes: 2 additions & 0 deletions lhc_web/modules/lhxmp/configuration.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

erLhcoreClassChatEventDispatcher::getInstance()->dispatch('xmp.configuration', array());

$tpl = erLhcoreClassTemplate::getInstance( 'lhxmp/xmp.tpl.php');

$xmpData = erLhcoreClassModelChatConfig::fetch('xmp_data');
Expand Down

0 comments on commit ffe135e

Please sign in to comment.