Search in sources :

Example 16 with SysSite

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

the class CmsPlaceAdminController method check.

/**
 * @param ids
 * @param request
 * @param session
 * @param model
 * @return view name
 */
@RequestMapping("check")
public String check(Long[] ids, HttpServletRequest request, HttpSession session, ModelMap model) {
    if (CommonUtils.notEmpty(ids)) {
        SysSite site = getSite(request);
        service.check(site.getId(), ids);
        logOperateService.save(new LogOperate(site.getId(), getAdminFromSession(session).getId(), LogLoginService.CHANNEL_WEB_MANAGER, "check.place", 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 17 with SysSite

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

the class CmsPlaceAdminController method refresh.

/**
 * @param ids
 * @param request
 * @param session
 * @param model
 * @return view name
 */
@RequestMapping("refresh")
public String refresh(Long[] ids, HttpServletRequest request, HttpSession session, ModelMap model) {
    if (CommonUtils.notEmpty(ids)) {
        SysSite site = getSite(request);
        service.refresh(site.getId(), ids);
        logOperateService.save(new LogOperate(site.getId(), getAdminFromSession(session).getId(), LogLoginService.CHANNEL_WEB_MANAGER, "refresh.place", 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 18 with SysSite

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

the class CmsPlaceAdminController method delete.

/**
 * @param ids
 * @param request
 * @param session
 * @return view name
 */
@RequestMapping("delete")
public String delete(Long[] ids, HttpServletRequest request, HttpSession session) {
    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.place", 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 19 with SysSite

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

the class CmsPlaceAdminController method save.

/**
 * @param entity
 * @param placeParamters
 * @param request
 * @param session
 * @param model
 * @return view name
 */
@RequestMapping(value = "save", method = RequestMethod.POST)
public String save(CmsPlace entity, @ModelAttribute CmsPlaceParamters placeParamters, HttpServletRequest request, HttpSession session, ModelMap model) {
    if (null != entity && CommonUtils.notEmpty(entity.getPath())) {
        entity.setPath(entity.getPath().replace("//", SEPARATOR));
        SysSite site = getSite(request);
        Long userId = getAdminFromSession(session).getId();
        if (CommonUtils.empty(entity.getItemType()) || CommonUtils.empty(entity.getItemId())) {
            entity.setItemType(CmsPlaceService.ITEM_TYPE_CUSTOM);
            entity.setItemId(null);
        }
        if (null != entity.getId()) {
            CmsPlace 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(), userId, LogLoginService.CHANNEL_WEB_MANAGER, "update.place", RequestUtils.getIpAddress(request), CommonUtils.getDate(), entity.getPath()));
            }
        } else {
            entity.setUserId(userId);
            entity.setSiteId(site.getId());
            entity.setStatus(CmsPlaceService.STATUS_NORMAL);
            service.save(entity);
            logOperateService.save(new LogOperate(site.getId(), userId, LogLoginService.CHANNEL_WEB_MANAGER, "save.place", RequestUtils.getIpAddress(request), CommonUtils.getDate(), entity.getPath()));
        }
        String filePath = siteComponent.getWebTemplateFilePath(site, TemplateComponent.INCLUDE_DIRECTORY + entity.getPath());
        Map<String, String> map = ExtendUtils.getExtentDataMap(placeParamters.getExtendDataList(), metadataComponent.getPlaceMetadata(filePath).getExtendList());
        String extentString = ExtendUtils.getExtendString(map);
        attributeService.updateAttribute(entity.getId(), extentString);
    }
    return TEMPLATE_DONE;
}
Also used : LogOperate(com.publiccms.entities.log.LogOperate) CmsPlace(com.publiccms.entities.cms.CmsPlace) SysSite(com.publiccms.entities.sys.SysSite) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 20 with SysSite

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

the class CmsPlaceAdminController method clear.

/**
 * @param path
 * @param request
 * @param session
 * @param model
 * @return view name
 */
@RequestMapping("clear")
public String clear(String path, HttpServletRequest request, HttpSession session, ModelMap model) {
    if (CommonUtils.notEmpty(path)) {
        SysSite site = getSite(request);
        service.delete(site.getId(), path);
        logOperateService.save(new LogOperate(site.getId(), getAdminFromSession(session).getId(), LogLoginService.CHANNEL_WEB_MANAGER, "clear.place", RequestUtils.getIpAddress(request), CommonUtils.getDate(), path));
    }
    return TEMPLATE_DONE;
}
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