Search in sources :

Example 41 with SysSite

use of com.publiccms.entities.sys.SysSite in project PublicCMS-preview by sanluan.

the class SysConfigAdminController method delete.

/**
 * @param code
 * @param request
 * @param session
 * @param model
 * @return view name
 */
@RequestMapping("delete")
public String delete(String code, HttpServletRequest request, HttpSession session, ModelMap model) {
    SysSite site = getSite(request);
    Map<String, SysConfig> modelMap = configComponent.getMap(site);
    SysConfig entity = modelMap.remove(code);
    if (null != entity) {
        configComponent.save(site, modelMap);
        logOperateService.save(new LogOperate(site.getId(), getAdminFromSession(session).getId(), LogLoginService.CHANNEL_WEB_MANAGER, "delete.config", RequestUtils.getIpAddress(request), CommonUtils.getDate(), JsonUtils.getString(entity)));
    }
    return TEMPLATE_DONE;
}
Also used : SysConfig(com.publiccms.views.pojo.entities.SysConfig) LogOperate(com.publiccms.entities.log.LogOperate) SysSite(com.publiccms.entities.sys.SysSite) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 42 with SysSite

use of com.publiccms.entities.sys.SysSite in project PublicCMS-preview by sanluan.

the class SysConfigDataAdminController method save.

/**
 * @param entity
 * @param sysConfigParamters
 * @param request
 * @param session
 * @param model
 * @return view name
 */
@RequestMapping("save")
public String save(SysConfigData entity, @ModelAttribute SysConfigParamters sysConfigParamters, HttpServletRequest request, HttpSession session, ModelMap model) {
    SysSite site = getSite(request);
    if (null != entity.getId()) {
        entity.getId().setSiteId(site.getId());
        SysConfigData oldEntity = service.getEntity(entity.getId());
        if (null != oldEntity && ControllerUtils.verifyNotEquals("siteId", site.getId(), oldEntity.getId().getSiteId(), model)) {
            return TEMPLATE_ERROR;
        }
        Map<String, String> map = ExtendUtils.getExtentDataMap(sysConfigParamters.getExtendDataList(), configComponent.getFieldList(site, entity.getId().getCode(), null, RequestContextUtils.getLocale(request)));
        entity.setData(ExtendUtils.getExtendString(map));
        if (null != oldEntity) {
            entity = service.update(oldEntity.getId(), entity, ignoreProperties);
            if (null != entity) {
                logOperateService.save(new LogOperate(site.getId(), getAdminFromSession(session).getId(), LogLoginService.CHANNEL_WEB_MANAGER, "update.configData", RequestUtils.getIpAddress(request), CommonUtils.getDate(), JsonUtils.getString(entity)));
                configComponent.removeCache(site.getId(), entity.getId().getCode());
            }
        } else {
            entity.getId().setSiteId(site.getId());
            service.save(entity);
            logOperateService.save(new LogOperate(site.getId(), getAdminFromSession(session).getId(), LogLoginService.CHANNEL_WEB_MANAGER, "save.configData", RequestUtils.getIpAddress(request), CommonUtils.getDate(), JsonUtils.getString(entity)));
            configComponent.removeCache(site.getId(), entity.getId().getCode());
        }
    }
    return TEMPLATE_DONE;
}
Also used : SysConfigData(com.publiccms.entities.sys.SysConfigData) LogOperate(com.publiccms.entities.log.LogOperate) SysSite(com.publiccms.entities.sys.SysSite) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 43 with SysSite

use of com.publiccms.entities.sys.SysSite in project PublicCMS-preview by sanluan.

the class SysConfigDataAdminController method delete.

/**
 * @param code
 * @param request
 * @param session
 * @return view name
 */
@RequestMapping("delete")
public String delete(String code, HttpServletRequest request, HttpSession session) {
    SysSite site = getSite(request);
    SysConfigData entity = service.getEntity(new SysConfigDataId(site.getId(), code));
    if (null != entity) {
        service.delete(entity.getId());
        logOperateService.save(new LogOperate(site.getId(), getAdminFromSession(session).getId(), LogLoginService.CHANNEL_WEB_MANAGER, "delete.configData", RequestUtils.getIpAddress(request), CommonUtils.getDate(), JsonUtils.getString(entity)));
        configComponent.removeCache(site.getId(), entity.getId().getCode());
    }
    return TEMPLATE_DONE;
}
Also used : SysConfigData(com.publiccms.entities.sys.SysConfigData) LogOperate(com.publiccms.entities.log.LogOperate) SysConfigDataId(com.publiccms.entities.sys.SysConfigDataId) SysSite(com.publiccms.entities.sys.SysSite) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 44 with SysSite

use of com.publiccms.entities.sys.SysSite in project PublicCMS-preview by sanluan.

the class SysDeptAdminController method disable.

/**
 * @param id
 * @param request
 * @param session
 * @param model
 * @return view name
 */
