Search in sources :

Example 16 with CmsCategory

use of com.publiccms.entities.cms.CmsCategory in project PublicCMS-preview by sanluan.

the class CmsCategoryAdminController method move.

/**
 * @param siteId
 * @param id
 * @param parentId
 */
private void move(SysSite site, Integer id, Integer parentId) {
    CmsCategory entity = service.getEntity(id);
    if (null != entity && site.getId() == entity.getSiteId()) {
        service.updateParentId(site.getId(), id, parentId);
        service.generateChildIds(site.getId(), entity.getParentId());
        if (null != parentId) {
            service.generateChildIds(site.getId(), parentId);
        }
    }
}
Also used : CmsCategory(com.publiccms.entities.cms.CmsCategory)

Example 17 with CmsCategory

use of com.publiccms.entities.cms.CmsCategory in project PublicCMS-preview by sanluan.

the class CmsContentAdminController method uncheck.

/**
 * @param ids
 * @param request
 * @param session
 * @param model
 * @return view name
 */
@RequestMapping("uncheck")
public String uncheck(Long[] ids, HttpServletRequest request, HttpSession session, ModelMap model) {
    if (CommonUtils.notEmpty(ids)) {
        SysSite site = getSite(request);
        Long userId = getAdminFromSession(session).getId();
        List<CmsContent> entityList = service.uncheck(site.getId(), userId, ids);
        Set<Integer> categoryIdSet = new HashSet<>();
        for (CmsContent entity : entityList) {
            if (null != entity && site.getId() == entity.getSiteId()) {
                if (CommonUtils.notEmpty(entity.getParentId())) {
                    publish(new Long[] { entity.getParentId() }, request, session, model);
                }
                publish(new Long[] { entity.getId() }, request, session, model);
                categoryIdSet.add(entity.getCategoryId());
            }
        }
        for (CmsCategory category : categoryService.getEntitys(categoryIdSet.toArray(new Integer[categoryIdSet.size()]))) {
            templateComponent.createCategoryFile(site, category, null, null);
        }
        logOperateService.save(new LogOperate(site.getId(), userId, LogLoginService.CHANNEL_WEB_MANAGER, "uncheck.content", RequestUtils.getIpAddress(request), CommonUtils.getDate(), StringUtils.join(ids, ',')));
    }
    return TEMPLATE_DONE;
}
Also used : CmsContent(com.publiccms.entities.cms.CmsContent) LogOperate(com.publiccms.entities.log.LogOperate) CmsCategory(com.publiccms.entities.cms.CmsCategory) SysSite(com.publiccms.entities.sys.SysSite) HashSet(java.util.HashSet) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

CmsCategory (com.publiccms.entities.cms.CmsCategory)17 SysSite (com.publiccms.entities.sys.SysSite)11 LogOperate (com.publiccms.entities.log.LogOperate)7 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)7 CmsContent (com.publiccms.entities.cms.CmsContent)6 SysExtendField (com.publiccms.entities.sys.SysExtendField)3 TemplateException (freemarker.template.TemplateException)3 IOException (java.io.IOException)3 CmsCategoryModel (com.publiccms.entities.cms.CmsCategoryModel)2 CmsCategoryModelId (com.publiccms.entities.cms.CmsCategoryModelId)2 SysUser (com.publiccms.entities.sys.SysUser)2 CmsModel (com.publiccms.views.pojo.entities.CmsModel)2 ExtendField (com.publiccms.views.pojo.entities.ExtendField)2 CmsCategoryQuery (com.publiccms.views.pojo.query.CmsCategoryQuery)2 HashSet (java.util.HashSet)2 LinkedHashMap (java.util.LinkedHashMap)2 List (java.util.List)2 CmsCategoryType (com.publiccms.entities.cms.CmsCategoryType)1 SysDept (com.publiccms.entities.sys.SysDept)1 SysDeptCategoryId (com.publiccms.entities.sys.SysDeptCategoryId)1