Results 1 to 4 of 4

Thread: overriding javascript functions

  1. #1
    ppragides is offline Junior Member
    Join Date
    Sep 2012
    Posts
    8
    Rep Power
    2

    Default overriding javascript functions

    Hi all,

    I have a question regarding overriding javascript functions. I know that generally we'll be doing the overriding via zimlets, but since they get loaded in last, a function that I'm overriding isn't going into effect until after some of the page is already rendered. Essentially, I'm trying to override the ZmMailMsgListView.prototype._getAbridgedContent function in order to to some tweaking to the way the mail list is displayed (i.e. mover the sender's name above the email subject, etc).

    I really don't want to make changes to core code and any help would be appreciated.

    p.s. we're on version 7.1.4

    Thanks,

    P

  2. #2
    ychaouche is offline Senior Member
    Join Date
    Jul 2012
    Location
    Algiers
    Posts
    55
    Rep Power
    2

    Default

    I was once inspecting the internals of the view in firebug and played with some functions interactively, one of them cleared out the whole central view. I don't know if it's a good idea or not but I'd suggest overriding the javascript functions in your zimlets, then call that function (that clears the central view) and rebuild it (there should be a function for that too).

    If you have a decent developer environement you could look for functions named "*clear*" in the appropriate source code files. It's a shame that the source code of zimbra is written in a way that ctags and etags can't parse. So for example this
    Code:
    AjxSoapDocument.prototype.createDoc = 
    function(arg1,arg2,){
    [...]
    };
    Can not be parsed as a function definition because no regular expression can match this as a function definition (ctags and etags process code line by line).

  3. #3
    ppragides is offline Junior Member
    Join Date
    Sep 2012
    Posts
    8
    Rep Power
    2

    Default

    Hi and thanks for your response. I did look into that route (i.e. overriding the function via a zimlet, clearing out the current content, and rebuilding it). We didn't like that the user "sees" what happens - the mail list loads, gets cleared, and then reloaded. I ended up creating a callback method to when the mailcore package has completed loading via the AjxDispatcher.addPackageLoadFunction and overrode the function that way.

  4. #4
    ychaouche is offline Senior Member
    Join Date
    Jul 2012
    Location
    Algiers
    Posts
    55
    Rep Power
    2

    Default

    I'm glad you made it. Can you tell us a little more where did you operated your modifications ? is it in your zimlet or in the Zimbra javascript source code ?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Overriding ZmContact.prototype.create function
    By sanil.naik in forum Developers
    Replies: 0
    Last Post: 02-17-2010, 03:59 AM
  2. IE8 'forgets' functions
    By jonallport in forum Users
    Replies: 1
    Last Post: 12-14-2009, 08:11 AM
  3. How to use IM functions ?
    By vincen in forum Users
    Replies: 1
    Last Post: 08-03-2008, 08:22 AM
  4. CRM functions
    By JustinHarlow in forum Users
    Replies: 1
    Last Post: 06-14-2007, 11:06 PM
  5. new functions for AjxXmlDoc
    By Heladito in forum Developers
    Replies: 2
    Last Post: 11-11-2005, 02:12 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •