Ejemplo n.º 1
0
def vcms_login(self, functions, actions, html_template, page_settings,
               parameter_dict):
    html = HtmlBuilder()
    html_data = html.getHeaderFooterHtml(page_settings, 1)
    return render_template(html_template,
                           header_footer_data=html_data,
                           data=page_settings)
Ejemplo n.º 2
0
def hrs_view_product(self, functions, actions, html_template, page_settings,
                     parameter_dict):
    html = HtmlBuilder()
    html_data = html.getHeaderFooterHtml(page_settings, 1)
    hrs = Hrs()
    page_settings["company_list"] = hrs.get_company_list(actions)
    page_settings["token"] = hrs.get_token()
    return render_template(html_template,
                           header_footer_data=html_data,
                           data=page_settings)
Ejemplo n.º 3
0
def hrs_view_self_test_image(self, functions, actions, html_template,
                             page_settings, parameter_dict):
    html = HtmlBuilder()
    html_data = html.getHeaderFooterHtml(page_settings, 1)
    pages = 1
    if parameter_dict.get("pages") is not None:
        pages = int(parameter_dict.get("pages"))
    hrs = Hrs()
    company_sn = parameter_dict.get("company_sn")
    image_total, return_data = hrs.get_company_self_test_images(
        actions, company_sn, parameter_dict, pages)
    page_settings["image_list"] = return_data
    page_settings["image_total"] = image_total
    page_settings["token"] = hrs.get_token()
    page_settings["company_name"] = hrs.get_company_info(
        int(company_sn))["company_name"]
    page_settings["forder"] = parameter_dict.get("folder")
    return render_template(html_template,
                           header_footer_data=html_data,
                           data=page_settings)
Ejemplo n.º 4
0
def vcms_main(self, functions, actions, html_template, page_settings,
              parameter_dict):
    html_data = HtmlBuilder().getHeaderFooterHtml(page_settings)
    tab_ui = {}
    if session["user_rank_sn"] == 1:
        tab_ui = VcmsEngineerFunction().get_main_ui(page_settings)
    if session["user_rank_sn"] == 2:
        tab_ui = VcmsRootFunction().get_main_ui(page_settings)
    if session["user_rank_sn"] == 3:
        tab_ui = VcmsAdminFunction().get_main_ui(page_settings)
    if session["user_rank_sn"] == 4:
        tab_ui = VcmsUserFunction().get_main_ui(page_settings)
    page_settings["tab_ui"] = tab_ui
    return render_template(html_template,
                           header_footer_data=html_data,
                           data=page_settings)
Ejemplo n.º 5
0
 def get_system_announcement_list(self, page_settings, pages=1):
     self.__reset_return_value()
     html = ""
     company_sn = int(session["company_sn"])
     page_settings["company_sn"] = company_sn
     page_settings["current_language"] = session["language"]
     page_settings["system_announcement_tab"] = 15
     page_settings["add_system_announcement_tab"] = 16
     page_settings["pages"] = pages
     if company_sn == 0:
         max_page_show_data = self.__max_show_data
         max_pages = 1
         vcms_db_agent = VcmsDbAgent()
         db_data_cnt = vcms_db_agent._get_all_system_announcement_cnt()
         if db_data_cnt > 0:
             max_pages = math.ceil(db_data_cnt / max_page_show_data)
         if int(pages) == 0:
             pages = 1
         if int(pages) >= max_pages:
             pages = max_pages
         offset = (int(pages) - 1) * max_page_show_data
         page_settings[
             "announcement_list"] = vcms_db_agent._get_all_system_announcement_data(
                 max_page_show_data, offset)
         base_url = page_settings["system_announcement_url"]
         pagination_setting = {
             "base_url": page_settings["system_announcement_url"],
             "tab_sn": 15,
             "data_sn": "0",
             "bind_class": "add_system_announcement",
             "direct_page": pages,
             "max_page": max_pages,
             "go_text": page_settings["go_text"]
         }
         page_settings["pagination"] = HtmlBuilder().pagination(
             base_url, pagination_setting)
         html = render_template("tab_ui/vcms_system_announcement.tpl",
                                data=page_settings)
     return html
Ejemplo n.º 6
0
 def get_system_announcement_list(self, page_settings, pages=1):
     self.__reset_return_value()
     company_sn = int(session["company_sn"])
     page_settings["company_sn"] = company_sn
     page_settings["current_language"] = session["language"]
     page_settings["system_announcement_tab"] = 4
     page_settings["add_system_announcement_tab"] = 5
     page_settings["pages"] = pages
     publish_time = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
     max_page_show_data = self.__max_show_data
     max_pages = 1
     vcms_db_agent = VcmsDbAgent()
     db_data_cnt = vcms_db_agent._get_all_enabled_system_announcement_cnt(
         publish_time)
     if db_data_cnt > 0:
         max_pages = math.ceil(db_data_cnt / max_page_show_data)
     if int(pages) == 0:
         pages = 1
     if int(pages) >= max_pages:
         pages = max_pages
     offset = (int(pages) - 1) * max_page_show_data
     page_settings[
         "announcement_list"] = vcms_db_agent._get_all_enabled_system_announcement_data(
             publish_time, max_page_show_data, offset)
     base_url = page_settings["system_announcement_url"]
     pagination_setting = {
         "base_url": page_settings["system_announcement_url"],
         "tab_sn": 4,
         "data_sn": "0",
         "bind_class": "back_system_announcement",
         "direct_page": pages,
         "max_page": max_pages,
         "go_text": page_settings["go_text"]
     }
     page_settings["pagination"] = HtmlBuilder().pagination(
         base_url, pagination_setting)
     return render_template("tab_ui/vcms_system_announcement.tpl",
                            data=page_settings)
Ejemplo n.º 7
0
 def get_company_product_list(self, page_settings, service_sn=0, pages=1):
     self.__reset_return_value()
     html = ""
     company_sn = int(session["company_sn"])
     branch_sn = int(session["company_branch_sn"])
     max_page_show_data = self.__max_show_data
     max_pages = 1
     vcms_db_agent = VcmsDbAgent()
     db_data_cnt = vcms_db_agent._get_company_service_product_enabled_cnt(
         company_sn, service_sn)
     if db_data_cnt > 0:
         max_pages = math.ceil(db_data_cnt / max_page_show_data)
     if int(pages) == 0:
         pages = 1
     if int(pages) >= max_pages:
         pages = max_pages
     offset = (int(pages) - 1) * max_page_show_data
     page_settings["service_sn"] = service_sn
     page_settings["pages"] = pages
     page_settings[
         "product_list"] = vcms_db_agent._get_company_service_product_enabled_data(
             company_sn, service_sn, max_page_show_data, offset, branch_sn)
     base_url = page_settings["company_product_url"]
     pagination_setting = {
         "base_url": page_settings["company_product_url"],
         "tab_sn": 3,
         "data_sn": service_sn,
         "bind_class": "company_product",
         "direct_page": pages,
         "max_page": max_pages,
         "go_text": page_settings["go_text"]
     }
     page_settings["pagination"] = HtmlBuilder().pagination(
         base_url, pagination_setting)
     html = render_template("tab_ui/vcms_user_company_product.tpl",
                            data=page_settings)
     return html