text:
package com.dli.controllers;

import com.dli.entities.*;
import com.dli.helper.Constant;
import com.dli.helper.FileUtil;
import com.dli.helper.Helper;
import com.dli.services.CollectService;
import com.dli.services.CourseService;
import com.dli.services.EnrollmentService;
import com.dli.services.LogonService;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.util.*;

@RestController
@RequestMapping("/")
public class EnrollmentController {

    private Logger logger = LoggerFactory.getLogger(this.getClass());

    @Autowired
    private EnrollmentService enrollmentService;

    @Autowired
    private CollectService collectService;

    @Autowired
    private LogonService logonService;

    @RequestMapping(value = "/getEnrollmentPeriodListInprocess", method = RequestMethod.GET)
    public Map getEnrollmentPeriodListInprocess(int skip, int take, @RequestHeader Map header) {
        Map<String, Object> result = new HashMap<String, Object>();
        String token = header.get("token").toString();
        User user = logonService.getUserByToken(token);
        if (user == null) {
            result.put(Constant.status, 0);
            result.put(Constant.result, "无效的登录用户");
            return result;
        }

        try {
            List<EnrollmentPeriodEnrollment> lst = enrollmentService.getEnrollmentPeriodListInprocess(user.getCompany_id(), skip, take);

            result.put(Constant.status, 1);
            result.put(Constant.result, lst);
        } catch (Exception ex) {
            logger.error(ex.getMessage());
            result.put(Constant.status, 0);
            result.put(Constant.result, ex.getMessage());
        }
        return result;
    }

    @RequestMapping(value = "/getEnrollmentPeriodListFinished", method = RequestMethod.GET)
    public Map getEnrollmentPeriodListFinished(int skip, int take, @RequestHeader Map header) {
        Map<String, Object> result = new HashMap<String, Object>();
        String token = header.get("token").toString();
        User user = logonService.getUserByToken(token);
        if (user == null) {
            result.put(Constant.status, 0);
            result.put(Constant.result, "无效的登录用户");
            return result;
        }

        try {
            List<EnrollmentPeriodEnrollment> lst = enrollmentService.getEnrollmentPeriodListFinished(user.getUser_id(), user.getCompany_id(), skip, take);

            result.put(Constant.status, 1);
            result.put(Constant.result, lst);
        } catch (Exception ex) {
            logger.error(ex.getMessage());
            result.put(Constant.status, 0);
            result.put(Constant.result, ex.getMessage());
        }
        return result;
    }

    @RequestMapping(value = "/enrollmentReminderAdded", method = RequestMethod.GET)
    public Map enrollmentReminderAdded(int periodid, @RequestHeader Map header) {
        Map<String, Object> result = new HashMap<String, Object>();
        String token = header.get("token").toString();
        User user = logonService.getUserByToken(token);
        if (user == null) {
            result.put(Constant.status, 0);
            result.put(Constant.result, "无效的登录用户");
            return result;
        }

        try {
            int count = enrollmentService.getReminderMappingCount(periodid, user.getUser_id());
            int added = 0;
            if (count > 0) {

                added = 1;
            }

            result.put(Constant.status, 1);
            result.put(Constant.result, added);
        } catch (Exception ex) {
            logger.error(ex.getMessage());
            result.put(Constant.status, 0);
            result.put(Constant.result, ex.getMessage());
        }
        return result;
    }

    @RequestMapping(value = "/addReminderMapping", method = RequestMethod.GET)
    public Map addReminderMapping(int periodid, @RequestHeader Map header) {
        Map<String, Object> result = new HashMap<String, Object>();
        String token = header.get("token").toString();
        User user = logonService.getUserByToken(token);
        if (user == null) {
            result.put(Constant.status, 0);
            result.put(Constant.result, "无效的登录用户");
            return result;
        }

        try {
            int count = enrollmentService.getReminderMappingCount(periodid, user.getUser_id());
            if (count > 0) {

                result.put(Constant.status, 0);
                result.put(Constant.result, "不能重复添加开班提醒");
            } else {
                enrollmentService.addReminderMapping(periodid, user.getUser_id());
                result.put(Constant.status, 1);
                result.put(Constant.result, "该报名已加入开班提醒");
            }
        } catch (Exception ex) {
            logger.error(ex.getMessage());
            result.put(Constant.status, 0);
            result.put(Constant.result, ex.getMessage());
        }
        return result;
    }

    @RequestMapping(value = "/getEnrollmentPeriodByID", method = RequestMethod.GET)
    public Map getEnrollmentPeriodByID(int periodid, @RequestHeader Map header) {
        Map<String, Object> result = new HashMap<String, Object>();
        String token = header.get("token").toString();
        User user = logonService.getUserByToken(token);
        if (user == null) {
            result.put(Constant.status, 0);
            result.put(Constant.result, "无效的登录用户");
            return result;
        }

        try {
            EnrollmentPeriodEnrollment entity = enrollmentService.getEnrollmentPeriodByID(periodid, user.getUser_id());

            result.put(Constant.status, 1);
            result.put(Constant.result, entity);

        } catch (Exception ex) {
            logger.error(ex.getMessage());
            result.put(Constant.status, 0);
            result.put(Constant.result, ex.getMessage());
        }
        return result;
    }

    @RequestMapping(value = "/addEnrollmentMapping", method = RequestMethod.GET)
    public Map addEnrollmentMapping(int periodid, @RequestHeader Map header) {
        Map<String, Object> result = new HashMap<String, Object>();
        String token = header.get("token").toString();
        User user = logonService.getUserByToken(token);
        if (user == null) {
            result.put(Constant.status, 0);
            result.put(Constant.result, "无效的登录用户");
            return result;
        }

        try {

            int count = enrollmentService.getEnrollmentMappingCount(periodid, user.getUser_id());

            if (count > 0) {
                result.put(Constant.status, 0);
                result.put(Constant.result, "不能重复报名");
            } else {
                enrollmentService.addEnrollmentMapping(periodid, user.getUser_id());

                result.put(Constant.status, 1);
                result.put(Constant.result, "报名成功");
            }

        } catch (Exception ex) {
            logger.error(ex.getMessage());
            result.put(Constant.status, 0);
            result.put(Constant.result, ex.getMessage());
        }
        return result;
    }

    @RequestMapping(value = "/deleteEnrollmentMapping", method = RequestMethod.GET)
    public Map deleteEnrollmentMapping(int periodid, @RequestHeader Map header) {
        Map<String, Object> result = new HashMap<String, Object>();
        String token = header.get("token").toString();
        User user = logonService.getUserByToken(token);
        if (user == null) {
            result.put(Constant.status, 0);
            result.put(Constant.result, "无效的登录用户");
            return result;
        }

        try {

            enrollmentService.deleteEnrollmentMapping(periodid, user.getUser_id());

            result.put(Constant.status, 1);
            result.put(Constant.result, "删除报名成功");

        } catch (Exception ex) {
            logger.error(ex.getMessage());
            result.put(Constant.status, 0);
            result.put(Constant.result, ex.getMessage());
        }
        return result;
    }

    @RequestMapping(value = "/getEnrollmentContentListByID", method = RequestMethod.GET)
    public Map getEnrollmentContentListByID(int periodid, @RequestHeader Map header) {
        Map<String, Object> result = new HashMap<String, Object>();
        String token = header.get("token").toString();
        User user = logonService.getUserByToken(token);
        if (user == null) {
            result.put(Constant.status, 0);
            result.put(Constant.result, "无效的登录用户");
            return result;
        }

        try {
            List<EnrollmentContent> contentLst = enrollmentService.getEnrollmentContentListByID(periodid);

            result.put(Constant.status, 1);
            result.put(Constant.result, contentLst);

        } catch (Exception ex) {
            logger.error(ex.getMessage());
            result.put(Constant.status, 0);
            result.put(Constant.result, ex.getMessage());
        }
        return result;
    }

    @RequestMapping(value = "/addEnrollmentCollection", method = RequestMethod.GET)
    public Map addEnrollmentCollection(int periodid, @RequestHeader Map header) {
        Map<String, Object> result = new HashMap<String, Object>();
        String token = header.get("token").toString();
        User user = logonService.getUserByToken(token);
        if (user == null) {
            result.put(Constant.status, 0);
            result.put(Constant.result, "无效的登录用户");
            return result;
        }

        try {

            boolean r = collectService.itemCollected("enrollment", periodid, user.getUser_id());

            if (r) {
                result.put(Constant.status, 0);
                result.put(Constant.result, "不能重复收藏");

            } else {
                collectService.addCollection(user.getUser_id(), Helper.GetItemType(3), periodid);

                result.put(Constant.status, 1);
                result.put(Constant.result, "收藏成功");

            }

        } catch (Exception ex) {
            logger.error(ex.getMessage());
            result.put(Constant.status, 0);
            result.put(Constant.result, ex.getMessage());
        }
        return result;
    }

    @RequestMapping(value = "/cancelEnrollmentCollection", method = RequestMethod.GET)
    public Map cancelEnrollmentCollection(int periodid, @RequestHeader Map header) {
        Map<String, Object> result = new HashMap<String, Object>();
        String token = header.get("token").toString();
        User user = logonService.getUserByToken(token);
        if (user == null) {
            result.put(Constant.status, 0);
            result.put(Constant.result, "无效的登录用户");
            return result;
        }

        try {
            collectService.cancelCollection(user.getUser_id(), Helper.GetItemType(3), periodid);
            result.put(Constant.status, 1);
            result.put(Constant.result, "取消收藏成功");
        } catch (Exception ex) {
            logger.error(ex.getMessage());
            result.put(Constant.status, 0);
            result.put(Constant.result, ex.getMessage());
        }
        return result;
    }

    @RequestMapping(value = "/addEnrollmentComment", method = RequestMethod.POST)
    public Map addEnrollmentComment(@RequestBody Map body, @RequestHeader Map header) {
        Map<String, Object> result = new HashMap<String, Object>();
        String token = header.get("token").toString();
        User user = logonService.getUserByToken(token);
        if (user == null) {
            result.put(Constant.status, 0);
            result.put(Constant.result, "无效的登录用户");
            return result;
        }

        try {
            int enrollmentid = (int) body.get("enrollmentid");
            int star = (int) body.get("star");
            String comment = (String) body.get("comment");

            boolean  exist = enrollmentService.getEnrommentCommentCountByUseridEnrollmentid(  user.getUser_id() , enrollmentid);

            if( exist )
            {
                result.put(Constant.status, 0);
                result.put(Constant.result, "不能重复评价");
            }
            else {
                enrollmentService.addEnrollmentComment(user.getUser_id(), enrollmentid, star, comment);

                result.put(Constant.status, 1);
                result.put(Constant.result, "评价成功");
            }

        } catch (Exception ex) {
            logger.error(ex.getMessage());
            result.put(Constant.status, 0);
            result.put(Constant.result, ex.getMessage());
        }
        return result;
    }

    @RequestMapping(value = "/getEnrollmentCommentList", method = RequestMethod.GET)
    public Map getEnrollmentCommentList(int enrollmentid, @RequestHeader Map header) {
        Map<String, Object> result = new HashMap<String, Object>();
        String token = header.get("token").toString();
        User user = logonService.getUserByToken(token);
        if (user == null) {
            result.put(Constant.status, 0);
            result.put(Constant.result, "无效的登录用户");
            return result;
        }

        try {
            List<EnrollmentComment> lst = enrollmentService.getEnrollmentCommentList(enrollmentid);

            result.put(Constant.status, 1);
            result.put(Constant.result, lst);

        } catch (Exception ex) {
            logger.error(ex.getMessage());
            result.put(Constant.status, 0);
            result.put(Constant.result, ex.getMessage());
        }
        return result;
    }

