cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
221
Views
0
Helpful
1
Replies
Cisco Employee

Clearing the gadget after call ends

I have written a simple gadget to display Marquee text when making an outbound call. It is working fine except that the gadget does not clear itself after the call ends. I added the handler for the end dialog event but it still does not clear.

What am I doing wrong/missing here?

===========================================

var finesse = finesse || {};

finesse.modules= finesse.modules|| {};

finesse.modules.clsession= (function ($) {

    /*

        Function called when workflow action event is received

            Logging enabled so we can see event data

            Especially useful while developing

    */

    var clientLogger= finesse.cslogger.ClientLogger,

    /**

     * 02/19/2017 - ktagdiwa - Handler for the end of Dialog (when call ends)

     *  Handler for deletions from the Dialogs collection object for this user.  This will occur

     *  when a Dialog is removed from this user's collection (example, end call)

     */

    handleEndDialog = function(dialog) {

        clientLogger.log("handleEndDialog()");

        // decrement the number of dialogs

        //numDialogs--;

        // clear the popValue

        //popValue = null;

        // render the html in the gadget

        $('#customContent').html(''); //Clear the gadget content

    },   

    handleWorkflowAction= function(action) {

        console.log("*************** Inside handleWorkflowAction...");

        // Perform all the event processing here

        // Access the action event object data passed to the handler

        var actname= action.getName();

        var acthandle= action.getHandledBy();

        var acttype= action.getType();

        var actparam= action.getParams();

        var gadgetHeight = 100;

        // Log event data and dump params block

        console.log("***** WF Action: " + actname+ "/" + acthandle+ "/" + acttype);

        console.log("***** Action Params: " + JSON.stringify(action.getParams(), null, 4));

        clientLogger.log("***** WF Action: " + actname+ "/" + acthandle+ "/" + acttype);

        clientLogger.log("***** Action Params: " + JSON.stringify(action.getParams(), null, 4));

        // Process action if BROWSER_POP, OTHER, and targeted at window called MarqueeWFActionWin

        if (acttype=="BROWSER_POP"&& acthandle== finesse.containerservices.WorkflowActionEvent.HandledBy.OTHER){

            console.log("************* Checking Window Name since the acttype and acthandle matched...");

            if (actparam.windowName.value== "MarqueeWFActionWin"){

                console.log("***** Matched windowName: " + actparam.windowName.value + ". Now setting the IFRAME tag inside the Gadget HTML...");

                // Modify gadget HTML content

                var wfhtml= '<iframe width="100%" height="100" style="border:0" src="'+ actparam.path.expandedValue

                + '"> </iframe>';

                $("#customContent").html(wfhtml);

                console.log("********** Adjusting the height of the gadget.");

                gadgets.window.adjustHeight(gadgetHeight);

            }

        }

    };

   

    return {

        /*

            Function finesse.modules.clsession.init() called from HTML when gadget is loaded

            Adds the handler to be called on workflow action events

        */

        init: function() {

            clientLogger.init(gadgets.Hub, "CL-Session-Workflow");

            containerServices= finesse.containerservices.ContainerServices.init(); // Boiler plate call

            clientLogger.log("Adding Workflow-Action handler...")

            containerServices.addHandler(finesse.containerservices.ContainerServices.Topics.WORKFLOW_ACTION_EVENT, handleWorkflowAction);// Add the handler function defined above as the handler for the WORKFLOW_ACTION_EVENT

        }

    };

}(jQuery));

Everyone's tags (4)
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Cisco Employee

Re: Clearing the gadget after call ends

I realized that I was not binding the handler in the init.

Once I did that, I was able to get this to work.

1 REPLY 1
Highlighted
Cisco Employee

Re: Clearing the gadget after call ends

I realized that I was not binding the handler in the init.

Once I did that, I was able to get this to work.

CreatePlease to create content
Content for Community-Ad
August's Community Spotlight Awards