+
+ this.update_dial_action = function($input) {
+ var $action = $('#' + $input.prop('id') + '-dial-action');
+
+ if (!$action)
+ return true;
+
+ var number = $input.val().replace(/\s+/g, '');
+ if (number === '')
+ $action.hide();
+ else
+ $action.prop('href', 'controller.pl?action=CTI/call&number=' + encodeURIComponent(number)).show();
+
+ return true;
+ };
+
+ this.init_dial_action = function(input) {
+ if ($('#_cti_enabled').val() != 1)
+ return false;
+
+ var $input = $(input);
+ var action_id = $input.prop('id') + '-dial-action';
+
+ if (!$('#' + action_id).size()) {
+ var $action = $('<a href="" id="' + action_id + '" class="cti_call_action" target="_blank" tabindex="-1"></a>');
+ $input.wrap('<span nobr></span>').after($action);
+
+ $input.change(function() { kivi.CustomerVendor.update_dial_action($input); });
+ }
+
+ kivi.CustomerVendor.update_dial_action($input);
+
+ return true;
+ };
+
+ this.inline_report = function(target, source, data){
+ $.ajax({
+ url: source,
+ success: function (rsp) {
+ $(target).html(rsp);
+ $(target).find('.paginate').find('a').click(function(event){ ns.redirect_event(event, target) });
+ $(target).find('a.report-generator-header-link').click(function(event){ ns.redirect_event(event, target) });
+ },
+ data: data,
+ });
+ };
+ this.redirect_event = function(event, target){
+ event.preventDefault();
+ ns.inline_report(target, event.target + '', {});
+ };