diff --git a/opt/ahenk/base/database/ahenk_db_service.py b/opt/ahenk/base/database/ahenk_db_service.py index 2bd037f..8e7a9f0 100644 --- a/opt/ahenk/base/database/ahenk_db_service.py +++ b/opt/ahenk/base/database/ahenk_db_service.py @@ -52,6 +52,9 @@ class AhenkDbService(object): 'timestamp TEXT', 'choice TEXT']) self.check_and_create_table('session', ['username TEXT', 'display TEXT', 'desktop TEXT', 'timestamp TEXT']) + self.check_and_create_table('mail', ['id INTEGER PRIMARY KEY AUTOINCREMENT', 'command TEXT', 'mailstatus INTEGER', 'timestamp TEXT']) + + def get_cols(self, table_name): if table_name == 'agreement': return ['contract_id', 'username', 'timestamp', 'choice'] diff --git a/opt/ahenk/base/plugin/plugin.py b/opt/ahenk/base/plugin/plugin.py index 7222654..2e2e864 100644 --- a/opt/ahenk/base/plugin/plugin.py +++ b/opt/ahenk/base/plugin/plugin.py @@ -20,6 +20,9 @@ class Context(object): def __init__(self): self.data = dict() self.scope = Scope().get_instance() + self.mail_send = False + self.mail_subject = '' + self.mail_content = '' def put(self, var_name, data): self.data[var_name] = data @@ -53,6 +56,24 @@ class Context(object): return success + def is_mail_send(self): + return self.mail_send + + def set_mail_send(self, mail_send): + self.mail_send=mail_send + + def get_mail_subject(self): + return self.mail_subject + + def set_mail_subject(self, mail_subject): + self.mail_subject=mail_subject + + def get_mail_content(self): + return self.mail_content + + def set_mail_content(self, mail_content): + self.mail_content = mail_content + class Plugin(threading.Thread): """ @@ -95,6 +116,11 @@ class Plugin(threading.Thread): task_data = item_obj.get_parameter_map() + # check if mail send is actve or not and set mail params to context object.. plugins get mail params via context object + self.context.set_mail_send(task_data['mailSend'] if 'mailSend' in task_data else False) + self.context.set_mail_subject(task_data['mailSubject'] if 'mailSubject' in task_data else '') + self.context.set_mail_content(task_data['mailContent'] if 'mailContent' in task_data else '') + self.logger.debug('[Plugin] Sending notify to user about task process') if System.Sessions.user_name() is not None and len(System.Sessions.user_name()) > 0: