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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations