Sindbad~EG File Manager

Current Path : /home/numerotech/st.aios-scientificcommittee.org/aios-slots/core/library/
Upload File :
Current File : //home/numerotech/st.aios-scientificcommittee.org/aios-slots/core/library/helper.py

from core import app
from flask import render_template_string
from flask import url_for
from datetime import datetime, date, time, timedelta
import datetime
import imp,sys

#settime working as global variable but commented for easy identification of this variable using class name 
# global settime
# settime = 5

class Helper:
    def_cat_id = 161
    mark1 = 10
    mark2 = 10
    mark3 = 10
    test_mail = "mukeshkumar@numerotec.com"
    testmail = "mukeshkumar@numerotec.com"
    master_email_ids = ["manjula@numerotec.com","priyavarthana@numerotec.com"]
    def isAjax(request):
        if request.headers.get("X-Requested-With") == "XMLHttpRequest":
            return True
        else:
            return False 

    def convert_jinja_template(data1,data):
        # data1 = data1[0]
        temp = app.jinja_env.from_string(data1["template_data"]).render(data=data)
        return render_template_string(temp)

    def footer_text():
        return ""

    def email_mask(email):
        if email:
            lo = email.find('@')
            if lo>0:
                mask_email =  email[0]+"*****"+email[lo-1:]
            return mask_email
        return email

    def mobile_mask(mobile):
        if mobile:
            lo = len(mobile)
            if lo>0:
                mask =  mobile[:2]+"******"+mobile[lo-2:]
                return mask
        return mobile

    def call_custom_controller(abs_type,conf_key):
        module_name = abs_type+"Controller"
        fp, pathname, description = imp.find_module(module_name,["./core/controller/"+conf_key.upper()])
        module = imp.load_module(module_name, fp, pathname, description)
        myclass = getattr(module, module_name)
        return myclass

    def merge_tags(text,values):
        for k, v in values.items():
            text = text.replace('*|'+k+'|*', v)
        return text

    def convert_html_for_mail_screen(data):
        temp = app.jinja_env.from_string("{{mail_content|safe}}").render(**data)
        return render_template_string(temp,**data)


app.jinja_env.globals.update(Helper=Helper) 




Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists