def get_behavior(cls, sobject): '''it takes sobject as an argument and turn it into a dictionary to pass to NotificationTestCmd''' pal = WebContainer.get_web().get_palette() bg_color = pal.color('background') sobj_dict = SObject.get_sobject_dict(sobject) sobj_json = jsondumps(sobj_dict) bvr = { 'type': 'click_up', 'cbjs_action': ''' var server = TacticServerStub.get(); var rtn = {}; var msg = ''; try { spt.app_busy.show( 'Email Test', 'Waiting for email server response...' ); rtn = server.execute_cmd('tactic.command.NotificationTestCmd', args={'sobject_dict': %s}); msg = rtn.description; msg += '\\nYou can also review the notification in the Notification Log.' } catch(e) { msg = 'Error found in this notification:\\n\\n' + spt.exception.handler(e); } //console.log(msg) spt.app_busy.hide(); var popup_id = 'Notification test result'; var class_name = 'tactic.ui.panel.CustomLayoutWdg'; msg= msg.replace(/\\n/g, '<br/>'); var options = { 'html': '<div><div style="background:%s; padding: 5px">' + msg + '</div></div>'}; var kwargs = {'width':'600px'}; spt.panel.load_popup(popup_id, class_name, options, kwargs); ''' % (sobj_json, bg_color) } return bvr
def get_behavior(cls, sobject): '''it takes sobject as an argument and turn it into a dictionary to pass to NotificationTestCmd''' pal = WebContainer.get_web().get_palette() bg_color = pal.color('background') sobj_dict = SObject.get_sobject_dict(sobject) sobj_json = jsondumps(sobj_dict) bvr = {'type': 'click_up', 'cbjs_action': ''' var server = TacticServerStub.get(); var rtn = {}; var msg = ''; try { spt.app_busy.show( 'Email Test', 'Waiting for email server response...' ); rtn = server.execute_cmd('tactic.command.NotificationTestCmd', args={'sobject_dict': %s}); msg = rtn.description; msg += '\\nYou can also review the notification in the Notification Log.' } catch(e) { msg = 'Error found in this notification:\\n\\n' + spt.exception.handler(e); } //console.log(msg) spt.app_busy.hide(); var popup_id = 'Notification test result'; var class_name = 'tactic.ui.panel.CustomLayoutWdg'; msg= msg.replace(/\\n/g, '<br/>'); var options = { 'html': '<div><div style="background:%s; padding: 5px">' + msg + '</div></div>'}; var kwargs = {'width':'600px'}; spt.panel.load_popup(popup_id, class_name, options, kwargs); ''' %(sobj_json, bg_color)} return bvr