update v1.0.7.9.1 R.C.

This commit is contained in:
Sujit Prasad
2016-08-19 15:08:43 +05:30
parent bda543a3a2
commit a54df4d919
15 changed files with 357 additions and 233 deletions

View File

@@ -182,7 +182,7 @@ class MailController extends Controller
$form_data = null;
$team_assign = null;
$ticket_status = null;
$result = $this->TicketWorkflowController->workflow($fromaddress, $fromname, $subject, $body, $phone, $phonecode, $mobile_number, $helptopic, $sla, $priority, $source, $collaborator, $dept, $assign, $team_assign, $ticket_status, $form_data, $auto_response);
$result = $this->TicketWorkflowController->workflow($fromaddress, $fromname, $subject, $body, $phone, $phonecode, $mobile_number, $helptopic, $sla, $priority, $source, $collaborator, $dept, $assign, $team_assign, $ticket_status, $form_data, $auto_response, $mail->getAttachments());
if ($result[1] == true) {
$ticket_table = Tickets::where('ticket_number', '=', $result[0])->first();

View File

@@ -316,8 +316,10 @@ class TicketController extends Controller
}
}
}
// this param is used for inline attachments via email
$inline_attachment = null;
//create user
if ($this->create_user($email, $fullname, $subject, $body, $phone, $phonecode, $mobile_number, $helptopic, $sla, $priority, $source->id, $headers, $help->department, $assignto, $form_data, $auto_response, $status)) {
if ($this->create_user($email, $fullname, $subject, $body, $phone, $phonecode, $mobile_number, $helptopic, $sla, $priority, $source->id, $headers, $help->department, $assignto, $form_data, $auto_response, $status, $inline_attachment)) {
return Redirect('newticket')->with('success', Lang::get('lang.Ticket-created-successfully'));
} else {
return Redirect('newticket')->with('fails', 'fails');
@@ -647,7 +649,7 @@ class TicketController extends Controller
*
* @return type bool
*/
public function create_user($emailadd, $username, $subject, $body, $phone, $phonecode, $mobile_number, $helptopic, $sla, $priority, $source, $headers, $dept, $assignto, $from_data, $auto_response, $status)
public function create_user($emailadd, $username, $subject, $body, $phone, $phonecode, $mobile_number, $helptopic, $sla, $priority, $source, $headers, $dept, $assignto, $from_data, $auto_response, $status, $mail_data)
{
// define global variables
$email;
@@ -721,7 +723,7 @@ class TicketController extends Controller
$body2 = null;
try {
if ($auto_response == 0) {
$this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('0', $ticketdata->dept_id), $to = ['name' => $username, 'email' => $emailadd], $message = ['subject' => $updated_subject, 'scenario' => 'create-ticket'], $template_variables = ['user' => $user->first_name, 'ticket_number' => $ticket_number2, 'department_sign' => '']);
$this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('0', $ticketdata->dept_id), $to = ['name' => $username, 'email' => $emailadd], $message = ['subject' => $updated_subject, 'scenario' => 'create-ticket'], $template_variables = ['user' => $username, 'ticket_number' => $ticket_number2, 'department_sign' => '']);
}
} catch (\Exception $e) {
}
@@ -770,7 +772,7 @@ class TicketController extends Controller
$emails_to_be_sent = array_unique($set_mails, SORT_REGULAR);
foreach ($emails_to_be_sent as $email_data) {
try {
$this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('0', $ticketdata->dept_id), $to = ['user' => $email_data['to_user'], 'email' => $email_data['to_email']], $message = ['subject' => $updated_subject, 'body' => $body, 'scenario' => $mail], $template_variables = ['ticket_agent_name' => $email_data['to_user_name'], 'ticket_client_name' => $username, 'ticket_client_email' => $emailadd, 'user' => $email_data['to_user_name'], 'ticket_number' => $ticket_number2, 'email_address' => $emailadd, 'name' => $ticket_creator]);
$this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('0', $ticketdata->dept_id), $to = ['user' => $email_data['to_user'], 'email' => $email_data['to_email']], $message = ['subject' => $updated_subject, 'body' => $body, 'scenario' => $mail, 'add_embedded_image' => $mail_data], $template_variables = ['ticket_agent_name' => $email_data['to_user_name'], 'ticket_client_name' => $username, 'ticket_client_email' => $emailadd, 'user' => $email_data['to_user_name'], 'ticket_number' => $ticket_number2, 'email_address' => $emailadd, 'name' => $ticket_creator]);
} catch (\Exception $e) {
}
}

View File