    @RequestMapping(value = "/getReminderList", method = RequestMethod.GET)
    public Map getReminderList(@RequestHeader Map header) {
        Map<String, Object> result = new HashMap<String, Object>();
        String token = header.get("token").toString();
        User user = logonService.getUserByToken(token);
        if (user == null) {
            result.put(Constant.status, 0);
            result.put(Constant.result, "无效的登录用户");
            return result;
        }

        try {
            List<EnrollmentReminderAndTarget> lst = enrollmentService.getReminderList(user.getUser_id());

            result.put(Constant.status, 1);
            result.put(Constant.result, lst);

        } catch (Exception ex) {
            logger.error(ex.getMessage());
            result.put(Constant.status, 0);
            result.put(Constant.result, ex.getMessage());
        }
        return result;
    }

    @RequestMapping(value = "/updateReadReminder", method = RequestMethod.GET)
    public Map updateReadReminder(int periodid, @RequestHeader Map header) {
        Map<String, Object> result = new HashMap<String, Object>();
        String token = header.get("token").toString();
        User user = logonService.getUserByToken(token);
        if (user == null) {
            result.put(Constant.status, 0);
            result.put(Constant.result, "无效的登录用户");
            return result;
        }

        try {
            enrollmentService.updateReadReminder(periodid, user.getUser_id());

            result.put(Constant.status, 1);
            result.put(Constant.result, "reminder读取更新成功");

        } catch (Exception ex) {
            logger.error(ex.getMessage());
            result.put(Constant.status, 0);
            result.put(Constant.result, ex.getMessage());
        }
        return result;
    }

    @RequestMapping(value = "/back/GetEnrollmentList", method = RequestMethod.GET)
    public Map backGetEnrollmentList(String title, String teacher, String start, String end, int skip, int take, @RequestHeader Map header) {
        Map<String, Object> result = new HashMap<String, Object>();
        String token = header.get("token").toString();
        User user = logonService.getUserByToken(token);
        if (user == null) {
            result.put(Constant.status, 0);
            result.put(Constant.result, "无效的登录用户");
            return result;
        }

        try {
            backEnrollment e = new backEnrollment();

            if (!Helper.isNullOrEmpty(title))
                e.setTitle(title);

            if (!Helper.isNullOrEmpty(teacher))
                e.setTeacher(teacher);

            if (!Helper.isNullOrEmpty(start))
                e.setStartCondition(  Helper.dateParse(start) );

            if (!Helper.isNullOrEmpty(end))
                e.setEndCondition(  Helper.addOneDay(end) );

            e.setCompany_id(user.getCompany_id());
            e.setSkip(skip);
            e.setTake(take);

            List<backEnrollment> lst = enrollmentService.backGetEnrollmentList(e);
            int total = enrollmentService.backGetEnrollmentListCount(e);

            result.put(Constant.status, 1);
            result.put(Constant.result, lst);
            result.put(Constant.total, total);

        } catch (Exception ex) {
            logger.error(ex.getMessage());
            result.put(Constant.status, 0);
            result.put(Constant.result, ex.getMessage());
        }
        return result;
    }

    @Value("${fileroot}")
    private String fileroot;

    @Value("${exportfolder}")
    private String exportfolder;

    @RequestMapping(value = "/back/ExportEnrollmentList", method = RequestMethod.GET)
    public Map backExportEnrollmentList(String title, String teacher, String start, String end,
                                        @RequestHeader Map header) {

        Map<String, Object> result = new HashMap<String, Object>();
        String token = header.get("token").toString();
        User user = logonService.getUserByToken(token);
        if (user == null) {
            result.put(Constant.status, 0);
            result.put(Constant.result, "无效的登录用户");
            return result;
        }
        try {
            //获取数据

            backEnrollment e = new backEnrollment();

            if (!Helper.isNullOrEmpty(title))
                e.setTitle(title);

            if (!Helper.isNullOrEmpty(teacher))
                e.setTeacher(teacher);

           // if (!Helper.isNullOrEmpty(start))
           //     e.setStart(start);

           // if (!Helper.isNullOrEmpty(end))
           //     e.setEnd(end);

            if (!Helper.isNullOrEmpty(start))
                e.setStartCondition(  Helper.dateParse(start) );

            if (!Helper.isNullOrEmpty(end))
                e.setEndCondition(  Helper.addOneDay(end) );

            e.setCompany_id(user.getCompany_id());
            e.setSkip(0);
            e.setTake(Constant.takeMax);

            List<backEnrollment> lst = enrollmentService.backGetEnrollmentList(e);

            //导出到服务器
            List<String> rowNameList = new ArrayList<>();

            rowNameList.add("课程名称");
            rowNameList.add("讲师");
            rowNameList.add("开始时间");
            rowNameList.add("结束时间");
            rowNameList.add("人数限制");

            List<Object[]> dataList = new ArrayList<>();

            for (backEnrollment be : lst) {
                Object[] dataArray = new Object[5];

                dataArray[0] = be.getTitle();
                dataArray[1] = be.getTeacher();
                dataArray[2] = be.getStart();
                dataArray[3] = be.getEnd();
                dataArray[4] = be.getCount();

                dataList.add(dataArray);
            }

            String url = Helper.Export(rowNameList, dataList, "EnrollmentList-", fileroot, exportfolder);

            result.put(Constant.status, 1);
            result.put(Constant.result, url);

        } catch (Exception ex) {
            logger.error(ex.getMessage());
            result.put(Constant.status, 0);
            result.put(Constant.result, ex.getMessage());
        }
        return result;
    }

    @RequestMapping(value = "/back/GetEnrollmentCommentList", method = RequestMethod.GET)
    public Map backGetEnrollmentCommentList(int enrollmentid, int skip, int take, @RequestHeader Map header) {
        Map<String, Object> result = new HashMap<String, Object>();
        String token = header.get("token").toString();
        User user = logonService.getUserByToken(token);
        if (user == null) {
            result.put(Constant.status, 0);
            result.put(Constant.result, "无效的登录用户");
            return result;
        }

        try {
            List<EnrollmentComment> lst = enrollmentService.backGetEnrollmentCommentList(enrollmentid, skip, take);
            int total = enrollmentService.backGetEnrollmentCommentListCount(enrollmentid);

            result.put(Constant.status, 1);
            result.put(Constant.result, lst);
            result.put(Constant.total, total);

        } catch (Exception ex) {
            logger.error(ex.getMessage());
            result.put(Constant.status, 0);
            result.put(Constant.result, ex.getMessage());
        }
        return result;
    }

    @RequestMapping(value = "/back/GetEnrollmentResultList", method = RequestMethod.GET)
    public Map backGetEnrollmentResultList(String title, String teacher, String start, String end, int skip, int take, @RequestHeader Map header) {
        Map<String, Object> result = new HashMap<String, Object>();
        String token = header.get("token").toString();
        User user = logonService.getUserByToken(token);
        if (user == null) {
            result.put(Constant.status, 0);
            result.put(Constant.result, "无效的登录用户");
            return result;
        }

        try {
            backEnrollment e = new backEnrollment();

            if (!Helper.isNullOrEmpty(title))
                e.setTitle(title);

            if (!Helper.isNullOrEmpty(teacher))
                e.setTeacher(teacher);

          //  if (!Helper.isNullOrEmpty(start))
          //      e.setStart(start);

          //  if (!Helper.isNullOrEmpty(end))
          //      e.setEnd(end);

            if (!Helper.isNullOrEmpty(start))
                e.setStartCondition(  Helper.dateParse(start) );

            if (!Helper.isNullOrEmpty(end))
                e.setEndCondition(  Helper.addOneDay(end) );

            e.setCompany_id(user.getCompany_id());
            e.setSkip(skip);
            e.setTake(take);

            List<backEnrollment> lst = enrollmentService.backGetEnrollmentResultList(e);

            int total = enrollmentService.backGetEnrollmentResultListCount(e);

            result.put(Constant.status, 1);
            result.put(Constant.result, lst);
            result.put(Constant.total, total);

        } catch (Exception ex) {
            logger.error(ex.getMessage());
            result.put(Constant.status, 0);
            result.put(Constant.result, ex.getMessage());
        }
        return result;
    }

    @RequestMapping(value = "/back/ExportEnrollmentResultList", method = RequestMethod.GET)
    public Map backExportEnrollmentResultList(String title, String teacher, String start, String end, @RequestHeader Map header) {
        Map<String, Object> result = new HashMap<String, Object>();
        String token = header.get("token").toString();
        User user = logonService.getUserByToken(token);
        if (user == null) {
            result.put(Constant.status, 0);
            result.put(Constant.result, "无效的登录用户");
            return result;
        }

        try {
            backEnrollment e = new backEnrollment();

            if (!Helper.isNullOrEmpty(title))
                e.setTitle(title);

            if (!Helper.isNullOrEmpty(teacher))
                e.setTeacher(teacher);

          //  if (!Helper.isNullOrEmpty(start))
           //     e.setStart(start);

          //  if (!Helper.isNullOrEmpty(end))
           //     e.setEnd(end);

            if (!Helper.isNullOrEmpty(start))
                e.setStartCondition(  Helper.dateParse(start) );

            if (!Helper.isNullOrEmpty(end))
                e.setEndCondition(  Helper.addOneDay(end) );

            e.setCompany_id(user.getCompany_id());
            e.setSkip(0);
            e.setTake(Constant.takeMax);

            List<backEnrollment> lst = enrollmentService.backGetEnrollmentResultList(e);

            //导出到服务器
            List<String> rowNameList = new ArrayList<>();

            rowNameList.add("课程名称");
            rowNameList.add("讲师");
            rowNameList.add("开始时间");
            rowNameList.add("结束时间");
            rowNameList.add("人数限制");

            rowNameList.add("本期报名");
            rowNameList.add("预约下期");

            List<Object[]> dataList = new ArrayList<>();

            for (backEnrollment be : lst) {
                Object[] dataArray = new Object[7];

                dataArray[0] = be.getTitle();
                dataArray[1] = be.getTeacher();
                dataArray[2] = be.getStart();
                dataArray[3] = be.getEnd();
                dataArray[4] = be.getCount();

                dataArray[5] = be.getCountThisPeriod();

                dataArray[6] = be.getDateCountNextPeriod();

                dataList.add(dataArray);
            }

            String url = Helper.Export(rowNameList, dataList, "EnrollmentResultList-", fileroot, exportfolder);

            result.put(Constant.status, 1);
            result.put(Constant.result, url);

        } catch (Exception ex) {
            logger.error(ex.getMessage());
            result.put(Constant.status, 0);
            result.put(Constant.result, ex.getMessage());
        }
        return result;
    }

    @RequestMapping(value = "/back/GetUserListThisEnrollmentPeriod", method = RequestMethod.GET)
    public Map backGetUserListThisEnrollmentPeriod(int periodid, int skip, int take, @RequestHeader Map header) {
        Map<String, Object> result = new HashMap<String, Object>();
        String token = header.get("token").toString();
        User user = logonService.getUserByToken(token);
        if (user == null) {
            result.put(Constant.status, 0);
            result.put(Constant.result, "无效的登录用户");
            return result;
        }

        try {
            List<User> lst = enrollmentService.backGetUserListThisEnrollmentPeriod(periodid, skip, take);
            int total = enrollmentService.backGetUserListThisEnrollmentPeriodCount(periodid);

            result.put(Constant.status, 1);
            result.put(Constant.result, lst);
            result.put(Constant.total, total);

        } catch (Exception ex) {
            logger.error(ex.getMessage());
            result.put(Constant.status, 0);
            result.put(Constant.result, ex.getMessage());
        }
        return result;
    }

