From fdf49570197da429fd34ba7d2409cf79c0401fdb Mon Sep 17 00:00:00 2001 From: Remdex Date: Wed, 8 Jul 2015 21:12:25 +0200 Subject: [PATCH] Devil is in details, fix #536 --- .../tpl/lhchat/chatwidget.tpl.php | 17 +++++++++-------- .../tpl/lhchat/offline_form.tpl.php | 18 +++++++++--------- .../tpl/lhchat/offline_form_startchat.tpl.php | 18 +++++++++--------- .../section_online_users_row.tpl.php | 1 - .../tpl/lhchat/part/accept_tos.tpl.php | 4 ++-- .../lhchat/part/admin_form_variables.tpl.php | 4 ++-- .../tpl/lhchat/part/user_variables.tpl.php | 4 ++-- .../defaulttheme/tpl/lhchat/startchat.tpl.php | 18 +++++++++--------- lhc_web/lib/core/lhchat/lhchatvalidator.php | 19 +++++++++---------- 9 files changed, 51 insertions(+), 52 deletions(-) diff --git a/lhc_web/design/defaulttheme/tpl/lhchat/chatwidget.tpl.php b/lhc_web/design/defaulttheme/tpl/lhchat/chatwidget.tpl.php index 748a1fe39c..816a507263 100644 --- a/lhc_web/design/defaulttheme/tpl/lhchat/chatwidget.tpl.php +++ b/lhc_web/design/defaulttheme/tpl/lhchat/chatwidget.tpl.php @@ -43,8 +43,8 @@ hattr)) : ?> -
- +
+
@@ -60,8 +60,8 @@ hattr)) : ?> -
- +
+
@@ -78,8 +78,8 @@ hattr)) : ?> -
- +
+
@@ -95,9 +95,10 @@ - - +
+ +
diff --git a/lhc_web/design/defaulttheme/tpl/lhchat/offline_form.tpl.php b/lhc_web/design/defaulttheme/tpl/lhchat/offline_form.tpl.php index 8b0c7e930b..4374fe2766 100644 --- a/lhc_web/design/defaulttheme/tpl/lhchat/offline_form.tpl.php +++ b/lhc_web/design/defaulttheme/tpl/lhchat/offline_form.tpl.php @@ -24,8 +24,8 @@ -
- +
+
@@ -33,8 +33,8 @@ -
- +
+
@@ -44,8 +44,8 @@ -
- +
+
@@ -53,7 +53,7 @@
- +
@@ -62,8 +62,8 @@ -
- +
+
diff --git a/lhc_web/design/defaulttheme/tpl/lhchat/offline_form_startchat.tpl.php b/lhc_web/design/defaulttheme/tpl/lhchat/offline_form_startchat.tpl.php index 8a09fb0497..de50455dd8 100644 --- a/lhc_web/design/defaulttheme/tpl/lhchat/offline_form_startchat.tpl.php +++ b/lhc_web/design/defaulttheme/tpl/lhchat/offline_form_startchat.tpl.php @@ -11,8 +11,8 @@ -
- +
+
@@ -21,8 +21,8 @@ -
- +
+
@@ -31,8 +31,8 @@ -
- +
+
@@ -40,7 +40,7 @@
- +
@@ -49,8 +49,8 @@ -
- +
+
diff --git a/lhc_web/design/defaulttheme/tpl/lhchat/onlineusers/section_online_users_row.tpl.php b/lhc_web/design/defaulttheme/tpl/lhchat/onlineusers/section_online_users_row.tpl.php index a81dc48bfe..67edec9ef1 100644 --- a/lhc_web/design/defaulttheme/tpl/lhchat/onlineusers/section_online_users_row.tpl.php +++ b/lhc_web/design/defaulttheme/tpl/lhchat/onlineusers/section_online_users_row.tpl.php @@ -24,7 +24,6 @@
- diff --git a/lhc_web/design/defaulttheme/tpl/lhchat/part/accept_tos.tpl.php b/lhc_web/design/defaulttheme/tpl/lhchat/part/accept_tos.tpl.php index 32d73e8da7..f1558e5a8c 100644 --- a/lhc_web/design/defaulttheme/tpl/lhchat/part/accept_tos.tpl.php +++ b/lhc_web/design/defaulttheme/tpl/lhchat/part/accept_tos.tpl.php @@ -1,5 +1,5 @@ -
- +
+
\ No newline at end of file diff --git a/lhc_web/design/defaulttheme/tpl/lhchat/part/admin_form_variables.tpl.php b/lhc_web/design/defaulttheme/tpl/lhchat/part/admin_form_variables.tpl.php index 679df6c99a..cf260acef6 100644 --- a/lhc_web/design/defaulttheme/tpl/lhchat/part/admin_form_variables.tpl.php +++ b/lhc_web/design/defaulttheme/tpl/lhchat/part/admin_form_variables.tpl.php @@ -7,8 +7,8 @@
-
- +
+
diff --git a/lhc_web/design/defaulttheme/tpl/lhchat/part/user_variables.tpl.php b/lhc_web/design/defaulttheme/tpl/lhchat/part/user_variables.tpl.php index e58edb739a..c7f93263ef 100644 --- a/lhc_web/design/defaulttheme/tpl/lhchat/part/user_variables.tpl.php +++ b/lhc_web/design/defaulttheme/tpl/lhchat/part/user_variables.tpl.php @@ -39,11 +39,11 @@ $showField = ($input_data->value_show[$key] == $modeUserVariables || $input_data->value_show[$key] == 'b'); $visibleItem = (isset($input_data->value_types[$key]) && $input_data->value_types[$key] == 'text' && isset($input_data->name_items[$key])); ?> + -
+
- diff --git a/lhc_web/design/defaulttheme/tpl/lhchat/startchat.tpl.php b/lhc_web/design/defaulttheme/tpl/lhchat/startchat.tpl.php index 11c1c984cb..2cce630753 100644 --- a/lhc_web/design/defaulttheme/tpl/lhchat/startchat.tpl.php +++ b/lhc_web/design/defaulttheme/tpl/lhchat/startchat.tpl.php @@ -25,10 +25,10 @@ hattr)) : ?> - + -
- +
+
@@ -42,8 +42,8 @@ hattr)) : ?> -
- +
+
@@ -58,8 +58,8 @@ hattr)) : ?> -
- +
+
@@ -74,8 +74,8 @@ -
- +
+
diff --git a/lhc_web/lib/core/lhchat/lhchatvalidator.php b/lhc_web/lib/core/lhchat/lhchatvalidator.php index 7c67a5f77e..2f3db6ea11 100644 --- a/lhc_web/lib/core/lhchat/lhchatvalidator.php +++ b/lhc_web/lib/core/lhchat/lhchatvalidator.php @@ -206,20 +206,20 @@ public static function validateStartChat(& $inputForm, & $start_data_fields, & $ if ( !$form->hasValidData( 'Username' ) || ($form->Username == '' && (($start_data_fields['name_require_option'] == 'required' && !isset($additionalParams['offline'])) || (isset($additionalParams['offline']) && isset($start_data_fields['offline_name_require_option']) && $start_data_fields['offline_name_require_option'] == 'required' ))) ) { - $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat','Please enter your name'); + $Errors['nick'] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat','Please enter your name'); } elseif ($form->hasValidData( 'Username' )) { $chat->nick = $inputForm->username = $form->Username; } if ($form->hasValidData( 'Username' ) && $form->Username != '' && strlen($form->Username) > 50) { - $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat','Maximum 50 characters'); + $Errors['nick'] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat','Maximum 50 characters'); } } if ( isset($validationFields['Email']) ) { if ( (!$form->hasValidData( 'Email' ) && $start_data_fields['email_require_option'] == 'required') || (!$form->hasValidData( 'Email' ) && isset($additionalParams['offline'])) ) { - $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat','Please enter a valid email address'); + $Errors['email'] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat','Please enter a valid email address'); } elseif ( $form->hasValidData( 'Email' ) ) { $chat->email = $inputForm->email = $form->Email; } else { @@ -231,20 +231,20 @@ public static function validateStartChat(& $inputForm, & $start_data_fields, & $ if (isset($validationFields['Question'])) { if ( !$form->hasValidData( 'Question' ) || (trim($form->Question) == '' && (($start_data_fields['message_require_option'] == 'required' && !isset($additionalParams['offline'])) || (isset($additionalParams['offline']) && isset($start_data_fields['offline_message_require_option']) && $start_data_fields['offline_message_require_option'] == 'required')))) { - $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat','Please enter your message'); + $Errors['question'] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat','Please enter your message'); } elseif ($form->hasValidData( 'Question' )) { $inputForm->question = trim($form->Question); } if ($form->hasValidData( 'Question' ) && trim($form->Question) != '' && strlen($form->Question) > (int)erLhcoreClassModelChatConfig::fetch('max_message_length')->current_value) { - $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat','Maximum').' '.(int)erLhcoreClassModelChatConfig::fetch('max_message_length')->current_value.' '.erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat','characters for a message'); + $Errors['question'] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat','Maximum').' '.(int)erLhcoreClassModelChatConfig::fetch('max_message_length')->current_value.' '.erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat','characters for a message'); } } if (isset($validationFields['AcceptTOS'])) { if ( !$form->hasValidData( 'AcceptTOS' ) || $form->AcceptTOS == false) { - $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat','You have to accept our Terms Of Service'); + $Errors['accept_tos'] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat','You have to accept our Terms Of Service'); } else { $inputForm->accept_tos = true; } @@ -262,7 +262,7 @@ public static function validateStartChat(& $inputForm, & $start_data_fields, & $ if ($form->hasValidData( 'Phone' ) && $form->Phone != '' && strlen($form->Phone) > 100) { - $Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat','Maximum 100 characters for phone'); + $Errors['phone'] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat','Maximum 100 characters for phone'); } } @@ -395,7 +395,7 @@ public static function validateStartChat(& $inputForm, & $start_data_fields, & $ foreach ($form->name_items as $key => $name_item) { if (isset($inputForm->values_req[$key]) && $inputForm->values_req[$key] == 't' && ($inputForm->value_show[$key] == 'b' || $inputForm->value_show[$key] == (isset($additionalParams['offline']) ? 'off' : 'on')) && (!isset($valuesArray[$key]) || trim($valuesArray[$key]) == '')) { - $Errors[] = trim($name_item).' : '.erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat','is required'); + $Errors['additional_'.$key] = trim($name_item).' : '.erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat','is required'); } $stringParts[] = array('key' => $name_item,'value' => (isset($valuesArray[$key]) ? trim($valuesArray[$key]) : '')); } @@ -416,7 +416,7 @@ public static function validateStartChat(& $inputForm, & $start_data_fields, & $ foreach ($customAdminfields as $key => $adminField) { if (isset($inputForm->value_items_admin[$key]) && isset($adminField['isrequired']) && $adminField['isrequired'] == 'true' && ($adminField['visibility'] == 'all' || $adminField['visibility'] == (isset($additionalParams['offline']) ? 'off' : 'on')) && (!isset($valuesArray[$key]) || trim($valuesArray[$key]) == '')) { - $Errors[] = trim($adminField['fieldname']).': '.erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat','is required'); + $Errors['additional_admin_'.$key] = trim($adminField['fieldname']).': '.erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat','is required'); } if (isset($valuesArray[$key]) && $valuesArray[$key] != '') { @@ -429,7 +429,6 @@ public static function validateStartChat(& $inputForm, & $start_data_fields, & $ if (!empty($stringParts)) { $chat->additional_data = json_encode($stringParts); } - erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.validate_start_chat',array('errors' => & $Errors, 'input_form' => & $inputForm, 'start_data_fields' => & $start_data_fields, 'chat' => & $chat,'additional_params' => & $additionalParams));