@RequestMapping(value = "disableUser", method = RequestMethod.POST)
public String disable(Long id, HttpServletRequest request, HttpSession session, ModelMap model) {
    if (ControllerUtils.verifyEquals("admin.operate", getAdminFromSession(session).getId(), id, model)) {
        return TEMPLATE_ERROR;
    }
    SysUser entity = userService.getEntity(id);
    if (null != entity) {
        SysSite site = getSite(request);
        SysDept dept = service.getEntity(entity.getDeptId());
        SysUser admin = getAdminFromSession(session);
        if (ControllerUtils.verifyNotEquals("siteId", site.getId(), entity.getSiteId(), model) || ControllerUtils.verifyNotEmpty("deptId", dept, model) || ControllerUtils.verifyNotEquals("userId", dept.getUserId(), admin.getId(), model)) {
            return TEMPLATE_ERROR;
        }
        userService.updateStatus(id, true);
        logOperateService.save(new LogOperate(site.getId(), admin.getId(), LogLoginService.CHANNEL_WEB_MANAGER, "disable.user", RequestUtils.getIpAddress(request), CommonUtils.getDate(), JsonUtils.getString(entity)));
    }
    return TEMPLATE_DONE;
}
Also used : LogOperate(com.publiccms.entities.log.LogOperate) SysUser(com.publiccms.entities.sys.SysUser) SysDept(com.publiccms.entities.sys.SysDept) SysSite(com.publiccms.entities.sys.SysSite) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 45 with SysSite

use of com.publiccms.entities.sys.SysSite in project PublicCMS-preview by sanluan.

the class SysDomainAdminController method save.

/**
 * @param entity
 * @param id
 * @param request
 * @param session
 * @param model
 * @return view name
 */
@RequestMapping("save")
public String save(SysDomain entity, String id, HttpServletRequest request, HttpSession session, ModelMap model) {
    SysSite site = getSite(request);
    if (ControllerUtils.verifyCustom("noright", !siteComponent.isMaster(site.getId()), model)) {
        return TEMPLATE_ERROR;
    }
    if (ControllerUtils.verifyCustom("needAuthorizationEdition", !CmsVersion.isAuthorizationEdition(), model) || ControllerUtils.verifyCustom("unauthorizedDomain", !CmsVersion.verifyDomain(entity.getName()), model)) {
        return TEMPLATE_ERROR;
    }
    if (CommonUtils.notEmpty(id)) {
        if (!entity.getName().equals(id) && ControllerUtils.verifyHasExist("domain", service.getEntity(entity.getName()), model)) {
            return TEMPLATE_ERROR;
        }
        entity = service.update(id, entity);
        if (null != entity) {
            logOperateService.save(new LogOperate(site.getId(), getAdminFromSession(session).getId(), LogLoginService.CHANNEL_WEB_MANAGER, "update.domain", RequestUtils.getIpAddress(request), CommonUtils.getDate(), JsonUtils.getString(entity)));
        }
    } else {
        if (ControllerUtils.verifyHasExist("domain", service.getEntity(entity.getName()), model)) {
            return TEMPLATE_ERROR;
        }
        if (0 == entity.getSiteId()) {
            entity.setSiteId(site.getId());
        }
        service.save(entity);
        logOperateService.save(new LogOperate(site.getId(), getAdminFromSession(session).getId(), LogLoginService.CHANNEL_WEB_MANAGER, "save.domain", RequestUtils.getIpAddress(request), CommonUtils.getDate(), JsonUtils.getString(entity)));
    }
    siteComponent.clear();
    return TEMPLATE_DONEANDREFRESH;
}
Also used : LogOperate(com.publiccms.entities.log.LogOperate) SysSite(com.publiccms.entities.sys.SysSite) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

SysSite (com.publiccms.entities.sys.SysSite)175 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)135 LogOperate (com.publiccms.entities.log.LogOperate)117 IOException (java.io.IOException)33 SysUser (com.publiccms.entities.sys.SysUser)21 LinkedHashMap (java.util.LinkedHashMap)19 TemplateException (freemarker.template.TemplateException)15 File (java.io.File)14 CmsContent (com.publiccms.entities.cms.CmsContent)12 CmsCategory (com.publiccms.entities.cms.CmsCategory)11 MultipartFile (org.springframework.web.multipart.MultipartFile)10 SysTask (com.publiccms.entities.sys.SysTask)9 HashMap (java.util.HashMap)8 LogUpload (com.publiccms.entities.log.LogUpload)7 SysDept (com.publiccms.entities.sys.SysDept)7 SysUserToken (com.publiccms.entities.sys.SysUserToken)7 CmsPlaceMetadata (com.publiccms.views.pojo.entities.CmsPlaceMetadata)7 CmsPageMetadata (com.publiccms.views.pojo.entities.CmsPageMetadata)6 CmsPlace (com.publiccms.entities.cms.CmsPlace)5 SysDomain (com.publiccms.entities.sys.SysDomain)5