Search in sources :

Example 66 with SysSite

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;
}
Also used : LogOperate(com.publiccms.entities.log.LogOperate) SysSite(com.publiccms.entities.sys.SysSite) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 67 with SysSite

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;
}
Also used : LogOperate(com.publiccms.entities.log.LogOperate) SysSite(com.publiccms.entities.sys.SysSite) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 68 with SysSite

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";
}
Also used : HashMap(java.util.HashMap) LogUpload(com.publiccms.entities.log.LogUpload) IOException(java.io.IOException) HashMap(java.util.HashMap) ModelMap(org.springframework.ui.ModelMap) Map(java.util.Map) SysSite(com.publiccms.entities.sys.SysSite) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 69 with SysSite

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";
}
Also used : LogUpload(com.publiccms.entities.log.LogUpload) IOException(java.io.IOException) SysSite(com.publiccms.entities.sys.SysSite) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 70 with SysSite

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;
}
Also used : LogOperate(com.publiccms.entities.log.LogOperate) SysApp(com.publiccms.entities.sys.SysApp) 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