mirror of
https://github.com/Pardus-LiderAhenk/ahenk
synced 2024-11-22 10:52:17 +03:00
Merge branch 'master' of https://github.com/Pardus-LiderAhenk/ahenk
This commit is contained in:
commit
2884993ebc
2 changed files with 29 additions and 0 deletions
|
@ -52,6 +52,9 @@ class AhenkDbService(object):
|
||||||
'timestamp TEXT', 'choice TEXT'])
|
'timestamp TEXT', 'choice TEXT'])
|
||||||
self.check_and_create_table('session', ['username TEXT', 'display TEXT', 'desktop TEXT', 'timestamp 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):
|
def get_cols(self, table_name):
|
||||||
if table_name == 'agreement':
|
if table_name == 'agreement':
|
||||||
return ['contract_id', 'username', 'timestamp', 'choice']
|
return ['contract_id', 'username', 'timestamp', 'choice']
|
||||||
|
|
|
@ -20,6 +20,9 @@ class Context(object):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.data = dict()
|
self.data = dict()
|
||||||
self.scope = Scope().get_instance()
|
self.scope = Scope().get_instance()
|
||||||
|
self.mail_send = False
|
||||||
|
self.mail_subject = ''
|
||||||
|
self.mail_content = ''
|
||||||
|
|
||||||
def put(self, var_name, data):
|
def put(self, var_name, data):
|
||||||
self.data[var_name] = data
|
self.data[var_name] = data
|
||||||
|
@ -53,6 +56,24 @@ class Context(object):
|
||||||
|
|
||||||
return success
|
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):
|
class Plugin(threading.Thread):
|
||||||
"""
|
"""
|
||||||
|
@ -95,6 +116,11 @@ class Plugin(threading.Thread):
|
||||||
|
|
||||||
task_data = item_obj.get_parameter_map()
|
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')
|
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:
|
if System.Sessions.user_name() is not None and len(System.Sessions.user_name()) > 0:
|
||||||
|
|
Loading…
Reference in a new issue