From c47de7ae12935a1cef9ef5fb4bfda0d14f6ebeb3 Mon Sep 17 00:00:00 2001 From: Li Jianxuan Date: Thu, 27 Dec 2012 08:42:56 +0000 Subject: [PATCH] =?UTF-8?q?#425=20=E9=A6=96=E9=A1=B5=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=96=B0=E9=97=BB=E7=9A=84=E7=84=A6=E7=82=B9=E8=BD=AE=E6=92=AD?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../default/controllers/IndexController.php | 132 ++++++++++-------- .../default/views/scripts/index/index.phtml | 42 ++++-- htdocs/css/author-metadata.css | 8 +- htdocs/css/default.css | 1 + htdocs/css/index.css | 24 ++-- htdocs/js/lib/slides.min.jquery.js | 20 +++ 6 files changed, 148 insertions(+), 79 deletions(-) create mode 100644 htdocs/js/lib/slides.min.jquery.js diff --git a/application/default/controllers/IndexController.php b/application/default/controllers/IndexController.php index 97e7b12b..56d7b627 100755 --- a/application/default/controllers/IndexController.php +++ b/application/default/controllers/IndexController.php @@ -1,57 +1,75 @@ -view->config->paths->newsletter,"newsletter_*.pdf"); - $this->view->newsletter=$l->getLast(); - $name=basename($this->view->newsletter,'.pdf'); - list(,$this->view->newsletterno)=explode("_",$name); - //统计数据 - $sql='select (select count(*) from users) as usernum,(select count(*) from metadata) as metanum,(select count(*) from offlineapp where ts_approved is not null ) as offlinenum'; - $row=$this->db->fetchRow($sql); - $this->view->usernum=$row['usernum']; - $this->view->metanum=$row['metanum']; - $this->view->offlinenum=$row['offlinenum']; - /*$sql='select count(*) from metadata'; - $row=$this->db->fetchRow($sql); - $this->view->metanum=$row['count'];*/ - $sql="select sum(filesize) as sum,datatype from metadata group by datatype"; - $rows=$this->db->fetchAll($sql); - foreach($rows as $row) - { - if ($row['datatype']) - $this->view->offlinesize=$row['sum']; - else - $this->view->onlinesize=$row['sum']; - } - //特色推荐 - $sql="select * from datafeature order by id desc"; - $this->view->feature=$this->db->fetchRow($sql); - //特色数据集 - $sql="select * from datasetcd order by random()"; - $this->view->datasetcd=$this->db->fetchRow($sql); - //下载最多数据(top 5) - $sql="select uuid,title,id from normalmetadata where id in (select m.id from normalmetadata m left join dataorder d on m.uuid=d.uuid where m.datatype=0 group by m.id order by count(d.uuid) desc limit 5)"; - $this->db->setFetchMode(Zend_Db::FETCH_OBJ); - $this->view->mdtop=$this->db->fetchAll($sql); - $sql="select uuid,title,id from normalmetadata where id in (select m.id from normalmetadata m left join dataorder d on m.uuid=d.uuid where m.datatype=1 group by m.id order by count(d.uuid) desc limit 5)"; - $this->view->offlinemdtop=$this->db->fetchAll($sql); - $sql="select m.uuid,m.title,m.id,m.description from normalmetadata m left join thumbnail t on m.id=t.id where length(t.data)>2 order by random()"; - $this->view->mdrandom=$this->db->fetchRow($sql); - //搜索 - $this->view->addHelperPath('helper','Zend_View_Helper_'); - $searchform=new SearchForm(); - //$searchform->removeElement('submit'); - $this->view->searchform=$searchform; - } - function preDispatch() - { - $this->view->config = Zend_Registry::get('config'); - $this->db=Zend_Registry::get('db'); - } - -} - +view->config = Zend_Registry::get('config'); + $this->db=Zend_Registry::get('db'); + $this->view->theme = new Theme(); + } + + function indexAction() + { + //数据通讯 + $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); + //统计数据 + $sql='select (select count(*) from users) as usernum,(select count(*) from metadata) as metanum,(select count(*) from offlineapp where ts_approved is not null ) as offlinenum'; + $row=$this->db->fetchRow($sql); + $this->view->usernum=$row['usernum']; + $this->view->metanum=$row['metanum']; + $this->view->offlinenum=$row['offlinenum']; + /*$sql='select count(*) from metadata'; + $row=$this->db->fetchRow($sql); + $this->view->metanum=$row['count'];*/ + $sql="select sum(filesize) as sum,datatype from metadata group by datatype"; + $rows=$this->db->fetchAll($sql); + foreach($rows as $row) + { + if ($row['datatype']) + $this->view->offlinesize=$row['sum']; + else + $this->view->onlinesize=$row['sum']; + } + //特色推荐 + $sql="select * from datafeature order by id desc"; + $this->view->feature=$this->db->fetchRow($sql); + //特色数据集 + $sql="select * from datasetcd order by random()"; + $this->view->datasetcd=$this->db->fetchRow($sql); + //下载最多数据(top 5) + $sql="select uuid,title,id from normalmetadata where id in (select m.id from normalmetadata m left join dataorder d on m.uuid=d.uuid where m.datatype=0 group by m.id order by count(d.uuid) desc limit 5)"; + $this->db->setFetchMode(Zend_Db::FETCH_OBJ); + $this->view->mdtop=$this->db->fetchAll($sql); + $sql="select uuid,title,id from normalmetadata where id in (select m.id from normalmetadata m left join dataorder d on m.uuid=d.uuid where m.datatype=1 group by m.id order by count(d.uuid) desc limit 5)"; + $this->view->offlinemdtop=$this->db->fetchAll($sql); + $sql="select m.uuid,m.title,m.id,m.description from normalmetadata m left join thumbnail t on m.id=t.id where length(t.data)>2 order by random()"; + $this->view->mdrandom=$this->db->fetchRow($sql); + //搜索 + $this->view->addHelperPath('helper','Zend_View_Helper_'); + $searchform=new SearchForm(); + //$searchform->removeElement('submit'); + $this->view->searchform=$searchform; + + $News = new Archive($this->db); + + $time = date("Y-m-d H:i:s",time()); + $sql = "SELECT * FROM archive WHERE is_pub=true AND ts_published<'$time' AND image!='' LIMIT 5"; + $sth = $this->db->query($sql); + $rows = $sth->fetchAll(PDO::FETCH_BOTH); + + foreach($rows as $k=>$v) + { + $url = $News->getArchiveUrlByCid($v['id']); + $rows[$k]['url'] = $url['archive_url']; + } + + $this->view->news = $rows; + + } + +} + diff --git a/application/default/views/scripts/index/index.phtml b/application/default/views/scripts/index/index.phtml index fa741568..1f6e3467 100755 --- a/application/default/views/scripts/index/index.phtml +++ b/application/default/views/scripts/index/index.phtml @@ -3,6 +3,8 @@ $this->headTitle('首页'); $this->headTitle()->setSeparator(' - '); $this->headLink()->appendStylesheet('/css/index.css'); + $this->theme->AppendPlus($this,'jquery'); + $this->theme->AppendPlus($this,'slides'); $auth = Zend_Auth::getInstance(); ?>
@@ -101,16 +103,21 @@
-
-
特色数据集
-
- -
feature['title']; ?>
-
- feature['description']; ?> -
- 以往推荐 - 详细 +
+
+ news as $k=>$v) + { + echo '
'. + '
'. + '

'.$v['title'].'

'. + ''.$v['description'].'
'. + ''. + '
'; + } + ?> +
+
@@ -144,5 +151,16 @@
- - \ No newline at end of file + + \ No newline at end of file diff --git a/htdocs/css/author-metadata.css b/htdocs/css/author-metadata.css index e8c54be8..7d0fdfb1 100644 --- a/htdocs/css/author-metadata.css +++ b/htdocs/css/author-metadata.css @@ -68,4 +68,10 @@ textarea {resize: none} .span3{width:200px;} .input_arae{ margin:5px 0;} -.map_display_part{width:500px;height:300px;float:left;} \ No newline at end of file +.map_display_part{width:500px;height:300px;float:left;} + +.auto-complete-elements{height:140px;position:absolute;z-index:999;background:#FFF;border:1px solid #ccc; padding:2px;} +.auto-complete-elements ul{height:120px;overflow-y:scroll;} +.auto-complete-elements ul li{line-height:18px; cursor:pointer;height:18px; overflow:hidden;border:1px solid #FFF;} +.auto-complete-elements ul li:hover{height:18px;line-height:18px; border:1px solid #dedede;} +.auto-complete-elements .close-btn{height:18px;line-height:18px;border:1px solid #ccc;cursor:pointer; text-align:center} \ No newline at end of file diff --git a/htdocs/css/default.css b/htdocs/css/default.css index cb7fea6c..0b8731da 100755 --- a/htdocs/css/default.css +++ b/htdocs/css/default.css @@ -114,6 +114,7 @@ input:focus,textarea:focus { -webkit-focus-ring-color:none; border-color:#c4c4c4; background-color:#FFFFF0; + border-radius:3px; } fieldset {border:0 none;border-top:1px solid #ddd;margin:10px 0;padding:10px 0;} legend {background:#fff;color:#93BB3A;font-weight:bold; padding:0 6px 0 0;} diff --git a/htdocs/css/index.css b/htdocs/css/index.css index bb5a31ba..d959e9ab 100755 --- a/htdocs/css/index.css +++ b/htdocs/css/index.css @@ -147,17 +147,23 @@ color:Green; text-decoration:none; #dataLink ul{padding:5px 0;} #rightPanel #dataLink a{font-weight: bold;} -/*数据CD开始*/ +/*新闻*/ #itemCd{ margin-top: 10px; border-bottom:1px dotted gray; overflow:hidden;} -#itemCd img { margin-top:-5px;margin-left:-5px;width:100px;height:100px;border-width:1px;border-style:solid;} -#itemCd #image{float: left; width: 110px; height: 105px;} -#itemCd #title{font-size: 105%; font-weight: bold; font-family: Tahoma; } -#itemCd #filesize{color: Gray;font-size: 95%;} -#itemCd #descript{margin: 10px 2% 5px 0px; font-family: Verdana;} -#itemCd #descript #intro {font-style: italic;} -#itemCd #link {margin-bottom: 10px;} + #dataLink ul{display:inline;float:left;list-style-type: none;margin-top:-5px;} input{background:#ECF0F5;margin-bottom:6px;} dd,dt{margin:0;} -#dataLink dd {padding-bottom:5px;margin-left:5px;margin-top:-5px;} \ No newline at end of file +#dataLink dd {padding-bottom:5px;margin-left:5px;margin-top:-5px;} + +#slides {overflow:hidden;} + #slides .slide{width:520px;} + #slides .slide { overflow:hidden;} + #slides .slide .thumb {float:left; overflow:hidden;} + #slides .slide .thumb img{max-height:150px;border:1px solid #CCC;padding:2px;margin:0 5px 0 0;} + #slides .slide .ctitle {float:left;overflow:hidden;} + #slides .slide .ctitle h2{font-weight:bold;display:block} + #slides .slide .description{float:left;} + #slides .pagination {} + #slides .pagination li{width:10px;height:16px;padding:2px;float:left;} + #slides .pagination li.current{background:#dedede;color:#FFF} \ No newline at end of file diff --git a/htdocs/js/lib/slides.min.jquery.js b/htdocs/js/lib/slides.min.jquery.js new file mode 100644 index 00000000..1a1fcdd8 --- /dev/null +++ b/htdocs/js/lib/slides.min.jquery.js @@ -0,0 +1,20 @@ +/* +* Slides, A Slideshow Plugin for jQuery +* Intructions: http://slidesjs.com +* By: Nathan Searles, http://nathansearles.com +* Version: 1.1.9 +* Updated: September 5th, 2011 +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +(function(a){a.fn.slides=function(b){return b=a.extend({},a.fn.slides.option,b),this.each(function(){function w(g,h,i){if(!p&&o){p=!0,b.animationStart(n+1);switch(g){case"next":l=n,k=n+1,k=e===k?0:k,r=f*2,g=-f*2,n=k;break;case"prev":l=n,k=n-1,k=k===-1?e-1:k,r=0,g=0,n=k;break;case"pagination":k=parseInt(i,10),l=a("."+b.paginationClass+" li."+b.currentClass+" a",c).attr("href").match("[^#/]+$"),k>l?(r=f*2,g=-f*2):(r=0,g=0),n=k}h==="fade"?b.crossfade?d.children(":eq("+k+")",c).css({zIndex:10}).fadeIn(b.fadeSpeed,b.fadeEasing,function(){b.autoHeight?d.animate({height:d.children(":eq("+k+")",c).outerHeight()},b.autoHeightSpeed,function(){d.children(":eq("+l+")",c).css({display:"none",zIndex:0}),d.children(":eq("+k+")",c).css({zIndex:0}),b.animationComplete(k+1),p=!1}):(d.children(":eq("+l+")",c).css({display:"none",zIndex:0}),d.children(":eq("+k+")",c).css({zIndex:0}),b.animationComplete(k+1),p=!1)}):d.children(":eq("+l+")",c).fadeOut(b.fadeSpeed,b.fadeEasing,function(){b.autoHeight?d.animate({height:d.children(":eq("+k+")",c).outerHeight()},b.autoHeightSpeed,function(){d.children(":eq("+k+")",c).fadeIn(b.fadeSpeed,b.fadeEasing)}):d.children(":eq("+k+")",c).fadeIn(b.fadeSpeed,b.fadeEasing,function(){a.browser.msie&&a(this).get(0).style.removeAttribute("filter")}),b.animationComplete(k+1),p=!1}):(d.children(":eq("+k+")").css({left:r,display:"block"}),b.autoHeight?d.animate({left:g,height:d.children(":eq("+k+")").outerHeight()},b.slideSpeed,b.slideEasing,function(){d.css({left:-f}),d.children(":eq("+k+")").css({left:f,zIndex:5}),d.children(":eq("+l+")").css({left:f,display:"none",zIndex:0}),b.animationComplete(k+1),p=!1}):d.animate({left:g},b.slideSpeed,b.slideEasing,function(){d.css({left:-f}),d.children(":eq("+k+")").css({left:f,zIndex:5}),d.children(":eq("+l+")").css({left:f,display:"none",zIndex:0}),b.animationComplete(k+1),p=!1})),b.pagination&&(a("."+b.paginationClass+" li."+b.currentClass,c).removeClass(b.currentClass),a("."+b.paginationClass+" li:eq("+k+")",c).addClass(b.currentClass))}}function x(){clearInterval(c.data("interval"))}function y(){b.pause?(clearTimeout(c.data("pause")),clearInterval(c.data("interval")),u=setTimeout(function(){clearTimeout(c.data("pause")),v=setInterval(function(){w("next",i)},b.play),c.data("interval",v)},b.pause),c.data("pause",u)):x()}a("."+b.container,a(this)).children().wrapAll('
');var c=a(this),d=a(".slides_control",c),e=d.children().size(),f=d.children().outerWidth(),g=d.children().outerHeight(),h=b.start-1,i=b.effect.indexOf(",")<0?b.effect:b.effect.replace(" ","").split(",")[0],j=b.effect.indexOf(",")<0?i:b.effect.replace(" ","").split(",")[1],k=0,l=0,m=0,n=0,o,p,q,r,s,t,u,v;if(e<2)return a("."+b.container,a(this)).fadeIn(b.fadeSpeed,b.fadeEasing,function(){o=!0,b.slidesLoaded()}),a("."+b.next+", ."+b.prev).fadeOut(0),!1;if(e<2)return;h<0&&(h=0),h>e&&(h=e-1),b.start&&(n=h),b.randomize&&d.randomize(),a("."+b.container,c).css({overflow:"hidden",position:"relative"}),d.children().css({position:"absolute",top:0,left:d.children().outerWidth(),zIndex:0,display:"none"}),d.css({position:"relative",width:f*3,height:g,left:-f}),a("."+b.container,c).css({display:"block"}),b.autoHeight&&(d.children().css({height:"auto"}),d.animate({height:d.children(":eq("+h+")").outerHeight()},b.autoHeightSpeed));if(b.preload&&d.find("img:eq("+h+")").length){a("."+b.container,c).css({background:"url("+b.preloadImage+") no-repeat 50% 50%"});var z=d.find("img:eq("+h+")").attr("src")+"?"+(new Date).getTime();a("img",c).parent().attr("class")!="slides_control"?t=d.children(":eq(0)")[0].tagName.toLowerCase():t=d.find("img:eq("+h+")"),d.find("img:eq("+h+")").attr("src",z).load(function(){d.find(t+":eq("+h+")").fadeIn(b.fadeSpeed,b.fadeEasing,function(){a(this).css({zIndex:5}),a("."+b.container,c).css({background:""}),o=!0,b.slidesLoaded()})})}else d.children(":eq("+h+")").fadeIn(b.fadeSpeed,b.fadeEasing,function(){o=!0,b.slidesLoaded()});b.bigTarget&&(d.children().css({cursor:"pointer"}),d.children().click(function(){return w("next",i),!1})),b.hoverPause&&b.play&&(d.bind("mouseover",function(){x()}),d.bind("mouseleave",function(){y()})),b.generateNextPrev&&(a("."+b.container,c).after('Prev'),a("."+b.prev,c).after('Next')),a("."+b.next,c).click(function(a){a.preventDefault(),b.play&&y(),w("next",i)}),a("."+b.prev,c).click(function(a){a.preventDefault(),b.play&&y(),w("prev",i)}),b.generatePagination?(b.prependPagination?c.prepend(""):c.append(""),d.children().each(function(){a("."+b.paginationClass,c).append('
  • '+(m+1)+"
  • "),m++})):a("."+b.paginationClass+" li a",c).each(function(){a(this).attr("href","#"+m),m++}),a("."+b.paginationClass+" li:eq("+h+")",c).addClass(b.currentClass),a("."+b.paginationClass+" li a",c).click(function(){return b.play&&y(),q=a(this).attr("href").match("[^#/]+$"),n!=q&&w("pagination",j,q),!1}),a("a.link",c).click(function(){return b.play&&y(),q=a(this).attr("href").match("[^#/]+$")-1,n!=q&&w("pagination",j,q),!1}),b.play&&(v=setInterval(function(){w("next",i)},b.play),c.data("interval",v))})},a.fn.slides.option={preload:!1,preloadImage:"/img/loading.gif",container:"slides_container",generateNextPrev:!1,next:"next",prev:"prev",pagination:!0,generatePagination:!0,prependPagination:!1,paginationClass:"pagination",currentClass:"current",fadeSpeed:350,fadeEasing:"",slideSpeed:350,slideEasing:"",start:1,effect:"slide",crossfade:!1,randomize:!1,play:0,pause:0,hoverPause:!1,autoHeight:!1,autoHeightSpeed:350,bigTarget:!1,animationStart:function(){},animationComplete:function(){},slidesLoaded:function(){}},a.fn.randomize=function(b){function c(){return Math.round(Math.random())-.5}return a(this).each(function(){var d=a(this),e=d.children(),f=e.length;if(f>1){e.hide();var g=[];for(i=0;i