<commit_before>package cn.cerc.ui.parts;

import java.util.ArrayList;
import java.util.List;

import cn.cerc.core.IHandle;
import cn.cerc.core.Utils;
import cn.cerc.db.core.ServerConfig;
import cn.cerc.mis.core.AbstractJspPage;
import cn.cerc.mis.core.Application;
import cn.cerc.mis.core.IClient;
import cn.cerc.mis.core.IForm;
import cn.cerc.mis.language.R;
import cn.cerc.mis.services.BookInfoRecord;
import cn.cerc.mis.services.MemoryBookInfo;
import cn.cerc.ui.core.Component;
import cn.cerc.ui.core.HtmlWriter;
import cn.cerc.ui.core.UrlRecord;

public class UIHeader extends UIComponent {
    private static final int MAX_MENUS = 4;
    private UIAdvertisement advertisement; // 可选
    // 页面标题
    private String pageTitle = null;
    // 首页
    private UrlRecord homePage;
    // 左边菜单
    private List<UrlRecord> leftMenus = new ArrayList<>();
    // 左菜单按钮
    private List<UIBottom> leftBottom = new ArrayList<>();
    // 右边菜单
    private List<UrlRecord> rightMenus = new ArrayList<>();
    // 当前用户
    private String userName;
    // 欢迎语
    private String welcome;
    // logo图标src
    private String logoSrc;
    // 当前用户
    private String currentUser;
    // 当前账套
    private String currentCorpNo;
    // 当前账套名称
    private String corpNoName;
    // 退出
    private UrlRecord exitPage = null;
    // 退出系统
    private UrlRecord exitSystem = null;
    // 菜单模组
    private String moduleCode = null;

    public void setHeadInfo(String logoSrc, String welcome) {
        this.logoSrc = logoSrc;
        this.welcome = welcome;
    }

    public UIHeader(AbstractJspPage owner) {
        super(owner);
        ServerConfig config = ServerConfig.getInstance();
        String homeImg = "images/Home.png";
        if (owner.getForm().getClient().isPhone()) {
            homeImg = config.getProperty("app.phone.home.image", homeImg);
        }
        homePage = new UrlRecord(Application.getAppConfig().getFormDefault(),
                String.format("<img src=\"%s\"/>", homeImg));
        leftMenus.add(homePage);
        homePage = new UrlRecord(Application.getAppConfig().getFormDefault(),
                R.asString(owner.getForm().getHandle(), "开始"));
        boolean isShowBar = "true".equals(config.getProperty("app.ui.head.show", "true"));
        if (!client.isPhone() && isShowBar) {
            IHandle handle = owner.getForm().getHandle();
            String token = (String) handle.getProperty(Application.token);
            handle.init(token);<commit_msg>Update UIHeader.java<commit_after>package cn.cerc.ui.parts;

import java.util.ArrayList;
import java.util.List;

import cn.cerc.core.IHandle;
import cn.cerc.core.Utils;
import cn.cerc.db.core.ServerConfig;
import cn.cerc.mis.core.AbstractJspPage;
import cn.cerc.mis.core.Application;
import cn.cerc.mis.core.IClient;
import cn.cerc.mis.core.IForm;
import cn.cerc.mis.language.R;
import cn.cerc.mis.services.BookInfoRecord;
import cn.cerc.mis.services.MemoryBookInfo;
import cn.cerc.ui.core.Component;
import cn.cerc.ui.core.HtmlWriter;
import cn.cerc.ui.core.UrlRecord;

public class UIHeader extends UIComponent {
    private static final int MAX_MENUS = 4;
    private UIAdvertisement advertisement; // 可选
    // 页面标题
    private String pageTitle = null;
    // 首页
    private UrlRecord homePage;
    // 左边菜单
    private List<UrlRecord> leftMenus = new ArrayList<>();
    // 左菜单按钮
    private List<UIBottom> leftBottom = new ArrayList<>();
    // 右边菜单
    private List<UrlRecord> rightMenus = new ArrayList<>();
    // 当前用户
    private String userName;
    // 欢迎语
    private String welcome;
    // logo图标src
    private String logoSrc;
    // 当前用户
    private String currentUser;
    // 当前账套
    private String currentCorpNo;
    // 当前账套名称
    private String corpNoName;
    // 退出
    private UrlRecord exitPage = null;
    // 退出系统
    private UrlRecord exitSystem = null;
    // 菜单模组
    private String moduleCode = null;

    public void setHeadInfo(String logoSrc, String welcome) {
        this.logoSrc = logoSrc;
        this.welcome = welcome;
    }

    public UIHeader(AbstractJspPage owner) {
        super(owner);
        ServerConfig config = ServerConfig.getInstance();
        String homeImg = "images/Home.png";
        if (owner.getForm().getClient().isPhone()) {
            homeImg = config.getProperty("app.phone.home.image", homeImg);
        }
        homePage = new UrlRecord(Application.getAppConfig().getFormDefault(),
                String.format("<img src=\"%s\"/>", homeImg));
        leftMenus.add(homePage);
        homePage = new UrlRecord(Application.getAppConfig().getFormDefault(),
                R.asString(owner.getForm().getHandle(), "开始"));
        IClient client = owner.getForm().getClient();
        boolean isShowBar = "true".equals(config.getProperty("app.ui.head.show", "true"));
        if (!client.isPhone() && isShowBar) {
            IHandle handle = owner.getForm().getHandle();
            String token = (String) handle.getProperty(Application.token);
            handle.init(token);
{'fraction_non_alphanumeric': 0.12188310392978256, 'fraction_numerical': 0.00039896269698783165, 'mean_word_length': 2.8658442559753277, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2764929', 'n_tokens_mistral': 1645, 'n_tokens_neox': 1683, 'n_words': 333}