sns 공유 기능 추가
This commit is contained in:
parent
d2977f588f
commit
9110adae9a
@ -35,6 +35,7 @@ import org.springframework.util.FileCopyUtils;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import cmm.Constant;
|
||||
@ -1630,67 +1631,6 @@ public class CmmController {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* YOURLS의 API를 통해서 단축URL 가져오기
|
||||
* @param cmmVO
|
||||
* @param model
|
||||
* @param commandMap
|
||||
* @param req
|
||||
* @param res
|
||||
* @return
|
||||
* @throws EgovBizException
|
||||
*/
|
||||
@RequestMapping(value="/cmm/shorturl-data.do")
|
||||
public ModelAndView shorturl (
|
||||
@ModelAttribute("cmmVO") CmmVO cmmVO
|
||||
, ModelMap model
|
||||
, HttpServletRequest req
|
||||
, HttpServletResponse res
|
||||
) throws EgovBizException {
|
||||
String returnUrl = "";
|
||||
DataMap paramMap = DataMap.getParamMap(req);
|
||||
try {
|
||||
String originUrl = URLEncoder.encode(paramMap.getString("url"), "UTF-8");
|
||||
URL url = new URL( propertiesService.getString("shorturl.api") + "&action=shorturl&format=xml&title=nculture&url=" + originUrl);
|
||||
HttpURLConnection con = (HttpURLConnection) url.openConnection();
|
||||
con.setRequestMethod("GET");
|
||||
//con.setRequestProperty("Authorization", header);
|
||||
int responseCode = con.getResponseCode();
|
||||
BufferedReader br;
|
||||
if(responseCode==200) { // 정상 호출
|
||||
br = new BufferedReader(new InputStreamReader(con.getInputStream()));
|
||||
} else { // 에러 발생
|
||||
br = new BufferedReader(new InputStreamReader(con.getErrorStream()));
|
||||
}
|
||||
|
||||
String inputLine;
|
||||
StringBuffer response = new StringBuffer();
|
||||
while ((inputLine = br.readLine()) != null) {
|
||||
response.append(inputLine);
|
||||
}
|
||||
br.close();
|
||||
|
||||
String str = response.toString();
|
||||
Pattern pattern = Pattern.compile("<shorturl>(.+?)</shorturl>");
|
||||
Matcher matcher = pattern.matcher(str);
|
||||
while (matcher.find()) {
|
||||
//System.out.println(matcher.group(1));
|
||||
returnUrl = matcher.group(1);
|
||||
if(matcher.group(1) == null){
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.err.println(e.toString());
|
||||
}
|
||||
|
||||
ModelAndView modelAndView = new ModelAndView();
|
||||
modelAndView.setViewName("jsonView");
|
||||
|
||||
model.addAttribute("responseData", returnUrl);
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
@RequestMapping(value="/cmm/cmmAssetSecondCategory.do")
|
||||
public ModelAndView selectCmmAssetSecondCategoryList(ModelMap model, HttpServletRequest request, HttpServletResponse response) throws Exception{
|
||||
DataMap paramMap = DataMap.getParamMap(request);
|
||||
|
||||
@ -93,7 +93,7 @@ public class InterestController extends NlibCommonController
|
||||
|
||||
//문화원 목록 조회
|
||||
vo = interestService.selectOrgList(searchCollectionVO);
|
||||
|
||||
model.addAttribute("pdfUri",NlibProperty.getProperty("pdf.uri"));
|
||||
model.addAttribute("deptList",vo);
|
||||
model.addAttribute("searchCollection", searchCollectionVO);
|
||||
return "nlib/collection/listInterests";
|
||||
@ -121,14 +121,13 @@ public class InterestController extends NlibCommonController
|
||||
|
||||
searchCollectionVO.setMbInfoId(loginVO.getMbInfoId());
|
||||
searchCollectionVO.setPageStart(searchCollectionVO.getPageIndex(), searchCollectionVO.getPageSize());
|
||||
List<CollectionVO> List = new ArrayList();
|
||||
|
||||
// 요청
|
||||
List = interestService.listInterests(searchCollectionVO);
|
||||
List<CollectionVO> interestList = interestService.listInterests(searchCollectionVO);
|
||||
totalCount = interestService.countListInterests(searchCollectionVO);
|
||||
|
||||
String mbInfoId = getMbInfoId(request);
|
||||
operList = collectionService.setDetailInfoForList(List, getMbInfoId(request), NlibProperty.getString("thumbnail.image.url.small"));
|
||||
operList = collectionService.setDetailInfoForList(interestList, getMbInfoId(request), NlibProperty.getString("thumbnail.image.url.small"));
|
||||
//-------------------------------
|
||||
// JSON변환 응답 처리
|
||||
//-------------------------------
|
||||
|
||||
673
src/main/java/nlib/sch/service/CmmVO.java
Normal file
673
src/main/java/nlib/sch/service/CmmVO.java
Normal file
@ -0,0 +1,673 @@
|
||||
package nlib.sch.service;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
|
||||
/**
|
||||
* @Class Name : CmmVO.java
|
||||
* @author Kdmistrator
|
||||
* @version 1.0
|
||||
* 상속 받아서 사용하는 공통 VO
|
||||
*/
|
||||
public class CmmVO implements Serializable{
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private String cntntsSeCode;
|
||||
private String searchCondition = "";
|
||||
private String searchKeyword = "";
|
||||
private String searchCondition2 = "";
|
||||
private String searchKeyword2 = "";
|
||||
private String searchCondition3 = "";
|
||||
private String searchKeyword3 = "";
|
||||
private String searchCondition4 = "";
|
||||
private String searchKeyword4 = "";
|
||||
private String searchCondition5 = "";
|
||||
private String searchKeyword5 = "";
|
||||
private String searchCondition6 = "";
|
||||
private String searchKeyword6 = "";
|
||||
private String searchCondition7 = "";
|
||||
private String searchCondition8 = "";
|
||||
private String searchKeywordWhole = "";
|
||||
private String searchConditionWhole = "";
|
||||
private String searchDateCondition = "";
|
||||
private Date searchStartDate = null;
|
||||
private Date searchEndDate = null;
|
||||
private String searchStartStr = null;
|
||||
private String searchEndStr = null;
|
||||
private String searchUseYn = "";
|
||||
private String searchType = "";
|
||||
private String searchType1 = "";
|
||||
private String searchType2 = "";
|
||||
private String searchType3 = "";
|
||||
private String searchType4 = "";
|
||||
private int pageIndex = 1;
|
||||
private int pageIndex2 = 1;
|
||||
private int pageIndex3 = 1;
|
||||
|
||||
private int pageUnit = 12;
|
||||
private int pageUnit10 = 10;
|
||||
private int pageUnit20 = 20;
|
||||
private int pageUnit30 = 30;
|
||||
private int pageSize = 10;
|
||||
private int mobilePageSize = 5;
|
||||
private int firstIndex = 1;
|
||||
private int lastIndex = 1;
|
||||
private int recordCountPerPage = 10;
|
||||
private String orderCondition;
|
||||
private String orderType;
|
||||
private boolean isBr = false;
|
||||
private String pageUseAt = "Y";
|
||||
private int limit = 5;
|
||||
private String authorCode;
|
||||
private String targetId;
|
||||
private String sido = "";
|
||||
private String sigungu = "";
|
||||
private String sido2 = "";
|
||||
private String sigungu2 = "";
|
||||
private String dong = "";
|
||||
private String lon = "";
|
||||
private String lat = "";
|
||||
private String addr ="";
|
||||
private String xy ="";
|
||||
private String distance = "";
|
||||
private String tabCode = "";
|
||||
private int fixedPage = 0;
|
||||
private String activityType ="";
|
||||
private String contentType = "";
|
||||
private String toDay = "";
|
||||
private String parameter1 = "";
|
||||
private String parameter2 = "";
|
||||
private String parameter3 = "";
|
||||
private String parameter4 = "";
|
||||
private String parameter5 = "";
|
||||
private String parameter6 = "";
|
||||
private String sessionId = "";
|
||||
private boolean isTag = false;
|
||||
private String viewType = "";
|
||||
// 태그 명이 넘어가는 파라미터
|
||||
private String searchTag = "";
|
||||
// 스크랩 여부(스크랩 활성 체크) : 존재하면 on , 존재하지 않으면 빈값 ""
|
||||
private String scrapActive = "";
|
||||
private String aId=""; // 에셋 아이디
|
||||
private String mId=""; // 에셋미디어 아이디
|
||||
private String [] searchLocaleArray; // 지역
|
||||
private String [] searchAssetClassArray; // 에셋유형 (ex. 일반, 특화, 문화원소장 등)
|
||||
private String [] searchAssetTypeArray; // 자산유형 (ex. 문서, 이미지, 동영상, 오디오, 링크 등)
|
||||
private String [] searchFirstCategoryArray; // 카테고리
|
||||
|
||||
private String sCouncilCd="";
|
||||
private String gubun="";
|
||||
|
||||
|
||||
public CmmVO() {}
|
||||
public String getCntntsSeCode() {
|
||||
return cntntsSeCode;
|
||||
}
|
||||
|
||||
public void setCntntsSeCode(String cntntsSeCode) {
|
||||
this.cntntsSeCode = cntntsSeCode;
|
||||
}
|
||||
|
||||
public String getSearchCondition() {
|
||||
return searchCondition;
|
||||
}
|
||||
|
||||
public void setSearchCondition(String searchCondition) {
|
||||
this.searchCondition = searchCondition;
|
||||
}
|
||||
|
||||
public String getSearchKeyword() {
|
||||
return searchKeyword;
|
||||
}
|
||||
|
||||
public void setSearchKeyword(String searchKeyword) {
|
||||
this.searchKeyword = searchKeyword;
|
||||
}
|
||||
|
||||
public String getSearchCondition2() {
|
||||
return searchCondition2;
|
||||
}
|
||||
|
||||
public void setSearchCondition2(String searchCondition2) {
|
||||
this.searchCondition2 = searchCondition2;
|
||||
}
|
||||
|
||||
public String getSearchKeyword2() {
|
||||
return searchKeyword2;
|
||||
}
|
||||
|
||||
public void setSearchKeyword2(String searchKeyword2) {
|
||||
this.searchKeyword2 = searchKeyword2;
|
||||
}
|
||||
|
||||
public String getSearchCondition3() {
|
||||
return searchCondition3;
|
||||
}
|
||||
|
||||
public void setSearchCondition3(String searchCondition3) {
|
||||
this.searchCondition3 = searchCondition3;
|
||||
}
|
||||
|
||||
public String getSearchKeyword3() {
|
||||
return searchKeyword3;
|
||||
}
|
||||
|
||||
public void setSearchKeyword3(String searchKeyword3) {
|
||||
this.searchKeyword3 = searchKeyword3;
|
||||
}
|
||||
public String getSearchCondition4() {
|
||||
return searchCondition4;
|
||||
}
|
||||
|
||||
public void setSearchCondition4(String searchCondition4) {
|
||||
this.searchCondition4 = searchCondition4;
|
||||
}
|
||||
|
||||
public String getSearchKeyword4() {
|
||||
return searchKeyword4;
|
||||
}
|
||||
|
||||
public void setSearchKeyword4(String searchKeyword4) {
|
||||
this.searchKeyword4 = searchKeyword4;
|
||||
}
|
||||
|
||||
public String getSearchCondition5() {
|
||||
return searchCondition5;
|
||||
}
|
||||
|
||||
public void setSearchCondition5(String searchCondition5) {
|
||||
this.searchCondition5 = searchCondition5;
|
||||
}
|
||||
|
||||
public String getSearchKeyword5() {
|
||||
return searchKeyword5;
|
||||
}
|
||||
|
||||
public void setSearchKeyword5(String searchKeyword5) {
|
||||
this.searchKeyword5 = searchKeyword5;
|
||||
}
|
||||
|
||||
public String getSearchCondition6() {
|
||||
return searchCondition6;
|
||||
}
|
||||
public void setSearchCondition6(String searchCondition6) {
|
||||
this.searchCondition6 = searchCondition6;
|
||||
}
|
||||
public String getSearchKeyword6() {
|
||||
return searchKeyword6;
|
||||
}
|
||||
|
||||
public String getSearchCondition7() {
|
||||
return searchCondition7;
|
||||
}
|
||||
public void setSearchCondition7(String searchCondition7) {
|
||||
this.searchCondition7 = searchCondition7;
|
||||
}
|
||||
public String getSearchCondition8() {
|
||||
return searchCondition8;
|
||||
}
|
||||
public void setSearchCondition8(String searchCondition8) {
|
||||
this.searchCondition8 = searchCondition8;
|
||||
}
|
||||
public String getSearchKeywordWhole() {
|
||||
return searchKeywordWhole;
|
||||
}
|
||||
public void setSearchKeywordWhole(String searchKeywordWhole) {
|
||||
this.searchKeywordWhole = searchKeywordWhole;
|
||||
}
|
||||
public String getSearchConditionWhole() {
|
||||
return searchConditionWhole;
|
||||
}
|
||||
public void setSearchConditionWhole(String searchConditionWhole) {
|
||||
this.searchConditionWhole = searchConditionWhole;
|
||||
}
|
||||
public void setSearchKeyword6(String searchKeyword6) {
|
||||
this.searchKeyword6 = searchKeyword6;
|
||||
}
|
||||
public String getSearchDateCondition() {
|
||||
return searchDateCondition;
|
||||
}
|
||||
|
||||
public void setSearchDateCondition(String searchDateCondition) {
|
||||
this.searchDateCondition = searchDateCondition;
|
||||
}
|
||||
|
||||
public Date getSearchStartDate() {
|
||||
return searchStartDate;
|
||||
}
|
||||
|
||||
public void setSearchStartDate(Date searchStartDate) {
|
||||
this.searchStartDate = searchStartDate;
|
||||
}
|
||||
|
||||
public Date getSearchEndDate() {
|
||||
return searchEndDate;
|
||||
}
|
||||
|
||||
public void setSearchEndDate(Date searchEndDate) {
|
||||
this.searchEndDate = searchEndDate;
|
||||
}
|
||||
|
||||
|
||||
public String getSearchStartStr() {
|
||||
return searchStartStr;
|
||||
}
|
||||
|
||||
public void setSearchStartStr(String searchStartStr) {
|
||||
this.searchStartStr = searchStartStr;
|
||||
}
|
||||
|
||||
public String getSearchEndStr() {
|
||||
return searchEndStr;
|
||||
}
|
||||
|
||||
public void setSearchEndStr(String searchEndStr) {
|
||||
this.searchEndStr = searchEndStr;
|
||||
}
|
||||
|
||||
public String getSearchUseYn() {
|
||||
return searchUseYn;
|
||||
}
|
||||
public void setSearchUseYn(String searchUseYn) {
|
||||
this.searchUseYn = searchUseYn;
|
||||
}
|
||||
|
||||
public String getSearchType() {
|
||||
return StringUtils.defaultIfEmpty(searchType, "1") ;
|
||||
}
|
||||
|
||||
public void setSearchType(String searchType) {
|
||||
this.searchType = searchType;
|
||||
}
|
||||
|
||||
public String getSearchType1() {
|
||||
return StringUtils.defaultIfEmpty(searchType1, "1") ;
|
||||
}
|
||||
public void setSearchType1(String searchType1) {
|
||||
this.searchType1 = searchType1;
|
||||
}
|
||||
public String getSearchType2() {
|
||||
return StringUtils.defaultIfEmpty(searchType2, "1") ;
|
||||
}
|
||||
public void setSearchType2(String searchType2) {
|
||||
this.searchType2 = searchType2;
|
||||
}
|
||||
public String getSearchType3() {
|
||||
return StringUtils.defaultIfEmpty(searchType3, "1") ;
|
||||
}
|
||||
public void setSearchType3(String searchType3) {
|
||||
this.searchType3 = searchType3;
|
||||
}
|
||||
public String getSearchType4() {
|
||||
return StringUtils.defaultIfEmpty(searchType4, "1") ;
|
||||
}
|
||||
public void setSearchType4(String searchType4) {
|
||||
this.searchType4 = searchType4;
|
||||
}
|
||||
public int getPageIndex() {
|
||||
return this.pageIndex;
|
||||
}
|
||||
|
||||
public void setPageIndex(int pageIndex) {
|
||||
this.pageIndex = pageIndex;
|
||||
}
|
||||
|
||||
public int getPageIndex2() {
|
||||
return pageIndex2;
|
||||
}
|
||||
public void setPageIndex2(int pageIndex2) {
|
||||
this.pageIndex2 = pageIndex2;
|
||||
}
|
||||
|
||||
public int getPageIndex3() {
|
||||
return pageIndex3;
|
||||
}
|
||||
public void setPageIndex3(int pageIndex3) {
|
||||
this.pageIndex3 = pageIndex3;
|
||||
}
|
||||
public int getPageUnit() {
|
||||
return pageUnit;
|
||||
}
|
||||
|
||||
public void setPageUnit(int pageUnit) {
|
||||
this.pageUnit = pageUnit;
|
||||
}
|
||||
|
||||
public int getPageUnit10() {
|
||||
return pageUnit10;
|
||||
}
|
||||
public void setPageUnit10(int pageUnit10) {
|
||||
this.pageUnit10 = pageUnit10;
|
||||
}
|
||||
|
||||
public int getPageUnit20() {
|
||||
return pageUnit20;
|
||||
}
|
||||
public void setPageUnit20(int pageUnit20) {
|
||||
this.pageUnit20 = pageUnit20;
|
||||
}
|
||||
public int getPageUnit30() {
|
||||
return pageUnit30;
|
||||
}
|
||||
public void setPageUnit30(int pageUnit30) {
|
||||
this.pageUnit30 = pageUnit30;
|
||||
}
|
||||
|
||||
public int getPageSize() {
|
||||
return pageSize;
|
||||
}
|
||||
|
||||
public void setPageSize(int pageSize) {
|
||||
this.pageSize = pageSize;
|
||||
}
|
||||
|
||||
public int getMobilePageSize() {
|
||||
return mobilePageSize;
|
||||
}
|
||||
public void setMobilePageSize(int mobilePageSize) {
|
||||
this.mobilePageSize = mobilePageSize;
|
||||
}
|
||||
public int getFirstIndex() {
|
||||
return firstIndex;
|
||||
}
|
||||
|
||||
public void setFirstIndex(int firstIndex) {
|
||||
this.firstIndex = firstIndex;
|
||||
}
|
||||
|
||||
public int getLastIndex() {
|
||||
return lastIndex;
|
||||
}
|
||||
|
||||
public void setLastIndex(int lastIndex) {
|
||||
this.lastIndex = lastIndex;
|
||||
}
|
||||
|
||||
public int getRecordCountPerPage() {
|
||||
return recordCountPerPage;
|
||||
}
|
||||
|
||||
public void setRecordCountPerPage(int recordCountPerPage) {
|
||||
this.recordCountPerPage = recordCountPerPage;
|
||||
}
|
||||
|
||||
public String getOrderCondition() {
|
||||
return orderCondition;
|
||||
}
|
||||
|
||||
public void setOrderCondition(String orderCondition) {
|
||||
this.orderCondition = orderCondition;
|
||||
}
|
||||
public String getOrderType() {
|
||||
return orderType;
|
||||
}
|
||||
|
||||
public void setOrderType(String orderType) {
|
||||
this.orderType = orderType;
|
||||
}
|
||||
|
||||
public boolean isBr() {
|
||||
return isBr;
|
||||
}
|
||||
|
||||
public void setBr(boolean isBr) {
|
||||
this.isBr = isBr;
|
||||
}
|
||||
|
||||
public String getPageUseAt() {
|
||||
return pageUseAt;
|
||||
}
|
||||
public void setPageUseAt(String pageUseAt) {
|
||||
this.pageUseAt = pageUseAt;
|
||||
}
|
||||
|
||||
public int getLimit() {
|
||||
return limit;
|
||||
}
|
||||
public void setLimit(int limit) {
|
||||
this.limit = limit;
|
||||
}
|
||||
|
||||
public String getAuthorCode() {
|
||||
return authorCode;
|
||||
}
|
||||
public void setAuthorCode(String authorCode) {
|
||||
this.authorCode = authorCode;
|
||||
}
|
||||
|
||||
public String getTargetId() {
|
||||
return targetId;
|
||||
}
|
||||
public void setTargetId(String targetId) {
|
||||
this.targetId = targetId;
|
||||
}
|
||||
|
||||
public String getSido() {
|
||||
return sido;
|
||||
}
|
||||
public void setSido(String sido) {
|
||||
this.sido = sido;
|
||||
}
|
||||
public String getSigungu() {
|
||||
return sigungu;
|
||||
}
|
||||
public void setSigungu(String sigungu) {
|
||||
this.sigungu = sigungu;
|
||||
}
|
||||
public String getSido2() {
|
||||
return sido2;
|
||||
}
|
||||
public void setSido2(String sido2) {
|
||||
this.sido2 = sido2;
|
||||
}
|
||||
public String getSigungu2() {
|
||||
return sigungu2;
|
||||
}
|
||||
public void setSigungu2(String sigungu2) {
|
||||
this.sigungu2 = sigungu2;
|
||||
}
|
||||
public String getDong() {
|
||||
return dong;
|
||||
}
|
||||
public void setDong(String dong) {
|
||||
this.dong = dong;
|
||||
}
|
||||
public String getLon() {
|
||||
return lon;
|
||||
}
|
||||
public void setLon(String lon) {
|
||||
this.lon = lon;
|
||||
}
|
||||
public String getLat() {
|
||||
return lat;
|
||||
}
|
||||
public void setLat(String lat) {
|
||||
this.lat = lat;
|
||||
}
|
||||
|
||||
public String getAddr() {
|
||||
return addr;
|
||||
}
|
||||
public void setAddr(String addr) {
|
||||
this.addr = addr;
|
||||
}
|
||||
public String getXy() {
|
||||
return xy;
|
||||
}
|
||||
public void setXy(String xy) {
|
||||
this.xy = xy;
|
||||
}
|
||||
|
||||
public String getDistance() {
|
||||
return distance;
|
||||
}
|
||||
public void setDistance(String distance) {
|
||||
this.distance = distance;
|
||||
}
|
||||
|
||||
public String getTabCode() {
|
||||
return tabCode;
|
||||
}
|
||||
public void setTabCode(String tabCode) {
|
||||
this.tabCode = tabCode;
|
||||
}
|
||||
|
||||
|
||||
public int getFixedPage() {
|
||||
return fixedPage;
|
||||
}
|
||||
public void setFixedPage(int fixedPage) {
|
||||
this.fixedPage = fixedPage;
|
||||
}
|
||||
|
||||
public String getActivityType() {
|
||||
return activityType;
|
||||
}
|
||||
public void setActivityType(String activityType) {
|
||||
this.activityType = activityType;
|
||||
}
|
||||
public String getContentType() {
|
||||
return contentType;
|
||||
}
|
||||
public void setContentType(String contentType) {
|
||||
this.contentType = contentType;
|
||||
}
|
||||
|
||||
public String getToDay() {
|
||||
return toDay;
|
||||
}
|
||||
public void setToDay(String toDay) {
|
||||
this.toDay = toDay;
|
||||
}
|
||||
public String getParameter1() {
|
||||
return parameter1;
|
||||
}
|
||||
public void setParameter1(String parameter1) {
|
||||
this.parameter1 = parameter1;
|
||||
}
|
||||
public String getParameter2() {
|
||||
return parameter2;
|
||||
}
|
||||
public void setParameter2(String parameter2) {
|
||||
this.parameter2 = parameter2;
|
||||
}
|
||||
public String getParameter3() {
|
||||
return parameter3;
|
||||
}
|
||||
public void setParameter3(String parameter3) {
|
||||
this.parameter3 = parameter3;
|
||||
}
|
||||
public String getParameter4() {
|
||||
return parameter4;
|
||||
}
|
||||
public void setParameter4(String parameter4) {
|
||||
this.parameter4 = parameter4;
|
||||
}
|
||||
public String getParameter5() {
|
||||
return parameter5;
|
||||
}
|
||||
public void setParameter5(String parameter5) {
|
||||
this.parameter5 = parameter5;
|
||||
}
|
||||
public String getParameter6() {
|
||||
return parameter6;
|
||||
}
|
||||
public void setParameter6(String parameter6) {
|
||||
this.parameter6 = parameter6;
|
||||
}
|
||||
public String getSessionId() {
|
||||
return sessionId;
|
||||
}
|
||||
public void setSessionId(String sessionId) {
|
||||
this.sessionId = sessionId;
|
||||
}
|
||||
public boolean isTag() {
|
||||
return isTag;
|
||||
}
|
||||
public void setIsTag(boolean isTag) {
|
||||
this.isTag = isTag;
|
||||
}
|
||||
public String getViewType() {
|
||||
return viewType;
|
||||
}
|
||||
public void setViewType(String viewType) {
|
||||
this.viewType = viewType;
|
||||
}
|
||||
|
||||
public String getSearchTag() {
|
||||
return searchTag;
|
||||
}
|
||||
public void setSearchTag(String searchTag) {
|
||||
this.searchTag = searchTag;
|
||||
}
|
||||
|
||||
public String getScrapActive() {
|
||||
return scrapActive;
|
||||
}
|
||||
public void setScrapActive(String scrapActive) {
|
||||
this.scrapActive = scrapActive;
|
||||
}
|
||||
public String getaId() {
|
||||
return aId;
|
||||
}
|
||||
public void setaId(String aId) {
|
||||
this.aId = aId;
|
||||
}
|
||||
public String getmId() {
|
||||
return mId;
|
||||
}
|
||||
public void setmId(String mId) {
|
||||
this.mId = mId;
|
||||
}
|
||||
|
||||
public String[] getSearchLocaleArray() {
|
||||
return searchLocaleArray;
|
||||
}
|
||||
public void setSearchLocaleArray(String[] searchLocaleArray) {
|
||||
this.searchLocaleArray = searchLocaleArray;
|
||||
}
|
||||
public String[] getSearchAssetClassArray() {
|
||||
return searchAssetClassArray;
|
||||
}
|
||||
public void setSearchAssetClassArray(String[] searchAssetClassArray) {
|
||||
this.searchAssetClassArray = searchAssetClassArray;
|
||||
}
|
||||
|
||||
public String[] getSearchAssetTypeArray() {
|
||||
return searchAssetTypeArray;
|
||||
}
|
||||
public void setSearchAssetTypeArray(String[] searchAssetTypeArray) {
|
||||
this.searchAssetTypeArray = searchAssetTypeArray;
|
||||
}
|
||||
public String getsCouncilCd() {
|
||||
return sCouncilCd;
|
||||
}
|
||||
public void setsCouncilCd(String sCouncilCd) {
|
||||
this.sCouncilCd = sCouncilCd;
|
||||
}
|
||||
|
||||
public String[] getSearchFirstCategoryArray() {
|
||||
return searchFirstCategoryArray;
|
||||
}
|
||||
public void setSearchFirstCategoryArray(String[] searchFirstCategoryArray) {
|
||||
this.searchFirstCategoryArray = searchFirstCategoryArray;
|
||||
}
|
||||
|
||||
public String getGubun() {
|
||||
return gubun;
|
||||
}
|
||||
public void setGubun(String gubun) {
|
||||
this.gubun = gubun;
|
||||
}
|
||||
/**
|
||||
* toString
|
||||
* @return String
|
||||
*/
|
||||
public String toString() {
|
||||
return ToStringBuilder.reflectionToString(this);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,11 +1,18 @@
|
||||
package nlib.sch.web;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.net.URLEncoder;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@ -20,9 +27,13 @@ import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import cmm.Constant;
|
||||
import cmm.util.CmmUtil;
|
||||
import nlib.sch.service.CmmVO;
|
||||
import cmm.util.DataMap;
|
||||
import egovframework.rte.fdl.cmmn.exception.EgovBizException;
|
||||
import kccf.res.service.ResourcesService;
|
||||
import kccf.sch.service.SearchService;
|
||||
import nlib.cmm.NlibCommonController;
|
||||
@ -194,7 +205,7 @@ public class NlibSearchController extends NlibCommonController {
|
||||
model.addAttribute("firstClassList", firstClassList);
|
||||
model.addAttribute("secondClassList", secondClassList);
|
||||
|
||||
|
||||
model.addAttribute("pdfUri", NlibProperty.getProperty("pdf.uri"));
|
||||
searchVO.setQuery(searchVO.getQuery().replaceAll("\\\"", """));
|
||||
return "nlib/collection/searchList";
|
||||
}
|
||||
@ -225,74 +236,76 @@ public class NlibSearchController extends NlibCommonController {
|
||||
vo = collectionService.getItemInfo(vo,NlibProperty.getString("thumbnail.image.url.big"));
|
||||
|
||||
//반납예정일 편집
|
||||
if(!StringUtil.getString(vo.getRtnExpctDd(),"").equals(""))
|
||||
if(!(vo == null) && !StringUtil.getString(vo.getRtnExpctDd(),"").equals(""))
|
||||
{
|
||||
String strDate = vo.getRtnExpctDd();
|
||||
SimpleDateFormat dtFormat = new SimpleDateFormat("yyyyMMdd");
|
||||
SimpleDateFormat newDtFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
Date formatDate = dtFormat.parse(strDate);
|
||||
String strNewDtFormat = newDtFormat.format(formatDate);
|
||||
String strNewDtFormat = newDtFormat.format(formatDate);
|
||||
vo.setRtnExpctDd(strNewDtFormat);
|
||||
}
|
||||
model.addAttribute("result", vo);
|
||||
model.addAttribute("pdfUri", NlibProperty.getProperty("pdf.uri"));
|
||||
return "nlib/collection/searchItemDetail";
|
||||
}
|
||||
|
||||
/**
|
||||
* 소장자료를 조회한다.
|
||||
*
|
||||
* @param req
|
||||
* @return
|
||||
*//*
|
||||
@RequestMapping(value="/collection/listItemsAjax.do", method = RequestMethod.POST)
|
||||
public ResponseEntity<String> listItemsAjax(HttpServletRequest req,
|
||||
Authentication authentication, @RequestBody CollectionVO searchCollectionVO) {
|
||||
|
||||
//String searchKeyword = paramMap.get("searchKeyword");
|
||||
if(searchCollectionVO.getPageIndex() < 1) searchCollectionVO.setPageIndex(1);
|
||||
if(searchCollectionVO.getPageSize() < 1) searchCollectionVO.setPageSize(DEFUALT_PAGE_SIZE);
|
||||
|
||||
|
||||
int totalCount= 0;
|
||||
//사용자 정보를 가져온다.
|
||||
NlibLoginVO loginVO = getNlibLoginVO(authentication);
|
||||
|
||||
searchCollectionVO.setPageStart(searchCollectionVO.getPageIndex(), searchCollectionVO.getPageSize());
|
||||
List<CollectionVO> List = new ArrayList();
|
||||
|
||||
// 요청
|
||||
List = risService.listItems(searchCollectionVO);
|
||||
totalCount = risService.countListItems(searchCollectionVO);
|
||||
|
||||
PagingVO pageVO = new PagingVO();
|
||||
pageVO.setPagingVO(totalCount, searchCollectionVO.getPageIndex(), searchCollectionVO.getPageSize());
|
||||
|
||||
//-------------------------------
|
||||
// REQ VO 구성
|
||||
//-------------------------------
|
||||
DataApiReqVO reqVO = new DataApiReqVO();
|
||||
reqVO.setPageIndex(pageIndex);
|
||||
reqVO.setPageSize(pageSize);
|
||||
reqVO.putInfoItem("searchKeyword", searchKeyword);
|
||||
|
||||
// 요청
|
||||
//DataApiResVO resVO = collectionService.listItems(reqVO);
|
||||
|
||||
//-------------------------------
|
||||
// JSON변환 응답 처리
|
||||
//-------------------------------
|
||||
// JS-GRID 페이징 처리를 포함한 응답값 처리
|
||||
// {data: [{...}],
|
||||
// itemsCount: 255
|
||||
// }
|
||||
HashMap<String, Object> retMap = new HashMap<String, Object>();
|
||||
retMap.put("data", resVO.getList(DataApiVO.XML_EL_NAME_RECORD));
|
||||
retMap.put("itemsCount", resVO.getRecordTotCount());
|
||||
retMap.put("data", List);
|
||||
retMap.put("pageVO", pageVO);
|
||||
|
||||
return makeResponseEntityJson(retMap);
|
||||
}*/
|
||||
|
||||
* YOURLS의 API를 통해서 단축URL 가져오기
|
||||
* @param cmmVO
|
||||
* @param model
|
||||
* @param commandMap
|
||||
* @param req
|
||||
* @param res
|
||||
* @return
|
||||
* @throws EgovBizException
|
||||
*/
|
||||
@RequestMapping(value="/search/shorturl-data.do")
|
||||
@ResponseBody
|
||||
public String shorturl (
|
||||
@ModelAttribute("cmmVO") CmmVO cmmVO
|
||||
, ModelMap model
|
||||
, HttpServletRequest req
|
||||
, HttpServletResponse res
|
||||
) throws EgovBizException {
|
||||
String returnUrl = "";
|
||||
DataMap paramMap = DataMap.getParamMap(req);
|
||||
try {
|
||||
String originUrl = URLEncoder.encode(paramMap.getString("url"), "UTF-8");
|
||||
URL url = new URL( NlibProperty.getProperty("shorturl.api") + "&action=shorturl&format=xml&title=nculture&url=" + originUrl);
|
||||
HttpURLConnection con = (HttpURLConnection) url.openConnection();
|
||||
con.setRequestMethod("GET");
|
||||
//con.setRequestProperty("Authorization", header);
|
||||
int responseCode = con.getResponseCode();
|
||||
BufferedReader br;
|
||||
if(responseCode==200) { // 정상 호출
|
||||
br = new BufferedReader(new InputStreamReader(con.getInputStream()));
|
||||
} else { // 에러 발생
|
||||
br = new BufferedReader(new InputStreamReader(con.getErrorStream()));
|
||||
}
|
||||
|
||||
String inputLine;
|
||||
StringBuffer response = new StringBuffer();
|
||||
while ((inputLine = br.readLine()) != null) {
|
||||
response.append(inputLine);
|
||||
}
|
||||
br.close();
|
||||
|
||||
String str = response.toString();
|
||||
Pattern pattern = Pattern.compile("<shorturl>(.+?)</shorturl>");
|
||||
Matcher matcher = pattern.matcher(str);
|
||||
while (matcher.find()) {
|
||||
//System.out.println(matcher.group(1));
|
||||
returnUrl = matcher.group(1);
|
||||
if(matcher.group(1) == null){
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.err.println(e.toString());
|
||||
}
|
||||
return returnUrl;
|
||||
}
|
||||
/**
|
||||
* 상세검색 팝업.
|
||||
*
|
||||
@ -325,49 +338,4 @@ public class NlibSearchController extends NlibCommonController {
|
||||
return "nlib/search/getDetailedSearchFormPopup";
|
||||
}
|
||||
|
||||
/**
|
||||
* 소장자료 상세 내용 조회한다.
|
||||
*
|
||||
* @param req
|
||||
* @return
|
||||
*//*
|
||||
@RequestMapping("/search/selectItemInfo.do")
|
||||
public String selectItemInfo(HttpServletRequest req, Authentication authentication, @RequestParam Map<String, String> paramMap, ModelMap model) {
|
||||
// 목록 이동시 전달할 매개변수
|
||||
String searchKeyword = paramMap.get("searchKeyword");
|
||||
String pageIndex = paramMap.get("pageIndex");
|
||||
String pageSize = paramMap.get("pageSize");
|
||||
String message = paramMap.get("message");
|
||||
|
||||
// 게시물 번호
|
||||
String articleNo = paramMap.get("articleNo");
|
||||
|
||||
log.debug("selectQnA > pageIndex = " + pageIndex);
|
||||
log.debug("selectQnA > pageSize = " + pageSize);
|
||||
log.debug("selectQnA > searchKeyword = " + searchKeyword);
|
||||
log.debug("selectQnA > articleNo = " + articleNo);
|
||||
log.debug("selectQnA > message = " + message);
|
||||
|
||||
//-------------------------------
|
||||
// REQ VO 구성
|
||||
//-------------------------------
|
||||
DataApiReqVO reqVO = new DataApiReqVO();
|
||||
reqVO.setPageIndex(pageIndex);
|
||||
reqVO.setPageSize(pageSize);
|
||||
reqVO.addInfoItem("boardNo", "QNA"); // 게시판ID
|
||||
reqVO.addInfoItem("articleNo", articleNo); // 게시물번호
|
||||
|
||||
// 요청
|
||||
DataApiResVO resVO = collectionService.selectItemInfo(reqVO);
|
||||
|
||||
// 반환 정보
|
||||
model.addAttribute("articleNo" , articleNo);
|
||||
model.addAttribute("article" , resVO.getInfo()); // 게시물 상세
|
||||
model.addAttribute("message" , message);
|
||||
model.addAttribute("pageIndex" , pageIndex);
|
||||
model.addAttribute("pageSize" , pageSize);
|
||||
model.addAttribute("searchKeyword", searchKeyword);
|
||||
|
||||
return "nlib/collection/selectItemInfo";
|
||||
}*/
|
||||
}
|
||||
|
||||
@ -180,6 +180,7 @@ cart.cookie.path = /
|
||||
#----------------------------------------
|
||||
# \uc378\ub124\uc77c \uae30\ubcf8 \uc774\ubbf8\uc9c0 (\uc378\ub124\uc77c \uc5c6\uc74c)
|
||||
#----------------------------------------
|
||||
thumbnail.image.url.prefix = https://iams-dev.nculture.org/uac
|
||||
thumbnail.image.url.small = /images/thumbnail/noimage-s.jpg
|
||||
thumbnail.image.url.middle = /images/thumbnail/noimage-m.jpg
|
||||
thumbnail.image.url.big = /images/thumbnail/noimage-b.jpg
|
||||
|
||||
@ -226,7 +226,7 @@
|
||||
}
|
||||
if(!fn_isEmpty(obj.interfaceId) && !fn_isEmpty(obj.openDivCd) && obj.openDivCd != '3')
|
||||
{
|
||||
t_btn+= "<button type=\"button\" class=\"btn-color\" onclick=\"docView('" + obj.interfaceId + "');\">원문보기</button>";
|
||||
t_btn+= "<button type=\"button\" class=\"btn-color\" onclick=\"docView('${pdfUri}','" + obj.interfaceId + "');\">원문보기</button>";
|
||||
}
|
||||
t_btn+= "<button type=\"button\" class=\"btn-gray\" onclick=\"risShow('" + obj.masterId +"');\">RIS</button>";
|
||||
|
||||
|
||||
@ -31,6 +31,7 @@
|
||||
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
|
||||
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
|
||||
<%@ taglib prefix="validator" uri="http://www.springmodules.org/tags/commons-validator" %>
|
||||
<script src="/js/qrcode.js"></script>
|
||||
|
||||
<c:set var="pageTitle">자료 상세</c:set>
|
||||
|
||||
@ -88,12 +89,21 @@
|
||||
</div>
|
||||
<div class="right">
|
||||
<div class="con-1">
|
||||
<c:if test="${(!empty result.openDivCd) && (result.openDivCd ne '3') && (!empty result.interfaceId)}">
|
||||
<%-- <c:if test="${(!empty result.openDivCd) && (result.openDivCd ne '3') && (!empty result.interfaceId)}">
|
||||
<button type="button" class="view" onclick="docView('<c:out value="${result.interfaceId}"/>')";>원문보기</button>
|
||||
</c:if>
|
||||
</c:if> --%>
|
||||
<button type="button" class="view" onclick="docView('${pdfUri}','3568')";>원문보기</button>
|
||||
<button type="button" class="ris" onclick="risShow('<c:out value="${result.masterId}"/>')";>RIS</button>
|
||||
<button type="button" class="favorit">즐겨찾기</button>
|
||||
<button type="button" class="share">공유</button>
|
||||
<c:if test='${result.MUseYn == "Y"}'>
|
||||
<button type="button" class="favorit" onclick="fn_changeInterestBtn('${result.masterId }', 'off');">즐겨찾기</button>
|
||||
</c:if>
|
||||
<c:if test='${result.MUseYn != "Y"}'>
|
||||
<button type="button" class="favorit" onclick="fn_changeInterestBtn('${result.masterId }', 'on');">즐겨찾기</button>
|
||||
</c:if>
|
||||
<%-- <c:if test="${(!empty result.openDivCd) && (result.openDivCd ne '3') && (!empty result.interfaceId)}">
|
||||
<button type="button" class="share" data-curl="${pdfUri}<c:out value="${result.interfaceId}"/>">공유</button>
|
||||
</c:if> --%>
|
||||
<button type="button" class="share" data-cUrl="${pdfUri}3568">공유</button>
|
||||
</div>
|
||||
<div class="con-2">
|
||||
<div class="de-data">
|
||||
@ -104,7 +114,7 @@
|
||||
</li>
|
||||
<li>
|
||||
<span>연대</span>
|
||||
<span><c:out value="${result.chronologicalCodeStartNm}"/>년부터 <c:out value="${result.chronologicalCodeEndNm}"/>까지</span>
|
||||
<span><c:if test = "${result.chronologicalCodeStartNm ne '해당없음'}"><c:out value="${result.chronologicalCodeStartNm}"/>년부터 <c:out value="${result.chronologicalCodeEndNm}"/>까지</c:if></span>
|
||||
</li>
|
||||
<li>
|
||||
<span>주제분야</span>
|
||||
@ -155,11 +165,7 @@
|
||||
</div>
|
||||
<div class="keyword">
|
||||
<span class="first">키워드</span>
|
||||
<span><c:out value="${result.keyword}"/>1</span>
|
||||
<span>경주</span>
|
||||
<span>문화인</span>
|
||||
<span>인물</span>
|
||||
<span>석불</span>
|
||||
<span><c:out value="${result.keyword}"/></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -519,10 +525,10 @@
|
||||
<p>자료를 <strong>SNS</strong>에 공유해보세요.</p>
|
||||
<button class="btn-close-pop">닫기</button>
|
||||
<ul class="sns-list">
|
||||
<li class="kstory-icon"><img src="/images/icon/icon-sharing-kstory-big.svg" alt="카카오스토리 공유하기" class="sns-pop" /><p>카카오스토리</p></li>
|
||||
<li class="nblog-icon"><img src="/images/icon/icon-sharing-nblog-big.svg" alt="네이버블로그 공유하기" class="sns-pop" /><p>블로그</p></li>
|
||||
<li class="fb-icon"><img src="/images/icon/icon-sharing-fb-big.svg" alt="페이스북 공유하기" class="sns-pop" /><p>페이스북</p></li>
|
||||
<li class="tw-icon"><img src="/images/icon/icon-sharing-tw-big.svg" alt="트위터 공유하기" class="sns-pop" /><p>트위터</p></li>
|
||||
<li class="kstory-icon"><img src="/images/icon/icon-sharing-kstory-big.svg" data-sType="4" alt="카카오스토리 공유하기" class="sns-pop" /><p>카카오스토리</p></li>
|
||||
<li class="nblog-icon"><img src="/images/icon/icon-sharing-nblog-big.svg" data-sType="3" alt="네이버블로그 공유하기" class="sns-pop" /><p>블로그</p></li>
|
||||
<li class="fb-icon"><img src="/images/icon/icon-sharing-fb-big.svg" data-sType="1" alt="페이스북 공유하기" class="sns-pop" /><p>페이스북</p></li>
|
||||
<li class="tw-icon"><img src="/images/icon/icon-sharing-tw-big.svg" data-sType="2" alt="트위터 공유하기" class="sns-pop" /><p>트위터</p></li>
|
||||
</ul>
|
||||
<div class="link-copy">
|
||||
<input type="text" class="link-txt" id="p_link-copy" value="http://www.nculture.org"/>
|
||||
@ -538,40 +544,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="pop-serge" style="display:none;">
|
||||
<div class="row Title">
|
||||
<h3>서지정보 내보내기<span>(Export)</span></h3>
|
||||
</div>
|
||||
<div class="inner">
|
||||
<div class="row Text">
|
||||
<div class="con-1">
|
||||
<p>서지정보 내보내기 안내</p>
|
||||
<div class="text-box">
|
||||
<p>소장자료관은 콘텐츠 생산자 및 연구자들을 위해 서지정보 내보내기 기능을 제공하고 있습니다.</p>
|
||||
<p><span>서지정보 내용</span><br>형식, 제목, 저자, 시리즈, 언어, URL, 태그</p>
|
||||
<p><span>제공 포맷</span><br>RIS : Search Information System (*.ris)</p>
|
||||
<p><span>RIS 지원 서지관리 프로그램</span><br>EndNote, Mendeley, Zotero) 외</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="con-2">
|
||||
<p>서지관리 프로그램 안내</p>
|
||||
<div class="text-box">
|
||||
<p>서지관리 프로그램은 문헌 및 온라인 콘텐츠 등 자료를 관리하고 공유하는데 사용됩니다.</p>
|
||||
<p>- 해당 프로그램은 소속기관 또는 개인 가입이 필요할 수 있으며, 소장자료관은 링크만 제공하고 직접 서비스를 제공하지 않습니다.</p>
|
||||
<p><span>Zotero (www.zotero.com) / 한글 메뉴 지원 (o), 300MB 용량 무료 (초과 유료)</span></p>
|
||||
<p><span>EndNote (www.endnote.com) / 한글 메뉴 지원 (x) , 2G 용량 무료 (초과유료)</span></p>
|
||||
<p><span>Mendeley (www.mendeley.com) / 한글 메뉴 지원 (x), 2G 용량 무료 (초과유료)</span></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row btn-box">
|
||||
<button type="button" class="btn btn-color">내보내기</button>
|
||||
<button type="submit" class="btn btn-gray">닫기</button>
|
||||
</div>
|
||||
<button type="button" class="serge-close"></button>
|
||||
</div>
|
||||
<div class="Bg"></div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
/* 함께 볼만한자료 슬라이드 */
|
||||
|
||||
@ -388,8 +388,8 @@ function fn_search_article(pageIndex) {
|
||||
</c:if>
|
||||
|
||||
</div>
|
||||
<div class="title"><a href="#"><c:out value="${result.title}"/></a></div>
|
||||
<div class="code">${result.mngtNo}</div>
|
||||
<div class="title"><a href="javascript:void(0)" onclick="goDetail('${result.masterId}');"><c:out value="${result.title}"/></a></div>
|
||||
<div class="code"><c:out value="${result.mngtNo}"/></div>
|
||||
<div class="subject">
|
||||
<c:if test="${!empty result.typeCodeNm}">
|
||||
<span>자료유형 : ${result.typeCodeNm} > ${result.dtlsTypeDivNm}</span>
|
||||
@ -417,7 +417,7 @@ function fn_search_article(pageIndex) {
|
||||
</c:otherwise>
|
||||
</c:choose>
|
||||
<c:if test="${(!empty result.openDivCd) && (result.openDivCd ne '3') && (!empty result.interfaceId)}">
|
||||
<button type="button" class="btn-color" onclick="docView('${result.interfaceId}')";>원문보기</button>
|
||||
<button type="button" class="btn-color" onclick="docView('${pdfUri }','${result.interfaceId}')";>원문보기</button>
|
||||
</c:if>
|
||||
<button type="button" class="btn-gray" onclick="risShow('${result.masterId}')";>RIS</button>
|
||||
</div>
|
||||
|
||||
@ -393,3 +393,15 @@ function docView(interfaceId){
|
||||
var openNewWindow = window.open("about:blank");
|
||||
openNewWindow.location.href = "https://port-dev.nculture.org/npdfView.do?npdf=I"+interfaceId;
|
||||
}
|
||||
|
||||
function gfn_openNewWindow(rul) {
|
||||
var win = window.open(rul, "_blank");
|
||||
}
|
||||
|
||||
function gfn_gotoUrl(url) {
|
||||
location.href = url;
|
||||
}
|
||||
|
||||
function gfn_getDetail(masterId) {
|
||||
gfn_openNewWindow("/search/searchItemDetail.do?masterId=" + masterId);
|
||||
}
|
||||
|
||||
614
src/main/webapp/js/qrcode.js
Normal file
614
src/main/webapp/js/qrcode.js
Normal file
@ -0,0 +1,614 @@
|
||||
/**
|
||||
* @fileoverview
|
||||
* - Using the 'QRCode for Javascript library'
|
||||
* - Fixed dataset of 'QRCode for Javascript library' for support full-spec.
|
||||
* - this library has no dependencies.
|
||||
*
|
||||
* @author davidshimjs
|
||||
* @see <a href="http://www.d-project.com/" target="_blank">http://www.d-project.com/</a>
|
||||
* @see <a href="http://jeromeetienne.github.com/jquery-qrcode/" target="_blank">http://jeromeetienne.github.com/jquery-qrcode/</a>
|
||||
*/
|
||||
var QRCode;
|
||||
|
||||
(function () {
|
||||
//---------------------------------------------------------------------
|
||||
// QRCode for JavaScript
|
||||
//
|
||||
// Copyright (c) 2009 Kazuhiko Arase
|
||||
//
|
||||
// URL: http://www.d-project.com/
|
||||
//
|
||||
// Licensed under the MIT license:
|
||||
// http://www.opensource.org/licenses/mit-license.php
|
||||
//
|
||||
// The word "QR Code" is registered trademark of
|
||||
// DENSO WAVE INCORPORATED
|
||||
// http://www.denso-wave.com/qrcode/faqpatent-e.html
|
||||
//
|
||||
//---------------------------------------------------------------------
|
||||
function QR8bitByte(data) {
|
||||
this.mode = QRMode.MODE_8BIT_BYTE;
|
||||
this.data = data;
|
||||
this.parsedData = [];
|
||||
|
||||
// Added to support UTF-8 Characters
|
||||
for (var i = 0, l = this.data.length; i < l; i++) {
|
||||
var byteArray = [];
|
||||
var code = this.data.charCodeAt(i);
|
||||
|
||||
if (code > 0x10000) {
|
||||
byteArray[0] = 0xF0 | ((code & 0x1C0000) >>> 18);
|
||||
byteArray[1] = 0x80 | ((code & 0x3F000) >>> 12);
|
||||
byteArray[2] = 0x80 | ((code & 0xFC0) >>> 6);
|
||||
byteArray[3] = 0x80 | (code & 0x3F);
|
||||
} else if (code > 0x800) {
|
||||
byteArray[0] = 0xE0 | ((code & 0xF000) >>> 12);
|
||||
byteArray[1] = 0x80 | ((code & 0xFC0) >>> 6);
|
||||
byteArray[2] = 0x80 | (code & 0x3F);
|
||||
} else if (code > 0x80) {
|
||||
byteArray[0] = 0xC0 | ((code & 0x7C0) >>> 6);
|
||||
byteArray[1] = 0x80 | (code & 0x3F);
|
||||
} else {
|
||||
byteArray[0] = code;
|
||||
}
|
||||
|
||||
this.parsedData.push(byteArray);
|
||||
}
|
||||
|
||||
this.parsedData = Array.prototype.concat.apply([], this.parsedData);
|
||||
|
||||
if (this.parsedData.length != this.data.length) {
|
||||
this.parsedData.unshift(191);
|
||||
this.parsedData.unshift(187);
|
||||
this.parsedData.unshift(239);
|
||||
}
|
||||
}
|
||||
|
||||
QR8bitByte.prototype = {
|
||||
getLength: function (buffer) {
|
||||
return this.parsedData.length;
|
||||
},
|
||||
write: function (buffer) {
|
||||
for (var i = 0, l = this.parsedData.length; i < l; i++) {
|
||||
buffer.put(this.parsedData[i], 8);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function QRCodeModel(typeNumber, errorCorrectLevel) {
|
||||
this.typeNumber = typeNumber;
|
||||
this.errorCorrectLevel = errorCorrectLevel;
|
||||
this.modules = null;
|
||||
this.moduleCount = 0;
|
||||
this.dataCache = null;
|
||||
this.dataList = [];
|
||||
}
|
||||
|
||||
QRCodeModel.prototype={addData:function(data){var newData=new QR8bitByte(data);this.dataList.push(newData);this.dataCache=null;},isDark:function(row,col){if(row<0||this.moduleCount<=row||col<0||this.moduleCount<=col){throw new Error(row+","+col);}
|
||||
return this.modules[row][col];},getModuleCount:function(){return this.moduleCount;},make:function(){this.makeImpl(false,this.getBestMaskPattern());},makeImpl:function(test,maskPattern){this.moduleCount=this.typeNumber*4+17;this.modules=new Array(this.moduleCount);for(var row=0;row<this.moduleCount;row++){this.modules[row]=new Array(this.moduleCount);for(var col=0;col<this.moduleCount;col++){this.modules[row][col]=null;}}
|
||||
this.setupPositionProbePattern(0,0);this.setupPositionProbePattern(this.moduleCount-7,0);this.setupPositionProbePattern(0,this.moduleCount-7);this.setupPositionAdjustPattern();this.setupTimingPattern();this.setupTypeInfo(test,maskPattern);if(this.typeNumber>=7){this.setupTypeNumber(test);}
|
||||
if(this.dataCache==null){this.dataCache=QRCodeModel.createData(this.typeNumber,this.errorCorrectLevel,this.dataList);}
|
||||
this.mapData(this.dataCache,maskPattern);},setupPositionProbePattern:function(row,col){for(var r=-1;r<=7;r++){if(row+r<=-1||this.moduleCount<=row+r)continue;for(var c=-1;c<=7;c++){if(col+c<=-1||this.moduleCount<=col+c)continue;if((0<=r&&r<=6&&(c==0||c==6))||(0<=c&&c<=6&&(r==0||r==6))||(2<=r&&r<=4&&2<=c&&c<=4)){this.modules[row+r][col+c]=true;}else{this.modules[row+r][col+c]=false;}}}},getBestMaskPattern:function(){var minLostPoint=0;var pattern=0;for(var i=0;i<8;i++){this.makeImpl(true,i);var lostPoint=QRUtil.getLostPoint(this);if(i==0||minLostPoint>lostPoint){minLostPoint=lostPoint;pattern=i;}}
|
||||
return pattern;},createMovieClip:function(target_mc,instance_name,depth){var qr_mc=target_mc.createEmptyMovieClip(instance_name,depth);var cs=1;this.make();for(var row=0;row<this.modules.length;row++){var y=row*cs;for(var col=0;col<this.modules[row].length;col++){var x=col*cs;var dark=this.modules[row][col];if(dark){qr_mc.beginFill(0,100);qr_mc.moveTo(x,y);qr_mc.lineTo(x+cs,y);qr_mc.lineTo(x+cs,y+cs);qr_mc.lineTo(x,y+cs);qr_mc.endFill();}}}
|
||||
return qr_mc;},setupTimingPattern:function(){for(var r=8;r<this.moduleCount-8;r++){if(this.modules[r][6]!=null){continue;}
|
||||
this.modules[r][6]=(r%2==0);}
|
||||
for(var c=8;c<this.moduleCount-8;c++){if(this.modules[6][c]!=null){continue;}
|
||||
this.modules[6][c]=(c%2==0);}},setupPositionAdjustPattern:function(){var pos=QRUtil.getPatternPosition(this.typeNumber);for(var i=0;i<pos.length;i++){for(var j=0;j<pos.length;j++){var row=pos[i];var col=pos[j];if(this.modules[row][col]!=null){continue;}
|
||||
for(var r=-2;r<=2;r++){for(var c=-2;c<=2;c++){if(r==-2||r==2||c==-2||c==2||(r==0&&c==0)){this.modules[row+r][col+c]=true;}else{this.modules[row+r][col+c]=false;}}}}}},setupTypeNumber:function(test){var bits=QRUtil.getBCHTypeNumber(this.typeNumber);for(var i=0;i<18;i++){var mod=(!test&&((bits>>i)&1)==1);this.modules[Math.floor(i/3)][i%3+this.moduleCount-8-3]=mod;}
|
||||
for(var i=0;i<18;i++){var mod=(!test&&((bits>>i)&1)==1);this.modules[i%3+this.moduleCount-8-3][Math.floor(i/3)]=mod;}},setupTypeInfo:function(test,maskPattern){var data=(this.errorCorrectLevel<<3)|maskPattern;var bits=QRUtil.getBCHTypeInfo(data);for(var i=0;i<15;i++){var mod=(!test&&((bits>>i)&1)==1);if(i<6){this.modules[i][8]=mod;}else if(i<8){this.modules[i+1][8]=mod;}else{this.modules[this.moduleCount-15+i][8]=mod;}}
|
||||
for(var i=0;i<15;i++){var mod=(!test&&((bits>>i)&1)==1);if(i<8){this.modules[8][this.moduleCount-i-1]=mod;}else if(i<9){this.modules[8][15-i-1+1]=mod;}else{this.modules[8][15-i-1]=mod;}}
|
||||
this.modules[this.moduleCount-8][8]=(!test);},mapData:function(data,maskPattern){var inc=-1;var row=this.moduleCount-1;var bitIndex=7;var byteIndex=0;for(var col=this.moduleCount-1;col>0;col-=2){if(col==6)col--;while(true){for(var c=0;c<2;c++){if(this.modules[row][col-c]==null){var dark=false;if(byteIndex<data.length){dark=(((data[byteIndex]>>>bitIndex)&1)==1);}
|
||||
var mask=QRUtil.getMask(maskPattern,row,col-c);if(mask){dark=!dark;}
|
||||
this.modules[row][col-c]=dark;bitIndex--;if(bitIndex==-1){byteIndex++;bitIndex=7;}}}
|
||||
row+=inc;if(row<0||this.moduleCount<=row){row-=inc;inc=-inc;break;}}}}};QRCodeModel.PAD0=0xEC;QRCodeModel.PAD1=0x11;QRCodeModel.createData=function(typeNumber,errorCorrectLevel,dataList){var rsBlocks=QRRSBlock.getRSBlocks(typeNumber,errorCorrectLevel);var buffer=new QRBitBuffer();for(var i=0;i<dataList.length;i++){var data=dataList[i];buffer.put(data.mode,4);buffer.put(data.getLength(),QRUtil.getLengthInBits(data.mode,typeNumber));data.write(buffer);}
|
||||
var totalDataCount=0;for(var i=0;i<rsBlocks.length;i++){totalDataCount+=rsBlocks[i].dataCount;}
|
||||
if(buffer.getLengthInBits()>totalDataCount*8){throw new Error("code length overflow. ("
|
||||
+buffer.getLengthInBits()
|
||||
+">"
|
||||
+totalDataCount*8
|
||||
+")");}
|
||||
if(buffer.getLengthInBits()+4<=totalDataCount*8){buffer.put(0,4);}
|
||||
while(buffer.getLengthInBits()%8!=0){buffer.putBit(false);}
|
||||
while(true){if(buffer.getLengthInBits()>=totalDataCount*8){break;}
|
||||
buffer.put(QRCodeModel.PAD0,8);if(buffer.getLengthInBits()>=totalDataCount*8){break;}
|
||||
buffer.put(QRCodeModel.PAD1,8);}
|
||||
return QRCodeModel.createBytes(buffer,rsBlocks);};QRCodeModel.createBytes=function(buffer,rsBlocks){var offset=0;var maxDcCount=0;var maxEcCount=0;var dcdata=new Array(rsBlocks.length);var ecdata=new Array(rsBlocks.length);for(var r=0;r<rsBlocks.length;r++){var dcCount=rsBlocks[r].dataCount;var ecCount=rsBlocks[r].totalCount-dcCount;maxDcCount=Math.max(maxDcCount,dcCount);maxEcCount=Math.max(maxEcCount,ecCount);dcdata[r]=new Array(dcCount);for(var i=0;i<dcdata[r].length;i++){dcdata[r][i]=0xff&buffer.buffer[i+offset];}
|
||||
offset+=dcCount;var rsPoly=QRUtil.getErrorCorrectPolynomial(ecCount);var rawPoly=new QRPolynomial(dcdata[r],rsPoly.getLength()-1);var modPoly=rawPoly.mod(rsPoly);ecdata[r]=new Array(rsPoly.getLength()-1);for(var i=0;i<ecdata[r].length;i++){var modIndex=i+modPoly.getLength()-ecdata[r].length;ecdata[r][i]=(modIndex>=0)?modPoly.get(modIndex):0;}}
|
||||
var totalCodeCount=0;for(var i=0;i<rsBlocks.length;i++){totalCodeCount+=rsBlocks[i].totalCount;}
|
||||
var data=new Array(totalCodeCount);var index=0;for(var i=0;i<maxDcCount;i++){for(var r=0;r<rsBlocks.length;r++){if(i<dcdata[r].length){data[index++]=dcdata[r][i];}}}
|
||||
for(var i=0;i<maxEcCount;i++){for(var r=0;r<rsBlocks.length;r++){if(i<ecdata[r].length){data[index++]=ecdata[r][i];}}}
|
||||
return data;};var QRMode={MODE_NUMBER:1<<0,MODE_ALPHA_NUM:1<<1,MODE_8BIT_BYTE:1<<2,MODE_KANJI:1<<3};var QRErrorCorrectLevel={L:1,M:0,Q:3,H:2};var QRMaskPattern={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var QRUtil={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:(1<<10)|(1<<8)|(1<<5)|(1<<4)|(1<<2)|(1<<1)|(1<<0),G18:(1<<12)|(1<<11)|(1<<10)|(1<<9)|(1<<8)|(1<<5)|(1<<2)|(1<<0),G15_MASK:(1<<14)|(1<<12)|(1<<10)|(1<<4)|(1<<1),getBCHTypeInfo:function(data){var d=data<<10;while(QRUtil.getBCHDigit(d)-QRUtil.getBCHDigit(QRUtil.G15)>=0){d^=(QRUtil.G15<<(QRUtil.getBCHDigit(d)-QRUtil.getBCHDigit(QRUtil.G15)));}
|
||||
return((data<<10)|d)^QRUtil.G15_MASK;},getBCHTypeNumber:function(data){var d=data<<12;while(QRUtil.getBCHDigit(d)-QRUtil.getBCHDigit(QRUtil.G18)>=0){d^=(QRUtil.G18<<(QRUtil.getBCHDigit(d)-QRUtil.getBCHDigit(QRUtil.G18)));}
|
||||
return(data<<12)|d;},getBCHDigit:function(data){var digit=0;while(data!=0){digit++;data>>>=1;}
|
||||
return digit;},getPatternPosition:function(typeNumber){return QRUtil.PATTERN_POSITION_TABLE[typeNumber-1];},getMask:function(maskPattern,i,j){switch(maskPattern){case QRMaskPattern.PATTERN000:return(i+j)%2==0;case QRMaskPattern.PATTERN001:return i%2==0;case QRMaskPattern.PATTERN010:return j%3==0;case QRMaskPattern.PATTERN011:return(i+j)%3==0;case QRMaskPattern.PATTERN100:return(Math.floor(i/2)+Math.floor(j/3))%2==0;case QRMaskPattern.PATTERN101:return(i*j)%2+(i*j)%3==0;case QRMaskPattern.PATTERN110:return((i*j)%2+(i*j)%3)%2==0;case QRMaskPattern.PATTERN111:return((i*j)%3+(i+j)%2)%2==0;default:throw new Error("bad maskPattern:"+maskPattern);}},getErrorCorrectPolynomial:function(errorCorrectLength){var a=new QRPolynomial([1],0);for(var i=0;i<errorCorrectLength;i++){a=a.multiply(new QRPolynomial([1,QRMath.gexp(i)],0));}
|
||||
return a;},getLengthInBits:function(mode,type){if(1<=type&&type<10){switch(mode){case QRMode.MODE_NUMBER:return 10;case QRMode.MODE_ALPHA_NUM:return 9;case QRMode.MODE_8BIT_BYTE:return 8;case QRMode.MODE_KANJI:return 8;default:throw new Error("mode:"+mode);}}else if(type<27){switch(mode){case QRMode.MODE_NUMBER:return 12;case QRMode.MODE_ALPHA_NUM:return 11;case QRMode.MODE_8BIT_BYTE:return 16;case QRMode.MODE_KANJI:return 10;default:throw new Error("mode:"+mode);}}else if(type<41){switch(mode){case QRMode.MODE_NUMBER:return 14;case QRMode.MODE_ALPHA_NUM:return 13;case QRMode.MODE_8BIT_BYTE:return 16;case QRMode.MODE_KANJI:return 12;default:throw new Error("mode:"+mode);}}else{throw new Error("type:"+type);}},getLostPoint:function(qrCode){var moduleCount=qrCode.getModuleCount();var lostPoint=0;for(var row=0;row<moduleCount;row++){for(var col=0;col<moduleCount;col++){var sameCount=0;var dark=qrCode.isDark(row,col);for(var r=-1;r<=1;r++){if(row+r<0||moduleCount<=row+r){continue;}
|
||||
for(var c=-1;c<=1;c++){if(col+c<0||moduleCount<=col+c){continue;}
|
||||
if(r==0&&c==0){continue;}
|
||||
if(dark==qrCode.isDark(row+r,col+c)){sameCount++;}}}
|
||||
if(sameCount>5){lostPoint+=(3+sameCount-5);}}}
|
||||
for(var row=0;row<moduleCount-1;row++){for(var col=0;col<moduleCount-1;col++){var count=0;if(qrCode.isDark(row,col))count++;if(qrCode.isDark(row+1,col))count++;if(qrCode.isDark(row,col+1))count++;if(qrCode.isDark(row+1,col+1))count++;if(count==0||count==4){lostPoint+=3;}}}
|
||||
for(var row=0;row<moduleCount;row++){for(var col=0;col<moduleCount-6;col++){if(qrCode.isDark(row,col)&&!qrCode.isDark(row,col+1)&&qrCode.isDark(row,col+2)&&qrCode.isDark(row,col+3)&&qrCode.isDark(row,col+4)&&!qrCode.isDark(row,col+5)&&qrCode.isDark(row,col+6)){lostPoint+=40;}}}
|
||||
for(var col=0;col<moduleCount;col++){for(var row=0;row<moduleCount-6;row++){if(qrCode.isDark(row,col)&&!qrCode.isDark(row+1,col)&&qrCode.isDark(row+2,col)&&qrCode.isDark(row+3,col)&&qrCode.isDark(row+4,col)&&!qrCode.isDark(row+5,col)&&qrCode.isDark(row+6,col)){lostPoint+=40;}}}
|
||||
var darkCount=0;for(var col=0;col<moduleCount;col++){for(var row=0;row<moduleCount;row++){if(qrCode.isDark(row,col)){darkCount++;}}}
|
||||
var ratio=Math.abs(100*darkCount/moduleCount/moduleCount-50)/5;lostPoint+=ratio*10;return lostPoint;}};var QRMath={glog:function(n){if(n<1){throw new Error("glog("+n+")");}
|
||||
return QRMath.LOG_TABLE[n];},gexp:function(n){while(n<0){n+=255;}
|
||||
while(n>=256){n-=255;}
|
||||
return QRMath.EXP_TABLE[n];},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)};for(var i=0;i<8;i++){QRMath.EXP_TABLE[i]=1<<i;}
|
||||
for(var i=8;i<256;i++){QRMath.EXP_TABLE[i]=QRMath.EXP_TABLE[i-4]^QRMath.EXP_TABLE[i-5]^QRMath.EXP_TABLE[i-6]^QRMath.EXP_TABLE[i-8];}
|
||||
for(var i=0;i<255;i++){QRMath.LOG_TABLE[QRMath.EXP_TABLE[i]]=i;}
|
||||
function QRPolynomial(num,shift){if(num.length==undefined){throw new Error(num.length+"/"+shift);}
|
||||
var offset=0;while(offset<num.length&&num[offset]==0){offset++;}
|
||||
this.num=new Array(num.length-offset+shift);for(var i=0;i<num.length-offset;i++){this.num[i]=num[i+offset];}}
|
||||
QRPolynomial.prototype={get:function(index){return this.num[index];},getLength:function(){return this.num.length;},multiply:function(e){var num=new Array(this.getLength()+e.getLength()-1);for(var i=0;i<this.getLength();i++){for(var j=0;j<e.getLength();j++){num[i+j]^=QRMath.gexp(QRMath.glog(this.get(i))+QRMath.glog(e.get(j)));}}
|
||||
return new QRPolynomial(num,0);},mod:function(e){if(this.getLength()-e.getLength()<0){return this;}
|
||||
var ratio=QRMath.glog(this.get(0))-QRMath.glog(e.get(0));var num=new Array(this.getLength());for(var i=0;i<this.getLength();i++){num[i]=this.get(i);}
|
||||
for(var i=0;i<e.getLength();i++){num[i]^=QRMath.gexp(QRMath.glog(e.get(i))+ratio);}
|
||||
return new QRPolynomial(num,0).mod(e);}};function QRRSBlock(totalCount,dataCount){this.totalCount=totalCount;this.dataCount=dataCount;}
|
||||
QRRSBlock.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]];QRRSBlock.getRSBlocks=function(typeNumber,errorCorrectLevel){var rsBlock=QRRSBlock.getRsBlockTable(typeNumber,errorCorrectLevel);if(rsBlock==undefined){throw new Error("bad rs block @ typeNumber:"+typeNumber+"/errorCorrectLevel:"+errorCorrectLevel);}
|
||||
var length=rsBlock.length/3;var list=[];for(var i=0;i<length;i++){var count=rsBlock[i*3+0];var totalCount=rsBlock[i*3+1];var dataCount=rsBlock[i*3+2];for(var j=0;j<count;j++){list.push(new QRRSBlock(totalCount,dataCount));}}
|
||||
return list;};QRRSBlock.getRsBlockTable=function(typeNumber,errorCorrectLevel){switch(errorCorrectLevel){case QRErrorCorrectLevel.L:return QRRSBlock.RS_BLOCK_TABLE[(typeNumber-1)*4+0];case QRErrorCorrectLevel.M:return QRRSBlock.RS_BLOCK_TABLE[(typeNumber-1)*4+1];case QRErrorCorrectLevel.Q:return QRRSBlock.RS_BLOCK_TABLE[(typeNumber-1)*4+2];case QRErrorCorrectLevel.H:return QRRSBlock.RS_BLOCK_TABLE[(typeNumber-1)*4+3];default:return undefined;}};function QRBitBuffer(){this.buffer=[];this.length=0;}
|
||||
QRBitBuffer.prototype={get:function(index){var bufIndex=Math.floor(index/8);return((this.buffer[bufIndex]>>>(7-index%8))&1)==1;},put:function(num,length){for(var i=0;i<length;i++){this.putBit(((num>>>(length-i-1))&1)==1);}},getLengthInBits:function(){return this.length;},putBit:function(bit){var bufIndex=Math.floor(this.length/8);if(this.buffer.length<=bufIndex){this.buffer.push(0);}
|
||||
if(bit){this.buffer[bufIndex]|=(0x80>>>(this.length%8));}
|
||||
this.length++;}};var QRCodeLimitLength=[[17,14,11,7],[32,26,20,14],[53,42,32,24],[78,62,46,34],[106,84,60,44],[134,106,74,58],[154,122,86,64],[192,152,108,84],[230,180,130,98],[271,213,151,119],[321,251,177,137],[367,287,203,155],[425,331,241,177],[458,362,258,194],[520,412,292,220],[586,450,322,250],[644,504,364,280],[718,560,394,310],[792,624,442,338],[858,666,482,382],[929,711,509,403],[1003,779,565,439],[1091,857,611,461],[1171,911,661,511],[1273,997,715,535],[1367,1059,751,593],[1465,1125,805,625],[1528,1190,868,658],[1628,1264,908,698],[1732,1370,982,742],[1840,1452,1030,790],[1952,1538,1112,842],[2068,1628,1168,898],[2188,1722,1228,958],[2303,1809,1283,983],[2431,1911,1351,1051],[2563,1989,1423,1093],[2699,2099,1499,1139],[2809,2213,1579,1219],[2953,2331,1663,1273]];
|
||||
|
||||
function _isSupportCanvas() {
|
||||
return typeof CanvasRenderingContext2D != "undefined";
|
||||
}
|
||||
|
||||
// android 2.x doesn't support Data-URI spec
|
||||
function _getAndroid() {
|
||||
var android = false;
|
||||
var sAgent = navigator.userAgent;
|
||||
|
||||
if (/android/i.test(sAgent)) { // android
|
||||
android = true;
|
||||
var aMat = sAgent.toString().match(/android ([0-9]\.[0-9])/i);
|
||||
|
||||
if (aMat && aMat[1]) {
|
||||
android = parseFloat(aMat[1]);
|
||||
}
|
||||
}
|
||||
|
||||
return android;
|
||||
}
|
||||
|
||||
var svgDrawer = (function() {
|
||||
|
||||
var Drawing = function (el, htOption) {
|
||||
this._el = el;
|
||||
this._htOption = htOption;
|
||||
};
|
||||
|
||||
Drawing.prototype.draw = function (oQRCode) {
|
||||
var _htOption = this._htOption;
|
||||
var _el = this._el;
|
||||
var nCount = oQRCode.getModuleCount();
|
||||
var nWidth = Math.floor(_htOption.width / nCount);
|
||||
var nHeight = Math.floor(_htOption.height / nCount);
|
||||
|
||||
this.clear();
|
||||
|
||||
function makeSVG(tag, attrs) {
|
||||
var el = document.createElementNS('http://www.w3.org/2000/svg', tag);
|
||||
for (var k in attrs)
|
||||
if (attrs.hasOwnProperty(k)) el.setAttribute(k, attrs[k]);
|
||||
return el;
|
||||
}
|
||||
|
||||
var svg = makeSVG("svg" , {'viewBox': '0 0 ' + String(nCount) + " " + String(nCount), 'width': '100%', 'height': '100%', 'fill': _htOption.colorLight});
|
||||
svg.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:xlink", "http://www.w3.org/1999/xlink");
|
||||
_el.appendChild(svg);
|
||||
|
||||
svg.appendChild(makeSVG("rect", {"fill": _htOption.colorLight, "width": "100%", "height": "100%"}));
|
||||
svg.appendChild(makeSVG("rect", {"fill": _htOption.colorDark, "width": "1", "height": "1", "id": "template"}));
|
||||
|
||||
for (var row = 0; row < nCount; row++) {
|
||||
for (var col = 0; col < nCount; col++) {
|
||||
if (oQRCode.isDark(row, col)) {
|
||||
var child = makeSVG("use", {"x": String(col), "y": String(row)});
|
||||
child.setAttributeNS("http://www.w3.org/1999/xlink", "href", "#template")
|
||||
svg.appendChild(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
Drawing.prototype.clear = function () {
|
||||
while (this._el.hasChildNodes())
|
||||
this._el.removeChild(this._el.lastChild);
|
||||
};
|
||||
return Drawing;
|
||||
})();
|
||||
|
||||
var useSVG = document.documentElement.tagName.toLowerCase() === "svg";
|
||||
|
||||
// Drawing in DOM by using Table tag
|
||||
var Drawing = useSVG ? svgDrawer : !_isSupportCanvas() ? (function () {
|
||||
var Drawing = function (el, htOption) {
|
||||
this._el = el;
|
||||
this._htOption = htOption;
|
||||
};
|
||||
|
||||
/**
|
||||
* Draw the QRCode
|
||||
*
|
||||
* @param {QRCode} oQRCode
|
||||
*/
|
||||
Drawing.prototype.draw = function (oQRCode) {
|
||||
var _htOption = this._htOption;
|
||||
var _el = this._el;
|
||||
var nCount = oQRCode.getModuleCount();
|
||||
var nWidth = Math.floor(_htOption.width / nCount);
|
||||
var nHeight = Math.floor(_htOption.height / nCount);
|
||||
var aHTML = ['<table style="border:0;border-collapse:collapse;">'];
|
||||
|
||||
for (var row = 0; row < nCount; row++) {
|
||||
aHTML.push('<tr>');
|
||||
|
||||
for (var col = 0; col < nCount; col++) {
|
||||
aHTML.push('<td style="border:0;border-collapse:collapse;padding:0;margin:0;width:' + nWidth + 'px;height:' + nHeight + 'px;background-color:' + (oQRCode.isDark(row, col) ? _htOption.colorDark : _htOption.colorLight) + ';"></td>');
|
||||
}
|
||||
|
||||
aHTML.push('</tr>');
|
||||
}
|
||||
|
||||
aHTML.push('</table>');
|
||||
_el.innerHTML = aHTML.join('');
|
||||
|
||||
// Fix the margin values as real size.
|
||||
var elTable = _el.childNodes[0];
|
||||
var nLeftMarginTable = (_htOption.width - elTable.offsetWidth) / 2;
|
||||
var nTopMarginTable = (_htOption.height - elTable.offsetHeight) / 2;
|
||||
|
||||
if (nLeftMarginTable > 0 && nTopMarginTable > 0) {
|
||||
elTable.style.margin = nTopMarginTable + "px " + nLeftMarginTable + "px";
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Clear the QRCode
|
||||
*/
|
||||
Drawing.prototype.clear = function () {
|
||||
this._el.innerHTML = '';
|
||||
};
|
||||
|
||||
return Drawing;
|
||||
})() : (function () { // Drawing in Canvas
|
||||
function _onMakeImage() {
|
||||
this._elImage.src = this._elCanvas.toDataURL("image/png");
|
||||
this._elImage.style.display = "block";
|
||||
this._elCanvas.style.display = "none";
|
||||
}
|
||||
|
||||
// Android 2.1 bug workaround
|
||||
// http://code.google.com/p/android/issues/detail?id=5141
|
||||
if (this._android && this._android <= 2.1) {
|
||||
var factor = 1 / window.devicePixelRatio;
|
||||
var drawImage = CanvasRenderingContext2D.prototype.drawImage;
|
||||
CanvasRenderingContext2D.prototype.drawImage = function (image, sx, sy, sw, sh, dx, dy, dw, dh) {
|
||||
if (("nodeName" in image) && /img/i.test(image.nodeName)) {
|
||||
for (var i = arguments.length - 1; i >= 1; i--) {
|
||||
arguments[i] = arguments[i] * factor;
|
||||
}
|
||||
} else if (typeof dw == "undefined") {
|
||||
arguments[1] *= factor;
|
||||
arguments[2] *= factor;
|
||||
arguments[3] *= factor;
|
||||
arguments[4] *= factor;
|
||||
}
|
||||
|
||||
drawImage.apply(this, arguments);
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether the user's browser supports Data URI or not
|
||||
*
|
||||
* @private
|
||||
* @param {Function} fSuccess Occurs if it supports Data URI
|
||||
* @param {Function} fFail Occurs if it doesn't support Data URI
|
||||
*/
|
||||
function _safeSetDataURI(fSuccess, fFail) {
|
||||
var self = this;
|
||||
self._fFail = fFail;
|
||||
self._fSuccess = fSuccess;
|
||||
|
||||
// Check it just once
|
||||
if (self._bSupportDataURI === null) {
|
||||
var el = document.createElement("img");
|
||||
var fOnError = function() {
|
||||
self._bSupportDataURI = false;
|
||||
|
||||
if (self._fFail) {
|
||||
self._fFail.call(self);
|
||||
}
|
||||
};
|
||||
var fOnSuccess = function() {
|
||||
self._bSupportDataURI = true;
|
||||
|
||||
if (self._fSuccess) {
|
||||
self._fSuccess.call(self);
|
||||
}
|
||||
};
|
||||
|
||||
el.onabort = fOnError;
|
||||
el.onerror = fOnError;
|
||||
el.onload = fOnSuccess;
|
||||
el.src = "data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=="; // the Image contains 1px data.
|
||||
return;
|
||||
} else if (self._bSupportDataURI === true && self._fSuccess) {
|
||||
self._fSuccess.call(self);
|
||||
} else if (self._bSupportDataURI === false && self._fFail) {
|
||||
self._fFail.call(self);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Drawing QRCode by using canvas
|
||||
*
|
||||
* @constructor
|
||||
* @param {HTMLElement} el
|
||||
* @param {Object} htOption QRCode Options
|
||||
*/
|
||||
var Drawing = function (el, htOption) {
|
||||
this._bIsPainted = false;
|
||||
this._android = _getAndroid();
|
||||
|
||||
this._htOption = htOption;
|
||||
this._elCanvas = document.createElement("canvas");
|
||||
this._elCanvas.width = htOption.width;
|
||||
this._elCanvas.height = htOption.height;
|
||||
el.appendChild(this._elCanvas);
|
||||
this._el = el;
|
||||
this._oContext = this._elCanvas.getContext("2d");
|
||||
this._bIsPainted = false;
|
||||
this._elImage = document.createElement("img");
|
||||
this._elImage.alt = "Scan me!";
|
||||
this._elImage.style.display = "none";
|
||||
this._el.appendChild(this._elImage);
|
||||
this._bSupportDataURI = null;
|
||||
};
|
||||
|
||||
/**
|
||||
* Draw the QRCode
|
||||
*
|
||||
* @param {QRCode} oQRCode
|
||||
*/
|
||||
Drawing.prototype.draw = function (oQRCode) {
|
||||
var _elImage = this._elImage;
|
||||
var _oContext = this._oContext;
|
||||
var _htOption = this._htOption;
|
||||
|
||||
var nCount = oQRCode.getModuleCount();
|
||||
var nWidth = _htOption.width / nCount;
|
||||
var nHeight = _htOption.height / nCount;
|
||||
var nRoundedWidth = Math.round(nWidth);
|
||||
var nRoundedHeight = Math.round(nHeight);
|
||||
|
||||
_elImage.style.display = "none";
|
||||
this.clear();
|
||||
|
||||
for (var row = 0; row < nCount; row++) {
|
||||
for (var col = 0; col < nCount; col++) {
|
||||
var bIsDark = oQRCode.isDark(row, col);
|
||||
var nLeft = col * nWidth;
|
||||
var nTop = row * nHeight;
|
||||
_oContext.strokeStyle = bIsDark ? _htOption.colorDark : _htOption.colorLight;
|
||||
_oContext.lineWidth = 1;
|
||||
_oContext.fillStyle = bIsDark ? _htOption.colorDark : _htOption.colorLight;
|
||||
_oContext.fillRect(nLeft, nTop, nWidth, nHeight);
|
||||
|
||||
// 안티 앨리어싱 방지 처리
|
||||
_oContext.strokeRect(
|
||||
Math.floor(nLeft) + 0.5,
|
||||
Math.floor(nTop) + 0.5,
|
||||
nRoundedWidth,
|
||||
nRoundedHeight
|
||||
);
|
||||
|
||||
_oContext.strokeRect(
|
||||
Math.ceil(nLeft) - 0.5,
|
||||
Math.ceil(nTop) - 0.5,
|
||||
nRoundedWidth,
|
||||
nRoundedHeight
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
this._bIsPainted = true;
|
||||
};
|
||||
|
||||
/**
|
||||
* Make the image from Canvas if the browser supports Data URI.
|
||||
*/
|
||||
Drawing.prototype.makeImage = function () {
|
||||
if (this._bIsPainted) {
|
||||
_safeSetDataURI.call(this, _onMakeImage);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Return whether the QRCode is painted or not
|
||||
*
|
||||
* @return {Boolean}
|
||||
*/
|
||||
Drawing.prototype.isPainted = function () {
|
||||
return this._bIsPainted;
|
||||
};
|
||||
|
||||
/**
|
||||
* Clear the QRCode
|
||||
*/
|
||||
Drawing.prototype.clear = function () {
|
||||
this._oContext.clearRect(0, 0, this._elCanvas.width, this._elCanvas.height);
|
||||
this._bIsPainted = false;
|
||||
};
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @param {Number} nNumber
|
||||
*/
|
||||
Drawing.prototype.round = function (nNumber) {
|
||||
if (!nNumber) {
|
||||
return nNumber;
|
||||
}
|
||||
|
||||
return Math.floor(nNumber * 1000) / 1000;
|
||||
};
|
||||
|
||||
return Drawing;
|
||||
})();
|
||||
|
||||
/**
|
||||
* Get the type by string length
|
||||
*
|
||||
* @private
|
||||
* @param {String} sText
|
||||
* @param {Number} nCorrectLevel
|
||||
* @return {Number} type
|
||||
*/
|
||||
function _getTypeNumber(sText, nCorrectLevel) {
|
||||
var nType = 1;
|
||||
var length = _getUTF8Length(sText);
|
||||
|
||||
for (var i = 0, len = QRCodeLimitLength.length; i <= len; i++) {
|
||||
var nLimit = 0;
|
||||
|
||||
switch (nCorrectLevel) {
|
||||
case QRErrorCorrectLevel.L :
|
||||
nLimit = QRCodeLimitLength[i][0];
|
||||
break;
|
||||
case QRErrorCorrectLevel.M :
|
||||
nLimit = QRCodeLimitLength[i][1];
|
||||
break;
|
||||
case QRErrorCorrectLevel.Q :
|
||||
nLimit = QRCodeLimitLength[i][2];
|
||||
break;
|
||||
case QRErrorCorrectLevel.H :
|
||||
nLimit = QRCodeLimitLength[i][3];
|
||||
break;
|
||||
}
|
||||
|
||||
if (length <= nLimit) {
|
||||
break;
|
||||
} else {
|
||||
nType++;
|
||||
}
|
||||
}
|
||||
|
||||
if (nType > QRCodeLimitLength.length) {
|
||||
throw new Error("Too long data");
|
||||
}
|
||||
|
||||
return nType;
|
||||
}
|
||||
|
||||
function _getUTF8Length(sText) {
|
||||
var replacedText = encodeURI(sText).toString().replace(/\%[0-9a-fA-F]{2}/g, 'a');
|
||||
return replacedText.length + (replacedText.length != sText ? 3 : 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @class QRCode
|
||||
* @constructor
|
||||
* @example
|
||||
* new QRCode(document.getElementById("test"), "http://jindo.dev.naver.com/collie");
|
||||
*
|
||||
* @example
|
||||
* var oQRCode = new QRCode("test", {
|
||||
* text : "http://naver.com",
|
||||
* width : 128,
|
||||
* height : 128
|
||||
* });
|
||||
*
|
||||
* oQRCode.clear(); // Clear the QRCode.
|
||||
* oQRCode.makeCode("http://map.naver.com"); // Re-create the QRCode.
|
||||
*
|
||||
* @param {HTMLElement|String} el target element or 'id' attribute of element.
|
||||
* @param {Object|String} vOption
|
||||
* @param {String} vOption.text QRCode link data
|
||||
* @param {Number} [vOption.width=256]
|
||||
* @param {Number} [vOption.height=256]
|
||||
* @param {String} [vOption.colorDark="#000000"]
|
||||
* @param {String} [vOption.colorLight="#ffffff"]
|
||||
* @param {QRCode.CorrectLevel} [vOption.correctLevel=QRCode.CorrectLevel.H] [L|M|Q|H]
|
||||
*/
|
||||
QRCode = function (el, vOption) {
|
||||
this._htOption = {
|
||||
width : 256,
|
||||
height : 256,
|
||||
typeNumber : 4,
|
||||
colorDark : "#000000",
|
||||
colorLight : "#ffffff",
|
||||
correctLevel : QRErrorCorrectLevel.H
|
||||
};
|
||||
|
||||
if (typeof vOption === 'string') {
|
||||
vOption = {
|
||||
text : vOption
|
||||
};
|
||||
}
|
||||
|
||||
// Overwrites options
|
||||
if (vOption) {
|
||||
for (var i in vOption) {
|
||||
this._htOption[i] = vOption[i];
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof el == "string") {
|
||||
el = document.getElementById(el);
|
||||
}
|
||||
|
||||
if (this._htOption.useSVG) {
|
||||
Drawing = svgDrawer;
|
||||
}
|
||||
|
||||
this._android = _getAndroid();
|
||||
this._el = el;
|
||||
this._oQRCode = null;
|
||||
this._oDrawing = new Drawing(this._el, this._htOption);
|
||||
|
||||
if (this._htOption.text) {
|
||||
this.makeCode(this._htOption.text);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Make the QRCode
|
||||
*
|
||||
* @param {String} sText link data
|
||||
*/
|
||||
QRCode.prototype.makeCode = function (sText) {
|
||||
this._oQRCode = new QRCodeModel(_getTypeNumber(sText, this._htOption.correctLevel), this._htOption.correctLevel);
|
||||
this._oQRCode.addData(sText);
|
||||
this._oQRCode.make();
|
||||
this._el.title = sText;
|
||||
this._oDrawing.draw(this._oQRCode);
|
||||
this.makeImage();
|
||||
};
|
||||
|
||||
/**
|
||||
* Make the Image from Canvas element
|
||||
* - It occurs automatically
|
||||
* - Android below 3 doesn't support Data-URI spec.
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
QRCode.prototype.makeImage = function () {
|
||||
if (typeof this._oDrawing.makeImage == "function" && (!this._android || this._android >= 3)) {
|
||||
this._oDrawing.makeImage();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Clear the QRCode
|
||||
*/
|
||||
QRCode.prototype.clear = function () {
|
||||
this._oDrawing.clear();
|
||||
};
|
||||
|
||||
/**
|
||||
* @name QRCode.CorrectLevel
|
||||
*/
|
||||
QRCode.CorrectLevel = QRErrorCorrectLevel;
|
||||
})();
|
||||
Loading…
Reference in New Issue
Block a user