Jump to content

Insert A Predefined Response With Signature Bug


PauloV

Recommended Posts

Consider this: You're typing something, and then you want to enter the predefined response. It appears as the end of what you're typing. Perfect. But it has no idea where your response ends, and where your signature begins.

 

Either we have to enter the predefined response at the beginning of the reply, or the end. I'm sure a case could be made for both methods.

Link to comment
Share on other sites

Hello,

 

I also consider a annoying "bug" (its not actualy a bug, but its very annoying, lol)

 

I will trie to see how WHMCS/Hostbill/ClentExec has implemented this, because on outher solutions it works that way :)

 

Maybe some javascript execution after click on "Predefined Response" that gets the ticket text, add first the Predefined Response and after the rest of the ticket text :) I think its easy :)

 

I will post a solution later :)

 

Regards,

Paulo V

Link to comment
Share on other sites

Final solution that is 100% working, and now, can add also responses on character focus, the way that should work :)
 
Open plugins/support_manager/views/default/admin_tickets_add.pdt
 
on line 177
 
change from:
 
function setPredefinedResponse(response_id) {
$(document).blestaRequest('GET', '" . $this->Html->safe($this->base_uri . "plugin/support_manager/admin_tickets/getresponse/") . "' + response_id, {},
function(data) {
if (data) {
$('#details').val($('#details').val() + data);
$('#details').scrollTop($('#details')[0].scrollHeight);
}
},
null,
{dataType:'json'}
);
}
 
To:
 
    jQuery.fn.extend({
        insertAtCaret: function(myValue){
          return this.each(function(i) {
            if (document.selection) {
              //For browsers like Internet Explorer
              this.focus();
              sel = document.selection.createRange();
              sel.text = myValue;
              this.focus();
            }
            else if (this.selectionStart || this.selectionStart == '0') {
              //For browsers like Firefox and Webkit based
              var startPos = this.selectionStart;
              var endPos = this.selectionEnd;
              var scrollTop = this.scrollTop;
              this.value = this.value.substring(0, startPos)+myValue+this.value.substring(endPos,this.value.length);
              this.focus();
              this.selectionStart = startPos + myValue.length;
              this.selectionEnd = startPos + myValue.length;
              this.scrollTop = scrollTop;
            } else {
              this.value += myValue;
              this.focus();
            }
          })
        }
        });

function setPredefinedResponse(response_id) {
$(document).blestaRequest('GET', '" . $this->Html->safe($this->base_uri . "plugin/support_manager/admin_tickets/getresponse/") . "' + response_id, {},
function(data) {
if (data) {
                    $('#details').insertAtCaret(data);
}
},
null,
{dataType:'json'}
);
}

Please test and send feedback :)

 

Regards,

Paulo V

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...