@@ -40,7 +40,7 @@ class TicketWorkflowController extends Controller
*
* @return type response
*/
public function workflow($fromaddress, $fromname, $subject, $body, $phone, $phonecode, $mobile_number, $helptopic, $sla, $priority, $source, $collaborator, $dept, $assign, $team_assign, $ticket_status, $form_data, $auto_response)
public function workflow($fromaddress, $fromname, $subject, $body, $phone, $phonecode, $mobile_number, $helptopic, $sla, $priority, $source, $collaborator, $dept, $assign, $team_assign, $ticket_status, $form_data, $auto_response, $mail)
{
$contact_details = ['email' => $fromaddress, 'email_name' => $fromname, 'subject' => $subject, 'message' => $body];
$ticket_settings_details = ['help_topic' => $helptopic, 'sla' => $sla, 'priority' => $priority, 'source' => $source, 'dept' => $dept, 'assign' => $assign, 'team' => $team_assign, 'status' => $ticket_status, 'reject' => false];
@@ -169,7 +169,7 @@ class TicketWorkflowController extends Controller
if ($ticket_settings_details['reject'] == true) {
return ['0' => false, '1' => false];
} else {
$create_ticket = $this->TicketController->create_user($contact_details['email'], $contact_details['email_name'], $contact_details['subject'], $contact_details['message'], $phone, $phonecode, $mobile_number, $ticket_settings_details['help_topic'], $ticket_settings_details['sla'], $ticket_settings_details['priority'], $source, $collaborator, $ticket_settings_details['dept'], $ticket_settings_details['assign'], $form_data, $auto_response, $ticket_settings_details['status']);
$create_ticket = $this->TicketController->create_user($contact_details['email'], $contact_details['email_name'], $contact_details['subject'], $contact_details['message'], $phone, $phonecode, $mobile_number, $ticket_settings_details['help_topic'], $ticket_settings_details['sla'], $ticket_settings_details['priority'], $source, $collaborator, $ticket_settings_details['dept'], $ticket_settings_details['assign'], $form_data, $auto_response, $ticket_settings_details['status'], $mail);
return $create_ticket;
}

View File

@@ -84,8 +84,9 @@ class ClientTicketController extends Controller
$ticket_status = null;
$auto_response = 0;
$this->TicketWorkflowController->workflow($fromaddress, $fromname, $subject, $body, $phone, $phonecode, $mobile_number, $helptopic, $sla, $priority, $source, $collaborator, $dept, $assign, $team_assign, $ticket_status, $form_data, $auto_response);
$inline_attachment = null;
$this->TicketWorkflowController->workflow($fromaddress, $fromname, $subject, $body, $phone, $phonecode, $mobile_number, $helptopic, $sla, $priority, $source, $collaborator, $dept, $assign, $team_assign, $ticket_status, $form_data, $auto_response, $inline_attachment);
return \Redirect::back()->with('success1', Lang::get('lang.successfully_replied'));
}
}

View File

