use of com.publiccms.entities.sys.SysSite in project PublicCMS-preview by sanluan.
the class HomeGroupPostAdminController method delete.
/**
* @param ids
* @param request
* @param session
* @return view name
*/
@RequestMapping("delete")
public String delete(Integer[] ids, HttpServletRequest request, HttpSession session) {
SysSite site = getSite(request);
if (CommonUtils.notEmpty(ids)) {
service.delete(ids);
logOperateService.save(new LogOperate(site.getId(), getAdminFromSession(session).getId(), LogLoginService.CHANNEL_WEB_MANAGER, "delete.homeGroupPost", RequestUtils.getIpAddress(request), CommonUtils.getDate(), StringUtils.join(ids, ',')));
}
return TEMPLATE_DONE;
}
use of com.publiccms.entities.sys.SysSite in project PublicCMS-preview by sanluan.
the class LogAdminController method logOperateDelete.
/**
* @param ids
* @param request
* @param session
* @return view name
*/
@RequestMapping("logOperate/delete")
public String logOperateDelete(Long[] ids, HttpServletRequest request, HttpSession session) {
SysSite site = getSite(request);
if (CommonUtils.notEmpty(ids)) {
logOperateService.delete(site.getId(), ids);
logOperateService.save(new LogOperate(site.getId(), getAdminFromSession(session).getId(), LogLoginService.CHANNEL_WEB_MANAGER, "delete.logOperate", RequestUtils.getIpAddress(request), CommonUtils.getDate(), StringUtils.join(ids, ',')));
}
return TEMPLATE_DONE;
}
use of com.publiccms.entities.sys.SysSite in project PublicCMS-preview by sanluan.
the class CkeditorAdminController method upload.
/**
* @param upload
* @param request
* @param session
* @param model
* @return view name
*/
@RequestMapping("upload")
public String upload(MultipartFile upload, HttpServletRequest request, HttpSession session, ModelMap model) {
SysSite site = getSite(request);
if (null != upload && !upload.isEmpty()) {
String originalName = upload.getOriginalFilename();
String suffix = fileComponent.getSuffix(originalName);
String fileName = fileComponent.getUploadFileName(suffix);
try {
fileComponent.upload(upload, siteComponent.getWebFilePath(site, fileName));
logUploadService.save(new LogUpload(site.getId(), getAdminFromSession(session).getId(), LogLoginService.CHANNEL_WEB_MANAGER, false, upload.getSize(), RequestUtils.getIpAddress(request), CommonUtils.getDate(), fileName));
Map<String, Object> map = getResultMap(true);
map.put(RESULT_FILENAME, originalName);
map.put(RESULT_URL, fileName);
model.addAttribute("result", map);
} catch (IllegalStateException | IOException e) {
Map<String, Object> map = getResultMap(false);
Map<String, String> messageMap = new HashMap<>();
messageMap.put(MESSAGE, e.getMessage());
map.put(ERROR, messageMap);
model.addAttribute("result", map);
}
} else {
Map<String, Object> map = getResultMap(false);
Map<String, String> messageMap = new HashMap<>();
messageMap.put(MESSAGE, "no file");
map.put(ERROR, messageMap);
model.addAttribute("result", map);
}
return "common/ckuploadResult";
}
use of com.publiccms.entities.sys.SysSite in project PublicCMS-preview by sanluan.
the class FileAdminController method upload.
/**
* @param file
* @param field
* @param originalField
* @param onlyImage
* @param request
* @param session
* @param model
* @return view name
*/
@RequestMapping(value = "doUpload", method = RequestMethod.POST)
public String upload(MultipartFile file, String field, String originalField, Boolean onlyImage, HttpServletRequest request, HttpSession session, ModelMap model) {
SysSite site = getSite(request);
if (null != file && !file.isEmpty()) {
String originalName = file.getOriginalFilename();
String suffix = fileComponent.getSuffix(originalName);
String fileName = fileComponent.getUploadFileName(suffix);
try {
fileComponent.upload(file, siteComponent.getWebFilePath(site, fileName));
model.put("field", field);
model.put(field, fileName);
if (CommonUtils.notEmpty(originalField)) {
model.put("originalField", originalField);
model.put(originalField, originalName);
}
logUploadService.save(new LogUpload(site.getId(), getAdminFromSession(session).getId(), LogLoginService.CHANNEL_WEB_MANAGER, onlyImage, file.getSize(), RequestUtils.getIpAddress(request), CommonUtils.getDate(), fileName));
} catch (IllegalStateException | IOException e) {
log.error(e.getMessage(), e);
return "common/uploadResult";
}
}
return "common/uploadResult";
}
use of com.publiccms.entities.sys.SysSite in project PublicCMS-preview by sanluan.
the class SysAppAdminController method delete.
/**
* @param id
* @param request
* @param session
* @param model
* @return view name
*/
@RequestMapping("delete")
public String delete(Integer id, HttpServletRequest request, HttpSession session, ModelMap model) {
SysSite site = getSite(request);
SysApp entity = service.getEntity(id);
if (null != entity) {
if (ControllerUtils.verifyNotEquals("siteId", site.getId(), entity.getSiteId(), model)) {
return TEMPLATE_ERROR;
}
service.delete(id);
entity.setAppSecret(null);
logOperateService.save(new LogOperate(site.getId(), getAdminFromSession(session).getId(), LogLoginService.CHANNEL_WEB_MANAGER, "delete.app", RequestUtils.getIpAddress(request), CommonUtils.getDate(), JsonUtils.getString(entity)));
}
return TEMPLATE_DONE;
}
Aggregations