    @RequestMapping(value = "/back/GetUserListNextEnrollmentPeriod", method = RequestMethod.GET)
    public Map backGetUserListNextEnrollmentPeriod(int periodid, int skip, int take, @RequestHeader Map header) {
        Map<String, Object> result = new HashMap<String, Object>();
        String token = header.get("token").toString();
        User user = logonService.getUserByToken(token);
        if (user == null) {
            result.put(Constant.status, 0);
            result.put(Constant.result, "无效的登录用户");
            return result;
        }

        try {
            List<User> lst = enrollmentService.backGetUserListNextEnrollmentPeriod(periodid, skip, take);
            int total = enrollmentService.backGetUserListNextEnrollmentPeriodCount(periodid);

            result.put(Constant.status, 1);
            result.put(Constant.result, lst);
            result.put(Constant.total, total);

        } catch (Exception ex) {
            logger.error(ex.getMessage());
            result.put(Constant.status, 0);
            result.put(Constant.result, ex.getMessage());
        }
        return result;
    }

    @RequestMapping(value = "/back/DisableEnrollmentPeriod", method = RequestMethod.GET)
    public Map backDisableEnrollmentPeriod(int periodid, @RequestHeader Map header) {
        Map<String, Object> result = new HashMap<String, Object>();
        String token = header.get("token").toString();
        User user = logonService.getUserByToken(token);
        if (user == null) {
            result.put(Constant.status, 0);
            result.put(Constant.result, "无效的登录用户");
            return result;
        }

        try {
            enrollmentService.backDisableEnrollmentPeriod(periodid);

            result.put(Constant.status, 1);
            result.put(Constant.result, "删除成功");
            //   result.put(Constant.total, total);

        } catch (Exception ex) {
            logger.error(ex.getMessage());
            result.put(Constant.status, 0);
            result.put(Constant.result, ex.getMessage());
        }
        return result;
    }

    @RequestMapping(value = "/back/GetEnrollmentEditPageInfoByEnrollmentID", method = RequestMethod.GET)
    public Map backGetEnrollmentEditPageInfoByEnrollmentID(int enrollmentid, @RequestHeader Map header) {
        Map<String, Object> result = new HashMap<String, Object>();
        String token = header.get("token").toString();
        User user = logonService.getUserByToken(token);
        if (user == null) {
            result.put(Constant.status, 0);
            result.put(Constant.result, "无效的登录用户");
            return result;
        }

        try {
            EnrollmentEditPageInfo e = enrollmentService.backGetEnrollmentEditPageInfoByEnrollmentID(enrollmentid);

            result.put(Constant.status, 1);
            result.put(Constant.result, e);

        } catch (Exception ex) {
            logger.error(ex.getMessage());
            result.put(Constant.status, 0);
            result.put(Constant.result, ex.getMessage());
        }
        return result;
    }

    @RequestMapping(value = "/back/GetEnrollmentEditPageInfoByPeriodID", method = RequestMethod.GET)
    public Map backGetEnrollmentEditPageInfoByPeriodID(int periodid, @RequestHeader Map header) {
        Map<String, Object> result = new HashMap<String, Object>();
        String token = header.get("token").toString();
        User user = logonService.getUserByToken(token);
        if (user == null) {
            result.put(Constant.status, 0);
            result.put(Constant.result, "无效的登录用户");
            return result;
        }

        try {
            EnrollmentEditPageInfo e = enrollmentService.backGetEnrollmentEditPageInfoByPeriodID(periodid);

            result.put(Constant.status, 1);
            result.put(Constant.result, e);

        } catch (Exception ex) {
            logger.error(ex.getMessage());
            result.put(Constant.status, 0);
            result.put(Constant.result, ex.getMessage());
        }
        return result;
    }

    @Value("${enrollmenticon}")
    private String enrollmenticon;

    @Value("${enrollmentpic}")
    private String enrollmentpic;

    @RequestMapping(value = "/back/UploadEnrollmentIcon", method = RequestMethod.POST)
    public Map backUploadEnrollmentIcon(@RequestParam(value = "file", required = true) MultipartFile file, @RequestHeader Map header) {
        Map<String, Object> result = new HashMap<String, Object>();
        String token = header.get("token").toString();
        User user = logonService.getUserByToken(token);
        if (user == null) {
            result.put(Constant.status, 0);
            result.put(Constant.result, "无效的登录用户");
            return result;
        }

        try {
            String guid = UUID.randomUUID().toString();
            String fileName = String.format("%s-icon.png", guid);
            String path = String.format(enrollmenticon, user.getCompany_id(), guid).replace(fileName, "");
            FileUtil.uploadFile(file.getBytes(), fileroot + path, fileName);

            result.put(Constant.status, 1);
            result.put(Constant.result, path + fileName);

        } catch (Exception ex) {
            logger.error(ex.getMessage());
            result.put(Constant.status, 0);
            result.put(Constant.result, ex.getMessage());
        }
        return result;
    }

    @RequestMapping(value = "/back/UploadEnrollmentPic", method = RequestMethod.POST)
    public Map backUploadEnrollmentPic(@RequestParam(value = "file", required = true) MultipartFile file, @RequestHeader Map header) {
        Map<String, Object> result = new HashMap<String, Object>();
        String token = header.get("token").toString();
        User user = logonService.getUserByToken(token);
        if (user == null) {
            result.put(Constant.status, 0);
            result.put(Constant.result, "无效的登录用户");
            return result;
        }

        try {
            String guid = UUID.randomUUID().toString();
            String fileName = String.format("%s-pic.png", guid);
            String path = String.format(enrollmentpic, user.getCompany_id(), guid).replace(fileName, "");
            FileUtil.uploadFile(file.getBytes(), fileroot + path, fileName);

            result.put(Constant.status, 1);
            result.put(Constant.result, path + fileName);

        } catch (Exception ex) {
            logger.error(ex.getMessage());
            result.put(Constant.status, 0);
            result.put(Constant.result, ex.getMessage());
        }
        return result;
    }

    @RequestMapping(value = "/back/AddEnrollment", method = RequestMethod.POST)
    public Map backAddEnrollment(@RequestBody Map body, @RequestHeader Map header) {

        Map<String, Object> result = new HashMap<String, Object>();
        String token = header.get("token").toString();
        User user = logonService.getUserByToken(token);
        if (user == null) {
            result.put(Constant.status, 0);
            result.put(Constant.result, "无效的登录用户");
            return result;
        }

        try {

            String title = (String) body.get("title");
            String intro = (String) body.get("intro");

            String teacher = (String) body.get("teacher");
            int count = (int) body.get("count");

            String start_date = (String) body.get("start_date");
            String end_date = (String) body.get("end_date");

            String location = (String) body.get("location");

            String icon = (String) body.get("icon");
            String pic = (String) body.get("pic");

            List<LinkedHashMap> contentList = (List<LinkedHashMap>) body.get("contentList");
            //ObjectMapper mapper = new ObjectMapper();
            //  List<EnrollmentContent> lst =  (List<EnrollmentContent>)mapper.readValue(contentListStr,  new TypeReference<List<EnrollmentContent>>() {});

            Enrollment enrollment = new Enrollment();
            enrollment.setTitle(title);
            enrollment.setIntro(intro);
            enrollment.setIcon(icon);
            enrollment.setPic(pic);
            enrollment.setCompany_id(user.getCompany_id());

            enrollmentService.backAddEnrollment(enrollment);

            EnrollmentPeriod period = new EnrollmentPeriod();
            period.setTeacher(teacher);
            period.setCount(count);
            period.setStart_date(Helper.dateParse(start_date));
            period.setEnd_date(Helper.dateParse(end_date));

            period.setLocation(location);
            period.setEnrollment_id(enrollment.getEnrollment_id());

            enrollmentService.backAddEnrollmentPeriod(period);

            for (LinkedHashMap content : contentList) {
                EnrollmentContent ec = new EnrollmentContent();
                ec.setSequnce_num((int) content.get("sequnce_num"));
                ec.setSequnce_title((String) content.get("sequnce_title"));
                ec.setContent((String) content.get("content"));

                ec.setTeacher((String) content.get("teacher"));
                ec.setEnrollment_id(enrollment.getEnrollment_id());

                enrollmentService.backAddEnrollmentContent(ec);
            }

            /*
            if (!icon.startsWith("/default")) {
                String fileName = String.format("%s-icon.png", enrollment.getEnrollment_id());
                String path = String.format(enrollmenticon, user.getCompany_id(), enrollment.getEnrollment_id()).replace(fileName, "");

                FileUtil.renameFile(fileroot + icon, fileroot + path + fileName);
                enrollment.setIcon(path + fileName);
                enrollment.setPic(null);
                enrollmentService.backUpdateEnrollmentIconAndPic(enrollment);
            }

            if (!pic.startsWith("/default")) {
                String fileName = String.format("%s-pic.png", enrollment.getEnrollment_id());
                String path = String.format(enrollmentpic, user.getCompany_id(), enrollment.getEnrollment_id()).replace(fileName, "");

                FileUtil.renameFile(fileroot + pic, fileroot + path + fileName);
                enrollment.setIcon(null);
                enrollment.setPic(path + fileName);
                enrollmentService.backUpdateEnrollmentIconAndPic(enrollment);
            }

            */

            result.put(Constant.status, 1);
            result.put(Constant.result, enrollmentService.backGetEnrollmentEditPageInfoByPeriodID(period.getPeriod_id()));

        } catch (Exception ex) {
            logger.error(ex.getMessage());
            result.put(Constant.status, 0);
            result.put(Constant.result, ex.getMessage());
        }
        return result;
    }

    @RequestMapping(value = "/back/UpdateEnrollment", method = RequestMethod.POST)
    public Map backUpdateEnrollment(@RequestBody Map body, @RequestHeader Map header) {

        Map<String, Object> result = new HashMap<String, Object>();
        String token = header.get("token").toString();
        User user = logonService.getUserByToken(token);
        if (user == null) {
            result.put(Constant.status, 0);
            result.put(Constant.result, "无效的登录用户");
            return result;
        }

        try {
            int enrollmentid = (int) body.get("enrollmentid");
            String title = (String) body.get("title");
            String intro = (String) body.get("intro");
            String icon = (String) body.get("icon");
            String pic = (String) body.get("pic");

            Enrollment enrollment = new Enrollment();
            enrollment.setEnrollment_id(enrollmentid);
            enrollment.setTitle(title);
            enrollment.setIntro(intro);
            enrollment.setIcon(icon);
            enrollment.setPic(pic);

            enrollmentService.backUpdateEnrollment(enrollment);

            int periodid = (int) body.get("periodid");
            String teacher = (String) body.get("teacher");
            int count = (int) body.get("count");
            String start_date = (String) body.get("start_date");
            String end_date = (String) body.get("end_date");
            String location = (String) body.get("location");

            EnrollmentPeriod period = new EnrollmentPeriod();
            period.setPeriod_id(periodid);
            period.setTeacher(teacher);
            period.setCount(count);
            period.setStart_date(Helper.dateParse(start_date));
            period.setEnd_date(Helper.dateParse(end_date));
            period.setLocation(location);
            period.setPeriod_id(periodid);

            enrollmentService.backUpdateEnrollmentPeriod(period);

            List<LinkedHashMap> contentList = (List<LinkedHashMap>) body.get("contentList");
            List<EnrollmentContent> lst = new ArrayList<EnrollmentContent>();
            for (LinkedHashMap content : contentList) {
                EnrollmentContent ec = new EnrollmentContent();
                ec.setSequnce_num((int) content.get("sequnce_num"));
                ec.setSequnce_title((String) content.get("sequnce_title"));
                ec.setContent((String) content.get("content"));
                ec.setTeacher((String) content.get("teacher"));

                int contentid = (int) content.get("content_id");
                ec.setContent_id(contentid);
                if (contentid == 0)
                    ec.setEnrollment_id(enrollmentid);

                lst.add(ec);
            }

            enrollmentService.backSaveContentList(enrollmentid, lst);

            /*
            if (!icon.startsWith("/default")) {
                String fileName = String.format("%s-icon.png", enrollmentid);
                String path = String.format(enrollmenticon, user.getCompany_id(), enrollmentid).replace(fileName, "");

                if (!icon.equals(path + fileName)) {
                    FileUtil.renameFile(fileroot + icon, fileroot + path + fileName);
                    enrollment.setIcon(path + fileName);
                    enrollment.setPic(null);
                    enrollmentService.backUpdateEnrollmentIconAndPic(enrollment);
                }
            }

            if (!pic.startsWith("/default")) {
                String fileName = String.format("%s-pic.png", enrollmentid);
                String path = String.format(enrollmentpic, user.getCompany_id(), enrollmentid).replace(fileName, "");

                if (!pic.equals(path + fileName)) {
                    FileUtil.renameFile(fileroot + pic, fileroot + path + fileName);
                    enrollment.setIcon(null);
                    enrollment.setPic(path + fileName);
                    enrollmentService.backUpdateEnrollmentIconAndPic(enrollment);
                }
            }

            */

            result.put(Constant.status, 1);
            result.put(Constant.result, "更新成功");

        } catch (Exception ex) {
            logger.error(ex.getMessage());
            result.put(Constant.status, 0);
            result.put(Constant.result, ex.getMessage());
        }
        return result;
    }

    @RequestMapping(value = "/back/OpenEnrollment", method = RequestMethod.POST)
    public Map backOpenEnrollment(@RequestBody Map body, @RequestHeader Map header) {

        Map<String, Object> result = new HashMap<String, Object>();
        String token = header.get("token").toString();
        User user = logonService.getUserByToken(token);
        if (user == null) {
            result.put(Constant.status, 0);
            result.put(Constant.result, "无效的登录用户");
            return result;
        }

        try {
            int enrollmentid = (int) body.get("enrollmentid");
            String title = (String) body.get("title");
            String intro = (String) body.get("intro");
            String icon = (String) body.get("icon");
            String pic = (String) body.get("pic");

            Enrollment enrollment = new Enrollment();
            enrollment.setEnrollment_id(enrollmentid);
            enrollment.setTitle(title);
            enrollment.setIntro(intro);
            enrollment.setIcon(icon);
            enrollment.setPic(pic);

            enrollmentService.backUpdateEnrollment(enrollment);

            List<LinkedHashMap> contentList = (List<LinkedHashMap>) body.get("contentList");
            List<EnrollmentContent> lst = new ArrayList<EnrollmentContent>();
            for (LinkedHashMap content : contentList) {
                EnrollmentContent ec = new EnrollmentContent();
                ec.setSequnce_num((int) content.get("sequnce_num"));
                ec.setSequnce_title((String) content.get("sequnce_title"));

                ec.setTeacher((String) content.get("teacher"));
                ec.setContent((String) content.get("content"));

                // if (content.get("content_id") != null) {
                int contentid = (int) content.get("content_id");
                ec.setContent_id(contentid);

                if (contentid == 0)
                    ec.setEnrollment_id(enrollmentid);

                lst.add(ec);
            }

            enrollmentService.backSaveContentList(enrollmentid, lst);

            String teacher = (String) body.get("teacher");
            int count = (int) body.get("count");

            String start_date = (String) body.get("start_date");
            String end_date = (String) body.get("end_date");

            String location = (String) body.get("location");

            EnrollmentPeriod period = new EnrollmentPeriod();
            period.setTeacher(teacher);
            period.setCount(count);
            period.setStart_date(Helper.dateParse(start_date));
            period.setEnd_date(Helper.dateParse(end_date));

            period.setLocation(location);
            period.setEnrollment_id(enrollment.getEnrollment_id());

            enrollmentService.backAddEnrollmentPeriod(period);

            /*
            if (!icon.startsWith("/default")) {
                String fileName = String.format("%s-icon.png", enrollmentid);
                String path = String.format(enrollmenticon, user.getCompany_id(), enrollmentid).replace(fileName, "");

                if (!icon.equals(path + fileName)) {
                    FileUtil.renameFile(fileroot + icon, fileroot + path + fileName);
                    enrollment.setIcon(path + fileName);
                    enrollment.setPic(null);
                    enrollmentService.backUpdateEnrollmentIconAndPic(enrollment);
                }
            }

            if (!pic.startsWith("/default")) {
                String fileName = String.format("%s-pic.png", enrollmentid);
                String path = String.format(enrollmentpic, user.getCompany_id(), enrollmentid).replace(fileName, "");

                if (!pic.equals(path + fileName)) {
                    FileUtil.renameFile(fileroot + pic, fileroot + path + fileName);
                    enrollment.setIcon(null);
                    enrollment.setPic(path + fileName);
                    enrollmentService.backUpdateEnrollmentIconAndPic(enrollment);
                }
            }

            */

            result.put(Constant.status, 1);
            result.put(Constant.result, enrollmentService.backGetEnrollmentEditPageInfoByPeriodID(period.getPeriod_id()));

        } catch (Exception ex) {
            logger.error(ex.getMessage());
            result.put(Constant.status, 0);
            result.put(Constant.result, ex.getMessage());
        }
        return result;
    }

    @RequestMapping(value = "/back/UpdateEnrollmentPublishStatus", method = RequestMethod.GET)
    public Map backUpdateEnrollmentPublishStatus(int periodid, int publish, @RequestHeader Map header) {
        Map<String, Object> result = new HashMap<String, Object>();
        String token = header.get("token").toString();
        User user = logonService.getUserByToken(token);
        if (user == null) {
            result.put(Constant.status, 0);
            result.put(Constant.result, "无效的登录用户");
            return result;
        }

        try {

            enrollmentService.backUpdateEnrollmentPublishStatus(publish, periodid);

            result.put(Constant.status, 1);
            result.put(Constant.result, "状态更新成功");

        } catch (Exception ex) {
            logger.error(ex.getMessage());
            result.put(Constant.status, 0);
            result.put(Constant.result, ex.getMessage());
        }
        return result;
    }

}


text:
package com.github.sqlcteator.test;

import java.io.Serializable;
import java.util.Date;

public class OrderTask implements Serializable {

	private static final long serialVersionUID = -9219153310444883120L;

	private Long taskId;// '定时id';
	private String taskDate;// '执行时间';
	private Integer orderAmount;// '订单数量';
	private Date ds;// '更新时间';
	private Date ts;// '时间';
	private Date startTs;// 起始时间
	private Date endTs;// 结束时间
	private String batchNumbers;// 批次号
	private String userName;// 用户名字
	private String userId;// 用户id

	public Long getTaskId() {
		return taskId;
	}
	public void setTaskId(Long taskId) {
		this.taskId = taskId;
	}
	public String getTaskDate() {
		return taskDate;
	}
	public void setTaskDate(String taskDate) {
		this.taskDate = taskDate;
	}
	public Integer getOrderAmount() {
		return orderAmount;
	}
	public void setOrderAmount(Integer orderAmount) {
		this.orderAmount = orderAmount;
	}
	public Date getDs() {
		return ds;
	}
	public void setDs(Date ds) {
		this.ds = ds;
	}
	public Date getTs() {
		return ts;
	}
	public void setTs(Date ts) {
		this.ts = ts;
	}
	public Date getStartTs() {
		return startTs;
	}
	public void setStartTs(Date startTs) {
		this.startTs = startTs;
	}
	public Date getEndTs() {
		return endTs;
	}
	public void setEndTs(Date endTs) {
		this.endTs = endTs;
	}
	public String getBatchNumbers() {
		return batchNumbers;
	}
	public void setBatchNumbers(String batchNumbers) {
		this.batchNumbers = batchNumbers;
	}
	public String getUserName() {
		return userName;
	}
	public void setUserName(String userName) {
		this.userName = userName;
	}
	public String getUserId() {
		return userId;
	}
	public void setUserId(String userId) {
		this.userId = userId;
	}
	public static long getSerialversionuid() {
		return serialVersionUID;
	}

}

redpajama_set_name: RedPajamaGithub


text:
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseShouldProcessForStateChangingFunctions', '')]
param ()

$modulePath = Join-Path -Path (Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -Parent) -ChildPath 'Modules'

# Import the Storage Common Modules
Import-Module -Name (Join-Path -Path $modulePath `
                               -ChildPath (Join-Path -Path 'StorageDsc.Common' `
                                                     -ChildPath 'StorageDsc.Common.psm1'))

# Import the Storage Resource Helper Module
Import-Module -Name (Join-Path -Path $modulePath `
                               -ChildPath (Join-Path -Path 'StorageDsc.ResourceHelper' `
                                                     -ChildPath 'StorageDsc.ResourceHelper.psm1'))

# Import Localization Strings
$localizedData = Get-LocalizedData `
    -ResourceName 'MSFT_xWaitForDisk' `
    -ResourcePath (Split-Path -Parent $Script:MyInvocation.MyCommand.Path)

<#
    .SYNOPSIS
    Returns the current state of the wait for disk resource.

    .PARAMETER DiskId
    Specifies the disk identifier for the disk to wait for.

    .PARAMETER DiskIdType
    Specifies the identifier type the DiskId contains. Defaults to Number.

    .PARAMETER RetryIntervalSec
    Specifies the number of seconds to wait for the disk to become available.

    .PARAMETER RetryCount
    The number of times to loop the retry interval while waiting for the disk.
#>
function Get-TargetResource
{
    [CmdletBinding()]
    [OutputType([System.Collections.Hashtable])]
    param
    (
        [Parameter(Mandatory = $true)]
        [System.String]
        $DiskId,

        [Parameter()]
        [ValidateSet('Number','UniqueId')]
        [System.String]
        $DiskIdType = 'Number',

        [Parameter()]
        [System.UInt32]
        $RetryIntervalSec = 10,

        [Parameter()]
        [System.UInt32]
        $RetryCount = 60
    )

    Write-Verbose -Message ( @(
            "$($MyInvocation.MyCommand): "
            $($localizedData.GettingWaitForDiskStatusMessage -f $DiskIdType,$DiskId)
        ) -join '' )

    $returnValue = @{
        DiskId           = $DiskId
        DiskIdType       = $DiskIdType
        RetryIntervalSec = $RetryIntervalSec
        RetryCount       = $RetryCount
    }
    return $returnValue
} # function Get-TargetResource

<#
    .SYNOPSIS
    Sets the current state of the wait for disk resource.

    .PARAMETER DiskId
    Specifies the disk identifier for the disk to wait for.

    .PARAMETER DiskIdType
    Specifies the identifier type the DiskId contains. Defaults to Number.

    .PARAMETER RetryIntervalSec
    Specifies the number of seconds to wait for the disk to become available.

    .PARAMETER RetryCount
    The number of times to loop the retry interval while waiting for the disk.
