Jump to content


Photo

Is it possible to register custom javascript from a custom module?

custom module javascript

  • Please log in to reply
3 replies to this topic

#1 Asaa

Asaa

    Member

  • Members
  • PipPip
  • 13 posts
  • LocationQC, Canada

Posted 23 July 2014 - 07:48 PM

I am making a chat module for connected users. 

 

I want to cleanly register a new javascript to the Zurmo header from my custom module.

(when I say cleanly, I mean without modifying the Core or other modules or the theme) 

 

Is there some sort of hook i can use in my custom module to register my .js?

Or a way to force zurmo to render one of my custom module view on everypage?

 


  • qwr likes this

#2 qwr

qwr

    Member

  • Members
  • PipPip
  • 10 posts

Posted 07 August 2014 - 06:48 AM

Hi, I would like to know how you are progressing with this. I also need the same functionality for my customization, have a trouble in detecting whether the user is online or not http://zurmo.org/for...-user-tracking/.



#3 Asaa

Asaa

    Member

  • Members
  • PipPip
  • 13 posts
  • LocationQC, Canada

Posted 12 August 2014 - 07:18 PM

I've made progress with my feature, but I doubt this will help you.

I could not find a way to register my .js from my custom module, so I decided to bypass my problem to not halt my development (added a function to /app/protected/modules/zurmo/views/HeaderView.php to register my JS scripts)

For the chat engine I decided to go with a node server with socket.io for real-time re-activity.

When a logged user goes on a page in Zurmo, I use his Zurmo username to register him online on the node server. The list of user can then be pumped by the socket.io client side and injected in the page via JS. (when a user logs the list is automatically sent to the client side).

 

I doubt this solution will help for your online user tracking it's a bit overkill to simply check who is online but I guess it could work.

Each page as a persistent connection to the node server if the page is closed the link is severed and the user would not be displayed online. You would need to account that a user could be online in multiple pages.

I'm planning to use this node deamon for a couple more features like Asterisk/VOIP implementation (click-to-call and call monitoring).

Just need to figure a way to cleanly register JS without having to add extra code line in the Existing code base (due to updates).

Either way I could inject them using Apache or Varnish but I would prefer not to. Trying to see if there is a way to do it in config files. 

 

 

 


  • qwr likes this

#4 qwr

qwr

    Member

  • Members
  • PipPip
  • 10 posts

Posted 16 August 2014 - 02:05 AM

The things is, we might also be needing to connect zurmo to a PBX based system for the same purpose at a later date.

I have still not found a clean way to accurately check online users.

Thank you for the response.







Also tagged with one or more of these keywords: custom, module, javascript

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users