@@ -5,6 +5,7 @@ namespace App\Http\Controllers\Client\helpdesk;
// controllers
use App\Http\Controllers\Agent\helpdesk\TicketWorkflowController;
use App\Http\Controllers\Controller;
use App\Http\Controllers\Common\FileuploadController;
// requests
use App\Http\Requests\helpdesk\ClientRequest;
use App\Model\helpdesk\Agent\Department;
@@ -70,8 +71,11 @@ class FormController extends Controller
} else {
$phonecode = '';
}
return view('themes.default1.client.helpdesk.form', compact('topics', 'codes'))->with('phonecode', $phonecode);
$fileupload = new FileuploadController();
$fileupload = $fileupload->file_upload_max_size();
$max_size_in_bytes = $fileupload[0];
$max_size_in_actual = $fileupload[1];
return view('themes.default1.client.helpdesk.form', compact('topics', 'codes', 'max_size_in_bytes', 'max_size_in_actual'))->with('phonecode', $phonecode);
} else {
return \Redirect::route('home');
}
@@ -189,7 +193,13 @@ class FormController extends Controller
}
}
}
$result = $this->TicketWorkflowController->workflow($email, $name, $subject, $details, $phone, $phonecode, $mobile_number, $helptopic, $sla, $priority, $source, $collaborator, $department, $assignto, $team_assign, $status, $form_extras, $auto_response);
// this param is used for inline attachments via email
if(empty($attachments)) {
$inline_attachment = $attachments;
} else {
$inline_attachment = null;
}
$result = $this->TicketWorkflowController->workflow($email, $name, $subject, $details, $phone, $phonecode, $mobile_number, $helptopic, $sla, $priority, $source, $collaborator, $department, $assignto, $team_assign, $status, $form_extras, $auto_response, $inline_attachment);
if ($result[1] == 1) {
$ticketId = Tickets::where('ticket_number', '=', $result[0])->first();

View File

@@ -9,9 +9,9 @@ class FileuploadController extends Controller
public function __construct()
{
// checking authentication
$this->middleware('auth');
// $this->middleware('auth');
// checking if role is agent
$this->middleware('role.agent');
// $this->middleware('role.agent');
}
// Returns a file size limit in bytes based on the PHP upload_max_filesize

View File

@@ -84,6 +84,13 @@ class PhpMailController extends Controller
$attachment = null;
}
// Inline Attachments
if (isset($message['add_embedded_image'])) {
$add_embedded_images = $message['add_embedded_image'];
} else {
$add_embedded_images = null;
}
// template variables
if (Auth::user()) {
$agent = Auth::user()->user_name;
@@ -265,6 +272,40 @@ class PhpMailController extends Controller
$mail->addAttachment($file_path, $file_name);
}
}
// inline images embedded as attachments
if ($add_embedded_images != null) {
// dd($add_embedded_images);
foreach ($add_embedded_images as $add_embedded_image) {
if(isset($add_embedded_image->id)) {
$cid = $add_embedded_image->id;
} else {
$cid = null;
}
if(isset($add_embedded_image->name)) {
$file_name = $add_embedded_image->name;
} else {
$file_name = null;
}
if(isset($add_embedded_image->filePath)) {
$file_path = $add_embedded_image->filePath;
} else {
$file_path = null;
}
if(isset($add_embedded_image->disposition)) {
if($add_embedded_image->disposition == 'INLINE') {
$mail->AddEmbeddedImage($file_path, $cid, $file_name);
} else {
$mail->addAttachment($file_path, $file_name);
}
} else {
$file_path = $add_embedded_image->getRealPath();
$file_name = $add_embedded_image->getClientOriginalName();
$mail->addAttachment($file_path, $file_name);
}
}
}
$mail->CharSet = 'utf8';
$mail->Subject = $subject;
if ($template == 'ticket-reply-agent') {

View File

@@ -2,9 +2,10 @@
namespace App\Model\helpdesk\Ticket;
use App\BaseModel;
//use App\BaseModel;
use Illuminate\Database\Eloquent\Model;
class Ticket_Thread extends BaseModel
class Ticket_Thread extends Model
{
protected $table = 'ticket_thread';
protected $fillable = [

View File

@@ -0,0 +1,7 @@
include.path=${php.global.include.path}
php.version=PHP_55
source.encoding=UTF-8
src.dir=.
tags.asp=false
tags.short=false
web.root=.

9
nbproject/project.xml Normal file
View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.php.project</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/php-project/1">
<name>faveo helpdesk master</name>
</data>
</configuration>
</project>

View File

@@ -1395,4 +1395,11 @@ return [
'reopen' => 'Reopen',
'invalid_attempt' => 'Invalid Attempt',
/**--------------------------------------------------------------------------------------------
* Attachment Updated
* --------------------------------------------------------------------------------------------
*/
'unable_to_load_file_type' => 'Unable to load file type',
];

View File

@@ -75,7 +75,6 @@ $group = App\Model\helpdesk\Agent\Groups::where('id', '=', $agent_group)->where(
if ($rating_value == null) {
$avg_rating = '0';
} else {
$avg_rate = explode('.', $rating_value);
$avg_rating = $avg_rate[0];
}
@@ -109,7 +108,6 @@ if ($thread->title != "") {
<!-- <button type="button" class="btn btn-default"><i class="fa fa-edit" style="color:green;"> </i> Edit</button> -->
<?php
Event::fire(new \App\Events\TicketBoxHeader($user->id));
if ($group->can_edit_ticket == 1) {
?>
<button type="button" class="btn btn-default" id="Edit_Ticket" data-toggle="modal" data-target="#Edit"><i class="fa fa-edit" style="color:green;"> </i> {!! Lang::get('lang.edit') !!}</button>
@@ -444,7 +442,7 @@ if ($thread->title != "") {
<div class="form-group">
<div class="row">
<!-- internal note -->
<div class="form-group {{ $errors->has('title') ? 'has-error' : '' }}" id="internal_content_class">
<div class="form-group {{ $errors->has('title') ? 'has-error' : '' }}">
<div class="col-md-2">
<label>{!! Lang::get('lang.internal_note') !!}:<span class="text-red"> *</span></label>
</div>
@@ -507,7 +505,6 @@ if ($thread->title != "") {
<?php
$ConvDate1 = $conversation->created_at;
$ConvDate = explode(' ', $ConvDate1);
$date = $ConvDate[0];
$time = $ConvDate[1];
$time = substr($time, 0, -3);
@@ -555,11 +552,13 @@ if ($thread->title != "") {
// echo "<img src='".base64_decode($attachment->file)."' style='width:128px;height:128px'/> ";
$body = $conversation->body;
$attachments = App\Model\helpdesk\Ticket\Ticket_attachments::where('thread_id', '=', $conversation->id)->orderBy('id', 'DESC')->get();
// $i = 0;
foreach ($attachments as $attachment) {
// $i++;
if ($attachment->type == 'jpg' || $attachment->type == 'png') {
if ($attachment->type == 'jpg' || $attachment->type == 'png' || $attachment->type == 'PNG' || $attachment->type == 'JPG' || $attachment->type == 'jpeg' || $attachment->type == 'JPEG' || $attachment->type == 'gif' || $attachment->type == 'GIF') {
if($attachment->size > 0) {
$image = @imagecreatefromstring($attachment->file);
if($image == false) {
} else {
ob_start();
imagejpeg($image, null, 80);
$data = ob_get_contents();
@@ -569,7 +568,6 @@ if ($thread->title != "") {
// echo $attachment->name;
// $body = explode($attachment->name, $body);
$body = str_replace($attachment->name, "data:image/" . $attachment->type . ";base64," . base64_encode($data), $body);
$string = $body;
$start = "<head>";
$end = "</head>";
@@ -583,6 +581,9 @@ if ($thread->title != "") {
$body2 = $parsed;
$body = str_replace($body2, " ", $body);
}
}
}
} else {
}
}
@@ -619,9 +620,6 @@ if ($thread->title != "") {
?>
<div class="timeline-item">
<span style="color:#fff;"><div class="pull-right"> <table><tbody>
@if($role)
@if($role->role != null)
@if($role->role != 'user' && $conversation->is_internal != 1)
@foreach($ratings as $rating)
@if($rating->rating_area == 'Comment Area')
<?php
@@ -642,9 +640,6 @@ if ($thread->title != "") {
</tr>
@endif
@endforeach
@endif
@endif
@endif
</tbody></table></div>
</span>
<h3 class="timeline-header">
@@ -723,6 +718,7 @@ if ($thread->title != "") {
<ul class='mailbox-attachments clearfix'>
<?php
foreach ($attachments as $attachment) {
$size = $attachment->size;
$units = array('B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB');
$power = $size > 0 ? floor(log($size, 1024)) : 0;
@@ -730,17 +726,24 @@ if ($thread->title != "") {
if ($attachment->poster == 'ATTACHMENT') {
if ($attachment->type == 'jpg' || $attachment->type == 'JPG' || $attachment->type == 'jpeg' || $attachment->type == 'JPEG' || $attachment->type == 'png' || $attachment->type == 'PNG' || $attachment->type == 'gif' || $attachment->type == 'GIF') {
$image = @imagecreatefromstring($attachment->file);
if($image == false) {
$var = '<a style="max-width:200px;height:133px;color:#666;" href="' . URL::route('image', array('image_id' => $attachment->id)) . '" target="_blank"><span class="mailbox-attachment-icon" style="background-color:#fff;">' . strtoupper($attachment->type) . '</span><div class="mailbox-attachment-info"><span ><b style="word-wrap: break-word;">' . $attachment->name . '</b><br/><p>' . $value . '</p></span></div></a>';
echo '<li style="background-color:#f4f4f4;">' . $var . '</li>';
} else {
ob_start();
imagejpeg($image, null, 80);
$data = ob_get_contents();
ob_end_clean();
$var = '<a href="' . URL::route('image', array('image_id' => $attachment->id)) . '" target="_blank"><img style="max-width:200px;height:133px;" src="data:image/jpg;base64,' . base64_encode($data) . '"/></a>';
echo '<li style="background-color:#f4f4f4;"><span class="mailbox-attachment-icon has-img">' . $var . '</span><div class="mailbox-attachment-info"><b style="word-wrap: break-word;">' . $attachment->name . '</b><br/><p>' . $value . '</p></div></li>';
}
} else {
$var = '<a style="max-width:200px;height:133px;color:#666;" href="' . URL::route('image', array('image_id' => $attachment->id)) . '" target="_blank"><span class="mailbox-attachment-icon" style="background-color:#fff;">' . strtoupper($attachment->type) . '</span><div class="mailbox-attachment-info"><span ><b style="word-wrap: break-word;">' . $attachment->name . '</b><br/><p>' . $value . '</p></span></div></a>';
echo '<li style="background-color:#f4f4f4;">' . $var . '</li>';
}
}
}
?>
</ul>
@@ -1083,7 +1086,6 @@ if ($thread->title != "") {
<div class="tab-pane active" id="ahah">
<div class="modal-body" id="def">
<div class="callout callout-info" id="hide1234" ><i class="icon fa fa-info"> </i>&nbsp;&nbsp;&nbsp; {!! Lang::get('lang.search_existing_users_or_add_new_users') !!}</div>
<div id="here"></div>
<div id="show7" style="display:none;">
<div class="row col-md-12">
<div class="col-xs-5">
@@ -1095,7 +1097,7 @@ if ($thread->title != "") {
</div>
</div>
</div>
<div id="here"></div>
{!! Form::model($tickets->id, ['id'=>'search-user','method' => 'PATCH'] )!!}
<script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
<input type="text" class="form-control" name="search" id="tags" placeholder="{!! Lang::get('lang.search_by_email') !!}">
@@ -1309,7 +1311,6 @@ if ($thread->title != "") {
// $('#cand').wysihtml5();
var wysihtml5Editor = $('#reply_content').wysihtml5().data("wysihtml5").editor;
$('#select').on('change', function (e) {
//alert('hello2');
var $_token = $('#token').val();
var data = $('#select').val();
@@ -1323,7 +1324,6 @@ if ($thread->title != "") {
dataType : 'json',
data : ({data}),
success : function(response) {
// alert(response);
wysihtml5Editor.setValue(response, true);
console.log(wysihtml5Editor.getValue());
@@ -1348,7 +1348,6 @@ if ($thread->title != "") {
$("#loader").show();
},
success: function (response) {
$("#refresh").load("../thread/{{$tickets->id}} #refresh");
$("#refresh").show();
$("#loader").hide();
@@ -1362,7 +1361,6 @@ if ($thread->title != "") {
});
});
$(document).ready(function () {
//Initialize Select2 Elements
$(".select2").select2();
setInterval(function(){
@@ -1397,9 +1395,12 @@ if ($thread->title != "") {
var message = "{!! Lang::get('lang.your_ticket_have_been_closed') !!}";
$("#alert11").show();
$('#message-success1').html(message);
setInterval(function(){
$("#alert11").hide();
setTimeout(function() {
window.location = document.referrer;
}, 500);
}, 2000);
}
})
return false;
@@ -1508,13 +1509,11 @@ if ($thread->title != "") {
// $('#t1').hide();
// $('#t2').show();
// });
// comment a ticket
// $('#aa').click(function() {
// $('#t1').show();
// $('#t2').hide();
// });
// Edit a ticket
$('#form').on('submit', function() {
$.ajax({
@@ -1575,7 +1574,6 @@ if ($thread->title != "") {
// var message = "Success";
// $('#message-success1').html(message);
// setInterval(function(){$("#alert11").hide(); },4000);
var message = "Success!";
$("#alert11").show();
$('#message-success1').html(message);
@@ -1677,19 +1675,6 @@ if ($thread->title != "") {
});
// Internal Note
$('#form2').on('submit', function() {
var internal_content = document.getElementById('InternalContent').value;
if(internal_content) {
$("#internal_content_class").removeClass('has-error');
$("#alert23").hide();
} else {
var message = "<li>{!! Lang::get('lang.internal_content_is_a_required_field') !!}</li>";
$("#internal_content_class").addClass('has-error');
$("#alert23").show();
$('#message-danger2').html(message);
$("#show3").hide();
$("#t1").show();
return false;
}
$.ajax({
type: "POST",
url: "../internal/note/{{ $tickets->id }}",
@@ -1700,7 +1685,6 @@ if ($thread->title != "") {
$("#show5").show();
},
success: function(response) {
if (response == 1)
{
$("#refresh1").load("../thread/{{$tickets->id}} #refresh1");
@@ -1716,16 +1700,6 @@ if ($thread->title != "") {
var div1 = document.getElementById('newtextarea1');
div1.innerHTML = div1.innerHTML + '<textarea style="width:98%;height:200px;" name="InternalContent" class="form-control" id="InternalContent"/></textarea>';
var wysihtml5Editor = $('textarea').wysihtml5().data("wysihtml5").editor;
setInterval(function(){
var head= document.getElementsByTagName('head')[0];
var script= document.createElement('script');
script.type= 'text/javascript';
script.src= '{{asset("lb-faveo/js/jquery.rating.pack.js")}}';
head.appendChild(script);
// $('.rating-cancel').hide();
// $(".star-rating-control").attr("disabled", "disabled").off('hover');
// $(".star-rating-control").addClass("disabled")
}, 4000);
} else {
// alert('fail');
var message = "{!! Lang::get('lang.for_some_reason_your_message_was_not_posted_please_try_again_later') !!}";
@@ -1782,10 +1756,10 @@ if ($thread->title != "") {
var i = Math.floor(Math.log(bytes) / Math.log(k));
return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i];
}
$('#form3').on('submit', function() {
var fd = new FormData(document.getElementById("form3"));
var reply_content = document.getElementById('reply_content').value;
var reply_content = document.getElementById("reply_content").value;
if(reply_content) {
$("#reply_content_class").removeClass('has-error');
$("#alert23").hide();
@@ -1841,9 +1815,9 @@ if ($thread->title != "") {
// $(".star-rating-control").attr("disabled", "disabled").off('hover');
// $(".star-rating-control").addClass("disabled")
}, 4000);
$( "#clear-file" ).trigger( "click" );
} else {
// alert('fail');
// $( "#dismis4" ).trigger( "click" );
var message = "{!! Lang::get('lang.for_some_reason_your_reply_was_not_posted_please_try_again_later') !!}";
$("#alert23").show();
$('#message-danger2').html(message);
@@ -1865,7 +1839,6 @@ if ($thread->title != "") {
type: "GET",
url: "../ticket/surrender/{{ $tickets->id }}",
success: function(response) {
if (response == 1)
{
// alert('ticket has been un assigned');
@@ -1897,7 +1870,6 @@ if ($thread->title != "") {
dataType: "html",
data: $(this).serialize(),
beforeSend: function() {
$('#here').html("");
$('#show7').show();
$('#hide1234').hide();
},
@@ -1912,7 +1884,7 @@ if ($thread->title != "") {
// if(link) {
// link.click();
// }
// $('#cc-close').trigger('click');
$('#cc-close').trigger('click');
}, 500);
}
})
@@ -1979,7 +1951,6 @@ if ($thread->title != "") {
type: 'GET',
data: $(this).serialize(),
success: function(data) {
$('#select-merge-tickts').html(data);
}
// return false;
@@ -2057,15 +2028,12 @@ if ($thread->title != "") {
$("#recepients").load("../thread/{{$tickets->id}} #recepients");
};
// $('#here2').html(response);
// $("#surrender22").load("../thread/{{$tickets->id}} #surrender22");
}
})
return false;
}
$(document).ready(function() {
var Vardata = "";
var count = 0;
$(".select2").on('select2:select', function(){
@@ -2101,7 +2069,6 @@ echo $ticket_data->title;
}
});
}
}
var locktime = '<?php echo $var->collision_avoid; ?>' * 60 * 1000;
var ltf = '<?php echo $var->lock_ticket_frequency;?>';
@@ -2129,7 +2096,6 @@ echo $ticket_data->title;
break;
}
}
$(this).data("prevType", e.type);
});
}
@@ -2180,9 +2146,7 @@ echo $ticket_data->title;
}
})
}
$(function() {
$('h5').html('<span class="stars">' + parseFloat($('input[name=amount]').val()) + '</span>');
$('span.stars').stars();
$('h4').html('<span class="stars2">' + parseFloat($('input[name=amt]').val()) + '</span>');

View File

@@ -189,19 +189,20 @@ foreach ($conversations as $conversation) {
$body = $conversation->body;
$attachments = App\Model\helpdesk\Ticket\Ticket_attachments::where('thread_id', '=', $conversation->id)->orderBy('id', 'DESC')->get();
foreach ($attachments as $attachment) {
if ($attachment->type == 'pdf') {
} elseif ($attachment->type == 'docx') {
} else {
// $i++;
try {
if ($attachment->type == 'jpg' || $attachment->type == 'png' || $attachment->type == 'PNG' || $attachment->type == 'JPG' || $attachment->type == 'jpeg' || $attachment->type == 'JPEG' || $attachment->type == 'gif' || $attachment->type == 'GIF') {
if($attachment->size > 0) {
$image = @imagecreatefromstring($attachment->file);
if($image == false) {
} else {
ob_start();
imagejpeg($image, null, 80);
$data = ob_get_contents();
ob_end_clean();
$var = '<img src="data:image/jpg;base64,' . base64_encode($data) . '" />';
$body = str_replace($attachment->name, "data:image/jpg;base64," . base64_encode($data), $body);
$var = '<img style="max-width:200px;max-height:200px;" src="data:image/' . $attachment->type . ';base64,' . base64_encode($data) . '" />';
$body = str_replace($attachment->name, "data:image/" . $attachment->type . ";base64," . base64_encode($data), $body);
$string = $body;
$start = "<head>";
$end = "</head>";
@@ -217,6 +218,12 @@ foreach ($conversations as $conversation) {
}
}
}
} else {
}
} catch(\Exception $e) {
}
}
}
$string = $body;
$start = "<head>";
@@ -306,12 +313,17 @@ foreach ($conversations as $conversation) {
if ($attachment->poster == 'ATTACHMENT') {
if ($attachment->type == 'jpg' || $attachment->type == 'JPG' || $attachment->type == 'jpeg' || $attachment->type == 'JPEG' || $attachment->type == 'png' || $attachment->type == 'PNG' || $attachment->type == 'gif' || $attachment->type == 'GIF') {
$image = @imagecreatefromstring($attachment->file);
if($image == false) {
$var = '<a style="max-width:200px;height:133px;color:#666;" href="' . URL::route('image', array('image_id' => $attachment->id)) . '" target="_blank"><span class="mailbox-attachment-icon" style="background-color:#fff;">' . strtoupper($attachment->type) . '</span><div class="mailbox-attachment-info"><span ><b style="word-wrap: break-word;">' . $attachment->name . '</b><br/><p>' . $value . '</p></span></div></a>';
echo '<li style="background-color:#f4f4f4;">' . $var . '</li>';
} else {
ob_start();
imagejpeg($image, null, 80);
$data = ob_get_contents();
ob_end_clean();
$var = '<a href="' . URL::route('image', array('image_id' => $attachment->id)) . '" target="_blank"><img style="max-width:200px;height:133px;" src="data:image/jpg;base64,' . base64_encode($data) . '"/></a>';
echo '<li style="background-color:#f4f4f4;"><span class="mailbox-attachment-icon has-img">' . $var . '</span><div class="mailbox-attachment-info"><b style="word-wrap: break-word;">' . $attachment->name . '</b><br/><p>' . $value . '</p></div></li>';
}
} else {
$var = '<a style="max-width:200px;height:133px;color:#666;" href="' . URL::route('image', array('image_id' => $attachment->id)) . '" target="_blank"><span class="mailbox-attachment-icon" style="background-color:#fff;">' . strtoupper($attachment->type) . '</span><div class="mailbox-attachment-info"><span ><b style="word-wrap: break-word;">' . $attachment->name . '</b><br/><p>' . $value . '</p></span></div></a>';
echo '<li style="background-color:#f4f4f4;">' . $var . '</li>';

View File

@@ -88,28 +88,7 @@ class = "active"
<h4>{!! Lang::get('lang.ticket') !!} </h4>
</div>
<div class="row col-md-12">
<div class="col-md-12 form-group {{ $errors->has('help_topic') ? 'has-error' : '' }}">
{!! Form::label('help_topic', Lang::get('lang.choose_a_help_topic')) !!}
{!! $errors->first('help_topic', '<spam class="help-block">:message</spam>') !!}
<?php
$forms = App\Model\helpdesk\Form\Forms::get();
$helptopic = App\Model\helpdesk\Manage\Help_topic::where('status', '=', 1)->get();
?>
<select name="helptopic" class="form-control" id="selectid">
<?php
$system_default_department = App\Model\helpdesk\Settings\System::where('id', '=', 1)->first();
if (isset($system_default_department->department)) {
$department_relation_helptopic = App\Model\helpdesk\Manage\Help_topic::where('department', '=', $system_default_department->department)->first();
$default_helptopic = $department_relation_helptopic->id;
} else {
$default_helptopic = 0;
}
?>
@foreach($helptopic as $topic)
<option value="{!! $topic->id !!}">{!! $topic->topic !!}</option>
@endforeach
</select>
</div>
@if(Auth::user())
@@ -154,6 +133,28 @@ class = "active"
{!! Form::text('Phone',null,['class' => 'form-control']) !!}
</div>
@endif
<div class="col-md-12 form-group {{ $errors->has('help_topic') ? 'has-error' : '' }}">
{!! Form::label('help_topic', Lang::get('lang.choose_a_help_topic')) !!}
{!! $errors->first('help_topic', '<spam class="help-block">:message</spam>') !!}
<?php
$forms = App\Model\helpdesk\Form\Forms::get();
$helptopic = App\Model\helpdesk\Manage\Help_topic::where('status', '=', 1)->get();
?>
<select name="helptopic" class="form-control" id="selectid">
<?php
$system_default_department = App\Model\helpdesk\Settings\System::where('id', '=', 1)->first();
if (isset($system_default_department->department)) {
$department_relation_helptopic = App\Model\helpdesk\Manage\Help_topic::where('department', '=', $system_default_department->department)->first();
$default_helptopic = $department_relation_helptopic->id;
} else {
$default_helptopic = 0;
}
?>
@foreach($helptopic as $topic)
<option value="{!! $topic->id !!}">{!! $topic->topic !!}</option>
@endforeach
</select>
</div>
<div class="col-md-12 form-group {{ $errors->has('Subject') ? 'has-error' : '' }}">
{!! Form::label('Subject',Lang::get('lang.subject')) !!}<span class="text-red"> *</span>
{!! Form::text('Subject',null,['class' => 'form-control']) !!}
@@ -163,14 +164,18 @@ class = "active"
{!! Form::textarea('Details',null,['class' => 'form-control']) !!}
</div>
<div class="col-md-12 form-group">
<div class="btn btn-default btn-file"><i class="fa fa-paperclip"> </i> {!! Lang::get('lang.attachment') !!}<input type="file" name="attachment[]" multiple/></div><br/>
{!! Lang::get('lang.max') !!}. 10MB
<div class="btn btn-default btn-file"><i class="fa fa-paperclip"> </i> {!! Lang::get('lang.attachment') !!}<input type="file" name="attachment[]" id="attachment" multiple/></div><br/>
<div id='file_details'></div><div id='total-size'></div>
{!! Lang::get('lang.max') !!}. {!! $max_size_in_actual !!}
<div>
<a id='clear-file' onClick='clearAll()' style='display:none; cursor:pointer;'><i class='fa fa-close'></i>Clear all</a>
</div>
</div>
{{-- Event fire --}}
<?php Event::fire(new App\Events\ClientTicketForm()); ?>
<div class="col-md-12" id="response"> </div>
<div id="ss" class="xs-md-6 form-group {{ $errors->has('') ? 'has-error' : '' }}"> </div>
<div class="col-md-12 form-group">{!! Form::submit(Lang::get('lang.Send'),['class'=>'form-group btn btn-info pull-left', 'onclick' => 'this.disabled=true;this.value="Sending, please wait...";this.form.submit();'])!!}</div></div>
<div class="col-md-12 form-group">{!! Form::submit(Lang::get('lang.Send'),['id' => 'submitbtn' ,'class'=>'form-group btn btn-info pull-left', 'onclick' => 'this.disabled=true;this.value="Sending, please wait...";this.form.submit();'])!!}</div>
</div>
<div class="col-md-12" id="response"> </div>
<div id="ss" class="xs-md-6 form-group {{ $errors->has('') ? 'has-error' : '' }}"> </div>
@@ -183,22 +188,87 @@ class = "active"
|====================================================
-->
<script type="text/javascript">
$('#selectid').on('change', function() {
var value = $('#selectid').val();
function clearAll() {
$("#file_details").html("");
$("#total-size").html("");
$("#attachment").val('');
$("#clear-file").hide();
$("#submitbtn").removeClass('disabled');
}
$(document).ready(function() {
var helpTopic = $("#selectid").val();
send(helpTopic);
$("#selectid").on("change", function() {
helpTopic = $("#selectid").val();
send(helpTopic);
});
function send(helpTopic) {
$.ajax({
url: "postform/" + value,
type: "post",
data: value,
success: function(data) {
$('#response').html(data);
var wysihtml5Editor = $('#unique-textarea').wysihtml5().data("wysihtml5").editor;
url: "{{url('/get-helptopic-form')}}",
data: {'helptopic': helpTopic},
type: "GET",
dataType: "html",
success: function(response) {
$("#response").html(response);
},
error: function(response) {
$("#response").html(response);
}
});
}
});
$(function() {
//Add text editor
$("textarea").wysihtml5();
});
// Ticket attachment
$('#attachment').change(function() {
input = document.getElementById('attachment');
if (!input) {
alert("Um, couldn't find the fileinput element.");
} else if (!input.files) {
alert("This browser doesn't seem to support the `files` property of file inputs.");
} else if (!input.files[0]) {
} else {
$("#file_details").html("");
var total_size = 0;
for (i = 0; i < input.files.length; i++) {
file = input.files[i];
var supported_size = "{!! $max_size_in_bytes !!}";
var supported_actual_size = "{!! $max_size_in_actual !!}";
if (file.size < supported_size) {
$("#file_details").append("<tr> <td> " + file.name + " </td><td> " + formatBytes(file.size) + "</td> </tr>");
} else {
$("#file_details").append("<tr style='color:red;'> <td> " + file.name + " </td><td> " + formatBytes(file.size) + "</td> </tr>");
}
total_size += parseInt(file.size);
}
if (total_size > supported_size) {
$("#total-size").append("<span style='color:red'>Your total file upload size is greater than " + supported_actual_size + "</span>");
$("#submitbtn").addClass('disabled');
$("#clear-file").show();
} else {
$("#total-size").html("");
$("#submitbtn").removeClass('disabled');
$("#clear-file").show();
}
}
});
function formatBytes(bytes, decimals) {
if (bytes == 0)
return '0 Byte';
var k = 1000;
var dm = decimals + 1 || 3;
var sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
var i = Math.floor(Math.log(bytes) / Math.log(k));
return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i];
}
</script>
@stop

View File

@@ -146,7 +146,7 @@ class Mailbox {
* @return array mailsIds (or empty array)
*/
public function searchMailbox($criteria = 'ALL') {
$mailsIds = imap_search($this->getImapStream(), 'ALL', SE_UID, $this->serverEncoding);
$mailsIds = imap_search($this->getImapStream(), $criteria, SE_UID, $this->serverEncoding);
return $mailsIds ? $mailsIds : array();
}
/**