Commit d91822c1 by 丁伟

培训中心报名系统初始提交

parent 30354671
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="config"/>
<classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v7.0">
<attributes>
<attribute name="owner.project.facets" value="jst.web"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
.yml
.DS_Store
*.iml
*.log
*.swp
target/
.idea/
logs/
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>registration</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
</natures>
</projectDescription>
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="WebContent"/>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.WebProject">
<attributes>
<attribute name="hide" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/>
<classpathentry kind="output" path=""/>
</classpath>
package org.ccpit.admin;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
/**
* Created by Administrator on 2015/8/24.
*/
@Controller
@RequestMapping("/admin")
public class AdminController {
@RequestMapping("/index")
public Object index(){
return new ModelAndView("home");
}
}
package org.ccpit.base.controller;
import org.apache.commons.lang.StringEscapeUtils;
import org.apache.commons.lang.StringUtils;
import org.ccpit.base.modol.BaseEntity;
import org.ccpit.base.user.User;
import javax.servlet.http.HttpServletRequest;
/**
* Created by Administrator on 2015/8/13.
*/
public class BaseController {
public static final String USER_IN_SESSION="user_in_session";
public static final String SUCCESS= "{success:true}";
public void setUserSession(HttpServletRequest request,BaseEntity entity){
request.getSession().setAttribute(USER_IN_SESSION,entity);
}
public User getUserSession(HttpServletRequest request){
return (User) request.getSession().getAttribute(USER_IN_SESSION);
}
/**
* 方法描述:封装网格查询字段排序和分页信息
*
* @param request
* @return PageRequest
*/
public PageRequest getPage(HttpServletRequest request) {
int page = 1;
int rows = 10;
// 从请求中拿page 判断是否为空
String requestPage = request.getParameter("page");
if (!StringUtils.isEmpty(requestPage) && StringUtils.isNumeric(requestPage)) {
page = Integer.parseInt(requestPage);
}
// 从请求中拿rows 判断是否为空
String requestRow = request.getParameter("rows");
if (!StringUtils.isEmpty(requestRow) && StringUtils.isNumeric(requestRow)) {
rows = Integer.parseInt(requestRow);
}
String sortName = "";
String sortOrder = "";
// 从请求中拿sortName 判断是否为空
String requestSort = request.getParameter("sort");
if (!StringUtils.isEmpty(requestSort)) {
sortName = StringEscapeUtils.escapeSql(requestSort);
}
// 从请求中拿sortOrder 判断是否为空
String requestOrder = request.getParameter("order");
if (!StringUtils.isEmpty(requestOrder)) {
sortOrder = StringEscapeUtils.escapeSql(requestOrder);
}
PageRequest pageRequest = new PageRequest();
pageRequest.setPageSize(rows);
pageRequest.setPageNo(page);
/**
* 设置排序字段, 多个排序字段时用','分隔.
*/
pageRequest.setOrderBy(sortName + " " + sortOrder);
return pageRequest;
}
/**
* getRequestIp:(获取客户端访问在Ip). 如果通过了多级反向代理的话,X-Forwarded-For的值并不止一个,而是一串IP值,那么真正的用户端的真实IP则是取X-Forwarded-For中第一个非unknown的有效IP字符串。<br/>
* @author dingwei
* @param request
* @return
* @since JDK 1.6
*/
public final static String getRequestIp(HttpServletRequest request){
String ip = request.getHeader("x-forwarded-for");
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("Proxy-Client-IP");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("WL-Proxy-Client-IP");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getRemoteAddr();
}
return ip;
}
}
package org.ccpit.base.controller;
import java.util.List;
import java.util.Map;
/**
* Created by Administrator on 2015/9/7.
*/
public interface Convert<T>{
public Map<String,Object> convert(T obj);
}
package org.ccpit.base.dao;
import org.ccpit.base.controller.Page;
import org.ccpit.base.controller.PageRequest;
import java.util.List;
/**
* Created by Administrator on 2015/8/18.
*/
public interface IDao<T> {
/**
* 实例化一个实体
* @param t
*/
public boolean save(T t);
/**
* 实例化所有实体
* @param t
*/
public boolean saveAll(List<T> list);
/**
* 删除一个实体
* @param t
*/
public boolean delete(T t);
/**
* 删除一个实体
* @param id
*/
public boolean deleteById(long id);
/**
* 删除所有实体
* @param t
*/
public boolean deleteAll(List<T> list);
/**
* 查询实体
* @param t
*/
public List<T> query(final String hql, final Object... params);
/**
* 查询所有
* @param t
*/
public List<T> queryAll();
/**
* 分页查询
* @param pageRequest
* @param hql
* @param values
* @return
*/
public Page findPage(PageRequest pageRequest, String hql, Object[] values);
/**
* 获取实体的Class
* @param t
*/
public Class getEntityClass();
}
package org.ccpit.base.emailSendManage;
import java.util.Date;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.ccpit.base.controller.BaseController;
import org.ccpit.base.controller.Page;
import org.ccpit.base.controller.PageRequest;
import org.ccpit.base.logManage.LogInfoService;
import org.ccpit.base.user.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;
/**
* Company Name : 中贸促信息技术有限责任公司
* Date:2016年9月13日
* author:huoyan
* Copyright (c) 2016, huoyan@ccpit.org All Rights Reserved.
*
*/
@RestController
@RequestMapping(value="/business/EmailManage")
public class EmailController extends BaseController{
@Autowired
private EmailService EmailService;
@Autowired
private LogInfoService logInfoService;
@RequestMapping(value ="/goinEmailPage")
public ModelAndView getPage() {
ModelAndView mv = new ModelAndView("business/emailPage");
return mv;
}
//1.查询
@RequestMapping(value="/queryEmail",produces ="application/json;charset=UTF-8")
public Object queryAllEmail(HttpServletRequest request,EmailInfo Email) {
PageRequest pageRequest = getPage(request);
String hql= "from EmailInfo where 1=1";
String title = request.getParameter("title");
String content = request.getParameter("content");
String recipients = request.getParameter("recipients");
if(title!=null && !title.equals("")){
hql = hql+"and title like '%"+ title +"%' ";
}
if(content!=null && !content.equals("")){
hql = hql+"and content like '%"+ content +"%' ";
}
if(recipients!=null && !recipients.equals("")){
hql = hql+"and recipients like '%"+ recipients +"%' ";
}
Page<EmailInfo> pageInformation = EmailService.queryEmailInfo(pageRequest, hql);
return EmailService.convert(pageInformation);
}
//2.新增或修改
@RequestMapping(value="/addOrUpdateEmail",produces ="application/json;charset=UTF-8")
public Object addOrUpdateEmail(@PathVariable String operate,HttpServletRequest request,HttpServletResponse response, EmailInfo Email){
String result = "";
User user = (User) request.getSession().getAttribute("user_in_session");
boolean flag = false;
Email.setCreateTime(new Date());
Email.setCreator(user);
flag = EmailService.add(Email);
if(flag){
//记录用户操作日志信息
logInfoService.recordLog(request, "新增邮件");
result = "{ \"flag\": "+ flag +", \"info\": \"数据保存成功!\" }";
}else {
result = "{ \"flag\": "+ flag +", \"info\": \"数据保存失败!\" }";
}
return result;
}
}
/*
* Company Name : 中贸促信息技术有限责任公司
* Project Name:memberManageSys
* File Name:EmailDao.java
* Package Name:org.ccpit.business.linkManage
* Date:2015年11月30日
* Copyright (c) 2015, jinlong@ccpit.org All Rights Reserved.
*
*/
package org.ccpit.base.emailSendManage;
import org.ccpit.base.dao.BaseDao;
import org.springframework.stereotype.Repository;
/**
* ClassName:EmailDao <br/>
* Function: TODO <br/>
* Reason: TODO <br/>
* Date: 2015年11月30日 <br/>
* @author jinlong
* @version
* @since JDK 1.6
* @see
*/
@Repository
public class EmailDao extends BaseDao<EmailInfo>{
}
/**
* Company Name : 中贸促信息技术有限责任公司
* Project Name:project
* File Name:EmailInfo.java
* Package Name:org.ccpit.business.emailManage
* Date:2015年10月10日下午2:51:55
* Copyright (c) 2015, dingwei@ccpit.org All Rights Reserved.
*
*/
package org.ccpit.base.emailSendManage;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import org.ccpit.base.user.User;
/**
* ClassName:EmailInfo <br/>
* Function:
* Reason:
* Date: 2015年10月10日 下午2:51:55 <br/>
*
* @author dingwei
* @version
* @since JDK 1.6
* @see
*/
@Entity
@Table(name = "ccoic_emailinfo")
public class EmailInfo implements Serializable {
/**
* serialVersionUID:
*
* @since JDK 1.6
*/
private static final long serialVersionUID = 1L;
private long id;
/**
* 邮件主题
*/
private String title;
/**
* 收件人
*/
private String recipients;
/**
* 发件人
*/
private String addresser;
/**
* 抄送人
*/
private String copyTo;
/**
* 邮件内容
*/
private String content;
/**
* 创建人
*/
private User creator;
/**
* 创建时间
*/
private Date createTime;
/**
* 修改人
*/
private User modifyBy;
/**
* 修改时间
*/
private Date modifyTime;
/**
* 发送状态 0 已发失败 | 1 已发成功
*/
private Integer status;
/**
* 收件人名称
*/
private String recipientName;
/**
* 邮件信息是否为被删除状态
*/
private Boolean emailWhether;
/**
* 备用字段1
*/
private String standby1;
/**
* 备用字段2
*/
private String standby2;
/**
* 备用字段3
*/
private String standby3;
/**
* 备用字段4
*/
private String standby4;
/**
* 备用字段5
*/
private String standby5;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getRecipients() {
return recipients;
}
public void setRecipients(String recipients) {
this.recipients = recipients;
}
public String getAddresser() {
return addresser;
}
public void setAddresser(String addresser) {
this.addresser = addresser;
}
public String getCopyTo() {
return copyTo;
}
public void setCopyTo(String copyTo) {
this.copyTo = copyTo;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public Boolean getEmailWhether() {
return emailWhether;
}
public void setEmailWhether(Boolean emailWhether) {
this.emailWhether = emailWhether;
}
public String getRecipientName() {
return recipientName;
}
public void setRecipientName(String recipientName) {
this.recipientName = recipientName;
}
@OneToOne
public User getCreator() {
return creator;
}
public void setCreator(User creator) {
this.creator = creator;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
@OneToOne
public User getModifyBy() {
return modifyBy;
}
public void setModifyBy(User modifyBy) {
this.modifyBy = modifyBy;
}
public Date getModifyTime() {
return modifyTime;
}
public void setModifyTime(Date modifyTime) {
this.modifyTime = modifyTime;
}
public String getStandby1() {
return standby1;
}
public void setStandby1(String standby1) {
this.standby1 = standby1;
}
public String getStandby2() {
return standby2;
}
public void setStandby2(String standby2) {
this.standby2 = standby2;
}
public String getStandby3() {
return standby3;
}
public void setStandby3(String standby3) {
this.standby3 = standby3;
}
public String getStandby4() {
return standby4;
}
public void setStandby4(String standby4) {
this.standby4 = standby4;
}
public String getStandby5() {
return standby5;
}
public void setStandby5(String standby5) {
this.standby5 = standby5;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
}
/*
* Company Name : 中贸促信息技术有限责任公司
* Project Name:memberManageSys
* File Name:EmailSendController.java
* Package Name:org.ccpit.business.linkManage
* Date:2016年1月21日
* Copyright (c) 2016, jinlong@ccpit.org All Rights Reserved.
*
*/
package org.ccpit.base.emailSendManage;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.ccpit.base.controller.BaseController;
import org.ccpit.base.logManage.LogInfoService;
import org.ccpit.base.metadataManage.MetadataDao;
import org.ccpit.base.metadataManage.MetadataService;
import org.ccpit.base.user.User;
import org.ccpit.base.user.UserDao;
import org.ccpit.base.utils.mailUtil.Mail;
import org.ccpit.base.utils.mailUtil.MailUtil;
import org.ccpit.business.registerManage.RegisterInfo;
import org.ccpit.business.registerManage.RegisterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.alibaba.fastjson.JSON;
/**
* ClassName:EmailSendController <br/>
* Function: TODO <br/>
* Reason: TODO <br/>
* Date: 2016年1月21日 <br/>
*
* @author jinlong
* @version
* @since JDK 1.6
* @see
*/
@Controller
@RequestMapping("base/emailSendManage")
public class EmailSendController extends BaseController {
@Autowired
private MetadataService metadataService;
@Autowired
private LogInfoService logInfoService;
@Autowired
private UserDao userDao;
@Autowired
private MetadataDao metadataDao;
@Autowired
private EmailService emailService;
@Autowired
private RegisterService registerService;
@RequestMapping("sendEmail")
@ResponseBody
public Object sendEmail(HttpServletRequest request) {
// 查找所有接收邮件的会员,放入rList中
String ids = request.getParameter("jsonIds");
List<Long> list = JSON.parseArray(ids, Long.class);
List<RegisterInfo> rList = new ArrayList<RegisterInfo>();
if (list != null && !list.isEmpty()) {
for (long id : list) {
RegisterInfo reg = registerService.queryRegisterById(id);
if (reg != null) {
rList.add(reg);
}
}
}
String emailSender = request.getParameter("emailSender");
String emailTitle = request.getParameter("emailTitle");
String emailContent = request.getParameter("emailContent");
// 5个人封装为一个String,放入List中,每50人发一封邮件
List<StringBuffer> strList = new ArrayList<StringBuffer>();
StringBuffer sb= new StringBuffer();
for(int i=0;i<rList.size();i++){
RegisterInfo registerInfo = rList.get(i);
String name = registerInfo.getEmail();
sb = sb.append(name+";");
if(i%5==4||i==rList.size()-1){
strList.add(sb);
sb= new StringBuffer();
}
}
for(StringBuffer s:strList){
EmailInfo emailInfo = new EmailInfo();
emailInfo.setTitle(emailTitle);
emailInfo.setRecipients(s.toString());
emailInfo.setAddresser(emailSender);
emailInfo.setContent(emailContent);
emailInfo.setCreateTime(new Date());
emailInfo.setCreator((User) request.getSession().getAttribute(BaseController.USER_IN_SESSION));
sendOneEmail(request, s.toString(),emailInfo);
}
Map<String, Object> result =new HashMap<String, Object>();
result.put("flag", true);
result.put("info", "发送完毕!!!");
return result;
}
// 单发
public void sendOneEmail(HttpServletRequest request, String emailAddress,EmailInfo emailInfo) {
Mail mail = null;
if (emailInfo != null) {
mail = new Mail();
mail.setHost("smtp.exmail.qq.com");
mail.setProtocol("smtp");
StringBuilder sb = new StringBuilder("<div class='emailbody'>");
sb.append("<div>尊敬的考生:</div>");
sb.append("<div>"+emailInfo.getContent()+"</div>");
sb.append("<div>中国贸促会培训中心</div>");
sb.append("</div>");
//设置发件人邮箱账号密码
String addresser = emailInfo.getAddresser();
mail.setSender(addresser);
if(addresser.equals("cdcschina@ccpit.org")){
mail.setEmailPassword("ccoic208");
}else if(addresser.equals("citfchina@ccpit.org")){
mail.setEmailPassword("suk4376");
}else if(addresser.equals("csdgchina@ccpit.org")){
mail.setEmailPassword("clyde361412");
}
mail.setName("培训中心报名管理平台");
mail.setEmailCount(addresser);
mail.setReceiver(emailAddress);
mail.setMailTitle(emailInfo.getTitle());
mail.setMailMessage(sb.toString());
boolean sendStatus = MailUtil.sendMail(mail);
if (sendStatus) {
emailInfo.setStatus(1);//成功
} else {
emailInfo.setStatus(0);//失败
}
emailService.add(emailInfo);
}
}
}
/*
* Company Name : 中贸促信息技术有限责任公司
* Project Name:memberManageSys
* File Name:EmailService.java
* Package Name:org.ccpit.business.linkManage
* Date:2015年11月30日
* Copyright (c) 2015, jinlong@ccpit.org All Rights Reserved.
*
*/
package org.ccpit.base.emailSendManage;
import java.text.SimpleDateFormat;
import java.util.HashMap;
import java.util.Map;
import org.ccpit.base.controller.Convert;
import org.ccpit.base.controller.Page;
import org.ccpit.base.controller.PageBo;
import org.ccpit.base.controller.PageRequest;
import org.ccpit.base.metadataManage.MetadataDao;
import org.ccpit.base.user.UserDao;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
/**
* ClassName:EmailService <br/>
* Function: TODO <br/>
* Reason: TODO <br/>
* Date: 2015年11月30日 <br/>
*
* @author jinlong
* @version
* @since JDK 1.6
* @see
*/
@Repository
@Transactional
public class EmailService {
private final static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@Autowired
private EmailDao emailDao;
@Autowired
private MetadataDao metadataDao;
@Autowired
private UserDao userDao;
public Page<EmailInfo> queryEmailInfo(PageRequest pageRequest, String hql) {
return emailDao.findPage(pageRequest, hql, null);
}
public boolean add(EmailInfo emailInfo) {
return emailDao.save(emailInfo);
}
public Map<String, Object> convertToMap(EmailInfo emailInfo) {
Map<String, Object> map = new HashMap<String, Object>();
if (emailInfo == null) {
return map;
}
map.put("id", emailInfo.getId());
map.put("title", emailInfo.getTitle());
map.put("recipients", emailInfo.getRecipients());
map.put("addresser", emailInfo.getAddresser());
map.put("content", emailInfo.getContent());
map.put("creator", emailInfo.getCreator().getUsername());
map.put("createTime", sdf.format(emailInfo.getCreateTime()));
map.put("status", emailInfo.getStatus()==1?"成功":"失败");
return map;
}
public PageBo<EmailInfo> convert(Page<EmailInfo> page) {
return new PageBo<EmailInfo>(page, new Convert<EmailInfo>() {
@Override
public Map<String, Object> convert(EmailInfo obj) {
return convertToMap(obj);
}
});
}
}
package org.ccpit.base.modol;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import java.io.Serializable;
import java.lang.annotation.Inherited;
/**
* Created by Administrator on 2015/8/13.
*/
public class BaseEntity implements IEntity,Serializable {
/**
* Serializable ID
*/
private long id;
/**
* set id
*
* @param id
*/
public void setId(long id) {
this.id = id;
}
/**
* Get id
*
* @return
*/
@Override
public long getId() {
return id;
}
}
package org.ccpit.base.modol;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Created by Administrator on 2015/8/13.
*/
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface EscapeHTML {
public String[] except() default {};
}
package org.ccpit.base.modol;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Created by Administrator on 2015/8/13.
*/
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface EscapeSql {
public String[] except() default {};
}
package org.ccpit.base.modol;
/**
* Created by Administrator on 2015/8/18.
*/
public interface IEntity {
public long getId();
}
package org.ccpit.base.role;
import java.util.List;
/**
* Created by Administrator on 2015/9/2.
*/
public interface IRole {
public String getRoleName();
public List<RoleUrl> getUrlPerfixs();
public long getId();
}
package org.ccpit.base.security;
import org.ccpit.base.controller.BaseController;
import org.ccpit.base.user.User;
import org.ccpit.base.user.UserService;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.TagSupport;
/**
* Created by Administrator on 2015/9/8.
*/
public class CmsTagSupport extends TagSupport implements ApplicationContextAware{
static String SPLIT = ",";
static ApplicationContext ac;
public User getUser(){
HttpServletRequest req = (HttpServletRequest) pageContext.getRequest();
Object obj = req.getSession().getAttribute(BaseController.USER_IN_SESSION);
if (obj==null)
return null;
return (User) obj;
// UserService userService = ac.getBean(UserService.class);
// User user = userService.getUser(1L);
// return user;
}
@Override
public int doStartTag() throws JspException {
if (getUser()==null)
return SKIP_BODY;
return validate()?EVAL_PAGE:SKIP_BODY;
}
/**
* validate the security return the result
* @return
*/
public boolean validate(){
return false;
};
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
ac=applicationContext;
}
}
package org.ccpit.base.service;
/**
* Created by Administrator on 2015/8/18.
*/
public interface IService {
}
package org.ccpit.base.user;
/**
* Created by Administrator on 2015/9/2.
*/
public interface IUser {
public String getUsername();
public String getLoginName();
public long getId();
}
package org.ccpit.base.utils;
import java.security.MessageDigest;
import javax.crypto.Cipher;
import javax.crypto.KeyGenerator;
import javax.crypto.SecretKey;
import javax.crypto.spec.SecretKeySpec;
/**
* @Description �����㷨
* @Version V0.1
* @Author zmc
* @Date 2015��4��3�� ����3:07:18 JDK�汾��sun jdk 1.6
* ���¼�¼****************************** �汾�� <�汾��> �޸����ڣ� <����> �޸��ˣ� <�޸�������>
* �޸����ݣ� <�޸���������>
**********************************************************************
*
*/
public class CryptUtil {
private static String DES_Algorithm = "DESede";
private static String MD5_Algorithm = "MD5";
private static KeyGenerator keygen;
private static SecretKey deskey;
public static SecretKey genDESKey(byte[] keyByte) throws Exception {
SecretKey k = null;
k = new SecretKeySpec(keyByte, DES_Algorithm);
return k;
}
public static SecretKey genDESKey(String keyStr) throws Exception {
SecretKey k = null;
k = new SecretKeySpec(keyStr.getBytes(), DES_Algorithm);
return k;
}
public static SecretKey genDESKey() throws Exception {
if (keygen == null) {
keygen = KeyGenerator.getInstance(DES_Algorithm);
deskey = keygen.generateKey();
}
return deskey;
}
public static byte[] desEncrypt(SecretKey key, byte[] src) throws Exception {
Cipher cipher = Cipher.getInstance("DESede");
cipher.init(1, key);
return cipher.doFinal(src);
}
public static String desEncrypt(SecretKey key, String src) throws Exception {
return new String(desEncrypt(key, src.getBytes()));
}
public static byte[] desEncrypt(byte[] src) throws Exception {
if (keygen == null) {
keygen = KeyGenerator.getInstance(DES_Algorithm);
deskey = keygen.generateKey();
}
Cipher cipher = Cipher.getInstance(DES_Algorithm);
cipher.init(1, deskey);
return cipher.doFinal(src);
}
public static String desEncrypt(String src) throws Exception {
return new String(desEncrypt(src.getBytes()));
}
public static byte[] desDecrypt(SecretKey key, byte[] crypt)
throws Exception {
Cipher cipher = Cipher.getInstance(DES_Algorithm);
cipher.init(2, key);
return cipher.doFinal(crypt);
}
public static String desDecrypt(SecretKey key, String crypt)
throws Exception {
return new String(desDecrypt(key, crypt.getBytes()));
}
public static byte[] desDecrypt(byte[] crypt) throws Exception {
if (keygen == null) {
keygen = KeyGenerator.getInstance(DES_Algorithm);
deskey = keygen.generateKey();
}
Cipher cipher = Cipher.getInstance(DES_Algorithm);
cipher.init(2, deskey);
return cipher.doFinal(crypt);
}
public static String desDecrypt(String crypt) throws Exception {
return new String(desDecrypt(crypt.getBytes()));
}
public static String md5Encrypt(String src) throws Exception {
byte[] md5 = md5Digest(src.getBytes("utf-8"));
return encodeHex(md5);
}
private static String md5Digest(String src) throws Exception {
return new String(md5Digest(src.getBytes("utf-8")));
}
private static byte[] md5Digest(byte[] src) throws Exception {
MessageDigest alg = MessageDigest.getInstance(MD5_Algorithm);
return alg.digest(src);
}
private static byte[] md5Digest(byte[] src, byte[] key) throws Exception {
MessageDigest alg = MessageDigest.getInstance(MD5_Algorithm);
alg.update(key);
return alg.digest(src);
}
private static String encodeHex(byte[] bytes) {
StringBuffer buf = new StringBuffer(bytes.length * 2);
for (int i = 0; i < bytes.length; i++) {
if ((bytes[i] & 0xFF) < 16) {
buf.append("0");
}
buf.append(Long.toString(bytes[i] & 0xFF, 16));
}
return buf.toString();
}
/*public static String base64Encode(String src) {
BASE64Encoder encoder = new BASE64Encoder();
return encoder.encode(src.getBytes());
}
public static String base64Encode(byte[] src) {
BASE64Encoder encoder = new BASE64Encoder();
return encoder.encode(src);
}
public static String base64Decode(String src) {
BASE64Decoder decoder = new BASE64Decoder();
try {
return new String(decoder.decodeBuffer(src));
} catch (Exception ex) {
}
return null;
}
public static byte[] base64DecodeToBytes(String src) {
BASE64Decoder decoder = new BASE64Decoder();
try {
return decoder.decodeBuffer(src);
} catch (Exception ex) {
}
return null;
}*/
}
package org.ccpit.base.utils;
import java.util.Date;
/**
* 邮件发送实体
* Date: 2015年10月29日 09:56
*
* @author 孙其鹏
* @version 1.0
*/
public class EmailBody {
/**
* 变量名 subject: TODO 邮件标题
*/
private String subject;
/**
* 变量名 sentDate: TODO 邮件日期
*/
private Date sentDate;
/**
* 变量名 text: TODO 邮件内容
*/
private String content;
public String getSubject() {
return subject;
}
public void setSubject(String subject) {
this.subject = subject;
}
public Date getSentDate() {
return sentDate;
}
public void setSentDate(Date sentDate) {
this.sentDate = sentDate;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
}
package org.ccpit.base.utils;
/**
* Created by Administrator on 2015/8/13.
*/
import org.apache.commons.lang.StringUtils;
import org.ccpit.base.modol.EscapeHTML;
import org.ccpit.base.modol.EscapeSql;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* Html 标签过滤工具,防止js注入
* 只对String类型的字段进行过滤
* Created by Sunqipeng on 2015/7/24.
*/
public class HtmlEscapeUtil<T> {
/**
* 实体
*/
private T entry;
/**
* 排除的字段
*/
private List<String> escapes = new ArrayList<String>();
/**
* 添加要排除的字段
*
* @param propertyName
* @return
*/
public HtmlEscapeUtil<T> except(String propertyName) {
escapes.add(propertyName);
return this;
}
/**
* 添加多个排除的字段
*
* @param propertyNames
* @return
*/
public HtmlEscapeUtil<T> except(String... propertyNames) {
escapes.addAll(Arrays.asList(propertyNames));
return this;
}
/**
* 设置要过滤的实体
*
* @param entry
* @return
*/
public HtmlEscapeUtil<T> encode(T entry) {
this.entry = entry;
return this;
}
/**
* Escape the Sql with the annotation
* @param t
* @return
*/
public T escape(T t){
EscapeHTML annotation = t.getClass().getAnnotation(EscapeHTML.class);
if (annotation!=null){
encode(t);
except(annotation.except());
execute();
}
return t;
}
/**
* 执行过滤操作
*
* @return
*/
public T execute() {
if (entry == null)
return null;
Field[] fields = entry.getClass().getDeclaredFields();
for (int i = 0; i < fields.length; i++) {
Field f = fields[i];
String name = f.getName();
if (escapes.contains(name))
continue;
if (f.getType().isAssignableFrom(String.class)) {
String upName = name.replaceFirst(name.substring(0, 1), name.substring(0, 1).toUpperCase());
try {
Method method = entry.getClass().getMethod("get" + upName);
String value = (String) method.invoke(entry);
if (!StringUtils.isEmpty(value)) {
value = escapeHtml(value);
Method setter = entry.getClass().getMethod("set" + upName, String.class);
setter.invoke(entry, value);
}
} catch (NoSuchMethodException e) {
System.out.println("未找到方法:" + upName);
continue;
} catch (Exception e) {
e.printStackTrace();
}
}
}
return entry;
}
/**
* 过滤方法
*
* @param prop
* @return
*/
public static String escapeHtml(String prop) {
prop = prop.replaceAll("<", "&lt");
prop = prop.replaceAll(">", "&gt");
return prop;
}
}
package org.ccpit.business.registerManage;
import java.io.IOException;
import java.io.OutputStream;
import java.text.SimpleDateFormat;
import java.util.List;
import org.apache.poi.hssf.util.HSSFColor;
import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFCellStyle;
import org.apache.poi.xssf.usermodel.XSSFFont;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
/**
* @author sunqipeng
* @Description 描述:excel助手类
* @Version v0.1
* @2015-6-5上午8:38:45 JDK版本 sun jdk1.6
* ********************************更新记录******************************
* 版本: <版本号> 修改日期: <日期> 修改人: <修改人姓名>
* 修改内容: <修改内容描述>
* *********************************************************************
*/
public class ExcelHelper {
private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd");
public static void exportExcelRegisterInfo(OutputStream os, List<RegisterInfo> newsInfoList, String sheetName) {
//创建Excel工作薄
XSSFWorkbook book = new XSSFWorkbook();
//在Excel工作薄中建一张工作表
XSSFSheet sheet = book.createSheet(sheetName);
//创建cell背景颜色
XSSFCellStyle style = book.createCellStyle();
XSSFFont font = book.createFont();
font.setColor(HSSFColor.BLACK.index);//字体颜色
font.setFontHeightInPoints((short) 12);
font.setBoldweight(XSSFFont.BOLDWEIGHT_BOLD); //字体增粗
style.setVerticalAlignment(XSSFCellStyle.VERTICAL_CENTER); //垂直
style.setFillBackgroundColor(HSSFColor.ROYAL_BLUE.index);
//设置单元格格式(文本)
XSSFCellStyle cellStyle = book.createCellStyle();
//创建第一行为标题行
XSSFRow row = sheet.createRow(0);
row.setRowStyle(style);
XSSFCell cell0 = row.createCell(0);
XSSFCell cell1 = row.createCell(1);
XSSFCell cell2 = row.createCell(2);
XSSFCell cell3 = row.createCell(3);
XSSFCell cell4 = row.createCell(4);
XSSFCell cell5 = row.createCell(5);
XSSFCell cell6 = row.createCell(6);
XSSFCell cell7 = row.createCell(7);
XSSFCell cell8 = row.createCell(8);
XSSFCell cell9 = row.createCell(9);
XSSFCell cell10 = row.createCell(10);
XSSFCell cell11 = row.createCell(11);
XSSFCell cell12 = row.createCell(12);
XSSFCell cell13 = row.createCell(13);
XSSFCell cell14 = row.createCell(14);
XSSFCell cell15 = row.createCell(15);
XSSFCell cell16 = row.createCell(16);
XSSFCell cell17 = row.createCell(17);
XSSFCell cell18 = row.createCell(18);
XSSFCell cell19 = row.createCell(19);
XSSFCell cell20 = row.createCell(20);
XSSFCell cell21 = row.createCell(21);
XSSFCell cell22 = row.createCell(22);
XSSFCell cell23 = row.createCell(23);
XSSFCell cell24 = row.createCell(24);
XSSFCell cell25 = row.createCell(25);
XSSFCell cell26 = row.createCell(26);
XSSFCell cell27 = row.createCell(27);
XSSFCell cell28 = row.createCell(28);
XSSFCell cell29 = row.createCell(29);
//定义单元格为字符串类型
cell0.setCellType(XSSFCell.CELL_TYPE_STRING);
cell1.setCellType(XSSFCell.CELL_TYPE_STRING);
cell2.setCellType(XSSFCell.CELL_TYPE_STRING);
cell3.setCellType(XSSFCell.CELL_TYPE_STRING);
cell4.setCellType(XSSFCell.CELL_TYPE_STRING);
cell5.setCellType(XSSFCell.CELL_TYPE_STRING);
cell6.setCellType(XSSFCell.CELL_TYPE_STRING);
cell7.setCellType(XSSFCell.CELL_TYPE_STRING);
cell8.setCellType(XSSFCell.CELL_TYPE_STRING);
cell9.setCellType(XSSFCell.CELL_TYPE_STRING);
cell10.setCellType(XSSFCell.CELL_TYPE_STRING);
cell11.setCellType(XSSFCell.CELL_TYPE_STRING);
cell12.setCellType(XSSFCell.CELL_TYPE_STRING);
cell13.setCellType(XSSFCell.CELL_TYPE_STRING);
cell14.setCellType(XSSFCell.CELL_TYPE_STRING);
cell15.setCellType(XSSFCell.CELL_TYPE_STRING);
cell16.setCellType(XSSFCell.CELL_TYPE_STRING);
cell17.setCellType(XSSFCell.CELL_TYPE_STRING);
cell18.setCellType(XSSFCell.CELL_TYPE_STRING);
cell19.setCellType(XSSFCell.CELL_TYPE_STRING);
cell20.setCellType(XSSFCell.CELL_TYPE_STRING);
cell21.setCellType(XSSFCell.CELL_TYPE_STRING);
cell22.setCellType(XSSFCell.CELL_TYPE_STRING);
cell23.setCellType(XSSFCell.CELL_TYPE_STRING);
cell24.setCellType(XSSFCell.CELL_TYPE_STRING);
//在单元格中输入数据
cell0.setCellValue("提交时间");
cell1.setCellValue("城市选择");
cell2.setCellValue("姓名");
cell3.setCellValue("性别");
cell4.setCellValue("出生日期");
cell5.setCellValue("电话");
cell6.setCellValue("手机");
cell7.setCellValue("邮箱");
cell8.setCellValue("工作单位");
cell9.setCellValue("发票抬头");
cell10.setCellValue("发票类型");
cell11.setCellValue("地址");
cell12.setCellValue("TITLE");
cell13.setCellValue("DATE OF BIRTH");
cell14.setCellValue("GENDER");
cell15.setCellValue("NAME");
cell16.setCellValue("COMPANY NAME");
cell17.setCellValue("ADDRESS");
cell18.setCellValue("COUNTRY");
cell19.setCellValue("PHONE");
cell20.setCellValue("EMAIL");
cell21.setCellValue("CITY SELECT");
cell22.setCellValue("考试科目");
cell23.setCellValue("报名类型");
cell24.setCellValue("报名状态");
cell0.setCellStyle(style);
//循环导出数据到excel中
for (int i = 0; i < newsInfoList.size(); i++) {
RegisterInfo registerInfo = newsInfoList.get(i);
//创建第i行
XSSFRow rowi = sheet.createRow(i + 1);
rowi.createCell(0).setCellValue(sdf.format(registerInfo.getSubmitTime())); //提交时间
rowi.createCell(1).setCellValue(registerInfo.getCity()); //城市
rowi.createCell(2).setCellValue(registerInfo.getName()); //姓名
rowi.createCell(3).setCellValue("male".equals(registerInfo.getGender()) ? "男" : "女"); //性别
rowi.createCell(4).setCellValue(sdf.format(registerInfo.getBirthday())); //出生日期
rowi.createCell(5).setCellValue(registerInfo.getTelphone()); //电话
rowi.createCell(6).setCellValue(registerInfo.getMobileTel()); //手机
rowi.createCell(7).setCellValue(registerInfo.getEmail()); //邮箱
rowi.createCell(8).setCellValue(registerInfo.getCompany()); //工作单位
rowi.createCell(9).setCellValue(registerInfo.getInvoiceTitle()); //发票抬头
rowi.createCell(10).setCellValue(registerInfo.getInvoiceType()); //发票类型
rowi.createCell(11).setCellValue(registerInfo.getAddress()); //地址
rowi.createCell(12).setCellValue(registerInfo.getTitle()); //TITLE
rowi.createCell(13).setCellValue(sdf.format(registerInfo.getBirthday())); //DATE OF BIRTH
rowi.createCell(14).setCellValue("male".equals(registerInfo.getGender()) ? "MALE" : "FEMALE"); //GENDER
rowi.createCell(15).setCellValue(registerInfo.getName_en()); //NAME
rowi.createCell(16).setCellValue(registerInfo.getCompany_en()); //COMPANY NAME
rowi.createCell(17).setCellValue(registerInfo.getAddress_en()); //ADDRESS
rowi.createCell(18).setCellValue(registerInfo.getCountry()); //COUNTRY
rowi.createCell(19).setCellValue(registerInfo.getSort()); //PHONE
rowi.createCell(20).setCellValue(registerInfo.getEmail()); //EMAIL
rowi.createCell(21).setCellValue(registerInfo.getCity_en()); //CITY SELECT
rowi.createCell(22).setCellValue(registerInfo.getSubject()); //考试科目
rowi.createCell(24).setCellValue(registerInfo.getRegisterStatus()); //报名状态
}
try {
book.write(os);
os.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
package org.ccpit.ueditor;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.ccpit.ueditor.define.ActionMap;
import org.ccpit.ueditor.define.AppInfo;
import org.ccpit.ueditor.define.BaseState;
import org.ccpit.ueditor.define.State;
import org.ccpit.ueditor.hunter.FileManager;
import org.ccpit.ueditor.hunter.ImageHunter;
import org.ccpit.ueditor.upload.Uploader;
public class ActionEnter {
private HttpServletRequest request = null;
private String rootPath = null;
private String contextPath = null;
private String actionType = null;
private ConfigManager configManager = null;
public ActionEnter ( HttpServletRequest request, String rootPath ) {
this.request = request;
this.rootPath = rootPath;
this.actionType = request.getParameter( "action" );
this.contextPath = request.getContextPath();
this.configManager = ConfigManager.getInstance( this.rootPath, this.contextPath, request.getRequestURI() );
}
public String exec () {
String callbackName = this.request.getParameter("callback");
if ( callbackName != null ) {
if ( !validCallbackName( callbackName ) ) {
return new BaseState( false, AppInfo.ILLEGAL ).toJSONString();
}
return callbackName+"("+this.invoke()+");";
} else {
return this.invoke();
}
}
public String invoke() {
if ( actionType == null || !ActionMap.mapping.containsKey( actionType ) ) {
return new BaseState( false, AppInfo.INVALID_ACTION ).toJSONString();
}
if ( this.configManager == null || !this.configManager.valid() ) {
return new BaseState( false, AppInfo.CONFIG_ERROR ).toJSONString();
}
State state = null;
int actionCode = ActionMap.getType( this.actionType );
Map<String, Object> conf = null;
switch ( actionCode ) {
case ActionMap.CONFIG:
return this.configManager.getAllConfig().toString();
case ActionMap.UPLOAD_IMAGE:
case ActionMap.UPLOAD_SCRAWL:
case ActionMap.UPLOAD_VIDEO:
case ActionMap.UPLOAD_FILE:
conf = this.configManager.getConfig( actionCode );
state = new Uploader( request, conf ).doExec();
break;
case ActionMap.CATCH_IMAGE:
conf = configManager.getConfig( actionCode );
String[] list = this.request.getParameterValues( (String)conf.get( "fieldName" ) );
state = new ImageHunter( conf ).capture( list );
break;
case ActionMap.LIST_IMAGE:
case ActionMap.LIST_FILE:
conf = configManager.getConfig( actionCode );
int start = this.getStartIndex();
state = new FileManager( conf ).listFile( start );
break;
}
return state.toJSONString();
}
public int getStartIndex () {
String start = this.request.getParameter( "start" );
try {
return Integer.parseInt( start );
} catch ( Exception e ) {
return 0;
}
}
/**
* callback参数验证
*/
public boolean validCallbackName ( String name ) {
if ( name.matches( "^[a-zA-Z_]+[\\w0-9_]*$" ) ) {
return true;
}
return false;
}
}
\ No newline at end of file
package org.ccpit.ueditor;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.util.HashMap;
import java.util.Map;
import org.ccpit.ueditor.define.ActionMap;
import org.json.JSONArray;
import org.json.JSONObject;
/**
* 配置管理器
* @author hancong03@baidu.com
*
*/
public final class ConfigManager {
private final String rootPath;
private final String originalPath;
private final String contextPath;
private static final String configFileName = "config.json";
private String parentPath = null;
private JSONObject jsonConfig = null;
// 涂鸦上传filename定义
private final static String SCRAWL_FILE_NAME = "scrawl";
// 远程图片抓取filename定义
private final static String REMOTE_FILE_NAME = "remote";
/*
* 通过一个给定的路径构建一个配置管理器, 该管理器要求地址路径所在目录下必须存在config.properties文件
*/
private ConfigManager ( String rootPath, String contextPath, String uri ) throws FileNotFoundException, IOException {
rootPath = rootPath.replace( "\\", "/" );
this.rootPath = rootPath;
this.contextPath = contextPath;
if ( contextPath.length() > 0 ) {
this.originalPath = this.rootPath + uri.substring( contextPath.length() );
} else {
this.originalPath = this.rootPath + uri;
}
this.initEnv();
}
/**
* 配置管理器构造工厂
* @param rootPath 服务器根路径
* @param contextPath 服务器所在项目路径
* @param uri 当前访问的uri
* @return 配置管理器实例或者null
*/
public static ConfigManager getInstance ( String rootPath, String contextPath, String uri ) {
try {
return new ConfigManager(rootPath, contextPath, uri);
} catch ( Exception e ) {
return null;
}
}
// 验证配置文件加载是否正确
public boolean valid () {
return this.jsonConfig != null;
}
public JSONObject getAllConfig () {
return this.jsonConfig;
}
public Map<String, Object> getConfig ( int type ) {
Map<String, Object> conf = new HashMap<String, Object>();
String savePath = null;
switch ( type ) {
case ActionMap.UPLOAD_FILE:
conf.put( "isBase64", "false" );
conf.put( "maxSize", this.jsonConfig.getLong( "fileMaxSize" ) );
conf.put( "allowFiles", this.getArray( "fileAllowFiles" ) );
conf.put( "fieldName", this.jsonConfig.getString( "fileFieldName" ) );
savePath = this.jsonConfig.getString( "filePathFormat" );
break;
case ActionMap.UPLOAD_IMAGE:
conf.put( "isBase64", "false" );
conf.put( "maxSize", this.jsonConfig.getLong( "imageMaxSize" ) );
conf.put( "allowFiles", this.getArray( "imageAllowFiles" ) );
conf.put( "fieldName", this.jsonConfig.getString( "imageFieldName" ) );
savePath = this.jsonConfig.getString( "imagePathFormat" );
break;
case ActionMap.UPLOAD_VIDEO:
conf.put( "maxSize", this.jsonConfig.getLong( "videoMaxSize" ) );
conf.put( "allowFiles", this.getArray( "videoAllowFiles" ) );
conf.put( "fieldName", this.jsonConfig.getString( "videoFieldName" ) );
savePath = this.jsonConfig.getString( "videoPathFormat" );
break;
case ActionMap.UPLOAD_SCRAWL:
conf.put( "filename", ConfigManager.SCRAWL_FILE_NAME );
conf.put( "maxSize", this.jsonConfig.getLong( "scrawlMaxSize" ) );
conf.put( "fieldName", this.jsonConfig.getString( "scrawlFieldName" ) );
conf.put( "isBase64", "true" );
savePath = this.jsonConfig.getString( "scrawlPathFormat" );
break;
case ActionMap.CATCH_IMAGE:
conf.put( "filename", ConfigManager.REMOTE_FILE_NAME );
conf.put( "filter", this.getArray( "catcherLocalDomain" ) );
conf.put( "maxSize", this.jsonConfig.getLong( "catcherMaxSize" ) );
conf.put( "allowFiles", this.getArray( "catcherAllowFiles" ) );
conf.put( "fieldName", this.jsonConfig.getString( "catcherFieldName" ) + "[]" );
savePath = this.jsonConfig.getString( "catcherPathFormat" );
break;
case ActionMap.LIST_IMAGE:
conf.put( "allowFiles", this.getArray( "imageManagerAllowFiles" ) );
conf.put( "dir", this.jsonConfig.getString( "imageManagerListPath" ) );
conf.put( "count", this.jsonConfig.getInt( "imageManagerListSize" ) );
break;
case ActionMap.LIST_FILE:
conf.put( "allowFiles", this.getArray( "fileManagerAllowFiles" ) );
conf.put( "dir", this.jsonConfig.getString( "fileManagerListPath" ) );
conf.put( "count", this.jsonConfig.getInt( "fileManagerListSize" ) );
break;
}
conf.put( "savePath", savePath );
conf.put( "rootPath", this.rootPath );
return conf;
}
private void initEnv () throws FileNotFoundException, IOException {
File file = new File( this.originalPath );
if ( !file.isAbsolute() ) {
file = new File( file.getAbsolutePath() );
}
this.parentPath = file.getParent();
String configContent = this.readFile( this.getConfigPath() );
try{
JSONObject jsonConfig = new JSONObject( configContent );
this.jsonConfig = jsonConfig;
} catch ( Exception e ) {
this.jsonConfig = null;
}
}
private String getConfigPath () {
return this.parentPath + File.separator + ConfigManager.configFileName;
}
private String[] getArray ( String key ) {
JSONArray jsonArray = this.jsonConfig.getJSONArray( key );
String[] result = new String[ jsonArray.length() ];
for ( int i = 0, len = jsonArray.length(); i < len; i++ ) {
result[i] = jsonArray.getString( i );
}
return result;
}
private String readFile ( String path ) throws IOException {
StringBuilder builder = new StringBuilder();
try {
InputStreamReader reader = new InputStreamReader( new FileInputStream( path ), "UTF-8" );
BufferedReader bfReader = new BufferedReader( reader );
String tmpContent = null;
while ( ( tmpContent = bfReader.readLine() ) != null ) {
builder.append( tmpContent );
}
bfReader.close();
} catch ( UnsupportedEncodingException e ) {
// 忽略
}
return this.filter( builder.toString() );
}
// 过滤输入字符串, 剔除多行注释以及替换掉反斜杠
private String filter ( String input ) {
return input.replaceAll( "/\\*[\\s\\S]*?\\*/", "" );
}
}
package org.ccpit.ueditor;
public class Encoder {
public static String toUnicode ( String input ) {
StringBuilder builder = new StringBuilder();
char[] chars = input.toCharArray();
for ( char ch : chars ) {
if ( ch < 256 ) {
builder.append( ch );
} else {
builder.append( "\\u" + Integer.toHexString( ch& 0xffff ) );
}
}
return builder.toString();
}
}
\ No newline at end of file
package org.ccpit.ueditor.define;
import java.util.Map;
import java.util.HashMap;
/**
* 定义请求action类型
* @author hancong03@baidu.com
*
*/
@SuppressWarnings("serial")
public final class ActionMap {
public static final Map<String, Integer> mapping;
// 获取配置请求
public static final int CONFIG = 0;
public static final int UPLOAD_IMAGE = 1;
public static final int UPLOAD_SCRAWL = 2;
public static final int UPLOAD_VIDEO = 3;
public static final int UPLOAD_FILE = 4;
public static final int CATCH_IMAGE = 5;
public static final int LIST_FILE = 6;
public static final int LIST_IMAGE = 7;
static {
mapping = new HashMap<String, Integer>(){{
put( "config", ActionMap.CONFIG );
put( "uploadimage", ActionMap.UPLOAD_IMAGE );
put( "uploadscrawl", ActionMap.UPLOAD_SCRAWL );
put( "uploadvideo", ActionMap.UPLOAD_VIDEO );
put( "uploadfile", ActionMap.UPLOAD_FILE );
put( "catchimage", ActionMap.CATCH_IMAGE );
put( "listfile", ActionMap.LIST_FILE );
put( "listimage", ActionMap.LIST_IMAGE );
}};
}
public static int getType ( String key ) {
return ActionMap.mapping.get( key );
}
}
package org.ccpit.ueditor.define;
public enum ActionState {
UNKNOW_ERROR
}
package org.ccpit.ueditor.define;
import java.util.HashMap;
import java.util.Map;
public final class AppInfo {
public static final int SUCCESS = 0;
public static final int MAX_SIZE = 1;
public static final int PERMISSION_DENIED = 2;
public static final int FAILED_CREATE_FILE = 3;
public static final int IO_ERROR = 4;
public static final int NOT_MULTIPART_CONTENT = 5;
public static final int PARSE_REQUEST_ERROR = 6;
public static final int NOTFOUND_UPLOAD_DATA = 7;
public static final int NOT_ALLOW_FILE_TYPE = 8;
public static final int INVALID_ACTION = 101;
public static final int CONFIG_ERROR = 102;
public static final int PREVENT_HOST = 201;
public static final int CONNECTION_ERROR = 202;
public static final int REMOTE_FAIL = 203;
public static final int NOT_DIRECTORY = 301;
public static final int NOT_EXIST = 302;
public static final int ILLEGAL = 401;
public static Map<Integer, String> info = new HashMap<Integer, String>(){{
put( AppInfo.SUCCESS, "SUCCESS" );
// 无效的Action
put( AppInfo.INVALID_ACTION, "\u65E0\u6548\u7684Action" );
// 配置文件初始化失败
put( AppInfo.CONFIG_ERROR, "\u914D\u7F6E\u6587\u4EF6\u521D\u59CB\u5316\u5931\u8D25" );
// 抓取远程图片失败
put( AppInfo.REMOTE_FAIL, "\u6293\u53D6\u8FDC\u7A0B\u56FE\u7247\u5931\u8D25" );
// 被阻止的远程主机
put( AppInfo.PREVENT_HOST, "\u88AB\u963B\u6B62\u7684\u8FDC\u7A0B\u4E3B\u673A" );
// 远程连接出错
put( AppInfo.CONNECTION_ERROR, "\u8FDC\u7A0B\u8FDE\u63A5\u51FA\u9519" );
// "文件大小超出限制"
put( AppInfo.MAX_SIZE, "\u6587\u4ef6\u5927\u5c0f\u8d85\u51fa\u9650\u5236" );
// 权限不足, 多指写权限
put( AppInfo.PERMISSION_DENIED, "\u6743\u9650\u4E0D\u8DB3" );
// 创建文件失败
put( AppInfo.FAILED_CREATE_FILE, "\u521B\u5EFA\u6587\u4EF6\u5931\u8D25" );
// IO错误
put( AppInfo.IO_ERROR, "IO\u9519\u8BEF" );
// 上传表单不是multipart/form-data类型
put( AppInfo.NOT_MULTIPART_CONTENT, "\u4E0A\u4F20\u8868\u5355\u4E0D\u662Fmultipart/form-data\u7C7B\u578B" );
// 解析上传表单错误
put( AppInfo.PARSE_REQUEST_ERROR, "\u89E3\u6790\u4E0A\u4F20\u8868\u5355\u9519\u8BEF" );
// 未找到上传数据
put( AppInfo.NOTFOUND_UPLOAD_DATA, "\u672A\u627E\u5230\u4E0A\u4F20\u6570\u636E" );
// 不允许的文件类型
put( AppInfo.NOT_ALLOW_FILE_TYPE, "\u4E0D\u5141\u8BB8\u7684\u6587\u4EF6\u7C7B\u578B" );
// 指定路径不是目录
put( AppInfo.NOT_DIRECTORY, "\u6307\u5B9A\u8DEF\u5F84\u4E0D\u662F\u76EE\u5F55" );
// 指定路径并不存在
put( AppInfo.NOT_EXIST, "\u6307\u5B9A\u8DEF\u5F84\u5E76\u4E0D\u5B58\u5728" );
// callback参数名不合法
put( AppInfo.ILLEGAL, "Callback\u53C2\u6570\u540D\u4E0D\u5408\u6CD5" );
}};
public static String getStateInfo ( int key ) {
return AppInfo.info.get( key );
}
}
package org.ccpit.ueditor.define;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import org.ccpit.ueditor.Encoder;
public class BaseState implements State {
private boolean state = false;
private String info = null;
private Map<String, String> infoMap = new HashMap<String, String>();
public BaseState () {
this.state = true;
}
public BaseState ( boolean state ) {
this.setState( state );
}
public BaseState ( boolean state, String info ) {
this.setState( state );
this.info = info;
}
public BaseState ( boolean state, int infoCode ) {
this.setState( state );
this.info = AppInfo.getStateInfo( infoCode );
}
public boolean isSuccess () {
return this.state;
}
public void setState ( boolean state ) {
this.state = state;
}
public void setInfo ( String info ) {
this.info = info;
}
public void setInfo ( int infoCode ) {
this.info = AppInfo.getStateInfo( infoCode );
}
@Override
public String toJSONString() {
return this.toString();
}
public String toString () {
String key = null;
String stateVal = this.isSuccess() ? AppInfo.getStateInfo( AppInfo.SUCCESS ) : this.info;
StringBuilder builder = new StringBuilder();
builder.append( "{\"state\": \"" + stateVal + "\"" );
Iterator<String> iterator = this.infoMap.keySet().iterator();
while ( iterator.hasNext() ) {
key = iterator.next();
builder.append( ",\"" + key + "\": \"" + this.infoMap.get(key) + "\"" );
}
builder.append( "}" );
return Encoder.toUnicode( builder.toString() );
}
@Override
public void putInfo(String name, String val) {
this.infoMap.put(name, val);
}
@Override
public void putInfo(String name, long val) {
this.putInfo(name, val+"");
}
}
package org.ccpit.ueditor.define;
import java.util.HashMap;
import java.util.Map;
public class FileType {
public static final String JPG = "JPG";
private static final Map<String, String> types = new HashMap<String, String>(){{
put( FileType.JPG, ".jpg" );
}};
public static String getSuffix ( String key ) {
return FileType.types.get( key );
}
/**
* 根据给定的文件名,获取其后缀信息
* @param filename
* @return
*/
public static String getSuffixByFilename ( String filename ) {
return filename.substring( filename.lastIndexOf( "." ) ).toLowerCase();
}
}
package org.ccpit.ueditor.hunter;
import java.io.File;
import java.util.Arrays;
import java.util.Collection;
import java.util.Map;
import org.apache.commons.io.FileUtils;
import org.ccpit.ueditor.PathFormat;
import org.ccpit.ueditor.define.AppInfo;
import org.ccpit.ueditor.define.BaseState;
import org.ccpit.ueditor.define.MultiState;
import org.ccpit.ueditor.define.State;
public class FileManager {
private String dir = null;
private String rootPath = null;
private String[] allowFiles = null;
private int count = 0;
public FileManager ( Map<String, Object> conf ) {
this.rootPath = (String)conf.get( "rootPath" );
this.dir = this.rootPath + (String)conf.get( "dir" );
this.allowFiles = this.getAllowFiles( conf.get("allowFiles") );
this.count = (Integer)conf.get( "count" );
}
public State listFile ( int index ) {
File dir = new File( this.dir );
State state = null;
if ( !dir.exists() ) {
return new BaseState( false, AppInfo.NOT_EXIST );
}
if ( !dir.isDirectory() ) {
return new BaseState( false, AppInfo.NOT_DIRECTORY );
}
Collection<File> list = FileUtils.listFiles( dir, this.allowFiles, true );
if ( index < 0 || index > list.size() ) {
state = new MultiState( true );
} else {
Object[] fileList = Arrays.copyOfRange( list.toArray(), index, index + this.count );
state = this.getState( fileList );
}
state.putInfo( "start", index );
state.putInfo( "total", list.size() );
return state;
}
private State getState ( Object[] files ) {
MultiState state = new MultiState( true );
BaseState fileState = null;
File file = null;
for ( Object obj : files ) {
if ( obj == null ) {
break;
}
file = (File)obj;
fileState = new BaseState( true );
fileState.putInfo( "url", PathFormat.format( this.getPath( file ) ) );
state.addState( fileState );
}
return state;
}
private String getPath ( File file ) {
String path = file.getAbsolutePath();
return path.replace( this.rootPath, "/" );
}
private String[] getAllowFiles ( Object fileExt ) {
String[] exts = null;
String ext = null;
if ( fileExt == null ) {
return new String[ 0 ];
}
exts = (String[])fileExt;
for ( int i = 0, len = exts.length; i < len; i++ ) {
ext = exts[ i ];
exts[ i ] = ext.replace( ".", "" );
}
return exts;
}
}
package org.ccpit.ueditor.hunter;
import java.net.HttpURLConnection;
import java.net.InetAddress;
import java.net.URL;
import java.net.UnknownHostException;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import org.ccpit.ueditor.PathFormat;
import org.ccpit.ueditor.define.AppInfo;
import org.ccpit.ueditor.define.BaseState;
import org.ccpit.ueditor.define.MIMEType;
import org.ccpit.ueditor.define.MultiState;
import org.ccpit.ueditor.define.State;
import org.ccpit.ueditor.upload.StorageManager;
/**
* 图片抓取器
* @author hancong03@baidu.com
*
*/
public class ImageHunter {
private String filename = null;
private String savePath = null;
private String rootPath = null;
private List<String> allowTypes = null;
private long maxSize = -1;
private List<String> filters = null;
public ImageHunter ( Map<String, Object> conf ) {
this.filename = (String)conf.get( "filename" );
this.savePath = (String)conf.get( "savePath" );
this.rootPath = (String)conf.get( "rootPath" );
this.maxSize = (Long)conf.get( "maxSize" );
this.allowTypes = Arrays.asList( (String[])conf.get( "allowFiles" ) );
this.filters = Arrays.asList( (String[])conf.get( "filter" ) );
}
public State capture ( String[] list ) {
MultiState state = new MultiState( true );
for ( String source : list ) {
state.addState( captureRemoteData( source ) );
}
return state;
}
public State captureRemoteData ( String urlStr ) {
HttpURLConnection connection = null;
URL url = null;
String suffix = null;
try {
url = new URL( urlStr );
if ( !validHost( url.getHost() ) ) {
return new BaseState( false, AppInfo.PREVENT_HOST );
}
connection = (HttpURLConnection) url.openConnection();
connection.setInstanceFollowRedirects( true );
connection.setUseCaches( true );
if ( !validContentState( connection.getResponseCode() ) ) {
return new BaseState( false, AppInfo.CONNECTION_ERROR );
}
suffix = MIMEType.getSuffix( connection.getContentType() );
if ( !validFileType( suffix ) ) {
return new BaseState( false, AppInfo.NOT_ALLOW_FILE_TYPE );
}
if ( !validFileSize( connection.getContentLength() ) ) {
return new BaseState( false, AppInfo.MAX_SIZE );
}
String savePath = this.getPath( this.savePath, this.filename, suffix );
String physicalPath = this.rootPath + savePath;
State state = StorageManager.saveFileByInputStream( connection.getInputStream(), physicalPath );
if ( state.isSuccess() ) {
state.putInfo( "url", PathFormat.format( savePath ) );
state.putInfo( "source", urlStr );
}
return state;
} catch ( Exception e ) {
return new BaseState( false, AppInfo.REMOTE_FAIL );
}
}
private String getPath ( String savePath, String filename, String suffix ) {
return PathFormat.parse( savePath + suffix, filename );
}
private boolean validHost ( String hostname ) {
try {
InetAddress ip = InetAddress.getByName(hostname);
if (ip.isSiteLocalAddress()) {
return false;
}
} catch (UnknownHostException e) {
return false;
}
return !filters.contains( hostname );
}
private boolean validContentState ( int code ) {
return HttpURLConnection.HTTP_OK == code;
}
private boolean validFileType ( String type ) {
return this.allowTypes.contains( type );
}
private boolean validFileSize ( int size ) {
return size < this.maxSize;
}
}
package org.ccpit.ueditor.upload;
import java.util.Map;
import org.apache.commons.codec.binary.Base64;
import org.ccpit.ueditor.PathFormat;
import org.ccpit.ueditor.define.AppInfo;
import org.ccpit.ueditor.define.BaseState;
import org.ccpit.ueditor.define.FileType;
import org.ccpit.ueditor.define.State;
public final class Base64Uploader {
public static State save(String content, Map<String, Object> conf) {
byte[] data = decode(content);
long maxSize = ((Long) conf.get("maxSize")).longValue();
if (!validSize(data, maxSize)) {
return new BaseState(false, AppInfo.MAX_SIZE);
}
String suffix = FileType.getSuffix("JPG");
String savePath = PathFormat.parse((String) conf.get("savePath"),
(String) conf.get("filename"));
savePath = savePath + suffix;
String physicalPath = (String) conf.get("rootPath") + savePath;
State storageState = StorageManager.saveBinaryFile(data, physicalPath);
if (storageState.isSuccess()) {
storageState.putInfo("url", PathFormat.format(savePath));
storageState.putInfo("type", suffix);
storageState.putInfo("original", "");
}
return storageState;
}
private static byte[] decode(String content) {
return Base64.decodeBase64(content);
}
private static boolean validSize(byte[] data, long length) {
return data.length <= length;
}
}
\ No newline at end of file
package org.ccpit.ueditor.upload;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.fileupload.FileItemIterator;
import org.apache.commons.fileupload.FileItemStream;
import org.apache.commons.fileupload.FileUploadException;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.fileupload.servlet.ServletFileUpload;
import org.ccpit.ueditor.PathFormat;
import org.ccpit.ueditor.define.AppInfo;
import org.ccpit.ueditor.define.BaseState;
import org.ccpit.ueditor.define.FileType;
import org.ccpit.ueditor.define.State;
public class BinaryUploader {
public static final State save(HttpServletRequest request,
Map<String, Object> conf) {
FileItemStream fileStream = null;
boolean isAjaxUpload = request.getHeader( "X_Requested_With" ) != null;
if (!ServletFileUpload.isMultipartContent(request)) {
return new BaseState(false, AppInfo.NOT_MULTIPART_CONTENT);
}
ServletFileUpload upload = new ServletFileUpload(
new DiskFileItemFactory());
if ( isAjaxUpload ) {
upload.setHeaderEncoding( "UTF-8" );
}
try {
FileItemIterator iterator = upload.getItemIterator(request);
while (iterator.hasNext()) {
fileStream = iterator.next();
if (!fileStream.isFormField())
break;
fileStream = null;
}
if (fileStream == null) {
return new BaseState(false, AppInfo.NOTFOUND_UPLOAD_DATA);
}
String savePath = (String) conf.get("savePath");
String originFileName = fileStream.getName();
String suffix = FileType.getSuffixByFilename(originFileName);
originFileName = originFileName.substring(0,
originFileName.length() - suffix.length());
savePath = savePath + suffix;
long maxSize = ((Long) conf.get("maxSize")).longValue();
if (!validType(suffix, (String[]) conf.get("allowFiles"))) {
return new BaseState(false, AppInfo.NOT_ALLOW_FILE_TYPE);
}
savePath = PathFormat.parse(savePath, originFileName);
String physicalPath = (String) conf.get("rootPath") + savePath;
InputStream is = fileStream.openStream();
State storageState = StorageManager.saveFileByInputStream(is,
physicalPath, maxSize);
is.close();
if (storageState.isSuccess()) {
storageState.putInfo("url", PathFormat.format(savePath));
storageState.putInfo("type", suffix);
storageState.putInfo("original", originFileName + suffix);
}
return storageState;
} catch (FileUploadException e) {
return new BaseState(false, AppInfo.PARSE_REQUEST_ERROR);
} catch (IOException e) {
}
return new BaseState(false, AppInfo.IO_ERROR);
}
private static boolean validType(String type, String[] allowTypes) {
List<String> list = Arrays.asList(allowTypes);
return list.contains(type);
}
}
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
">
<!-- 启动自动扫描 该包下所有的Bean
<context:component-scan base-package="org.ccpit" name-generator="org.ccpit.base.utils.SpringBeanNameGenerator"/>-->
<context:component-scan base-package="org.ccpit" />
<!-- 基于注释的事务,当注释中发现@Transactional时,使用id为“transactionManager”的事务管理器 -->
<!-- 如果没有设置transaction-manager的值,则spring以缺省默认的事务管理器来处理事务,默认事务管理器为第一个加载的事务管理器 -->
<tx:annotation-driven transaction-manager="transactionManager" proxy-target-class="true"/>
<!-- 静态资源过滤 -->
<mvc:annotation-driven/>
<mvc:default-servlet-handler/>
<!-- json转换接口配置,spring mvc提供 -->
<bean id="mappingJacksonHttpMessageConverter" class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
<property name="supportedMediaTypes">
<list>
<value>text/html;charset=UTF-8</value> <!-- 避免IE出现下载JSON文件的情况 -->
</list>
</property>
<property name="objectMapper">
<bean class="com.fasterxml.jackson.databind.ObjectMapper">
<!-- 处理responseBody 里面日期类型 -->
<property name="dateFormat">
<bean class="java.text.SimpleDateFormat">
<constructor-arg type="java.lang.String" value="yyyy-MM-dd HH:mm:ss" />
</bean>
</property>
<!-- 为null字段时不显示 -->
<property name="serializationInclusion">
<value type="com.fasterxml.jackson.annotation.JsonInclude.Include">NON_NULL</value>
</property>
</bean>
</property>
</bean>
<!-- 启动Spring MVC的注解功能,完成请求和注解POJO的映射 -->
<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
<property name="messageConverters">
<list>
<ref bean="mappingJacksonHttpMessageConverter" /><!-- json转换器 -->
</list>
</property>
</bean>
<!-- 定义视图解析器 -->
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix">
<value>/WEB-INF/jsp/</value>
</property>
<property name="suffix">
<value>.jsp</value>
</property>
</bean>
<!-- 过滤器 -->
<mvc:interceptors>
<mvc:interceptor>
<mvc:mapping path="/admin/**"/>
<bean class="org.ccpit.base.security.SecurityInterceptor"></bean>
</mvc:interceptor>
</mvc:interceptors>
</beans>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://ehcache.org/ehcache.xsd">
<diskStore path="java.io.tmpdir"/>
<!--
name:缓存名称。
maxElementsInMemory:缓存最大个数。
eternal:对象是否永久有效,一但设置了,timeout将不起作用。
timeToIdleSeconds:设置对象在失效前的允许闲置时间(单位:秒)。仅当eternal=false对象不是永久有效时使用,可选属性,默认值是0,也就是可闲置时间无穷大。
timeToLiveSeconds:设置对象在失效前允许存活时间(单位:秒)。最大时间介于创建时间和失效时间之间。仅当eternal=false对象不是永久有效时使用,默认是0.,也就是对象存活时间无穷大。
overflowToDisk:当内存中对象数量达到maxElementsInMemory时,Ehcache将会对象写到磁盘中。
diskSpoolBufferSizeMB:这个参数设置DiskStore(磁盘缓存)的缓存区大小。默认是30MB。每个Cache都应该有自己的一个缓冲区。
maxElementsOnDisk:硬盘最大缓存个数。
diskPersistent:是否缓存虚拟机重启期数据 Whether the disk store persists between restarts of the Virtual Machine. The default value is false.
diskExpiryThreadIntervalSeconds:磁盘失效线程运行时间间隔,默认是120秒。
memoryStoreEvictionPolicy:当达到maxElementsInMemory限制时,Ehcache将会根据指定的策略去清理内存。默认策略是LRU(最近最少使用)。你可以设置为FIFO(先进先出)或是LFU(较少使用)。
clearOnFlush:内存数量最大时是否清除。
-->
<defaultCache
maxElementsInMemory="10000"
eternal="false"
timeToIdleSeconds="120"
timeToLiveSeconds="120"
overflowToDisk="true"
maxElementsOnDisk="10000000"
diskPersistent="false"
diskExpiryThreadIntervalSeconds="120"
memoryStoreEvictionPolicy="LRU"
/>
</ehcache>
# jdbc.X
jdbc.driverClassName=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/registration?createDatabaseIfNotExist=true&characterEncoding=utf-8
jdbc.user=ccpit
jdbc.pass=ccpit1516
# hibernate.X
hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
hibernate.show_sql=false
hibernate.hbm2ddl.auto=update
#email
email.name=passwordcdcs@ccpit.org
email.password=Ccoic208
email.smtp=smtp.exmail.qq.com
This source diff could not be displayed because it is too large. You can view the blob instead.
<%--
Created by IntelliJ IDEA.
User: sqp
Date: 2015-11-10
Time: 14:11
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title></title>
</head>
<body>
</body>
</html>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="security" uri="http://www.ccpit.org/" %>
<!DOCTYPE html>
<html>
<head>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="chrome=1,IE=9">
<meta charset="utf-8">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="Cache-Control" content="no-cache, must-revalidate">
<meta http-equiv="expires" content="0">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>研考恢复管理列表界面</title>
<link href="<c:url value='/resource/themes-1.3.1/default/easyui.css'/>" rel="stylesheet" type="text/css"/>
<link href="<c:url value='/resource/themes-1.3.1/icon.css' />" rel="stylesheet" type="text/css"/>
<link href="<c:url value='/resource/themes-1.3.1/css/default.css'/>" rel="stylesheet" type="text/css" />
<style type="text/css">
.edittable{
width:80%;
margin-left:20%;
margin:0 auto;
}
.props >div{
width:50%;
float:left;
height:35px;
}
.props>div>label{
display:block;
}
.props>div>label,
.props>div>div{
display:inline;
zoom:1;
}
.edittable .actions{
clear:both;
display:block;
margin:0 auto;
padding-top:20px;
}
.dropable{
overflow-y: auto;
}
.dropable .block{
padding:5px;
width:200px;
margin:5px 0;
}
.dropable .block:hover{
background-color:#F0F0F0;
}
.dropable .block+.block{
border-top:1px dashed;
}
.search-con .block,
.block>div{
display:inline-block;
display:inline;
zoom:1;
}
.dropable .ele{
margin-left:10px;
float:right;
}
.dropable .ele a{
border:1px solid #ccc;
cursor:pointer;
width: 15px;
text-align: center;
display: inline-block;
display:inline;
zoom:1;
}
.dropable .ele a+a{
margin-left:5px;
}
.quick-export{
margin:10px 0;
}
.quick-export a.exp-btn{
border:1px solid #ccc;
padding:2px 5px;
cursor:pointer;
background-color:#EAEAEA;
border-radius:10px;
}
.quick-export a.exp-btn:hover{
background-color:#FFF;
}
</style>
</head>
<body style="overflow:hidden">
<div class="easyui-panel" id="queryDiv" title="资讯查询" collapsed="false" collapsible="false">
<form method="post" id="queryFormId" name="queryForm">
<table>
<tr>
<td width="10%" align="right"><span>主题:</span></td>
<td align="left"><input id="title00Id" class="easyui-textbox" /></td>
<td width="10%" align="right"><span>内容:</span></td>
<td align="left"><input id="content00Id" class="easyui-textbox" /></td>
<td width="10%" align="right"><span>收件人:</span></td>
<td align="left"><input id="recipients00Id" class="easyui-textbox"/></td>
</tr>
<tr>
<td align="center" colspan="6">
<a id="saveButtonId01" href="#" class="easyui-linkbutton" iconCls="icon-search" onclick="queryData()">查询</a>
<a id="saveButtonId02" href="#" class="easyui-linkbutton" iconCls="icon-undo" onclick="clearQueryForm()">清空</a>
</td>
</tr>
</table>
</form>
</div>
<!-- datagrid列表 -->
<table id="registersTable" toolbar="#toolbar" key="newsList" title="角色列表"
width="98%" singleSelect="false">
</table>
<script src="<c:url value='/resource/home/js/jquery-1.6.min.js' />"></script>
<script src="<c:url value='/resource/home/js/jquery.easyui.min.js'/>"></script>
<script src="/resource/common.js" type="text/javascript"></script>
<script src="<c:url value='/resource/locale/easyui-lang-zh_CN.js'/>"></script>
<script type="text/javascript" src="/resource/business/email.js"></script>
</body>
</html>
\ No newline at end of file
<%--
Created by IntelliJ IDEA.
User: sqp
Date: 2015-11-12
Time: 11:27
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<!DOCTYPE html>
<head>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="chrome=1,IE=9">
<meta charset="utf-8">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="Cache-Control" content="no-cache, must-revalidate">
<meta http-equiv="expires" content="0">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>未开放注册页面</title>
<link href="/resource/front/css/style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="wrapper">
<div id="top"><IMG src="/resource/front/img/banner.png" width=1024 height=204 ></div>
<div class="pp"></div>
<table width="" border="0" cellpadding="0" cellspacing="0" style="width:100%;min-height:600px;">
<div style="padding-left:20px;">对不起,您访问的页面尚未开放。</div>
</table>
<div class="pp">
</div>
<div id="foot">
<p>&copy;版权所有:中国国际贸易促进委员会(中国国际商会)培训中心 &nbsp;地址:北京市西城区桦皮厂胡同2号国际商会大厦2层 邮编:100035电话:010-82217206 传真:010-82217272<br>
邮箱:training@ccpit.org &nbsp;技术支持:中贸促信息技术有限责任公司</p>
</div>
</div>
</body>
</html>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="security" uri="http://www.ccpit.org/" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>
<head>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="chrome=1,IE=edge">
<meta charset="utf-8">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="Cache-Control" content="no-cache, must-revalidate">
<meta http-equiv="expires" content="0">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>培训中心报名系统</title>
<link href="<c:url value='/resource/themes-1.3.1/default/easyui.css'/>" rel="stylesheet" type="text/css"/>
<link href="<c:url value='/resource/themes-1.3.1/icon.css' />" rel="stylesheet" type="text/css"/>
<link href="<c:url value='/resource/themes-1.3.1/css/default.css'/>" rel="stylesheet" type="text/css"/>
<script src="<c:url value='/resource/home/js/jquery-1.6.min.js' />"></script>
<!-- jQuery v@1.8.0 -->
<script src="<c:url value='/resource/jquery.easyui.min.js'/>"></script>
<!-- jQuery EasyUI 1.4.3 -->
<script src="<c:url value='/resource/home/js/home.js'/>" type="text/javascript"></script>
<script src="<c:url value='/resource/home/js/outlook2.js'/>" async="async" type="text/javascript"></script>
</head>
<body class="easyui-layout" style="overflow-y: hidden" scroll="no">
<%-- <noscript>
<div style="position: absolute; z-index: 100000; height: 1046px; top: 0px; left: 0px; width: 100%; background: white; text-align: center;">
<img src="<c:url value='/resource/home/images/noscript.gif'/>" alt='抱歉,请开启脚本支持!' />
</div>
</noscript> --%>
<div id="topHurdleID" region="north" split="true" border="false">
<span style="float: right; padding-right: 20px;" class="head">欢迎您:
<font style="font-weight:bold">${user_in_session.username}</font><a style="text-decoration:none;color:#000000;font-weight:bold" href="#" id="editpass" >&nbsp;&nbsp;修改密码</a> <a style="font-weight:bold;text-decoration:none;color:red" href="#" id="loginOut">安全退出</a>
</span>
<div align="center"><span style="font-size: 16px;"><img src="<c:url value='/resource/home/images/homeTop_b20.png'/>" width="20" height="20" align="absmiddle" />&emsp;培训中心报名管理平台</span></div>
</div>
<div region="south" split="true" style="height: 30px; background: #D2E0F2;">
<div class="footer">技术支持: <a href="#">中贸促信息技术有限责任公司</a></div>
</div>
<div region="west" hide="true" split="true" title="导航菜单" style="width: 180px;" id="west">
<div id="nav" class="easyui-accordion" fit="true" border="false">
<!-- 导航内容 -->
<ul >
<security:url uri="/admin/org/goinOrgListPage"><li><div><a ref="11" href="#" rel="/admin/org/goinOrgListPage" ><span class="icon icon-sys" >&nbsp;</span><span class="nav">机构管理</span></a></div></li></security:url>
<security:url uri="/admin/user/queryAllUser"><li><div><a ref="12" href="#" rel="/admin/user/queryAllUser" ><span class="icon icon-users" >&nbsp;</span><span class="nav">用户管理</span></a></div></li></security:url>
<security:url uri="/admin/role/goinRoleListPage"><li><div><a ref="13" href="#" rel="/admin/role/goinRoleListPage" ><span class="icon icon-role" >&nbsp;</span><span class="nav">角色管理</span></a></div></li></security:url>
<security:url uri="/admin/privilegeManage/goinPriListPage"><li><div><a ref="14" href="#" rel="/admin/privilegeManage/goinPriListPage" ><span class="icon icon-privilege" >&nbsp;</span><span class="nav">权限管理</span></a></div></li></security:url>
<security:url uri="/admin/privilegeManage/goRolePriListPage"><li><div><a ref="15" href="#" rel="/admin/privilegeManage/goRolePriListPage" ><span class="icon icon-allotRole" >&nbsp;</span><span class="nav">角色权限分配</span></a></div></li></security:url>
<security:url uri="/admin/metadataManage/goinMetadataListPage"><li><div><a ref="16" href="#" rel="/admin/metadataManage/goinMetadataListPage" ><span class="icon icon-database" >&nbsp;</span><span class="nav">数据字典管理</span></a></div></li></security:url>
</ul>
<ul>
<security:url uri="/admin/business/registerManage/goinRegisterInfoListPage"><li><div><a ref="21" href="#" rel="/admin/business/registerManage/goinRegisterInfoListPage" ><span class="icon icon-nav" >&nbsp;</span><span class="nav">报名管理</span></a></div></li></security:url>
<security:url uri="/admin/business/registerManage/goinRegisterInfoExtListPage"><li><div><a ref="21" href="#" rel="/admin/business/registerManage/goinRegisterInfoExtListPage" ><span class="icon icon-nav" >&nbsp;</span><span class="nav">延考恢复管理</span></a></div></li></security:url>
<security:url uri="/admin/business/phaseManage/page"><li><div><a ref="21" href="#" rel="/admin/business/phaseManage/page" ><span class="icon icon-nav" >&nbsp;</span><span class="nav">报名期数管理</span></a></div></li></security:url>
</ul>
<ul>
<security:url uri="/admin/logManage/goinLogInfoListPage"><li><div><a ref="31" rel="/business/EmailManage/goinEmailPage" ><span class="icon icon-log" >&nbsp;</span><span class="nav">邮件管理</span></a></div></li></security:url>
<security:url uri="/admin/logManage/goinLogInfoListPage"><li><div><a ref="31" rel="/admin/logManage/goinLogInfoListPage" ><span class="icon icon-log" >&nbsp;</span><span class="nav">统计日志</span></a></div></li></security:url>
</ul>
</div>
</div>
<div id="mainPanle" region="center" style="background: #eee; overflow-y: hidden">
<div id="tabs" class="easyui-tabs" fit="true" border="false">
<div title="欢迎使用"
style="padding: 20px; overflow: hidden; color: red;">
<div align="center"><h1 style="font-size: 24px;">欢迎使用培训中心报名管理平台</h1></div>
</div>
</div>
</div>
<!-- <div region="east" title="其他" split="true"
style="width: 180px; overflow: hidden;">
<div class="easyui-calendar"></div>
</div> -->
<!--修改密码窗口-->
<div id="w" class="easyui-window" title="修改密码" >
<table width="100%">
<tr>
<td>&emsp;</td>
</tr>
<tr>
<td align="right">&ensp;&ensp;码:</td>
<td><input id="txtNewPass" type="Password" style="width:180px" /></td>
</tr>
<tr>
<td align="right">确认密码:</td>
<td><input id="txtRePass" type="Password" style="width:180px" /></td>
</tr>
<tr>
<td>&emsp;</td>
</tr>
<tr>
<td colspan="2" align="center">
<a href="#" id="btnEp" class="easyui-linkbutton" data-options="size:'50',iconCls:'icon-save'" >保存</a>
<a href="#" id="btnCancel" class="easyui-linkbutton" data-options="iconCls:'icon-cancel'">取消</a>
</td>
</tr>
</table>
</div>
<div id="mm" class="easyui-menu" style="width: 150px;">
<div id="mm-tabupdate">刷新</div>
<div class="menu-sep"></div>
<div id="mm-tabclose">关闭</div>
<div id="mm-tabcloseall">全部关闭</div>
<div id="mm-tabcloseother">除此之外全部关闭</div>
<div class="menu-sep"></div>
<div id="mm-tabcloseright">当前页右侧全部关闭</div>
<div id="mm-tabcloseleft">当前页左侧全部关闭</div>
<div class="menu-sep"></div>
<div id="mm-exit">退出</div>
</div>
</body>
</html>
\ No newline at end of file
<%--
Created by IntelliJ IDEA.
User: sqp
Date: 2015/10/13
Time: 9:21
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="chrome=1,IE=edge">
<meta charset="UTF-8">
<title>ERROR</title>
<link rel="stylesheet" href="/resource/front/c/style.css">
</head>
<body>
<div class="main w cf">
<div style="font-size:150px;color:red;text-align:center;text-shadow:0 0 10px #ccc;font-family:Simhei;font-weight:bold">404</div>
<div class="error-title">Oops! Page Not Found...</div>
<div class="error-body">The page you requested cannot be found. It is possible that the page has been moved or is no longer available. We apologize for the inconvenience.</div>
<div class="error-title">出错了...</div>
<div class="error-body">您访问的页面不存在或因太久远而被删除了,请检查网址的正确性或返回<a href="/" target="_self">首页</a></div>
<!-- main end -->
</div>
</body>
</html>
<script src="/resource/front/j/jquery-1.7.2.min.js"></script>
<script src="/resource/front/j/slider.js"></script>
<script src="/resource/front/j/public.js"></script>
<%--
Created by IntelliJ IDEA.
User: sqp
Date: 2015-11-10
Time: 14:55
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title></title>
</head>
<body>
<jsp:forward page="/training/loginp"></jsp:forward>
</body>
</html>
[{
"id":"cityType",
"text":"城市类别"
},{
"id":"encityType",
"text":"城市类别(英)"
},{
"id":"status",
"text":"报名及补考信息状态"
},{
"id":"status2",
"text":"延考及恢复信息状态"
},{
"id":"invoiceType",
"text":"发票类型"
},{
"id":"subject",
"text":"考试科目"
},{
"id":"subject2",
"text":"延考及恢复考试科目"
},{
"id":"registerType",
"text":"报名类型"
},{
"id":"appreciationTaxType",
"text":"增值税发票"
},{
"id":"gender",
"text":"性别"
},{
"id":"engender",
"text":"性别(英)"
}]
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
<?xml version="1.0" encoding="utf-8"?>
<project name="lplib.build" default="build" basedir=".">
<property name="tools.dir" location="../../tools"/>
<property name="build.dir" location="./"/>
<property name="des.dir" location="./"/>
<property name="charset" value="UTF-8"/>
<target name="build" depends="prepare,compress,native2ascii">
</target>
<target name="prepare">
<delete>
<fileset dir="${des.dir}" includes="**/*-min.js"/>
</delete>
</target>
<!-- 用 YUICompressor 压缩 js -->
<target name="compress">
<apply executable="java" verbose="true" dest="${des.dir}">
<fileset dir="${des.dir}" includes="**/*.js"/>
<arg line="-jar"/>
<arg path="${tools.dir}/yuicompressor.jar"/>
<arg line="--charset utf-8"/>
<srcfile/>
<arg line="-o"/>
<targetfile/>
<mapper type="regexp" from="^(.*)\.(js)$" to="\1-min.\2"/>
</apply>
</target>
<target name="native2ascii" depends="compress">
<mkdir dir="${build.dir}/tmp"/>
<move todir="${build.dir}/tmp">
<fileset dir="${des.dir}" includes="*-min.js"/>
</move>
<native2ascii encoding="${charset}"
src="${build.dir}/tmp"
dest="${des.dir}"
includes="*.js"/>
<delete dir="${build.dir}/tmp"/>
</target>
<!---->
</project>
\ No newline at end of file
(function(f){var d="",e="/assets/js";function a(h){if(!/:/.test(h)){return true}}function c(h){if(a(h)){var i=b();return i+"/"+h}return h}function b(){var h=location.href,i;h=h.replace(/\?.*$/,"").replace(/\#.*$/,"");i=h.lastIndexOf("/");return h.substring(0,i)}function g(){var h=f("script"),i="";f.each(h,function(k,j){var l=j.src,m=l.indexOf(e+"/config");if(m!==-1){i=l.substring(0,m);return false}});return c(i)}if(!d){d=g()}BUI.config({alias:{common:d+e+"/common",module:d+e+"/module"},map:[[/module\/(.*)-min.js/,"module/$1.js"]]})})(jQuery);
(function ($) {
var baseUrl = '', //网站的根目录地址,发布到线上时使用
jsBase = '/assets/js';
function isRelative(url){
if(!/:/.test(url)){
return true;
}
}
function formatUrl(url){
if(isRelative(url)){
var path = getCurrentPath();
return path +'/'+ url;
}
return url;
}
function getCurrentPath(){
var url = location.href,
lastIndex;
url = url.replace(/\?.*$/,'').replace(/\#.*$/,'');
lastIndex = url.lastIndexOf('/');
return url.substring(0,lastIndex);
}
function getBaseUrl(){ //根据config.js的路径取baseUrl
var scripts = $('script'),
rst = '';
$.each(scripts,function(index,script){
var src = script.src,
lastIndex = src.indexOf(jsBase + '/config');
if(lastIndex !== -1){
rst = src.substring(0,lastIndex);
return false;
}
});
return formatUrl(rst);
}
if(!baseUrl){//如果未指定项目路径,进行匹配。
baseUrl = getBaseUrl();
}
BUI.config({
alias : {
'common' : baseUrl + jsBase + '/common',
'module' : baseUrl + jsBase + '/module'
},/**/
map : [ //调试环境下使用'*.js',如果发布上线前,使用*-min.js去掉下面的map
//[/common\/(.*)-min.js/,'common/$1.js'],
[/module\/(.*)-min.js/,'module/$1.js']
]
});
})(jQuery);
\ No newline at end of file
/**
* @fileOverview \u7f16\u8f91\u5668\u547d\u540d\u7a7a\u95f4\u5165\u53e3
* @ignore
*/define("bui/editor",["bui/common","bui/form","bui/editor/editor","bui/editor/record","bui/editor/dialog"],function(e){var t=e("bui/common"),n=e("bui/form"),r=t.namespace("Editor");return t.mix(r,{Editor:e("bui/editor/editor"),RecordEditor:e("bui/editor/record"),DialogEditor:e("bui/editor/dialog")}),r}),define("bui/editor/mixin",function(e){function t(e){var t=e,n=t.get("controlCfgField"),r=t.get(n),i=t.addChild(r);t.setInternal(n,i)}var n=function(){t(this)};return n.ATTRS={acceptEvent:{value:"autohide"},preventHide:{value:!0},changeSourceEvent:{value:"show triggerchange"},ignoreInputFields:{value:!1},innerValueField:{},emptyValue:{},controlCfgField:{},autoUpdate:{value:!0},events:{value:{accept:!1,cancel:!1}}},n.prototype={__bindUI:function(){var e=this,t=e.get("acceptEvent"),n=e.get("changeSourceEvent");t&&e.on(t,function(){if(e.accept())return;if(e.get("preventHide"))return!1;e.cancel()}),n&&e.on(n,function(){e.setValue(e.getSourceValue()),e.get("visible")&&e.focus()})},getInnerControl:function(){var e=this,t=e.get("children");return t[0]},setValue:function(e){var t=this,n=t.getInnerControl();t.set("editValue",e),t.clearControlValue(),n.set(t.get("innerValueField"),e),e||t.valid()},getValue:function(){var e=this,t=e.getInnerControl();return t.get(e.get("innerValueField"))},isValid:function(){var e=this,t=e.getInnerControl();return t.isValid?t.isValid():!0},valid:function(){var e=this,t=e.getInnerControl();t.valid&&t.valid()},getErrors:function(){var e=this,t=e.getInnerControl();return t.getErrors?t.getErrors():[]},isChange:function(){var e=this,t=e.get("editValue"),n=e.getValue();return t!==n},clearValue:function(){this.clearControlValue(),this.clearErrors()},clearControlValue:function(){var e=this,t=e.getInnerControl();t.set(e.get("innerValueField"),e.get("emptyValue"))},clearErrors:function(){var e=this,t=e.getInnerControl();t.clearErrors()},getSourceValue:function(){},updateSource:function(){},handleNavEsc:function(){this.cancel()},handleNavEnter:function(e){var t=e.target;if(t.tagName==="TEXTAREA")return;t.tagName==="BUTTON"&&$(t).trigger("click"),this.accept()},focus:function(){var e=this,t=e.getInnerControl();t.focus&&t.focus()},accept:function(){var e=this,t;e.valid();if(!e.isValid())return!1;t=e.getValue(),e.get("autoUpdate")&&e.updateSource(t);if(e.fire("beforeaccept",{value:t})==0)return;return e.fire("accept",{value:t,editValue:e.get("editValue")}),e.hide(),!0},cancel:function(){this.fire("cancel"),this.clearValue(),this.hide()}},n}),define("bui/editor/editor",["bui/common","bui/overlay","bui/editor/mixin"],function(e){var t=e("bui/common"),n=e("bui/overlay").Overlay;CLS_TIPS="x-editor-tips",Mixin=e("bui/editor/mixin");var r=n.extend([Mixin],{bindUI:function(){var e=this,t=e.getInnerControl();e.on("validchange",function(t){!e.isValid()&&e.get("visible")?e._showError(e.getErrors()):e._hideError()}),e.on("hide",function(){e._hideError()}),e.on("show",function(){e.isValid()||e._showError(e.getErrors())})},_initOverlay:function(){var e=this,t=new n({children:[{xclass:"simple-list",itemTpl:'<li><span class="x-icon x-icon-mini x-icon-error" title="{error}">!</span>&nbsp;<span>{error}</span></li>'}],elCls:CLS_TIPS,autoRender:!0});return e.set("overlay",t),t},_getErrorList:function(){var e=this,t=e.get("overlay");return t&&t.get("children")[0]},_showError:function(e){var n=this,r=n.get("overlay")||n._initOverlay(),i=n._getErrorList(),s=n.get("errorAlign"),o=t.Array.map(e,function(e){return{error:e}});i.set("items",o),s.node=n.get("el"),r.set("align",s),r.show()},_hideError:function(){var e=this,t=e.get("overlay");t&&t.hide()},getSourceValue:function(){var e=this,t=e.get("curTrigger");return t.text()},updateSource:function(e){var t=this,n=t.get("curTrigger");n&&n.length&&n.text(e)},_uiSetWidth:function(e){var t=this;if(e!=null){var n=t.getInnerControl();n.set&&n.set("width",e)}}},{ATTRS:{innerValueField:{value:"value"},emptyValue:{value:""},autoHide:{value:!0},controlCfgField:{value:"field"},defaultChildCfg:{value:{tpl:"",forceFit:!0,errorTpl:""}},defaultChildClass:{value:"form-field"},align:{value:{points:["tl","tl"]}},errorAlign:{value:{points:["bl","tl"],offset:[0,10]}},overlay:{},field:{value:{}}}},{xclass:"editor"});return r}),define("bui/editor/record",["bui/common","bui/editor/editor"],function(e){var t=e("bui/common"),n=e("bui/editor/editor"),r=n.extend({getSourceValue:function(){return this.get("record")},updateSource:function(e){var n=this,r=n.get("record");t.mix(r,e)},_uiSetRecord:function(e){this.setValue(e)}},{ATTRS:{innerValueField:{value:"record"},acceptEvent:{value:""},emptyValue:{value:{}},autoHide:{value:!1},record:{value:{}},controlCfgField:{value:"form"},form:{value:{}},errorAlign:{value:{points:["tr","tl"],offset:[10,0]}},defaultChildCfg:{valueFn:function(){var e=this;return{xclass:"form",errorTpl:"",showError:!0,showChildError:!0,defaultChildCfg:{elCls:"bui-inline-block",tpl:"",forceFit:!0},buttons:[{btnCls:"button button-primary",text:"\u786e\u5b9a",handler:function(){e.accept()}},{btnCls:"button",text:"\u53d6\u6d88",handler:function(){e.cancel()}}]}}}}},{xclass:"record-editor"});return r}),define("bui/editor/dialog",["bui/overlay","bui/editor/mixin"],function(e){var t=e("bui/overlay").Dialog,n=e("bui/editor/mixin"),r=t.extend([n],{getSourceValue:function(){return this.get("record")},handleNavEnter:function(e){var t=this,n=t.get("success"),r=e.target;if(r.tagName==="TEXTAREA")return;r.tagName==="BUTTON"&&$(r).trigger("click"),n?n.call(t):this.accept()},updateSource:function(e){var t=this,n=t.get("record");BUI.mix(n,e)},_uiSetRecord:function(e){this.setValue(e)}},{ATTRS:{innerValueField:{value:"record"},acceptEvent:{value:""},record:{value:{}},emptyValue:{value:{}},controlCfgField:{value:"form"},changeSourceEvent:{value:""},defaultChildCfg:{value:{xclass:"form-horizontal"}},focusable:{value:!0},success:{value:function(){this.accept()}},form:{value:{}}}},{xclass:"dialog-editor"});return r});
<?xml version="1.0" encoding="utf-8"?>
<project name="lplib.build" default="build" basedir=".">
<property name="tools.dir" location="../../tools"/>
<property name="build.dir" location="./"/>
<property name="des.dir" location="./"/>
<property name="charset" value="UTF-8"/>
<target name="build" depends="prepare,compress,native2ascii">
</target>
<target name="prepare">
<delete>
<fileset dir="${des.dir}" includes="**/*-min.js"/>
</delete>
</target>
<!-- 用 YUICompressor 压缩 js -->
<target name="compress">
<apply executable="java" verbose="true" dest="${des.dir}">
<fileset dir="${des.dir}" includes="**/*.js"/>
<arg line="-jar"/>
<arg path="${tools.dir}/yuicompressor.jar"/>
<arg line="--charset utf-8"/>
<srcfile/>
<arg line="-o"/>
<targetfile/>
<mapper type="regexp" from="^(.*)\.(js)$" to="\1-min.\2"/>
</apply>
</target>
<target name="native2ascii" depends="compress">
<mkdir dir="${build.dir}/tmp"/>
<move todir="${build.dir}/tmp">
<fileset dir="${des.dir}" includes="*-min.js"/>
</move>
<native2ascii encoding="${charset}"
src="${build.dir}/tmp"
dest="${des.dir}"
includes="*.js"/>
<delete dir="${build.dir}/tmp"/>
</target>
<!---->
</project>
\ No newline at end of file
var imagePath = "";
var divHeight = ""; // 查询面板高度
var dataGridWidth = ""; // 查询面板宽度
var dataGridHeight = "";
var bodyWidth = 0;
var bodyHeight = 0;
var editor1 = null;
var operation = "";
var serverIp = "";
var addWinWidth = 0; //新增窗口宽度
var addWinHeight = 0; //新增窗口高度
var languageType = "chinese";
//var status = ['报名成功','缴费成功','书籍发放','DC号','准考证打印','发票寄送','证书寄送'];
var subjectArray = [];
var statusArray = [];
var activePhase;
//var registerTypeArray = ['首次报名','补考报名','延考及恢复'];
var rows=[];
//扩展Date的format方法
Date.prototype.format = function (format) {
var o = {
"M+": this.getMonth() + 1,
"d+": this.getDate(),
"h+": this.getHours(),
"m+": this.getMinutes(),
"s+": this.getSeconds(),
"q+": Math.floor((this.getMonth() + 3) / 3),
"S": this.getMilliseconds()
}
if (/(y+)/.test(format)) {
format = format.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
}
for (var k in o) {
if (new RegExp("(" + k + ")").test(format)) {
format = format.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length));
}
}
return format;
}
$(function() {
divHeight = $("#queryDiv").height();
dataGridWidth = $("#queryDiv").width();
dataGridHeight = divHeight + 45;
bodyWidth = document.body.clientWidth;
bodyHeight = document.documentElement.clientHeight;
addWinWidth = (bodyWidth/100)*80;
addWinHeight = (addWinWidth/16)*9;
//初始状态为关闭
$("#addNewsWinId").window({closed:true});
$("#exportWindow").window({closed:true});
$("#editStatusWinId").window('close');
$("#addEmailInfoWinId").window('close');
$("#emailSendWinId").window('close');
//初始状态是隐藏
$("#newsTypeId01").hide();//无用
$("#newsTypeId02").hide();
//获得相应数据长度
var length1 = 0;
var length2 = 0;
statusArray = new Array(length1);
subjectArray = new Array(length2);
initDataTable();
serverIp = document.location.hostname;
initInputWidth();
initExportWindow();
$.each(subjectArray,function(n,v){
var href = "/admin/business/registerManage/exporgExcel2?phase="+activePhase+"&flagExt=0&subject2=" +(n+6)+
"&fields=submitTime,dcNumber,title,dateOfBirth,gender_en,name_en,company_en,address_en,country,phone,email,city_en,subject2,name,address,invoiceType,invoiceTitle";
var html="<a href='"+href+"' class='exp-btn'>"+v+"</a>";
$(".quick-export").append(html);
})
});
function initInputWidth(){
$("#title00Id").attr("style", "width:" + fixShortWidth() + "px");
$("#content00Id").attr("style", "width:" + fixShortWidth() + "px");
$("#recipients00Id").attr("style", "width:" + fixShortWidth() + "px");
}
function initExportWindow(){
$(".dropable .ele .up").on("click",function(){
$from = $(this).parent().parent();
$to = $from.prev(".block");
if($to.length>0){
$to.insertAfter($from);
}
});
$(".dropable .ele .down").on("click",function(){
$from = $(this).parent().parent();
$to = $from.next(".block");
if($to.length>0){
$to.insertBefore($from);
}
});
}
function initDataTable(){
var h = document.documentElement.clientHeight;
$("#registersTable").datagrid({
height : h - dataGridHeight,
nowrap : true,
striped : true,
pagination : true,
rownumbers : true,
pageList : [15,20,30,40,50],
autoRowHeight : false,
fitColumns : true,
title : "邮件列表",
queryParams : {
phase:activePhase
},
url : '/business/EmailManage/queryEmail',
columns : [ [ {
field : 'ck',
title : 'id',
width : 15,
checkbox : true
},{
field : 'title',
title : '主题',
align : 'left',
width : 100
}, {
field : 'status',
title : '是否成功',
align : 'center',
width : 50
}, {
field : 'recipients',
title : '收件人',
align : 'center',
width : 300
}, {
field : 'addresser',
title : '发件人',
align : 'center',
width : 100
}, {
field : 'content',
title : '邮件内容',
align : 'center',
width : 400
}, {
field : 'creator',
title : '创建人',
align : 'center',
width : 50
}, {
field : 'createTime',
title : '创建时间',
align : 'center',
width : 100
}] ],
onDblClickRow : function(index, row) { // 双击"任一行"执行
},
onLoadSuccess : function(data) { // 加载成功之后执行
}
});
}
function view(val,row){
return "<a href=\"javascript:viewData("+row.id+")\">"+row.name_en+"</button>";
}
//导出为excel exportExl()
function exportExl(){
var name = $("#name00Id").val();
var status2 = $("#registerStatus200Id").combobox('getValue');
var phase = $("#phaseId").combobox('getValue');
var subject2 = $("#subject200Id").combobox('getValue');
var queryParams = null;
var out ='';
$(".dropable .block").each(function(){
if ($(this).find("input").get(0).checked) {
if (out.length>0) {
out+=",";
};
out+=$(this).find(".ele-name").attr("val");
};
});
name = encodeURI(encodeURI(name));
location.href="/admin/business/registerManage/exporgExcel2?name="+name+"&subject2="+subject2+"&status2="+status2
+"&fields="+out+"&flagExt=0&phase="+phase;
$("#exportWindow").window('close');
}
//查询
function queryData() {
var title = $("#title00Id").val();
var content = $("#content00Id").val();
var recipients = $("#recipients00Id").val();
$("#registersTable").datagrid({
queryParams : {
title:title,
content:content,
recipients:recipients
}
});
}
//清空查询条件
function clearQueryForm(){
$("#queryFormId").form('clear');
}
function formatDateField(selector,val){
console.log(val);
if(val!=''&&val!=undefined&&val!='undefined'){
var d = new Date(parseInt(val));
d.setTime(d.getTime() + 60*60*1000);
$(selector).val(d.format("yyyy-MM-dd"));
$(selector).datebox("setValue",d.format("yyyy-MM-dd"));
}
}
/**
* id数组转换为json字符串
*/
function arrayTojson(arr) {
var jsonIds = "[";
for ( var i = 0; i < arr.length; i++) {
if (i == arr.length - 1) {
jsonIds += arr[i].id;
} else {
jsonIds += arr[i].id + ",";
}
}
jsonIds += "]";
return jsonIds;
}
//设置 long 宽度自适应 相对窗口
function fixLongWidth(){
return addWinWidth*0.66;
}
//设置 short 宽度自适应
function fixShortWidth(){
return addWinWidth*0.284;
}
//关闭窗口
function closeWindow(){
$("#addNewsWinId").window('close');
}
function closeWindow2(){
$("#editStatusWinId").window('close');
}
var addWinWidth = 0; //新增窗口宽度
var addWinHeight = 0; //新增窗口高度
var bodyWidth = 0;
var bodyHeight = 0;
$(function(){
bodyWidth = document.body.clientWidth;
bodyHeight = document.documentElement.clientHeight;
addWinWidth = (bodyWidth/100)*80;
addWinHeight = (addWinWidth/16)*9;
})
/**
* 判断浏览器类型
*/
function judgeBrowser(){
var bro=$.browser;
var browserType = "";
if(bro.msie) {
browserType = "IE";
}
if(bro.mozilla) {
browserType = "Firefox";
}
if(bro.safari) {
browserType = "Safari";
}
if(bro.opera) {
browserType = "Opera";
}
return browserType;
}
/**
* 弹出窗口输入框宽度 长输入框
*/
function fixLongWidth(){
var borwserType = judgeBrowser();
if(borwserType == "IE"){
return addWinWidth*0.76 - 22;
}else if(borwserType == "Firefox"){
return addWinWidth*0.76 - 21;
}else if(borwserType == "Safari"){
return addWinWidth*0.76 - 19;
}else if(borwserType == "Opera"){
return addWinWidth*0.76;
}else {
return addWinWidth*0.76;
}
}
/**
* 弹出窗口输入框宽度 短输入框
*/
function fixShortWidth(){
var borwserType = judgeBrowser();
if(borwserType == "IE"){
return addWinWidth*0.284+3
}else if(borwserType == "Firefox"){
return addWinWidth*0.284+3
}else if(borwserType == "Safari"){
return addWinWidth*0.284+3
}else if(borwserType == "Opera"){
return addWinWidth*0.284+3
}else {
return addWinWidth*0.284+3;
}
}
/**
* 弹出窗口输入项少的,长输入框和小输入框统一确定长度标准
* 小窗口长输入框长度
*/
function smallWinInputLong(){
var borwserType = judgeBrowser();
if(borwserType == "IE"){
return 660*0.841;
}else if(borwserType == "Firefox"){
return 660*0.841;
}else if(borwserType == "Safari"){
return 660*0.841;
}else if(borwserType == "Opera"){
return 660*0.841;
}else {
return 660*0.841;
}
}
/**
* 小窗口短输入框长度
*/
function smallWinInputShort(){
var borwserType = judgeBrowser();
if(borwserType == "IE"){
return 660*0.841;
}else if(borwserType == "Firefox"){
return 660*0.841;
}else if(borwserType == "Safari"){
return 660*0.841;
}else if(borwserType == "Opera"){
return 660*0.841;
}else {
return 660*0.336;
}
}
/**
* 弹出窗口输入项少的,长输入框和小输入框统一确定长度标准
* 小窗口长输入框长度
*/
function smallWinInputLong2(){
var borwserType = judgeBrowser();
if(borwserType == "IE"){
return 836*0.95;
}else if(borwserType == "Firefox"){
return 836*0.95;
}else if(borwserType == "Safari"){
return 836*0.95;
}else if(borwserType == "Opera"){
return 836*0.95;
}else {
return 660*0.95;
}
}
/**
* 小窗口短输入框长度
*/
function smallWinInputShort2(){
var borwserType = judgeBrowser();
if(borwserType == "IE"){
return 836*0.336;
}else if(borwserType == "Firefox"){
return 836*0.336;
}else if(borwserType == "Safari"){
return 836*0.336;
}else if(borwserType == "Opera"){
return 836*0.336;
}else {
return 836*0.282;
}
}
//js时间戳格式化成日期格式
function timestampformat(timestamp) {
var date = new Date(timestamp);
var year = date.getFullYear();
var month = date.getMonth()+1;
var day = date.getDate();
return year+"-"+month+"-"+day;
}
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>AJAX Content</title>
</head>
<body>
<p style="font-size:14px">Here is the content loaded via AJAX.</p>
<ul>
<li>easyui is a collection of user-interface plugin based on jQuery.</li>
<li>easyui provides essential functionality for building modern, interactive, javascript applications.</li>
<li>using easyui you don't need to write many javascript code, you usually defines user-interface by writing some HTML markup.</li>
<li>complete framework for HTML5 web page.</li>
<li>easyui save your time and scales while developing your products.</li>
<li>easyui is very easy but powerful.</li>
</ul>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Accordion Actions - jQuery EasyUI Demo</title>
<link rel="stylesheet" type="text/css" href="../../themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="../../themes/icon.css">
<link rel="stylesheet" type="text/css" href="../demo.css">
<script type="text/javascript" src="../../jquery.min.js"></script>
<script type="text/javascript" src="../../jquery.easyui.min.js"></script>
</head>
<body>
<h2>Accordion Actions</h2>
<p>Click the buttons below to add or remove accordion items.</p>
<div style="margin:20px 0 10px 0;">
<a href="javascript:void(0)" class="easyui-linkbutton" onclick="selectPanel()">Select</a>
<a href="javascript:void(0)" class="easyui-linkbutton" onclick="addPanel()">Add</a>
<a href="javascript:void(0)" class="easyui-linkbutton" onclick="removePanel()">Remove</a>
</div>
<div id="aa" class="easyui-accordion" style="width:500px;height:300px;">
<div title="About" data-options="iconCls:'icon-ok'" style="overflow:auto;padding:10px;">
<h3 style="color:#0099FF;">Accordion for jQuery</h3>
<p>Accordion is a part of easyui framework for jQuery. It lets you define your accordion component on web page more easily.</p>
</div>
</div>
<script type="text/javascript">
function selectPanel(){
$.messager.prompt('Prompt','Please enter the panel title:',function(s){
if (s){
$('#aa').accordion('select',s);
}
});
}
var idx = 1;
function addPanel(){
$('#aa').accordion('add',{
title:'Title'+idx,
content:'<div style="padding:10px">Content'+idx+'</div>'
});
idx++;
}
function removePanel(){
var pp = $('#aa').accordion('getSelected');
if (pp){
var index = $('#aa').accordion('getPanelIndex',pp);
$('#aa').accordion('remove',index);
}
}
</script>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Loading Accordion Content with AJAX - jQuery EasyUI Demo</title>
<link rel="stylesheet" type="text/css" href="../../themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="../../themes/icon.css">
<link rel="stylesheet" type="text/css" href="../demo.css">
<script type="text/javascript" src="../../jquery.min.js"></script>
<script type="text/javascript" src="../../jquery.easyui.min.js"></script>
</head>
<body>
<h2>Loading Accordion Content with AJAX</h2>
<p>Click AJAX panel header to load content via AJAX.</p>
<div style="margin:20px 0 10px 0;"></div>
<div class="easyui-accordion" style="width:500px;height:300px;">
<div title="About" data-options="iconCls:'icon-ok'" style="overflow:auto;padding:10px;">
<h3 style="color:#0099FF;">Accordion for jQuery</h3>
<p>Accordion is a part of easyui framework for jQuery. It lets you define your accordion component on web page more easily.</p>
</div>
<div title="Help" data-options="iconCls:'icon-help'" style="padding:10px;">
<p>The accordion allows you to provide multiple panels and display one or more at a time. Each panel has built-in support for expanding and collapsing. Clicking on a panel header to expand or collapse that panel body. The panel content can be loaded via ajax by specifying a 'href' property. Users can define a panel to be selected. If it is not specified, then the first panel is taken by default.</p>
</div>
<div title="Ajax" data-options="href:'_content.html'" style="padding:10px">
</div>
</div>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Basic Accordion - jQuery EasyUI Demo</title>
<link rel="stylesheet" type="text/css" href="../../themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="../../themes/icon.css">
<link rel="stylesheet" type="text/css" href="../demo.css">
<script type="text/javascript" src="../../jquery.min.js"></script>
<script type="text/javascript" src="../../jquery.easyui.min.js"></script>
</head>
<body>
<h2>Basic Accordion</h2>
<p>Click on panel header to show its content.</p>
<div style="margin:20px 0 10px 0;"></div>
<div class="easyui-accordion" style="width:500px;height:300px;">
<div title="About" data-options="iconCls:'icon-ok'" style="overflow:auto;padding:10px;">
<h3 style="color:#0099FF;">Accordion for jQuery</h3>
<p>Accordion is a part of easyui framework for jQuery. It lets you define your accordion component on web page more easily.</p>
</div>
<div title="Help" data-options="iconCls:'icon-help'" style="padding:10px;">
<p>The accordion allows you to provide multiple panels and display one or more at a time. Each panel has built-in support for expanding and collapsing. Clicking on a panel header to expand or collapse that panel body. The panel content can be loaded via ajax by specifying a 'href' property. Users can define a panel to be selected. If it is not specified, then the first panel is taken by default.</p>
</div>
<div title="TreeMenu" data-options="iconCls:'icon-search'" style="padding:10px;">
<ul class="easyui-tree">
<li>
<span>Foods</span>
<ul>
<li>
<span>Fruits</span>
<ul>
<li>apple</li>
<li>orange</li>
</ul>
</li>
<li>
<span>Vegetables</span>
<ul>
<li>tomato</li>
<li>carrot</li>
<li>cabbage</li>
<li>potato</li>
<li>lettuce</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
</body>
</html>
\ No newline at end of file
{"total":28,"rows":[
{"productid":"FI-SW-01","productname":"Koi","unitcost":10.00,"status":"P","listprice":36.50,"attr1":"Large","itemid":"EST-1"},
{"productid":"K9-DL-01","productname":"Dalmation","unitcost":12.00,"status":"P","listprice":18.50,"attr1":"Spotted Adult Female","itemid":"EST-10"},
{"productid":"RP-SN-01","productname":"Rattlesnake","unitcost":12.00,"status":"P","listprice":38.50,"attr1":"Venomless","itemid":"EST-11"},
{"productid":"RP-SN-01","productname":"Rattlesnake","unitcost":12.00,"status":"P","listprice":26.50,"attr1":"Rattleless","itemid":"EST-12"},
{"productid":"RP-LI-02","productname":"Iguana","unitcost":12.00,"status":"P","listprice":35.50,"attr1":"Green Adult","itemid":"EST-13"},
{"productid":"FL-DSH-01","productname":"Manx","unitcost":12.00,"status":"P","listprice":158.50,"attr1":"Tailless","itemid":"EST-14"},
{"productid":"FL-DSH-01","productname":"Manx","unitcost":12.00,"status":"P","listprice":83.50,"attr1":"With tail","itemid":"EST-15"},
{"productid":"FL-DLH-02","productname":"Persian","unitcost":12.00,"status":"P","listprice":23.50,"attr1":"Adult Female","itemid":"EST-16"},
{"productid":"FL-DLH-02","productname":"Persian","unitcost":12.00,"status":"P","listprice":89.50,"attr1":"Adult Male","itemid":"EST-17"},
{"productid":"AV-CB-01","productname":"Amazon Parrot","unitcost":92.00,"status":"P","listprice":63.50,"attr1":"Adult Male","itemid":"EST-18"}
]}
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Keep Expandable Panel in Accordion - jQuery EasyUI Demo</title>
<link rel="stylesheet" type="text/css" href="../../themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="../../themes/icon.css">
<link rel="stylesheet" type="text/css" href="../demo.css">
<script type="text/javascript" src="../../jquery.min.js"></script>
<script type="text/javascript" src="../../jquery.easyui.min.js"></script>
</head>
<body>
<h2>Keep Expandable Panel in Accordion</h2>
<p>Keep a expandable panel and prevent it from collapsing.</p>
<div style="margin:20px 0 10px 0;"></div>
<div class="easyui-accordion" style="width:500px;height:300px;">
<div title="Top Panel" data-options="iconCls:'icon-search',collapsed:false,collapsible:false" style="padding:10px;">
<input class="easyui-searchbox" prompt="Enter something here" style="width:300px;height:25px;">
</div>
<div title="About" data-options="selected:true" style="padding:10px;">
<h3 style="color:#0099FF;">Accordion for jQuery</h3>
<p>Accordion is a part of easyui framework for jQuery. It lets you define your accordion component on web page more easily.</p>
</div>
<div title="Title1" style="padding:10px">
<p>Content1</p>
</div>
<div title="Title2" style="padding:10px">
<p>Content2</p>
</div>
</div>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Fluid Accordion - jQuery EasyUI Demo</title>
<link rel="stylesheet" type="text/css" href="../../themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="../../themes/icon.css">
<link rel="stylesheet" type="text/css" href="../demo.css">
<script type="text/javascript" src="../../jquery.min.js"></script>
<script type="text/javascript" src="../../jquery.easyui.min.js"></script>
</head>
<body>
<h2>Fluid Accordion</h2>
<p>This example shows how to set the width of accordion to a percentage of its parent container.</p>
<div style="margin:20px 0 10px 0;"></div>
<div class="easyui-accordion" style="width:100%;height:180px;">
<div title="About" data-options="iconCls:'icon-ok'" style="overflow:auto;padding:10px;">
<p>width: 100%</p>
</div>
<div title="Help" data-options="iconCls:'icon-help',href:'_content.html'" style="padding:10px;">
</div>
</div>
<div style="margin:20px 0 10px 0;"></div>
<div class="easyui-accordion" style="width:50%;height:180px;">
<div title="About" data-options="iconCls:'icon-ok'" style="overflow:auto;padding:10px;">
<p>width: 50%</p>
</div>
<div title="Help" data-options="iconCls:'icon-help',href:'_content.html'" style="padding:10px;">
</div>
</div>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Basic Calendar - jQuery EasyUI Demo</title>
<link rel="stylesheet" type="text/css" href="../../themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="../../themes/icon.css">
<link rel="stylesheet" type="text/css" href="../demo.css">
<script type="text/javascript" src="../../jquery.min.js"></script>
<script type="text/javascript" src="../../jquery.easyui.min.js"></script>
</head>
<body>
<h2>Basic Calendar</h2>
<p>Click to select date.</p>
<div style="margin:20px 0"></div>
<div class="easyui-calendar" style="width:250px;height:250px;"></div>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Custom Calendar - jQuery EasyUI Demo</title>
<link rel="stylesheet" type="text/css" href="../../themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="../../themes/icon.css">
<link rel="stylesheet" type="text/css" href="../demo.css">
<script type="text/javascript" src="../../jquery.min.js"></script>
<script type="text/javascript" src="../../jquery.easyui.min.js"></script>
</head>
<body>
<h2>Custom Calendar</h2>
<p>This example shows how to custom the calendar date by using 'formatter' function.</p>
<div style="margin:20px 0"></div>
<div class="easyui-calendar" style="width:250px;height:250px;" data-options="formatter:formatDay"></div>
<script>
var d1 = Math.floor((Math.random()*30)+1);
var d2 = Math.floor((Math.random()*30)+1);
function formatDay(date){
var m = date.getMonth()+1;
var d = date.getDate();
var opts = $(this).calendar('options');
if (opts.month == m && d == d1){
return '<div class="icon-ok md">' + d + '</div>';
} else if (opts.month == m && d == d2){
return '<div class="icon-search md">' + d + '</div>';
}
return d;
}
</script>
<style scoped="scoped">
.md{
height:16px;
line-height:16px;
background-position:2px center;
text-align:right;
font-weight:bold;
padding:0 2px;
color:red;
}
</style>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Disable Calendar Date - jQuery EasyUI Demo</title>
<link rel="stylesheet" type="text/css" href="../../themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="../../themes/icon.css">
<link rel="stylesheet" type="text/css" href="../demo.css">
<script type="text/javascript" src="../../jquery.min.js"></script>
<script type="text/javascript" src="../../jquery.easyui.min.js"></script>
</head>
<body>
<h2>Disable Calendar Date</h2>
<p>This example shows how to disable specified dates, only allows the user to select Mondays.</p>
<div style="margin:20px 0"></div>
<div class="easyui-calendar" style="width:250px;height:250px;" data-options="
validator: function(date){
if (date.getDay() == 1){
return true;
} else {
return false;
}
}
"></div>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>First Day of Week - jQuery EasyUI Demo</title>
<link rel="stylesheet" type="text/css" href="../../themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="../../themes/icon.css">
<link rel="stylesheet" type="text/css" href="../demo.css">
<script type="text/javascript" src="../../jquery.min.js"></script>
<script type="text/javascript" src="../../jquery.easyui.min.js"></script>
</head>
<body>
<h2>First Day of Week</h2>
<p>Choose the first day of the week.</p>
<div style="margin:20px 0">
<select onchange="$('#cc').calendar({firstDay:this.value})">
<option value="0">Sunday</option>
<option value="1">Monday</option>
<option value="2">Tuesday</option>
<option value="3">Wednesday</option>
<option value="4">Thursday</option>
<option value="5">Friday</option>
<option value="6">Saturday</option>
</select>
</div>
<div id="cc" class="easyui-calendar" style="width:250px;height:250px;"></div>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Fluid Calendar - jQuery EasyUI Demo</title>
<link rel="stylesheet" type="text/css" href="../../themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="../../themes/icon.css">
<link rel="stylesheet" type="text/css" href="../demo.css">
<script type="text/javascript" src="../../jquery.min.js"></script>
<script type="text/javascript" src="../../jquery.easyui.min.js"></script>
</head>
<body>
<h2>Fluid Calendar</h2>
<p>This example shows how to set the width of calendar to a percentage of its parent container.</p>
<div style="margin:20px 0"></div>
<div class="easyui-panel" style="width:700px;padding:10px">
<p>width: 50%, height: 250px</p>
<div class="easyui-calendar" style="width:50%;height:250px;"></div>
<p>width: 30%, height: 40%</p>
<div class="easyui-calendar" style="width:30%;height:40%;"></div>
</div>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Combo Animation - jQuery EasyUI Demo</title>
<link rel="stylesheet" type="text/css" href="../../themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="../../themes/icon.css">
<link rel="stylesheet" type="text/css" href="../demo.css">
<script type="text/javascript" src="../../jquery.min.js"></script>
<script type="text/javascript" src="../../jquery.easyui.min.js"></script>
</head>
<body>
<h2>Combo Animation</h2>
<p>Change the animation type when open & close the drop-down panel.</p>
<div style="margin:20px 0">
<span>Animation Type:</span>
<select onchange="changeAnimation(this.value)">
<option>slide</option>
<option>fade</option>
<option>show</option>
</select>
</div>
<select id="cc" style="width:150px"></select>
<script type="text/javascript">
$(function(){
$('#cc').combo();
changeAnimation('slide');
});
function changeAnimation(atype){
$('#cc').combo('panel').panel({
openAnimation:atype,
closeAnimation:(atype=='show'?'hide':atype)
});
}
</script>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Basic Combo - jQuery EasyUI Demo</title>
<link rel="stylesheet" type="text/css" href="../../themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="../../themes/icon.css">
<link rel="stylesheet" type="text/css" href="../demo.css">
<script type="text/javascript" src="../../jquery.min.js"></script>
<script type="text/javascript" src="../../jquery.easyui.min.js"></script>
</head>
<body>
<h2>Basic Combo</h2>
<p>Click the right arrow button to show drop down panel that can be filled with any content.</p>
<div style="margin:20px 0"></div>
<select id="cc" style="width:150px"></select>
<div id="sp">
<div style="color:#99BBE8;background:#fafafa;padding:5px;">Select a language</div>
<div style="padding:10px">
<input type="radio" name="lang" value="01"><span>Java</span><br/>
<input type="radio" name="lang" value="02"><span>C#</span><br/>
<input type="radio" name="lang" value="03"><span>Ruby</span><br/>
<input type="radio" name="lang" value="04"><span>Basic</span><br/>
<input type="radio" name="lang" value="05"><span>Fortran</span>
</div>
</div>
<script type="text/javascript">
$(function(){
$('#cc').combo({
required:true,
editable:false
});
$('#sp').appendTo($('#cc').combo('panel'));
$('#sp input').click(function(){
var v = $(this).val();
var s = $(this).next('span').text();
$('#cc').combo('setValue', v).combo('setText', s).combo('hidePanel');
});
});
</script>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>ComboBox Actions - jQuery EasyUI Demo</title>
<link rel="stylesheet" type="text/css" href="../../themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="../../themes/icon.css">
<link rel="stylesheet" type="text/css" href="../demo.css">
<script type="text/javascript" src="../../jquery.min.js"></script>
<script type="text/javascript" src="../../jquery.easyui.min.js"></script>
</head>
<body>
<h2>ComboBox</h2>
<p>Click the buttons below to perform actions.</p>
<div style="margin:20px 0;">
<a href="javascript:void(0)" class="easyui-linkbutton" onclick="setvalue()">SetValue</a>
<a href="javascript:void(0)" class="easyui-linkbutton" onclick="alert($('#state').combobox('getValue'))">GetValue</a>
<a href="javascript:void(0)" class="easyui-linkbutton" onclick="$('#state').combobox('disable')">Disable</a>
<a href="javascript:void(0)" class="easyui-linkbutton" onclick="$('#state').combobox('enable')">Enable</a>
</div>
<script type="text/javascript">
function setvalue(){
$.messager.prompt('SetValue','Please input the value(CO,NV,UT,etc):',function(v){
if (v){
$('#state').combobox('setValue',v);
}
});
}
</script>
<select id="state" class="easyui-combobox" name="state" style="width:200px;">
<option value="AL">Alabama</option>
<option value="AK">Alaska</option>
<option value="AZ">Arizona</option>
<option value="AR">Arkansas</option>
<option value="CA">California</option>
<option value="CO">Colorado</option>
<option value="CT">Connecticut</option>
<option value="DE">Delaware</option>
<option value="FL">Florida</option>
<option value="GA">Georgia</option>
<option value="HI">Hawaii</option>
<option value="ID">Idaho</option>
<option value="IL">Illinois</option>
<option value="IN">Indiana</option>
<option value="IA">Iowa</option>
<option value="KS">Kansas</option>
<option value="KY">Kentucky</option>
<option value="LA">Louisiana</option>
<option value="ME">Maine</option>
<option value="MD">Maryland</option>
<option value="MA">Massachusetts</option>
<option value="MI">Michigan</option>
<option value="MN">Minnesota</option>
<option value="MS">Mississippi</option>
<option value="MO">Missouri</option>
<option value="MT">Montana</option>
<option value="NE">Nebraska</option>
<option value="NV">Nevada</option>
<option value="NH">New Hampshire</option>
<option value="NJ">New Jersey</option>
<option value="NM">New Mexico</option>
<option value="NY">New York</option>
<option value="NC">North Carolina</option>
<option value="ND">North Dakota</option>
<option value="OH" selected>Ohio</option>
<option value="OK">Oklahoma</option>
<option value="OR">Oregon</option>
<option value="PA">Pennsylvania</option>
<option value="RI">Rhode Island</option>
<option value="SC">South Carolina</option>
<option value="SD">South Dakota</option>
<option value="TN">Tennessee</option>
<option value="TX">Texas</option>
<option value="UT">Utah</option>
<option value="VT">Vermont</option>
<option value="VA">Virginia</option>
<option value="WA">Washington</option>
<option value="WV">West Virginia</option>
<option value="WI">Wisconsin</option>
<option value="WY">Wyoming</option>
</select>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Basic ComboBox - jQuery EasyUI Demo</title>
<link rel="stylesheet" type="text/css" href="../../themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="../../themes/icon.css">
<link rel="stylesheet" type="text/css" href="../demo.css">
<script type="text/javascript" src="../../jquery.min.js"></script>
<script type="text/javascript" src="../../jquery.easyui.min.js"></script>
</head>
<body>
<h2>Basic ComboBox</h2>
<p>Type in ComboBox to try auto complete.</p>
<div style="margin:20px 0"></div>
<select class="easyui-combobox" name="state" style="width:200px;">
<option value="AL">Alabama</option>
<option value="AK">Alaska</option>
<option value="AZ">Arizona</option>
<option value="AR">Arkansas</option>
<option value="CA">California</option>
<option value="CO">Colorado</option>
<option value="CT">Connecticut</option>
<option value="DE">Delaware</option>
<option value="FL">Florida</option>
<option value="GA">Georgia</option>
<option value="HI">Hawaii</option>
<option value="ID">Idaho</option>
<option value="IL">Illinois</option>
<option value="IN">Indiana</option>
<option value="IA">Iowa</option>
<option value="KS">Kansas</option>
<option value="KY">Kentucky</option>
<option value="LA">Louisiana</option>
<option value="ME">Maine</option>
<option value="MD">Maryland</option>
<option value="MA">Massachusetts</option>
<option value="MI">Michigan</option>
<option value="MN">Minnesota</option>
<option value="MS">Mississippi</option>
<option value="MO">Missouri</option>
<option value="MT">Montana</option>
<option value="NE">Nebraska</option>
<option value="NV">Nevada</option>
<option value="NH">New Hampshire</option>
<option value="NJ">New Jersey</option>
<option value="NM">New Mexico</option>
<option value="NY">New York</option>
<option value="NC">North Carolina</option>
<option value="ND">North Dakota</option>
<option value="OH" selected>Ohio</option>
<option value="OK">Oklahoma</option>
<option value="OR">Oregon</option>
<option value="PA">Pennsylvania</option>
<option value="RI">Rhode Island</option>
<option value="SC">South Carolina</option>
<option value="SD">South Dakota</option>
<option value="TN">Tennessee</option>
<option value="TX">Texas</option>
<option value="UT">Utah</option>
<option value="VT">Vermont</option>
<option value="VA">Virginia</option>
<option value="WA">Washington</option>
<option value="WV">West Virginia</option>
<option value="WI">Wisconsin</option>
<option value="WY">Wyoming</option>
</select>
</body>
</html>
\ No newline at end of file
[{
"id":1,
"text":"Java",
"desc":"Write once, run anywhere"
},{
"id":2,
"text":"C#",
"desc":"One of the programming languages designed for the Common Language Infrastructure"
},{
"id":3,
"text":"Ruby",
"selected":true,
"desc":"A dynamic, reflective, general-purpose object-oriented programming language"
},{
"id":4,
"text":"Perl",
"desc":"A high-level, general-purpose, interpreted, dynamic programming language"
},{
"id":5,
"text":"Basic",
"desc":"A family of general-purpose, high-level programming languages"
}]
\ No newline at end of file
[{
"value":"f20",
"text":"Firefox 2.0 or higher",
"group":"Firefox"
},{
"value":"f15",
"text":"Firefox 1.5.x",
"group":"Firefox"
},{
"value":"f10",
"text":"Firefox 1.0.x",
"group":"Firefox"
},{
"value":"ie7",
"text":"Microsoft Internet Explorer 7.0 or higher",
"group":"Microsoft Internet Explorer"
},{
"value":"ie6",
"text":"Microsoft Internet Explorer 6.x",
"group":"Microsoft Internet Explorer"
},{
"value":"ie5",
"text":"Microsoft Internet Explorer 5.x",
"group":"Microsoft Internet Explorer"
},{
"value":"ie4",
"text":"Microsoft Internet Explorer 4.x",
"group":"Microsoft Internet Explorer"
},{
"value":"op9",
"text":"Opera 9.0 or higher",
"group":"Opera"
},{
"value":"op8",
"text":"Opera 8.x",
"group":"Opera"
},{
"value":"op7",
"text":"Opera 7.x",
"group":"Opera"
},{
"value":"Safari",
"text":"Safari"
},{
"value":"Other",
"text":"Other"
}]
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Custom Format in ComboBox - jQuery EasyUI Demo</title>
<link rel="stylesheet" type="text/css" href="../../themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="../../themes/icon.css">
<link rel="stylesheet" type="text/css" href="../demo.css">
<script type="text/javascript" src="../../jquery.min.js"></script>
<script type="text/javascript" src="../../jquery.easyui.min.js"></script>
</head>
<body>
<h2>Custom Format in ComboBox</h2>
<p>This sample shows how to custom the format of list item.</p>
<div style="margin:20px 0"></div>
<input class="easyui-combobox" name="language" data-options="
url: 'combobox_data1.json',
method: 'get',
valueField: 'id',
textField: 'text',
panelWidth: 350,
panelHeight: 'auto',
formatter: formatItem
">
<script type="text/javascript">
function formatItem(row){
var s = '<span style="font-weight:bold">' + row.text + '</span><br/>' +
'<span style="color:#888">' + row.desc + '</span>';
return s;
}
</script>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Load Dynamic ComboBox Data - jQuery EasyUI Demo</title>
<link rel="stylesheet" type="text/css" href="../../themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="../../themes/icon.css">
<link rel="stylesheet" type="text/css" href="../demo.css">
<script type="text/javascript" src="../../jquery.min.js"></script>
<script type="text/javascript" src="../../jquery.easyui.min.js"></script>
</head>
<body>
<h2>Load Dynamic ComboBox Data</h2>
<p>Click the button below to load data.</p>
<div style="margin:20px 0;">
<a href="javascript:void(0)" class="easyui-linkbutton" onclick="$('#language').combobox('reload', 'combobox_data1.json')">LoadData</a>
</div>
<input class="easyui-combobox" id="language" name="language"
data-options="valueField:'id',textField:'text'">
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Fluid ComboBox - jQuery EasyUI Demo</title>
<link rel="stylesheet" type="text/css" href="../../themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="../../themes/icon.css">
<link rel="stylesheet" type="text/css" href="../demo.css">
<script type="text/javascript" src="../../jquery.min.js"></script>
<script type="text/javascript" src="../../jquery.easyui.min.js"></script>
</head>
<body>
<h2>Fluid ComboBox</h2>
<p>This example shows how to set the width of combobox to a percentage of its parent container.</p>
<div style="margin:20px 0"></div>
<p>width: 50%</p>
<input class="easyui-combobox" name="language" style="width:50%"
data-options="
url: 'combobox_data2.json',
method: 'get',
valueField:'value',
textField:'text',
groupField:'group'
">
<p>width: 30%</p>
<input class="easyui-combobox" name="language" style="width:30%"
data-options="
url:'combobox_data1.json',
method:'get',
valueField:'id',
textField:'text',
panelHeight:'auto'
">
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Group ComboBox - jQuery EasyUI Demo</title>
<link rel="stylesheet" type="text/css" href="../../themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="../../themes/icon.css">
<link rel="stylesheet" type="text/css" href="../demo.css">
<script type="text/javascript" src="../../jquery.min.js"></script>
<script type="text/javascript" src="../../jquery.easyui.min.js"></script>
</head>
<body>
<h2>Group ComboBox</h2>
<p>This example shows how to display combobox items in groups.</p>
<div style="margin:20px 0"></div>
<input class="easyui-combobox" name="browser" style="width:280px;" data-options="
url: 'combobox_data2.json',
method: 'get',
valueField:'value',
textField:'text',
groupField:'group'
">
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>ComboBox with Extra Icons- jQuery EasyUI Demo</title>
<link rel="stylesheet" type="text/css" href="../../themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="../../themes/icon.css">
<link rel="stylesheet" type="text/css" href="../demo.css">
<script type="text/javascript" src="../../jquery.min.js"></script>
<script type="text/javascript" src="../../jquery.easyui.min.js"></script>
</head>
<body>
<h2>ComboBox with Extra Icons</h2>
<p>The user can attach extra icons to the ComboBox.</p>
<div style="margin:20px 0"></div>
<input class="easyui-combobox"
name="language"
data-options="
url:'combobox_data1.json',
method:'get',
valueField:'id',
textField:'text',
panelHeight:'auto',
icons:[{
iconCls:'icon-add'
},{
iconCls:'icon-cut'
}]
">
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>ComboGrid Actions - jQuery EasyUI Demo</title>
<link rel="stylesheet" type="text/css" href="../../themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="../../themes/icon.css">
<link rel="stylesheet" type="text/css" href="../demo.css">
<script type="text/javascript" src="../../jquery.min.js"></script>
<script type="text/javascript" src="../../jquery.easyui.min.js"></script>
</head>
<body>
<h2>ComboGrid Actions</h2>
<p>Click the buttons below to perform actions.</p>
<div style="margin:20px 0">
<a href="javascript:void(0)" class="easyui-linkbutton" onclick="getValue()">GetValue</a>
<a href="javascript:void(0)" class="easyui-linkbutton" onclick="setValue()">SetValue</a>
<a href="javascript:void(0)" class="easyui-linkbutton" onclick="disable()">Disable</a>
<a href="javascript:void(0)" class="easyui-linkbutton" onclick="enable()">Enable</a>
</div>
<input id="cc" class="easyui-combogrid" style="width:250px" data-options="
panelWidth: 500,
idField: 'itemid',
textField: 'productname',
url: 'datagrid_data1.json',
method: 'get',
columns: [[
{field:'itemid',title:'Item ID',width:80},
{field:'productname',title:'Product',width:120},
{field:'listprice',title:'List Price',width:80,align:'right'},
{field:'unitcost',title:'Unit Cost',width:80,align:'right'},
{field:'attr1',title:'Attribute',width:200},
{field:'status',title:'Status',width:60,align:'center'}
]],
fitColumns: true
">
<script type="text/javascript">
function getValue(){
var val = $('#cc').combogrid('getValue');
alert(val);
}
function setValue(){
$('#cc').combogrid('setValue', 'EST-13');
}
function disable(){
$('#cc').combogrid('disable');
}
function enable(){
$('#cc').combogrid('enable');
}
</script>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Basic ComboGrid - jQuery EasyUI Demo</title>
<link rel="stylesheet" type="text/css" href="../../themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="../../themes/icon.css">
<link rel="stylesheet" type="text/css" href="../demo.css">
<script type="text/javascript" src="../../jquery.min.js"></script>
<script type="text/javascript" src="../../jquery.easyui.min.js"></script>
</head>
<body>
<h2>Basic ComboGrid</h2>
<p>Click the right arrow button to show the DataGrid.</p>
<div style="margin:20px 0"></div>
<select class="easyui-combogrid" style="width:250px" data-options="
panelWidth: 500,
idField: 'itemid',
textField: 'productname',
url: 'datagrid_data1.json',
method: 'get',
columns: [[
{field:'itemid',title:'Item ID',width:80},
{field:'productname',title:'Product',width:120},
{field:'listprice',title:'List Price',width:80,align:'right'},
{field:'unitcost',title:'Unit Cost',width:80,align:'right'},
{field:'attr1',title:'Attribute',width:200},
{field:'status',title:'Status',width:60,align:'center'}
]],
fitColumns: true
">
</select>
</body>
</html>
\ No newline at end of file
{"total":28,"rows":[
{"productid":"FI-SW-01","productname":"Koi","unitcost":10.00,"status":"P","listprice":36.50,"attr1":"Large","itemid":"EST-1"},
{"productid":"K9-DL-01","productname":"Dalmation","unitcost":12.00,"status":"P","listprice":18.50,"attr1":"Spotted Adult Female","itemid":"EST-10"},
{"productid":"RP-SN-01","productname":"Rattlesnake","unitcost":12.00,"status":"P","listprice":38.50,"attr1":"Venomless","itemid":"EST-11"},
{"productid":"RP-SN-01","productname":"Rattlesnake","unitcost":12.00,"status":"P","listprice":26.50,"attr1":"Rattleless","itemid":"EST-12"},
{"selected":true,"productid":"RP-LI-02","productname":"Iguana","unitcost":12.00,"status":"P","listprice":35.50,"attr1":"Green Adult","itemid":"EST-13"},
{"productid":"FL-DSH-01","productname":"Manx","unitcost":12.00,"status":"P","listprice":158.50,"attr1":"Tailless","itemid":"EST-14"},
{"productid":"FL-DSH-01","productname":"Manx","unitcost":12.00,"status":"P","listprice":83.50,"attr1":"With tail","itemid":"EST-15"},
{"productid":"FL-DLH-02","productname":"Persian","unitcost":12.00,"status":"P","listprice":23.50,"attr1":"Adult Female","itemid":"EST-16"},
{"productid":"FL-DLH-02","productname":"Persian","unitcost":12.00,"status":"P","listprice":89.50,"attr1":"Adult Male","itemid":"EST-17"},
{"productid":"AV-CB-01","productname":"Amazon Parrot","unitcost":92.00,"status":"P","listprice":63.50,"attr1":"Adult Male","itemid":"EST-18"}
]}
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Fluid ComboGrid - jQuery EasyUI Demo</title>
<link rel="stylesheet" type="text/css" href="../../themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="../../themes/icon.css">
<link rel="stylesheet" type="text/css" href="../demo.css">
<script type="text/javascript" src="../../jquery.min.js"></script>
<script type="text/javascript" src="../../jquery.easyui.min.js"></script>
</head>
<body>
<h2>Fluid ComboGrid</h2>
<p>This example shows how to set the width of ComboGrid to a percentage of its parent container.</p>
<div style="margin:20px 0"></div>
<p>width: 50%</p>
<select class="easyui-combogrid" style="width:50%" data-options="
panelWidth: 500,
panelMinWidth: '50%',
idField: 'itemid',
textField: 'productname',
url: 'datagrid_data1.json',
method: 'get',
columns: [[
{field:'itemid',title:'Item ID',width:80},
{field:'productname',title:'Product',width:120},
{field:'listprice',title:'List Price',width:80,align:'right'},
{field:'unitcost',title:'Unit Cost',width:80,align:'right'},
{field:'attr1',title:'Attribute',width:200},
{field:'status',title:'Status',width:60,align:'center'}
]],
fitColumns: true
">
</select>
<p>width: 30%</p>
<select class="easyui-combogrid" style="width:30%" data-options="
panelWidth: 500,
idField: 'itemid',
textField: 'productname',
url: 'datagrid_data1.json',
method: 'get',
columns: [[
{field:'itemid',title:'Item ID',width:80},
{field:'productname',title:'Product',width:120},
{field:'listprice',title:'List Price',width:80,align:'right'},
{field:'unitcost',title:'Unit Cost',width:80,align:'right'},
{field:'attr1',title:'Attribute',width:200},
{field:'status',title:'Status',width:60,align:'center'}
]],
fitColumns: true
">
</select>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Initialize Value for ComboGrid - jQuery EasyUI Demo</title>
<link rel="stylesheet" type="text/css" href="../../themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="../../themes/icon.css">
<link rel="stylesheet" type="text/css" href="../demo.css">
<script type="text/javascript" src="../../jquery.min.js"></script>
<script type="text/javascript" src="../../jquery.easyui.min.js"></script>
</head>
<body>
<h2>Initialize Value for ComboGrid</h2>
<p>Initialize value when ComboGrid is created.</p>
<div style="margin:20px 0"></div>
<input class="easyui-combogrid" style="width:250px" value="EST-12" data-options="
panelWidth: 500,
idField: 'itemid',
textField: 'productname',
url: 'datagrid_data1.json',
method: 'get',
columns: [[
{field:'itemid',title:'Item ID',width:80},
{field:'productname',title:'Product',width:120},
{field:'listprice',title:'List Price',width:80,align:'right'},
{field:'unitcost',title:'Unit Cost',width:80,align:'right'},
{field:'attr1',title:'Attribute',width:200},
{field:'status',title:'Status',width:60,align:'center'}
]],
fitColumns: true
">
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>ComboTree Actions - jQuery EasyUI Demo</title>
<link rel="stylesheet" type="text/css" href="../../themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="../../themes/icon.css">
<link rel="stylesheet" type="text/css" href="../demo.css">
<script type="text/javascript" src="../../jquery.min.js"></script>
<script type="text/javascript" src="../../jquery.easyui.min.js"></script>
</head>
<body>
<h2>ComboTree Actions</h2>
<p>Click the buttons below to perform actions</p>
<div style="margin:20px 0">
<a href="javascript:void(0)" class="easyui-linkbutton" onclick="getValue()">GetValue</a>
<a href="javascript:void(0)" class="easyui-linkbutton" onclick="setValue()">SetValue</a>
<a href="javascript:void(0)" class="easyui-linkbutton" onclick="disable()">Disable</a>
<a href="javascript:void(0)" class="easyui-linkbutton" onclick="enable()">Enable</a>
</div>
<input id="cc" class="easyui-combotree" data-options="url:'tree_data1.json',method:'get',required:true" style="width:200px;">
<script type="text/javascript">
function getValue(){
var val = $('#cc').combotree('getValue');
alert(val);
}
function setValue(){
$('#cc').combotree('setValue', '122');
}
function disable(){
$('#cc').combotree('disable');
}
function enable(){
$('#cc').combotree('enable');
}
</script>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Basic ComboTree - jQuery EasyUI Demo</title>
<link rel="stylesheet" type="text/css" href="../../themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="../../themes/icon.css">
<link rel="stylesheet" type="text/css" href="../demo.css">
<script type="text/javascript" src="../../jquery.min.js"></script>
<script type="text/javascript" src="../../jquery.easyui.min.js"></script>
</head>
<body>
<h2>Basic ComboTree</h2>
<p>Click the right arrow button to show the tree panel.</p>
<div style="margin:20px 0"></div>
<input class="easyui-combotree" data-options="url:'tree_data1.json',method:'get',required:true" style="width:200px;">
</body>
</html>
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment