Search in sources :

Example 91 with LogOperate

use of com.publiccms.entities.log.LogOperate in project PublicCMS-preview by sanluan.

the class CmsModelAdminController method save.

/**
 * @param entity
 * @param modelId
 * @param request
 * @param session
 * @return view name
 */
@RequestMapping("save")
public String save(@ModelAttribute CmsModel entity, String modelId, HttpServletRequest request, HttpSession session) {
    SysSite site = getSite(request);
    modelComponent.clear(site.getId());
    if (CommonUtils.notEmpty(modelId)) {
        Map<String, CmsModel> modelMap = modelComponent.getMap(site);
        modelMap.remove(modelId);
        modelMap.put(entity.getId(), entity);
        modelComponent.save(site, modelMap);
        logOperateService.save(new LogOperate(site.getId(), getAdminFromSession(session).getId(), LogLoginService.CHANNEL_WEB_MANAGER, "update.model", RequestUtils.getIpAddress(request), CommonUtils.getDate(), JsonUtils.getString(entity)));
    } else {
        Map<String, CmsModel> modelMap = modelComponent.getMap(site);
        modelMap.put(entity.getId(), entity);
        modelComponent.save(site, modelMap);
        logOperateService.save(new LogOperate(site.getId(), getAdminFromSession(session).getId(), LogLoginService.CHANNEL_WEB_MANAGER, "save.model", RequestUtils.getIpAddress(request), CommonUtils.getDate(), JsonUtils.getString(entity)));
    }
    return TEMPLATE_DONE;
}
Also used : LogOperate(com.publiccms.entities.log.LogOperate) CmsModel(com.publiccms.views.pojo.entities.CmsModel) SysSite(com.publiccms.entities.sys.SysSite) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 92 with LogOperate

use of com.publiccms.entities.log.LogOperate in project PublicCMS-preview by sanluan.

the class CmsPageAdminController method saveMetadata.

/**
 * @param path
 * @param placeParamters
 * @param request
 * @param session
 * @param model
 * @return view name
 */
@RequestMapping("save")
public String saveMetadata(String path, @ModelAttribute CmsPlaceParamters placeParamters, HttpServletRequest request, HttpSession session, ModelMap model) {
    if (CommonUtils.notEmpty(path)) {
        SysSite site = getSite(request);
        String filePath = siteComponent.getWebTemplateFilePath(site, path);
        CmsPageMetadata oldmetadata = metadataComponent.getTemplateMetadata(filePath);
        oldmetadata.setExtendDataList(placeParamters.getExtendDataList());
        metadataComponent.updateTemplateMetadata(filePath, oldmetadata);
        logOperateService.save(new LogOperate(site.getId(), getAdminFromSession(session).getId(), LogLoginService.CHANNEL_WEB_MANAGER, "update.template.data", RequestUtils.getIpAddress(request), CommonUtils.getDate(), path));
    }
    return TEMPLATE_DONE;
}
Also used : CmsPageMetadata(com.publiccms.views.pojo.entities.CmsPageMetadata) LogOperate(com.publiccms.entities.log.LogOperate) SysSite(com.publiccms.entities.sys.SysSite) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 93 with LogOperate

use of com.publiccms.entities.log.LogOperate in project PublicCMS-preview by sanluan.

the class CmsTagAdminController method delete.

/**
 * @param ids
 * @param request
 * @param session
 * @param model
 * @return view name
 */
@RequestMapping("delete")
public String delete(Long[] ids, HttpServletRequest request, HttpSession session, ModelMap model) {
    if (CommonUtils.notEmpty(ids)) {
        SysSite site = getSite(request);
        service.delete(site.getId(), ids);
        logOperateService.save(new LogOperate(site.getId(), getAdminFromSession(session).getId(), LogLoginService.CHANNEL_WEB_MANAGER, "delete.tag", RequestUtils.getIpAddress(request), CommonUtils.getDate(), StringUtils.join(ids, ',')));
    }
    return TEMPLATE_DONE;
}
Also used : LogOperate(com.publiccms.entities.log.LogOperate) SysSite(com.publiccms.entities.sys.SysSite) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 94 with LogOperate

use of com.publiccms.entities.log.LogOperate in project PublicCMS-preview by sanluan.

the class CmsTagTypeAdminController method save.

/**
 * @param entity
 * @param request
 * @param session
 * @param model
 * @return view name
 */
@RequestMapping("save")
public String save(CmsTagType entity, HttpServletRequest request, HttpSession session, ModelMap model) {
    SysSite site = getSite(request);
    if (null != entity.getId()) {
        CmsTagType oldEntity = service.getEntity(entity.getId());
        if (null == oldEntity || ControllerUtils.verifyNotEquals("siteId", site.getId(), oldEntity.getSiteId(), model)) {
            return TEMPLATE_ERROR;
        }
        entity = service.update(entity.getId(), entity, ignoreProperties);
        if (null != entity) {
            logOperateService.save(new LogOperate(site.getId(), getAdminFromSession(session).getId(), LogLoginService.CHANNEL_WEB_MANAGER, "update.tagType", RequestUtils.getIpAddress(request), CommonUtils.getDate(), JsonUtils.getString(entity)));
        }
    } else {
        entity.setSiteId(site.getId());
        service.save(entity);
        logOperateService.save(new LogOperate(site.getId(), getAdminFromSession(session).getId(), LogLoginService.CHANNEL_WEB_MANAGER, "save.tagType", RequestUtils.getIpAddress(request), CommonUtils.getDate(), JsonUtils.getString(entity)));
    }
    return TEMPLATE_DONE;
}
Also used : LogOperate(com.publiccms.entities.log.LogOperate) CmsTagType(com.publiccms.entities.cms.CmsTagType) SysSite(com.publiccms.entities.sys.SysSite) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 95 with LogOperate

use of com.publiccms.entities.log.LogOperate in project PublicCMS-preview by sanluan.

the class CmsTemplateAdminController method upload.

/**
 * @param file
 * @param path
 * @param request
 * @param session
 * @param model
 * @return view name
 */
@RequestMapping("doUpload")
public String upload(MultipartFile file, String path, HttpServletRequest request, HttpSession session, ModelMap model) {
    if (null != file && !file.isEmpty()) {
        try {
            SysSite site = getSite(request);
            path = path + SEPARATOR + file.getOriginalFilename();
            fileComponent.upload(file, siteComponent.getWebTemplateFilePath(site, path));
            CmsPageMetadata metadata = new CmsPageMetadata();
            metadata.setUseDynamic(true);
            metadataComponent.updateTemplateMetadata(path, metadata);
            templateComponent.clearTemplateCache();
            cacheComponent.clearViewCache();
            logOperateService.save(new LogOperate(site.getId(), getAdminFromSession(session).getId(), LogLoginService.CHANNEL_WEB_MANAGER, "upload.web.template", RequestUtils.getIpAddress(request), CommonUtils.getDate(), path));
        } catch (IOException e) {
            model.addAttribute(ERROR, e.getMessage());
            log.error(e.getMessage(), e);
            return TEMPLATE_ERROR;
        }
    }
    return TEMPLATE_DONE;
}
Also used : CmsPageMetadata(com.publiccms.views.pojo.entities.CmsPageMetadata) LogOperate(com.publiccms.entities.log.LogOperate) IOException(java.io.IOException) SysSite(com.publiccms.entities.sys.SysSite) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

LogOperate (com.publiccms.entities.log.LogOperate)117 SysSite (com.publiccms.entities.sys.SysSite)117 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)115 SysUser (com.publiccms.entities.sys.SysUser)15 IOException (java.io.IOException)13 CmsContent (com.publiccms.entities.cms.CmsContent)9 File (java.io.File)9 MultipartFile (org.springframework.web.multipart.MultipartFile)8 CmsCategory (com.publiccms.entities.cms.CmsCategory)7 TemplateException (freemarker.template.TemplateException)7 SysDept (com.publiccms.entities.sys.SysDept)6 SysTask (com.publiccms.entities.sys.SysTask)6 CmsPageMetadata (com.publiccms.views.pojo.entities.CmsPageMetadata)5 CmsPlaceMetadata (com.publiccms.views.pojo.entities.CmsPlaceMetadata)5 CmsPlace (com.publiccms.entities.cms.CmsPlace)4 CmsWord (com.publiccms.entities.cms.CmsWord)4 SysDomain (com.publiccms.entities.sys.SysDomain)4 SysRoleUser (com.publiccms.entities.sys.SysRoleUser)4 CmsModel (com.publiccms.views.pojo.entities.CmsModel)4 CmsCategoryType (com.publiccms.entities.cms.CmsCategoryType)3