#>
function Set-TargetResource
{
    [CmdletBinding()]
    param
    (
        [Parameter(Mandatory = $true)]
        [System.String]
        $DiskId,

        [Parameter()]
        [ValidateSet('Number','UniqueId')]
        [System.String]
        $DiskIdType = 'Number',

        [Parameter()]
        [System.UInt32]
        $RetryIntervalSec = 10,

        [Parameter()]
        [System.UInt32]
        $RetryCount = 60
    )

    Write-Verbose -Message ( @(
            "$($MyInvocation.MyCommand): "
            $($localizedData.CheckingForDiskStatusMessage -f $DiskIdType,$DiskId)
        ) -join '' )

    $diskFound = $false

    $diskIdParameter = @{
        $DiskIdType = $DiskId
    }

    for ($count = 0; $count -lt $RetryCount; $count++)
    {
        $disk = Get-Disk `
            @diskIdParameter `
            -ErrorAction SilentlyContinue
        if ($disk)
        {
            Write-Verbose -Message ( @(
                    "$($MyInvocation.MyCommand): "
                    $($localizedData.DiskFoundMessage -f $DiskIdType,$DiskId,$disk.FriendlyName)
                ) -join '' )

            $diskFound = $true
            break
        }
        else
        {
            Write-Verbose -Message ( @(
                    "$($MyInvocation.MyCommand): "
                    $($localizedData.DiskNotFoundMessage -f $DiskIdType,$DiskId,$RetryIntervalSec)
                ) -join '' )

            Start-Sleep -Seconds $RetryIntervalSec
        } # if
    } # for

    if (-not $diskFound)
    {
        New-InvalidOperationException `
            -Message $($localizedData.DiskNotFoundAfterError -f $DiskIdType,$DiskId,$RetryCount)
    } # if
} # function Set-TargetResource

<#
    .SYNOPSIS
    Tests the current state of the wait for disk resource.

    .PARAMETER DiskId
    Specifies the disk identifier for the disk to wait for.

    .PARAMETER DiskIdType
    Specifies the identifier type the DiskId contains. Defaults to Number.

    .PARAMETER RetryIntervalSec
    Specifies the number of seconds to wait for the disk to become available.

    .PARAMETER RetryCount
    The number of times to loop the retry interval while waiting for the disk.
#>
function Test-TargetResource
{
    [CmdletBinding()]
    [OutputType([System.Boolean])]
    param
    (
        [Parameter(Mandatory = $true)]
        [System.String]
        $DiskId,

        [Parameter()]
        [ValidateSet('Number','UniqueId')]
        [System.String]
        $DiskIdType = 'Number',

        [Parameter()]
        [System.UInt32]
        $RetryIntervalSec = 10,

        [Parameter()]
        [System.UInt32]
        $RetryCount = 60
    )

    Write-Verbose -Message ( @(
            "$($MyInvocation.MyCommand): "
            $($localizedData.CheckingForDiskStatusMessage -f $DiskIdType,$DiskId)
        ) -join '' )

    $diskIdParameter = @{
        $DiskIdType = $DiskId
    }

    $disk = Get-Disk `
        @diskIdParameter `
        -ErrorAction SilentlyContinue

    if ($disk)
    {
        Write-Verbose -Message ( @(
                "$($MyInvocation.MyCommand): "
                $($localizedData.DiskFoundMessage -f $DiskIdType,$DiskId,$disk.FriendlyName)
            ) -join '' )

        return $true
    }

    Write-Verbose -Message ( @(
            "$($MyInvocation.MyCommand): "
            $($localizedData.DiskNotFoundMessage -f $DiskIdType,$DiskId)
        ) -join '' )

    return $false
} # function Test-TargetResource

Export-ModuleMember -Function *-TargetResource


text:
.header-right fieldset {
    float: right;
}

.header-right #magegiant_notice {
    display: inline !important;
}


text:
<?php

/**
 * Form module for O3 Engine
 *
 * Config file
 *
 * @package o3
 * @link    todo: add url
 * @author  Zotlan Fischer <zoli_fischer@yahoo.com>
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 */

use o3\config as config;

/** Allow o3 form to inject CSS and JS resources to head tag */
config\def('O3_FORM_INJECT_RESOURCES', true );

/** URL to the javascrip form style file */
config\def('O3_FORM_CSS_URL', O3_URL.'/module/form/o3_form.css' );

/** URL to the javascrip form controller file */
config\def('O3_FORM_JS_URL', O3_URL.'/module/form/o3_form.js' );

/** Text for loading */
config\def('O3_FORM_TXT_LOADING', 'Loading, please wait...' );

/** Error text for field required  */
config\def('O3_FORM_ERR_MANDATORY', 'You can\'t leave this empty.' );

/** Error text for valid email required  */
config\def('O3_FORM_ERR_VALID_EMAIL', 'Please insert a valid email address.' );

/** Error text for valid password required  */
config\def('O3_FORM_ERR_VALID_PASSWORD', 'Please insert a valid password. Use between %d and %d characters (a-z, A-Z, 0-9, %s).' );

/** Error text for valid number required  */
config\def('O3_FORM_ERR_VALID_NUMBER', 'Please insert a valid number.' );

/** Error text for valid float required  */
config\def('O3_FORM_ERR_VALID_FLOAT', 'Please insert a valid decimal.' );

/** Upload field name - path separator */
config\def('O3_FORM_FILE_NAME_PATH_SEP', '///' );

/** Error file uploading - submit stoped */
config\def('O3_FORM_ERR_UPLOADING_WAIT_SUBMIT', 'Please wait until all uploads are finished and try again.' );

/** Error file uploading - file is to large */
config\def('O3_FORM_ERR_UPLOADING_SIZELIMIT', 'The selected file is too large. Max. allowed file size is %s' );

/** Error file uploading - file type not accepted */
config\def('O3_FORM_ERR_UPLOADING_TYPE', 'The selected file type is not allowed. Allowed file types: %s' );

/** Error file uploading - file type not accepted */
config\def('O3_FORM_ERR_UPLOADING_GENERAL', 'The file is not uploaded because an error occured. Please try again.' );

/** File field text for no file selected */
config\def('O3_FORM_FILE_NO_FILE_SELECTED', 'No file selected' );

/** File field text for select file button */
config\def('O3_FORM_FILE_SELECT_FILE', 'Select file' );

?>


text:
package Moduls.Skladnik.ui.graphics.CellRenderers;

import Moduls.Skladnik.DataStructure.Box;
import Moduls.Skladnik.Enums.typOperace;
import VControl.Settings.AppSettings;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.awt.RenderingHints;
import java.awt.geom.RoundRectangle2D;
import javax.swing.BorderFactory;
import javax.swing.DefaultListCellRenderer;

import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.ListCellRenderer;

public class ModulCellRenderer extends JLabel implements ListCellRenderer {

  protected DefaultListCellRenderer defaultRenderer = new DefaultListCellRenderer();
  private final CustomLabel renderer;

  public ModulCellRenderer(final JList list) {
    renderer = new CustomLabel();
  }

  /**
   * Returns custom renderer for each cell of the list.
   *
   * @param list list to process
   * @param value cell value (CustomData object in our case)
   * @param index cell index
   * @param isSelected whether cell is selected or not
   * @param cellHasFocus whether cell has focus or not
   * @return custom renderer for each cell of the list
   */
  @Override
  public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
    renderer.setSelected(isSelected);
    renderer.setData((Box) value);
    return renderer;
  }

  /**
   * Label that has some custom decorations.
   */
  private static class CustomLabel extends JLabel {

    private static final Color backgroundColor = AppSettings.getColour("BG_Color");
    private final int GAP = 10;

    private boolean selected;
    private Box data;

    public CustomLabel() {
      super();
      setOpaque(false);
      setBorder(BorderFactory.createEmptyBorder(0, 36 + 5, 0, 40));
    }

    private void setSelected(boolean selected) {
      this.selected = selected;
      setForeground(selected ? Color.WHITE : Color.BLACK);
    }

    private void setData(Box data) {
      this.data = data;
      //setText ( this.data.toString());
    }

    @Override
    protected void paintComponent(Graphics g) {
      Graphics2D g2d = (Graphics2D) g;
      g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);

      Color color;
      if (data.getStav() == typOperace.NIC) {
        color = AppSettings.getColour("FG_Color");
      } else {
        color = Color.GRAY;
      }

      int s = 3;
      if (selected) {
        s = 5;
      }
//            60X200
      RoundRectangle2D x = new RoundRectangle2D.Double(GAP / 2, GAP / 2, getWidth() - GAP, getHeight() - GAP, 6, 6);

      g2d.setColor(color);
      g2d.fill(x); //vykresli vybrany ctverec
      RoundRectangle2D y = new RoundRectangle2D.Double(GAP / 2 + s, GAP / 2 + s, getWidth() - GAP - 2 * s, getHeight() - GAP - 2 * s, 6 - s, 6 - s);
      g2d.setPaint(backgroundColor);
      g2d.fill(y); //vyrizne ve vybranem ctverci bili ramec

      String text = data.getObsah();
      Font Font = new Font(AppSettings.getString("Font_Name"), 0, (int) 2 * AppSettings.getInt("Font_Size"));
      g2d.setFont(Font);
      FontMetrics fm = g2d.getFontMetrics();
      while ((fm.stringWidth(text) > (getWidth() - GAP - 2 * s)) || (fm.getHeight() > (getHeight() - GAP - 2 * s))) {
        g2d.setFont(Font.deriveFont(g2d.getFont().getSize() - 3f));
        fm = g2d.getFontMetrics();
      }

      g2d.setColor(color);
      g2d.drawString(text, ((getWidth() - GAP - 2 * s) - fm.stringWidth(text)) / 2 + GAP / 2 + s, getHeight() - ((getHeight() - GAP - 2 * s) - fm.getHeight()) / 2 - GAP / 2-
 2*s);
      super.paintComponent(g);
    }

    public void paintString(String text, int x, int y, Color c, Graphics2D g2d) {
      final Font oldFont = g2d.getFont();
      g2d.setFont(oldFont.deriveFont(oldFont.getSize() + 3f));
      final FontMetrics fm = g2d.getFontMetrics();
      g2d.setPaint(c);
      g2d.drawString(text, x + GAP - fm.stringWidth(text) / 2, y); //vykresli obsah boxu
      g2d.setFont(oldFont);
    }

    @Override
    public Dimension getPreferredSize() {
      final Dimension ps = super.getPreferredSize();
      ps.height = 36;
      return ps;
    }
  }
}


text:
import {inspect} from 'util';
import {suite} from 'uvu';
import * as assert from 'uvu/assert';
import {drawSquiggle, OffsetToPositionConverter} from '../error.js';
import {IdeAnalyzer} from '../ide.js';
import {WireitTestRig} from './util/test-rig.js';
import * as url from 'url';
import {removeAnsiColors} from './util/colors.js';

const test = suite<{rig: WireitTestRig}>();

test.before.each(async (ctx) => {
  try {
    ctx.rig = new WireitTestRig();
    await ctx.rig.setup();
  } catch (error) {
    // Uvu has a bug where it silently ignores failures in before and after,
    // see https://github.com/lukeed/uvu/issues/191.
    console.error('uvu before error', error);
    process.exit(1);
  }
});

test.after.each(async (ctx) => {
  try {
    await ctx.rig.cleanup();
  } catch (error) {
    // Uvu has a bug where it silently ignores failures in before and after,
    // see https://github.com/lukeed/uvu/issues/191.
    console.error('uvu after error', error);
    process.exit(1);
  }
});

async function assertDiagnostics(
  ide: IdeAnalyzer,
  expected: Record<string, string[]>
) {
  const actual = {} as Record<string, string[]>;
  const byFile = await ide.getDiagnostics();
  for (const [path, diagnostics] of byFile.entries()) {
    actual[path] = [...diagnostics].map((d) => d.message);
  }
  assert.equal(actual, expected);
}

test('can get diagnostics from a single file', async ({rig}) => {
  const ide = new IdeAnalyzer();
  ide.setOpenFileContents(rig.resolve('package.json'), `{"scripts": "bad"}`);
  await assertDiagnostics(ide, {
    [rig.resolve(`package.json`)]: ['Expected an object, but was string.'],
  });
});

test('changing a file gives us new diagnostics', async ({rig}) => {
  const ide = new IdeAnalyzer();
  ide.setOpenFileContents(rig.resolve(`package.json`), `{"scripts": "bad"}`);
  await assertDiagnostics(ide, {
    [rig.resolve(`package.json`)]: ['Expected an object, but was string.'],
  });
  ide.setOpenFileContents(rig.resolve(`package.json`), `{"scripts": {}}`);
  await assertDiagnostics(ide, {});
  ide.setOpenFileContents(
    rig.resolve(`package.json`),
    `{"scripts": {"bad": []}}`
  );
  await assertDiagnostics(ide, {
    [rig.resolve(`package.json`)]: ['Expected a string, but was array.'],
  });
});

test('the overlay filesystem overrides the regular one', async ({rig}) => {
  await rig.write('child/package.json', {scripts: {}});
  const ide = new IdeAnalyzer();
  ide.setOpenFileContents(
    rig.resolve(`package.json`),
    JSON.stringify({
      scripts: {a: 'wireit'},
      wireit: {
        a: {
          dependencies: ['./child:b'],
        },
      },
    })
  );
  await assertDiagnostics(ide, {
    [rig.resolve(`package.json`)]: [
      `Cannot find script named "b" in package "${rig.resolve('child')}"`,
    ],
  });
  const childPath = rig.resolve('child/package.json');
  ide.setOpenFileContents(
    childPath,
    JSON.stringify({
      scripts: {b: 'foo'},
    })
  );
  assert.equal(
    [...ide.openFiles],
    [rig.resolve('package.json'), rig.resolve('child/package.json')]
  );
  await assertDiagnostics(ide, {});
  // Replace the in-memory buffer with a file on disk.
  await rig.write('child/package.json', {scripts: {c: 'foo'}});
  ide.closeFile(rig.resolve('child/package.json'));
  // We now read the file on disk, but it doesn't have a 'b' diagnostic, just a 'c'.
  await assertDiagnostics(ide, {
    [rig.resolve('package.json')]: [
      `Cannot find script named "b" in package "${rig.resolve('child')}"`,
    ],
  });
  // Updating our main file to point to 'c' should resolve the diagnostic.
  ide.setOpenFileContents(
    rig.resolve('package.json'),
    JSON.stringify({
      scripts: {a: 'wireit'},
      wireit: {
        a: {
          dependencies: ['./child:c'],
        },
      },
    })
  );
  await assertDiagnostics(ide, {});
});

test('we can get cyclic dependency errors', async ({rig}) => {
  const ide = new IdeAnalyzer();
  ide.setOpenFileContents(
    rig.resolve('package.json'),
    JSON.stringify({
      scripts: {
        a: 'wireit',
        b: 'wireit',
      },
      wireit: {
        a: {
          dependencies: ['b'],
        },
        b: {
          dependencies: ['a'],
        },
      },
    })
  );
  await assertDiagnostics(ide, {
    [rig.resolve('package.json')]: [`Cycle detected in dependencies of "a".`],
  });
});

async function assertDefinition(
  ide: IdeAnalyzer,
  options: {
    path: string;
    contentsWithPipe: string;
    expected:
      | undefined
      | {
          target: string;
          targetSelection: string;
          originSelection: string;
        };
  }
) {
  const offset = options.contentsWithPipe.indexOf('|');
  const contents =
    options.contentsWithPipe.slice(0, offset) +
    options.contentsWithPipe.slice(offset + 1);
  ide.setOpenFileContents(options.path, contents);
  const sourceFile = await ide.getPackageJsonForTest(options.path);
  if (sourceFile === undefined) {
    throw new Error(`could not get source file`);
  }
  const sourceConverter = OffsetToPositionConverter.get(sourceFile.jsonFile);
  const definitions = await ide.getDefinition(
    options.path,
    sourceConverter.toIdePosition(offset)
  );
  if (definitions === undefined) {
    if (options.expected === undefined) {
      return; // No definition, as expected.
    }
    throw new Error(
      `Expected to find a definition matching \n${inspect(options.expected)}`
    );
  }
  // currently we always expect one definition
  assert.equal(definitions.length, 1);
  const definition = definitions[0];
  if (options.expected === undefined) {
    throw new Error(
      `Expected no definition, but got one: ${inspect(definition)}`
    );
  }
  const targetFile = await ide.getPackageJsonForTest(
    url.fileURLToPath(definition.targetUri)
  );
  if (targetFile === undefined) {
    throw new Error(`Could not load target file`);
  }
  const targetConverter = OffsetToPositionConverter.get(targetFile.jsonFile);
  const targetSquiggle = drawSquiggle(
    {
      file: targetFile.jsonFile,
      range: targetConverter.ideRangeToRange(definition.targetRange),
    },
    0
  );
  assertSquiggleEquals(targetSquiggle, options.expected.target);

  const targetSelectionSquiggle = drawSquiggle(
    {
      file: targetFile.jsonFile,
      range: targetConverter.ideRangeToRange(definition.targetSelectionRange),
    },
    0
  );
  assertSquiggleEquals(
    targetSelectionSquiggle,
    options.expected.targetSelection
  );
  if (definition.originSelectionRange === undefined) {
    throw new Error(`No iriginSelectionRange returned`);
  }
  const sourceSelectionSquiggle = drawSquiggle(
    {
      file: sourceFile.jsonFile,
      range: sourceConverter.ideRangeToRange(definition.originSelectionRange),
    },
    2
  );
  assertSquiggleEquals(
    sourceSelectionSquiggle,
    options.expected.originSelection
  );
}

function assertSquiggleEquals(actual: string, expected: string) {
  actual = removeAnsiColors(actual);
  if (actual.trim() !== expected.trim()) {
    console.log(`Copy pastable output:\n${actual}`);
  }
  assert.equal(actual.trim(), expected.trim());
}

test('we can get the definition for a same file dependency', async ({rig}) => {
  const ide = new IdeAnalyzer();
  await assertDefinition(ide, {
    path: rig.resolve('package.json'),
    contentsWithPipe: JSON.stringify(
      {
        scripts: {
          a: 'wireit',
          b: 'wireit',
        },
        wireit: {
          a: {
            dependencies: ['|b'],
          },
          b: {
            command: 'echo',
          },
        },
      },
      null,
      2
    ),
    expected: {
      target: `
    "b": {
    ~~~~~~
      "command": "echo"
~~~~~~~~~~~~~~~~~~~~~~~
    }
~~~~~`,
      targetSelection: `
    "b": {
    ~~~`,
      originSelection: `
          "b"
          ~~~`,
    },
  });
});

test(`we jump to the scripts section for a vanilla script`, async ({rig}) => {
  const ide = new IdeAnalyzer();
  await assertDefinition(ide, {
    path: rig.resolve('package.json'),
    contentsWithPipe: JSON.stringify(
      {
        scripts: {
          a: 'wireit',
          b: 'echo',
        },
        wireit: {
          a: {
            dependencies: ['|b'],
          },
        },
      },
      null,
      2
    ),
    expected: {
      target: `
    "b": "echo"
    ~~~~~~~~~~~`,
      targetSelection: `
    "b": "echo"
    ~~~`,
      originSelection: `
          "b"
          ~~~`,
    },
  });
});

test('jump to definition from object style dependency', async ({rig}) => {
  const ide = new IdeAnalyzer();
  await assertDefinition(ide, {
    path: rig.resolve('package.json'),
    contentsWithPipe: JSON.stringify(
      {
        scripts: {
          a: 'wireit',
          b: 'echo',
        },
        wireit: {
          a: {
            dependencies: [{script: '|b'}],
          },
        },
      },
      null,
      2
    ),
    expected: {
      target: `
    "b": "echo"
    ~~~~~~~~~~~`,
      targetSelection: `
    "b": "echo"
    ~~~`,
      originSelection: `
            "script": "b"
                      ~~~`,
    },
  });
});

test(`we don't get definitions for non-dep locations`, async ({rig}) => {
  const ide = new IdeAnalyzer();
  await assertDefinition(ide, {
    path: rig.resolve('package.json'),
    contentsWithPipe: JSON.stringify(
      {
        scripts: {
          a: 'wireit',
          b: 'wireit',
        },
        wireit: {
          a: {
            dependencies: ['b'],
            foo: 'b|ar',
          },
          b: {
            command: 'echo',
          },
        },
      },
      null,
      2
    ),
    expected: undefined,
  });
  await assertDefinition(ide, {
    path: rig.resolve('package.json'),
    contentsWithPipe: JSON.stringify(
      {
        scripts: {
          a: 'wireit',
          b: 'wireit',
        },
        wireit: {
          a: {
            dependencies: ['b'],
            foo: 'b|ar',
          },
          b: {
            command: 'echo',
          },
        },
      },
      null,
      2
    ),
    expected: undefined,
  });
  await assertDefinition(ide, {
    path: rig.resolve('package.json'),
    contentsWithPipe: JSON.stringify(
      {
        scripts: {
          a: 'wireit',
          b: 'wireit',
        },
        wireit: {
          a: {
            ['depen|dencies']: ['b'],
          },
          b: {
            command: 'echo',
          },
        },
      },
      null,
      2
    ),
    expected: undefined,
  });
  await assertDefinition(ide, {
    path: rig.resolve('package.json'),
    contentsWithPipe: JSON.stringify(
      {
        scripts: {
          a: 'wireit',
          b: 'wireit',
        },
        wireit: {
          ['|a']: {
            dependencies: ['b'],
          },
          b: {
            command: 'echo',
          },
        },
      },
      null,
      2
    ),
    expected: undefined,
  });
});

test(`we can jump to definitions across files`, async ({rig}) => {
  const ide = new IdeAnalyzer();
  await rig.write('child/package.json', {scripts: {b: 'echo'}});
  await assertDefinition(ide, {
    path: rig.resolve('package.json'),
    contentsWithPipe: JSON.stringify(
      {
        scripts: {
          a: 'wireit',
        },
        wireit: {
          a: {
            dependencies: ['./chil|d:b'],
          },
        },
      },
      null,
      2
    ),
    expected: {
      target: `
    "b": "echo"
    ~~~~~~~~~~~`,
      targetSelection: `
    "b": "echo"
    ~~~`,
      originSelection: `
          "./child:b"
          ~~~~~~~~~~~`,
    },
  });
});

test('can jump from scripts section to wireit config', async ({rig}) => {
  const ide = new IdeAnalyzer();
  await assertDefinition(ide, {
    path: rig.resolve('package.json'),
    contentsWithPipe: JSON.stringify(
      {
        scripts: {
          a: 'wir|eit',
          b: 'wireit',
        },
        wireit: {
          a: {
            dependencies: ['b'],
          },
          b: {
            command: 'echo',
          },
        },
      },
      null,
      2
    ),
    expected: {
      target: `
    "a": {
    ~~~~~~
      "dependencies": [
~~~~~~~~~~~~~~~~~~~~~~~
        "b"
~~~~~~~~~~~
      ]
~~~~~~~
    },
~~~~~`,
      targetSelection: `
    "a": {
    ~~~`,
      originSelection: `
      "a": "wireit",
      ~~~~~~~~~~~~~`,
    },
  });
});

test('can jump from colon in scripts section to wireit config', async ({
  rig,
}) => {
  const ide = new IdeAnalyzer();
  await assertDefinition(ide, {
    path: rig.resolve('package.json'),
    contentsWithPipe: `
    {
      "scripts": {
        "a":| "wireit",
        "b": "wireit"
      },
      "wireit": {
        "a": {
          "dependencies": ["b"]
        },
        "b": {
          "command": "echo"
        }
      }
    }`,
    expected: {
      target: `
        "a": {
        ~~~~~~
          "dependencies": ["b"]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        },
~~~~~~~~~`,
      targetSelection: `
        "a": {
        ~~~`,
      originSelection: `
          "a": "wireit",
          ~~~~~~~~~~~~~`,
    },
  });
});

test.run();


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;
using System.Web;
using System.Web.Security;
using NearForums.Web.State;
using NearForums;
using NearForums.Web.Extensions;
using System.Web.Routing;
using NearForums.Configuration;
using NearForums.Web.Controllers.Helpers;

namespace NearForums.Web.Controllers.Filters
{
	/// <summary>
	/// Validates that FormsAuth / Membership is enabled. If the user is logged in, validates that the provider for the user is this.
	/// </summary>
	public class ValidateFormsAuthAttribute : BaseActionFilterAttribute
	{
		public override void OnActionExecuting(ActionExecutingContext filterContext)
		{
			var session = new SessionWrapper(filterContext.HttpContext);
			if (!Config.AuthenticationProviders.FormsAuth.IsDefined)
			{
				filterContext.Result = ResultHelper.ForbiddenResult(filterContext.Controller as BaseController);
			}
			else
			{
				if (session.User != null && !session.User.AuthenticatedBy(AuthenticationProvider.Membership))
				{
					filterContext.Result = ResultHelper.ForbiddenResult(filterContext.Controller as BaseController);
				}
			}
			base.OnActionExecuting(filterContext);
		}
	}
}


text:
coloring
========

Coloring problem


text:
import os
import pkgutil
import importlib
import logging
import traceback
from flask import render_template, current_app
from emonitor.extensions import babel, db
from emonitor.utils import Module
from emonitor.modules.settings.settings import Settings

from flask import Blueprint

logger = logging.getLogger(__name__)
modules = Blueprint('modules', __name__, template_folder="web/templates")

class StartModule(Module):
    """
        startpage for admin and frontend area
    """
    info = dict(area=['admin', 'frontend'], name='startpages', path='default', icon='fa-home', version='0.1')

    def __repr__(self):
        return "startpages"

    def __init__(self, app):
        Module.__init__(self, app)
        babel.gettext(u'module.startpages')
        babel.gettext(u'emonitor.communication.Communication')

    def frontendContent(self):
        return 0

    def getAdminContent(self, **params):
        return render_template('admin_start.html', **params)

    def getFrontendContent(self, **params):
        """
        Get frontend content with areas (west, center, east) to hold modules.
        Areas can be configured in :py:class:`emonitor.modules.settings.settings.Settings`

        :param params: dict with key `area`
        :return: rendered HTML-template of module
        """
        if 'area' in params:
            defaultarea = dict()
            defaultarea['center'] = Settings.getFrontendSettings('center')
            defaultarea['west'] = Settings.getFrontendSettings('west')
            defaultarea['east'] = Settings.getFrontendSettings('east')

            # load module data
            if defaultarea[params['area']]['module'] == 'default':
                return render_template('frontend.default.html')
            elif defaultarea[params['area']]['module'] in current_app.blueprints['frontend'].modules:
                return current_app.blueprints['frontend'].modules[defaultarea[params['area']]['module']].getFrontendContent(**params)
            else:
                current_app.logger.error("module %s not found for frontend area %s" % (defaultarea[params['area']]['module'], params['area']))
                return ""

        return render_template('frontend.default.html')

    def getFrontendData(self, *params):
        return ""

def init_app(app):
    """
    Load all modules of folder `emonitor/modules` into app

    :param app: :py:class:`Flask`
    """
    _count = 0
    #startpage
    m = StartModule(app)
    for area in m.info['area']:
        if area in app.blueprints:
            app.blueprints[area].addModule(m)

    for _, name, _ in pkgutil.iter_modules([os.path.join(app.config.get('PROJECT_ROOT'), 'emonitor/modules')]):
        m = importlib.import_module('emonitor.modules.%s' % name, '%sModule' % str(name).title())
        try:
            m = eval('m.%sModule' % str(name).title())(app)
            if m.info:
                if 'area' in m.info:
                    for area in m.info['area']:
                        if area in app.blueprints:
                            app.blueprints[area].addModule(m)

                if 'messages' in m.info:
                    for t in m.info['messages']:
                        app.flashtypes.append('%s.%s' % (name, t))

            _count += 1
        except AttributeError:
            logger.error('module "%s" could not be loaded: %s' % (name, traceback.format_exc()))

    db.create_all(app=app)

    #logger.info('%s modules loaded' % _count)

modules.init_app = init_app


text:
'use babel'

import Syntax from './syntax'

class ActionSyntax extends Syntax {
  constructor (cell) {
    super()
    this.cell = cell
  }

  static tryNew () {
    return "life"
  }

  render (map) {
    return this.cell.value
  }
}

module.exports = ActionSyntax


text:
namespace WifiBegone.Tray.Service
{
    using WifiBegone.Core;

    public class BackgroundService
    {
        private readonly ILogger _logger;
        private readonly NetworkManager _manager;
        private readonly NetworkStateNotifier _stateNotifier;
        private readonly NetworkStateReactor _reactor;

        public BackgroundService(ILogger logger)
        {
            _logger = logger;
            _manager = new NetworkManager();
            _stateNotifier = new NetworkStateNotifier(_manager);
            _reactor = new NetworkStateReactor(_manager, _stateNotifier, _logger);
        }

        public void Start()
        {
            _stateNotifier.Start();
        }
    }
}


text:
 * `dc.selectMenu`, implementing a `<select>` menu or multiple-select widget, by Andrea Singh ([#771](https://github.com/dc-js/dc.js/pull/771))
 * Heatmap allows customizing the ordering separately from the values, by Matt Traynham ([#869](https://github.com/dc-js/dc.js/pull/869) - thanks also to Quinn Lee for [#837](https://github.com/dc-js/dc.js/pull/837))
 * Front page stable version automatically read from GitHub, by Enrico Spinielli ([#865](https://github.com/dc-js/dc.js/pull/865))
 * Functional-style filter handlers: instead of modifying the array of filters in-place, filter handlers must return the new filter array. This is consistent with the old documention, but a different implementation: any changes to the `filters` argument will be ignored unless they are returned. This should make filter handlers easier to reason about.

# 2.0 Series
## 2.0.0 beta 30
* Fix the doc build, which was crashing due to an impolite library and the upgrade of another one that knew nothing about it ([#1142](https://github.com/dc-js/dc.js/issues/1142))
* Strip fragment from URL before creating clip path URL ([#1079](https://github.com/dc-js/dc.js/issues/1079))

## 2.0.0 beta 29
* Fix node/browserify require(crossfilter2) again (first fix was lost in merge). Thanks Timothy Pfafman! ([#1133](https://github.com/dc-js/dc.js/pull/1133))

## 2.0.0 beta 28
* Line chart labels, by Mohamed Gazal ([#1045](https://github.com/dc-js/dc.js/pull/1045))
* Don't break when scatter plot key contains more than two elements, by Cathy Nangini ([#1123](https://github.com/dc-js/dc.js/pull/1123))
* Fix row chart title label offset, by Adrián de la Rosa ([#941](https://github.com/dc-js/dc.js/issues/941) / [#1129](https://github.com/dc-js/dc.js/pull/1129))
* Fix clip paths being dropped by Angular by using abolute paths, by @yandongCoder ([#1079](https://github.com/dc-js/dc.js/issues/1079))
* Fix error with object-valued crossfilter groups in pie chart, by Xaser Acheron ([#1085](https://github.com/dc-js/dc.js/issues/1085) / [#1128](https://github.com/dc-js/dc.js/pull/1128))
* Pass `value` function to `stackLayout` to make it possible to specify other stack layouts, by @jetsnguns ([#1102](https://github.com/dc-js/dc.js/issues/1102))
* Clarify documentation for `dataCount`, `rangeChart` ([#1076](https://github.com/dc-js/dc.js/issues/1076), [#1112](https://github.com/dc-js/dc.js/issues/1112))
* Documentation syntax fixes by @devginie, Chaitanya Chandukar ([#1131](https://github.com/dc-js/dc.js/issues/1131), [#1111](https://github.com/dc-js/dc.js/pull/1111))
* Switch to community fork of crossfilter. (Thanks Timothy Pfafman for correcting the node/browserify code here.) ([#1124](https://github.com/dc-js/dc.js/pull/1124))
* Add an HTML documentation front/welcome page ([#1103](https://github.com/dc-js/dc.js/issues/1103))

## 2.0.0 beta 27
* Improvements to HTML documentation, by Matt Traynham ([#1096](https://github.com/dc-js/dc.js/issues/1096) / [#1097](https://github.com/dc-js/dc.js/issues/1097) / [#1099](https://github.com/dc-js/dc.js/issues/1099) / [#1100](https://github.com/dc-js/dc.js/issues/1100) / [#1101](https://github.com/dc-js/dc.js/pull/1101))
* Ability to set color and opacity of non-brushed ("excluded") points in scatterplot; also separate brushing from highlighting, which seems like a different thing. ([#938](https://github.com/dc-js/dc.js/issues/938))

## 2.0.0 beta 26
* Apply pie chart labels before transition, so they are easier to manipulate with the pretransition hook. Added example of showing percentages in pie chart labels. (Workaround for [#703](https://github.com/dc-js/dc.js/issues/703))
* Documentation of chart registry, by Jasmine Hegman ([#676](https://github.com/dc-js/dc.js/issues/676) / [#1082](https://github.com/dc-js/dc.js/pull/1082))
* HTML documentation generation, by Matt Traynham. There are still some kinks to be worked out here, but in principle it should be more robust than the gigantic markdown file we are generating. ([#1086](https://github.com/dc-js/dc.js/pull/1086))
* Document that you need to use a `RangedFilter` when filtering a range, by koefoed ([#1090](https://github.com/dc-js/dc.js/pull/1090))
* Fix links to box plot examples, by Yuval Greenfield ([#1094](https://github.com/dc-js/dc.js/pull/1094))
* [Sparkline example](http://dc-js.github.io/dc.js/examples/sparkline.html) ([#1013](https://github.com/dc-js/dc.js/issues/1013))
* Example of [complex reductions](http://dc-js.github.io/dc.js/examples/complex-reduce.html) that need all the rows in each group, like min, max, median.
* [Time interval](http://dc-js.github.io/dc.js/examples/time-intervals.html) example.

## 2.0.0 beta 25
* Improved dataTable docs (including a fix for [#1030](https://github.com/dc-js/dc.js/issues/1030))
* Generate proper data table header ([#1015](https://github.com/dc-js/dc.js/issues/1015))
* Fix various test failures on Safari/IE/Edge (regular testing is on Chrome/Firefox/Opera) ([#1072](https://github.com/dc-js/dc.js/issues/1072), [#1073](https://github.com/dc-js/dc.js/issues/1073), [#1074](https://github.com/dc-js/dc.js/issues/1064))

## 2.0.0 beta 24
* Only auto-calculate width/height once each render - sizes were getting calculated wrong ([#1070](https://github.com/dc-js/dc.js/issues/1070)) and charts were changing size on redraw if they didn't have a fixed size in the chart spec or in the div style ([#980](https://github.com/dc-js/dc.js/issues/980))
* Tell browserify the correct entry point `browser: dc.js`, so it won't try to bundle jsdom, by Sam Dunster ([#1005](https://github.com/dc-js/dc.js/issues/1005) / ([#1062](https://github.com/dc-js/dc.js/pull/1062))
* Lighten the vertical lines in row chart (consistent with other charts), by Mike Vashevko ([#1046](https://github.com/dc-js/dc.js/issues/1046) / ([#1047](https://github.com/dc-js/dc.js/pull/1047))
* dc.utils docs, by Matt Traynham ([#961](https://github.com/dc-js/dc.js/issues/961) / ([#1041](https://github.com/dc-js/dc.js/pull/1041))

## 2.0.0 beta 23
* Domain was getting set for composite charts even when `elasticY` disabled. ([#1056](https://github.com/dc-js/dc.js/issues/1056)

## 2.0.0 beta 22
(no changes; bump due to botched npm publish)

## 2.0.0 beta 21
* Ability to use non-crossfilter backend with asynchronous connection (callback), via `commitHandler`.
* Domain comparison was failing for undefined/null domain values.
* Option `controlsUseVisibility` to use `visibility` attribute instead of `display` for `filter` and `reset` controls, to reduce disruption to the layout. Was originally on 2.1 branch with default true, now on 2.0 branch with default false. ([#888](https://github.com/dc-js/dc.js/issues/888), [#1016](https://github.com/dc-js/dc.js/issues/1016))
* Option to add labels above bars in bar chart (e.g. to show the value), by N Reese ([#211](https://github.com/dc-js/dc.js/issues/211) / [#1031](https://github.com/dc-js/dc.js/pull/1031))
* Option to sort bubbles with smaller bubbles in front; make bubble labels not clickable because they can get in the way, by Matt Traynham ([#1025](https://github.com/dc-js/dc.js/pull/1025))

## 2.0.0 beta 20
* Slicing functionality for basic data table paging, based on Chris Alvino's feature for the data grid ([#101](https://github.com/dc-js/dc.js/issues/101))
* Ability to customize the legend text, by Chris Alvino ([#982](https://github.com/dc-js/dc.js/pull/982))
* Option to align the left and right Y axes if either or both has negative values, by Mohomed Gazal ([#985](https://github.com/dc-js/dc.js/pull/985))
* Connector lines from pie wedges to external labels, by Alan Kavanagh ([#986](https://github.com/dc-js/dc.js/pull/986))
* Further documentation improvements, including lots more cross-linking, by Matt Traynham ([#1012](https://github.com/dc-js/dc.js/pull/1012))
* Minified CSS, by Indri Muska ([#1023](https://github.com/dc-js/dc.js/pull/1023))

## 2.0.0 beta 19
* Allow d3.selection to be passed as parent, as documented ([#1006](https://github.com/dc-js/dc.js/issues/1006))
* Properly derive dc.errors from Error prototype to get stack
* Add BadArgumentException and make .anchor() parent argument mandatory
* Enable crossfilter optimizations by not resetting the filter and by using filterExact and filterRange, by Ethan Jewett ([#990](https://github.com/dc-js/dc.js/pull/990) / [#989](https://github.com/dc-js/dc.js/issues/989) / [#478](https://github.com/dc-js/dc.js/issues/478))
* Add `filterType` to dc.filters, for filter optimizations and [easier serialization](https://github.com/dc-js/dc.js/issues/819)
* More documentation improvements, by Matt Traynham ([#999](https://github.com/dc-js/dc.js/pull/999))
* Fix method name in documentation ([#1009](https://github.com/dc-js/dc.js/issues/1009))
* Move x axis when row chart size changes, by Wang Xuan ([#1001](https://github.com/dc-js/dc.js/pull/1001)
* Fix css rule that was improperly selecting all axes, not just dc.js ones ([#1011](https://github.com/dc-js/dc.js/pull/1011) / ([#1005](https://github.com/dc-js/dc.js/issues/1007))
* Add pre-commit hook to hopefully avoid ever checking in merge artifacts again.

## 2.0.0 beta 18
* Fixes resizing examples to use `rescale` - currently all coordinate grid charts need to call this when changing width/height, in order to get axes moved ([#974](https://github.com/dc-js/dc.js/issues/974))
* Update all dependencies, continued linting, by Matt Traynham ([#975](https://github.com/dc-js/dc.js/pull/975))
* Bubble mixin minimum radius accessor ([#687](https://github.com/dc-js/dc.js/issues/687))
* Example of single selection of ordinal bar chart (for [#996](https://github.com/dc-js/dc.js/issues/996))
* Move documentation to JSDoc toolchain, by Matt Traynham ([#978](https://github.com/dc-js/dc.js/pull/978) / [#994](https://github.com/dc-js/dc.js/pull/994))
* Resize heat map axes when chart size changes, by Wang Xuan ([#995](https://github.com/dc-js/dc.js/pull/995)

## 2.0.0 beta 17
* Fixes issue where transitions were applied to the brush as it's being applied, causing it to lag ([#973](https://github.com/dc-js/dc.js/issues/973))

## 2.0.0 beta 16
* Reposition brush when coordinate grid chart size changes ([#972](https://github.com/dc-js/dc.js/pull/972))
* Ability to slice the data grid, by Chris Alvino ([#946](https://github.com/dc-js/dc.js/pull/946)). Also a much-needed warning that data table and data grid `.group()` means something completely different.
* Ability not to apply grouping to data table, by Emiliano Guevara ([#863](https://github.com/dc-js/dc.js/pull/863))

## 2.0.0 beta 15
* Reposition X axis on chart resize, by Rob Hardwick ([#856](https://github.com/dc-js/dc.js/pull/856)). Y axis as well
* More fixes for resizing charts, and [a new resizing examples directory](http://dc-js.github.io/dc.js/resizing/), mostly for testing.

## 2.0.0 beta 14
* Fix a test for IE and add svg subpath matcher, for #894

## 2.0.0 beta 13
* Pie chart radius padding, by Matt Traynham ([#894](https://github.com/dc-js/dc.js/pull/894))
* Example of a table showing group-aggregated data, by Ion Alberdi ([#929](https://github.com/dc-js/dc.js/pull/929))
* Filtered items were not displayed after render in coordinate grid charts, by Matt Traynham ([#900](https://github.com/dc-js/dc.js/pull/900))
* grammar/spelling/formatting fixes to annotated stock example, by Johnny Peck and Enrico Spinielli ([#956](https://github.com/dc-js/dc.js/pull/956), [#875](https://github.com/dc-js/dc.js/pull/875))
* document bower install, by Mayfarth ([#899](https://github.com/dc-js/dc.js/pull/899))
* remove unused bower version, by Kevin Kirsche ([#948](https://github.com/dc-js/dc.js/pull/948))

## 2.0.0 beta 12
 * axes should rescale on chart rescale (not just on zoom). ([#791](https://github.com/dc-js/dc.js/issues/791))
 * always rescale x axis on render, and detect domain change more thoroughly, by Matt Traynham
 ([#896](https://github.com/dc-js/dc.js/pull/896))

## 2.0.0 beta 11
 * pretransition event ([#806](https://github.com/dc-js/dc.js/issues/806))
 * replace `.renderlet(...)` with `.on("renderlet", ...)` in test and examples, by Alan Kavanagh ([#906](https://github.com/dc-js/dc.js/issues/906) / ([#917](https://github.com/dc-js/dc.js/pull/917))

## 2.0.0 beta 10
 * component package manager support, by Shobhit Gupta ([#860](https://github.com/dc-js/dc.js/pull/860))
 * add sourcemaps (*.map) to distributions ([#866](https://github.com/dc-js/dc.js/issues/866))
 * allow `.options()` to take an array of arguments (for better angular-dc support), by Tim Ruhle ([#886](https://github.com/dc-js/dc.js/pull/886) / ([#769](https://github.com/dc-js/dc.js/issues/769))
 * make bower distro smaller, by Matt Traynham and Tim Ruhle ([#925](https://github.com/dc-js/dc.js/pull/925 / [#935](https://github.com/dc-js/dc.js/pull/935))
 * added infrastructure for testing transitions by eye
 * added area and stacked bar examples ([#777](https://github.com/dc-js/dc.js/issues/#777))

## 2.0.0 beta 9
 * propagate elasticX to child charts so that domain can be calculated correctly ([#926](https://github.com/dc-js/dc.js/issues/926))

## 2.0.0 beta 8
 * simplify Gruntfile and further update dependencies, by Matt Traynham ([#849](https://github.com/dc-js/dc.js/pull/849))
 * setting the chart group should automatically put the chart in that group, by Matt Traynham ([#834](https://github.com/dc-js/dc.js/pull/834) / [#775](https://github.com/dc-js/dc.js/issues/775))

## 2.0.0 beta 7
 * fixes a bug introduced in the last release where the ordering function was defined inconsistently, causing the default ordering function to be incorrect and causing crashes with largish data in crossfilter's quicksort on IE. ([#909](https://github.com/dc-js/dc.js/issues/909))

## 2.0.0 beta 6
 * pie chart consistently pass data object to pie title function, by Jasmine Hegman ([#824](https://github.com/dc-js/dc.js/pull/824) / [#755](https://github.com/dc-js/dc.js/issues/755))
 * heatmap box titles were not updated on redraw, by hhravn ([#798](https://github.com/dc-js/dc.js/pull/798))
 * apply ordering to ordinal bar chart, by Mihai Hodorogea ([#766](https://github.com/dc-js/dc.js/pull/766) / [#772](https://github.com/dc-js/dc.js/issues/772))
 * add option to hide mouseover dots for line chart, by Davis Ford ([#735](https://github.com/dc-js/dc.js/pull/735))
 * adding example bar-extra-line, overlaying a line with a renderlet

## 2.0.0 beta 5
 * updating this doc to link to issues/PRs manually (until we get a better changelog
   system?), by Matt Traynham ([#845](https://github.com/dc-js/dc.js/issues/845))
 * update all NPM dependencies and fix tests that were not expecting any results,
   by Matt Traynham ([#844](https://github.com/dc-js/dc.js/issues/844))

## 2.0.0 beta 4
 * make barChart.onClick a proper override, by Gordon Woodhull (fixes the complaint in [#168](https://github.com/dc-js/dc.js/issues/168))

## 2.0.0 beta 3
 * Properly tagged this time.

## 2.0.0 beta 2
 * Re-implement renderlets as regular event `.on('renderlet')`. old function `.renderlet()`
   is deprecated, by Matt Traynham ([#776](https://github.com/dc-js/dc.js/issues/776) / [#833](https://github.com/dc-js/dc.js/issues/833), replaces [#779](https://github.com/dc-js/dc.js/issues/779))
 * Geochoropleth tests sped up, by Jasmine Hegman ([#825](https://github.com/dc-js/dc.js/issues/825) / [#817](https://github.com/dc-js/dc.js/issues/817))
 * Number display test cleaned up, by Jasmine Hegman ([#826](https://github.com/dc-js/dc.js/issues/826)/ [#783](https://github.com/dc-js/dc.js/issues/783))
 * Provide a way to override the heatmap labels, by hhravn ([#794](https://github.com/dc-js/dc.js/issues/794) / [#793](https://github.com/dc-js/dc.js/issues/793))

## add-logo tag
 * Added logo to main page and favicon ([#618](https://github.com/dc-js/dc.js/issues/618))

## 2.0.0 beta 1
 * Merged [#800](https://github.com/dc-js/dc.js/issues/800): unselectable ids starting with numbers [#789](https://github.com/dc-js/dc.js/issues/789). Thanks Jasmine Hegman!
 * Interface and features frozen - from this point all fixes will be merged to
   `master` and `develop`, and all interface changes only merged to `develop`.

## Starting dc.js Changelog
 * Here we start using git-flow, start a changelog, and start 2015.  Under git-flow,
   the latest release (starting with 2.0.0-beta.1) is always on the master branch,
   development (2.1.0-dev) is on the develop branch, and releases and fixes are always
   merged into develop.
 * Read about git-flow here: http://jeffkreeftmeijer.com/2010/why-arent-you-using-git-flow/
 * It follows that this document will always have two active sections: the master
   section, and the develop section.  Since any changes merged to master are also
   merged to develop, any changes added to the changelog for the master branch will
   get merged into the same section in the develop version of this document.


text:
@font-face {
  font-family: impactlabelreversed;
  src: url("../images/impactlabelreversed.ttf");
}
@font-face {
  font-family: impactlabel;
  src: url("../images/impactlabel.ttf");
}
body {
  padding: 50px;
  background-color: #474747;
  font: 14px "Lucida Grande", Helvetica, Arial, sans-serif;
  background-repeat: no-repeat;
  background-attachment: fixed;
/*background-image: url('../images/background.jpg');*/
}
a {
  color: #fff;
  background-color: #232323;
  text-decoration: none;
  margin-top: 2px;
  font-size: 30px;
  font-family: impactlabelreversed;
}
a:hover {
  background-color: #d6006f;
}
img {
  margin-left: auto;
  margin-right: auto;
  margin-top: 5px;
  margin-bottom: 5px;
  display: block;
}
#load-more {
  cursor: pointer;
  margin-left: auto;
  margin-right: auto;
  margin-top: 40px;
  display: block;
  background-color: #232323;
  font-family: impactlabelreversed;
  font-size: 50px;
  color: #fff;
  width: 452px;
  height: 66px;
  border: 0px;
}
#load-more:hover {
  background-color: #d6006f;
}
#the-end {
  background-image: url("../images/end_gif.gif");
  background-repeat: none;
  width: 232px;
  height: 66px;
  margin-left: auto;
  margin-right: auto;
  margin-top: 40px;
  display: block;
}
#menu {
  position: absolute;
  left: 10px;
  top: 10px;
}
#menu a {
  float: left;
  clear: both;
}
#menu span {
  float: left;
  clear: both;
  color: #000;
  text-decoration: none;
  margin-top: 2px;
  font-size: 30px;
  font-family: impactlabelreversed;
}