diff --git a/application/admin/controllers/DataController.php b/application/admin/controllers/DataController.php index b5fa7fab..ed125cf4 100755 --- a/application/admin/controllers/DataController.php +++ b/application/admin/controllers/DataController.php @@ -2209,7 +2209,6 @@ class Admin_DataController extends Zend_Controller_Action $ac = $this->_request->getParam('ac'); $uuid = $this->_request->getParam('uuid'); - set_time_limit(0); $auth = Zend_Auth::getInstance(); if($auth->hasIdentity()) @@ -2567,7 +2566,7 @@ class Admin_DataController extends Zend_Controller_Action unset($mailtp); //email to author $mail=new WestdcMailer($this->view->config->smtp); - $mail->setFrom($this->view->config->service->email,'数据服务组'); + $mail->setFrom($this->view->config->service->email,'西部数据中心服务组'); $mailtp=new EmailText($this->db,"version-commit-author",array( 'user' => $user->username, 'uuid' => $row['uuid'], @@ -2621,7 +2620,7 @@ class Admin_DataController extends Zend_Controller_Action unset($mailtp); //email to author $mail=new WestdcMailer($this->view->config->smtp); - $mail->setFrom($this->view->config->service->email,'数据服务组'); + $mail->setFrom($this->view->config->service->email,'西部数据中心服务组'); $mailtp=new EmailText($this->db,"version-commit-author",array( 'user' => $user->username, 'uuid' => $row['uuid'], @@ -2687,7 +2686,7 @@ class Admin_DataController extends Zend_Controller_Action //email to admin & author $mail=new WestdcMailer($this->view->config->smtp); - $mail->setFrom($this->view->config->service->email,'数据服务组'); + $mail->setFrom($this->view->config->service->email,'西部数据中心服务组'); $mailtp=new EmailText($this->db,"metadata-release",array( 'user' => $user->username, 'uuid' => $row['uuid'], @@ -3838,22 +3837,6 @@ class Admin_DataController extends Zend_Controller_Action }//fund - public function visualAction() - { - $uuid = $this->_getParam('uuid'); - $submit = $this->_getParam('submit'); - - if(!empty($uuid)) - { - $this->_helper->viewRenderer('visual-add'); - $this->view->data = ['uuid' => $uuid]; - if(empty($submit)) - return true; - - - } - } - public function doiAction() { $ac = $this->_getParam('ac'); diff --git a/application/admin/controllers/SysController.php b/application/admin/controllers/SysController.php index f3ae2804..b1faf9bc 100644 --- a/application/admin/controllers/SysController.php +++ b/application/admin/controllers/SysController.php @@ -1,6 +1,4 @@ db->query($sql); - view::Post($this,'模板已删除',-1); - return; - - } - else if($ac=='test'&& !empty($id)) { if(!empty($submit)) @@ -435,10 +424,10 @@ class Admin_SysController extends Zend_Controller_Action if ($ac=='' || $ac=='online') { $sql = "SELECT m.title,m.uuid,ds.host,ds.path, - floor(t.filesize/1024/1024*100)/100 as filesize, - t.filecount from metadata m + floor(t.filesize/1024/1024*100)/100 as filesize, + t.filecount from metadata m LEFT JOIN mdstatus s ON m.uuid=s.uuid - LEFT JOIN dataset ds ON m.uuid=ds.uuid + LEFT JOIN dataset ds ON m.uuid=ds.uuid left join (select dsid,count(id) as filecount,sum(filesize) as filesize from datafile group by dsid) as t on ds.id=t.dsid where s.status>4 and m.datatype=0 and ds.host='ftp1.westgis.ac.cn' ORDER BY m.id DESC"; @@ -451,15 +440,15 @@ class Admin_SysController extends Zend_Controller_Action $paginator->setItemCountPerPage($pages); $paginator->setView($this->view); Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination.phtml'); - $this->view->paginator=$paginator; + $this->view->paginator=$paginator; $ac='online'; } else if ($ac=='heihe') { $sql = "SELECT m.title,m.uuid,ds.host,ds.path, - floor(t.filesize/1024/1024*100)/100 as filesize, - t.filecount from metadata m + floor(t.filesize/1024/1024*100)/100 as filesize, + t.filecount from metadata m LEFT JOIN mdstatus s ON m.uuid=s.uuid - LEFT JOIN dataset ds ON m.uuid=ds.uuid + LEFT JOIN dataset ds ON m.uuid=ds.uuid left join (select dsid,count(id) as filecount,sum(filesize) as filesize from datafile group by dsid) as t on ds.id=t.dsid left join datasource on datasource.uuid=m.uuid left join source on datasource.sourceid=source.id @@ -477,15 +466,15 @@ class Admin_SysController extends Zend_Controller_Action $this->view->paginator=$paginator; } else if ($ac=='water') { - $sql = "SELECT m.title,m.uuid,ds.host,ds.path, - floor(t.filesize/1024/1024*100)/100 as filesize, - t.filecount from metadata m - LEFT JOIN mdstatus s ON m.uuid=s.uuid - LEFT JOIN dataset ds ON m.uuid=ds.uuid - left join (select dsid,count(id) as filecount,sum(filesize) as filesize from datafile group by dsid) as t on ds.id=t.dsid - left join datasource on datasource.uuid=m.uuid - left join source on datasource.sourceid=source.id - where s.status>4 and m.datatype=1 and ds.host='ftp1.westgis.ac.cn' and source.code='water' + $sql = "SELECT m.title,m.uuid,ds.host,ds.path, + floor(t.filesize/1024/1024*100)/100 as filesize, + t.filecount from metadata m + LEFT JOIN mdstatus s ON m.uuid=s.uuid + LEFT JOIN dataset ds ON m.uuid=ds.uuid + left join (select dsid,count(id) as filecount,sum(filesize) as filesize from datafile group by dsid) as t on ds.id=t.dsid + left join datasource on datasource.uuid=m.uuid + left join source on datasource.sourceid=source.id + where s.status>4 and m.datatype=1 and ds.host='ftp1.westgis.ac.cn' and source.code='water' ORDER BY m.title DESC"; $sth = $this->db->prepare($sql); $sth->execute(); @@ -500,7 +489,7 @@ class Admin_SysController extends Zend_Controller_Action } else if ($ac=='heihe1') { $sql = "SELECT m.title,m.uuid,ds.host,ds.path, - floor(t.filesize/1024/1024*100)/100 as filesize, + floor(t.filesize/1024/1024*100)/100 as filesize, t.filecount from metadata m LEFT JOIN mdstatus s ON m.uuid=s.uuid LEFT JOIN dataset ds ON m.uuid=ds.uuid @@ -522,11 +511,11 @@ class Admin_SysController extends Zend_Controller_Action } else if ($ac=='hiwater') { $sql = "SELECT m.title,m.uuid,ds.host,ds.path, - floor(t.filesize/1024/1024*100)/100 as filesize, + floor(t.filesize/1024/1024*100)/100 as filesize, t.filecount from metadata m LEFT JOIN mdstatus s ON m.uuid=s.uuid LEFT JOIN dataset ds ON m.uuid=ds.uuid - left join (select dsid,count(id) as filecount,sum(filesize) as filesize from datafile group by dsid) as t on ds.id=t.dsid + left join (select dsid,count(id) as filecount,sum(filesize) as filesize from datafile group by dsid) as t on ds.id=t.dsid left join datasource on datasource.uuid=m.uuid left join source on datasource.sourceid=source.id where ds.host='ftp1.westgis.ac.cn' and source.code='hiwater' @@ -544,10 +533,10 @@ class Admin_SysController extends Zend_Controller_Action }else if ($ac=='westee') { $sql = "SELECT m.title,m.uuid,ds.host,ds.path, - floor(t.filesize/1024/1024*100)/100 as filesize, + floor(t.filesize/1024/1024*100)/100 as filesize, t.filecount from metadata m LEFT JOIN mdstatus s ON m.uuid=s.uuid - LEFT JOIN dataset ds ON m.uuid=ds.uuid + LEFT JOIN dataset ds ON m.uuid=ds.uuid left join (select dsid,count(id) as filecount,sum(filesize) as filesize from datafile group by dsid) as t on ds.id=t.dsid where ds.host='ftp1.westgis.ac.cn' and m.uuid in (select uuid from westeemd) ORDER BY m.title DESC"; @@ -564,10 +553,10 @@ class Admin_SysController extends Zend_Controller_Action }else if ($ac=='other') { $sql = "SELECT m.title,m.uuid,ds.host,ds.path, - floor(t.filesize/1024/1024*100)/100 as filesize, + floor(t.filesize/1024/1024*100)/100 as filesize, t.filecount from metadata m LEFT JOIN mdstatus s ON m.uuid=s.uuid - LEFT JOIN dataset ds ON m.uuid=ds.uuid + LEFT JOIN dataset ds ON m.uuid=ds.uuid left join (select dsid,count(id) as filecount,sum(filesize) as filesize from datafile group by dsid) as t on ds.id=t.dsid where ds.host='ftp1.westgis.ac.cn' and m.uuid not in (select uuid from datasource) and m.uuid not in (select uuid from westeemd) ORDER BY m.title DESC"; @@ -584,7 +573,7 @@ class Admin_SysController extends Zend_Controller_Action } $this->view->activeID="btn-".$ac; } - + function problemAction() { $pages=20; @@ -592,7 +581,7 @@ class Admin_SysController extends Zend_Controller_Action if ($ac=='' || $ac=='ref') { $sql = "SELECT m.title,m.uuid,m.citation,g.id as gid from metadata m - LEFT JOIN mdstatus s ON m.uuid=s.uuid + LEFT JOIN mdstatus s ON m.uuid=s.uuid left join geonetworkmetadata g on g.uuid=m.uuid where s.status>4 and m.citation like '%??%' ORDER BY m.id DESC"; @@ -605,16 +594,16 @@ class Admin_SysController extends Zend_Controller_Action $paginator->setItemCountPerPage($pages); $paginator->setView($this->view); Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination.phtml'); - $this->view->paginator=$paginator; - $this->_helper->viewRenderer('problem-ref'); + $this->view->paginator=$paginator; + $this->_helper->viewRenderer('problem-ref'); $ac='ref'; } else if ($ac=='file') { - $sql = "SELECT m.title,m.uuid,m.filesize,ds.host,ds.path from metadata m - LEFT JOIN mdstatus s ON m.uuid=s.uuid - LEFT JOIN dataset ds ON m.uuid=ds.uuid - where s.status>4 and ds.id not in (select distinct dsid from datafile) - group by m.title,m.uuid,ds.host,ds.path,m.filesize + $sql = "SELECT m.title,m.uuid,m.filesize,ds.host,ds.path from metadata m + LEFT JOIN mdstatus s ON m.uuid=s.uuid + LEFT JOIN dataset ds ON m.uuid=ds.uuid + where s.status>4 and ds.id not in (select distinct dsid from datafile) + group by m.title,m.uuid,ds.host,ds.path,m.filesize ORDER BY m.title DESC;"; $sth = $this->db->prepare($sql); $sth->execute(); @@ -628,18 +617,18 @@ class Admin_SysController extends Zend_Controller_Action $this->view->paginator=$paginator; } else if ($ac=='tiny') { - $sql = "SELECT m.title,m.uuid,ds.host,ds.path, - floor(sum(datafile.filesize)/1024/1024*100)/100 as filesize, - count(datafile.id) as filecount - from metadata m - LEFT JOIN mdstatus s ON m.uuid=s.uuid - LEFT JOIN dataset ds ON m.uuid=ds.uuid - left join datasource on datasource.uuid=m.uuid - left join datafile on ds.id=datafile.dsid - left join source on datasource.sourceid=source.id - where s.status>4 and ds.id in (select t.dsid from (select dsid,count(id) as filecount,sum(filesize) as filesize from datafile group by dsid) as t -where t.filesize<1024*5) - group by m.title,m.uuid,ds.host,ds.path + $sql = "SELECT m.title,m.uuid,ds.host,ds.path, + floor(sum(datafile.filesize)/1024/1024*100)/100 as filesize, + count(datafile.id) as filecount + from metadata m + LEFT JOIN mdstatus s ON m.uuid=s.uuid + LEFT JOIN dataset ds ON m.uuid=ds.uuid + left join datasource on datasource.uuid=m.uuid + left join datafile on ds.id=datafile.dsid + left join source on datasource.sourceid=source.id + where s.status>4 and ds.id in (select t.dsid from (select dsid,count(id) as filecount,sum(filesize) as filesize from datafile group by dsid) as t +where t.filesize<1024*5) + group by m.title,m.uuid,ds.host,ds.path ORDER BY m.title DESC;"; $sth = $this->db->prepare($sql); $sth->execute(); @@ -653,14 +642,14 @@ where t.filesize<1024*5) $this->view->paginator=$paginator; } else if ($ac=='heihefund') { - $sql = "SELECT m.title,m.uuid,g.id as gid - from metadata m - LEFT JOIN mdstatus s ON m.uuid=s.uuid - left join datasource on datasource.uuid=m.uuid - left join source on datasource.sourceid=source.id -left join mdfund mf on mf.uuid=m.uuid -left join geonetworkmetadata g on m.uuid=g.uuid - where s.status>4 and source.code='heihe' and mf.fid is null + $sql = "SELECT m.title,m.uuid,g.id as gid + from metadata m + LEFT JOIN mdstatus s ON m.uuid=s.uuid + left join datasource on datasource.uuid=m.uuid + left join source on datasource.sourceid=source.id +left join mdfund mf on mf.uuid=m.uuid +left join geonetworkmetadata g on m.uuid=g.uuid + where s.status>4 and source.code='heihe' and mf.fid is null ORDER BY m.title DESC;"; $sth = $this->db->prepare($sql); $sth->execute(); @@ -671,19 +660,19 @@ left join geonetworkmetadata g on m.uuid=g.uuid $paginator->setItemCountPerPage($pages); $paginator->setView($this->view); Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination.phtml'); - $this->view->paginator=$paginator; + $this->view->paginator=$paginator; $this->_helper->viewRenderer('problem-md'); } else if ($ac=='noemail') { - $sql = "SELECT distinct m.title,m.uuid,g.id as gid - from metadata m - LEFT JOIN mdstatus s ON m.uuid=s.uuid -left join role on role.uuid=m.uuid -left join geonetworkmetadata g on m.uuid=g.uuid - where m.datatype=1 and s.status>4 and m.uuid not in ( -select role.uuid from role left join responsible res on role.resid=res.id -where res.email is not null and role.role in ('resourceProvider','owner','pointOfContact','custodian') -) + $sql = "SELECT distinct m.title,m.uuid,g.id as gid + from metadata m + LEFT JOIN mdstatus s ON m.uuid=s.uuid +left join role on role.uuid=m.uuid +left join geonetworkmetadata g on m.uuid=g.uuid + where m.datatype=1 and s.status>4 and m.uuid not in ( +select role.uuid from role left join responsible res on role.resid=res.id +where res.email is not null and role.role in ('resourceProvider','owner','pointOfContact','custodian') +) ORDER BY m.title DESC;"; $sth = $this->db->prepare($sql); $sth->execute(); @@ -694,16 +683,16 @@ where res.email is not null and role.role in ('resourceProvider','owner','pointO $paginator->setItemCountPerPage($pages); $paginator->setView($this->view); Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination.phtml'); - $this->view->paginator=$paginator; + $this->view->paginator=$paginator; $this->_helper->viewRenderer('problem-md'); } else if ($ac=='unmoved') { - $sql = "SELECT distinct m.title,m.uuid,g.id as gid - from metadata m -LEFT JOIN mdstatus s ON m.uuid=s.uuid -left join geonetworkmetadata g on m.uuid=g.uuid -left join dataset ds on ds.uuid=m.uuid - where s.status>4 and ds.path like '%upload%' + $sql = "SELECT distinct m.title,m.uuid,g.id as gid + from metadata m +LEFT JOIN mdstatus s ON m.uuid=s.uuid +left join geonetworkmetadata g on m.uuid=g.uuid +left join dataset ds on ds.uuid=m.uuid + where s.status>4 and ds.path like '%upload%' ORDER BY m.title DESC;"; $sth = $this->db->prepare($sql); $sth->execute(); @@ -714,7 +703,7 @@ left join dataset ds on ds.uuid=m.uuid $paginator->setItemCountPerPage($pages); $paginator->setView($this->view); Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination.phtml'); - $this->view->paginator=$paginator; + $this->view->paginator=$paginator; $this->_helper->viewRenderer('problem-md'); } $this->view->activeID="btn-".$ac; diff --git a/application/admin/controllers/UserController.php b/application/admin/controllers/UserController.php index 3b66a45f..f5d44c7c 100755 --- a/application/admin/controllers/UserController.php +++ b/application/admin/controllers/UserController.php @@ -1,6 +1,8 @@ from('users') ->where('usertype = ?', 'administrator') ->order('users.id desc'); - - $paginator = Zend_Paginator::factory($select); $paginator->setCurrentPageNumber($this->_getParam('page')); $paginator->setItemCountPerPage(30); $paginator->setView($this->view); Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination.phtml'); $this->view->paginator=$paginator; - - $ac = $this->_getParam('ac'); - - if($ac == 'sync') - { - $sql = "SELECT id FROM users WHERE usertype='administrator'"; - $rs = $this->db->query($sql); - $ids = $rs->fetchAll(); - - $data = array(); - foreach($ids as $v) - { - $data[] = $v['id']; - } - unset($ids); - - $ids = join(",",$data); - - $gn_sql = "update users set profile='Administrator' where id in ($ids)"; - $gn_db = new PDO(array( - 'host'=> $this->view->config->geonetwork->params->host, - 'port' => 5432, - 'user' => $this->view->config->geonetwork->params->username, - 'pwd' => $this->view->config->geonetwork->params->password , - 'db' => $this->view->config->geonetwork->params->dbname - )); - - $gn_db->exec("update users set profile='Editor' where id>1 and profile='Administrator'"); - $gn_db->exec($gn_sql); - - view::Post($this,"同步成功!",-1); - } } function showAction() diff --git a/application/admin/views/scripts/data/left.phtml b/application/admin/views/scripts/data/left.phtml index f22e6b39..5e4684a6 100644 --- a/application/admin/views/scripts/data/left.phtml +++ b/application/admin/views/scripts/data/left.phtml @@ -19,9 +19,5 @@
  • 专题管理
  • 汇交计划
  • 支持项目
  • -<<<<<<< .working
  • DOI
  • -======= -
  • 可视化数据
  • ->>>>>>> .merge-right.r4534 \ No newline at end of file diff --git a/application/admin/views/scripts/data/md.phtml b/application/admin/views/scripts/data/md.phtml index 5a25f514..b44a4935 100644 --- a/application/admin/views/scripts/data/md.phtml +++ b/application/admin/views/scripts/data/md.phtml @@ -66,8 +66,7 @@ 邮件通知 | 支持项目 | - DOI | - 数据可视化 + DOI

    数据贡献者:

    diff --git a/application/admin/views/scripts/data/visual-add.phtml b/application/admin/views/scripts/data/visual-add.phtml deleted file mode 100644 index f2d2f890..00000000 --- a/application/admin/views/scripts/data/visual-add.phtml +++ /dev/null @@ -1,51 +0,0 @@ -headTitle($this->config->title->site); - $this->headTitle('后台管理'); - $this->headTitle()->setSeparator(' - '); - $this->breadcrumb('首页'); - $this->breadcrumb('后台首页'); - $this->breadcrumb('数据管理'); - $this->breadcrumb('同步GEONETWORK元数据'); - $this->breadcrumb()->setSeparator(' > '); -?> -
    -
    - partial('data/left.phtml'); ?> -
    - -
    -

    添加可视化要素

    -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    -
    - - -
    -
    -
    -
    -
    - diff --git a/application/admin/views/scripts/data/visual.phtml b/application/admin/views/scripts/data/visual.phtml deleted file mode 100644 index ad30c23d..00000000 --- a/application/admin/views/scripts/data/visual.phtml +++ /dev/null @@ -1,20 +0,0 @@ -headTitle($this->config->title->site); - $this->headTitle('后台管理'); - $this->headTitle()->setSeparator(' - '); - $this->headLink()->appendStylesheet('/css/admin.css'); - $this->breadcrumb('首页'); - $this->breadcrumb('后台首页'); - $this->breadcrumb('数据管理'); - $this->breadcrumb('同步GEONETWORK元数据'); - $this->breadcrumb()->setSeparator(' > '); -?> -
    -
    - partial('data/left.phtml'); ?> -
    - -
    - -
    -
    diff --git a/application/admin/views/scripts/user/adminlist.phtml b/application/admin/views/scripts/user/adminlist.phtml index 3606ba74..f47d1de3 100755 --- a/application/admin/views/scripts/user/adminlist.phtml +++ b/application/admin/views/scripts/user/adminlist.phtml @@ -2,46 +2,51 @@ $this->headTitle($this->config->title->site); $this->headTitle('后台管理'); $this->headTitle()->setSeparator(' - '); - $this->headLink()->appendStylesheet('/css/admin.css'); +# $this->headLink()->appendStylesheet('/css/admin.css'); $this->breadcrumb('首页'); $this->breadcrumb('后台首页'); $this->breadcrumb('用户管理'); $this->breadcrumb()->setSeparator(' > '); ?> -
    -partial('user/left.phtml'); ?> -
    -
    -
    管理员列表
    -
    同步管理员到geonetwork
    - - - - - - - - - - - -paginator)): ?> - -paginator as $item): ?> - - - - - - - - - - - -
    用户名电子邮箱用户类型真实姓名电话操作
    -'>查看详细 -
    - -
    \ No newline at end of file + +
    +
    partial('user/left.phtml'); ?>
    + +
    +

    管理员列表

    +
    + + + + + + + + + + + + paginator)): ?> + + paginator as $item): ?> + + + + + + + + + + + +
    用户名电子邮箱用户类型真实姓名电话操作
    + '>查看详细 +
    + +
    +
    diff --git a/application/config.ini b/application/config.ini index a4096aca..80a24be0 100755 --- a/application/config.ini +++ b/application/config.ini @@ -1,158 +1,161 @@ -[general] -db.adapter = PDO_PGSQL -db.params.host = localhost -db.params.username = gis -db.params.password = gispassword -db.params.dbname = metadata - -geonetwork.url=http://www.sanjiangyuan.org.cn/geonetwork/ -geonetwork.adapter = PDO_PGSQL -geonetwork.params.host = localhost -geonetwork.params.username = gis -geonetwork.params.password = gispassword -geonetwork.params.dbname = geonetwork - -google.maps.api=ABQIAAAACD-MqkkoOm60o_dvwdcKVhRBSKpgcP88GYi6r2Of16IkMX_4YhSBQsywCi4J2_fh4nBuWmK7gyRjLg -bing.api=4BC90E1E9ED351ECE0D9FB71509BC3CC1264340C -bigthumb.path=../geonetwork/data/ -temp.path=/tmp/ -upload=../data/upload/ - -paths.newsletter=images/newsletter/ -logging.file = /var/www/test.westgis.ac.cn/data/logs/debug.log -page.limit=10 -import.dir=../data/import -title.site=三江源生态监测综合数据服务平台 -title.data=数据产品与服务 -title.review=数据评审 -title.author=数据作者 -title.knowledge=知识积累 -supportemail=sjy@mygis.org -reportemail=westdc-report-subscribe@lists.westgis.ac.cn - -smtp.username=sjy@mygis.org -smtp.password=qherc@123 -smtp.host=smtp.gmail.com -smtp.ssl=SSL -smtp.auth=login -smtp.name=三江源生态监测综合数据服务平台 - -ftp.user=newwestdc -ftp.password=westdcforsmall -download.max=5 //最多同时申请下载个数 -page.max=10 //每页显示条目数 -offline.template=../data/offline.pdf -offline.heihetemplate=../data/heihe.pdf -offline.security=../data/security.pdf -offline.water_template=../data/water_offline.pdf -offline.font=../data/simhei.ttf -offline.savepath=../data/offlineapp -service.email=sjy@mygis.org -offline.email.template=../data/offline-email.txt -offline.email.start_template=../data/offline-start-email.txt -offline.email.finish_template=../data/offline-finish-email.txt -offline.email.deny_template=../data/offline-deny-email.txt -register.email.template=../data/register-email.txt -westdc.xsl=../data/ISO19115.xsl - -routes.accout.route = "account/fetchpwd/:login/:key" -routes.accout.defaults.controller = "account" -routes.accout.defaults.action = "fetchpwd" - -routes.tag.route = "data/tag/:key" -routes.tag.defaults.controller = "data" -routes.tag.defaults.action = "tag" - -routes.netkites1.type = "Zend_Controller_Router_Route_Static" -routes.netkites1.route = "knowledge/netkites" -routes.netkites1.defaults.controller = netkites -routes.netkites1.defaults.action = index - -routes.netkites.route = "knowledge/netkites/:action/*" -routes.netkites.defaults.controller = netkites - -routes.dataid.route = "data/:id" -routes.dataid.defaults.controller = "data" -routes.dataid.defaults.action = "view" -routes.dataid.reqs.id = "\d+" - -routes.dataxmluuid.route = "data/xml/:uuid" -routes.dataxmluuid.defaults.controller = "data" -routes.dataxmluuid.defaults.action = "xml" -routes.dataxmluuid.reqs.uuid = "[[:xdigit:]]{8}(-[[:xdigit:]]{4}){3}-[[:xdigit:]]{12}" - -routes.datauuid.route = "data/:uuid" -routes.datauuid.defaults.controller = "data" -routes.datauuid.defaults.action = "view" -routes.datauuid.reqs.uuid = "[[:xdigit:]]{8}(-[[:xdigit:]]{4}){3}-[[:xdigit:]]{12}" - -routes.datacat.route = "data/category/:code" -routes.datacat.defaults.controller = "data" -routes.datacat.defaults.action = "category" -routes.datacat.reqs.code = "\d+" - -routes.dataseriesplace.route = "data/series/:id/:keyword" -routes.dataseriesplace.defaults.controller = "data" -routes.dataseriesplace.defaults.action = "series" -//routes.dataseries.reqs.code = "\d+" - -routes.dataseries.route = "data/series/:id" -routes.dataseries.defaults.controller = "data" -routes.dataseries.defaults.action = "series" - -routes.wateruuid.route = "water/:uuid" -routes.wateruuid.defaults.controller = "water" -routes.wateruuid.defaults.action = "view" -routes.wateruuid.reqs.uuid = "[[:xdigit:]]{8}(-[[:xdigit:]]{4}){3}-[[:xdigit:]]{12}" - -routes.watertag.route = "water/tag/:key" -routes.watertag.defaults.controller = "water" -routes.watertag.defaults.action = "tag" - -routes.mddoc.route = "data/wiki/:title" -routes.mddoc.defaults.controller = "metainfo" -routes.mddoc.defaults.action = "index" - -routes.mdfile.route = "filelist/uuid/:uuid" -routes.mdfile.defaults.controller = "filelist" -routes.mdfile.defaults.action = "index" - -routes.adminofflineapp.route = admin/down/offlineapp/:page -routes.adminofflineapp.defaults.module = admin -routes.adminofflineapp.defaults.controller = down -routes.adminofflineapp.defaults.action = offlineapp -routes.adminofflineapp.defaults.page = 1 -routes.adminofflineapp.reqs.page = \d+ - -routes.admindatasetcd.route = admin/data/datasetcd/:page -routes.admindatasetcd.defaults.module = admin -routes.admindatasetcd.defaults.controller = data -routes.admindatasetcd.defaults.action = datasetcd -routes.admindatasetcd.defaults.page = 1 -routes.admindatasetcd.reqs.page = \d+ - -routes.adminmd.route = admin/data/md/:page -routes.adminmd.defaults.module = admin -routes.adminmd.defaults.controller = data -routes.adminmd.defaults.action = md -routes.adminmd.defaults.page = 1 -routes.adminmd.reqs.page = \d+ - -routes.admincomment.route = admin/data/comment/:page -routes.admincomment.defaults.module = admin -routes.admincomment.defaults.controller = data -routes.admincomment.defaults.action = comment -routes.admincomment.defaults.page = 1 -routes.admincomment.reqs.page = \d+ - -routes.adminoffline.route = admin/data/offline/:page -routes.adminoffline.defaults.module = admin -routes.adminoffline.defaults.controller = data -routes.adminoffline.defaults.action = offline -routes.adminoffline.defaults.page = 1 -routes.adminoffline.reqs.page = \d+ - -routes.news.route = archives/:ptype/:type/:page -routes.news.defaults.controller = archives -routes.news.defaults.action = list -routes.news.defaults.page = 1 +[general] +db.adapter = PDO_PGSQL +db.params.host = localhost +db.params.username = gis +db.params.password = gispassword +db.params.dbname = sanjiangyuan + +geonetwork.url=http://sanjiangyuan.westgis.ac.cn/geonetwork/ +geonetwork.adapter = PDO_PGSQL +geonetwork.params.host = localhost +geonetwork.params.username = gis +geonetwork.params.password = gispassword +geonetwork.params.dbname = geonetwork + +google.maps.api=ABQIAAAACD-MqkkoOm60o_dvwdcKVhRBSKpgcP88GYi6r2Of16IkMX_4YhSBQsywCi4J2_fh4nBuWmK7gyRjLg +bing.api=4BC90E1E9ED351ECE0D9FB71509BC3CC1264340C +bigthumb.path=../geonetwork/data/ +temp.path=/tmp/ +upload=../data/upload/ + +paths.newsletter=images/newsletter/ +logging.file = /var/www/test.westgis.ac.cn/data/logs/debug.log +page.limit=10 +import.dir=../data/import +title.site=三江源自然保护区数据管理中心 +title.data=数据产品与服务 +title.heihe=黑河计划数据管理中心 +title.yrnmr=黄河上游宁蒙河段综合数据平台 +title.glacier=中国冰川资源及其变化调查 +title.review=数据评审 +title.author=数据作者 +title.knowledge=知识积累 +supportemail=westdc@lzb.ac.cn +reportemail=westdc-report-subscribe@lists.westgis.ac.cn + +smtp.username=westdc@lzb.ac.cn +smtp.password=ilovewestdc +smtp.host=smtp.cstnet.cn +smtp.ssl=TLS +smtp.auth=login +smtp.name=数据中心服务组 + +ftp.user=newwestdc +ftp.password=westdcforsmall +download.max=5 //最多同时申请下载个数 +page.max=10 //每页显示条目数 +offline.template=../data/offline.pdf +offline.heihetemplate=../data/heihe.pdf +offline.security=../data/security.pdf +offline.water_template=../data/water_offline.pdf +offline.font=../data/simhei.ttf +offline.savepath=../data/offlineapp +service.email=westdc@lzb.ac.cn +offline.email.template=../data/offline-email.txt +offline.email.start_template=../data/offline-start-email.txt +offline.email.finish_template=../data/offline-finish-email.txt +offline.email.deny_template=../data/offline-deny-email.txt +register.email.template=../data/register-email.txt +westdc.xsl=../data/ISO19115.xsl + +routes.accout.route = "account/fetchpwd/:login/:key" +routes.accout.defaults.controller = "account" +routes.accout.defaults.action = "fetchpwd" + +routes.tag.route = "data/tag/:key" +routes.tag.defaults.controller = "data" +routes.tag.defaults.action = "tag" + +routes.netkites1.type = "Zend_Controller_Router_Route_Static" +routes.netkites1.route = "knowledge/netkites" +routes.netkites1.defaults.controller = netkites +routes.netkites1.defaults.action = index + +routes.netkites.route = "knowledge/netkites/:action/*" +routes.netkites.defaults.controller = netkites + +routes.dataid.route = "data/:id" +routes.dataid.defaults.controller = "data" +routes.dataid.defaults.action = "view" +routes.dataid.reqs.id = "\d+" + +routes.dataxmluuid.route = "data/xml/:uuid" +routes.dataxmluuid.defaults.controller = "data" +routes.dataxmluuid.defaults.action = "xml" +routes.dataxmluuid.reqs.uuid = "[[:xdigit:]]{8}(-[[:xdigit:]]{4}){3}-[[:xdigit:]]{12}" + +routes.datauuid.route = "data/:uuid" +routes.datauuid.defaults.controller = "data" +routes.datauuid.defaults.action = "view" +routes.datauuid.reqs.uuid = "[[:xdigit:]]{8}(-[[:xdigit:]]{4}){3}-[[:xdigit:]]{12}" + +routes.datacat.route = "data/category/:code" +routes.datacat.defaults.controller = "data" +routes.datacat.defaults.action = "category" +routes.datacat.reqs.code = "\d+" + +routes.dataseriesplace.route = "data/series/:id/:keyword" +routes.dataseriesplace.defaults.controller = "data" +routes.dataseriesplace.defaults.action = "series" +//routes.dataseries.reqs.code = "\d+" + +routes.dataseries.route = "data/series/:id" +routes.dataseries.defaults.controller = "data" +routes.dataseries.defaults.action = "series" + +routes.wateruuid.route = "water/:uuid" +routes.wateruuid.defaults.controller = "water" +routes.wateruuid.defaults.action = "view" +routes.wateruuid.reqs.uuid = "[[:xdigit:]]{8}(-[[:xdigit:]]{4}){3}-[[:xdigit:]]{12}" + +routes.watertag.route = "water/tag/:key" +routes.watertag.defaults.controller = "water" +routes.watertag.defaults.action = "tag" + +routes.mddoc.route = "data/wiki/:title" +routes.mddoc.defaults.controller = "metainfo" +routes.mddoc.defaults.action = "index" + +routes.mdfile.route = "filelist/uuid/:uuid" +routes.mdfile.defaults.controller = "filelist" +routes.mdfile.defaults.action = "index" + +routes.adminofflineapp.route = admin/down/offlineapp/:page +routes.adminofflineapp.defaults.module = admin +routes.adminofflineapp.defaults.controller = down +routes.adminofflineapp.defaults.action = offlineapp +routes.adminofflineapp.defaults.page = 1 +routes.adminofflineapp.reqs.page = \d+ + +routes.admindatasetcd.route = admin/data/datasetcd/:page +routes.admindatasetcd.defaults.module = admin +routes.admindatasetcd.defaults.controller = data +routes.admindatasetcd.defaults.action = datasetcd +routes.admindatasetcd.defaults.page = 1 +routes.admindatasetcd.reqs.page = \d+ + +routes.adminmd.route = admin/data/md/:page +routes.adminmd.defaults.module = admin +routes.adminmd.defaults.controller = data +routes.adminmd.defaults.action = md +routes.adminmd.defaults.page = 1 +routes.adminmd.reqs.page = \d+ + +routes.admincomment.route = admin/data/comment/:page +routes.admincomment.defaults.module = admin +routes.admincomment.defaults.controller = data +routes.admincomment.defaults.action = comment +routes.admincomment.defaults.page = 1 +routes.admincomment.reqs.page = \d+ + +routes.adminoffline.route = admin/data/offline/:page +routes.adminoffline.defaults.module = admin +routes.adminoffline.defaults.controller = data +routes.adminoffline.defaults.action = offline +routes.adminoffline.defaults.page = 1 +routes.adminoffline.reqs.page = \d+ + +routes.news.route = archives/:ptype/:type/:page +routes.news.defaults.controller = archives +routes.news.defaults.action = list +routes.news.defaults.page = 1 diff --git a/application/default/controllers/DataController.php b/application/default/controllers/DataController.php index fe5394cb..007644fd 100755 --- a/application/default/controllers/DataController.php +++ b/application/default/controllers/DataController.php @@ -1,2305 +1,2304 @@ -db=Zend_Registry::get('db'); - $this->view->config = Zend_Registry::get('config'); - $this->messenger=$this->_helper->getHelper('FlashMessenger'); - $this->view->messages = $this->messenger->getMessages(); - $this->view->theme = new Theme(); - $this->view->main_nav_pageID = "data"; - - $this->view->nav = array( - array('link'=>'/','title'=>''), - array('link'=>'/data','title'=>$this->view->config->title->data), - ); - } - function indexAction() - { - //序列 - $state=$this->db->query('select s.id,s.name,count(*) as count from series s,dataseries d where d.sid=s.id and length(s.name)>2 group by s.id,s.name order by count desc limit 15'); - $this->view->serie=$state->fetchAll(); - //分类 - $state=$this->db->query('select c.code,name,name_zh,count(*) from category c,categorycode cc where c.code=cc.code group by c.code,cc.name,cc.name_zh'); - $this->view->category=$state->fetchAll(); - //关键词 - $state=$this->db->query("select keyword,count(*) from keyword right join normalmetadata on keyword.id=normalmetadata.id where keytype='place' group by keyword order by count desc limit 20"); - $k1=$state->fetchAll(); - $state=$this->db->query("select keyword,count(*) from keyword right join normalmetadata on keyword.id=normalmetadata.id where keytype='theme' group by keyword order by count desc limit 20"); - //$state=$this->db->query("select k.keyword,count(k.keyword) from keyword k left join normalmetadata m on k.id=m.id where k.keytype='theme' and (m.uuid in (select uuid from dataorder group by uuid order by count(uuid) desc limit 20)) group by k.keyword order by count(k.keyword) desc limit 20"); - $k2=$state->fetchAll(); - $state=$this->db->query("select keyword,count(*) from keyword right join normalmetadata on keyword.id=normalmetadata.id where keytype='discipline' group by keyword order by count desc limit 20"); - $k3=$state->fetchAll(); - $state=$this->db->query("select keyword,count(*) from keyword right join normalmetadata on keyword.id=normalmetadata.id where keytype='stratum' group by keyword order by count desc limit 20"); - $k4=$state->fetchAll(); - $state=$this->db->query("select keyword,count(*) from keyword right join normalmetadata on keyword.id=normalmetadata.id where keytype='temporal' group by keyword order by count desc limit 20"); - //$state=$this->db->query("select k.keyword,count(k.keyword) from keyword k left join normalmetadata m on k.id=m.id where k.keytype='temporal' and (m.uuid in (select uuid from dataorder group by uuid order by count(uuid) desc limit 20)) group by k.keyword order by count(k.keyword) desc limit 20"); - $k5=$state->fetchAll(); - $this->view->keywords=array('place'=>$k1,'theme'=>$k2,'discipline'=>$k3,'stratum'=>$k4,'temporal'=>$k5); - //最新10个入库数据 - $state=$this->db->query('select id,uuid,title from normalmetadata order by id desc limit 10'); - $this->view->metadata = $state->fetchAll(); - //特色数据 - - //服务 - $l=new mydir($this->view->config->paths->newsletter,"newsletter_*.pdf"); - $this->view->newsletter=$l->getLast(); - $name=basename($this->view->newsletter,'.pdf'); - list(,$this->view->newsletterno)=explode("_",$name); - - $this->view->addHelperPath('helper','Zend_View_Helper_'); - $form=new MaillistForm(); - $form->submit->setLabel('输入邮件地址,订阅数据通讯列表'); - - $this->view->form=$form; - if ($this->_request->isPost()) { - //发送邮件 - $formData=$this->_request->getPost(); - if ($form->isValid($formData)) { - $mail=new WestdcMailer($this->view->config->smtp); - $mail->setFrom($formData['email']); - $mail->setBodyText("."); - $mail->setSubject('subscribe'); - $mail->addTo($this->view->config->reportemail); - $mail->send(); - $this->messenger->addMessage('订阅成功,请检查您的邮件!'); - $this->_redirect('/data/'); - } - } else { - $auth = Zend_Auth::getInstance(); - if ($auth->hasIdentity()) { - $user=$auth->getIdentity(); - $formData['email']=$user->email; - $form->populate($formData); - } - } - $searchform=new SearchForm(); - $this->view->searchform=$searchform; - - //其他连接 - } - function onlinelistAction() - { - $page=(int)$this->_request->getParam('page'); - if (empty($page)) $page=1; - $limit=30; - $offset=$limit*($page-1); - $state=$this->db->query('select count(*) from normalmetadata where datatype=0'); - $row=$state->fetchAll(); - $sum=$row[0]['count']; - $select=$this->db->select(); - $select->from('normalmetadata','*')->where('datatype=0')->order('title')->limitPage($page,$limit); - $this->view->metadata = $this->db->fetchAll($select); - $this->view->page=new Pagination($sum,$page,$limit); - } - function offlinelistAction() - { - $page=(int)$this->_request->getParam('page'); - if (empty($page)) $page=1; - $limit=30; - $offset=$limit*($page-1); - $state=$this->db->query('select count(*) from normalmetadata where datatype=1'); - $row=$state->fetchAll(); - $sum=$row[0]['count']; - $select=$this->db->select(); - $select->from('normalmetadata','*')->where('datatype=1')->order('title')->limitPage($page,$limit); - $this->view->metadata = $this->db->fetchAll($select); - $this->view->page=new Pagination($sum,$page,$limit); - } - //展示最近20条离线神情记录情况 - function offlineappAction() - { - $sql="select * from offlineapp where ts_approved is not null and pdflink<>'' and status>=0 order by ts_created desc limit 20"; - $this->view->rows=$this->db->fetchAll($sql); - } - function requestAction() - { - $archives=new Archive($this->db); - $this->view->item=$archives->getOneArchive('如何申请数据','help'); - } - function submitAction() - { - $archives=new Archive($this->db); - $this->view->item=$archives->getOneArchive('如何发布数据','help'); - } - function serviceAction() - { - } - function newsletterAction() - { - $l=new mydir($this->view->config->paths->newsletter,"newsletter_*.pdf"); - $this->view->newsletters=$l->toArray(); - $this->view->addHelperPath('helper','Zend_View_Helper_'); - rsort($this->view->newsletters); - $form=new MaillistForm(); - $this->view->form=$form; - $form->submit->setLabel('输入邮件地址,订阅数据通讯列表'); - if ($this->_request->isPost()) { - //发送邮件 - $formData=$this->_request->getPost(); - if ($form->isValid($formData)) { - //$mail=new Zend_Mail('utf-8'); - $mail=new WestdcMailer($this->view->config->smtp); - $mail->setFrom($formData['email']); - $mail->setBodyText("."); - $mail->setSubject('subscribe'); - $mail->addTo($this->view->config->reportemail); - /* - $tr=new Zend_Mail_Transport_Smtp($this->view->config->smtp->host, - array('ssl' => $this->view->config->smtp->ssl, - 'auth'=>$this->view->config->smtp->auth, - 'username'=>$this->view->config->smtp->username, - 'password'=>$this->view->config->smtp->password)); - $mail->send($tr); - */ - $mail->send(); - $this->messenger->addMessage('订阅成功,请检查您的邮件!'); - $this->_redirect('/data/newsletter'); - } - } else { - $auth = Zend_Auth::getInstance(); - if ($auth->hasIdentity()) { - $user=$auth->getIdentity(); - $formData['email']=$user->email; - $form->populate($formData); - } - } - } - function featureAction() - { - $sql="select * from datafeature order by id desc"; - $this->view->feature=$this->db->fetchAll($sql); - } - - function datasetcdAction() - { - $cd=new DatasetcdTable(); - $this->view->rows=$cd->fetchAll(); - } - /* - * 数据浏览 - */ - function browseAction() - { - $page=(int)$this->_request->getParam('page'); - if (empty($page)) $page=1; - $limit=10; - $offset=$limit*($page-1); - $state=$this->db->query('select count(*) from metadata'); - $row=$state->fetchAll(); - $sum=$row[0]['count']; - $select=$this->db->select(); - $select->from('metadata','*')->order('id desc')->limitPage($page,$limit); - $this->view->metadata = $this->db->fetchAll($select); - $this->view->page=new Pagination($sum,$page,$limit); - } - function tagAction() - { - $id = (int)$this->_request->getParam('id'); - $key = $this->_request->getParam('key'); - $keytype = $this->_request->getParam('keytype'); - $page=(int)$this->_request->getParam('page'); - if (empty($page)) $page=1; - $limit=10; - $offset=$limit*($page-1); - $sql='select keyword,count(*),keytype from keyword right join normalmetadata on keyword.id=normalmetadata.id '; - if (!empty($keytype) && ($keytype=='place' || $keytype=='theme' || $keytype=='discipline'||$keytype=='temporal')) $sql.=" where keytype='".$keytype."'"; - $sql.=' group by keyword,keytype order by keytype,keyword,count desc'; - $state=$this->db->query($sql); - $this->view->keywords=$state->fetchAll(); - - if ($id>0 or !empty($key)) { - if (empty($key)) { - $where=$this->db->quoteInto('id = ?',$id); - $row=$md->fetchRow($where); - $key=$row->name; - } - $this->view->codename=$key; - $sql=$this->db->quoteInto('select count(m.id) from normalmetadata m,keyword k where m.id=k.id and k.keyword=?',$key); - - $state=$this->db->query($sql); - $row=$state->fetchAll(); - $sum=$row[0]['count']; - $select=$this->db->select(); - $select->from('normalmetadata','*')->join('keyword','normalmetadata.id=keyword.id')->where('keyword.keyword=?',$key)->order('normalmetadata.title')->limitPage($page,$limit); - //$sql=$db->quoteInto('select m.* from metadata m,keyword k where m.id=k.id and k.keyword=?',$key); - //$state=$db->query($sql); - $this->view->metadata=$this->db->fetchAll($select); - $this->view->page=new Pagination($sum,$page,$limit); - } - } - /* - * 数据集序列浏览 - */ - function seriesAction() - { - $id = $this->_request->getParam('id'); - if (empty($id)) $id=0; - if (!is_numeric($id)) - { - $name=$id; - $id=''; - } - $keyword=$this->_request->getParam('keyword'); - if (empty($id)) { - if (!empty($name)) - { - $where=$this->db->quoteInto('name = ?',$name); - $row=$this->db->fetchRow("select * from series where ".$where); - } - } else { - $where=$this->db->quoteInto('id = ?',$id); - $row=$this->db->fetchRow("select * from series where ".$where); - } - if (!empty($id) or !empty($name)) - { - if (!$row) $this->_redirect('/data'); - $id=$row['id']; - } - $page=(int)$this->_request->getParam('page'); - if (empty($page)) $page=1; - $limit=10; - $offset=$limit*($page-1); - $state=$this->db->query('select s.id,name,count(*) from series s,dataseries d where d.sid=s.id group by s.id,s.name'); - $this->view->serie=$state->fetchAll(); - if ($id>0) { - //$where=$this->db->quoteInto('id = ?',$id); - //$row=$this->db->fetchRow("select * from series where ".$where); - $this->view->codename=$row['name']; - if (!empty($keyword)) - { - $sql='select count(m.id) as count from normalmetadata m,dataseries d,keyword k where m.id=d.id and m.id=k.id and d.sid=? and k.keyword=?'; - $row=$this->db->fetchAll($sql,array($id,$keyword)); - $this->view->codename.="【关键词:".$keyword."】"; - }else{ - $sql='select count(m.id) as count from normalmetadata m,dataseries d where m.id=d.id and d.sid=?'; - $row=$this->db->fetchAll($sql,array($id)); - } - $sum=$row[0]['count']; - $select=$this->db->select(); - $select->from('normalmetadata','*')->join('dataseries','normalmetadata.id=dataseries.id')->where('dataseries.sid=?',$id)->order('normalmetadata.title')->limitPage($page,$limit); - if (!empty($keyword)) $select->join('keyword','keyword.id=normalmetadata.id')->where('keyword.keyword=?',$keyword); - $this->view->metadata=$this->db->fetchAll($select); - $this->view->page=new Pagination($sum,$page,$limit); - //$this->view->showtools=($sum>$page)?true:false; - //$this->view->form=new SearchForm(); - $sql=$this->db->quoteInto("select keyword,count(*) as count from (select t.keyword,t.id from keyword t left join dataseries d on t.id=d.id where t.keytype='place' and d.sid=?) as f group by keyword order by count desc limit 30",$id); - $state=$this->db->query($sql); - $row=$state->fetchAll(); - $this->view->places=$row; - $this->view->seriesid=$id; - } else { - //提供全部数据集序列列表 - } - } - /* - * 分类浏览模式 - */ - function categoryAction() - { - $page = $this->_request->getParam('page'); - $code = (int)$this->_request->getParam('code'); - $state=$this->db->query('select c.code,name,name_zh,count(*) from category c,categorycode cc where c.code=cc.code group by c.code,cc.name,cc.name_zh'); - $this->view->category=$state->fetchAll(); - if ($code>0 && $code<20) { - $where=$this->db->quoteInto('code = ?',$code); - $row=$this->db->fetchRow("select * from categorycode where ".$where); - $this->view->codename=(empty($row['name_zh'])?$row['name']:$row['name_zh']); - $sql='select count(m.id) from normalmetadata m left join category c on m.id=c.id where c.code=?'; - $row=$this->db->fetchRow($sql,array($code)); - $sum=$row['count']; - $select=$this->db->select(); - $select->from('normalmetadata as m','*')->joinLeft('category as c','m.id=c.id')->where('c.code=?',$code)->order('m.title')->limitPage($page,$this->limit); - $this->view->metadata=$this->db->fetchAll($select); - $this->view->page=new Pagination($sum,$page,$this->limit); - } else { - //提供全部分类列表 - } - } - /* - * 时间浏览方式 - * todo:实现xml的缓存,基于时间的缓存(每天)?基于元数据修改的缓存,每次导入后都重新生成一次。 - */ - function timelineAction() - { - $fn="time1.xml"; - $rows=$this->db->fetchAll("select ts_created from normalmetadata order by ts_created desc limit 1"); - $last_update=strtotime($rows[0]['ts_created']); - if (!file_exists($fn) || (filemtime($fn)<$last_update)) - { - $dateformat="M j Y"; - $md = new MetadataTable(); - $db=$md->getAdapter(); - $state=$db->query('select id,uuid,description,title,timebegin,timeend from normalmetadata where timebegin is not null order by timebegin'); - $rows=$state->fetchAll(); - $timexml=''; - foreach($rows as $row) { - $timexml.=''; - $desc_length=mb_strlen($row['description'],"UTF-8"); - $desc=mb_substr($row['description'],0,($desc_length>300)?300:$desc_length,"UTF-8"); - if ($desc_length>300) $desc.=" ..."; - $timexml.=htmlspecialchars($desc); - $timexml.="\n"; - } - $timexml.=''; - $fp=fopen($fn,'w'); - fwrite($fp,$timexml); - fclose($fp); - } - //$this->_helper->layout->disableLayout(); - } - /* - * todo:空间浏览 - */ - function mapAction() - { - //use json & openlayers? - $id=(int)$this->_request->getParam('id'); - if ($id>0) $this->view->params="/id/$id"; - } - /* - * 产生geojson数据 - */ - function jsonAction() - { - $md=new MetadataTable(); - $db=$md->getAdapter(); - $id = (int)$this->_request->getParam('id'); - $where=''; - if (!empty($id)) { $where=' where id='.$id; } - $sql='select id,uuid,west,south,north,east,title from normalmetadata'.$where; - $state=$db->query($sql); - $rows=$state->fetchAll(); - $geomd=new GeoMetaData(); - foreach($rows as $row){ - if ($id) - $box=new GeoBox($row['west'],$row['south'],$row['east'],$row['north']); - else - $box=new GeoBoxLine($row['west'],$row['south'],$row['east'],$row['north']); - $feature=new Geofeature(); - $feature->id=$row['id']; - $feature->addProperties('title',$row['title']); - $feature->addProperties('uuid',$row['uuid']); - $feature->addProperties('id',$row['id']); - $feature->geometry=$box; - $geomd->addFeature($feature); - } - $this->_helper->json($geomd); - } - /* - * 时空动态浏览 - */ - function timemapAction() - { - $sql='select id,uuid,west,south,north,east,title,timebegin,timeend from normalmetadata where timebegin is not null'; - $this->view->rows=$this->db->fetchAll($sql); - } - /* - * 返回XML源文件 - */ - function xmlAction() - { - $uuid=$this->_request->getParam('uuid'); - $row=$this->db->fetchRow("select xml.data from xml left join metadata on xml.id=metadata.id where metadata.uuid=?",array($uuid)); - $this->_helper->layout->disableLayout(); - $this->_helper->viewRenderer->setNoRender(); - $this->getResponse()->setHeader('Content-Type', 'text/xml') - ->setBody($row['data']); - } - function detailAction() - { - $id=(int)$this->_request->getParam('id'); - $xml=new XmlTable(); - $db=$xml->getAdapter(); - $where=$db->quoteInto('id=?',$id); - $order='id desc'; - $row=$xml->fetchRow($where,$order); - // Load the XML source - $xml = new DOMDocument; - $xml->loadXML($row->data); - $xsl = new DOMDocument; - $xsl->load($this->view->config->westdc->xsl); - // Configure the transformer - $proc = new XSLTProcessor; - $proc->importStyleSheet($xsl); // attach the xsl rules - $this->view->xml=$proc->transformToXML($xml); - //$this->_helper->layout->disableLayout(); - //$this->_helper->viewRenderer->setNoRender(); - //$this->getResponse()->setHeader('Content-Type', 'text/html') - // ->setBody($proc->transformToXML($xml)); - } - function feedAction() - { - $feedArray = array( - 'title' => '中国西部环境与生态科学数据中心', - 'link' => 'http://'.$_SERVER['SERVER_NAME'].'/data/feed', - 'description' => '共享西部计划产生的数据', - 'language' => 'zh-CN', - 'charset' => 'utf-8', - 'published' => time(), - //'generator' => 'Zend Framework Zend_Feed', - 'entries' => array() - ); - $sql="select * from normalmetadata order by ts_created desc"; - $rs=$this->db->fetchAll($sql); - $feedArray['published']=strtotime($rs[0]['ts_created']); - foreach($rs as $r) - { - $feedArray['entries'][] = array( - 'title' => $r['title'], - 'link' => 'http://'.$_SERVER['SERVER_NAME'].'/data/' . $r['uuid'], - 'guid' => 'http://'.$_SERVER['SERVER_NAME'].'/data/' . $r['uuid'], - //'content'=>$r['description'], - 'description' => $r['description'], - 'lastUpdate' => strtotime($r['ts_created']) - ); - } - $feed = Zend_Feed::importArray($feedArray,'rss'); - $this->_helper->layout->disableLayout(); - $this->_helper->viewRenderer->setNoRender(); - $feed->send(); - } - /* - * todo: search - */ - function searchAction() - { - $this->view->addHelperPath('helper','Zend_View_Helper_'); - $form=new SearchForm(); - $this->view->form=$form; - //$form->submit->setLabel('快速搜索'); - $key=$this->_request->getParam('q'); - if (!empty($key)) { - //$formData=$this->_request->getPost(); - //include_once("bcspamblock.php"); - //if ($form->isValid($formData)) { - $page=@(int)$this->_request->getParam('page'); - if (empty($page)) $page=1; - $offset=$this->limit*($page-1); - $search=new Search($key); - $where=$search->sql_expr(array("title","description")); - $row=$this->db->fetchAll("select count(*) from normalmetadata where ".$where); - $sum=$row[0]['count']; - $sql="select uuid,title,id,description from normalmetadata where ".$where." order by title limit ? offset ?"; - $this->view->metadata=$this->db->fetchAll($sql,array($this->limit,$offset)); - $this->view->page=new Pagination($sum,$page,$this->limit); - $this->view->key=$key; - } - } - /* - * todo: 高级搜索 - */ - function advancesearchAction() - { - $this->view->addHelperPath('helper','Zend_View_Helper_'); - //$form=new SearchForm(); - //$this->view->form=$form; - - $md=new MetadataTable(); - $db=$md->getAdapter(); - $page=(int)$this->_request->getParam('page'); - if (empty($page)) $page=1; - $limit=10; - $offset=$limit*($page-1); - $key=$this->_request->getParam('q'); - $n=(int)$this->_request->getParam('n'); - $s=(int)$this->_request->getParam('s'); - $e=(int)$this->_request->getParam('e'); - $w=(int)$this->_request->getParam('w'); - if (!(empty($n) && empty($key))) { - if (empty($n)) $n=90; - if (empty($s)) $s=-90; - if (empty($e)) $e=180; - if (empty($w)) $w=-180; - $start=$this->_request->getParam('start'); - $end=$this->_request->getParam('end'); - if (!empty($key)) { - $sql='select count(*) from normalmetadata where east? and north? and (title ilike ? or description ilike ?)'; - $row=$db->fetchAll($sql,array($e,$w,$n,$s,'%'.$key.'%','%'.$key.'%')); - } else { - $sql='select count(*) from normalmetadata where east? and north?'; - $row=$db->fetchAll($sql,array($e,$w,$n,$s)); - } - $sum=$row[0]['count']; - $select=$db->select(); - $select->from('normalmetadata','*')->where('eastwhere('west>?',$w)->where('northwhere('south>?',$s); - if (!empty($key)) $select->where('(title ilike ? or description ilike ?)','%'.$key.'%'); - $select->order('title')->limit($limit,$offset); - $this->view->metadata = $db->fetchAll($select); - $this->view->page=new Pagination($sum,$page); - $this->view->key=$key; - } - } - /* - * 根据id或uuid来查看元数据 - * id为一组数字,uuid为唯一标识符 - */ - function viewAction() - { - $id = (int)$this->_request->getParam('id'); - $sql="select m.*,s.status,g.id as gid,t.filename,i.doi as datadoi,i.authors,i.author_en,i.publisher,i.publisher_en, date_part('year',i.ts_published) as publish_year from normalmetadata m left join mdstatus s on m.uuid=s.uuid - left join thumbnail t on t.id=m.id left join geonetworkmetadata g on m.uuid=g.uuid left join datadoi i on i.uuid=m.uuid where "; - if (empty($id)) { - $uuid = $this->_request->getParam('uuid'); - if (empty($uuid)) $this->_redirect('/data'); - $where=$this->db->quoteInto('m.uuid = ?',$uuid); - } else { - $where=$this->db->quoteInto('m.id = ?',$id); - } - $sql.=$where; - $this->db->setFetchMode(Zend_Db::FETCH_OBJ); - $row=$this->db->fetchRow($sql); - if (!$row) $this->_redirect('/data'); - $id=$row->id; - $uuid=$row->uuid; - $this->view->metadata=$row; - //提前对表格进行预处理 - $wiki=new WikiFormat(); - $this->view->metadata->description=$wiki->parseTable($this->view->escape($row->description)); - //处理外部链接 - $this->view->metadata->description=preg_replace('/\[\s*(http:\/\/.+?)\s+(.*?)\]/m','$2',$this->view->metadata->description); - $this->view->thumburl='/gndata/'.sprintf('%05d',floor(($row->gid+0.1)/100)*100).'-'.sprintf('%05d',ceil(($row->gid+0.1)/100)*100-1)."/".$row->gid; - $this->view->thumburl.='/public/'.str_replace('_s.','.',$row->filename); - if (is_numeric($row->projection)) - { - $sql="select proj4text from spatial_ref_sys where auth_srid=?"; - $rs=$this->db->fetchRow($sql,array((int)$row->projection)); - if ($rs) $this->view->projection=$rs->proj4text; - } - - $sql = "select * from keyword where id=? order by keytype,ts_created"; - $sth = $this->db->prepare($sql); - $rs = $sth->execute(array($id)); - $this->view->keys = $sth->fetchAll(PDO::FETCH_BOTH); - - $sql='select c.code,cc.name,cc.name_zh from category c,categorycode cc where c.code=cc.code and c.id= ?'; - $state=$this->db->query($sql,array($id)); - $this->view->category=$state->fetchAll(); - $sql='select s.name,s.id from dataseries d, series s where d.sid=s.id and d.id= ?'; - $state=$this->db->query($sql,array($id)); - $this->view->series=$state->fetchAll(); - $sql=$this->db->quoteInto("select count(*) as count from dataorder where uuid=?",$uuid); - $row=$this->db->fetchRow($sql); - $this->view->downloaded=$row->count; - //update the viewed times - $sql="update mdstat set viewed=viewed+1 where uuid=?"; - $this->db->query($sql,array($uuid)); - $sql=$this->db->quoteInto("select viewed from mdstat where uuid=?",$uuid); - $row=$this->db->fetchRow($sql); - $this->view->viewed=$row->viewed; - //数据文档 - $sql="select linkage from onlineresource where uuid=? and description='数据说明文档'"; - $sql=$this->db->quoteInto($sql,$uuid); - $row=$this->db->fetchRow($sql); - if ($row) $this->view->doc=$row->linkage; - //相关资源 - $sql="select * from onlineresource where uuid=? and (linkage not like '%sanjiangyuan.org.cn%') and name<>'元数据地址'"; - $sql=$this->db->quoteInto($sql,$uuid); - $this->view->resources=$this->db->fetchAll($sql); - //相关文献:作者建议 - $sql="select r.* from reference r left join mdref m on m.refid=r.id where m.uuid=? and m.reftype=0 order by m.place"; - $sql=$this->db->quoteInto($sql,$uuid); +db=Zend_Registry::get('db'); + $this->view->config = Zend_Registry::get('config'); + $this->messenger=$this->_helper->getHelper('FlashMessenger'); + $this->view->messages = $this->messenger->getMessages(); + $this->view->theme = new Theme(); + $this->view->main_nav_pageID = "data"; + + $this->view->nav = array( + array('link'=>'/','title'=>''), + array('link'=>'/data','title'=>$this->view->config->title->data), + ); + } + function indexAction() + { + //序列 + $state=$this->db->query('select s.id,s.name,count(*) as count from series s,dataseries d where d.sid=s.id and length(s.name)>2 group by s.id,s.name order by count desc limit 15'); + $this->view->serie=$state->fetchAll(); + //分类 + $state=$this->db->query('select c.code,name,name_zh,count(*) from category c,categorycode cc where c.code=cc.code group by c.code,cc.name,cc.name_zh'); + $this->view->category=$state->fetchAll(); + //关键词 + $state=$this->db->query("select keyword,count(*) from keyword right join normalmetadata on keyword.id=normalmetadata.id where keytype='place' group by keyword order by count desc limit 20"); + $k1=$state->fetchAll(); + $state=$this->db->query("select keyword,count(*) from keyword right join normalmetadata on keyword.id=normalmetadata.id where keytype='theme' group by keyword order by count desc limit 20"); + //$state=$this->db->query("select k.keyword,count(k.keyword) from keyword k left join normalmetadata m on k.id=m.id where k.keytype='theme' and (m.uuid in (select uuid from dataorder group by uuid order by count(uuid) desc limit 20)) group by k.keyword order by count(k.keyword) desc limit 20"); + $k2=$state->fetchAll(); + $state=$this->db->query("select keyword,count(*) from keyword right join normalmetadata on keyword.id=normalmetadata.id where keytype='discipline' group by keyword order by count desc limit 20"); + $k3=$state->fetchAll(); + $state=$this->db->query("select keyword,count(*) from keyword right join normalmetadata on keyword.id=normalmetadata.id where keytype='stratum' group by keyword order by count desc limit 20"); + $k4=$state->fetchAll(); + $state=$this->db->query("select keyword,count(*) from keyword right join normalmetadata on keyword.id=normalmetadata.id where keytype='temporal' group by keyword order by count desc limit 20"); + //$state=$this->db->query("select k.keyword,count(k.keyword) from keyword k left join normalmetadata m on k.id=m.id where k.keytype='temporal' and (m.uuid in (select uuid from dataorder group by uuid order by count(uuid) desc limit 20)) group by k.keyword order by count(k.keyword) desc limit 20"); + $k5=$state->fetchAll(); + $this->view->keywords=array('place'=>$k1,'theme'=>$k2,'discipline'=>$k3,'stratum'=>$k4,'temporal'=>$k5); + //最新10个入库数据 + $state=$this->db->query('select id,uuid,title from normalmetadata order by id desc limit 10'); + $this->view->metadata = $state->fetchAll(); + //特色数据 + + //服务 + $l=new mydir($this->view->config->paths->newsletter,"newsletter_*.pdf"); + $this->view->newsletter=$l->getLast(); + $name=basename($this->view->newsletter,'.pdf'); + list(,$this->view->newsletterno)=explode("_",$name); + + $this->view->addHelperPath('helper','Zend_View_Helper_'); + $form=new MaillistForm(); + $form->submit->setLabel('输入邮件地址,订阅数据通讯列表'); + + $this->view->form=$form; + if ($this->_request->isPost()) { + //发送邮件 + $formData=$this->_request->getPost(); + if ($form->isValid($formData)) { + $mail=new WestdcMailer($this->view->config->smtp); + $mail->setFrom($formData['email']); + $mail->setBodyText("."); + $mail->setSubject('subscribe'); + $mail->addTo($this->view->config->reportemail); + $mail->send(); + $this->messenger->addMessage('订阅成功,请检查您的邮件!'); + $this->_redirect('/data/'); + } + } else { + $auth = Zend_Auth::getInstance(); + if ($auth->hasIdentity()) { + $user=$auth->getIdentity(); + $formData['email']=$user->email; + $form->populate($formData); + } + } + $searchform=new SearchForm(); + $this->view->searchform=$searchform; + + //其他连接 + } + function onlinelistAction() + { + $page=(int)$this->_request->getParam('page'); + if (empty($page)) $page=1; + $limit=30; + $offset=$limit*($page-1); + $state=$this->db->query('select count(*) from normalmetadata where datatype=0'); + $row=$state->fetchAll(); + $sum=$row[0]['count']; + $select=$this->db->select(); + $select->from('normalmetadata','*')->where('datatype=0')->order('title')->limitPage($page,$limit); + $this->view->metadata = $this->db->fetchAll($select); + $this->view->page=new Pagination($sum,$page,$limit); + } + function offlinelistAction() + { + $page=(int)$this->_request->getParam('page'); + if (empty($page)) $page=1; + $limit=30; + $offset=$limit*($page-1); + $state=$this->db->query('select count(*) from normalmetadata where datatype=1'); + $row=$state->fetchAll(); + $sum=$row[0]['count']; + $select=$this->db->select(); + $select->from('normalmetadata','*')->where('datatype=1')->order('title')->limitPage($page,$limit); + $this->view->metadata = $this->db->fetchAll($select); + $this->view->page=new Pagination($sum,$page,$limit); + } + //展示最近20条离线神情记录情况 + function offlineappAction() + { + $sql="select * from offlineapp where ts_approved is not null and pdflink<>'' and status>=0 order by ts_created desc limit 20"; + $this->view->rows=$this->db->fetchAll($sql); + } + function requestAction() + { + $archives=new Archive($this->db); + $this->view->item=$archives->getOneArchive('如何申请数据','help'); + } + function submitAction() + { + $archives=new Archive($this->db); + $this->view->item=$archives->getOneArchive('如何发布数据','help'); + } + function serviceAction() + { + } + function newsletterAction() + { + $l=new mydir($this->view->config->paths->newsletter,"newsletter_*.pdf"); + $this->view->newsletters=$l->toArray(); + $this->view->addHelperPath('helper','Zend_View_Helper_'); + rsort($this->view->newsletters); + $form=new MaillistForm(); + $this->view->form=$form; + $form->submit->setLabel('输入邮件地址,订阅数据通讯列表'); + if ($this->_request->isPost()) { + //发送邮件 + $formData=$this->_request->getPost(); + if ($form->isValid($formData)) { + //$mail=new Zend_Mail('utf-8'); + $mail=new WestdcMailer($this->view->config->smtp); + $mail->setFrom($formData['email']); + $mail->setBodyText("."); + $mail->setSubject('subscribe'); + $mail->addTo($this->view->config->reportemail); + /* + $tr=new Zend_Mail_Transport_Smtp($this->view->config->smtp->host, + array('ssl' => $this->view->config->smtp->ssl, + 'auth'=>$this->view->config->smtp->auth, + 'username'=>$this->view->config->smtp->username, + 'password'=>$this->view->config->smtp->password)); + $mail->send($tr); + */ + $mail->send(); + $this->messenger->addMessage('订阅成功,请检查您的邮件!'); + $this->_redirect('/data/newsletter'); + } + } else { + $auth = Zend_Auth::getInstance(); + if ($auth->hasIdentity()) { + $user=$auth->getIdentity(); + $formData['email']=$user->email; + $form->populate($formData); + } + } + } + function featureAction() + { + $sql="select * from datafeature order by id desc"; + $this->view->feature=$this->db->fetchAll($sql); + } + + function datasetcdAction() + { + $cd=new DatasetcdTable(); + $this->view->rows=$cd->fetchAll(); + } + /* + * 数据浏览 + */ + function browseAction() + { + $page=(int)$this->_request->getParam('page'); + if (empty($page)) $page=1; + $limit=10; + $offset=$limit*($page-1); + $state=$this->db->query('select count(*) from metadata'); + $row=$state->fetchAll(); + $sum=$row[0]['count']; + $select=$this->db->select(); + $select->from('metadata','*')->order('id desc')->limitPage($page,$limit); + $this->view->metadata = $this->db->fetchAll($select); + $this->view->page=new Pagination($sum,$page,$limit); + } + function tagAction() + { + $id = (int)$this->_request->getParam('id'); + $key = $this->_request->getParam('key'); + $keytype = $this->_request->getParam('keytype'); + $page=(int)$this->_request->getParam('page'); + if (empty($page)) $page=1; + $limit=10; + $offset=$limit*($page-1); + $sql='select keyword,count(*),keytype from keyword right join normalmetadata on keyword.id=normalmetadata.id '; + if (!empty($keytype) && ($keytype=='place' || $keytype=='theme' || $keytype=='discipline'||$keytype=='temporal')) $sql.=" where keytype='".$keytype."'"; + $sql.=' group by keyword,keytype order by keytype,keyword,count desc'; + $state=$this->db->query($sql); + $this->view->keywords=$state->fetchAll(); + + if ($id>0 or !empty($key)) { + if (empty($key)) { + $where=$this->db->quoteInto('id = ?',$id); + $row=$md->fetchRow($where); + $key=$row->name; + } + $this->view->codename=$key; + $sql=$this->db->quoteInto('select count(m.id) from normalmetadata m,keyword k where m.id=k.id and k.keyword=?',$key); + + $state=$this->db->query($sql); + $row=$state->fetchAll(); + $sum=$row[0]['count']; + $select=$this->db->select(); + $select->from('normalmetadata','*')->join('keyword','normalmetadata.id=keyword.id')->where('keyword.keyword=?',$key)->order('normalmetadata.title')->limitPage($page,$limit); + //$sql=$db->quoteInto('select m.* from metadata m,keyword k where m.id=k.id and k.keyword=?',$key); + //$state=$db->query($sql); + $this->view->metadata=$this->db->fetchAll($select); + $this->view->page=new Pagination($sum,$page,$limit); + } + } + /* + * 数据集序列浏览 + */ + function seriesAction() + { + $id = $this->_request->getParam('id'); + if (empty($id)) $id=0; + if (!is_numeric($id)) + { + $name=$id; + $id=''; + } + $keyword=$this->_request->getParam('keyword'); + if (empty($id)) { + if (!empty($name)) + { + $where=$this->db->quoteInto('name = ?',$name); + $row=$this->db->fetchRow("select * from series where ".$where); + } + } else { + $where=$this->db->quoteInto('id = ?',$id); + $row=$this->db->fetchRow("select * from series where ".$where); + } + if (!empty($id) or !empty($name)) + { + if (!$row) $this->_redirect('/data'); + $id=$row['id']; + } + $page=(int)$this->_request->getParam('page'); + if (empty($page)) $page=1; + $limit=10; + $offset=$limit*($page-1); + $state=$this->db->query('select s.id,name,count(*) from series s,dataseries d where d.sid=s.id group by s.id,s.name'); + $this->view->serie=$state->fetchAll(); + if ($id>0) { + //$where=$this->db->quoteInto('id = ?',$id); + //$row=$this->db->fetchRow("select * from series where ".$where); + $this->view->codename=$row['name']; + if (!empty($keyword)) + { + $sql='select count(m.id) as count from normalmetadata m,dataseries d,keyword k where m.id=d.id and m.id=k.id and d.sid=? and k.keyword=?'; + $row=$this->db->fetchAll($sql,array($id,$keyword)); + $this->view->codename.="【关键词:".$keyword."】"; + }else{ + $sql='select count(m.id) as count from normalmetadata m,dataseries d where m.id=d.id and d.sid=?'; + $row=$this->db->fetchAll($sql,array($id)); + } + $sum=$row[0]['count']; + $select=$this->db->select(); + $select->from('normalmetadata','*')->join('dataseries','normalmetadata.id=dataseries.id')->where('dataseries.sid=?',$id)->order('normalmetadata.title')->limitPage($page,$limit); + if (!empty($keyword)) $select->join('keyword','keyword.id=normalmetadata.id')->where('keyword.keyword=?',$keyword); + $this->view->metadata=$this->db->fetchAll($select); + $this->view->page=new Pagination($sum,$page,$limit); + //$this->view->showtools=($sum>$page)?true:false; + //$this->view->form=new SearchForm(); + $sql=$this->db->quoteInto("select keyword,count(*) as count from (select t.keyword,t.id from keyword t left join dataseries d on t.id=d.id where t.keytype='place' and d.sid=?) as f group by keyword order by count desc limit 30",$id); + $state=$this->db->query($sql); + $row=$state->fetchAll(); + $this->view->places=$row; + $this->view->seriesid=$id; + } else { + //提供全部数据集序列列表 + } + } + /* + * 分类浏览模式 + */ + function categoryAction() + { + $page = $this->_request->getParam('page'); + $code = (int)$this->_request->getParam('code'); + $state=$this->db->query('select c.code,name,name_zh,count(*) from category c,categorycode cc where c.code=cc.code group by c.code,cc.name,cc.name_zh'); + $this->view->category=$state->fetchAll(); + if ($code>0 && $code<20) { + $where=$this->db->quoteInto('code = ?',$code); + $row=$this->db->fetchRow("select * from categorycode where ".$where); + $this->view->codename=(empty($row['name_zh'])?$row['name']:$row['name_zh']); + $sql='select count(m.id) from normalmetadata m left join category c on m.id=c.id where c.code=?'; + $row=$this->db->fetchRow($sql,array($code)); + $sum=$row['count']; + $select=$this->db->select(); + $select->from('normalmetadata as m','*')->joinLeft('category as c','m.id=c.id')->where('c.code=?',$code)->order('m.title')->limitPage($page,$this->limit); + $this->view->metadata=$this->db->fetchAll($select); + $this->view->page=new Pagination($sum,$page,$this->limit); + } else { + //提供全部分类列表 + } + } + /* + * 时间浏览方式 + * todo:实现xml的缓存,基于时间的缓存(每天)?基于元数据修改的缓存,每次导入后都重新生成一次。 + */ + function timelineAction() + { + $fn="time1.xml"; + $rows=$this->db->fetchAll("select ts_created from normalmetadata order by ts_created desc limit 1"); + $last_update=strtotime($rows[0]['ts_created']); + if (!file_exists($fn) || (filemtime($fn)<$last_update)) + { + $dateformat="M j Y"; + $md = new MetadataTable(); + $db=$md->getAdapter(); + $state=$db->query('select id,uuid,description,title,timebegin,timeend from normalmetadata where timebegin is not null order by timebegin'); + $rows=$state->fetchAll(); + $timexml=''; + foreach($rows as $row) { + $timexml.=''; + $desc_length=mb_strlen($row['description'],"UTF-8"); + $desc=mb_substr($row['description'],0,($desc_length>300)?300:$desc_length,"UTF-8"); + if ($desc_length>300) $desc.=" ..."; + $timexml.=htmlspecialchars($desc); + $timexml.="\n"; + } + $timexml.=''; + $fp=fopen($fn,'w'); + fwrite($fp,$timexml); + fclose($fp); + } + //$this->_helper->layout->disableLayout(); + } + /* + * todo:空间浏览 + */ + function mapAction() + { + //use json & openlayers? + $id=(int)$this->_request->getParam('id'); + if ($id>0) $this->view->params="/id/$id"; + } + /* + * 产生geojson数据 + */ + function jsonAction() + { + $md=new MetadataTable(); + $db=$md->getAdapter(); + $id = (int)$this->_request->getParam('id'); + $where=''; + if (!empty($id)) { $where=' where id='.$id; } + $sql='select id,uuid,west,south,north,east,title from normalmetadata'.$where; + $state=$db->query($sql); + $rows=$state->fetchAll(); + $geomd=new GeoMetaData(); + foreach($rows as $row){ + if ($id) + $box=new GeoBox($row['west'],$row['south'],$row['east'],$row['north']); + else + $box=new GeoBoxLine($row['west'],$row['south'],$row['east'],$row['north']); + $feature=new Geofeature(); + $feature->id=$row['id']; + $feature->addProperties('title',$row['title']); + $feature->addProperties('uuid',$row['uuid']); + $feature->addProperties('id',$row['id']); + $feature->geometry=$box; + $geomd->addFeature($feature); + } + $this->_helper->json($geomd); + } + /* + * 时空动态浏览 + */ + function timemapAction() + { + $sql='select id,uuid,west,south,north,east,title,timebegin,timeend from normalmetadata where timebegin is not null'; + $this->view->rows=$this->db->fetchAll($sql); + } + /* + * 返回XML源文件 + */ + function xmlAction() + { + $uuid=$this->_request->getParam('uuid'); + $row=$this->db->fetchRow("select xml.data from xml left join metadata on xml.id=metadata.id where metadata.uuid=?",array($uuid)); + $this->_helper->layout->disableLayout(); + $this->_helper->viewRenderer->setNoRender(); + $this->getResponse()->setHeader('Content-Type', 'text/xml') + ->setBody($row['data']); + } + function detailAction() + { + $id=(int)$this->_request->getParam('id'); + $xml=new XmlTable(); + $db=$xml->getAdapter(); + $where=$db->quoteInto('id=?',$id); + $order='id desc'; + $row=$xml->fetchRow($where,$order); + // Load the XML source + $xml = new DOMDocument; + $xml->loadXML($row->data); + $xsl = new DOMDocument; + $xsl->load($this->view->config->westdc->xsl); + // Configure the transformer + $proc = new XSLTProcessor; + $proc->importStyleSheet($xsl); // attach the xsl rules + $this->view->xml=$proc->transformToXML($xml); + //$this->_helper->layout->disableLayout(); + //$this->_helper->viewRenderer->setNoRender(); + //$this->getResponse()->setHeader('Content-Type', 'text/html') + // ->setBody($proc->transformToXML($xml)); + } + function feedAction() + { + $feedArray = array( + 'title' => '中国西部环境与生态科学数据中心', + 'link' => 'http://'.$_SERVER['SERVER_NAME'].'/data/feed', + 'description' => '共享西部计划产生的数据', + 'language' => 'zh-CN', + 'charset' => 'utf-8', + 'published' => time(), + //'generator' => 'Zend Framework Zend_Feed', + 'entries' => array() + ); + $sql="select * from normalmetadata order by ts_created desc"; + $rs=$this->db->fetchAll($sql); + $feedArray['published']=strtotime($rs[0]['ts_created']); + foreach($rs as $r) + { + $feedArray['entries'][] = array( + 'title' => $r['title'], + 'link' => 'http://'.$_SERVER['SERVER_NAME'].'/data/' . $r['uuid'], + 'guid' => 'http://'.$_SERVER['SERVER_NAME'].'/data/' . $r['uuid'], + //'content'=>$r['description'], + 'description' => $r['description'], + 'lastUpdate' => strtotime($r['ts_created']) + ); + } + $feed = Zend_Feed::importArray($feedArray,'rss'); + $this->_helper->layout->disableLayout(); + $this->_helper->viewRenderer->setNoRender(); + $feed->send(); + } + /* + * todo: search + */ + function searchAction() + { + $this->view->addHelperPath('helper','Zend_View_Helper_'); + $form=new SearchForm(); + $this->view->form=$form; + //$form->submit->setLabel('快速搜索'); + $key=$this->_request->getParam('q'); + if (!empty($key)) { + //$formData=$this->_request->getPost(); + //include_once("bcspamblock.php"); + //if ($form->isValid($formData)) { + $page=@(int)$this->_request->getParam('page'); + if (empty($page)) $page=1; + $offset=$this->limit*($page-1); + $search=new Search($key); + $where=$search->sql_expr(array("title","description")); + $row=$this->db->fetchAll("select count(*) from normalmetadata where ".$where); + $sum=$row[0]['count']; + $sql="select uuid,title,id,description from normalmetadata where ".$where." order by title limit ? offset ?"; + $this->view->metadata=$this->db->fetchAll($sql,array($this->limit,$offset)); + $this->view->page=new Pagination($sum,$page,$this->limit); + $this->view->key=$key; + } + } + /* + * todo: 高级搜索 + */ + function advancesearchAction() + { + $this->view->addHelperPath('helper','Zend_View_Helper_'); + //$form=new SearchForm(); + //$this->view->form=$form; + + $md=new MetadataTable(); + $db=$md->getAdapter(); + $page=(int)$this->_request->getParam('page'); + if (empty($page)) $page=1; + $limit=10; + $offset=$limit*($page-1); + $key=$this->_request->getParam('q'); + $n=(int)$this->_request->getParam('n'); + $s=(int)$this->_request->getParam('s'); + $e=(int)$this->_request->getParam('e'); + $w=(int)$this->_request->getParam('w'); + if (!(empty($n) && empty($key))) { + if (empty($n)) $n=90; + if (empty($s)) $s=-90; + if (empty($e)) $e=180; + if (empty($w)) $w=-180; + $start=$this->_request->getParam('start'); + $end=$this->_request->getParam('end'); + if (!empty($key)) { + $sql='select count(*) from normalmetadata where east? and north? and (title ilike ? or description ilike ?)'; + $row=$db->fetchAll($sql,array($e,$w,$n,$s,'%'.$key.'%','%'.$key.'%')); + } else { + $sql='select count(*) from normalmetadata where east? and north?'; + $row=$db->fetchAll($sql,array($e,$w,$n,$s)); + } + $sum=$row[0]['count']; + $select=$db->select(); + $select->from('normalmetadata','*')->where('eastwhere('west>?',$w)->where('northwhere('south>?',$s); + if (!empty($key)) $select->where('(title ilike ? or description ilike ?)','%'.$key.'%'); + $select->order('title')->limit($limit,$offset); + $this->view->metadata = $db->fetchAll($select); + $this->view->page=new Pagination($sum,$page); + $this->view->key=$key; + } + } + /* + * 根据id或uuid来查看元数据 + * id为一组数字,uuid为唯一标识符 + */ + function viewAction() + { + $id = (int)$this->_request->getParam('id'); + $sql="select m.*,s.status,g.id as gid,t.filename,i.doi as datadoi,i.authors,i.author_en,i.publisher,i.publisher_en, date_part('year',i.ts_published) as publish_year from normalmetadata m left join mdstatus s on m.uuid=s.uuid + left join thumbnail t on t.id=m.id left join geonetworkmetadata g on m.uuid=g.uuid left join datadoi i on i.uuid=m.uuid where "; + if (empty($id)) { + $uuid = $this->_request->getParam('uuid'); + if (empty($uuid)) $this->_redirect('/data'); + $where=$this->db->quoteInto('m.uuid = ?',$uuid); + } else { + $where=$this->db->quoteInto('m.id = ?',$id); + } + $sql.=$where; + $this->db->setFetchMode(Zend_Db::FETCH_OBJ); + $row=$this->db->fetchRow($sql); + if (!$row) $this->_redirect('/data'); + $id=$row->id; + $uuid=$row->uuid; + $this->view->metadata=$row; + //提前对表格进行预处理 + $wiki=new WikiFormat(); + $this->view->metadata->description=$wiki->parseTable($this->view->escape($row->description)); + //处理外部链接 + $this->view->metadata->description=preg_replace('/\[\s*(http:\/\/.+?)\s+(.*?)\]/m','$2',$this->view->metadata->description); + $this->view->thumburl='/gndata/'.sprintf('%05d',floor(($row->gid+0.1)/100)*100).'-'.sprintf('%05d',ceil(($row->gid+0.1)/100)*100-1)."/".$row->gid; + $this->view->thumburl.='/public/'.str_replace('_s.','.',$row->filename); + if (is_numeric($row->projection)) + { + $sql="select proj4text from spatial_ref_sys where auth_srid=?"; + $rs=$this->db->fetchRow($sql,array((int)$row->projection)); + if ($rs) $this->view->projection=$rs->proj4text; + } + + $sql = "select * from keyword where id=? order by keytype,ts_created"; + $sth = $this->db->prepare($sql); + $rs = $sth->execute(array($id)); + $this->view->keys = $sth->fetchAll(PDO::FETCH_BOTH); + + $sql='select c.code,cc.name,cc.name_zh from category c,categorycode cc where c.code=cc.code and c.id= ?'; + $state=$this->db->query($sql,array($id)); + $this->view->category=$state->fetchAll(); + $sql='select s.name,s.id from dataseries d, series s where d.sid=s.id and d.id= ?'; + $state=$this->db->query($sql,array($id)); + $this->view->series=$state->fetchAll(); + $sql=$this->db->quoteInto("select count(*) as count from dataorder where uuid=?",$uuid); + $row=$this->db->fetchRow($sql); + $this->view->downloaded=$row->count; + //update the viewed times + $sql="update mdstat set viewed=viewed+1 where uuid=?"; + $this->db->query($sql,array($uuid)); + $sql=$this->db->quoteInto("select viewed from mdstat where uuid=?",$uuid); + $row=$this->db->fetchRow($sql); + $this->view->viewed=$row->viewed; + //数据文档 + $sql="select linkage from onlineresource where uuid=? and description='数据说明文档'"; + $sql=$this->db->quoteInto($sql,$uuid); + $row=$this->db->fetchRow($sql); + if ($row) $this->view->doc=$row->linkage; + //相关资源 + $sql="select * from onlineresource where uuid=? and (linkage not like '%ftp.westgis%') and name<>'元数据地址'"; + $sql=$this->db->quoteInto($sql,$uuid); + $this->view->resources=$this->db->fetchAll($sql); + //建议参考文献 + $sql="select r.* from reference r left join mdref m on m.refid=r.id where m.uuid=? and m.reftype=0 order by m.place"; + $sql=$this->db->quoteInto($sql,$uuid); $this->view->ref=$this->db->fetchAll($sql); - //用户发表文献 - $sql="select r.* from reference r left join mdref m on m.refid=r.id where m.uuid=? and m.reftype=1 order by r.language asc,r.year desc,r.ts_created desc limit 15"; - $sql=$this->db->quoteInto($sql,$uuid); - $this->view->userref=$this->db->fetchAll($sql); - //多篇引用形式:hiwater - $sql="select r.* from reference r left join mdref m on m.refid=r.id where m.uuid=? and m.reftype=3 order by m.place"; - $sql=$this->db->quoteInto($sql,$uuid); - $this->view->mcitation=$this->db->fetchAll($sql); - //相关用户 - $sql="select p.email,p.individual,p.organisation,r.role from role r left join responsible p on r.resid=p.id where r.uuid=? order by r.role,r.id"; - $this->view->authors=$this->db->fetchAll($sql,array($uuid)); - //数据限制信息 - $sql="select u.* from uselimit u left join mdlimit m on u.id=m.lid where m.uuid=?"; - $this->view->uselimits=$this->db->fetchAll($sql,array($uuid)); - //相关下载 - $sql = "select d.uuid,count(distinct(d.userid)) as downtimes,m.title from dataorder d left join metadata m on d.uuid=m.uuid where d.userid in ( - select distinct(userid) from dataorder where uuid=? and status in (0,5) - ) and d.uuid<>? and length(m.title)>2 group by d.uuid,m.title order by count(distinct(d.userid)) desc limit 10;"; - $this->view->downlists = $this->db->fetchAll($sql,array($uuid,$uuid)); - //相关文献 - $sql="select a.*,array_to_string(array(select author from knl_author t where t.item_id=a.item_id order by place asc),'; ') as author from knl_article a where ("; - foreach($this->view->keys as $k) - { - if ($k['keytype']=='theme') - { - $sql.=" a.title like '%".$k['keyword']."%' or "; - } - } - $sql.=" 1<>1) order by a.ts_created desc limit 10"; - $this->view->literature=$this->db->fetchAll($sql); - //相关元数据,根据同名关键词实现 - $sql="select distinct(md.uuid),md.title from keyword kw left join normalmetadata md on kw.id=md.id where kw.keyword in (select k.keyword from keyword k left join metadata m on k.id=m.id where m.id=? and k.keytype='theme') and kw.id<>? limit 10"; - $this->view->related=$this->db->fetchAll($sql,array($id,$id)); - //用户下载记录 - $sql = "select o.ts_created,m.uuid,u.realname,u.unit,oa.project as onlineproject, fa.project as offlineproject - from dataorder as o left join metadata as m on o.uuid = m.uuid left join users as u on o.userid=u.id - left join onlineapp oa on o.onlineappid=oa.id left join offlineapp fa on o.offlineappid=fa.id - where m.uuid = '$uuid' and (o.status=0 or o.status=5) and u.realname IS NOT NULL order by o.ts_created desc limit 10"; - $this->view->downhistory=$this->db->fetchAll($sql); - //数据附件 - $sql = $this->db->quoteInto("select m.id,a.realname from mdattach m left join attachments a on m.id=a.id where m.uuid=?",$uuid); - $this->view->attachments = $this->db->fetchAll($sql); - //数据版本 - $sql = "SELECT count(id) as c FROM mdversion WHERE uuid=? AND changelog IS NOT NULL"; - $sth = $this->db->prepare($sql); - $sth->execute(array($uuid)); - $row = $sth->fetch(); - $this->view->version = $row; - $archives = new Archive($this->db); - $data_archives = $archives->getArchiveByUUID($uuid); - if(!empty($data_archives)) - { - foreach($data_archives as $k=>$v) - { - $data_archives[$k]['url'] = $archives->getArchiveUrlByCid($v['id']); - } - } - $this->view->data_archives = $data_archives; - //支持项目 - include_once("data/Fund.php"); - $fund = new Fund($this->db); - $this->view->fund = $fund->fetch($uuid); - - //判断特殊数据服务 - $this->view->dataService= $this->checkDataService($uuid); - - //自动跳转 - $sql="select s.* from datasource d left join source s on d.sourceid=s.id where d.uuid=?"; - $row=$this->db->fetchRow($this->db->quoteInto($sql,$uuid)); - $jump=$this->_request->getParam('jump'); - if ($jump=="") $jump=1;//默认跳转 - if (@$row->has_pages && ($jump==1)) - { - $this->_helper->viewRenderer($row->code.'/view',null,true); - } - } //viewAction - - //检查特殊数据服务是否存在 - private function checkDataService($uuid) - { - $order = new \Order\Mount\OrderOperate(); - $service = $order->getDataService($uuid); - - if(empty($service)) - { - return NULL; - }else{ - if($order->checkOrderHas($uuid)) - { - return NULL; - }else{ - return $service; - } - } - }//checkDataService - - //特殊数据服务 - public function dataserviceAction() - { - - $uuid = $this->_getParam('uuid'); - - if(empty($uuid)) - { - $this->jsonexit(array("error"=>"参数错误")); - } - - $dataservice = new \data\DataService(); - $info = $dataservice->get($uuid); - - - //暂时只有wsn - { - $this->_helper->layout->disableLayout(); - $this->_helper->viewRenderer->setNoRender(); - - $data = array( - "type"=>"wsn", //服务类型 - "info"=>$info, //信息 dataservice 表中的字段 - "callback"=>"westdc.dataservice.wsn.request()", //成功后的js回调函数 - ); - - $data['data'] = $dataservice->getWsnData("site",$uuid); - - if(empty($data['data'])) - { - $this->jsonexit(array("error"=>'数据接口错误,请联系管理员')); - return true; - } - - if(!is_array($data['data'])) - { - $this->jsonexit(array("error"=>$data['data'])); - return true; - } - - $this->_helper->layout->disableLayout(); - $this->_helper->viewRenderer->setNoRender(); - - $this->jsonexit($data); - } - // WSN end - - } - - public function wsnAction() - { - $this->_helper->layout->disableLayout(); - $this->_helper->viewRenderer->setNoRender(); - - $type = $this->_getParam('type'); - $uuid = $this->_getParam("uuid"); - - $dataservice = new DataService(); - - if($type == 'var') - { - $sites = array( - "chk"=>$this->_getParam("siteid") - ); - - $info = $dataservice->get($uuid); - - $data = array( - "type"=>"wsn", //服务类型 - "info"=>$info, //信息 dataservice 表中的字段 - "callback"=>"westdc.dataservice.wsn.Submit()", //成功后的js回调函数 - ); - + //用户发表文献 + $sql="select r.* from reference r left join mdref m on m.refid=r.id where m.uuid=? and m.reftype=1"; + $sql=$this->db->quoteInto($sql,$uuid); + $this->view->userref=$this->db->fetchAll($sql); + //多篇引用形式:hiwater + $sql="select r.* from reference r left join mdref m on m.refid=r.id where m.uuid=? and m.reftype=3 order by m.place"; + $sql=$this->db->quoteInto($sql,$uuid); + $this->view->mcitation=$this->db->fetchAll($sql); + //相关用户 + $sql="select p.email,p.individual,p.organisation,r.role from role r left join responsible p on r.resid=p.id where r.uuid=? order by r.role,r.id"; + $this->view->authors=$this->db->fetchAll($sql,array($uuid)); + //数据限制信息 + $sql="select u.* from uselimit u left join mdlimit m on u.id=m.lid where m.uuid=?"; + $this->view->uselimits=$this->db->fetchAll($sql,array($uuid)); + //相关下载 + $sql = "select d.uuid,count(distinct(d.userid)) as downtimes,m.title from dataorder d left join metadata m on d.uuid=m.uuid where d.userid in ( + select distinct(userid) from dataorder where uuid=? and status in (0,5) + ) and d.uuid<>? and length(m.title)>2 group by d.uuid,m.title order by count(distinct(d.userid)) desc limit 10;"; + $this->view->downlists = $this->db->fetchAll($sql,array($uuid,$uuid)); + //相关文献 + $sql="select a.*,array_to_string(array(select author from knl_author t where t.item_id=a.item_id order by place asc),'; ') as author from knl_article a where ("; + foreach($this->view->keys as $k) + { + if ($k['keytype']=='theme') + { + $sql.=" a.title like '%".$k['keyword']."%' or "; + } + } + $sql.=" 1<>1) order by a.ts_created desc limit 10"; + $this->view->literature=$this->db->fetchAll($sql); + //相关元数据,根据同名关键词实现 + $sql="select distinct(md.uuid),md.title from keyword kw left join normalmetadata md on kw.id=md.id where kw.keyword in (select k.keyword from keyword k left join metadata m on k.id=m.id where m.id=? and k.keytype='theme') and kw.id<>? limit 10"; + $this->view->related=$this->db->fetchAll($sql,array($id,$id)); + //用户下载记录 + $sql = "select o.ts_created,m.uuid,u.realname,u.unit,oa.project as onlineproject, fa.project as offlineproject + from dataorder as o left join metadata as m on o.uuid = m.uuid left join users as u on o.userid=u.id + left join onlineapp oa on o.onlineappid=oa.id left join offlineapp fa on o.offlineappid=fa.id + where m.uuid = '$uuid' and (o.status=0 or o.status=5) and u.realname IS NOT NULL order by o.ts_created desc limit 10"; + $this->view->downhistory=$this->db->fetchAll($sql); + //数据附件 + $sql = $this->db->quoteInto("select m.id,a.realname from mdattach m left join attachments a on m.id=a.id where m.uuid=?",$uuid); + $this->view->attachments = $this->db->fetchAll($sql); + //数据版本 + $sql = "SELECT count(id) as c FROM mdversion WHERE uuid=? AND changelog IS NOT NULL"; + $sth = $this->db->prepare($sql); + $sth->execute(array($uuid)); + $row = $sth->fetch(); + $this->view->version = $row; + $archives = new Archive($this->db); + $data_archives = $archives->getArchiveByUUID($uuid); + if(!empty($data_archives)) + { + foreach($data_archives as $k=>$v) + { + $data_archives[$k]['url'] = $archives->getArchiveUrlByCid($v['id']); + } + } + $this->view->data_archives = $data_archives; + //支持项目 + include_once("data/Fund.php"); + $fund = new Fund($this->db); + $this->view->fund = $fund->fetch($uuid); + + //判断特殊数据服务 + $this->view->dataService= $this->checkDataService($uuid); + + //自动跳转 + $sql="select s.* from datasource d left join source s on d.sourceid=s.id where d.uuid=?"; + $row=$this->db->fetchRow($this->db->quoteInto($sql,$uuid)); + $jump=$this->_request->getParam('jump'); + if ($jump=="") $jump=1;//默认跳转 + if (@$row->has_pages && ($jump==1)) + { + $this->_helper->viewRenderer($row->code.'/view',null,true); + } + } //viewAction + + //检查特殊数据服务是否存在 + private function checkDataService($uuid) + { + $order = new \Order\mount\OrderOperate(); + $service = $order->getDataService($uuid); + + if(empty($service)) + { + return NULL; + }else{ + if($order->checkOrderHas($uuid)) + { + return NULL; + }else{ + return $service; + } + } + }//checkDataService + + //特殊数据服务 + public function dataserviceAction() + { + + $uuid = $this->_getParam('uuid'); + + if(empty($uuid)) + { + $this->jsonexit(array("error"=>"参数错误")); + } + + $dataservice = new \data\DataService(); + $info = $dataservice->get($uuid); + + + //暂时只有wsn + { + $this->_helper->layout->disableLayout(); + $this->_helper->viewRenderer->setNoRender(); + + $data = array( + "type"=>"wsn", //服务类型 + "info"=>$info, //信息 dataservice 表中的字段 + "callback"=>"westdc.dataservice.wsn.request()", //成功后的js回调函数 + ); + + $data['data'] = $dataservice->getWsnData("site",$uuid); + + if(empty($data['data'])) + { + $this->jsonexit(array("error"=>'数据接口错误,请联系管理员')); + return true; + } + + if(!is_array($data['data'])) + { + $this->jsonexit(array("error"=>$data['data'])); + return true; + } + + $this->_helper->layout->disableLayout(); + $this->_helper->viewRenderer->setNoRender(); + + $this->jsonexit($data); + } + // WSN end + + } + + public function wsnAction() + { + $this->_helper->layout->disableLayout(); + $this->_helper->viewRenderer->setNoRender(); + + $type = $this->_getParam('type'); + $uuid = $this->_getParam("uuid"); + + $dataservice = new DataService(); + + if($type == 'var') + { + $sites = array( + "chk"=>$this->_getParam("siteid") + ); + + $info = $dataservice->get($uuid); + + $data = array( + "type"=>"wsn", //服务类型 + "info"=>$info, //信息 dataservice 表中的字段 + "callback"=>"westdc.dataservice.wsn.Submit()", //成功后的js回调函数 + ); + $data['data'] = $dataservice->getWsnData("var",$uuid,$sites); - - if(empty($data['data'])) - { - $this->jsonexit(array("error"=>'数据接口错误,请联系管理员')); - return true; - } - - if(!is_array($data['data'])) - { - $this->jsonexit(array("error"=>$data['data'])); - return true; - } - - $this->jsonexit($data); - return true; - } - - if($type == "submit") - { - $info = $dataservice->get($uuid); - $param = array( - "site" => $this->_getParam("site"), - ); - - $data = array( - "type"=>"wsn", //服务类型 - "info"=>$info, //信息 dataservice 表中的字段 - "callback"=>"westdc.dataservice.wsn.Submited()", //成功后的js回调函数 - ); - + + if(empty($data['data'])) + { + $this->jsonexit(array("error"=>'数据接口错误,请联系管理员')); + return true; + } + + if(!is_array($data['data'])) + { + $this->jsonexit(array("error"=>$data['data'])); + return true; + } + + $this->jsonexit($data); + return true; + } + + if($type == "submit") + { + $info = $dataservice->get($uuid); + $param = array( + "site" => $this->_getParam("site"), + ); + + $data = array( + "type"=>"wsn", //服务类型 + "info"=>$info, //信息 dataservice 表中的字段 + "callback"=>"westdc.dataservice.wsn.Submited()", //成功后的js回调函数 + ); + $data['data'] = $dataservice->getWsnData("submit",$uuid,$param); - - - if(empty($data['data'])) - { - $this->jsonexit(array("error"=>'数据接口错误,请联系管理员')); - return true; - } - - if(!is_array($data['data'])) - { - $this->jsonexit(array("error"=>$data['data'])); - return true; - } - - $order = new Order(); - $status = $order->addOrder($uuid,json_encode($data['data']['site'],JSON_NUMERIC_CHECK)); - if($status !== true) - { - $this->jsonexit(array("error"=>$status)); - return true; - } - - $this->jsonexit($data); - return true; - } - } - - - - /* - getversionAction() 获取数据版本 - */ - function getversionAction(){ - - $ac = $this->_getParam('ac'); - $uuid = $this->_getParam('uuid'); - - if($ac == 'list') - { - $this->_helper->layout->disableLayout(); - $this->_helper->viewRenderer->setNoRender(); - - $sql = "SELECT v.changelog,v.ts_created,u.username FROM mdversion v - LEFT JOIN users u ON v.userid=u.id - WHERE v.uuid=? AND v.changelog IS NOT NULL - ORDER BY v.ts_created DESC"; - - $sth = $this->db->prepare($sql); - $sth->execute(array($uuid)); - $rows = $sth->fetchAll(); - - if($rows) - { - foreach($rows as $k=>$v) - { - $rows[$k]['ts_created'] = date("Y-m-d H:i",strtotime($v['ts_created'])); - $rows[$k]['changelog'] = str_replace("\n","

    ",$v['changelog']); - } - $data = array("list"=>$rows); - $this->jsonexit($data); - return true; - }else{ - $data = array("error"=>"处理中出现错误"); - $this->jsonexit($data); - return true; - } - } - - }//getversionAction() - - function replace($string){ - $patterns = array("/\"/i","/\'/i"); - $replacements = array("“","‘"); - ksort($patterns); - ksort($replacements); - return preg_replace($patterns, $replacements, $string); - }//引号替换 - - - function postcommentAction(){ - $this->_helper->layout->disableLayout(); - $this->_helper->viewRenderer->setNoRender(); - try{ - $auth = Zend_Auth::getInstance(); - if($auth->hasIdentity()) - { - $user = $auth->getIdentity(); - $userid = $user->id; - }else - { - $userid=0; - } - - $author = mb_substr($this->replace(trim($this->_request->getParam('author'))),0,30,'UTF-8'); - $email = mb_substr($this->replace(trim($this->_request->getParam('email'))),0,60,'UTF-8'); - $url = mb_substr($this->replace(trim($this->_request->getParam('url'))),0,60,'UTF-8'); - $content = $this->replace(trim($this->_request->getParam('content'))); - $vdcode = mb_substr($this->replace(trim($this->_request->getParam('vdcode'))),0,4,'UTF-8'); - - if(empty($author)) - { - echo "请输入您的名字"; - exit(); - } - - if(strlen($author)<3) exit("姓名长度不得少于2个汉字 :)"); - - if(empty($email)) - { - echo "请输入您的电子邮箱地址"; - exit(); - } - - if(strlen($email)<4) exit("Email长度太短,请填写正确的Email :)"); - - if(!preg_match("/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/i",$email)) - { - echo "Email格式不正确"; - exit(); - } - - if(strlen($content)<5) exit("评论长度不得少于3个汉字 :)"); - - if(preg_match("/script/i",$content)) - { - $content = preg_replace("/script/i","script",$content); - } - - if(preg_match("/<|>/",$content)) - { - $data=array( - '<'=>'<', - '>'=>'>', - ); - - $patterns = array(); - $replacements = array(); - foreach($data as $k=>$v) - { - $patterns[]='/'.$k.'/i'; - $replacements[]=$v; - } - ksort($patterns); - ksort($replacements); - $content=preg_replace($patterns, $replacements, $content); - if(!empty($url)) - { - $url=preg_replace($patterns, $replacements, $url); - } - } - - if(preg_match("/script/i",$url)) - { - $url = preg_replace("/script/i","script",$url); - } - - if(!preg_match("/http:\/\//",$url)) - { - $url = "http://".$url; - } - - $uuid = trim($this->_request->getParam('uuid')); - - if(!preg_match("/^[0-9A-Za-z]{8}-[0-9A-Za-z]{4}-[0-9A-Za-z]{4}-[0-9A-Za-z]{4}-[0-9A-Za-z]{12}$/",$uuid)) - { - echo "参数错误!"; - exit(); - } - - if(strtolower($vdcode) != $_SESSION['vdcodes']) - { - echo "验证码错误,请重新输入"; - exit(); - } - - - $data = array( - 'uuid' => $uuid, - 'uid' => $userid, - 'author' => $author, - 'email' => $email, - 'url' => $url, - 'ip' => $_SERVER['REMOTE_ADDR'], - 'content' => $content, - 'agent' => $_SERVER['HTTP_USER_AGENT'], - 'type' => 'comment' - ); - - $sql = "INSERT INTO comments (author,email,url,ip,content,agent,type,uuid,userid) VALUES (?,?,?,?,?,?,?,?,?)"; - $sth = $this->db->prepare($sql); - $exec = $sth->execute(array($data['author'],$data['email'],$data['url'],$data['ip'],$data['content'],$data['agent'],$data['type'],$data['uuid'],$data['uid'])); - - if($exec) - { - $sql = "SELECT u.email FROM mdauthor au - LEFT JOIN users u on au.userid=u.id - WHERE au.uuid='$uuid'"; - $sth = $this->db->query($sql); - $rows = $sth->fetchAll(); - - @$mailtp=new EmailText( - $this->db, - 'data-comment-note', - array( - 'user' =>$user->username, - 'uuid' =>$data['uuid'], - 'title' =>$this->replace(trim($this->_request->getParam('mdtitle'))), - 'content'=>$content - ) - ); - @$mail=new WestdcMailer($this->view->config->smtp); - @$mail->setBodyText($mailtp->getBody()); - @$mail->setFrom($this->view->config->service->email,'西部数据中心服务组'); - @$mail->addTo($this->view->config->service->email); - if(is_array($rows) && count($rows)>0) - { - foreach($rows as $v) - { - @$mail->addTo($v['email']); - } - } - @$mail->setSubject($mailtp->getSubject()); - @$mail->send(); - $msg = "用户".$user->username."对元数据《".$this->replace(trim($this->_request->getParam('mdtitle')))."》进行了评论,点击查看"; - include_once("message.php"); - message::post($this->db,0,-1,"收到新数据评论",$msg); - echo "评论成功"; - exit(); - }else - { - echo "评论失败,请重试 :)"; - exit(); - } - }catch(Exception $e){ - echo "出错了,请稍后再试"; - exit(); - } - }//ajax评论 - - - /* - * 数据评论,根据UUID读取 - */ - function commentAction() - { - $this->_helper->layout->disableLayout(); - $this->_helper->viewRenderer->setNoRender(); - $uuid=$this->_request->getParam('uuid'); - if (empty($uuid)) die(); - $sql="select * from comments where uuid=? AND reply=0 order by id desc"; - $comments=$this->db->fetchAll($sql,array($uuid)); - - $paginator = Zend_Paginator::factory($comments); - $paginator->setCurrentPageNumber($this->_getParam('page')); - $paginator->setItemCountPerPage(5); - $paginator->setView($this->view); - Zend_View_Helper_PaginationControl::setDefaultViewPartial('data/pagination_ajax.phtml'); - - include_once("Avatar.php"); - $avatar = new Avatar(); - if ($paginator) - { - foreach($paginator as $c) - { - //$author=$this->view->escape($c['author']); - $sql = "SELECT cr.id,cr.content as body,cr.reply,u.username,cr.ts_created,u.usertype,u.email as email, - (SELECT au.uuid FROM mdauthor au WHERE au.userid=u.id AND au.uuid='$uuid') as uuid - FROM comments cr - LEFT JOIN users u ON cr.userid=u.id - WHERE cr.reply=?"; - $sth = $this->db->prepare($sql); - $sth->execute(array($c['id'])); - $replys = $sth->fetchAll(); - $replyhtml = ""; - if(!empty($replys) || count($replys)>0) - { - foreach($replys as $v) - { - $usertype = ""; - $color = ""; - if($v['usertype'] == "administrator") - { - $usertype = "[管理员]"; - $color="#009d00"; - } - if($v['uuid'] == $uuid) - { - $usertype = "[数据作者]"; - $color="#add2e9"; - } - if(!empty($color)) - { - $color = 'background:'.$color.';color:#FFFFFF;'; - } - $img = $avatar->Get($v['email'],48); - $replyhtml .=' -

    - - - -
    - 回复于'.date('Y-m-d H:i:s',strtotime($v['ts_created'])).' -
    '.$v['username'].' '.$usertype.'
    - '.$v['body'].' -
    -
    - '; - - } - } - - $img = $avatar->Get($c['email'],64); - //$img = ''; - - $author = $c['author']; - $author = ($c['url'])?''.$author.'':$author; - $author = ''.$author.""; - $time = '发表于'.date('Y-m-d H:i:s',strtotime($c['ts_created'])).''; - print ' -
    - -
    - '.$time.' -

    '.$c['author'].'

    - '.$c['content'].' - '.$replyhtml.' -
    -
    - '; - } - echo '
    '.$paginator.'
    '; - }//else echo "
  • No comments.
  • "; - }//评论列表 - - /** - * 判断用户是否填写了申请信息 - * @param string $uuid - * @param int $userid - */ - function todownloadAction() { - - $this->view->pageID = "account-dataorder"; - - $this->_helper->viewRenderer('onlineapp-download'); - - $this->view->uuid = $uuid = $this->_request->getParam('uuid'); - - $auth = Zend_Auth::getInstance(); - if (!$auth->hasIdentity()) - { - $this->view->AlertType = "alert-error"; - $this->view->msg = "请先登录您的账户后进行下载,页面将自动跳转"; - $this->view->jump_url = '/account/login/?href=/data/todownload/uuid/'.$uuid; - return true; - } - - if(empty($uuid)) - { - $this->view->AlertType = "alert-error"; - $this->view->msg = "参数错误!"; - $this->view->jump_url = "/data"; - return true; - } - - $this->view->projectType = array( - "请选择项目类型" => "", - "国家973计划项目课题" => "国家973计划项目课题", - "国家863计划课题"=>"国家863计划课题", - "国家级科技支撑课题" => "国家级科技支撑课题", - "国家级科技重大专项" => "国家级科技重大专项", - "国家级国家重大工程" => "国家级国家重大工程", - "国家级国家自然科学基金" => "国家级国家自然科学基金", - "国际合作项目"=>"国际合作项目", - "省部级项目" => "省部级项目", - "其他项目工程" => "其他项目工程", - ); - - $userid = Zend_Auth::getInstance()->getIdentity()->id; - - $submit = $this->_getParam('submit'); - if(!empty($submit)){ - - $datas = array(); - $datas['realname'] = $this->_request->getParam('realname'); - $datas['unit'] = $this->_request->getParam('unit'); - $datas['phone'] = $this->_request->getParam('phone'); - $datas['address'] = $this->_request->getParam('address'); - $datas['postcode'] = $this->_request->getParam('postcode'); - $datas['email'] = $this->_request->getParam('email'); - $datas['project'] = $this->_request->getParam('project'); - $datas['project_id'] = $this->_request->getParam('project_id'); - $datas['project_type'] = $this->_request->getParam('project_type'); - $datas['project_title'] = $this->_request->getParam('project_title'); - $datas['project_leader']= $this->_request->getParam('project_leader'); - - $this->view->info = $datas; - - $this->view->AlertType = "alert-error"; - - foreach($datas as $k=>$v) - { - if(empty($v)) - { - $this->view->error = "每一项内容都需要填写"; - return true; - } - } - - if(!is_numeric($datas['postcode'])) - { - $this->view->error = "联系电话和邮政编码请填写数字"; - return true; - } - - if(!preg_match("/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/i",$datas['email'])) - { - $this->view->error = "请填写正确的email地址"; - return true; - } - - if(mb_strlen($datas['project'],"utf-8")<8) - { - $this->view->error = "项目介绍内容不少于8个字符"; - return true; - } - - if(preg_match('/^\d+$/',$datas['project'])) - { - $this->view->error = "请输入有意义的项目介绍内容"; - return true; - } - - $data = array( - 'userid' => $userid, - 'username' => $datas['realname'], - 'unit' => $datas['unit'], - 'phone' => $datas['phone'], - 'address' => $datas['address'], - 'postcode' => $datas['postcode'], - 'project' => $datas['project'], - 'uuid' =>$uuid, - 'email' =>$datas['email'], - 'project_id'=>$datas['project_id'], - 'project_title'=>$datas['project_title'], - 'project_type'=>$datas['project_type'], - 'project_leader'=>$datas['project_leader'] - ); - - if($this->db->insert('onlineapp',$data)) - { - $select = "select id from onlineapp where userid='$userid' order by id desc"; - $re=$this->db->query($select); - $row=$re->fetch(); - - $this->view->AlertType = "alert-success"; - $this->view->jump_url = '/data/download/uuid/'.$uuid.'/onlineappid/'.$row['id']; - $this->view->msg = "您的信息已经提交成功,可以进行下载。请等待页面自动跳转,view->jump_url."\">或点击这里进入下载页面"; - - $msg = "用户{$data['username']} 填写了在线数据申请表 查看详细"; - $title = "用户 {$data['username']} 申请了在线下载数据"; - include_once("message.php"); - message::post($this->db,0,-1,$title,$msg); - - return true; - } - else { - $this->view->AlertType = "alert-error"; - $this->view->error = "申请失败,请稍后重新尝试"; - $this->view->info = $data; - return true; - } - - return true; - }else{ - - $testsql="select * from onlineapp where userid='$userid' and uuid='$uuid' order by id desc"; - $result=$this->db->query($testsql); - $rows = $result->fetch(); - if (empty($rows['id'])) - { - include_once("Users.php"); - $usr = new Users($this->db); - $this->view->info = $usr->getUserInfo($userid); - return true; - } - else - { - $datas['realname'] = $rows['username']; - $datas['unit'] = $rows['unit']; - $datas['phone'] = $rows['phone']; - $datas['address'] = $rows['address']; - $datas['postcode'] = $rows['postcode']; - $datas['email'] = $rows['email']; - $datas['project'] = $rows['project']; - $datas['project_id'] = $rows['project_id']; - $datas['project_type'] = $rows['project_type']; - $datas['project_title'] = $rows['project_title']; - $datas['project_leader'] = $rows['project_leader']; - $this->view->info = $datas; - return true; - } - } - - return true; - - $userid=Zend_Auth::getInstance()->getIdentity()->id; - - $datas = array(); - $submited = $this->_request->getParam('submited'); - $datas['username'] = $this->_request->getParam('username'); - $datas['unit'] = $this->_request->getParam('unit'); - $datas['phone'] = $this->_request->getParam('phone'); - $datas['address'] = $this->_request->getParam('address'); - $datas['postcode'] = $this->_request->getParam('postcode'); - $datas['email'] = $this->_request->getParam('email'); - $datas['project'] = $this->_request->getParam('project'); - $datas['project_id'] = $this->_request->getParam('projectid'); - $datas['project_type'] = $this->_request->getParam('projecttype'); - $datas['project_title'] = $this->_request->getParam('projecttitle'); - $datas['project_leader'] = $this->_request->getParam('projectleader'); - - - - $form=$this->creatform($datas); - - if (!empty($submited) && $ft==0){ - - foreach($datas as $k=>$v) - { - if($v == '') - { - echo $form.''; - exit(); - } - } - - if(!is_numeric($datas['postcode'])) - { - echo $form.''; - exit(); - } - - if(!preg_match("/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/i",$datas['email'])) - { - echo $form.''; - exit(); - } - - if(mb_strlen($datas['project'],"utf-8")<8) - { - echo $form.''; - exit(); - } - - if(preg_match('/^\d+$/',$datas['project'])) - { - echo $form.''; - exit(); - } - - $data = array( - 'userid' => $userid, - 'username' => $datas['username'], - 'unit' => $datas['unit'], - 'phone' => $datas['phone'], - 'address' => $datas['address'], - 'postcode' => $datas['postcode'], - 'project' => $datas['project'], - 'uuid' =>$uuid, - 'email' =>$datas['email'], - 'project_id'=>$datas['project_id'], - 'project_title'=>$datas['project_title'], - 'project_type'=>$datas['project_type'], - 'project_leader'=>$datas['project_leader'] - ); - - if($this->db->insert('onlineapp',$data)) - { - $select = "select id from onlineapp where userid='$userid' order by id desc"; - $re=$this->db->query($select); - $row=$re->fetch(); - echo "您的信息已经提交成功,可以进行下载。
    - 如果页面没有自动跳转,请点击这里进入下载页面 - "; - $msg = "用户{$data['username']} 填写了在线数据申请表 查看详细"; - $title = "用户 {$data['username']} 申请了在线下载数据"; - include_once("message.php"); - message::post($this->db,0,-1,$title,$msg); - exit(); - } - else { - echo $form.''; - exit(); - } - - }else if( $ft==1 ) - { - $testsql="select * from onlineapp where userid='$userid' and uuid='$uuid' order by id desc"; - $result=$this->db->query($testsql); - $rows = $result->fetch(); - if (empty($rows['id'])) - { - $sql="select * from users where id='$userid'"; - $result=$this->db->query($sql); - $rows = $result->fetch(); - - $datas['username'] = $rows['realname']; - $datas['unit'] = $rows['unit']; - $datas['phone'] = $rows['phone']; - $datas['address'] = $rows['address']; - $datas['postcode'] = $rows['postcode']; - $datas['email'] = $rows['email']; - $datas['project'] = $rows['project']; - $datas['project_id'] = $rows['project_id']; - $datas['project_type'] = $rows['project_type']; - $datas['project_title'] = $rows['project_title']; - $datas['project_leader'] = $rows['project_leader']; - echo $this->creatform($datas); - exit(); - } - else - { - $datas['username'] = $rows['username']; - $datas['unit'] = $rows['unit']; - $datas['phone'] = $rows['phone']; - $datas['address'] = $rows['address']; - $datas['postcode'] = $rows['postcode']; - $datas['email'] = $rows['email']; - $datas['project'] = $rows['project']; - $datas['project_id'] = $rows['project_id']; - $datas['project_type'] = $rows['project_type']; - $datas['project_title'] = $rows['project_title']; - $datas['project_leader'] = $rows['project_leader']; - echo $this->creatform($datas); - exit(); - } - } - - } - - /* - * 数据下载,根据UUID进行判断 - * 一次只下载一个数据(一个元数据项) - */ - function downloadAction() - { - $uuid=$this->_request->getParam('uuid'); - $onlineappid=$this->_request->getParam('onlineappid'); - $this->view->pageID = "account-dataorder"; - - if (empty($uuid)) $this->_redirect('/data'); - - $auth = Zend_Auth::getInstance(); - if($auth->hasIdentity()) - { - $user = $auth->getIdentity(); - $userid = $user->id; - } - - $testsql="select id,has_send_mail from onlineapp where userid='$userid' and uuid='$uuid' order by id desc"; - $result=$this->db->query($testsql); - $rows = $result->fetch(); - $has_send_mail=$rows['has_send_mail']; - if (empty($rows['id'])) - { - $this->_redirect('/data/'.$uuid); - } - else - { - $sql="select onlineappid,id from dataorder where status=0 and userid='$userid' and uuid='$uuid' order by id desc"; - $re=$this->db->query($sql); - $row=$re->fetch(); - if(empty($row['onlineappid'])) - { - $data = array( - 'userid' => $userid, - 'uuid' => $uuid, - 'onlineappid'=> $onlineappid, - 'ts_approved'=>'now()', - ); - try {$this->db->insert('dataorder',$data);} catch (Exception $e) {} - }else - { - $sql="update dataorder set onlineappid='$onlineappid',ts_approved=now() where id='{$row['id']}'"; - try {$this->db->exec($sql);} catch (Exception $e) {} - } - } - - - $sql=$this->db->quoteInto("select * from dataset o left join metadata m on o.uuid=m.uuid left join mdstatus s on m.uuid=s.uuid where s.status>4 and m.datatype=0 and m.uuid=?",$uuid); - $data=$this->db->fetchRow($sql); - $updateftp=$updateftp1=false; - $this->view->md=$data; - $this->view->userpass=md5('westdc'.rand(1000,9999)); - $this->view->ftptime=date('Y-m-d H:i:s', strtotime('+1 week')); - $sql=$this->db->quoteInto("select * from ftpuser where userid=?",$userid); - $row=$this->db->fetchRow($sql); - $datacount=$row['datacount']; - if ($data['host']=='ftp.westgis.ac.cn') - { - //添加FTP帐号信息以及时间控制信息 - $updateftp=true; - $g6=new G6ftp(); - $g6->db=$this->db; - //不进行判断,每个元数据中的下载地址都对应一个虚拟路径 - $path[]=$data['path']; - $this->view->username='westdc'.$userid; - $uu=(object)array("id"=>$userid, - "username"=>$this->view->username, - "password"=>$this->view->userpass, - "path"=>$path, - "maxdata"=>$this->view->config->download->max, - "time"=>$this->view->ftptime, - "datacount"=>$datacount); - if ($g6->createuser($uu)) { - $this->view->userpass=$g6->pwd; - $this->view->ftptime=$g6->time; - } else { - $this->messenger->addMessage('错误:您正在进行下载的在线数据数已经超过系统允许的最大值,请在下面点击“完成”或“取消”对应的在线数据下载!'); - $this->_redirect('/data/order'); - } - } elseif ($data['host']=='ftp1.westgis.ac.cn') - { - //添加FTP1帐号信息以及时间控制信息 - $proftp=new Proftp(); - $proftp->db=$this->db; - //proftp离线用户名和g6的用户名稍有不同 - $this->view->username='westdc_'.$userid; - $uu=(object)array("id"=>$userid, - "username"=>$this->view->username, - "password"=>$this->view->userpass, - "host"=>'ftp1.westgis.ac.cn', - "param"=>"onlineappid=".$onlineappid, - "maxdata"=>$this->view->config->download->max, - "time"=>$this->view->ftptime, - "datacount"=>$datacount); - if ($proftp->createuser($uu)) - { - $this->view->userpass=$proftp->pwd; - $this->view->ftptime=$proftp->time; - } - } elseif ($data['host']=='ftp.sanjiangyuan.org.cn') - { - //添加FTP2帐号信息以及时间控制信息 - $proftp=new Pureftp(); - $proftp->db=$this->db; - $this->view->username='sjy_'.$userid; - $uu=(object)array("id"=>$userid, - "username"=>$this->view->username, - "password"=>$this->view->userpass, - "host"=>'ftp.sanjiangyuan.org.cn', - "param"=>"onlineappid=".$onlineappid, - "maxdata"=>$this->view->config->download->max, - "time"=>$this->view->ftptime, - "datacount"=>$datacount); - if ($proftp->createuser($uu)) - { - $this->view->userpass=$proftp->pwd; - $this->view->ftptime=$proftp->time; - } - } - $ftpurl='ftp://'.$this->view->username.'@'.$data['host']; - if ($data['host']=='ftp.westgis.ac.cn') $ftpurl.=$data['path']; - - //设置输出 - //if ($updateftp || $updateftp1) $this->view->userpass=$password; - $this->view->ftpurl=$ftpurl; - //更新下载记录 - //todo: 尝试添加一个RULE:若有对应数据存在,则不插入( userid,uuid,status=0,ts_approved:null) - /*$sql="select * from dataorder where userid=? and uuid=? and status=0 and (ts_approved is null)"; - $u=$this->db->fetchRow($sql,array($userid,$uuid)); - if (empty($u)) { - $sql="insert into dataorder (userid,uuid,ts_created) values(?,?,now())"; - $this->db->query($sql,array($userid,$uuid)); - }*/ - if (!empty($ftpurl) && !$has_send_mail) - { - $data = array( - "uuid"=>$uuid, - "title"=>$this->view->md['title']."(".$this->view->md['filesize']."MB)", - "user"=>$user->username, - "ftpuser"=>$this->view->username, - "ftppwd"=>$this->view->userpass, - "ftptime"=>$this->view->ftptime, - "ftpurl"=>$this->view->ftpurl, - "note"=>$updateftp?'BTW:请注意登陆后要手工进入对应的目录!':'' - ); - $mailtp=new EmailText($this->db,'online-download',$data); - $mail=new WestdcMailer($this->view->config->smtp); - $mail->setBodyText($mailtp->getBody()); - $mail->setFrom($this->view->config->service->email,'西部数据中心服务组'); - $mail->addTo($user->email); - $mail->setSubject($mailtp->getSubject()); - @$mail->send(); - $sql="update onlineapp set has_send_mail=true where id=?"; - $sth=$this->db->prepare($sql); - $sth->execute(array($onlineappid)); - } - } - /* - * 离线申请(可以包括在线数据),在无数据参数时,则显示已有列表 - */ - function orderAction() - { - $this->view->pageID = "account-dataorder"; - $ac = $this->_request->getParam('ac'); - - $uuid = $this->_request->getParam('uuid'); - - $del = $this->_request->getParam('del'); - $apply = $this->_request->getParam('apply'); - $finish = $this->_request->getParam('finish'); - $cancel = $this->_request->getParam('cancel'); - $wsn = $this->_request->getParam('wsn'); - $pdf = $this->_request->getParam('pdf'); - $selections = $this->_request->getParam('data'); - - //if (empty($uuid)) $this->_redirect('/data'); - $userid = view::User('id'); - - //添加到数据篮 - if ($uuid) - { - //存在历史遗留问题,原来的数据并不能保证唯一 - - $order = new Order(); - $state = $order->addOrder($uuid); - - if($state !== true) - { - if(!is_array($state)) - { - $this->view->msg = view::Msg('alert-error',$state); - }else{ - $service_type = $order->serviceTypeTest($state['service_type']); - if($service_type !== false) - { - view::Post($this,$service_type,$state['service_url']."?href=".urlencode(view::getHostLink()."/data/order/")."&uuid=".$state['uuid']."&uid=".$userid); - }else{ - $this->view->msg = view::Msg('alert-error',"无法申请:此元数据的数据类型未知"); - } - } - }else{ - $this->view->msg = view::Msg('alert-success',"添加成功!您可以继续浏览数据或是继续提交申请表"); - } - - if (empty($ac)) $ac='offline1'; - - } - - elseif ($selections) - { - if(empty($uuid)) - { - $this->view->msg = view::Msg('alert-error',"无法申请:参数出错,请通过正确的途径访问"); - } - - $order = new Order(); - $state = $order->addOrder($uuid,$selections); - - if($state !== true) - { - $this->view->msg = view::Msg('alert-error',$state); - }else{ - $this->view->msg = view::Msg('alert-success',"添加成功!您可以继续浏览数据或是继续提交申请表"); - } - - if (empty($ac)) $ac='offline1'; - } - - //删除申请 - elseif ($del) { - $order = new Order(); - $state = $order->del($del); - if($state !== true) - { - $this->view->msg = view::Msg('alert-error',$state); - }else{ - $this->view->msg = view::Msg('alert-success',"数据申请取消成功"); - } - $this->_redirect('/data/order'); - } - - //提交申请 - elseif ($apply) { - if($apply == "all" || !is_numeric($apply)) - { - $apply = -1; - } - $order = new Order(); - $state = $order->apply($apply); - if($state !== true) - { - $this->view->msg = view::Msg('alert-error',$state); - }else{ - $this->view->msg = view::Msg('alert-success',"提交成功,您可以点击“提交离线申请”来生成PDF申请表"); - } - if (empty($ac)) $ac='offline2'; - } - - //完成 - elseif ($finish) { - if ($finish=='all') { - $sql=$this->db->quoteInto("update dataorder set ts_approved=now() where status=0 and userid=?",$userid); - $this->db->query($sql); - $sql="update ftpuser set datacount=0 where userid=?"; - $this->db->query($sql,array($userid)); - } else { - $sql="update dataorder set ts_approved=now() where status=0 and userid=? and id=?"; - $this->db->query($sql,array($userid,(int)$finish)); - $sql="update ftpuser set datacount=datacount-1 where userid=? and datacount>0"; - $this->db->query($sql,array($userid)); - } - } - - elseif($wsn) - { - $this->_helper->viewRenderer('order-wsn'); - - return true; - } - - elseif ($cancel) { - if ($cancel=='all') { - $sql=$this->db->quoteInto("update dataorder set ts_approved=now(),status=-1 where status=0 and userid=?",$userid); - $this->db->query($sql); - $sql="update ftpuser set datacount=0 where userid=?"; - $this->db->query($sql,array($userid)); - } else { - $sql="update dataorder set ts_approved=now(),status=-1 where status in (0,1,2) and userid=? and id=?"; - $this->db->query($sql,array($userid,(int)$cancel)); - $sql="update ftpuser set datacount=datacount-1 where userid=? and datacount>0"; - $this->db->query($sql,array($userid)); - } - if (empty($ac)) $ac='offline2'; - } - - //生成PDF离线申请文件 - elseif ($pdf) { - - //用户信息可以从SESSION中读取?离线申请信息 - //$sql="select * from users where id=?"; - $order = new Order(); - $rows = $order->getOrderItemForPdf(); - $this->view->projectType = $order->projectType; - - if ($rows) { - $this->_helper->viewRenderer('pdf'); - - $this->view->data2 = $rows; - - if ($this->_request->isPost()) { - - $this->view->formData = $formData = $this->_request->getPost(); - - $datalist=''; - foreach($rows as $i=>$row) - { - $datalist.=($i+1).". ".$row['title'].";"; - } - $formData['datalist'] = $datalist; - - if (@$formData['save']) { - - $order->setPdfData($rows); - - $s = $order->SaveOrder($formData); - - if($s !== true) - { - $this->view->error = view::Msg('alert-error',$s); - return true; - } - - //不能修改顺序 - $this->_helper->layout->disableLayout(); - $this->_helper->viewRenderer->setNoRender(); - - return true; - } elseif ($formData['submit']) { - //生成PDF - $order->setPdfData($rows); - $s = $order->SubmitOrder($formData); - - if($s !== true) - { - $this->view->error = view::Msg('alert-error',$s); - return true; - } - - $this->view->msg = view::Msg('alert-success','提示信息:您的离线申请已经提交,请在线上传PDF的签字版PDF文件。',0); - if (empty($ac)) $ac='offline3'; - } - } else { - $sql="select u.* from users u left join offlineapp o on u.id=o.userid where u.id=? ORDER BY o.id DESC"; - $row=$this->db->fetchRow($sql,array($userid)); - $this->view->formData = $row; - } - } else{ - $this->view->msg=view::Msg('alert-error',"错误:您还没有提交任何离线申请的数据,或您的数据申请已经提交(等待处理过程中)!",0); - } - return true; - }//pdf - - if($ac == "commitapplicationform") - { - $offlineappid = $this->_getParam('offlineappid'); - - if(!is_numeric($offlineappid) || $offlineappid < 1) - { - view::Post($this,"参数错误",-1); - return true; - } - - $order = new Order(); - $status = $order->commitApplicationForm($offlineappid); - - if( $status !== true) - { - view::Post($this,$status,-1); - }else{ - view::Post($this,"申请已提交,请等待管理员接收并通过数据所有者审核",'/data/order/ac/offline3'); - } - - return true; - } - - //index - $this->view->ac = $ac; - $this->_helper->viewRenderer('order'); - if ($ac=='' || $ac=='online') - { - $this->view->tabID='order-online'; - } else if ($ac=='offline1') { - $this->view->tabID='order-offline1'; - } else if ($ac=='offline2') { - $this->view->tabID='order-offline2'; - } else if ($ac=='offline3') { - $this->view->tabID='order-offline3'; - } else if ($ac=='offline4') { - $this->view->tabID='order-offline4'; - } - //显示已经申请的数据,包括已经提交的申请和未提交的申请,还有已经处理完成的申请,正在进行的在线数据下载 - $sql="select d.*,m.title,m.datatype,off.applicationform from dataorder d - left join metadata m on d.uuid=m.uuid - left join offlineapp off ON off.id = d.offlineappid - where d.userid=? order by d.status,d.ts_created desc"; - $rows=$this->db->fetchAll($sql,array($userid)); - - $showorders = array(); - $counts = array( - 'onlineapp' => 0, - 'offline1' => 0, - 'offline2' => 0, - 'offline3' => 0, - 'offline4' => 0 - ); - - if(count($rows) > 0) { - foreach($rows as $k=>$v) - { - switch($v['status']) { - case 0: - $counts['onlineapp'] ++; - break; - case 1: - $counts['offline1'] ++; - break; - case 2: - $counts['offline2'] ++; - break; - case 3: - $counts['offline3'] ++; - break; - case 4: - $counts['offline3'] ++; - break; - case 5: - $counts['offline4'] ++; - break; - } - switch($ac){ - default : - if($v['status'] == 0 && !empty($v['ts_approved']))$showorders[] = $rows[$k]; - break; - case 'online' : - if($v['status'] == 0 && !empty($v['ts_approved']))$showorders[] = $rows[$k]; - break; - case 'offline1' : - if($v['status'] == 1) $showorders[] = $rows[$k]; - break; - case 'offline2' : + + + if(empty($data['data'])) + { + $this->jsonexit(array("error"=>'数据接口错误,请联系管理员')); + return true; + } + + if(!is_array($data['data'])) + { + $this->jsonexit(array("error"=>$data['data'])); + return true; + } + + $order = new Order(); + $status = $order->addOrder($uuid,json_encode($data['data']['site'],JSON_NUMERIC_CHECK)); + if($status !== true) + { + $this->jsonexit(array("error"=>$status)); + return true; + } + + $this->jsonexit($data); + return true; + } + } + + + + /* + getversionAction() 获取数据版本 + */ + function getversionAction(){ + + $ac = $this->_getParam('ac'); + $uuid = $this->_getParam('uuid'); + + if($ac == 'list') + { + $this->_helper->layout->disableLayout(); + $this->_helper->viewRenderer->setNoRender(); + + $sql = "SELECT v.changelog,v.ts_created,u.username FROM mdversion v + LEFT JOIN users u ON v.userid=u.id + WHERE v.uuid=? AND v.changelog IS NOT NULL + ORDER BY v.ts_created DESC"; + + $sth = $this->db->prepare($sql); + $sth->execute(array($uuid)); + $rows = $sth->fetchAll(); + + if($rows) + { + foreach($rows as $k=>$v) + { + $rows[$k]['ts_created'] = date("Y-m-d H:i",strtotime($v['ts_created'])); + $rows[$k]['changelog'] = str_replace("\n","

    ",$v['changelog']); + } + $data = array("list"=>$rows); + $this->jsonexit($data); + return true; + }else{ + $data = array("error"=>"处理中出现错误"); + $this->jsonexit($data); + return true; + } + } + + }//getversionAction() + + function replace($string){ + $patterns = array("/\"/i","/\'/i"); + $replacements = array("“","‘"); + ksort($patterns); + ksort($replacements); + return preg_replace($patterns, $replacements, $string); + }//引号替换 + + + function postcommentAction(){ + $this->_helper->layout->disableLayout(); + $this->_helper->viewRenderer->setNoRender(); + try{ + $auth = Zend_Auth::getInstance(); + if($auth->hasIdentity()) + { + $user = $auth->getIdentity(); + $userid = $user->id; + }else + { + $userid=0; + } + + $author = mb_substr($this->replace(trim($this->_request->getParam('author'))),0,30,'UTF-8'); + $email = mb_substr($this->replace(trim($this->_request->getParam('email'))),0,60,'UTF-8'); + $url = mb_substr($this->replace(trim($this->_request->getParam('url'))),0,60,'UTF-8'); + $content = $this->replace(trim($this->_request->getParam('content'))); + $vdcode = mb_substr($this->replace(trim($this->_request->getParam('vdcode'))),0,4,'UTF-8'); + + if(empty($author)) + { + echo "请输入您的名字"; + exit(); + } + + if(strlen($author)<3) exit("姓名长度不得少于2个汉字 :)"); + + if(empty($email)) + { + echo "请输入您的电子邮箱地址"; + exit(); + } + + if(strlen($email)<4) exit("Email长度太短,请填写正确的Email :)"); + + if(!preg_match("/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/i",$email)) + { + echo "Email格式不正确"; + exit(); + } + + if(strlen($content)<5) exit("评论长度不得少于3个汉字 :)"); + + if(preg_match("/script/i",$content)) + { + $content = preg_replace("/script/i","script",$content); + } + + if(preg_match("/<|>/",$content)) + { + $data=array( + '<'=>'<', + '>'=>'>', + ); + + $patterns = array(); + $replacements = array(); + foreach($data as $k=>$v) + { + $patterns[]='/'.$k.'/i'; + $replacements[]=$v; + } + ksort($patterns); + ksort($replacements); + $content=preg_replace($patterns, $replacements, $content); + if(!empty($url)) + { + $url=preg_replace($patterns, $replacements, $url); + } + } + + if(preg_match("/script/i",$url)) + { + $url = preg_replace("/script/i","script",$url); + } + + if(!preg_match("/http:\/\//",$url)) + { + $url = "http://".$url; + } + + $uuid = trim($this->_request->getParam('uuid')); + + if(!preg_match("/^[0-9A-Za-z]{8}-[0-9A-Za-z]{4}-[0-9A-Za-z]{4}-[0-9A-Za-z]{4}-[0-9A-Za-z]{12}$/",$uuid)) + { + echo "参数错误!"; + exit(); + } + + if(strtolower($vdcode) != $_SESSION['vdcodes']) + { + echo "验证码错误,请重新输入"; + exit(); + } + + + $data = array( + 'uuid' => $uuid, + 'uid' => $userid, + 'author' => $author, + 'email' => $email, + 'url' => $url, + 'ip' => $_SERVER['REMOTE_ADDR'], + 'content' => $content, + 'agent' => $_SERVER['HTTP_USER_AGENT'], + 'type' => 'comment' + ); + + $sql = "INSERT INTO comments (author,email,url,ip,content,agent,type,uuid,userid) VALUES (?,?,?,?,?,?,?,?,?)"; + $sth = $this->db->prepare($sql); + $exec = $sth->execute(array($data['author'],$data['email'],$data['url'],$data['ip'],$data['content'],$data['agent'],$data['type'],$data['uuid'],$data['uid'])); + + if($exec) + { + $sql = "SELECT u.email FROM mdauthor au + LEFT JOIN users u on au.userid=u.id + WHERE au.uuid='$uuid'"; + $sth = $this->db->query($sql); + $rows = $sth->fetchAll(); + + @$mailtp=new EmailText( + $this->db, + 'data-comment-note', + array( + 'user' =>$user->username, + 'uuid' =>$data['uuid'], + 'title' =>$this->replace(trim($this->_request->getParam('mdtitle'))), + 'content'=>$content + ) + ); + @$mail=new WestdcMailer($this->view->config->smtp); + @$mail->setBodyText($mailtp->getBody()); + @$mail->setFrom($this->view->config->service->email,'西部数据中心服务组'); + @$mail->addTo($this->view->config->service->email); + if(is_array($rows) && count($rows)>0) + { + foreach($rows as $v) + { + @$mail->addTo($v['email']); + } + } + @$mail->setSubject($mailtp->getSubject()); + @$mail->send(); + $msg = "用户".$user->username."对元数据《".$this->replace(trim($this->_request->getParam('mdtitle')))."》进行了评论,点击查看"; + include_once("message.php"); + message::post($this->db,0,-1,"收到新数据评论",$msg); + echo "评论成功"; + exit(); + }else + { + echo "评论失败,请重试 :)"; + exit(); + } + }catch(Exception $e){ + echo "出错了,请稍后再试"; + exit(); + } + }//ajax评论 + + + /* + * 数据评论,根据UUID读取 + */ + function commentAction() + { + $this->_helper->layout->disableLayout(); + $this->_helper->viewRenderer->setNoRender(); + $uuid=$this->_request->getParam('uuid'); + if (empty($uuid)) die(); + $sql="select * from comments where uuid=? AND reply=0 order by id desc"; + $comments=$this->db->fetchAll($sql,array($uuid)); + + $paginator = Zend_Paginator::factory($comments); + $paginator->setCurrentPageNumber($this->_getParam('page')); + $paginator->setItemCountPerPage(5); + $paginator->setView($this->view); + Zend_View_Helper_PaginationControl::setDefaultViewPartial('data/pagination_ajax.phtml'); + + include_once("Avatar.php"); + $avatar = new Avatar(); + if ($paginator) + { + foreach($paginator as $c) + { + //$author=$this->view->escape($c['author']); + $sql = "SELECT cr.id,cr.content as body,cr.reply,u.username,cr.ts_created,u.usertype,u.email as email, + (SELECT au.uuid FROM mdauthor au WHERE au.userid=u.id AND au.uuid='$uuid') as uuid + FROM comments cr + LEFT JOIN users u ON cr.userid=u.id + WHERE cr.reply=?"; + $sth = $this->db->prepare($sql); + $sth->execute(array($c['id'])); + $replys = $sth->fetchAll(); + $replyhtml = ""; + if(!empty($replys) || count($replys)>0) + { + foreach($replys as $v) + { + $usertype = ""; + $color = ""; + if($v['usertype'] == "administrator") + { + $usertype = "[管理员]"; + $color="#009d00"; + } + if($v['uuid'] == $uuid) + { + $usertype = "[数据作者]"; + $color="#add2e9"; + } + if(!empty($color)) + { + $color = 'background:'.$color.';color:#FFFFFF;'; + } + $img = $avatar->Get($v['email'],48); + $replyhtml .=' +

    + + + +
    + 回复于'.date('Y-m-d H:i:s',strtotime($v['ts_created'])).' +
    '.$v['username'].' '.$usertype.'
    + '.$v['body'].' +
    +
    + '; + + } + } + + $img = $avatar->Get($c['email'],64); + //$img = ''; + + $author = $c['author']; + $author = ($c['url'])?''.$author.'':$author; + $author = ''.$author.""; + $time = '发表于'.date('Y-m-d H:i:s',strtotime($c['ts_created'])).''; + print ' +
    + +
    + '.$time.' +

    '.$c['author'].'

    + '.$c['content'].' + '.$replyhtml.' +
    +
    + '; + } + echo '
    '.$paginator.'
    '; + }//else echo "
  • No comments.
  • "; + }//评论列表 + + /** + * 判断用户是否填写了申请信息 + * @param string $uuid + * @param int $userid + */ + function todownloadAction() { + + $this->view->pageID = "account-dataorder"; + + $this->_helper->viewRenderer('onlineapp-download'); + + $this->view->uuid = $uuid = $this->_request->getParam('uuid'); + + $auth = Zend_Auth::getInstance(); + if (!$auth->hasIdentity()) + { + $this->view->AlertType = "alert-error"; + $this->view->msg = "请先登录您的账户后进行下载,页面将自动跳转"; + $this->view->jump_url = '/account/login/?href=/data/todownload/uuid/'.$uuid; + return true; + } + + if(empty($uuid)) + { + $this->view->AlertType = "alert-error"; + $this->view->msg = "参数错误!"; + $this->view->jump_url = "/data"; + return true; + } + + $this->view->projectType = array( + "请选择项目类型" => "", + "国家973计划项目课题" => "国家973计划项目课题", + "国家863计划课题"=>"国家863计划课题", + "国家级科技支撑课题" => "国家级科技支撑课题", + "国家级科技重大专项" => "国家级科技重大专项", + "国家级国家重大工程" => "国家级国家重大工程", + "国家级国家自然科学基金" => "国家级国家自然科学基金", + "国际合作项目"=>"国际合作项目", + "省部级项目" => "省部级项目", + "其他项目工程" => "其他项目工程", + ); + + $userid = Zend_Auth::getInstance()->getIdentity()->id; + + $submit = $this->_getParam('submit'); + if(!empty($submit)){ + + $datas = array(); + $datas['realname'] = $this->_request->getParam('realname'); + $datas['unit'] = $this->_request->getParam('unit'); + $datas['phone'] = $this->_request->getParam('phone'); + $datas['address'] = $this->_request->getParam('address'); + $datas['postcode'] = $this->_request->getParam('postcode'); + $datas['email'] = $this->_request->getParam('email'); + $datas['project'] = $this->_request->getParam('project'); + $datas['project_id'] = $this->_request->getParam('project_id'); + $datas['project_type'] = $this->_request->getParam('project_type'); + $datas['project_title'] = $this->_request->getParam('project_title'); + $datas['project_leader']= $this->_request->getParam('project_leader'); + + $this->view->info = $datas; + + $this->view->AlertType = "alert-error"; + + foreach($datas as $k=>$v) + { + if(empty($v)) + { + $this->view->error = "每一项内容都需要填写"; + return true; + } + } + + if(!is_numeric($datas['postcode'])) + { + $this->view->error = "联系电话和邮政编码请填写数字"; + return true; + } + + if(!preg_match("/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/i",$datas['email'])) + { + $this->view->error = "请填写正确的email地址"; + return true; + } + + if(mb_strlen($datas['project'],"utf-8")<8) + { + $this->view->error = "项目介绍内容不少于8个字符"; + return true; + } + + if(preg_match('/^\d+$/',$datas['project'])) + { + $this->view->error = "请输入有意义的项目介绍内容"; + return true; + } + + $data = array( + 'userid' => $userid, + 'username' => $datas['realname'], + 'unit' => $datas['unit'], + 'phone' => $datas['phone'], + 'address' => $datas['address'], + 'postcode' => $datas['postcode'], + 'project' => $datas['project'], + 'uuid' =>$uuid, + 'email' =>$datas['email'], + 'project_id'=>$datas['project_id'], + 'project_title'=>$datas['project_title'], + 'project_type'=>$datas['project_type'], + 'project_leader'=>$datas['project_leader'] + ); + + if($this->db->insert('onlineapp',$data)) + { + $select = "select id from onlineapp where userid='$userid' order by id desc"; + $re=$this->db->query($select); + $row=$re->fetch(); + + $this->view->AlertType = "alert-success"; + $this->view->jump_url = '/data/download/uuid/'.$uuid.'/onlineappid/'.$row['id']; + $this->view->msg = "您的信息已经提交成功,可以进行下载。请等待页面自动跳转,view->jump_url."\">或点击这里进入下载页面"; + + $msg = "用户{$data['username']} 填写了在线数据申请表 查看详细"; + $title = "用户 {$data['username']} 申请了在线下载数据"; + include_once("message.php"); + message::post($this->db,0,-1,$title,$msg); + + return true; + } + else { + $this->view->AlertType = "alert-error"; + $this->view->error = "申请失败,请稍后重新尝试"; + $this->view->info = $data; + return true; + } + + return true; + }else{ + + $testsql="select * from onlineapp where userid='$userid' and uuid='$uuid' order by id desc"; + $result=$this->db->query($testsql); + $rows = $result->fetch(); + if (empty($rows['id'])) + { + include_once("Users.php"); + $usr = new Users($this->db); + $this->view->info = $usr->getUserInfo($userid); + return true; + } + else + { + $datas['realname'] = $rows['username']; + $datas['unit'] = $rows['unit']; + $datas['phone'] = $rows['phone']; + $datas['address'] = $rows['address']; + $datas['postcode'] = $rows['postcode']; + $datas['email'] = $rows['email']; + $datas['project'] = $rows['project']; + $datas['project_id'] = $rows['project_id']; + $datas['project_type'] = $rows['project_type']; + $datas['project_title'] = $rows['project_title']; + $datas['project_leader'] = $rows['project_leader']; + $this->view->info = $datas; + return true; + } + } + + return true; + + $userid=Zend_Auth::getInstance()->getIdentity()->id; + + $datas = array(); + $submited = $this->_request->getParam('submited'); + $datas['username'] = $this->_request->getParam('username'); + $datas['unit'] = $this->_request->getParam('unit'); + $datas['phone'] = $this->_request->getParam('phone'); + $datas['address'] = $this->_request->getParam('address'); + $datas['postcode'] = $this->_request->getParam('postcode'); + $datas['email'] = $this->_request->getParam('email'); + $datas['project'] = $this->_request->getParam('project'); + $datas['project_id'] = $this->_request->getParam('projectid'); + $datas['project_type'] = $this->_request->getParam('projecttype'); + $datas['project_title'] = $this->_request->getParam('projecttitle'); + $datas['project_leader'] = $this->_request->getParam('projectleader'); + + + + $form=$this->creatform($datas); + + if (!empty($submited) && $ft==0){ + + foreach($datas as $k=>$v) + { + if($v == '') + { + echo $form.''; + exit(); + } + } + + if(!is_numeric($datas['postcode'])) + { + echo $form.''; + exit(); + } + + if(!preg_match("/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/i",$datas['email'])) + { + echo $form.''; + exit(); + } + + if(mb_strlen($datas['project'],"utf-8")<8) + { + echo $form.''; + exit(); + } + + if(preg_match('/^\d+$/',$datas['project'])) + { + echo $form.''; + exit(); + } + + $data = array( + 'userid' => $userid, + 'username' => $datas['username'], + 'unit' => $datas['unit'], + 'phone' => $datas['phone'], + 'address' => $datas['address'], + 'postcode' => $datas['postcode'], + 'project' => $datas['project'], + 'uuid' =>$uuid, + 'email' =>$datas['email'], + 'project_id'=>$datas['project_id'], + 'project_title'=>$datas['project_title'], + 'project_type'=>$datas['project_type'], + 'project_leader'=>$datas['project_leader'] + ); + + if($this->db->insert('onlineapp',$data)) + { + $select = "select id from onlineapp where userid='$userid' order by id desc"; + $re=$this->db->query($select); + $row=$re->fetch(); + echo "您的信息已经提交成功,可以进行下载。
    + 如果页面没有自动跳转,请点击这里进入下载页面 + "; + $msg = "用户{$data['username']} 填写了在线数据申请表 查看详细"; + $title = "用户 {$data['username']} 申请了在线下载数据"; + include_once("message.php"); + message::post($this->db,0,-1,$title,$msg); + exit(); + } + else { + echo $form.''; + exit(); + } + + }else if( $ft==1 ) + { + $testsql="select * from onlineapp where userid='$userid' and uuid='$uuid' order by id desc"; + $result=$this->db->query($testsql); + $rows = $result->fetch(); + if (empty($rows['id'])) + { + $sql="select * from users where id='$userid'"; + $result=$this->db->query($sql); + $rows = $result->fetch(); + + $datas['username'] = $rows['realname']; + $datas['unit'] = $rows['unit']; + $datas['phone'] = $rows['phone']; + $datas['address'] = $rows['address']; + $datas['postcode'] = $rows['postcode']; + $datas['email'] = $rows['email']; + $datas['project'] = $rows['project']; + $datas['project_id'] = $rows['project_id']; + $datas['project_type'] = $rows['project_type']; + $datas['project_title'] = $rows['project_title']; + $datas['project_leader'] = $rows['project_leader']; + echo $this->creatform($datas); + exit(); + } + else + { + $datas['username'] = $rows['username']; + $datas['unit'] = $rows['unit']; + $datas['phone'] = $rows['phone']; + $datas['address'] = $rows['address']; + $datas['postcode'] = $rows['postcode']; + $datas['email'] = $rows['email']; + $datas['project'] = $rows['project']; + $datas['project_id'] = $rows['project_id']; + $datas['project_type'] = $rows['project_type']; + $datas['project_title'] = $rows['project_title']; + $datas['project_leader'] = $rows['project_leader']; + echo $this->creatform($datas); + exit(); + } + } + + } + + /* + * 数据下载,根据UUID进行判断 + * 一次只下载一个数据(一个元数据项) + */ + function downloadAction() + { + $uuid=$this->_request->getParam('uuid'); + $onlineappid=$this->_request->getParam('onlineappid'); + $this->view->pageID = "account-dataorder"; + + if (empty($uuid)) $this->_redirect('/data'); + + $auth = Zend_Auth::getInstance(); + if($auth->hasIdentity()) + { + $user = $auth->getIdentity(); + $userid = $user->id; + } + + $testsql="select id,has_send_mail from onlineapp where userid='$userid' and uuid='$uuid' order by id desc"; + $result=$this->db->query($testsql); + $rows = $result->fetch(); + $has_send_mail=$rows['has_send_mail']; + if (empty($rows['id'])) + { + $this->_redirect('/data/'.$uuid); + } + else + { + $sql="select onlineappid,id from dataorder where status=0 and userid='$userid' and uuid='$uuid' order by id desc"; + $re=$this->db->query($sql); + $row=$re->fetch(); + if(empty($row['onlineappid'])) + { + $data = array( + 'userid' => $userid, + 'uuid' => $uuid, + 'onlineappid'=> $onlineappid, + 'ts_approved'=>'now()', + ); + try {$this->db->insert('dataorder',$data);} catch (Exception $e) {} + }else + { + $sql="update dataorder set onlineappid='$onlineappid',ts_approved=now() where id='{$row['id']}'"; + try {$this->db->exec($sql);} catch (Exception $e) {} + } + } + + + $sql=$this->db->quoteInto("select * from dataset o left join metadata m on o.uuid=m.uuid left join mdstatus s on m.uuid=s.uuid where s.status>4 and m.datatype=0 and m.uuid=?",$uuid); + $data=$this->db->fetchRow($sql); + $updateftp=$updateftp1=false; + $this->view->md=$data; + $this->view->userpass=md5('westdc'.rand(1000,9999)); + $this->view->ftptime=date('Y-m-d H:i:s', strtotime('+1 week')); + $sql=$this->db->quoteInto("select * from ftpuser where userid=?",$userid); + $row=$this->db->fetchRow($sql); + $datacount=$row['datacount']; + if ($data['host']=='ftp.westgis.ac.cn') + { + //添加FTP帐号信息以及时间控制信息 + $updateftp=true; + $g6=new G6ftp(); + $g6->db=$this->db; + //不进行判断,每个元数据中的下载地址都对应一个虚拟路径 + $path[]=$data['path']; + $this->view->username='westdc'.$userid; + $uu=(object)array("id"=>$userid, + "username"=>$this->view->username, + "password"=>$this->view->userpass, + "path"=>$path, + "maxdata"=>$this->view->config->download->max, + "time"=>$this->view->ftptime, + "datacount"=>$datacount); + if ($g6->createuser($uu)) { + $this->view->userpass=$g6->pwd; + $this->view->ftptime=$g6->time; + } else { + $this->messenger->addMessage('错误:您正在进行下载的在线数据数已经超过系统允许的最大值,请在下面点击“完成”或“取消”对应的在线数据下载!'); + $this->_redirect('/data/order'); + } + } elseif ($data['host']=='ftp1.westgis.ac.cn') + { + //添加FTP1帐号信息以及时间控制信息 + $proftp=new Proftp(); + $proftp->db=$this->db; + //proftp离线用户名和g6的用户名稍有不同 + $this->view->username='westdc_'.$userid; + $uu=(object)array("id"=>$userid, + "username"=>$this->view->username, + "password"=>$this->view->userpass, + "host"=>'ftp1.westgis.ac.cn', + "param"=>"onlineappid=".$onlineappid, + "maxdata"=>$this->view->config->download->max, + "time"=>$this->view->ftptime, + "datacount"=>$datacount); + if ($proftp->createuser($uu)) + { + $this->view->userpass=$proftp->pwd; + $this->view->ftptime=$proftp->time; + } + } elseif ($data['host']=='ftp2.westgis.ac.cn') + { + //添加FTP2帐号信息以及时间控制信息 + $proftp=new Pureftp(); + $proftp->db=$this->db; + $this->view->username='westdc_'.$userid; + $uu=(object)array("id"=>$userid, + "username"=>$this->view->username, + "password"=>$this->view->userpass, + "host"=>'ftp2.westgis.ac.cn', + "param"=>"onlineappid=".$onlineappid, + "maxdata"=>$this->view->config->download->max, + "time"=>$this->view->ftptime, + "datacount"=>$datacount); + if ($proftp->createuser($uu)) + { + $this->view->userpass=$proftp->pwd; + $this->view->ftptime=$proftp->time; + } + } + $ftpurl='ftp://'.$this->view->username.'@'.$data['host']; + if ($data['host']=='ftp.westgis.ac.cn') $ftpurl.=$data['path']; + + //设置输出 + //if ($updateftp || $updateftp1) $this->view->userpass=$password; + $this->view->ftpurl=$ftpurl; + //更新下载记录 + //todo: 尝试添加一个RULE:若有对应数据存在,则不插入( userid,uuid,status=0,ts_approved:null) + /*$sql="select * from dataorder where userid=? and uuid=? and status=0 and (ts_approved is null)"; + $u=$this->db->fetchRow($sql,array($userid,$uuid)); + if (empty($u)) { + $sql="insert into dataorder (userid,uuid,ts_created) values(?,?,now())"; + $this->db->query($sql,array($userid,$uuid)); + }*/ + if (!empty($ftpurl) && !$has_send_mail) + { + $data = array( + "uuid"=>$uuid, + "title"=>$this->view->md['title']."(".$this->view->md['filesize']."MB)", + "user"=>$user->username, + "ftpuser"=>$this->view->username, + "ftppwd"=>$this->view->userpass, + "ftptime"=>$this->view->ftptime, + "ftpurl"=>$this->view->ftpurl, + "note"=>$updateftp?'BTW:请注意登陆后要手工进入对应的目录!':'' + ); + $mailtp=new EmailText($this->db,'online-download',$data); + $mail=new WestdcMailer($this->view->config->smtp); + $mail->setBodyText($mailtp->getBody()); + $mail->setFrom($this->view->config->service->email,'西部数据中心服务组'); + $mail->addTo($user->email); + $mail->setSubject($mailtp->getSubject()); + @$mail->send(); + $sql="update onlineapp set has_send_mail=true where id=?"; + $sth=$this->db->prepare($sql); + $sth->execute(array($onlineappid)); + } + } + /* + * 离线申请(可以包括在线数据),在无数据参数时,则显示已有列表 + */ + function orderAction() + { + $this->view->pageID = "account-dataorder"; + $ac = $this->_request->getParam('ac'); + + $uuid = $this->_request->getParam('uuid'); + + $del = $this->_request->getParam('del'); + $apply = $this->_request->getParam('apply'); + $finish = $this->_request->getParam('finish'); + $cancel = $this->_request->getParam('cancel'); + $wsn = $this->_request->getParam('wsn'); + $pdf = $this->_request->getParam('pdf'); + $selections = $this->_request->getParam('data'); + + //if (empty($uuid)) $this->_redirect('/data'); + $userid = view::User('id'); + + //添加到数据篮 + if ($uuid) + { + //存在历史遗留问题,原来的数据并不能保证唯一 + + $order = new Order(); + $state = $order->addOrder($uuid); + + if($state !== true) + { + if(!is_array($state)) + { + $this->view->msg = view::Msg('alert-error',$state); + }else{ + $service_type = $order->serviceTypeTest($state['service_type']); + if($service_type !== false) + { + view::Post($this,$service_type,$state['service_url']."?href=".urlencode(view::getHostLink()."/data/order/")."&uuid=".$state['uuid']."&uid=".$userid); + }else{ + $this->view->msg = view::Msg('alert-error',"无法申请:此元数据的数据类型未知"); + } + } + }else{ + $this->view->msg = view::Msg('alert-success',"添加成功!您可以继续浏览数据或是继续提交申请表"); + } + + if (empty($ac)) $ac='offline1'; + + } + + elseif ($selections) + { + if(empty($uuid)) + { + $this->view->msg = view::Msg('alert-error',"无法申请:参数出错,请通过正确的途径访问"); + } + + $order = new Order(); + $state = $order->addOrder($uuid,$selections); + + if($state !== true) + { + $this->view->msg = view::Msg('alert-error',$state); + }else{ + $this->view->msg = view::Msg('alert-success',"添加成功!您可以继续浏览数据或是继续提交申请表"); + } + + if (empty($ac)) $ac='offline1'; + } + + //删除申请 + elseif ($del) { + $order = new Order(); + $state = $order->del($del); + if($state !== true) + { + $this->view->msg = view::Msg('alert-error',$state); + }else{ + $this->view->msg = view::Msg('alert-success',"数据申请取消成功"); + } + $this->_redirect('/data/order'); + } + + //提交申请 + elseif ($apply) { + if($apply == "all" || !is_numeric($apply)) + { + $apply = -1; + } + $order = new Order(); + $state = $order->apply($apply); + if($state !== true) + { + $this->view->msg = view::Msg('alert-error',$state); + }else{ + $this->view->msg = view::Msg('alert-success',"提交成功,您可以点击“提交离线申请”来生成PDF申请表"); + } + if (empty($ac)) $ac='offline2'; + } + + //完成 + elseif ($finish) { + if ($finish=='all') { + $sql=$this->db->quoteInto("update dataorder set ts_approved=now() where status=0 and userid=?",$userid); + $this->db->query($sql); + $sql="update ftpuser set datacount=0 where userid=?"; + $this->db->query($sql,array($userid)); + } else { + $sql="update dataorder set ts_approved=now() where status=0 and userid=? and id=?"; + $this->db->query($sql,array($userid,(int)$finish)); + $sql="update ftpuser set datacount=datacount-1 where userid=? and datacount>0"; + $this->db->query($sql,array($userid)); + } + } + + elseif($wsn) + { + $this->_helper->viewRenderer('order-wsn'); + + return true; + } + + elseif ($cancel) { + if ($cancel=='all') { + $sql=$this->db->quoteInto("update dataorder set ts_approved=now(),status=-1 where status=0 and userid=?",$userid); + $this->db->query($sql); + $sql="update ftpuser set datacount=0 where userid=?"; + $this->db->query($sql,array($userid)); + } else { + $sql="update dataorder set ts_approved=now(),status=-1 where status in (0,1,2) and userid=? and id=?"; + $this->db->query($sql,array($userid,(int)$cancel)); + $sql="update ftpuser set datacount=datacount-1 where userid=? and datacount>0"; + $this->db->query($sql,array($userid)); + } + if (empty($ac)) $ac='offline2'; + } + + //生成PDF离线申请文件 + elseif ($pdf) { + + //用户信息可以从SESSION中读取?离线申请信息 + //$sql="select * from users where id=?"; + $order = new Order(); + $rows = $order->getOrderItemForPdf(); + $this->view->projectType = $order->projectType; + + if ($rows) { + $this->_helper->viewRenderer('pdf'); + + $this->view->data2 = $rows; + + if ($this->_request->isPost()) { + + $this->view->formData = $formData = $this->_request->getPost(); + + $datalist=''; + foreach($rows as $i=>$row) + { + $datalist.=($i+1).". ".$row['title'].";"; + } + $formData['datalist'] = $datalist; + + if (@$formData['save']) { + + $order->setPdfData($rows); + + $s = $order->SaveOrder($formData); + + if($s !== true) + { + $this->view->error = view::Msg('alert-error',$s); + return true; + } + + //不能修改顺序 + $this->_helper->layout->disableLayout(); + $this->_helper->viewRenderer->setNoRender(); + + return true; + } elseif ($formData['submit']) { + //生成PDF + $order->setPdfData($rows); + $s = $order->SubmitOrder($formData); + + if($s !== true) + { + $this->view->error = view::Msg('alert-error',$s); + return true; + } + + $this->view->msg = view::Msg('alert-success','提示信息:您的离线申请已经提交,请在线上传PDF的签字版PDF文件。',0); + if (empty($ac)) $ac='offline3'; + } + } else { + $sql="select u.* from users u left join offlineapp o on u.id=o.userid where u.id=? ORDER BY o.id DESC"; + $row=$this->db->fetchRow($sql,array($userid)); + $this->view->formData = $row; + } + } else{ + $this->view->msg=view::Msg('alert-error',"错误:您还没有提交任何离线申请的数据,或您的数据申请已经提交(等待处理过程中)!",0); + } + return true; + }//pdf + + if($ac == "commitapplicationform") + { + $offlineappid = $this->_getParam('offlineappid'); + + if(!is_numeric($offlineappid) || $offlineappid < 1) + { + view::Post($this,"参数错误",-1); + return true; + } + + $order = new Order(); + $status = $order->commitApplicationForm($offlineappid); + + if( $status !== true) + { + view::Post($this,$status,-1); + }else{ + view::Post($this,"申请已提交,请等待管理员接收并通过数据所有者审核",'/data/order/ac/offline3'); + } + + return true; + } + + //index + $this->view->ac = $ac; + $this->_helper->viewRenderer('order'); + if ($ac=='' || $ac=='online') + { + $this->view->tabID='order-online'; + } else if ($ac=='offline1') { + $this->view->tabID='order-offline1'; + } else if ($ac=='offline2') { + $this->view->tabID='order-offline2'; + } else if ($ac=='offline3') { + $this->view->tabID='order-offline3'; + } else if ($ac=='offline4') { + $this->view->tabID='order-offline4'; + } + //显示已经申请的数据,包括已经提交的申请和未提交的申请,还有已经处理完成的申请,正在进行的在线数据下载 + $sql="select d.*,m.title,m.datatype,off.applicationform from dataorder d + left join metadata m on d.uuid=m.uuid + left join offlineapp off ON off.id = d.offlineappid + where d.userid=? order by d.status,d.ts_created desc"; + $rows=$this->db->fetchAll($sql,array($userid)); + + $showorders = array(); + $counts = array( + 'onlineapp' => 0, + 'offline1' => 0, + 'offline2' => 0, + 'offline3' => 0, + 'offline4' => 0 + ); + + if(count($rows) > 0) { + foreach($rows as $k=>$v) + { + switch($v['status']) { + case 0: + $counts['onlineapp'] ++; + break; + case 1: + $counts['offline1'] ++; + break; + case 2: + $counts['offline2'] ++; + break; + case 3: + $counts['offline3'] ++; + break; + case 4: + $counts['offline3'] ++; + break; + case 5: + $counts['offline4'] ++; + break; + } + switch($ac){ + default : + if($v['status'] == 0 && !empty($v['ts_approved']))$showorders[] = $rows[$k]; + break; + case 'online' : + if($v['status'] == 0 && !empty($v['ts_approved']))$showorders[] = $rows[$k]; + break; + case 'offline1' : + if($v['status'] == 1) $showorders[] = $rows[$k]; + break; + case 'offline2' : if($v['status'] == 2) { - $showorders[] = $rows[$k]; - $this->view->offlineappid = $v['offlineappid']; - $this->view->applicationform = $v['applicationform']; + $showorders[] = $rows[$k]; + $this->view->offlineappid = $v['offlineappid']; + $this->view->applicationform = $v['applicationform']; $this->view->offlineappstatus = $v['status']; - } - break; - case 'offline3' : + } + break; + case 'offline3' : if($v['status'] == 3 || $v['status'] == 4) { - $showorders[] = $rows[$k]; - $this->view->offlineappid = $v['offlineappid']; - $this->view->applicationform = $v['applicationform']; + $showorders[] = $rows[$k]; + $this->view->offlineappid = $v['offlineappid']; + $this->view->applicationform = $v['applicationform']; $this->view->offlineappstatus = $v['status']; - } - break; - case 'offline4' : - if($v['status'] == 5) $showorders[] = $rows[$k]; - break; - } - } - } - - $this->view->counts = $counts; - view::addPaginator($showorders,$this,10); - - } - - /* - * 查看数据缩略图 - */ - function thumbAction() - { - $page=(int)$this->_request->getParam('page'); - if (empty($page)) $page=1; - $offset=$this->limit*($page-1); - $state=$this->db->query("select count(*) from normalmetadata"); - $row=$state->fetchAll(); - $sum=$row[0]['count']; - $select=$this->db->select(); - $select->from('normalmetadata as m','m.*') - ->order('m.title desc')->limitPage($page,9); - $this->view->metadata = $this->db->fetchAll($select); - $this->view->page=new Pagination($sum,$page,$this->limit); - } - - /* - *附件下载 - */ - function attachAction(){ - - $uuid = $this->_request->getParam('uuid'); - - if(!empty($uuid)) - { - - $sql="select * from mdattach m left join attachments a on m.id=a.id where m.uuid='$uuid'"; - $re=$this->db->query($sql); - $atts = $re->fetch(); - - if(empty($atts['id'])) - { - $this->_redirect("/data/$uuid"); - }//没有附件 - - $auth = Zend_Auth::getInstance(); - if($auth->hasIdentity()) - { - /* - $user = $auth->getIdentity(); - $userid = $user->id; - $sql = "select d.* from dataorder d - left join users u on u.id=d.userid - left join metadata m on m.uuid=d.uuid - where (d.status=5 and d.userid='$userid' and d.uuid='$uuid') or u.usertype='administrator'"; - $re= $this->db->query($sql); - $row=$re->fetch(); - if(!empty($row['uuid'])) - { - $this->messenger->addMessage('您没有权限下载该附件'); - $this->_redirect("/data"); - } - else - {*/ - //由于涉及多个文件下载,所以将附件添加到zip压缩文件再输出 - - $sql="select * from mdattach m left join attachments a on m.id=a.id where m.uuid='$uuid'"; - $re=$this->db->query($sql); - $atts = $re->fetchAll(); - - $zip = new ZipArchive(); - $url=$this->view->config->upload."tmp/attachments_$uuid.zip";//创建临时文件 - $opened=$zip->open($url, ZIPARCHIVE::CREATE | ZIPARCHIVE::OVERWRITE); - if( $opened !== true ){ - die("cannot open {$url} for writing."); - } - - $updates = array(); //统计被下载的附件ID - - foreach ($atts as $k=>$v) - { - if (is_file($this->view->config->upload.$v['filename'])) { - $updates[]=$v['id']; - $zip->addFile($this->view->config->upload.$v['filename'],'/'.basename($v['filename'])); - } - } - $zip->close(); - - //更新统计 - $ids=join(',',$updates); - $sql = "update attachments set downtimes=downtimes+1 where id in ($ids)"; - @$this->db->exec($sql); - - - //输出下载 - $content=file_get_contents($url); - $this->_helper->layout->disableLayout(); - $this->_helper->viewRenderer->setNoRender(); - $this->getResponse()->setHeader('Content-Type', 'application/octet-stream') - ->setHeader('Content-Disposition','attachment; filename="'.basename($url).'"') - ->setHeader('Content-Length', strlen($content)) - ->setHeader('Content-Type','application/force-download') - ->setHeader('Content-Type','application/download') - ->setHeader('Content-Type','application/zip') - ->setHeader('Content-Description','File Transfer') - ->setHeader('Content-Transfer-Encoding','binary') - ->setHeader('Expires',0) - ->setHeader('Cache-Control','must-revalidate, post-check=0, pre-check=0') - ->setHeader('Pragma','public') - ->setBody($content); - // } - }//end if - else - { - $this->messenger->addMessage('您没有权限下载该附件'); - $this->_redirect("/data/$uuid"); - }//未登陆 - }//end if - else - { - $this->messenger->addMessage('您没有权限下载该附件'); - $this->_redirect("/data/$uuid"); - }//无权限 - - } - - - /* - * 西部计划项目及其数据产出 - */ - public function westeeAction() - { - //$sql="select w.*,m.uuid from westee w left join westeemd m on w.id=m.eeid order by w.id"; - $sql="select * from westee order by id"; - $this->view->westee=$this->db->fetchAll($sql); - $sql="select w.eeid,m.title,m.uuid from westeemd w left join metadata m on w.uuid=m.uuid order by w.eeid"; - $this->view->westeemd=$this->db->fetchAll($sql); - } - - public function pingbackAction() - { - $this->_helper->ViewRenderer->setNoRender(); - $this->_helper->layout->disableLayout(); - $server = new Zend_XmlRpc_Server(); - $server->setClass('PingbackRpc', 'pingback'); - echo $server->handle(); - } - - public function pingtestAction() - { - $this->_helper->ViewRenderer->setNoRender(); - $this->_helper->layout->disableLayout(); - $client = new Zend_XmlRpc_Client('http://test.westgis.ac.cn/data/pingback'); - $arg1 = 'http://wlx.westgis.ac.cn/567/'; - $arg2 = 'http://test.westgis.ac.cn/data/487591d0-d437-4114-b810-cbef7c4ee4b2'; - //$result = $client->call('pingback.ping', array($arg1, $arg2)); - $test = $client->getProxy('pingback'); - $test->ping($arg1,$arg2); - //var_dump($result); - } - public function outputAction() - { - $this->_helper->layout->disableLayout(); - $this->_helper->viewRenderer->setNoRender(); - $sql="select title,datatype,filesize,id from normalmetadata"; - $md=$this->db->fetchAll($sql); - foreach($md as $m) - { - print $m["title"].","; - print ($m["datatype"]?"内部":"公开").","; - print ($m["filesize"]==1?" ":$m["filesize"]).","; - $sql1="select keyword from keyword where id=".$m["id"]." and keytype='place'"; - $kd=$this->db->fetchAll($sql1); - foreach ($kd as $p) print $p["keyword"]." "; - print ","; - $sql1="select keyword from keyword where id=".$m["id"]." and keytype='temporal'"; - $kd=$this->db->fetchAll($sql1); - foreach ($kd as $p) print $p["keyword"]." "; - print ","; - print "
    "; - } - - } - - - public function jsonexit($data){ - $this->getResponse()->setHeader('Content-Type', 'application/json')->appendBody(json_encode($data,JSON_NUMERIC_CHECK)); - return true; - } - - public function organizationAction() - { - $page = $this->_request->getParam('page'); - $name = $this->_request->getParam('name'); - $state=$this->db->query("select distinct responsible.organisation from responsible left join role on role.resid=responsible.id where role.role in ('pointOfContact','resourceProvider','owner')"); - $this->view->organisation=$state->fetchAll(); - if (!empty($name)) { - $this->view->codename=$name; - $sql="select distinct m.* from normalmetadata m left join role r on m.uuid=r.uuid left join responsible s on r.resid=s.id where r.role in ('pointOfContact','resourceProvider','owner') and s.organisation=?"; - $sth = $this->db->prepare($sql); - $sth->execute(array($name)); - $rows = $sth->fetchAll(); - $paginator = Zend_Paginator::factory($rows); - $paginator->setCurrentPageNumber($this->_getParam('page')); - $paginator->setItemCountPerPage(10); - $paginator->setView($this->view); - Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml'); - $this->view->paginator=$paginator; - } else { - //提供全部分类列表 - } - } - function fundAction() - { - $id = (int)$this->_request->getParam('id'); - if (!empty($id)) { - $sql="select * from fund where id=?"; - $this->view->fund=$this->db->fetchRow($sql,array($id)); - if ($this->view->fund) { - $sql="select distinct m.* from normalmetadata m left join mdfund mf on m.uuid=mf.uuid where mf.fid=?"; - $sth = $this->db->prepare($sql); - $sth->execute(array($id)); - $rows = $sth->fetchAll(); - $paginator = Zend_Paginator::factory($rows); - $paginator->setCurrentPageNumber($this->_getParam('page')); - $paginator->setItemCountPerPage(10); - $paginator->setView($this->view); - Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml'); - $this->view->paginator=$paginator; - } - } else { - //提供全部分类列表 - $sql="select f.id,f.title,f.fund_id,f.fund_type,f.ts_created,count(m.id) as datacount,sum(md.filesize) as filesize from fund f left join mdfund m on f.id=m.fid left join metadata md on m.uuid=md.uuid where m.id is not null group by f.id,f.title,f.fund_id,f.fund_type,f.ts_created order by datacount desc,f.ts_created desc"; - $sth = $this->db->prepare($sql); - $sth->execute(); - $rows = $sth->fetchAll(); - $paginator = Zend_Paginator::factory($rows); - $paginator->setCurrentPageNumber($this->_getParam('page')); - $paginator->setItemCountPerPage(10); - $paginator->setView($this->view); - Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml'); - $this->view->paginator=$paginator; - $this->_helper->viewRenderer('fund-list'); - } - } - - //实现基于DOI信息的浏览 - function doiAction() - { - $ac = $this->_request->getParam('ac'); - if ($ac=='unready') { - //列出没有DOI的数据 - $sql="select m.* from normalmetadata m where length(m.doi)<3 and m.uuid not in (select uuid from datadoi) order by m.ts_created desc"; - $this->view->pageID='doi-unready'; - } else if ($ac=='prepare') { - //列出有DOI但还未进行提交申请的数据 - $sql="select m.* from normalmetadata m where length(m.doi)>3 and m.uuid not in (select uuid from datadoi) order by m.ts_created desc"; - $this->view->pageID='doi-prepare'; - } else if ($ac=='unsubmit') { - //列出有DOI并计划提交申请的数据 - $sql="select m.*,d.doi as datadoi,date(d.ts_created) as ts_created from normalmetadata m left join datadoi d on m.uuid=d.uuid where length(m.doi)>3 and d.ts_created is not null and d.ts_submitted is null order by d.ts_created desc"; - $this->view->pageID='doi-unsubmit'; - } else if ($ac=='submit') { - //列出有DOI并计划提交申请的数据 - $sql="select m.*,d.doi as datadoi,date(d.ts_submitted) as ts_submitted from normalmetadata m left join datadoi d on m.uuid=d.uuid where length(m.doi)>3 and d.ts_submitted is not null and d.ts_published is null order by d.ts_submitted desc,d.ts_created desc"; - $this->view->pageID='doi-submit'; - } else if ($ac=='publish' || empty($ac)) { - //默认:列出最新发布的DOI数据 - $sql="select m.*,d.doi as datadoi,date(d.ts_submitted) as ts_submitted,date(d.ts_published) as ts_published from normalmetadata m left join datadoi d on m.uuid=d.uuid where length(m.doi)>3 and d.ts_published is not null order by d.ts_published desc,d.ts_submitted desc,d.ts_created desc"; - $this->view->pageID='doi-publish'; - } - $sth = $this->db->prepare($sql); - $sth->execute(); - $rows = $sth->fetchAll(); - $paginator = Zend_Paginator::factory($rows); - $paginator->setCurrentPageNumber($this->_getParam('page')); - $paginator->setItemCountPerPage(10); - $paginator->setView($this->view); - Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml'); - $this->view->paginator=$paginator; - } - - //基于数据作者的浏览(包括认证后的数据作者以及未认证的数据作者) - function authorAction() - { - $ac = $this->_request->getParam('ac'); - $id = (int)$this->_request->getParam('id'); - if ($ac=='verified') { - //已经认证过的数据作者 - $this->view->pageID='author-verified'; - $this->view->ac='verified'; - if ($id) { - //列出作者的数据 - $sql="select username,realname from users where id=?"; - $this->view->author=$this->db->fetchRow($sql,array($id)); - $sql="select m.* from normalmetadata m left join mdauthor a on a.uuid=m.uuid where a.userid=?"; - $sth = $this->db->prepare($sql); - $sth->execute(array($id)); - $rows = $sth->fetchAll(); - $paginator = Zend_Paginator::factory($rows); - $paginator->setCurrentPageNumber($this->_getParam('page')); - $paginator->setItemCountPerPage(10); - $paginator->setView($this->view); - Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml'); - $this->view->paginator=$paginator; - } else { - //已经认证过的数据作者 - $sql="select u.username,u.realname,u.id,count(u.id) as count from mdauthor a left join users u on a.userid=u.id where a.status=1 and a.uuid in (select uuid from normalmetadata) group by u.id,u.username,u.realname"; - $sth = $this->db->prepare($sql); - $sth->execute(); - $rows = $sth->fetchAll(); - $paginator = Zend_Paginator::factory($rows); - $paginator->setCurrentPageNumber($this->_getParam('page')); - $paginator->setItemCountPerPage(50); - $paginator->setView($this->view); - Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml'); - $this->view->paginator=$paginator; - } - } else if ($ac=='unverified' || empty($ac)) { - //未认证的数据作者 - $this->view->pageID='author-unverified'; - $this->view->ac='unverified'; - if ($id) { - //列出数据 - $sql="select individual as username from responsible where id=?"; - $this->view->author=$this->db->fetchRow($sql,array($id)); - $sql="select distinct m.* from normalmetadata m left join role r on m.uuid=r.uuid left join responsible s on r.resid=s.id where r.role in ('pointOfContact','resourceProvider','owner') and s.id=?"; - $sth = $this->db->prepare($sql); - $sth->execute(array($id)); - $rows = $sth->fetchAll(); - $paginator = Zend_Paginator::factory($rows); - $paginator->setCurrentPageNumber($this->_getParam('page')); - $paginator->setItemCountPerPage(10); - $paginator->setView($this->view); - Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml'); - $this->view->paginator=$paginator; - } else { - //列出所有作者 - $sql="select distinct responsible.individual as username,responsible.id from responsible left join role on role.resid=responsible.id where role.role in ('pointOfContact','resourceProvider','owner')"; - $sth = $this->db->prepare($sql); - $sth->execute(); - $rows = $sth->fetchAll(); - $paginator = Zend_Paginator::factory($rows); - $paginator->setCurrentPageNumber($this->_getParam('page')); - $paginator->setItemCountPerPage(50); - $paginator->setView($this->view); - Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml'); - $this->view->paginator=$paginator; - } - } - } - - function listAction() - { - $sql="select m.uuid,m.title,m.citation,m.doi,d.doi as datadoi,d.ts_published,d.authors,d.publisher,date_part('year',d.ts_published) as publish_year from normalmetadata m -left join mdstatus s on m.uuid=s.uuid -left join datadoi d on d.uuid=m.uuid -where s.status>4 -and m.uuid not in -(select d.uuid from datasource d left join source s on d.sourceid=s.id -where s.code in ('heihe','water','hiwater','westee')) -order by m.title"; - $this->view->metadata=$this->db->fetchAll($sql); - $sql="select m.uuid,m.title,m.citation,m.doi,d.doi as datadoi,d.ts_published,d.authors,d.publisher,date_part('year',d.ts_published) as publish_year - from normalmetadata m left join datadoi d on d.uuid=m.uuid left join mdstatus s on m.uuid=s.uuid where s.status>4 and m.title like '黑河综合遥感联合试验%' order by title"; - $this->view->water=$this->db->fetchAll($sql); - $sql="select m.uuid,m.title,m.citation ,m.doi,d.doi as datadoi,d.ts_published,d.authors,d.publisher,date_part('year',d.ts_published) as publish_year - from normalmetadata m left join datadoi d on d.uuid=m.uuid left join mdstatus s on m.uuid=s.uuid where s.status>0 and m.title like '黑河生态水文遥感试验%' order by title"; - $this->view->hiwater=$this->db->fetchAll($sql); - $sql="select m.uuid,m.title,m.citation ,m.doi,d.doi as datadoi,d.ts_published,d.authors,d.publisher,date_part('year',d.ts_published) as publish_year - from normalmetadata m left join datadoi d on d.uuid=m.uuid left join mdstatus s on m.uuid=s.uuid left join datasource ds on ds.uuid=m.uuid left join source sr on ds.sourceid=sr.id where sr.code='heihe' and s.status>0 and m.title not like '黑河生态水文遥感试验%' order by title"; - $this->view->heihe=$this->db->fetchAll($sql); - $sql="select m.uuid,m.title,m.citation ,m.doi,d.doi as datadoi,d.ts_published,d.authors,d.publisher,date_part('year',d.ts_published) as publish_year - from normalmetadata m left join datadoi d on d.uuid=m.uuid left join mdstatus s on m.uuid=s.uuid left join datasource ds on ds.uuid=m.uuid left join source sr on ds.sourceid=sr.id where sr.code='westee' and s.status>4 order by title"; - $this->view->westee=$this->db->fetchAll($sql); - - } -} - + } + break; + case 'offline4' : + if($v['status'] == 5) $showorders[] = $rows[$k]; + break; + } + } + } + + $this->view->counts = $counts; + view::addPaginator($showorders,$this,10); + + } + + /* + * 查看数据缩略图 + */ + function thumbAction() + { + $page=(int)$this->_request->getParam('page'); + if (empty($page)) $page=1; + $offset=$this->limit*($page-1); + $state=$this->db->query("select count(*) from normalmetadata"); + $row=$state->fetchAll(); + $sum=$row[0]['count']; + $select=$this->db->select(); + $select->from('normalmetadata as m','m.*') + ->order('m.title desc')->limitPage($page,9); + $this->view->metadata = $this->db->fetchAll($select); + $this->view->page=new Pagination($sum,$page,$this->limit); + } + + /* + *附件下载 + */ + function attachAction(){ + + $uuid = $this->_request->getParam('uuid'); + + if(!empty($uuid)) + { + + $sql="select * from mdattach m left join attachments a on m.id=a.id where m.uuid='$uuid'"; + $re=$this->db->query($sql); + $atts = $re->fetch(); + + if(empty($atts['id'])) + { + $this->_redirect("/data/$uuid"); + }//没有附件 + + $auth = Zend_Auth::getInstance(); + if($auth->hasIdentity()) + { + /* + $user = $auth->getIdentity(); + $userid = $user->id; + $sql = "select d.* from dataorder d + left join users u on u.id=d.userid + left join metadata m on m.uuid=d.uuid + where (d.status=5 and d.userid='$userid' and d.uuid='$uuid') or u.usertype='administrator'"; + $re= $this->db->query($sql); + $row=$re->fetch(); + if(!empty($row['uuid'])) + { + $this->messenger->addMessage('您没有权限下载该附件'); + $this->_redirect("/data"); + } + else + {*/ + //由于涉及多个文件下载,所以将附件添加到zip压缩文件再输出 + + $sql="select * from mdattach m left join attachments a on m.id=a.id where m.uuid='$uuid'"; + $re=$this->db->query($sql); + $atts = $re->fetchAll(); + + $zip = new ZipArchive(); + $url=$this->view->config->upload."tmp/attachments_$uuid.zip";//创建临时文件 + $opened=$zip->open($url, ZIPARCHIVE::CREATE | ZIPARCHIVE::OVERWRITE); + if( $opened !== true ){ + die("cannot open {$url} for writing."); + } + + $updates = array(); //统计被下载的附件ID + + foreach ($atts as $k=>$v) + { + if (is_file($this->view->config->upload.$v['filename'])) { + $updates[]=$v['id']; + $zip->addFile($this->view->config->upload.$v['filename'],'/'.basename($v['filename'])); + } + } + $zip->close(); + + //更新统计 + $ids=join(',',$updates); + $sql = "update attachments set downtimes=downtimes+1 where id in ($ids)"; + @$this->db->exec($sql); + + + //输出下载 + $content=file_get_contents($url); + $this->_helper->layout->disableLayout(); + $this->_helper->viewRenderer->setNoRender(); + $this->getResponse()->setHeader('Content-Type', 'application/octet-stream') + ->setHeader('Content-Disposition','attachment; filename="'.basename($url).'"') + ->setHeader('Content-Length', strlen($content)) + ->setHeader('Content-Type','application/force-download') + ->setHeader('Content-Type','application/download') + ->setHeader('Content-Type','application/zip') + ->setHeader('Content-Description','File Transfer') + ->setHeader('Content-Transfer-Encoding','binary') + ->setHeader('Expires',0) + ->setHeader('Cache-Control','must-revalidate, post-check=0, pre-check=0') + ->setHeader('Pragma','public') + ->setBody($content); + // } + }//end if + else + { + $this->messenger->addMessage('您没有权限下载该附件'); + $this->_redirect("/data/$uuid"); + }//未登陆 + }//end if + else + { + $this->messenger->addMessage('您没有权限下载该附件'); + $this->_redirect("/data/$uuid"); + }//无权限 + + } + + + /* + * 西部计划项目及其数据产出 + */ + public function westeeAction() + { + //$sql="select w.*,m.uuid from westee w left join westeemd m on w.id=m.eeid order by w.id"; + $sql="select * from westee order by id"; + $this->view->westee=$this->db->fetchAll($sql); + $sql="select w.eeid,m.title,m.uuid from westeemd w left join metadata m on w.uuid=m.uuid order by w.eeid"; + $this->view->westeemd=$this->db->fetchAll($sql); + } + + public function pingbackAction() + { + $this->_helper->ViewRenderer->setNoRender(); + $this->_helper->layout->disableLayout(); + $server = new Zend_XmlRpc_Server(); + $server->setClass('PingbackRpc', 'pingback'); + echo $server->handle(); + } + + public function pingtestAction() + { + $this->_helper->ViewRenderer->setNoRender(); + $this->_helper->layout->disableLayout(); + $client = new Zend_XmlRpc_Client('http://test.westgis.ac.cn/data/pingback'); + $arg1 = 'http://wlx.westgis.ac.cn/567/'; + $arg2 = 'http://test.westgis.ac.cn/data/487591d0-d437-4114-b810-cbef7c4ee4b2'; + //$result = $client->call('pingback.ping', array($arg1, $arg2)); + $test = $client->getProxy('pingback'); + $test->ping($arg1,$arg2); + //var_dump($result); + } + public function outputAction() + { + $this->_helper->layout->disableLayout(); + $this->_helper->viewRenderer->setNoRender(); + $sql="select title,datatype,filesize,id from normalmetadata"; + $md=$this->db->fetchAll($sql); + foreach($md as $m) + { + print $m["title"].","; + print ($m["datatype"]?"内部":"公开").","; + print ($m["filesize"]==1?" ":$m["filesize"]).","; + $sql1="select keyword from keyword where id=".$m["id"]." and keytype='place'"; + $kd=$this->db->fetchAll($sql1); + foreach ($kd as $p) print $p["keyword"]." "; + print ","; + $sql1="select keyword from keyword where id=".$m["id"]." and keytype='temporal'"; + $kd=$this->db->fetchAll($sql1); + foreach ($kd as $p) print $p["keyword"]." "; + print ","; + print "
    "; + } + + } + + + public function jsonexit($data){ + $this->getResponse()->setHeader('Content-Type', 'application/json')->appendBody(json_encode($data,JSON_NUMERIC_CHECK)); + return true; + } + function organizationAction() + { + $page = $this->_request->getParam('page'); + $name = $this->_request->getParam('name'); + $state=$this->db->query("select distinct responsible.organisation from responsible left join role on role.resid=responsible.id where role.role in ('pointOfContact','resourceProvider','owner')"); + $this->view->organisation=$state->fetchAll(); + if (!empty($name)) { + $this->view->codename=$name; + $sql="select distinct m.* from normalmetadata m left join role r on m.uuid=r.uuid left join responsible s on r.resid=s.id where r.role in ('pointOfContact','resourceProvider','owner') and s.organisation=?"; + $sth = $this->db->prepare($sql); + $sth->execute(array($name)); + $rows = $sth->fetchAll(); + $paginator = Zend_Paginator::factory($rows); + $paginator->setCurrentPageNumber($this->_getParam('page')); + $paginator->setItemCountPerPage(10); + $paginator->setView($this->view); + Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml'); + $this->view->paginator=$paginator; + } else { + //提供全部分类列表 + } + } + function fundAction() + { + $id = (int)$this->_request->getParam('id'); + if (!empty($id)) { + $sql="select * from fund where id=?"; + $this->view->fund=$this->db->fetchRow($sql,array($id)); + if ($this->view->fund) { + $sql="select distinct m.* from normalmetadata m left join mdfund mf on m.uuid=mf.uuid where mf.fid=?"; + $sth = $this->db->prepare($sql); + $sth->execute(array($id)); + $rows = $sth->fetchAll(); + $paginator = Zend_Paginator::factory($rows); + $paginator->setCurrentPageNumber($this->_getParam('page')); + $paginator->setItemCountPerPage(10); + $paginator->setView($this->view); + Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml'); + $this->view->paginator=$paginator; + } + } else { + //提供全部分类列表 + $sql="select f.id,f.title,f.fund_id,f.fund_type,f.ts_created,count(m.id) as datacount,sum(md.filesize) as filesize from fund f left join mdfund m on f.id=m.fid left join metadata md on m.uuid=md.uuid where m.id is not null group by f.id,f.title,f.fund_id,f.fund_type,f.ts_created order by datacount desc,f.ts_created desc"; + $sth = $this->db->prepare($sql); + $sth->execute(); + $rows = $sth->fetchAll(); + $paginator = Zend_Paginator::factory($rows); + $paginator->setCurrentPageNumber($this->_getParam('page')); + $paginator->setItemCountPerPage(10); + $paginator->setView($this->view); + Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml'); + $this->view->paginator=$paginator; + $this->_helper->viewRenderer('fund-list'); + } + } + + //实现基于DOI信息的浏览 + function doiAction() + { + $ac = $this->_request->getParam('ac'); + if ($ac=='unready') { + //列出没有DOI的数据 + $sql="select m.* from normalmetadata m where length(m.doi)<3 and m.uuid not in (select uuid from datadoi) order by m.ts_created desc"; + $this->view->pageID='doi-unready'; + } else if ($ac=='prepare') { + //列出有DOI但还未进行提交申请的数据 + $sql="select m.* from normalmetadata m where length(m.doi)>3 and m.uuid not in (select uuid from datadoi) order by m.ts_created desc"; + $this->view->pageID='doi-prepare'; + } else if ($ac=='unsubmit') { + //列出有DOI并计划提交申请的数据 + $sql="select m.*,d.doi as datadoi,date(d.ts_created) as ts_created from normalmetadata m left join datadoi d on m.uuid=d.uuid where length(m.doi)>3 and d.ts_created is not null and d.ts_submitted is null order by d.ts_created desc"; + $this->view->pageID='doi-unsubmit'; + } else if ($ac=='submit') { + //列出有DOI并计划提交申请的数据 + $sql="select m.*,d.doi as datadoi,date(d.ts_submitted) as ts_submitted from normalmetadata m left join datadoi d on m.uuid=d.uuid where length(m.doi)>3 and d.ts_submitted is not null and d.ts_published is null order by d.ts_submitted desc,d.ts_created desc"; + $this->view->pageID='doi-submit'; + } else if ($ac=='publish' || empty($ac)) { + //默认:列出最新发布的DOI数据 + $sql="select m.*,d.doi as datadoi,date(d.ts_submitted) as ts_submitted,date(d.ts_published) as ts_published from normalmetadata m left join datadoi d on m.uuid=d.uuid where length(m.doi)>3 and d.ts_published is not null order by d.ts_published desc,d.ts_submitted desc,d.ts_created desc"; + $this->view->pageID='doi-publish'; + } + $sth = $this->db->prepare($sql); + $sth->execute(); + $rows = $sth->fetchAll(); + $paginator = Zend_Paginator::factory($rows); + $paginator->setCurrentPageNumber($this->_getParam('page')); + $paginator->setItemCountPerPage(10); + $paginator->setView($this->view); + Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml'); + $this->view->paginator=$paginator; + } + + //基于数据作者的浏览(包括认证后的数据作者以及未认证的数据作者) + function authorAction() + { + $ac = $this->_request->getParam('ac'); + $id = (int)$this->_request->getParam('id'); + if ($ac=='verified') { + //已经认证过的数据作者 + $this->view->pageID='author-verified'; + $this->view->ac='verified'; + if ($id) { + //列出作者的数据 + $sql="select username,realname from users where id=?"; + $this->view->author=$this->db->fetchRow($sql,array($id)); + $sql="select m.* from normalmetadata m left join mdauthor a on a.uuid=m.uuid where a.userid=?"; + $sth = $this->db->prepare($sql); + $sth->execute(array($id)); + $rows = $sth->fetchAll(); + $paginator = Zend_Paginator::factory($rows); + $paginator->setCurrentPageNumber($this->_getParam('page')); + $paginator->setItemCountPerPage(10); + $paginator->setView($this->view); + Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml'); + $this->view->paginator=$paginator; + } else { + //已经认证过的数据作者 + $sql="select u.username,u.realname,u.id,count(u.id) as count from mdauthor a left join users u on a.userid=u.id where a.status=1 and a.uuid in (select uuid from normalmetadata) group by u.id,u.username,u.realname"; + $sth = $this->db->prepare($sql); + $sth->execute(); + $rows = $sth->fetchAll(); + $paginator = Zend_Paginator::factory($rows); + $paginator->setCurrentPageNumber($this->_getParam('page')); + $paginator->setItemCountPerPage(50); + $paginator->setView($this->view); + Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml'); + $this->view->paginator=$paginator; + } + } else if ($ac=='unverified' || empty($ac)) { + //未认证的数据作者 + $this->view->pageID='author-unverified'; + $this->view->ac='unverified'; + if ($id) { + //列出数据 + $sql="select individual as username from responsible where id=?"; + $this->view->author=$this->db->fetchRow($sql,array($id)); + $sql="select distinct m.* from normalmetadata m left join role r on m.uuid=r.uuid left join responsible s on r.resid=s.id where r.role in ('pointOfContact','resourceProvider','owner') and s.id=?"; + $sth = $this->db->prepare($sql); + $sth->execute(array($id)); + $rows = $sth->fetchAll(); + $paginator = Zend_Paginator::factory($rows); + $paginator->setCurrentPageNumber($this->_getParam('page')); + $paginator->setItemCountPerPage(10); + $paginator->setView($this->view); + Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml'); + $this->view->paginator=$paginator; + } else { + //列出所有作者 + $sql="select distinct responsible.individual as username,responsible.id from responsible left join role on role.resid=responsible.id where role.role in ('pointOfContact','resourceProvider','owner')"; + $sth = $this->db->prepare($sql); + $sth->execute(); + $rows = $sth->fetchAll(); + $paginator = Zend_Paginator::factory($rows); + $paginator->setCurrentPageNumber($this->_getParam('page')); + $paginator->setItemCountPerPage(50); + $paginator->setView($this->view); + Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml'); + $this->view->paginator=$paginator; + } + } + } + + function listAction() + { + $sql="select m.uuid,m.title,m.citation,m.doi,d.doi as datadoi,d.ts_published,d.authors,d.publisher,date_part('year',d.ts_published) as publish_year from normalmetadata m +left join mdstatus s on m.uuid=s.uuid +left join datadoi d on d.uuid=m.uuid +where s.status>4 +and m.uuid not in +(select d.uuid from datasource d left join source s on d.sourceid=s.id +where s.code in ('heihe','water','hiwater','westee')) +order by m.title"; + $this->view->metadata=$this->db->fetchAll($sql); + $sql="select m.uuid,m.title,m.citation,m.doi,d.doi as datadoi,d.ts_published,d.authors,d.publisher,date_part('year',d.ts_published) as publish_year + from normalmetadata m left join datadoi d on d.uuid=m.uuid left join mdstatus s on m.uuid=s.uuid where s.status>4 and m.title like '黑河综合遥感联合试验%' order by title"; + $this->view->water=$this->db->fetchAll($sql); + $sql="select m.uuid,m.title,m.citation ,m.doi,d.doi as datadoi,d.ts_published,d.authors,d.publisher,date_part('year',d.ts_published) as publish_year + from normalmetadata m left join datadoi d on d.uuid=m.uuid left join mdstatus s on m.uuid=s.uuid where s.status>0 and m.title like '黑河生态水文遥感试验%' order by title"; + $this->view->hiwater=$this->db->fetchAll($sql); + $sql="select m.uuid,m.title,m.citation ,m.doi,d.doi as datadoi,d.ts_published,d.authors,d.publisher,date_part('year',d.ts_published) as publish_year + from normalmetadata m left join datadoi d on d.uuid=m.uuid left join mdstatus s on m.uuid=s.uuid left join datasource ds on ds.uuid=m.uuid left join source sr on ds.sourceid=sr.id where sr.code='heihe' and s.status>0 and m.title not like '黑河生态水文遥感试验%' order by title"; + $this->view->heihe=$this->db->fetchAll($sql); + $sql="select m.uuid,m.title,m.citation ,m.doi,d.doi as datadoi,d.ts_published,d.authors,d.publisher,date_part('year',d.ts_published) as publish_year + from normalmetadata m left join datadoi d on d.uuid=m.uuid left join mdstatus s on m.uuid=s.uuid left join datasource ds on ds.uuid=m.uuid left join source sr on ds.sourceid=sr.id where sr.code='westee' and s.status>4 order by title"; + $this->view->westee=$this->db->fetchAll($sql); + + } +} + diff --git a/application/default/controllers/VisualController.php b/application/default/controllers/VisualController.php deleted file mode 100644 index cb3a0e11..00000000 --- a/application/default/controllers/VisualController.php +++ /dev/null @@ -1,80 +0,0 @@ -view->config = Zend_Registry::get('config'); - $this->db=Zend_Registry::get('db'); - - $auth = Zend_Auth::getInstance(); - if($auth->hasIdentity()) - { - $user = $auth->getIdentity(); - $this->uid = $user->id; - }else{ - $this->_redirect('/account/login?href=/visual'); - } - } - - function indexAction() - { - $record_type = $this->_getParam("dataset"); - - if(empty($record_type)) - return true; - - $sc = Factory::Bootstrap($record_type); - } - - - //******************************************************** - - /* - * dataAction() ajax获取数据 - * - * param string $ac //请求的数据类型 - * param string $dt //请求的数据来源(气象,水文) - * - * return view - */ - function dataAction() - { - $this->_helper->viewRenderer->setNoRender(); - $this->_helper->layout->disableLayout(); - - $record_type = $this->_getParam("dataset"); - $record_subset = $this->_getParam("subdataset"); - - if(empty($record_type)) - return true; - - $record = Factory::Bootstrap($record_type); - - if(!empty($record_subset)) - { - $record->subset = $record_subset; - } - $data = $record->outPut(); - - $this->jsonexit($data); - return true; - - }//dataAction() Ajax获取数据 - - - /* - * jsonexit() 退出并返回json数据 - * - * param array $data 要返回的JSON数据,可以是任意数组 - * - * return application/JSON - */ - public function jsonexit($data){ - $this->getResponse()->setHeader('Content-Type', 'application/json')->appendBody(json_encode($data,JSON_NUMERIC_CHECK)); - return true; - }//jsonexit() 退出并返回json数据 - -} \ No newline at end of file diff --git a/application/default/views/scripts/data/index.phtml b/application/default/views/scripts/data/index.phtml index c4ab8b53..c589d345 100755 --- a/application/default/views/scripts/data/index.phtml +++ b/application/default/views/scripts/data/index.phtml @@ -8,81 +8,81 @@ $this->headTitle()->setSeparator(' - '); .fieldlist ul li:hover{color:#FFF;background:#0088CC;border-radius: 6px 6px 6px 6px;} .fieldlist ul li:hover a{color:#FFF; text-decoration:none;} .news_list ul li{line-height:24px;} - -
    -
    -

    特色导航

    - + + '地点关键词','theme'=>'主题关键词','discipline'=>'学科关键词','stratum'=>'地层关键词','temporal'=>'时间关键词'); + $keytypezh=array('place'=>'地点关键词','theme'=>'主题关键词','discipline'=>'学科关键词','stratum'=>'地层关键词','temporal'=>'时间关键词'); $type='theme'; -?> -
    -

    +?> +
    +

      keywords[$type] as $cg) : ?>
    • '>()
    -
    +
    -
    -

    +
    +

      keywords[$type] as $cg) : ?>
    • '>()
    -
    -
    -
    +
    +
    +
    -
    -

    +?> +
    +

      keywords[$type] as $cg) : ?>
    • '>()
    -
    +
    -
    -

    +
    +

      keywords[$type] as $cg) : ?>
    • '>()
    -
    +
    @@ -94,7 +94,7 @@ $this->headTitle()->setSeparator(' - ');
  • '>()
  • -
    +

     数据服务

    @@ -102,7 +102,6 @@ $this->headTitle()->setSeparator(' - ');
  • -   离线数据服务记录(最近20个)
  • -   如何从数据中心申请数据
  • -   如何在数据中心发布数据
  • -
  • -   数据可视化
  • diff --git a/application/default/views/scripts/index/index.phtml b/application/default/views/scripts/index/index.phtml index 84269165..1867014d 100755 --- a/application/default/views/scripts/index/index.phtml +++ b/application/default/views/scripts/index/index.phtml @@ -83,7 +83,7 @@
    -

    青海省草原总站

    +

    青海省草原总站

    @@ -110,7 +110,7 @@
    -

    青海省林业调查规划院

    +

    青海省林业调查规划院

    @@ -126,7 +126,7 @@
    -

    青海省水文水资源局

    +

    青海省水文水资源局

    diff --git a/application/default/views/scripts/visual/data.phtml b/application/default/views/scripts/visual/data.phtml deleted file mode 100644 index 5bf9f199..00000000 --- a/application/default/views/scripts/visual/data.phtml +++ /dev/null @@ -1,174 +0,0 @@ -headTitle($this->config->title->site); -$this->headTitle($this->config->title->author); -$this->headTitle()->setSeparator(' - '); -$this->headScript()->appendFile('/js/jquery.colorbox-min.js'); -$this->headLink()->appendStylesheet('/css/colorbox.css'); -$this->headScript()->appendFile('/static/js/highcharts/highcharts.js'); -$this->headScript()->appendFile('/static/js/highcharts/modules/exporting.js'); -$this->breadcrumb('首页'); -$this->breadcrumb('数据可视化'); -$this->breadcrumb()->setSeparator(' > '); -?> - - - - - -
    -
    -
    - -
    - - \ No newline at end of file diff --git a/application/default/views/scripts/visual/index.phtml b/application/default/views/scripts/visual/index.phtml deleted file mode 100644 index 1e3e474b..00000000 --- a/application/default/views/scripts/visual/index.phtml +++ /dev/null @@ -1,140 +0,0 @@ -headTitle($this->config->title->site); -$this->headTitle($this->config->title->data); -$this->headTitle()->setSeparator(' - '); -$theme = new Theme; -$theme->appendPlus($this,'highstock'); -$this->breadcrumb('首页'); -$this->breadcrumb('数据与服务'); -$this->breadcrumb('数据可视化'); -$this->breadcrumb()->setSeparator(' > '); -?> - - \ No newline at end of file diff --git a/application/layouts/layout.phtml b/application/layouts/layout.phtml index 825bbf07..2b56287b 100755 --- a/application/layouts/layout.phtml +++ b/application/layouts/layout.phtml @@ -28,20 +28,16 @@
    render('footer.phtml') ?> - - - + + \ No newline at end of file diff --git a/application/models/ISO19115.php b/application/models/ISO19115.php index 95411588..6acc47dd 100755 --- a/application/models/ISO19115.php +++ b/application/models/ISO19115.php @@ -175,7 +175,6 @@ class ISO19115 //删除所有未用到的responsible数据 $sql="delete from responsible where id not in (select distinct(resid) from role)"; $db->query($sql); - $this->view=new \stdClass; $this->view->config = Zend_Registry::get('config'); //if (!empty($this->doi)) $row->doi=$this->doi; @@ -210,14 +209,8 @@ class ISO19115 //处理在线资源 if ($this->onlineresource) foreach($this->onlineresource as $resource) { - if (isset($resource['name']) && $resource['name']) - { - $sql="insert into onlineresource (uuid,linkage,protocol,name,description) values(?,?,?,?,?)"; - $db->query($sql,array($this->uuid,$resource['linkage'],$resource['protocol'],$resource['name'],$resource['description'])); - } else { - $sql="insert into onlineresource (uuid,linkage,protocol,description) values(?,?,?,?)"; - $db->query($sql,array($this->uuid,$resource['linkage'],$resource['protocol'],$resource['description'])); - } + $sql="insert into onlineresource (uuid,linkage,protocol,name,description) values(?,?,?,?,?)"; + $db->query($sql,array($this->uuid,$resource['linkage'],$resource['protocol'],$resource['name'],$resource['description'])); } //处理缩略图 if (!empty($this->thumbnail)) { @@ -232,7 +225,7 @@ class ISO19115 if ($this->view->config) $geonetwork=$this->view->config->geonetwork->url; else - $geonetwork='http://www.sanjiangyuan.org.cn/geonetwork/'; + $geonetwork='http://westdc.westgis.ac.cn/geonetwork/'; $thumb=base64_encode(file_get_contents($geonetwork.'srv/cn/resources.get?access=public&id='.$r->gid.'&fname='.urlencode($this->graph['filename']))); $sql="insert into thumbnail (id,data,filetype,filedesc,filename) values(?,?,?,?,?)"; $db->query($sql,array($id,$thumb,$this->graph['filetype'],$this->graph['filedesc'],$this->graph['filename'])); @@ -378,7 +371,7 @@ class ISO19115 function parse() { $this->resTitle=$this->dom->getElementsByTagName('resTitle')->item(0)->nodeValue; - @$this->resAltTitle=$this->dom->getElementsByTagName('resAltTitle')->item(0)->nodeValue; + $this->resAltTitle=$this->dom->getElementsByTagName('resAltTitle')->item(0)->nodeValue; $this->idAbs=$this->dom->getElementsByTagName('idAbs')->item(0)->nodeValue; $this->mdFileID=$this->dom->getElementsByTagName('mdFileID')->item(0)->nodeValue; $this->mdDateSt=$this->dom->getElementsByTagName('mdDateSt')->item(0)->nodeValue; @@ -388,7 +381,7 @@ class ISO19115 //项目支持信息 @$this->suppinfo=$this->dom->getElementsByTagName('suppInfo')->item(0)->nodeValue; //DOI,自定义项 - @$cittype=$this->dom->getElementsByTagName('citIdType')->item(0)->nodeValue; + $cittype=$this->dom->getElementsByTagName('citIdType')->item(0)->nodeValue; if ($cittype=='DOI') $this->doi=$this->dom->getElementsByTagName('citId')->item(0)->nodeValue; //数据大小,以MB为单位 @@ -409,7 +402,7 @@ class ISO19115 { $this->author[$k]['individual']=$author->getElementsByTagName('rpIndName')->item(0)->nodeValue; $this->author[$k]['organisation']=$author->getElementsByTagName('rpOrgName')->item(0)->nodeValue; - @$this->author[$k]['position']=$author->getElementsByTagName('rpPosName')->item(0)->nodeValue; + $this->author[$k]['position']=$author->getElementsByTagName('rpPosName')->item(0)->nodeValue; $this->author[$k]['delivery']=$author->getElementsByTagName('delPoint')->item(0)->nodeValue; $this->author[$k]['phone']=$author->getElementsByTagName('voiceNum')->item(0)->nodeValue; $this->author[$k]['email']=$author->getElementsByTagName('eMailAdd')->item(0)->nodeValue; @@ -425,7 +418,7 @@ class ISO19115 { $this->author[$cnt+$j]['individual']=$author->getElementsByTagName('rpIndName')->item(0)->nodeValue; $this->author[$cnt+$j]['organisation']=$author->getElementsByTagName('rpOrgName')->item(0)->nodeValue; - @$this->author[$cnt+$j]['position']=$author->getElementsByTagName('rpPosName')->item(0)->nodeValue; + $this->author[$cnt+$j]['position']=$author->getElementsByTagName('rpPosName')->item(0)->nodeValue; $this->author[$cnt+$j]['delivery']=$author->getElementsByTagName('delPoint')->item(0)->nodeValue; $this->author[$cnt+$j]['phone']=$author->getElementsByTagName('voiceNum')->item(0)->nodeValue; $this->author[$cnt+$j]['email']=$author->getElementsByTagName('eMailAdd')->item(0)->nodeValue; @@ -441,7 +434,7 @@ class ISO19115 { $this->author[$cnt+$m]['individual']=$author->getElementsByTagName('rpIndName')->item(0)->nodeValue; $this->author[$cnt+$m]['organisation']=$author->getElementsByTagName('rpOrgName')->item(0)->nodeValue; - @$this->author[$cnt+$m]['position']=$author->getElementsByTagName('rpPosName')->item(0)->nodeValue; + $this->author[$cnt+$m]['position']=$author->getElementsByTagName('rpPosName')->item(0)->nodeValue; $this->author[$cnt+$m]['delivery']=$author->getElementsByTagName('delPoint')->item(0)->nodeValue; $this->author[$cnt+$m]['phone']=$author->getElementsByTagName('voiceNum')->item(0)->nodeValue; $this->author[$cnt+$m]['email']=$author->getElementsByTagName('eMailAdd')->item(0)->nodeValue; @@ -579,8 +572,8 @@ class ISO19115 foreach($ds as $k=>$dataset) { $this->datasetSeries[$k]['seriesName']=$dataset->getElementsByTagName('seriesName')->item(0)->nodeValue; - @$this->datasetSeries[$k]['issId']=$dataset->getElementsByTagName('issId')->item(0)->nodeValue; - @$this->datasetSeries[$k]['artPage']=$dataset->getElementsByTagName('artPage')->item(0)->nodeValue; + $this->datasetSeries[$k]['issId']=$dataset->getElementsByTagName('issId')->item(0)->nodeValue; + $this->datasetSeries[$k]['artPage']=$dataset->getElementsByTagName('artPage')->item(0)->nodeValue; } //unsure which one. $ds=$this->dom->getElementsByTagName('Series'); diff --git a/application/models/Search.php b/application/models/Search.php index f66b64e1..964b6e24 100644 --- a/application/models/Search.php +++ b/application/models/Search.php @@ -66,7 +66,7 @@ class Search function __construct($text='') { require_once '/home/wlx/xunsearch/sdk/php/lib/XS.php'; - $this->xs=new XS('westdc'); + $this->xs=new XS('heihe'); $this->search=$this->xs->search; $this->terms = array(); $this->text=$text; diff --git a/application/models/Theme.php b/application/models/Theme.php index 50324775..244a75bc 100644 --- a/application/models/Theme.php +++ b/application/models/Theme.php @@ -1,194 +1,188 @@ -_init_plus(); - } - - //初始化插件 - function _init_plus() - { - $this->plus = array( - - /**********Jquery公共库******/ - - //Jquery - 'jquery'=>array( - $this->ScriptKey => array( - '/js/lib/jquery.lasted.js' - ) - ), - - //Jquery UI - 'jquery_ui'=>array( - $this->ScriptKey => array( - '/js/lib/jquery.lasted.js', - '/js/lib/jquery.ui/jquery-ui.lasted.js' - ), - $this->CSSKey =>array( - '/js/lib/jquery.ui/jquery-ui.lasted.css' - ) - ), - - /********* Bootstrap ******/ - 'bootstrap'=>array( - $this->ScriptKey => array( - '/js/lib/bootstrap/js/bootstrap.min.js', - ), - $this->CSSKey =>array( - '/js/lib/bootstrap/css/bootstrap.min.css', - '/js/lib/bootstrap/css/bootstrap-responsive.min.css' - ) - ), - - - /********Jquery 插件********/ - - //colorbox - 'colorbox' => array( - $this->ScriptKey => array( - '/js/lib/jquery.colorbox/jquery.colorbox-min.js' - ), - $this->CSSKey => array( - '/js/lib/jquery.colorbox/style2/colorbox.css' - ) - ), - - //inputbg - 'inputbg' => array( - $this->ScriptKey => array( - '/js/lib/custom/jquery.inputbg.js' - ) - ), - - //loadinglayer - 'loadinglayer' => array( - $this->ScriptKey => array( - '/js/lib/custom/jquery.loadinglayer.js' - ) - ), - - //admin_plugin - 'admin_plugin' => array( - $this->ScriptKey => array( - '/js/lib/custom/admin_plugin.js' - ) - ), - - 'jplayer' => array( - $this->ScriptKey => array( - '/js/lib/jplayer/jquery.jplayer.min.js' - ) - ), - - //slides - 'slides' => array( - $this->ScriptKey => array( - '/js/lib/jquery.slides.min.js' - ) - ), - - 'datatable' => array( - $this->ScriptKey => array( - '/js/lib/jquery.datatable/jquery.dataTables.min.js' - ), - $this->CSSKey => array( - '/js/lib/jquery.datatable/datatable.css' - ) - ), - - 'masonry' => array( - $this->ScriptKey => array( - '/js/lib/jquery.masonry.min.js' - ), - ), - - 'uploadify' => array( - $this->ScriptKey => array( - '/js/lib/uploadify/jquery.uploadify.min.js' - ), - $this->CSSKey => array( - '/js/lib/uploadify/uploadify.css' - ), - ), - - 'datepicker' => array( - $this->ScriptKey => array( - '/js/lib/datepicker/jquery-ui-1.10.3.custom.min.js' - ), - $this->CSSKey => array( - '/js/lib/datepicker/jquery-ui-1.10.3.custom.min.css' - ) - ), - - 'highstock' => array( - $this->ScriptKey => array( - '/js/lib/highstock/highstock.js' - ) - ), - - /*********谷歌地图*********/ - - //Google Map API v3 - 'google_map_v3'=>array( - $this->ScriptKey => array( - 'http://maps.google.com/maps/api/js?sensor=false&language=zh-cn' - ) - ), - - //Google Map API v3 - KeyDragZone - 'google_map_keydragzone' => array( - $this->ScriptKey => array( - '/js/lib/google-map/keydragzoom.js' - ) - ), - - );//插件列表 - - }// _init_plus() - - //前台添加插件 - function AppendPlus($render,$plus_name){ - - $plus_name = strtolower($plus_name); - - $plusing = $this->plus; - - if(!empty($plusing[$plus_name][$this->ScriptKey])) - { - foreach($plusing[$plus_name][$this->ScriptKey] as $k=>$v) - { - $render->headScript()->appendFile($v); - } - } - - if(!empty($plusing[$plus_name][$this->CSSKey])) - { - foreach($plusing[$plus_name][$this->CSSKey] as $k=>$v) - { - $render->headLink()->appendStylesheet($v); - } - } - - }// AppendPlus - - //加载页面中的JS - function AppendModel($render,$model) - { - - $model = trim($model); - - $render->headScript()->appendFile("/js/lib/custom/models/".$model.".js"); - - }// -} +_init_plus(); + } + + //初始化插件 + function _init_plus() + { + $this->plus = array( + + /**********Jquery公共库******/ + + //Jquery + 'jquery'=>array( + $this->ScriptKey => array( + '/js/lib/jquery.lasted.js' + ) + ), + + //Jquery UI + 'jquery_ui'=>array( + $this->ScriptKey => array( + '/js/lib/jquery.lasted.js', + '/js/lib/jquery.ui/jquery-ui.lasted.js' + ), + $this->CSSKey =>array( + '/js/lib/jquery.ui/jquery-ui.lasted.css' + ) + ), + + /********* Bootstrap ******/ + 'bootstrap'=>array( + $this->ScriptKey => array( + '/js/lib/bootstrap/js/bootstrap.min.js', + ), + $this->CSSKey =>array( + '/js/lib/bootstrap/css/bootstrap.min.css', + '/js/lib/bootstrap/css/bootstrap-responsive.min.css' + ) + ), + + + /********Jquery 插件********/ + + //colorbox + 'colorbox' => array( + $this->ScriptKey => array( + '/js/lib/jquery.colorbox/jquery.colorbox-min.js' + ), + $this->CSSKey => array( + '/js/lib/jquery.colorbox/style2/colorbox.css' + ) + ), + + //inputbg + 'inputbg' => array( + $this->ScriptKey => array( + '/js/lib/custom/jquery.inputbg.js' + ) + ), + + //loadinglayer + 'loadinglayer' => array( + $this->ScriptKey => array( + '/js/lib/custom/jquery.loadinglayer.js' + ) + ), + + //admin_plugin + 'admin_plugin' => array( + $this->ScriptKey => array( + '/js/lib/custom/admin_plugin.js' + ) + ), + + 'jplayer' => array( + $this->ScriptKey => array( + '/js/lib/jplayer/jquery.jplayer.min.js' + ) + ), + + //slides + 'slides' => array( + $this->ScriptKey => array( + '/js/lib/jquery.slides.min.js' + ) + ), + + 'datatable' => array( + $this->ScriptKey => array( + '/js/lib/jquery.datatable/jquery.dataTables.min.js' + ), + $this->CSSKey => array( + '/js/lib/jquery.datatable/datatable.css' + ) + ), + + 'masonry' => array( + $this->ScriptKey => array( + '/js/lib/jquery.masonry.min.js' + ), + ), + + 'uploadify' => array( + $this->ScriptKey => array( + '/js/lib/uploadify/jquery.uploadify.min.js' + ), + $this->CSSKey => array( + '/js/lib/uploadify/uploadify.css' + ), + ), + + 'datepicker' => array( + $this->ScriptKey => array( + '/js/lib/datepicker/jquery-ui-1.10.3.custom.min.js' + ), + $this->CSSKey => array( + '/js/lib/datepicker/jquery-ui-1.10.3.custom.min.css' + ) + ), + + /*********谷歌地图*********/ + + //Google Map API v3 + 'google_map_v3'=>array( + $this->ScriptKey => array( + 'http://maps.google.com/maps/api/js?sensor=false&language=zh-cn' + ) + ), + + //Google Map API v3 - KeyDragZone + 'google_map_keydragzone' => array( + $this->ScriptKey => array( + '/js/lib/google-map/keydragzoom.js' + ) + ), + + );//插件列表 + + }// _init_plus() + + //前台添加插件 + function AppendPlus($render,$plus_name){ + + $plus_name = strtolower($plus_name); + + $plusing = $this->plus; + + if(!empty($plusing[$plus_name][$this->ScriptKey])) + { + foreach($plusing[$plus_name][$this->ScriptKey] as $k=>$v) + { + $render->headScript()->appendFile($v); + } + } + + if(!empty($plusing[$plus_name][$this->CSSKey])) + { + foreach($plusing[$plus_name][$this->CSSKey] as $k=>$v) + { + $render->headLink()->appendStylesheet($v); + } + } + + }// AppendPlus + + //加载页面中的JS + function AppendModel($render,$model) + { + + $model = trim($model); + + $render->headScript()->appendFile("/js/lib/custom/models/".$model.".js"); + + }// +} diff --git a/application/module/Helpers/PDO.php b/application/module/Helpers/PDO.php deleted file mode 100644 index d41733c4..00000000 --- a/application/module/Helpers/PDO.php +++ /dev/null @@ -1,45 +0,0 @@ -config_local_path); - $dsn = "pgsql:host={$config_local->db->hostname};" - ."port=5432;" - ."dbname={$config_local->db->database};" - ."user={$config_local->db->username};" - ."password={$config_local->db->password}"; - parent::__construct($dsn); - } - - else{ - - if(is_string($DSN)) - { - parent::__construct($DSN); - } - - else{ - $dsn = "pgsql:host={$DSN['host']};" - ."port={$DSN['port']};" - ."dbname={$DSN['db']};" - ."user={$DSN['user']};" - ."password={$DSN['pwd']}"; - parent::__construct($dsn); - } - - } - } - -} \ No newline at end of file diff --git a/application/module/Westdc/Visual/Event/RecordEvent.php b/application/module/Westdc/Visual/Event/RecordEvent.php deleted file mode 100644 index 31513adb..00000000 --- a/application/module/Westdc/Visual/Event/RecordEvent.php +++ /dev/null @@ -1,13 +0,0 @@ -db = \Zend_Registry::get('db'); - - - $this->config = \Zend_Registry::get('config'); - $this->table = new Table(); - } - - public function deleteAuthor(\Zend_EventManager_Event $e) - { - $id = $e->getParam('id'); - - $ref = new Reference(); - - return $ref->deleteReferenceAuthor($id); - } - - public function deleteTag(\Zend_EventManager_Event $e) - { - $id = $e->getParam('id'); - - $ref = new Reference(); - - return $ref->deleteReferenceTag($id); - } -} \ No newline at end of file diff --git a/application/module/Westdc/Visual/Listener/RecordListener.php b/application/module/Westdc/Visual/Listener/RecordListener.php deleted file mode 100644 index eb06afe8..00000000 --- a/application/module/Westdc/Visual/Listener/RecordListener.php +++ /dev/null @@ -1,35 +0,0 @@ -_Events = Factory::Handle($recordType); - } - - public function attach(EventManagerInterface $events) - { - $this->listeners[] = $events->attach('submit.checkParam', array($this->_Events, 'checkParam'), 100); - $this->listeners[] = $events->attach('submit.processData', array($this->_Events, 'processData'), 100); - $this->listeners[] = $events->attach('submit.recordPosted', array($this->_Events, 'recordPosted'), 100); - $this->listeners[] = $events->attach('submit.recordChanged', array($this->_Events, 'recordChanged'), 100); - } - - public function detach(EventManagerInterface $events) - { - foreach ($this->listeners as $index => $listener) { - if ($events->detach($listener)) { - unset($this->listeners[$index]); - } - } - } - -} diff --git a/application/module/Westdc/Visual/Listener/VisualListener.php b/application/module/Westdc/Visual/Listener/VisualListener.php deleted file mode 100644 index b5bcf3f5..00000000 --- a/application/module/Westdc/Visual/Listener/VisualListener.php +++ /dev/null @@ -1,27 +0,0 @@ -event = new \Zend_EventManager_EventManager(); - } - - public function attach(\Zend_EventManager_EventCollection $events) - { - $Handler = new ReferenceHandler(); - $events->attach('submit.checkParam', array($Handler, 'checkReferenceParam'), 100); - $events->attach('submit.processData', array($Handler, 'processReferenceData'), 100); - $events->attach('submit.recordPosted', array($Handler, 'recordPosted'), 100); - $events->attach('submit.recordChanged', array($Handler, 'recordChanged'), 100); - } - - public function detach(\Zend_EventManager_EventCollection $events) - { - - } - -} diff --git a/application/module/Westdc/Visual/Reader/Sc.php b/application/module/Westdc/Visual/Reader/Sc.php deleted file mode 100644 index 49b2f1f5..00000000 --- a/application/module/Westdc/Visual/Reader/Sc.php +++ /dev/null @@ -1,71 +0,0 @@ -subset)) - { - $this->subset = "avg_sand"; - return; - } - - switch($this->subset){ - case "avg": - $this->subset = "avg_sand"; - break; - case "max" : - $this->subset = "max_sand"; - break; - case "min" : - $this->subset = "min_sand"; - break; - } - - return; - } - - public function getData() - { - $sql = "SELECT * FROM data_sands - ORDER BY - year ASC, - month ASC - "; - - $rs = $this->db->query($sql); - return $rs; - - } - - public function outPut() - { - $this->switchDataset(); - - $rs = $this->getData(); - - $data = array(); - - while($row = $rs->fetch()) - { - $row['utctime'] = $this->utcMsTime(mktime(0,0,0,$row['month'],0,$row['year'])); - $data[] = array($row['utctime'],$row[$this->subset]); - } - - return $data; - } - -} \ No newline at end of file diff --git a/application/module/Westdc/Visual/Reader/Sc2009.php b/application/module/Westdc/Visual/Reader/Sc2009.php deleted file mode 100644 index 3cd9c522..00000000 --- a/application/module/Westdc/Visual/Reader/Sc2009.php +++ /dev/null @@ -1,71 +0,0 @@ -subset)) - { - $this->subset = "avg_sand"; - return; - } - - switch($this->subset){ - case "avg": - $this->subset = "avg_sand"; - break; - case "max" : - $this->subset = "max_sand"; - break; - case "min" : - $this->subset = "min_sand"; - break; - } - - return; - } - - public function getData() - { - $sql = "SELECT * FROM data_sands2009 - ORDER BY - year ASC, - month ASC - "; - - $rs = $this->db->query($sql); - return $rs; - - } - - public function outPut() - { - $this->switchDataset(); - - $rs = $this->getData(); - - $data = array(); - - while($row = $rs->fetch()) - { - $row['utctime'] = $this->utcMsTime(mktime(0,0,0,$row['month'],0,$row['year'])); - $data[] = array($row['utctime'],$row[$this->subset]); - } - - return $data; - } - -} \ No newline at end of file diff --git a/application/module/Westdc/Visual/Reader/SoilMoisture.php b/application/module/Westdc/Visual/Reader/SoilMoisture.php deleted file mode 100644 index 0b363a0e..00000000 --- a/application/module/Westdc/Visual/Reader/SoilMoisture.php +++ /dev/null @@ -1,81 +0,0 @@ -subset)) - { - $this->subset = "20cm"; - return; - } - - switch($this->subset){ - case "10cm": - $this->subset = "vwc_avg10"; - break; - case "20cm" : - $this->subset = "vwc_avg20"; - break; - case "30cm" : - $this->subset = "vwc_avg30"; - break; - case "40cm" : - $this->subset = "vwc_avg40"; - break; - case "50cm" : - $this->subset = "vwc_avg50"; - break; - } - - return; - } - - public function getData() - { - $this->switchDataset(); - - $sql = "SELECT * FROM data_watercontent - WHERE - $this->subset > 0 - ORDER BY - extract(year from \"timestamp\") ASC, - extract(month from \"timestamp\") ASC, - extract(day from \"timestamp\") ASC, - extract(hour from \"timestamp\") ASC - "; - //exit($sql); - $rs = $this->db->query($sql); - return $rs; - - } - - public function outPut() - { - - $rs = $this->getData(); - - $data = array(); - - while($row = $rs->fetch()) - { - $row['utctime'] = $this->utcMsTime(strtotime($row['timestamp'])); - $data[] = array($row['utctime'],$row[$this->subset]); - } - - return $data; - } - -} \ No newline at end of file diff --git a/application/module/Westdc/Visual/Record.php b/application/module/Westdc/Visual/Record.php deleted file mode 100644 index 0b390e30..00000000 --- a/application/module/Westdc/Visual/Record.php +++ /dev/null @@ -1,48 +0,0 @@ -initDatabase(); - } - - public function initDatabase() - { - $config = \Zend_Registry::get('config'); - - $dsn = "pgsql:host={$config->visual_db->hostname};" - ."port={$config->visual_db->port};" - ."dbname={$config->visual_db->database};" - ."user={$config->visual_db->username};" - ."password={$config->visual_db->password}"; - - $this->db = new \PDO($dsn); - } - - public function makeSql($table,$index,$fieldValue,$fieldTime) - { - $sql = "SELECT - \"$index\" as \"index\", \"$fieldValue\" as \"value\", \"$fieldTime\" as \"time\" - FROM \"$table\" - ORDER BY - extract(year from \"$fieldTime\") ASC, - extract(month from \"$fieldTime\") ASC, - extract(day from \"$fieldTime\") ASC, - "; - - $rs = $this->db->query($sql); - return $rs; - } - - public function utcMsTime($time=''){ - if(empty($time)) - return (time()+8*3600)*1000; - else - return $time*1000; - } -} \ No newline at end of file diff --git a/application/module/Westdc/Visual/RecordInterface.php b/application/module/Westdc/Visual/RecordInterface.php deleted file mode 100644 index d2351c3a..00000000 --- a/application/module/Westdc/Visual/RecordInterface.php +++ /dev/null @@ -1,8 +0,0 @@ -db = \Zend_Registry::get('db'); - $Listener = new Listener(); - @$this->getEventManager()->attachAggregate($Listener); - - } - - public function getEventManager(\Zend_EventManager_EventCollection $events = NULL) - { - if ($events !== NULL) { - $this->events = $events; - } elseif ($this->events === NULL) { - $this->events = new \Zend_EventManager_EventManager(__CLASS__); - } - return $this->events; - } - - //添加 - public function add($data,$id = 0) - { - $params = compact('data'); - $results = $this->getEventManager()->trigger('submit.checkParam', $this, $params); - $cache_data = $results->last(); - - if($cache_data !== true) - { - return $cache_data; - } - - $results = $this->getEventManager()->trigger('submit.processData', $this, $params); - $data = $results->last(); - - $dbh = new dbh(); - - if(empty($id)) - { - $id = $dbh->insert($this->mainTable,$data,true); - - if(!empty($id) && is_numeric($id)) - { - $this->getEventManager()->trigger('submit.recordPosted', $this, $params); - return true; - }else{ - if($id === false) - { - return '服务器开小差了,请稍后再试'; - }else{ - return '服务器处理中遇到错误,请联系管理员'; - } - } - }//add - - else{ - if(!$dbh->update($this->mainTable,$data," id=$id ",true)) - { - $this->getEventManager()->trigger('submit.recordChanged', $this, $params); - return "修改失败!请重试"; - }else{ - return true; - } - }//edit - - }// add() - - //删除 - public function del($id) - { - if(!is_numeric($id) || empty($id) || $id< 0) - { - return false; - } - - $sql = "DELETE FROM {$this->mainTable} WHERE id=$id"; - return $this->db->exec($sql); - } -} \ No newline at end of file diff --git a/htdocs/js/lib/highstock/adapters/standalone-framework.js b/htdocs/js/lib/highstock/adapters/standalone-framework.js deleted file mode 100644 index 8545f8a8..00000000 --- a/htdocs/js/lib/highstock/adapters/standalone-framework.js +++ /dev/null @@ -1,18 +0,0 @@ -/* - Highstock JS v2.0.1 (2014-04-24) - - Standalone Highcharts Framework - - License: MIT License -*/ -var HighchartsAdapter=function(){function o(c){function b(b,a,d){b.removeEventListener(a,d,!1)}function d(b,a,d){d=b.HCProxiedMethods[d.toString()];b.detachEvent("on"+a,d)}function a(a,c){var f=a.HCEvents,i,g,k,j;if(a.removeEventListener)i=b;else if(a.attachEvent)i=d;else return;c?(g={},g[c]=!0):g=f;for(j in g)if(f[j])for(k=f[j].length;k--;)i(a,j,f[j][k])}c.HCExtended||Highcharts.extend(c,{HCExtended:!0,HCEvents:{},bind:function(b,a){var d=this,c=this.HCEvents,g;if(d.addEventListener)d.addEventListener(b, -a,!1);else if(d.attachEvent){g=function(b){b.target=b.srcElement||window;a.call(d,b)};if(!d.HCProxiedMethods)d.HCProxiedMethods={};d.HCProxiedMethods[a.toString()]=g;d.attachEvent("on"+b,g)}c[b]===r&&(c[b]=[]);c[b].push(a)},unbind:function(c,h){var f,i;c?(f=this.HCEvents[c]||[],h?(i=HighchartsAdapter.inArray(h,f),i>-1&&(f.splice(i,1),this.HCEvents[c]=f),this.removeEventListener?b(this,c,h):this.attachEvent&&d(this,c,h)):(a(this,c),this.HCEvents[c]=[])):(a(this),this.HCEvents={})},trigger:function(b, -a){var d=this.HCEvents[b]||[],c=d.length,g,k,j;k=function(){a.defaultPrevented=!0};for(g=0;g=a.duration+this.startTime){this.now=this.end; -this.pos=this.state=1;this.update();b=this.options.curAnim[this.prop]=!0;for(h in a.curAnim)a.curAnim[h]!==!0&&(b=!1);b&&a.complete&&a.complete.call(e);a=!1}else e=c-this.startTime,this.state=e/a.duration,this.pos=a.easing(e,0,1,a.duration),this.now=this.start+(this.end-this.start)*this.pos,this.update(),a=!0;return a}};this.animate=function(b,d,a){var e,h="",f,i,g;b.stopAnimation=!1;if(typeof a!=="object"||a===null)e=arguments,a={duration:e[2],easing:e[3],complete:e[4]};if(typeof a.duration!=="number")a.duration= -400;a.easing=Math[a.easing]||Math.easeInOutSine;a.curAnim=Highcharts.extend({},d);for(g in d)i=new n(b,a,g),f=null,g==="d"?(i.paths=c.init(b,b.d,d.d),i.toD=d.d,e=0,f=1):b.attr?e=b.attr(g):(e=parseFloat(HighchartsAdapter._getStyle(b,g))||0,g!=="opacity"&&(h="px")),f||(f=parseFloat(d[g])),i.custom(e,f,h)}},_getStyle:function(c,b){return window.getComputedStyle(c,void 0).getPropertyValue(b)},getScript:function(c,b){var d=l.getElementsByTagName("head")[0],a=l.createElement("script");a.type="text/javascript"; -a.src=c;a.onload=b;d.appendChild(a)},inArray:function(c,b){return b.indexOf?b.indexOf(c):p.indexOf.call(b,c)},adapterRun:function(c,b){return parseInt(HighchartsAdapter._getStyle(c,b),10)},grep:function(c,b){return p.filter.call(c,b)},map:function(c,b){for(var d=[],a=0,e=c.length;af&&c-f>m/2+1.0E-4?(j=j.concat(z(e,a,b,d,f,f+m/2,h,i)),j=j.concat(z(e,a,b,d,f+m/2,c,h,i))):cm/2+1.0E-4?(j=j.concat(z(e,a,b, -d,f,f-m/2,h,i)),j=j.concat(z(e,a,b,d,f-m/2,c,h,i))):(j=c-f,["C",e+b*l(f)-b*D*j*k(f)+h,a+d*k(f)+d*D*j*l(f)+i,e+b*l(c)+b*D*j*k(c)+h,a+d*k(c)-d*D*j*l(c)+i,e+b*l(c)+h,a+d*k(c)+i])}function F(e){if(this.chart.is3d()){var a=this.chart.options.plotOptions.column.grouping;a!==void 0&&!a&&this.group.zIndex!==void 0&&this.group.attr({zIndex:this.group.zIndex*10});if(this.userOptions.borderColor===void 0)this.options.borderColor=this.color;c.each(this.data,function(a){var d=a.options.borderColor||a.color||a.series.userOptions.borderColor; -a.options.borderColor=d;a.borderColor=d;a.pointAttr[""].stroke=d;a.pointAttr.hover.stroke=d;a.pointAttr.select.stroke=d})}e.apply(this,[].slice.call(arguments,1))}var m=Math.PI,n=m/180,k=Math.sin,l=Math.cos,C=Math.round,D=4*(Math.sqrt(2)-1)/3/(m/2);c.SVGRenderer.prototype.toLinePath=function(e,a){var b=[];c.each(e,function(a){b.push("L",a.x,a.y)});b[0]="M";a&&b.push("Z");return b};c.SVGRenderer.prototype.cuboid=function(e){var a=this.g(),e=this.cuboidPath(e);a.front=this.path(e[0]).attr({zIndex:e[3], -"stroke-linejoin":"round"}).add(a);a.top=this.path(e[1]).attr({zIndex:e[4],"stroke-linejoin":"round"}).add(a);a.side=this.path(e[2]).attr({zIndex:e[5],"stroke-linejoin":"round"}).add(a);a.fillSetter=function(a){var d=c.Color(a).brighten(0.1).get(),e=c.Color(a).brighten(-0.1).get();this.front.attr({fill:a});this.top.attr({fill:d});this.side.attr({fill:e});this.color=a;return this};a.opacitySetter=function(a){this.front.attr({opacity:a});this.top.attr({opacity:a});this.side.attr({opacity:a});return this}; -a.attr=function(a){a.shapeArgs||a.x?(a=this.renderer.cuboidPath(a.shapeArgs||a),this.front.attr({d:a[0],zIndex:a[3]}),this.top.attr({d:a[1],zIndex:a[4]}),this.side.attr({d:a[2],zIndex:a[5]})):c.SVGElement.prototype.attr.call(this,a);return this};a.animate=function(a,d,e){a.x&&a.y?(a=this.renderer.cuboidPath(a),this.front.attr({zIndex:a[3]}).animate({d:a[0]},d,e),this.top.attr({zIndex:a[4]}).animate({d:a[1]},d,e),this.side.attr({zIndex:a[5]}).animate({d:a[2]},d,e)):a.opacity?(this.front.animate(a, -d,e),this.top.animate(a,d,e),this.side.animate(a,d,e)):c.SVGElement.prototype.animate.call(this,a,d,e);return this};a.destroy=function(){this.front.destroy();this.top.destroy();this.side.destroy();return null};a.attr({zIndex:-e[3]});return a};c.SVGRenderer.prototype.cuboidPath=function(e){var a=e.x,b=e.y,d=e.z,c=e.height,g=e.width,h=e.depth,i=e.alpha,j=e.beta,a=[{x:a,y:b,z:d},{x:a+g,y:b,z:d},{x:a+g,y:b+c,z:d},{x:a,y:b+c,z:d},{x:a,y:b+c,z:d+h},{x:a+g,y:b+c,z:d+h},{x:a+g,y:b,z:d+h},{x:a,y:b,z:d+h}], -a=x(a,i,j,e.origin),e=["M",a[0].x,a[0].y,"L",a[7].x,a[7].y,"L",a[6].x,a[6].y,"L",a[1].x,a[1].y,"Z"],b=["M",a[3].x,a[3].y,"L",a[2].x,a[2].y,"L",a[5].x,a[5].y,"L",a[4].x,a[4].y,"Z"],d=["M",a[1].x,a[1].y,"L",a[2].x,a[2].y,"L",a[5].x,a[5].y,"L",a[6].x,a[6].y,"Z"],c=["M",a[0].x,a[0].y,"L",a[7].x,a[7].y,"L",a[4].x,a[4].y,"L",a[3].x,a[3].y,"Z"];return[["M",a[0].x,a[0].y,"L",a[1].x,a[1].y,"L",a[2].x,a[2].y,"L",a[3].x,a[3].y,"Z"],a[7].ya[2].y?b:[],a[6].x>a[1].x?d:a[7].x0?(a[0].z+a[7].z+a[6].z+a[1].z)/4:(a[3].z+a[2].z+a[5].z+a[4].z)/4,i>0?(a[1].z+a[2].z+a[5].z+a[6].z)/4:(a[0].z+a[7].z+a[4].z+a[3].z)/4]};c.SVGRenderer.prototype.arc3d=function(e){e.alpha*=n;e.beta*=n;var a=this.g(),b=this.arc3dPath(e),d=a.renderer,f=b.zAll*100;a.shapeArgs=e;a.side1=d.path(b.side2).attr({zIndex:b.zSide2}).add(a);a.side2=d.path(b.side1).attr({zIndex:b.zSide1}).add(a);a.inn=d.path(b.inn).attr({zIndex:b.zInn}).add(a);a.out=d.path(b.out).attr({zIndex:b.zOut}).add(a); -a.top=d.path(b.top).attr({zIndex:b.zTop}).add(a);a.fillSetter=function(a){this.color=a;var b=c.Color(a).brighten(-0.1).get();this.side1.attr({fill:b});this.side2.attr({fill:b});this.inn.attr({fill:b});this.out.attr({fill:b});this.top.attr({fill:a});return this};a.animate=function(a,b,d){c.SVGElement.prototype.animate.call(this,a,b,d);if(a.x&&a.y)b=this.renderer,a=c.splat(a)[0],a.alpha*=n,a.beta*=n,b=b.arc3dPath(a),this.shapeArgs=a,this.inn.attr({d:b.inn,zIndex:b.zInn}),this.out.attr({d:b.out,zIndex:b.zOut}), -this.side1.attr({d:b.side1,zIndex:b.zSide2}),this.side2.attr({d:b.side2,zIndex:b.zSide1}),this.top.attr({d:b.top,zIndex:b.zTop}),this.attr({fill:this.color}),this.attr({zIndex:b.zAll*100});return this};a.zIndex=f;a.attr({zIndex:f});return a};c.SVGRenderer.prototype.arc3dPath=function(e){var a=e.x,b=e.y,d=e.start,c=e.end-1.0E-5,g=e.r,h=e.innerR,i=e.depth,j=e.alpha,o=e.beta,t=l(d),y=k(d),v=l(c),n=k(c),q=g*l(o),r=g*l(j),u=h*l(o),s=h*l(j),A=i*k(o),B=i*k(j),i=["M",a+q*t,b+r*y],i=i.concat(z(a,b,q,r,d,c, -0,0)),i=i.concat(["L",a+u*v,b+s*n]),i=i.concat(z(a,b,u,s,c,d,0,0)),i=i.concat(["Z"]),e=(e.start+e.end)/2,e=k(o)*l(e)+k(-j)*k(-e),p=o>0?m/2:0,w=j>0?0:m/2,p=d>-p?d:c>-p?-p:d,x=c0?4:-1}).css({stroke:i.color}).add(); -else{var q={x:m,y:n,z:o+1,width:l,height:k+i.size,depth:j.size,alpha:f,beta:g,origin:d};this.backFrame?this.backFrame.animate(q):this.backFrame=b.cuboid(q).attr({fill:j.color,zIndex:-3}).css({stroke:j.color}).add();this.axisLine&&this.axisLine.hide();a={x:(a.yAxis[0].opposite?l:0)+m-h.size,y:n,z:0,width:h.size,height:k+i.size,depth:o+j.size,alpha:f,beta:g,origin:d};this.sideFrame?this.sideFrame.animate(a):this.sideFrame=b.cuboid(a).attr({fill:h.color,zIndex:-2}).css({stroke:h.color}).add()}}});c.wrap(c.Axis.prototype, -"getPlotLinePath",function(c){var a=c.apply(this,[].slice.call(arguments,1));if(!this.chart.is3d())return a;if(a===null)return a;var b=this.chart,d=b.options.chart.options3d,f=d.depth;d.origin={x:b.plotLeft+b.plotWidth/2,y:b.plotTop+b.plotHeight/2,z:f,vd:d.viewDistance};var a=[{x:a[1],y:a[2],z:this.horiz||this.opposite?f:0},{x:a[1],y:a[2],z:f},{x:a[4],y:a[5],z:f},{x:a[4],y:a[5],z:this.horiz||this.opposite?0:f}],f=b.options.inverted?d.beta:d.alpha,g=b.options.inverted?d.alpha:d.beta;g*=b.yAxis[0].opposite? --1:1;a=x(a,f,g,d.origin);return a=this.chart.renderer.toLinePath(a,!1)});c.wrap(c.Tick.prototype,"getMarkPath",function(c){var a=c.apply(this,[].slice.call(arguments,1));if(!this.axis.chart.is3d())return a;var b=this.axis.chart,d=b.options.chart.options3d,f={x:b.plotLeft+b.plotWidth/2,y:b.plotTop+b.plotHeight/2,z:d.depth,vd:d.viewDistance},a=[{x:a[1],y:a[2],z:0},{x:a[4],y:a[5],z:0}],g=b.inverted?d.beta:d.alpha,d=b.inverted?d.alpha:d.beta;d*=b.yAxis[0].opposite?-1:1;a=x(a,g,d,f);return a=["M",a[0].x, -a[0].y,"L",a[1].x,a[1].y]});c.wrap(c.Tick.prototype,"getLabelPosition",function(c){var a=c.apply(this,[].slice.call(arguments,1));if(!this.axis.chart.is3d())return a;var b=this.axis.chart,d=b.options.chart.options3d,f={x:b.plotLeft+b.plotWidth/2,y:b.plotTop+b.plotHeight/2,z:d.depth,vd:d.viewDistance},g=b.inverted?d.beta:d.alpha,d=b.inverted?d.alpha:d.beta;d*=b.yAxis[0].opposite?-1:1;return a=x([{x:a.x,y:a.y,z:0}],g,d,f)[0]});c.wrap(c.Axis.prototype,"drawCrosshair",function(c){var a=arguments;this.chart.is3d()&& -a[2]&&(a[2]={plotX:a[2].plotXold||a[2].plotX,plotY:a[2].plotYold||a[2].plotY});c.apply(this,[].slice.call(a,1))});c.wrap(c.seriesTypes.column.prototype,"translate",function(e){e.apply(this,[].slice.call(arguments,1));if(this.chart.is3d()){var a=this.chart,b=a.options,d=b.plotOptions[this.chart.options.chart.type],b=b.chart.options3d,f=d.depth||25,g={x:a.plotWidth/2,y:a.plotHeight/2,z:b.depth,vd:b.viewDistance},h=b.alpha,i=b.beta*(a.yAxis[0].opposite?-1:1),j=(d.stacking?this.options.stack||0:this._i)* -(f+(d.groupZPadding||1));d.grouping!==!1&&(j=0);j+=d.groupZPadding||1;c.each(this.data,function(a){var b=a.shapeArgs,c=a.tooltipPos;a.shapeType="cuboid";b.alpha=h;b.beta=i;b.z=j;b.origin=g;b.depth=f;c=x([{x:c[0],y:c[1],z:j}],h,i,g)[0];a.tooltipPos=[c.x,c.y]})}});c.wrap(c.seriesTypes.column.prototype,"animate",function(e){if(this.chart.is3d()){var a=arguments[1],b=this.yAxis,d=this,f=this.yAxis.reversed;if(c.svg)a?c.each(d.data,function(a){a.height=a.shapeArgs.height;a.shapeArgs.height=1;if(!f)a.shapeArgs.y= -a.stackY?a.plotY+b.translate(a.stackY):a.plotY+(a.negative?-a.height:a.height)}):(c.each(d.data,function(a){a.shapeArgs.height=a.height;if(!f)a.shapeArgs.y=a.plotY-(a.negative?a.height:0);a.graphic&&a.graphic.animate(a.shapeArgs,d.options.animation)}),d.animate=null)}else e.apply(this,[].slice.call(arguments,1))});c.wrap(c.seriesTypes.column.prototype,"init",function(c){c.apply(this,[].slice.call(arguments,1));if(this.chart.is3d()){var a=this.chart.options.plotOptions.column.grouping,b=this.chart.options.plotOptions.column.stacking, -d=this.options.zIndex;if(!d&&(a===void 0||a)&&b){a=this.chart.retrieveStacks();b=this.options.stack||0;for(d=0;d0?k(h)*e:0),-c*(1-l(g))*k(b)+(k(b)>0?k(g)*e:0));a.dataLabel&&a.dataLabel.attr({x:a.dataLabel.connX+-c*(1-l(h))*l(b)+(l(b)>0?l(h)*e:0)-a.dataLabel.width/2,y:a.dataLabel.connY+-c*(1-l(g))*k(b)+(k(b)>0?k(g)*e:0)-a.dataLabel.height/2})})});c.wrap(c.seriesTypes.pie.prototype,"addPoint",function(c){c.apply(this,[].slice.call(arguments,1));this.chart.is3d()&&this.update()});c.wrap(c.seriesTypes.pie.prototype,"animate",function(e){if(this.chart.is3d()){var a=arguments[1],b=this.options.animation,d= -this.center,f=this.group,g=this.markerGroup;if(c.svg)if(b===!0&&(b={}),a){if(this.oldtranslateX=f.translateX,this.oldtranslateY=f.translateY,a={translateX:d[0],translateY:d[1],scaleX:0.001,scaleY:0.001},f.attr(a),g)g.attrSetters=f.attrSetters,g.attr(a)}else a={translateX:this.oldtranslateX,translateY:this.oldtranslateY,scaleX:1,scaleY:1},f.animate(a,b),g&&g.animate(a,b),this.animate=null}else e.apply(this,[].slice.call(arguments,1))});c.wrap(c.seriesTypes.scatter.prototype,"translate",function(e){e.apply(this, -[].slice.call(arguments,1));if(this.chart.is3d()){var a=this.chart,b=this.chart.options.chart.options3d,d=b.alpha,f=b.beta,g={x:a.inverted?a.plotHeight/2:a.plotWidth/2,y:a.inverted?a.plotWidth/2:a.plotHeight/2,z:b.depth,vd:b.viewDistance},b=b.depth,h=a.options.zAxis||{min:0,max:b},i=b/(h.max-h.min);c.each(this.data,function(a){var b={x:a.plotX,y:a.plotY,z:(a.z-h.min)*i},b=x([b],d,f,g)[0];a.plotXold=a.plotX;a.plotYold=a.plotY;a.plotX=b.x;a.plotY=b.y;a.plotZ=b.z})}});c.wrap(c.seriesTypes.scatter.prototype, -"init",function(c){var a=c.apply(this,[].slice.call(arguments,1));if(this.chart.is3d())this.pointArrayMap=["x","y","z"],this.tooltipOptions.pointFormat=this.userOptions.tooltip?this.userOptions.tooltip.pointFormat||"x: {point.x}
    y: {point.y}
    z: {point.z}
    ":"x: {point.x}
    y: {point.y}
    z: {point.z}
    ";return a});if(c.VMLRenderer)c.setOptions({animate:!1}),c.VMLRenderer.prototype.cuboid=c.SVGRenderer.prototype.cuboid,c.VMLRenderer.prototype.cuboidPath= -c.SVGRenderer.prototype.cuboidPath,c.VMLRenderer.prototype.toLinePath=c.SVGRenderer.prototype.toLinePath,c.VMLRenderer.prototype.createElement3D=c.SVGRenderer.prototype.createElement3D,c.VMLRenderer.prototype.arc3d=function(e){e=c.SVGRenderer.prototype.arc3d.call(this,e);e.css({zIndex:e.zIndex});return e},c.VMLRenderer.prototype.arc3dPath=c.SVGRenderer.prototype.arc3dPath,c.Chart.prototype.renderSeries=function(){for(var c,a=this.series.length;a--;)c=this.series[a],c.translate(),c.setTooltipPoints&& -c.setTooltipPoints(),c.render()},c.wrap(c.Axis.prototype,"render",function(c){c.apply(this,[].slice.call(arguments,1));this.sideFrame&&(this.sideFrame.css({zIndex:0}),this.sideFrame.front.attr({fill:this.sideFrame.color}));this.bottomFrame&&(this.bottomFrame.css({zIndex:1}),this.bottomFrame.front.attr({fill:this.bottomFrame.color}));this.backFrame&&(this.backFrame.css({zIndex:0}),this.backFrame.front.attr({fill:this.backFrame.color}))})})(Highcharts); diff --git a/htdocs/js/lib/highstock/highcharts-more.js b/htdocs/js/lib/highstock/highcharts-more.js deleted file mode 100644 index 3cc51350..00000000 --- a/htdocs/js/lib/highstock/highcharts-more.js +++ /dev/null @@ -1,51 +0,0 @@ -/* - Highcharts JS v4.0.1 (2014-04-24) - - (c) 2009-2014 Torstein Honsi - - License: www.highcharts.com/license -*/ -(function(m,C){function K(a,b,c){this.init.call(this,a,b,c)}var O=m.arrayMin,P=m.arrayMax,s=m.each,F=m.extend,o=m.merge,Q=m.map,q=m.pick,x=m.pInt,p=m.getOptions().plotOptions,h=m.seriesTypes,u=m.extendClass,L=m.splat,r=m.wrap,M=m.Axis,y=m.Tick,H=m.Point,R=m.Pointer,S=m.CenteredSeriesMixin,z=m.TrackerMixin,t=m.Series,v=Math,D=v.round,A=v.floor,T=v.max,U=m.Color,w=function(){};F(K.prototype,{init:function(a,b,c){var d=this,e=d.defaultOptions;d.chart=b;if(b.angular)e.background={};d.options=a=o(e,a); -(a=a.background)&&s([].concat(L(a)).reverse(),function(a){var g=a.backgroundColor,a=o(d.defaultBackgroundOptions,a);if(g)a.backgroundColor=g;a.color=a.backgroundColor;c.options.plotBands.unshift(a)})},defaultOptions:{center:["50%","50%"],size:"85%",startAngle:0},defaultBackgroundOptions:{shape:"circle",borderWidth:1,borderColor:"silver",backgroundColor:{linearGradient:{x1:0,y1:0,x2:0,y2:1},stops:[[0,"#FFF"],[1,"#DDD"]]},from:Number.MIN_VALUE,innerRadius:0,to:Number.MAX_VALUE,outerRadius:"105%"}}); -var G=M.prototype,y=y.prototype,V={getOffset:w,redraw:function(){this.isDirty=!1},render:function(){this.isDirty=!1},setScale:w,setCategories:w,setTitle:w},N={isRadial:!0,defaultRadialGaugeOptions:{labels:{align:"center",x:0,y:null},minorGridLineWidth:0,minorTickInterval:"auto",minorTickLength:10,minorTickPosition:"inside",minorTickWidth:1,tickLength:10,tickPosition:"inside",tickWidth:2,title:{rotation:0},zIndex:2},defaultRadialXOptions:{gridLineWidth:1,labels:{align:null,distance:15,x:0,y:null}, -maxPadding:0,minPadding:0,showLastLabel:!1,tickLength:0},defaultRadialYOptions:{gridLineInterpolation:"circle",labels:{align:"right",x:-3,y:-2},showLastLabel:!1,title:{x:4,text:null,rotation:90}},setOptions:function(a){a=this.options=o(this.defaultOptions,this.defaultRadialOptions,a);if(!a.plotBands)a.plotBands=[]},getOffset:function(){G.getOffset.call(this);this.chart.axisOffset[this.side]=0;this.center=this.pane.center=S.getCenter.call(this.pane)},getLinePath:function(a,b){var c=this.center,b=q(b, -c[2]/2-this.offset);return this.chart.renderer.symbols.arc(this.left+c[0],this.top+c[1],b,b,{start:this.startAngleRad,end:this.endAngleRad,open:!0,innerR:0})},setAxisTranslation:function(){G.setAxisTranslation.call(this);if(this.center)this.transA=this.isCircular?(this.endAngleRad-this.startAngleRad)/(this.max-this.min||1):this.center[2]/2/(this.max-this.min||1),this.minPixelPadding=this.isXAxis?this.transA*this.minPointOffset:0},beforeSetTickPositions:function(){this.autoConnect&&(this.max+=this.categories&& -1||this.pointRange||this.closestPointRange||0)},setAxisSize:function(){G.setAxisSize.call(this);if(this.isRadial){this.center=this.pane.center=m.CenteredSeriesMixin.getCenter.call(this.pane);if(this.isCircular)this.sector=this.endAngleRad-this.startAngleRad;this.len=this.width=this.height=this.center[2]*q(this.sector,1)/2}},getPosition:function(a,b){return this.postTranslate(this.isCircular?this.translate(a):0,q(this.isCircular?b:this.translate(a),this.center[2]/2)-this.offset)},postTranslate:function(a, -b){var c=this.chart,d=this.center,a=this.startAngleRad+a;return{x:c.plotLeft+d[0]+Math.cos(a)*b,y:c.plotTop+d[1]+Math.sin(a)*b}},getPlotBandPath:function(a,b,c){var d=this.center,e=this.startAngleRad,f=d[2]/2,g=[q(c.outerRadius,"100%"),c.innerRadius,q(c.thickness,10)],k=/%$/,l,n=this.isCircular;this.options.gridLineInterpolation==="polygon"?d=this.getPlotLinePath(a).concat(this.getPlotLinePath(b,!0)):(n||(g[0]=this.translate(a),g[1]=this.translate(b)),g=Q(g,function(a){k.test(a)&&(a=x(a,10)*f/100); -return a}),c.shape==="circle"||!n?(a=-Math.PI/2,b=Math.PI*1.5,l=!0):(a=e+this.translate(a),b=e+this.translate(b)),d=this.chart.renderer.symbols.arc(this.left+d[0],this.top+d[1],g[0],g[0],{start:a,end:b,innerR:q(g[1],g[0]-g[2]),open:l}));return d},getPlotLinePath:function(a,b){var c=this,d=c.center,e=c.chart,f=c.getPosition(a),g,k,l;c.isCircular?l=["M",d[0]+e.plotLeft,d[1]+e.plotTop,"L",f.x,f.y]:c.options.gridLineInterpolation==="circle"?(a=c.translate(a))&&(l=c.getLinePath(0,a)):(s(e.xAxis,function(a){a.pane=== -c.pane&&(g=a)}),l=[],a=c.translate(a),d=g.tickPositions,g.autoConnect&&(d=d.concat([d[0]])),b&&(d=[].concat(d).reverse()),s(d,function(f,c){k=g.getPosition(f,a);l.push(c?"L":"M",k.x,k.y)}));return l},getTitlePosition:function(){var a=this.center,b=this.chart,c=this.options.title;return{x:b.plotLeft+a[0]+(c.x||0),y:b.plotTop+a[1]-{high:0.5,middle:0.25,low:0}[c.align]*a[2]+(c.y||0)}}};r(G,"init",function(a,b,c){var i;var d=b.angular,e=b.polar,f=c.isX,g=d&&f,k,l;l=b.options;var n=c.pane||0;if(d){if(F(this, -g?V:N),k=!f)this.defaultRadialOptions=this.defaultRadialGaugeOptions}else if(e)F(this,N),this.defaultRadialOptions=(k=f)?this.defaultRadialXOptions:o(this.defaultYAxisOptions,this.defaultRadialYOptions);a.call(this,b,c);if(!g&&(d||e)){a=this.options;if(!b.panes)b.panes=[];this.pane=(i=b.panes[n]=b.panes[n]||new K(L(l.pane)[n],b,this),n=i);n=n.options;b.inverted=!1;l.chart.zoomType=null;this.startAngleRad=b=(n.startAngle-90)*Math.PI/180;this.endAngleRad=l=(q(n.endAngle,n.startAngle+360)-90)*Math.PI/ -180;this.offset=a.offset||0;if((this.isCircular=k)&&c.max===C&&l-b===2*Math.PI)this.autoConnect=!0}});r(y,"getPosition",function(a,b,c,d,e){var f=this.axis;return f.getPosition?f.getPosition(c):a.call(this,b,c,d,e)});r(y,"getLabelPosition",function(a,b,c,d,e,f,g,k,l){var n=this.axis,j=f.y,i=f.align,h=(n.translate(this.pos)+n.startAngleRad+Math.PI/2)/Math.PI*180%360;n.isRadial?(a=n.getPosition(this.pos,n.center[2]/2+q(f.distance,-25)),f.rotation==="auto"?d.attr({rotation:h}):j===null&&(j=n.chart.renderer.fontMetrics(d.styles.fontSize).b- -d.getBBox().height/2),i===null&&(i=n.isCircular?h>20&&h<160?"left":h>200&&h<340?"right":"center":"center",d.attr({align:i})),a.x+=f.x,a.y+=j):a=a.call(this,b,c,d,e,f,g,k,l);return a});r(y,"getMarkPath",function(a,b,c,d,e,f,g){var k=this.axis;k.isRadial?(a=k.getPosition(this.pos,k.center[2]/2+d),b=["M",b,c,"L",a.x,a.y]):b=a.call(this,b,c,d,e,f,g);return b});p.arearange=o(p.area,{lineWidth:1,marker:null,threshold:null,tooltip:{pointFormat:' {series.name}: {point.low} - {point.high}
    '}, -trackByArea:!0,dataLabels:{verticalAlign:null,xLow:0,xHigh:0,yLow:0,yHigh:0},states:{hover:{halo:!1}}});h.arearange=u(h.area,{type:"arearange",pointArrayMap:["low","high"],toYData:function(a){return[a.low,a.high]},pointValKey:"low",getSegments:function(){var a=this;s(a.points,function(b){if(!a.options.connectNulls&&(b.low===null||b.high===null))b.y=null;else if(b.low===null&&b.high!==null)b.y=b.high});t.prototype.getSegments.call(this)},translate:function(){var a=this.yAxis;h.area.prototype.translate.apply(this); -s(this.points,function(b){var c=b.low,d=b.high,e=b.plotY;d===null&&c===null?b.y=null:c===null?(b.plotLow=b.plotY=null,b.plotHigh=a.translate(d,0,1,0,1)):d===null?(b.plotLow=e,b.plotHigh=null):(b.plotLow=e,b.plotHigh=a.translate(d,0,1,0,1))})},getSegmentPath:function(a){var b,c=[],d=a.length,e=t.prototype.getSegmentPath,f,g;g=this.options;var k=g.step;for(b=HighchartsAdapter.grep(a,function(a){return a.plotLow!==null});d--;)f=a[d],f.plotHigh!==null&&c.push({plotX:f.plotX,plotY:f.plotHigh});a=e.call(this, -b);if(k)k===!0&&(k="left"),g.step={left:"right",center:"center",right:"left"}[k];c=e.call(this,c);g.step=k;g=[].concat(a,c);c[0]="L";this.areaPath=this.areaPath.concat(a,c);return g},drawDataLabels:function(){var a=this.data,b=a.length,c,d=[],e=t.prototype,f=this.options.dataLabels,g,k=this.chart.inverted;if(f.enabled||this._hasPointLabels){for(c=b;c--;)g=a[c],g.y=g.high,g._plotY=g.plotY,g.plotY=g.plotHigh,d[c]=g.dataLabel,g.dataLabel=g.dataLabelUpper,g.below=!1,k?(f.align="left",f.x=f.xHigh):f.y= -f.yHigh;e.drawDataLabels&&e.drawDataLabels.apply(this,arguments);for(c=b;c--;)g=a[c],g.dataLabelUpper=g.dataLabel,g.dataLabel=d[c],g.y=g.low,g.plotY=g._plotY,g.below=!0,k?(f.align="right",f.x=f.xLow):f.y=f.yLow;e.drawDataLabels&&e.drawDataLabels.apply(this,arguments)}},alignDataLabel:function(){h.column.prototype.alignDataLabel.apply(this,arguments)},getSymbol:h.column.prototype.getSymbol,drawPoints:w});p.areasplinerange=o(p.arearange);h.areasplinerange=u(h.arearange,{type:"areasplinerange",getPointSpline:h.spline.prototype.getPointSpline}); -(function(){var a=h.column.prototype;p.columnrange=o(p.column,p.arearange,{lineWidth:1,pointRange:null});h.columnrange=u(h.arearange,{type:"columnrange",translate:function(){var b=this,c=b.yAxis,d;a.translate.apply(b);s(b.points,function(a){var f=a.shapeArgs,g=b.options.minPointLength,k;a.tooltipPos=null;a.plotHigh=d=c.translate(a.high,0,1,0,1);a.plotLow=a.plotY;k=d;a=a.plotY-d;a {series.name}
    Maximum: {point.high}
    Upper quartile: {point.q3}
    Median: {point.median}
    Lower quartile: {point.q1}
    Minimum: {point.low}
    '}, -whiskerLength:"50%",whiskerWidth:2});h.boxplot=u(h.column,{type:"boxplot",pointArrayMap:["low","q1","median","q3","high"],toYData:function(a){return[a.low,a.q1,a.median,a.q3,a.high]},pointValKey:"high",pointAttrToOptions:{fill:"fillColor",stroke:"color","stroke-width":"lineWidth"},drawDataLabels:w,translate:function(){var a=this.yAxis,b=this.pointArrayMap;h.column.prototype.translate.apply(this);s(this.points,function(c){s(b,function(b){c[b]!==null&&(c[b+"Plot"]=a.translate(c[b],0,1,0,1))})})},drawPoints:function(){var a= -this,b=a.points,c=a.options,d=a.chart.renderer,e,f,g,k,l,n,j,i,h,m,p,I,r,o,J,u,w,t,v,x,z,y,E=a.doQuartiles!==!1,B=parseInt(a.options.whiskerLength,10)/100;s(b,function(b){h=b.graphic;z=b.shapeArgs;p={};o={};u={};y=b.color||a.color;if(b.plotY!==C)if(e=b.pointAttr[b.selected?"selected":""],w=z.width,t=A(z.x),v=t+w,x=D(w/2),f=A(E?b.q1Plot:b.lowPlot),g=A(E?b.q3Plot:b.lowPlot),k=A(b.highPlot),l=A(b.lowPlot),p.stroke=b.stemColor||c.stemColor||y,p["stroke-width"]=q(b.stemWidth,c.stemWidth,c.lineWidth),p.dashstyle= -b.stemDashStyle||c.stemDashStyle,o.stroke=b.whiskerColor||c.whiskerColor||y,o["stroke-width"]=q(b.whiskerWidth,c.whiskerWidth,c.lineWidth),u.stroke=b.medianColor||c.medianColor||y,u["stroke-width"]=q(b.medianWidth,c.medianWidth,c.lineWidth),u["stroke-linecap"]="round",j=p["stroke-width"]%2/2,i=t+x+j,m=["M",i,g,"L",i,k,"M",i,f,"L",i,l],E&&(j=e["stroke-width"]%2/2,i=A(i)+j,f=A(f)+j,g=A(g)+j,t+=j,v+=j,I=["M",t,g,"L",t,f,"L",v,f,"L",v,g,"L",t,g,"z"]),B&&(j=o["stroke-width"]%2/2,k+=j,l+=j,r=["M",i-x*B, -k,"L",i+x*B,k,"M",i-x*B,l,"L",i+x*B,l]),j=u["stroke-width"]%2/2,n=D(b.medianPlot)+j,J=["M",t,n,"L",v,n],h)b.stem.animate({d:m}),B&&b.whiskers.animate({d:r}),E&&b.box.animate({d:I}),b.medianShape.animate({d:J});else{b.graphic=h=d.g().add(a.group);b.stem=d.path(m).attr(p).add(h);if(B)b.whiskers=d.path(r).attr(o).add(h);if(E)b.box=d.path(I).attr(e).add(h);b.medianShape=d.path(J).attr(u).add(h)}})}});p.errorbar=o(p.boxplot,{color:"#000000",grouping:!1,linkedTo:":previous",tooltip:{pointFormat:' {series.name}: {point.low} - {point.high}
    '}, -whiskerWidth:null});h.errorbar=u(h.boxplot,{type:"errorbar",pointArrayMap:["low","high"],toYData:function(a){return[a.low,a.high]},pointValKey:"high",doQuartiles:!1,drawDataLabels:h.arearange?h.arearange.prototype.drawDataLabels:w,getColumnMetrics:function(){return this.linkedParent&&this.linkedParent.columnMetrics||h.column.prototype.getColumnMetrics.call(this)}});p.waterfall=o(p.column,{lineWidth:1,lineColor:"#333",dashStyle:"dot",borderColor:"#333"});h.waterfall=u(h.column,{type:"waterfall",upColorProp:"fill", -pointArrayMap:["low","y"],pointValKey:"y",init:function(a,b){b.stacking=!0;h.column.prototype.init.call(this,a,b)},translate:function(){var a=this.yAxis,b,c,d,e,f,g,k,l,n;b=this.options.threshold;h.column.prototype.translate.apply(this);l=b;d=this.points;for(c=0,b=d.length;c0&&!a.color)a.pointAttr=d,a.color=c})},getGraphPath:function(){var a=this.data,b=a.length, -c=D(this.options.lineWidth+this.borderWidth)%2/2,d=[],e,f,g;for(g=1;g0?(k[f]-a)/(b- -a):0.5,n&&g>=0&&(g=Math.sqrt(g)),l.push(v.ceil(c+g*(d-c))/2);this.radii=l},animate:function(a){var b=this.options.animation;if(!a)s(this.points,function(a){var d=a.graphic,a=a.shapeArgs;d&&a&&(d.attr("r",1),d.animate({r:a.r},b))}),this.animate=null},translate:function(){var a,b=this.data,c,d,e=this.radii;h.scatter.prototype.translate.call(this);for(a=b.length;a--;)c=b[a],d=e?e[a]:0,c.negative=c.z<(this.options.zThreshold||0),d>=this.minPxSize/2?(c.shapeType="circle",c.shapeArgs={x:c.plotX,y:c.plotY, -r:d},c.dlBox={x:c.plotX-d,y:c.plotY-d,width:2*d,height:2*d}):c.shapeArgs=c.plotY=c.dlBox=C},drawLegendSymbol:function(a,b){var c=x(a.itemStyle.fontSize)/2;b.legendSymbol=this.chart.renderer.circle(c,a.baseline-c,c).attr({zIndex:3}).add(b.legendGroup);b.legendSymbol.isMarker=!0},drawPoints:h.column.prototype.drawPoints,alignDataLabel:h.column.prototype.alignDataLabel});M.prototype.beforePadding=function(){var a=this,b=this.len,c=this.chart,d=0,e=b,f=this.isXAxis,g=f?"xData":"yData",k=this.min,l={}, -n=v.min(c.plotWidth,c.plotHeight),j=Number.MAX_VALUE,i=-Number.MAX_VALUE,h=this.max-k,m=b/h,p=[];this.tickPositions&&(s(this.series,function(b){var g=b.options;if(b.bubblePadding&&(b.visible||!c.options.chart.ignoreHiddenSeries))if(a.allowZoomOutside=!0,p.push(b),f)s(["minSize","maxSize"],function(a){var b=g[a],f=/%$/.test(b),b=x(b);l[a]=f?n*b/100:b}),b.minPxSize=l.minSize,b=b.zData,b.length&&(j=v.min(j,v.max(O(b),g.displayNegative===!1?g.zThreshold:-Number.MAX_VALUE)),i=v.max(i,P(b)))}),s(p,function(a){var b= -a[g],c=b.length,n;f&&a.getRadii(j,i,l.minSize,l.maxSize);if(h>0)for(;c--;)typeof b[c]==="number"&&(n=a.radii[c],d=Math.min((b[c]-k)*m-n,d),e=Math.max((b[c]-k)*m+n,e))}),p.length&&h>0&&q(this.options.min,this.userMin)===C&&q(this.options.max,this.userMax)===C&&(e-=b,m*=(b+d-e)/b,this.min+=d/m,this.max+=e/m))};(function(){function a(a,b,c){a.call(this,b,c);if(this.chart.polar)this.closeSegment=function(a){var b=this.xAxis.center;a.push("L",b[0],b[1])},this.closedStacks=!0}function b(a,b){var c=this.chart, -d=this.options.animation,e=this.group,j=this.markerGroup,i=this.xAxis.center,h=c.plotLeft,m=c.plotTop;if(c.polar){if(c.renderer.isSVG)d===!0&&(d={}),b?(c={translateX:i[0]+h,translateY:i[1]+m,scaleX:0.001,scaleY:0.001},e.attr(c),j&&j.attr(c)):(c={translateX:h,translateY:m,scaleX:1,scaleY:1},e.animate(c,d),j&&j.animate(c,d),this.animate=null)}else a.call(this,b)}var c=t.prototype,d=R.prototype,e;c.toXY=function(a){var b,c=this.chart,d=a.plotX;b=a.plotY;a.rectPlotX=d;a.rectPlotY=b;d=(d/Math.PI*180+this.xAxis.pane.options.startAngle)% -360;d<0&&(d+=360);a.clientX=d;b=this.xAxis.postTranslate(a.plotX,this.yAxis.len-b);a.plotX=a.polarPlotX=b.x-c.plotLeft;a.plotY=a.polarPlotY=b.y-c.plotTop};c.orderTooltipPoints=function(a){if(this.chart.polar&&(a.sort(function(a,b){return a.clientX-b.clientX}),a[0]))a[0].wrappedClientX=a[0].clientX+360,a.push(a[0])};h.area&&r(h.area.prototype,"init",a);h.areaspline&&r(h.areaspline.prototype,"init",a);h.spline&&r(h.spline.prototype,"getPointSpline",function(a,b,c,d){var e,j,i,h,m,p,o;if(this.chart.polar){e= -c.plotX;j=c.plotY;a=b[d-1];i=b[d+1];this.connectEnds&&(a||(a=b[b.length-2]),i||(i=b[1]));if(a&&i)h=a.plotX,m=a.plotY,b=i.plotX,p=i.plotY,h=(1.5*e+h)/2.5,m=(1.5*j+m)/2.5,i=(1.5*e+b)/2.5,o=(1.5*j+p)/2.5,b=Math.sqrt(Math.pow(h-e,2)+Math.pow(m-j,2)),p=Math.sqrt(Math.pow(i-e,2)+Math.pow(o-j,2)),h=Math.atan2(m-j,h-e),m=Math.atan2(o-j,i-e),o=Math.PI/2+(h+m)/2,Math.abs(h-o)>Math.PI/2&&(o-=Math.PI),h=e+Math.cos(o)*b,m=j+Math.sin(o)*b,i=e+Math.cos(Math.PI+o)*p,o=j+Math.sin(Math.PI+o)*p,c.rightContX=i,c.rightContY= -o;d?(c=["C",a.rightContX||a.plotX,a.rightContY||a.plotY,h||e,m||j,e,j],a.rightContX=a.rightContY=null):c=["M",e,j]}else c=a.call(this,b,c,d);return c});r(c,"translate",function(a){a.call(this);if(this.chart.polar&&!this.preventPostTranslate)for(var a=this.points,b=a.length;b--;)this.toXY(a[b])});r(c,"getSegmentPath",function(a,b){var c=this.points;if(this.chart.polar&&this.options.connectEnds!==!1&&b[b.length-1]===c[c.length-1]&&c[0].y!==null)this.connectEnds=!0,b=[].concat(b,[c[0]]);return a.call(this, -b)});r(c,"animate",b);r(c,"setTooltipPoints",function(a,b){this.chart.polar&&F(this.xAxis,{tooltipLen:360});return a.call(this,b)});if(h.column)e=h.column.prototype,r(e,"animate",b),r(e,"translate",function(a){var b=this.xAxis,c=this.yAxis.len,d=b.center,e=b.startAngleRad,h=this.chart.renderer,i,m;this.preventPostTranslate=!0;a.call(this);if(b.isRadial){b=this.points;for(m=b.length;m--;)i=b[m],a=i.barX+e,i.shapeType="path",i.shapeArgs={d:h.symbols.arc(d[0],d[1],c-i.plotY,null,{start:a,end:a+i.pointWidth, -innerR:c-q(i.yBottom,c)})},this.toXY(i),i.tooltipPos=[i.plotX,i.plotY],i.ttBelow=i.plotY>d[1]}}),r(e,"alignDataLabel",function(a,b,d,e,h,j){if(this.chart.polar){a=b.rectPlotX/Math.PI*180;if(e.align===null)e.align=a>20&&a<160?"left":a>200&&a<340?"right":"center";if(e.verticalAlign===null)e.verticalAlign=a<45||a>315?"bottom":a>135&&a<225?"top":"middle";c.alignDataLabel.call(this,b,d,e,h,j)}else a.call(this,b,d,e,h,j)});r(d,"getIndex",function(a,b){var c,d=this.chart,e;d.polar?(e=d.xAxis[0].center,c= -b.chartX-e[0]-d.plotLeft,d=b.chartY-e[1]-d.plotTop,c=180-Math.round(Math.atan2(c,d)/Math.PI*180)):c=a.call(this,b);return c});r(d,"getCoordinates",function(a,b){var c=this.chart,d={xAxis:[],yAxis:[]};c.polar?s(c.axes,function(a){var e=a.isXAxis,f=a.center,h=b.chartX-f[0]-c.plotLeft,f=b.chartY-f[1]-c.plotTop;d[e?"xAxis":"yAxis"].push({axis:a,value:a.translate(e?Math.PI-Math.atan2(h,f):Math.sqrt(Math.pow(h,2)+Math.pow(f,2)),!0)})}):d=a.call(this,b);return d})})()})(Highcharts); diff --git a/htdocs/js/lib/highstock/highstock.js b/htdocs/js/lib/highstock/highstock.js deleted file mode 100644 index 31242af1..00000000 --- a/htdocs/js/lib/highstock/highstock.js +++ /dev/null @@ -1,383 +0,0 @@ -/* - Highstock JS v2.0.1 (2014-04-24) - - (c) 2009-2014 Torstein Honsi - - License: www.highcharts.com/license -*/ -(function(){function v(a,b){var c;a||(a={});for(c in b)a[c]=b[c];return a}function y(){var a,b=arguments,c,d={},e=function(a,b){var c,d;typeof a!=="object"&&(a={});for(d in b)b.hasOwnProperty(d)&&(c=b[d],a[d]=c&&typeof c==="object"&&Object.prototype.toString.call(c)!=="[object Array]"&&d!=="renderTo"&&typeof c.nodeType!=="number"?e(a[d]||{},c):b[d]);return a};b[0]===!0&&(d=b[1],b=Array.prototype.slice.call(b,2));c=b.length;for(a=0;a3?c.length%3:0;return e+(g?c.substr(0,g)+d:"")+c.substr(g).replace(/(\d{3})(?=\d)/g,"$1"+d)+(f?b+M(a-c).toFixed(f).slice(2):"")}function Qa(a,b){return Array((b||2)+1-String(a).length).join(0)+a}function O(a, -b,c){var d=a[b];a[b]=function(){var a=Array.prototype.slice.call(arguments);a.unshift(d);return c.apply(this,a)}}function Ja(a,b){for(var c="{",d=!1,e,f,g,h,i,k=[];(c=a.indexOf(c))!==-1;){e=a.slice(0,c);if(d){f=e.split(":");g=f.shift().split(".");i=g.length;e=b;for(h=0;h-1?h.thousandsSep:""))):e=ua(f,e)}k.push(e);a=a.slice(c+1);c=(d=!d)? -"}":"{"}k.push(a);return k.join("")}function rb(a){return V.pow(10,S(V.log(a)/V.LN10))}function sb(a,b,c,d){var e,c=o(c,1);e=a/c;b||(b=[1,2,2.5,5,10],d&&d.allowDecimals===!1&&(c===1?b=[1,2,5,10]:c<=0.1&&(b=[1/c])));for(d=0;dc&&(c=a[b]);return c}function Ka(a,b){for(var c in a)a[c]&&a[c]!==b&&a[c].destroy&&a[c].destroy(),delete a[c]}function Sa(a){hb||(hb=$(Ta));a&&hb.appendChild(a);hb.innerHTML=""}function qa(a,b){var c="Highcharts error #"+a+": www.highcharts.com/errors/"+a;if(b)throw c;else X.console&&console.log(c)}function ha(a){return parseFloat(a.toPrecision(14))}function Ya(a,b){Ca=o(a,b.animation)}function Mb(){var a= -F.global.useUTC,b=a?"getUTC":"get",c=a?"setUTC":"set";La=(a&&F.global.timezoneOffset||0)*6E4;ib=a?Date.UTC:function(a,b,c,g,h,i){return(new Date(a,b,o(c,1),o(g,0),o(h,0),o(i,0))).getTime()};ub=b+"Minutes";vb=b+"Hours";wb=b+"Day";Ua=b+"Date";jb=b+"Month";kb=b+"FullYear";Nb=c+"Minutes";Ob=c+"Hours";xb=c+"Date";Pb=c+"Month";Qb=c+"FullYear"}function Z(){}function Za(a,b,c,d){this.axis=a;this.pos=b;this.type=c||"";this.isNew=!0;!c&&!d&&this.addLabel()}function L(){this.init.apply(this,arguments)}function va(){this.init.apply(this, -arguments)}function Rb(a,b,c,d,e){var f=a.chart.inverted;this.axis=a;this.isNegative=c;this.options=b;this.x=d;this.total=null;this.points={};this.stack=e;this.alignOptions={align:b.align||(f?c?"left":"right":"center"),verticalAlign:b.verticalAlign||(f?"middle":c?"bottom":"top"),y:o(b.y,f?4:c?14:-6),x:o(b.x,f?c?-6:6:0)};this.textAlign=b.textAlign||(f?c?"right":"left":"center")}function yb(a){var b=a.options,c=b.navigator,d=c.enabled,b=b.scrollbar,e=b.enabled,f=d?c.height:0,g=e?b.height:0;this.handles= -[];this.scrollbarButtons=[];this.elementsToDestroy=[];this.chart=a;this.setBaseSeries();this.height=f;this.scrollbarHeight=g;this.scrollbarEnabled=e;this.navigatorEnabled=d;this.navigatorOptions=c;this.scrollbarOptions=b;this.outlineHeight=f+g;this.init()}function zb(a){this.init(a)}var r,B=document,X=window,V=Math,s=V.round,S=V.floor,Va=V.ceil,w=V.max,z=V.min,M=V.abs,da=V.cos,ia=V.sin,ra=V.PI,Ma=ra*2/360,Da=navigator.userAgent,Sb=X.opera,Ha=/msie/i.test(Da)&&!Sb,lb=B.documentMode===8,mb=/AppleWebKit/.test(Da), -$a=/Firefox/.test(Da),cb=/(Mobile|Android|Windows Phone)/.test(Da),Ea="http://www.w3.org/2000/svg",ca=!!B.createElementNS&&!!B.createElementNS(Ea,"svg").createSVGRect,Yb=$a&&parseInt(Da.split("Firefox/")[1],10)<4,ja=!ca&&!Ha&&!!B.createElement("canvas").getContext,Wa,ab,Tb={},Ab=0,hb,F,ua,Ca,Bb,H,na=function(){},aa=[],db=0,Ta="div",Y="none",Zb=/^[0-9]+$/,$b="stroke-width",ib,La,ub,vb,wb,Ua,jb,kb,Nb,Ob,xb,Pb,Qb,C={},P=X.Highcharts=X.Highcharts?qa(16,!0):{};ua=function(a,b,c){if(!t(b)||isNaN(b))return"Invalid date"; -var a=o(a,"%Y-%m-%d %H:%M:%S"),d=new Date(b-La),e,f=d[vb](),g=d[wb](),h=d[Ua](),i=d[jb](),k=d[kb](),j=F.lang,l=j.weekdays,d=v({a:l[g].substr(0,3),A:l[g],d:Qa(h),e:h,b:j.shortMonths[i],B:j.months[i],m:Qa(i+1),y:k.toString().substr(2,2),Y:k,H:Qa(f),I:Qa(f%12||12),l:f%12||12,M:Qa(d[ub]()),p:f<12?"AM":"PM",P:f<12?"am":"pm",S:Qa(d.getSeconds()),L:Qa(s(b%1E3),3)},P.dateFormats);for(e in d)for(;a.indexOf("%"+e)!==-1;)a=a.replace("%"+e,typeof d[e]==="function"?d[e](b):d[e]);return c?a.substr(0,1).toUpperCase()+ -a.substr(1):a};Lb.prototype={wrapColor:function(a){if(this.color>=a)this.color=0},wrapSymbol:function(a){if(this.symbol>=a)this.symbol=0}};H=Kb("millisecond",1,"second",1E3,"minute",6E4,"hour",36E5,"day",864E5,"week",6048E5,"month",26784E5,"year",31556952E3);Bb={init:function(a,b,c){var b=b||"",d=a.shift,e=b.indexOf("C")>-1,f=e?7:3,g,b=b.split(" "),c=[].concat(c),h,i,k=function(a){for(g=a.length;g--;)a[g]==="M"&&a.splice(g+1,0,a[g+1],a[g+2],a[g+1],a[g+2])};e&&(k(b),k(c));a.isArea&&(h=b.splice(b.length- -6,6),i=c.splice(c.length-6,6));if(d<=c.length/f&&b.length===c.length)for(;d--;)c=[].concat(c).splice(0,f).concat(c);a.shift=0;if(b.length)for(a=c.length;b.length{point.key}
    ',pointFormat:' {series.name}: {point.y}
    ',shadow:!0,snap:cb?25:10,style:{color:"#333333",cursor:"default",fontSize:"12px",padding:"8px",whiteSpace:"nowrap"}},credits:{enabled:!0,text:"Highcharts.com",href:"http://www.highcharts.com",position:{align:"right", -x:-10,verticalAlign:"bottom",y:-5},style:{cursor:"pointer",color:"#909090",fontSize:"9px"}}};var T=F.plotOptions,J=T.line;Mb();var dc=/rgba\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]?(?:\.[0-9]+)?)\s*\)/,ec=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/,fc=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/,Fa=function(a){var b=[],c,d;(function(a){a&&a.stops?d=xa(a.stops,function(a){return Fa(a[1])}):(c=dc.exec(a))?b=[I(c[1]),I(c[2]),I(c[3]),parseFloat(c[4], -10)]:(c=ec.exec(a))?b=[I(c[1],16),I(c[2],16),I(c[3],16),1]:(c=fc.exec(a))&&(b=[I(c[1]),I(c[2]),I(c[3]),1])})(a);return{get:function(c){var f;d?(f=y(a),f.stops=[].concat(f.stops),q(d,function(a,b){f.stops[b]=[f.stops[b][0],a.get(c)]})):f=b&&!isNaN(b[0])?c==="rgb"?"rgb("+b[0]+","+b[1]+","+b[2]+")":c==="a"?b[3]:"rgba("+b.join(",")+")":a;return f},brighten:function(a){if(d)q(d,function(b){b.brighten(a)});else if(la(a)&&a!==0){var c;for(c=0;c<3;c++)b[c]+=I(a*255),b[c]<0&&(b[c]=0),b[c]>255&&(b[c]=255)}return this}, -rgba:b,setOpacity:function(a){b[3]=a;return this}}};Z.prototype={init:function(a,b){this.element=b==="span"?$(b):B.createElementNS(Ea,b);this.renderer=a},opacity:1,animate:function(a,b,c){b=o(b,Ca,!0);eb(this);if(b){b=y(b,{});if(c)b.complete=c;ob(this,a,b)}else this.attr(a),c&&c()},colorGradient:function(a,b,c){var d=this.renderer,e,f,g,h,i,k,j,l,m,n,p=[];a.linearGradient?f="linearGradient":a.radialGradient&&(f="radialGradient");if(f){g=a[f];h=d.gradients;k=a.stops;m=c.radialReference;Pa(g)&&(a[f]= -g={x1:g[0],y1:g[1],x2:g[2],y2:g[3],gradientUnits:"userSpaceOnUse"});f==="radialGradient"&&m&&!t(g.gradientUnits)&&(g=y(g,{cx:m[0]-m[2]/2+g.cx*m[2],cy:m[1]-m[2]/2+g.cy*m[2],r:g.r*m[2],gradientUnits:"userSpaceOnUse"}));for(n in g)n!=="id"&&p.push(n,g[n]);for(n in k)p.push(k[n]);p=p.join(",");h[p]?a=h[p].attr("id"):(g.id=a="highcharts-"+Ab++,h[p]=i=d.createElement(f).attr(g).add(d.defs),i.stops=[],q(k,function(a){a[1].indexOf("rgba")===0?(e=Fa(a[1]),j=e.get("rgb"),l=e.get("a")):(j=a[1],l=1);a=d.createElement("stop").attr({offset:a[0], -"stop-color":j,"stop-opacity":l}).add(i);i.stops.push(a)}));c.setAttribute(b,"url("+d.url+"#"+a+")")}},attr:function(a,b){var c,d,e=this.element,f,g=this,h;typeof a==="string"&&b!==r&&(c=a,a={},a[c]=b);if(typeof a==="string")g=(this[a+"Getter"]||this._defaultGetter).call(this,a,e);else{for(c in a){d=a[c];h=!1;this.symbolName&&/^(x|y|width|height|r|start|end|innerR|anchorX|anchorY)/.test(c)&&(f||(this.symbolAttr(a),f=!0),h=!0);if(this.rotation&&(c==="x"||c==="y"))this.doTransform=!0;h||(this[c+"Setter"]|| -this._defaultSetter).call(this,d,c,e);this.shadows&&/^(width|height|visibility|x|y|d|transform|cx|cy|r)$/.test(c)&&this.updateShadows(c,d)}if(this.doTransform)this.updateTransform(),this.doTransform=!1}return g},updateShadows:function(a,b){for(var c=this.shadows,d=c.length;d--;)c[d].setAttribute(a,a==="height"?w(b-(c[d].cutHeight||0),0):a==="d"?this.d:b)},addClass:function(a){var b=this.element,c=W(b,"class")||"";c.indexOf(a)===-1&&W(b,"class",c+" "+a);return this},symbolAttr:function(a){var b=this; -q("x,y,r,start,end,width,height,innerR,anchorX,anchorY".split(","),function(c){b[c]=o(a[c],b[c])});b.attr({d:b.renderer.symbols[b.symbolName](b.x,b.y,b.width,b.height,b)})},clip:function(a){return this.attr("clip-path",a?"url("+this.renderer.url+"#"+a.id+")":Y)},crisp:function(a){var b,c={},d,e=a.strokeWidth||this.strokeWidth||this.attr&&this.attr("stroke-width")||0;d=s(e)%2/2;a.x=S(a.x||this.x||0)+d;a.y=S(a.y||this.y||0)+d;a.width=S((a.width||this.width||0)-2*d);a.height=S((a.height||this.height|| -0)-2*d);a.strokeWidth=e;for(b in a)this[b]!==a[b]&&(this[b]=c[b]=a[b]);return c},css:function(a){var b=this.styles,c={},d=this.element,e,f,g="";e=!b;if(a&&a.color)a.fill=a.color;if(b)for(f in a)a[f]!==b[f]&&(c[f]=a[f],e=!0);if(e){e=this.textWidth=a&&a.width&&d.nodeName.toLowerCase()==="text"&&I(a.width);b&&(a=v(b,c));this.styles=a;e&&(ja||!ca&&this.renderer.forExport)&&delete a.width;if(Ha&&!ca)E(this.element,a);else{b=function(a,b){return"-"+b.toLowerCase()};for(f in a)g+=f.replace(/([A-Z])/g,b)+ -":"+a[f]+";";W(d,"style",g)}e&&this.added&&this.renderer.buildText(this)}return this},on:function(a,b){var c=this,d=c.element;ab&&a==="click"?(d.ontouchstart=function(a){c.touchEventFired=Date.now();a.preventDefault();b.call(d,a)},d.onclick=function(a){(Da.indexOf("Android")===-1||Date.now()-(c.touchEventFired||0)>1100)&&b.call(d,a)}):d["on"+a]=b;return this},setRadialReference:function(a){this.element.radialReference=a;return this},translate:function(a,b){return this.attr({translateX:a,translateY:b})}, -invert:function(){this.inverted=!0;this.updateTransform();return this},updateTransform:function(){var a=this.translateX||0,b=this.translateY||0,c=this.scaleX,d=this.scaleY,e=this.inverted,f=this.rotation,g=this.element;e&&(a+=this.attr("width"),b+=this.attr("height"));a=["translate("+a+","+b+")"];e?a.push("rotate(90) scale(-1,1)"):f&&a.push("rotate("+f+" "+(g.getAttribute("x")||0)+" "+(g.getAttribute("y")||0)+")");(t(c)||t(d))&&a.push("scale("+o(c,1)+" "+o(d,1)+")");a.length&&g.setAttribute("transform", -a.join(" "))},toFront:function(){var a=this.element;a.parentNode.appendChild(a);return this},align:function(a,b,c){var d,e,f,g,h={};e=this.renderer;f=e.alignedObjects;if(a){if(this.alignOptions=a,this.alignByTranslate=b,!c||Oa(c))this.alignTo=d=c||"renderer",pa(f,this),f.push(this),c=null}else a=this.alignOptions,b=this.alignByTranslate,d=this.alignTo;c=o(c,e[d],e);d=a.align;e=a.verticalAlign;f=(c.x||0)+(a.x||0);g=(c.y||0)+(a.y||0);if(d==="right"||d==="center")f+=(c.width-(a.width||0))/{right:1,center:2}[d]; -h[b?"translateX":"x"]=s(f);if(e==="bottom"||e==="middle")g+=(c.height-(a.height||0))/({bottom:1,middle:2}[e]||1);h[b?"translateY":"y"]=s(g);this[this.placed?"animate":"attr"](h);this.placed=!0;this.alignAttr=h;return this},getBBox:function(){var a=this.bBox,b=this.renderer,c,d,e=this.rotation;c=this.element;var f=this.styles,g=e*Ma;d=this.textStr;var h;if(d===""||Zb.test(d))h="num."+d.toString().length+(f?"|"+f.fontSize+"|"+f.fontFamily:"");h&&(a=b.cache[h]);if(!a){if(c.namespaceURI===Ea||b.forExport){try{a= -c.getBBox?v({},c.getBBox()):{width:c.offsetWidth,height:c.offsetHeight}}catch(i){}if(!a||a.width<0)a={width:0,height:0}}else a=this.htmlGetBBox();if(b.isSVG){c=a.width;d=a.height;if(Ha&&f&&f.fontSize==="11px"&&d.toPrecision(3)==="16.9")a.height=d=14;if(e)a.width=M(d*ia(g))+M(c*da(g)),a.height=M(d*da(g))+M(c*ia(g))}this.bBox=a;h&&(b.cache[h]=a)}return a},show:function(a){return a&&this.element.namespaceURI===Ea?(this.element.removeAttribute("visibility"),this):this.attr({visibility:a?"inherit":"visible"})}, -hide:function(){return this.attr({visibility:"hidden"})},fadeOut:function(a){var b=this;b.animate({opacity:0},{duration:a||150,complete:function(){b.hide()}})},add:function(a){var b=this.renderer,c=a||b,d=c.element||b.box,e=this.element,f=this.zIndex,g,h;if(a)this.parentGroup=a;this.parentInverted=a&&a.inverted;this.textStr!==void 0&&b.buildText(this);if(f)c.handleZ=!0,f=I(f);if(c.handleZ){a=d.childNodes;for(g=0;gf||!t(f)&&t(c))){d.insertBefore(e, -b);h=!0;break}}h||d.appendChild(e);this.added=!0;if(this.onAdd)this.onAdd();return this},safeRemoveChild:function(a){var b=a.parentNode;b&&b.removeChild(a)},destroy:function(){var a=this,b=a.element||{},c=a.shadows,d=a.renderer.isSVG&&b.nodeName==="SPAN"&&a.parentGroup,e,f;b.onclick=b.onmouseout=b.onmouseover=b.onmousemove=b.point=null;eb(a);if(a.clipPath)a.clipPath=a.clipPath.destroy();if(a.stops){for(f=0;f/,i=/<.*href="(http[^"]+)".*>/,l&&!a.added&&this.box.appendChild(b),e=f?e.replace(/<(b|strong)>/g,'').replace(/<(i|em)>/g,'').replace(//g, -"").split(//g):[e],e[e.length-1]===""&&e.pop(),q(e,function(e,f){var g,m=0,e=e.replace(//g,"|||");g=e.split("|||");q(g,function(e){if(e!==""||g.length===1){var n={},u=B.createElementNS(Ea,"tspan"),o;h.test(e)&&(o=e.match(h)[1].replace(/(;| |^)color([ :])/,"$1fill$2"),W(u,"style",o));i.test(e)&&!d&&(W(u,"onclick",'location.href="'+e.match(i)[1]+'"'),E(u,{cursor:"pointer"}));e=(e.replace(/<(.|\n)*?>/g,"")||" ").replace(/</g,"<").replace(/>/g, -">");if(e!==" "){u.appendChild(B.createTextNode(e));if(m)n.dx=0;else if(f&&k!==null)n.x=k;W(u,n);!m&&f&&(!ca&&d&&E(u,{display:"block"}),W(u,"dy",p(u),mb&&u.offsetHeight));b.appendChild(u);m++;if(l)for(var e=e.replace(/([^\^])-/g,"$1- ").split(" "),n=e.length>1&&j.whiteSpace!=="nowrap",q,r,D=a._clipHeight,t=[],s=p(),w=1;n&&(e.length||t.length);)delete a.bBox,q=a.getBBox(),r=q.width,!ca&&c.forExport&&(r=c.measureSpanWidth(u.firstChild.data,a.styles)),q=r>l,!q||e.length===1?(e=t,t=[],e.length&&(w++, -D&&w*s>D?(e=["..."],a.attr("title",a.textStr)):(u=B.createElementNS(Ea,"tspan"),W(u,{dy:s,x:k}),o&&W(u,"style",o),b.appendChild(u),r>l&&(l=r)))):(u.removeChild(u.firstChild),t.unshift(e.pop())),e.length&&u.appendChild(B.createTextNode(e.join(" ").replace(/- /g,"-")))}}})}))},button:function(a,b,c,d,e,f,g,h,i){var k=this.label(a,b,c,i,null,null,null,null,"button"),j=0,l,m,n,p,u,o,a={x1:0,y1:0,x2:0,y2:1},e=y({"stroke-width":1,stroke:"#CCCCCC",fill:{linearGradient:a,stops:[[0,"#FEFEFE"],[1,"#F6F6F6"]]}, -r:2,padding:5,style:{color:"black"}},e);n=e.style;delete e.style;f=y(e,{stroke:"#68A",fill:{linearGradient:a,stops:[[0,"#FFF"],[1,"#ACF"]]}},f);p=f.style;delete f.style;g=y(e,{stroke:"#68A",fill:{linearGradient:a,stops:[[0,"#9BD"],[1,"#CDF"]]}},g);u=g.style;delete g.style;h=y(e,{style:{color:"#CCC"}},h);o=h.style;delete h.style;A(k.element,Ha?"mouseover":"mouseenter",function(){j!==3&&k.attr(f).css(p)});A(k.element,Ha?"mouseout":"mouseleave",function(){j!==3&&(l=[e,f,g][j],m=[n,p,u][j],k.attr(l).css(m))}); -k.setState=function(a){(k.state=j=a)?a===2?k.attr(g).css(u):a===3&&k.attr(h).css(o):k.attr(e).css(n)};return k.on("click",function(){j!==3&&d.call(k)}).attr(e).css(v({cursor:"default"},n))},crispLine:function(a,b){a[1]===a[4]&&(a[1]=a[4]=s(a[1])-b%2/2);a[2]===a[5]&&(a[2]=a[5]=s(a[2])+b%2/2);return a},path:function(a){var b={fill:Y};Pa(a)?b.d=a:fa(a)&&v(b,a);return this.createElement("path").attr(b)},circle:function(a,b,c){a=fa(a)?a:{x:a,y:b,r:c};b=this.createElement("circle");b.xSetter=function(a){this.element.setAttribute("cx", -a)};b.ySetter=function(a){this.element.setAttribute("cy",a)};return b.attr(a)},arc:function(a,b,c,d,e,f){if(fa(a))b=a.y,c=a.r,d=a.innerR,e=a.start,f=a.end,a=a.x;a=this.symbol("arc",a||0,b||0,c||0,c||0,{innerR:d||0,start:e||0,end:f||0});a.r=c;return a},rect:function(a,b,c,d,e,f){var e=fa(a)?a.r:e,g=this.createElement("rect"),a=fa(a)?a:a===r?{}:{x:a,y:b,width:w(c,0),height:w(d,0)};if(f!==r)a.strokeWidth=f,a=g.crisp(a);if(e)a.r=e;g.rSetter=function(a){W(this.element,{rx:a,ry:a})};return g.attr(a)},setSize:function(a, -b,c){var d=this.alignedObjects,e=d.length;this.width=a;this.height=b;for(this.boxWrapper[o(c,!0)?"animate":"attr"]({width:a,height:b});e--;)d[e].align()},g:function(a){var b=this.createElement("g");return t(a)?b.attr({"class":"highcharts-"+a}):b},image:function(a,b,c,d,e){var f={preserveAspectRatio:Y};arguments.length>1&&v(f,{x:b,y:c,width:d,height:e});f=this.createElement("image").attr(f);f.element.setAttributeNS?f.element.setAttributeNS("http://www.w3.org/1999/xlink","href",a):f.element.setAttribute("hc-svg-href", -a);return f},symbol:function(a,b,c,d,e,f){var g,h=this.symbols[a],h=h&&h(s(b),s(c),d,e,f),i=/^url\((.*?)\)$/,k,j;if(h)g=this.path(h),v(g,{symbolName:a,x:b,y:c,width:d,height:e}),f&&v(g,f);else if(i.test(a))j=function(a,b){a.element&&(a.attr({width:b[0],height:b[1]}),a.alignByTranslate||a.translate(s((d-b[0])/2),s((e-b[1])/2)))},k=a.match(i)[1],a=Tb[k],g=this.image(k).attr({x:b,y:c}),g.isImg=!0,a?j(g,a):(g.attr({width:0,height:0}),$("img",{onload:function(){j(g,Tb[k]=[this.width,this.height])},src:k})); -return g},symbols:{circle:function(a,b,c,d){var e=0.166*c;return["M",a+c/2,b,"C",a+c+e,b,a+c+e,b+d,a+c/2,b+d,"C",a-e,b+d,a-e,b,a+c/2,b,"Z"]},square:function(a,b,c,d){return["M",a,b,"L",a+c,b,a+c,b+d,a,b+d,"Z"]},triangle:function(a,b,c,d){return["M",a+c/2,b,"L",a+c,b+d,a,b+d,"Z"]},"triangle-down":function(a,b,c,d){return["M",a,b,"L",a+c,b,a+c/2,b+d,"Z"]},diamond:function(a,b,c,d){return["M",a+c/2,b,"L",a+c,b+d/2,a+c/2,b+d,a,b+d/2,"Z"]},arc:function(a,b,c,d,e){var f=e.start,c=e.r||c||d,g=e.end-0.001, -d=e.innerR,h=e.open,i=da(f),k=ia(f),j=da(g),g=ia(g),e=e.end-fc&&i>b+g&&ib+g&&id&&h>a+g&&ha+g&&hl&&/[ \-]/.test(b.textContent||b.innerText))E(b,{width:l+"px",display:"block",whiteSpace:"normal"}),i=l;this.getSpanCorrection(i,j,h,k,g)}E(b,{left:e+(this.xCorr||0)+"px",top:f+(this.yCorr||0)+"px"});if(mb)j=b.offsetHeight;this.cTT=m}}else this.alignOnAdd=!0},setSpanRotation:function(a,b,c){var d={},e=Ha?"-ms-transform":mb?"-webkit-transform":$a?"MozTransform":Sb?"-o-transform":"";d[e]=d.transform="rotate("+a+"deg)";d[e+($a?"Origin":"-origin")]=d.transformOrigin= -b*100+"% "+c+"px";E(this.element,d)},getSpanCorrection:function(a,b,c){this.xCorr=-a*c;this.yCorr=-b}});v(ka.prototype,{html:function(a,b,c){var d=this.createElement("span"),e=d.element,f=d.renderer;d.textSetter=function(a){a!==e.innerHTML&&delete this.bBox;e.innerHTML=this.textStr=a};d.xSetter=d.ySetter=d.alignSetter=d.rotationSetter=function(a,b){b==="align"&&(b="textAlign");d[b]=a;d.htmlUpdateTransform()};d.attr({text:a,x:s(b),y:s(c)}).css({position:"absolute",whiteSpace:"nowrap",fontFamily:this.style.fontFamily, -fontSize:this.style.fontSize});d.css=d.htmlCss;if(f.isSVG)d.add=function(a){var b,c=f.box.parentNode,k=[];if(this.parentGroup=a){if(b=a.div,!b){for(;a;)k.push(a),a=a.parentGroup;q(k.reverse(),function(a){var d;b=a.div=a.div||$(Ta,{className:W(a.element,"class")},{position:"absolute",left:(a.translateX||0)+"px",top:(a.translateY||0)+"px"},b||c);d=b.style;v(a,{translateXSetter:function(b,c){d.left=b+"px";a[c]=b;a.doTransform=!0},translateYSetter:function(b,c){d.top=b+"px";a[c]=b;a.doTransform=!0},visibilitySetter:function(a, -b){d[b]=a}})})}}else b=c;b.appendChild(e);d.added=!0;d.alignOnAdd&&d.htmlUpdateTransform();return d};return d}});var fb,ea;if(!ca&&!ja)P.VMLElement=ea={init:function(a,b){var c=["<",b,' filled="f" stroked="f"'],d=["position: ","absolute",";"],e=b===Ta;(b==="shape"||e)&&d.push("left:0;top:0;width:1px;height:1px;");d.push("visibility: ",e?"hidden":"visible");c.push(' style="',d.join(""),'"/>');if(b)c=e||b==="span"||b==="img"?c.join(""):a.prepVML(c),this.element=$(c);this.renderer=a},add:function(a){var b= -this.renderer,c=this.element,d=b.box,d=a?a.element||a:d;a&&a.inverted&&b.invertChild(c,d);d.appendChild(c);this.added=!0;this.alignOnAdd&&!this.deferUpdateTransform&&this.updateTransform();if(this.onAdd)this.onAdd();return this},updateTransform:Z.prototype.htmlUpdateTransform,setSpanRotation:function(){var a=this.rotation,b=da(a*Ma),c=ia(a*Ma);E(this.element,{filter:a?["progid:DXImageTransform.Microsoft.Matrix(M11=",b,", M12=",-c,", M21=",c,", M22=",b,", sizingMethod='auto expand')"].join(""):Y})}, -getSpanCorrection:function(a,b,c,d,e){var f=d?da(d*Ma):1,g=d?ia(d*Ma):0,h=o(this.elemHeight,this.element.offsetHeight),i;this.xCorr=f<0&&-a;this.yCorr=g<0&&-h;i=f*g<0;this.xCorr+=g*b*(i?1-c:c);this.yCorr-=f*b*(d?i?c:1-c:1);e&&e!=="left"&&(this.xCorr-=a*c*(f<0?-1:1),d&&(this.yCorr-=h*c*(g<0?-1:1)),E(this.element,{textAlign:e}))},pathToVML:function(a){for(var b=a.length,c=[];b--;)if(la(a[b]))c[b]=s(a[b]*10)-5;else if(a[b]==="Z")c[b]="x";else if(c[b]=a[b],a.isArc&&(a[b]==="wa"||a[b]==="at"))c[b+5]=== -c[b+7]&&(c[b+7]+=a[b+7]>a[b+5]?1:-1),c[b+6]===c[b+8]&&(c[b+8]+=a[b+8]>a[b+6]?1:-1);return c.join(" ")||"x"},clip:function(a){var b=this,c;a?(c=a.members,pa(c,b),c.push(b),b.destroyClip=function(){pa(c,b)},a=a.getCSS(b)):(b.destroyClip&&b.destroyClip(),a={clip:lb?"inherit":"rect(auto)"});return b.css(a)},css:Z.prototype.htmlCss,safeRemoveChild:function(a){a.parentNode&&Sa(a)},destroy:function(){this.destroyClip&&this.destroyClip();return Z.prototype.destroy.apply(this)},on:function(a,b){this.element["on"+ -a]=function(){var a=X.event;a.target=a.srcElement;b(a)};return this},cutOffPath:function(a,b){var c,a=a.split(/[ ,]/);c=a.length;if(c===9||c===11)a[c-4]=a[c-2]=I(a[c-2])-10*b;return a.join(" ")},shadow:function(a,b,c){var d=[],e,f=this.element,g=this.renderer,h,i=f.style,k,j=f.path,l,m,n,p;j&&typeof j.value!=="string"&&(j="x");m=j;if(a){n=o(a.width,3);p=(a.opacity||0.15)/n;for(e=1;e<=3;e++){l=n*2+1-2*e;c&&(m=this.cutOffPath(j.value,l+0.5));k=[''];h=$(g.prepVML(k),null,{left:I(i.left)+o(a.offsetX,1),top:I(i.top)+o(a.offsetY,1)});if(c)h.cutOff=l+1;k=[''];$(g.prepVML(k),null,null,h);b?b.element.appendChild(h):f.parentNode.insertBefore(h,f);d.push(h)}this.shadows=d}return this},updateShadows:na,setAttr:function(a,b){lb?this.element[a]=b:this.element.setAttribute(a,b)},classSetter:function(a){this.element.className=a},dashstyleSetter:function(a, -b,c){(c.getElementsByTagName("stroke")[0]||$(this.renderer.prepVML([""]),null,null,c))[b]=a||"solid";this[b]=a},dSetter:function(a,b,c){var d=this.shadows,a=a||[];this.d=a.join(" ");c.path=a=this.pathToVML(a);if(d)for(c=d.length;c--;)d[c].path=d[c].cutOff?this.cutOffPath(a,d[c].cutOff):a;this.setAttr(b,a)},fillSetter:function(a,b,c){var d=c.nodeName;if(d==="SPAN")c.style.color=a;else if(d!=="IMG")c.filled=a!==Y,this.setAttr("fillcolor",this.renderer.color(a,c,b,this))},opacitySetter:na,rotationSetter:function(a, -b,c){c=c.style;this[b]=c[b]=a;c.left=-s(ia(a*Ma)+1)+"px";c.top=s(da(a*Ma))+"px"},strokeSetter:function(a,b,c){this.setAttr("strokecolor",this.renderer.color(a,c,b))},"stroke-widthSetter":function(a,b,c){c.stroked=!!a;this[b]=a;la(a)&&(a+="px");this.setAttr("strokeweight",a)},titleSetter:function(a,b){this.setAttr(b,a)},visibilitySetter:function(a,b,c){a==="inherit"&&(a="visible");this.shadows&&q(this.shadows,function(c){c.style[b]=a});c.nodeName==="DIV"&&(a=a==="hidden"?"-999em":0,lb||(c.style[b]= -a?"visible":"hidden"),b="top");c.style[b]=a},xSetter:function(a,b,c){this[b]=a;b==="x"?b="left":b==="y"&&(b="top");this.updateClipping?(this[b]=a,this.updateClipping()):c.style[b]=a},zIndexSetter:function(a,b,c){c.style[b]=a}},ea=ga(Z,ea),ea.prototype.ySetter=ea.prototype.widthSetter=ea.prototype.heightSetter=ea.prototype.xSetter,ea={Element:ea,isIE8:Da.indexOf("MSIE 8.0")>-1,init:function(a,b,c,d){var e;this.alignedObjects=[];d=this.createElement(Ta).css(v(this.getStyle(d),{position:"relative"})); -e=d.element;a.appendChild(d.element);this.isVML=!0;this.box=e;this.boxWrapper=d;this.cache={};this.setSize(b,c,!1);if(!B.namespaces.hcv){B.namespaces.add("hcv","urn:schemas-microsoft-com:vml");try{B.createStyleSheet().cssText="hcv\\:fill, hcv\\:path, hcv\\:shape, hcv\\:stroke{ behavior:url(#default#VML); display: inline-block; } "}catch(f){B.styleSheets[0].cssText+="hcv\\:fill, hcv\\:path, hcv\\:shape, hcv\\:stroke{ behavior:url(#default#VML); display: inline-block; } "}}},isHidden:function(){return!this.box.offsetWidth}, -clipRect:function(a,b,c,d){var e=this.createElement(),f=fa(a);return v(e,{members:[],left:(f?a.x:a)+1,top:(f?a.y:b)+1,width:(f?a.width:c)-1,height:(f?a.height:d)-1,getCSS:function(a){var b=a.element,c=b.nodeName,a=a.inverted,d=this.top-(c==="shape"?b.offsetTop:0),e=this.left,b=e+this.width,f=d+this.height,d={clip:"rect("+s(a?e:d)+"px,"+s(a?f:b)+"px,"+s(a?b:f)+"px,"+s(a?d:e)+"px)"};!a&&lb&&c==="DIV"&&v(d,{width:b+"px",height:f+"px"});return d},updateClipping:function(){q(e.members,function(a){a.element&& -a.css(e.getCSS(a))})}})},color:function(a,b,c,d){var e=this,f,g=/^rgba/,h,i,k=Y;a&&a.linearGradient?i="gradient":a&&a.radialGradient&&(i="pattern");if(i){var j,l,m=a.linearGradient||a.radialGradient,n,p,u,o,G,x="",a=a.stops,r,t=[],s=function(){h=[''];$(e.prepVML(h),null,null,b)};n=a[0];r=a[a.length-1];n[0]>0&&a.unshift([0,n[1]]);r[0]<1&&a.push([1,r[1]]);q(a,function(a,b){g.test(a[1])?(f= -Fa(a[1]),j=f.get("rgb"),l=f.get("a")):(j=a[1],l=1);t.push(a[0]*100+"% "+j);b?(u=l,o=j):(p=l,G=j)});if(c==="fill")if(i==="gradient")c=m.x1||m[0]||0,a=m.y1||m[1]||0,n=m.x2||m[2]||0,m=m.y2||m[3]||0,x='angle="'+(90-V.atan((m-a)/(n-c))*180/ra)+'"',s();else{var k=m.r,w=k*2,v=k*2,y=m.cx,D=m.cy,U=b.radialReference,z,k=function(){U&&(z=d.getBBox(),y+=(U[0]-z.x)/z.width-0.5,D+=(U[1]-z.y)/z.height-0.5,w*=U[2]/z.width,v*=U[2]/z.height);x='src="'+F.global.VMLRadialGradientURL+'" size="'+w+","+v+'" origin="0.5,0.5" position="'+ -y+","+D+'" color2="'+G+'" ';s()};d.added?k():d.onAdd=k;k=o}else k=j}else if(g.test(a)&&b.tagName!=="IMG")f=Fa(a),h=["<",c,' opacity="',f.get("a"),'"/>'],$(this.prepVML(h),null,null,b),k=f.get("rgb");else{k=b.getElementsByTagName(c);if(k.length)k[0].opacity=1,k[0].type="solid";k=a}return k},prepVML:function(a){var b=this.isIE8,a=a.join("");b?(a=a.replace("/>",' xmlns="urn:schemas-microsoft-com:vml" />'),a=a.indexOf('style="')===-1?a.replace("/>",' style="display:inline-block;behavior:url(#default#VML);" />'): -a.replace('style="','style="display:inline-block;behavior:url(#default#VML);')):a=a.replace("<","1&&f.attr({x:b,y:c,width:d,height:e});return f},createElement:function(a){return a==="rect"?this.symbol(a):ka.prototype.createElement.call(this,a)},invertChild:function(a,b){var c=this,d=b.style,e=a.tagName==="IMG"&&a.style;E(a,{flip:"x",left:I(d.width)-(e?I(e.top):1),top:I(d.height)-(e?I(e.left):1),rotation:-90});q(a.childNodes,function(b){c.invertChild(b,a)})},symbols:{arc:function(a,b,c,d,e){var f=e.start,g=e.end,h=e.r||c|| -d,c=e.innerR,d=da(f),i=ia(f),k=da(g),j=ia(g);if(g-f===0)return["x"];f=["wa",a-h,b-h,a+h,b+h,a+h*d,b+h*i,a+h*k,b+h*j];e.open&&!c&&f.push("e","M",a,b);f.push("at",a-c,b-c,a+c,b+c,a+c*k,b+c*j,a+c*d,b+c*i,"x","e");f.isArc=!0;return f},circle:function(a,b,c,d,e){e&&(c=d=2*e.r);e&&e.isCircle&&(a-=c/2,b-=d/2);return["wa",a,b,a+c,b+d,a+c,b+d/2,a+c,b+d/2,"e"]},rect:function(a,b,c,d,e){return ka.prototype.symbols[!t(e)||!e.r?"square":"callout"].call(0,a,b,c,d,e)}}},P.VMLRenderer=fb=function(){this.init.apply(this, -arguments)},fb.prototype=y(ka.prototype,ea),Wa=fb;ka.prototype.measureSpanWidth=function(a,b){var c=B.createElement("span"),d;d=B.createTextNode(a);c.appendChild(d);E(c,b);this.box.appendChild(c);d=c.offsetWidth;Sa(c);return d};var Vb;if(ja)P.CanVGRenderer=ea=function(){Ea="http://www.w3.org/1999/xhtml"},ea.prototype.symbols={},Vb=function(){function a(){var a=b.length,d;for(d=0;dl[p]?l[p]=g+k:m||(c=!1);if(m){l=(m=d.justifyToPlot)?d.pos:0;m=m?l+d.len:d.chart.chartWidth;do a+=e?1:-1,n=d.ticks[i[a]];while(i[a]&&(!n||n.label.line!==p));d=n&& -n.label.xy&&n.label.xy.x+n.getLabelSides()[e?0:1];e&&!h||f&&h?g+jd&&(c=!1)):g+k>m&&(g=m-k,n&&g+j0&&b.height>0){f=y({align:c&&j&&"center",x:c?!j&&4:10,verticalAlign:!c&&j&&"middle",y:c?j?16:10:j?6:-4,rotation:c&&!j&&90},f);if(!g){r={align:f.textAlign||f.align,rotation:f.rotation};if(t(G))r.zIndex=G;a.label=g=s.text(f.text,0,0,f.useHTML).attr(r).css(f.style).add()}b=[p[1],p[4],o(p[6],p[1])];p=[p[2],p[5],o(p[7],p[2])];c=Ra(b);j=Ra(p);g.align(f,!1,{x:c,y:j,width:Ba(b)-c,height:Ba(p)-j});g.show()}else g&& -g.hide();return a},destroy:function(){pa(this.axis.plotLinesAndBands,this);delete this.axis;Ka(this)}};L.prototype={defaultOptions:{dateTimeLabelFormats:{millisecond:"%H:%M:%S.%L",second:"%H:%M:%S",minute:"%H:%M",hour:"%H:%M",day:"%e. %b",week:"%e. %b",month:"%b '%y",year:"%Y"},endOnTick:!1,gridLineColor:"#C0C0C0",labels:Q,lineColor:"#C0D0E0",lineWidth:1,minPadding:0.01,maxPadding:0.01,minorGridLineColor:"#E0E0E0",minorGridLineWidth:1,minorTickColor:"#A0A0A0",minorTickLength:2,minorTickPosition:"outside", -startOfWeek:1,startOnTick:!1,tickColor:"#C0D0E0",tickLength:10,tickmarkPlacement:"between",tickPixelInterval:100,tickPosition:"outside",tickWidth:1,title:{align:"middle",style:{color:"#707070"}},type:"linear"},defaultYAxisOptions:{endOnTick:!0,gridLineWidth:1,tickPixelInterval:72,showLastLabel:!0,labels:{x:-8,y:3},lineWidth:0,maxPadding:0.05,minPadding:0.05,startOnTick:!0,tickWidth:0,title:{rotation:270,text:"Values"},stackLabels:{enabled:!1,formatter:function(){return Ia(this.total,-1)},style:Q.style}}, -defaultLeftAxisOptions:{labels:{x:-15,y:null},title:{rotation:270}},defaultRightAxisOptions:{labels:{x:15,y:null},title:{rotation:90}},defaultBottomAxisOptions:{labels:{x:0,y:20},title:{rotation:0}},defaultTopAxisOptions:{labels:{x:0,y:-15},title:{rotation:0}},init:function(a,b){var c=b.isX;this.horiz=a.inverted?!c:c;this.coll=(this.isXAxis=c)?"xAxis":"yAxis";this.opposite=b.opposite;this.side=b.side||(this.horiz?this.opposite?0:2:this.opposite?1:3);this.setOptions(b);var d=this.options,e=d.type; -this.labelFormatter=d.labels.formatter||this.defaultLabelFormatter;this.userOptions=b;this.minPixelPadding=0;this.chart=a;this.reversed=d.reversed;this.zoomEnabled=d.zoomEnabled!==!1;this.categories=d.categories||e==="category";this.names=[];this.isLog=e==="logarithmic";this.isDatetimeAxis=e==="datetime";this.isLinked=t(d.linkedTo);this.tickmarkOffset=this.categories&&d.tickmarkPlacement==="between"?0.5:0;this.ticks={};this.labelEdge=[];this.minorTicks={};this.plotLinesAndBands=[];this.alternateBands= -{};this.len=0;this.minRange=this.userMinRange=d.minRange||d.maxZoom;this.range=d.range;this.offset=d.offset||0;this.stacks={};this.oldStacks={};this.min=this.max=null;this.crosshair=o(d.crosshair,ma(a.options.tooltip.crosshairs)[c?0:1],!1);var f,d=this.options.events;wa(this,a.axes)===-1&&(c&&!this.isColorAxis?a.axes.splice(a.xAxis.length,0,this):a.axes.push(this),a[this.coll].push(this));this.series=this.series||[];if(a.inverted&&c&&this.reversed===r)this.reversed=!0;this.removePlotLine=this.removePlotBand= -this.removePlotBandOrLine;for(f in d)A(this,f,d[f]);if(this.isLog)this.val2lin=Ga,this.lin2val=oa},setOptions:function(a){this.options=y(this.defaultOptions,this.isXAxis?{}:this.defaultYAxisOptions,[this.defaultTopAxisOptions,this.defaultRightAxisOptions,this.defaultBottomAxisOptions,this.defaultLeftAxisOptions][this.side],y(F[this.coll],a))},defaultLabelFormatter:function(){var a=this.axis,b=this.value,c=a.categories,d=this.dateTimeLabelFormat,e=F.lang.numericSymbols,f=e&&e.length,g,h=a.options.labels.format, -a=a.isLog?b:a.tickInterval;if(h)g=Ja(h,this);else if(c)g=b;else if(d)g=ua(d,b);else if(f&&a>=1E3)for(;f--&&g===r;)c=Math.pow(1E3,f+1),a>=c&&e[f]!==null&&(g=Ia(b/c,-1)+e[f]);g===r&&(g=M(b)>=1E4?Ia(b,0):Ia(b,-1,r,""));return g},getSeriesExtremes:function(){var a=this,b=a.chart;a.hasVisibleSeries=!1;a.dataMin=a.dataMax=null;a.buildStacks&&a.buildStacks();q(a.series,function(c){if(c.visible||!b.options.chart.ignoreHiddenSeries){var d;d=c.options.threshold;var e;a.hasVisibleSeries=!0;a.isLog&&d<=0&&(d= -null);if(a.isXAxis){if(d=c.xData,d.length)a.dataMin=z(o(a.dataMin,d[0]),Ra(d)),a.dataMax=w(o(a.dataMax,d[0]),Ba(d))}else{c.getExtremes();e=c.dataMax;c=c.dataMin;if(t(c)&&t(e))a.dataMin=z(o(a.dataMin,c),c),a.dataMax=w(o(a.dataMax,e),e);if(t(d))if(a.dataMin>=d)a.dataMin=d,a.ignoreMinPadding=!0;else if(a.dataMaxg+this.width)m=!0}else if(a=g,c=l-this.right,ih+this.height)m=!0;return m&&!d?null:f.renderer.crispLine(["M",a,i,"L",c,k],b||1)},getLinearTickPositions:function(a,b,c){var d,e=ha(S(b/a)*a),f=ha(Va(c/a)*a),g=[];if(b===c&&la(b))return[b];for(b=e;b<=f;){g.push(b);b=ha(b+ -a);if(b===d)break;d=b}return g},getMinorTickPositions:function(){var a=this.options,b=this.tickPositions,c=this.minorTickInterval,d=[],e;if(this.isLog){e=b.length;for(a=1;a=this.minRange,f,g,h,i,k;if(this.isXAxis&&this.minRange===r&&!this.isLog)t(a.min)||t(a.max)?this.minRange=null:(q(this.series,function(a){i=a.xData;for(g=k=a.xIncrement?1:i.length-1;g>0;g--)if(h=i[g]-i[g-1],f===r||hc&&(h=0);d=w(d,h);f=w(f,Oa(k)?0:h/2);g=w(g,k==="on"?0:h);!a.noSharedTooltip&&t(n)&&(e=t(e)?z(e,n):n)}),h=b.ordinalSlope&& -e?b.ordinalSlope/e:1,b.minPointOffset=f*=h,b.pointRangePadding=g*=h,b.pointRange=z(d,c),b.closestPointRange=e;if(a)b.oldTransA=k;b.translationSlope=b.transA=k=b.len/(c+g||1);b.transB=b.horiz?b.left:b.bottom;b.minPixelPadding=k*f},setTickPositions:function(a){var b=this,c=b.chart,d=b.options,e=b.isLog,f=b.isDatetimeAxis,g=b.isXAxis,h=b.isLinked,i=b.options.tickPositioner,k=d.maxPadding,j=d.minPadding,l=d.tickInterval,m=d.minTickInterval,n=d.tickPixelInterval,p,u=b.categories;h?(b.linkedParent=c[b.coll][d.linkedTo], -c=b.linkedParent.getExtremes(),b.min=o(c.min,c.dataMin),b.max=o(c.max,c.dataMax),d.type!==b.linkedParent.options.type&&qa(11,1)):(b.min=o(b.userMin,d.min,b.dataMin),b.max=o(b.userMax,d.max,b.dataMax));if(e)!a&&z(b.min,o(b.dataMin,b.min))<=0&&qa(10,1),b.min=ha(Ga(b.min)),b.max=ha(Ga(b.max));if(b.range&&t(b.max))b.userMin=b.min=w(b.min,b.max-b.range),b.userMax=b.max,b.range=null;b.beforePadding&&b.beforePadding();b.adjustForMinRange();if(!u&&!b.axisPointRange&&!b.usePercentage&&!h&&t(b.min)&&t(b.max)&& -(c=b.max-b.min)){if(!t(d.min)&&!t(b.userMin)&&j&&(b.dataMin<0||!b.ignoreMinPadding))b.min-=c*j;if(!t(d.max)&&!t(b.userMax)&&k&&(b.dataMax>0||!b.ignoreMaxPadding))b.max+=c*k}if(la(d.floor))b.min=w(b.min,d.floor);if(la(d.ceiling))b.max=z(b.max,d.ceiling);b.min===b.max||b.min===void 0||b.max===void 0?b.tickInterval=1:h&&!l&&n===b.linkedParent.options.tickPixelInterval?b.tickInterval=b.linkedParent.tickInterval:(b.tickInterval=o(l,u?1:(b.max-b.min)*n/w(b.len,n)),!t(l)&&b.lenw(2*b.len,200)&&qa(19,!0),a=f?b.getTimeTicks(b.normalizeTimeTickInterval(b.tickInterval,d.units),b.min,b.max,d.startOfWeek,b.ordinalPositions,b.closestPointRange,!0):e?b.getLogTickPositions(b.tickInterval,b.min,b.max):b.getLinearTickPositions(b.tickInterval,b.min,b.max),p&& -a.splice(1,a.length-2),b.tickPositions=a;if(!h)e=a[0],f=a[a.length-1],h=b.minPointOffset||0,d.startOnTick?b.min=e:b.min-h>e&&a.shift(),d.endOnTick?b.max=f:b.max+h1E13?1:0.001,b.min-=d,b.max+=d)},setMaxTicks:function(){var a=this.chart,b=a.maxTicks||{},c=this.tickPositions,d=this._maxTicksKey=[this.coll,this.pos,this.len].join("-");if(!this.isLinked&&!this.isDatetimeAxis&&c&&c.length>(b[d]||0)&&this.options.alignTicks!==!1)b[d]=c.length;a.maxTicks=b},adjustTickAmount:function(){var a= -this._maxTicksKey,b=this.tickPositions,c=this.chart.maxTicks;if(c&&c[a]&&!this.isDatetimeAxis&&!this.categories&&!this.isLinked&&this.options.alignTicks!==!1&&this.min!==r){var d=this.tickAmount,e=b.length;this.tickAmount=a=c[a];if(e=w(d,o(e.max,d))&&(b=r));this.displayBtn=a!==r||b!==r;this.setExtremes(a,b,!1,r, -{trigger:"zoom"});return!0},setAxisSize:function(){var a=this.chart,b=this.options,c=b.offsetLeft||0,d=this.horiz,e=o(b.width,a.plotWidth-c+(b.offsetRight||0)),f=o(b.height,a.plotHeight),g=o(b.top,a.plotTop),b=o(b.left,a.plotLeft+c),c=/%$/;c.test(f)&&(f=parseInt(f,10)/100*a.plotHeight);c.test(g)&&(g=parseInt(g,10)/100*a.plotHeight+a.plotTop);this.left=b;this.top=g;this.width=e;this.height=f;this.bottom=a.chartHeight-f-g;this.right=a.chartWidth-e-b;this.len=w(d?e:f,0);this.pos=d?b:g},getExtremes:function(){var a= -this.isLog;return{min:a?ha(oa(this.min)):this.min,max:a?ha(oa(this.max)):this.max,dataMin:this.dataMin,dataMax:this.dataMax,userMin:this.userMin,userMax:this.userMax}},getThreshold:function(a){var b=this.isLog,c=b?oa(this.min):this.min,b=b?oa(this.max):this.max;c>a||a===null?a=c:b15&&a<165?"right":a>195&&a<345?"left":"center"},getOffset:function(){var a=this,b=a.chart,c=b.renderer,d=a.options, -e=a.tickPositions,f=a.ticks,g=a.horiz,h=a.side,i=b.inverted?[1,0,3,2][h]:h,k,j=0,l,m=0,n=d.title,p=d.labels,u=0,Db=b.axisOffset,G=b.clipOffset,x=[-1,1,1,-1][h],s,v=1,y=o(p.maxStaggerLines,5),z,A,B,D,U=h===2?c.fontMetrics(p.style.fontSize).b:0;a.hasData=k=a.hasVisibleSeries||t(a.min)&&t(a.max)&&!!e;a.showAxis=b=k||o(d.showEmpty,!0);a.staggerLines=a.horiz&&p.staggerLines;if(!a.axisGroup)a.gridGroup=c.g("grid").attr({zIndex:d.gridZIndex||1}).add(),a.axisGroup=c.g("axis").attr({zIndex:d.zIndex||2}).add(), -a.labelGroup=c.g("axis-labels").attr({zIndex:p.zIndex||7}).addClass("highcharts-"+a.coll.toLowerCase()+"-labels").add();if(k||a.isLinked){a.labelAlign=o(p.align||a.autoLabelAlign(p.rotation));q(e,function(b){f[b]?f[b].addLabel():f[b]=new Za(a,b)});if(a.horiz&&!a.staggerLines&&y&&!p.rotation){for(s=a.reversed?[].concat(e).reverse():e;v1)a.staggerLines=v}q(e,function(b){if(h===0||h===2||{1:"left",3:"right"}[h]===a.labelAlign)u=w(f[b].getLabelSize(),u)});if(a.staggerLines)u*=a.staggerLines,a.labelOffset=u}else for(s in f)f[s].destroy(),delete f[s];if(n&&n.text&&n.enabled!==!1){if(!a.axisTitle)a.axisTitle=c.text(n.text,0,0,n.useHTML).attr({zIndex:7,rotation:n.rotation||0,align:n.textAlign||{low:"left",middle:"center",high:"right"}[n.align]}).addClass("highcharts-"+this.coll.toLowerCase()+"-title").css(n.style).add(a.axisGroup), -a.axisTitle.isNew=!0;if(b)j=a.axisTitle.getBBox()[g?"height":"width"],m=o(n.margin,g?5:10),l=n.offset;a.axisTitle[b?"show":"hide"]()}a.offset=x*o(d.offset,Db[h]);a.axisTitleMargin=o(l,u+m+(u&&x*d.labels[g?"y":"x"]-U));Db[h]=w(Db[h],a.axisTitleMargin+j+x*a.offset);G[i]=w(G[i],S(d.lineWidth/2)*2)},getLinePath:function(a){var b=this.chart,c=this.opposite,d=this.offset,e=this.horiz,f=this.left+(c?this.width:0)+d,d=b.chartHeight-this.bottom-(c?this.height:0)+d;c&&(a*=-1);return b.renderer.crispLine(["M", -e?this.left:f,e?d:this.top,"L",e?b.chartWidth-this.right:f,e?d:b.chartHeight-this.bottom],a)},getTitlePosition:function(){var a=this.horiz,b=this.left,c=this.top,d=this.len,e=this.options.title,f=a?b:c,g=this.opposite,h=this.offset,i=I(e.style.fontSize||12),d={low:f+(a?0:d),middle:f+d/2,high:f+(a?d:0)}[e.align],b=(a?c+this.height:b)+(a?1:-1)*(g?-1:1)*this.axisTitleMargin+(this.side===2?i:0);return{x:a?d:b+(g?this.width:0)+h+(e.x||0),y:a?b-(g?this.height:0)+h:d+(e.y||0)}},render:function(){var a=this, -b=a.horiz,c=a.reversed,d=a.chart,e=d.renderer,f=a.options,g=a.isLog,h=a.isLinked,i=a.tickPositions,k,j=a.axisTitle,l=a.ticks,m=a.minorTicks,n=a.alternateBands,p=f.stackLabels,u=f.alternateGridColor,o=a.tickmarkOffset,G=f.lineWidth,x=d.hasRendered&&t(a.oldMin)&&!isNaN(a.oldMin),s=a.hasData,w=a.showAxis,v,y=f.labels.overflow,z=a.justifyLabels=b&&y!==!1,A;a.labelEdge.length=0;a.justifyToPlot=y==="justify";q([l,m,n],function(a){for(var b in a)a[b].isActive=!1});if(s||h)if(a.minorTickInterval&&!a.categories&& -q(a.getMinorTickPositions(),function(b){m[b]||(m[b]=new Za(a,b,"minor"));x&&m[b].isNew&&m[b].render(null,!0);m[b].render(null,!1,1)}),i.length&&(k=i.slice(),(b&&c||!b&&!c)&&k.reverse(),z&&(k=k.slice(1).concat([k[0]])),q(k,function(b,c){z&&(c=c===k.length-1?0:c+1);if(!h||b>=a.min&&b<=a.max)l[b]||(l[b]=new Za(a,b)),x&&l[b].isNew&&l[b].render(c,!0,0.1),l[b].render(c,!1,1)}),o&&a.min===0&&(l[-1]||(l[-1]=new Za(a,-1,null,!0)),l[-1].render(-1))),u&&q(i,function(b,c){if(c%2===0&&b=H.second&&(i.setMilliseconds(0),i.setSeconds(k>=H.minute?0:j*S(i.getSeconds()/j)));if(k>=H.minute)i[Nb](k>= -H.hour?0:j*S(i[ub]()/j));if(k>=H.hour)i[Ob](k>=H.day?0:j*S(i[vb]()/j));if(k>=H.day)i[xb](k>=H.month?1:j*S(i[Ua]()/j));k>=H.month&&(i[Pb](k>=H.year?0:j*S(i[jb]()/j)),h=i[kb]());k>=H.year&&(h-=h%j,i[Qb](h));if(k===H.week)i[xb](i[Ua]()-i[wb]()+o(d,1));b=1;La&&(i=new Date(i.getTime()+La));h=i[kb]();for(var d=i.getTime(),l=i[jb](),m=i[Ua](),n=g?La:(864E5+i.getTimezoneOffset()*6E4)%864E5;d=0.5)a=s(a),g=this.getLinearTickPositions(a,b,c);else if(a>=0.08)for(var f=S(b),h,i,k,j,l,e=a>0.3?[1,2,4]:a>0.15?[1,2,4,6,8]:[1,2,3,4,5,6,7,8,9];fb&&(!d|| -j<=c)&&g.push(j),j>c&&(l=!0),j=k}else if(b=oa(b),c=oa(c),a=e[d?"minorTickInterval":"tickInterval"],a=o(a==="auto"?null:a,this._minorAutoInterval,(c-b)*(e.tickPixelInterval/(d?5:1))/((d?f/this.tickPositions.length:f)||1)),a=sb(a,null,rb(a)),g=xa(this.getLinearTickPositions(a,b,c),Ga),!d)this._minorAutoInterval=a/5;if(!d)this.tickInterval=a;return g};var Hb=P.Tooltip=function(){this.init.apply(this,arguments)};Hb.prototype={init:function(a,b){var c=b.borderWidth,d=b.style,e=I(d.padding);this.chart= -a;this.options=b;this.crosshairs=[];this.now={x:0,y:0};this.isHidden=!0;this.label=a.renderer.label("",0,0,b.shape||"callout",null,null,b.useHTML,null,"tooltip").attr({padding:e,fill:b.backgroundColor,"stroke-width":c,r:b.borderRadius,zIndex:8}).css(d).css({padding:0}).add().attr({y:-9999});ja||this.label.shadow(b.shadow);this.shared=b.shared},destroy:function(){if(this.label)this.label=this.label.destroy();clearTimeout(this.hideTimer);clearTimeout(this.tooltipTimeout)},move:function(a,b,c,d){var e= -this,f=e.now,g=e.options.animation!==!1&&!e.isHidden,h=e.followPointer||e.len>1;v(f,{x:g?(2*f.x+a)/3:a,y:g?(f.y+b)/2:b,anchorX:h?r:g?(2*f.anchorX+c)/3:c,anchorY:h?r:g?(f.anchorY+d)/2:d});e.label.attr(f);if(g&&(M(a-f.x)>1||M(b-f.y)>1))clearTimeout(this.tooltipTimeout),this.tooltipTimeout=setTimeout(function(){e&&e.move(a,b,c,d)},32)},hide:function(){var a=this,b;clearTimeout(this.hideTimer);if(!this.isHidden)b=this.chart.hoverPoints,this.hideTimer=setTimeout(function(){a.label.fadeOut();a.isHidden= -!0},o(this.options.hideDelay,500)),b&&q(b,function(a){a.setState()}),this.chart.hoverPoints=null},getAnchor:function(a,b){var c,d=this.chart,e=d.inverted,f=d.plotTop,g=0,h=0,i,a=ma(a);c=a[0].tooltipPos;this.followPointer&&b&&(b.chartX===r&&(b=d.pointer.normalize(b)),c=[b.chartX-d.plotLeft,b.chartY-f]);c||(q(a,function(a){i=a.series.yAxis;g+=a.plotX;h+=(a.plotLow?(a.plotLow+a.plotHigh)/2:a.plotY)+(!e&&i?i.top-f:0)}),g/=a.length,h/=a.length,c=[e?d.plotWidth-h:g,this.shared&&!e&&a.length>1&&b?b.chartY- -f:e?d.plotHeight-g:h]);return xa(c,s)},getPosition:function(a,b,c){var d=this.chart,e=this.distance,f={},g,h=["y",d.chartHeight,b,c.plotY+d.plotTop],i=["x",d.chartWidth,a,c.plotX+d.plotLeft],k=c.ttBelow||d.inverted&&!c.negative||!d.inverted&&c.negative,j=function(a,b,c,d){var g=cb-e)return!1;else f[a]=db-c/2?b-c-2:d-c/2},m=function(a){var b=h;h=i; -i=b;g=a},n=function(){j.apply(0,h)!==!1?l.apply(0,i)===!1&&!g&&(m(!0),n()):g?f.x=f.y=0:(m(!0),n())};(d.inverted||this.len>1)&&m();n();return f},defaultFormatter:function(a){var b=this.points||ma(this),c=b[0].series,d;d=[a.tooltipHeaderFormatter(b[0])];q(b,function(a){c=a.series;d.push(c.tooltipFormatter&&c.tooltipFormatter(a)||a.point.tooltipFormatter(c.tooltipOptions.pointFormat))});d.push(a.options.footerFormat||"");return d.join("")},refresh:function(a,b){var c=this.chart,d=this.label,e=this.options, -f,g,h={},i,k=[];i=e.formatter||this.defaultFormatter;var h=c.hoverPoints,j,l=this.shared;clearTimeout(this.hideTimer);this.followPointer=ma(a)[0].series.tooltipOptions.followPointer;g=this.getAnchor(a,b);f=g[0];g=g[1];l&&(!a.series||!a.series.noSharedTooltip)?(c.hoverPoints=a,h&&q(h,function(a){a.setState()}),q(a,function(a){a.setState("hover");k.push(a.getLabelConfig())}),h={x:a[0].category,y:a[0].y},h.points=k,this.len=k.length,a=a[0]):h=a.getLabelConfig();i=i.call(h,this);h=a.series;this.distance= -o(h.tooltipOptions.distance,16);i===!1?this.hide():(this.isHidden&&(eb(d),d.attr("opacity",1).show()),d.attr({text:i}),j=e.borderColor||a.color||h.color||"#606060",d.attr({stroke:j}),this.updatePosition({plotX:f,plotY:g,negative:a.negative,ttBelow:a.ttBelow}),this.isHidden=!1);N(c,"tooltipRefresh",{text:i,x:f+c.plotLeft,y:g+c.plotTop,borderColor:j})},updatePosition:function(a){var b=this.chart,c=this.label,c=(this.options.positioner||this.getPosition).call(this,c.width,c.height,a);this.move(s(c.x), -s(c.y),a.plotX+b.plotLeft,a.plotY+b.plotTop)},tooltipHeaderFormatter:function(a){var b=a.series,c=b.tooltipOptions,d=c.dateTimeLabelFormats,e=c.xDateFormat,f=b.xAxis,g=f&&f.options.type==="datetime"&&la(a.key),c=c.headerFormat,f=f&&f.closestPointRange,h;if(g&&!e){if(f)for(h in H){if(H[h]>=f||H[h]<=H.day&&a.key%H[h]>0){e=d[h];break}}else e=d.day;e=e||d.year}g&&e&&(c=c.replace("{point.key}","{point.key:"+e+"}"));return Ja(c,{point:a,series:b})}};var sa;ab=B.documentElement.ontouchstart!==r;var Xa=P.Pointer= -function(a,b){this.init(a,b)};Xa.prototype={init:function(a,b){var c=b.chart,d=c.events,e=ja?"":c.zoomType,c=a.inverted,f;this.options=b;this.chart=a;this.zoomX=f=/x/.test(e);this.zoomY=e=/y/.test(e);this.zoomHor=f&&!c||e&&c;this.zoomVert=e&&!c||f&&c;this.hasZoom=f||e;this.runChartClick=d&&!!d.click;this.pinchDown=[];this.lastValidTouch={};if(P.Tooltip&&b.tooltip.enabled)a.tooltip=new Hb(a,b.tooltip),this.followTouchMove=b.tooltip.followTouchMove;this.setDOMEvents()},normalize:function(a,b){var c, -d,a=a||window.event,a=cc(a);if(!a.target)a.target=a.srcElement;d=a.touches?a.touches.length?a.touches.item(0):a.changedTouches[0]:a;if(!b)this.chartPosition=b=bc(this.chart.container);d.pageX===r?(c=w(a.x,a.clientX-b.left),d=a.y):(c=d.pageX-b.left,d=d.pageY-b.top);return v(a,{chartX:s(c),chartY:s(d)})},getCoordinates:function(a){var b={xAxis:[],yAxis:[]};q(this.chart.axes,function(c){b[c.isXAxis?"xAxis":"yAxis"].push({axis:c,value:c.toValue(a[c.horiz?"chartX":"chartY"])})});return b},getIndex:function(a){var b= -this.chart;return b.inverted?b.plotHeight+b.plotTop-a.chartY:a.chartX-b.plotLeft},runPointActions:function(a){var b=this.chart,c=b.series,d=b.tooltip,e,f,g=b.hoverPoint,h=b.hoverSeries,i,k,j=b.chartWidth,l=this.getIndex(a);if(d&&this.options.tooltip.shared&&(!h||!h.noSharedTooltip)){f=[];i=c.length;for(k=0;kj&&f.splice(i,1);if(f.length&&f[0].clientX!==this.hoverX)d.refresh(f,a),this.hoverX=f[0].clientX}c=h&&h.tooltipOptions.followPointer;if(h&&h.tracker&&!c){if((e=h.tooltipPoints[l])&&e!==g)e.onMouseOver(a)}else d&&c&&!d.isHidden&&(h=d.getAnchor([{}],a),d.updatePosition({plotX:h[0],plotY:h[1]}));if(d&&!this._onDocumentMouseMove)this._onDocumentMouseMove=function(a){if(aa[sa])aa[sa].pointer.onDocumentMouseMove(a)},A(B,"mousemove",this._onDocumentMouseMove); -q(b.axes,function(b){b.drawCrosshair(a,o(e,g))})},reset:function(a){var b=this.chart,c=b.hoverSeries,d=b.hoverPoint,e=b.tooltip,f=e&&e.shared?b.hoverPoints:d;(a=a&&e&&f)&&ma(f)[0].plotX===r&&(a=!1);if(a)e.refresh(f),d&&d.setState(d.state,!0);else{if(d)d.onMouseOut();if(c)c.onMouseOut();e&&e.hide();if(this._onDocumentMouseMove)R(B,"mousemove",this._onDocumentMouseMove),this._onDocumentMouseMove=null;q(b.axes,function(a){a.hideCrosshair()});this.hoverX=null}},scaleGroups:function(a,b){var c=this.chart, -d;q(c.series,function(e){d=a||e.getPlotBox();e.xAxis&&e.xAxis.zoomEnabled&&(e.group.attr(d),e.markerGroup&&(e.markerGroup.attr(d),e.markerGroup.clip(b?c.clipRect:null)),e.dataLabelsGroup&&e.dataLabelsGroup.attr(d))});c.clipRect.attr(b||c.clipBox)},dragStart:function(a){var b=this.chart;b.mouseIsDown=a.type;b.cancelClick=!1;b.mouseDownX=this.mouseDownX=a.chartX;b.mouseDownY=this.mouseDownY=a.chartY},drag:function(a){var b=this.chart,c=b.options.chart,d=a.chartX,e=a.chartY,f=this.zoomHor,g=this.zoomVert, -h=b.plotLeft,i=b.plotTop,k=b.plotWidth,j=b.plotHeight,l,m=this.mouseDownX,n=this.mouseDownY;dh+k&&(d=h+k);ei+j&&(e=i+j);this.hasDragged=Math.sqrt(Math.pow(m-d,2)+Math.pow(n-e,2));if(this.hasDragged>10){l=b.isInsidePlot(m-h,n-i);if(b.hasCartesianSeries&&(this.zoomX||this.zoomY)&&l&&!this.selectionMarker)this.selectionMarker=b.renderer.rect(h,i,f?1:k,g?1:j,0).attr({fill:c.selectionMarkerFill||"rgba(69,114,167,0.25)",zIndex:7}).add();this.selectionMarker&&f&&(d-=m,this.selectionMarker.attr({width:M(d), -x:(d>0?0:d)+m}));this.selectionMarker&&g&&(d=e-n,this.selectionMarker.attr({height:M(d),y:(d>0?0:d)+n}));l&&!this.selectionMarker&&c.panning&&b.pan(a,c.panning)}},drop:function(a){var b=this.chart,c=this.hasPinched;if(this.selectionMarker){var d={xAxis:[],yAxis:[],originalEvent:a.originalEvent||a},a=this.selectionMarker,e=a.attr?a.attr("x"):a.x,f=a.attr?a.attr("y"):a.y,g=a.attr?a.attr("width"):a.width,h=a.attr?a.attr("height"):a.height,i;if(this.hasDragged||c)q(b.axes,function(a){if(a.zoomEnabled){var b= -a.horiz,c=a.toValue(b?e:f),b=a.toValue(b?e+g:f+h);!isNaN(c)&&!isNaN(b)&&(d[a.coll].push({axis:a,min:z(c,b),max:w(c,b)}),i=!0)}}),i&&N(b,"selection",d,function(a){b.zoom(v(a,c?{animation:!1}:null))});this.selectionMarker=this.selectionMarker.destroy();c&&this.scaleGroups()}if(b)E(b.container,{cursor:b._cursor}),b.cancelClick=this.hasDragged>10,b.mouseIsDown=this.hasDragged=this.hasPinched=!1,this.pinchDown=[]},onContainerMouseDown:function(a){a=this.normalize(a);a.preventDefault&&a.preventDefault(); -this.dragStart(a)},onDocumentMouseUp:function(a){aa[sa]&&aa[sa].pointer.drop(a)},onDocumentMouseMove:function(a){var b=this.chart,c=this.chartPosition,d=b.hoverSeries,a=this.normalize(a,c);c&&d&&!this.inClass(a.target,"highcharts-tracker")&&!b.isInsidePlot(a.chartX-b.plotLeft,a.chartY-b.plotTop)&&this.reset()},onContainerMouseLeave:function(){var a=aa[sa];if(a)a.pointer.reset(),a.pointer.chartPosition=null},onContainerMouseMove:function(a){var b=this.chart;sa=b.index;a=this.normalize(a);b.mouseIsDown=== -"mousedown"&&this.drag(a);(this.inClass(a.target,"highcharts-tracker")||b.isInsidePlot(a.chartX-b.plotLeft,a.chartY-b.plotTop))&&!b.openMenu&&this.runPointActions(a)},inClass:function(a,b){for(var c;a;){if(c=W(a,"class"))if(c.indexOf(b)!==-1)return!0;else if(c.indexOf("highcharts-container")!==-1)return!1;a=a.parentNode}},onTrackerMouseOut:function(a){var b=this.chart.hoverSeries,c=(a=a.relatedTarget||a.toElement)&&a.point&&a.point.series;if(b&&!b.options.stickyTracking&&!this.inClass(a,"highcharts-tooltip")&& -c!==b)b.onMouseOut()},onContainerClick:function(a){var b=this.chart,c=b.hoverPoint,d=b.plotLeft,e=b.plotTop,a=this.normalize(a);a.cancelBubble=!0;b.cancelClick||(c&&this.inClass(a.target,"highcharts-tracker")?(N(c.series,"click",v(a,{point:c})),b.hoverPoint&&c.firePointEvent("click",a)):(v(a,this.getCoordinates(a)),b.isInsidePlot(a.chartX-d,a.chartY-e)&&N(b,"click",a)))},setDOMEvents:function(){var a=this,b=a.chart.container;b.onmousedown=function(b){a.onContainerMouseDown(b)};b.onmousemove=function(b){a.onContainerMouseMove(b)}; -b.onclick=function(b){a.onContainerClick(b)};A(b,"mouseleave",a.onContainerMouseLeave);db===1&&A(B,"mouseup",a.onDocumentMouseUp);if(ab)b.ontouchstart=function(b){a.onContainerTouchStart(b)},b.ontouchmove=function(b){a.onContainerTouchMove(b)},db===1&&A(B,"touchend",a.onDocumentTouchEnd)},destroy:function(){var a;R(this.chart.container,"mouseleave",this.onContainerMouseLeave);db||(R(B,"mouseup",this.onDocumentMouseUp),R(B,"touchend",this.onDocumentTouchEnd));clearInterval(this.tooltipTimeout);for(a in this)this[a]= -null}};v(P.Pointer.prototype,{pinchTranslate:function(a,b,c,d,e,f){(this.zoomHor||this.pinchHor)&&this.pinchTranslateDirection(!0,a,b,c,d,e,f);(this.zoomVert||this.pinchVert)&&this.pinchTranslateDirection(!1,a,b,c,d,e,f)},pinchTranslateDirection:function(a,b,c,d,e,f,g,h){var i=this.chart,k=a?"x":"y",j=a?"X":"Y",l="chart"+j,m=a?"width":"height",n=i["plot"+(a?"Left":"Top")],p,u,o=h||1,q=i.inverted,x=i.bounds[a?"h":"v"],r=b.length===1,s=b[0][l],t=c[0][l],w=!r&&b[1][l],v=!r&&c[1][l],y,c=function(){!r&& -M(s-w)>20&&(o=h||M(t-v)/M(s-w));u=(n-t)/o+s;p=i["plot"+(a?"Width":"Height")]/o};c();b=u;bx.max&&(b=x.max-p,y=!0);y?(t-=0.8*(t-g[k][0]),r||(v-=0.8*(v-g[k][1])),c()):g[k]=[t,v];q||(f[k]=u-n,f[m]=p);f=q?1/o:o;e[m]=p;e[k]=b;d[q?a?"scaleY":"scaleX":"scale"+j]=o;d["translate"+j]=f*n+(t-f*s)},pinch:function(a){var b=this,c=b.chart,d=b.pinchDown,e=b.followTouchMove,f=a.touches,g=f.length,h=b.lastValidTouch,i=b.hasZoom,k=b.selectionMarker,j={},l=g===1&&(b.inClass(a.target,"highcharts-tracker")&& -c.runTrackerClick||c.runChartClick),m={};(i||e)&&!l&&a.preventDefault();xa(f,function(a){return b.normalize(a)});if(a.type==="touchstart")q(f,function(a,b){d[b]={chartX:a.chartX,chartY:a.chartY}}),h.x=[d[0].chartX,d[1]&&d[1].chartX],h.y=[d[0].chartY,d[1]&&d[1].chartY],q(c.axes,function(a){if(a.zoomEnabled){var b=c.bounds[a.horiz?"h":"v"],d=a.minPixelPadding,e=a.toPixels(a.dataMin),f=a.toPixels(a.dataMax),g=z(e,f),e=w(e,f);b.min=z(a.pos,g-d);b.max=w(a.pos+a.len,e+d)}});else if(d.length){if(!k)b.selectionMarker= -k=v({destroy:na},c.plotBox);b.pinchTranslate(d,f,j,k,m,h);b.hasPinched=i;b.scaleGroups(j,m);!i&&e&&g===1&&this.runPointActions(b.normalize(a))}},onContainerTouchStart:function(a){var b=this.chart;sa=b.index;a.touches.length===1?(a=this.normalize(a),b.isInsidePlot(a.chartX-b.plotLeft,a.chartY-b.plotTop)?(this.runPointActions(a),this.pinch(a)):this.reset()):a.touches.length===2&&this.pinch(a)},onContainerTouchMove:function(a){(a.touches.length===1||a.touches.length===2)&&this.pinch(a)},onDocumentTouchEnd:function(a){aa[sa]&& -aa[sa].pointer.drop(a)}});if(X.PointerEvent||X.MSPointerEvent){var ya={},Ib=!!X.PointerEvent,gc=function(){var a,b=[];b.item=function(a){return this[a]};for(a in ya)ya.hasOwnProperty(a)&&b.push({pageX:ya[a].pageX,pageY:ya[a].pageY,target:ya[a].target});return b},Jb=function(a,b,c,d){a=a.originalEvent||a;if((a.pointerType==="touch"||a.pointerType===a.MSPOINTER_TYPE_TOUCH)&&aa[sa])d(a),d=aa[sa].pointer,d[b]({type:c,target:a.currentTarget,preventDefault:na,touches:gc()})};v(Xa.prototype,{onContainerPointerDown:function(a){Jb(a, -"onContainerTouchStart","touchstart",function(a){ya[a.pointerId]={pageX:a.pageX,pageY:a.pageY,target:a.currentTarget}})},onContainerPointerMove:function(a){Jb(a,"onContainerTouchMove","touchmove",function(a){ya[a.pointerId]={pageX:a.pageX,pageY:a.pageY};if(!ya[a.pointerId].target)ya[a.pointerId].target=a.currentTarget})},onDocumentPointerUp:function(a){Jb(a,"onContainerTouchEnd","touchend",function(a){delete ya[a.pointerId]})},batchMSEvents:function(a){a(this.chart.container,Ib?"pointerdown":"MSPointerDown", -this.onContainerPointerDown);a(this.chart.container,Ib?"pointermove":"MSPointerMove",this.onContainerPointerMove);a(B,Ib?"pointerup":"MSPointerUp",this.onDocumentPointerUp)}});O(Xa.prototype,"init",function(a,b,c){a.call(this,b,c);(this.hasZoom||this.followTouchMove)&&E(b.container,{"-ms-touch-action":Y,"touch-action":Y})});O(Xa.prototype,"setDOMEvents",function(a){a.apply(this);(this.hasZoom||this.followTouchMove)&&this.batchMSEvents(A)});O(Xa.prototype,"destroy",function(a){this.batchMSEvents(R); -a.call(this)})}var pb=P.Legend=function(a,b){this.init(a,b)};pb.prototype={init:function(a,b){var c=this,d=b.itemStyle,e=o(b.padding,8),f=b.itemMarginTop||0;this.options=b;if(b.enabled)c.baseline=I(d.fontSize)+3+f,c.itemStyle=d,c.itemHiddenStyle=y(d,b.itemHiddenStyle),c.itemMarginTop=f,c.padding=e,c.initialItemX=e,c.initialItemY=e-5,c.maxItemWidth=0,c.chart=a,c.itemHeight=0,c.lastLineHeight=0,c.symbolWidth=o(b.symbolWidth,16),c.pages=[],c.render(),A(c.chart,"endResize",function(){c.positionCheckboxes()})}, -colorizeItem:function(a,b){var c=this.options,d=a.legendItem,e=a.legendLine,f=a.legendSymbol,g=this.itemHiddenStyle.color,c=b?c.itemStyle.color:g,h=b?a.legendColor||a.color||"#CCC":g,g=a.options&&a.options.marker,i={fill:h},k;d&&d.css({fill:c,color:c});e&&e.attr({stroke:h});if(f){if(g&&f.isMarker)for(k in i.stroke=h,g=a.convertAttribs(g),g)d=g[k],d!==r&&(i[k]=d);f.attr(i)}},positionItem:function(a){var b=this.options,c=b.symbolPadding,b=!b.rtl,d=a._legendItemPos,e=d[0],d=d[1],f=a.checkbox;a.legendGroup&& -a.legendGroup.translate(b?e:this.legendWidth-e-2*c-4,d);if(f)f.x=e,f.y=d},destroyItem:function(a){var b=a.checkbox;q(["legendItem","legendLine","legendSymbol","legendGroup"],function(b){a[b]&&(a[b]=a[b].destroy())});b&&Sa(a.checkbox)},destroy:function(){var a=this.group,b=this.box;if(b)this.box=b.destroy();if(a)this.group=a.destroy()},positionCheckboxes:function(a){var b=this.group.alignAttr,c,d=this.clipHeight||this.legendHeight;if(b)c=b.translateY,q(this.allItems,function(e){var f=e.checkbox,g; -f&&(g=c+f.y+(a||0)+3,E(f,{left:b.translateX+e.checkboxOffset+f.x-20+"px",top:g+"px",display:g>c-6&&g(m||b.chartWidth-2*k-u-d.x))this.itemX=u,this.itemY+= -p+this.lastLineHeight+n,this.lastLineHeight=0;this.maxItemWidth=w(this.maxItemWidth,f);this.lastItemY=p+this.itemY+n;this.lastLineHeight=w(g,this.lastLineHeight);a._legendItemPos=[this.itemX,this.itemY];e?this.itemX+=f:(this.itemY+=p+g+n,this.lastLineHeight=g);this.offsetWidth=m||w((e?this.itemX-u-j:f)+k,this.offsetWidth)},getAllItems:function(){var a=[];q(this.chart.series,function(b){var c=b.options;if(o(c.showInLegend,!t(c.linkedTo)?r:!1,!0))a=a.concat(b.legendItems||(c.legendType==="point"?b.data: -b))});return a},render:function(){var a=this,b=a.chart,c=b.renderer,d=a.group,e,f,g,h,i=a.box,k=a.options,j=a.padding,l=k.borderWidth,m=k.backgroundColor;a.itemX=a.initialItemX;a.itemY=a.initialItemY;a.offsetWidth=0;a.lastItemY=0;if(!d)a.group=d=c.g("legend").attr({zIndex:7}).add(),a.contentGroup=c.g().attr({zIndex:1}).add(d),a.scrollGroup=c.g().add(a.contentGroup);a.renderTitle();e=a.getAllItems();tb(e,function(a,b){return(a.options&&a.options.legendIndex||0)-(b.options&&b.options.legendIndex||0)}); -k.reversed&&e.reverse();a.allItems=e;a.display=f=!!e.length;q(e,function(b){a.renderItem(b)});g=k.width||a.offsetWidth;h=a.lastItemY+a.lastLineHeight+a.titleHeight;h=a.handleOverflow(h);if(l||m){g+=j;h+=j;if(i){if(g>0&&h>0)i[i.isNew?"attr":"animate"](i.crisp({width:g,height:h})),i.isNew=!1}else a.box=i=c.rect(0,0,g,h,k.borderRadius,l||0).attr({stroke:k.borderColor,"stroke-width":l||0,fill:m||Y}).add(d).shadow(k.shadow),i.isNew=!0;i[f?"show":"hide"]()}a.legendWidth=g;a.legendHeight=h;q(e,function(b){a.positionItem(b)}); -f&&d.align(v({width:g,height:h},k),!0,"spacingBox");b.isResizing||this.positionCheckboxes()},handleOverflow:function(a){var b=this,c=this.chart,d=c.renderer,e=this.options,f=e.y,f=c.spacingBox.height+(e.verticalAlign==="top"?-f:f)-this.padding,g=e.maxHeight,h,i=this.clipRect,k=e.navigation,j=o(k.animation,!0),l=k.arrowSize||12,m=this.nav,n=this.pages,p,u=this.allItems;e.layout==="horizontal"&&(f/=2);g&&(f=z(f,g));n.length=0;if(a>f&&!e.useHTML){this.clipHeight=h=f-20-this.titleHeight-this.padding; -this.currentPage=o(this.currentPage,1);this.fullHeight=a;q(u,function(a,b){var c=a._legendItemPos[1],d=s(a.legendItem.getBBox().height),e=n.length;if(!e||c-n[e-1]>h&&(p||c)!==n[e-1])n.push(p||c),e++;b===u.length-1&&c+d-n[e-1]>h&&n.push(c);c!==p&&(p=c)});if(!i)i=b.clipRect=d.clipRect(0,this.padding,9999,0),b.contentGroup.clip(i);i.attr({height:h});if(!m)this.nav=m=d.g().attr({zIndex:1}).add(this.group),this.up=d.symbol("triangle",0,0,l,l).on("click",function(){b.scroll(-1,j)}).add(m),this.pager=d.text("", -15,10).css(k.style).add(m),this.down=d.symbol("triangle-down",0,0,l,l).on("click",function(){b.scroll(1,j)}).add(m);b.scroll(0);a=f}else if(m)i.attr({height:c.chartHeight}),m.hide(),this.scrollGroup.attr({translateY:1}),this.clipHeight=0;return a},scroll:function(a,b){var c=this.pages,d=c.length,e=this.currentPage+a,f=this.clipHeight,g=this.options.navigation,h=g.activeColor,g=g.inactiveColor,i=this.pager,k=this.padding;e>d&&(e=d);if(e>0)b!==r&&Ya(b,this.chart),this.nav.attr({translateX:k,translateY:f+ -this.padding+7+this.titleHeight,visibility:"visible"}),this.up.attr({fill:e===1?g:h}).css({cursor:e===1?"default":"pointer"}),i.attr({text:e+"/"+d}),this.down.attr({x:18+this.pager.getBBox().width,fill:e===d?g:h}).css({cursor:e===d?"default":"pointer"}),c=-c[e-1]+this.initialItemY,this.scrollGroup.animate({translateY:c}),this.currentPage=e,this.positionCheckboxes(c)}};Q=P.LegendSymbolMixin={drawRectangle:function(a,b){var c=a.options.symbolHeight||12;b.legendSymbol=this.chart.renderer.rect(0,a.baseline- -5-c/2,a.symbolWidth,c,a.options.symbolRadius||0).attr({zIndex:3}).add(b.legendGroup)},drawLineMarker:function(a){var b=this.options,c=b.marker,d;d=a.symbolWidth;var e=this.chart.renderer,f=this.legendGroup,a=a.baseline-s(e.fontMetrics(a.options.itemStyle.fontSize).b*0.3),g;if(b.lineWidth){g={"stroke-width":b.lineWidth};if(b.dashStyle)g.dashstyle=b.dashStyle;this.legendLine=e.path(["M",0,a,"L",d,a]).attr(g).add(f)}if(c&&c.enabled!==!1)b=c.radius,this.legendSymbol=d=e.symbol(this.symbol,d/2-b,a-b,2* -b,2*b).add(f),d.isMarker=!0}};(/Trident\/7\.0/.test(Da)||$a)&&O(pb.prototype,"positionItem",function(a,b){var c=this,d=function(){b._legendItemPos&&a.call(c,b)};d();setTimeout(d)});va.prototype={init:function(a,b){var c,d=a.series;a.series=null;c=y(F,a);c.series=a.series=d;this.userOptions=a;d=c.chart;this.margin=this.splashArray("margin",d);this.spacing=this.splashArray("spacing",d);var e=d.events;this.bounds={h:{},v:{}};this.callback=b;this.isResizing=0;this.options=c;this.axes=[];this.series=[]; -this.hasCartesianSeries=d.showAxes;var f=this,g;f.index=aa.length;aa.push(f);db++;d.reflow!==!1&&A(f,"load",function(){f.initReflow()});if(e)for(g in e)A(f,g,e[g]);f.xAxis=[];f.yAxis=[];f.animation=ja?!1:o(d.animation,!0);f.pointCount=0;f.counters=new Lb;f.firstRender()},initSeries:function(a){var b=this.options.chart;(b=C[a.type||b.type||b.defaultSeriesType])||qa(17,!0);b=new b;b.init(this,a);return b},isInsidePlot:function(a,b,c){var d=c?b:a,a=c?a:b;return d>=0&&d<=this.plotWidth&&a>=0&&a<=this.plotHeight}, -adjustTickAmounts:function(){this.options.chart.alignTicks!==!1&&q(this.axes,function(a){a.adjustTickAmount()});this.maxTicks=null},redraw:function(a){var b=this.axes,c=this.series,d=this.pointer,e=this.legend,f=this.isDirtyLegend,g,h,i=this.isDirtyBox,k=c.length,j=k,l=this.renderer,m=l.isHidden(),n=[];Ya(a,this);m&&this.cloneRenderTo();for(this.layOutTitles();j--;)if(a=c[j],a.options.stacking&&(g=!0,a.isDirty)){h=!0;break}if(h)for(j=k;j--;)if(a=c[j],a.options.stacking)a.isDirty=!0;q(c,function(a){a.isDirty&& -a.options.legendType==="point"&&(f=!0)});if(f&&e.options.enabled)e.render(),this.isDirtyLegend=!1;g&&this.getStacks();if(this.hasCartesianSeries){if(!this.isResizing)this.maxTicks=null,q(b,function(a){a.setScale()});this.adjustTickAmounts();this.getMargins();q(b,function(a){a.isDirty&&(i=!0)});q(b,function(a){if(a.isDirtyExtremes)a.isDirtyExtremes=!1,n.push(function(){N(a,"afterSetExtremes",v(a.eventArgs,a.getExtremes()));delete a.eventArgs});(i||g)&&a.redraw()})}i&&this.drawChartBox();q(c,function(a){a.isDirty&& -a.visible&&(!a.isCartesian||a.xAxis)&&a.redraw()});d&&d.reset(!0);l.draw();N(this,"redraw");m&&this.cloneRenderTo(!0);q(n,function(a){a.call()})},get:function(a){var b=this.axes,c=this.series,d,e;for(d=0;d19?this.containerHeight:400))},cloneRenderTo:function(a){var b=this.renderToClone,c=this.container;a?b&&(this.renderTo.appendChild(c),Sa(b),delete this.renderToClone):(c&&c.parentNode===this.renderTo&&this.renderTo.removeChild(c), -this.renderToClone=b=this.renderTo.cloneNode(0),E(b,{position:"absolute",top:"-9999px",display:"block"}),b.style.setProperty&&b.style.setProperty("display","block","important"),B.body.appendChild(b),c&&b.appendChild(c))},getContainer:function(){var a,b=this.options.chart,c,d,e;this.renderTo=a=b.renderTo;e="highcharts-"+Ab++;if(Oa(a))this.renderTo=a=B.getElementById(a);a||qa(13,!0);c=I(W(a,"data-highcharts-chart"));!isNaN(c)&&aa[c]&&aa[c].hasRendered&&aa[c].destroy();W(a,"data-highcharts-chart",this.index); -a.innerHTML="";!b.skipClone&&!a.offsetWidth&&this.cloneRenderTo();this.getChartSize();c=this.chartWidth;d=this.chartHeight;this.container=a=$(Ta,{className:"highcharts-container"+(b.className?" "+b.className:""),id:e},v({position:"relative",overflow:"hidden",width:c+"px",height:d+"px",textAlign:"left",lineHeight:"normal",zIndex:0,"-webkit-tap-highlight-color":"rgba(0,0,0,0)"},b.style),this.renderToClone||a);this._cursor=a.style.cursor;this.renderer=b.forExport?new ka(a,c,d,b.style,!0):new Wa(a,c, -d,b.style);ja&&this.renderer.create(this,a,c,d)},getMargins:function(){var a=this.spacing,b,c=this.legend,d=this.margin,e=this.options.legend,f=o(e.margin,20),g=e.x,h=e.y,i=e.align,k=e.verticalAlign,j=this.titleOffset;this.resetMargins();b=this.axisOffset;if(j&&!t(d[0]))this.plotTop=w(this.plotTop,j+this.options.title.margin+a[0]);if(c.display&&!e.floating)if(i==="right"){if(!t(d[1]))this.marginRight=w(this.marginRight,c.legendWidth-g+f+a[1])}else if(i==="left"){if(!t(d[3]))this.plotLeft=w(this.plotLeft, -c.legendWidth+g+f+a[3])}else if(k==="top"){if(!t(d[0]))this.plotTop=w(this.plotTop,c.legendHeight+h+f+a[0])}else if(k==="bottom"&&!t(d[2]))this.marginBottom=w(this.marginBottom,c.legendHeight-h+f+a[2]);this.extraBottomMargin&&(this.marginBottom+=this.extraBottomMargin);this.extraTopMargin&&(this.plotTop+=this.extraTopMargin);this.hasCartesianSeries&&q(this.axes,function(a){a.getOffset()});t(d[3])||(this.plotLeft+=b[3]);t(d[0])||(this.plotTop+=b[0]);t(d[2])||(this.marginBottom+=b[2]);t(d[1])||(this.marginRight+= -b[1]);this.setChartSize()},reflow:function(a){var b=this,c=b.options.chart,d=b.renderTo,e=c.width||nb(d,"width"),f=c.height||nb(d,"height"),c=a?a.target:X,d=function(){if(b.container)b.setSize(e,f,!1),b.hasUserSize=null};if(!b.hasUserSize&&e&&f&&(c===X||c===B)){if(e!==b.containerWidth||f!==b.containerHeight)clearTimeout(b.reflowTimeout),a?b.reflowTimeout=setTimeout(d,100):d();b.containerWidth=e;b.containerHeight=f}},initReflow:function(){var a=this,b=function(b){a.reflow(b)};A(X,"resize",b);A(a,"destroy", -function(){R(X,"resize",b)})},setSize:function(a,b,c){var d=this,e,f,g;d.isResizing+=1;g=function(){d&&N(d,"endResize",null,function(){d.isResizing-=1})};Ya(c,d);d.oldChartHeight=d.chartHeight;d.oldChartWidth=d.chartWidth;if(t(a))d.chartWidth=e=w(0,s(a)),d.hasUserSize=!!e;if(t(b))d.chartHeight=f=w(0,s(b));(Ca?ob:E)(d.container,{width:e+"px",height:f+"px"},Ca);d.setChartSize(!0);d.renderer.setSize(e,f,c);d.maxTicks=null;q(d.axes,function(a){a.isDirty=!0;a.setScale()});q(d.series,function(a){a.isDirty= -!0});d.isDirtyLegend=!0;d.isDirtyBox=!0;d.layOutTitles();d.getMargins();d.redraw(c);d.oldChartHeight=null;N(d,"resize");Ca===!1?g():setTimeout(g,Ca&&Ca.duration||500)},setChartSize:function(a){var b=this.inverted,c=this.renderer,d=this.chartWidth,e=this.chartHeight,f=this.options.chart,g=this.spacing,h=this.clipOffset,i,k,j,l;this.plotLeft=i=s(this.plotLeft);this.plotTop=k=s(this.plotTop);this.plotWidth=j=w(0,s(d-i-this.marginRight));this.plotHeight=l=w(0,s(e-k-this.marginBottom));this.plotSizeX= -b?l:j;this.plotSizeY=b?j:l;this.plotBorderWidth=f.plotBorderWidth||0;this.spacingBox=c.spacingBox={x:g[3],y:g[0],width:d-g[3]-g[1],height:e-g[0]-g[2]};this.plotBox=c.plotBox={x:i,y:k,width:j,height:l};d=2*S(this.plotBorderWidth/2);b=Va(w(d,h[3])/2);c=Va(w(d,h[0])/2);this.clipBox={x:b,y:c,width:S(this.plotSizeX-w(d,h[1])/2-b),height:S(this.plotSizeY-w(d,h[2])/2-c)};a||q(this.axes,function(a){a.setAxisSize();a.setAxisTranslation()})},resetMargins:function(){var a=this.spacing,b=this.margin;this.plotTop= -o(b[0],a[0]);this.marginRight=o(b[1],a[1]);this.marginBottom=o(b[2],a[2]);this.plotLeft=o(b[3],a[3]);this.axisOffset=[0,0,0,0];this.clipOffset=[0,0,0,0]},drawChartBox:function(){var a=this.options.chart,b=this.renderer,c=this.chartWidth,d=this.chartHeight,e=this.chartBackground,f=this.plotBackground,g=this.plotBorder,h=this.plotBGImage,i=a.borderWidth||0,k=a.backgroundColor,j=a.plotBackgroundColor,l=a.plotBackgroundImage,m=a.plotBorderWidth||0,n,p=this.plotLeft,u=this.plotTop,o=this.plotWidth,q=this.plotHeight, -x=this.plotBox,r=this.clipRect,s=this.clipBox;n=i+(a.shadow?8:0);if(i||k)if(e)e.animate(e.crisp({width:c-n,height:d-n}));else{e={fill:k||Y};if(i)e.stroke=a.borderColor,e["stroke-width"]=i;this.chartBackground=b.rect(n/2,n/2,c-n,d-n,a.borderRadius,i).attr(e).addClass("highcharts-background").add().shadow(a.shadow)}if(j)f?f.animate(x):this.plotBackground=b.rect(p,u,o,q,0).attr({fill:j}).add().shadow(a.plotShadow);if(l)h?h.animate(x):this.plotBGImage=b.image(l,p,u,o,q).add();r?r.animate({width:s.width, -height:s.height}):this.clipRect=b.clipRect(s);if(m)g?g.animate(g.crisp({x:p,y:u,width:o,height:q})):this.plotBorder=b.rect(p,u,o,q,0,-m).attr({stroke:a.plotBorderColor,"stroke-width":m,fill:Y,zIndex:1}).add();this.isDirtyBox=!1},propFromSeries:function(){var a=this,b=a.options.chart,c,d=a.options.series,e,f;q(["inverted","angular","polar"],function(g){c=C[b.type||b.defaultSeriesType];f=a[g]||b[g]||c&&c.prototype[g];for(e=d&&d.length;!f&&e--;)(c=C[d[e].type])&&c.prototype[g]&&(f=!0);a[g]=f})},linkSeries:function(){var a= -this,b=a.series;q(b,function(a){a.linkedSeries.length=0});q(b,function(b){var d=b.options.linkedTo;if(Oa(d)&&(d=d===":previous"?a.series[b.index-1]:a.get(d)))d.linkedSeries.push(b),b.linkedParent=d})},renderSeries:function(){q(this.series,function(a){a.translate();a.setTooltipPoints&&a.setTooltipPoints();a.render()})},render:function(){var a=this,b=a.axes,c=a.renderer,d=a.options,e=d.labels,f=d.credits,g;a.setTitle();a.legend=new pb(a,d.legend);a.getStacks();q(b,function(a){a.setScale()});a.getMargins(); -a.maxTicks=null;q(b,function(a){a.setTickPositions(!0);a.setMaxTicks()});a.adjustTickAmounts();a.getMargins();a.drawChartBox();a.hasCartesianSeries&&q(b,function(a){a.render()});if(!a.seriesGroup)a.seriesGroup=c.g("series-group").attr({zIndex:3}).add();a.renderSeries();e.items&&q(e.items,function(b){var d=v(e.style,b.style),f=I(d.left)+a.plotLeft,g=I(d.top)+a.plotTop+12;delete d.left;delete d.top;c.text(b.html,f,g).attr({zIndex:2}).css(d).add()});if(f.enabled&&!a.credits)g=f.href,a.credits=c.text(f.text, -0,0).on("click",function(){if(g)location.href=g}).attr({align:f.position.align,zIndex:8}).css(f.style).add().align(f.position);a.hasRendered=!0},destroy:function(){var a=this,b=a.axes,c=a.series,d=a.container,e,f=d&&d.parentNode;N(a,"destroy");aa[a.index]=r;db--;a.renderTo.removeAttribute("data-highcharts-chart");R(a);for(e=b.length;e--;)b[e]=b[e].destroy();for(e=c.length;e--;)c[e]=c[e].destroy();q("title,subtitle,chartBackground,plotBackground,plotBGImage,plotBorder,seriesGroup,clipRect,credits,pointer,scroller,rangeSelector,legend,resetZoomButton,tooltip,renderer".split(","), -function(b){var c=a[b];c&&c.destroy&&(a[b]=c.destroy())});if(d)d.innerHTML="",R(d),f&&Sa(d);for(e in a)delete a[e]},isReadyToRender:function(){var a=this;return!ca&&X==X.top&&B.readyState!=="complete"||ja&&!X.canvg?(ja?Vb.push(function(){a.firstRender()},a.options.global.canvasToolsURL):B.attachEvent("onreadystatechange",function(){B.detachEvent("onreadystatechange",a.firstRender);B.readyState==="complete"&&a.firstRender()}),!1):!0},firstRender:function(){var a=this,b=a.options,c=a.callback;if(a.isReadyToRender()){a.getContainer(); -N(a,"init");a.resetMargins();a.setChartSize();a.propFromSeries();a.getAxes();q(b.series||[],function(b){a.initSeries(b)});a.linkSeries();N(a,"beforeRender");if(P.Pointer)a.pointer=new Xa(a,b);a.render();a.renderer.draw();c&&c.apply(a,[a]);q(a.callbacks,function(b){b.apply(a,[a])});a.cloneRenderTo(!0);N(a,"load")}},splashArray:function(a,b){var c=b[a],c=fa(c)?c:[c,c,c,c];return[o(b[a+"Top"],c[0]),o(b[a+"Right"],c[1]),o(b[a+"Bottom"],c[2]),o(b[a+"Left"],c[3])]}};va.prototype.callbacks=[];ea=P.CenteredSeriesMixin= -{getCenter:function(){var a=this.options,b=this.chart,c=2*(a.slicedOffset||0),d,e=b.plotWidth-2*c,f=b.plotHeight-2*c,b=a.center,a=[o(b[0],"50%"),o(b[1],"50%"),a.size||"100%",a.innerSize||0],g=z(e,f),h;return xa(a,function(a,b){h=/%$/.test(a);d=b<2||b===2&&h;return(h?[e,f,g,g][b]*I(a)/100:a)+(d?c:0)})}};var za=function(){};za.prototype={init:function(a,b,c){this.series=a;this.applyOptions(b,c);this.pointAttr={};if(a.options.colorByPoint&&(b=a.options.colors||a.chart.options.colors,this.color=this.color|| -b[a.colorCounter++],a.colorCounter===b.length))a.colorCounter=0;a.chart.pointCount++;return this},applyOptions:function(a,b){var c=this.series,d=c.pointValKey,a=za.prototype.optionsToObject.call(this,a);v(this,a);this.options=this.options?v(this.options,a):a;if(d)this.y=this[d];if(this.x===r&&c)this.x=b===r?c.autoIncrement():b;return this},optionsToObject:function(a){var b={},c=this.series,d=c.pointArrayMap||["y"],e=d.length,f=0,g=0;if(typeof a==="number"||a===null)b[d[0]]=a;else if(Pa(a)){if(a.length> -e){c=typeof a[0];if(c==="string")b.name=a[0];else if(c==="number")b.x=a[0];f++}for(;ga+1&&b.push(d.slice(a+1,g)),a=g):g===e-1&&b.push(d.slice(a+1,g+1))});this.segments=b},setOptions:function(a){var b=this.chart,c=b.options.plotOptions,b=b.userOptions||{},d=b.plotOptions||{},e=c[this.type];this.userOptions= -a;c=y(e,c.series,a);this.tooltipOptions=y(F.tooltip,F.plotOptions[this.type].tooltip,b.tooltip,d.series&&d.series.tooltip,d[this.type]&&d[this.type].tooltip,a.tooltip);e.marker===null&&delete c.marker;return c},getColor:function(){var a=this.options,b=this.userOptions,c=this.chart.options.colors,d=this.chart.counters,e;e=a.color||T[this.type].color;if(!e&&!a.colorByPoint)t(b._colorIndex)?a=b._colorIndex:(b._colorIndex=d.color,a=d.color++),e=c[a];this.color=e;d.wrapColor(c.length)},getSymbol:function(){var a= -this.userOptions,b=this.options.marker,c=this.chart,d=c.options.symbols,c=c.counters;this.symbol=b.symbol;if(!this.symbol)t(a._symbolIndex)?a=a._symbolIndex:(a._symbolIndex=c.symbol,a=c.symbol++),this.symbol=d[a];if(/^url/.test(this.symbol))b.radius=0;c.wrapSymbol(d.length)},drawLegendSymbol:Q.drawLineMarker,setData:function(a,b,c,d){var e=this,f=e.points,g=f&&f.length||0,h,i=e.options,k=e.chart,j=null,l=e.xAxis,m=l&&!!l.categories,n=e.tooltipPoints,p=i.turboThreshold,u=this.xData,s=this.yData,G= -(h=e.pointArrayMap)&&h.length,a=a||[];h=a.length;b=o(b,!0);if(d!==!1&&h&&g===h&&!e.cropped&&!e.hasGroupedData)q(a,function(a,b){f[b].update(a,!1)});else{e.xIncrement=null;e.pointRange=m?1:i.pointRange;e.colorCounter=0;q(this.parallelArrays,function(a){e[a+"Data"].length=0});if(p&&h>p){for(c=0;j===null&&ck||this.forceCrop))if(m=h.min,n=h.max,b[d-1]n)b=[],c=[];else if(b[0]n)e=this.cropData(this.xData,this.yData,m,n),b=e.xData,c=e.yData,e=e.start,f=!0,j=b.length;for(d=b.length-1;d>=0;d--)a=b[d]-b[d-1],!f&&b[d]>m&&b[d]0&&(g===r||a=c){f=w(0,i-h);break}for(;id){g=i+h;break}return{xData:a.slice(f,g),yData:b.slice(f,g),start:f,end:g}},generatePoints:function(){var a=this.options.data,b=this.data,c,d=this.processedXData,e=this.processedYData,f=this.pointClass,g=d.length,h=this.cropStart||0,i,k=this.hasGroupedData, -j,l=[],m;if(!b&&!k)b=[],b.length=a.length,b=this.data=b;for(m=0;m0),k=this.getExtremesFromAll||this.cropped||(c[l+1]||k)>=g&&(c[l-1]||k)<=h,i&&k)if(i=j.length)for(;i--;)j[i]!==null&&(e[f++]=j[i]);else e[f++]=j;this.dataMin=o(void 0,Ra(e));this.dataMax=o(void 0,Ba(e))},translate:function(){this.processedXData||this.processData();this.generatePoints();for(var a=this.options,b=a.stacking,c=this.xAxis,d=c.categories,e=this.yAxis,f=this.points,g=f.length,h=!!this.modifyValue,i=a.pointPlacement, -k=i==="between"||la(i),j=a.threshold,a=0;a0||k))g.graphic=c.renderer.symbol(i,d-h,e-h,2*h,2*h).attr(a).add(n)}else if(j)g.graphic=j.destroy()},convertAttribs:function(a,b,c,d){var e=this.pointAttrToOptions,f,g,h={},a=a||{},b=b||{},c=c||{},d=d||{};for(f in e)g=e[f],h[f]=o(a[g],b[f],c[f],d[f]);return h},getAttribs:function(){var a=this,b=a.options, -c=T[a.type].marker?b.marker:b,d=c.states,e=d.hover,f,g=a.color;f={stroke:g,fill:g};var h=a.points||[],i,k=[],j,l=a.pointAttrToOptions;j=a.hasPointSpecificOptions;var m=b.negativeColor,n=c.lineColor,p=c.fillColor;i=b.turboThreshold;var u;b.marker?(e.radius=e.radius||c.radius+2,e.lineWidth=e.lineWidth||c.lineWidth+1):e.color=e.color||Fa(e.color||g).brighten(e.brightness).get();k[""]=a.convertAttribs(c,f);q(["hover","select"],function(b){k[b]=a.convertAttribs(d[b],k[""])});a.pointAttr=k;g=h.length;if(!i|| -g1?b=b.concat(c):d.push(e[0])});a.singlePoints=d;return a.graphPath=b},drawGraph:function(){var a=this,b=this.options,c=[["graph",b.lineColor||this.color]],d=b.lineWidth,e=b.dashStyle,f=b.linecap!=="square",g=this.getGraphPath(),h=b.negativeColor;h&&c.push(["graphNeg",h]);q(c,function(c,h){var j=c[0],l=a[j];if(l)eb(l),l.animate({d:g});else if(d&&g.length)l={stroke:c[1],"stroke-width":d,fill:Y,zIndex:1},e?l.dashstyle=e:f&&(l["stroke-linecap"]= -l["stroke-linejoin"]="round"),a[j]=a.chart.renderer.path(g).attr(l).add(a.group).shadow(!h&&b.shadow)})},clipNeg:function(){var a=this.options,b=this.chart,c=b.renderer,d=a.negativeColor||a.negativeFillColor,e,f=this.graph,g=this.area,h=this.posClip,i=this.negClip;e=b.chartWidth;var k=b.chartHeight,j=w(e,k),l=this.yAxis;if(d&&(f||g)){d=s(l.toPixels(a.threshold||0,!0));d<0&&(j-=d);a={x:0,y:0,width:j,height:d};j={x:0,y:d,width:j,height:j};if(b.inverted)a.height=j.y=b.plotWidth-d,c.isVML&&(a={x:b.plotWidth- -d-b.plotLeft,y:0,width:e,height:k},j={x:d+b.plotLeft-e,y:0,width:b.plotLeft+d,height:e});l.reversed?(b=j,e=a):(b=a,e=j);h?(h.animate(b),i.animate(e)):(this.posClip=h=c.clipRect(b),this.negClip=i=c.clipRect(e),f&&this.graphNeg&&(f.clip(h),this.graphNeg.clip(i)),g&&(g.clip(h),this.areaNeg.clip(i)))}},invertGroups:function(){function a(){var a={width:b.yAxis.len,height:b.xAxis.len};q(["group","markerGroup"],function(c){b[c]&&b[c].attr(a).invert()})}var b=this,c=b.chart;if(b.xAxis)A(c,"resize",a),A(b, -"destroy",function(){R(c,"resize",a)}),a(),b.invertGroups=a},plotGroup:function(a,b,c,d,e){var f=this[a],g=!f;g&&(this[a]=f=this.chart.renderer.g(b).attr({visibility:c,zIndex:d||0.1}).add(e));f[g?"attr":"animate"](this.getPlotBox());return f},getPlotBox:function(){var a=this.chart,b=this.xAxis,c=this.yAxis;if(a.inverted)b=c,c=this.xAxis;return{translateX:b?b.left:a.plotLeft,translateY:c?c.top:a.plotTop,scaleX:1,scaleY:1}},render:function(){var a=this,b=a.chart,c,d=a.options,e=(c=d.animation)&&!!a.animate&& -b.renderer.isSVG&&o(c.duration,500)||0,f=a.visible?"visible":"hidden",g=d.zIndex,h=a.hasRendered,i=b.seriesGroup;c=a.plotGroup("group","series",f,g,i);a.markerGroup=a.plotGroup("markerGroup","markers",f,g,i);e&&a.animate(!0);a.getAttribs();c.inverted=a.isCartesian?b.inverted:!1;a.drawGraph&&(a.drawGraph(),a.clipNeg());a.drawDataLabels&&a.drawDataLabels();a.visible&&a.drawPoints();a.drawTracker&&a.options.enableMouseTracking!==!1&&a.drawTracker();b.inverted&&a.invertGroups();d.clip!==!1&&!a.sharedClipKey&& -!h&&c.clip(b.clipRect);e&&a.animate();if(!h)e?a.animationTimeout=setTimeout(function(){a.afterAnimate()},e):a.afterAnimate();a.isDirty=a.isDirtyData=!1;a.hasRendered=!0},redraw:function(){var a=this.chart,b=this.isDirtyData,c=this.group,d=this.xAxis,e=this.yAxis;c&&(a.inverted&&c.attr({width:a.plotWidth,height:a.plotHeight}),c.animate({translateX:o(d&&d.left,a.plotLeft),translateY:o(e&&e.top,a.plotTop)}));this.translate();this.setTooltipPoints&&this.setTooltipPoints(!0);this.render();b&&N(this,"updatedData")}}; -Rb.prototype={destroy:function(){Ka(this,this.axis)},render:function(a){var b=this.options,c=b.format,c=c?Ja(c,this):b.formatter.call(this);this.label?this.label.attr({text:c,visibility:"hidden"}):this.label=this.axis.chart.renderer.text(c,null,null,b.useHTML).css(b.style).attr({align:this.textAlign,rotation:b.rotation,visibility:"hidden"}).add(a)},setOffset:function(a,b){var c=this.axis,d=c.chart,e=d.inverted,f=this.isNegative,g=c.translate(c.usePercentage?100:this.total,0,0,0,1),c=c.translate(0), -c=M(g-c),h=d.xAxis[0].translate(this.x)+a,i=d.plotHeight,f={x:e?f?g:g-c:h,y:e?i-h-b:f?i-g-c:i-g,width:e?c:b,height:e?b:c};if(e=this.label)e.align(this.alignOptions,null,f),f=e.alignAttr,e[this.options.crop===!1||d.isInsidePlot(f.x,f.y)?"show":"hide"](!0)}};L.prototype.buildStacks=function(){var a=this.series,b=o(this.options.reversedStacks,!0),c=a.length;if(!this.isXAxis){for(this.usePercentage=!1;c--;)a[b?c:a.length-c-1].setStackedPoints();if(this.usePercentage)for(c=0;cg;)h--;this.updateParallelArrays(d,"splice",h,0,0);this.updateParallelArrays(d,h);if(k)k[g]=d.name;l.splice(h,0,a);m&&(this.data.splice(h,0,null),this.processData());e.legendType==="point"&&this.generatePoints();c&&(f[0]&&f[0].remove?f[0].remove(!1): -(f.shift(),this.updateParallelArrays(d,"shift"),l.shift()));this.isDirtyData=this.isDirty=!0;b&&(this.getAttribs(),i.redraw())},remove:function(a,b){var c=this,d=c.chart,a=o(a,!0);if(!c.isRemoving)c.isRemoving=!0,N(c,"remove",null,function(){c.destroy();d.isDirtyLegend=d.isDirtyBox=!0;d.linkSeries();a&&d.redraw(b)});c.isRemoving=!1},update:function(a,b){var c=this.chart,d=this.type,e=C[d].prototype,f,a=y(this.userOptions,{animation:!1,index:this.index,pointStart:this.xData[0]},{data:this.options.data}, -a);this.remove(!1);for(f in e)e.hasOwnProperty(f)&&(this[f]=r);v(this,C[a.type||d].prototype);this.init(c,a);o(b,!0)&&c.redraw(!1)}});v(L.prototype,{update:function(a,b){var c=this.chart,a=c.options[this.coll][this.options.index]=y(this.userOptions,a);this.destroy(!0);this._addedPlotLB=r;this.init(c,v(a,{events:r}));c.isDirtyBox=!0;o(b,!0)&&c.redraw()},remove:function(a){for(var b=this.chart,c=this.coll,d=this.series,e=d.length;e--;)d[e]&&d[e].remove(!1);pa(b.axes,this);pa(b[c],this);b.options[c].splice(this.options.index, -1);q(b[c],function(a,b){a.options.index=b});this.destroy();b.isDirtyBox=!0;o(a,!0)&&b.redraw()},setTitle:function(a,b){this.update({title:a},b)},setCategories:function(a,b){this.update({categories:a},b)}});var Aa=ga(K);C.line=Aa;T.area=y(J,{threshold:0});var ta=ga(K,{type:"area",getSegments:function(){var a=[],b=[],c=[],d=this.xAxis,e=this.yAxis,f=e.stacks[this.stackKey],g={},h,i,k=this.points,j=this.options.connectNulls,l,m,n;if(this.options.stacking&&!this.cropped){for(m=0;m=0;d--)g=o(a[d].yBottom,f),da&&i>e?(i=w(a,e),j=2*e-i):ig&&j>e?(j=w(g,e),i=2*e-j):j0.5*a.xAxis.len?0:1),e=a.yAxis,f=a.translatedThreshold= -e.getThreshold(c.threshold),g=o(c.minPointLength,5),c=a.getColumnMetrics(),h=c.width,i=a.barW=Va(w(h,1+2*d)),k=a.pointXOffset=c.offset,j=-(d%2?0.5:0),l=d%2?0.5:1;b.renderer.isVML&&b.inverted&&(l+=1);K.prototype.translate.apply(a);q(a.points,function(c){var d=o(c.yBottom,f),p=z(w(-999-d,c.plotY),e.len+999+d),u=c.plotX+k,q=i,r=z(p,d),x;x=w(p,d)-r;M(x)g?d-g:f-(e.translate(c.y,0,1,0,1)<=f?g:0)));c.barX=u;c.pointWidth=h;c.tooltipPos=b.inverted?[e.len-p,a.xAxis.len-u-q/2]:[u+q/2, -p];d=M(u)<0.5;q=s(u+q)+j;u=s(u)+j;q-=u;p=M(r)<0.5;x=s(r+x)+l;r=s(r)+l;x-=r;d&&(u+=1,q-=1);p&&(r-=1,x+=1);c.shapeType="rect";c.shapeArgs={x:u,y:r,width:q,height:x}})},getSymbol:na,drawLegendSymbol:Q.drawRectangle,drawGraph:na,drawPoints:function(){var a=this,b=this.chart,c=a.options,d=b.renderer,e=c.animationLimit||250,f,g,h;q(a.points,function(i){var k=i.plotY,j=i.graphic;if(k!==r&&!isNaN(k)&&i.y!==null)f=i.shapeArgs,h=t(a.borderWidth)?{"stroke-width":a.borderWidth}:{},g=i.pointAttr[i.selected?"select": -""]||a.pointAttr[""],j?(eb(j),j.attr(h)[b.pointCount {series.name}
    ',pointFormat:"x: {point.x}
    y: {point.y}
    "},stickyTracking:!1}); -ta=ga(K,{type:"scatter",sorted:!1,requireSorting:!1,noSharedTooltip:!0,trackerGroups:["markerGroup"],takeOrdinalPosition:!1,singularTooltips:!0,drawGraph:function(){this.options.lineWidth&&K.prototype.drawGraph.call(this)}});C.scatter=ta;T.pie=y(J,{borderColor:"#FFFFFF",borderWidth:1,center:[null,null],clip:!1,colorByPoint:!0,dataLabels:{distance:30,enabled:!0,formatter:function(){return this.point.name}},ignoreHiddenPoint:!0,legendType:"point",marker:null,size:null,showInLegend:!1,slicedOffset:10, -states:{hover:{brightness:0.1,shadow:!1}},stickyTracking:!1,tooltip:{followPointer:!0}});J={type:"pie",isCartesian:!1,pointClass:ga(za,{init:function(){za.prototype.init.apply(this,arguments);var a=this,b;if(a.y<0)a.y=null;v(a,{visible:a.visible!==!1,name:o(a.name,"Slice")});b=function(b){a.slice(b.type==="select")};A(a,"select",b);A(a,"unselect",b);return a},setVisible:function(a){var b=this,c=b.series,d=c.chart;b.visible=b.options.visible=a=a===r?!b.visible:a;c.options.data[wa(b,c.data)]=b.options; -q(["graphic","dataLabel","connector","shadowGroup"],function(c){if(b[c])b[c][a?"show":"hide"](!0)});b.legendItem&&d.legend.colorizeItem(b,a);if(!c.isDirty&&c.options.ignoreHiddenPoint)c.isDirty=!0,d.redraw()},slice:function(a,b,c){var d=this.series;Ya(c,d.chart);o(b,!0);this.sliced=this.options.sliced=a=t(a)?a:!this.sliced;d.options.data[wa(this,d.data)]=this.options;a=a?this.slicedTranslation:{translateX:0,translateY:0};this.graphic.animate(a);this.shadowGroup&&this.shadowGroup.animate(a)},haloPath:function(a){var b= -this.shapeArgs,c=this.series.chart;return this.series.chart.renderer.symbols.arc(c.plotLeft+b.x,c.plotTop+b.y,b.r+a,b.r+a,{innerR:this.shapeArgs.r,start:b.start,end:b.end})}}),requireSorting:!1,noSharedTooltip:!0,trackerGroups:["group","dataLabelsGroup"],axisTypes:[],pointAttrToOptions:{stroke:"borderColor","stroke-width":"borderWidth",fill:"color"},singularTooltips:!0,getColor:na,animate:function(a){var b=this,c=b.points,d=b.startAngleRad;if(!a)q(c,function(a){var c=a.graphic,a=a.shapeArgs;c&&(c.attr({r:b.center[3]/ -2,start:d,end:d}),c.animate({r:a.r,start:a.start,end:a.end},b.options.animation))}),b.animate=null},setData:function(a,b,c,d){K.prototype.setData.call(this,a,!1,c,d);this.processData();this.generatePoints();o(b,!0)&&this.chart.redraw(c)},generatePoints:function(){var a,b=0,c,d,e,f=this.options.ignoreHiddenPoint;K.prototype.generatePoints.call(this);c=this.points;d=c.length;for(a=0;a0?e.y/b*100:0,e.total=b},translate:function(a){this.generatePoints(); -var b=0,c=this.options,d=c.slicedOffset,e=d+c.borderWidth,f,g,h,i=c.startAngle||0,k=this.startAngleRad=ra/180*(i-90),i=(this.endAngleRad=ra/180*(o(c.endAngle,i+360)-90))-k,j=this.points,l=c.dataLabels.distance,c=c.ignoreHiddenPoint,m,n=j.length,p;if(!a)this.center=a=this.getCenter();this.getX=function(b,c){h=V.asin(z((b-a[1])/(a[2]/2+l),1));return a[0]+(c?-1:1)*da(h)*(a[2]/2+l)};for(m=0;m1.5*ra?h-=2*ra:h<-ra/2&&(h+=2*ra);p.slicedTranslation={translateX:s(da(h)*d),translateY:s(ia(h)*d)};f=da(h)*a[2]/2;g=ia(h)*a[2]/2;p.tooltipPos=[a[0]+f*0.7,a[1]+g*0.7];p.half=h<-ra/2||h>ra/2?1:0;p.angle=h;e=z(e,l/2);p.labelPos=[a[0]+f+da(h)*l,a[1]+g+ia(h)*l,a[0]+f+da(h)*e,a[1]+g+ia(h)*e,a[0]+f,a[1]+g,l<0?"center":p.half?"right":"left",h]}},drawGraph:null,drawPoints:function(){var a=this,b=a.chart.renderer,c,d,e=a.options.shadow, -f,g;if(e&&!a.shadowGroup)a.shadowGroup=b.g("shadow").add(a.group);q(a.points,function(h){d=h.graphic;g=h.shapeArgs;f=h.shadowGroup;if(e&&!f)f=h.shadowGroup=b.g("shadow").add(a.shadowGroup);c=h.sliced?h.slicedTranslation:{translateX:0,translateY:0};f&&f.attr(c);d?d.animate(v(g,c)):h.graphic=d=b[h.shapeType](g).setRadialReference(a.center).attr(h.pointAttr[h.selected?"select":""]).attr({"stroke-linejoin":"round"}).attr(c).add(a.group).shadow(e,f);h.visible!==void 0&&h.setVisible(h.visible)})},sortByAngle:function(a, -b){a.sort(function(a,d){return a.angle!==void 0&&(d.angle-a.angle)*b})},drawLegendSymbol:Q.drawRectangle,getCenter:ea.getCenter,getSymbol:na};J=ga(K,J);C.pie=J;K.prototype.drawDataLabels=function(){var a=this,b=a.options,c=b.cursor,d=b.dataLabels,e=a.points,f,g,h,i;if(d.enabled||a._hasPointLabels)a.dlProcessOptions&&a.dlProcessOptions(d),i=a.plotGroup("dataLabelsGroup","data-labels","hidden",d.zIndex||6),!a.hasRendered&&o(d.defer,!0)&&(i.attr({opacity:0}),A(a,"afterAnimate",function(){a.dataLabelsGroup.show()[b.animation? -"animate":"attr"]({opacity:1},{duration:200})})),g=d,q(e,function(b){var e,l=b.dataLabel,m,n,p=b.connector,u=!0;f=b.options&&b.options.dataLabels;e=o(f&&f.enabled,g.enabled);if(l&&!e)b.dataLabel=l.destroy();else if(e){d=y(g,f);e=d.rotation;m=b.getLabelConfig();h=d.format?Ja(d.format,m):d.formatter.call(m,d);d.style.color=o(d.color,d.style.color,a.color,"black");if(l)if(t(h))l.attr({text:h}),u=!1;else{if(b.dataLabel=l=l.destroy(),p)b.connector=p.destroy()}else if(t(h)){l={fill:d.backgroundColor,stroke:d.borderColor, -"stroke-width":d.borderWidth,r:d.borderRadius||0,rotation:e,padding:d.padding,zIndex:1};for(n in l)l[n]===r&&delete l[n];l=b.dataLabel=a.chart.renderer[e?"text":"label"](h,0,-999,null,null,null,d.useHTML).attr(l).css(v(d.style,c&&{cursor:c})).add(i).shadow(d.shadow)}l&&a.alignDataLabel(b,l,d,null,u)}})};K.prototype.alignDataLabel=function(a,b,c,d,e){var f=this.chart,g=f.inverted,h=o(a.plotX,-999),i=o(a.plotY,-999),k=b.getBBox();if(a=this.visible&&(a.series.forceDL||f.isInsidePlot(h,s(i),g)||d&&f.isInsidePlot(h, -g?d.x+1:d.y+d.height-1,g)))d=v({x:g?f.plotWidth-i:h,y:s(g?f.plotHeight-h:i),width:0,height:0},d),v(c,{width:k.width,height:k.height}),c.rotation?(g={align:c.align,x:d.x+c.x+d.width/2,y:d.y+c.y+d.height/2},b[e?"attr":"animate"](g)):(b.align(c,null,d),g=b.alignAttr,o(c.overflow,"justify")==="justify"?this.justifyDataLabel(b,c,g,k,d,e):o(c.crop,!0)&&(a=f.isInsidePlot(g.x,g.y)&&f.isInsidePlot(g.x+k.width,g.y+k.height)));if(!a)b.attr({y:-999}),b.placed=!1};K.prototype.justifyDataLabel=function(a,b,c,d, -e,f){var g=this.chart,h=b.align,i=b.verticalAlign,k,j;k=c.x;if(k<0)h==="right"?b.align="left":b.x=-k,j=!0;k=c.x+d.width;if(k>g.plotWidth)h==="left"?b.align="right":b.x=g.plotWidth-k,j=!0;k=c.y;if(k<0)i==="bottom"?b.verticalAlign="top":b.y=-k,j=!0;k=c.y+d.height;if(k>g.plotHeight)i==="top"?b.verticalAlign="bottom":b.y=g.plotHeight-k,j=!0;if(j)a.placed=!f,a.align(b,null,e)};if(C.pie)C.pie.prototype.drawDataLabels=function(){var a=this,b=a.data,c,d=a.chart,e=a.options.dataLabels,f=o(e.connectorPadding, -10),g=o(e.connectorWidth,1),h=d.plotWidth,d=d.plotHeight,i,k,j=o(e.softConnector,!0),l=e.distance,m=a.center,n=m[2]/2,p=m[1],u=l>0,r,G,x,t,v=[[],[]],y,z,A,B,D,U=[0,0,0,0],I=function(a,b){return b.y-a.y};if(a.visible&&(e.enabled||a._hasPointLabels)){K.prototype.drawDataLabels.apply(a);q(b,function(a){a.dataLabel&&a.visible&&v[a.half].push(a)});for(B=0;!t&&b[B];)t=b[B]&&b[B].dataLabel&&(b[B].dataLabel.getBBox().height||21),B++;for(B=2;B--;){var b=[],H=[],C=v[B],E=C.length,F;a.sortByAngle(C,B-0.5);if(l> -0){for(D=p-n-l;D<=p+n+l;D+=t)b.push(D);G=b.length;if(E>G){c=[].concat(C);c.sort(I);for(D=E;D--;)c[D].rank=D;for(D=E;D--;)C[D].rank>=G&&C.splice(D,1);E=C.length}for(D=0;D0){if(G=H.pop(),F=G.i, -z=G.y,c>z&&b[F+1]!==null||ch-f&&(U[1]=w(s(y+G-h+f),U[1])),z-t/2<0?U[0]=w(s(-z+t/2),U[0]):z+t/2>d&&(U[2]=w(s(z+t/2-d),U[2]))}}if(Ba(U)===0||this.verifyDataLabelOverflow(U))this.placeDataLabels(),u&&g&&q(this.points,function(b){i= -b.connector;x=b.labelPos;if((r=b.dataLabel)&&r._pos)A=r._attr.visibility,y=r.connX,z=r.connY,k=j?["M",y+(x[6]==="left"?5:-5),z,"C",y,z,2*x[2]-x[4],2*x[3]-x[5],x[2],x[3],"L",x[4],x[5]]:["M",y+(x[6]==="left"?5:-5),z,"L",x[2],x[3],"L",x[4],x[5]],i?(i.animate({d:k}),i.attr("visibility",A)):b.connector=i=a.chart.renderer.path(k).attr({"stroke-width":g,stroke:e.connectorColor||b.color||"#606060",visibility:A}).add(a.dataLabelsGroup);else if(i)b.connector=i.destroy()})}},C.pie.prototype.placeDataLabels= -function(){q(this.points,function(a){var a=a.dataLabel,b;if(a)(b=a._pos)?(a.attr(a._attr),a[a.moved?"animate":"attr"](b),a.moved=!0):a&&a.attr({y:-999})})},C.pie.prototype.alignDataLabel=na,C.pie.prototype.verifyDataLabelOverflow=function(a){var b=this.center,c=this.options,d=c.center,e=c=c.minSize||80,f;d[0]!==null?e=w(b[2]-w(a[1],a[3]),c):(e=w(b[2]-a[1]-a[3],c),b[0]+=(a[3]-a[1])/2);d[1]!==null?e=w(z(e,b[2]-w(a[0],a[2])),c):(e=w(z(e,b[2]-a[0]-a[2]),c),b[1]+=(a[0]-a[2])/2);eo(this.translatedThreshold,f.plotSizeY),k=o(c.inside,!!this.options.stacking);if(h&&(d=y(h),g&&(d={x:f.plotWidth-d.y-d.height,y:f.plotHeight-d.x-d.width,width:d.height,height:d.width}),!k))g?(d.x+=i?0:d.width,d.width=0):(d.y+=i?d.height:0, -d.height=0);c.align=o(c.align,!g||k?"center":i?"right":"left");c.verticalAlign=o(c.verticalAlign,g||k?"middle":i?"top":"bottom");K.prototype.alignDataLabel.call(this,a,b,c,d,e)};var gb=P.TrackerMixin={drawTrackerPoint:function(){var a=this,b=a.chart,c=b.pointer,d=a.options.cursor,e=d&&{cursor:d},f=function(c){var d=c.target,e;if(b.hoverSeries!==a)a.onMouseOver();for(;d&&!e;)e=d.point,d=d.parentNode;if(e!==r&&e!==b.hoverPoint)e.onMouseOver(c)};q(a.points,function(a){if(a.graphic)a.graphic.element.point= -a;if(a.dataLabel)a.dataLabel.element.point=a});if(!a._hasTracking)q(a.trackerGroups,function(b){if(a[b]&&(a[b].addClass("highcharts-tracker").on("mouseover",f).on("mouseout",function(a){c.onTrackerMouseOut(a)}).css(e),ab))a[b].on("touchstart",f)}),a._hasTracking=!0},drawTrackerGraph:function(){var a=this,b=a.options,c=b.trackByArea,d=[].concat(c?a.areaPath:a.graphPath),e=d.length,f=a.chart,g=f.pointer,h=f.renderer,i=f.options.tooltip.snap,k=a.tracker,j=b.cursor,l=j&&{cursor:j},j=a.singlePoints,m, -n=function(){if(f.hoverSeries!==a)a.onMouseOver()},p="rgba(192,192,192,"+(ca?1.0E-4:0.002)+")";if(e&&!c)for(m=e+1;m--;)d[m]==="M"&&d.splice(m+1,0,d[m+1]-i,d[m+2],"L"),(m&&d[m]==="M"||m===e)&&d.splice(m,0,"L",d[m-2]+i,d[m-1]);for(m=0;mz(j.dataMin,j.min)&&i=f.min&&c<=f.max){h=b[i+1];c=d===r?0:d+1;for(d=b[i+1]?z(w(0,S((e.clientX+(h?h.wrappedClientX||h.clientX:g))/2)),g):g;c>=0&&c<=d;)k[c++]=e}this.tooltipPoints=k}},show:function(){this.setVisible(!0)}, -hide:function(){this.setVisible(!1)},select:function(a){this.selected=a=a===r?!this.selected:a;if(this.checkbox)this.checkbox.checked=a;N(this,a?"select":"unselect")},drawTracker:gb.drawTrackerGraph});O(K.prototype,"init",function(a){var b;a.apply(this,Array.prototype.slice.call(arguments,1));(b=this.xAxis)&&b.options.ordinal&&A(this,"updatedData",function(){delete b.ordinalIndex})});O(L.prototype,"getTimeTicks",function(a,b,c,d,e,f,g,h){var i=0,k=0,j,l={},m,n,p,o=[],q=-Number.MAX_VALUE,s=this.options.tickPixelInterval; -if(!this.options.ordinal||!f||f.length<3||c===r)return a.call(this,b,c,d,e);for(n=f.length;kd;f[k]g*5||p){if(f[k]>q){for(j=a.call(this,b,f[i],f[k],e);j.length&&j[0]<=q;)j.shift();j.length&&(q=j[j.length-1]);o=o.concat(j)}i=k+1}if(p)break}a=j.info;if(h&&a.unitRange<=H.hour){k=o.length-1;for(i=1;id?a-1:a;for(x=void 0;h--;)i=k[h],d=x-i,x&&d2){d=b[1]-b[0];for(g=a-1;g--&&!c;)b[g+1]-b[g]!==d&&(c=!0);if(!this.options.keepOrdinalPadding&&(b[0]-f>d||e-b[b.length-1]>d))c=!0}c?(this.ordinalPositions=b,c=this.val2lin(w(f,b[0]),!0),d=this.val2lin(z(e,b[b.length-1]),!0),this.ordinalSlope=e=(e-f)/(d-c),this.ordinalOffset=f-c*e):this.ordinalPositions=this.ordinalSlope=this.ordinalOffset=r}this.groupIntervalFactor=null},val2lin:function(a,b){var c= -this.ordinalPositions;if(c){var d=c.length,e,f;for(e=d;e--;)if(c[e]===a){f=e;break}for(e=d-1;e--;)if(a>c[e]||e===0){c=(a-c[e])/(c[e+1]-c[e]);f=e+c;break}return b?f:this.ordinalSlope*(f||0)+this.ordinalOffset}else return a},lin2val:function(a,b){var c=this.ordinalPositions;if(c){var d=this.ordinalSlope,e=this.ordinalOffset,f=c.length-1,g,h;if(b)a<0?a=c[0]:a>f?a=c[f]:(f=S(a),h=a-f);else for(;f--;)if(g=d*f+e,a>=g){d=d*(f+1)+e;h=(a-g)/(d-g);break}return h!==r&&c[f]!==r?c[f]+(h?h*(c[f+1]-c[f]):0):a}else return a}, -getExtendedPositions:function(){var a=this.chart,b=this.series[0].currentDataGrouping,c=this.ordinalIndex,d=b?b.count+b.unitName:"raw",e=this.getExtremes(),f,g;if(!c)c=this.ordinalIndex={};if(!c[d])f={series:[],getExtremes:function(){return{min:e.dataMin,max:e.dataMax}},options:{ordinal:!0},val2lin:L.prototype.val2lin},q(this.series,function(c){g={xAxis:f,xData:c.xData,chart:a,destroyGroupedData:na};g.options={dataGrouping:b?{enabled:!0,forced:!0,approximation:"open",units:[[b.unitName,[b.count]]]}: -{enabled:!1}};c.processData.apply(g);f.series.push(g)}),this.beforeSetTickPositions.apply(f),c[d]=f.ordinalPositions;return c[d]},getGroupIntervalFactor:function(a,b,c){var d=0,c=c.processedXData,e=c.length,f=[],g=this.groupIntervalFactor;if(!g){for(;d1)j&&q(j,function(a){a.setState()}),f<0?(j=m,p=c.ordinalPositions?c:m):(j=c.ordinalPositions?c:m,p=m),m=p.ordinalPositions,h>m[m.length-1]&&m.push(h), -this.fixedRange=k-i,f=c.toFixedRange(null,null,l.apply(j,[n.apply(j,[i,!0])+f,!0]),l.apply(p,[n.apply(p,[k,!0])+f,!0])),f.min>=z(g.dataMin,i)&&f.max<=w(h,k)&&c.setExtremes(f.min,f.max,!0,!1,{trigger:"pan"}),this.mouseDownX=d,E(this.container,{cursor:"move"})}else e=!0}else e=!0;e&&a.apply(this,Array.prototype.slice.call(arguments,1))});O(K.prototype,"getSegments",function(a){var b,c=this.options.gapSize,d=this.xAxis;a.apply(this,Array.prototype.slice.call(arguments,1));if(c)b=this.segments,q(b,function(a, -f){for(var g=a.length-1;g--;)a[g+1].x-a[g].x>d.closestPointRange*c&&b.splice(f+1,0,a.splice(g+1,a.length-g))})});var ba=K.prototype,J=Hb.prototype,hc=ba.processData,ic=ba.generatePoints,jc=ba.destroy,kc=J.tooltipHeaderFormatter,lc={approximation:"average",groupPixelWidth:2,dateTimeLabelFormats:Kb("millisecond",["%A, %b %e, %H:%M:%S.%L","%A, %b %e, %H:%M:%S.%L","-%H:%M:%S.%L"],"second",["%A, %b %e, %H:%M:%S","%A, %b %e, %H:%M:%S","-%H:%M:%S"],"minute",["%A, %b %e, %H:%M","%A, %b %e, %H:%M","-%H:%M"], -"hour",["%A, %b %e, %H:%M","%A, %b %e, %H:%M","-%H:%M"],"day",["%A, %b %e, %Y","%A, %b %e","-%A, %b %e, %Y"],"week",["Week from %A, %b %e, %Y","%A, %b %e","-%A, %b %e, %Y"],"month",["%B %Y","%B","-%B %Y"],"year",["%Y","%Y","-%Y"])},Wb={line:{},spline:{},area:{},areaspline:{},column:{approximation:"sum",groupPixelWidth:10},arearange:{approximation:"range"},areasplinerange:{approximation:"range"},columnrange:{approximation:"range",groupPixelWidth:10},candlestick:{approximation:"ohlc",groupPixelWidth:10}, -ohlc:{approximation:"ohlc",groupPixelWidth:5}},Xb=[["millisecond",[1,2,5,10,20,25,50,100,200,500]],["second",[1,2,5,10,15,30]],["minute",[1,2,5,10,15,30]],["hour",[1,2,3,4,6,8,12]],["day",[1]],["week",[1]],["month",[1,3,6]],["year",null]],Na={sum:function(a){var b=a.length,c;if(!b&&a.hasNulls)c=null;else if(b)for(c=0;b--;)c+=a[b];return c},average:function(a){var b=a.length,a=Na.sum(a);typeof a==="number"&&b&&(a/=b);return a},open:function(a){return a.length?a[0]:a.hasNulls?null:r},high:function(a){return a.length? -Ba(a):a.hasNulls?null:r},low:function(a){return a.length?Ra(a):a.hasNulls?null:r},close:function(a){return a.length?a[a.length-1]:a.hasNulls?null:r},ohlc:function(a,b,c,d){a=Na.open(a);b=Na.high(b);c=Na.low(c);d=Na.close(d);if(typeof a==="number"||typeof b==="number"||typeof c==="number"||typeof d==="number")return[a,b,c,d]},range:function(a,b){a=Na.low(a);b=Na.high(b);if(typeof a==="number"||typeof b==="number")return[a,b]}};ba.groupData=function(a,b,c,d){var e=this.data,f=this.options.data,g=[], -h=[],i=a.length,k,j,l=!!b,m=[[],[],[],[]],d=typeof d==="function"?d:Na[d],n=this.pointArrayMap,p=n&&n.length,o;for(o=0;o<=i;o++)if(a[o]>=c[0])break;for(;o<=i;o++){for(;c[1]!==r&&a[o]>=c[1]||o===i;)if(k=c.shift(),j=d.apply(0,m),j!==r&&(g.push(k),h.push(j)),m[0]=[],m[1]=[],m[2]=[],m[3]=[],o===i)break;if(o===i)break;if(n){k=this.cropStart+o;k=e&&e[k]||this.pointClass.prototype.applyOptions.apply({series:this},[f[k]]);var q;for(j=0;j0;)f[c]+=h/2;f[0]=d}this.currentDataGrouping=k.info;if(b.pointRange===null)this.pointRange=k.info.totalRange;this.closestPointRange=k.info.totalRange;if(t(f[0])&& -f[0]=g.closestPointRange||H[h]<=H.day&&a.key%H[h]>0){e=d[h][0];break}e=ua(e,a.key);f&&(e+=ua(f,a.key+b.totalRange-1));a=c.headerFormat.replace("{point.key}",e)}else a=kc.call(this,a);return a};ba.destroy=function(){for(var a=this.groupedData||[],b=a.length;b--;)a[b]&&a[b].destroy();jc.apply(this)}; -O(ba,"setOptions",function(a,b){var c=a.call(this,b),d=this.type,e=this.chart.options.plotOptions,f=T[d].dataGrouping;if(Wb[d])f||(f=y(lc,Wb[d])),c.dataGrouping=y(f,e.series&&e.series.dataGrouping,e[d].dataGrouping,b.dataGrouping);if(this.chart.options._stock)this.requireSorting=!0;return c});O(L.prototype,"setScale",function(a){a.call(this);q(this.series,function(a){a.hasProcessed=!1})});L.prototype.getGroupPixelWidth=function(){var a=this.series,b=a.length,c,d=0,e=!1,f;for(c=b;c--;)(f=a[c].options.dataGrouping)&& -(d=w(d,f.groupPixelWidth));for(c=b;c--;)if((f=a[c].options.dataGrouping)&&a[c].hasProcessed)if(b=(a[c].processedXData||a[c].data).length,a[c].groupPixelWidth||b>this.chart.plotSizeX/d||b&&f.forced)e=!0;return e?d:0};T.ohlc=y(T.column,{lineWidth:1,tooltip:{pointFormat:' {series.name}
    Open: {point.open}
    High: {point.high}
    Low: {point.low}
    Close: {point.close}
    '},states:{hover:{lineWidth:3}},threshold:null});J=ga(C.column,{type:"ohlc", -pointArrayMap:["open","high","low","close"],toYData:function(a){return[a.open,a.high,a.low,a.close]},pointValKey:"high",pointAttrToOptions:{stroke:"color","stroke-width":"lineWidth"},upColorProp:"stroke",getAttribs:function(){C.column.prototype.getAttribs.apply(this,arguments);var a=this.options,b=a.states,a=a.upColor||this.color,c=y(this.pointAttr),d=this.upColorProp;c[""][d]=a;c.hover[d]=b.hover.upColor||a;c.select[d]=b.select.upColor||a;q(this.points,function(a){if(a.open"},threshold:null,y:-30});C.flags=ga(C.column,{type:"flags",sorted:!1,noSharedTooltip:!0,takeOrdinalPosition:!1,trackerGroups:["markerGroup"],forceCrop:!0,init:K.prototype.init,pointAttrToOptions:{fill:"fillColor",stroke:"color","stroke-width":"lineWidth",r:"radius"},translate:function(){C.column.prototype.translate.apply(this);var a=this.chart,b=this.points,c=b.length-1,d,e,f=this.options.onSeries, -f=(d=f&&a.get(f))&&d.options.step,g=d&&d.points,h=g&&g.length,i=this.xAxis,k=i.getExtremes(),j,l,m;if(d&&d.visible&&h){d=d.currentDataGrouping;l=g[h-1].x+(d?d.totalRange:0);for(b.sort(function(a,b){return a.x-b.x});h--&&b[c];)if(d=b[c],j=g[h],j.x<=d.x&&j.plotY!==r){if(d.x<=l)d.plotY=j.plotY,j.x=k.min&&c.x<=k.max?c.plotY=a.chartHeight-i.bottom-(i.opposite?i.height: -0)+i.offset-a.plotTop:c.shapeArgs={};if((e=b[d-1])&&e.plotX===c.plotX){if(e.stackIndex===r)e.stackIndex=0;c.stackIndex=e.stackIndex+1}})},drawPoints:function(){var a,b=this.pointAttr[""],c=this.points,d=this.chart.renderer,e,f,g=this.options,h=g.y,i,k,j,l,m=g.lineWidth%2/2,n,o;for(k=c.length;k--;)if(j=c[k],a=j.plotX>this.xAxis.len,e=j.plotX+(a?m:-m),l=j.stackIndex,i=j.options.shape||g.shape,f=j.plotY,f!==r&&(f=j.plotY+h+m-(l!==r&&l*g.stackDistance)),n=l?r:j.plotX+m,o=l?r:j.plotY,l=j.graphic,f!==r&& -e>=0&&!a)a=j.pointAttr[j.selected?"select":""]||b,l?l.attr({x:e,y:f,r:a.r,anchorX:n,anchorY:o}):j.graphic=d.label(j.options.title||g.title||"A",e,f,i,n,o,g.useHTML).css(y(g.style,j.style)).attr(a).attr({align:i==="flag"?"left":"center",width:g.width,height:g.height}).add(this.markerGroup).shadow(g.shadow),j.tooltipPos=[e,f];else if(l)j.graphic=l.destroy()},drawTracker:function(){var a=this.points;gb.drawTrackerPoint.apply(this);q(a,function(b){var c=b.graphic;c&&A(c.element,"mouseover",function(){if(b.stackIndex> -0&&!b.raised)b._y=c.y,c.attr({y:b._y-8}),b.raised=!0;q(a,function(a){if(a!==b&&a.raised&&a.graphic)a.graphic.attr({y:a._y}),a.raised=!1})})})},animate:na});qb.flag=function(a,b,c,d,e){var f=e&&e.anchorX||a,e=e&&e.anchorY||b;return["M",f,e,"L",a,b+d,a,b,a+c,b,a+c,b+d,a,b+d,"M",f,e,"Z"]};q(["circle","square"],function(a){qb[a+"pin"]=function(b,c,d,e,f){var g=f&&f.anchorX,f=f&&f.anchorY,b=qb[a](b,c,d,e);g&&f&&b.push("M",g,c>f?c:c+e,"L",g,f);return b}});Wa===P.VMLRenderer&&q(["flag","circlepin","squarepin"], -function(a){fb.prototype.symbols[a]=qb[a]});J=[].concat(Xb);J[4]=["day",[1,2,3,4]];J[5]=["week",[1,2,3]];v(F,{navigator:{handles:{backgroundColor:"#ebe7e8",borderColor:"#b2b1b6"},height:40,margin:25,maskFill:"rgba(128,179,236,0.3)",maskInside:!0,outlineColor:"#b2b1b6",outlineWidth:1,series:{type:C.areaspline===r?"line":"areaspline",color:"#4572A7",compare:null,fillOpacity:0.05,dataGrouping:{approximation:"average",enabled:!0,groupPixelWidth:2,smoothed:!0,units:J},dataLabels:{enabled:!1,zIndex:2}, -id:"highcharts-navigator-series",lineColor:"#4572A7",lineWidth:1,marker:{enabled:!1},pointRange:0,shadow:!1,threshold:null},xAxis:{tickWidth:0,lineWidth:0,gridLineColor:"#EEE",gridLineWidth:1,tickPixelInterval:200,labels:{align:"left",style:{color:"#888"},x:3,y:-4},crosshair:!1},yAxis:{gridLineWidth:0,startOnTick:!1,endOnTick:!1,minPadding:0.1,maxPadding:0.1,labels:{enabled:!1},crosshair:!1,title:{text:null},tickWidth:0}},scrollbar:{height:cb?20:14,barBackgroundColor:"#bfc8d1",barBorderRadius:0,barBorderWidth:1, -barBorderColor:"#bfc8d1",buttonArrowColor:"#666",buttonBackgroundColor:"#ebe7e8",buttonBorderColor:"#bbb",buttonBorderRadius:0,buttonBorderWidth:1,minWidth:6,rifleColor:"#666",trackBackgroundColor:"#eeeeee",trackBorderColor:"#eeeeee",trackBorderWidth:1,liveRedraw:ca&&!cb}});yb.prototype={drawHandle:function(a,b){var c=this.chart,d=c.renderer,e=this.elementsToDestroy,f=this.handles,g=this.navigatorOptions.handles,g={fill:g.backgroundColor,stroke:g.borderColor,"stroke-width":1},h;this.rendered||(f[b]= -d.g("navigator-handle-"+["left","right"][b]).css({cursor:"e-resize"}).attr({zIndex:4-b}).add(),h=d.rect(-4.5,0,9,16,0,1).attr(g).add(f[b]),e.push(h),h=d.path(["M",-1.5,4,"L",-1.5,12,"M",0.5,4,"L",0.5,12]).attr(g).add(f[b]),e.push(h));f[b][c.isResizing?"animate":"attr"]({translateX:this.scrollerLeft+this.scrollbarHeight+parseInt(a,10),translateY:this.top+this.height/2-8})},drawScrollbarButton:function(a){var b=this.chart.renderer,c=this.elementsToDestroy,d=this.scrollbarButtons,e=this.scrollbarHeight, -f=this.scrollbarOptions,g;this.rendered||(d[a]=b.g().add(this.scrollbarGroup),g=b.rect(-0.5,-0.5,e+1,e+1,f.buttonBorderRadius,f.buttonBorderWidth).attr({stroke:f.buttonBorderColor,"stroke-width":f.buttonBorderWidth,fill:f.buttonBackgroundColor}).add(d[a]),c.push(g),g=b.path(["M",e/2+(a?-1:1),e/2-3,"L",e/2+(a?-1:1),e/2+3,e/2+(a?2:-2),e/2]).attr({fill:f.buttonArrowColor}).add(d[a]),c.push(g));a&&d[a].attr({translateX:this.scrollerWidth-e})},render:function(a,b,c,d){var e=this.chart,f=e.renderer,g,h, -i,k,j=this.scrollbarGroup,l=this.navigatorGroup,m=this.scrollbar,l=this.xAxis,n=this.scrollbarTrack,p=this.scrollbarHeight,q=this.scrollbarEnabled,r=this.navigatorOptions,t=this.scrollbarOptions,x=t.minWidth,v=this.height,y=this.top,A=this.navigatorEnabled,B=r.outlineWidth,C=B/2,F=0,D=this.outlineHeight,I=t.barBorderRadius,H=t.barBorderWidth,E=y+C,J;if(!isNaN(a)){this.navigatorLeft=g=o(l.left,e.plotLeft+p);this.navigatorWidth=h=o(l.len,e.plotWidth-2*p);this.scrollerLeft=i=g-p;this.scrollerWidth=k= -k=h+2*p;l.getExtremes&&(J=this.getUnionExtremes(!0))&&(J.dataMin!==l.min||J.dataMax!==l.max)&&l.setExtremes(J.dataMin,J.dataMax,!0,!1);c=o(c,l.translate(a));d=o(d,l.translate(b));if(isNaN(c)||M(c)===Infinity)c=0,d=k;if(!(l.translate(d,!0)-l.translate(c,!0)12?"visible":"hidden"})[e]({d:["M",x-3,p/4,"L",x-3,2*p/3,"M",x,p/4,"L",x,2*p/3,"M",x+3,p/4,"L",x+3,2*p/3]});this.scrollbarPad=F;this.rendered=!0}}},addEvents:function(){var a=this.chart.container, -b=this.mouseDownHandler,c=this.mouseMoveHandler,d=this.mouseUpHandler,e;e=[[a,"mousedown",b],[a,"mousemove",c],[document,"mouseup",d]];ab&&e.push([a,"touchstart",b],[a,"touchmove",c],[document,"touchend",d]);q(e,function(a){A.apply(null,a)});this._events=e},removeEvents:function(){q(this._events,function(a){R.apply(null,a)});this._events=r;this.navigatorEnabled&&this.baseSeries&&R(this.baseSeries,"updatedData",this.updatedDataHandler)},init:function(){var a=this,b=a.chart,c,d,e=a.scrollbarHeight, -f=a.navigatorOptions,g=a.height,h=a.top,i,k,j=document.body.style,l,m=a.baseSeries;a.mouseDownHandler=function(d){var d=b.pointer.normalize(d),e=a.zoomedMin,f=a.zoomedMax,h=a.top,k=a.scrollbarHeight,m=a.scrollerLeft,n=a.scrollerWidth,o=a.navigatorLeft,p=a.navigatorWidth,q=a.scrollbarPad,r=a.range,s=d.chartX,t=d.chartY,d=b.xAxis[0],v,w=cb?10:7;if(t>h&&to+e-q&&sm&&sm+n-k?e+r*0.2:s=p)f=p-r,v=c.dataMax;if(f!==e)a.fixedWidth=r,e=c.toFixedRange(f,f+r,null,v),d.setExtremes(e.min,e.max,!0,!1,{trigger:"navigator"})}};a.mouseMoveHandler=function(c){var d=a.scrollbarHeight,e=a.navigatorLeft, -f=a.navigatorWidth,g=a.scrollerLeft,h=a.scrollerWidth,j=a.range,l;if(c.pageX!==0)c=b.pointer.normalize(c),l=c.chartX,lg+h-d&&(l=g+h-d),a.grabbedLeft?(k=!0,a.render(0,0,l-e,a.otherHandlePos)):a.grabbedRight?(k=!0,a.render(0,0,a.otherHandlePos,l-e)):a.grabbedCenter&&(k=!0,lf+i-j&&(l=f+i-j),a.render(0,0,l-i,l-i+j)),k&&a.scrollbarOptions.liveRedraw&&setTimeout(function(){a.mouseUpHandler(c)},0)};a.mouseUpHandler=function(d){var e,f;if(k){if(a.zoomedMin===a.otherHandlePos)e=a.fixedExtreme; -else if(a.zoomedMax===a.otherHandlePos)f=a.fixedExtreme;e=c.toFixedRange(a.zoomedMin,a.zoomedMax,e,f);b.xAxis[0].setExtremes(e.min,e.max,!0,!1,{trigger:"navigator",triggerOp:"navigator-drag",DOMEvent:d})}if(d.type!=="mousemove")a.grabbedLeft=a.grabbedRight=a.grabbedCenter=a.fixedWidth=a.fixedExtreme=a.otherHandlePos=k=i=null,j.cursor=l||""};var n=b.xAxis.length,p=b.yAxis.length;b.extraBottomMargin=a.outlineHeight+f.margin;a.navigatorEnabled?(a.xAxis=c=new L(b,y({ordinal:m&&m.xAxis.options.ordinal}, -f.xAxis,{id:"navigator-x-axis",isX:!0,type:"datetime",index:n,height:g,offset:0,offsetLeft:e,offsetRight:-e,keepOrdinalPadding:!0,startOnTick:!1,endOnTick:!1,minPadding:0,maxPadding:0,zoomEnabled:!1})),a.yAxis=d=new L(b,y(f.yAxis,{id:"navigator-y-axis",alignTicks:!1,height:g,offset:0,index:p,zoomEnabled:!1})),m||f.series.data?a.addBaseSeries():b.series.length===0&&O(b,"redraw",function(c,d){if(b.series.length>0&&!a.series)a.setBaseSeries(),b.redraw=c;c.call(b,d)})):a.xAxis=c={translate:function(a, -c){var d=b.xAxis[0].getExtremes(),f=b.plotWidth-2*e,g=d.dataMin,d=d.dataMax-g;return c?a*d/f+g:f*(a-g)/d},toFixedRange:L.prototype.toFixedRange};O(b,"getMargins",function(b){var e=this.legend,f=e.options;b.call(this);a.top=h=a.navigatorOptions.top||this.chartHeight-a.height-a.scrollbarHeight-this.spacing[2]-(f.verticalAlign==="bottom"&&f.enabled&&!f.floating?e.legendHeight+o(f.margin,10):0);if(c&&d)c.options.top=d.options.top=h,c.setAxisSize(),d.setAxisSize()});a.addEvents()},getUnionExtremes:function(a){var b= -this.chart.xAxis[0],c=this.xAxis,d=c.options;if(!a||b.dataMin!==null)return{dataMin:o(d&&d.min,(t(b.dataMin)&&t(c.dataMin)?z:o)(b.dataMin,c.dataMin)),dataMax:o(d&&d.max,(t(b.dataMax)&&t(c.dataMax)?w:o)(b.dataMax,c.dataMax))}},setBaseSeries:function(a){var b=this.chart,a=a||b.options.navigator.baseSeries;this.series&&this.series.remove();this.baseSeries=b.series[a]||typeof a==="string"&&b.get(a)||b.series[0];this.xAxis&&this.addBaseSeries()},addBaseSeries:function(){var a=this.baseSeries,b=a?a.options: -{},c=b.data,d=this.navigatorOptions.series,e;e=d.data;this.hasNavigatorData=!!e;b=y(b,d,{enableMouseTracking:!1,group:"nav",padXAxis:!1,xAxis:"navigator-x-axis",yAxis:"navigator-y-axis",name:"Navigator",showInLegend:!1,isInternal:!0,visible:!0});b.data=e||c;this.series=this.chart.initSeries(b);if(a&&this.navigatorOptions.adaptToUpdatedData!==!1)A(a,"updatedData",this.updatedDataHandler),a.userOptions.events=v(a.userOptions.event,{updatedData:this.updatedDataHandler})},updatedDataHandler:function(){var a= -this.chart.scroller,b=a.baseSeries,c=b.xAxis,d=c.getExtremes(),e=d.min,f=d.max,g=d.dataMin,d=d.dataMax,h=f-e,i,k,j,l,m,n=a.series;i=n.xData;var o=!!c.setExtremes;k=f>=i[i.length-1]-(this.closestPointRange||0);i=e<=g;if(!a.hasNavigatorData)n.options.pointStart=b.xData[0],n.setData(b.options.data,!1),m=!0;i&&(l=g,j=l+h);k&&(j=d,i||(l=w(j-h,n.xData[0])));o&&(i||k)?isNaN(l)||c.setExtremes(l,j,!0,!1,{trigger:"updatedData"}):(m&&this.chart.redraw(!1),a.render(w(e,g),z(f,d)))},destroy:function(){this.removeEvents(); -q([this.xAxis,this.yAxis,this.leftShade,this.rightShade,this.outline,this.scrollbarTrack,this.scrollbarRifles,this.scrollbarGroup,this.scrollbar],function(a){a&&a.destroy&&a.destroy()});this.xAxis=this.yAxis=this.leftShade=this.rightShade=this.outline=this.scrollbarTrack=this.scrollbarRifles=this.scrollbarGroup=this.scrollbar=null;q([this.scrollbarButtons,this.handles,this.elementsToDestroy],function(a){Ka(a)})}};P.Scroller=yb;O(L.prototype,"zoom",function(a,b,c){var d=this.chart,e=d.options,f=e.chart.zoomType, -g=e.navigator,e=e.rangeSelector,h;if(this.isXAxis&&(g&&g.enabled||e&&e.enabled))if(f==="x")d.resetZoomButton="blocked";else if(f==="y")h=!1;else if(f==="xy")d=this.previousZoom,t(b)?this.previousZoom=[this.min,this.max]:d&&(b=d[0],c=d[1],delete this.previousZoom);return h!==r?h:a.call(this,b,c)});O(va.prototype,"init",function(a,b,c){A(this,"beforeRender",function(){var a=this.options;if(a.navigator.enabled||a.scrollbar.enabled)this.scroller=new yb(this)});a.call(this,b,c)});O(K.prototype,"addPoint", -function(a,b,c,d,e){var f=this.options.turboThreshold;f&&this.xData.length>f&&fa(b)&&!Pa(b)&&this.chart.scroller&&qa(20,!0);a.call(this,b,c,d,e)});v(F,{rangeSelector:{buttonTheme:{width:28,height:18,fill:"#f7f7f7",padding:2,r:0,"stroke-width":0,style:{color:"#444",cursor:"pointer",fontWeight:"normal"},zIndex:7,states:{hover:{fill:"#e7e7e7"},select:{fill:"#e7f0f9",style:{color:"black",fontWeight:"bold"}}}},inputPosition:{align:"right"},labelStyle:{color:"#666"}}});F.lang=y(F.lang,{rangeSelectorZoom:"Zoom", -rangeSelectorFrom:"From",rangeSelectorTo:"To"});zb.prototype={clickButton:function(a,b){var c=this,d=c.selected,e=c.chart,f=c.buttons,g=c.buttonOptions[a],h=e.xAxis[0],i=e.scroller&&e.scroller.getUnionExtremes()||h||{},k=i.dataMin,j=i.dataMax,l,m=h&&s(z(h.max,o(j,h.max))),n=new Date(m),p=g.type,u=g.count,i=g._range,t;if(!(k===null||j===null||a===c.selected)){if(p==="month"||p==="year")l={month:"Month",year:"FullYear"}[p],n["set"+l](n["get"+l]()-u),l=n.getTime(),k=o(k,Number.MIN_VALUE),isNaN(l)||l< -k?(l=k,m=z(l+i,j)):i=m-l;else if(i)l=w(m-i,k),m=z(l+i,j);else if(p==="ytd")if(h){if(j===r)k=Number.MAX_VALUE,j=Number.MIN_VALUE,q(e.series,function(a){a=a.xData;k=z(a[0],k);j=w(a[a.length-1],j)}),b=!1;m=new Date(j);t=m.getFullYear();l=t=w(k||0,Date.UTC(t,0,1));m=m.getTime();m=z(j||m,m)}else{A(e,"beforeRender",function(){c.clickButton(a)});return}else p==="all"&&h&&(l=k,m=j);f[d]&&f[d].setState(0);f[a]&&f[a].setState(2);e.fixedRange=i;h?h.setExtremes(l,m,o(b,1),0,{trigger:"rangeSelectorButton",rangeSelectorButton:g}): -(d=e.options.xAxis,d[0]=y(d[0],{range:i,min:t}));c.setSelected(a)}},setSelected:function(a){this.selected=this.options.selected=a},defaultButtons:[{type:"month",count:1,text:"1m"},{type:"month",count:3,text:"3m"},{type:"month",count:6,text:"6m"},{type:"ytd",text:"YTD"},{type:"year",count:1,text:"1y"},{type:"all",text:"All"}],init:function(a){var b=this,c=a.options.rangeSelector,d=c.buttons||[].concat(b.defaultButtons),e=c.selected,f=b.blurInputs=function(){var a=b.minInput,c=b.maxInput;a&&a.blur(); -c&&c.blur()};b.chart=a;b.options=c;b.buttons=[];a.extraTopMargin=35;b.buttonOptions=d;A(a.container,"mousedown",f);A(a,"resize",f);q(d,b.computeButtonRange);e!==r&&d[e]&&this.clickButton(e,!1);A(a,"load",function(){A(a.xAxis[0],"afterSetExtremes",function(){b.updateButtonStates(!0)})})},updateButtonStates:function(a){var b=this,c=this.chart,d=c.xAxis[0],e=c.scroller&&c.scroller.getUnionExtremes()||d,f=e.dataMin,g=e.dataMax,h=b.selected,i=b.buttons;a&&c.fixedRange!==s(d.max-d.min)&&(i[h]&&i[h].setState(0), -b.setSelected(null));q(b.buttonOptions,function(a,c){var e=a._range,m=e>g-f,n=e=g-f&&i[c].state!==2,q=a.type==="ytd"&&ua("%Y",f)===ua("%Y",g);e===s(d.max-d.min)&&c!==h?(b.setSelected(c),i[c].setState(2)):m||n||o||q?i[c].setState(3):i[c].state===3&&i[c].setState(0)})},computeButtonRange:function(a){var b=a.type,c=a.count||1,d={millisecond:1,second:1E3,minute:6E4,hour:36E5,day:864E5,week:6048E5};if(d[b])a._range=d[b]*c;else if(b==="month"||b==="year")a._range= -{month:30,year:365}[b]*864E5*c},setInputValue:function(a,b){var c=this.chart.options.rangeSelector;if(t(b))this[a+"Input"].HCTime=b;this[a+"Input"].value=ua(c.inputEditDateFormat||"%Y-%m-%d",this[a+"Input"].HCTime);this[a+"DateBox"].attr({text:ua(c.inputDateFormat||"%b %e, %Y",this[a+"Input"].HCTime)})},drawInput:function(a){var b=this,c=b.chart,d=c.renderer.style,e=c.renderer,f=c.options.rangeSelector,g=b.div,h=a==="min",i,k,j,l=this.inputGroup;this[a+"Label"]=k=e.label(F.lang[h?"rangeSelectorFrom": -"rangeSelectorTo"],this.inputGroup.offset).attr({padding:2}).css(y(d,f.labelStyle)).add(l);l.offset+=k.width+5;this[a+"DateBox"]=j=e.label("",l.offset).attr({padding:2,width:f.inputBoxWidth||90,height:f.inputBoxHeight||17,stroke:f.inputBoxBorderColor||"silver","stroke-width":1}).css(y({textAlign:"center",color:"#444"},d,f.inputStyle)).on("click",function(){b[a+"Input"].focus()}).add(l);l.offset+=j.width+(h?10:0);this[a+"Input"]=i=$("input",{name:a,className:"highcharts-range-selector",type:"text"}, -v({position:"absolute",border:0,width:"1px",height:"1px",padding:0,textAlign:"center",fontSize:d.fontSize,fontFamily:d.fontFamily,top:c.plotTop+"px"},f.inputStyle),g);i.onfocus=function(){E(this,{left:l.translateX+j.x+"px",top:l.translateY+"px",width:j.width-2+"px",height:j.height-2+"px",border:"2px solid silver"})};i.onblur=function(){E(this,{border:0,width:"1px",height:"1px"});b.setInputValue(a)};i.onchange=function(){var a=i.value,d=(f.inputDateParser||Date.parse)(a),e=c.xAxis[0],g=e.dataMin,j= -e.dataMax;isNaN(d)&&(d=a.split("-"),d=Date.UTC(I(d[0]),I(d[1])-1,I(d[2])));isNaN(d)||(F.global.useUTC||(d+=(new Date).getTimezoneOffset()*6E4),h?d>b.maxInput.HCTime?d=r:dj&&(d=j),d!==r&&c.xAxis[0].setExtremes(h?d:e.min,h?e.max:d,r,r,{trigger:"rangeSelectorInput"}))}},render:function(a,b){var c=this,d=c.chart,e=d.renderer,f=d.container,g=d.options,h=g.exporting&&g.navigation&&g.navigation.buttonOptions,i=g.rangeSelector,k=c.buttons,g=F.lang,j=c.div,j=c.inputGroup, -l=i.buttonTheme,m=i.inputEnabled!==!1,n=l&&l.states,p=d.plotLeft,r;if(!c.rendered&&(c.zoomText=e.text(g.rangeSelectorZoom,p,d.plotTop-20).css(i.labelStyle).add(),r=p+c.zoomText.getBBox().width+5,q(c.buttonOptions,function(a,b){k[b]=e.button(a.text,r,d.plotTop-35,function(){c.clickButton(b);c.isActive=!0},l,n&&n.hover,n&&n.select).css({textAlign:"center"}).add();r+=k[b].width+o(i.buttonSpacing,5);c.selected===b&&k[b].setState(2)}),c.updateButtonStates(),m))c.div=j=$("div",null,{position:"relative", -height:0,zIndex:1}),f.parentNode.insertBefore(j,f),c.inputGroup=j=e.g("input-group").add(),j.offset=0,c.drawInput("min"),c.drawInput("max");m&&(f=d.plotTop-45,j.align(v({y:f,width:j.offset,x:h&&f<(h.y||0)+h.height-d.spacing[0]?-40:0},i.inputPosition),!0,d.spacingBox),c.setInputValue("min",a),c.setInputValue("max",b));c.rendered=!0},destroy:function(){var a=this.minInput,b=this.maxInput,c=this.chart,d=this.blurInputs,e;R(c.container,"mousedown",d);R(c,"resize",d);Ka(this.buttons);if(a)a.onfocus=a.onblur= -a.onchange=null;if(b)b.onfocus=b.onblur=b.onchange=null;for(e in this)this[e]&&e!=="chart"&&(this[e].destroy?this[e].destroy():this[e].nodeType&&Sa(this[e])),this[e]=null}};L.prototype.toFixedRange=function(a,b,c,d){var e=this.chart&&this.chart.fixedRange,a=o(c,this.translate(a,!0)),b=o(d,this.translate(b,!0)),c=e&&(b-a)/e;c>0.7&&c<1.3&&(d?a=b-e:b=a+e);return{min:a,max:b}};O(va.prototype,"init",function(a,b,c){A(this,"init",function(){if(this.options.rangeSelector.enabled)this.rangeSelector=new zb(this)}); -a.call(this,b,c)});P.RangeSelector=zb;va.prototype.callbacks.push(function(a){function b(){f=a.xAxis[0].getExtremes();g.render(f.min,f.max)}function c(){f=a.xAxis[0].getExtremes();isNaN(f.min)||h.render(f.min,f.max)}function d(a){a.triggerOp!=="navigator-drag"&&g.render(a.min,a.max)}function e(a){h.render(a.min,a.max)}var f,g=a.scroller,h=a.rangeSelector;g&&(A(a.xAxis[0],"afterSetExtremes",d),O(a,"drawChartBox",function(a){var c=this.isDirtyBox;a.call(this);c&&b()}),b());h&&(A(a.xAxis[0],"afterSetExtremes", -e),A(a,"resize",c),c());A(a,"destroy",function(){g&&R(a.xAxis[0],"afterSetExtremes",d);h&&(R(a,"resize",c),R(a.xAxis[0],"afterSetExtremes",e))})});P.StockChart=function(a,b){var c=a.series,d,e=o(a.navigator&&a.navigator.enabled,!0)?{startOnTick:!1,endOnTick:!1}:null,f={marker:{enabled:!1,radius:2},states:{hover:{lineWidth:2}}},g={shadow:!1,borderWidth:0};a.xAxis=xa(ma(a.xAxis||{}),function(a){return y({minPadding:0,maxPadding:0,ordinal:!0,title:{text:null},labels:{overflow:"justify"},showLastLabel:!0}, -a,{type:"datetime",categories:null},e)});a.yAxis=xa(ma(a.yAxis||{}),function(a){d=o(a.opposite,!0);return y({labels:{y:-2},opposite:d,showLastLabel:!1,title:{text:null}},a)});a.series=null;a=y({chart:{panning:!0,pinchType:"x"},navigator:{enabled:!0},scrollbar:{enabled:!0},rangeSelector:{enabled:!0},title:{text:null,style:{fontSize:"16px"}},tooltip:{shared:!0,crosshairs:!0},legend:{enabled:!1},plotOptions:{line:f,spline:f,area:f,areaspline:f,arearange:f,areasplinerange:f,column:g,columnrange:g,candlestick:g, -ohlc:g}},a,{_stock:!0,chart:{inverted:!1}});a.series=c;return new va(a,b)};O(Xa.prototype,"init",function(a,b,c){var d=c.chart.pinchType||"";a.call(this,b,c);this.pinchX=this.pinchHor=d.indexOf("x")!==-1;this.pinchY=this.pinchVert=d.indexOf("y")!==-1;this.hasZoom=this.hasZoom||this.pinchHor||this.pinchVert});O(L.prototype,"autoLabelAlign",function(a){if(this.chart.options._stock&&this.coll==="yAxis"&&wa(this,this.chart.yAxis)===0){if(this.options.labels.x===15)this.options.labels.x=0;return"right"}return a.call(this)}); -L.prototype.getPlotLinePath=function(a,b,c,d,e){var f=this,g=this.isLinked&&!this.series?this.linkedParent.series:this.series,h=f.chart,i=h.renderer,k=f.left,j=f.top,l,m,n,p,r=[],v,w;v=f.isXAxis?t(f.options.yAxis)?[h.yAxis[f.options.yAxis]]:xa(g,function(a){return a.yAxis}):t(f.options.xAxis)?[h.xAxis[f.options.xAxis]]:xa(g,function(a){return a.xAxis});q(f.isXAxis?h.yAxis:h.xAxis,function(a){if(t(a.options.id)?a.options.id.indexOf("navigator")===-1:1){var b=a.isXAxis?"yAxis":"xAxis",b=t(a.options[b])? -h[b][a.options[b]]:h[b][0];f===b&&v.push(a)}});w=v.length?[]:[f];q(v,function(a){wa(a,w)===-1&&w.push(a)});e=o(e,f.translate(a,null,null,c));isNaN(e)||(f.horiz?q(w,function(a){m=a.top;p=m+a.len;l=n=s(e+f.transB);(l>=k&&l<=k+f.width||d)&&r.push("M",l,m,"L",n,p)}):q(w,function(a){l=a.left;n=l+a.width;m=p=s(j+f.height-e);(m>=j&&m<=j+f.height||d)&&r.push("M",l,m,"L",n,p)}));if(r.length>0)return i.crispPolyLine(r,b||1)};L.prototype.getPlotBandPath=function(a,b){var c=this.getPlotLinePath(b),d=this.getPlotLinePath(a), -e=[],f;if(d&&c)for(f=0;fk+this.height)this.hideCrosshair();else{!n&&!f.formatter&&(this.isDatetimeAxis&&(p="%b %d, %Y"),n="{value"+(p?":"+p:"")+"}");j.attr({text:n? -Ja(n,{value:c[g]}):f.formatter.call(this,c[g]),x:l,y:m,visibility:"visible"});c=j.getBBox();if(b){if(this.options.tickPosition==="inside"&&!h||this.options.tickPosition!=="inside"&&h)m=j.y-c.height}else m=j.y-c.height/2;b?(d=i-c.x,e=i+this.width-c.x):(d=this.labelAlign==="left"?i:0,e=this.labelAlign==="right"?i+this.width:a.chartWidth);j.translateX=e&&(l-=j.translateX+c.width-e);j.attr({x:l,y:m,visibility:"visible"})}}});var mc=ba.init,nc=ba.processData, -oc=za.prototype.tooltipFormatter;ba.init=function(){mc.apply(this,arguments);this.setCompare(this.options.compare)};ba.setCompare=function(a){this.modifyValue=a==="value"||a==="percent"?function(b,c){var d=this.compareValue;if(b!==r&&(b=a==="value"?b-d:b=100*(b/d)-100,c))c.change=b;return b}:null;if(this.chart.hasRendered)this.isDirty=!0};ba.processData=function(){var a=0,b,c,d;nc.apply(this,arguments);if(this.xAxis&&this.processedYData){b=this.processedXData;c=this.processedYData;for(d=c.length;a< -d;a++)if(typeof c[a]==="number"&&b[a]>=this.xAxis.min){this.compareValue=c[a];break}}};O(ba,"getExtremes",function(a){a.call(this);if(this.modifyValue)this.dataMax=this.modifyValue(this.dataMax),this.dataMin=this.modifyValue(this.dataMin)});L.prototype.setCompare=function(a,b){this.isXAxis||(q(this.series,function(b){b.setCompare(a)}),o(b,!0)&&this.chart.redraw())};za.prototype.tooltipFormatter=function(a){a=a.replace("{point.change}",(this.change>0?"+":"")+Ia(this.change,o(this.series.tooltipOptions.changeDecimals, -2)));return oc.apply(this,[a])};O(K.prototype,"render",function(a){if(this.isCartesian&&this.chart.options._stock)this.clipBox?this.chart[this.sharedClipKey]&&this.chart[this.sharedClipKey].attr({width:this.xAxis.len,height:this.yAxis.len}):(this.clipBox=y(this.chart.clipBox),this.clipBox.width=this.xAxis.len,this.clipBox.height=this.yAxis.len);a.call(this)});v(P,{Axis:L,Chart:va,Color:Fa,Point:za,Tick:Za,Renderer:Wa,Series:K,SVGElement:Z,SVGRenderer:ka,arrayMin:Ra,arrayMax:Ba,charts:aa,dateFormat:ua, -format:Ja,pathAnim:Bb,getOptions:function(){return F},hasBidiBug:Yb,isTouchDevice:cb,numberFormat:Ia,seriesTypes:C,setOptions:function(a){F=y(!0,F,a);Mb();return F},addEvent:A,removeEvent:R,createElement:$,discardElement:Sa,css:E,each:q,extend:v,map:xa,merge:y,pick:o,splat:ma,extendClass:ga,pInt:I,wrap:O,svg:ca,canvas:ja,vml:!ca&&!ja,product:"Highstock",version:"2.0.1"})})(); diff --git a/htdocs/js/lib/highstock/modules/canvas-tools.js b/htdocs/js/lib/highstock/modules/canvas-tools.js deleted file mode 100644 index b015ce6a..00000000 --- a/htdocs/js/lib/highstock/modules/canvas-tools.js +++ /dev/null @@ -1,133 +0,0 @@ -/* - A class to parse color values - @author Stoyan Stefanov - @link http://www.phpied.com/rgb-color-parser-in-javascript/ - Use it if you like it - - canvg.js - Javascript SVG parser and renderer on Canvas - MIT Licensed - Gabe Lerner (gabelerner@gmail.com) - http://code.google.com/p/canvg/ - - Requires: rgbcolor.js - http://www.phpied.com/rgb-color-parser-in-javascript/ - - Highstock JS v2.0.1 (2014-04-24) - CanVGRenderer Extension module - - (c) 2011-2012 Torstein Honsi, Erik Olsson - - License: www.highcharts.com/license -*/ -function RGBColor(m){this.ok=!1;m.charAt(0)=="#"&&(m=m.substr(1,6));var m=m.replace(/ /g,""),m=m.toLowerCase(),a={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b", -darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dodgerblue:"1e90ff",feldspar:"d19275",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff", -gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgrey:"d3d3d3",lightgreen:"90ee90",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa", -lightslateblue:"8470ff",lightslategray:"778899",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"00ff00",limegreen:"32cd32",linen:"faf0e6",magenta:"ff00ff",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370d8",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080", -oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"d87093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",red:"ff0000",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd", -slategray:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",violetred:"d02090",wheat:"f5deb3",white:"ffffff",whitesmoke:"f5f5f5",yellow:"ffff00",yellowgreen:"9acd32"},c;for(c in a)m==c&&(m=a[c]);var d=[{re:/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,example:["rgb(123, 234, 45)","rgb(255,234,245)"],process:function(b){return[parseInt(b[1]),parseInt(b[2]),parseInt(b[3])]}},{re:/^(\w{2})(\w{2})(\w{2})$/, -example:["#00ff00","336699"],process:function(b){return[parseInt(b[1],16),parseInt(b[2],16),parseInt(b[3],16)]}},{re:/^(\w{1})(\w{1})(\w{1})$/,example:["#fb0","f0f"],process:function(b){return[parseInt(b[1]+b[1],16),parseInt(b[2]+b[2],16),parseInt(b[3]+b[3],16)]}}];for(c=0;c255?255:this.r;this.g=this.g<0||isNaN(this.g)?0: -this.g>255?255:this.g;this.b=this.b<0||isNaN(this.b)?0:this.b>255?255:this.b;this.toRGB=function(){return"rgb("+this.r+", "+this.g+", "+this.b+")"};this.toHex=function(){var b=this.r.toString(16),a=this.g.toString(16),d=this.b.toString(16);b.length==1&&(b="0"+b);a.length==1&&(a="0"+a);d.length==1&&(d="0"+d);return"#"+b+a+d};this.getHelpXML=function(){for(var b=[],k=0;k "+o.toRGB()+" -> "+o.toHex());l.appendChild(n);l.appendChild(q);c.appendChild(l)}catch(p){}return c}} -if(!window.console)window.console={},window.console.log=function(){},window.console.dir=function(){};if(!Array.prototype.indexOf)Array.prototype.indexOf=function(m){for(var a=0;a]*>/,""),d=new ActiveXObject("Microsoft.XMLDOM");d.async="false";d.loadXML(a);return d}};a.Property=function(c,d){this.name=c;this.value=d;this.hasValue=function(){return this.value!=null&&this.value!==""};this.numValue=function(){if(!this.hasValue())return 0;var b=parseFloat(this.value);(this.value+"").match(/%$/)&& -(b/=100);return b};this.valueOrDefault=function(b){return this.hasValue()?this.value:b};this.numValueOrDefault=function(b){return this.hasValue()?this.numValue():b};var b=this;this.Color={addOpacity:function(d){var c=b.value;if(d!=null&&d!=""){var f=new RGBColor(b.value);f.ok&&(c="rgba("+f.r+", "+f.g+", "+f.b+", "+d+")")}return new a.Property(b.name,c)}};this.Definition={getDefinition:function(){var d=b.value.replace(/^(url\()?#([^\)]+)\)?$/,"$2");return a.Definitions[d]},isUrl:function(){return b.value.indexOf("url(")== -0},getFillStyle:function(b){var d=this.getDefinition();return d!=null&&d.createGradient?d.createGradient(a.ctx,b):d!=null&&d.createPattern?d.createPattern(a.ctx,b):null}};this.Length={DPI:function(){return 96},EM:function(b){var d=12,c=new a.Property("fontSize",a.Font.Parse(a.ctx.font).fontSize);c.hasValue()&&(d=c.Length.toPixels(b));return d},toPixels:function(d){if(!b.hasValue())return 0;var c=b.value+"";return c.match(/em$/)?b.numValue()*this.EM(d):c.match(/ex$/)?b.numValue()*this.EM(d)/2:c.match(/px$/)? -b.numValue():c.match(/pt$/)?b.numValue()*1.25:c.match(/pc$/)?b.numValue()*15:c.match(/cm$/)?b.numValue()*this.DPI(d)/2.54:c.match(/mm$/)?b.numValue()*this.DPI(d)/25.4:c.match(/in$/)?b.numValue()*this.DPI(d):c.match(/%$/)?b.numValue()*a.ViewPort.ComputeSize(d):b.numValue()}};this.Time={toMilliseconds:function(){if(!b.hasValue())return 0;var a=b.value+"";if(a.match(/s$/))return b.numValue()*1E3;a.match(/ms$/);return b.numValue()}};this.Angle={toRadians:function(){if(!b.hasValue())return 0;var a=b.value+ -"";return a.match(/deg$/)?b.numValue()*(Math.PI/180):a.match(/grad$/)?b.numValue()*(Math.PI/200):a.match(/rad$/)?b.numValue():b.numValue()*(Math.PI/180)}}};a.Font=new function(){this.Styles=["normal","italic","oblique","inherit"];this.Variants=["normal","small-caps","inherit"];this.Weights="normal,bold,bolder,lighter,100,200,300,400,500,600,700,800,900,inherit".split(",");this.CreateFont=function(d,b,c,e,f,g){g=g!=null?this.Parse(g):this.CreateFont("","","","","",a.ctx.font);return{fontFamily:f|| -g.fontFamily,fontSize:e||g.fontSize,fontStyle:d||g.fontStyle,fontWeight:c||g.fontWeight,fontVariant:b||g.fontVariant,toString:function(){return[this.fontStyle,this.fontVariant,this.fontWeight,this.fontSize,this.fontFamily].join(" ")}}};var c=this;this.Parse=function(d){for(var b={},d=a.trim(a.compressSpaces(d||"")).split(" "),k=!1,e=!1,f=!1,g=!1,j="",h=0;hthis.x2)this.x2=b}if(a!=null){if(isNaN(this.y1)||isNaN(this.y2))this.y2=this.y1=a;if(athis.y2)this.y2=a}};this.addX=function(b){this.addPoint(b,null)};this.addY=function(b){this.addPoint(null,b)};this.addBoundingBox=function(b){this.addPoint(b.x1,b.y1);this.addPoint(b.x2,b.y2)};this.addQuadraticCurve=function(b,a,d,c,k,l){d=b+2/3*(d-b);c=a+2/3*(c- -a);this.addBezierCurve(b,a,d,d+1/3*(k-b),c,c+1/3*(l-a),k,l)};this.addBezierCurve=function(b,a,d,c,k,l,o,n){var q=[b,a],p=[d,c],t=[k,l],m=[o,n];this.addPoint(q[0],q[1]);this.addPoint(m[0],m[1]);for(i=0;i<=1;i++)b=function(b){return Math.pow(1-b,3)*q[i]+3*Math.pow(1-b,2)*b*p[i]+3*(1-b)*Math.pow(b,2)*t[i]+Math.pow(b,3)*m[i]},a=6*q[i]-12*p[i]+6*t[i],d=-3*q[i]+9*p[i]-9*t[i]+3*m[i],c=3*p[i]-3*q[i],d==0?a!=0&&(a=-c/a,0=this.tokens.length-1};this.isCommandOrEnd=function(){return this.isEnd()? -!0:this.tokens[this.i+1].match(/^[A-Za-z]$/)!=null};this.isRelativeCommand=function(){return this.command==this.command.toLowerCase()};this.getToken=function(){this.i+=1;return this.tokens[this.i]};this.getScalar=function(){return parseFloat(this.getToken())};this.nextCommand=function(){this.previousCommand=this.command;this.command=this.getToken()};this.getPoint=function(){return this.makeAbsolute(new a.Point(this.getScalar(),this.getScalar()))};this.getAsControlPoint=function(){var b=this.getPoint(); -return this.control=b};this.getAsCurrentPoint=function(){var b=this.getPoint();return this.current=b};this.getReflectedControlPoint=function(){return this.previousCommand.toLowerCase()!="c"&&this.previousCommand.toLowerCase()!="s"?this.current:new a.Point(2*this.current.x-this.control.x,2*this.current.y-this.control.y)};this.makeAbsolute=function(b){if(this.isRelativeCommand())b.x=this.current.x+b.x,b.y=this.current.y+b.y;return b};this.addMarker=function(b,a,d){d!=null&&this.angles.length>0&&this.angles[this.angles.length- -1]==null&&(this.angles[this.angles.length-1]=this.points[this.points.length-1].angleTo(d));this.addMarkerAngle(b,a==null?null:a.angleTo(b))};this.addMarkerAngle=function(b,a){this.points.push(b);this.angles.push(a)};this.getMarkerPoints=function(){return this.points};this.getMarkerAngles=function(){for(var b=0;b1&&(h*=Math.sqrt(q),l*=Math.sqrt(q));o=(o==j?-1:1)*Math.sqrt((Math.pow(h,2)*Math.pow(l,2)-Math.pow(h,2)*Math.pow(n.y,2)-Math.pow(l,2)*Math.pow(n.x,2))/(Math.pow(h,2)*Math.pow(n.y,2)+Math.pow(l,2)*Math.pow(n.x,2)));isNaN(o)&&(o=0);var p=new a.Point(o*h*n.y/l,o*-l*n.x/h),g=new a.Point((g.x+e.x)/2+Math.cos(f)* -p.x-Math.sin(f)*p.y,(g.y+e.y)/2+Math.sin(f)*p.x+Math.cos(f)*p.y),m=function(b,a){return(b[0]*a[0]+b[1]*a[1])/(Math.sqrt(Math.pow(b[0],2)+Math.pow(b[1],2))*Math.sqrt(Math.pow(a[0],2)+Math.pow(a[1],2)))},s=function(b,a){return(b[0]*a[1]=1&&(n=0);j==0&&n>0&&(n-=2*Math.PI);j==1&&n<0&&(n+=2*Math.PI);q=new a.Point(g.x-h*Math.cos((o+n)/ -2),g.y-l*Math.sin((o+n)/2));b.addMarkerAngle(q,(o+n)/2+(j==0?1:-1)*Math.PI/2);b.addMarkerAngle(e,n+(j==0?1:-1)*Math.PI/2);c.addPoint(e.x,e.y);d!=null&&(m=h>l?h:l,e=h>l?1:h/l,h=h>l?l/h:1,d.translate(g.x,g.y),d.rotate(f),d.scale(e,h),d.arc(0,0,m,o,o+n,1-j),d.scale(1/e,1/h),d.rotate(-f),d.translate(-g.x,-g.y))}break;case "Z":d!=null&&d.closePath(),b.current=b.start}return c};this.getMarkers=function(){for(var a=this.PathParser.getMarkerPoints(),b=this.PathParser.getMarkerAngles(),c=[],e=0;ethis.maxDuration)if(this.attribute("repeatCount").value=="indefinite")this.duration=0;else return this.attribute("fill").valueOrDefault("remove")=="remove"&&!this.removed?(this.removed=!0,this.getProperty().value=this.initialValue,!0):!1;this.duration+=a;a=!1;if(this.begin0&&b[c-1]!=" "&&c0&&b[c-1]!=" "&&(c==b.length-1||b[c+1]==" "))g="initial";typeof a.glyphs[e]!="undefined"&&(f=a.glyphs[e][g],f==null&&a.glyphs[e].type=="glyph"&&(f=a.glyphs[e]))}else f=a.glyphs[e];if(f==null)f=a.missingGlyph;return f};this.renderChildren=function(c){var b=this.parent.style("font-family").Definition.getDefinition();if(b!=null){var k=this.parent.style("font-size").numValueOrDefault(a.Font.Parse(a.ctx.font).fontSize), -e=this.parent.style("font-style").valueOrDefault(a.Font.Parse(a.ctx.font).fontStyle),f=this.getText();b.isRTL&&(f=f.split("").reverse().join(""));for(var g=a.ToNumberArray(this.parent.attribute("dx").value),j=0;j0?c.childNodes[0].nodeValue:c.text;this.getText=function(){return this.text}};a.Element.tspan.prototype=new a.Element.TextElementBase;a.Element.tref=function(c){this.base=a.Element.TextElementBase;this.base(c);this.getText=function(){var a=this.attribute("xlink:href").Definition.getDefinition();if(a!=null)return a.children[0].getText()}};a.Element.tref.prototype=new a.Element.TextElementBase; -a.Element.a=function(c){this.base=a.Element.TextElementBase;this.base(c);this.hasText=!0;for(var d=0;d1?c.childNodes[1].nodeValue: -""),c=c.replace(/(\/\*([^*]|[\r\n]|(\*+([^*\/]|[\r\n])))*\*+\/)|(^[\s]*\/\/.*)/gm,""),c=a.compressSpaces(c),c=c.split("}"),d=0;d0){l=g[j].indexOf("url");h=g[j].indexOf(")",l);l=g[j].substr(l+5,h-l-6);l=a.parseXml(a.ajax(l)).getElementsByTagName("font");for(h=0;h=e&&c<=h&&!j&&k!==""&&(k=b.split(f),m(k,function(b,a){a>=i&&a<=g&&(d[a-i]||(d[a-i]=[]),d[a-i][o]=b)}),o+=1)}),this.dataFound())},parseTable:function(){var a=this.options,b=a.table,c=this.columns,d=a.startRow||0,e=a.endRow||Number.MAX_VALUE,h=a.startColumn||0,i=a.endColumn||Number.MAX_VALUE;b&&(typeof b==="string"&&(b=document.getElementById(b)),m(b.getElementsByTagName("tr"),function(a, -b){b>=d&&b<=e&&m(a.children,function(a,e){if((a.tagName==="TD"||a.tagName==="TH")&&e>=h&&e<=i)c[e-h]||(c[e-h]=[]),c[e-h][b-d]=a.innerHTML})}),this.dataFound())},parseGoogleSpreadsheet:function(){var a=this,b=this.options,c=b.googleSpreadsheetKey,d=this.columns,e=b.startRow||0,h=b.endRow||Number.MAX_VALUE,i=b.startColumn||0,g=b.endColumn||Number.MAX_VALUE,f,k;c&&jQuery.ajax({dataType:"json",url:"https://spreadsheets.google.com/feeds/cells/"+c+"/"+(b.googleSpreadsheetWorksheet||"od6")+"/public/values?alt=json-in-script&callback=?", -error:b.error,success:function(b){var b=b.feed.entry,c,j=b.length,m=0,n=0,l;for(l=0;l=i&&l<=g)d[l-i]=[],d[l-i].length=Math.min(n,h-e);for(l=0;l=i&&k<=g&&f>=e&&f<=h)d[k-i][f-e]=c.content.$t;a.dataFound()}})},findHeaderRow:function(){m(this.columns,function(){});this.headerRow=0},trim:function(a){return typeof a==="string"?a.replace(/^\s+|\s+$/g,""):a},parseTypes:function(){for(var a= -this.columns,b=a.length,c,d,e,h;b--;)for(c=a[b].length;c--;)d=a[b][c],e=parseFloat(d),h=this.trim(d),h==e?(a[b][c]=e,e>31536E6?a[b].isDatetime=!0:a[b].isNumeric=!0):(d=this.parseDate(d),b===0&&typeof d==="number"&&!isNaN(d)?(a[b][c]=d,a[b].isDatetime=!0):a[b][c]=h===""?null:h)},dateFormats:{"YYYY-mm-dd":{regex:"^([0-9]{4})-([0-9]{2})-([0-9]{2})$",parser:function(a){return Date.UTC(+a[1],a[2]-1,+a[3])}}},parseDate:function(a){var b=this.options.parseDate,c,d,e;b&&(c=b(a));if(typeof a==="string")for(d in this.dateFormats)b= -this.dateFormats[d],(e=a.match(b.regex))&&(c=b.parser(e));return c},rowsToColumns:function(a){var b,c,d,e,h;if(a){h=[];c=a.length;for(b=0;b1&&(b=a.shift(),this.headerRow===0&&b.shift(),b.isDatetime?c="datetime":b.isNumeric|| -(c="category"));for(g=0;g1&&i[f].push(a[g+1][f]!==void 0?a[g+1][f]:null),e>2&&i[f].push(a[g+2][f]!==void 0?a[g+2][f]:null),e>3&&i[f].push(a[g+3][f]!==void 0?a[g+3][f]:null),e>4&&i[f].push(a[g+4][f]!==void 0?a[g+4][f]:null);h[k]={name:a[g].name,data:i};g+= -e}d.complete({xAxis:{type:c},series:h})}}});j.Data=n;j.data=function(a,b){return new n(a,b)};j.wrap(j.Chart.prototype,"init",function(a,b,c){var d=this;b&&b.data?j.data(j.extend(b.data,{complete:function(e){b.hasOwnProperty("series")&&(typeof b.series==="object"?m(b.series,function(a,c){b.series[c]=j.merge(a,e.series[c])}):delete b.series);b=j.merge(e,b);a.call(d,b,c)}}),b):a.call(d,b,c)})})(Highcharts); diff --git a/htdocs/js/lib/highstock/modules/drilldown.js b/htdocs/js/lib/highstock/modules/drilldown.js deleted file mode 100644 index 6f147802..00000000 --- a/htdocs/js/lib/highstock/modules/drilldown.js +++ /dev/null @@ -1,14 +0,0 @@ -(function(g){function s(a,b,d){return"rgba("+[Math.round(a[0]+(b[0]-a[0])*d),Math.round(a[1]+(b[1]-a[1])*d),Math.round(a[2]+(b[2]-a[2])*d),a[3]+(b[3]-a[3])*d].join(",")+")"}var t=function(){},o=g.getOptions(),i=g.each,p=g.extend,x=g.format,q=g.wrap,l=g.Chart,n=g.seriesTypes,u=n.pie,m=n.column,v=HighchartsAdapter.fireEvent,y=HighchartsAdapter.inArray;p(o.lang,{drillUpText:"◁ Back to {series.name}"});o.drilldown={activeAxisLabelStyle:{cursor:"pointer",color:"#0d233a",fontWeight:"bold",textDecoration:"underline"}, -activeDataLabelStyle:{cursor:"pointer",color:"#0d233a",fontWeight:"bold",textDecoration:"underline"},animation:{duration:500},drillUpButton:{position:{align:"right",x:-10,y:10}}};g.SVGRenderer.prototype.Element.prototype.fadeIn=function(a){this.attr({opacity:0.1,visibility:"inherit"}).animate({opacity:1},a||{duration:250})};l.prototype.addSeriesAsDrilldown=function(a,b){this.addSingleSeriesAsDrilldown(a,b);this.applyDrilldown()};l.prototype.addSingleSeriesAsDrilldown=function(a,b){var d=a.series, -c=d.xAxis,f=d.yAxis,h;h=a.color||d.color;var e,w=[],g=[],k;k=d.levelNumber||0;b=p({color:h},b);e=y(a,d.points);i(d.chart.series,function(a){if(a.xAxis===c)w.push(a),g.push(a.userOptions),a.levelNumber=a.levelNumber||0});h={levelNumber:k,seriesOptions:d.userOptions,levelSeriesOptions:g,levelSeries:w,shapeArgs:a.shapeArgs,bBox:a.graphic.getBBox(),color:h,lowerSeriesOptions:b,pointOptions:d.options.data[e],pointIndex:e,oldExtremes:{xMin:c&&c.userMin,xMax:c&&c.userMax,yMin:f&&f.userMin,yMax:f&&f.userMax}}; -if(!this.drilldownLevels)this.drilldownLevels=[];this.drilldownLevels.push(h);h=h.lowerSeries=this.addSeries(b,!1);h.levelNumber=k+1;if(c)c.oldPos=c.pos,c.userMin=c.userMax=null,f.userMin=f.userMax=null;if(d.type===h.type)h.animate=h.animateDrilldown||t,h.options.animation=!0};l.prototype.applyDrilldown=function(){var a=this.drilldownLevels,b=a[a.length-1].levelNumber;i(this.drilldownLevels,function(a){a.levelNumber===b&&i(a.levelSeries,function(a){a.levelNumber===b&&a.remove(!1)})});this.redraw(); -this.showDrillUpButton()};l.prototype.getDrilldownBackText=function(){var a=this.drilldownLevels[this.drilldownLevels.length-1];a.series=a.seriesOptions;return x(this.options.lang.drillUpText,a)};l.prototype.showDrillUpButton=function(){var a=this,b=this.getDrilldownBackText(),d=a.options.drilldown.drillUpButton,c,f;this.drillUpButton?this.drillUpButton.attr({text:b}).align():(f=(c=d.theme)&&c.states,this.drillUpButton=this.renderer.button(b,null,null,function(){a.drillUp()},c,f&&f.hover,f&&f.select).attr({align:d.position.align, -zIndex:9}).add().align(d.position,!1,d.relativeTo||"plotBox"))};l.prototype.drillUp=function(){for(var a=this,b=a.drilldownLevels,d=b[b.length-1].levelNumber,c=b.length,f=a.series,h=f.length,e,g,j,k,l=function(b){var c;i(f,function(a){a.userOptions===b&&(c=a)});c=c||a.addSeries(b,!1);if(c.type===g.type&&c.animateDrillupTo)c.animate=c.animateDrillupTo;b===e.seriesOptions&&(j=c)};c--;)if(e=b[c],e.levelNumber===d){b.pop();g=e.lowerSeries;if(!g.chart)for(;h--;)if(f[h].options.id===e.lowerSeriesOptions.id){g= -f[h];break}g.xData=[];i(e.levelSeriesOptions,l);v(a,"drillup",{seriesOptions:e.seriesOptions});if(j.type===g.type)j.drilldownLevel=e,j.options.animation=a.options.drilldown.animation,g.animateDrillupFrom&&g.animateDrillupFrom(e);j.levelNumber=d;g.remove(!1);if(j.xAxis)k=e.oldExtremes,j.xAxis.setExtremes(k.xMin,k.xMax,!1),j.yAxis.setExtremes(k.yMin,k.yMax,!1)}this.redraw();this.drilldownLevels.length===0?this.drillUpButton=this.drillUpButton.destroy():this.drillUpButton.attr({text:this.getDrilldownBackText()}).align()}; -m.prototype.supportsDrilldown=!0;m.prototype.animateDrillupTo=function(a){if(!a){var b=this,d=b.drilldownLevel;i(this.points,function(a){a.graphic.hide();a.dataLabel&&a.dataLabel.hide();a.connector&&a.connector.hide()});setTimeout(function(){i(b.points,function(a,b){var h=b===(d&&d.pointIndex)?"show":"fadeIn",e=h==="show"?!0:void 0;a.graphic[h](e);if(a.dataLabel)a.dataLabel[h](e);if(a.connector)a.connector[h](e)})},Math.max(this.chart.options.drilldown.animation.duration-50,0));this.animate=t}};m.prototype.animateDrilldown= -function(a){var b=this,d=this.chart.drilldownLevels,c=this.chart.drilldownLevels[this.chart.drilldownLevels.length-1].shapeArgs,f=this.chart.options.drilldown.animation;if(!a)i(d,function(a){if(b.userOptions===a.lowerSeriesOptions)c=a.shapeArgs}),c.x+=this.xAxis.oldPos-this.xAxis.pos,i(this.points,function(a){a.graphic&&a.graphic.attr(c).animate(a.shapeArgs,f);a.dataLabel&&a.dataLabel.fadeIn(f)}),this.animate=null};m.prototype.animateDrillupFrom=function(a){var b=this.chart.options.drilldown.animation, -d=this.group,c=this;i(c.trackerGroups,function(a){if(c[a])c[a].on("mouseover")});delete this.group;i(this.points,function(c){var h=c.graphic,e=g.Color(c.color).rgba,i=g.Color(a.color).rgba,j=function(){h.destroy();d&&(d=d.destroy())};h&&(delete c.graphic,b?h.animate(a.shapeArgs,g.merge(b,{step:function(a,b){b.prop==="start"&&e.length===4&&i.length===4&&this.attr({fill:s(e,i,b.pos)})},complete:j})):(h.attr(a.shapeArgs),j()))})};u&&p(u.prototype,{supportsDrilldown:!0,animateDrillupTo:m.prototype.animateDrillupTo, -animateDrillupFrom:m.prototype.animateDrillupFrom,animateDrilldown:function(a){var b=this.chart.drilldownLevels[this.chart.drilldownLevels.length-1],d=this.chart.options.drilldown.animation,c=b.shapeArgs,f=c.start,h=(c.end-f)/this.points.length,e=g.Color(b.color).rgba;if(!a)i(this.points,function(a,b){var i=g.Color(a.color).rgba;a.graphic.attr(g.merge(c,{start:f+b*h,end:f+(b+1)*h}))[d?"animate":"attr"](a.shapeArgs,g.merge(d,{step:function(a,b){b.prop==="start"&&e.length===4&&i.length===4&&this.attr({fill:s(e, -i,b.pos)})}}))}),this.animate=null}});g.Point.prototype.doDrilldown=function(a){for(var b=this.series.chart,d=b.options.drilldown,c=(d.series||[]).length,f;c--&&!f;)d.series[c].id===this.drilldown&&(f=d.series[c]);v(b,"drilldown",{point:this,seriesOptions:f});f&&(a?b.addSingleSeriesAsDrilldown(this,f):b.addSeriesAsDrilldown(this,f))};q(g.Point.prototype,"init",function(a,b,d,c){var f=a.call(this,b,d,c),h=b.chart,e=(a=b.xAxis&&b.xAxis.ticks[c])&&a.label;if(f.drilldown){if(g.addEvent(f,"click",function(){f.doDrilldown()}), -e){if(!e._basicStyle)e._basicStyle=e.element.getAttribute("style");e.addClass("highcharts-drilldown-axis-label").css(h.options.drilldown.activeAxisLabelStyle).on("click",function(){i(e.ddPoints,function(a){a.doDrilldown&&a.doDrilldown(!0)});h.applyDrilldown()});if(!e.ddPoints)e.ddPoints=[];e.ddPoints.push(f)}}else e&&e._basicStyle&&e.element.setAttribute("style",e._basicStyle);return f});q(g.Series.prototype,"drawDataLabels",function(a){var b=this.chart.options.drilldown.activeDataLabelStyle;a.call(this); -i(this.points,function(a){if(a.drilldown&&a.dataLabel)a.dataLabel.attr({"class":"highcharts-drilldown-data-label"}).css(b).on("click",function(){a.doDrilldown()})})});var r,o=function(a){a.call(this);i(this.points,function(a){a.drilldown&&a.graphic&&a.graphic.attr({"class":"highcharts-drilldown-point"}).css({cursor:"pointer"})})};for(r in n)n[r].prototype.supportsDrilldown&&q(n[r].prototype,"drawTracker",o)})(Highcharts); diff --git a/htdocs/js/lib/highstock/modules/exporting.js b/htdocs/js/lib/highstock/modules/exporting.js deleted file mode 100644 index b2bcc506..00000000 --- a/htdocs/js/lib/highstock/modules/exporting.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - Highstock JS v2.0.1 (2014-04-24) - Exporting module - - (c) 2010-2014 Torstein Honsi - - License: www.highcharts.com/license -*/ -(function(f){var A=f.Chart,t=f.addEvent,B=f.removeEvent,l=f.createElement,o=f.discardElement,v=f.css,k=f.merge,r=f.each,p=f.extend,D=Math.max,j=document,C=window,E=f.isTouchDevice,F=f.Renderer.prototype.symbols,s=f.getOptions(),y;p(s.lang,{printChart:"Print chart",downloadPNG:"Download PNG image",downloadJPEG:"Download JPEG image",downloadPDF:"Download PDF document",downloadSVG:"Download SVG vector image",contextButtonTitle:"Chart context menu"});s.navigation={menuStyle:{border:"1px solid #A0A0A0", -background:"#FFFFFF",padding:"5px 0"},menuItemStyle:{padding:"0 10px",background:"none",color:"#303030",fontSize:E?"14px":"11px"},menuItemHoverStyle:{background:"#4572A5",color:"#FFFFFF"},buttonOptions:{symbolFill:"#E0E0E0",symbolSize:14,symbolStroke:"#666",symbolStrokeWidth:3,symbolX:12.5,symbolY:10.5,align:"right",buttonSpacing:3,height:22,theme:{fill:"white",stroke:"none"},verticalAlign:"top",width:24}};s.exporting={type:"image/png",url:"http://export.highcharts.com/",buttons:{contextButton:{menuClassName:"highcharts-contextmenu", -symbol:"menu",_titleKey:"contextButtonTitle",menuItems:[{textKey:"printChart",onclick:function(){this.print()}},{separator:!0},{textKey:"downloadPNG",onclick:function(){this.exportChart()}},{textKey:"downloadJPEG",onclick:function(){this.exportChart({type:"image/jpeg"})}},{textKey:"downloadPDF",onclick:function(){this.exportChart({type:"application/pdf"})}},{textKey:"downloadSVG",onclick:function(){this.exportChart({type:"image/svg+xml"})}}]}}};f.post=function(b,a,d){var c,b=l("form",k({method:"post", -action:b,enctype:"multipart/form-data"},d),{display:"none"},j.body);for(c in a)l("input",{type:"hidden",name:c,value:a[c]},null,b);b.submit();o(b)};p(A.prototype,{getSVG:function(b){var a=this,d,c,z,h,g=k(a.options,b);if(!j.createElementNS)j.createElementNS=function(a,b){return j.createElement(b)};b=l("div",null,{position:"absolute",top:"-9999em",width:a.chartWidth+"px",height:a.chartHeight+"px"},j.body);c=a.renderTo.style.width;h=a.renderTo.style.height;c=g.exporting.sourceWidth||g.chart.width|| -/px$/.test(c)&&parseInt(c,10)||600;h=g.exporting.sourceHeight||g.chart.height||/px$/.test(h)&&parseInt(h,10)||400;p(g.chart,{animation:!1,renderTo:b,forExport:!0,width:c,height:h});g.exporting.enabled=!1;g.series=[];r(a.series,function(a){z=k(a.options,{animation:!1,showCheckbox:!1,visible:a.visible});z.isInternal||g.series.push(z)});d=new f.Chart(g,a.callback);r(["xAxis","yAxis"],function(b){r(a[b],function(a,c){var g=d[b][c],f=a.getExtremes(),h=f.userMin,f=f.userMax;g&&(h!==void 0||f!==void 0)&& -g.setExtremes(h,f,!0,!1)})});c=d.container.innerHTML;g=null;d.destroy();o(b);c=c.replace(/zIndex="[^"]+"/g,"").replace(/isShadow="[^"]+"/g,"").replace(/symbolName="[^"]+"/g,"").replace(/jQuery[0-9]+="[^"]+"/g,"").replace(/url\([^#]+#/g,"url(#").replace(/.*?$/,"").replace(/ /g," ").replace(/­/g,"­").replace(//g,'xlink:href="$1"/>').replace(/id=([^" >]+)/g,'id="$1"').replace(/class=([^" >]+)/g,'class="$1"').replace(/ transform /g," ").replace(/:(path|rect)/g,"$1").replace(/style="([^"]+)"/g,function(a){return a.toLowerCase()});return c=c.replace(/(url\(#highcharts-[0-9]+)"/g,"$1").replace(/"/g,"'")},exportChart:function(b,a){var b=b||{},d=this.options.exporting,d=this.getSVG(k({chart:{borderRadius:0}},d.chartOptions,a,{exporting:{sourceWidth:b.sourceWidth|| -d.sourceWidth,sourceHeight:b.sourceHeight||d.sourceHeight}})),b=k(this.options.exporting,b);f.post(b.url,{filename:b.filename||"chart",type:b.type,width:b.width||0,scale:b.scale||2,svg:d},b.formAttributes)},print:function(){var b=this,a=b.container,d=[],c=a.parentNode,f=j.body,h=f.childNodes;if(!b.isPrinting)b.isPrinting=!0,r(h,function(a,b){if(a.nodeType===1)d[b]=a.style.display,a.style.display="none"}),f.appendChild(a),C.focus(),C.print(),setTimeout(function(){c.appendChild(a);r(h,function(a,b){if(a.nodeType=== -1)a.style.display=d[b]});b.isPrinting=!1},1E3)},contextMenu:function(b,a,d,c,f,h,g){var e=this,k=e.options.navigation,q=k.menuItemStyle,m=e.chartWidth,n=e.chartHeight,j="cache-"+b,i=e[j],u=D(f,h),w,x,o,s=function(a){e.pointer.inClass(a.target,b)||x()};if(!i)e[j]=i=l("div",{className:b},{position:"absolute",zIndex:1E3,padding:u+"px"},e.container),w=l("div",null,p({MozBoxShadow:"3px 3px 10px #888",WebkitBoxShadow:"3px 3px 10px #888",boxShadow:"3px 3px 10px #888"},k.menuStyle),i),x=function(){v(i,{display:"none"}); -g&&g.setState(0);e.openMenu=!1},t(i,"mouseleave",function(){o=setTimeout(x,500)}),t(i,"mouseenter",function(){clearTimeout(o)}),t(document,"mouseup",s),t(e,"destroy",function(){B(document,"mouseup",s)}),r(a,function(a){if(a){var b=a.separator?l("hr",null,null,w):l("div",{onmouseover:function(){v(this,k.menuItemHoverStyle)},onmouseout:function(){v(this,q)},onclick:function(){x();a.onclick.apply(e,arguments)},innerHTML:a.text||e.options.lang[a.textKey]},p({cursor:"pointer"},q),w);e.exportDivElements.push(b)}}), -e.exportDivElements.push(w,i),e.exportMenuWidth=i.offsetWidth,e.exportMenuHeight=i.offsetHeight;a={display:"block"};d+e.exportMenuWidth>m?a.right=m-d-f-u+"px":a.left=d-u+"px";c+h+e.exportMenuHeight>n&&g.alignOptions.verticalAlign!=="top"?a.bottom=n-c-u+"px":a.top=c+h-u+"px";v(i,a);e.openMenu=!0},addButton:function(b){var a=this,d=a.renderer,c=k(a.options.navigation.buttonOptions,b),j=c.onclick,h=c.menuItems,g,e,l={stroke:c.symbolStroke,fill:c.symbolFill},q=c.symbolSize||12;if(!a.btnCount)a.btnCount= -0;if(!a.exportDivElements)a.exportDivElements=[],a.exportSVGElements=[];if(c.enabled!==!1){var m=c.theme,n=m.states,o=n&&n.hover,n=n&&n.select,i;delete m.states;j?i=function(){j.apply(a,arguments)}:h&&(i=function(){a.contextMenu(e.menuClassName,h,e.translateX,e.translateY,e.width,e.height,e);e.setState(2)});c.text&&c.symbol?m.paddingLeft=f.pick(m.paddingLeft,25):c.text||p(m,{width:c.width,height:c.height,padding:0});e=d.button(c.text,0,0,i,m,o,n).attr({title:a.options.lang[c._titleKey],"stroke-linecap":"round"}); -e.menuClassName=b.menuClassName||"highcharts-menu-"+a.btnCount++;c.symbol&&(g=d.symbol(c.symbol,c.symbolX-q/2,c.symbolY-q/2,q,q).attr(p(l,{"stroke-width":c.symbolStrokeWidth||1,zIndex:1})).add(e));e.add().align(p(c,{width:e.width,x:f.pick(c.x,y)}),!0,"spacingBox");y+=(e.width+c.buttonSpacing)*(c.align==="right"?-1:1);a.exportSVGElements.push(e,g)}},destroyExport:function(b){var b=b.target,a,d;for(a=0;ae-t||e===t?s:s+(q-s)*((e-t-j)/(e-t))};this.getX=function(j,a){return h+(a?-1:1)*(r(g?n-j:j)/2+c.dataLabels.distance)};this.center=[h,d,e];this.centerX=h;A(a,function(a){B+=a.y}); -A(a,function(a){m=null;y=B?a.y/B:0;l=d-e/2+o*e;i=l+y*e;k=r(l);z=h-k/2;C=z+k;k=r(i);p=h-k/2;u=p+k;l>w?(z=p=h-s/2,C=u=h+s/2):i>w&&(m=i,k=r(w),p=h-k/2,u=p+k,i=w);g&&(l=e-l,i=e-i,m=m?e-m:null);x=["M",z,l,"L",C,l,u,i];m&&x.push(u,m,p,m);x.push(p,i,"Z");a.shapeType="path";a.shapeArgs={d:x};a.percentage=y*100;a.plotX=h;a.plotY=(l+(m||i))/2;a.tooltipPos=[h,a.plotY];a.slice=D;a.half=v;o+=y})},drawPoints:function(){var a=this,b=a.options,f=a.chart.renderer;A(a.data,function(c){var g=c.graphic,d=c.shapeArgs; -g?g.animate(d):c.graphic=f.path(d).attr({fill:c.color,stroke:b.borderColor,"stroke-width":b.borderWidth}).add(a.group)})},sortByAngle:function(a){a.sort(function(a,b){return a.plotY-b.plotY})},drawDataLabels:function(){var a=this.data,b=this.options.dataLabels.distance,f,c,g,d=a.length,n,o;for(this.center[2]-=2*b;d--;)g=a[d],c=(f=g.half)?1:-1,o=g.plotY,n=this.getX(o,f),g.labelPos=[0,o,n+(b-5)*c,o,n+b*c,o,f?"right":"left",0];q.pie.prototype.drawDataLabels.call(this)}});d.plotOptions.pyramid=b.merge(d.plotOptions.funnel, -{neckWidth:"0%",neckHeight:"0%",reversed:!0});b.seriesTypes.pyramid=b.extendClass(b.seriesTypes.funnel,{type:"pyramid"})})(Highcharts); diff --git a/htdocs/js/lib/highstock/modules/heatmap.js b/htdocs/js/lib/highstock/modules/heatmap.js deleted file mode 100644 index 7eb7f6d9..00000000 --- a/htdocs/js/lib/highstock/modules/heatmap.js +++ /dev/null @@ -1,21 +0,0 @@ -/* - Highstock JS v2.0.1 (2014-04-24) - - (c) 2011-2014 Torstein Honsi - - License: www.highcharts.com/license -*/ -(function(g){var j=g.Axis,x=g.Chart,o=g.Color,y=g.Legend,s=g.LegendSymbolMixin,t=g.Series,u=g.getOptions(),k=g.each,p=g.extend,z=g.extendClass,l=g.merge,q=g.pick,v=g.numberFormat,m=g.seriesTypes,w=g.wrap,n=function(){},r=g.ColorAxis=function(){this.isColorAxis=!0;this.init.apply(this,arguments)};p(r.prototype,j.prototype);p(r.prototype,{defaultColorAxisOptions:{lineWidth:0,gridLineWidth:1,tickPixelInterval:72,startOnTick:!0,endOnTick:!0,offset:0,marker:{animation:{duration:50},color:"gray",width:0.01}, -labels:{overflow:"justify"},minColor:"#EFEFFF",maxColor:"#003875",tickLength:5},init:function(b,a){var d=b.options.legend.layout!=="vertical",c;c=l(this.defaultColorAxisOptions,{side:d?2:1,reversed:!d},a,{isX:d,opposite:!d,showEmpty:!1,title:null,isColor:!0});j.prototype.init.call(this,b,c);a.dataClasses&&this.initDataClasses(a);this.initStops(a);this.isXAxis=!0;this.horiz=d;this.zoomEnabled=!1},tweenColors:function(b,a,d){var c=a.rgba[3]!==1||b.rgba[3]!==1;return(c?"rgba(":"rgb(")+Math.round(a.rgba[0]+ -(b.rgba[0]-a.rgba[0])*(1-d))+","+Math.round(a.rgba[1]+(b.rgba[1]-a.rgba[1])*(1-d))+","+Math.round(a.rgba[2]+(b.rgba[2]-a.rgba[2])*(1-d))+(c?","+(a.rgba[3]+(b.rgba[3]-a.rgba[3])*(1-d)):"")+")"},initDataClasses:function(b){var a=this,d=this.chart,c,e=0,h=this.options;this.dataClasses=c=[];k(b.dataClasses,function(f,i){var g,f=l(f);c.push(f);if(!f.color)h.dataClassColor==="category"?(g=d.options.colors,f.color=g[e++],e===g.length&&(e=0)):f.color=a.tweenColors(o(h.minColor),o(h.maxColor),i/(b.dataClasses.length- -1))})},initStops:function(b){this.stops=b.stops||[[0,this.options.minColor],[1,this.options.maxColor]];k(this.stops,function(a){a.color=o(a[1])})},setOptions:function(b){j.prototype.setOptions.call(this,b);this.options.crosshair=this.options.marker;this.coll="colorAxis"},setAxisSize:function(){var b=this.legendSymbol,a=this.chart,d,c,e;if(b)this.left=d=b.attr("x"),this.top=c=b.attr("y"),this.width=e=b.attr("width"),this.height=b=b.attr("height"),this.right=a.chartWidth-d-e,this.bottom=a.chartHeight- -c-b,this.len=this.horiz?e:b,this.pos=this.horiz?d:c},toColor:function(b,a){var d,c=this.stops,e,h=this.dataClasses,f,i;if(h)for(i=h.length;i--;){if(f=h[i],e=f.from,c=f.to,(e===void 0||b>=e)&&(c===void 0||b<=c)){d=f.color;if(a)a.dataClass=i;break}}else{this.isLog&&(b=this.val2lin(b));d=1-(this.max-b)/(this.max-this.min);for(i=c.length;i--;)if(d>c[i][0])break;e=c[i]||c[i+1];c=c[i+1]||e;d=1-(c[0]-d)/(c[0]-e[0]||1);d=this.tweenColors(e.color,c.color,d)}return d},getOffset:function(){var b=this.legendGroup; -if(b&&(j.prototype.getOffset.call(this),!this.axisGroup.parentGroup))this.axisGroup.add(b),this.gridGroup.add(b),this.labelGroup.add(b),this.added=!0},setLegendColor:function(){var b,a=this.options;b=this.horiz?[0,0,1,0]:[0,0,0,1];this.legendColor={linearGradient:{x1:b[0],y1:b[1],x2:b[2],y2:b[3]},stops:a.stops||[[0,a.minColor],[1,a.maxColor]]}},drawLegendSymbol:function(b,a){var d=b.padding,c=b.options,e=this.horiz,h=q(c.symbolWidth,e?200:12),f=q(c.symbolHeight,e?12:200),c=q(c.labelPadding,e?10:30); -this.setLegendColor();a.legendSymbol=this.chart.renderer.rect(0,b.baseline-11,h,f).attr({zIndex:1}).add(a.legendGroup);a.legendSymbol.getBBox();this.legendItemWidth=h+d+(e?0:c);this.legendItemHeight=f+d+(e?c:0)},setState:n,visible:!0,setVisible:n,getSeriesExtremes:function(){var b;if(this.series.length)b=this.series[0],this.dataMin=b.valueMin,this.dataMax=b.valueMax},drawCrosshair:function(b,a){var d=!this.cross,c=a&&a.plotX,e=a&&a.plotY,h,f=this.pos,i=this.len;if(a)h=this.toPixels(a.value),hf+i&&(h=f+i+2),a.plotX=h,a.plotY=this.len-h,j.prototype.drawCrosshair.call(this,b,a),a.plotX=c,a.plotY=e,!d&&this.cross&&this.cross.attr({fill:this.crosshair.color}).add(this.labelGroup)},getPlotLinePath:function(b,a,d,c,e){return e?this.horiz?["M",e-4,this.top-6,"L",e+4,this.top-6,e,this.top,"Z"]:["M",this.left,e,"L",this.left-6,e+6,this.left-6,e-6,"Z"]:j.prototype.getPlotLinePath.call(this,b,a,d,c)},update:function(b,a){k(this.series,function(a){a.isDirtyData=!0});j.prototype.update.call(this, -b,a);this.legendItem&&(this.setLegendColor(),this.chart.legend.colorizeItem(this,!0))},getDataClassLegendSymbols:function(){var b=this,a=this.chart,d=[],c=a.options.legend,e=c.valueDecimals,h=c.valueSuffix||"",f;k(this.dataClasses,function(c,g){var j=!0,l=c.from,m=c.to;f="";l===void 0?f="< ":m===void 0&&(f="> ");l!==void 0&&(f+=v(l,e)+h);l!==void 0&&m!==void 0&&(f+=" - ");m!==void 0&&(f+=v(m,e)+h);d.push(p({chart:a,name:f,options:{},drawLegendSymbol:s.drawRectangle,visible:!0,setState:n,setVisible:function(){j= -this.visible=!j;k(b.series,function(a){k(a.points,function(a){a.dataClass===g&&a.setVisible(j)})});a.legend.colorizeItem(this,j)}},c))});return d},name:""});w(x.prototype,"getAxes",function(b){var a=this.options.colorAxis;b.call(this);this.colorAxis=[];a&&new r(this,a)});w(y.prototype,"getAllItems",function(b){var a=[],d=this.chart.colorAxis[0];d&&(d.options.dataClasses?a=a.concat(d.getDataClassLegendSymbols()):a.push(d),k(d.series,function(a){a.options.showInLegend=!1}));return a.concat(b.call(this))}); -g={pointAttrToOptions:{stroke:"borderColor","stroke-width":"borderWidth",fill:"color",dashstyle:"dashStyle"},pointArrayMap:["value"],axisTypes:["xAxis","yAxis","colorAxis"],optionalAxis:"colorAxis",trackerGroups:["group","markerGroup","dataLabelsGroup"],getSymbol:n,parallelArrays:["x","y","value"],translateColors:function(){var b=this,a=this.options.nullColor,d=this.colorAxis;k(this.data,function(c){var e=c.value;if(e=e===null?a:d?d.toColor(e,c):c.color||b.color)c.color=e})}};u.plotOptions.heatmap= -l(u.plotOptions.scatter,{animation:!1,borderWidth:0,nullColor:"#F8F8F8",dataLabels:{format:"{point.value}",verticalAlign:"middle",crop:!1,overflow:!1,style:{color:"white",fontWeight:"bold",textShadow:"0 0 5px black"}},marker:null,tooltip:{pointFormat:"{point.x}, {point.y}: {point.value}
    "},states:{normal:{animation:!0},hover:{brightness:0.2}}});m.heatmap=z(m.scatter,l(g,{type:"heatmap",pointArrayMap:["y","value"],hasPointSpecificOptions:!0,supportsDrilldown:!0,getExtremesFromAll:!0,init:function(){m.scatter.prototype.init.apply(this, -arguments);this.pointRange=this.options.colsize||1;this.yAxis.axisPointRange=this.options.rowsize||1},translate:function(){var b=this.options,a=this.xAxis,d=this.yAxis;this.generatePoints();k(this.points,function(c){var e=(b.colsize||1)/2,h=(b.rowsize||1)/2,f=Math.round(a.len-a.translate(c.x-e,0,1,0,1)),e=Math.round(a.len-a.translate(c.x+e,0,1,0,1)),g=Math.round(d.translate(c.y-h,0,1,0,1)),h=Math.round(d.translate(c.y+h,0,1,0,1));c.plotX=(f+e)/2;c.plotY=(g+h)/2;c.shapeType="rect";c.shapeArgs={x:Math.min(f, -e),y:Math.min(g,h),width:Math.abs(e-f),height:Math.abs(h-g)}});this.translateColors()},drawPoints:m.column.prototype.drawPoints,animate:n,getBox:n,drawLegendSymbol:s.drawRectangle,getExtremes:function(){t.prototype.getExtremes.call(this,this.valueData);this.valueMin=this.dataMin;this.valueMax=this.dataMax;t.prototype.getExtremes.call(this)}}))})(Highcharts); diff --git a/htdocs/js/lib/highstock/modules/no-data-to-display.js b/htdocs/js/lib/highstock/modules/no-data-to-display.js deleted file mode 100644 index 27eb0bde..00000000 --- a/htdocs/js/lib/highstock/modules/no-data-to-display.js +++ /dev/null @@ -1,12 +0,0 @@ -/* - Highstock JS v2.0.1 (2014-04-24) - Plugin for displaying a message when there is no data visible in chart. - - (c) 2010-2014 Highsoft AS - Author: Oystein Moseng - - License: www.highcharts.com/license -*/ -(function(c){function f(){return!!this.points.length}function g(){this.hasData()?this.hideNoData():this.showNoData()}var d=c.seriesTypes,e=c.Chart.prototype,h=c.getOptions(),i=c.extend;i(h.lang,{noData:"No data to display"});h.noData={position:{x:0,y:0,align:"center",verticalAlign:"middle"},attr:{},style:{fontWeight:"bold",fontSize:"12px",color:"#60606a"}};if(d.pie)d.pie.prototype.hasData=f;if(d.gauge)d.gauge.prototype.hasData=f;if(d.waterfall)d.waterfall.prototype.hasData=f;c.Series.prototype.hasData= -function(){return this.dataMax!==void 0&&this.dataMin!==void 0};e.showNoData=function(a){var b=this.options,a=a||b.lang.noData,b=b.noData;if(!this.noDataLabel)this.noDataLabel=this.renderer.label(a,0,0,null,null,null,null,null,"no-data").attr(b.attr).css(b.style).add(),this.noDataLabel.align(i(this.noDataLabel.getBBox(),b.position),!1,"plotBox")};e.hideNoData=function(){if(this.noDataLabel)this.noDataLabel=this.noDataLabel.destroy()};e.hasData=function(){for(var a=this.series,b=a.length;b--;)if(a[b].hasData()&& -!a[b].options.isInternal)return!0;return!1};e.callbacks.push(function(a){c.addEvent(a,"load",g);c.addEvent(a,"redraw",g)})})(Highcharts); diff --git a/htdocs/js/lib/highstock/modules/solid-gauge.js b/htdocs/js/lib/highstock/modules/solid-gauge.js deleted file mode 100644 index 41597e15..00000000 --- a/htdocs/js/lib/highstock/modules/solid-gauge.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - Highstock JS v2.0.1 (2014-04-24) - Solid angular gauge module - - (c) 2010-2014 Torstein Honsi - - License: www.highcharts.com/license -*/ -(function(a){var l=a.getOptions().plotOptions,o=a.pInt,p=a.pick,j=a.each,m;l.solidgauge=a.merge(l.gauge,{colorByPoint:!0});m={initDataClasses:function(b){var h=this,e=this.chart,c,k=0,f=this.options;this.dataClasses=c=[];j(b.dataClasses,function(g,d){var i,g=a.merge(g);c.push(g);if(!g.color)f.dataClassColor==="category"?(i=e.options.colors,g.color=i[k++],k===i.length&&(k=0)):g.color=h.tweenColors(a.Color(f.minColor),a.Color(f.maxColor),d/(b.dataClasses.length-1))})},initStops:function(b){this.stops= -b.stops||[[0,this.options.minColor],[1,this.options.maxColor]];j(this.stops,function(b){b.color=a.Color(b[1])})},toColor:function(b,h){var e,c=this.stops,a,f=this.dataClasses,g,d;if(f)for(d=f.length;d--;){if(g=f[d],a=g.from,c=g.to,(a===void 0||b>=a)&&(c===void 0||b<=c)){e=g.color;if(h)h.dataClass=d;break}}else{this.isLog&&(b=this.val2lin(b));e=1-(this.max-b)/(this.max-this.min);for(d=c.length;d--;)if(e>c[d][0])break;a=c[d]||c[d+1];c=c[d+1]||a;e=1-(c[0]-e)/(c[0]-a[0]||1);e=this.tweenColors(a.color, -c.color,e)}return e},tweenColors:function(b,a,e){var c=a.rgba[3]!==1||b.rgba[3]!==1;return b.rgba.length===0||a.rgba.length===0?"none":(c?"rgba(":"rgb(")+Math.round(a.rgba[0]+(b.rgba[0]-a.rgba[0])*(1-e))+","+Math.round(a.rgba[1]+(b.rgba[1]-a.rgba[1])*(1-e))+","+Math.round(a.rgba[2]+(b.rgba[2]-a.rgba[2])*(1-e))+(c?","+(a.rgba[3]+(b.rgba[3]-a.rgba[3])*(1-e)):"")+")"}};a.seriesTypes.solidgauge=a.extendClass(a.seriesTypes.gauge,{type:"solidgauge",bindAxes:function(){var b;a.seriesTypes.gauge.prototype.bindAxes.call(this); -b=this.yAxis;a.extend(b,m);b.options.dataClasses&&b.initDataClasses(b.options);b.initStops(b.options)},drawPoints:function(){var b=this,h=b.yAxis,e=h.center,c=b.options,k=b.chart.renderer;a.each(b.points,function(f){var g=f.graphic,d=h.startAngleRad+h.translate(f.y,null,null,null,!0),i=o(p(c.radius,100))*e[2]/200,l=o(p(c.innerRadius,60))*e[2]/200,n=h.toColor(f.y,f),j;if(n!=="none")j=f.color,f.color=n;c.wrap===!1&&(d=Math.max(h.startAngleRad,Math.min(h.endAngleRad,d)));d=d*180/Math.PI;d={x:e[0],y:e[1], -r:i,innerR:l,start:h.startAngleRad,end:d/(180/Math.PI)};g?(i=d.d,g.attr({fill:f.color}).animate(d,{step:function(b,c){g.attr("fill",m.tweenColors(a.Color(j),a.Color(n),c.pos))}}),d.d=i):f.graphic=k.arc(d).attr({stroke:c.borderColor||"none","stroke-width":c.borderWidth||0,fill:f.color}).add(b.group)})},animate:null})})(Highcharts); diff --git a/htdocs/js/lib/highstock/themes/dark-blue.js b/htdocs/js/lib/highstock/themes/dark-blue.js deleted file mode 100644 index 7cf7138a..00000000 --- a/htdocs/js/lib/highstock/themes/dark-blue.js +++ /dev/null @@ -1,254 +0,0 @@ -/** - * Dark blue theme for Highcharts JS - * @author Torstein Honsi - */ - -Highcharts.theme = { - colors: ["#DDDF0D", "#55BF3B", "#DF5353", "#7798BF", "#aaeeee", "#ff0066", "#eeaaee", - "#55BF3B", "#DF5353", "#7798BF", "#aaeeee"], - chart: { - backgroundColor: { - linearGradient: { x1: 0, y1: 0, x2: 1, y2: 1 }, - stops: [ - [0, 'rgb(48, 48, 96)'], - [1, 'rgb(0, 0, 0)'] - ] - }, - borderColor: '#000000', - borderWidth: 2, - className: 'dark-container', - plotBackgroundColor: 'rgba(255, 255, 255, .1)', - plotBorderColor: '#CCCCCC', - plotBorderWidth: 1 - }, - title: { - style: { - color: '#C0C0C0', - font: 'bold 16px "Trebuchet MS", Verdana, sans-serif' - } - }, - subtitle: { - style: { - color: '#666666', - font: 'bold 12px "Trebuchet MS", Verdana, sans-serif' - } - }, - xAxis: { - gridLineColor: '#333333', - gridLineWidth: 1, - labels: { - style: { - color: '#A0A0A0' - } - }, - lineColor: '#A0A0A0', - tickColor: '#A0A0A0', - title: { - style: { - color: '#CCC', - fontWeight: 'bold', - fontSize: '12px', - fontFamily: 'Trebuchet MS, Verdana, sans-serif' - - } - } - }, - yAxis: { - gridLineColor: '#333333', - labels: { - style: { - color: '#A0A0A0' - } - }, - lineColor: '#A0A0A0', - minorTickInterval: null, - tickColor: '#A0A0A0', - tickWidth: 1, - title: { - style: { - color: '#CCC', - fontWeight: 'bold', - fontSize: '12px', - fontFamily: 'Trebuchet MS, Verdana, sans-serif' - } - } - }, - tooltip: { - backgroundColor: 'rgba(0, 0, 0, 0.75)', - style: { - color: '#F0F0F0' - } - }, - toolbar: { - itemStyle: { - color: 'silver' - } - }, - plotOptions: { - line: { - dataLabels: { - color: '#CCC' - }, - marker: { - lineColor: '#333' - } - }, - spline: { - marker: { - lineColor: '#333' - } - }, - scatter: { - marker: { - lineColor: '#333' - } - }, - candlestick: { - lineColor: 'white' - } - }, - legend: { - itemStyle: { - font: '9pt Trebuchet MS, Verdana, sans-serif', - color: '#A0A0A0' - }, - itemHoverStyle: { - color: '#FFF' - }, - itemHiddenStyle: { - color: '#444' - } - }, - credits: { - style: { - color: '#666' - } - }, - labels: { - style: { - color: '#CCC' - } - }, - - navigation: { - buttonOptions: { - symbolStroke: '#DDDDDD', - hoverSymbolStroke: '#FFFFFF', - theme: { - fill: { - linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 }, - stops: [ - [0.4, '#606060'], - [0.6, '#333333'] - ] - }, - stroke: '#000000' - } - } - }, - - // scroll charts - rangeSelector: { - buttonTheme: { - fill: { - linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 }, - stops: [ - [0.4, '#888'], - [0.6, '#555'] - ] - }, - stroke: '#000000', - style: { - color: '#CCC', - fontWeight: 'bold' - }, - states: { - hover: { - fill: { - linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 }, - stops: [ - [0.4, '#BBB'], - [0.6, '#888'] - ] - }, - stroke: '#000000', - style: { - color: 'white' - } - }, - select: { - fill: { - linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 }, - stops: [ - [0.1, '#000'], - [0.3, '#333'] - ] - }, - stroke: '#000000', - style: { - color: 'yellow' - } - } - } - }, - inputStyle: { - backgroundColor: '#333', - color: 'silver' - }, - labelStyle: { - color: 'silver' - } - }, - - navigator: { - handles: { - backgroundColor: '#666', - borderColor: '#AAA' - }, - outlineColor: '#CCC', - maskFill: 'rgba(16, 16, 16, 0.5)', - series: { - color: '#7798BF', - lineColor: '#A6C7ED' - } - }, - - scrollbar: { - barBackgroundColor: { - linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 }, - stops: [ - [0.4, '#888'], - [0.6, '#555'] - ] - }, - barBorderColor: '#CCC', - buttonArrowColor: '#CCC', - buttonBackgroundColor: { - linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 }, - stops: [ - [0.4, '#888'], - [0.6, '#555'] - ] - }, - buttonBorderColor: '#CCC', - rifleColor: '#FFF', - trackBackgroundColor: { - linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 }, - stops: [ - [0, '#000'], - [1, '#333'] - ] - }, - trackBorderColor: '#666' - }, - - // special colors for some of the - legendBackgroundColor: 'rgba(0, 0, 0, 0.5)', - background2: 'rgb(35, 35, 70)', - dataLabelsColor: '#444', - textColor: '#C0C0C0', - maskColor: 'rgba(255,255,255,0.3)' -}; - -// Apply the theme -var highchartsOptions = Highcharts.setOptions(Highcharts.theme); diff --git a/htdocs/js/lib/highstock/themes/dark-green.js b/htdocs/js/lib/highstock/themes/dark-green.js deleted file mode 100644 index 4a7ad586..00000000 --- a/htdocs/js/lib/highstock/themes/dark-green.js +++ /dev/null @@ -1,255 +0,0 @@ -/** - * Dark blue theme for Highcharts JS - * @author Torstein Honsi - */ - -Highcharts.theme = { - colors: ["#DDDF0D", "#55BF3B", "#DF5353", "#7798BF", "#aaeeee", "#ff0066", "#eeaaee", - "#55BF3B", "#DF5353", "#7798BF", "#aaeeee"], - chart: { - backgroundColor: { - linearGradient: [0, 0, 250, 500], - stops: [ - [0, 'rgb(48, 96, 48)'], - [1, 'rgb(0, 0, 0)'] - ] - }, - borderColor: '#000000', - borderWidth: 2, - className: 'dark-container', - plotBackgroundColor: 'rgba(255, 255, 255, .1)', - plotBorderColor: '#CCCCCC', - plotBorderWidth: 1 - }, - title: { - style: { - color: '#C0C0C0', - font: 'bold 16px "Trebuchet MS", Verdana, sans-serif' - } - }, - subtitle: { - style: { - color: '#666666', - font: 'bold 12px "Trebuchet MS", Verdana, sans-serif' - } - }, - xAxis: { - gridLineColor: '#333333', - gridLineWidth: 1, - labels: { - style: { - color: '#A0A0A0' - } - }, - lineColor: '#A0A0A0', - tickColor: '#A0A0A0', - title: { - style: { - color: '#CCC', - fontWeight: 'bold', - fontSize: '12px', - fontFamily: 'Trebuchet MS, Verdana, sans-serif' - - } - } - }, - yAxis: { - gridLineColor: '#333333', - labels: { - style: { - color: '#A0A0A0' - } - }, - lineColor: '#A0A0A0', - minorTickInterval: null, - tickColor: '#A0A0A0', - tickWidth: 1, - title: { - style: { - color: '#CCC', - fontWeight: 'bold', - fontSize: '12px', - fontFamily: 'Trebuchet MS, Verdana, sans-serif' - } - } - }, - tooltip: { - backgroundColor: 'rgba(0, 0, 0, 0.75)', - style: { - color: '#F0F0F0' - } - }, - toolbar: { - itemStyle: { - color: 'silver' - } - }, - plotOptions: { - line: { - dataLabels: { - color: '#CCC' - }, - marker: { - lineColor: '#333' - } - }, - spline: { - marker: { - lineColor: '#333' - } - }, - scatter: { - marker: { - lineColor: '#333' - } - }, - candlestick: { - lineColor: 'white' - } - }, - legend: { - itemStyle: { - font: '9pt Trebuchet MS, Verdana, sans-serif', - color: '#A0A0A0' - }, - itemHoverStyle: { - color: '#FFF' - }, - itemHiddenStyle: { - color: '#444' - } - }, - credits: { - style: { - color: '#666' - } - }, - labels: { - style: { - color: '#CCC' - } - }, - - - navigation: { - buttonOptions: { - symbolStroke: '#DDDDDD', - hoverSymbolStroke: '#FFFFFF', - theme: { - fill: { - linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 }, - stops: [ - [0.4, '#606060'], - [0.6, '#333333'] - ] - }, - stroke: '#000000' - } - } - }, - - // scroll charts - rangeSelector: { - buttonTheme: { - fill: { - linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 }, - stops: [ - [0.4, '#888'], - [0.6, '#555'] - ] - }, - stroke: '#000000', - style: { - color: '#CCC', - fontWeight: 'bold' - }, - states: { - hover: { - fill: { - linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 }, - stops: [ - [0.4, '#BBB'], - [0.6, '#888'] - ] - }, - stroke: '#000000', - style: { - color: 'white' - } - }, - select: { - fill: { - linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 }, - stops: [ - [0.1, '#000'], - [0.3, '#333'] - ] - }, - stroke: '#000000', - style: { - color: 'yellow' - } - } - } - }, - inputStyle: { - backgroundColor: '#333', - color: 'silver' - }, - labelStyle: { - color: 'silver' - } - }, - - navigator: { - handles: { - backgroundColor: '#666', - borderColor: '#AAA' - }, - outlineColor: '#CCC', - maskFill: 'rgba(16, 16, 16, 0.5)', - series: { - color: '#7798BF', - lineColor: '#A6C7ED' - } - }, - - scrollbar: { - barBackgroundColor: { - linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 }, - stops: [ - [0.4, '#888'], - [0.6, '#555'] - ] - }, - barBorderColor: '#CCC', - buttonArrowColor: '#CCC', - buttonBackgroundColor: { - linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 }, - stops: [ - [0.4, '#888'], - [0.6, '#555'] - ] - }, - buttonBorderColor: '#CCC', - rifleColor: '#FFF', - trackBackgroundColor: { - linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 }, - stops: [ - [0, '#000'], - [1, '#333'] - ] - }, - trackBorderColor: '#666' - }, - - // special colors for some of the - legendBackgroundColor: 'rgba(0, 0, 0, 0.5)', - background2: 'rgb(35, 35, 70)', - dataLabelsColor: '#444', - textColor: '#C0C0C0', - maskColor: 'rgba(255,255,255,0.3)' -}; - -// Apply the theme -var highchartsOptions = Highcharts.setOptions(Highcharts.theme); diff --git a/htdocs/js/lib/highstock/themes/dark-unica.js b/htdocs/js/lib/highstock/themes/dark-unica.js deleted file mode 100644 index 4f1f8df5..00000000 --- a/htdocs/js/lib/highstock/themes/dark-unica.js +++ /dev/null @@ -1,213 +0,0 @@ -/** - * Dark theme for Highcharts JS - * @author Torstein Honsi - */ - -// Load the fonts -Highcharts.createElement('link', { - href: 'http://fonts.googleapis.com/css?family=Unica+One', - rel: 'stylesheet', - type: 'text/css' -}, null, document.getElementsByTagName('head')[0]); - -Highcharts.theme = { - colors: ["#2b908f", "#90ee7e", "#f45b5b", "#7798BF", "#aaeeee", "#ff0066", "#eeaaee", - "#55BF3B", "#DF5353", "#7798BF", "#aaeeee"], - chart: { - backgroundColor: { - linearGradient: { x1: 0, y1: 0, x2: 1, y2: 1 }, - stops: [ - [0, '#2a2a2b'], - [1, '#3e3e40'] - ] - }, - style: { - fontFamily: "'Unica One', sans-serif" - }, - plotBorderColor: '#606063' - }, - title: { - style: { - color: '#E0E0E3', - textTransform: 'uppercase', - fontSize: '20px' - } - }, - subtitle: { - style: { - color: '#E0E0E3', - textTransform: 'uppercase' - } - }, - xAxis: { - gridLineColor: '#707073', - labels: { - style: { - color: '#E0E0E3' - } - }, - lineColor: '#707073', - minorGridLineColor: '#505053', - tickColor: '#707073', - title: { - style: { - color: '#A0A0A3' - - } - } - }, - yAxis: { - gridLineColor: '#707073', - labels: { - style: { - color: '#E0E0E3' - } - }, - lineColor: '#707073', - minorGridLineColor: '#505053', - tickColor: '#707073', - tickWidth: 1, - title: { - style: { - color: '#A0A0A3' - } - } - }, - tooltip: { - backgroundColor: 'rgba(0, 0, 0, 0.85)', - style: { - color: '#F0F0F0' - } - }, - plotOptions: { - series: { - dataLabels: { - color: '#B0B0B3' - }, - marker: { - lineColor: '#333' - } - }, - boxplot: { - fillColor: '#505053' - }, - candlestick: { - lineColor: 'white' - }, - errorbar: { - color: 'white' - } - }, - legend: { - itemStyle: { - color: '#E0E0E3' - }, - itemHoverStyle: { - color: '#FFF' - }, - itemHiddenStyle: { - color: '#606063' - } - }, - credits: { - style: { - color: '#666' - } - }, - labels: { - style: { - color: '#707073' - } - }, - - drilldown: { - activeAxisLabelStyle: { - color: '#F0F0F3' - }, - activeDataLabelStyle: { - color: '#F0F0F3' - } - }, - - navigation: { - buttonOptions: { - symbolStroke: '#DDDDDD', - theme: { - fill: '#505053' - } - } - }, - - // scroll charts - rangeSelector: { - buttonTheme: { - fill: '#505053', - stroke: '#000000', - style: { - color: '#CCC' - }, - states: { - hover: { - fill: '#707073', - stroke: '#000000', - style: { - color: 'white' - } - }, - select: { - fill: '#000003', - stroke: '#000000', - style: { - color: 'white' - } - } - } - }, - inputBoxBorderColor: '#505053', - inputStyle: { - backgroundColor: '#333', - color: 'silver' - }, - labelStyle: { - color: 'silver' - } - }, - - navigator: { - handles: { - backgroundColor: '#666', - borderColor: '#AAA' - }, - outlineColor: '#CCC', - maskFill: 'rgba(255,255,255,0.1)', - series: { - color: '#7798BF', - lineColor: '#A6C7ED' - }, - xAxis: { - gridLineColor: '#505053' - } - }, - - scrollbar: { - barBackgroundColor: '#808083', - barBorderColor: '#808083', - buttonArrowColor: '#CCC', - buttonBackgroundColor: '#606063', - buttonBorderColor: '#606063', - rifleColor: '#FFF', - trackBackgroundColor: '#404043', - trackBorderColor: '#404043' - }, - - // special colors for some of the - legendBackgroundColor: 'rgba(0, 0, 0, 0.5)', - background2: '#505053', - dataLabelsColor: '#B0B0B3', - textColor: '#C0C0C0', - contrastTextColor: '#F0F0F3', - maskColor: 'rgba(255,255,255,0.3)' -}; - -// Apply the theme -Highcharts.setOptions(Highcharts.theme); diff --git a/htdocs/js/lib/highstock/themes/gray.js b/htdocs/js/lib/highstock/themes/gray.js deleted file mode 100644 index d9a40169..00000000 --- a/htdocs/js/lib/highstock/themes/gray.js +++ /dev/null @@ -1,257 +0,0 @@ -/** - * Gray theme for Highcharts JS - * @author Torstein Honsi - */ - -Highcharts.theme = { - colors: ["#DDDF0D", "#7798BF", "#55BF3B", "#DF5353", "#aaeeee", "#ff0066", "#eeaaee", - "#55BF3B", "#DF5353", "#7798BF", "#aaeeee"], - chart: { - backgroundColor: { - linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 }, - stops: [ - [0, 'rgb(96, 96, 96)'], - [1, 'rgb(16, 16, 16)'] - ] - }, - borderWidth: 0, - borderRadius: 0, - plotBackgroundColor: null, - plotShadow: false, - plotBorderWidth: 0 - }, - title: { - style: { - color: '#FFF', - font: '16px Lucida Grande, Lucida Sans Unicode, Verdana, Arial, Helvetica, sans-serif' - } - }, - subtitle: { - style: { - color: '#DDD', - font: '12px Lucida Grande, Lucida Sans Unicode, Verdana, Arial, Helvetica, sans-serif' - } - }, - xAxis: { - gridLineWidth: 0, - lineColor: '#999', - tickColor: '#999', - labels: { - style: { - color: '#999', - fontWeight: 'bold' - } - }, - title: { - style: { - color: '#AAA', - font: 'bold 12px Lucida Grande, Lucida Sans Unicode, Verdana, Arial, Helvetica, sans-serif' - } - } - }, - yAxis: { - alternateGridColor: null, - minorTickInterval: null, - gridLineColor: 'rgba(255, 255, 255, .1)', - minorGridLineColor: 'rgba(255,255,255,0.07)', - lineWidth: 0, - tickWidth: 0, - labels: { - style: { - color: '#999', - fontWeight: 'bold' - } - }, - title: { - style: { - color: '#AAA', - font: 'bold 12px Lucida Grande, Lucida Sans Unicode, Verdana, Arial, Helvetica, sans-serif' - } - } - }, - legend: { - itemStyle: { - color: '#CCC' - }, - itemHoverStyle: { - color: '#FFF' - }, - itemHiddenStyle: { - color: '#333' - } - }, - labels: { - style: { - color: '#CCC' - } - }, - tooltip: { - backgroundColor: { - linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 }, - stops: [ - [0, 'rgba(96, 96, 96, .8)'], - [1, 'rgba(16, 16, 16, .8)'] - ] - }, - borderWidth: 0, - style: { - color: '#FFF' - } - }, - - - plotOptions: { - series: { - nullColor: '#444444' - }, - line: { - dataLabels: { - color: '#CCC' - }, - marker: { - lineColor: '#333' - } - }, - spline: { - marker: { - lineColor: '#333' - } - }, - scatter: { - marker: { - lineColor: '#333' - } - }, - candlestick: { - lineColor: 'white' - } - }, - - toolbar: { - itemStyle: { - color: '#CCC' - } - }, - - navigation: { - buttonOptions: { - symbolStroke: '#DDDDDD', - hoverSymbolStroke: '#FFFFFF', - theme: { - fill: { - linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 }, - stops: [ - [0.4, '#606060'], - [0.6, '#333333'] - ] - }, - stroke: '#000000' - } - } - }, - - // scroll charts - rangeSelector: { - buttonTheme: { - fill: { - linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 }, - stops: [ - [0.4, '#888'], - [0.6, '#555'] - ] - }, - stroke: '#000000', - style: { - color: '#CCC', - fontWeight: 'bold' - }, - states: { - hover: { - fill: { - linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 }, - stops: [ - [0.4, '#BBB'], - [0.6, '#888'] - ] - }, - stroke: '#000000', - style: { - color: 'white' - } - }, - select: { - fill: { - linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 }, - stops: [ - [0.1, '#000'], - [0.3, '#333'] - ] - }, - stroke: '#000000', - style: { - color: 'yellow' - } - } - } - }, - inputStyle: { - backgroundColor: '#333', - color: 'silver' - }, - labelStyle: { - color: 'silver' - } - }, - - navigator: { - handles: { - backgroundColor: '#666', - borderColor: '#AAA' - }, - outlineColor: '#CCC', - maskFill: 'rgba(16, 16, 16, 0.5)', - series: { - color: '#7798BF', - lineColor: '#A6C7ED' - } - }, - - scrollbar: { - barBackgroundColor: { - linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 }, - stops: [ - [0.4, '#888'], - [0.6, '#555'] - ] - }, - barBorderColor: '#CCC', - buttonArrowColor: '#CCC', - buttonBackgroundColor: { - linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 }, - stops: [ - [0.4, '#888'], - [0.6, '#555'] - ] - }, - buttonBorderColor: '#CCC', - rifleColor: '#FFF', - trackBackgroundColor: { - linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 }, - stops: [ - [0, '#000'], - [1, '#333'] - ] - }, - trackBorderColor: '#666' - }, - - // special colors for some of the demo examples - legendBackgroundColor: 'rgba(48, 48, 48, 0.8)', - background2: 'rgb(70, 70, 70)', - dataLabelsColor: '#444', - textColor: '#E0E0E0', - maskColor: 'rgba(255,255,255,0.3)' -}; - -// Apply the theme -var highchartsOptions = Highcharts.setOptions(Highcharts.theme); diff --git a/htdocs/js/lib/highstock/themes/grid-light.js b/htdocs/js/lib/highstock/themes/grid-light.js deleted file mode 100644 index acf53aec..00000000 --- a/htdocs/js/lib/highstock/themes/grid-light.js +++ /dev/null @@ -1,74 +0,0 @@ -/** - * Grid-light theme for Highcharts JS - * @author Torstein Honsi - */ - -// Load the fonts -Highcharts.createElement('link', { - href: 'http://fonts.googleapis.com/css?family=Dosis:400,600', - rel: 'stylesheet', - type: 'text/css' -}, null, document.getElementsByTagName('head')[0]); - -Highcharts.theme = { - colors: ["#7cb5ec", "#f7a35c", "#90ee7e", "#7798BF", "#aaeeee", "#ff0066", "#eeaaee", - "#55BF3B", "#DF5353", "#7798BF", "#aaeeee"], - chart: { - backgroundColor: null, - style: { - fontFamily: "Dosis, sans-serif" - } - }, - title: { - style: { - fontSize: '16px', - fontWeight: 'bold', - textTransform: 'uppercase' - } - }, - tooltip: { - borderWidth: 0, - backgroundColor: 'rgba(219,219,216,0.8)', - shadow: false - }, - legend: { - itemStyle: { - fontWeight: 'bold', - fontSize: '13px' - } - }, - xAxis: { - gridLineWidth: 1, - labels: { - style: { - fontSize: '12px' - } - } - }, - yAxis: { - minorTickInterval: 'auto', - title: { - style: { - textTransform: 'uppercase' - } - }, - labels: { - style: { - fontSize: '12px' - } - } - }, - plotOptions: { - candlestick: { - lineColor: '#404048' - } - }, - - - // General - background2: '#F0F0EA' - -}; - -// Apply the theme -Highcharts.setOptions(Highcharts.theme); diff --git a/htdocs/js/lib/highstock/themes/grid.js b/htdocs/js/lib/highstock/themes/grid.js deleted file mode 100644 index 70342f5e..00000000 --- a/htdocs/js/lib/highstock/themes/grid.js +++ /dev/null @@ -1,103 +0,0 @@ -/** - * Grid theme for Highcharts JS - * @author Torstein Honsi - */ - -Highcharts.theme = { - colors: ['#058DC7', '#50B432', '#ED561B', '#DDDF00', '#24CBE5', '#64E572', '#FF9655', '#FFF263', '#6AF9C4'], - chart: { - backgroundColor: { - linearGradient: { x1: 0, y1: 0, x2: 1, y2: 1 }, - stops: [ - [0, 'rgb(255, 255, 255)'], - [1, 'rgb(240, 240, 255)'] - ] - }, - borderWidth: 2, - plotBackgroundColor: 'rgba(255, 255, 255, .9)', - plotShadow: true, - plotBorderWidth: 1 - }, - title: { - style: { - color: '#000', - font: 'bold 16px "Trebuchet MS", Verdana, sans-serif' - } - }, - subtitle: { - style: { - color: '#666666', - font: 'bold 12px "Trebuchet MS", Verdana, sans-serif' - } - }, - xAxis: { - gridLineWidth: 1, - lineColor: '#000', - tickColor: '#000', - labels: { - style: { - color: '#000', - font: '11px Trebuchet MS, Verdana, sans-serif' - } - }, - title: { - style: { - color: '#333', - fontWeight: 'bold', - fontSize: '12px', - fontFamily: 'Trebuchet MS, Verdana, sans-serif' - - } - } - }, - yAxis: { - minorTickInterval: 'auto', - lineColor: '#000', - lineWidth: 1, - tickWidth: 1, - tickColor: '#000', - labels: { - style: { - color: '#000', - font: '11px Trebuchet MS, Verdana, sans-serif' - } - }, - title: { - style: { - color: '#333', - fontWeight: 'bold', - fontSize: '12px', - fontFamily: 'Trebuchet MS, Verdana, sans-serif' - } - } - }, - legend: { - itemStyle: { - font: '9pt Trebuchet MS, Verdana, sans-serif', - color: 'black' - - }, - itemHoverStyle: { - color: '#039' - }, - itemHiddenStyle: { - color: 'gray' - } - }, - labels: { - style: { - color: '#99b' - } - }, - - navigation: { - buttonOptions: { - theme: { - stroke: '#CCCCCC' - } - } - } -}; - -// Apply the theme -var highchartsOptions = Highcharts.setOptions(Highcharts.theme); diff --git a/htdocs/js/lib/highstock/themes/sand-signika.js b/htdocs/js/lib/highstock/themes/sand-signika.js deleted file mode 100644 index 27198331..00000000 --- a/htdocs/js/lib/highstock/themes/sand-signika.js +++ /dev/null @@ -1,101 +0,0 @@ -/** - * Sand-Signika theme for Highcharts JS - * @author Torstein Honsi - */ - -// Load the fonts -Highcharts.createElement('link', { - href: 'http://fonts.googleapis.com/css?family=Signika:400,700', - rel: 'stylesheet', - type: 'text/css' -}, null, document.getElementsByTagName('head')[0]); - -// Add the background image to the container -Highcharts.wrap(Highcharts.Chart.prototype, 'getContainer', function (proceed) { - proceed.call(this); - this.container.style.background = 'url(http://www.highcharts.com/samples/graphics/sand.png)'; -}); - - -Highcharts.theme = { - colors: ["#f45b5b", "#8085e9", "#8d4654", "#7798BF", "#aaeeee", "#ff0066", "#eeaaee", - "#55BF3B", "#DF5353", "#7798BF", "#aaeeee"], - chart: { - backgroundColor: null, - style: { - fontFamily: "Signika, serif" - } - }, - title: { - style: { - color: 'black', - fontSize: '16px', - fontWeight: 'bold' - } - }, - subtitle: { - style: { - color: 'black' - } - }, - tooltip: { - borderWidth: 0 - }, - legend: { - itemStyle: { - fontWeight: 'bold', - fontSize: '13px' - } - }, - xAxis: { - labels: { - style: { - color: '#6e6e70' - } - } - }, - yAxis: { - labels: { - style: { - color: '#6e6e70' - } - } - }, - plotOptions: { - series: { - shadow: true - }, - candlestick: { - lineColor: '#404048' - } - }, - - // Highstock specific - navigator: { - xAxis: { - gridLineColor: '#D0D0D8' - } - }, - rangeSelector: { - buttonTheme: { - fill: 'white', - stroke: '#C0C0C8', - 'stroke-width': 1, - states: { - select: { - fill: '#D0D0D8' - } - } - } - }, - scrollbar: { - trackBorderColor: '#C0C0C8' - }, - - // General - background2: '#E0E0E8' - -}; - -// Apply the theme -Highcharts.setOptions(Highcharts.theme); diff --git a/htdocs/js/lib/highstock/themes/skies.js b/htdocs/js/lib/highstock/themes/skies.js deleted file mode 100644 index d58b1f24..00000000 --- a/htdocs/js/lib/highstock/themes/skies.js +++ /dev/null @@ -1,89 +0,0 @@ -/** - * Skies theme for Highcharts JS - * @author Torstein Honsi - */ - -Highcharts.theme = { - colors: ["#514F78", "#42A07B", "#9B5E4A", "#72727F", "#1F949A", "#82914E", "#86777F", "#42A07B"], - chart: { - className: 'skies', - borderWidth: 0, - plotShadow: true, - plotBackgroundImage: 'http://www.highcharts.com/demo/gfx/skies.jpg', - plotBackgroundColor: { - linearGradient: [0, 0, 250, 500], - stops: [ - [0, 'rgba(255, 255, 255, 1)'], - [1, 'rgba(255, 255, 255, 0)'] - ] - }, - plotBorderWidth: 1 - }, - title: { - style: { - color: '#3E576F', - font: '16px Lucida Grande, Lucida Sans Unicode, Verdana, Arial, Helvetica, sans-serif' - } - }, - subtitle: { - style: { - color: '#6D869F', - font: '12px Lucida Grande, Lucida Sans Unicode, Verdana, Arial, Helvetica, sans-serif' - } - }, - xAxis: { - gridLineWidth: 0, - lineColor: '#C0D0E0', - tickColor: '#C0D0E0', - labels: { - style: { - color: '#666', - fontWeight: 'bold' - } - }, - title: { - style: { - color: '#666', - font: '12px Lucida Grande, Lucida Sans Unicode, Verdana, Arial, Helvetica, sans-serif' - } - } - }, - yAxis: { - alternateGridColor: 'rgba(255, 255, 255, .5)', - lineColor: '#C0D0E0', - tickColor: '#C0D0E0', - tickWidth: 1, - labels: { - style: { - color: '#666', - fontWeight: 'bold' - } - }, - title: { - style: { - color: '#666', - font: '12px Lucida Grande, Lucida Sans Unicode, Verdana, Arial, Helvetica, sans-serif' - } - } - }, - legend: { - itemStyle: { - font: '9pt Trebuchet MS, Verdana, sans-serif', - color: '#3E576F' - }, - itemHoverStyle: { - color: 'black' - }, - itemHiddenStyle: { - color: 'silver' - } - }, - labels: { - style: { - color: '#3E576F' - } - } -}; - -// Apply the theme -var highchartsOptions = Highcharts.setOptions(Highcharts.theme);