Announcement

Collapse
No announcement yet.

Extending Contacts GUI with OXSE 6.18.2.0-6...

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Extending Contacts GUI with OXSE 6.18.2.0-6...

    Hi all, I'm developing a little GUI plugin that adds some extra informations within OXSE Contacts GUI.
    Looking at VoipNOW GUI plugin I've developed my own plugin which seems to work pretty well with OXSE 6.18.1.x, but when upgrading to latest OXSE 6.18.2.0-6 my plugin has stopped to work correctly due to many internal OX api changes.

    In particular, my plugin needs to integrate with Contact Hovers (in "Cards" and "Phone list" views) and with Contact Detail.

    With OXSE 6.18.1.x I was able to register to PAINT_CONTACT event in order to manage all Contact Hovers:
    Code:
    register("PAINT_CONTACT", function(e) {
    	try {
    		// is contact?
    		if (e.contact.distribution_list === null) {
    			switch (e.view) {
    				case "card":
    					break;
    							
    				case "hover":
    					// MY CODE GOES HERE!!!
    					// 'e.contact' refers to the current hovered contact
    					...
    					break;
    			}
    		}
    	} catch(ex){}
    });
    But with OXSE 6.18.2.0-6 the PAINT_CONTACT event is only triggered in the "Cards" view so I'm not longer able to catch Hovers in the "Phone list" view!
    • Is this an intended behaviour?
    • How can I register to all Contact Hover events?



    I also need to integrate with the "Contact Detail" view. After some research I've registered to OX_View_Changed event as follows:
    Code:
    register("OX_View_Changed", function(e) {
    	if (e.module == "contacts" && e.path == "contacts,detail,overview") {
    		// MY CODE GOES HERE!!!
    		// 'e.contact' DOES NOT contain a reference to currently displayed contact!
    		...
    	}
    });
    This event is triggered both with OXSE 6.18.1 and 6.18.2 but it is a generic event so it does not contain any reference to currently displayed contact.
    • How can I handle more efficiently the "Contact Detail" view? Is there a more convenient event that can I register to?

  • #2
    As regards the Contact Detail view, I've looked to contact.js source code and I've found a quite interesting function (the showContactDetail).
    If I'm not wrong, at the end of the inner showDetailInside function you could trigger a new event (eg: PAINT_CONTACT_DETAIL) or extend your PAINT_CONTACT event in order to provide a more contact-detail friendly event...
    Code:
    function showContactDetail(cb_function) {	
    	function showDetailInside(daten) {		
    		if (cb_function) 
    		  cb_function();          
            
    		objContactCardFunctions.currentDatailContactData = daten;
    
    
    		// YOU CAN TRIGGER A NEW EVENT HERE???
    		triggerEvent("PAINT_CONTACT_DETAIL", {"contact": daten});
    
    		// ...OR CAN EXTEND THE PAINT_CONTACT EVENT???
    		triggerEvent("PAINT_CONTACT", {"view": "detail", "contact": daten});
    
    	}
    	...
    }

    Comment


    • #3
      Patch proposal for Contact Detail paint-event

      I've successfully checked the extension of the PAINT_CONTACT event as follows:
      Code:
      Index: js/contacts/contacts.js
      ===================================================================
      --- js/contacts/contacts.js	(revision 3849)
      +++ js/contacts/contacts.js	(working copy)
      @@ -1813,6 +1813,8 @@
       		    objContactFunctions.loadingContactDetail(false);                    
       		}
       		register("OX_Print",contacts_printDetail);
      +		
      +		triggerEvent("PAINT_CONTACT", {"view": "detail", "contact": daten});
       	}
       	
       	objContactFunctions.loadingContactDetail(true);
      Feel free to integrate this simple patch into your HEAD


      As regards Contact Hovers, I'm waiting for suggestions

      Comment


      • #4
        Are you sure that PAINT_CONTACT worked for the list view? There never was any code to trigger it there.

        Anyway, now it works, and is also triggered for the detail view. It will be available with the next nightly build and with 6.18.2 rev 9.

        Comment


        • #5
          Originally posted by Viktor Pracht View Post
          Are you sure that PAINT_CONTACT worked for the list view?
          Yes, I'm quite sure that with OXSE 6.18.1 this event was triggered also in list view
          Thanks for your support

          Comment

          Working...
          X