package kcc.web; import java.util.Map; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import kcc.let.uss.ion.cnt.service.CntManageVO; import kcc.let.uss.ion.cnt.service.EgovCntManageService; @Controller public class ContentController{ @Resource(name = "egovCntManageService") private EgovCntManageService egovCntManageService; /*인사말*/ @RequestMapping(value="/web/intro/intro.do") public String intro(@RequestParam Map commandMap, Model model) throws Exception { //selectNaviList(68, model); return "/web/intro/intro"; } /* content*/ @RequestMapping(value="/web/content.do") public String contentIntro(@RequestParam Map commandMap, CntManageVO cntManageVO , HttpServletRequest request, Model model) throws Exception { if(commandMap.get("proFn")==null){ return "blank"; } cntManageVO.setProgrmFileNm((String)commandMap.get("proFn")); cntManageVO = egovCntManageService.selectContentVo(cntManageVO); if(cntManageVO==null){ //매뉴에 등록되지 않았으면 cnt_manage 에서라도 가져옴.(proFn 으로 무조건 content 가져옴) cntManageVO = new CntManageVO(); cntManageVO.setProgrmFileNm((String)commandMap.get("proFn")); cntManageVO = egovCntManageService.selectContentByProFn(cntManageVO) ; if(cntManageVO == null){ return "blank"; } return "cnt/"+cntManageVO.getCntId() ; } if(cntManageVO.getMenuCours()!=null){ //매뉴구조 cntManageVO.setMenuCours(cntManageVO.getMenuCours().replace("|" , " > ")); } if(null != commandMap.get("proFn")) { cntManageVO.setMenuNo((String)commandMap.get("proFn")); } model.addAttribute("cntManageVO", cntManageVO); String sLocationUrl = "cnt/"+cntManageVO.getCntId(); return sLocationUrl ; } /* 관리자 컨텐츠 content*/ @RequestMapping(value="/web/adminContent.do") public String adminContent(@RequestParam Map commandMap, CntManageVO cntManageVO , HttpServletRequest request, Model model) throws Exception { //selectNaviList(68, model); String tempCntDtId = "" ; if(cntManageVO.getCntDtId() != null){ //관리자 미리보기 화면 tempCntDtId = cntManageVO.getCntDtId(); //cntManageVO = egovCntManageService.selectContentByCntDtId(cntManageVO); cntManageVO = egovCntManageService.selectCntDtDetail(cntManageVO); if(cntManageVO!=null){ if(cntManageVO.getMenuCours()!=null){ //매뉴구조 cntManageVO.setMenuCours(cntManageVO.getMenuCours().replace("|" , " > ")); } } if(cntManageVO.getCntCn().contains("bbsLoad")) { cntManageVO.setCntCn(cntManageVO.getCntCn().replace("id=\"bbsLoad\"" , "")); } model.addAttribute("cntManageVO", cntManageVO); } String sLocationUrl = "cntsource/ckeditorPriview"; return sLocationUrl ; } /* 관리자 컨텐츠 content*/ @RequestMapping(value="/{siteId}/web/adminContent.do") public String siteAdminContent(@PathVariable("siteId") String siteId, @RequestParam Map commandMap, CntManageVO cntManageVO , HttpServletRequest request, Model model) throws Exception { //selectNaviList(68, model); String tempCntDtId = "" ; if(cntManageVO.getCntDtId() != null){ //관리자 미리보기 화면 tempCntDtId = cntManageVO.getCntDtId(); //cntManageVO = egovCntManageService.selectContentByCntDtId(cntManageVO); cntManageVO = egovCntManageService.selectCntDtDetail(cntManageVO); if(cntManageVO!=null){ if(cntManageVO.getMenuCours()!=null){ //매뉴구조 cntManageVO.setMenuCours(cntManageVO.getMenuCours().replace("|" , " > ")); } } model.addAttribute("cntManageVO", cntManageVO); } String sLocationUrl = "cntsource/ckeditorPriview"; return sLocationUrl ; } /* 컨텐츠 등록시 실제 파일로 테스트 해봄*/ @RequestMapping(value="/web/contentTemp.do") public String contentTempWrite(@RequestParam Map commandMap, CntManageVO cntManageVO , HttpServletRequest request, Model model) throws Exception { cntManageVO.setMenuCours("기관소개|인사말".replace("|" , " > ")); model.addAttribute("cntManageVO", cntManageVO); return "cntsource/contentTemp"; } /* 컨텐츠 에디터 미리보기 해봄*/ @RequestMapping(value="/web/ckeditorPriview.do") public String ckeditorPriview(@RequestParam Map commandMap, CntManageVO cntManageVO , HttpServletRequest request, Model model) throws Exception { model.addAttribute("cntManageVO", cntManageVO); String sLocationUrl = "cntsource/ckeditorPriview"; return sLocationUrl ; } /* 컨텐츠 에디터 미리보기 해봄*/ @RequestMapping(value="/{siteId}/web/ckeditorPriview.do") public String siteCkeditorPriview(@PathVariable("siteId") String siteId , @RequestParam Map commandMap, CntManageVO cntManageVO , HttpServletRequest request, Model model) throws Exception { model.addAttribute("cntManageVO", cntManageVO); String sLocationUrl = "cntsource/siteIdCkeditorPriview"; return sLocationUrl ; } /* siteId content*/ @RequestMapping(value="/{siteId}/web/content.do") public String siteContentIntro(@PathVariable("siteId") String siteId ,@RequestParam Map commandMap, CntManageVO cntManageVO , HttpServletRequest request, Model model) throws Exception { if(commandMap.get("proFn")==null){ return "blank"; } cntManageVO.setProgrmFileNm((String)commandMap.get("proFn")); cntManageVO.setSiteId(""); //수퍼 관리자 등록시 siteId 안들어감. cntManageVO = egovCntManageService.selectContentVo(cntManageVO); if(cntManageVO==null){ //매뉴에 등록되지 않았으면 cnt_manage 에서라도 가져옴.(proFn 으로 무조건 content 가져옴) cntManageVO = new CntManageVO(); cntManageVO.setProgrmFileNm((String)commandMap.get("proFn")); cntManageVO = egovCntManageService.selectContentByProFn(cntManageVO) ; if(cntManageVO == null){ return "blank"; } return "cnt/"+cntManageVO.getCntId() ; } if(cntManageVO.getMenuCours()!=null){ //매뉴구조 cntManageVO.setMenuCours(cntManageVO.getMenuCours().replace("|" , " > ")); } model.addAttribute("cntManageVO", cntManageVO); model.addAttribute("siteId", siteId); String siteFolder = "site/"+siteId ; model.addAttribute("site_path", "/"+siteFolder); String sLocationUrl = "cnt/"+cntManageVO.getCntId(); return sLocationUrl ; } }