Results 1 to 4 of 4

Thread: How to capture save appointment event from zimlet

  1. #1
    amitkabraiiit is offline New Member
    Join Date
    Aug 2010
    Posts
    3
    Rep Power
    4

    Default How to capture save appointment event from zimlet

    Hello,
    I want to capture a save appointment event, how can we do that.
    Requirement is like, when someone saves an appointment we will do some action first and based on that action we would like to continue saving appointment otherwise we would force a cancel.

    Thanks.

  2. #2
    lfasci is offline Trained Alumni
    Join Date
    Jul 2006
    Location
    Pisa
    Posts
    135
    Rep Power
    9

    Default

    Did you solved this problem ?

    Thank you.

  3. #3
    tdesorbaix is offline Zimlet Guru & Moderator
    Join Date
    Apr 2007
    Location
    Paris, France
    Posts
    367
    Rep Power
    8

    Default

    The difficult part would be to find all the functions assigned to the save of appointment in the source code.
    Then you just have to write a zimlet where you will overwrite the functions (the zimlets are loaded after the other js packages).

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

    Default

    I would grab a reference to the save button and change its selection handler (that's the handler called when the user clicks on the save button). If you override the initializeToolbar function in your zimlet, it will be called whenever the toolbar of a view (in our case the appointments view) is loaded. That's when you can grab a reference to the save button, for example :
    Code:
    SugarBee.prototype.initializeToolbar = function(app, toolbar, controller, viewID){
       [...]
        else if (viewID.indexOf(ZmId.VIEW_APPOINTMENT) >= 0){
        this._createApptButton(toolbar,controller);
        }
    };

    Then

    Code:
    SugarBee.prototype._createApptButton = function(toolbar,controller){
    [...]
        var save_button = toolbar.getButton("SAVE");
        // save the listners before we remove everything. We'll put them back after we click
        this.save_button_listners = save_button._listeners;
        save_button.removeSelectionListeners();
        // we need to pass in a reference to the save_button for later usage.
        save_bouton.addSelectionListener(new AjxListener(this,this._displayAppt,[save_button]));
    };
    and finally

    Code:
    SugarBee.prototype._displayAppt = function (...,save_button,...) {
        [...] // Do our business;
        save_button._listners = this.save_button_listners;     // restore the listners
        save_button._emulateSingleClick(); // 
    };

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 7
    Last Post: 11-30-2010, 09:14 PM
  2. Replies: 6
    Last Post: 03-05-2010, 01:13 AM
  3. Replies: 21
    Last Post: 02-04-2010, 10:06 AM
  4. Samba and POSIX undeploy problem
    By catnipper in forum Zimlets
    Replies: 0
    Last Post: 09-02-2009, 10:51 AM
  5. zimlet to save email on local hard drive
    By frankh in forum Zimlets
    Replies: 17
    Last Post: 05-21-2008, 12:26 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
  •