@ -0,0 +1,265 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi</artifactId>
|
||||
<version>4.1.0</version>
|
||||
|
||||
<name>ruoyi</name>
|
||||
<url>http://www.ruoyi.vip</url>
|
||||
<description>Educoder大数据系统</description>
|
||||
|
||||
<properties>
|
||||
<ruoyi.version>4.1.0</ruoyi.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<java.version>1.8</java.version>
|
||||
<shiro.version>1.4.2</shiro.version>
|
||||
<thymeleaf.extras.shiro.version>2.0.0</thymeleaf.extras.shiro.version>
|
||||
<mybatis.boot.version>1.3.2</mybatis.boot.version>
|
||||
<druid.version>1.1.14</druid.version>
|
||||
<bitwalker.version>1.19</bitwalker.version>
|
||||
<kaptcha.version>2.3.2</kaptcha.version>
|
||||
<swagger.version>2.9.2</swagger.version>
|
||||
<pagehelper.boot.version>1.2.5</pagehelper.boot.version>
|
||||
<fastjson.version>1.2.60</fastjson.version>
|
||||
<oshi.version>3.9.1</oshi.version>
|
||||
<commons.io.version>2.5</commons.io.version>
|
||||
<commons.fileupload.version>1.3.3</commons.fileupload.version>
|
||||
<poi.version>3.17</poi.version>
|
||||
<velocity.version>1.7</velocity.version>
|
||||
</properties>
|
||||
|
||||
<!-- 依赖声明 -->
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
|
||||
<!-- SpringBoot的依赖配置-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-dependencies</artifactId>
|
||||
<version>2.1.1.RELEASE</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
|
||||
<!--阿里数据库连接池 -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>druid-spring-boot-starter</artifactId>
|
||||
<version>${druid.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!--验证码 -->
|
||||
<dependency>
|
||||
<groupId>com.github.penggle</groupId>
|
||||
<artifactId>kaptcha</artifactId>
|
||||
<version>${kaptcha.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!--Shiro核心框架 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.shiro</groupId>
|
||||
<artifactId>shiro-core</artifactId>
|
||||
<version>${shiro.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Shiro使用Srping框架 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.shiro</groupId>
|
||||
<artifactId>shiro-spring</artifactId>
|
||||
<version>${shiro.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Shiro使用EhCache缓存框架 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.shiro</groupId>
|
||||
<artifactId>shiro-ehcache</artifactId>
|
||||
<version>${shiro.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- thymeleaf模板引擎和shiro框架的整合 -->
|
||||
<dependency>
|
||||
<groupId>com.github.theborakompanioni</groupId>
|
||||
<artifactId>thymeleaf-extras-shiro</artifactId>
|
||||
<version>${thymeleaf.extras.shiro.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 解析客户端操作系统、浏览器等 -->
|
||||
<dependency>
|
||||
<groupId>eu.bitwalker</groupId>
|
||||
<artifactId>UserAgentUtils</artifactId>
|
||||
<version>${bitwalker.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- pagehelper 分页插件 -->
|
||||
<dependency>
|
||||
<groupId>com.github.pagehelper</groupId>
|
||||
<artifactId>pagehelper-spring-boot-starter</artifactId>
|
||||
<version>${pagehelper.boot.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 获取系统信息 -->
|
||||
<dependency>
|
||||
<groupId>com.github.oshi</groupId>
|
||||
<artifactId>oshi-core</artifactId>
|
||||
<version>${oshi.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- swagger2-->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger2</artifactId>
|
||||
<version>${swagger.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-annotations</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-models</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!-- swagger2-UI-->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger-ui</artifactId>
|
||||
<version>${swagger.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!--io常用工具类 -->
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>${commons.io.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!--文件上传工具类 -->
|
||||
<dependency>
|
||||
<groupId>commons-fileupload</groupId>
|
||||
<artifactId>commons-fileupload</artifactId>
|
||||
<version>${commons.fileupload.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- excel工具 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml</artifactId>
|
||||
<version>${poi.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!--velocity代码生成使用模板 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.velocity</groupId>
|
||||
<artifactId>velocity</artifactId>
|
||||
<version>${velocity.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 阿里JSON解析器 -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
<version>${fastjson.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 定时任务-->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-quartz</artifactId>
|
||||
<version>${ruoyi.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 代码生成-->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-generator</artifactId>
|
||||
<version>${ruoyi.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 核心模块-->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-framework</artifactId>
|
||||
<version>${ruoyi.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 系统模块-->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-system</artifactId>
|
||||
<version>${ruoyi.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 通用工具-->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-common</artifactId>
|
||||
<version>${ruoyi.version}</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
<modules>
|
||||
<module>ruoyi-admin</module>
|
||||
<module>ruoyi-framework</module>
|
||||
<module>ruoyi-system</module>
|
||||
<module>ruoyi-quartz</module>
|
||||
<module>ruoyi-common</module>
|
||||
</modules>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
|
||||
<dependencies>
|
||||
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.1</version>
|
||||
<configuration>
|
||||
<source>${java.version}</source>
|
||||
<target>${java.version}</target>
|
||||
<encoding>${project.build.sourceEncoding}</encoding>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>public</id>
|
||||
<name>aliyun nexus</name>
|
||||
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
</releases>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>public</id>
|
||||
<name>aliyun nexus</name>
|
||||
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
|
||||
</project>
|
@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" output="target/classes" path="src/main/java">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
<attribute name="test" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
|
||||
<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"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>ruoyi-admin</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.springframework.ide.eclipse.boot.validation.springbootbuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
@ -0,0 +1,4 @@
|
||||
eclipse.preferences.version=1
|
||||
encoding//src/main/java=UTF-8
|
||||
encoding//src/main/resources=UTF-8
|
||||
encoding/<project>=UTF-8
|
@ -0,0 +1,6 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||
org.eclipse.jdt.core.compiler.release=disabled
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
@ -0,0 +1,4 @@
|
||||
activeProfiles=
|
||||
eclipse.preferences.version=1
|
||||
resolveWorkspaceProjects=true
|
||||
version=1
|
@ -0,0 +1,2 @@
|
||||
boot.validation.initialized=true
|
||||
eclipse.preferences.version=1
|
@ -0,0 +1,30 @@
|
||||
package com.ruoyi;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
|
||||
/**
|
||||
* 启动程序
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
|
||||
public class RuoYiApplication
|
||||
{
|
||||
public static void main(String[] args)
|
||||
{
|
||||
// System.setProperty("spring.devtools.restart.enabled", "false");
|
||||
SpringApplication.run(RuoYiApplication.class, args);
|
||||
System.out.println("(♥◠‿◠)ノ゙ 启动成功 ლ(´ڡ`ლ)゙ \n" +
|
||||
" .-------. ____ __ \n" +
|
||||
" | _ _ \\ \\ \\ / / \n" +
|
||||
" | ( ' ) | \\ _. / ' \n" +
|
||||
" |(_ o _) / _( )_ .' \n" +
|
||||
" | (_,_).' __ ___(_ o _)' \n" +
|
||||
" | |\\ \\ | || |(_,_)' \n" +
|
||||
" | | \\ `' /| `-' / \n" +
|
||||
" | | \\ / \\ / \n" +
|
||||
" ''-' `'-' `-..-' ");
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package com.ruoyi;
|
||||
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
|
||||
|
||||
/**
|
||||
* web容器中进行部署
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public class RuoYiServletInitializer extends SpringBootServletInitializer
|
||||
{
|
||||
@Override
|
||||
protected SpringApplicationBuilder configure(SpringApplicationBuilder application)
|
||||
{
|
||||
return application.sources(RuoYiApplication.class);
|
||||
}
|
||||
}
|
@ -0,0 +1,113 @@
|
||||
package com.ruoyi.web.controller.common;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import com.ruoyi.common.config.Global;
|
||||
import com.ruoyi.common.config.ServerConfig;
|
||||
import com.ruoyi.common.constant.Constants;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.file.FileUploadUtils;
|
||||
import com.ruoyi.common.utils.file.FileUtils;
|
||||
|
||||
/**
|
||||
* 通用请求处理
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Controller
|
||||
public class CommonController
|
||||
{
|
||||
private static final Logger log = LoggerFactory.getLogger(CommonController.class);
|
||||
|
||||
@Autowired
|
||||
private ServerConfig serverConfig;
|
||||
|
||||
/**
|
||||
* 通用下载请求
|
||||
*
|
||||
* @param fileName 文件名称
|
||||
* @param delete 是否删除
|
||||
*/
|
||||
@GetMapping("common/download")
|
||||
public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!FileUtils.isValidFilename(fileName))
|
||||
{
|
||||
throw new Exception(StringUtils.format("文件名称({})非法,不允许下载。 ", fileName));
|
||||
}
|
||||
String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1);
|
||||
String filePath = Global.getDownloadPath() + fileName;
|
||||
|
||||
response.setCharacterEncoding("utf-8");
|
||||
response.setContentType("multipart/form-data");
|
||||
response.setHeader("Content-Disposition",
|
||||
"attachment;fileName=" + FileUtils.setFileDownloadHeader(request, realFileName));
|
||||
FileUtils.writeBytes(filePath, response.getOutputStream());
|
||||
if (delete)
|
||||
{
|
||||
FileUtils.deleteFile(filePath);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.error("下载文件失败", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通用上传请求
|
||||
*/
|
||||
@PostMapping("/common/upload")
|
||||
@ResponseBody
|
||||
public AjaxResult uploadFile(MultipartFile file) throws Exception
|
||||
{
|
||||
try
|
||||
{
|
||||
// 上传文件路径
|
||||
String filePath = Global.getUploadPath();
|
||||
// 上传并返回新文件名称
|
||||
String fileName = FileUploadUtils.upload(filePath, file);
|
||||
String url = serverConfig.getUrl() + fileName;
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax.put("fileName", fileName);
|
||||
ajax.put("url", url);
|
||||
return ajax;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return AjaxResult.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 本地资源通用下载
|
||||
*/
|
||||
@GetMapping("/common/download/resource")
|
||||
public void resourceDownload(String resource, HttpServletRequest request, HttpServletResponse response)
|
||||
throws Exception
|
||||
{
|
||||
// 本地资源路径
|
||||
String localPath = Global.getProfile();
|
||||
// 数据库资源地址
|
||||
String downloadPath = localPath + StringUtils.substringAfter(resource, Constants.RESOURCE_PREFIX);
|
||||
// 下载名称
|
||||
String downloadName = StringUtils.substringAfterLast(downloadPath, "/");
|
||||
response.setCharacterEncoding("utf-8");
|
||||
response.setContentType("multipart/form-data");
|
||||
response.setHeader("Content-Disposition",
|
||||
"attachment;fileName=" + FileUtils.setFileDownloadHeader(request, downloadName));
|
||||
FileUtils.writeBytes(downloadPath, response.getOutputStream());
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package com.ruoyi.web.controller.monitor;
|
||||
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
|
||||
/**
|
||||
* druid 监控
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/monitor/data")
|
||||
public class DruidController extends BaseController
|
||||
{
|
||||
private String prefix = "/druid";
|
||||
|
||||
@RequiresPermissions("monitor:data:view")
|
||||
@GetMapping()
|
||||
public String index()
|
||||
{
|
||||
return redirect(prefix + "/index");
|
||||
}
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package com.ruoyi.web.controller.monitor;
|
||||
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.framework.web.domain.Server;
|
||||
|
||||
/**
|
||||
* 服务器监控
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/monitor/server")
|
||||
public class ServerController extends BaseController
|
||||
{
|
||||
private String prefix = "monitor/server";
|
||||
|
||||
@RequiresPermissions("monitor:server:view")
|
||||
@GetMapping()
|
||||
public String server(ModelMap mmap) throws Exception
|
||||
{
|
||||
Server server = new Server();
|
||||
server.copyTo();
|
||||
mmap.put("server", server);
|
||||
return prefix + "/server";
|
||||
}
|
||||
}
|
@ -0,0 +1,94 @@
|
||||
package com.ruoyi.web.controller.monitor;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.framework.shiro.service.SysPasswordService;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.system.domain.SysLogininfor;
|
||||
import com.ruoyi.system.service.ISysLogininforService;
|
||||
|
||||
/**
|
||||
* 系统访问记录
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/monitor/logininfor")
|
||||
public class SysLogininforController extends BaseController
|
||||
{
|
||||
private String prefix = "monitor/logininfor";
|
||||
|
||||
@Autowired
|
||||
private ISysLogininforService logininforService;
|
||||
|
||||
@Autowired
|
||||
private SysPasswordService passwordService;
|
||||
|
||||
@RequiresPermissions("monitor:logininfor:view")
|
||||
@GetMapping()
|
||||
public String logininfor()
|
||||
{
|
||||
return prefix + "/logininfor";
|
||||
}
|
||||
|
||||
@RequiresPermissions("monitor:logininfor:list")
|
||||
@PostMapping("/list")
|
||||
@ResponseBody
|
||||
public TableDataInfo list(SysLogininfor logininfor)
|
||||
{
|
||||
startPage();
|
||||
List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "登陆日志", businessType = BusinessType.EXPORT)
|
||||
@RequiresPermissions("monitor:logininfor:export")
|
||||
@PostMapping("/export")
|
||||
@ResponseBody
|
||||
public AjaxResult export(SysLogininfor logininfor)
|
||||
{
|
||||
List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
|
||||
ExcelUtil<SysLogininfor> util = new ExcelUtil<SysLogininfor>(SysLogininfor.class);
|
||||
return util.exportExcel(list, "登陆日志");
|
||||
}
|
||||
|
||||
@RequiresPermissions("monitor:logininfor:remove")
|
||||
@Log(title = "登陆日志", businessType = BusinessType.DELETE)
|
||||
@PostMapping("/remove")
|
||||
@ResponseBody
|
||||
public AjaxResult remove(String ids)
|
||||
{
|
||||
return toAjax(logininforService.deleteLogininforByIds(ids));
|
||||
}
|
||||
|
||||
@RequiresPermissions("monitor:logininfor:remove")
|
||||
@Log(title = "登陆日志", businessType = BusinessType.CLEAN)
|
||||
@PostMapping("/clean")
|
||||
@ResponseBody
|
||||
public AjaxResult clean()
|
||||
{
|
||||
logininforService.cleanLogininfor();
|
||||
return success();
|
||||
}
|
||||
|
||||
@RequiresPermissions("monitor:logininfor:unlock")
|
||||
@Log(title = "账户解锁", businessType = BusinessType.OTHER)
|
||||
@PostMapping("/unlock")
|
||||
@ResponseBody
|
||||
public AjaxResult unlock(String loginName)
|
||||
{
|
||||
passwordService.unlock(loginName);
|
||||
return success();
|
||||
}
|
||||
}
|
@ -0,0 +1,89 @@
|
||||
package com.ruoyi.web.controller.monitor;
|
||||
|
||||
import java.util.List;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.system.domain.SysOperLog;
|
||||
import com.ruoyi.system.service.ISysOperLogService;
|
||||
|
||||
/**
|
||||
* 操作日志记录
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/monitor/operlog")
|
||||
public class SysOperlogController extends BaseController
|
||||
{
|
||||
private String prefix = "monitor/operlog";
|
||||
|
||||
@Autowired
|
||||
private ISysOperLogService operLogService;
|
||||
|
||||
@RequiresPermissions("monitor:operlog:view")
|
||||
@GetMapping()
|
||||
public String operlog()
|
||||
{
|
||||
return prefix + "/operlog";
|
||||
}
|
||||
|
||||
@RequiresPermissions("monitor:operlog:list")
|
||||
@PostMapping("/list")
|
||||
@ResponseBody
|
||||
public TableDataInfo list(SysOperLog operLog)
|
||||
{
|
||||
startPage();
|
||||
List<SysOperLog> list = operLogService.selectOperLogList(operLog);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "操作日志", businessType = BusinessType.EXPORT)
|
||||
@RequiresPermissions("monitor:operlog:export")
|
||||
@PostMapping("/export")
|
||||
@ResponseBody
|
||||
public AjaxResult export(SysOperLog operLog)
|
||||
{
|
||||
List<SysOperLog> list = operLogService.selectOperLogList(operLog);
|
||||
ExcelUtil<SysOperLog> util = new ExcelUtil<SysOperLog>(SysOperLog.class);
|
||||
return util.exportExcel(list, "操作日志");
|
||||
}
|
||||
|
||||
@RequiresPermissions("monitor:operlog:remove")
|
||||
@PostMapping("/remove")
|
||||
@ResponseBody
|
||||
public AjaxResult remove(String ids)
|
||||
{
|
||||
return toAjax(operLogService.deleteOperLogByIds(ids));
|
||||
}
|
||||
|
||||
@RequiresPermissions("monitor:operlog:detail")
|
||||
@GetMapping("/detail/{operId}")
|
||||
public String detail(@PathVariable("operId") Long operId, ModelMap mmap)
|
||||
{
|
||||
mmap.put("operLog", operLogService.selectOperLogById(operId));
|
||||
return prefix + "/detail";
|
||||
}
|
||||
|
||||
@Log(title = "操作日志", businessType = BusinessType.CLEAN)
|
||||
@RequiresPermissions("monitor:operlog:remove")
|
||||
@PostMapping("/clean")
|
||||
@ResponseBody
|
||||
public AjaxResult clean()
|
||||
{
|
||||
operLogService.cleanOperLog();
|
||||
return success();
|
||||
}
|
||||
}
|
@ -0,0 +1,114 @@
|
||||
package com.ruoyi.web.controller.monitor;
|
||||
|
||||
import java.util.List;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.enums.OnlineStatus;
|
||||
import com.ruoyi.framework.shiro.session.OnlineSession;
|
||||
import com.ruoyi.framework.shiro.session.OnlineSessionDAO;
|
||||
import com.ruoyi.framework.util.ShiroUtils;
|
||||
import com.ruoyi.system.domain.SysUserOnline;
|
||||
import com.ruoyi.system.service.ISysUserOnlineService;
|
||||
|
||||
/**
|
||||
* 在线用户监控
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/monitor/online")
|
||||
public class SysUserOnlineController extends BaseController
|
||||
{
|
||||
private String prefix = "monitor/online";
|
||||
|
||||
@Autowired
|
||||
private ISysUserOnlineService userOnlineService;
|
||||
|
||||
@Autowired
|
||||
private OnlineSessionDAO onlineSessionDAO;
|
||||
|
||||
@RequiresPermissions("monitor:online:view")
|
||||
@GetMapping()
|
||||
public String online()
|
||||
{
|
||||
return prefix + "/online";
|
||||
}
|
||||
|
||||
@RequiresPermissions("monitor:online:list")
|
||||
@PostMapping("/list")
|
||||
@ResponseBody
|
||||
public TableDataInfo list(SysUserOnline userOnline)
|
||||
{
|
||||
startPage();
|
||||
List<SysUserOnline> list = userOnlineService.selectUserOnlineList(userOnline);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@RequiresPermissions("monitor:online:batchForceLogout")
|
||||
@Log(title = "在线用户", businessType = BusinessType.FORCE)
|
||||
@PostMapping("/batchForceLogout")
|
||||
@ResponseBody
|
||||
public AjaxResult batchForceLogout(@RequestParam("ids[]") String[] ids)
|
||||
{
|
||||
for (String sessionId : ids)
|
||||
{
|
||||
SysUserOnline online = userOnlineService.selectOnlineById(sessionId);
|
||||
if (online == null)
|
||||
{
|
||||
return error("用户已下线");
|
||||
}
|
||||
OnlineSession onlineSession = (OnlineSession) onlineSessionDAO.readSession(online.getSessionId());
|
||||
if (onlineSession == null)
|
||||
{
|
||||
return error("用户已下线");
|
||||
}
|
||||
if (sessionId.equals(ShiroUtils.getSessionId()))
|
||||
{
|
||||
return error("当前登陆用户无法强退");
|
||||
}
|
||||
onlineSession.setStatus(OnlineStatus.off_line);
|
||||
onlineSessionDAO.update(onlineSession);
|
||||
online.setStatus(OnlineStatus.off_line);
|
||||
userOnlineService.saveOnline(online);
|
||||
}
|
||||
return success();
|
||||
}
|
||||
|
||||
@RequiresPermissions("monitor:online:forceLogout")
|
||||
@Log(title = "在线用户", businessType = BusinessType.FORCE)
|
||||
@PostMapping("/forceLogout")
|
||||
@ResponseBody
|
||||
public AjaxResult forceLogout(String sessionId)
|
||||
{
|
||||
SysUserOnline online = userOnlineService.selectOnlineById(sessionId);
|
||||
if (sessionId.equals(ShiroUtils.getSessionId()))
|
||||
{
|
||||
return error("当前登陆用户无法强退");
|
||||
}
|
||||
if (online == null)
|
||||
{
|
||||
return error("用户已下线");
|
||||
}
|
||||
OnlineSession onlineSession = (OnlineSession) onlineSessionDAO.readSession(online.getSessionId());
|
||||
if (onlineSession == null)
|
||||
{
|
||||
return error("用户已下线");
|
||||
}
|
||||
onlineSession.setStatus(OnlineStatus.off_line);
|
||||
onlineSessionDAO.update(onlineSession);
|
||||
online.setStatus(OnlineStatus.off_line);
|
||||
userOnlineService.saveOnline(online);
|
||||
return success();
|
||||
}
|
||||
}
|
@ -0,0 +1,144 @@
|
||||
package com.ruoyi.web.controller.system;
|
||||
|
||||
import java.util.List;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.constant.UserConstants;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.framework.util.ShiroUtils;
|
||||
import com.ruoyi.system.domain.SysConfig;
|
||||
import com.ruoyi.system.service.ISysConfigService;
|
||||
|
||||
/**
|
||||
* 参数配置 信息操作处理
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/system/config")
|
||||
public class SysConfigController extends BaseController
|
||||
{
|
||||
private String prefix = "system/config";
|
||||
|
||||
@Autowired
|
||||
private ISysConfigService configService;
|
||||
|
||||
@RequiresPermissions("system:config:view")
|
||||
@GetMapping()
|
||||
public String config()
|
||||
{
|
||||
return prefix + "/config";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询参数配置列表
|
||||
*/
|
||||
@RequiresPermissions("system:config:list")
|
||||
@PostMapping("/list")
|
||||
@ResponseBody
|
||||
public TableDataInfo list(SysConfig config)
|
||||
{
|
||||
startPage();
|
||||
List<SysConfig> list = configService.selectConfigList(config);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "参数管理", businessType = BusinessType.EXPORT)
|
||||
@RequiresPermissions("system:config:export")
|
||||
@PostMapping("/export")
|
||||
@ResponseBody
|
||||
public AjaxResult export(SysConfig config)
|
||||
{
|
||||
List<SysConfig> list = configService.selectConfigList(config);
|
||||
ExcelUtil<SysConfig> util = new ExcelUtil<SysConfig>(SysConfig.class);
|
||||
return util.exportExcel(list, "参数数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增参数配置
|
||||
*/
|
||||
@GetMapping("/add")
|
||||
public String add()
|
||||
{
|
||||
return prefix + "/add";
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增保存参数配置
|
||||
*/
|
||||
@RequiresPermissions("system:config:add")
|
||||
@Log(title = "参数管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/add")
|
||||
@ResponseBody
|
||||
public AjaxResult addSave(@Validated SysConfig config)
|
||||
{
|
||||
if (UserConstants.CONFIG_KEY_NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config)))
|
||||
{
|
||||
return error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在");
|
||||
}
|
||||
config.setCreateBy(ShiroUtils.getLoginName());
|
||||
return toAjax(configService.insertConfig(config));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改参数配置
|
||||
*/
|
||||
@GetMapping("/edit/{configId}")
|
||||
public String edit(@PathVariable("configId") Long configId, ModelMap mmap)
|
||||
{
|
||||
mmap.put("config", configService.selectConfigById(configId));
|
||||
return prefix + "/edit";
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存参数配置
|
||||
*/
|
||||
@RequiresPermissions("system:config:edit")
|
||||
@Log(title = "参数管理", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/edit")
|
||||
@ResponseBody
|
||||
public AjaxResult editSave(@Validated SysConfig config)
|
||||
{
|
||||
if (UserConstants.CONFIG_KEY_NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config)))
|
||||
{
|
||||
return error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在");
|
||||
}
|
||||
config.setUpdateBy(ShiroUtils.getLoginName());
|
||||
return toAjax(configService.updateConfig(config));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除参数配置
|
||||
*/
|
||||
@RequiresPermissions("system:config:remove")
|
||||
@Log(title = "参数管理", businessType = BusinessType.DELETE)
|
||||
@PostMapping("/remove")
|
||||
@ResponseBody
|
||||
public AjaxResult remove(String ids)
|
||||
{
|
||||
return toAjax(configService.deleteConfigByIds(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验参数键名
|
||||
*/
|
||||
@PostMapping("/checkConfigKeyUnique")
|
||||
@ResponseBody
|
||||
public String checkConfigKeyUnique(SysConfig config)
|
||||
{
|
||||
return configService.checkConfigKeyUnique(config);
|
||||
}
|
||||
}
|
@ -0,0 +1,120 @@
|
||||
package com.ruoyi.web.controller.system;
|
||||
|
||||
import java.util.List;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.framework.util.ShiroUtils;
|
||||
import com.ruoyi.system.domain.SysDictData;
|
||||
import com.ruoyi.system.service.ISysDictDataService;
|
||||
|
||||
/**
|
||||
* 数据字典信息
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/system/dict/data")
|
||||
public class SysDictDataController extends BaseController
|
||||
{
|
||||
private String prefix = "system/dict/data";
|
||||
|
||||
@Autowired
|
||||
private ISysDictDataService dictDataService;
|
||||
|
||||
@RequiresPermissions("system:dict:view")
|
||||
@GetMapping()
|
||||
public String dictData()
|
||||
{
|
||||
return prefix + "/data";
|
||||
}
|
||||
|
||||
@PostMapping("/list")
|
||||
@RequiresPermissions("system:dict:list")
|
||||
@ResponseBody
|
||||
public TableDataInfo list(SysDictData dictData)
|
||||
{
|
||||
startPage();
|
||||
List<SysDictData> list = dictDataService.selectDictDataList(dictData);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "字典数据", businessType = BusinessType.EXPORT)
|
||||
@RequiresPermissions("system:dict:export")
|
||||
@PostMapping("/export")
|
||||
@ResponseBody
|
||||
public AjaxResult export(SysDictData dictData)
|
||||
{
|
||||
List<SysDictData> list = dictDataService.selectDictDataList(dictData);
|
||||
ExcelUtil<SysDictData> util = new ExcelUtil<SysDictData>(SysDictData.class);
|
||||
return util.exportExcel(list, "字典数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增字典类型
|
||||
*/
|
||||
@GetMapping("/add/{dictType}")
|
||||
public String add(@PathVariable("dictType") String dictType, ModelMap mmap)
|
||||
{
|
||||
mmap.put("dictType", dictType);
|
||||
return prefix + "/add";
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增保存字典类型
|
||||
*/
|
||||
@Log(title = "字典数据", businessType = BusinessType.INSERT)
|
||||
@RequiresPermissions("system:dict:add")
|
||||
@PostMapping("/add")
|
||||
@ResponseBody
|
||||
public AjaxResult addSave(@Validated SysDictData dict)
|
||||
{
|
||||
dict.setCreateBy(ShiroUtils.getLoginName());
|
||||
return toAjax(dictDataService.insertDictData(dict));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改字典类型
|
||||
*/
|
||||
@GetMapping("/edit/{dictCode}")
|
||||
public String edit(@PathVariable("dictCode") Long dictCode, ModelMap mmap)
|
||||
{
|
||||
mmap.put("dict", dictDataService.selectDictDataById(dictCode));
|
||||
return prefix + "/edit";
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存字典类型
|
||||
*/
|
||||
@Log(title = "字典数据", businessType = BusinessType.UPDATE)
|
||||
@RequiresPermissions("system:dict:edit")
|
||||
@PostMapping("/edit")
|
||||
@ResponseBody
|
||||
public AjaxResult editSave(@Validated SysDictData dict)
|
||||
{
|
||||
dict.setUpdateBy(ShiroUtils.getLoginName());
|
||||
return toAjax(dictDataService.updateDictData(dict));
|
||||
}
|
||||
|
||||
@Log(title = "字典数据", businessType = BusinessType.DELETE)
|
||||
@RequiresPermissions("system:dict:remove")
|
||||
@PostMapping("/remove")
|
||||
@ResponseBody
|
||||
public AjaxResult remove(String ids)
|
||||
{
|
||||
return toAjax(dictDataService.deleteDictDataByIds(ids));
|
||||
}
|
||||
}
|
@ -0,0 +1,182 @@
|
||||
package com.ruoyi.web.controller.system;
|
||||
|
||||
import java.util.List;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.constant.UserConstants;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.Ztree;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.framework.util.ShiroUtils;
|
||||
import com.ruoyi.system.domain.SysDictType;
|
||||
import com.ruoyi.system.service.ISysDictTypeService;
|
||||
|
||||
/**
|
||||
* 数据字典信息
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/system/dict")
|
||||
public class SysDictTypeController extends BaseController
|
||||
{
|
||||
private String prefix = "system/dict/type";
|
||||
|
||||
@Autowired
|
||||
private ISysDictTypeService dictTypeService;
|
||||
|
||||
@RequiresPermissions("system:dict:view")
|
||||
@GetMapping()
|
||||
public String dictType()
|
||||
{
|
||||
return prefix + "/type";
|
||||
}
|
||||
|
||||
@PostMapping("/list")
|
||||
@RequiresPermissions("system:dict:list")
|
||||
@ResponseBody
|
||||
public TableDataInfo list(SysDictType dictType)
|
||||
{
|
||||
startPage();
|
||||
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "字典类型", businessType = BusinessType.EXPORT)
|
||||
@RequiresPermissions("system:dict:export")
|
||||
@PostMapping("/export")
|
||||
@ResponseBody
|
||||
public AjaxResult export(SysDictType dictType)
|
||||
{
|
||||
|
||||
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
|
||||
ExcelUtil<SysDictType> util = new ExcelUtil<SysDictType>(SysDictType.class);
|
||||
return util.exportExcel(list, "字典类型");
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增字典类型
|
||||
*/
|
||||
@GetMapping("/add")
|
||||
public String add()
|
||||
{
|
||||
return prefix + "/add";
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增保存字典类型
|
||||
*/
|
||||
@Log(title = "字典类型", businessType = BusinessType.INSERT)
|
||||
@RequiresPermissions("system:dict:add")
|
||||
@PostMapping("/add")
|
||||
@ResponseBody
|
||||
public AjaxResult addSave(@Validated SysDictType dict)
|
||||
{
|
||||
if (UserConstants.DICT_TYPE_NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict)))
|
||||
{
|
||||
return error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在");
|
||||
}
|
||||
dict.setCreateBy(ShiroUtils.getLoginName());
|
||||
return toAjax(dictTypeService.insertDictType(dict));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改字典类型
|
||||
*/
|
||||
@GetMapping("/edit/{dictId}")
|
||||
public String edit(@PathVariable("dictId") Long dictId, ModelMap mmap)
|
||||
{
|
||||
mmap.put("dict", dictTypeService.selectDictTypeById(dictId));
|
||||
return prefix + "/edit";
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存字典类型
|
||||
*/
|
||||
@Log(title = "字典类型", businessType = BusinessType.UPDATE)
|
||||
@RequiresPermissions("system:dict:edit")
|
||||
@PostMapping("/edit")
|
||||
@ResponseBody
|
||||
public AjaxResult editSave(@Validated SysDictType dict)
|
||||
{
|
||||
if (UserConstants.DICT_TYPE_NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict)))
|
||||
{
|
||||
return error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在");
|
||||
}
|
||||
dict.setUpdateBy(ShiroUtils.getLoginName());
|
||||
return toAjax(dictTypeService.updateDictType(dict));
|
||||
}
|
||||
|
||||
@Log(title = "字典类型", businessType = BusinessType.DELETE)
|
||||
@RequiresPermissions("system:dict:remove")
|
||||
@PostMapping("/remove")
|
||||
@ResponseBody
|
||||
public AjaxResult remove(String ids)
|
||||
{
|
||||
try
|
||||
{
|
||||
return toAjax(dictTypeService.deleteDictTypeByIds(ids));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询字典详细
|
||||
*/
|
||||
@RequiresPermissions("system:dict:list")
|
||||
@GetMapping("/detail/{dictId}")
|
||||
public String detail(@PathVariable("dictId") Long dictId, ModelMap mmap)
|
||||
{
|
||||
mmap.put("dict", dictTypeService.selectDictTypeById(dictId));
|
||||
mmap.put("dictList", dictTypeService.selectDictTypeAll());
|
||||
return "system/dict/data/data";
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验字典类型
|
||||
*/
|
||||
@PostMapping("/checkDictTypeUnique")
|
||||
@ResponseBody
|
||||
public String checkDictTypeUnique(SysDictType dictType)
|
||||
{
|
||||
return dictTypeService.checkDictTypeUnique(dictType);
|
||||
}
|
||||
|
||||
/**
|
||||
* 选择字典树
|
||||
*/
|
||||
@GetMapping("/selectDictTree/{columnId}/{dictType}")
|
||||
public String selectDeptTree(@PathVariable("columnId") Long columnId, @PathVariable("dictType") String dictType,
|
||||
ModelMap mmap)
|
||||
{
|
||||
mmap.put("columnId", columnId);
|
||||
mmap.put("dict", dictTypeService.selectDictTypeByType(dictType));
|
||||
return prefix + "/tree";
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载字典列表树
|
||||
*/
|
||||
@GetMapping("/treeData")
|
||||
@ResponseBody
|
||||
public List<Ztree> treeData()
|
||||
{
|
||||
List<Ztree> ztrees = dictTypeService.selectDictTree(new SysDictType());
|
||||
return ztrees;
|
||||
}
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
package com.ruoyi.web.controller.system;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import com.ruoyi.common.config.Global;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.framework.util.ShiroUtils;
|
||||
import com.ruoyi.system.domain.SysMenu;
|
||||
import com.ruoyi.system.domain.SysUser;
|
||||
import com.ruoyi.system.service.ISysMenuService;
|
||||
|
||||
/**
|
||||
* 首页 业务处理
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Controller
|
||||
public class SysIndexController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysMenuService menuService;
|
||||
|
||||
// 系统首页
|
||||
@GetMapping("/index")
|
||||
public String index(ModelMap mmap)
|
||||
{
|
||||
// 取身份信息
|
||||
SysUser user = ShiroUtils.getSysUser();
|
||||
// 根据用户id取出菜单
|
||||
List<SysMenu> menus = menuService.selectMenusByUser(user);
|
||||
mmap.put("menus", menus);
|
||||
mmap.put("user", user);
|
||||
mmap.put("copyrightYear", Global.getCopyrightYear());
|
||||
mmap.put("demoEnabled", Global.isDemoEnabled());
|
||||
return "index";
|
||||
}
|
||||
|
||||
// 切换主题
|
||||
@GetMapping("/system/switchSkin")
|
||||
public String switchSkin(ModelMap mmap)
|
||||
{
|
||||
return "skin";
|
||||
}
|
||||
|
||||
// 系统介绍
|
||||
@GetMapping("/system/main")
|
||||
public String main(ModelMap mmap)
|
||||
{
|
||||
mmap.put("version", Global.getVersion());
|
||||
return "main";
|
||||
}
|
||||
}
|
@ -0,0 +1,196 @@
|
||||
package com.ruoyi.web.controller.system;
|
||||
|
||||
import java.util.List;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.constant.UserConstants;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.Ztree;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.framework.util.ShiroUtils;
|
||||
import com.ruoyi.system.domain.SysMenu;
|
||||
import com.ruoyi.system.domain.SysRole;
|
||||
import com.ruoyi.system.service.ISysMenuService;
|
||||
|
||||
/**
|
||||
* 菜单信息
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/system/menu")
|
||||
public class SysMenuController extends BaseController
|
||||
{
|
||||
private String prefix = "system/menu";
|
||||
|
||||
@Autowired
|
||||
private ISysMenuService menuService;
|
||||
|
||||
@RequiresPermissions("system:menu:view")
|
||||
@GetMapping()
|
||||
public String menu()
|
||||
{
|
||||
return prefix + "/menu";
|
||||
}
|
||||
|
||||
@RequiresPermissions("system:menu:list")
|
||||
@PostMapping("/list")
|
||||
@ResponseBody
|
||||
public List<SysMenu> list(SysMenu menu)
|
||||
{
|
||||
Long userId = ShiroUtils.getUserId();
|
||||
List<SysMenu> menuList = menuService.selectMenuList(menu, userId);
|
||||
return menuList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除菜单
|
||||
*/
|
||||
@Log(title = "菜单管理", businessType = BusinessType.DELETE)
|
||||
@RequiresPermissions("system:menu:remove")
|
||||
@GetMapping("/remove/{menuId}")
|
||||
@ResponseBody
|
||||
public AjaxResult remove(@PathVariable("menuId") Long menuId)
|
||||
{
|
||||
if (menuService.selectCountMenuByParentId(menuId) > 0)
|
||||
{
|
||||
return AjaxResult.warn("存在子菜单,不允许删除");
|
||||
}
|
||||
if (menuService.selectCountRoleMenuByMenuId(menuId) > 0)
|
||||
{
|
||||
return AjaxResult.warn("菜单已分配,不允许删除");
|
||||
}
|
||||
ShiroUtils.clearCachedAuthorizationInfo();
|
||||
return toAjax(menuService.deleteMenuById(menuId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
@GetMapping("/add/{parentId}")
|
||||
public String add(@PathVariable("parentId") Long parentId, ModelMap mmap)
|
||||
{
|
||||
SysMenu menu = null;
|
||||
if (0L != parentId)
|
||||
{
|
||||
menu = menuService.selectMenuById(parentId);
|
||||
}
|
||||
else
|
||||
{
|
||||
menu = new SysMenu();
|
||||
menu.setMenuId(0L);
|
||||
menu.setMenuName("主目录");
|
||||
}
|
||||
mmap.put("menu", menu);
|
||||
return prefix + "/add";
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增保存菜单
|
||||
*/
|
||||
@Log(title = "菜单管理", businessType = BusinessType.INSERT)
|
||||
@RequiresPermissions("system:menu:add")
|
||||
@PostMapping("/add")
|
||||
@ResponseBody
|
||||
public AjaxResult addSave(@Validated SysMenu menu)
|
||||
{
|
||||
if (UserConstants.MENU_NAME_NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu)))
|
||||
{
|
||||
return error("新增菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
|
||||
}
|
||||
menu.setCreateBy(ShiroUtils.getLoginName());
|
||||
ShiroUtils.clearCachedAuthorizationInfo();
|
||||
return toAjax(menuService.insertMenu(menu));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改菜单
|
||||
*/
|
||||
@GetMapping("/edit/{menuId}")
|
||||
public String edit(@PathVariable("menuId") Long menuId, ModelMap mmap)
|
||||
{
|
||||
mmap.put("menu", menuService.selectMenuById(menuId));
|
||||
return prefix + "/edit";
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存菜单
|
||||
*/
|
||||
@Log(title = "菜单管理", businessType = BusinessType.UPDATE)
|
||||
@RequiresPermissions("system:menu:edit")
|
||||
@PostMapping("/edit")
|
||||
@ResponseBody
|
||||
public AjaxResult editSave(@Validated SysMenu menu)
|
||||
{
|
||||
if (UserConstants.MENU_NAME_NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu)))
|
||||
{
|
||||
return error("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
|
||||
}
|
||||
menu.setUpdateBy(ShiroUtils.getLoginName());
|
||||
ShiroUtils.clearCachedAuthorizationInfo();
|
||||
return toAjax(menuService.updateMenu(menu));
|
||||
}
|
||||
|
||||
/**
|
||||
* 选择菜单图标
|
||||
*/
|
||||
@GetMapping("/icon")
|
||||
public String icon()
|
||||
{
|
||||
return prefix + "/icon";
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验菜单名称
|
||||
*/
|
||||
@PostMapping("/checkMenuNameUnique")
|
||||
@ResponseBody
|
||||
public String checkMenuNameUnique(SysMenu menu)
|
||||
{
|
||||
return menuService.checkMenuNameUnique(menu);
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载角色菜单列表树
|
||||
*/
|
||||
@GetMapping("/roleMenuTreeData")
|
||||
@ResponseBody
|
||||
public List<Ztree> roleMenuTreeData(SysRole role)
|
||||
{
|
||||
Long userId = ShiroUtils.getUserId();
|
||||
List<Ztree> ztrees = menuService.roleMenuTreeData(role, userId);
|
||||
return ztrees;
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载所有菜单列表树
|
||||
*/
|
||||
@GetMapping("/menuTreeData")
|
||||
@ResponseBody
|
||||
public List<Ztree> menuTreeData()
|
||||
{
|
||||
Long userId = ShiroUtils.getUserId();
|
||||
List<Ztree> ztrees = menuService.menuTreeData(userId);
|
||||
return ztrees;
|
||||
}
|
||||
|
||||
/**
|
||||
* 选择菜单树
|
||||
*/
|
||||
@GetMapping("/selectMenuTree/{menuId}")
|
||||
public String selectMenuTree(@PathVariable("menuId") Long menuId, ModelMap mmap)
|
||||
{
|
||||
mmap.put("menu", menuService.selectMenuById(menuId));
|
||||
return prefix + "/tree";
|
||||
}
|
||||
}
|
@ -0,0 +1,112 @@
|
||||
package com.ruoyi.web.controller.system;
|
||||
|
||||
import java.util.List;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.framework.util.ShiroUtils;
|
||||
import com.ruoyi.system.domain.SysNotice;
|
||||
import com.ruoyi.system.service.ISysNoticeService;
|
||||
|
||||
/**
|
||||
* 公告 信息操作处理
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/system/notice")
|
||||
public class SysNoticeController extends BaseController
|
||||
{
|
||||
private String prefix = "system/notice";
|
||||
|
||||
@Autowired
|
||||
private ISysNoticeService noticeService;
|
||||
|
||||
@RequiresPermissions("system:notice:view")
|
||||
@GetMapping()
|
||||
public String notice()
|
||||
{
|
||||
return prefix + "/notice";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询公告列表
|
||||
*/
|
||||
@RequiresPermissions("system:notice:list")
|
||||
@PostMapping("/list")
|
||||
@ResponseBody
|
||||
public TableDataInfo list(SysNotice notice)
|
||||
{
|
||||
startPage();
|
||||
List<SysNotice> list = noticeService.selectNoticeList(notice);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增公告
|
||||
*/
|
||||
@GetMapping("/add")
|
||||
public String add()
|
||||
{
|
||||
return prefix + "/add";
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增保存公告
|
||||
*/
|
||||
@RequiresPermissions("system:notice:add")
|
||||
@Log(title = "通知公告", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/add")
|
||||
@ResponseBody
|
||||
public AjaxResult addSave(SysNotice notice)
|
||||
{
|
||||
notice.setCreateBy(ShiroUtils.getLoginName());
|
||||
return toAjax(noticeService.insertNotice(notice));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改公告
|
||||
*/
|
||||
@GetMapping("/edit/{noticeId}")
|
||||
public String edit(@PathVariable("noticeId") Long noticeId, ModelMap mmap)
|
||||
{
|
||||
mmap.put("notice", noticeService.selectNoticeById(noticeId));
|
||||
return prefix + "/edit";
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存公告
|
||||
*/
|
||||
@RequiresPermissions("system:notice:edit")
|
||||
@Log(title = "通知公告", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/edit")
|
||||
@ResponseBody
|
||||
public AjaxResult editSave(SysNotice notice)
|
||||
{
|
||||
notice.setUpdateBy(ShiroUtils.getLoginName());
|
||||
return toAjax(noticeService.updateNotice(notice));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除公告
|
||||
*/
|
||||
@RequiresPermissions("system:notice:remove")
|
||||
@Log(title = "通知公告", businessType = BusinessType.DELETE)
|
||||
@PostMapping("/remove")
|
||||
@ResponseBody
|
||||
public AjaxResult remove(String ids)
|
||||
{
|
||||
return toAjax(noticeService.deleteNoticeByIds(ids));
|
||||
}
|
||||
}
|
@ -0,0 +1,163 @@
|
||||
package com.ruoyi.web.controller.system;
|
||||
|
||||
import java.util.List;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.constant.UserConstants;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.framework.util.ShiroUtils;
|
||||
import com.ruoyi.system.domain.SysPost;
|
||||
import com.ruoyi.system.service.ISysPostService;
|
||||
|
||||
/**
|
||||
* 岗位信息操作处理
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/system/post")
|
||||
public class SysPostController extends BaseController
|
||||
{
|
||||
private String prefix = "system/post";
|
||||
|
||||
@Autowired
|
||||
private ISysPostService postService;
|
||||
|
||||
@RequiresPermissions("system:post:view")
|
||||
@GetMapping()
|
||||
public String operlog()
|
||||
{
|
||||
return prefix + "/post";
|
||||
}
|
||||
|
||||
@RequiresPermissions("system:post:list")
|
||||
@PostMapping("/list")
|
||||
@ResponseBody
|
||||
public TableDataInfo list(SysPost post)
|
||||
{
|
||||
startPage();
|
||||
List<SysPost> list = postService.selectPostList(post);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "岗位管理", businessType = BusinessType.EXPORT)
|
||||
@RequiresPermissions("system:post:export")
|
||||
@PostMapping("/export")
|
||||
@ResponseBody
|
||||
public AjaxResult export(SysPost post)
|
||||
{
|
||||
List<SysPost> list = postService.selectPostList(post);
|
||||
ExcelUtil<SysPost> util = new ExcelUtil<SysPost>(SysPost.class);
|
||||
return util.exportExcel(list, "岗位数据");
|
||||
}
|
||||
|
||||
@RequiresPermissions("system:post:remove")
|
||||
@Log(title = "岗位管理", businessType = BusinessType.DELETE)
|
||||
@PostMapping("/remove")
|
||||
@ResponseBody
|
||||
public AjaxResult remove(String ids)
|
||||
{
|
||||
try
|
||||
{
|
||||
return toAjax(postService.deletePostByIds(ids));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增岗位
|
||||
*/
|
||||
@GetMapping("/add")
|
||||
public String add()
|
||||
{
|
||||
return prefix + "/add";
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增保存岗位
|
||||
*/
|
||||
@RequiresPermissions("system:post:add")
|
||||
@Log(title = "岗位管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/add")
|
||||
@ResponseBody
|
||||
public AjaxResult addSave(@Validated SysPost post)
|
||||
{
|
||||
if (UserConstants.POST_NAME_NOT_UNIQUE.equals(postService.checkPostNameUnique(post)))
|
||||
{
|
||||
return error("新增岗位'" + post.getPostName() + "'失败,岗位名称已存在");
|
||||
}
|
||||
else if (UserConstants.POST_CODE_NOT_UNIQUE.equals(postService.checkPostCodeUnique(post)))
|
||||
{
|
||||
return error("新增岗位'" + post.getPostName() + "'失败,岗位编码已存在");
|
||||
}
|
||||
post.setCreateBy(ShiroUtils.getLoginName());
|
||||
return toAjax(postService.insertPost(post));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改岗位
|
||||
*/
|
||||
@GetMapping("/edit/{postId}")
|
||||
public String edit(@PathVariable("postId") Long postId, ModelMap mmap)
|
||||
{
|
||||
mmap.put("post", postService.selectPostById(postId));
|
||||
return prefix + "/edit";
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存岗位
|
||||
*/
|
||||
@RequiresPermissions("system:post:edit")
|
||||
@Log(title = "岗位管理", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/edit")
|
||||
@ResponseBody
|
||||
public AjaxResult editSave(@Validated SysPost post)
|
||||
{
|
||||
if (UserConstants.POST_NAME_NOT_UNIQUE.equals(postService.checkPostNameUnique(post)))
|
||||
{
|
||||
return error("修改岗位'" + post.getPostName() + "'失败,岗位名称已存在");
|
||||
}
|
||||
else if (UserConstants.POST_CODE_NOT_UNIQUE.equals(postService.checkPostCodeUnique(post)))
|
||||
{
|
||||
return error("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在");
|
||||
}
|
||||
post.setUpdateBy(ShiroUtils.getLoginName());
|
||||
return toAjax(postService.updatePost(post));
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验岗位名称
|
||||
*/
|
||||
@PostMapping("/checkPostNameUnique")
|
||||
@ResponseBody
|
||||
public String checkPostNameUnique(SysPost post)
|
||||
{
|
||||
return postService.checkPostNameUnique(post);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验岗位编码
|
||||
*/
|
||||
@PostMapping("/checkPostCodeUnique")
|
||||
@ResponseBody
|
||||
public String checkPostCodeUnique(SysPost post)
|
||||
{
|
||||
return postService.checkPostCodeUnique(post);
|
||||
}
|
||||
}
|
@ -0,0 +1,173 @@
|
||||
package com.ruoyi.web.controller.system;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.config.Global;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.file.FileUploadUtils;
|
||||
import com.ruoyi.framework.shiro.service.SysPasswordService;
|
||||
import com.ruoyi.framework.util.ShiroUtils;
|
||||
import com.ruoyi.system.domain.SysUser;
|
||||
import com.ruoyi.system.service.ISysUserService;
|
||||
|
||||
/**
|
||||
* 个人信息 业务处理
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/system/user/profile")
|
||||
public class SysProfileController extends BaseController
|
||||
{
|
||||
private static final Logger log = LoggerFactory.getLogger(SysProfileController.class);
|
||||
|
||||
private String prefix = "system/user/profile";
|
||||
|
||||
@Autowired
|
||||
private ISysUserService userService;
|
||||
|
||||
@Autowired
|
||||
private SysPasswordService passwordService;
|
||||
|
||||
/**
|
||||
* 个人信息
|
||||
*/
|
||||
@GetMapping()
|
||||
public String profile(ModelMap mmap)
|
||||
{
|
||||
SysUser user = ShiroUtils.getSysUser();
|
||||
mmap.put("user", user);
|
||||
mmap.put("roleGroup", userService.selectUserRoleGroup(user.getUserId()));
|
||||
mmap.put("postGroup", userService.selectUserPostGroup(user.getUserId()));
|
||||
return prefix + "/profile";
|
||||
}
|
||||
|
||||
@GetMapping("/checkPassword")
|
||||
@ResponseBody
|
||||
public boolean checkPassword(String password)
|
||||
{
|
||||
SysUser user = ShiroUtils.getSysUser();
|
||||
if (passwordService.matches(user, password))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@GetMapping("/resetPwd")
|
||||
public String resetPwd(ModelMap mmap)
|
||||
{
|
||||
SysUser user = ShiroUtils.getSysUser();
|
||||
mmap.put("user", userService.selectUserById(user.getUserId()));
|
||||
return prefix + "/resetPwd";
|
||||
}
|
||||
|
||||
@Log(title = "重置密码", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/resetPwd")
|
||||
@ResponseBody
|
||||
public AjaxResult resetPwd(String oldPassword, String newPassword)
|
||||
{
|
||||
SysUser user = ShiroUtils.getSysUser();
|
||||
if (StringUtils.isNotEmpty(newPassword) && passwordService.matches(user, oldPassword))
|
||||
{
|
||||
user.setSalt(ShiroUtils.randomSalt());
|
||||
user.setPassword(passwordService.encryptPassword(user.getLoginName(), newPassword, user.getSalt()));
|
||||
if (userService.resetUserPwd(user) > 0)
|
||||
{
|
||||
ShiroUtils.setSysUser(userService.selectUserById(user.getUserId()));
|
||||
return success();
|
||||
}
|
||||
return error();
|
||||
}
|
||||
else
|
||||
{
|
||||
return error("修改密码失败,旧密码错误");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户
|
||||
*/
|
||||
@GetMapping("/edit")
|
||||
public String edit(ModelMap mmap)
|
||||
{
|
||||
SysUser user = ShiroUtils.getSysUser();
|
||||
mmap.put("user", userService.selectUserById(user.getUserId()));
|
||||
return prefix + "/edit";
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改头像
|
||||
*/
|
||||
@GetMapping("/avatar")
|
||||
public String avatar(ModelMap mmap)
|
||||
{
|
||||
SysUser user = ShiroUtils.getSysUser();
|
||||
mmap.put("user", userService.selectUserById(user.getUserId()));
|
||||
return prefix + "/avatar";
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户
|
||||
*/
|
||||
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/update")
|
||||
@ResponseBody
|
||||
public AjaxResult update(SysUser user)
|
||||
{
|
||||
SysUser currentUser = ShiroUtils.getSysUser();
|
||||
currentUser.setUserName(user.getUserName());
|
||||
currentUser.setEmail(user.getEmail());
|
||||
currentUser.setPhonenumber(user.getPhonenumber());
|
||||
currentUser.setSex(user.getSex());
|
||||
if (userService.updateUserInfo(currentUser) > 0)
|
||||
{
|
||||
ShiroUtils.setSysUser(userService.selectUserById(currentUser.getUserId()));
|
||||
return success();
|
||||
}
|
||||
return error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存头像
|
||||
*/
|
||||
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/updateAvatar")
|
||||
@ResponseBody
|
||||
public AjaxResult updateAvatar(@RequestParam("avatarfile") MultipartFile file)
|
||||
{
|
||||
SysUser currentUser = ShiroUtils.getSysUser();
|
||||
try
|
||||
{
|
||||
if (!file.isEmpty())
|
||||
{
|
||||
String avatar = FileUploadUtils.upload(Global.getAvatarPath(), file);
|
||||
currentUser.setAvatar(avatar);
|
||||
if (userService.updateUserInfo(currentUser) > 0)
|
||||
{
|
||||
ShiroUtils.setSysUser(userService.selectUserById(currentUser.getUserId()));
|
||||
return success();
|
||||
}
|
||||
}
|
||||
return error();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.error("修改头像失败!", e);
|
||||
return error(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,304 @@
|
||||
package com.ruoyi.web.controller.system;
|
||||
|
||||
import java.util.List;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.constant.UserConstants;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.framework.util.ShiroUtils;
|
||||
import com.ruoyi.system.domain.SysRole;
|
||||
import com.ruoyi.system.domain.SysUser;
|
||||
import com.ruoyi.system.domain.SysUserRole;
|
||||
import com.ruoyi.system.service.ISysRoleService;
|
||||
import com.ruoyi.system.service.ISysUserService;
|
||||
|
||||
/**
|
||||
* 角色信息
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/system/role")
|
||||
public class SysRoleController extends BaseController
|
||||
{
|
||||
private String prefix = "system/role";
|
||||
|
||||
@Autowired
|
||||
private ISysRoleService roleService;
|
||||
|
||||
@Autowired
|
||||
private ISysUserService userService;
|
||||
|
||||
@RequiresPermissions("system:role:view")
|
||||
@GetMapping()
|
||||
public String role()
|
||||
{
|
||||
return prefix + "/role";
|
||||
}
|
||||
|
||||
@RequiresPermissions("system:role:list")
|
||||
@PostMapping("/list")
|
||||
@ResponseBody
|
||||
public TableDataInfo list(SysRole role)
|
||||
{
|
||||
startPage();
|
||||
List<SysRole> list = roleService.selectRoleList(role);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "角色管理", businessType = BusinessType.EXPORT)
|
||||
@RequiresPermissions("system:role:export")
|
||||
@PostMapping("/export")
|
||||
@ResponseBody
|
||||
public AjaxResult export(SysRole role)
|
||||
{
|
||||
List<SysRole> list = roleService.selectRoleList(role);
|
||||
ExcelUtil<SysRole> util = new ExcelUtil<SysRole>(SysRole.class);
|
||||
return util.exportExcel(list, "角色数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增角色
|
||||
*/
|
||||
@GetMapping("/add")
|
||||
public String add()
|
||||
{
|
||||
return prefix + "/add";
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增保存角色
|
||||
*/
|
||||
@RequiresPermissions("system:role:add")
|
||||
@Log(title = "角色管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/add")
|
||||
@ResponseBody
|
||||
public AjaxResult addSave(@Validated SysRole role)
|
||||
{
|
||||
if (UserConstants.ROLE_NAME_NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role)))
|
||||
{
|
||||
return error("新增角色'" + role.getRoleName() + "'失败,角色名称已存在");
|
||||
}
|
||||
else if (UserConstants.ROLE_KEY_NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role)))
|
||||
{
|
||||
return error("新增角色'" + role.getRoleName() + "'失败,角色权限已存在");
|
||||
}
|
||||
role.setCreateBy(ShiroUtils.getLoginName());
|
||||
ShiroUtils.clearCachedAuthorizationInfo();
|
||||
return toAjax(roleService.insertRole(role));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改角色
|
||||
*/
|
||||
@GetMapping("/edit/{roleId}")
|
||||
public String edit(@PathVariable("roleId") Long roleId, ModelMap mmap)
|
||||
{
|
||||
mmap.put("role", roleService.selectRoleById(roleId));
|
||||
return prefix + "/edit";
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存角色
|
||||
*/
|
||||
@RequiresPermissions("system:role:edit")
|
||||
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/edit")
|
||||
@ResponseBody
|
||||
public AjaxResult editSave(@Validated SysRole role)
|
||||
{
|
||||
roleService.checkRoleAllowed(role);
|
||||
if (UserConstants.ROLE_NAME_NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role)))
|
||||
{
|
||||
return error("修改角色'" + role.getRoleName() + "'失败,角色名称已存在");
|
||||
}
|
||||
else if (UserConstants.ROLE_KEY_NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role)))
|
||||
{
|
||||
return error("修改角色'" + role.getRoleName() + "'失败,角色权限已存在");
|
||||
}
|
||||
role.setUpdateBy(ShiroUtils.getLoginName());
|
||||
ShiroUtils.clearCachedAuthorizationInfo();
|
||||
return toAjax(roleService.updateRole(role));
|
||||
}
|
||||
|
||||
/**
|
||||
* 角色分配数据权限
|
||||
*/
|
||||
@GetMapping("/authDataScope/{roleId}")
|
||||
public String authDataScope(@PathVariable("roleId") Long roleId, ModelMap mmap)
|
||||
{
|
||||
mmap.put("role", roleService.selectRoleById(roleId));
|
||||
return prefix + "/dataScope";
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存角色分配数据权限
|
||||
*/
|
||||
@RequiresPermissions("system:role:edit")
|
||||
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/authDataScope")
|
||||
@ResponseBody
|
||||
public AjaxResult authDataScopeSave(SysRole role)
|
||||
{
|
||||
roleService.checkRoleAllowed(role);
|
||||
role.setUpdateBy(ShiroUtils.getLoginName());
|
||||
if (roleService.authDataScope(role) > 0)
|
||||
{
|
||||
ShiroUtils.setSysUser(userService.selectUserById(ShiroUtils.getSysUser().getUserId()));
|
||||
return success();
|
||||
}
|
||||
return error();
|
||||
}
|
||||
|
||||
@RequiresPermissions("system:role:remove")
|
||||
@Log(title = "角色管理", businessType = BusinessType.DELETE)
|
||||
@PostMapping("/remove")
|
||||
@ResponseBody
|
||||
public AjaxResult remove(String ids)
|
||||
{
|
||||
try
|
||||
{
|
||||
return toAjax(roleService.deleteRoleByIds(ids));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验角色名称
|
||||
*/
|
||||
@PostMapping("/checkRoleNameUnique")
|
||||
@ResponseBody
|
||||
public String checkRoleNameUnique(SysRole role)
|
||||
{
|
||||
return roleService.checkRoleNameUnique(role);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验角色权限
|
||||
*/
|
||||
@PostMapping("/checkRoleKeyUnique")
|
||||
@ResponseBody
|
||||
public String checkRoleKeyUnique(SysRole role)
|
||||
{
|
||||
return roleService.checkRoleKeyUnique(role);
|
||||
}
|
||||
|
||||
/**
|
||||
* 选择菜单树
|
||||
*/
|
||||
@GetMapping("/selectMenuTree")
|
||||
public String selectMenuTree()
|
||||
{
|
||||
return prefix + "/tree";
|
||||
}
|
||||
|
||||
/**
|
||||
* 角色状态修改
|
||||
*/
|
||||
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
||||
@RequiresPermissions("system:role:edit")
|
||||
@PostMapping("/changeStatus")
|
||||
@ResponseBody
|
||||
public AjaxResult changeStatus(SysRole role)
|
||||
{
|
||||
roleService.checkRoleAllowed(role);
|
||||
return toAjax(roleService.changeStatus(role));
|
||||
}
|
||||
|
||||
/**
|
||||
* 分配用户
|
||||
*/
|
||||
@RequiresPermissions("system:role:edit")
|
||||
@GetMapping("/authUser/{roleId}")
|
||||
public String authUser(@PathVariable("roleId") Long roleId, ModelMap mmap)
|
||||
{
|
||||
mmap.put("role", roleService.selectRoleById(roleId));
|
||||
return prefix + "/authUser";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询已分配用户角色列表
|
||||
*/
|
||||
@RequiresPermissions("system:role:list")
|
||||
@PostMapping("/authUser/allocatedList")
|
||||
@ResponseBody
|
||||
public TableDataInfo allocatedList(SysUser user)
|
||||
{
|
||||
startPage();
|
||||
List<SysUser> list = userService.selectAllocatedList(user);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消授权
|
||||
*/
|
||||
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
||||
@PostMapping("/authUser/cancel")
|
||||
@ResponseBody
|
||||
public AjaxResult cancelAuthUser(SysUserRole userRole)
|
||||
{
|
||||
return toAjax(roleService.deleteAuthUser(userRole));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量取消授权
|
||||
*/
|
||||
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
||||
@PostMapping("/authUser/cancelAll")
|
||||
@ResponseBody
|
||||
public AjaxResult cancelAuthUserAll(Long roleId, String userIds)
|
||||
{
|
||||
return toAjax(roleService.deleteAuthUsers(roleId, userIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 选择用户
|
||||
*/
|
||||
@GetMapping("/authUser/selectUser/{roleId}")
|
||||
public String selectUser(@PathVariable("roleId") Long roleId, ModelMap mmap)
|
||||
{
|
||||
mmap.put("role", roleService.selectRoleById(roleId));
|
||||
return prefix + "/selectUser";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询未分配用户角色列表
|
||||
*/
|
||||
@RequiresPermissions("system:role:list")
|
||||
@PostMapping("/authUser/unallocatedList")
|
||||
@ResponseBody
|
||||
public TableDataInfo unallocatedList(SysUser user)
|
||||
{
|
||||
startPage();
|
||||
List<SysUser> list = userService.selectUnallocatedList(user);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量选择用户授权
|
||||
*/
|
||||
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
||||
@PostMapping("/authUser/selectAll")
|
||||
@ResponseBody
|
||||
public AjaxResult selectAuthUserAll(Long roleId, String userIds)
|
||||
{
|
||||
return toAjax(roleService.insertAuthUsers(roleId, userIds));
|
||||
}
|
||||
}
|
@ -0,0 +1,261 @@
|
||||
package com.ruoyi.web.controller.system;
|
||||
|
||||
import java.util.List;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.constant.UserConstants;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.framework.shiro.service.SysPasswordService;
|
||||
import com.ruoyi.framework.util.ShiroUtils;
|
||||
import com.ruoyi.system.domain.SysUser;
|
||||
import com.ruoyi.system.service.ISysPostService;
|
||||
import com.ruoyi.system.service.ISysRoleService;
|
||||
import com.ruoyi.system.service.ISysUserService;
|
||||
|
||||
/**
|
||||
* 用户信息
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/system/user")
|
||||
public class SysUserController extends BaseController
|
||||
{
|
||||
private String prefix = "system/user";
|
||||
|
||||
@Autowired
|
||||
private ISysUserService userService;
|
||||
|
||||
@Autowired
|
||||
private ISysRoleService roleService;
|
||||
|
||||
@Autowired
|
||||
private ISysPostService postService;
|
||||
|
||||
@Autowired
|
||||
private SysPasswordService passwordService;
|
||||
|
||||
@RequiresPermissions("system:user:view")
|
||||
@GetMapping()
|
||||
public String user()
|
||||
{
|
||||
return prefix + "/user";
|
||||
}
|
||||
|
||||
@RequiresPermissions("system:user:list")
|
||||
@PostMapping("/list")
|
||||
@ResponseBody
|
||||
public TableDataInfo list(SysUser user)
|
||||
{
|
||||
startPage();
|
||||
List<SysUser> list = userService.selectUserList(user);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "用户管理", businessType = BusinessType.EXPORT)
|
||||
@RequiresPermissions("system:user:export")
|
||||
@PostMapping("/export")
|
||||
@ResponseBody
|
||||
public AjaxResult export(SysUser user)
|
||||
{
|
||||
List<SysUser> list = userService.selectUserList(user);
|
||||
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
|
||||
return util.exportExcel(list, "用户数据");
|
||||
}
|
||||
|
||||
@Log(title = "用户管理", businessType = BusinessType.IMPORT)
|
||||
@RequiresPermissions("system:user:import")
|
||||
@PostMapping("/importData")
|
||||
@ResponseBody
|
||||
public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception
|
||||
{
|
||||
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
|
||||
List<SysUser> userList = util.importExcel(file.getInputStream());
|
||||
String operName = ShiroUtils.getSysUser().getLoginName();
|
||||
String message = userService.importUser(userList, updateSupport, operName);
|
||||
return AjaxResult.success(message);
|
||||
}
|
||||
|
||||
@RequiresPermissions("system:user:view")
|
||||
@GetMapping("/importTemplate")
|
||||
@ResponseBody
|
||||
public AjaxResult importTemplate()
|
||||
{
|
||||
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
|
||||
return util.importTemplateExcel("用户数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增用户
|
||||
*/
|
||||
@GetMapping("/add")
|
||||
public String add(ModelMap mmap)
|
||||
{
|
||||
mmap.put("roles", roleService.selectRoleAll());
|
||||
mmap.put("posts", postService.selectPostAll());
|
||||
return prefix + "/add";
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增保存用户
|
||||
*/
|
||||
@RequiresPermissions("system:user:add")
|
||||
@Log(title = "用户管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/add")
|
||||
@ResponseBody
|
||||
public AjaxResult addSave(@Validated SysUser user)
|
||||
{
|
||||
if (UserConstants.USER_NAME_NOT_UNIQUE.equals(userService.checkLoginNameUnique(user.getLoginName())))
|
||||
{
|
||||
return error("新增用户'" + user.getLoginName() + "'失败,登录账号已存在");
|
||||
}
|
||||
else if (UserConstants.USER_PHONE_NOT_UNIQUE.equals(userService.checkPhoneUnique(user)))
|
||||
{
|
||||
return error("新增用户'" + user.getLoginName() + "'失败,手机号码已存在");
|
||||
}
|
||||
else if (UserConstants.USER_EMAIL_NOT_UNIQUE.equals(userService.checkEmailUnique(user)))
|
||||
{
|
||||
return error("新增用户'" + user.getLoginName() + "'失败,邮箱账号已存在");
|
||||
}
|
||||
user.setSalt(ShiroUtils.randomSalt());
|
||||
user.setPassword(passwordService.encryptPassword(user.getLoginName(), user.getPassword(), user.getSalt()));
|
||||
user.setCreateBy(ShiroUtils.getLoginName());
|
||||
return toAjax(userService.insertUser(user));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户
|
||||
*/
|
||||
@GetMapping("/edit/{userId}")
|
||||
public String edit(@PathVariable("userId") Long userId, ModelMap mmap)
|
||||
{
|
||||
mmap.put("user", userService.selectUserById(userId));
|
||||
mmap.put("roles", roleService.selectRolesByUserId(userId));
|
||||
mmap.put("posts", postService.selectPostsByUserId(userId));
|
||||
return prefix + "/edit";
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存用户
|
||||
*/
|
||||
@RequiresPermissions("system:user:edit")
|
||||
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/edit")
|
||||
@ResponseBody
|
||||
public AjaxResult editSave(@Validated SysUser user)
|
||||
{
|
||||
userService.checkUserAllowed(user);
|
||||
if (UserConstants.USER_PHONE_NOT_UNIQUE.equals(userService.checkPhoneUnique(user)))
|
||||
{
|
||||
return error("修改用户'" + user.getLoginName() + "'失败,手机号码已存在");
|
||||
}
|
||||
else if (UserConstants.USER_EMAIL_NOT_UNIQUE.equals(userService.checkEmailUnique(user)))
|
||||
{
|
||||
return error("修改用户'" + user.getLoginName() + "'失败,邮箱账号已存在");
|
||||
}
|
||||
user.setUpdateBy(ShiroUtils.getLoginName());
|
||||
return toAjax(userService.updateUser(user));
|
||||
}
|
||||
|
||||
@RequiresPermissions("system:user:resetPwd")
|
||||
@Log(title = "重置密码", businessType = BusinessType.UPDATE)
|
||||
@GetMapping("/resetPwd/{userId}")
|
||||
public String resetPwd(@PathVariable("userId") Long userId, ModelMap mmap)
|
||||
{
|
||||
mmap.put("user", userService.selectUserById(userId));
|
||||
return prefix + "/resetPwd";
|
||||
}
|
||||
|
||||
@RequiresPermissions("system:user:resetPwd")
|
||||
@Log(title = "重置密码", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/resetPwd")
|
||||
@ResponseBody
|
||||
public AjaxResult resetPwdSave(SysUser user)
|
||||
{
|
||||
userService.checkUserAllowed(user);
|
||||
user.setSalt(ShiroUtils.randomSalt());
|
||||
user.setPassword(passwordService.encryptPassword(user.getLoginName(), user.getPassword(), user.getSalt()));
|
||||
if (userService.resetUserPwd(user) > 0)
|
||||
{
|
||||
if (ShiroUtils.getUserId() == user.getUserId())
|
||||
{
|
||||
ShiroUtils.setSysUser(userService.selectUserById(user.getUserId()));
|
||||
}
|
||||
return success();
|
||||
}
|
||||
return error();
|
||||
}
|
||||
|
||||
@RequiresPermissions("system:user:remove")
|
||||
@Log(title = "用户管理", businessType = BusinessType.DELETE)
|
||||
@PostMapping("/remove")
|
||||
@ResponseBody
|
||||
public AjaxResult remove(String ids)
|
||||
{
|
||||
try
|
||||
{
|
||||
return toAjax(userService.deleteUserByIds(ids));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验用户名
|
||||
*/
|
||||
@PostMapping("/checkLoginNameUnique")
|
||||
@ResponseBody
|
||||
public String checkLoginNameUnique(SysUser user)
|
||||
{
|
||||
return userService.checkLoginNameUnique(user.getLoginName());
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验手机号码
|
||||
*/
|
||||
@PostMapping("/checkPhoneUnique")
|
||||
@ResponseBody
|
||||
public String checkPhoneUnique(SysUser user)
|
||||
{
|
||||
return userService.checkPhoneUnique(user);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验email邮箱
|
||||
*/
|
||||
@PostMapping("/checkEmailUnique")
|
||||
@ResponseBody
|
||||
public String checkEmailUnique(SysUser user)
|
||||
{
|
||||
return userService.checkEmailUnique(user);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户状态修改
|
||||
*/
|
||||
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
||||
@RequiresPermissions("system:user:edit")
|
||||
@PostMapping("/changeStatus")
|
||||
@ResponseBody
|
||||
public AjaxResult changeStatus(SysUser user)
|
||||
{
|
||||
userService.checkUserAllowed(user);
|
||||
return toAjax(userService.changeStatus(user));
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package com.ruoyi.web.controller.tool;
|
||||
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
|
||||
/**
|
||||
* build 表单构建
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/tool/build")
|
||||
public class BuildController extends BaseController
|
||||
{
|
||||
private String prefix = "tool/build";
|
||||
|
||||
@RequiresPermissions("tool:build:view")
|
||||
@GetMapping()
|
||||
public String build()
|
||||
{
|
||||
return prefix + "/build";
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package com.ruoyi.web.controller.tool;
|
||||
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
|
||||
/**
|
||||
* swagger 接口
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/tool/swagger")
|
||||
public class SwaggerController extends BaseController
|
||||
{
|
||||
@RequiresPermissions("tool:swagger:view")
|
||||
@GetMapping()
|
||||
public String index()
|
||||
{
|
||||
return redirect("/swagger-ui.html");
|
||||
}
|
||||
}
|
@ -0,0 +1,175 @@
|
||||
package com.ruoyi.web.controller.tool;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
/**
|
||||
* swagger 用户测试方法
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Api("用户信息管理")
|
||||
@RestController
|
||||
@RequestMapping("/test/user")
|
||||
public class TestController extends BaseController
|
||||
{
|
||||
private final static Map<Integer, UserEntity> users = new LinkedHashMap<Integer, UserEntity>();
|
||||
{
|
||||
users.put(1, new UserEntity(1, "admin", "admin123", "15888888888"));
|
||||
users.put(2, new UserEntity(2, "ry", "admin123", "15666666666"));
|
||||
}
|
||||
|
||||
@ApiOperation("获取用户列表")
|
||||
@GetMapping("/list")
|
||||
public AjaxResult userList()
|
||||
{
|
||||
List<UserEntity> userList = new ArrayList<UserEntity>(users.values());
|
||||
return AjaxResult.success(userList);
|
||||
}
|
||||
|
||||
@ApiOperation("获取用户详细")
|
||||
@ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path")
|
||||
@GetMapping("/{userId}")
|
||||
public AjaxResult getUser(@PathVariable Integer userId)
|
||||
{
|
||||
if (!users.isEmpty() && users.containsKey(userId))
|
||||
{
|
||||
return AjaxResult.success(users.get(userId));
|
||||
}
|
||||
else
|
||||
{
|
||||
return error("用户不存在");
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation("新增用户")
|
||||
@ApiImplicitParam(name = "userEntity", value = "新增用户信息", dataType = "UserEntity")
|
||||
@PostMapping("/save")
|
||||
public AjaxResult save(UserEntity user)
|
||||
{
|
||||
if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId()))
|
||||
{
|
||||
return error("用户ID不能为空");
|
||||
}
|
||||
return AjaxResult.success(users.put(user.getUserId(), user));
|
||||
}
|
||||
|
||||
@ApiOperation("更新用户")
|
||||
@ApiImplicitParam(name = "userEntity", value = "新增用户信息", dataType = "UserEntity")
|
||||
@PutMapping("/update")
|
||||
public AjaxResult update(UserEntity user)
|
||||
{
|
||||
if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId()))
|
||||
{
|
||||
return error("用户ID不能为空");
|
||||
}
|
||||
if (users.isEmpty() || !users.containsKey(user.getUserId()))
|
||||
{
|
||||
return error("用户不存在");
|
||||
}
|
||||
users.remove(user.getUserId());
|
||||
return AjaxResult.success(users.put(user.getUserId(), user));
|
||||
}
|
||||
|
||||
@ApiOperation("删除用户信息")
|
||||
@ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path")
|
||||
@DeleteMapping("/{userId}")
|
||||
public AjaxResult delete(@PathVariable Integer userId)
|
||||
{
|
||||
if (!users.isEmpty() && users.containsKey(userId))
|
||||
{
|
||||
users.remove(userId);
|
||||
return success();
|
||||
}
|
||||
else
|
||||
{
|
||||
return error("用户不存在");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ApiModel("用户实体")
|
||||
class UserEntity
|
||||
{
|
||||
@ApiModelProperty("用户ID")
|
||||
private Integer userId;
|
||||
|
||||
@ApiModelProperty("用户名称")
|
||||
private String username;
|
||||
|
||||
@ApiModelProperty("用户密码")
|
||||
private String password;
|
||||
|
||||
@ApiModelProperty("用户手机")
|
||||
private String mobile;
|
||||
|
||||
public UserEntity()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public UserEntity(Integer userId, String username, String password, String mobile)
|
||||
{
|
||||
this.userId = userId;
|
||||
this.username = username;
|
||||
this.password = password;
|
||||
this.mobile = mobile;
|
||||
}
|
||||
|
||||
public Integer getUserId()
|
||||
{
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(Integer userId)
|
||||
{
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public String getUsername()
|
||||
{
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username)
|
||||
{
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getPassword()
|
||||
{
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password)
|
||||
{
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public String getMobile()
|
||||
{
|
||||
return mobile;
|
||||
}
|
||||
|
||||
public void setMobile(String mobile)
|
||||
{
|
||||
this.mobile = mobile;
|
||||
}
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
# 数据源配置
|
||||
spring:
|
||||
datasource:
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
driverClassName: com.mysql.cj.jdbc.Driver
|
||||
druid:
|
||||
# 主库数据源
|
||||
master:
|
||||
url: jdbc:mysql://121.40.129.71:43306/ry?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
username: root
|
||||
password: root
|
||||
# 从库数据源
|
||||
slave:
|
||||
# 从数据源开关/默认关闭
|
||||
enabled: false
|
||||
url:
|
||||
username:
|
||||
password:
|
||||
# 初始连接数
|
||||
initialSize: 5
|
||||
# 最小连接池数量
|
||||
minIdle: 10
|
||||
# 最大连接池数量
|
||||
maxActive: 20
|
||||
# 配置获取连接等待超时的时间
|
||||
maxWait: 60000
|
||||
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
|
||||
timeBetweenEvictionRunsMillis: 60000
|
||||
# 配置一个连接在池中最小生存的时间,单位是毫秒
|
||||
minEvictableIdleTimeMillis: 300000
|
||||
# 配置一个连接在池中最大生存的时间,单位是毫秒
|
||||
maxEvictableIdleTimeMillis: 900000
|
||||
# 配置检测连接是否有效
|
||||
validationQuery: SELECT 1 FROM DUAL
|
||||
testWhileIdle: true
|
||||
testOnBorrow: false
|
||||
testOnReturn: false
|
||||
webStatFilter:
|
||||
enabled: true
|
||||
statViewServlet:
|
||||
enabled: true
|
||||
# 设置白名单,不填则允许所有访问
|
||||
allow:
|
||||
url-pattern: /druid/*
|
||||
# 控制台管理用户名和密码
|
||||
login-username:
|
||||
login-password:
|
||||
filter:
|
||||
stat:
|
||||
enabled: true
|
||||
# 慢SQL记录
|
||||
log-slow-sql: true
|
||||
slow-sql-millis: 1000
|
||||
merge-sql: true
|
||||
wall:
|
||||
config:
|
||||
multi-statement-allow: true
|
@ -0,0 +1,24 @@
|
||||
Application Version: ${ruoyi.version}
|
||||
Spring Boot Version: ${spring-boot.version}
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// _ooOoo_ //
|
||||
// o8888888o //
|
||||
// 88" . "88 //
|
||||
// (| ^_^ |) //
|
||||
// O\ = /O //
|
||||
// ____/`---'\____ //
|
||||
// .' \\| |// `. //
|
||||
// / \\||| : |||// \ //
|
||||
// / _||||| -:- |||||- \ //
|
||||
// | | \\\ - /// | | //
|
||||
// | \_| ''\---/'' | | //
|
||||
// \ .-\__ `-` ___/-. / //
|
||||
// ___`. .' /--.--\ `. . ___ //
|
||||
// ."" '< `.___\_<|>_/___.' >'"". //
|
||||
// | | : `- \`.;`\ _ /`;.`/ - ` : | | //
|
||||
// \ \ `-. \_ __\ /__ _/ .-` / / //
|
||||
// ========`-.____`-.___\_____/___.-`____.-'======== //
|
||||
// `=---=' //
|
||||
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //
|
||||
// 佛祖保佑 永不宕机 永无BUG //
|
||||
////////////////////////////////////////////////////////////////////
|
@ -0,0 +1,93 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration>
|
||||
<!-- 日志存放路径 -->
|
||||
<property name="log.path" value="/home/ruoyi/logs" />
|
||||
<!-- 日志输出格式 -->
|
||||
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
|
||||
|
||||
<!-- 控制台输出 -->
|
||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 系统日志输出 -->
|
||||
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/sys-info.log</file>
|
||||
<!-- 循环政策:基于时间创建日志文件 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 日志文件名格式 -->
|
||||
<fileNamePattern>${log.path}/sys-info.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<!-- 过滤的级别 -->
|
||||
<level>INFO</level>
|
||||
<!-- 匹配时的操作:接收(记录) -->
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/sys-error.log</file>
|
||||
<!-- 循环政策:基于时间创建日志文件 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 日志文件名格式 -->
|
||||
<fileNamePattern>${log.path}/sys-error.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<!-- 过滤的级别 -->
|
||||
<level>ERROR</level>
|
||||
<!-- 匹配时的操作:接收(记录) -->
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<!-- 用户访问日志输出 -->
|
||||
<appender name="sys-user" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/sys-user.log</file>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 按天回滚 daily -->
|
||||
<fileNamePattern>${log.path}/sys-user.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 系统模块日志级别控制 -->
|
||||
<logger name="com.ruoyi" level="info" />
|
||||
<!-- Spring日志级别控制 -->
|
||||
<logger name="org.springframework" level="warn" />
|
||||
|
||||
<root level="info">
|
||||
<appender-ref ref="console" />
|
||||
</root>
|
||||
|
||||
<!--系统操作日志-->
|
||||
<root level="info">
|
||||
<appender-ref ref="file_info" />
|
||||
<appender-ref ref="file_error" />
|
||||
</root>
|
||||
|
||||
<!--系统用户操作日志-->
|
||||
<logger name="sys-user" level="info">
|
||||
<appender-ref ref="sys-user"/>
|
||||
</logger>
|
||||
</configuration>
|
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE configuration
|
||||
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-config.dtd">
|
||||
<configuration>
|
||||
|
||||
<settings>
|
||||
<setting name="cacheEnabled" value="true" /> <!-- 全局映射器启用缓存 -->
|
||||
<setting name="useGeneratedKeys" value="true" /> <!-- 允许 JDBC 支持自动生成主键 -->
|
||||
<setting name="defaultExecutorType" value="REUSE" /> <!-- 配置默认的执行器 -->
|
||||
<setting name="logImpl" value="SLF4J" /> <!-- 指定 MyBatis 所用日志的具体实现 -->
|
||||
<!-- <setting name="mapUnderscoreToCamelCase" value="true"/> 驼峰式命名 -->
|
||||
</settings>
|
||||
|
||||
</configuration>
|
@ -0,0 +1,617 @@
|
||||
/*jshint curly:true, eqeqeq:true, laxbreak:true, noempty:false */
|
||||
/*
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2007-2013 Einar Lielmanis and contributors.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation files
|
||||
(the "Software"), to deal in the Software without restriction,
|
||||
including without limitation the rights to use, copy, modify, merge,
|
||||
publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
||||
BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
|
||||
Style HTML
|
||||
---------------
|
||||
|
||||
Written by Nochum Sossonko, (nsossonko@hotmail.com)
|
||||
|
||||
Based on code initially developed by: Einar Lielmanis, <elfz@laacz.lv>
|
||||
http://jsbeautifier.org/
|
||||
|
||||
Usage:
|
||||
style_html(html_source);
|
||||
|
||||
style_html(html_source, options);
|
||||
|
||||
The options are:
|
||||
indent_size (default 4) — indentation size,
|
||||
indent_char (default space) — character to indent with,
|
||||
max_char (default 250) - maximum amount of characters per line (0 = disable)
|
||||
brace_style (default "collapse") - "collapse" | "expand" | "end-expand"
|
||||
put braces on the same line as control statements (default), or put braces on own line (Allman / ANSI style), or just put end braces on own line.
|
||||
unformatted (defaults to inline tags) - list of tags, that shouldn't be reformatted
|
||||
indent_scripts (default normal) - "keep"|"separate"|"normal"
|
||||
|
||||
e.g.
|
||||
|
||||
style_html(html_source, {
|
||||
'indent_size': 2,
|
||||
'indent_char': ' ',
|
||||
'max_char': 78,
|
||||
'brace_style': 'expand',
|
||||
'unformatted': ['a', 'sub', 'sup', 'b', 'i', 'u']
|
||||
});
|
||||
*/
|
||||
|
||||
(function() {
|
||||
|
||||
function style_html(html_source, options, js_beautify, css_beautify) {
|
||||
//Wrapper function to invoke all the necessary constructors and deal with the output.
|
||||
|
||||
var multi_parser,
|
||||
indent_size,
|
||||
indent_character,
|
||||
max_char,
|
||||
brace_style,
|
||||
unformatted;
|
||||
|
||||
options = options || {};
|
||||
indent_size = options.indent_size || 4;
|
||||
indent_character = options.indent_char || ' ';
|
||||
brace_style = options.brace_style || 'collapse';
|
||||
max_char = options.max_char === 0 ? Infinity : options.max_char || 250;
|
||||
unformatted = options.unformatted || ['a', 'span', 'bdo', 'em', 'strong', 'dfn', 'code', 'samp', 'kbd', 'var', 'cite', 'abbr', 'acronym', 'q', 'sub', 'sup', 'tt', 'i', 'b', 'big', 'small', 'u', 's', 'strike', 'font', 'ins', 'del', 'pre', 'address', 'dt', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
|
||||
|
||||
function Parser() {
|
||||
|
||||
this.pos = 0; //Parser position
|
||||
this.token = '';
|
||||
this.current_mode = 'CONTENT'; //reflects the current Parser mode: TAG/CONTENT
|
||||
this.tags = { //An object to hold tags, their position, and their parent-tags, initiated with default values
|
||||
parent: 'parent1',
|
||||
parentcount: 1,
|
||||
parent1: ''
|
||||
};
|
||||
this.tag_type = '';
|
||||
this.token_text = this.last_token = this.last_text = this.token_type = '';
|
||||
|
||||
this.Utils = { //Uilities made available to the various functions
|
||||
whitespace: "\n\r\t ".split(''),
|
||||
single_token: 'br,input,link,meta,!doctype,basefont,base,area,hr,wbr,param,img,isindex,?xml,embed,?php,?,?='.split(','), //all the single tags for HTML
|
||||
extra_liners: 'head,body,/html'.split(','), //for tags that need a line of whitespace before them
|
||||
in_array: function (what, arr) {
|
||||
for (var i=0; i<arr.length; i++) {
|
||||
if (what === arr[i]) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
this.get_content = function () { //function to capture regular content between tags
|
||||
|
||||
var input_char = '',
|
||||
content = [],
|
||||
space = false; //if a space is needed
|
||||
|
||||
while (this.input.charAt(this.pos) !== '<') {
|
||||
if (this.pos >= this.input.length) {
|
||||
return content.length?content.join(''):['', 'TK_EOF'];
|
||||
}
|
||||
|
||||
input_char = this.input.charAt(this.pos);
|
||||
this.pos++;
|
||||
this.line_char_count++;
|
||||
|
||||
if (this.Utils.in_array(input_char, this.Utils.whitespace)) {
|
||||
if (content.length) {
|
||||
space = true;
|
||||
}
|
||||
this.line_char_count--;
|
||||
continue; //don't want to insert unnecessary space
|
||||
}
|
||||
else if (space) {
|
||||
if (this.line_char_count >= this.max_char) { //insert a line when the max_char is reached
|
||||
content.push('\n');
|
||||
for (var i=0; i<this.indent_level; i++) {
|
||||
content.push(this.indent_string);
|
||||
}
|
||||
this.line_char_count = 0;
|
||||
}
|
||||
else{
|
||||
content.push(' ');
|
||||
this.line_char_count++;
|
||||
}
|
||||
space = false;
|
||||
}
|
||||
content.push(input_char); //letter at-a-time (or string) inserted to an array
|
||||
}
|
||||
return content.length?content.join(''):'';
|
||||
};
|
||||
|
||||
this.get_contents_to = function (name) { //get the full content of a script or style to pass to js_beautify
|
||||
if (this.pos === this.input.length) {
|
||||
return ['', 'TK_EOF'];
|
||||
}
|
||||
var input_char = '';
|
||||
var content = '';
|
||||
var reg_match = new RegExp('</' + name + '\\s*>', 'igm');
|
||||
reg_match.lastIndex = this.pos;
|
||||
var reg_array = reg_match.exec(this.input);
|
||||
var end_script = reg_array?reg_array.index:this.input.length; //absolute end of script
|
||||
if(this.pos < end_script) { //get everything in between the script tags
|
||||
content = this.input.substring(this.pos, end_script);
|
||||
this.pos = end_script;
|
||||
}
|
||||
return content;
|
||||
};
|
||||
|
||||
this.record_tag = function (tag){ //function to record a tag and its parent in this.tags Object
|
||||
if (this.tags[tag + 'count']) { //check for the existence of this tag type
|
||||
this.tags[tag + 'count']++;
|
||||
this.tags[tag + this.tags[tag + 'count']] = this.indent_level; //and record the present indent level
|
||||
}
|
||||
else { //otherwise initialize this tag type
|
||||
this.tags[tag + 'count'] = 1;
|
||||
this.tags[tag + this.tags[tag + 'count']] = this.indent_level; //and record the present indent level
|
||||
}
|
||||
this.tags[tag + this.tags[tag + 'count'] + 'parent'] = this.tags.parent; //set the parent (i.e. in the case of a div this.tags.div1parent)
|
||||
this.tags.parent = tag + this.tags[tag + 'count']; //and make this the current parent (i.e. in the case of a div 'div1')
|
||||
};
|
||||
|
||||
this.retrieve_tag = function (tag) { //function to retrieve the opening tag to the corresponding closer
|
||||
if (this.tags[tag + 'count']) { //if the openener is not in the Object we ignore it
|
||||
var temp_parent = this.tags.parent; //check to see if it's a closable tag.
|
||||
while (temp_parent) { //till we reach '' (the initial value);
|
||||
if (tag + this.tags[tag + 'count'] === temp_parent) { //if this is it use it
|
||||
break;
|
||||
}
|
||||
temp_parent = this.tags[temp_parent + 'parent']; //otherwise keep on climbing up the DOM Tree
|
||||
}
|
||||
if (temp_parent) { //if we caught something
|
||||
this.indent_level = this.tags[tag + this.tags[tag + 'count']]; //set the indent_level accordingly
|
||||
this.tags.parent = this.tags[temp_parent + 'parent']; //and set the current parent
|
||||
}
|
||||
delete this.tags[tag + this.tags[tag + 'count'] + 'parent']; //delete the closed tags parent reference...
|
||||
delete this.tags[tag + this.tags[tag + 'count']]; //...and the tag itself
|
||||
if (this.tags[tag + 'count'] === 1) {
|
||||
delete this.tags[tag + 'count'];
|
||||
}
|
||||
else {
|
||||
this.tags[tag + 'count']--;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
this.get_tag = function (peek) { //function to get a full tag and parse its type
|
||||
var input_char = '',
|
||||
content = [],
|
||||
comment = '',
|
||||
space = false,
|
||||
tag_start, tag_end,
|
||||
orig_pos = this.pos,
|
||||
orig_line_char_count = this.line_char_count;
|
||||
|
||||
peek = peek !== undefined ? peek : false;
|
||||
|
||||
do {
|
||||
if (this.pos >= this.input.length) {
|
||||
if (peek) {
|
||||
this.pos = orig_pos;
|
||||
this.line_char_count = orig_line_char_count;
|
||||
}
|
||||
return content.length?content.join(''):['', 'TK_EOF'];
|
||||
}
|
||||
|
||||
input_char = this.input.charAt(this.pos);
|
||||
this.pos++;
|
||||
this.line_char_count++;
|
||||
|
||||
if (this.Utils.in_array(input_char, this.Utils.whitespace)) { //don't want to insert unnecessary space
|
||||
space = true;
|
||||
this.line_char_count--;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (input_char === "'" || input_char === '"') {
|
||||
if (!content[1] || content[1] !== '!') { //if we're in a comment strings don't get treated specially
|
||||
input_char += this.get_unformatted(input_char);
|
||||
space = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (input_char === '=') { //no space before =
|
||||
space = false;
|
||||
}
|
||||
|
||||
if (content.length && content[content.length-1] !== '=' && input_char !== '>' && space) {
|
||||
//no space after = or before >
|
||||
if (this.line_char_count >= this.max_char) {
|
||||
this.print_newline(false, content);
|
||||
this.line_char_count = 0;
|
||||
}
|
||||
else {
|
||||
content.push(' ');
|
||||
this.line_char_count++;
|
||||
}
|
||||
space = false;
|
||||
}
|
||||
if (input_char === '<') {
|
||||
tag_start = this.pos - 1;
|
||||
}
|
||||
content.push(input_char); //inserts character at-a-time (or string)
|
||||
} while (input_char !== '>');
|
||||
|
||||
var tag_complete = content.join('');
|
||||
var tag_index;
|
||||
if (tag_complete.indexOf(' ') !== -1) { //if there's whitespace, thats where the tag name ends
|
||||
tag_index = tag_complete.indexOf(' ');
|
||||
}
|
||||
else { //otherwise go with the tag ending
|
||||
tag_index = tag_complete.indexOf('>');
|
||||
}
|
||||
var tag_check = tag_complete.substring(1, tag_index).toLowerCase();
|
||||
if (tag_complete.charAt(tag_complete.length-2) === '/' ||
|
||||
this.Utils.in_array(tag_check, this.Utils.single_token)) { //if this tag name is a single tag type (either in the list or has a closing /)
|
||||
if ( ! peek) {
|
||||
this.tag_type = 'SINGLE';
|
||||
}
|
||||
}
|
||||
else if (tag_check === 'script') { //for later script handling
|
||||
if ( ! peek) {
|
||||
this.record_tag(tag_check);
|
||||
this.tag_type = 'SCRIPT';
|
||||
}
|
||||
}
|
||||
else if (tag_check === 'style') { //for future style handling (for now it justs uses get_content)
|
||||
if ( ! peek) {
|
||||
this.record_tag(tag_check);
|
||||
this.tag_type = 'STYLE';
|
||||
}
|
||||
}
|
||||
else if (this.is_unformatted(tag_check, unformatted)) { // do not reformat the "unformatted" tags
|
||||
comment = this.get_unformatted('</'+tag_check+'>', tag_complete); //...delegate to get_unformatted function
|
||||
content.push(comment);
|
||||
// Preserve collapsed whitespace either before or after this tag.
|
||||
if (tag_start > 0 && this.Utils.in_array(this.input.charAt(tag_start - 1), this.Utils.whitespace)){
|
||||
content.splice(0, 0, this.input.charAt(tag_start - 1));
|
||||
}
|
||||
tag_end = this.pos - 1;
|
||||
if (this.Utils.in_array(this.input.charAt(tag_end + 1), this.Utils.whitespace)){
|
||||
content.push(this.input.charAt(tag_end + 1));
|
||||
}
|
||||
this.tag_type = 'SINGLE';
|
||||
}
|
||||
else if (tag_check.charAt(0) === '!') { //peek for <!-- comment
|
||||
if (tag_check.indexOf('[if') !== -1) { //peek for <!--[if conditional comment
|
||||
if (tag_complete.indexOf('!IE') !== -1) { //this type needs a closing --> so...
|
||||
comment = this.get_unformatted('-->', tag_complete); //...delegate to get_unformatted
|
||||
content.push(comment);
|
||||
}
|
||||
if ( ! peek) {
|
||||
this.tag_type = 'START';
|
||||
}
|
||||
}
|
||||
else if (tag_check.indexOf('[endif') !== -1) {//peek for <!--[endif end conditional comment
|
||||
this.tag_type = 'END';
|
||||
this.unindent();
|
||||
}
|
||||
else if (tag_check.indexOf('[cdata[') !== -1) { //if it's a <[cdata[ comment...
|
||||
comment = this.get_unformatted(']]>', tag_complete); //...delegate to get_unformatted function
|
||||
content.push(comment);
|
||||
if ( ! peek) {
|
||||
this.tag_type = 'SINGLE'; //<![CDATA[ comments are treated like single tags
|
||||
}
|
||||
}
|
||||
else {
|
||||
comment = this.get_unformatted('-->', tag_complete);
|
||||
content.push(comment);
|
||||
this.tag_type = 'SINGLE';
|
||||
}
|
||||
}
|
||||
else if ( ! peek) {
|
||||
if (tag_check.charAt(0) === '/') { //this tag is a double tag so check for tag-ending
|
||||
this.retrieve_tag(tag_check.substring(1)); //remove it and all ancestors
|
||||
this.tag_type = 'END';
|
||||
}
|
||||
else { //otherwise it's a start-tag
|
||||
this.record_tag(tag_check); //push it on the tag stack
|
||||
this.tag_type = 'START';
|
||||
}
|
||||
if (this.Utils.in_array(tag_check, this.Utils.extra_liners)) { //check if this double needs an extra line
|
||||
this.print_newline(true, this.output);
|
||||
}
|
||||
}
|
||||
|
||||
if (peek) {
|
||||
this.pos = orig_pos;
|
||||
this.line_char_count = orig_line_char_count;
|
||||
}
|
||||
|
||||
return content.join(''); //returns fully formatted tag
|
||||
};
|
||||
|
||||
this.get_unformatted = function (delimiter, orig_tag) { //function to return unformatted content in its entirety
|
||||
|
||||
if (orig_tag && orig_tag.toLowerCase().indexOf(delimiter) !== -1) {
|
||||
return '';
|
||||
}
|
||||
var input_char = '';
|
||||
var content = '';
|
||||
var space = true;
|
||||
do {
|
||||
|
||||
if (this.pos >= this.input.length) {
|
||||
return content;
|
||||
}
|
||||
|
||||
input_char = this.input.charAt(this.pos);
|
||||
this.pos++;
|
||||
|
||||
if (this.Utils.in_array(input_char, this.Utils.whitespace)) {
|
||||
if (!space) {
|
||||
this.line_char_count--;
|
||||
continue;
|
||||
}
|
||||
if (input_char === '\n' || input_char === '\r') {
|
||||
content += '\n';
|
||||
/* Don't change tab indention for unformatted blocks. If using code for html editing, this will greatly affect <pre> tags if they are specified in the 'unformatted array'
|
||||
for (var i=0; i<this.indent_level; i++) {
|
||||
content += this.indent_string;
|
||||
}
|
||||
space = false; //...and make sure other indentation is erased
|
||||
*/
|
||||
this.line_char_count = 0;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
content += input_char;
|
||||
this.line_char_count++;
|
||||
space = true;
|
||||
|
||||
|
||||
} while (content.toLowerCase().indexOf(delimiter) === -1);
|
||||
return content;
|
||||
};
|
||||
|
||||
this.get_token = function () { //initial handler for token-retrieval
|
||||
var token;
|
||||
|
||||
if (this.last_token === 'TK_TAG_SCRIPT' || this.last_token === 'TK_TAG_STYLE') { //check if we need to format javascript
|
||||
var type = this.last_token.substr(7);
|
||||
token = this.get_contents_to(type);
|
||||
if (typeof token !== 'string') {
|
||||
return token;
|
||||
}
|
||||
return [token, 'TK_' + type];
|
||||
}
|
||||
if (this.current_mode === 'CONTENT') {
|
||||
token = this.get_content();
|
||||
if (typeof token !== 'string') {
|
||||
return token;
|
||||
}
|
||||
else {
|
||||
return [token, 'TK_CONTENT'];
|
||||
}
|
||||
}
|
||||
|
||||
if (this.current_mode === 'TAG') {
|
||||
token = this.get_tag();
|
||||
if (typeof token !== 'string') {
|
||||
return token;
|
||||
}
|
||||
else {
|
||||
var tag_name_type = 'TK_TAG_' + this.tag_type;
|
||||
return [token, tag_name_type];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
this.get_full_indent = function (level) {
|
||||
level = this.indent_level + level || 0;
|
||||
if (level < 1) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return Array(level + 1).join(this.indent_string);
|
||||
};
|
||||
|
||||
this.is_unformatted = function(tag_check, unformatted) {
|
||||
//is this an HTML5 block-level link?
|
||||
if (!this.Utils.in_array(tag_check, unformatted)){
|
||||
return false;
|
||||
}
|
||||
|
||||
if (tag_check.toLowerCase() !== 'a' || !this.Utils.in_array('a', unformatted)){
|
||||
return true;
|
||||
}
|
||||
|
||||
//at this point we have an tag; is its first child something we want to remain
|
||||
//unformatted?
|
||||
var next_tag = this.get_tag(true /* peek. */);
|
||||
|
||||
// tets next_tag to see if it is just html tag (no external content)
|
||||
var tag = (next_tag || "").match(/^\s*<\s*\/?([a-z]*)\s*[^>]*>\s*$/);
|
||||
|
||||
// if next_tag comes back but is not an isolated tag, then
|
||||
// let's treat the 'a' tag as having content
|
||||
// and respect the unformatted option
|
||||
if (!tag || this.Utils.in_array(tag, unformatted)){
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
this.printer = function (js_source, indent_character, indent_size, max_char, brace_style) { //handles input/output and some other printing functions
|
||||
|
||||
this.input = js_source || ''; //gets the input for the Parser
|
||||
this.output = [];
|
||||
this.indent_character = indent_character;
|
||||
this.indent_string = '';
|
||||
this.indent_size = indent_size;
|
||||
this.brace_style = brace_style;
|
||||
this.indent_level = 0;
|
||||
this.max_char = max_char;
|
||||
this.line_char_count = 0; //count to see if max_char was exceeded
|
||||
|
||||
for (var i=0; i<this.indent_size; i++) {
|
||||
this.indent_string += this.indent_character;
|
||||
}
|
||||
|
||||
this.print_newline = function (ignore, arr) {
|
||||
this.line_char_count = 0;
|
||||
if (!arr || !arr.length) {
|
||||
return;
|
||||
}
|
||||
if (!ignore) { //we might want the extra line
|
||||
while (this.Utils.in_array(arr[arr.length-1], this.Utils.whitespace)) {
|
||||
arr.pop();
|
||||
}
|
||||
}
|
||||
arr.push('\n');
|
||||
for (var i=0; i<this.indent_level; i++) {
|
||||
arr.push(this.indent_string);
|
||||
}
|
||||
};
|
||||
|
||||
this.print_token = function (text) {
|
||||
this.output.push(text);
|
||||
};
|
||||
|
||||
this.indent = function () {
|
||||
this.indent_level++;
|
||||
};
|
||||
|
||||
this.unindent = function () {
|
||||
if (this.indent_level > 0) {
|
||||
this.indent_level--;
|
||||
}
|
||||
};
|
||||
};
|
||||
return this;
|
||||
}
|
||||
|
||||
/*_____________________--------------------_____________________*/
|
||||
|
||||
multi_parser = new Parser(); //wrapping functions Parser
|
||||
multi_parser.printer(html_source, indent_character, indent_size, max_char, brace_style); //initialize starting values
|
||||
|
||||
while (true) {
|
||||
var t = multi_parser.get_token();
|
||||
multi_parser.token_text = t[0];
|
||||
multi_parser.token_type = t[1];
|
||||
|
||||
if (multi_parser.token_type === 'TK_EOF') {
|
||||
break;
|
||||
}
|
||||
|
||||
switch (multi_parser.token_type) {
|
||||
case 'TK_TAG_START':
|
||||
multi_parser.print_newline(false, multi_parser.output);
|
||||
multi_parser.print_token(multi_parser.token_text);
|
||||
multi_parser.indent();
|
||||
multi_parser.current_mode = 'CONTENT';
|
||||
break;
|
||||
case 'TK_TAG_STYLE':
|
||||
case 'TK_TAG_SCRIPT':
|
||||
multi_parser.print_newline(false, multi_parser.output);
|
||||
multi_parser.print_token(multi_parser.token_text);
|
||||
multi_parser.current_mode = 'CONTENT';
|
||||
break;
|
||||
case 'TK_TAG_END':
|
||||
//Print new line only if the tag has no content and has child
|
||||
if (multi_parser.last_token === 'TK_CONTENT' && multi_parser.last_text === '') {
|
||||
var tag_name = multi_parser.token_text.match(/\w+/)[0];
|
||||
var tag_extracted_from_last_output = multi_parser.output[multi_parser.output.length -1].match(/<\s*(\w+)/);
|
||||
if (tag_extracted_from_last_output === null || tag_extracted_from_last_output[1] !== tag_name) {
|
||||
multi_parser.print_newline(true, multi_parser.output);
|
||||
}
|
||||
}
|
||||
multi_parser.print_token(multi_parser.token_text);
|
||||
multi_parser.current_mode = 'CONTENT';
|
||||
break;
|
||||
case 'TK_TAG_SINGLE':
|
||||
// Don't add a newline before elements that should remain unformatted.
|
||||
var tag_check = multi_parser.token_text.match(/^\s*<([a-z]+)/i);
|
||||
if (!tag_check || !multi_parser.Utils.in_array(tag_check[1], unformatted)){
|
||||
multi_parser.print_newline(false, multi_parser.output);
|
||||
}
|
||||
multi_parser.print_token(multi_parser.token_text);
|
||||
multi_parser.current_mode = 'CONTENT';
|
||||
break;
|
||||
case 'TK_CONTENT':
|
||||
if (multi_parser.token_text !== '') {
|
||||
multi_parser.print_token(multi_parser.token_text);
|
||||
}
|
||||
multi_parser.current_mode = 'TAG';
|
||||
break;
|
||||
case 'TK_STYLE':
|
||||
case 'TK_SCRIPT':
|
||||
if (multi_parser.token_text !== '') {
|
||||
multi_parser.output.push('\n');
|
||||
var text = multi_parser.token_text,
|
||||
_beautifier,
|
||||
script_indent_level = 1;
|
||||
if (multi_parser.token_type === 'TK_SCRIPT') {
|
||||
_beautifier = typeof js_beautify === 'function' && js_beautify;
|
||||
} else if (multi_parser.token_type === 'TK_STYLE') {
|
||||
_beautifier = typeof css_beautify === 'function' && css_beautify;
|
||||
}
|
||||
|
||||
if (options.indent_scripts === "keep") {
|
||||
script_indent_level = 0;
|
||||
} else if (options.indent_scripts === "separate") {
|
||||
script_indent_level = -multi_parser.indent_level;
|
||||
}
|
||||
|
||||
var indentation = multi_parser.get_full_indent(script_indent_level);
|
||||
if (_beautifier) {
|
||||
// call the Beautifier if avaliable
|
||||
text = _beautifier(text.replace(/^\s*/, indentation), options);
|
||||
} else {
|
||||
// simply indent the string otherwise
|
||||
var white = text.match(/^\s*/)[0];
|
||||
var _level = white.match(/[^\n\r]*$/)[0].split(multi_parser.indent_string).length - 1;
|
||||
var reindent = multi_parser.get_full_indent(script_indent_level -_level);
|
||||
text = text.replace(/^\s*/, indentation)
|
||||
.replace(/\r\n|\r|\n/g, '\n' + reindent)
|
||||
.replace(/\s*$/, '');
|
||||
}
|
||||
if (text) {
|
||||
multi_parser.print_token(text);
|
||||
multi_parser.print_newline(true, multi_parser.output);
|
||||
}
|
||||
}
|
||||
multi_parser.current_mode = 'TAG';
|
||||
break;
|
||||
}
|
||||
multi_parser.last_token = multi_parser.token_type;
|
||||
multi_parser.last_text = multi_parser.token_text;
|
||||
}
|
||||
return multi_parser.output.join('');
|
||||
}
|
||||
|
||||
// If we're running a web page and don't have either of the above, add our one global
|
||||
window.html_beautify = function(html_source, options) {
|
||||
return style_html(html_source, options, window.js_beautify, window.css_beautify);
|
||||
};
|
||||
|
||||
}());
|
@ -0,0 +1,550 @@
|
||||
/*!
|
||||
* bootstrap-fileinput v5.0.4
|
||||
* http://plugins.krajee.com/file-input
|
||||
*
|
||||
* Krajee default styling for bootstrap-fileinput.
|
||||
*
|
||||
* Author: Kartik Visweswaran
|
||||
* Copyright: 2014 - 2019, Kartik Visweswaran, Krajee.com
|
||||
*
|
||||
* Licensed under the BSD-3-Clause
|
||||
* https://github.com/kartik-v/bootstrap-fileinput/blob/master/LICENSE.md
|
||||
*/
|
||||
.file-loading input[type=file], input[type=file].file-loading {
|
||||
width: 0;
|
||||
height: 0;
|
||||
}
|
||||
|
||||
.file-no-browse {
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
bottom: 20%;
|
||||
width: 1px;
|
||||
height: 1px;
|
||||
font-size: 0;
|
||||
opacity: 0;
|
||||
border: none;
|
||||
background: none;
|
||||
outline: none;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.kv-hidden, .file-caption-icon, .file-zoom-dialog .modal-header:before, .file-zoom-dialog .modal-header:after, .file-input-new .file-preview, .file-input-new .close, .file-input-new .glyphicon-file, .file-input-new .fileinput-remove-button, .file-input-new .fileinput-upload-button, .file-input-new .no-browse .input-group-btn, .file-input-ajax-new .fileinput-remove-button, .file-input-ajax-new .fileinput-upload-button, .file-input-ajax-new .no-browse .input-group-btn, .hide-content .kv-file-content, .is-locked .fileinput-upload-button, .is-locked .fileinput-remove-button {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.btn-file input[type=file], .file-caption-icon, .file-preview .fileinput-remove, .krajee-default .file-thumb-progress, .file-zoom-dialog .btn-navigate, .file-zoom-dialog .floating-buttons {
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.file-caption-icon .kv-caption-icon {
|
||||
line-height: inherit;
|
||||
}
|
||||
|
||||
.file-input, .file-loading:before, .btn-file, .file-caption, .file-preview, .krajee-default.file-preview-frame, .krajee-default .file-thumbnail-footer, .file-zoom-dialog .modal-dialog {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.file-error-message pre, .file-error-message ul, .krajee-default .file-actions, .krajee-default .file-other-error {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.file-error-message pre, .file-error-message ul {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.krajee-default .file-drag-handle, .krajee-default .file-upload-indicator {
|
||||
float: left;
|
||||
margin-top: 10px;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
}
|
||||
|
||||
.krajee-default .file-thumb-progress .progress, .krajee-default .file-thumb-progress .progress-bar {
|
||||
height: 20px;
|
||||
font-family: Verdana, Helvetica, sans-serif;
|
||||
font-size: 9px;
|
||||
}
|
||||
|
||||
.krajee-default .file-thumb-progress .progress, .kv-upload-progress .progress {
|
||||
background-color: #ccc;
|
||||
}
|
||||
|
||||
.krajee-default .file-caption-info, .krajee-default .file-size-info {
|
||||
display: block;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
width: 160px;
|
||||
height: 15px;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
.file-zoom-content > .file-object.type-video, .file-zoom-content > .file-object.type-flash, .file-zoom-content > .file-object.type-image {
|
||||
max-width: 100%;
|
||||
max-height: 100%;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
.file-zoom-content > .file-object.type-video, .file-zoom-content > .file-object.type-flash {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.file-zoom-content > .file-object.type-pdf, .file-zoom-content > .file-object.type-html, .file-zoom-content > .file-object.type-text, .file-zoom-content > .file-object.type-default {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.file-loading:before {
|
||||
content: " Loading...";
|
||||
display: inline-block;
|
||||
padding-left: 20px;
|
||||
line-height: 16px;
|
||||
font-size: 13px;
|
||||
font-variant: small-caps;
|
||||
color: #999;
|
||||
background: transparent url(loading.gif) top left no-repeat;
|
||||
}
|
||||
|
||||
.file-object {
|
||||
margin: 0 0 -5px 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.btn-file {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.btn-file input[type=file] {
|
||||
top: 0;
|
||||
left: 0;
|
||||
min-width: 100%;
|
||||
min-height: 100%;
|
||||
text-align: right;
|
||||
opacity: 0;
|
||||
background: none repeat scroll 0 0 transparent;
|
||||
cursor: inherit;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.btn-file ::-ms-browse {
|
||||
font-size: 10000px;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.file-caption .file-caption-name {
|
||||
width: 100%;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-shadow: none;
|
||||
border: none;
|
||||
background: none;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.file-caption.icon-visible .file-caption-icon {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.file-caption.icon-visible .file-caption-name {
|
||||
padding-left: 15px;
|
||||
}
|
||||
|
||||
.file-caption-icon {
|
||||
left: 8px;
|
||||
}
|
||||
|
||||
.file-error-message {
|
||||
color: #a94442;
|
||||
background-color: #f2dede;
|
||||
margin: 5px;
|
||||
border: 1px solid #ebccd1;
|
||||
border-radius: 4px;
|
||||
padding: 15px;
|
||||
}
|
||||
|
||||
.file-error-message pre {
|
||||
margin: 5px 0;
|
||||
}
|
||||
|
||||
.file-caption-disabled {
|
||||
background-color: #eee;
|
||||
cursor: not-allowed;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.file-preview {
|
||||
border-radius: 5px;
|
||||
border: 1px solid #ddd;
|
||||
padding: 8px;
|
||||
width: 100%;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.file-preview .btn-xs {
|
||||
padding: 1px 5px;
|
||||
font-size: 12px;
|
||||
line-height: 1.5;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.file-preview .fileinput-remove {
|
||||
top: 1px;
|
||||
right: 1px;
|
||||
line-height: 10px;
|
||||
}
|
||||
|
||||
.file-preview .clickable {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.file-preview-image {
|
||||
font: 40px Impact, Charcoal, sans-serif;
|
||||
color: #008000;
|
||||
}
|
||||
|
||||
.krajee-default.file-preview-frame {
|
||||
margin: 8px;
|
||||
border: 1px solid rgba(0,0,0,0.2);
|
||||
box-shadow: 0 0 10px 0 rgba(0,0,0,0.2);
|
||||
padding: 6px;
|
||||
float: left;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.krajee-default.file-preview-frame .kv-file-content {
|
||||
width: 213px;
|
||||
height: 160px;
|
||||
}
|
||||
|
||||
.krajee-default .file-preview-other-frame {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.krajee-default.file-preview-frame .kv-file-content.kv-pdf-rendered {
|
||||
width: 400px;
|
||||
}
|
||||
|
||||
.krajee-default.file-preview-frame[data-template="audio"] .kv-file-content {
|
||||
width: 240px;
|
||||
height: 55px;
|
||||
}
|
||||
|
||||
.krajee-default.file-preview-frame .file-thumbnail-footer {
|
||||
height: 70px;
|
||||
}
|
||||
|
||||
.krajee-default.file-preview-frame:not(.file-preview-error):hover {
|
||||
border: 1px solid rgba(0,0,0,0.3);
|
||||
box-shadow: 0 0 10px 0 rgba(0,0,0,0.4);
|
||||
}
|
||||
|
||||
.krajee-default .file-preview-text {
|
||||
display: block;
|
||||
color: #428bca;
|
||||
border: 1px solid #ddd;
|
||||
font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
|
||||
outline: none;
|
||||
padding: 8px;
|
||||
resize: none;
|
||||
}
|
||||
|
||||
.krajee-default .file-preview-html {
|
||||
border: 1px solid #ddd;
|
||||
padding: 8px;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.krajee-default .file-other-icon {
|
||||
font-size: 6em;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.krajee-default .file-footer-buttons {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.krajee-default .file-footer-caption {
|
||||
display: block;
|
||||
text-align: center;
|
||||
padding-top: 4px;
|
||||
font-size: 11px;
|
||||
color: #777;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.file-upload-stats {
|
||||
font-size: 10px;
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.kv-upload-progress .file-upload-stats {
|
||||
font-size: 12px;
|
||||
margin: -10px 0 5px;
|
||||
}
|
||||
|
||||
.krajee-default .file-preview-error {
|
||||
opacity: 0.65;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.krajee-default .file-thumb-progress {
|
||||
height: 11px;
|
||||
top: 37px;
|
||||
left: 0;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.krajee-default.kvsortable-ghost {
|
||||
background: #e1edf7;
|
||||
border: 2px solid #a1abff;
|
||||
}
|
||||
|
||||
.krajee-default .file-preview-other:hover {
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
.krajee-default .file-preview-frame:not(.file-preview-error) .file-footer-caption:hover {
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.kv-upload-progress .progress {
|
||||
height: 20px;
|
||||
margin: 10px 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.kv-upload-progress .progress-bar {
|
||||
height: 20px;
|
||||
font-family: Verdana, Helvetica, sans-serif;
|
||||
}
|
||||
|
||||
/*noinspection CssOverwrittenProperties*/
|
||||
.file-zoom-dialog .file-other-icon {
|
||||
font-size: 22em;
|
||||
font-size: 50vmin;
|
||||
}
|
||||
|
||||
.file-zoom-dialog .modal-dialog {
|
||||
width: auto;
|
||||
}
|
||||
|
||||
.file-zoom-dialog .modal-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.file-zoom-dialog .btn-navigate {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
background: transparent;
|
||||
text-decoration: none;
|
||||
outline: none;
|
||||
opacity: 0.7;
|
||||
top: 45%;
|
||||
font-size: 4em;
|
||||
color: #1c94c4;
|
||||
}
|
||||
|
||||
.file-zoom-dialog .btn-navigate:not([disabled]):hover {
|
||||
outline: none;
|
||||
box-shadow: none;
|
||||
opacity: 0.6;
|
||||
}
|
||||
|
||||
.file-zoom-dialog .floating-buttons {
|
||||
top: 5px;
|
||||
right: 10px;
|
||||
}
|
||||
|
||||
.file-zoom-dialog .btn-navigate[disabled] {
|
||||
opacity: 0.3;
|
||||
}
|
||||
|
||||
.file-zoom-dialog .btn-prev {
|
||||
left: 1px;
|
||||
}
|
||||
|
||||
.file-zoom-dialog .btn-next {
|
||||
right: 1px;
|
||||
}
|
||||
|
||||
.file-zoom-dialog .kv-zoom-title {
|
||||
font-weight: 300;
|
||||
color: #999;
|
||||
max-width: 50%;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.file-input-new .no-browse .form-control {
|
||||
border-top-right-radius: 4px;
|
||||
border-bottom-right-radius: 4px;
|
||||
}
|
||||
|
||||
.file-input-ajax-new .no-browse .form-control {
|
||||
border-top-right-radius: 4px;
|
||||
border-bottom-right-radius: 4px;
|
||||
}
|
||||
|
||||
.file-caption-main {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.file-thumb-loading {
|
||||
background: transparent url(loading.gif) no-repeat scroll center center content-box !important;
|
||||
}
|
||||
|
||||
.file-drop-zone {
|
||||
border: 1px dashed #aaa;
|
||||
border-radius: 4px;
|
||||
text-align: center;
|
||||
vertical-align: middle;
|
||||
margin: 12px 15px 12px 12px;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
.file-drop-zone.clickable:hover {
|
||||
border: 2px dashed #999;
|
||||
}
|
||||
|
||||
.file-drop-zone.clickable:focus {
|
||||
border: 2px solid #5acde2;
|
||||
}
|
||||
|
||||
.file-drop-zone .file-preview-thumbnails {
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.file-drop-zone-title {
|
||||
color: #aaa;
|
||||
font-size: 1.6em;
|
||||
padding: 85px 10px;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.file-highlighted {
|
||||
border: 2px dashed #999 !important;
|
||||
background-color: #eee;
|
||||
}
|
||||
|
||||
.file-uploading {
|
||||
background: url(loading-sm.gif) no-repeat center bottom 10px;
|
||||
opacity: 0.65;
|
||||
}
|
||||
|
||||
.file-zoom-fullscreen .modal-dialog {
|
||||
min-width: 100%;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.file-zoom-fullscreen .modal-content {
|
||||
border-radius: 0;
|
||||
box-shadow: none;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
.file-zoom-fullscreen .modal-body {
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.floating-buttons {
|
||||
z-index: 3000;
|
||||
}
|
||||
|
||||
.floating-buttons .btn-kv {
|
||||
margin-left: 3px;
|
||||
z-index: 3000;
|
||||
}
|
||||
|
||||
.kv-zoom-actions .btn-kv {
|
||||
margin-left: 3px;
|
||||
}
|
||||
|
||||
.file-zoom-content {
|
||||
height: 480px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.file-zoom-content .file-preview-image {
|
||||
max-height: 100%;
|
||||
}
|
||||
|
||||
.file-zoom-content .file-preview-video {
|
||||
max-height: 100%;
|
||||
}
|
||||
|
||||
.file-zoom-content > .file-object.type-image {
|
||||
height: auto;
|
||||
min-height: inherit;
|
||||
}
|
||||
|
||||
.file-zoom-content > .file-object.type-audio {
|
||||
width: auto;
|
||||
height: 30px;
|
||||
}
|
||||
|
||||
@media (min-width: 576px) {
|
||||
.file-zoom-dialog .modal-dialog {
|
||||
max-width: 500px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 992px) {
|
||||
.file-zoom-dialog .modal-lg {
|
||||
max-width: 800px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 767px) {
|
||||
.file-preview-thumbnails {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.file-zoom-dialog .modal-header {
|
||||
flex-direction: column;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 350px) {
|
||||
.krajee-default.file-preview-frame:not([data-template="audio"]) .kv-file-content {
|
||||
width: 160px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 420px) {
|
||||
.krajee-default.file-preview-frame .kv-file-content.kv-pdf-rendered {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.file-loading[dir=rtl]:before {
|
||||
background: transparent url(loading.gif) top right no-repeat;
|
||||
padding-left: 0;
|
||||
padding-right: 20px;
|
||||
}
|
||||
|
||||
.file-sortable .file-drag-handle {
|
||||
cursor: move;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.file-sortable .file-drag-handle:hover {
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
.clickable .file-drop-zone-title {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.file-preview-initial.sortable-chosen {
|
||||
background-color: #d9edf7;
|
||||
}
|
After Width: | Height: | Size: 2.6 KiB |
After Width: | Height: | Size: 847 B |
@ -0,0 +1,429 @@
|
||||
/*!
|
||||
* Bootstrap-select v1.13.10 (https://developer.snapappointments.com/bootstrap-select)
|
||||
*
|
||||
* Copyright 2012-2019 SnapAppointments, LLC
|
||||
* Licensed under MIT (https://github.com/snapappointments/bootstrap-select/blob/master/LICENSE)
|
||||
*/
|
||||
|
||||
select.bs-select-hidden,
|
||||
.bootstrap-select > select.bs-select-hidden,
|
||||
select.selectpicker {
|
||||
display: none !important;
|
||||
}
|
||||
.bootstrap-select {
|
||||
width: 220px \0;
|
||||
/*IE9 and below*/
|
||||
vertical-align: middle;
|
||||
}
|
||||
.bootstrap-select > .dropdown-toggle {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
text-align: right;
|
||||
white-space: nowrap;
|
||||
display: -webkit-inline-box;
|
||||
display: -webkit-inline-flex;
|
||||
display: -ms-inline-flexbox;
|
||||
display: inline-flex;
|
||||
-webkit-box-align: center;
|
||||
-webkit-align-items: center;
|
||||
-ms-flex-align: center;
|
||||
align-items: center;
|
||||
-webkit-box-pack: justify;
|
||||
-webkit-justify-content: space-between;
|
||||
-ms-flex-pack: justify;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.bootstrap-select > .dropdown-toggle:after {
|
||||
margin-top: -1px;
|
||||
}
|
||||
.bootstrap-select > .dropdown-toggle.bs-placeholder,
|
||||
.bootstrap-select > .dropdown-toggle.bs-placeholder:hover,
|
||||
.bootstrap-select > .dropdown-toggle.bs-placeholder:focus,
|
||||
.bootstrap-select > .dropdown-toggle.bs-placeholder:active {
|
||||
color: #999;
|
||||
}
|
||||
.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-primary,
|
||||
.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-secondary,
|
||||
.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-success,
|
||||
.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-danger,
|
||||
.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-info,
|
||||
.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-dark,
|
||||
.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-primary:hover,
|
||||
.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-secondary:hover,
|
||||
.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-success:hover,
|
||||
.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-danger:hover,
|
||||
.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-info:hover,
|
||||
.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-dark:hover,
|
||||
.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-primary:focus,
|
||||
.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-secondary:focus,
|
||||
.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-success:focus,
|
||||
.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-danger:focus,
|
||||
.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-info:focus,
|
||||
.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-dark:focus,
|
||||
.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-primary:active,
|
||||
.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-secondary:active,
|
||||
.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-success:active,
|
||||
.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-danger:active,
|
||||
.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-info:active,
|
||||
.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-dark:active {
|
||||
color: rgba(255, 255, 255, 0.5);
|
||||
}
|
||||
.bootstrap-select > select {
|
||||
position: absolute !important;
|
||||
bottom: 0;
|
||||
left: 50%;
|
||||
display: block !important;
|
||||
width: 0.5px !important;
|
||||
height: 100% !important;
|
||||
padding: 0 !important;
|
||||
opacity: 0 !important;
|
||||
border: none;
|
||||
z-index: 0 !important;
|
||||
}
|
||||
.bootstrap-select > select.mobile-device {
|
||||
top: 0;
|
||||
left: 0;
|
||||
display: block !important;
|
||||
width: 100% !important;
|
||||
z-index: 2 !important;
|
||||
}
|
||||
.has-error .bootstrap-select .dropdown-toggle,
|
||||
.error .bootstrap-select .dropdown-toggle,
|
||||
.bootstrap-select.is-invalid .dropdown-toggle,
|
||||
.was-validated .bootstrap-select .selectpicker:invalid + .dropdown-toggle {
|
||||
border-color: #b94a48;
|
||||
}
|
||||
.bootstrap-select.is-valid .dropdown-toggle,
|
||||
.was-validated .bootstrap-select .selectpicker:valid + .dropdown-toggle {
|
||||
border-color: #28a745;
|
||||
}
|
||||
.bootstrap-select.fit-width {
|
||||
width: auto !important;
|
||||
}
|
||||
.bootstrap-select:not([class*="col-"]):not([class*="form-control"]):not(.input-group-btn) {
|
||||
width: 220px;
|
||||
}
|
||||
.bootstrap-select > select.mobile-device:focus + .dropdown-toggle,
|
||||
.bootstrap-select .dropdown-toggle:focus {
|
||||
outline: thin dotted #333333 !important;
|
||||
outline: 5px auto -webkit-focus-ring-color !important;
|
||||
outline-offset: -2px;
|
||||
}
|
||||
.bootstrap-select.form-control {
|
||||
margin-bottom: 0;
|
||||
padding: 0;
|
||||
border: none;
|
||||
height: auto;
|
||||
}
|
||||
:not(.input-group) > .bootstrap-select.form-control:not([class*="col-"]) {
|
||||
width: 100%;
|
||||
}
|
||||
.bootstrap-select.form-control.input-group-btn {
|
||||
float: none;
|
||||
z-index: auto;
|
||||
}
|
||||
.form-inline .bootstrap-select,
|
||||
.form-inline .bootstrap-select.form-control:not([class*="col-"]) {
|
||||
width: auto;
|
||||
}
|
||||
.bootstrap-select:not(.input-group-btn),
|
||||
.bootstrap-select[class*="col-"] {
|
||||
float: none;
|
||||
display: inline-block;
|
||||
margin-left: 0;
|
||||
}
|
||||
.bootstrap-select.dropdown-menu-right,
|
||||
.bootstrap-select[class*="col-"].dropdown-menu-right,
|
||||
.row .bootstrap-select[class*="col-"].dropdown-menu-right {
|
||||
float: right;
|
||||
}
|
||||
.form-inline .bootstrap-select,
|
||||
.form-horizontal .bootstrap-select,
|
||||
.form-group .bootstrap-select {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.form-group-lg .bootstrap-select.form-control,
|
||||
.form-group-sm .bootstrap-select.form-control {
|
||||
padding: 0;
|
||||
}
|
||||
.form-group-lg .bootstrap-select.form-control .dropdown-toggle,
|
||||
.form-group-sm .bootstrap-select.form-control .dropdown-toggle {
|
||||
height: 100%;
|
||||
font-size: inherit;
|
||||
line-height: inherit;
|
||||
border-radius: inherit;
|
||||
}
|
||||
.bootstrap-select.form-control-sm .dropdown-toggle,
|
||||
.bootstrap-select.form-control-lg .dropdown-toggle {
|
||||
font-size: inherit;
|
||||
line-height: inherit;
|
||||
border-radius: inherit;
|
||||
}
|
||||
.bootstrap-select.form-control-sm .dropdown-toggle {
|
||||
padding: 0.25rem 0.5rem;
|
||||
}
|
||||
.bootstrap-select.form-control-lg .dropdown-toggle {
|
||||
padding: 0.5rem 1rem;
|
||||
}
|
||||
.form-inline .bootstrap-select .form-control {
|
||||
width: 100%;
|
||||
}
|
||||
.bootstrap-select.disabled,
|
||||
.bootstrap-select > .disabled {
|
||||
cursor: not-allowed;
|
||||
}
|
||||
.bootstrap-select.disabled:focus,
|
||||
.bootstrap-select > .disabled:focus {
|
||||
outline: none !important;
|
||||
}
|
||||
.bootstrap-select.bs-container {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
height: 0 !important;
|
||||
padding: 0 !important;
|
||||
}
|
||||
.bootstrap-select.bs-container .dropdown-menu {
|
||||
z-index: 1060;
|
||||
}
|
||||
.bootstrap-select .dropdown-toggle .filter-option {
|
||||
position: static;
|
||||
top: 0;
|
||||
left: 0;
|
||||
float: left;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
text-align: left;
|
||||
overflow: hidden;
|
||||
-webkit-box-flex: 0;
|
||||
-webkit-flex: 0 1 auto;
|
||||
-ms-flex: 0 1 auto;
|
||||
flex: 0 1 auto;
|
||||
}
|
||||
.bs3.bootstrap-select .dropdown-toggle .filter-option {
|
||||
padding-right: inherit;
|
||||
}
|
||||
.input-group .bs3-has-addon.bootstrap-select .dropdown-toggle .filter-option {
|
||||
position: absolute;
|
||||
padding-top: inherit;
|
||||
padding-bottom: inherit;
|
||||
padding-left: inherit;
|
||||
float: none;
|
||||
}
|
||||
.input-group .bs3-has-addon.bootstrap-select .dropdown-toggle .filter-option .filter-option-inner {
|
||||
padding-right: inherit;
|
||||
}
|
||||
.bootstrap-select .dropdown-toggle .filter-option-inner-inner {
|
||||
overflow: hidden;
|
||||
}
|
||||
.bootstrap-select .dropdown-toggle .filter-expand {
|
||||
width: 0 !important;
|
||||
float: left;
|
||||
opacity: 0 !important;
|
||||
overflow: hidden;
|
||||
}
|
||||
.bootstrap-select .dropdown-toggle .caret {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
right: 12px;
|
||||
margin-top: -2px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.input-group .bootstrap-select.form-control .dropdown-toggle {
|
||||
border-radius: inherit;
|
||||
}
|
||||
.bootstrap-select[class*="col-"] .dropdown-toggle {
|
||||
width: 100%;
|
||||
}
|
||||
.bootstrap-select .dropdown-menu {
|
||||
min-width: 100%;
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.bootstrap-select .dropdown-menu > .inner:focus {
|
||||
outline: none !important;
|
||||
}
|
||||
.bootstrap-select .dropdown-menu.inner {
|
||||
position: static;
|
||||
float: none;
|
||||
border: 0;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
border-radius: 0;
|
||||
-webkit-box-shadow: none;
|
||||
box-shadow: none;
|
||||
}
|
||||
.bootstrap-select .dropdown-menu li {
|
||||
position: relative;
|
||||
}
|
||||
.bootstrap-select .dropdown-menu li.active small {
|
||||
color: rgba(255, 255, 255, 0.5) !important;
|
||||
}
|
||||
.bootstrap-select .dropdown-menu li.disabled a {
|
||||
cursor: not-allowed;
|
||||
}
|
||||
.bootstrap-select .dropdown-menu li a {
|
||||
cursor: pointer;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
.bootstrap-select .dropdown-menu li a.opt {
|
||||
position: relative;
|
||||
padding-left: 2.25em;
|
||||
}
|
||||
.bootstrap-select .dropdown-menu li a span.check-mark {
|
||||
display: none;
|
||||
}
|
||||
.bootstrap-select .dropdown-menu li a span.text {
|
||||
display: inline-block;
|
||||
}
|
||||
.bootstrap-select .dropdown-menu li small {
|
||||
padding-left: 0.5em;
|
||||
}
|
||||
.bootstrap-select .dropdown-menu .notify {
|
||||
position: absolute;
|
||||
bottom: 5px;
|
||||
width: 96%;
|
||||
margin: 0 2%;
|
||||
min-height: 26px;
|
||||
padding: 3px 5px;
|
||||
background: #f5f5f5;
|
||||
border: 1px solid #e3e3e3;
|
||||
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
|
||||
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
|
||||
pointer-events: none;
|
||||
opacity: 0.9;
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.bootstrap-select .no-results {
|
||||
padding: 3px;
|
||||
background: #f5f5f5;
|
||||
margin: 0 5px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.bootstrap-select.fit-width .dropdown-toggle .filter-option {
|
||||
position: static;
|
||||
display: inline;
|
||||
padding: 0;
|
||||
}
|
||||
.bootstrap-select.fit-width .dropdown-toggle .filter-option-inner,
|
||||
.bootstrap-select.fit-width .dropdown-toggle .filter-option-inner-inner {
|
||||
display: inline;
|
||||
}
|
||||
.bootstrap-select.fit-width .dropdown-toggle .bs-caret:before {
|
||||
content: '\00a0';
|
||||
}
|
||||
.bootstrap-select.fit-width .dropdown-toggle .caret {
|
||||
position: static;
|
||||
top: auto;
|
||||
margin-top: -1px;
|
||||
}
|
||||
.bootstrap-select.show-tick .dropdown-menu .selected span.check-mark {
|
||||
position: absolute;
|
||||
display: inline-block;
|
||||
right: 15px;
|
||||
top: 5px;
|
||||
}
|
||||
.bootstrap-select.show-tick .dropdown-menu li a span.text {
|
||||
margin-right: 34px;
|
||||
}
|
||||
.bootstrap-select .bs-ok-default:after {
|
||||
content: '';
|
||||
display: block;
|
||||
width: 0.5em;
|
||||
height: 1em;
|
||||
border-style: solid;
|
||||
border-width: 0 0.26em 0.26em 0;
|
||||
-webkit-transform: rotate(45deg);
|
||||
-ms-transform: rotate(45deg);
|
||||
-o-transform: rotate(45deg);
|
||||
transform: rotate(45deg);
|
||||
}
|
||||
.bootstrap-select.show-menu-arrow.open > .dropdown-toggle,
|
||||
.bootstrap-select.show-menu-arrow.show > .dropdown-toggle {
|
||||
z-index: 1061;
|
||||
}
|
||||
.bootstrap-select.show-menu-arrow .dropdown-toggle .filter-option:before {
|
||||
content: '';
|
||||
border-left: 7px solid transparent;
|
||||
border-right: 7px solid transparent;
|
||||
border-bottom: 7px solid rgba(204, 204, 204, 0.2);
|
||||
position: absolute;
|
||||
bottom: -4px;
|
||||
left: 9px;
|
||||
display: none;
|
||||
}
|
||||
.bootstrap-select.show-menu-arrow .dropdown-toggle .filter-option:after {
|
||||
content: '';
|
||||
border-left: 6px solid transparent;
|
||||
border-right: 6px solid transparent;
|
||||
border-bottom: 6px solid white;
|
||||
position: absolute;
|
||||
bottom: -4px;
|
||||
left: 10px;
|
||||
display: none;
|
||||
}
|
||||
.bootstrap-select.show-menu-arrow.dropup .dropdown-toggle .filter-option:before {
|
||||
bottom: auto;
|
||||
top: -4px;
|
||||
border-top: 7px solid rgba(204, 204, 204, 0.2);
|
||||
border-bottom: 0;
|
||||
}
|
||||
.bootstrap-select.show-menu-arrow.dropup .dropdown-toggle .filter-option:after {
|
||||
bottom: auto;
|
||||
top: -4px;
|
||||
border-top: 6px solid white;
|
||||
border-bottom: 0;
|
||||
}
|
||||
.bootstrap-select.show-menu-arrow.pull-right .dropdown-toggle .filter-option:before {
|
||||
right: 12px;
|
||||
left: auto;
|
||||
}
|
||||
.bootstrap-select.show-menu-arrow.pull-right .dropdown-toggle .filter-option:after {
|
||||
right: 13px;
|
||||
left: auto;
|
||||
}
|
||||
.bootstrap-select.show-menu-arrow.open > .dropdown-toggle .filter-option:before,
|
||||
.bootstrap-select.show-menu-arrow.show > .dropdown-toggle .filter-option:before,
|
||||
.bootstrap-select.show-menu-arrow.open > .dropdown-toggle .filter-option:after,
|
||||
.bootstrap-select.show-menu-arrow.show > .dropdown-toggle .filter-option:after {
|
||||
display: block;
|
||||
}
|
||||
.bs-searchbox,
|
||||
.bs-actionsbox,
|
||||
.bs-donebutton {
|
||||
padding: 4px 8px;
|
||||
}
|
||||
.bs-actionsbox {
|
||||
width: 100%;
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.bs-actionsbox .btn-group button {
|
||||
width: 50%;
|
||||
}
|
||||
.bs-donebutton {
|
||||
float: left;
|
||||
width: 100%;
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.bs-donebutton .btn-group button {
|
||||
width: 100%;
|
||||
}
|
||||
.bs-searchbox + .bs-actionsbox {
|
||||
padding: 0 8px 4px;
|
||||
}
|
||||
.bs-searchbox .form-control {
|
||||
margin-bottom: 0;
|
||||
width: 100%;
|
||||
float: none;
|
||||
}
|
||||
/*# sourceMappingURL=bootstrap-select.css.map */
|
@ -0,0 +1,297 @@
|
||||
/**
|
||||
* 基于bootstrap-table-fixed-columns修改
|
||||
* 支持左右列冻结、支持固定高度
|
||||
* Copyright (c) 2019 ruoyi
|
||||
*/
|
||||
(function ($) {
|
||||
'use strict';
|
||||
|
||||
$.extend($.fn.bootstrapTable.defaults, {
|
||||
fixedColumns: false,
|
||||
fixedNumber: 1,
|
||||
rightFixedColumns: false,
|
||||
rightFixedNumber: 1
|
||||
});
|
||||
|
||||
var BootstrapTable = $.fn.bootstrapTable.Constructor,
|
||||
_initHeader = BootstrapTable.prototype.initHeader,
|
||||
_initBody = BootstrapTable.prototype.initBody,
|
||||
_resetView = BootstrapTable.prototype.resetView;
|
||||
|
||||
BootstrapTable.prototype.initFixedColumns = function () {
|
||||
this.timeoutHeaderColumns_ = 0;
|
||||
this.timeoutBodyColumns_ = 0;
|
||||
if (this.options.fixedColumns) {
|
||||
this.$fixedHeader = $([
|
||||
'<div class="left-fixed-table-columns">',
|
||||
'<table>',
|
||||
'<thead></thead>',
|
||||
'</table>',
|
||||
'</div>'].join(''));
|
||||
|
||||
this.$fixedHeader.find('table').attr('class', this.$el.attr('class'));
|
||||
this.$fixedHeaderColumns = this.$fixedHeader.find('thead');
|
||||
this.$tableHeader.before(this.$fixedHeader);
|
||||
|
||||
this.$fixedBody = $([
|
||||
'<div class="left-fixed-body-columns">',
|
||||
'<table>',
|
||||
'<tbody></tbody>',
|
||||
'</table>',
|
||||
'</div>'].join(''));
|
||||
|
||||
this.$fixedBody.find('table').attr('class', this.$el.attr('class'));
|
||||
this.$fixedBodyColumns = this.$fixedBody.find('tbody');
|
||||
this.$tableBody.before(this.$fixedBody);
|
||||
}
|
||||
if (this.options.rightFixedColumns) {
|
||||
this.$rightfixedBody = $([
|
||||
'<div class="right-fixed-table-columns">',
|
||||
'<table>',
|
||||
'<thead></thead>',
|
||||
'<tbody style="background-color: #fff;"></tbody>',
|
||||
'</table>',
|
||||
'</div>'].join(''));
|
||||
this.$rightfixedBody.find('table').attr('class', this.$el.attr('class'));
|
||||
this.$rightfixedHeaderColumns = this.$rightfixedBody.find('thead');
|
||||
this.$rightfixedBodyColumns = this.$rightfixedBody.find('tbody');
|
||||
this.$tableBody.before(this.$rightfixedBody);
|
||||
if (this.options.fixedColumns) {
|
||||
$('.right-fixed-table-columns').attr('style','right:0px');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
BootstrapTable.prototype.initHeader = function () {
|
||||
_initHeader.apply(this, Array.prototype.slice.apply(arguments));
|
||||
|
||||
if (!this.options.fixedColumns && !this.options.rightFixedColumns){
|
||||
return;
|
||||
}
|
||||
this.initFixedColumns();
|
||||
|
||||
var $ltr = this.$header.find('tr:eq(0)').clone(true),
|
||||
$rtr = this.$header.find('tr:eq(0)').clone(),
|
||||
$lths = $ltr.clone(true).find('th'),
|
||||
$rths = $rtr.clone().find('th');
|
||||
|
||||
$ltr.html('');
|
||||
$rtr.html('');
|
||||
//右边列冻结
|
||||
if (this.options.rightFixedColumns) {
|
||||
for (var i = 0; i < this.options.rightFixedNumber; i++) {
|
||||
$rtr.append($rths.eq($rths.length - this.options.rightFixedNumber + i).clone());
|
||||
}
|
||||
this.$rightfixedHeaderColumns.html('').append($rtr);
|
||||
}
|
||||
|
||||
//左边列冻结
|
||||
if (this.options.fixedColumns) {
|
||||
for (var i = 0; i < this.options.fixedNumber; i++) {
|
||||
$ltr.append($lths.eq(i).clone(true));
|
||||
}
|
||||
this.$fixedHeaderColumns.html('').append($ltr);
|
||||
this.$selectAll = $ltr.find('[name="btSelectAll"]');
|
||||
this.$selectAll.on('click', function () {
|
||||
var checked = $(this).prop('checked');
|
||||
$(".left-fixed-body-columns input[name=btSelectItem]").filter(':enabled').prop('checked', checked);
|
||||
$('.fixed-table-body input[name=btSelectItem]').closest('tr').removeClass('selected');
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
BootstrapTable.prototype.initBody = function () {
|
||||
_initBody.apply(this, Array.prototype.slice.apply(arguments));
|
||||
|
||||
if (!this.options.fixedColumns && !this.options.rightFixedColumns) {
|
||||
return;
|
||||
}
|
||||
|
||||
var that = this;
|
||||
if (this.options.fixedColumns) {
|
||||
this.$fixedBodyColumns.html('');
|
||||
this.$body.find('> tr[data-index]').each(function () {
|
||||
var $tr = $(this).clone(true),
|
||||
$tds = $tr.clone(true).find('td');
|
||||
|
||||
$tr.html('');
|
||||
for (var i = 0; i < that.options.fixedNumber; i++) {
|
||||
$tr.append($tds.eq(i).clone(true));
|
||||
}
|
||||
that.$fixedBodyColumns.append($tr);
|
||||
});
|
||||
}
|
||||
if (this.options.rightFixedColumns) {
|
||||
this.$rightfixedBodyColumns.html('');
|
||||
this.$body.find('> tr[data-index]').each(function () {
|
||||
var $tr = $(this).clone(),
|
||||
$tds = $tr.clone().find('td');
|
||||
|
||||
$tr.html('');
|
||||
for (var i = 0; i < that.options.rightFixedNumber; i++) {
|
||||
var indexTd = $tds.length - that.options.rightFixedNumber + i;
|
||||
var oldTd = $tds.eq(indexTd);
|
||||
var fixTd = oldTd.clone();
|
||||
var buttons = fixTd.find('button');
|
||||
//事件转移:冻结列里面的事件转移到实际按钮的事件
|
||||
buttons.each(function (key, item) {
|
||||
$(item).click(function () {
|
||||
that.$body.find("tr[data-index=" + $tr.attr('data-index') + "] td:eq(" + indexTd + ") button:eq(" + key + ")").click();
|
||||
});
|
||||
});
|
||||
$tr.append(fixTd);
|
||||
}
|
||||
that.$rightfixedBodyColumns.append($tr);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
BootstrapTable.prototype.resetView = function () {
|
||||
_resetView.apply(this, Array.prototype.slice.apply(arguments));
|
||||
|
||||
if (!this.options.fixedColumns && !this.options.rightFixedColumns) {
|
||||
return;
|
||||
}
|
||||
|
||||
clearTimeout(this.timeoutHeaderColumns_);
|
||||
this.timeoutHeaderColumns_ = setTimeout($.proxy(this.fitHeaderColumns, this), this.$el.is(':hidden') ? 100 : 0);
|
||||
|
||||
clearTimeout(this.timeoutBodyColumns_);
|
||||
this.timeoutBodyColumns_ = setTimeout($.proxy(this.fitBodyColumns, this), this.$el.is(':hidden') ? 100 : 0);
|
||||
};
|
||||
|
||||
BootstrapTable.prototype.fitHeaderColumns = function () {
|
||||
var that = this,
|
||||
visibleFields = this.getVisibleFields(),
|
||||
headerWidth = 0;
|
||||
if (that.options.fixedColumns) {
|
||||
this.$body.find('tr:first-child:not(.no-records-found) > *').each(function (i) {
|
||||
var $this = $(this),
|
||||
index = i;
|
||||
|
||||
if (i >= that.options.fixedNumber) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (that.options.detailView && !that.options.cardView) {
|
||||
index = i - 1;
|
||||
}
|
||||
that.$fixedHeader.find('thead th[data-field="' + visibleFields[index] + '"]')
|
||||
.find('.fht-cell').width($this.innerWidth());
|
||||
headerWidth += $this.outerWidth();
|
||||
});
|
||||
this.$fixedHeader.width(headerWidth + 2).show();
|
||||
}
|
||||
if (that.options.rightFixedColumns) {
|
||||
this.$body.find('tr:first-child:not(.no-records-found) > *').each(function (i) {
|
||||
var $this = $(this),
|
||||
index = i;
|
||||
|
||||
if (i >= visibleFields.length - that.options.rightFixedNumber) {
|
||||
return false;
|
||||
|
||||
|
||||
if (that.options.detailView && !that.options.cardView) {
|
||||
index = i - 1;
|
||||
}
|
||||
that.$rightfixedBody.find('thead th[data-field="' + visibleFields[index] + '"]')
|
||||
.find('.fht-cell').width($this.innerWidth() - 1);
|
||||
headerWidth += $this.outerWidth();
|
||||
}
|
||||
});
|
||||
this.$rightfixedBody.width(headerWidth - 1).show();
|
||||
}
|
||||
};
|
||||
|
||||
BootstrapTable.prototype.fitBodyColumns = function () {
|
||||
var that = this,
|
||||
top = -(parseInt(this.$el.css('margin-top'))),
|
||||
height = this.$tableBody.height();
|
||||
|
||||
if (that.options.fixedColumns) {
|
||||
if (!this.$body.find('> tr[data-index]').length) {
|
||||
this.$fixedBody.hide();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.options.height) {
|
||||
top = this.$fixedHeader.height()- 1;
|
||||
height = height - top;
|
||||
}
|
||||
|
||||
this.$fixedBody.css({
|
||||
width: this.$fixedHeader.width(),
|
||||
height: height,
|
||||
top: top + 1
|
||||
}).show();
|
||||
|
||||
this.$body.find('> tr').each(function (i) {
|
||||
that.$fixedBody.find('tr:eq(' + i + ')').height($(this).height() - 0.5);
|
||||
var thattds = this;
|
||||
that.$fixedBody.find('tr:eq(' + i + ')').find('td').each(function (j) {
|
||||
$(this).width($($(thattds).find('td')[j]).width() + 1);
|
||||
});
|
||||
});
|
||||
|
||||
$("#" + table.options.id).on("check.bs.table uncheck.bs.table", function (e, rows, $element) {
|
||||
var index= $element.data('index');
|
||||
$(this).find('.bs-checkbox').find('input[data-index="' + index + '"]').prop("checked", true);
|
||||
var selectFixedItem = $('.left-fixed-body-columns input[name=btSelectItem]');
|
||||
var checkAll = selectFixedItem.filter(':enabled').length &&
|
||||
selectFixedItem.filter(':enabled').length ===
|
||||
selectFixedItem.filter(':enabled').filter(':checked').length;
|
||||
$(".left-fixed-table-columns input[name=btSelectAll]").prop('checked', checkAll);
|
||||
$('.fixed-table-body input[name=btSelectItem]').closest('tr').removeClass('selected');
|
||||
});
|
||||
|
||||
//// events
|
||||
this.$tableBody.on('scroll', function () {
|
||||
that.$fixedBody.find('table').css('top', -$(this).scrollTop());
|
||||
});
|
||||
this.$body.find('> tr[data-index]').off('hover').hover(function () {
|
||||
var index = $(this).data('index');
|
||||
that.$fixedBody.find('tr[data-index="' + index + '"]').addClass('hover');
|
||||
}, function () {
|
||||
var index = $(this).data('index');
|
||||
that.$fixedBody.find('tr[data-index="' + index + '"]').removeClass('hover');
|
||||
});
|
||||
this.$fixedBody.find('tr[data-index]').off('hover').hover(function () {
|
||||
var index = $(this).data('index');
|
||||
that.$body.find('tr[data-index="' + index + '"]').addClass('hover');
|
||||
}, function () {
|
||||
var index = $(this).data('index');
|
||||
that.$body.find('> tr[data-index="' + index + '"]').removeClass('hover');
|
||||
});
|
||||
}
|
||||
if (that.options.rightFixedColumns) {
|
||||
if (!this.$body.find('> tr[data-index]').length) {
|
||||
this.$rightfixedBody.hide();
|
||||
return;
|
||||
}
|
||||
|
||||
this.$body.find('> tr').each(function (i) {
|
||||
that.$rightfixedBody.find('tbody tr:eq(' + i + ')').height($(this).height());
|
||||
});
|
||||
|
||||
//// events
|
||||
this.$tableBody.on('scroll', function () {
|
||||
that.$rightfixedBody.find('table').css('top', -$(this).scrollTop());
|
||||
});
|
||||
this.$body.find('> tr[data-index]').off('hover').hover(function () {
|
||||
var index = $(this).data('index');
|
||||
that.$rightfixedBody.find('tr[data-index="' + index + '"]').addClass('hover');
|
||||
}, function () {
|
||||
var index = $(this).data('index');
|
||||
that.$rightfixedBody.find('tr[data-index="' + index + '"]').removeClass('hover');
|
||||
});
|
||||
this.$rightfixedBody.find('tr[data-index]').off('hover').hover(function () {
|
||||
var index = $(this).data('index');
|
||||
that.$body.find('tr[data-index="' + index + '"]').addClass('hover');
|
||||
}, function () {
|
||||
var index = $(this).data('index');
|
||||
that.$body.find('> tr[data-index="' + index + '"]').removeClass('hover');
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
})(jQuery);
|
@ -0,0 +1,663 @@
|
||||
/*! X-editable - v1.5.1
|
||||
* In-place editing with Twitter Bootstrap, jQuery UI or pure jQuery
|
||||
* http://github.com/vitalets/x-editable
|
||||
* Copyright (c) 2013 Vitaliy Potapov; Licensed MIT */
|
||||
.editableform {
|
||||
margin-bottom: 0; /* overwrites bootstrap margin */
|
||||
}
|
||||
|
||||
.editableform .control-group {
|
||||
margin-bottom: 0; /* overwrites bootstrap margin */
|
||||
white-space: nowrap; /* prevent wrapping buttons on new line */
|
||||
line-height: 20px; /* overwriting bootstrap line-height. See #133 */
|
||||
}
|
||||
|
||||
/*
|
||||
BS3 width:1005 for inputs breaks editable form in popup
|
||||
See: https://github.com/vitalets/x-editable/issues/393
|
||||
*/
|
||||
.editableform .form-control {
|
||||
width: auto;
|
||||
}
|
||||
|
||||
.editable-buttons {
|
||||
display: inline-block; /* should be inline to take effect of parent's white-space: nowrap */
|
||||
vertical-align: top;
|
||||
margin-left: 7px;
|
||||
/* inline-block emulation for IE7*/
|
||||
zoom: 1;
|
||||
*display: inline;
|
||||
}
|
||||
|
||||
.editable-buttons.editable-buttons-bottom {
|
||||
display: block;
|
||||
margin-top: 7px;
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
.editable-input {
|
||||
vertical-align: top;
|
||||
display: inline-block; /* should be inline to take effect of parent's white-space: nowrap */
|
||||
width: auto; /* bootstrap-responsive has width: 100% that breakes layout */
|
||||
white-space: normal; /* reset white-space decalred in parent*/
|
||||
/* display-inline emulation for IE7*/
|
||||
zoom: 1;
|
||||
*display: inline;
|
||||
}
|
||||
|
||||
.editable-buttons .editable-cancel {
|
||||
margin-left: 7px;
|
||||
}
|
||||
|
||||
/*for jquery-ui buttons need set height to look more pretty*/
|
||||
.editable-buttons button.ui-button-icon-only {
|
||||
height: 24px;
|
||||
width: 30px;
|
||||
}
|
||||
|
||||
.editableform-loading {
|
||||
background: url('loading.gif') center center no-repeat;
|
||||
height: 25px;
|
||||
width: auto;
|
||||
min-width: 25px;
|
||||
}
|
||||
|
||||
.editable-inline .editableform-loading {
|
||||
background-position: left 5px;
|
||||
}
|
||||
|
||||
.editable-error-block {
|
||||
max-width: 300px;
|
||||
margin: 5px 0 0 0;
|
||||
width: auto;
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
/*add padding for jquery ui*/
|
||||
.editable-error-block.ui-state-error {
|
||||
padding: 3px;
|
||||
}
|
||||
|
||||
.editable-error {
|
||||
color: red;
|
||||
}
|
||||
|
||||
/* ---- For specific types ---- */
|
||||
|
||||
.editableform .editable-date {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
float: left;
|
||||
}
|
||||
|
||||
/* move datepicker icon to center of add-on button. See https://github.com/vitalets/x-editable/issues/183 */
|
||||
.editable-inline .add-on .icon-th {
|
||||
margin-top: 3px;
|
||||
margin-left: 1px;
|
||||
}
|
||||
|
||||
|
||||
/* checklist vertical alignment */
|
||||
.editable-checklist label input[type="checkbox"],
|
||||
.editable-checklist label span {
|
||||
vertical-align: middle;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.editable-checklist label {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/* set exact width of textarea to fit buttons toolbar */
|
||||
.editable-wysihtml5 {
|
||||
width: 566px;
|
||||
height: 250px;
|
||||
}
|
||||
|
||||
/* clear button shown as link in date inputs */
|
||||
.editable-clear {
|
||||
clear: both;
|
||||
font-size: 0.9em;
|
||||
text-decoration: none;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
/* IOS-style clear button for text inputs */
|
||||
.editable-clear-x {
|
||||
background: url('clear.png') center center no-repeat;
|
||||
display: block;
|
||||
width: 13px;
|
||||
height: 13px;
|
||||
position: absolute;
|
||||
opacity: 0.6;
|
||||
z-index: 100;
|
||||
|
||||
top: 50%;
|
||||
right: 6px;
|
||||
margin-top: -6px;
|
||||
|
||||
}
|
||||
|
||||
.editable-clear-x:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.editable-pre-wrapped {
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
.editable-container.editable-popup {
|
||||
max-width: none !important; /* without this rule poshytip/tooltip does not stretch */
|
||||
}
|
||||
|
||||
.editable-container.popover {
|
||||
width: auto; /* without this rule popover does not stretch */
|
||||
}
|
||||
|
||||
.editable-container.editable-inline {
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
width: auto;
|
||||
/* inline-block emulation for IE7*/
|
||||
zoom: 1;
|
||||
*display: inline;
|
||||
}
|
||||
|
||||
.editable-container.ui-widget {
|
||||
font-size: inherit; /* jqueryui widget font 1.1em too big, overwrite it */
|
||||
z-index: 9990; /* should be less than select2 dropdown z-index to close dropdown first when click */
|
||||
}
|
||||
.editable-click,
|
||||
a.editable-click,
|
||||
a.editable-click:hover {
|
||||
text-decoration: none;
|
||||
border-bottom: dashed 1px #0088cc;
|
||||
}
|
||||
|
||||
.editable-click.editable-disabled,
|
||||
a.editable-click.editable-disabled,
|
||||
a.editable-click.editable-disabled:hover {
|
||||
color: #585858;
|
||||
cursor: default;
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.editable-empty, .editable-empty:hover, .editable-empty:focus{
|
||||
font-style: italic;
|
||||
color: #DD1144;
|
||||
/* border-bottom: none; */
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.editable-unsaved {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.editable-unsaved:after {
|
||||
/* content: '*'*/
|
||||
}
|
||||
|
||||
.editable-bg-transition {
|
||||
-webkit-transition: background-color 1400ms ease-out;
|
||||
-moz-transition: background-color 1400ms ease-out;
|
||||
-o-transition: background-color 1400ms ease-out;
|
||||
-ms-transition: background-color 1400ms ease-out;
|
||||
transition: background-color 1400ms ease-out;
|
||||
}
|
||||
|
||||
/*see https://github.com/vitalets/x-editable/issues/139 */
|
||||
.form-horizontal .editable
|
||||
{
|
||||
padding-top: 5px;
|
||||
display:inline-block;
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
* Datepicker for Bootstrap
|
||||
*
|
||||
* Copyright 2012 Stefan Petre
|
||||
* Improvements by Andrew Rowls
|
||||
* Licensed under the Apache License v2.0
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*/
|
||||
.datepicker {
|
||||
padding: 4px;
|
||||
-webkit-border-radius: 4px;
|
||||
-moz-border-radius: 4px;
|
||||
border-radius: 4px;
|
||||
direction: ltr;
|
||||
/*.dow {
|
||||
border-top: 1px solid #ddd !important;
|
||||
}*/
|
||||
|
||||
}
|
||||
.datepicker-inline {
|
||||
width: 220px;
|
||||
}
|
||||
.datepicker.datepicker-rtl {
|
||||
direction: rtl;
|
||||
}
|
||||
.datepicker.datepicker-rtl table tr td span {
|
||||
float: right;
|
||||
}
|
||||
.datepicker-dropdown {
|
||||
top: 0;
|
||||
left: 0;
|
||||
}
|
||||
.datepicker-dropdown:before {
|
||||
content: '';
|
||||
display: inline-block;
|
||||
border-left: 7px solid transparent;
|
||||
border-right: 7px solid transparent;
|
||||
border-bottom: 7px solid #ccc;
|
||||
border-bottom-color: rgba(0, 0, 0, 0.2);
|
||||
position: absolute;
|
||||
top: -7px;
|
||||
left: 6px;
|
||||
}
|
||||
.datepicker-dropdown:after {
|
||||
content: '';
|
||||
display: inline-block;
|
||||
border-left: 6px solid transparent;
|
||||
border-right: 6px solid transparent;
|
||||
border-bottom: 6px solid #ffffff;
|
||||
position: absolute;
|
||||
top: -6px;
|
||||
left: 7px;
|
||||
}
|
||||
.datepicker > div {
|
||||
display: none;
|
||||
}
|
||||
.datepicker.days div.datepicker-days {
|
||||
display: block;
|
||||
}
|
||||
.datepicker.months div.datepicker-months {
|
||||
display: block;
|
||||
}
|
||||
.datepicker.years div.datepicker-years {
|
||||
display: block;
|
||||
}
|
||||
.datepicker table {
|
||||
margin: 0;
|
||||
}
|
||||
.datepicker td,
|
||||
.datepicker th {
|
||||
text-align: center;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
-webkit-border-radius: 4px;
|
||||
-moz-border-radius: 4px;
|
||||
border-radius: 4px;
|
||||
border: none;
|
||||
}
|
||||
.table-striped .datepicker table tr td,
|
||||
.table-striped .datepicker table tr th {
|
||||
background-color: transparent;
|
||||
}
|
||||
.datepicker table tr td.day:hover {
|
||||
background: #eeeeee;
|
||||
cursor: pointer;
|
||||
}
|
||||
.datepicker table tr td.old,
|
||||
.datepicker table tr td.new {
|
||||
color: #999999;
|
||||
}
|
||||
.datepicker table tr td.disabled,
|
||||
.datepicker table tr td.disabled:hover {
|
||||
background: none;
|
||||
color: #999999;
|
||||
cursor: default;
|
||||
}
|
||||
.datepicker table tr td.today,
|
||||
.datepicker table tr td.today:hover,
|
||||
.datepicker table tr td.today.disabled,
|
||||
.datepicker table tr td.today.disabled:hover {
|
||||
background-color: #fde19a;
|
||||
background-image: -moz-linear-gradient(top, #fdd49a, #fdf59a);
|
||||
background-image: -ms-linear-gradient(top, #fdd49a, #fdf59a);
|
||||
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#fdd49a), to(#fdf59a));
|
||||
background-image: -webkit-linear-gradient(top, #fdd49a, #fdf59a);
|
||||
background-image: -o-linear-gradient(top, #fdd49a, #fdf59a);
|
||||
background-image: linear-gradient(top, #fdd49a, #fdf59a);
|
||||
background-repeat: repeat-x;
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fdd49a', endColorstr='#fdf59a', GradientType=0);
|
||||
border-color: #fdf59a #fdf59a #fbed50;
|
||||
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
|
||||
color: #000;
|
||||
}
|
||||
.datepicker table tr td.today:hover,
|
||||
.datepicker table tr td.today:hover:hover,
|
||||
.datepicker table tr td.today.disabled:hover,
|
||||
.datepicker table tr td.today.disabled:hover:hover,
|
||||
.datepicker table tr td.today:active,
|
||||
.datepicker table tr td.today:hover:active,
|
||||
.datepicker table tr td.today.disabled:active,
|
||||
.datepicker table tr td.today.disabled:hover:active,
|
||||
.datepicker table tr td.today.active,
|
||||
.datepicker table tr td.today:hover.active,
|
||||
.datepicker table tr td.today.disabled.active,
|
||||
.datepicker table tr td.today.disabled:hover.active,
|
||||
.datepicker table tr td.today.disabled,
|
||||
.datepicker table tr td.today:hover.disabled,
|
||||
.datepicker table tr td.today.disabled.disabled,
|
||||
.datepicker table tr td.today.disabled:hover.disabled,
|
||||
.datepicker table tr td.today[disabled],
|
||||
.datepicker table tr td.today:hover[disabled],
|
||||
.datepicker table tr td.today.disabled[disabled],
|
||||
.datepicker table tr td.today.disabled:hover[disabled] {
|
||||
background-color: #fdf59a;
|
||||
}
|
||||
.datepicker table tr td.today:active,
|
||||
.datepicker table tr td.today:hover:active,
|
||||
.datepicker table tr td.today.disabled:active,
|
||||
.datepicker table tr td.today.disabled:hover:active,
|
||||
.datepicker table tr td.today.active,
|
||||
.datepicker table tr td.today:hover.active,
|
||||
.datepicker table tr td.today.disabled.active,
|
||||
.datepicker table tr td.today.disabled:hover.active {
|
||||
background-color: #fbf069 \9;
|
||||
}
|
||||
.datepicker table tr td.today:hover:hover {
|
||||
color: #000;
|
||||
}
|
||||
.datepicker table tr td.today.active:hover {
|
||||
color: #fff;
|
||||
}
|
||||
.datepicker table tr td.range,
|
||||
.datepicker table tr td.range:hover,
|
||||
.datepicker table tr td.range.disabled,
|
||||
.datepicker table tr td.range.disabled:hover {
|
||||
background: #eeeeee;
|
||||
-webkit-border-radius: 0;
|
||||
-moz-border-radius: 0;
|
||||
border-radius: 0;
|
||||
}
|
||||
.datepicker table tr td.range.today,
|
||||
.datepicker table tr td.range.today:hover,
|
||||
.datepicker table tr td.range.today.disabled,
|
||||
.datepicker table tr td.range.today.disabled:hover {
|
||||
background-color: #f3d17a;
|
||||
background-image: -moz-linear-gradient(top, #f3c17a, #f3e97a);
|
||||
background-image: -ms-linear-gradient(top, #f3c17a, #f3e97a);
|
||||
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#f3c17a), to(#f3e97a));
|
||||
background-image: -webkit-linear-gradient(top, #f3c17a, #f3e97a);
|
||||
background-image: -o-linear-gradient(top, #f3c17a, #f3e97a);
|
||||
background-image: linear-gradient(top, #f3c17a, #f3e97a);
|
||||
background-repeat: repeat-x;
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f3c17a', endColorstr='#f3e97a', GradientType=0);
|
||||
border-color: #f3e97a #f3e97a #edde34;
|
||||
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
|
||||
-webkit-border-radius: 0;
|
||||
-moz-border-radius: 0;
|
||||
border-radius: 0;
|
||||
}
|
||||
.datepicker table tr td.range.today:hover,
|
||||
.datepicker table tr td.range.today:hover:hover,
|
||||
.datepicker table tr td.range.today.disabled:hover,
|
||||
.datepicker table tr td.range.today.disabled:hover:hover,
|
||||
.datepicker table tr td.range.today:active,
|
||||
.datepicker table tr td.range.today:hover:active,
|
||||
.datepicker table tr td.range.today.disabled:active,
|
||||
.datepicker table tr td.range.today.disabled:hover:active,
|
||||
.datepicker table tr td.range.today.active,
|
||||
.datepicker table tr td.range.today:hover.active,
|
||||
.datepicker table tr td.range.today.disabled.active,
|
||||
.datepicker table tr td.range.today.disabled:hover.active,
|
||||
.datepicker table tr td.range.today.disabled,
|
||||
.datepicker table tr td.range.today:hover.disabled,
|
||||
.datepicker table tr td.range.today.disabled.disabled,
|
||||
.datepicker table tr td.range.today.disabled:hover.disabled,
|
||||
.datepicker table tr td.range.today[disabled],
|
||||
.datepicker table tr td.range.today:hover[disabled],
|
||||
.datepicker table tr td.range.today.disabled[disabled],
|
||||
.datepicker table tr td.range.today.disabled:hover[disabled] {
|
||||
background-color: #f3e97a;
|
||||
}
|
||||
.datepicker table tr td.range.today:active,
|
||||
.datepicker table tr td.range.today:hover:active,
|
||||
.datepicker table tr td.range.today.disabled:active,
|
||||
.datepicker table tr td.range.today.disabled:hover:active,
|
||||
.datepicker table tr td.range.today.active,
|
||||
.datepicker table tr td.range.today:hover.active,
|
||||
.datepicker table tr td.range.today.disabled.active,
|
||||
.datepicker table tr td.range.today.disabled:hover.active {
|
||||
background-color: #efe24b \9;
|
||||
}
|
||||
.datepicker table tr td.selected,
|
||||
.datepicker table tr td.selected:hover,
|
||||
.datepicker table tr td.selected.disabled,
|
||||
.datepicker table tr td.selected.disabled:hover {
|
||||
background-color: #9e9e9e;
|
||||
background-image: -moz-linear-gradient(top, #b3b3b3, #808080);
|
||||
background-image: -ms-linear-gradient(top, #b3b3b3, #808080);
|
||||
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#b3b3b3), to(#808080));
|
||||
background-image: -webkit-linear-gradient(top, #b3b3b3, #808080);
|
||||
background-image: -o-linear-gradient(top, #b3b3b3, #808080);
|
||||
background-image: linear-gradient(top, #b3b3b3, #808080);
|
||||
background-repeat: repeat-x;
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#b3b3b3', endColorstr='#808080', GradientType=0);
|
||||
border-color: #808080 #808080 #595959;
|
||||
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
|
||||
color: #fff;
|
||||
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
|
||||
}
|
||||
.datepicker table tr td.selected:hover,
|
||||
.datepicker table tr td.selected:hover:hover,
|
||||
.datepicker table tr td.selected.disabled:hover,
|
||||
.datepicker table tr td.selected.disabled:hover:hover,
|
||||
.datepicker table tr td.selected:active,
|
||||
.datepicker table tr td.selected:hover:active,
|
||||
.datepicker table tr td.selected.disabled:active,
|
||||
.datepicker table tr td.selected.disabled:hover:active,
|
||||
.datepicker table tr td.selected.active,
|
||||
.datepicker table tr td.selected:hover.active,
|
||||
.datepicker table tr td.selected.disabled.active,
|
||||
.datepicker table tr td.selected.disabled:hover.active,
|
||||
.datepicker table tr td.selected.disabled,
|
||||
.datepicker table tr td.selected:hover.disabled,
|
||||
.datepicker table tr td.selected.disabled.disabled,
|
||||
.datepicker table tr td.selected.disabled:hover.disabled,
|
||||
.datepicker table tr td.selected[disabled],
|
||||
.datepicker table tr td.selected:hover[disabled],
|
||||
.datepicker table tr td.selected.disabled[disabled],
|
||||
.datepicker table tr td.selected.disabled:hover[disabled] {
|
||||
background-color: #808080;
|
||||
}
|
||||
.datepicker table tr td.selected:active,
|
||||
.datepicker table tr td.selected:hover:active,
|
||||
.datepicker table tr td.selected.disabled:active,
|
||||
.datepicker table tr td.selected.disabled:hover:active,
|
||||
.datepicker table tr td.selected.active,
|
||||
.datepicker table tr td.selected:hover.active,
|
||||
.datepicker table tr td.selected.disabled.active,
|
||||
.datepicker table tr td.selected.disabled:hover.active {
|
||||
background-color: #666666 \9;
|
||||
}
|
||||
.datepicker table tr td.active,
|
||||
.datepicker table tr td.active:hover,
|
||||
.datepicker table tr td.active.disabled,
|
||||
.datepicker table tr td.active.disabled:hover {
|
||||
background-color: #006dcc;
|
||||
background-image: -moz-linear-gradient(top, #0088cc, #0044cc);
|
||||
background-image: -ms-linear-gradient(top, #0088cc, #0044cc);
|
||||
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc));
|
||||
background-image: -webkit-linear-gradient(top, #0088cc, #0044cc);
|
||||
background-image: -o-linear-gradient(top, #0088cc, #0044cc);
|
||||
background-image: linear-gradient(top, #0088cc, #0044cc);
|
||||
background-repeat: repeat-x;
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0088cc', endColorstr='#0044cc', GradientType=0);
|
||||
border-color: #0044cc #0044cc #002a80;
|
||||
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
|
||||
color: #fff;
|
||||
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
|
||||
}
|
||||
.datepicker table tr td.active:hover,
|
||||
.datepicker table tr td.active:hover:hover,
|
||||
.datepicker table tr td.active.disabled:hover,
|
||||
.datepicker table tr td.active.disabled:hover:hover,
|
||||
.datepicker table tr td.active:active,
|
||||
.datepicker table tr td.active:hover:active,
|
||||
.datepicker table tr td.active.disabled:active,
|
||||
.datepicker table tr td.active.disabled:hover:active,
|
||||
.datepicker table tr td.active.active,
|
||||
.datepicker table tr td.active:hover.active,
|
||||
.datepicker table tr td.active.disabled.active,
|
||||
.datepicker table tr td.active.disabled:hover.active,
|
||||
.datepicker table tr td.active.disabled,
|
||||
.datepicker table tr td.active:hover.disabled,
|
||||
.datepicker table tr td.active.disabled.disabled,
|
||||
.datepicker table tr td.active.disabled:hover.disabled,
|
||||
.datepicker table tr td.active[disabled],
|
||||
.datepicker table tr td.active:hover[disabled],
|
||||
.datepicker table tr td.active.disabled[disabled],
|
||||
.datepicker table tr td.active.disabled:hover[disabled] {
|
||||
background-color: #0044cc;
|
||||
}
|
||||
.datepicker table tr td.active:active,
|
||||
.datepicker table tr td.active:hover:active,
|
||||
.datepicker table tr td.active.disabled:active,
|
||||
.datepicker table tr td.active.disabled:hover:active,
|
||||
.datepicker table tr td.active.active,
|
||||
.datepicker table tr td.active:hover.active,
|
||||
.datepicker table tr td.active.disabled.active,
|
||||
.datepicker table tr td.active.disabled:hover.active {
|
||||
background-color: #003399 \9;
|
||||
}
|
||||
.datepicker table tr td span {
|
||||
display: block;
|
||||
width: 23%;
|
||||
height: 54px;
|
||||
line-height: 54px;
|
||||
float: left;
|
||||
margin: 1%;
|
||||
cursor: pointer;
|
||||
-webkit-border-radius: 4px;
|
||||
-moz-border-radius: 4px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
.datepicker table tr td span:hover {
|
||||
background: #eeeeee;
|
||||
}
|
||||
.datepicker table tr td span.disabled,
|
||||
.datepicker table tr td span.disabled:hover {
|
||||
background: none;
|
||||
color: #999999;
|
||||
cursor: default;
|
||||
}
|
||||
.datepicker table tr td span.active,
|
||||
.datepicker table tr td span.active:hover,
|
||||
.datepicker table tr td span.active.disabled,
|
||||
.datepicker table tr td span.active.disabled:hover {
|
||||
background-color: #006dcc;
|
||||
background-image: -moz-linear-gradient(top, #0088cc, #0044cc);
|
||||
background-image: -ms-linear-gradient(top, #0088cc, #0044cc);
|
||||
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc));
|
||||
background-image: -webkit-linear-gradient(top, #0088cc, #0044cc);
|
||||
background-image: -o-linear-gradient(top, #0088cc, #0044cc);
|
||||
background-image: linear-gradient(top, #0088cc, #0044cc);
|
||||
background-repeat: repeat-x;
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0088cc', endColorstr='#0044cc', GradientType=0);
|
||||
border-color: #0044cc #0044cc #002a80;
|
||||
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
|
||||
color: #fff;
|
||||
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
|
||||
}
|
||||
.datepicker table tr td span.active:hover,
|
||||
.datepicker table tr td span.active:hover:hover,
|
||||
.datepicker table tr td span.active.disabled:hover,
|
||||
.datepicker table tr td span.active.disabled:hover:hover,
|
||||
.datepicker table tr td span.active:active,
|
||||
.datepicker table tr td span.active:hover:active,
|
||||
.datepicker table tr td span.active.disabled:active,
|
||||
.datepicker table tr td span.active.disabled:hover:active,
|
||||
.datepicker table tr td span.active.active,
|
||||
.datepicker table tr td span.active:hover.active,
|
||||
.datepicker table tr td span.active.disabled.active,
|
||||
.datepicker table tr td span.active.disabled:hover.active,
|
||||
.datepicker table tr td span.active.disabled,
|
||||
.datepicker table tr td span.active:hover.disabled,
|
||||
.datepicker table tr td span.active.disabled.disabled,
|
||||
.datepicker table tr td span.active.disabled:hover.disabled,
|
||||
.datepicker table tr td span.active[disabled],
|
||||
.datepicker table tr td span.active:hover[disabled],
|
||||
.datepicker table tr td span.active.disabled[disabled],
|
||||
.datepicker table tr td span.active.disabled:hover[disabled] {
|
||||
background-color: #0044cc;
|
||||
}
|
||||
.datepicker table tr td span.active:active,
|
||||
.datepicker table tr td span.active:hover:active,
|
||||
.datepicker table tr td span.active.disabled:active,
|
||||
.datepicker table tr td span.active.disabled:hover:active,
|
||||
.datepicker table tr td span.active.active,
|
||||
.datepicker table tr td span.active:hover.active,
|
||||
.datepicker table tr td span.active.disabled.active,
|
||||
.datepicker table tr td span.active.disabled:hover.active {
|
||||
background-color: #003399 \9;
|
||||
}
|
||||
.datepicker table tr td span.old,
|
||||
.datepicker table tr td span.new {
|
||||
color: #999999;
|
||||
}
|
||||
.datepicker th.datepicker-switch {
|
||||
width: 145px;
|
||||
}
|
||||
.datepicker thead tr:first-child th,
|
||||
.datepicker tfoot tr th {
|
||||
cursor: pointer;
|
||||
}
|
||||
.datepicker thead tr:first-child th:hover,
|
||||
.datepicker tfoot tr th:hover {
|
||||
background: #eeeeee;
|
||||
}
|
||||
.datepicker .cw {
|
||||
font-size: 10px;
|
||||
width: 12px;
|
||||
padding: 0 2px 0 5px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.datepicker thead tr:first-child th.cw {
|
||||
cursor: default;
|
||||
background-color: transparent;
|
||||
}
|
||||
.input-append.date .add-on i,
|
||||
.input-prepend.date .add-on i {
|
||||
display: block;
|
||||
cursor: pointer;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
}
|
||||
.input-daterange input {
|
||||
text-align: center;
|
||||
}
|
||||
.input-daterange input:first-child {
|
||||
-webkit-border-radius: 3px 0 0 3px;
|
||||
-moz-border-radius: 3px 0 0 3px;
|
||||
border-radius: 3px 0 0 3px;
|
||||
}
|
||||
.input-daterange input:last-child {
|
||||
-webkit-border-radius: 0 3px 3px 0;
|
||||
-moz-border-radius: 0 3px 3px 0;
|
||||
border-radius: 0 3px 3px 0;
|
||||
}
|
||||
.input-daterange .add-on {
|
||||
display: inline-block;
|
||||
width: auto;
|
||||
min-width: 16px;
|
||||
height: 18px;
|
||||
padding: 4px 5px;
|
||||
font-weight: normal;
|
||||
line-height: 18px;
|
||||
text-align: center;
|
||||
text-shadow: 0 1px 0 #ffffff;
|
||||
vertical-align: middle;
|
||||
background-color: #eeeeee;
|
||||
border: 1px solid #ccc;
|
||||
margin-left: -5px;
|
||||
margin-right: -5px;
|
||||
}
|
@ -0,0 +1,146 @@
|
||||
/**
|
||||
* @author zhixin wen <wenzhixin2010@gmail.com>
|
||||
* extensions: https://github.com/vitalets/x-editable
|
||||
*/
|
||||
|
||||
(function($) {
|
||||
|
||||
'use strict';
|
||||
|
||||
$.extend($.fn.bootstrapTable.defaults, {
|
||||
editable: true,
|
||||
onEditableInit: function() {
|
||||
return false;
|
||||
},
|
||||
onEditableSave: function(field, row, oldValue, $el) {
|
||||
return false;
|
||||
},
|
||||
onEditableShown: function(field, row, $el, editable) {
|
||||
return false;
|
||||
},
|
||||
onEditableHidden: function(field, row, $el, reason) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
$.extend($.fn.bootstrapTable.Constructor.EVENTS, {
|
||||
'editable-init.bs.table': 'onEditableInit',
|
||||
'editable-save.bs.table': 'onEditableSave',
|
||||
'editable-shown.bs.table': 'onEditableShown',
|
||||
'editable-hidden.bs.table': 'onEditableHidden'
|
||||
});
|
||||
|
||||
var BootstrapTable = $.fn.bootstrapTable.Constructor,
|
||||
_initTable = BootstrapTable.prototype.initTable,
|
||||
_initBody = BootstrapTable.prototype.initBody;
|
||||
|
||||
BootstrapTable.prototype.initTable = function() {
|
||||
var that = this;
|
||||
_initTable.apply(this, Array.prototype.slice.apply(arguments));
|
||||
|
||||
if (!this.options.editable) {
|
||||
return;
|
||||
}
|
||||
|
||||
$.each(this.columns, function(i, column) {
|
||||
if (!column.editable) {
|
||||
return;
|
||||
}
|
||||
|
||||
var editableOptions = {},
|
||||
editableDataMarkup = [],
|
||||
editableDataPrefix = 'editable-';
|
||||
|
||||
var processDataOptions = function(key, value) {
|
||||
// Replace camel case with dashes.
|
||||
var dashKey = key.replace(/([A-Z])/g, function($1) {
|
||||
return "-" + $1.toLowerCase();
|
||||
});
|
||||
if (dashKey.slice(0, editableDataPrefix.length) == editableDataPrefix) {
|
||||
var dataKey = dashKey.replace(editableDataPrefix, 'data-');
|
||||
editableOptions[dataKey] = value;
|
||||
}
|
||||
};
|
||||
|
||||
$.each(that.options, processDataOptions);
|
||||
|
||||
column.formatter = column.formatter || function(value, row, index) {
|
||||
return value;
|
||||
};
|
||||
column._formatter = column._formatter ? column._formatter : column.formatter;
|
||||
column.formatter = function(value, row, index) {
|
||||
var result = column._formatter ? column._formatter(value, row, index) : value;
|
||||
|
||||
$.each(column, processDataOptions);
|
||||
|
||||
$.each(editableOptions, function(key, value) {
|
||||
editableDataMarkup.push(' ' + key + '="' + value + '"');
|
||||
});
|
||||
|
||||
var _dont_edit_formatter = false;
|
||||
if (column.editable.hasOwnProperty('noeditFormatter')) {
|
||||
_dont_edit_formatter = column.editable.noeditFormatter(value, row, index);
|
||||
}
|
||||
|
||||
if (_dont_edit_formatter === false) {
|
||||
return ['<a href="javascript:void(0)"',
|
||||
' data-name="' + column.field + '"',
|
||||
' data-pk="' + row[that.options.idField] + '"',
|
||||
' data-value="' + result + '"',
|
||||
editableDataMarkup.join(''),
|
||||
'>' + '</a>'
|
||||
].join('');
|
||||
} else {
|
||||
return _dont_edit_formatter;
|
||||
}
|
||||
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
BootstrapTable.prototype.initBody = function() {
|
||||
var that = this;
|
||||
_initBody.apply(this, Array.prototype.slice.apply(arguments));
|
||||
|
||||
if (!this.options.editable) {
|
||||
return;
|
||||
}
|
||||
|
||||
$.each(this.columns, function(i, column) {
|
||||
if (!column.editable) {
|
||||
return;
|
||||
}
|
||||
|
||||
that.$body.find('a[data-name="' + column.field + '"]').editable(column.editable)
|
||||
.off('save').on('save', function(e, params) {
|
||||
var data = that.getData(),
|
||||
index = $(this).parents('tr[data-index]').data('index'),
|
||||
row = data[index],
|
||||
oldValue = row[column.field];
|
||||
|
||||
$(this).data('value', params.submitValue);
|
||||
row[column.field] = params.submitValue;
|
||||
that.trigger('editable-save', column.field, row, oldValue, $(this));
|
||||
that.resetFooter();
|
||||
});
|
||||
that.$body.find('a[data-name="' + column.field + '"]').editable(column.editable)
|
||||
.off('shown').on('shown', function(e, editable) {
|
||||
var data = that.getData(),
|
||||
index = $(this).parents('tr[data-index]').data('index'),
|
||||
row = data[index];
|
||||
|
||||
that.trigger('editable-shown', column.field, row, $(this), editable);
|
||||
});
|
||||
that.$body.find('a[data-name="' + column.field + '"]').editable(column.editable)
|
||||
.off('hidden').on('hidden', function(e, reason) {
|
||||
var data = that.getData(),
|
||||
index = $(this).parents('tr[data-index]').data('index'),
|
||||
row = data[index];
|
||||
|
||||
that.trigger('editable-hidden', column.field, row, $(this), reason);
|
||||
});
|
||||
});
|
||||
this.trigger('editable-init');
|
||||
};
|
||||
|
||||
})(jQuery);
|
After Width: | Height: | Size: 244 B |
After Width: | Height: | Size: 1.8 KiB |
@ -0,0 +1,119 @@
|
||||
/**
|
||||
* @author zhixin wen <wenzhixin2010@gmail.com>
|
||||
* extensions: https://github.com/kayalshri/tableExport.jquery.plugin
|
||||
*/
|
||||
|
||||
(function ($) {
|
||||
'use strict';
|
||||
var sprintf = $.fn.bootstrapTable.utils.sprintf;
|
||||
|
||||
var TYPE_NAME = {
|
||||
csv: 'CSV',
|
||||
txt: 'TXT',
|
||||
doc: 'Word',
|
||||
excel: 'Excel'
|
||||
};
|
||||
|
||||
$.extend($.fn.bootstrapTable.defaults, {
|
||||
showExport: false,
|
||||
exportDataType: 'all', // basic, all, selected
|
||||
exportTypes: ['csv', 'txt', 'doc', 'excel'],
|
||||
exportOptions: {
|
||||
ignoreColumn: [0] //忽略列索引
|
||||
}
|
||||
});
|
||||
|
||||
$.extend($.fn.bootstrapTable.defaults.icons, {
|
||||
export: 'glyphicon glyphicon-save'
|
||||
});
|
||||
|
||||
$.extend($.fn.bootstrapTable.locales, {
|
||||
formatExport: function () {
|
||||
return '导出';
|
||||
}
|
||||
});
|
||||
$.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales);
|
||||
|
||||
var BootstrapTable = $.fn.bootstrapTable.Constructor,
|
||||
_initToolbar = BootstrapTable.prototype.initToolbar;
|
||||
|
||||
BootstrapTable.prototype.initToolbar = function () {
|
||||
this.showToolbar = this.options.showExport;
|
||||
|
||||
_initToolbar.apply(this, Array.prototype.slice.apply(arguments));
|
||||
|
||||
if (this.options.showExport) {
|
||||
var that = this,
|
||||
$btnGroup = this.$toolbar.find('>.btn-group'),
|
||||
$export = $btnGroup.find('div.export');
|
||||
|
||||
if (!$export.length) {
|
||||
$export = $([
|
||||
'<div class="export btn-group">',
|
||||
'<button class="btn' +
|
||||
sprintf(' btn-%s', this.options.buttonsClass) +
|
||||
sprintf(' btn-%s', this.options.iconSize) +
|
||||
' dropdown-toggle" ' +
|
||||
'title="' + this.options.formatExport() + '" ' +
|
||||
'data-toggle="dropdown" type="button">',
|
||||
sprintf('<i class="%s %s"></i> ', this.options.iconsPrefix, this.options.icons.export),
|
||||
'<span class="caret"></span>',
|
||||
'</button>',
|
||||
'<ul class="dropdown-menu" role="menu">',
|
||||
'</ul>',
|
||||
'</div>'].join('')).appendTo($btnGroup);
|
||||
|
||||
var $menu = $export.find('.dropdown-menu'),
|
||||
exportTypes = this.options.exportTypes;
|
||||
|
||||
if (typeof this.options.exportTypes === 'string') {
|
||||
var types = this.options.exportTypes.slice(1, -1).replace(/ /g, '').split(',');
|
||||
|
||||
exportTypes = [];
|
||||
$.each(types, function (i, value) {
|
||||
exportTypes.push(value.slice(1, -1));
|
||||
});
|
||||
}
|
||||
$.each(exportTypes, function (i, type) {
|
||||
if (TYPE_NAME.hasOwnProperty(type)) {
|
||||
$menu.append(['<li data-type="' + type + '">',
|
||||
'<a href="javascript:void(0)">',
|
||||
TYPE_NAME[type],
|
||||
'</a>',
|
||||
'</li>'].join(''));
|
||||
}
|
||||
});
|
||||
|
||||
$menu.find('li').click(function () {
|
||||
var type = $(this).data('type'),
|
||||
doExport = function () {
|
||||
that.$el.tableExport($.extend({}, that.options.exportOptions, {
|
||||
type: type,
|
||||
escape: false
|
||||
}));
|
||||
};
|
||||
|
||||
if (that.options.exportDataType === 'all' && that.options.pagination) {
|
||||
that.$el.one(that.options.sidePagination === 'server' ? 'post-body.bs.table' : 'page-change.bs.table', function () {
|
||||
doExport();
|
||||
that.togglePagination();
|
||||
});
|
||||
that.togglePagination();
|
||||
} else if (that.options.exportDataType === 'selected') {
|
||||
//修改sidePagination属性为server无法导出选中数据
|
||||
var trs = that.$body.children();
|
||||
for (var i = 0; i < trs.length; i++) {
|
||||
var $this = $(trs[i]);
|
||||
if(!$this.find(sprintf('[name="%s"]',that.options.selectItemName)).prop('checked')){
|
||||
$this['hide']();
|
||||
}}
|
||||
doExport();
|
||||
that.getRowsHidden(true);
|
||||
} else {
|
||||
doExport();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
})(jQuery);
|
@ -0,0 +1,92 @@
|
||||
/**
|
||||
* 基于bootstrap-table-mobile修改
|
||||
* 修正部分iPhone手机不显示卡片视图
|
||||
* Copyright (c) 2019 ruoyi
|
||||
*/
|
||||
!function ($) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var resetView = function (that) {
|
||||
if (that.options.height || that.options.showFooter) {
|
||||
setTimeout(that.resetView(), 1);
|
||||
}
|
||||
};
|
||||
|
||||
// 判断是否 iphone
|
||||
var isIPhone = function () {
|
||||
var browserName = navigator.userAgent.toLowerCase();
|
||||
return /(iPhone|iPad|iPod|iOS)/i.test(browserName);
|
||||
};
|
||||
|
||||
var changeView = function (that, width, height) {
|
||||
if (that.options.minHeight) {
|
||||
if (checkValuesLessEqual(width, that.options.minWidth) && checkValuesLessEqual(height, that.options.minHeight)) {
|
||||
conditionCardView(that);
|
||||
} else if (checkValuesGreater(width, that.options.minWidth) && checkValuesGreater(height, that.options.minHeight)) {
|
||||
conditionFullView(that);
|
||||
}
|
||||
} else {
|
||||
if (checkValuesLessEqual(width, that.options.minWidth) || isIPhone()) {
|
||||
conditionCardView(that);
|
||||
} else if (checkValuesGreater(width, that.options.minWidth)) {
|
||||
conditionFullView(that);
|
||||
}
|
||||
}
|
||||
|
||||
resetView(that);
|
||||
};
|
||||
|
||||
var checkValuesLessEqual = function (currentValue, targetValue) {
|
||||
return currentValue <= targetValue;
|
||||
};
|
||||
|
||||
var checkValuesGreater = function (currentValue, targetValue) {
|
||||
return currentValue > targetValue;
|
||||
};
|
||||
|
||||
var conditionCardView = function (that) {
|
||||
changeTableView(that, false);
|
||||
};
|
||||
|
||||
var conditionFullView = function (that) {
|
||||
changeTableView(that, true);
|
||||
};
|
||||
|
||||
var changeTableView = function (that, cardViewState) {
|
||||
that.options.cardView = cardViewState;
|
||||
that.toggleView();
|
||||
};
|
||||
|
||||
$.extend($.fn.bootstrapTable.defaults, {
|
||||
mobileResponsive: false,
|
||||
minWidth: 562,
|
||||
minHeight: undefined,
|
||||
checkOnInit: true,
|
||||
toggled: false
|
||||
});
|
||||
|
||||
var BootstrapTable = $.fn.bootstrapTable.Constructor,
|
||||
_init = BootstrapTable.prototype.init;
|
||||
|
||||
BootstrapTable.prototype.init = function () {
|
||||
_init.apply(this, Array.prototype.slice.apply(arguments));
|
||||
|
||||
if (!this.options.mobileResponsive) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.options.minWidth) {
|
||||
return;
|
||||
}
|
||||
|
||||
var that = this;
|
||||
$(window).resize(function () {
|
||||
changeView(that, $(this).width(), $(this).height())
|
||||
});
|
||||
|
||||
if (this.options.checkOnInit) {
|
||||
changeView(this, $(window).width(), $(window).height());
|
||||
}
|
||||
};
|
||||
}(jQuery);
|
@ -0,0 +1,117 @@
|
||||
/**
|
||||
* @author: Dennis Hernández
|
||||
* 实现表格拖拽功能
|
||||
* @version: v1.0.1
|
||||
*/
|
||||
(function ($) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var isSearch = false;
|
||||
|
||||
var rowAttr = function (row, index) {
|
||||
return {
|
||||
id: 'customId_' + index
|
||||
};
|
||||
};
|
||||
|
||||
$.extend($.fn.bootstrapTable.defaults, {
|
||||
reorderableRows: false,
|
||||
onDragStyle: null,
|
||||
onDropStyle: null,
|
||||
onDragClass: "reorder_rows_onDragClass",
|
||||
dragHandle: null,
|
||||
useRowAttrFunc: false,
|
||||
onReorderRowsDrag: function (table, row) {
|
||||
return false;
|
||||
},
|
||||
onReorderRowsDrop: function (table, row) {
|
||||
return false;
|
||||
},
|
||||
onReorderRow: function (newData) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
$.extend($.fn.bootstrapTable.Constructor.EVENTS, {
|
||||
'reorder-row.bs.table': 'onReorderRow'
|
||||
});
|
||||
|
||||
var BootstrapTable = $.fn.bootstrapTable.Constructor,
|
||||
_init = BootstrapTable.prototype.init,
|
||||
_initSearch = BootstrapTable.prototype.initSearch;
|
||||
|
||||
BootstrapTable.prototype.init = function () {
|
||||
|
||||
if (!this.options.reorderableRows) {
|
||||
_init.apply(this, Array.prototype.slice.apply(arguments));
|
||||
return;
|
||||
}
|
||||
|
||||
var that = this;
|
||||
if (this.options.useRowAttrFunc) {
|
||||
this.options.rowAttributes = rowAttr;
|
||||
}
|
||||
|
||||
var onPostBody = this.options.onPostBody;
|
||||
this.options.onPostBody = function () {
|
||||
setTimeout(function () {
|
||||
that.makeRowsReorderable();
|
||||
onPostBody.apply();
|
||||
}, 1);
|
||||
};
|
||||
|
||||
_init.apply(this, Array.prototype.slice.apply(arguments));
|
||||
};
|
||||
|
||||
BootstrapTable.prototype.initSearch = function () {
|
||||
_initSearch.apply(this, Array.prototype.slice.apply(arguments));
|
||||
|
||||
if (!this.options.reorderableRows) {
|
||||
return;
|
||||
}
|
||||
|
||||
//Known issue after search if you reorder the rows the data is not display properly
|
||||
//isSearch = true;
|
||||
};
|
||||
|
||||
BootstrapTable.prototype.makeRowsReorderable = function () {
|
||||
if (this.options.cardView) {
|
||||
return;
|
||||
}
|
||||
|
||||
var that = this;
|
||||
this.$el.tableDnD({
|
||||
onDragStyle: that.options.onDragStyle,
|
||||
onDropStyle: that.options.onDropStyle,
|
||||
onDragClass: that.options.onDragClass,
|
||||
onDrop: that.onDrop,
|
||||
onDragStart: that.options.onReorderRowsDrag,
|
||||
dragHandle: that.options.dragHandle
|
||||
});
|
||||
};
|
||||
|
||||
BootstrapTable.prototype.onDrop = function (table, droppedRow) {
|
||||
var tableBs = $(table),
|
||||
tableBsData = tableBs.data('bootstrap.table'),
|
||||
tableBsOptions = tableBs.data('bootstrap.table').options,
|
||||
row = null,
|
||||
newData = [];
|
||||
|
||||
for (var i = 0; i < table.tBodies[0].rows.length; i++) {
|
||||
row = $(table.tBodies[0].rows[i]);
|
||||
newData.push(tableBsOptions.data[row.data('index')]);
|
||||
row.data('index', i).attr('data-index', i);
|
||||
}
|
||||
|
||||
tableBsOptions.data = tableBsOptions.data.slice(0, tableBsData.pageFrom - 1)
|
||||
.concat(newData)
|
||||
.concat(tableBsOptions.data.slice(tableBsData.pageTo));
|
||||
|
||||
//Call the user defined function
|
||||
tableBsOptions.onReorderRowsDrop.apply(table, [table, droppedRow]);
|
||||
|
||||
//Call the event reorder-row
|
||||
tableBsData.trigger('reorder-row', newData);
|
||||
};
|
||||
})(jQuery);
|
@ -0,0 +1,598 @@
|
||||
/**
|
||||
* TableDnD plug-in for JQuery, allows you to drag and drop table rows
|
||||
* You can set up various options to control how the system will work
|
||||
* Copyright (c) Denis Howlett <denish@isocra.com>
|
||||
* License: MIT.
|
||||
* See https://github.com/isocra/TableDnD
|
||||
*/
|
||||
!function ($, window, document, undefined) {
|
||||
|
||||
var startEvent = 'touchstart mousedown',
|
||||
moveEvent = 'touchmove mousemove',
|
||||
endEvent = 'touchend mouseup';
|
||||
|
||||
$(document).ready(function () {
|
||||
function parseStyle(css) {
|
||||
var objMap = {},
|
||||
parts = css.match(/([^;:]+)/g) || [];
|
||||
while (parts.length)
|
||||
objMap[parts.shift()] = parts.shift().trim();
|
||||
|
||||
return objMap;
|
||||
}
|
||||
$('table').each(function () {
|
||||
if ($(this).data('table') === 'dnd') {
|
||||
|
||||
$(this).tableDnD({
|
||||
onDragStyle: $(this).data('ondragstyle') && parseStyle($(this).data('ondragstyle')) || null,
|
||||
onDropStyle: $(this).data('ondropstyle') && parseStyle($(this).data('ondropstyle')) || null,
|
||||
onDragClass: $(this).data('ondragclass') === undefined && "tDnD_whileDrag" || $(this).data('ondragclass'),
|
||||
onDrop: $(this).data('ondrop') && new Function('table', 'row', $(this).data('ondrop')), // 'return eval("'+$(this).data('ondrop')+'");') || null,
|
||||
onDragStart: $(this).data('ondragstart') && new Function('table', 'row' ,$(this).data('ondragstart')), // 'return eval("'+$(this).data('ondragstart')+'");') || null,
|
||||
onDragStop: $(this).data('ondragstop') && new Function('table', 'row' ,$(this).data('ondragstop')),
|
||||
scrollAmount: $(this).data('scrollamount') || 5,
|
||||
sensitivity: $(this).data('sensitivity') || 10,
|
||||
hierarchyLevel: $(this).data('hierarchylevel') || 0,
|
||||
indentArtifact: $(this).data('indentartifact') || '<div class="indent"> </div>',
|
||||
autoWidthAdjust: $(this).data('autowidthadjust') || true,
|
||||
autoCleanRelations: $(this).data('autocleanrelations') || true,
|
||||
jsonPretifySeparator: $(this).data('jsonpretifyseparator') || '\t',
|
||||
serializeRegexp: $(this).data('serializeregexp') && new RegExp($(this).data('serializeregexp')) || /[^\-]*$/,
|
||||
serializeParamName: $(this).data('serializeparamname') || false,
|
||||
dragHandle: $(this).data('draghandle') || null
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
jQuery.tableDnD = {
|
||||
/** Keep hold of the current table being dragged */
|
||||
currentTable: null,
|
||||
/** Keep hold of the current drag object if any */
|
||||
dragObject: null,
|
||||
/** The current mouse offset */
|
||||
mouseOffset: null,
|
||||
/** Remember the old value of X and Y so that we don't do too much processing */
|
||||
oldX: 0,
|
||||
oldY: 0,
|
||||
|
||||
/** Actually build the structure */
|
||||
build: function(options) {
|
||||
// Set up the defaults if any
|
||||
|
||||
this.each(function() {
|
||||
// This is bound to each matching table, set up the defaults and override with user options
|
||||
this.tableDnDConfig = $.extend({
|
||||
onDragStyle: null,
|
||||
onDropStyle: null,
|
||||
// Add in the default class for whileDragging
|
||||
onDragClass: "tDnD_whileDrag",
|
||||
onDrop: null,
|
||||
onDragStart: null,
|
||||
onDragStop: null,
|
||||
scrollAmount: 5,
|
||||
/** Sensitivity setting will throttle the trigger rate for movement detection */
|
||||
sensitivity: 10,
|
||||
/** Hierarchy level to support parent child. 0 switches this functionality off */
|
||||
hierarchyLevel: 0,
|
||||
/** The html artifact to prepend the first cell with as indentation */
|
||||
indentArtifact: '<div class="indent"> </div>',
|
||||
/** Automatically adjust width of first cell */
|
||||
autoWidthAdjust: true,
|
||||
/** Automatic clean-up to ensure relationship integrity */
|
||||
autoCleanRelations: true,
|
||||
/** Specify a number (4) as number of spaces or any indent string for JSON.stringify */
|
||||
jsonPretifySeparator: '\t',
|
||||
/** The regular expression to use to trim row IDs */
|
||||
serializeRegexp: /[^\-]*$/,
|
||||
/** If you want to specify another parameter name instead of the table ID */
|
||||
serializeParamName: false,
|
||||
/** If you give the name of a class here, then only Cells with this class will be draggable */
|
||||
dragHandle: null
|
||||
}, options || {});
|
||||
|
||||
// Now make the rows draggable
|
||||
$.tableDnD.makeDraggable(this);
|
||||
// Prepare hierarchy support
|
||||
this.tableDnDConfig.hierarchyLevel
|
||||
&& $.tableDnD.makeIndented(this);
|
||||
});
|
||||
|
||||
// Don't break the chain
|
||||
return this;
|
||||
},
|
||||
makeIndented: function (table) {
|
||||
var config = table.tableDnDConfig,
|
||||
rows = table.rows,
|
||||
firstCell = $(rows).first().find('td:first')[0],
|
||||
indentLevel = 0,
|
||||
cellWidth = 0,
|
||||
longestCell,
|
||||
tableStyle;
|
||||
|
||||
if ($(table).hasClass('indtd'))
|
||||
return null;
|
||||
|
||||
tableStyle = $(table).addClass('indtd').attr('style');
|
||||
$(table).css({whiteSpace: "nowrap"});
|
||||
|
||||
for (var w = 0; w < rows.length; w++) {
|
||||
if (cellWidth < $(rows[w]).find('td:first').text().length) {
|
||||
cellWidth = $(rows[w]).find('td:first').text().length;
|
||||
longestCell = w;
|
||||
}
|
||||
}
|
||||
$(firstCell).css({width: 'auto'});
|
||||
for (w = 0; w < config.hierarchyLevel; w++)
|
||||
$(rows[longestCell]).find('td:first').prepend(config.indentArtifact);
|
||||
firstCell && $(firstCell).css({width: firstCell.offsetWidth});
|
||||
tableStyle && $(table).css(tableStyle);
|
||||
|
||||
for (w = 0; w < config.hierarchyLevel; w++)
|
||||
$(rows[longestCell]).find('td:first').children(':first').remove();
|
||||
|
||||
config.hierarchyLevel
|
||||
&& $(rows).each(function () {
|
||||
indentLevel = $(this).data('level') || 0;
|
||||
indentLevel <= config.hierarchyLevel
|
||||
&& $(this).data('level', indentLevel)
|
||||
|| $(this).data('level', 0);
|
||||
for (var i = 0; i < $(this).data('level'); i++)
|
||||
$(this).find('td:first').prepend(config.indentArtifact);
|
||||
});
|
||||
|
||||
return this;
|
||||
},
|
||||
/** This function makes all the rows on the table draggable apart from those marked as "NoDrag" */
|
||||
makeDraggable: function(table) {
|
||||
var config = table.tableDnDConfig;
|
||||
|
||||
config.dragHandle
|
||||
// We only need to add the event to the specified cells
|
||||
&& $(config.dragHandle, table).each(function() {
|
||||
// The cell is bound to "this"
|
||||
$(this).bind(startEvent, function(e) {
|
||||
$.tableDnD.initialiseDrag($(this).parents('tr')[0], table, this, e, config);
|
||||
return false;
|
||||
});
|
||||
})
|
||||
// For backwards compatibility, we add the event to the whole row
|
||||
// get all the rows as a wrapped set
|
||||
|| $(table.rows).each(function() {
|
||||
// Iterate through each row, the row is bound to "this"
|
||||
if (! $(this).hasClass("nodrag")) {
|
||||
$(this).bind(startEvent, function(e) {
|
||||
if (e.target.tagName === "TD" && event.target.className !== "nodrag") {
|
||||
$.tableDnD.initialiseDrag(this, table, this, e, config);
|
||||
return false;
|
||||
}
|
||||
}).css("cursor", "move"); // Store the tableDnD object
|
||||
} else {
|
||||
$(this).css("cursor", ""); // Remove the cursor if we don't have the nodrag class
|
||||
}
|
||||
});
|
||||
},
|
||||
currentOrder: function() {
|
||||
var rows = this.currentTable.rows;
|
||||
return $.map(rows, function (val) {
|
||||
return ($(val).data('level') + val.id).replace(/\s/g, '');
|
||||
}).join('');
|
||||
},
|
||||
initialiseDrag: function(dragObject, table, target, e, config) {
|
||||
this.dragObject = dragObject;
|
||||
this.currentTable = table;
|
||||
this.mouseOffset = this.getMouseOffset(target, e);
|
||||
this.originalOrder = this.currentOrder();
|
||||
|
||||
// Now we need to capture the mouse up and mouse move event
|
||||
// We can use bind so that we don't interfere with other event handlers
|
||||
$(document)
|
||||
.bind(moveEvent, this.mousemove)
|
||||
.bind(endEvent, this.mouseup);
|
||||
|
||||
// Call the onDragStart method if there is one
|
||||
config.onDragStart
|
||||
&& config.onDragStart(table, target);
|
||||
},
|
||||
updateTables: function() {
|
||||
this.each(function() {
|
||||
// this is now bound to each matching table
|
||||
if (this.tableDnDConfig)
|
||||
$.tableDnD.makeDraggable(this);
|
||||
});
|
||||
},
|
||||
/** Get the mouse coordinates from the event (allowing for browser differences) */
|
||||
mouseCoords: function(e) {
|
||||
if (e.originalEvent.changedTouches)
|
||||
return {
|
||||
x: e.originalEvent.changedTouches[0].clientX,
|
||||
y: e.originalEvent.changedTouches[0].clientY
|
||||
};
|
||||
|
||||
if(e.pageX || e.pageY)
|
||||
return {
|
||||
x: e.pageX,
|
||||
y: e.pageY
|
||||
};
|
||||
|
||||
return {
|
||||
x: e.clientX + document.body.scrollLeft - document.body.clientLeft,
|
||||
y: e.clientY + document.body.scrollTop - document.body.clientTop
|
||||
};
|
||||
},
|
||||
/** Given a target element and a mouse eent, get the mouse offset from that element.
|
||||
To do this we need the element's position and the mouse position */
|
||||
getMouseOffset: function(target, e) {
|
||||
var mousePos,
|
||||
docPos;
|
||||
|
||||
e = e || window.event;
|
||||
|
||||
docPos = this.getPosition(target);
|
||||
mousePos = this.mouseCoords(e);
|
||||
|
||||
return {
|
||||
x: mousePos.x - docPos.x,
|
||||
y: mousePos.y - docPos.y
|
||||
};
|
||||
},
|
||||
/** Get the position of an element by going up the DOM tree and adding up all the offsets */
|
||||
getPosition: function(element) {
|
||||
var left = 0,
|
||||
top = 0;
|
||||
|
||||
// Safari fix -- thanks to Luis Chato for this!
|
||||
// Safari 2 doesn't correctly grab the offsetTop of a table row
|
||||
// this is detailed here:
|
||||
// http://jacob.peargrove.com/blog/2006/technical/table-row-offsettop-bug-in-safari/
|
||||
// the solution is likewise noted there, grab the offset of a table cell in the row - the firstChild.
|
||||
// note that firefox will return a text node as a first child, so designing a more thorough
|
||||
// solution may need to take that into account, for now this seems to work in firefox, safari, ie
|
||||
if (element.offsetHeight === 0)
|
||||
element = element.firstChild; // a table cell
|
||||
|
||||
while (element.offsetParent) {
|
||||
left += element.offsetLeft;
|
||||
top += element.offsetTop;
|
||||
element = element.offsetParent;
|
||||
}
|
||||
|
||||
left += element.offsetLeft;
|
||||
top += element.offsetTop;
|
||||
|
||||
return {
|
||||
x: left,
|
||||
y: top
|
||||
};
|
||||
},
|
||||
autoScroll: function (mousePos) {
|
||||
var config = this.currentTable.tableDnDConfig,
|
||||
yOffset = window.pageYOffset,
|
||||
windowHeight = window.innerHeight
|
||||
? window.innerHeight
|
||||
: document.documentElement.clientHeight
|
||||
? document.documentElement.clientHeight
|
||||
: document.body.clientHeight;
|
||||
|
||||
// Windows version
|
||||
// yOffset=document.body.scrollTop;
|
||||
if (document.all)
|
||||
if (typeof document.compatMode !== 'undefined'
|
||||
&& document.compatMode !== 'BackCompat')
|
||||
yOffset = document.documentElement.scrollTop;
|
||||
else if (typeof document.body !== 'undefined')
|
||||
yOffset = document.body.scrollTop;
|
||||
|
||||
mousePos.y - yOffset < config.scrollAmount
|
||||
&& window.scrollBy(0, - config.scrollAmount)
|
||||
|| windowHeight - (mousePos.y - yOffset) < config.scrollAmount
|
||||
&& window.scrollBy(0, config.scrollAmount);
|
||||
|
||||
},
|
||||
moveVerticle: function (moving, currentRow) {
|
||||
|
||||
if (0 !== moving.vertical
|
||||
// If we're over a row then move the dragged row to there so that the user sees the
|
||||
// effect dynamically
|
||||
&& currentRow
|
||||
&& this.dragObject !== currentRow
|
||||
&& this.dragObject.parentNode === currentRow.parentNode)
|
||||
0 > moving.vertical
|
||||
&& this.dragObject.parentNode.insertBefore(this.dragObject, currentRow.nextSibling)
|
||||
|| 0 < moving.vertical
|
||||
&& this.dragObject.parentNode.insertBefore(this.dragObject, currentRow);
|
||||
|
||||
},
|
||||
moveHorizontal: function (moving, currentRow) {
|
||||
var config = this.currentTable.tableDnDConfig,
|
||||
currentLevel;
|
||||
|
||||
if (!config.hierarchyLevel
|
||||
|| 0 === moving.horizontal
|
||||
// We only care if moving left or right on the current row
|
||||
|| !currentRow
|
||||
|| this.dragObject !== currentRow)
|
||||
return null;
|
||||
|
||||
currentLevel = $(currentRow).data('level');
|
||||
|
||||
0 < moving.horizontal
|
||||
&& currentLevel > 0
|
||||
&& $(currentRow).find('td:first').children(':first').remove()
|
||||
&& $(currentRow).data('level', --currentLevel);
|
||||
|
||||
0 > moving.horizontal
|
||||
&& currentLevel < config.hierarchyLevel
|
||||
&& $(currentRow).prev().data('level') >= currentLevel
|
||||
&& $(currentRow).children(':first').prepend(config.indentArtifact)
|
||||
&& $(currentRow).data('level', ++currentLevel);
|
||||
|
||||
},
|
||||
mousemove: function(e) {
|
||||
var dragObj = $($.tableDnD.dragObject),
|
||||
config = $.tableDnD.currentTable.tableDnDConfig,
|
||||
currentRow,
|
||||
mousePos,
|
||||
moving,
|
||||
x,
|
||||
y;
|
||||
|
||||
e && e.preventDefault();
|
||||
|
||||
if (!$.tableDnD.dragObject)
|
||||
return false;
|
||||
|
||||
// prevent touch device screen scrolling
|
||||
e.type === 'touchmove'
|
||||
&& event.preventDefault(); // TODO verify this is event and not really e
|
||||
|
||||
// update the style to show we're dragging
|
||||
config.onDragClass
|
||||
&& dragObj.addClass(config.onDragClass)
|
||||
|| dragObj.css(config.onDragStyle);
|
||||
|
||||
mousePos = $.tableDnD.mouseCoords(e);
|
||||
x = mousePos.x - $.tableDnD.mouseOffset.x;
|
||||
y = mousePos.y - $.tableDnD.mouseOffset.y;
|
||||
|
||||
// auto scroll the window
|
||||
$.tableDnD.autoScroll(mousePos);
|
||||
|
||||
currentRow = $.tableDnD.findDropTargetRow(dragObj, y);
|
||||
moving = $.tableDnD.findDragDirection(x, y);
|
||||
|
||||
$.tableDnD.moveVerticle(moving, currentRow);
|
||||
$.tableDnD.moveHorizontal(moving, currentRow);
|
||||
|
||||
return false;
|
||||
},
|
||||
findDragDirection: function (x,y) {
|
||||
var sensitivity = this.currentTable.tableDnDConfig.sensitivity,
|
||||
oldX = this.oldX,
|
||||
oldY = this.oldY,
|
||||
xMin = oldX - sensitivity,
|
||||
xMax = oldX + sensitivity,
|
||||
yMin = oldY - sensitivity,
|
||||
yMax = oldY + sensitivity,
|
||||
moving = {
|
||||
horizontal: x >= xMin && x <= xMax ? 0 : x > oldX ? -1 : 1,
|
||||
vertical : y >= yMin && y <= yMax ? 0 : y > oldY ? -1 : 1
|
||||
};
|
||||
|
||||
// update the old value
|
||||
if (moving.horizontal !== 0)
|
||||
this.oldX = x;
|
||||
if (moving.vertical !== 0)
|
||||
this.oldY = y;
|
||||
|
||||
return moving;
|
||||
},
|
||||
/** We're only worried about the y position really, because we can only move rows up and down */
|
||||
findDropTargetRow: function(draggedRow, y) {
|
||||
var rowHeight = 0,
|
||||
rows = this.currentTable.rows,
|
||||
config = this.currentTable.tableDnDConfig,
|
||||
rowY = 0,
|
||||
row = null;
|
||||
|
||||
for (var i = 0; i < rows.length; i++) {
|
||||
row = rows[i];
|
||||
rowY = this.getPosition(row).y;
|
||||
rowHeight = parseInt(row.offsetHeight) / 2;
|
||||
if (row.offsetHeight === 0) {
|
||||
rowY = this.getPosition(row.firstChild).y;
|
||||
rowHeight = parseInt(row.firstChild.offsetHeight) / 2;
|
||||
}
|
||||
// Because we always have to insert before, we need to offset the height a bit
|
||||
if (y > (rowY - rowHeight) && y < (rowY + rowHeight))
|
||||
// that's the row we're over
|
||||
// If it's the same as the current row, ignore it
|
||||
if (draggedRow.is(row)
|
||||
|| (config.onAllowDrop
|
||||
&& !config.onAllowDrop(draggedRow, row))
|
||||
// If a row has nodrop class, then don't allow dropping (inspired by John Tarr and Famic)
|
||||
|| $(row).hasClass("nodrop"))
|
||||
return null;
|
||||
else
|
||||
return row;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
processMouseup: function() {
|
||||
if (!this.currentTable || !this.dragObject)
|
||||
return null;
|
||||
|
||||
var config = this.currentTable.tableDnDConfig,
|
||||
droppedRow = this.dragObject,
|
||||
parentLevel = 0,
|
||||
myLevel = 0;
|
||||
|
||||
// Unbind the event handlers
|
||||
$(document)
|
||||
.unbind(moveEvent, this.mousemove)
|
||||
.unbind(endEvent, this.mouseup);
|
||||
|
||||
config.hierarchyLevel
|
||||
&& config.autoCleanRelations
|
||||
&& $(this.currentTable.rows).first().find('td:first').children().each(function () {
|
||||
myLevel = $(this).parents('tr:first').data('level');
|
||||
myLevel
|
||||
&& $(this).parents('tr:first').data('level', --myLevel)
|
||||
&& $(this).remove();
|
||||
})
|
||||
&& config.hierarchyLevel > 1
|
||||
&& $(this.currentTable.rows).each(function () {
|
||||
myLevel = $(this).data('level');
|
||||
if (myLevel > 1) {
|
||||
parentLevel = $(this).prev().data('level');
|
||||
while (myLevel > parentLevel + 1) {
|
||||
$(this).find('td:first').children(':first').remove();
|
||||
$(this).data('level', --myLevel);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// If we have a dragObject, then we need to release it,
|
||||
// The row will already have been moved to the right place so we just reset stuff
|
||||
config.onDragClass
|
||||
&& $(droppedRow).removeClass(config.onDragClass)
|
||||
|| $(droppedRow).css(config.onDropStyle);
|
||||
|
||||
this.dragObject = null;
|
||||
// Call the onDrop method if there is one
|
||||
config.onDrop
|
||||
&& this.originalOrder !== this.currentOrder()
|
||||
&& $(droppedRow).hide().fadeIn('fast')
|
||||
&& config.onDrop(this.currentTable, droppedRow);
|
||||
|
||||
// Call the onDragStop method if there is one
|
||||
config.onDragStop
|
||||
&& config.onDragStop(this.currentTable, droppedRow);
|
||||
|
||||
this.currentTable = null; // let go of the table too
|
||||
},
|
||||
mouseup: function(e) {
|
||||
e && e.preventDefault();
|
||||
$.tableDnD.processMouseup();
|
||||
return false;
|
||||
},
|
||||
jsonize: function(pretify) {
|
||||
var table = this.currentTable;
|
||||
if (pretify)
|
||||
return JSON.stringify(
|
||||
this.tableData(table),
|
||||
null,
|
||||
table.tableDnDConfig.jsonPretifySeparator
|
||||
);
|
||||
return JSON.stringify(this.tableData(table));
|
||||
},
|
||||
serialize: function() {
|
||||
return $.param(this.tableData(this.currentTable));
|
||||
},
|
||||
serializeTable: function(table) {
|
||||
var result = "";
|
||||
var paramName = table.tableDnDConfig.serializeParamName || table.id;
|
||||
var rows = table.rows;
|
||||
for (var i=0; i<rows.length; i++) {
|
||||
if (result.length > 0) result += "&";
|
||||
var rowId = rows[i].id;
|
||||
if (rowId && table.tableDnDConfig && table.tableDnDConfig.serializeRegexp) {
|
||||
rowId = rowId.match(table.tableDnDConfig.serializeRegexp)[0];
|
||||
result += paramName + '[]=' + rowId;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
},
|
||||
serializeTables: function() {
|
||||
var result = [];
|
||||
$('table').each(function() {
|
||||
this.id && result.push($.param($.tableDnD.tableData(this)));
|
||||
});
|
||||
return result.join('&');
|
||||
},
|
||||
tableData: function (table) {
|
||||
var config = table.tableDnDConfig,
|
||||
previousIDs = [],
|
||||
currentLevel = 0,
|
||||
indentLevel = 0,
|
||||
rowID = null,
|
||||
data = {},
|
||||
getSerializeRegexp,
|
||||
paramName,
|
||||
currentID,
|
||||
rows;
|
||||
|
||||
if (!table)
|
||||
table = this.currentTable;
|
||||
if (!table || !table.rows || !table.rows.length)
|
||||
return {error: { code: 500, message: "Not a valid table."}};
|
||||
if (!table.id && !config.serializeParamName)
|
||||
return {error: { code: 500, message: "No serializable unique id provided."}};
|
||||
|
||||
rows = config.autoCleanRelations
|
||||
&& table.rows
|
||||
|| $.makeArray(table.rows);
|
||||
paramName = config.serializeParamName || table.id;
|
||||
currentID = paramName;
|
||||
|
||||
getSerializeRegexp = function (rowId) {
|
||||
if (rowId && config && config.serializeRegexp)
|
||||
return rowId.match(config.serializeRegexp)[0];
|
||||
return rowId;
|
||||
};
|
||||
|
||||
data[currentID] = [];
|
||||
!config.autoCleanRelations
|
||||
&& $(rows[0]).data('level')
|
||||
&& rows.unshift({id: 'undefined'});
|
||||
|
||||
|
||||
|
||||
for (var i=0; i < rows.length; i++) {
|
||||
if (config.hierarchyLevel) {
|
||||
indentLevel = $(rows[i]).data('level') || 0;
|
||||
if (indentLevel === 0) {
|
||||
currentID = paramName;
|
||||
previousIDs = [];
|
||||
}
|
||||
else if (indentLevel > currentLevel) {
|
||||
previousIDs.push([currentID, currentLevel]);
|
||||
currentID = getSerializeRegexp(rows[i-1].id);
|
||||
}
|
||||
else if (indentLevel < currentLevel) {
|
||||
for (var h = 0; h < previousIDs.length; h++) {
|
||||
if (previousIDs[h][1] === indentLevel)
|
||||
currentID = previousIDs[h][0];
|
||||
if (previousIDs[h][1] >= currentLevel)
|
||||
previousIDs[h][1] = 0;
|
||||
}
|
||||
}
|
||||
currentLevel = indentLevel;
|
||||
|
||||
if (!$.isArray(data[currentID]))
|
||||
data[currentID] = [];
|
||||
rowID = getSerializeRegexp(rows[i].id);
|
||||
rowID && data[currentID].push(rowID);
|
||||
}
|
||||
else {
|
||||
rowID = getSerializeRegexp(rows[i].id);
|
||||
rowID && data[currentID].push(rowID);
|
||||
}
|
||||
}
|
||||
return data;
|
||||
}
|
||||
};
|
||||
|
||||
jQuery.fn.extend(
|
||||
{
|
||||
tableDnD : $.tableDnD.build,
|
||||
tableDnDUpdate : $.tableDnD.updateTables,
|
||||
tableDnDSerialize : $.proxy($.tableDnD.serialize, $.tableDnD),
|
||||
tableDnDSerializeAll : $.tableDnD.serializeTables,
|
||||
tableDnDData : $.proxy($.tableDnD.tableData, $.tableDnD)
|
||||
}
|
||||
);
|
||||
|
||||
}(jQuery, window, window.document);
|
@ -0,0 +1,211 @@
|
||||
/**
|
||||
* @author: aperez <aperez@datadec.es>
|
||||
* @version: v2.0.0
|
||||
*
|
||||
* @update Dennis Hernández <http://djhvscf.github.io/Blog>
|
||||
*/
|
||||
|
||||
!function($) {
|
||||
'use strict';
|
||||
|
||||
var firstLoad = false;
|
||||
|
||||
var sprintf = $.fn.bootstrapTable.utils.sprintf;
|
||||
|
||||
var showAvdSearch = function(pColumns, searchTitle, searchText, that) {
|
||||
if (!$("#avdSearchModal" + "_" + that.options.idTable).hasClass("modal")) {
|
||||
var vModal = sprintf("<div id=\"avdSearchModal%s\" class=\"modal fade\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"mySmallModalLabel\" aria-hidden=\"true\">", "_" + that.options.idTable);
|
||||
vModal += "<div class=\"modal-dialog modal-xs\">";
|
||||
vModal += " <div class=\"modal-content\">";
|
||||
vModal += " <div class=\"modal-header\">";
|
||||
vModal += " <button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-hidden=\"true\" >×</button>";
|
||||
vModal += sprintf(" <h4 class=\"modal-title\">%s</h4>", searchTitle);
|
||||
vModal += " </div>";
|
||||
vModal += " <div class=\"modal-body modal-body-custom\">";
|
||||
vModal += sprintf(" <div class=\"container-fluid\" id=\"avdSearchModalContent%s\" style=\"padding-right: 0px;padding-left: 0px;\" >", "_" + that.options.idTable);
|
||||
vModal += " </div>";
|
||||
vModal += " </div>";
|
||||
vModal += " </div>";
|
||||
vModal += " </div>";
|
||||
vModal += "</div>";
|
||||
|
||||
$("body").append($(vModal));
|
||||
|
||||
var vFormAvd = createFormAvd(pColumns, searchText, that),
|
||||
timeoutId = 0;;
|
||||
|
||||
$('#avdSearchModalContent' + "_" + that.options.idTable).append(vFormAvd.join(''));
|
||||
|
||||
$('#' + that.options.idForm).off('keyup blur', 'input').on('keyup blur', 'input', function (event) {
|
||||
clearTimeout(timeoutId);
|
||||
timeoutId = setTimeout(function () {
|
||||
that.onColumnAdvancedSearch(event);
|
||||
}, that.options.searchTimeOut);
|
||||
});
|
||||
|
||||
$("#btnCloseAvd" + "_" + that.options.idTable).click(function() {
|
||||
$("#avdSearchModal" + "_" + that.options.idTable).modal('hide');
|
||||
});
|
||||
|
||||
$("#avdSearchModal" + "_" + that.options.idTable).modal();
|
||||
} else {
|
||||
$("#avdSearchModal" + "_" + that.options.idTable).modal();
|
||||
}
|
||||
};
|
||||
|
||||
var createFormAvd = function(pColumns, searchText, that) {
|
||||
var htmlForm = [];
|
||||
htmlForm.push(sprintf('<form class="form-horizontal" id="%s" action="%s" >', that.options.idForm, that.options.actionForm));
|
||||
for (var i in pColumns) {
|
||||
var vObjCol = pColumns[i];
|
||||
if (!vObjCol.checkbox && vObjCol.visible && vObjCol.searchable) {
|
||||
htmlForm.push('<div class="form-group">');
|
||||
htmlForm.push(sprintf('<label class="col-sm-4 control-label">%s</label>', vObjCol.title));
|
||||
htmlForm.push('<div class="col-sm-6">');
|
||||
htmlForm.push(sprintf('<input type="text" class="form-control input-md" name="%s" placeholder="%s" id="%s">', vObjCol.field, vObjCol.title, vObjCol.field));
|
||||
htmlForm.push('</div>');
|
||||
htmlForm.push('</div>');
|
||||
}
|
||||
}
|
||||
|
||||
htmlForm.push('<div class="form-group">');
|
||||
htmlForm.push('<div class="col-sm-offset-9 col-sm-3">');
|
||||
htmlForm.push(sprintf('<button type="button" id="btnCloseAvd%s" class="btn btn-default" >%s</button>', "_" + that.options.idTable, searchText));
|
||||
htmlForm.push('</div>');
|
||||
htmlForm.push('</div>');
|
||||
htmlForm.push('</form>');
|
||||
|
||||
return htmlForm;
|
||||
};
|
||||
|
||||
$.extend($.fn.bootstrapTable.defaults, {
|
||||
advancedSearch: false,
|
||||
idForm: 'advancedSearch',
|
||||
actionForm: '',
|
||||
idTable: undefined,
|
||||
onColumnAdvancedSearch: function (field, text) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
$.extend($.fn.bootstrapTable.defaults.icons, {
|
||||
advancedSearchIcon: 'glyphicon-chevron-down'
|
||||
});
|
||||
|
||||
$.extend($.fn.bootstrapTable.Constructor.EVENTS, {
|
||||
'column-advanced-search.bs.table': 'onColumnAdvancedSearch'
|
||||
});
|
||||
|
||||
$.extend($.fn.bootstrapTable.locales, {
|
||||
formatAdvancedSearch: function() {
|
||||
return 'Advanced search';
|
||||
},
|
||||
formatAdvancedCloseButton: function() {
|
||||
return "Close";
|
||||
}
|
||||
});
|
||||
|
||||
$.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales);
|
||||
|
||||
var BootstrapTable = $.fn.bootstrapTable.Constructor,
|
||||
_initToolbar = BootstrapTable.prototype.initToolbar,
|
||||
_load = BootstrapTable.prototype.load,
|
||||
_initSearch = BootstrapTable.prototype.initSearch;
|
||||
|
||||
BootstrapTable.prototype.initToolbar = function() {
|
||||
_initToolbar.apply(this, Array.prototype.slice.apply(arguments));
|
||||
|
||||
if (!this.options.search) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.options.advancedSearch) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.options.idTable) {
|
||||
return;
|
||||
}
|
||||
|
||||
var that = this,
|
||||
html = [];
|
||||
|
||||
html.push(sprintf('<div class="columns columns-%s btn-group pull-%s" role="group">', this.options.buttonsAlign, this.options.buttonsAlign));
|
||||
html.push(sprintf('<button class="btn btn-default%s' + '" type="button" name="advancedSearch" title="%s">', that.options.iconSize === undefined ? '' : ' btn-' + that.options.iconSize, that.options.formatAdvancedSearch()));
|
||||
html.push(sprintf('<i class="%s %s"></i>', that.options.iconsPrefix, that.options.icons.advancedSearchIcon))
|
||||
html.push('</button></div>');
|
||||
|
||||
that.$toolbar.prepend(html.join(''));
|
||||
|
||||
that.$toolbar.find('button[name="advancedSearch"]')
|
||||
.off('click').on('click', function() {
|
||||
showAvdSearch(that.columns, that.options.formatAdvancedSearch(), that.options.formatAdvancedCloseButton(), that);
|
||||
});
|
||||
};
|
||||
|
||||
BootstrapTable.prototype.load = function(data) {
|
||||
_load.apply(this, Array.prototype.slice.apply(arguments));
|
||||
|
||||
if (!this.options.advancedSearch) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (typeof this.options.idTable === 'undefined') {
|
||||
return;
|
||||
} else {
|
||||
if (!firstLoad) {
|
||||
var height = parseInt($(".bootstrap-table").height());
|
||||
height += 10;
|
||||
$("#" + this.options.idTable).bootstrapTable("resetView", {height: height});
|
||||
firstLoad = true;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
BootstrapTable.prototype.initSearch = function () {
|
||||
_initSearch.apply(this, Array.prototype.slice.apply(arguments));
|
||||
|
||||
if (!this.options.advancedSearch) {
|
||||
return;
|
||||
}
|
||||
|
||||
var that = this;
|
||||
var fp = $.isEmptyObject(this.filterColumnsPartial) ? null : this.filterColumnsPartial;
|
||||
|
||||
this.data = fp ? $.grep(this.data, function (item, i) {
|
||||
for (var key in fp) {
|
||||
var fval = fp[key].toLowerCase();
|
||||
var value = item[key];
|
||||
value = $.fn.bootstrapTable.utils.calculateObjectValue(that.header,
|
||||
that.header.formatters[$.inArray(key, that.header.fields)],
|
||||
[value, item, i], value);
|
||||
|
||||
if (!($.inArray(key, that.header.fields) !== -1 &&
|
||||
(typeof value === 'string' || typeof value === 'number') &&
|
||||
(value + '').toLowerCase().indexOf(fval) !== -1)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}) : this.data;
|
||||
};
|
||||
|
||||
BootstrapTable.prototype.onColumnAdvancedSearch = function (event) {
|
||||
var text = $.trim($(event.currentTarget).val());
|
||||
var $field = $(event.currentTarget)[0].id;
|
||||
|
||||
if ($.isEmptyObject(this.filterColumnsPartial)) {
|
||||
this.filterColumnsPartial = {};
|
||||
}
|
||||
if (text) {
|
||||
this.filterColumnsPartial[$field] = text;
|
||||
} else {
|
||||
delete this.filterColumnsPartial[$field];
|
||||
}
|
||||
|
||||
this.options.pageNumber = 1;
|
||||
this.onSearch(event);
|
||||
this.updatePagination();
|
||||
this.trigger('column-advanced-search', $field, text);
|
||||
};
|
||||
}(jQuery);
|
@ -0,0 +1,7 @@
|
||||
/*
|
||||
* bootstrap-table - v1.11.0 - 2016-07-02
|
||||
* https://github.com/wenzhixin/bootstrap-table
|
||||
* Copyright (c) 2016 zhixin wen
|
||||
* Licensed MIT License
|
||||
*/
|
||||
!function(a){"use strict";var b=!1,c=a.fn.bootstrapTable.utils.sprintf,d=function(b,d,f,g){if(a("#avdSearchModal_"+g.options.idTable).hasClass("modal"))a("#avdSearchModal_"+g.options.idTable).modal();else{var h=c('<div id="avdSearchModal%s" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true">',"_"+g.options.idTable);h+='<div class="modal-dialog modal-xs">',h+=' <div class="modal-content">',h+=' <div class="modal-header">',h+=' <button type="button" class="close" data-dismiss="modal" aria-hidden="true" >×</button>',h+=c(' <h4 class="modal-title">%s</h4>',d),h+=" </div>",h+=' <div class="modal-body modal-body-custom">',h+=c(' <div class="container-fluid" id="avdSearchModalContent%s" style="padding-right: 0px;padding-left: 0px;" >',"_"+g.options.idTable),h+=" </div>",h+=" </div>",h+=" </div>",h+=" </div>",h+="</div>",a("body").append(a(h));var i=e(b,f,g),j=0;a("#avdSearchModalContent_"+g.options.idTable).append(i.join("")),a("#"+g.options.idForm).off("keyup blur","input").on("keyup blur","input",function(a){clearTimeout(j),j=setTimeout(function(){g.onColumnAdvancedSearch(a)},g.options.searchTimeOut)}),a("#btnCloseAvd_"+g.options.idTable).click(function(){a("#avdSearchModal_"+g.options.idTable).modal("hide")}),a("#avdSearchModal_"+g.options.idTable).modal()}},e=function(a,b,d){var e=[];e.push(c('<form class="form-horizontal" id="%s" action="%s" >',d.options.idForm,d.options.actionForm));for(var f in a){var g=a[f];!g.checkbox&&g.visible&&g.searchable&&(e.push('<div class="form-group">'),e.push(c('<label class="col-sm-4 control-label">%s</label>',g.title)),e.push('<div class="col-sm-6">'),e.push(c('<input type="text" class="form-control input-md" name="%s" placeholder="%s" id="%s">',g.field,g.title,g.field)),e.push("</div>"),e.push("</div>"))}return e.push('<div class="form-group">'),e.push('<div class="col-sm-offset-9 col-sm-3">'),e.push(c('<button type="button" id="btnCloseAvd%s" class="btn btn-default" >%s</button>',"_"+d.options.idTable,b)),e.push("</div>"),e.push("</div>"),e.push("</form>"),e};a.extend(a.fn.bootstrapTable.defaults,{advancedSearch:!1,idForm:"advancedSearch",actionForm:"",idTable:void 0,onColumnAdvancedSearch:function(){return!1}}),a.extend(a.fn.bootstrapTable.defaults.icons,{advancedSearchIcon:"glyphicon-chevron-down"}),a.extend(a.fn.bootstrapTable.Constructor.EVENTS,{"column-advanced-search.bs.table":"onColumnAdvancedSearch"}),a.extend(a.fn.bootstrapTable.locales,{formatAdvancedSearch:function(){return"Advanced search"},formatAdvancedCloseButton:function(){return"Close"}}),a.extend(a.fn.bootstrapTable.defaults,a.fn.bootstrapTable.locales);var f=a.fn.bootstrapTable.Constructor,g=f.prototype.initToolbar,h=f.prototype.load,i=f.prototype.initSearch;f.prototype.initToolbar=function(){if(g.apply(this,Array.prototype.slice.apply(arguments)),this.options.search&&this.options.advancedSearch&&this.options.idTable){var a=this,b=[];b.push(c('<div class="columns columns-%s btn-group pull-%s" role="group">',this.options.buttonsAlign,this.options.buttonsAlign)),b.push(c('<button class="btn btn-default%s" type="button" name="advancedSearch" title="%s">',void 0===a.options.iconSize?"":" btn-"+a.options.iconSize,a.options.formatAdvancedSearch())),b.push(c('<i class="%s %s"></i>',a.options.iconsPrefix,a.options.icons.advancedSearchIcon)),b.push("</button></div>"),a.$toolbar.prepend(b.join("")),a.$toolbar.find('button[name="advancedSearch"]').off("click").on("click",function(){d(a.columns,a.options.formatAdvancedSearch(),a.options.formatAdvancedCloseButton(),a)})}},f.prototype.load=function(){if(h.apply(this,Array.prototype.slice.apply(arguments)),this.options.advancedSearch&&"undefined"!=typeof this.options.idTable&&!b){var c=parseInt(a(".bootstrap-table").height());c+=10,a("#"+this.options.idTable).bootstrapTable("resetView",{height:c}),b=!0}},f.prototype.initSearch=function(){if(i.apply(this,Array.prototype.slice.apply(arguments)),this.options.advancedSearch){var b=this,c=a.isEmptyObject(this.filterColumnsPartial)?null:this.filterColumnsPartial;this.data=c?a.grep(this.data,function(d,e){for(var f in c){var g=c[f].toLowerCase(),h=d[f];if(h=a.fn.bootstrapTable.utils.calculateObjectValue(b.header,b.header.formatters[a.inArray(f,b.header.fields)],[h,d,e],h),-1===a.inArray(f,b.header.fields)||"string"!=typeof h&&"number"!=typeof h||-1===(h+"").toLowerCase().indexOf(g))return!1}return!0}):this.data}},f.prototype.onColumnAdvancedSearch=function(b){var c=a.trim(a(b.currentTarget).val()),d=a(b.currentTarget)[0].id;a.isEmptyObject(this.filterColumnsPartial)&&(this.filterColumnsPartial={}),c?this.filterColumnsPartial[d]=c:delete this.filterColumnsPartial[d],this.options.pageNumber=1,this.onSearch(b),this.updatePagination(),this.trigger("column-advanced-search",d,c)}}(jQuery);
|
@ -0,0 +1,42 @@
|
||||
(function ($) {
|
||||
'use strict';
|
||||
|
||||
$.fn.bootstrapTable.locales['zh-CN'] = {
|
||||
formatLoadingMessage: function () {
|
||||
return '正在努力地加载数据中,请稍候……';
|
||||
},
|
||||
formatRecordsPerPage: function (pageNumber) {
|
||||
return pageNumber + ' 条记录每页';
|
||||
},
|
||||
formatShowingRows: function (pageFrom, pageTo, totalRows) {
|
||||
return '第 ' + pageFrom + ' 到 ' + pageTo + ' 条,共 ' + totalRows + ' 条记录。';
|
||||
},
|
||||
formatSearch: function () {
|
||||
return '搜索';
|
||||
},
|
||||
formatNoMatches: function () {
|
||||
return '没有找到匹配的记录';
|
||||
},
|
||||
formatPaginationSwitch: function () {
|
||||
return '隐藏/显示分页';
|
||||
},
|
||||
formatRefresh: function () {
|
||||
return '刷新';
|
||||
},
|
||||
formatToggle: function () {
|
||||
return '切换';
|
||||
},
|
||||
formatColumns: function () {
|
||||
return '列';
|
||||
},
|
||||
formatExport: function () {
|
||||
return '导出数据';
|
||||
},
|
||||
formatClearFilters: function () {
|
||||
return '清空过滤';
|
||||
}
|
||||
};
|
||||
|
||||
$.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['zh-CN']);
|
||||
|
||||
})(jQuery);
|
@ -0,0 +1 @@
|
||||
(function($){$.fn.bootstrapTable.locales["zh-CN"]={formatLoadingMessage:function(){return"正在努力地加载数据中,请稍候……"},formatRecordsPerPage:function(pageNumber){return pageNumber+" 条记录每页"},formatShowingRows:function(pageFrom,pageTo,totalRows){return"第 "+pageFrom+" 到 "+pageTo+" 条,共 "+totalRows+" 条记录。"},formatSearch:function(){return"搜索"},formatNoMatches:function(){return"没有找到匹配的记录"},formatPaginationSwitch:function(){return"隐藏/显示分页"},formatRefresh:function(){return"刷新"},formatToggle:function(){return"切换"},formatColumns:function(){return"列"},formatExport:function(){return"导出数据"},formatClearFilters:function(){return"清空过滤"}};$.extend($.fn.bootstrapTable.defaults,$.fn.bootstrapTable.locales["zh-CN"])})(jQuery);
|
@ -0,0 +1,127 @@
|
||||
@charset "utf-8";
|
||||
.container {
|
||||
margin: 10px auto 0 auto;
|
||||
position: relative;
|
||||
font-family: 微软雅黑;
|
||||
font-size: 12px;
|
||||
}
|
||||
.container p {
|
||||
line-height: 12px;
|
||||
line-height: 0px;
|
||||
height: 0px;
|
||||
margin: 10px;
|
||||
color: #bbb
|
||||
}
|
||||
.action {
|
||||
width: 400px;
|
||||
height: 30px;
|
||||
margin: 10px 0;
|
||||
}
|
||||
.cropped {
|
||||
position: absolute;
|
||||
left: 500px;
|
||||
top: 0;
|
||||
width: 200px;
|
||||
border: 1px #ddd solid;
|
||||
height: 450px;
|
||||
padding: 4px;
|
||||
box-shadow: 0px 0px 12px #ddd;
|
||||
text-align: center;
|
||||
}
|
||||
.imageBox {
|
||||
position: relative;
|
||||
height: 400px;
|
||||
width: 400px;
|
||||
border: 1px solid #aaa;
|
||||
background: #fff;
|
||||
overflow: hidden;
|
||||
background-repeat: no-repeat;
|
||||
cursor: move;
|
||||
box-shadow: 4px 4px 12px #B0B0B0;
|
||||
}
|
||||
.imageBox .thumbBox {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
width: 200px;
|
||||
height: 200px;
|
||||
margin-top: -100px;
|
||||
margin-left: -100px;
|
||||
box-sizing: border-box;
|
||||
border: 1px solid rgb(102, 102, 102);
|
||||
box-shadow: 0 0 0 1000px rgba(0, 0, 0, 0.5);
|
||||
background: none repeat scroll 0% 0% transparent;
|
||||
}
|
||||
.imageBox .spinner {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
text-align: center;
|
||||
line-height: 400px;
|
||||
background: rgba(0,0,0,0.7);
|
||||
}
|
||||
.Btnsty_peyton{ float: right;
|
||||
width: 46px;
|
||||
display: inline-block;
|
||||
margin-bottom: 10px;
|
||||
height: 37px;
|
||||
line-height: 37px;
|
||||
font-size: 14px;
|
||||
color: #FFFFFF;
|
||||
margin:0px 2px;
|
||||
background-color: #f38e81;
|
||||
border-radius: 3px;
|
||||
text-decoration: none;
|
||||
cursor: pointer;
|
||||
box-shadow: 0px 0px 5px #B0B0B0;
|
||||
border: 0px #fff solid;}
|
||||
/*选择文件上传*/
|
||||
.new-contentarea {
|
||||
width: 165px;
|
||||
overflow:hidden;
|
||||
margin: 0 auto;
|
||||
position:relative;float:left;
|
||||
}
|
||||
.new-contentarea label {
|
||||
width:100%;
|
||||
height:100%;
|
||||
display:block;
|
||||
}
|
||||
.new-contentarea input[type=file] {
|
||||
width:188px;
|
||||
height:60px;
|
||||
background:#333;
|
||||
margin: 0 auto;
|
||||
position:absolute;
|
||||
right:50%;
|
||||
margin-right:-94px;
|
||||
top:0;
|
||||
right/*\**/:0px\9;
|
||||
margin-right/*\**/:0px\9;
|
||||
width/*\**/:10px\9;
|
||||
opacity:0;
|
||||
filter:alpha(opacity=0);
|
||||
z-index:2;
|
||||
}
|
||||
a.upload-img{
|
||||
width:165px;
|
||||
display: inline-block;
|
||||
margin-bottom: 10px;
|
||||
height:37px;
|
||||
line-height: 37px;
|
||||
font-size: 14px;
|
||||
color: #FFFFFF;
|
||||
background-color: #f38e81;
|
||||
border-radius: 3px;
|
||||
text-decoration:none;
|
||||
cursor:pointer;
|
||||
border: 0px #fff solid;
|
||||
box-shadow: 0px 0px 5px #B0B0B0;
|
||||
}
|
||||
a.upload-img:hover{
|
||||
background-color: #ec7e70;
|
||||
}
|
||||
|
||||
.tc{text-align:center;}
|
@ -0,0 +1,136 @@
|
||||
"use strict";
|
||||
(function (factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
define(['jquery'], factory);
|
||||
} else {
|
||||
factory(jQuery);
|
||||
}
|
||||
}(function ($) {
|
||||
var cropbox = function(options, el){
|
||||
var el = el || $(options.imageBox),
|
||||
obj =
|
||||
{
|
||||
state : {},
|
||||
ratio : 1,
|
||||
options : options,
|
||||
imageBox : el,
|
||||
thumbBox : el.find(options.thumbBox),
|
||||
spinner : el.find(options.spinner),
|
||||
image : new Image(),
|
||||
getDataURL: function ()
|
||||
{
|
||||
var width = this.thumbBox.width(),
|
||||
height = this.thumbBox.height(),
|
||||
canvas = document.createElement("canvas"),
|
||||
dim = el.css('background-position').split(' '),
|
||||
size = el.css('background-size').split(' '),
|
||||
dx = parseInt(dim[0]) - el.width()/2 + width/2,
|
||||
dy = parseInt(dim[1]) - el.height()/2 + height/2,
|
||||
dw = parseInt(size[0]),
|
||||
dh = parseInt(size[1]),
|
||||
sh = parseInt(this.image.height),
|
||||
sw = parseInt(this.image.width);
|
||||
|
||||
canvas.width = width;
|
||||
canvas.height = height;
|
||||
var context = canvas.getContext("2d");
|
||||
context.drawImage(this.image, 0, 0, sw, sh, dx, dy, dw, dh);
|
||||
var imageData = canvas.toDataURL('image/png');
|
||||
return imageData;
|
||||
},
|
||||
getBlob: function()
|
||||
{
|
||||
var imageData = this.getDataURL();
|
||||
var b64 = imageData.replace('data:image/png;base64,','');
|
||||
var binary = atob(b64);
|
||||
var array = [];
|
||||
for (var i = 0; i < binary.length; i++) {
|
||||
array.push(binary.charCodeAt(i));
|
||||
}
|
||||
return new Blob([new Uint8Array(array)], {type: 'image/png'});
|
||||
},
|
||||
zoomIn: function ()
|
||||
{
|
||||
this.ratio*=1.1;
|
||||
setBackground();
|
||||
},
|
||||
zoomOut: function ()
|
||||
{
|
||||
this.ratio*=0.9;
|
||||
setBackground();
|
||||
}
|
||||
},
|
||||
setBackground = function()
|
||||
{
|
||||
var w = parseInt(obj.image.width)*obj.ratio;
|
||||
var h = parseInt(obj.image.height)*obj.ratio;
|
||||
|
||||
var pw = (el.width() - w) / 2;
|
||||
var ph = (el.height() - h) / 2;
|
||||
|
||||
el.css({
|
||||
'background-image': 'url(' + obj.image.src + ')',
|
||||
'background-size': w +'px ' + h + 'px',
|
||||
'background-position': pw + 'px ' + ph + 'px',
|
||||
'background-repeat': 'no-repeat'});
|
||||
},
|
||||
imgMouseDown = function(e)
|
||||
{
|
||||
e.stopImmediatePropagation();
|
||||
|
||||
obj.state.dragable = true;
|
||||
obj.state.mouseX = e.clientX;
|
||||
obj.state.mouseY = e.clientY;
|
||||
},
|
||||
imgMouseMove = function(e)
|
||||
{
|
||||
e.stopImmediatePropagation();
|
||||
|
||||
if (obj.state.dragable)
|
||||
{
|
||||
var x = e.clientX - obj.state.mouseX;
|
||||
var y = e.clientY - obj.state.mouseY;
|
||||
|
||||
var bg = el.css('background-position').split(' ');
|
||||
|
||||
var bgX = x + parseInt(bg[0]);
|
||||
var bgY = y + parseInt(bg[1]);
|
||||
|
||||
el.css('background-position', bgX +'px ' + bgY + 'px');
|
||||
|
||||
obj.state.mouseX = e.clientX;
|
||||
obj.state.mouseY = e.clientY;
|
||||
}
|
||||
},
|
||||
imgMouseUp = function(e)
|
||||
{
|
||||
e.stopImmediatePropagation();
|
||||
obj.state.dragable = false;
|
||||
},
|
||||
zoomImage = function(e)
|
||||
{
|
||||
e.originalEvent.wheelDelta > 0 || e.originalEvent.detail < 0 ? obj.ratio*=1.1 : obj.ratio*=0.9;
|
||||
setBackground();
|
||||
}
|
||||
|
||||
obj.spinner.show();
|
||||
obj.image.onload = function() {
|
||||
obj.spinner.hide();
|
||||
setBackground();
|
||||
|
||||
el.bind('mousedown', imgMouseDown);
|
||||
el.bind('mousemove', imgMouseMove);
|
||||
$(window).bind('mouseup', imgMouseUp);
|
||||
el.bind('mousewheel DOMMouseScroll', zoomImage);
|
||||
};
|
||||
obj.image.crossOrigin = 'Anonymous';
|
||||
obj.image.src = options.imgSrc;
|
||||
el.on('remove', function(){$(window).unbind('mouseup', imgMouseUp)});
|
||||
|
||||
return obj;
|
||||
};
|
||||
|
||||
jQuery.fn.cropbox = function(options){
|
||||
return new cropbox(options, this);
|
||||
};
|
||||
}));
|
@ -0,0 +1,418 @@
|
||||
/*!
|
||||
* Datetimepicker for Bootstrap
|
||||
*
|
||||
* Copyright 2012 Stefan Petre
|
||||
* Improvements by Andrew Rowls
|
||||
* Licensed under the Apache License v2.0
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*/
|
||||
.datetimepicker {
|
||||
padding: 4px;
|
||||
margin-top: 1px;
|
||||
-webkit-border-radius: 4px;
|
||||
-moz-border-radius: 4px;
|
||||
border-radius: 4px;
|
||||
direction: ltr;
|
||||
}
|
||||
|
||||
.datetimepicker-inline {
|
||||
width: 220px;
|
||||
}
|
||||
|
||||
.datetimepicker.datetimepicker-rtl {
|
||||
direction: rtl;
|
||||
}
|
||||
|
||||
.datetimepicker.datetimepicker-rtl table tr td span {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.datetimepicker-dropdown, .datetimepicker-dropdown-left {
|
||||
top: 0;
|
||||
left: 0;
|
||||
}
|
||||
|
||||
[class*=" datetimepicker-dropdown"]:before {
|
||||
content: '';
|
||||
display: inline-block;
|
||||
border-left: 7px solid transparent;
|
||||
border-right: 7px solid transparent;
|
||||
border-bottom: 7px solid #cccccc;
|
||||
border-bottom-color: rgba(0, 0, 0, 0.2);
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
[class*=" datetimepicker-dropdown"]:after {
|
||||
content: '';
|
||||
display: inline-block;
|
||||
border-left: 6px solid transparent;
|
||||
border-right: 6px solid transparent;
|
||||
border-bottom: 6px solid #ffffff;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
[class*=" datetimepicker-dropdown-top"]:before {
|
||||
content: '';
|
||||
display: inline-block;
|
||||
border-left: 7px solid transparent;
|
||||
border-right: 7px solid transparent;
|
||||
border-top: 7px solid #cccccc;
|
||||
border-top-color: rgba(0, 0, 0, 0.2);
|
||||
border-bottom: 0;
|
||||
}
|
||||
|
||||
[class*=" datetimepicker-dropdown-top"]:after {
|
||||
content: '';
|
||||
display: inline-block;
|
||||
border-left: 6px solid transparent;
|
||||
border-right: 6px solid transparent;
|
||||
border-top: 6px solid #ffffff;
|
||||
border-bottom: 0;
|
||||
}
|
||||
|
||||
.datetimepicker-dropdown-bottom-left:before {
|
||||
top: -7px;
|
||||
right: 6px;
|
||||
}
|
||||
|
||||
.datetimepicker-dropdown-bottom-left:after {
|
||||
top: -6px;
|
||||
right: 7px;
|
||||
}
|
||||
|
||||
.datetimepicker-dropdown-bottom-right:before {
|
||||
top: -7px;
|
||||
left: 6px;
|
||||
}
|
||||
|
||||
.datetimepicker-dropdown-bottom-right:after {
|
||||
top: -6px;
|
||||
left: 7px;
|
||||
}
|
||||
|
||||
.datetimepicker-dropdown-top-left:before {
|
||||
bottom: -7px;
|
||||
right: 6px;
|
||||
}
|
||||
|
||||
.datetimepicker-dropdown-top-left:after {
|
||||
bottom: -6px;
|
||||
right: 7px;
|
||||
}
|
||||
|
||||
.datetimepicker-dropdown-top-right:before {
|
||||
bottom: -7px;
|
||||
left: 6px;
|
||||
}
|
||||
|
||||
.datetimepicker-dropdown-top-right:after {
|
||||
bottom: -6px;
|
||||
left: 7px;
|
||||
}
|
||||
|
||||
.datetimepicker > div {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.datetimepicker.minutes div.datetimepicker-minutes {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.datetimepicker.hours div.datetimepicker-hours {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.datetimepicker.days div.datetimepicker-days {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.datetimepicker.months div.datetimepicker-months {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.datetimepicker.years div.datetimepicker-years {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.datetimepicker table {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.datetimepicker td,
|
||||
.datetimepicker th {
|
||||
text-align: center;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
-webkit-border-radius: 4px;
|
||||
-moz-border-radius: 4px;
|
||||
border-radius: 4px;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.table-striped .datetimepicker table tr td,
|
||||
.table-striped .datetimepicker table tr th {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.datetimepicker table tr td.minute:hover {
|
||||
background: #eeeeee;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.datetimepicker table tr td.hour:hover {
|
||||
background: #eeeeee;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.datetimepicker table tr td.day:hover {
|
||||
background: #eeeeee;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.datetimepicker table tr td.old,
|
||||
.datetimepicker table tr td.new {
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
.datetimepicker table tr td.disabled,
|
||||
.datetimepicker table tr td.disabled:hover {
|
||||
background: none;
|
||||
color: #999999;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.datetimepicker table tr td.today,
|
||||
.datetimepicker table tr td.today:hover,
|
||||
.datetimepicker table tr td.today.disabled,
|
||||
.datetimepicker table tr td.today.disabled:hover {
|
||||
background-color: #fde19a;
|
||||
background-image: -moz-linear-gradient(top, #fdd49a, #fdf59a);
|
||||
background-image: -ms-linear-gradient(top, #fdd49a, #fdf59a);
|
||||
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#fdd49a), to(#fdf59a));
|
||||
background-image: -webkit-linear-gradient(top, #fdd49a, #fdf59a);
|
||||
background-image: -o-linear-gradient(top, #fdd49a, #fdf59a);
|
||||
background-image: linear-gradient(to bottom, #fdd49a, #fdf59a);
|
||||
background-repeat: repeat-x;
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fdd49a', endColorstr='#fdf59a', GradientType=0);
|
||||
border-color: #fdf59a #fdf59a #fbed50;
|
||||
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
|
||||
}
|
||||
|
||||
.datetimepicker table tr td.today:hover,
|
||||
.datetimepicker table tr td.today:hover:hover,
|
||||
.datetimepicker table tr td.today.disabled:hover,
|
||||
.datetimepicker table tr td.today.disabled:hover:hover,
|
||||
.datetimepicker table tr td.today:active,
|
||||
.datetimepicker table tr td.today:hover:active,
|
||||
.datetimepicker table tr td.today.disabled:active,
|
||||
.datetimepicker table tr td.today.disabled:hover:active,
|
||||
.datetimepicker table tr td.today.active,
|
||||
.datetimepicker table tr td.today:hover.active,
|
||||
.datetimepicker table tr td.today.disabled.active,
|
||||
.datetimepicker table tr td.today.disabled:hover.active,
|
||||
.datetimepicker table tr td.today.disabled,
|
||||
.datetimepicker table tr td.today:hover.disabled,
|
||||
.datetimepicker table tr td.today.disabled.disabled,
|
||||
.datetimepicker table tr td.today.disabled:hover.disabled,
|
||||
.datetimepicker table tr td.today[disabled],
|
||||
.datetimepicker table tr td.today:hover[disabled],
|
||||
.datetimepicker table tr td.today.disabled[disabled],
|
||||
.datetimepicker table tr td.today.disabled:hover[disabled] {
|
||||
background-color: #fdf59a;
|
||||
}
|
||||
|
||||
.datetimepicker table tr td.today:active,
|
||||
.datetimepicker table tr td.today:hover:active,
|
||||
.datetimepicker table tr td.today.disabled:active,
|
||||
.datetimepicker table tr td.today.disabled:hover:active,
|
||||
.datetimepicker table tr td.today.active,
|
||||
.datetimepicker table tr td.today:hover.active,
|
||||
.datetimepicker table tr td.today.disabled.active,
|
||||
.datetimepicker table tr td.today.disabled:hover.active {
|
||||
background-color: #fbf069;
|
||||
}
|
||||
|
||||
.datetimepicker table tr td.active,
|
||||
.datetimepicker table tr td.active:hover,
|
||||
.datetimepicker table tr td.active.disabled,
|
||||
.datetimepicker table tr td.active.disabled:hover {
|
||||
background-color: #006dcc;
|
||||
background-image: -moz-linear-gradient(top, #0088cc, #0044cc);
|
||||
background-image: -ms-linear-gradient(top, #0088cc, #0044cc);
|
||||
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc));
|
||||
background-image: -webkit-linear-gradient(top, #0088cc, #0044cc);
|
||||
background-image: -o-linear-gradient(top, #0088cc, #0044cc);
|
||||
background-image: linear-gradient(to bottom, #0088cc, #0044cc);
|
||||
background-repeat: repeat-x;
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0088cc', endColorstr='#0044cc', GradientType=0);
|
||||
border-color: #0044cc #0044cc #002a80;
|
||||
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
|
||||
color: #ffffff;
|
||||
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
|
||||
}
|
||||
|
||||
.datetimepicker table tr td.active:hover,
|
||||
.datetimepicker table tr td.active:hover:hover,
|
||||
.datetimepicker table tr td.active.disabled:hover,
|
||||
.datetimepicker table tr td.active.disabled:hover:hover,
|
||||
.datetimepicker table tr td.active:active,
|
||||
.datetimepicker table tr td.active:hover:active,
|
||||
.datetimepicker table tr td.active.disabled:active,
|
||||
.datetimepicker table tr td.active.disabled:hover:active,
|
||||
.datetimepicker table tr td.active.active,
|
||||
.datetimepicker table tr td.active:hover.active,
|
||||
.datetimepicker table tr td.active.disabled.active,
|
||||
.datetimepicker table tr td.active.disabled:hover.active,
|
||||
.datetimepicker table tr td.active.disabled,
|
||||
.datetimepicker table tr td.active:hover.disabled,
|
||||
.datetimepicker table tr td.active.disabled.disabled,
|
||||
.datetimepicker table tr td.active.disabled:hover.disabled,
|
||||
.datetimepicker table tr td.active[disabled],
|
||||
.datetimepicker table tr td.active:hover[disabled],
|
||||
.datetimepicker table tr td.active.disabled[disabled],
|
||||
.datetimepicker table tr td.active.disabled:hover[disabled] {
|
||||
background-color: #0044cc;
|
||||
}
|
||||
|
||||
.datetimepicker table tr td.active:active,
|
||||
.datetimepicker table tr td.active:hover:active,
|
||||
.datetimepicker table tr td.active.disabled:active,
|
||||
.datetimepicker table tr td.active.disabled:hover:active,
|
||||
.datetimepicker table tr td.active.active,
|
||||
.datetimepicker table tr td.active:hover.active,
|
||||
.datetimepicker table tr td.active.disabled.active,
|
||||
.datetimepicker table tr td.active.disabled:hover.active {
|
||||
background-color: #003399;
|
||||
}
|
||||
|
||||
.datetimepicker table tr td span {
|
||||
display: block;
|
||||
width: 23%;
|
||||
height: 54px;
|
||||
line-height: 54px;
|
||||
float: left;
|
||||
margin: 1%;
|
||||
cursor: pointer;
|
||||
-webkit-border-radius: 4px;
|
||||
-moz-border-radius: 4px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.datetimepicker .datetimepicker-hours span {
|
||||
height: 26px;
|
||||
line-height: 26px;
|
||||
}
|
||||
|
||||
.datetimepicker .datetimepicker-hours table tr td span.hour_am,
|
||||
.datetimepicker .datetimepicker-hours table tr td span.hour_pm {
|
||||
width: 14.6%;
|
||||
}
|
||||
|
||||
.datetimepicker .datetimepicker-hours fieldset legend,
|
||||
.datetimepicker .datetimepicker-minutes fieldset legend {
|
||||
margin-bottom: inherit;
|
||||
line-height: 30px;
|
||||
}
|
||||
|
||||
.datetimepicker .datetimepicker-minutes span {
|
||||
height: 26px;
|
||||
line-height: 26px;
|
||||
}
|
||||
|
||||
.datetimepicker table tr td span:hover {
|
||||
background: #eeeeee;
|
||||
}
|
||||
|
||||
.datetimepicker table tr td span.disabled,
|
||||
.datetimepicker table tr td span.disabled:hover {
|
||||
background: none;
|
||||
color: #999999;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.datetimepicker table tr td span.active,
|
||||
.datetimepicker table tr td span.active:hover,
|
||||
.datetimepicker table tr td span.active.disabled,
|
||||
.datetimepicker table tr td span.active.disabled:hover {
|
||||
background-color: #006dcc;
|
||||
background-image: -moz-linear-gradient(top, #0088cc, #0044cc);
|
||||
background-image: -ms-linear-gradient(top, #0088cc, #0044cc);
|
||||
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc));
|
||||
background-image: -webkit-linear-gradient(top, #0088cc, #0044cc);
|
||||
background-image: -o-linear-gradient(top, #0088cc, #0044cc);
|
||||
background-image: linear-gradient(to bottom, #0088cc, #0044cc);
|
||||
background-repeat: repeat-x;
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0088cc', endColorstr='#0044cc', GradientType=0);
|
||||
border-color: #0044cc #0044cc #002a80;
|
||||
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
|
||||
color: #ffffff;
|
||||
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
|
||||
}
|
||||
|
||||
.datetimepicker table tr td span.active:hover,
|
||||
.datetimepicker table tr td span.active:hover:hover,
|
||||
.datetimepicker table tr td span.active.disabled:hover,
|
||||
.datetimepicker table tr td span.active.disabled:hover:hover,
|
||||
.datetimepicker table tr td span.active:active,
|
||||
.datetimepicker table tr td span.active:hover:active,
|
||||
.datetimepicker table tr td span.active.disabled:active,
|
||||
.datetimepicker table tr td span.active.disabled:hover:active,
|
||||
.datetimepicker table tr td span.active.active,
|
||||
.datetimepicker table tr td span.active:hover.active,
|
||||
.datetimepicker table tr td span.active.disabled.active,
|
||||
.datetimepicker table tr td span.active.disabled:hover.active,
|
||||
.datetimepicker table tr td span.active.disabled,
|
||||
.datetimepicker table tr td span.active:hover.disabled,
|
||||
.datetimepicker table tr td span.active.disabled.disabled,
|
||||
.datetimepicker table tr td span.active.disabled:hover.disabled,
|
||||
.datetimepicker table tr td span.active[disabled],
|
||||
.datetimepicker table tr td span.active:hover[disabled],
|
||||
.datetimepicker table tr td span.active.disabled[disabled],
|
||||
.datetimepicker table tr td span.active.disabled:hover[disabled] {
|
||||
background-color: #0044cc;
|
||||
}
|
||||
|
||||
.datetimepicker table tr td span.active:active,
|
||||
.datetimepicker table tr td span.active:hover:active,
|
||||
.datetimepicker table tr td span.active.disabled:active,
|
||||
.datetimepicker table tr td span.active.disabled:hover:active,
|
||||
.datetimepicker table tr td span.active.active,
|
||||
.datetimepicker table tr td span.active:hover.active,
|
||||
.datetimepicker table tr td span.active.disabled.active,
|
||||
.datetimepicker table tr td span.active.disabled:hover.active {
|
||||
background-color: #003399;
|
||||
}
|
||||
|
||||
.datetimepicker table tr td span.old {
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
.datetimepicker th.switch {
|
||||
width: 145px;
|
||||
}
|
||||
|
||||
.datetimepicker th span.glyphicon {
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.datetimepicker thead tr:first-child th,
|
||||
.datetimepicker tfoot th {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.datetimepicker thead tr:first-child th:hover,
|
||||
.datetimepicker tfoot th:hover {
|
||||
background: #eeeeee;
|
||||
}
|
||||
|
||||
.input-append.date .add-on i,
|
||||
.input-prepend.date .add-on i,
|
||||
.input-group.date .input-group-addon span {
|
||||
cursor: pointer;
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
}
|
@ -0,0 +1,86 @@
|
||||
/*
|
||||
* Bootstrap Duallistbox - v3.0.7
|
||||
* A responsive dual listbox widget optimized for Twitter Bootstrap. It works on all modern browsers and on touch devices.
|
||||
* https://www.virtuosoft.eu/code/bootstrap-duallistbox/
|
||||
*
|
||||
* Made by István Ujj-Mészáros
|
||||
* Under Apache License v2.0 License
|
||||
*/
|
||||
.bootstrap-duallistbox-container .buttons {
|
||||
width: 100%;
|
||||
margin-bottom: -1px;
|
||||
}
|
||||
|
||||
.bootstrap-duallistbox-container label {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.bootstrap-duallistbox-container .info {
|
||||
display: inline-block;
|
||||
margin-bottom: 5px;
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
.bootstrap-duallistbox-container .clear1,
|
||||
.bootstrap-duallistbox-container .clear2 {
|
||||
display: none;
|
||||
font-size: 10px;
|
||||
}
|
||||
|
||||
.bootstrap-duallistbox-container .box1.filtered .clear1,
|
||||
.bootstrap-duallistbox-container .box2.filtered .clear2 {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.bootstrap-duallistbox-container .move,
|
||||
.bootstrap-duallistbox-container .remove {
|
||||
width: 60%;
|
||||
}
|
||||
|
||||
.bootstrap-duallistbox-container .btn-group .btn {
|
||||
border-bottom-left-radius: 0;
|
||||
border-bottom-right-radius: 0;
|
||||
}
|
||||
.bootstrap-duallistbox-container select {
|
||||
border-top-left-radius: 0;
|
||||
border-top-right-radius: 0;
|
||||
}
|
||||
|
||||
.bootstrap-duallistbox-container .moveall,
|
||||
.bootstrap-duallistbox-container .removeall {
|
||||
width: 40%;
|
||||
}
|
||||
|
||||
.bootstrap-duallistbox-container.bs2compatible .btn-group > .btn + .btn {
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
.bootstrap-duallistbox-container select {
|
||||
width: 100%;
|
||||
height: 300px;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.bootstrap-duallistbox-container .filter {
|
||||
display: inline-block;
|
||||
width: 100%;
|
||||
height: 31px;
|
||||
margin: 0 0 5px 0;
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.bootstrap-duallistbox-container .filter.placeholder {
|
||||
color: #aaa;
|
||||
}
|
||||
|
||||
.bootstrap-duallistbox-container.moveonselect .move,
|
||||
.bootstrap-duallistbox-container.moveonselect .remove {
|
||||
display:none;
|
||||
}
|
||||
|
||||
.bootstrap-duallistbox-container.moveonselect .moveall,
|
||||
.bootstrap-duallistbox-container.moveonselect .removeall {
|
||||
width: 100%;
|
||||
}
|
@ -0,0 +1,841 @@
|
||||
/*
|
||||
* Bootstrap Duallistbox - v3.0.7
|
||||
* A responsive dual listbox widget optimized for Twitter Bootstrap. It works on all modern browsers and on touch devices.
|
||||
* https://www.virtuosoft.eu/code/bootstrap-duallistbox/
|
||||
*
|
||||
* Made by István Ujj-Mészáros
|
||||
* Under Apache License v2.0 License
|
||||
*/
|
||||
;(function ($, window, document, undefined) {
|
||||
// Create the defaults once
|
||||
var pluginName = 'bootstrapDualListbox',
|
||||
defaults = {
|
||||
bootstrap2Compatible: false,
|
||||
filterTextClear: 'show all',
|
||||
filterPlaceHolder: 'Filter',
|
||||
moveSelectedLabel: 'Move selected',
|
||||
moveAllLabel: 'Move all',
|
||||
removeSelectedLabel: 'Remove selected',
|
||||
removeAllLabel: 'Remove all',
|
||||
moveOnSelect: true, // true/false (forced true on androids, see the comment later)
|
||||
moveOnDoubleClick: true, // true/false (forced false on androids, cause moveOnSelect is forced to true)
|
||||
preserveSelectionOnMove: false, // 'all' / 'moved' / false
|
||||
selectedListLabel: false, // 'string', false
|
||||
nonSelectedListLabel: false, // 'string', false
|
||||
helperSelectNamePostfix: '_helper', // 'string_of_postfix' / false
|
||||
selectorMinimalHeight: 100,
|
||||
showFilterInputs: true, // whether to show filter inputs
|
||||
nonSelectedFilter: '', // string, filter the non selected options
|
||||
selectedFilter: '', // string, filter the selected options
|
||||
infoText: 'Showing all {0}', // text when all options are visible / false for no info text
|
||||
infoTextFiltered: '<span class="label label-warning">Filtered</span> {0} from {1}', // when not all of the options are visible due to the filter
|
||||
infoTextEmpty: 'Empty list', // when there are no options present in the list
|
||||
filterOnValues: false, // filter by selector's values, boolean
|
||||
sortByInputOrder: false,
|
||||
eventMoveOverride: false, // boolean, allows user to unbind default event behaviour and run their own instead
|
||||
eventMoveAllOverride: false, // boolean, allows user to unbind default event behaviour and run their own instead
|
||||
eventRemoveOverride: false, // boolean, allows user to unbind default event behaviour and run their own instead
|
||||
eventRemoveAllOverride: false // boolean, allows user to unbind default event behaviour and run their own instead
|
||||
},
|
||||
// Selections are invisible on android if the containing select is styled with CSS
|
||||
// http://code.google.com/p/android/issues/detail?id=16922
|
||||
isBuggyAndroid = /android/i.test(navigator.userAgent.toLowerCase());
|
||||
|
||||
// The actual plugin constructor
|
||||
function BootstrapDualListbox(element, options) {
|
||||
this.element = $(element);
|
||||
// jQuery has an extend method which merges the contents of two or
|
||||
// more objects, storing the result in the first object. The first object
|
||||
// is generally empty as we don't want to alter the default options for
|
||||
// future instances of the plugin
|
||||
this.settings = $.extend({}, defaults, options);
|
||||
this._defaults = defaults;
|
||||
this._name = pluginName;
|
||||
this.init();
|
||||
}
|
||||
|
||||
function triggerChangeEvent(dualListbox) {
|
||||
dualListbox.element.trigger('change');
|
||||
}
|
||||
|
||||
function updateSelectionStates(dualListbox) {
|
||||
dualListbox.element.find('option').each(function(index, item) {
|
||||
var $item = $(item);
|
||||
if (typeof($item.data('original-index')) === 'undefined') {
|
||||
$item.data('original-index', dualListbox.elementCount++);
|
||||
}
|
||||
if (typeof($item.data('_selected')) === 'undefined') {
|
||||
$item.data('_selected', false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function changeSelectionState(dualListbox, original_index, selected) {
|
||||
dualListbox.element.find('option').each(function(index, item) {
|
||||
var $item = $(item);
|
||||
if ($item.data('original-index') === original_index) {
|
||||
$item.prop('selected', selected);
|
||||
if(selected){
|
||||
$item.attr('data-sortindex', dualListbox.sortIndex);
|
||||
dualListbox.sortIndex++;
|
||||
} else {
|
||||
$item.removeAttr('data-sortindex');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function formatString(s, args) {
|
||||
return s.replace(/\{(\d+)\}/g, function(match, number) {
|
||||
return typeof args[number] !== 'undefined' ? args[number] : match;
|
||||
});
|
||||
}
|
||||
|
||||
function refreshInfo(dualListbox) {
|
||||
if (!dualListbox.settings.infoText) {
|
||||
return;
|
||||
}
|
||||
|
||||
var visible1 = dualListbox.elements.select1.find('option').length,
|
||||
visible2 = dualListbox.elements.select2.find('option').length,
|
||||
all1 = dualListbox.element.find('option').length - dualListbox.selectedElements,
|
||||
all2 = dualListbox.selectedElements,
|
||||
content = '';
|
||||
|
||||
if (all1 === 0) {
|
||||
content = dualListbox.settings.infoTextEmpty;
|
||||
} else if (visible1 === all1) {
|
||||
content = formatString(dualListbox.settings.infoText, [visible1, all1]);
|
||||
} else {
|
||||
content = formatString(dualListbox.settings.infoTextFiltered, [visible1, all1]);
|
||||
}
|
||||
|
||||
dualListbox.elements.info1.html(content);
|
||||
dualListbox.elements.box1.toggleClass('filtered', !(visible1 === all1 || all1 === 0));
|
||||
|
||||
if (all2 === 0) {
|
||||
content = dualListbox.settings.infoTextEmpty;
|
||||
} else if (visible2 === all2) {
|
||||
content = formatString(dualListbox.settings.infoText, [visible2, all2]);
|
||||
} else {
|
||||
content = formatString(dualListbox.settings.infoTextFiltered, [visible2, all2]);
|
||||
}
|
||||
|
||||
dualListbox.elements.info2.html(content);
|
||||
dualListbox.elements.box2.toggleClass('filtered', !(visible2 === all2 || all2 === 0));
|
||||
}
|
||||
|
||||
function refreshSelects(dualListbox) {
|
||||
dualListbox.selectedElements = 0;
|
||||
|
||||
dualListbox.elements.select1.empty();
|
||||
dualListbox.elements.select2.empty();
|
||||
|
||||
dualListbox.element.find('option').each(function(index, item) {
|
||||
var $item = $(item);
|
||||
if ($item.prop('selected')) {
|
||||
dualListbox.selectedElements++;
|
||||
dualListbox.elements.select2.append($item.clone(true).prop('selected', $item.data('_selected')));
|
||||
} else {
|
||||
dualListbox.elements.select1.append($item.clone(true).prop('selected', $item.data('_selected')));
|
||||
}
|
||||
});
|
||||
|
||||
if (dualListbox.settings.showFilterInputs) {
|
||||
filter(dualListbox, 1);
|
||||
filter(dualListbox, 2);
|
||||
}
|
||||
refreshInfo(dualListbox);
|
||||
}
|
||||
|
||||
function filter(dualListbox, selectIndex) {
|
||||
if (!dualListbox.settings.showFilterInputs) {
|
||||
return;
|
||||
}
|
||||
|
||||
saveSelections(dualListbox, selectIndex);
|
||||
|
||||
dualListbox.elements['select'+selectIndex].empty().scrollTop(0);
|
||||
var regex = new RegExp($.trim(dualListbox.elements['filterInput'+selectIndex].val()), 'gi'),
|
||||
allOptions = dualListbox.element.find('option'),
|
||||
options = dualListbox.element;
|
||||
|
||||
if (selectIndex === 1) {
|
||||
options = allOptions.not(':selected');
|
||||
} else {
|
||||
options = options.find('option:selected');
|
||||
}
|
||||
|
||||
options.each(function(index, item) {
|
||||
var $item = $(item),
|
||||
isFiltered = true;
|
||||
if (item.text.match(regex) || (dualListbox.settings.filterOnValues && $item.attr('value').match(regex) ) ) {
|
||||
isFiltered = false;
|
||||
dualListbox.elements['select'+selectIndex].append($item.clone(true).prop('selected', $item.data('_selected')));
|
||||
}
|
||||
allOptions.eq($item.data('original-index')).data('filtered'+selectIndex, isFiltered);
|
||||
});
|
||||
|
||||
refreshInfo(dualListbox);
|
||||
}
|
||||
|
||||
function saveSelections(dualListbox, selectIndex) {
|
||||
var options = dualListbox.element.find('option');
|
||||
dualListbox.elements['select'+selectIndex].find('option').each(function(index, item) {
|
||||
var $item = $(item);
|
||||
options.eq($item.data('original-index')).data('_selected', $item.prop('selected'));
|
||||
});
|
||||
}
|
||||
|
||||
function sortOptionsByInputOrder(select){
|
||||
var selectopt = select.children('option');
|
||||
|
||||
selectopt.sort(function(a,b){
|
||||
var an = parseInt(a.getAttribute('data-sortindex')),
|
||||
bn = parseInt(b.getAttribute('data-sortindex'));
|
||||
|
||||
if(an > bn) {
|
||||
return 1;
|
||||
}
|
||||
if(an < bn) {
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
});
|
||||
|
||||
selectopt.detach().appendTo(select);
|
||||
}
|
||||
|
||||
function sortOptions(select) {
|
||||
select.find('option').sort(function(a, b) {
|
||||
return ($(a).data('original-index') > $(b).data('original-index')) ? 1 : -1;
|
||||
}).appendTo(select);
|
||||
}
|
||||
|
||||
function clearSelections(dualListbox) {
|
||||
dualListbox.elements.select1.find('option').each(function() {
|
||||
dualListbox.element.find('option').data('_selected', false);
|
||||
});
|
||||
}
|
||||
|
||||
function move(dualListbox) {
|
||||
if (dualListbox.settings.preserveSelectionOnMove === 'all' && !dualListbox.settings.moveOnSelect) {
|
||||
saveSelections(dualListbox, 1);
|
||||
saveSelections(dualListbox, 2);
|
||||
} else if (dualListbox.settings.preserveSelectionOnMove === 'moved' && !dualListbox.settings.moveOnSelect) {
|
||||
saveSelections(dualListbox, 1);
|
||||
}
|
||||
|
||||
dualListbox.elements.select1.find('option:selected').each(function(index, item) {
|
||||
var $item = $(item);
|
||||
if (!$item.data('filtered1')) {
|
||||
changeSelectionState(dualListbox, $item.data('original-index'), true);
|
||||
}
|
||||
});
|
||||
|
||||
refreshSelects(dualListbox);
|
||||
triggerChangeEvent(dualListbox);
|
||||
if(dualListbox.settings.sortByInputOrder){
|
||||
sortOptionsByInputOrder(dualListbox.elements.select2);
|
||||
} else {
|
||||
sortOptions(dualListbox.elements.select2);
|
||||
}
|
||||
}
|
||||
|
||||
function remove(dualListbox) {
|
||||
if (dualListbox.settings.preserveSelectionOnMove === 'all' && !dualListbox.settings.moveOnSelect) {
|
||||
saveSelections(dualListbox, 1);
|
||||
saveSelections(dualListbox, 2);
|
||||
} else if (dualListbox.settings.preserveSelectionOnMove === 'moved' && !dualListbox.settings.moveOnSelect) {
|
||||
saveSelections(dualListbox, 2);
|
||||
}
|
||||
|
||||
dualListbox.elements.select2.find('option:selected').each(function(index, item) {
|
||||
var $item = $(item);
|
||||
if (!$item.data('filtered2')) {
|
||||
changeSelectionState(dualListbox, $item.data('original-index'), false);
|
||||
}
|
||||
});
|
||||
|
||||
refreshSelects(dualListbox);
|
||||
triggerChangeEvent(dualListbox);
|
||||
sortOptions(dualListbox.elements.select1);
|
||||
if(dualListbox.settings.sortByInputOrder){
|
||||
sortOptionsByInputOrder(dualListbox.elements.select2);
|
||||
}
|
||||
}
|
||||
|
||||
function moveAll(dualListbox) {
|
||||
if (dualListbox.settings.preserveSelectionOnMove === 'all' && !dualListbox.settings.moveOnSelect) {
|
||||
saveSelections(dualListbox, 1);
|
||||
saveSelections(dualListbox, 2);
|
||||
} else if (dualListbox.settings.preserveSelectionOnMove === 'moved' && !dualListbox.settings.moveOnSelect) {
|
||||
saveSelections(dualListbox, 1);
|
||||
}
|
||||
|
||||
dualListbox.element.find('option').each(function(index, item) {
|
||||
var $item = $(item);
|
||||
if (!$item.data('filtered1')) {
|
||||
$item.prop('selected', true);
|
||||
$item.attr('data-sortindex', dualListbox.sortIndex);
|
||||
dualListbox.sortIndex++;
|
||||
}
|
||||
});
|
||||
|
||||
refreshSelects(dualListbox);
|
||||
triggerChangeEvent(dualListbox);
|
||||
}
|
||||
|
||||
function removeAll(dualListbox) {
|
||||
if (dualListbox.settings.preserveSelectionOnMove === 'all' && !dualListbox.settings.moveOnSelect) {
|
||||
saveSelections(dualListbox, 1);
|
||||
saveSelections(dualListbox, 2);
|
||||
} else if (dualListbox.settings.preserveSelectionOnMove === 'moved' && !dualListbox.settings.moveOnSelect) {
|
||||
saveSelections(dualListbox, 2);
|
||||
}
|
||||
|
||||
dualListbox.element.find('option').each(function(index, item) {
|
||||
var $item = $(item);
|
||||
if (!$item.data('filtered2')) {
|
||||
$item.prop('selected', false);
|
||||
$item.removeAttr('data-sortindex');
|
||||
}
|
||||
});
|
||||
|
||||
refreshSelects(dualListbox);
|
||||
triggerChangeEvent(dualListbox);
|
||||
}
|
||||
|
||||
function bindEvents(dualListbox) {
|
||||
dualListbox.elements.form.submit(function(e) {
|
||||
if (dualListbox.elements.filterInput1.is(':focus')) {
|
||||
e.preventDefault();
|
||||
dualListbox.elements.filterInput1.focusout();
|
||||
} else if (dualListbox.elements.filterInput2.is(':focus')) {
|
||||
e.preventDefault();
|
||||
dualListbox.elements.filterInput2.focusout();
|
||||
}
|
||||
});
|
||||
|
||||
dualListbox.element.on('bootstrapDualListbox.refresh', function(e, mustClearSelections){
|
||||
dualListbox.refresh(mustClearSelections);
|
||||
});
|
||||
|
||||
dualListbox.elements.filterClear1.on('click', function() {
|
||||
dualListbox.setNonSelectedFilter('', true);
|
||||
});
|
||||
|
||||
dualListbox.elements.filterClear2.on('click', function() {
|
||||
dualListbox.setSelectedFilter('', true);
|
||||
});
|
||||
|
||||
if (dualListbox.settings.eventMoveOverride === false) {
|
||||
dualListbox.elements.moveButton.on('click', function() {
|
||||
move(dualListbox);
|
||||
});
|
||||
}
|
||||
|
||||
if (dualListbox.settings.eventMoveAllOverride === false) {
|
||||
dualListbox.elements.moveAllButton.on('click', function() {
|
||||
moveAll(dualListbox);
|
||||
});
|
||||
}
|
||||
|
||||
if (dualListbox.settings.eventRemoveOverride === false) {
|
||||
dualListbox.elements.removeButton.on('click', function() {
|
||||
remove(dualListbox);
|
||||
});
|
||||
}
|
||||
|
||||
if (dualListbox.settings.eventRemoveAllOverride === false) {
|
||||
dualListbox.elements.removeAllButton.on('click', function() {
|
||||
removeAll(dualListbox);
|
||||
});
|
||||
}
|
||||
|
||||
dualListbox.elements.filterInput1.on('change keyup', function() {
|
||||
filter(dualListbox, 1);
|
||||
});
|
||||
|
||||
dualListbox.elements.filterInput2.on('change keyup', function() {
|
||||
filter(dualListbox, 2);
|
||||
});
|
||||
}
|
||||
|
||||
BootstrapDualListbox.prototype = {
|
||||
init: function () {
|
||||
// Add the custom HTML template
|
||||
this.container = $('' +
|
||||
'<div class="bootstrap-duallistbox-container">' +
|
||||
' <div class="box1">' +
|
||||
' <label></label>' +
|
||||
' <span class="info-container">' +
|
||||
' <span class="info"></span>' +
|
||||
' <button type="button" class="btn clear1 pull-right"></button>' +
|
||||
' </span>' +
|
||||
' <input class="filter" type="text">' +
|
||||
' <div class="btn-group buttons">' +
|
||||
' <button type="button" class="btn moveall">' +
|
||||
' <i></i>' +
|
||||
' <i></i>' +
|
||||
' </button>' +
|
||||
' <button type="button" class="btn move">' +
|
||||
' <i></i>' +
|
||||
' </button>' +
|
||||
' </div>' +
|
||||
' <select multiple="multiple"></select>' +
|
||||
' </div>' +
|
||||
' <div class="box2">' +
|
||||
' <label></label>' +
|
||||
' <span class="info-container">' +
|
||||
' <span class="info"></span>' +
|
||||
' <button type="button" class="btn clear2 pull-right"></button>' +
|
||||
' </span>' +
|
||||
' <input class="filter" type="text">' +
|
||||
' <div class="btn-group buttons">' +
|
||||
' <button type="button" class="btn remove">' +
|
||||
' <i></i>' +
|
||||
' </button>' +
|
||||
' <button type="button" class="btn removeall">' +
|
||||
' <i></i>' +
|
||||
' <i></i>' +
|
||||
' </button>' +
|
||||
' </div>' +
|
||||
' <select multiple="multiple"></select>' +
|
||||
' </div>' +
|
||||
'</div>')
|
||||
.insertBefore(this.element);
|
||||
|
||||
// Cache the inner elements
|
||||
this.elements = {
|
||||
originalSelect: this.element,
|
||||
box1: $('.box1', this.container),
|
||||
box2: $('.box2', this.container),
|
||||
filterInput1: $('.box1 .filter', this.container),
|
||||
filterInput2: $('.box2 .filter', this.container),
|
||||
filterClear1: $('.box1 .clear1', this.container),
|
||||
filterClear2: $('.box2 .clear2', this.container),
|
||||
label1: $('.box1 > label', this.container),
|
||||
label2: $('.box2 > label', this.container),
|
||||
info1: $('.box1 .info', this.container),
|
||||
info2: $('.box2 .info', this.container),
|
||||
select1: $('.box1 select', this.container),
|
||||
select2: $('.box2 select', this.container),
|
||||
moveButton: $('.box1 .move', this.container),
|
||||
removeButton: $('.box2 .remove', this.container),
|
||||
moveAllButton: $('.box1 .moveall', this.container),
|
||||
removeAllButton: $('.box2 .removeall', this.container),
|
||||
form: $($('.box1 .filter', this.container)[0].form)
|
||||
};
|
||||
|
||||
// Set select IDs
|
||||
this.originalSelectName = this.element.attr('name') || '';
|
||||
var select1Id = 'bootstrap-duallistbox-nonselected-list_' + this.originalSelectName,
|
||||
select2Id = 'bootstrap-duallistbox-selected-list_' + this.originalSelectName;
|
||||
this.elements.select1.attr('id', select1Id);
|
||||
this.elements.select2.attr('id', select2Id);
|
||||
this.elements.label1.attr('for', select1Id);
|
||||
this.elements.label2.attr('for', select2Id);
|
||||
|
||||
// Apply all settings
|
||||
this.selectedElements = 0;
|
||||
this.sortIndex = 0;
|
||||
this.elementCount = 0;
|
||||
this.setBootstrap2Compatible(this.settings.bootstrap2Compatible);
|
||||
this.setFilterTextClear(this.settings.filterTextClear);
|
||||
this.setFilterPlaceHolder(this.settings.filterPlaceHolder);
|
||||
this.setMoveSelectedLabel(this.settings.moveSelectedLabel);
|
||||
this.setMoveAllLabel(this.settings.moveAllLabel);
|
||||
this.setRemoveSelectedLabel(this.settings.removeSelectedLabel);
|
||||
this.setRemoveAllLabel(this.settings.removeAllLabel);
|
||||
this.setMoveOnSelect(this.settings.moveOnSelect);
|
||||
this.setMoveOnDoubleClick(this.settings.moveOnDoubleClick);
|
||||
this.setPreserveSelectionOnMove(this.settings.preserveSelectionOnMove);
|
||||
this.setSelectedListLabel(this.settings.selectedListLabel);
|
||||
this.setNonSelectedListLabel(this.settings.nonSelectedListLabel);
|
||||
this.setHelperSelectNamePostfix(this.settings.helperSelectNamePostfix);
|
||||
this.setSelectOrMinimalHeight(this.settings.selectorMinimalHeight);
|
||||
|
||||
updateSelectionStates(this);
|
||||
|
||||
this.setShowFilterInputs(this.settings.showFilterInputs);
|
||||
this.setNonSelectedFilter(this.settings.nonSelectedFilter);
|
||||
this.setSelectedFilter(this.settings.selectedFilter);
|
||||
this.setInfoText(this.settings.infoText);
|
||||
this.setInfoTextFiltered(this.settings.infoTextFiltered);
|
||||
this.setInfoTextEmpty(this.settings.infoTextEmpty);
|
||||
this.setFilterOnValues(this.settings.filterOnValues);
|
||||
this.setSortByInputOrder(this.settings.sortByInputOrder);
|
||||
this.setEventMoveOverride(this.settings.eventMoveOverride);
|
||||
this.setEventMoveAllOverride(this.settings.eventMoveAllOverride);
|
||||
this.setEventRemoveOverride(this.settings.eventRemoveOverride);
|
||||
this.setEventRemoveAllOverride(this.settings.eventRemoveAllOverride);
|
||||
|
||||
// Hide the original select
|
||||
this.element.hide();
|
||||
|
||||
bindEvents(this);
|
||||
refreshSelects(this);
|
||||
|
||||
return this.element;
|
||||
},
|
||||
setBootstrap2Compatible: function(value, refresh) {
|
||||
this.settings.bootstrap2Compatible = value;
|
||||
if (value) {
|
||||
this.container.removeClass('row').addClass('row-fluid bs2compatible');
|
||||
this.container.find('.box1, .box2').removeClass('col-md-6').addClass('span6');
|
||||
this.container.find('.clear1, .clear2').removeClass('btn-white btn-xs').addClass('btn-mini');
|
||||
this.container.find('input, select').removeClass('form-control');
|
||||
this.container.find('.btn').removeClass('btn-white');
|
||||
this.container.find('.moveall > i, .move > i').removeClass('glyphicon glyphicon-arrow-right').addClass('icon-arrow-right');
|
||||
this.container.find('.removeall > i, .remove > i').removeClass('glyphicon glyphicon-arrow-left').addClass('icon-arrow-left');
|
||||
} else {
|
||||
this.container.removeClass('row-fluid bs2compatible').addClass('row');
|
||||
this.container.find('.box1, .box2').removeClass('span6').addClass('col-md-6');
|
||||
this.container.find('.clear1, .clear2').removeClass('btn-mini').addClass('btn-white btn-xs');
|
||||
this.container.find('input, select').addClass('form-control');
|
||||
this.container.find('.btn').addClass('btn-white');
|
||||
this.container.find('.moveall > i, .move > i').removeClass('icon-arrow-right').addClass('glyphicon glyphicon-arrow-right');
|
||||
this.container.find('.removeall > i, .remove > i').removeClass('icon-arrow-left').addClass('glyphicon glyphicon-arrow-left');
|
||||
}
|
||||
if (refresh) {
|
||||
refreshSelects(this);
|
||||
}
|
||||
return this.element;
|
||||
},
|
||||
setFilterTextClear: function(value, refresh) {
|
||||
this.settings.filterTextClear = value;
|
||||
this.elements.filterClear1.html(value);
|
||||
this.elements.filterClear2.html(value);
|
||||
if (refresh) {
|
||||
refreshSelects(this);
|
||||
}
|
||||
return this.element;
|
||||
},
|
||||
setFilterPlaceHolder: function(value, refresh) {
|
||||
this.settings.filterPlaceHolder = value;
|
||||
this.elements.filterInput1.attr('placeholder', value);
|
||||
this.elements.filterInput2.attr('placeholder', value);
|
||||
if (refresh) {
|
||||
refreshSelects(this);
|
||||
}
|
||||
return this.element;
|
||||
},
|
||||
setMoveSelectedLabel: function(value, refresh) {
|
||||
this.settings.moveSelectedLabel = value;
|
||||
this.elements.moveButton.attr('title', value);
|
||||
if (refresh) {
|
||||
refreshSelects(this);
|
||||
}
|
||||
return this.element;
|
||||
},
|
||||
setMoveAllLabel: function(value, refresh) {
|
||||
this.settings.moveAllLabel = value;
|
||||
this.elements.moveAllButton.attr('title', value);
|
||||
if (refresh) {
|
||||
refreshSelects(this);
|
||||
}
|
||||
return this.element;
|
||||
},
|
||||
setRemoveSelectedLabel: function(value, refresh) {
|
||||
this.settings.removeSelectedLabel = value;
|
||||
this.elements.removeButton.attr('title', value);
|
||||
if (refresh) {
|
||||
refreshSelects(this);
|
||||
}
|
||||
return this.element;
|
||||
},
|
||||
setRemoveAllLabel: function(value, refresh) {
|
||||
this.settings.removeAllLabel = value;
|
||||
this.elements.removeAllButton.attr('title', value);
|
||||
if (refresh) {
|
||||
refreshSelects(this);
|
||||
}
|
||||
return this.element;
|
||||
},
|
||||
setMoveOnSelect: function(value, refresh) {
|
||||
if (isBuggyAndroid) {
|
||||
value = true;
|
||||
}
|
||||
this.settings.moveOnSelect = value;
|
||||
if (this.settings.moveOnSelect) {
|
||||
this.container.addClass('moveonselect');
|
||||
var self = this;
|
||||
this.elements.select1.on('change', function() {
|
||||
move(self);
|
||||
});
|
||||
this.elements.select2.on('change', function() {
|
||||
remove(self);
|
||||
});
|
||||
} else {
|
||||
this.container.removeClass('moveonselect');
|
||||
this.elements.select1.off('change');
|
||||
this.elements.select2.off('change');
|
||||
}
|
||||
if (refresh) {
|
||||
refreshSelects(this);
|
||||
}
|
||||
return this.element;
|
||||
},
|
||||
setMoveOnDoubleClick: function(value, refresh) {
|
||||
if (isBuggyAndroid) {
|
||||
value = false;
|
||||
}
|
||||
this.settings.moveOnDoubleClick = value;
|
||||
if (this.settings.moveOnDoubleClick) {
|
||||
this.container.addClass('moveondoubleclick');
|
||||
var self = this;
|
||||
this.elements.select1.on('dblclick', function() {
|
||||
move(self);
|
||||
});
|
||||
this.elements.select2.on('dblclick', function() {
|
||||
remove(self);
|
||||
});
|
||||
} else {
|
||||
this.container.removeClass('moveondoubleclick');
|
||||
this.elements.select1.off('dblclick');
|
||||
this.elements.select2.off('dblclick');
|
||||
}
|
||||
if (refresh) {
|
||||
refreshSelects(this);
|
||||
}
|
||||
return this.element;
|
||||
},
|
||||
setPreserveSelectionOnMove: function(value, refresh) {
|
||||
// We are forcing to move on select and disabling preserveSelectionOnMove on Android
|
||||
if (isBuggyAndroid) {
|
||||
value = false;
|
||||
}
|
||||
this.settings.preserveSelectionOnMove = value;
|
||||
if (refresh) {
|
||||
refreshSelects(this);
|
||||
}
|
||||
return this.element;
|
||||
},
|
||||
setSelectedListLabel: function(value, refresh) {
|
||||
this.settings.selectedListLabel = value;
|
||||
if (value) {
|
||||
this.elements.label2.show().html(value);
|
||||
} else {
|
||||
this.elements.label2.hide().html(value);
|
||||
}
|
||||
if (refresh) {
|
||||
refreshSelects(this);
|
||||
}
|
||||
return this.element;
|
||||
},
|
||||
setNonSelectedListLabel: function(value, refresh) {
|
||||
this.settings.nonSelectedListLabel = value;
|
||||
if (value) {
|
||||
this.elements.label1.show().html(value);
|
||||
} else {
|
||||
this.elements.label1.hide().html(value);
|
||||
}
|
||||
if (refresh) {
|
||||
refreshSelects(this);
|
||||
}
|
||||
return this.element;
|
||||
},
|
||||
setHelperSelectNamePostfix: function(value, refresh) {
|
||||
this.settings.helperSelectNamePostfix = value;
|
||||
if (value) {
|
||||
this.elements.select1.attr('name', this.originalSelectName + value + '1');
|
||||
this.elements.select2.attr('name', this.originalSelectName + value + '2');
|
||||
} else {
|
||||
this.elements.select1.removeAttr('name');
|
||||
this.elements.select2.removeAttr('name');
|
||||
}
|
||||
if (refresh) {
|
||||
refreshSelects(this);
|
||||
}
|
||||
return this.element;
|
||||
},
|
||||
setSelectOrMinimalHeight: function(value, refresh) {
|
||||
this.settings.selectorMinimalHeight = value;
|
||||
var height = this.element.height();
|
||||
if (this.element.height() < value) {
|
||||
height = value;
|
||||
}
|
||||
this.elements.select1.height(height);
|
||||
this.elements.select2.height(height);
|
||||
if (refresh) {
|
||||
refreshSelects(this);
|
||||
}
|
||||
return this.element;
|
||||
},
|
||||
setShowFilterInputs: function(value, refresh) {
|
||||
if (!value) {
|
||||
this.setNonSelectedFilter('');
|
||||
this.setSelectedFilter('');
|
||||
refreshSelects(this);
|
||||
this.elements.filterInput1.hide();
|
||||
this.elements.filterInput2.hide();
|
||||
} else {
|
||||
this.elements.filterInput1.show();
|
||||
this.elements.filterInput2.show();
|
||||
}
|
||||
this.settings.showFilterInputs = value;
|
||||
if (refresh) {
|
||||
refreshSelects(this);
|
||||
}
|
||||
return this.element;
|
||||
},
|
||||
setNonSelectedFilter: function(value, refresh) {
|
||||
if (this.settings.showFilterInputs) {
|
||||
this.settings.nonSelectedFilter = value;
|
||||
this.elements.filterInput1.val(value);
|
||||
if (refresh) {
|
||||
refreshSelects(this);
|
||||
}
|
||||
return this.element;
|
||||
}
|
||||
},
|
||||
setSelectedFilter: function(value, refresh) {
|
||||
if (this.settings.showFilterInputs) {
|
||||
this.settings.selectedFilter = value;
|
||||
this.elements.filterInput2.val(value);
|
||||
if (refresh) {
|
||||
refreshSelects(this);
|
||||
}
|
||||
return this.element;
|
||||
}
|
||||
},
|
||||
setInfoText: function(value, refresh) {
|
||||
this.settings.infoText = value;
|
||||
if (value) {
|
||||
this.elements.info1.show();
|
||||
this.elements.info2.show();
|
||||
} else {
|
||||
this.elements.info1.hide();
|
||||
this.elements.info2.hide();
|
||||
}
|
||||
if (refresh) {
|
||||
refreshSelects(this);
|
||||
}
|
||||
return this.element;
|
||||
},
|
||||
setInfoTextFiltered: function(value, refresh) {
|
||||
this.settings.infoTextFiltered = value;
|
||||
if (refresh) {
|
||||
refreshSelects(this);
|
||||
}
|
||||
return this.element;
|
||||
},
|
||||
setInfoTextEmpty: function(value, refresh) {
|
||||
this.settings.infoTextEmpty = value;
|
||||
if (refresh) {
|
||||
refreshSelects(this);
|
||||
}
|
||||
return this.element;
|
||||
},
|
||||
setFilterOnValues: function(value, refresh) {
|
||||
this.settings.filterOnValues = value;
|
||||
if (refresh) {
|
||||
refreshSelects(this);
|
||||
}
|
||||
return this.element;
|
||||
},
|
||||
setSortByInputOrder: function(value, refresh){
|
||||
this.settings.sortByInputOrder = value;
|
||||
if (refresh) {
|
||||
refreshSelects(this);
|
||||
}
|
||||
return this.element;
|
||||
},
|
||||
setEventMoveOverride: function(value, refresh) {
|
||||
this.settings.eventMoveOverride = value;
|
||||
if (refresh) {
|
||||
refreshSelects(this);
|
||||
}
|
||||
return this.element;
|
||||
},
|
||||
setEventMoveAllOverride: function(value, refresh) {
|
||||
this.settings.eventMoveAllOverride = value;
|
||||
if (refresh) {
|
||||
refreshSelects(this);
|
||||
}
|
||||
return this.element;
|
||||
},
|
||||
setEventRemoveOverride: function(value, refresh) {
|
||||
this.settings.eventRemoveOverride = value;
|
||||
if (refresh) {
|
||||
refreshSelects(this);
|
||||
}
|
||||
return this.element;
|
||||
},
|
||||
setEventRemoveAllOverride: function(value, refresh) {
|
||||
this.settings.eventRemoveAllOverride = value;
|
||||
if (refresh) {
|
||||
refreshSelects(this);
|
||||
}
|
||||
return this.element;
|
||||
},
|
||||
getContainer: function() {
|
||||
return this.container;
|
||||
},
|
||||
refresh: function(mustClearSelections) {
|
||||
updateSelectionStates(this);
|
||||
|
||||
if (!mustClearSelections) {
|
||||
saveSelections(this, 1);
|
||||
saveSelections(this, 2);
|
||||
} else {
|
||||
clearSelections(this);
|
||||
}
|
||||
|
||||
refreshSelects(this);
|
||||
},
|
||||
destroy: function() {
|
||||
this.container.remove();
|
||||
this.element.show();
|
||||
$.data(this, 'plugin_' + pluginName, null);
|
||||
return this.element;
|
||||
}
|
||||
};
|
||||
|
||||
// A really lightweight plugin wrapper around the constructor,
|
||||
// preventing against multiple instantiations
|
||||
$.fn[ pluginName ] = function (options) {
|
||||
var args = arguments;
|
||||
|
||||
// Is the first parameter an object (options), or was omitted, instantiate a new instance of the plugin.
|
||||
if (options === undefined || typeof options === 'object') {
|
||||
return this.each(function () {
|
||||
// If this is not a select
|
||||
if (!$(this).is('select')) {
|
||||
$(this).find('select').each(function(index, item) {
|
||||
// For each nested select, instantiate the Dual List Box
|
||||
$(item).bootstrapDualListbox(options);
|
||||
});
|
||||
} else if (!$.data(this, 'plugin_' + pluginName)) {
|
||||
// Only allow the plugin to be instantiated once so we check that the element has no plugin instantiation yet
|
||||
|
||||
// if it has no instance, create a new one, pass options to our plugin constructor,
|
||||
// and store the plugin instance in the elements jQuery data object.
|
||||
$.data(this, 'plugin_' + pluginName, new BootstrapDualListbox(this, options));
|
||||
}
|
||||
});
|
||||
// If the first parameter is a string and it doesn't start with an underscore or "contains" the `init`-function,
|
||||
// treat this as a call to a public method.
|
||||
} else if (typeof options === 'string' && options[0] !== '_' && options !== 'init') {
|
||||
|
||||
// Cache the method call to make it possible to return a value
|
||||
var returns;
|
||||
|
||||
this.each(function () {
|
||||
var instance = $.data(this, 'plugin_' + pluginName);
|
||||
// Tests that there's already a plugin-instance and checks that the requested public method exists
|
||||
if (instance instanceof BootstrapDualListbox && typeof instance[options] === 'function') {
|
||||
// Call the method of our plugin instance, and pass it the supplied arguments.
|
||||
returns = instance[options].apply(instance, Array.prototype.slice.call(args, 1));
|
||||
}
|
||||
});
|
||||
|
||||
// If the earlier cached method gives a value back return the value,
|
||||
// otherwise return this to preserve chainability.
|
||||
return returns !== undefined ? returns : this;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
})(jQuery, window, document);
|
@ -0,0 +1 @@
|
||||
.bootstrap-duallistbox-container .buttons{width:100%;margin-bottom:-1px}.bootstrap-duallistbox-container label{display:block}.bootstrap-duallistbox-container .info{display:inline-block;margin-bottom:5px;font-size:11px}.bootstrap-duallistbox-container .clear1,.bootstrap-duallistbox-container .clear2{display:none;font-size:10px}.bootstrap-duallistbox-container .box1.filtered .clear1,.bootstrap-duallistbox-container .box2.filtered .clear2{display:inline-block}.bootstrap-duallistbox-container .move,.bootstrap-duallistbox-container .remove{width:60%}.bootstrap-duallistbox-container .btn-group .btn{border-bottom-left-radius:0;border-bottom-right-radius:0}.bootstrap-duallistbox-container select{border-top-left-radius:0;border-top-right-radius:0}.bootstrap-duallistbox-container .moveall,.bootstrap-duallistbox-container .removeall{width:40%}.bootstrap-duallistbox-container.bs2compatible .btn-group>.btn+.btn{margin-left:0}.bootstrap-duallistbox-container select{width:100%;height:300px;padding:0}.bootstrap-duallistbox-container .filter{display:inline-block;width:100%;height:31px;margin:0 0 5px 0;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.bootstrap-duallistbox-container .filter.placeholder{color:#aaa}.bootstrap-duallistbox-container.moveonselect .move,.bootstrap-duallistbox-container.moveonselect .remove{display:none}.bootstrap-duallistbox-container.moveonselect .moveall,.bootstrap-duallistbox-container.moveonselect .removeall{width:100%}
|
@ -0,0 +1,315 @@
|
||||
/* The MIT License
|
||||
|
||||
Copyright (c) 2011 by Michael Zinsmaier and nergal.dev
|
||||
Copyright (c) 2012 by Thomas Ritou
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
____________________________________________________
|
||||
|
||||
what it is:
|
||||
____________________________________________________
|
||||
|
||||
curvedLines is a plugin for flot, that tries to display lines in a smoother way.
|
||||
The plugin is based on nergal.dev's work https://code.google.com/p/flot/issues/detail?id=226
|
||||
and further extended with a mode that forces the min/max points of the curves to be on the
|
||||
points. Both modes are achieved through adding of more data points
|
||||
=> 1) with large data sets you may get trouble
|
||||
=> 2) if you want to display the points too, you have to plot them as 2nd data series over the lines
|
||||
|
||||
&& 3) consecutive x data points are not allowed to have the same value
|
||||
|
||||
This is version 0.5 of curvedLines so it will probably not work in every case. However
|
||||
the basic form of use descirbed next works (:
|
||||
|
||||
Feel free to further improve the code
|
||||
|
||||
____________________________________________________
|
||||
|
||||
how to use it:
|
||||
____________________________________________________
|
||||
|
||||
var d1 = [[5,5],[7,3],[9,12]];
|
||||
|
||||
var options = { series: { curvedLines: { active: true }}};
|
||||
|
||||
$.plot($("#placeholder"), [{data = d1, lines: { show: true}, curvedLines: {apply: true}}], options);
|
||||
|
||||
_____________________________________________________
|
||||
|
||||
options:
|
||||
_____________________________________________________
|
||||
|
||||
active: bool true => plugin can be used
|
||||
apply: bool true => series will be drawn as curved line
|
||||
fit: bool true => forces the max,mins of the curve to be on the datapoints
|
||||
curvePointFactor int defines how many "virtual" points are used per "real" data point to
|
||||
emulate the curvedLines (points total = real points * curvePointFactor)
|
||||
fitPointDist: int defines the x axis distance of the additional two points that are used
|
||||
to enforce the min max condition.
|
||||
|
||||
+ line options (since v0.5 curved lines use flots line implementation for drawing
|
||||
=> line options like fill, show ... are supported out of the box)
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
* v0.1 initial commit
|
||||
* v0.15 negative values should work now (outcommented a negative -> 0 hook hope it does no harm)
|
||||
* v0.2 added fill option (thanks to monemihir) and multi axis support (thanks to soewono effendi)
|
||||
* v0.3 improved saddle handling and added basic handling of Dates
|
||||
* v0.4 rewritten fill option (thomas ritou) mostly from original flot code (now fill between points rather than to graph bottom), corrected fill Opacity bug
|
||||
* v0.5 rewritten instead of implementing a own draw function CurvedLines is now based on the processDatapoints flot hook (credits go to thomas ritou).
|
||||
* This change breakes existing code however CurvedLines are now just many tiny straight lines to flot and therefore all flot lines options (like gradient fill,
|
||||
* shadow) are now supported out of the box
|
||||
* v0.6 flot 0.8 compatibility and some bug fixes
|
||||
*/
|
||||
|
||||
(function($) {
|
||||
|
||||
var options = {
|
||||
series : {
|
||||
curvedLines : {
|
||||
active : false,
|
||||
apply: false,
|
||||
fit : false,
|
||||
curvePointFactor : 20,
|
||||
fitPointDist : undefined
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function init(plot) {
|
||||
|
||||
plot.hooks.processOptions.push(processOptions);
|
||||
|
||||
//if the plugin is active register processDatapoints method
|
||||
function processOptions(plot, options) {
|
||||
if (options.series.curvedLines.active) {
|
||||
plot.hooks.processDatapoints.unshift(processDatapoints);
|
||||
}
|
||||
}
|
||||
|
||||
//only if the plugin is active
|
||||
function processDatapoints(plot, series, datapoints) {
|
||||
var nrPoints = datapoints.points.length / datapoints.pointsize;
|
||||
var EPSILON = 0.5; //pretty large epsilon but save
|
||||
|
||||
if (series.curvedLines.apply == true && series.originSeries === undefined && nrPoints > (1 + EPSILON)) {
|
||||
if (series.lines.fill) {
|
||||
|
||||
var pointsTop = calculateCurvePoints(datapoints, series.curvedLines, 1)
|
||||
,pointsBottom = calculateCurvePoints(datapoints, series.curvedLines, 2); //flot makes sure for us that we've got a second y point if fill is true !
|
||||
|
||||
//Merge top and bottom curve
|
||||
datapoints.pointsize = 3;
|
||||
datapoints.points = [];
|
||||
var j = 0;
|
||||
var k = 0;
|
||||
var i = 0;
|
||||
var ps = 2;
|
||||
while (i < pointsTop.length || j < pointsBottom.length) {
|
||||
if (pointsTop[i] == pointsBottom[j]) {
|
||||
datapoints.points[k] = pointsTop[i];
|
||||
datapoints.points[k + 1] = pointsTop[i + 1];
|
||||
datapoints.points[k + 2] = pointsBottom[j + 1];
|
||||
j += ps;
|
||||
i += ps;
|
||||
|
||||
} else if (pointsTop[i] < pointsBottom[j]) {
|
||||
datapoints.points[k] = pointsTop[i];
|
||||
datapoints.points[k + 1] = pointsTop[i + 1];
|
||||
datapoints.points[k + 2] = k > 0 ? datapoints.points[k-1] : null;
|
||||
i += ps;
|
||||
} else {
|
||||
datapoints.points[k] = pointsBottom[j];
|
||||
datapoints.points[k + 1] = k > 1 ? datapoints.points[k-2] : null;
|
||||
datapoints.points[k + 2] = pointsBottom[j + 1];
|
||||
j += ps;
|
||||
}
|
||||
k += 3;
|
||||
}
|
||||
} else if (series.lines.lineWidth > 0) {
|
||||
datapoints.points = calculateCurvePoints(datapoints, series.curvedLines, 1);
|
||||
datapoints.pointsize = 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//no real idea whats going on here code mainly from https://code.google.com/p/flot/issues/detail?id=226
|
||||
//if fit option is selected additional datapoints get inserted before the curve calculations in nergal.dev s code.
|
||||
function calculateCurvePoints(datapoints, curvedLinesOptions, yPos) {
|
||||
|
||||
var points = datapoints.points, ps = datapoints.pointsize;
|
||||
var num = curvedLinesOptions.curvePointFactor * (points.length / ps);
|
||||
|
||||
var xdata = new Array;
|
||||
var ydata = new Array;
|
||||
|
||||
var curX = -1;
|
||||
var curY = -1;
|
||||
var j = 0;
|
||||
|
||||
if (curvedLinesOptions.fit) {
|
||||
//insert a point before and after the "real" data point to force the line
|
||||
//to have a max,min at the data point.
|
||||
|
||||
var fpDist;
|
||||
if(typeof curvedLinesOptions.fitPointDist == 'undefined') {
|
||||
//estimate it
|
||||
var minX = points[0];
|
||||
var maxX = points[points.length-ps];
|
||||
fpDist = (maxX - minX) / (500 * 100); //x range / (estimated pixel length of placeholder * factor)
|
||||
} else {
|
||||
//use user defined value
|
||||
fpDist = curvedLinesOptions.fitPointDist;
|
||||
}
|
||||
|
||||
for (var i = 0; i < points.length; i += ps) {
|
||||
|
||||
var frontX;
|
||||
var backX;
|
||||
curX = i;
|
||||
curY = i + yPos;
|
||||
|
||||
//add point X s
|
||||
frontX = points[curX] - fpDist;
|
||||
backX = points[curX] + fpDist;
|
||||
|
||||
var factor = 2;
|
||||
while (frontX == points[curX] || backX == points[curX]) {
|
||||
//inside the ulp
|
||||
frontX = points[curX] - (fpDist * factor);
|
||||
backX = points[curX] + (fpDist * factor);
|
||||
factor++;
|
||||
}
|
||||
|
||||
//add curve points
|
||||
xdata[j] = frontX;
|
||||
ydata[j] = points[curY];
|
||||
j++;
|
||||
|
||||
xdata[j] = points[curX];
|
||||
ydata[j] = points[curY];
|
||||
j++;
|
||||
|
||||
xdata[j] = backX;
|
||||
ydata[j] = points[curY];
|
||||
j++;
|
||||
}
|
||||
} else {
|
||||
//just use the datapoints
|
||||
for (var i = 0; i < points.length; i += ps) {
|
||||
curX = i;
|
||||
curY = i + yPos;
|
||||
|
||||
xdata[j] = points[curX];
|
||||
ydata[j] = points[curY];
|
||||
j++;
|
||||
}
|
||||
}
|
||||
|
||||
var n = xdata.length;
|
||||
|
||||
var y2 = new Array();
|
||||
var delta = new Array();
|
||||
y2[0] = 0;
|
||||
y2[n - 1] = 0;
|
||||
delta[0] = 0;
|
||||
|
||||
for (var i = 1; i < n - 1; ++i) {
|
||||
var d = (xdata[i + 1] - xdata[i - 1]);
|
||||
if (d == 0) {
|
||||
//point before current point and after current point need some space in between
|
||||
return [];
|
||||
}
|
||||
|
||||
var s = (xdata[i] - xdata[i - 1]) / d;
|
||||
var p = s * y2[i - 1] + 2;
|
||||
y2[i] = (s - 1) / p;
|
||||
delta[i] = (ydata[i + 1] - ydata[i]) / (xdata[i + 1] - xdata[i]) - (ydata[i] - ydata[i - 1]) / (xdata[i] - xdata[i - 1]);
|
||||
delta[i] = (6 * delta[i] / (xdata[i + 1] - xdata[i - 1]) - s * delta[i - 1]) / p;
|
||||
}
|
||||
|
||||
for (var j = n - 2; j >= 0; --j) {
|
||||
y2[j] = y2[j] * y2[j + 1] + delta[j];
|
||||
}
|
||||
|
||||
// xmax - xmin / #points
|
||||
var step = (xdata[n - 1] - xdata[0]) / (num - 1);
|
||||
|
||||
var xnew = new Array;
|
||||
var ynew = new Array;
|
||||
var result = new Array;
|
||||
|
||||
xnew[0] = xdata[0];
|
||||
ynew[0] = ydata[0];
|
||||
|
||||
result.push(xnew[0]);
|
||||
result.push(ynew[0]);
|
||||
|
||||
for ( j = 1; j < num; ++j) {
|
||||
//new x point (sampling point for the created curve)
|
||||
xnew[j] = xnew[0] + j * step;
|
||||
|
||||
var max = n - 1;
|
||||
var min = 0;
|
||||
|
||||
while (max - min > 1) {
|
||||
var k = Math.round((max + min) / 2);
|
||||
if (xdata[k] > xnew[j]) {
|
||||
max = k;
|
||||
} else {
|
||||
min = k;
|
||||
}
|
||||
}
|
||||
|
||||
//found point one to the left and one to the right of generated new point
|
||||
var h = (xdata[max] - xdata[min]);
|
||||
|
||||
if (h == 0) {
|
||||
//similar to above two points from original x data need some space between them
|
||||
return [];
|
||||
}
|
||||
|
||||
var a = (xdata[max] - xnew[j]) / h;
|
||||
var b = (xnew[j] - xdata[min]) / h;
|
||||
|
||||
ynew[j] = a * ydata[min] + b * ydata[max] + ((a * a * a - a) * y2[min] + (b * b * b - b) * y2[max]) * (h * h) / 6;
|
||||
|
||||
result.push(xnew[j]);
|
||||
result.push(ynew[j]);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
}//end init
|
||||
|
||||
$.plot.plugins.push({
|
||||
init : init,
|
||||
options : options,
|
||||
name : 'curvedLines',
|
||||
version : '0.5'
|
||||
});
|
||||
|
||||
})(jQuery);
|
@ -0,0 +1,750 @@
|
||||
/*
|
||||
Flot plugin for rendering pie charts. The plugin assumes the data is
|
||||
coming is as a single data value for each series, and each of those
|
||||
values is a positive value or zero (negative numbers don't make
|
||||
any sense and will cause strange effects). The data values do
|
||||
NOT need to be passed in as percentage values because it
|
||||
internally calculates the total and percentages.
|
||||
|
||||
* Created by Brian Medendorp, June 2009
|
||||
* Updated November 2009 with contributions from: btburnett3, Anthony Aragues and Xavi Ivars
|
||||
|
||||
* Changes:
|
||||
2009-10-22: lineJoin set to round
|
||||
2009-10-23: IE full circle fix, donut
|
||||
2009-11-11: Added basic hover from btburnett3 - does not work in IE, and center is off in Chrome and Opera
|
||||
2009-11-17: Added IE hover capability submitted by Anthony Aragues
|
||||
2009-11-18: Added bug fix submitted by Xavi Ivars (issues with arrays when other JS libraries are included as well)
|
||||
|
||||
|
||||
Available options are:
|
||||
series: {
|
||||
pie: {
|
||||
show: true/false
|
||||
radius: 0-1 for percentage of fullsize, or a specified pixel length, or 'auto'
|
||||
innerRadius: 0-1 for percentage of fullsize or a specified pixel length, for creating a donut effect
|
||||
startAngle: 0-2 factor of PI used for starting angle (in radians) i.e 3/2 starts at the top, 0 and 2 have the same result
|
||||
tilt: 0-1 for percentage to tilt the pie, where 1 is no tilt, and 0 is completely flat (nothing will show)
|
||||
offset: {
|
||||
top: integer value to move the pie up or down
|
||||
left: integer value to move the pie left or right, or 'auto'
|
||||
},
|
||||
stroke: {
|
||||
color: any hexidecimal color value (other formats may or may not work, so best to stick with something like '#FFF')
|
||||
width: integer pixel width of the stroke
|
||||
},
|
||||
label: {
|
||||
show: true/false, or 'auto'
|
||||
formatter: a user-defined function that modifies the text/style of the label text
|
||||
radius: 0-1 for percentage of fullsize, or a specified pixel length
|
||||
background: {
|
||||
color: any hexidecimal color value (other formats may or may not work, so best to stick with something like '#000')
|
||||
opacity: 0-1
|
||||
},
|
||||
threshold: 0-1 for the percentage value at which to hide labels (if they're too small)
|
||||
},
|
||||
combine: {
|
||||
threshold: 0-1 for the percentage value at which to combine slices (if they're too small)
|
||||
color: any hexidecimal color value (other formats may or may not work, so best to stick with something like '#CCC'), if null, the plugin will automatically use the color of the first slice to be combined
|
||||
label: any text value of what the combined slice should be labeled
|
||||
}
|
||||
highlight: {
|
||||
opacity: 0-1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
More detail and specific examples can be found in the included HTML file.
|
||||
|
||||
*/
|
||||
|
||||
(function ($)
|
||||
{
|
||||
function init(plot) // this is the "body" of the plugin
|
||||
{
|
||||
var canvas = null;
|
||||
var target = null;
|
||||
var maxRadius = null;
|
||||
var centerLeft = null;
|
||||
var centerTop = null;
|
||||
var total = 0;
|
||||
var redraw = true;
|
||||
var redrawAttempts = 10;
|
||||
var shrink = 0.95;
|
||||
var legendWidth = 0;
|
||||
var processed = false;
|
||||
var raw = false;
|
||||
|
||||
// interactive variables
|
||||
var highlights = [];
|
||||
|
||||
// add hook to determine if pie plugin in enabled, and then perform necessary operations
|
||||
plot.hooks.processOptions.push(checkPieEnabled);
|
||||
plot.hooks.bindEvents.push(bindEvents);
|
||||
|
||||
// check to see if the pie plugin is enabled
|
||||
function checkPieEnabled(plot, options)
|
||||
{
|
||||
if (options.series.pie.show)
|
||||
{
|
||||
//disable grid
|
||||
options.grid.show = false;
|
||||
|
||||
// set labels.show
|
||||
if (options.series.pie.label.show=='auto')
|
||||
if (options.legend.show)
|
||||
options.series.pie.label.show = false;
|
||||
else
|
||||
options.series.pie.label.show = true;
|
||||
|
||||
// set radius
|
||||
if (options.series.pie.radius=='auto')
|
||||
if (options.series.pie.label.show)
|
||||
options.series.pie.radius = 3/4;
|
||||
else
|
||||
options.series.pie.radius = 1;
|
||||
|
||||
// ensure sane tilt
|
||||
if (options.series.pie.tilt>1)
|
||||
options.series.pie.tilt=1;
|
||||
if (options.series.pie.tilt<0)
|
||||
options.series.pie.tilt=0;
|
||||
|
||||
// add processData hook to do transformations on the data
|
||||
plot.hooks.processDatapoints.push(processDatapoints);
|
||||
plot.hooks.drawOverlay.push(drawOverlay);
|
||||
|
||||
// add draw hook
|
||||
plot.hooks.draw.push(draw);
|
||||
}
|
||||
}
|
||||
|
||||
// bind hoverable events
|
||||
function bindEvents(plot, eventHolder)
|
||||
{
|
||||
var options = plot.getOptions();
|
||||
|
||||
if (options.series.pie.show && options.grid.hoverable)
|
||||
eventHolder.unbind('mousemove').mousemove(onMouseMove);
|
||||
|
||||
if (options.series.pie.show && options.grid.clickable)
|
||||
eventHolder.unbind('click').click(onClick);
|
||||
}
|
||||
|
||||
|
||||
// debugging function that prints out an object
|
||||
function alertObject(obj)
|
||||
{
|
||||
var msg = '';
|
||||
function traverse(obj, depth)
|
||||
{
|
||||
if (!depth)
|
||||
depth = 0;
|
||||
for (var i = 0; i < obj.length; ++i)
|
||||
{
|
||||
for (var j=0; j<depth; j++)
|
||||
msg += '\t';
|
||||
|
||||
if( typeof obj[i] == "object")
|
||||
{ // its an object
|
||||
msg += ''+i+':\n';
|
||||
traverse(obj[i], depth+1);
|
||||
}
|
||||
else
|
||||
{ // its a value
|
||||
msg += ''+i+': '+obj[i]+'\n';
|
||||
}
|
||||
}
|
||||
}
|
||||
traverse(obj);
|
||||
alert(msg);
|
||||
}
|
||||
|
||||
function calcTotal(data)
|
||||
{
|
||||
for (var i = 0; i < data.length; ++i)
|
||||
{
|
||||
var item = parseFloat(data[i].data[0][1]);
|
||||
if (item)
|
||||
total += item;
|
||||
}
|
||||
}
|
||||
|
||||
function processDatapoints(plot, series, data, datapoints)
|
||||
{
|
||||
if (!processed)
|
||||
{
|
||||
processed = true;
|
||||
|
||||
canvas = plot.getCanvas();
|
||||
target = $(canvas).parent();
|
||||
options = plot.getOptions();
|
||||
|
||||
plot.setData(combine(plot.getData()));
|
||||
}
|
||||
}
|
||||
|
||||
function setupPie()
|
||||
{
|
||||
legendWidth = target.children().filter('.legend').children().width();
|
||||
|
||||
// calculate maximum radius and center point
|
||||
maxRadius = Math.min(canvas.width,(canvas.height/options.series.pie.tilt))/2;
|
||||
centerTop = (canvas.height/2)+options.series.pie.offset.top;
|
||||
centerLeft = (canvas.width/2);
|
||||
|
||||
if (options.series.pie.offset.left=='auto')
|
||||
if (options.legend.position.match('w'))
|
||||
centerLeft += legendWidth/2;
|
||||
else
|
||||
centerLeft -= legendWidth/2;
|
||||
else
|
||||
centerLeft += options.series.pie.offset.left;
|
||||
|
||||
if (centerLeft<maxRadius)
|
||||
centerLeft = maxRadius;
|
||||
else if (centerLeft>canvas.width-maxRadius)
|
||||
centerLeft = canvas.width-maxRadius;
|
||||
}
|
||||
|
||||
function fixData(data)
|
||||
{
|
||||
for (var i = 0; i < data.length; ++i)
|
||||
{
|
||||
if (typeof(data[i].data)=='number')
|
||||
data[i].data = [[1,data[i].data]];
|
||||
else if (typeof(data[i].data)=='undefined' || typeof(data[i].data[0])=='undefined')
|
||||
{
|
||||
if (typeof(data[i].data)!='undefined' && typeof(data[i].data.label)!='undefined')
|
||||
data[i].label = data[i].data.label; // fix weirdness coming from flot
|
||||
data[i].data = [[1,0]];
|
||||
|
||||
}
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
function combine(data)
|
||||
{
|
||||
data = fixData(data);
|
||||
calcTotal(data);
|
||||
var combined = 0;
|
||||
var numCombined = 0;
|
||||
var color = options.series.pie.combine.color;
|
||||
|
||||
var newdata = [];
|
||||
for (var i = 0; i < data.length; ++i)
|
||||
{
|
||||
// make sure its a number
|
||||
data[i].data[0][1] = parseFloat(data[i].data[0][1]);
|
||||
if (!data[i].data[0][1])
|
||||
data[i].data[0][1] = 0;
|
||||
|
||||
if (data[i].data[0][1]/total<=options.series.pie.combine.threshold)
|
||||
{
|
||||
combined += data[i].data[0][1];
|
||||
numCombined++;
|
||||
if (!color)
|
||||
color = data[i].color;
|
||||
}
|
||||
else
|
||||
{
|
||||
newdata.push({
|
||||
data: [[1,data[i].data[0][1]]],
|
||||
color: data[i].color,
|
||||
label: data[i].label,
|
||||
angle: (data[i].data[0][1]*(Math.PI*2))/total,
|
||||
percent: (data[i].data[0][1]/total*100)
|
||||
});
|
||||
}
|
||||
}
|
||||
if (numCombined>0)
|
||||
newdata.push({
|
||||
data: [[1,combined]],
|
||||
color: color,
|
||||
label: options.series.pie.combine.label,
|
||||
angle: (combined*(Math.PI*2))/total,
|
||||
percent: (combined/total*100)
|
||||
});
|
||||
return newdata;
|
||||
}
|
||||
|
||||
function draw(plot, newCtx)
|
||||
{
|
||||
if (!target) return; // if no series were passed
|
||||
ctx = newCtx;
|
||||
|
||||
setupPie();
|
||||
var slices = plot.getData();
|
||||
|
||||
var attempts = 0;
|
||||
while (redraw && attempts<redrawAttempts)
|
||||
{
|
||||
redraw = false;
|
||||
if (attempts>0)
|
||||
maxRadius *= shrink;
|
||||
attempts += 1;
|
||||
clear();
|
||||
if (options.series.pie.tilt<=0.8)
|
||||
drawShadow();
|
||||
drawPie();
|
||||
}
|
||||
if (attempts >= redrawAttempts) {
|
||||
clear();
|
||||
target.prepend('<div class="error">Could not draw pie with labels contained inside canvas</div>');
|
||||
}
|
||||
|
||||
if ( plot.setSeries && plot.insertLegend )
|
||||
{
|
||||
plot.setSeries(slices);
|
||||
plot.insertLegend();
|
||||
}
|
||||
|
||||
// we're actually done at this point, just defining internal functions at this point
|
||||
|
||||
function clear()
|
||||
{
|
||||
ctx.clearRect(0,0,canvas.width,canvas.height);
|
||||
target.children().filter('.pieLabel, .pieLabelBackground').remove();
|
||||
}
|
||||
|
||||
function drawShadow()
|
||||
{
|
||||
var shadowLeft = 5;
|
||||
var shadowTop = 15;
|
||||
var edge = 10;
|
||||
var alpha = 0.02;
|
||||
|
||||
// set radius
|
||||
if (options.series.pie.radius>1)
|
||||
var radius = options.series.pie.radius;
|
||||
else
|
||||
var radius = maxRadius * options.series.pie.radius;
|
||||
|
||||
if (radius>=(canvas.width/2)-shadowLeft || radius*options.series.pie.tilt>=(canvas.height/2)-shadowTop || radius<=edge)
|
||||
return; // shadow would be outside canvas, so don't draw it
|
||||
|
||||
ctx.save();
|
||||
ctx.translate(shadowLeft,shadowTop);
|
||||
ctx.globalAlpha = alpha;
|
||||
ctx.fillStyle = '#000';
|
||||
|
||||
// center and rotate to starting position
|
||||
ctx.translate(centerLeft,centerTop);
|
||||
ctx.scale(1, options.series.pie.tilt);
|
||||
|
||||
//radius -= edge;
|
||||
for (var i=1; i<=edge; i++)
|
||||
{
|
||||
ctx.beginPath();
|
||||
ctx.arc(0,0,radius,0,Math.PI*2,false);
|
||||
ctx.fill();
|
||||
radius -= i;
|
||||
}
|
||||
|
||||
ctx.restore();
|
||||
}
|
||||
|
||||
function drawPie()
|
||||
{
|
||||
startAngle = Math.PI*options.series.pie.startAngle;
|
||||
|
||||
// set radius
|
||||
if (options.series.pie.radius>1)
|
||||
var radius = options.series.pie.radius;
|
||||
else
|
||||
var radius = maxRadius * options.series.pie.radius;
|
||||
|
||||
// center and rotate to starting position
|
||||
ctx.save();
|
||||
ctx.translate(centerLeft,centerTop);
|
||||
ctx.scale(1, options.series.pie.tilt);
|
||||
//ctx.rotate(startAngle); // start at top; -- This doesn't work properly in Opera
|
||||
|
||||
// draw slices
|
||||
ctx.save();
|
||||
var currentAngle = startAngle;
|
||||
for (var i = 0; i < slices.length; ++i)
|
||||
{
|
||||
slices[i].startAngle = currentAngle;
|
||||
drawSlice(slices[i].angle, slices[i].color, true);
|
||||
}
|
||||
ctx.restore();
|
||||
|
||||
// draw slice outlines
|
||||
ctx.save();
|
||||
ctx.lineWidth = options.series.pie.stroke.width;
|
||||
currentAngle = startAngle;
|
||||
for (var i = 0; i < slices.length; ++i)
|
||||
drawSlice(slices[i].angle, options.series.pie.stroke.color, false);
|
||||
ctx.restore();
|
||||
|
||||
// draw donut hole
|
||||
drawDonutHole(ctx);
|
||||
|
||||
// draw labels
|
||||
if (options.series.pie.label.show)
|
||||
drawLabels();
|
||||
|
||||
// restore to original state
|
||||
ctx.restore();
|
||||
|
||||
function drawSlice(angle, color, fill)
|
||||
{
|
||||
if (angle<=0)
|
||||
return;
|
||||
|
||||
if (fill)
|
||||
ctx.fillStyle = color;
|
||||
else
|
||||
{
|
||||
ctx.strokeStyle = color;
|
||||
ctx.lineJoin = 'round';
|
||||
}
|
||||
|
||||
ctx.beginPath();
|
||||
if (Math.abs(angle - Math.PI*2) > 0.000000001)
|
||||
ctx.moveTo(0,0); // Center of the pie
|
||||
else if ($.browser.msie)
|
||||
angle -= 0.0001;
|
||||
//ctx.arc(0,0,radius,0,angle,false); // This doesn't work properly in Opera
|
||||
ctx.arc(0,0,radius,currentAngle,currentAngle+angle,false);
|
||||
ctx.closePath();
|
||||
//ctx.rotate(angle); // This doesn't work properly in Opera
|
||||
currentAngle += angle;
|
||||
|
||||
if (fill)
|
||||
ctx.fill();
|
||||
else
|
||||
ctx.stroke();
|
||||
}
|
||||
|
||||
function drawLabels()
|
||||
{
|
||||
var currentAngle = startAngle;
|
||||
|
||||
// set radius
|
||||
if (options.series.pie.label.radius>1)
|
||||
var radius = options.series.pie.label.radius;
|
||||
else
|
||||
var radius = maxRadius * options.series.pie.label.radius;
|
||||
|
||||
for (var i = 0; i < slices.length; ++i)
|
||||
{
|
||||
if (slices[i].percent >= options.series.pie.label.threshold*100)
|
||||
drawLabel(slices[i], currentAngle, i);
|
||||
currentAngle += slices[i].angle;
|
||||
}
|
||||
|
||||
function drawLabel(slice, startAngle, index)
|
||||
{
|
||||
if (slice.data[0][1]==0)
|
||||
return;
|
||||
|
||||
// format label text
|
||||
var lf = options.legend.labelFormatter, text, plf = options.series.pie.label.formatter;
|
||||
if (lf)
|
||||
text = lf(slice.label, slice);
|
||||
else
|
||||
text = slice.label;
|
||||
if (plf)
|
||||
text = plf(text, slice);
|
||||
|
||||
var halfAngle = ((startAngle+slice.angle) + startAngle)/2;
|
||||
var x = centerLeft + Math.round(Math.cos(halfAngle) * radius);
|
||||
var y = centerTop + Math.round(Math.sin(halfAngle) * radius) * options.series.pie.tilt;
|
||||
|
||||
var html = '<span class="pieLabel" id="pieLabel'+index+'" style="position:absolute;top:' + y + 'px;left:' + x + 'px;">' + text + "</span>";
|
||||
target.append(html);
|
||||
var label = target.children('#pieLabel'+index);
|
||||
var labelTop = (y - label.height()/2);
|
||||
var labelLeft = (x - label.width()/2);
|
||||
label.css('top', labelTop);
|
||||
label.css('left', labelLeft);
|
||||
|
||||
// check to make sure that the label is not outside the canvas
|
||||
if (0-labelTop>0 || 0-labelLeft>0 || canvas.height-(labelTop+label.height())<0 || canvas.width-(labelLeft+label.width())<0)
|
||||
redraw = true;
|
||||
|
||||
if (options.series.pie.label.background.opacity != 0) {
|
||||
// put in the transparent background separately to avoid blended labels and label boxes
|
||||
var c = options.series.pie.label.background.color;
|
||||
if (c == null) {
|
||||
c = slice.color;
|
||||
}
|
||||
var pos = 'top:'+labelTop+'px;left:'+labelLeft+'px;';
|
||||
$('<div class="pieLabelBackground" style="position:absolute;width:' + label.width() + 'px;height:' + label.height() + 'px;' + pos +'background-color:' + c + ';"> </div>').insertBefore(label).css('opacity', options.series.pie.label.background.opacity);
|
||||
}
|
||||
} // end individual label function
|
||||
} // end drawLabels function
|
||||
} // end drawPie function
|
||||
} // end draw function
|
||||
|
||||
// Placed here because it needs to be accessed from multiple locations
|
||||
function drawDonutHole(layer)
|
||||
{
|
||||
// draw donut hole
|
||||
if(options.series.pie.innerRadius > 0)
|
||||
{
|
||||
// subtract the center
|
||||
layer.save();
|
||||
innerRadius = options.series.pie.innerRadius > 1 ? options.series.pie.innerRadius : maxRadius * options.series.pie.innerRadius;
|
||||
layer.globalCompositeOperation = 'destination-out'; // this does not work with excanvas, but it will fall back to using the stroke color
|
||||
layer.beginPath();
|
||||
layer.fillStyle = options.series.pie.stroke.color;
|
||||
layer.arc(0,0,innerRadius,0,Math.PI*2,false);
|
||||
layer.fill();
|
||||
layer.closePath();
|
||||
layer.restore();
|
||||
|
||||
// add inner stroke
|
||||
layer.save();
|
||||
layer.beginPath();
|
||||
layer.strokeStyle = options.series.pie.stroke.color;
|
||||
layer.arc(0,0,innerRadius,0,Math.PI*2,false);
|
||||
layer.stroke();
|
||||
layer.closePath();
|
||||
layer.restore();
|
||||
// TODO: add extra shadow inside hole (with a mask) if the pie is tilted.
|
||||
}
|
||||
}
|
||||
|
||||
//-- Additional Interactive related functions --
|
||||
|
||||
function isPointInPoly(poly, pt)
|
||||
{
|
||||
for(var c = false, i = -1, l = poly.length, j = l - 1; ++i < l; j = i)
|
||||
((poly[i][1] <= pt[1] && pt[1] < poly[j][1]) || (poly[j][1] <= pt[1] && pt[1]< poly[i][1]))
|
||||
&& (pt[0] < (poly[j][0] - poly[i][0]) * (pt[1] - poly[i][1]) / (poly[j][1] - poly[i][1]) + poly[i][0])
|
||||
&& (c = !c);
|
||||
return c;
|
||||
}
|
||||
|
||||
function findNearbySlice(mouseX, mouseY)
|
||||
{
|
||||
var slices = plot.getData(),
|
||||
options = plot.getOptions(),
|
||||
radius = options.series.pie.radius > 1 ? options.series.pie.radius : maxRadius * options.series.pie.radius;
|
||||
|
||||
for (var i = 0; i < slices.length; ++i)
|
||||
{
|
||||
var s = slices[i];
|
||||
|
||||
if(s.pie.show)
|
||||
{
|
||||
ctx.save();
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(0,0); // Center of the pie
|
||||
//ctx.scale(1, options.series.pie.tilt); // this actually seems to break everything when here.
|
||||
ctx.arc(0,0,radius,s.startAngle,s.startAngle+s.angle,false);
|
||||
ctx.closePath();
|
||||
x = mouseX-centerLeft;
|
||||
y = mouseY-centerTop;
|
||||
if(ctx.isPointInPath)
|
||||
{
|
||||
if (ctx.isPointInPath(mouseX-centerLeft, mouseY-centerTop))
|
||||
{
|
||||
//alert('found slice!');
|
||||
ctx.restore();
|
||||
return {datapoint: [s.percent, s.data], dataIndex: 0, series: s, seriesIndex: i};
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// excanvas for IE doesn;t support isPointInPath, this is a workaround.
|
||||
p1X = (radius * Math.cos(s.startAngle));
|
||||
p1Y = (radius * Math.sin(s.startAngle));
|
||||
p2X = (radius * Math.cos(s.startAngle+(s.angle/4)));
|
||||
p2Y = (radius * Math.sin(s.startAngle+(s.angle/4)));
|
||||
p3X = (radius * Math.cos(s.startAngle+(s.angle/2)));
|
||||
p3Y = (radius * Math.sin(s.startAngle+(s.angle/2)));
|
||||
p4X = (radius * Math.cos(s.startAngle+(s.angle/1.5)));
|
||||
p4Y = (radius * Math.sin(s.startAngle+(s.angle/1.5)));
|
||||
p5X = (radius * Math.cos(s.startAngle+s.angle));
|
||||
p5Y = (radius * Math.sin(s.startAngle+s.angle));
|
||||
arrPoly = [[0,0],[p1X,p1Y],[p2X,p2Y],[p3X,p3Y],[p4X,p4Y],[p5X,p5Y]];
|
||||
arrPoint = [x,y];
|
||||
// TODO: perhaps do some mathmatical trickery here with the Y-coordinate to compensate for pie tilt?
|
||||
if(isPointInPoly(arrPoly, arrPoint))
|
||||
{
|
||||
ctx.restore();
|
||||
return {datapoint: [s.percent, s.data], dataIndex: 0, series: s, seriesIndex: i};
|
||||
}
|
||||
}
|
||||
ctx.restore();
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function onMouseMove(e)
|
||||
{
|
||||
triggerClickHoverEvent('plothover', e);
|
||||
}
|
||||
|
||||
function onClick(e)
|
||||
{
|
||||
triggerClickHoverEvent('plotclick', e);
|
||||
}
|
||||
|
||||
// trigger click or hover event (they send the same parameters so we share their code)
|
||||
function triggerClickHoverEvent(eventname, e)
|
||||
{
|
||||
var offset = plot.offset(),
|
||||
canvasX = parseInt(e.pageX - offset.left),
|
||||
canvasY = parseInt(e.pageY - offset.top),
|
||||
item = findNearbySlice(canvasX, canvasY);
|
||||
|
||||
if (options.grid.autoHighlight)
|
||||
{
|
||||
// clear auto-highlights
|
||||
for (var i = 0; i < highlights.length; ++i)
|
||||
{
|
||||
var h = highlights[i];
|
||||
if (h.auto == eventname && !(item && h.series == item.series))
|
||||
unhighlight(h.series);
|
||||
}
|
||||
}
|
||||
|
||||
// highlight the slice
|
||||
if (item)
|
||||
highlight(item.series, eventname);
|
||||
|
||||
// trigger any hover bind events
|
||||
var pos = { pageX: e.pageX, pageY: e.pageY };
|
||||
target.trigger(eventname, [ pos, item ]);
|
||||
}
|
||||
|
||||
function highlight(s, auto)
|
||||
{
|
||||
if (typeof s == "number")
|
||||
s = series[s];
|
||||
|
||||
var i = indexOfHighlight(s);
|
||||
if (i == -1)
|
||||
{
|
||||
highlights.push({ series: s, auto: auto });
|
||||
plot.triggerRedrawOverlay();
|
||||
}
|
||||
else if (!auto)
|
||||
highlights[i].auto = false;
|
||||
}
|
||||
|
||||
function unhighlight(s)
|
||||
{
|
||||
if (s == null)
|
||||
{
|
||||
highlights = [];
|
||||
plot.triggerRedrawOverlay();
|
||||
}
|
||||
|
||||
if (typeof s == "number")
|
||||
s = series[s];
|
||||
|
||||
var i = indexOfHighlight(s);
|
||||
if (i != -1)
|
||||
{
|
||||
highlights.splice(i, 1);
|
||||
plot.triggerRedrawOverlay();
|
||||
}
|
||||
}
|
||||
|
||||
function indexOfHighlight(s)
|
||||
{
|
||||
for (var i = 0; i < highlights.length; ++i)
|
||||
{
|
||||
var h = highlights[i];
|
||||
if (h.series == s)
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
function drawOverlay(plot, octx)
|
||||
{
|
||||
//alert(options.series.pie.radius);
|
||||
var options = plot.getOptions();
|
||||
//alert(options.series.pie.radius);
|
||||
|
||||
var radius = options.series.pie.radius > 1 ? options.series.pie.radius : maxRadius * options.series.pie.radius;
|
||||
|
||||
octx.save();
|
||||
octx.translate(centerLeft, centerTop);
|
||||
octx.scale(1, options.series.pie.tilt);
|
||||
|
||||
for (i = 0; i < highlights.length; ++i)
|
||||
drawHighlight(highlights[i].series);
|
||||
|
||||
drawDonutHole(octx);
|
||||
|
||||
octx.restore();
|
||||
|
||||
function drawHighlight(series)
|
||||
{
|
||||
if (series.angle < 0) return;
|
||||
|
||||
//octx.fillStyle = parseColor(options.series.pie.highlight.color).scale(null, null, null, options.series.pie.highlight.opacity).toString();
|
||||
octx.fillStyle = "rgba(255, 255, 255, "+options.series.pie.highlight.opacity+")"; // this is temporary until we have access to parseColor
|
||||
|
||||
octx.beginPath();
|
||||
if (Math.abs(series.angle - Math.PI*2) > 0.000000001)
|
||||
octx.moveTo(0,0); // Center of the pie
|
||||
octx.arc(0,0,radius,series.startAngle,series.startAngle+series.angle,false);
|
||||
octx.closePath();
|
||||
octx.fill();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} // end init (plugin body)
|
||||
|
||||
// define pie specific options and their default values
|
||||
var options = {
|
||||
series: {
|
||||
pie: {
|
||||
show: false,
|
||||
radius: 'auto', // actual radius of the visible pie (based on full calculated radius if <=1, or hard pixel value)
|
||||
innerRadius:0, /* for donut */
|
||||
startAngle: 3/2,
|
||||
tilt: 1,
|
||||
offset: {
|
||||
top: 0,
|
||||
left: 'auto'
|
||||
},
|
||||
stroke: {
|
||||
color: '#FFF',
|
||||
width: 1
|
||||
},
|
||||
label: {
|
||||
show: 'auto',
|
||||
formatter: function(label, slice){
|
||||
return '<div style="font-size:x-small;text-align:center;padding:2px;color:'+slice.color+';">'+label+'<br/>'+Math.round(slice.percent)+'%</div>';
|
||||
}, // formatter function
|
||||
radius: 1, // radius at which to place the labels (based on full calculated radius if <=1, or hard pixel value)
|
||||
background: {
|
||||
color: null,
|
||||
opacity: 0
|
||||
},
|
||||
threshold: 0 // percentage at which to hide the label (i.e. the slice is too narrow)
|
||||
},
|
||||
combine: {
|
||||
threshold: -1, // percentage at which to combine little slices into one larger slice
|
||||
color: null, // color to give the new slice (auto-generated if null)
|
||||
label: 'Other' // label to give the new slice
|
||||
},
|
||||
highlight: {
|
||||
//color: '#FFF', // will add this functionality once parseColor is available
|
||||
opacity: 0.5
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
$.plot.plugins.push({
|
||||
init: init,
|
||||
options: options,
|
||||
name: "pie",
|
||||
version: "1.0"
|
||||
});
|
||||
})(jQuery);
|
@ -0,0 +1,60 @@
|
||||
/* Flot plugin for automatically redrawing plots as the placeholder resizes.
|
||||
|
||||
Copyright (c) 2007-2013 IOLA and Ole Laursen.
|
||||
Licensed under the MIT license.
|
||||
|
||||
It works by listening for changes on the placeholder div (through the jQuery
|
||||
resize event plugin) - if the size changes, it will redraw the plot.
|
||||
|
||||
There are no options. If you need to disable the plugin for some plots, you
|
||||
can just fix the size of their placeholders.
|
||||
|
||||
*/
|
||||
|
||||
/* Inline dependency:
|
||||
* jQuery resize event - v1.1 - 3/14/2010
|
||||
* http://benalman.com/projects/jquery-resize-plugin/
|
||||
*
|
||||
* Copyright (c) 2010 "Cowboy" Ben Alman
|
||||
* Dual licensed under the MIT and GPL licenses.
|
||||
* http://benalman.com/about/license/
|
||||
*/
|
||||
|
||||
(function($,h,c){var a=$([]),e=$.resize=$.extend($.resize,{}),i,k="setTimeout",j="resize",d=j+"-special-event",b="delay",f="throttleWindow";e[b]=250;e[f]=true;$.event.special[j]={setup:function(){if(!e[f]&&this[k]){return false}var l=$(this);a=a.add(l);$.data(this,d,{w:l.width(),h:l.height()});if(a.length===1){g()}},teardown:function(){if(!e[f]&&this[k]){return false}var l=$(this);a=a.not(l);l.removeData(d);if(!a.length){clearTimeout(i)}},add:function(l){if(!e[f]&&this[k]){return false}var n;function m(s,o,p){var q=$(this),r=$.data(this,d);r.w=o!==c?o:q.width();r.h=p!==c?p:q.height();n.apply(this,arguments)}if($.isFunction(l)){n=l;return m}else{n=l.handler;l.handler=m}}};function g(){i=h[k](function(){a.each(function(){var n=$(this),m=n.width(),l=n.height(),o=$.data(this,d);if(m!==o.w||l!==o.h){n.trigger(j,[o.w=m,o.h=l])}});g()},e[b])}})(jQuery,this);
|
||||
|
||||
(function ($) {
|
||||
var options = { }; // no options
|
||||
|
||||
function init(plot) {
|
||||
function onResize() {
|
||||
var placeholder = plot.getPlaceholder();
|
||||
|
||||
// somebody might have hidden us and we can't plot
|
||||
// when we don't have the dimensions
|
||||
if (placeholder.width() == 0 || placeholder.height() == 0)
|
||||
return;
|
||||
|
||||
plot.resize();
|
||||
plot.setupGrid();
|
||||
plot.draw();
|
||||
}
|
||||
|
||||
function bindEvents(plot, eventHolder) {
|
||||
plot.getPlaceholder().resize(onResize);
|
||||
}
|
||||
|
||||
function shutdown(plot, eventHolder) {
|
||||
plot.getPlaceholder().unbind("resize", onResize);
|
||||
}
|
||||
|
||||
plot.hooks.bindEvents.push(bindEvents);
|
||||
plot.hooks.shutdown.push(shutdown);
|
||||
}
|
||||
|
||||
$.plot.plugins.push({
|
||||
init: init,
|
||||
options: options,
|
||||
name: 'resize',
|
||||
version: '1.0'
|
||||
});
|
||||
})(jQuery);
|
@ -0,0 +1,212 @@
|
||||
/**
|
||||
* Flot plugin that provides spline interpolation for line graphs
|
||||
* author: Alex Bardas < alex.bardas@gmail.com >
|
||||
* modified by: Avi Kohn https://github.com/AMKohn
|
||||
* based on the spline interpolation described at:
|
||||
* http://scaledinnovation.com/analytics/splines/aboutSplines.html
|
||||
*
|
||||
* Example usage: (add in plot options series object)
|
||||
* for linespline:
|
||||
* series: {
|
||||
* ...
|
||||
* lines: {
|
||||
* show: false
|
||||
* },
|
||||
* splines: {
|
||||
* show: true,
|
||||
* tension: x, (float between 0 and 1, defaults to 0.5),
|
||||
* lineWidth: y (number, defaults to 2),
|
||||
* fill: z (float between 0 .. 1 or false, as in flot documentation)
|
||||
* },
|
||||
* ...
|
||||
* }
|
||||
* areaspline:
|
||||
* series: {
|
||||
* ...
|
||||
* lines: {
|
||||
* show: true,
|
||||
* lineWidth: 0, (line drawing will not execute)
|
||||
* fill: x, (float between 0 .. 1, as in flot documentation)
|
||||
* ...
|
||||
* },
|
||||
* splines: {
|
||||
* show: true,
|
||||
* tension: 0.5 (float between 0 and 1)
|
||||
* },
|
||||
* ...
|
||||
* }
|
||||
*
|
||||
*/
|
||||
|
||||
(function($) {
|
||||
'use strict'
|
||||
|
||||
/**
|
||||
* @param {Number} x0, y0, x1, y1: coordinates of the end (knot) points of the segment
|
||||
* @param {Number} x2, y2: the next knot (not connected, but needed to calculate p2)
|
||||
* @param {Number} tension: control how far the control points spread
|
||||
* @return {Array}: p1 -> control point, from x1 back toward x0
|
||||
* p2 -> the next control point, returned to become the next segment's p1
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
function getControlPoints(x0, y0, x1, y1, x2, y2, tension) {
|
||||
|
||||
var pow = Math.pow,
|
||||
sqrt = Math.sqrt,
|
||||
d01, d12, fa, fb, p1x, p1y, p2x, p2y;
|
||||
|
||||
// Scaling factors: distances from this knot to the previous and following knots.
|
||||
d01 = sqrt(pow(x1 - x0, 2) + pow(y1 - y0, 2));
|
||||
d12 = sqrt(pow(x2 - x1, 2) + pow(y2 - y1, 2));
|
||||
|
||||
fa = tension * d01 / (d01 + d12);
|
||||
fb = tension - fa;
|
||||
|
||||
p1x = x1 + fa * (x0 - x2);
|
||||
p1y = y1 + fa * (y0 - y2);
|
||||
|
||||
p2x = x1 - fb * (x0 - x2);
|
||||
p2y = y1 - fb * (y0 - y2);
|
||||
|
||||
return [p1x, p1y, p2x, p2y];
|
||||
}
|
||||
|
||||
var line = [];
|
||||
|
||||
function drawLine(points, ctx, height, fill, seriesColor) {
|
||||
var c = $.color.parse(seriesColor);
|
||||
|
||||
c.a = typeof fill == "number" ? fill : .3;
|
||||
c.normalize();
|
||||
c = c.toString();
|
||||
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(points[0][0], points[0][1]);
|
||||
|
||||
var plength = points.length;
|
||||
|
||||
for (var i = 0; i < plength; i++) {
|
||||
ctx[points[i][3]].apply(ctx, points[i][2]);
|
||||
}
|
||||
|
||||
ctx.stroke();
|
||||
|
||||
ctx.lineWidth = 0;
|
||||
ctx.lineTo(points[plength - 1][0], height);
|
||||
ctx.lineTo(points[0][0], height);
|
||||
|
||||
ctx.closePath();
|
||||
|
||||
if (fill !== false) {
|
||||
ctx.fillStyle = c;
|
||||
ctx.fill();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Object} ctx: canvas context
|
||||
* @param {String} type: accepted strings: 'bezier' or 'quadratic' (defaults to quadratic)
|
||||
* @param {Array} points: 2 points for which to draw the interpolation
|
||||
* @param {Array} cpoints: control points for those segment points
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
function queue(ctx, type, points, cpoints) {
|
||||
if (type === void 0 || (type !== 'bezier' && type !== 'quadratic')) {
|
||||
type = 'quadratic';
|
||||
}
|
||||
type = type + 'CurveTo';
|
||||
|
||||
if (line.length == 0) line.push([points[0], points[1], cpoints.concat(points.slice(2)), type]);
|
||||
else if (type == "quadraticCurveTo" && points.length == 2) {
|
||||
cpoints = cpoints.slice(0, 2).concat(points);
|
||||
|
||||
line.push([points[0], points[1], cpoints, type]);
|
||||
}
|
||||
else line.push([points[2], points[3], cpoints.concat(points.slice(2)), type]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Object} plot
|
||||
* @param {Object} ctx: canvas context
|
||||
* @param {Object} series
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function drawSpline(plot, ctx, series) {
|
||||
// Not interested if spline is not requested
|
||||
if (series.splines.show !== true) {
|
||||
return;
|
||||
}
|
||||
|
||||
var cp = [],
|
||||
// array of control points
|
||||
tension = series.splines.tension || 0.5,
|
||||
idx, x, y, points = series.datapoints.points,
|
||||
ps = series.datapoints.pointsize,
|
||||
plotOffset = plot.getPlotOffset(),
|
||||
len = points.length,
|
||||
pts = [];
|
||||
|
||||
line = [];
|
||||
|
||||
// Cannot display a linespline/areaspline if there are less than 3 points
|
||||
if (len / ps < 4) {
|
||||
$.extend(series.lines, series.splines);
|
||||
return;
|
||||
}
|
||||
|
||||
for (idx = 0; idx < len; idx += ps) {
|
||||
x = points[idx];
|
||||
y = points[idx + 1];
|
||||
if (x == null || x < series.xaxis.min || x > series.xaxis.max || y < series.yaxis.min || y > series.yaxis.max) {
|
||||
continue;
|
||||
}
|
||||
|
||||
pts.push(series.xaxis.p2c(x) + plotOffset.left, series.yaxis.p2c(y) + plotOffset.top);
|
||||
}
|
||||
|
||||
len = pts.length;
|
||||
|
||||
// Draw an open curve, not connected at the ends
|
||||
for (idx = 0; idx < len - 2; idx += 2) {
|
||||
cp = cp.concat(getControlPoints.apply(this, pts.slice(idx, idx + 6).concat([tension])));
|
||||
}
|
||||
|
||||
ctx.save();
|
||||
ctx.strokeStyle = series.color;
|
||||
ctx.lineWidth = series.splines.lineWidth;
|
||||
|
||||
queue(ctx, 'quadratic', pts.slice(0, 4), cp.slice(0, 2));
|
||||
|
||||
for (idx = 2; idx < len - 3; idx += 2) {
|
||||
queue(ctx, 'bezier', pts.slice(idx, idx + 4), cp.slice(2 * idx - 2, 2 * idx + 2));
|
||||
}
|
||||
|
||||
queue(ctx, 'quadratic', pts.slice(len - 2, len), [cp[2 * len - 10], cp[2 * len - 9], pts[len - 4], pts[len - 3]]);
|
||||
|
||||
drawLine(line, ctx, plot.height() + 10, series.splines.fill, series.color);
|
||||
|
||||
ctx.restore();
|
||||
}
|
||||
|
||||
$.plot.plugins.push({
|
||||
init: function(plot) {
|
||||
plot.hooks.drawSeries.push(drawSpline);
|
||||
},
|
||||
options: {
|
||||
series: {
|
||||
splines: {
|
||||
show: false,
|
||||
lineWidth: 2,
|
||||
tension: 0.5,
|
||||
fill: false
|
||||
}
|
||||
}
|
||||
},
|
||||
name: 'spline',
|
||||
version: '0.8.2'
|
||||
});
|
||||
})(jQuery);
|
@ -0,0 +1,71 @@
|
||||
/* Flot plugin that adds some extra symbols for plotting points.
|
||||
|
||||
Copyright (c) 2007-2014 IOLA and Ole Laursen.
|
||||
Licensed under the MIT license.
|
||||
|
||||
The symbols are accessed as strings through the standard symbol options:
|
||||
|
||||
series: {
|
||||
points: {
|
||||
symbol: "square" // or "diamond", "triangle", "cross"
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
(function ($) {
|
||||
function processRawData(plot, series, datapoints) {
|
||||
// we normalize the area of each symbol so it is approximately the
|
||||
// same as a circle of the given radius
|
||||
|
||||
var handlers = {
|
||||
square: function (ctx, x, y, radius, shadow) {
|
||||
// pi * r^2 = (2s)^2 => s = r * sqrt(pi)/2
|
||||
var size = radius * Math.sqrt(Math.PI) / 2;
|
||||
ctx.rect(x - size, y - size, size + size, size + size);
|
||||
},
|
||||
diamond: function (ctx, x, y, radius, shadow) {
|
||||
// pi * r^2 = 2s^2 => s = r * sqrt(pi/2)
|
||||
var size = radius * Math.sqrt(Math.PI / 2);
|
||||
ctx.moveTo(x - size, y);
|
||||
ctx.lineTo(x, y - size);
|
||||
ctx.lineTo(x + size, y);
|
||||
ctx.lineTo(x, y + size);
|
||||
ctx.lineTo(x - size, y);
|
||||
},
|
||||
triangle: function (ctx, x, y, radius, shadow) {
|
||||
// pi * r^2 = 1/2 * s^2 * sin (pi / 3) => s = r * sqrt(2 * pi / sin(pi / 3))
|
||||
var size = radius * Math.sqrt(2 * Math.PI / Math.sin(Math.PI / 3));
|
||||
var height = size * Math.sin(Math.PI / 3);
|
||||
ctx.moveTo(x - size/2, y + height/2);
|
||||
ctx.lineTo(x + size/2, y + height/2);
|
||||
if (!shadow) {
|
||||
ctx.lineTo(x, y - height/2);
|
||||
ctx.lineTo(x - size/2, y + height/2);
|
||||
}
|
||||
},
|
||||
cross: function (ctx, x, y, radius, shadow) {
|
||||
// pi * r^2 = (2s)^2 => s = r * sqrt(pi)/2
|
||||
var size = radius * Math.sqrt(Math.PI) / 2;
|
||||
ctx.moveTo(x - size, y - size);
|
||||
ctx.lineTo(x + size, y + size);
|
||||
ctx.moveTo(x - size, y + size);
|
||||
ctx.lineTo(x + size, y - size);
|
||||
}
|
||||
};
|
||||
|
||||
var s = series.points.symbol;
|
||||
if (handlers[s])
|
||||
series.points.symbol = handlers[s];
|
||||
}
|
||||
|
||||
function init(plot) {
|
||||
plot.hooks.processDatapoints.push(processRawData);
|
||||
}
|
||||
|
||||
$.plot.plugins.push({
|
||||
init: init,
|
||||
name: 'symbols',
|
||||
version: '1.0'
|
||||
});
|
||||
})(jQuery);
|
@ -0,0 +1,12 @@
|
||||
/*
|
||||
* jquery.flot.tooltip
|
||||
*
|
||||
* description: easy-to-use tooltips for Flot charts
|
||||
* version: 0.6.2
|
||||
* author: Krzysztof Urbas @krzysu [myviews.pl]
|
||||
* website: https://github.com/krzysu/flot.tooltip
|
||||
*
|
||||
* build on 2013-09-30
|
||||
* released under MIT License, 2012
|
||||
*/
|
||||
(function(t){var o={tooltip:!1,tooltipOpts:{content:"%s | X: %x | Y: %y",xDateFormat:null,yDateFormat:null,shifts:{x:10,y:20},defaultTheme:!0,onHover:function(){}}},i=function(t){this.tipPosition={x:0,y:0},this.init(t)};i.prototype.init=function(o){function i(t){var o={};o.x=t.pageX,o.y=t.pageY,s.updateTooltipPosition(o)}function e(t,o,i){var e=s.getDomElement();if(i){var n;n=s.stringFormat(s.tooltipOptions.content,i),e.html(n),s.updateTooltipPosition({x:o.pageX,y:o.pageY}),e.css({left:s.tipPosition.x+s.tooltipOptions.shifts.x,top:s.tipPosition.y+s.tooltipOptions.shifts.y}).show(),"function"==typeof s.tooltipOptions.onHover&&s.tooltipOptions.onHover(i,e)}else e.hide().html("")}var s=this;o.hooks.bindEvents.push(function(o,n){s.plotOptions=o.getOptions(),s.plotOptions.tooltip!==!1&&void 0!==s.plotOptions.tooltip&&(s.tooltipOptions=s.plotOptions.tooltipOpts,s.getDomElement(),t(o.getPlaceholder()).bind("plothover",e),t(n).bind("mousemove",i))}),o.hooks.shutdown.push(function(o,s){t(o.getPlaceholder()).unbind("plothover",e),t(s).unbind("mousemove",i)})},i.prototype.getDomElement=function(){var o;return t("#flotTip").length>0?o=t("#flotTip"):(o=t("<div />").attr("id","flotTip"),o.appendTo("body").hide().css({position:"absolute"}),this.tooltipOptions.defaultTheme&&o.css({background:"#fff","z-index":"100",padding:"0.4em 0.6em","border-radius":"0.5em","font-size":"0.8em",border:"1px solid #111",display:"none","white-space":"nowrap"})),o},i.prototype.updateTooltipPosition=function(o){var i=t("#flotTip").outerWidth()+this.tooltipOptions.shifts.x,e=t("#flotTip").outerHeight()+this.tooltipOptions.shifts.y;o.x-t(window).scrollLeft()>t(window).innerWidth()-i&&(o.x-=i),o.y-t(window).scrollTop()>t(window).innerHeight()-e&&(o.y-=e),this.tipPosition.x=o.x,this.tipPosition.y=o.y},i.prototype.stringFormat=function(t,o){var i=/%p\.{0,1}(\d{0,})/,e=/%s/,s=/%x\.{0,1}(?:\d{0,})/,n=/%y\.{0,1}(?:\d{0,})/;return"function"==typeof t&&(t=t(o.series.label,o.series.data[o.dataIndex][0],o.series.data[o.dataIndex][1],o)),o.series.percent!==void 0&&(t=this.adjustValPrecision(i,t,o.series.percent)),o.series.label!==void 0&&(t=t.replace(e,o.series.label)),this.isTimeMode("xaxis",o)&&this.isXDateFormat(o)&&(t=t.replace(s,this.timestampToDate(o.series.data[o.dataIndex][0],this.tooltipOptions.xDateFormat))),this.isTimeMode("yaxis",o)&&this.isYDateFormat(o)&&(t=t.replace(n,this.timestampToDate(o.series.data[o.dataIndex][1],this.tooltipOptions.yDateFormat))),"number"==typeof o.series.data[o.dataIndex][0]&&(t=this.adjustValPrecision(s,t,o.series.data[o.dataIndex][0])),"number"==typeof o.series.data[o.dataIndex][1]&&(t=this.adjustValPrecision(n,t,o.series.data[o.dataIndex][1])),o.series.xaxis.tickFormatter!==void 0&&(t=t.replace(s,o.series.xaxis.tickFormatter(o.series.data[o.dataIndex][0],o.series.xaxis))),o.series.yaxis.tickFormatter!==void 0&&(t=t.replace(n,o.series.yaxis.tickFormatter(o.series.data[o.dataIndex][1],o.series.yaxis))),t},i.prototype.isTimeMode=function(t,o){return o.series[t].options.mode!==void 0&&"time"===o.series[t].options.mode},i.prototype.isXDateFormat=function(){return this.tooltipOptions.xDateFormat!==void 0&&null!==this.tooltipOptions.xDateFormat},i.prototype.isYDateFormat=function(){return this.tooltipOptions.yDateFormat!==void 0&&null!==this.tooltipOptions.yDateFormat},i.prototype.timestampToDate=function(o,i){var e=new Date(o);return t.plot.formatDate(e,i)},i.prototype.adjustValPrecision=function(t,o,i){var e,s=o.match(t);return null!==s&&""!==RegExp.$1&&(e=RegExp.$1,i=i.toFixed(e),o=o.replace(t,i)),o};var e=function(t){new i(t)};t.plot.plugins.push({init:e,options:o,name:"tooltip",version:"0.6.1"})})(jQuery);
|
@ -0,0 +1,182 @@
|
||||
/**
|
||||
* 基于jQuery FullScreen修改
|
||||
* 新增支持IE全屏显示
|
||||
* Copyright (c) 2019 ruoyi
|
||||
*/
|
||||
(function(jQuery) {
|
||||
|
||||
/**
|
||||
* Sets or gets the fullscreen state.
|
||||
*
|
||||
* @param {boolean=} state
|
||||
* True to enable fullscreen mode, false to disable it. If not
|
||||
* specified then the current fullscreen state is returned.
|
||||
* @return {boolean|Element|jQuery|null}
|
||||
* When querying the fullscreen state then the current fullscreen
|
||||
* element (or true if browser doesn't support it) is returned
|
||||
* when browser is currently in full screen mode. False is returned
|
||||
* if browser is not in full screen mode. Null is returned if
|
||||
* browser doesn't support fullscreen mode at all. When setting
|
||||
* the fullscreen state then the current jQuery selection is
|
||||
* returned for chaining.
|
||||
* @this {jQuery}
|
||||
*/
|
||||
function fullScreen(state)
|
||||
{
|
||||
var e, func, doc;
|
||||
|
||||
// Do nothing when nothing was selected
|
||||
if (!this.length) return this;
|
||||
|
||||
// We only use the first selected element because it doesn't make sense
|
||||
// to fullscreen multiple elements.
|
||||
e = (/** @type {Element} */ this[0]);
|
||||
|
||||
// Find the real element and the document (Depends on whether the
|
||||
// document itself or a HTML element was selected)
|
||||
if (e.ownerDocument)
|
||||
{
|
||||
doc = e.ownerDocument;
|
||||
}
|
||||
else
|
||||
{
|
||||
doc = e;
|
||||
e = doc.documentElement;
|
||||
}
|
||||
|
||||
// When no state was specified then return the current state.
|
||||
if (state == null)
|
||||
{
|
||||
// When fullscreen mode is not supported then return null
|
||||
if (!((/** @type {?Function} */ doc["exitFullscreen"])
|
||||
|| (/** @type {?Function} */ doc["webkitExitFullscreen"])
|
||||
|| (/** @type {?Function} */ doc["webkitCancelFullScreen"])
|
||||
|| (/** @type {?Function} */ doc["msExitFullscreen"])
|
||||
|| (/** @type {?Function} */ doc["mozCancelFullScreen"])))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// Check fullscreen state
|
||||
state = !!doc["fullscreenElement"]
|
||||
|| !!doc["msFullscreenElement"]
|
||||
|| !!doc["webkitIsFullScreen"]
|
||||
|| !!doc["mozFullScreen"];
|
||||
if (!state) return state;
|
||||
|
||||
// Return current fullscreen element or "true" if browser doesn't
|
||||
// support this
|
||||
return (/** @type {?Element} */ doc["fullscreenElement"])
|
||||
|| (/** @type {?Element} */ doc["webkitFullscreenElement"])
|
||||
|| (/** @type {?Element} */ doc["webkitCurrentFullScreenElement"])
|
||||
|| (/** @type {?Element} */ doc["msFullscreenElement"])
|
||||
|| (/** @type {?Element} */ doc["mozFullScreenElement"])
|
||||
|| state;
|
||||
}
|
||||
|
||||
// When state was specified then enter or exit fullscreen mode.
|
||||
if (state)
|
||||
{
|
||||
// Enter fullscreen
|
||||
func = (/** @type {?Function} */ e["requestFullscreen"])
|
||||
|| (/** @type {?Function} */ e["webkitRequestFullscreen"])
|
||||
|| (/** @type {?Function} */ e["webkitRequestFullScreen"])
|
||||
|| (/** @type {?Function} */ e["msRequestFullscreen"])
|
||||
|| (/** @type {?Function} */ e["mozRequestFullScreen"]);
|
||||
if (func)
|
||||
{
|
||||
func.call(e);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Exit fullscreen
|
||||
func = (/** @type {?Function} */ doc["exitFullscreen"])
|
||||
|| (/** @type {?Function} */ doc["webkitExitFullscreen"])
|
||||
|| (/** @type {?Function} */ doc["webkitCancelFullScreen"])
|
||||
|| (/** @type {?Function} */ doc["msExitFullscreen"])
|
||||
|| (/** @type {?Function} */ doc["mozCancelFullScreen"]);
|
||||
if (func) func.call(doc);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggles the fullscreen mode.
|
||||
*
|
||||
* @return {!jQuery}
|
||||
* The jQuery selection for chaining.
|
||||
* @this {jQuery}
|
||||
*/
|
||||
function toggleFullScreen()
|
||||
{
|
||||
return (/** @type {!jQuery} */ fullScreen.call(this,
|
||||
!fullScreen.call(this)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the browser-specific fullscreenchange event and triggers
|
||||
* a jquery event for it.
|
||||
*
|
||||
* @param {?Event} event
|
||||
* The fullscreenchange event.
|
||||
*/
|
||||
function fullScreenChangeHandler(event)
|
||||
{
|
||||
jQuery(document).trigger(new jQuery.Event("fullscreenchange"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the browser-specific fullscreenerror event and triggers
|
||||
* a jquery event for it.
|
||||
*
|
||||
* @param {?Event} event
|
||||
* The fullscreenerror event.
|
||||
*/
|
||||
function fullScreenErrorHandler(event)
|
||||
{
|
||||
jQuery(document).trigger(new jQuery.Event("fullscreenerror"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Installs the fullscreenchange event handler.
|
||||
*/
|
||||
function installFullScreenHandlers()
|
||||
{
|
||||
var e, change, error;
|
||||
|
||||
// Determine event name
|
||||
e = document;
|
||||
if (e["webkitCancelFullScreen"])
|
||||
{
|
||||
change = "webkitfullscreenchange";
|
||||
error = "webkitfullscreenerror";
|
||||
}
|
||||
else if (e["msExitFullscreen"])
|
||||
{
|
||||
change = "MSFullscreenChange";
|
||||
error = "MSFullscreenError";
|
||||
}
|
||||
else if (e["mozCancelFullScreen"])
|
||||
{
|
||||
change = "mozfullscreenchange";
|
||||
error = "mozfullscreenerror";
|
||||
}
|
||||
else
|
||||
{
|
||||
change = "fullscreenchange";
|
||||
error = "fullscreenerror";
|
||||
}
|
||||
|
||||
// Install the event handlers
|
||||
jQuery(document).bind(change, fullScreenChangeHandler);
|
||||
jQuery(document).bind(error, fullScreenErrorHandler);
|
||||
}
|
||||
|
||||
jQuery.fn["fullScreen"] = fullScreen;
|
||||
jQuery.fn["toggleFullScreen"] = toggleFullScreen;
|
||||
installFullScreenHandlers();
|
||||
|
||||
})(jQuery);
|
||||
|
@ -0,0 +1,72 @@
|
||||
/* iCheck plugin Square skin, green
|
||||
----------------------------------- */
|
||||
.icheckbox_square-green,
|
||||
.iradio_square-green {
|
||||
display: inline-block;
|
||||
*display: inline;
|
||||
vertical-align: middle;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
background: url(green.png) no-repeat;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.icheckbox_square-green-login{
|
||||
display: inline-block;
|
||||
*display: inline;
|
||||
vertical-align: middle;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
background: url(green-login.png) no-repeat;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.icheckbox_square-green,.icheckbox_square-green-login {
|
||||
background-position: 0 0;
|
||||
}
|
||||
.icheckbox_square-green.hover,.icheckbox_square-green-login.hover {
|
||||
background-position: -24px 0;
|
||||
}
|
||||
.icheckbox_square-green.checked,.icheckbox_square-green-login.checked {
|
||||
background-position: -48px 0;
|
||||
}
|
||||
.icheckbox_square-green.disabled,.icheckbox_square-green.disabled-login {
|
||||
background-position: -72px 0;
|
||||
cursor: default;
|
||||
}
|
||||
.icheckbox_square-green.checked.disabled,.icheckbox_square-green-login.checked.disabled {
|
||||
background-position: -96px 0;
|
||||
}
|
||||
|
||||
.iradio_square-green {
|
||||
background-position: -120px 0;
|
||||
}
|
||||
.iradio_square-green.hover {
|
||||
background-position: -144px 0;
|
||||
}
|
||||
.iradio_square-green.checked {
|
||||
background-position: -168px 0;
|
||||
}
|
||||
.iradio_square-green.disabled {
|
||||
background-position: -192px 0;
|
||||
cursor: default;
|
||||
}
|
||||
.iradio_square-green.checked.disabled {
|
||||
background-position: -216px 0;
|
||||
}
|
||||
|
||||
/* HiDPI support */
|
||||
@media (-o-min-device-pixel-ratio: 5/4), (-webkit-min-device-pixel-ratio: 1.25), (min-resolution: 120dpi) {
|
||||
.icheckbox_square-green,.icheckbox_square-green-login,
|
||||
.iradio_square-green {
|
||||
background-image: url(green%402x.png);
|
||||
-webkit-background-size: 240px 24px;
|
||||
background-size: 240px 24px;
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 7.5 KiB |
@ -0,0 +1,11 @@
|
||||
/*! iCheck v1.0.2 by Damir Sultanov, http://git.io/arlzeA, MIT Licensed */
|
||||
(function(f){function A(a,b,d){var c=a[0],g=/er/.test(d)?_indeterminate:/bl/.test(d)?n:k,e=d==_update?{checked:c[k],disabled:c[n],indeterminate:"true"==a.attr(_indeterminate)||"false"==a.attr(_determinate)}:c[g];if(/^(ch|di|in)/.test(d)&&!e)x(a,g);else if(/^(un|en|de)/.test(d)&&e)q(a,g);else if(d==_update)for(var f in e)e[f]?x(a,f,!0):q(a,f,!0);else if(!b||"toggle"==d){if(!b)a[_callback]("ifClicked");e?c[_type]!==r&&q(a,g):x(a,g)}}function x(a,b,d){var c=a[0],g=a.parent(),e=b==k,u=b==_indeterminate,
|
||||
v=b==n,s=u?_determinate:e?y:"enabled",F=l(a,s+t(c[_type])),B=l(a,b+t(c[_type]));if(!0!==c[b]){if(!d&&b==k&&c[_type]==r&&c.name){var w=a.closest("form"),p='input[name="'+c.name+'"]',p=w.length?w.find(p):f(p);p.each(function(){this!==c&&f(this).data(m)&&q(f(this),b)})}u?(c[b]=!0,c[k]&&q(a,k,"force")):(d||(c[b]=!0),e&&c[_indeterminate]&&q(a,_indeterminate,!1));D(a,e,b,d)}c[n]&&l(a,_cursor,!0)&&g.find("."+C).css(_cursor,"default");g[_add](B||l(a,b)||"");g.attr("role")&&!u&&g.attr("aria-"+(v?n:k),"true");
|
||||
g[_remove](F||l(a,s)||"")}function q(a,b,d){var c=a[0],g=a.parent(),e=b==k,f=b==_indeterminate,m=b==n,s=f?_determinate:e?y:"enabled",q=l(a,s+t(c[_type])),r=l(a,b+t(c[_type]));if(!1!==c[b]){if(f||!d||"force"==d)c[b]=!1;D(a,e,s,d)}!c[n]&&l(a,_cursor,!0)&&g.find("."+C).css(_cursor,"pointer");g[_remove](r||l(a,b)||"");g.attr("role")&&!f&&g.attr("aria-"+(m?n:k),"false");g[_add](q||l(a,s)||"")}function E(a,b){if(a.data(m)){a.parent().html(a.attr("style",a.data(m).s||""));if(b)a[_callback](b);a.off(".i").unwrap();
|
||||
f(_label+'[for="'+a[0].id+'"]').add(a.closest(_label)).off(".i")}}function l(a,b,f){if(a.data(m))return a.data(m).o[b+(f?"":"Class")]}function t(a){return a.charAt(0).toUpperCase()+a.slice(1)}function D(a,b,f,c){if(!c){if(b)a[_callback]("ifToggled");a[_callback]("ifChanged")[_callback]("if"+t(f))}}var m="iCheck",C=m+"-helper",r="radio",k="checked",y="un"+k,n="disabled";_determinate="determinate";_indeterminate="in"+_determinate;_update="update";_type="type";_click="click";_touch="touchbegin.i touchend.i";
|
||||
_add="addClass";_remove="removeClass";_callback="trigger";_label="label";_cursor="cursor";_mobile=/ipad|iphone|ipod|android|blackberry|windows phone|opera mini|silk/i.test(navigator.userAgent);f.fn[m]=function(a,b){var d='input[type="checkbox"], input[type="'+r+'"]',c=f(),g=function(a){a.each(function(){var a=f(this);c=a.is(d)?c.add(a):c.add(a.find(d))})};if(/^(check|uncheck|toggle|indeterminate|determinate|disable|enable|update|destroy)$/i.test(a))return a=a.toLowerCase(),g(this),c.each(function(){var c=
|
||||
f(this);"destroy"==a?E(c,"ifDestroyed"):A(c,!0,a);f.isFunction(b)&&b()});if("object"!=typeof a&&a)return this;var e=f.extend({checkedClass:k,disabledClass:n,indeterminateClass:_indeterminate,labelHover:!0},a),l=e.handle,v=e.hoverClass||"hover",s=e.focusClass||"focus",t=e.activeClass||"active",B=!!e.labelHover,w=e.labelHoverClass||"hover",p=(""+e.increaseArea).replace("%","")|0;if("checkbox"==l||l==r)d='input[type="'+l+'"]';-50>p&&(p=-50);g(this);return c.each(function(){var a=f(this);E(a);var c=this,
|
||||
b=c.id,g=-p+"%",d=100+2*p+"%",d={position:"absolute",top:g,left:g,display:"block",width:d,height:d,margin:0,padding:0,background:"#fff",border:0,opacity:0},g=_mobile?{position:"absolute",visibility:"hidden"}:p?d:{position:"absolute",opacity:0},l="checkbox"==c[_type]?e.checkboxClass||"icheckbox":e.radioClass||"i"+r,z=f(_label+'[for="'+b+'"]').add(a.closest(_label)),u=!!e.aria,y=m+"-"+Math.random().toString(36).substr(2,6),h='<div class="'+l+'" '+(u?'role="'+c[_type]+'" ':"");u&&z.each(function(){h+=
|
||||
'aria-labelledby="';this.id?h+=this.id:(this.id=y,h+=y);h+='"'});h=a.wrap(h+"/>")[_callback]("ifCreated").parent().append(e.insert);d=f('<ins class="'+C+'"/>').css(d).appendTo(h);a.data(m,{o:e,s:a.attr("style")}).css(g);e.inheritClass&&h[_add](c.className||"");e.inheritID&&b&&h.attr("id",m+"-"+b);"static"==h.css("position")&&h.css("position","relative");A(a,!0,_update);if(z.length)z.on(_click+".i mouseover.i mouseout.i "+_touch,function(b){var d=b[_type],e=f(this);if(!c[n]){if(d==_click){if(f(b.target).is("a"))return;
|
||||
A(a,!1,!0)}else B&&(/ut|nd/.test(d)?(h[_remove](v),e[_remove](w)):(h[_add](v),e[_add](w)));if(_mobile)b.stopPropagation();else return!1}});a.on(_click+".i focus.i blur.i keyup.i keydown.i keypress.i",function(b){var d=b[_type];b=b.keyCode;if(d==_click)return!1;if("keydown"==d&&32==b)return c[_type]==r&&c[k]||(c[k]?q(a,k):x(a,k)),!1;if("keyup"==d&&c[_type]==r)!c[k]&&x(a,k);else if(/us|ur/.test(d))h["blur"==d?_remove:_add](s)});d.on(_click+" mousedown mouseup mouseover mouseout "+_touch,function(b){var d=
|
||||
b[_type],e=/wn|up/.test(d)?t:v;if(!c[n]){if(d==_click)A(a,!1,!0);else{if(/wn|er|in/.test(d))h[_add](e);else h[_remove](e+" "+t);if(z.length&&B&&e==v)z[/ut|nd/.test(d)?_remove:_add](w)}if(_mobile)b.stopPropagation();else return!1}})})}})(window.jQuery||window.Zepto);
|
@ -0,0 +1,621 @@
|
||||
/*!
|
||||
* Jasny Bootstrap v3.1.3 (http://jasny.github.io/bootstrap)
|
||||
* Copyright 2012-2014 Arnold Daniels
|
||||
* Licensed under Apache-2.0 (https://github.com/jasny/bootstrap/blob/master/LICENSE)
|
||||
*/
|
||||
|
||||
.container-smooth {
|
||||
max-width: 1170px;
|
||||
}
|
||||
@media (min-width: 1px) {
|
||||
.container-smooth {
|
||||
width: auto;
|
||||
}
|
||||
}
|
||||
.btn-labeled {
|
||||
padding-top: 0;
|
||||
padding-bottom: 0;
|
||||
}
|
||||
.btn-label {
|
||||
position: relative;
|
||||
left: -12px;
|
||||
display: inline-block;
|
||||
padding: 6px 12px;
|
||||
background: transparent;
|
||||
background: rgba(0, 0, 0, .15);
|
||||
border-radius: 3px 0 0 3px;
|
||||
}
|
||||
.btn-label.btn-label-right {
|
||||
right: -12px;
|
||||
left: auto;
|
||||
border-radius: 0 3px 3px 0;
|
||||
}
|
||||
.btn-lg .btn-label {
|
||||
left: -16px;
|
||||
padding: 10px 16px;
|
||||
border-radius: 5px 0 0 5px;
|
||||
}
|
||||
.btn-lg .btn-label.btn-label-right {
|
||||
right: -16px;
|
||||
left: auto;
|
||||
border-radius: 0 5px 5px 0;
|
||||
}
|
||||
.btn-sm .btn-label {
|
||||
left: -10px;
|
||||
padding: 5px 10px;
|
||||
border-radius: 2px 0 0 2px;
|
||||
}
|
||||
.btn-sm .btn-label.btn-label-right {
|
||||
right: -10px;
|
||||
left: auto;
|
||||
border-radius: 0 2px 2px 0;
|
||||
}
|
||||
.btn-xs .btn-label {
|
||||
left: -5px;
|
||||
padding: 1px 5px;
|
||||
border-radius: 2px 0 0 2px;
|
||||
}
|
||||
.btn-xs .btn-label.btn-label-right {
|
||||
right: -5px;
|
||||
left: auto;
|
||||
border-radius: 0 2px 2px 0;
|
||||
}
|
||||
.nav-tabs-bottom {
|
||||
border-top: 1px solid #ddd;
|
||||
border-bottom: 0;
|
||||
}
|
||||
.nav-tabs-bottom > li {
|
||||
margin-top: -1px;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.nav-tabs-bottom > li > a {
|
||||
border-radius: 0 0 4px 4px;
|
||||
}
|
||||
.nav-tabs-bottom > li > a:hover,
|
||||
.nav-tabs-bottom > li > a:focus,
|
||||
.nav-tabs-bottom > li.active > a,
|
||||
.nav-tabs-bottom > li.active > a:hover,
|
||||
.nav-tabs-bottom > li.active > a:focus {
|
||||
border: 1px solid #ddd;
|
||||
border-top-color: transparent;
|
||||
}
|
||||
.nav-tabs-left {
|
||||
border-right: 1px solid #ddd;
|
||||
border-bottom: 0;
|
||||
}
|
||||
.nav-tabs-left > li {
|
||||
float: none;
|
||||
margin-right: -1px;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.nav-tabs-left > li > a {
|
||||
margin-right: 0;
|
||||
margin-bottom: 2px;
|
||||
border-radius: 4px 0 0 4px;
|
||||
}
|
||||
.nav-tabs-left > li > a:hover,
|
||||
.nav-tabs-left > li > a:focus,
|
||||
.nav-tabs-left > li.active > a,
|
||||
.nav-tabs-left > li.active > a:hover,
|
||||
.nav-tabs-left > li.active > a:focus {
|
||||
border: 1px solid #ddd;
|
||||
border-right-color: transparent;
|
||||
}
|
||||
.row > .nav-tabs-left {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
padding-right: 0;
|
||||
padding-left: 15px;
|
||||
margin-right: -1px;
|
||||
}
|
||||
.row > .nav-tabs-left + .tab-content {
|
||||
border-left: 1px solid #ddd;
|
||||
}
|
||||
.nav-tabs-right {
|
||||
border-bottom: 0;
|
||||
border-left: 1px solid #ddd;
|
||||
}
|
||||
.nav-tabs-right > li {
|
||||
float: none;
|
||||
margin-bottom: 0;
|
||||
margin-left: -1px;
|
||||
}
|
||||
.nav-tabs-right > li > a {
|
||||
margin-bottom: 2px;
|
||||
margin-left: 0;
|
||||
border-radius: 0 4px 4px 0;
|
||||
}
|
||||
.nav-tabs-right > li > a:hover,
|
||||
.nav-tabs-right > li > a:focus,
|
||||
.nav-tabs-right > li.active > a,
|
||||
.nav-tabs-right > li.active > a:hover,
|
||||
.nav-tabs-right > li.active > a:focus {
|
||||
border: 1px solid #ddd;
|
||||
border-left-color: transparent;
|
||||
}
|
||||
.row > .nav-tabs-right {
|
||||
padding-right: 15px;
|
||||
padding-left: 0;
|
||||
}
|
||||
.navmenu,
|
||||
.navbar-offcanvas {
|
||||
width: 300px;
|
||||
height: auto;
|
||||
border-style: solid;
|
||||
border-width: 1px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
.navmenu-fixed-left,
|
||||
.navmenu-fixed-right,
|
||||
.navbar-offcanvas {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
z-index: 1030;
|
||||
overflow-y: auto;
|
||||
border-radius: 0;
|
||||
}
|
||||
.navmenu-fixed-left,
|
||||
.navbar-offcanvas.navmenu-fixed-left {
|
||||
right: auto;
|
||||
left: 0;
|
||||
border-width: 0 1px 0 0;
|
||||
}
|
||||
.navmenu-fixed-right,
|
||||
.navbar-offcanvas {
|
||||
right: 0;
|
||||
left: auto;
|
||||
border-width: 0 0 0 1px;
|
||||
}
|
||||
.navmenu-nav {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.navmenu-nav.dropdown-menu {
|
||||
position: static;
|
||||
float: none;
|
||||
padding-top: 0;
|
||||
margin: 0;
|
||||
border: none;
|
||||
border-radius: 0;
|
||||
-webkit-box-shadow: none;
|
||||
box-shadow: none;
|
||||
}
|
||||
.navbar-offcanvas .navbar-nav {
|
||||
margin: 0;
|
||||
}
|
||||
@media (min-width: 768px) {
|
||||
.navbar-offcanvas {
|
||||
width: auto;
|
||||
border-top: 0;
|
||||
box-shadow: none;
|
||||
}
|
||||
.navbar-offcanvas.offcanvas {
|
||||
position: static;
|
||||
display: block !important;
|
||||
height: auto !important;
|
||||
padding-bottom: 0;
|
||||
overflow: visible !important;
|
||||
}
|
||||
.navbar-offcanvas .navbar-nav.navbar-left:first-child {
|
||||
margin-left: -15px;
|
||||
}
|
||||
.navbar-offcanvas .navbar-nav.navbar-right:last-child {
|
||||
margin-right: -15px;
|
||||
}
|
||||
.navbar-offcanvas .navmenu-brand {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
.navmenu-brand {
|
||||
display: block;
|
||||
padding: 10px 15px;
|
||||
margin: 10px 0;
|
||||
font-size: 18px;
|
||||
line-height: 20px;
|
||||
}
|
||||
.navmenu-brand:hover,
|
||||
.navmenu-brand:focus {
|
||||
text-decoration: none;
|
||||
}
|
||||
.navmenu-default,
|
||||
.navbar-default .navbar-offcanvas {
|
||||
background-color: #f8f8f8;
|
||||
border-color: #e7e7e7;
|
||||
}
|
||||
.navmenu-default .navmenu-brand,
|
||||
.navbar-default .navbar-offcanvas .navmenu-brand {
|
||||
color: #777;
|
||||
}
|
||||
.navmenu-default .navmenu-brand:hover,
|
||||
.navbar-default .navbar-offcanvas .navmenu-brand:hover,
|
||||
.navmenu-default .navmenu-brand:focus,
|
||||
.navbar-default .navbar-offcanvas .navmenu-brand:focus {
|
||||
color: #5e5e5e;
|
||||
background-color: transparent;
|
||||
}
|
||||
.navmenu-default .navmenu-text,
|
||||
.navbar-default .navbar-offcanvas .navmenu-text {
|
||||
color: #777;
|
||||
}
|
||||
.navmenu-default .navmenu-nav > .dropdown > a:hover .caret,
|
||||
.navbar-default .navbar-offcanvas .navmenu-nav > .dropdown > a:hover .caret,
|
||||
.navmenu-default .navmenu-nav > .dropdown > a:focus .caret,
|
||||
.navbar-default .navbar-offcanvas .navmenu-nav > .dropdown > a:focus .caret {
|
||||
border-top-color: #333;
|
||||
border-bottom-color: #333;
|
||||
}
|
||||
.navmenu-default .navmenu-nav > .open > a,
|
||||
.navbar-default .navbar-offcanvas .navmenu-nav > .open > a,
|
||||
.navmenu-default .navmenu-nav > .open > a:hover,
|
||||
.navbar-default .navbar-offcanvas .navmenu-nav > .open > a:hover,
|
||||
.navmenu-default .navmenu-nav > .open > a:focus,
|
||||
.navbar-default .navbar-offcanvas .navmenu-nav > .open > a:focus {
|
||||
color: #555;
|
||||
background-color: #e7e7e7;
|
||||
}
|
||||
.navmenu-default .navmenu-nav > .open > a .caret,
|
||||
.navbar-default .navbar-offcanvas .navmenu-nav > .open > a .caret,
|
||||
.navmenu-default .navmenu-nav > .open > a:hover .caret,
|
||||
.navbar-default .navbar-offcanvas .navmenu-nav > .open > a:hover .caret,
|
||||
.navmenu-default .navmenu-nav > .open > a:focus .caret,
|
||||
.navbar-default .navbar-offcanvas .navmenu-nav > .open > a:focus .caret {
|
||||
border-top-color: #555;
|
||||
border-bottom-color: #555;
|
||||
}
|
||||
.navmenu-default .navmenu-nav > .dropdown > a .caret,
|
||||
.navbar-default .navbar-offcanvas .navmenu-nav > .dropdown > a .caret {
|
||||
border-top-color: #777;
|
||||
border-bottom-color: #777;
|
||||
}
|
||||
.navmenu-default .navmenu-nav.dropdown-menu,
|
||||
.navbar-default .navbar-offcanvas .navmenu-nav.dropdown-menu {
|
||||
background-color: #e7e7e7;
|
||||
}
|
||||
.navmenu-default .navmenu-nav.dropdown-menu > .divider,
|
||||
.navbar-default .navbar-offcanvas .navmenu-nav.dropdown-menu > .divider {
|
||||
background-color: #f8f8f8;
|
||||
}
|
||||
.navmenu-default .navmenu-nav.dropdown-menu > .active > a,
|
||||
.navbar-default .navbar-offcanvas .navmenu-nav.dropdown-menu > .active > a,
|
||||
.navmenu-default .navmenu-nav.dropdown-menu > .active > a:hover,
|
||||
.navbar-default .navbar-offcanvas .navmenu-nav.dropdown-menu > .active > a:hover,
|
||||
.navmenu-default .navmenu-nav.dropdown-menu > .active > a:focus,
|
||||
.navbar-default .navbar-offcanvas .navmenu-nav.dropdown-menu > .active > a:focus {
|
||||
background-color: #d7d7d7;
|
||||
}
|
||||
.navmenu-default .navmenu-nav > li > a,
|
||||
.navbar-default .navbar-offcanvas .navmenu-nav > li > a {
|
||||
color: #777;
|
||||
}
|
||||
.navmenu-default .navmenu-nav > li > a:hover,
|
||||
.navbar-default .navbar-offcanvas .navmenu-nav > li > a:hover,
|
||||
.navmenu-default .navmenu-nav > li > a:focus,
|
||||
.navbar-default .navbar-offcanvas .navmenu-nav > li > a:focus {
|
||||
color: #333;
|
||||
background-color: transparent;
|
||||
}
|
||||
.navmenu-default .navmenu-nav > .active > a,
|
||||
.navbar-default .navbar-offcanvas .navmenu-nav > .active > a,
|
||||
.navmenu-default .navmenu-nav > .active > a:hover,
|
||||
.navbar-default .navbar-offcanvas .navmenu-nav > .active > a:hover,
|
||||
.navmenu-default .navmenu-nav > .active > a:focus,
|
||||
.navbar-default .navbar-offcanvas .navmenu-nav > .active > a:focus {
|
||||
color: #555;
|
||||
background-color: #e7e7e7;
|
||||
}
|
||||
.navmenu-default .navmenu-nav > .disabled > a,
|
||||
.navbar-default .navbar-offcanvas .navmenu-nav > .disabled > a,
|
||||
.navmenu-default .navmenu-nav > .disabled > a:hover,
|
||||
.navbar-default .navbar-offcanvas .navmenu-nav > .disabled > a:hover,
|
||||
.navmenu-default .navmenu-nav > .disabled > a:focus,
|
||||
.navbar-default .navbar-offcanvas .navmenu-nav > .disabled > a:focus {
|
||||
color: #ccc;
|
||||
background-color: transparent;
|
||||
}
|
||||
.navmenu-inverse,
|
||||
.navbar-inverse .navbar-offcanvas {
|
||||
background-color: #222;
|
||||
border-color: #080808;
|
||||
}
|
||||
.navmenu-inverse .navmenu-brand,
|
||||
.navbar-inverse .navbar-offcanvas .navmenu-brand {
|
||||
color: #999;
|
||||
}
|
||||
.navmenu-inverse .navmenu-brand:hover,
|
||||
.navbar-inverse .navbar-offcanvas .navmenu-brand:hover,
|
||||
.navmenu-inverse .navmenu-brand:focus,
|
||||
.navbar-inverse .navbar-offcanvas .navmenu-brand:focus {
|
||||
color: #fff;
|
||||
background-color: transparent;
|
||||
}
|
||||
.navmenu-inverse .navmenu-text,
|
||||
.navbar-inverse .navbar-offcanvas .navmenu-text {
|
||||
color: #999;
|
||||
}
|
||||
.navmenu-inverse .navmenu-nav > .dropdown > a:hover .caret,
|
||||
.navbar-inverse .navbar-offcanvas .navmenu-nav > .dropdown > a:hover .caret,
|
||||
.navmenu-inverse .navmenu-nav > .dropdown > a:focus .caret,
|
||||
.navbar-inverse .navbar-offcanvas .navmenu-nav > .dropdown > a:focus .caret {
|
||||
border-top-color: #fff;
|
||||
border-bottom-color: #fff;
|
||||
}
|
||||
.navmenu-inverse .navmenu-nav > .open > a,
|
||||
.navbar-inverse .navbar-offcanvas .navmenu-nav > .open > a,
|
||||
.navmenu-inverse .navmenu-nav > .open > a:hover,
|
||||
.navbar-inverse .navbar-offcanvas .navmenu-nav > .open > a:hover,
|
||||
.navmenu-inverse .navmenu-nav > .open > a:focus,
|
||||
.navbar-inverse .navbar-offcanvas .navmenu-nav > .open > a:focus {
|
||||
color: #fff;
|
||||
background-color: #080808;
|
||||
}
|
||||
.navmenu-inverse .navmenu-nav > .open > a .caret,
|
||||
.navbar-inverse .navbar-offcanvas .navmenu-nav > .open > a .caret,
|
||||
.navmenu-inverse .navmenu-nav > .open > a:hover .caret,
|
||||
.navbar-inverse .navbar-offcanvas .navmenu-nav > .open > a:hover .caret,
|
||||
.navmenu-inverse .navmenu-nav > .open > a:focus .caret,
|
||||
.navbar-inverse .navbar-offcanvas .navmenu-nav > .open > a:focus .caret {
|
||||
border-top-color: #fff;
|
||||
border-bottom-color: #fff;
|
||||
}
|
||||
.navmenu-inverse .navmenu-nav > .dropdown > a .caret,
|
||||
.navbar-inverse .navbar-offcanvas .navmenu-nav > .dropdown > a .caret {
|
||||
border-top-color: #999;
|
||||
border-bottom-color: #999;
|
||||
}
|
||||
.navmenu-inverse .navmenu-nav.dropdown-menu,
|
||||
.navbar-inverse .navbar-offcanvas .navmenu-nav.dropdown-menu {
|
||||
background-color: #080808;
|
||||
}
|
||||
.navmenu-inverse .navmenu-nav.dropdown-menu > .divider,
|
||||
.navbar-inverse .navbar-offcanvas .navmenu-nav.dropdown-menu > .divider {
|
||||
background-color: #222;
|
||||
}
|
||||
.navmenu-inverse .navmenu-nav.dropdown-menu > .active > a,
|
||||
.navbar-inverse .navbar-offcanvas .navmenu-nav.dropdown-menu > .active > a,
|
||||
.navmenu-inverse .navmenu-nav.dropdown-menu > .active > a:hover,
|
||||
.navbar-inverse .navbar-offcanvas .navmenu-nav.dropdown-menu > .active > a:hover,
|
||||
.navmenu-inverse .navmenu-nav.dropdown-menu > .active > a:focus,
|
||||
.navbar-inverse .navbar-offcanvas .navmenu-nav.dropdown-menu > .active > a:focus {
|
||||
background-color: #000;
|
||||
}
|
||||
.navmenu-inverse .navmenu-nav > li > a,
|
||||
.navbar-inverse .navbar-offcanvas .navmenu-nav > li > a {
|
||||
color: #999;
|
||||
}
|
||||
.navmenu-inverse .navmenu-nav > li > a:hover,
|
||||
.navbar-inverse .navbar-offcanvas .navmenu-nav > li > a:hover,
|
||||
.navmenu-inverse .navmenu-nav > li > a:focus,
|
||||
.navbar-inverse .navbar-offcanvas .navmenu-nav > li > a:focus {
|
||||
color: #fff;
|
||||
background-color: transparent;
|
||||
}
|
||||
.navmenu-inverse .navmenu-nav > .active > a,
|
||||
.navbar-inverse .navbar-offcanvas .navmenu-nav > .active > a,
|
||||
.navmenu-inverse .navmenu-nav > .active > a:hover,
|
||||
.navbar-inverse .navbar-offcanvas .navmenu-nav > .active > a:hover,
|
||||
.navmenu-inverse .navmenu-nav > .active > a:focus,
|
||||
.navbar-inverse .navbar-offcanvas .navmenu-nav > .active > a:focus {
|
||||
color: #fff;
|
||||
background-color: #080808;
|
||||
}
|
||||
.navmenu-inverse .navmenu-nav > .disabled > a,
|
||||
.navbar-inverse .navbar-offcanvas .navmenu-nav > .disabled > a,
|
||||
.navmenu-inverse .navmenu-nav > .disabled > a:hover,
|
||||
.navbar-inverse .navbar-offcanvas .navmenu-nav > .disabled > a:hover,
|
||||
.navmenu-inverse .navmenu-nav > .disabled > a:focus,
|
||||
.navbar-inverse .navbar-offcanvas .navmenu-nav > .disabled > a:focus {
|
||||
color: #444;
|
||||
background-color: transparent;
|
||||
}
|
||||
.alert-fixed-top,
|
||||
.alert-fixed-bottom {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
z-index: 1035;
|
||||
width: 100%;
|
||||
margin: 0;
|
||||
border-radius: 0;
|
||||
}
|
||||
@media (min-width: 992px) {
|
||||
.alert-fixed-top,
|
||||
.alert-fixed-bottom {
|
||||
left: 50%;
|
||||
width: 992px;
|
||||
margin-left: -496px;
|
||||
}
|
||||
}
|
||||
.alert-fixed-top {
|
||||
top: 0;
|
||||
border-width: 0 0 1px 0;
|
||||
}
|
||||
@media (min-width: 992px) {
|
||||
.alert-fixed-top {
|
||||
border-width: 0 1px 1px 1px;
|
||||
border-bottom-right-radius: 4px;
|
||||
border-bottom-left-radius: 4px;
|
||||
}
|
||||
}
|
||||
.alert-fixed-bottom {
|
||||
bottom: 0;
|
||||
border-width: 1px 0 0 0;
|
||||
}
|
||||
@media (min-width: 992px) {
|
||||
.alert-fixed-bottom {
|
||||
border-width: 1px 1px 0 1px;
|
||||
border-top-left-radius: 4px;
|
||||
border-top-right-radius: 4px;
|
||||
}
|
||||
}
|
||||
.offcanvas {
|
||||
display: none;
|
||||
}
|
||||
.offcanvas.in {
|
||||
display: block;
|
||||
}
|
||||
@media (max-width: 767px) {
|
||||
.offcanvas-xs {
|
||||
display: none;
|
||||
}
|
||||
.offcanvas-xs.in {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
@media (max-width: 991px) {
|
||||
.offcanvas-sm {
|
||||
display: none;
|
||||
}
|
||||
.offcanvas-sm.in {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
@media (max-width: 1199px) {
|
||||
.offcanvas-md {
|
||||
display: none;
|
||||
}
|
||||
.offcanvas-md.in {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
.offcanvas-lg {
|
||||
display: none;
|
||||
}
|
||||
.offcanvas-lg.in {
|
||||
display: block;
|
||||
}
|
||||
.canvas-sliding {
|
||||
-webkit-transition: top .35s, left .35s, bottom .35s, right .35s;
|
||||
transition: top .35s, left .35s, bottom .35s, right .35s;
|
||||
}
|
||||
.offcanvas-clone {
|
||||
position: absolute !important;
|
||||
top: auto !important;
|
||||
right: 0 !important;
|
||||
bottom: 0 !important;
|
||||
left: auto !important;
|
||||
width: 0 !important;
|
||||
height: 0 !important;
|
||||
padding: 0 !important;
|
||||
margin: 0 !important;
|
||||
overflow: hidden !important;
|
||||
border: none !important;
|
||||
opacity: 0 !important;
|
||||
}
|
||||
.table.rowlink td:not(.rowlink-skip),
|
||||
.table .rowlink td:not(.rowlink-skip) {
|
||||
cursor: pointer;
|
||||
}
|
||||
.table.rowlink td:not(.rowlink-skip) a,
|
||||
.table .rowlink td:not(.rowlink-skip) a {
|
||||
font: inherit;
|
||||
color: inherit;
|
||||
text-decoration: inherit;
|
||||
}
|
||||
.table-hover.rowlink tr:hover td,
|
||||
.table-hover .rowlink tr:hover td {
|
||||
background-color: #cfcfcf;
|
||||
}
|
||||
.btn-file {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.btn-file > input {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
font-size: 23px;
|
||||
cursor: pointer;
|
||||
filter: alpha(opacity=0);
|
||||
opacity: 0;
|
||||
|
||||
direction: ltr;
|
||||
}
|
||||
.fileinput {
|
||||
display: inline-block;
|
||||
margin-bottom: 9px;
|
||||
}
|
||||
.fileinput .form-control {
|
||||
display: inline-block;
|
||||
padding-top: 7px;
|
||||
padding-bottom: 5px;
|
||||
margin-bottom: 0;
|
||||
vertical-align: middle;
|
||||
cursor: text;
|
||||
}
|
||||
.fileinput .thumbnail {
|
||||
display: inline-block;
|
||||
margin-bottom: 5px;
|
||||
overflow: hidden;
|
||||
text-align: center;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.fileinput .thumbnail > img {
|
||||
max-height: 100%;
|
||||
}
|
||||
.fileinput .btn {
|
||||
vertical-align: middle;
|
||||
}
|
||||
.fileinput-exists .fileinput-new,
|
||||
.fileinput-new .fileinput-exists {
|
||||
display: none;
|
||||
}
|
||||
.fileinput-inline .fileinput-controls {
|
||||
display: inline;
|
||||
}
|
||||
.fileinput-filename {
|
||||
display: inline-block;
|
||||
overflow: hidden;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.form-control .fileinput-filename {
|
||||
vertical-align: bottom;
|
||||
}
|
||||
.fileinput.input-group {
|
||||
display: table;
|
||||
}
|
||||
.fileinput.input-group > * {
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
}
|
||||
.fileinput.input-group > .btn-file {
|
||||
z-index: 1;
|
||||
}
|
||||
.fileinput-new.input-group .btn-file,
|
||||
.fileinput-new .input-group .btn-file {
|
||||
border-radius: 0 4px 4px 0;
|
||||
}
|
||||
.fileinput-new.input-group .btn-file.btn-xs,
|
||||
.fileinput-new .input-group .btn-file.btn-xs,
|
||||
.fileinput-new.input-group .btn-file.btn-sm,
|
||||
.fileinput-new .input-group .btn-file.btn-sm {
|
||||
border-radius: 0 3px 3px 0;
|
||||
}
|
||||
.fileinput-new.input-group .btn-file.btn-lg,
|
||||
.fileinput-new .input-group .btn-file.btn-lg {
|
||||
border-radius: 0 6px 6px 0;
|
||||
}
|
||||
.form-group.has-warning .fileinput .fileinput-preview {
|
||||
color: #8a6d3b;
|
||||
}
|
||||
.form-group.has-warning .fileinput .thumbnail {
|
||||
border-color: #faebcc;
|
||||
}
|
||||
.form-group.has-error .fileinput .fileinput-preview {
|
||||
color: #a94442;
|
||||
}
|
||||
.form-group.has-error .fileinput .thumbnail {
|
||||
border-color: #ebccd1;
|
||||
}
|
||||
.form-group.has-success .fileinput .fileinput-preview {
|
||||
color: #3c763d;
|
||||
}
|
||||
.form-group.has-success .fileinput .thumbnail {
|
||||
border-color: #d6e9c6;
|
||||
}
|
||||
.input-group-addon:not(:first-child) {
|
||||
border-left: 0;
|
||||
}
|
||||
/*# sourceMappingURL=jasny-bootstrap.css.map */
|
@ -0,0 +1 @@
|
||||
.ui-draggable-handle{-ms-touch-action:none;touch-action:none}.ui-layout-pane{overflow:auto}.ui-layout-content{padding:10px;position:relative;overflow:auto;width:100%;border:0}.layout-child-container,.layout-content-container{padding:0;overflow:hidden}.layout-child-container{border:0}.layout-scroll{overflow:auto}.layout-hide{display:none}.ui-layout-resizer{background:#fafafa;border:1px solid #eee;border-width:0}.ui-layout-resizer-open-hover,.ui-layout-resizer-dragging{background:#fafafa}.ui-layout-resizer-dragging{border:1px solid #eee}.ui-layout-resizer-north-dragging,.ui-layout-resizer-south-dragging{border-width:1px 0}.ui-layout-resizer-west-dragging,.ui-layout-resizer-east-dragging{border-width:0 1px}.ui-layout-resizer-dragging-limit{background:#e1a4a4}.ui-layout-resizer-closed-hover{background:#ebd5aa}.ui-layout-resizer-north-sliding-hover{border-bottom-width:1px}.ui-layout-resizer-south-sliding-hover{border-top-width:1px}.ui-layout-resizer-west-sliding-hover{border-right-width:1px}.ui-layout-resizer-east-sliding-hover{border-left-width:1px}.ui-layout-toggler{border:1px solid #eee;background-color:#eee}.ui-layout-resizer-hover .ui-layout-toggler{opacity:1.00;filter:alpha(opacity=100)}.ui-layout-toggler-hover,.ui-layout-resizer-hover .ui-layout-toggler-hover{background-color:#FC6;opacity:1.00;filter:alpha(opacity=100)}.ui-layout-toggler-north,.ui-layout-toggler-south{border-width:0 1px}.ui-layout-toggler-west,.ui-layout-toggler-east{border-width:1px 0}.ui-layout-resizer-sliding .ui-layout-toggler{display:none}.ui-layout-toggler .ui-content{color:#666;font-size:12px;font-weight:bold;line-height:8px;width:100%;padding-bottom:.35ex}.ui-layout-toggler .ui-content .fa{line-height:8px}.ui-layout-toggler-north-closed .fa:before,.ui-layout-toggler-south-open .fa:before{content:"\f0d7"}.ui-layout-toggler-south-closed .fa:before,.ui-layout-toggler-north-open .fa:before{content:"\f0d8"}.ui-layout-toggler-west-closed .fa:before,.ui-layout-toggler-east-open .fa:before{content:"\f0da"}.ui-layout-toggler-east-closed .fa:before,.ui-layout-toggler-west-open .fa:before{content:"\f0d9"}.ui-layout-mask{border:none!important;padding:0!important;margin:0!important;overflow:hidden!important;position:absolute!important;opacity:0!important;filter:Alpha(Opacity="0")!important}.ui-layout-mask-inside-pane{top:0!important;left:0!important;width:100%!important;height:100%!important}@media print{html{height:auto!important;overflow:visible!important}body.ui-layout-container{position:static!important;top:auto!important;bottom:auto!important;left:auto!important;right:auto!important;_width:auto!important;_height:auto!important}.ui-layout-resizer,.ui-layout-toggler{display:none!important}.ui-layout-pane{border:none!important;background:transparent!important;position:relative!important;top:auto!important;bottom:auto!important;left:auto!important;right:auto!important;width:auto!important;height:auto!important;overflow:visible!important}}
|
After Width: | Height: | Size: 601 B |