blak3r / yaai

SugarCRM Asterisk integration
http://www.sugarforge.org/projects/yaai
GNU General Public License v3.0
81 stars 85 forks source link

How to add Magic Dial button to Edit View? #167

Closed ViktorNova closed 10 years ago

ViktorNova commented 10 years ago

This maybe sounds like a weird question, but I need to add magic dial buttons to Edit View for Contacts. This has to be possible, how might I try to get that working?

blak3r commented 10 years ago

Ehhhh sounds like a bad idea. But, edit dialOut.js. Figure out the appropriate JavaScript selector for jquery

Sent from my iPhone

On Dec 6, 2013, at 7:57 PM, Viktor Nova notifications@github.com wrote:

This maybe sounds like a weird question, but I need to add magic dial buttons to Edit View for Contacts. This has to be possible, how might I try to get that working?

— Reply to this email directly or view it on GitHub.

ViktorNova commented 10 years ago

Cool, I will start there!

I only have a loose grasp at how Sugar actually works on the inside, but would it make sense to put

<span class='phone'>{sugar_phone value=$phone usa_format=$usa_format}</span>

somewhere in the edit view's php file?

I tried putting it at the top of modules/Contacts/views/view.edit.php but got a blank page ;)

I only know enough to be dangerous at this point, but am determined to figure it out!

blak3r commented 10 years ago

Ehhh. No. Don't think so. Just do it with jquery somehow.

If dialout.js isn't loaded on edit view look at AsteriskJS.php. That controls what pages the JavaScript is loaded on. I don't think edit view is filtered but it might.

Sent from my iPhone

On Dec 6, 2013, at 11:36 PM, Viktor Nova notifications@github.com wrote:

Cool, I will start there!

I only have a loose grasp at how Sugar actually works on the inside, but would it make sense to put {sugar_phone value=$phone usa_format=$usa_format} somewhere in the edit view's php file?

I tried putting it at the top of modules/Contacts/views/view.edit.php but got a blank page ;)

I only know enough to be dangerous at this point, but am determined to figure it out!

— Reply to this email directly or view it on GitHub.

ViktorNova commented 10 years ago

Got it working perfectly! I first tried the jquery route, but it was already looking for the class "phone", which is what the input field in edit view was already set as. The reason it doesn't render a call button is because there's no actual "normal" html text displaying the phone number in edit mode, instead it is an input field with the phone number pre-populated using value=""

Here's what I did to get it working -

In /custom/modules/Contacts/metadata/editviewdefs.php

      1 => 
      array (
        'name' => 'some_unique_name',
        'comment' => 'Work phone number of the contact',
        'label' => 'some_unique_label',
        'customCode' => '<div class="phone" name="phone_work" /> {$fields.phone_work.value}',

      ),

I added this to the top panel (named "DISPOSITON" in this screenie) which is a custom panel made in studio that previously only had one thing in it. If 'name' and 'label' are set to something unique, you can still mess with Edit View in the studio and not lose this customization

This setup is awesome, it allows telemarketers to cruise through callback lists in edit mode and still have click-to-dial functionality

image

Very nice!

ViktorNova commented 10 years ago

Ok, there is still a little problem here - when an outgoing call is made via the edit interface with my above little hack, the call popup is not saving any changes.

In fact, the call popup for a call made while in edit mode doesn't ever go away! Like it thinks I never clicked Save Memo. It goes away when clicked, but then comes back, sometimes on it's own, but always when the page is refreshed or a new page is loaded. So after making a few calls, the screen begins to endlessly stack up with call boxes that won't go away

Call popups are working and saving notes just fine otherwise, through list view and detail view.

Any idea where to look next?

blak3r commented 10 years ago

I don't think this issue is related to your change. I've heard others report issues with the popups disappearing as well.

Since you're a developer... could you look to see if there are any PHP errors or javascript errors when you try and do the save.

On Mon, Dec 9, 2013 at 9:28 PM, Viktor Nova notifications@github.comwrote:

Ok, there is still a little problem here - when an outgoing call is made via the edit interface with my above little hack, the call popup is not saving any changes.

In fact, the call popup for a call made while in edit mode doesn't ever go away! Like it thinks I never clicked Save Memo. It goes away when clicked, but then comes back, sometimes on it's own, but always when the page is refreshed or a new page is loaded. So after making a few calls, the screen begins to endlessly stack up with call boxes that won't go away

Call popups are working and saving notes just fine otherwise, through list view and detail view.

Any idea where to look next?

— Reply to this email directly or view it on GitHubhttps://github.com/blak3r/yaai/issues/167#issuecomment-30194433 .

ViktorNova commented 10 years ago

Sorry for the radio silence, I have been focused on other things here and this was put on the back burner, but I am about to tackle this again and will absolutely help debug the problem

blak3r commented 10 years ago

Great thanks!

On Mon, Dec 30, 2013 at 8:36 PM, Viktor Nova notifications@github.comwrote:

Sorry for the radio silence, I have been focused on other things here and this was put on the back burner, but I am about to tackle this again and will absolutely help debug the problem

— Reply to this email directly or view it on GitHubhttps://github.com/blak3r/yaai/issues/167#issuecomment-31379795 .

ViktorNova commented 10 years ago

I'm closing this issue since the original problem is fixed, a la my mini hack above

(and I'm going to open a new issue about the call popups not saving, as I'm running into that in normal view too)