From 2524ad2b240a09d85ea538982097b77a06fd47e7 Mon Sep 17 00:00:00 2001
From: 4ngle
Date: Fri, 19 Mar 2010 10:18:58 +0000
Subject: [PATCH] metadata filelist
---
.../controllers/FilelistController.php | 2 +-
.../controllers/MetainfoController.php | 9 ++
.../default/views/scripts/data/view.phtml | 15 +--
.../views/scripts/metainfo/index.phtml | 106 ++++++++++++++++++
4 files changed, 124 insertions(+), 8 deletions(-)
create mode 100644 application/default/controllers/MetainfoController.php
create mode 100644 application/default/views/scripts/metainfo/index.phtml
diff --git a/application/default/controllers/FilelistController.php b/application/default/controllers/FilelistController.php
index 52291460..cf69e017 100644
--- a/application/default/controllers/FilelistController.php
+++ b/application/default/controllers/FilelistController.php
@@ -2,7 +2,7 @@
class FilelistController extends Zend_Controller_Action {
function indexAction() {
$uuid=$this->_request->getParam('uuid');
- $filelist=new FilelistTable(array('db'=>'filelist'));
+ $filelist=new FilelistTable();
$adapter=$filelist->getAdapter();
$db=$adapter->query("select file_name,file_path from westdc_fileinfo where meta_uuid='$uuid'");
$files=$db->fetchAll();
diff --git a/application/default/controllers/MetainfoController.php b/application/default/controllers/MetainfoController.php
new file mode 100644
index 00000000..c71b497c
--- /dev/null
+++ b/application/default/controllers/MetainfoController.php
@@ -0,0 +1,9 @@
+_request->getParam('title');
+ $filePath="http://wiki.westgis.ac.cn/api.php?format=php&action=query&prop=revisions&titles=$title&rvprop=content";
+ $wikifp=fopen($filePath,r);
+ $this->view->title=$wikifp;
+ }
+}
\ No newline at end of file
diff --git a/application/default/views/scripts/data/view.phtml b/application/default/views/scripts/data/view.phtml
index 93481993..fa294933 100755
--- a/application/default/views/scripts/data/view.phtml
+++ b/application/default/views/scripts/data/view.phtml
@@ -79,7 +79,13 @@ else
数据时间范围:timebegin));if (!empty($md->timeend)) echo " 至 ".date('Y-m-d',strtotime($md->timeend)); ?>
doc)) : ?>
- 数据说明文档
+ doc;
+ }?>">数据说明文档
数据类型:datatype) print "离线(可免费申请)"; else print "在线(可直接下载)";?>
@@ -155,12 +161,7 @@ endforeach;
endforeach;
?>
-suppinfo) : ?>
-项目支持信息
-'.str_replace(array("\r\n", "\n", "\r"),'
+$wikiFont";
+ }elseif(strpos($text,'====')!== false&&substr($text,0,1)=='=') {
+ $wikiFont=str_replace('====','',$text);
+ echo "
$wikiFont
";
+ }elseif(strpos($text,'===')!== false&&substr($text,0,1)=='=') {
+ $wikiFont=str_replace('===','',$text);
+ echo "
$wikiFont
";
+ }elseif(strpos($text,'==')!== false&&substr($text,0,1)=='=') {
+ $wikiFont=str_replace('==','',$text);
+ echo "
$wikiFont
";
+ }elseif(strpos($text,'[[image:')!== false||strpos($text,'[[Image:')!== false) {
+ $wimag=array('[[image:',']]','[[Image:');
+ $imag=str_replace($wimag,'',$text);
+ $fname="http://wiki.westgis.ac.cn/api.php?format=php&action=query&prop=imageinfo&titles=image:$imag&iiprop=url";
+ $imagfp=fopen($fname,r);
+ $imagfiles=fread($imagfp,1024);
+ $imagfile=strstr($imagfiles,'http');
+ $imagurl=mb_strstr($imagfile,'"',true);
+ echo "
";
+ }elseif(substr($text,0,3)=='·[['||substr($text,0,4)=='· [['||substr($text,0,2)=='[[') {
+ $wikia=array('·[[','· [[','[[',']]');
+ $wikiname=str_replace($wikia,'',$text);
+ echo '
'.$wikiname.'
';
+ }elseif(strpos($text,'[[')!== false) {
+ $a=array('[[',']]');
+ $b=array('
','');
+ $test=str_replace($a,$b,$text);
+ preg_match_all("|<[^>]+>(.*)[^>]+>|U",$test,$out,PREG_PATTERN_ORDER);
+ $name=$out[1][0];//还有问题,测试遇到再解决!
+ $alink='
';
+ $c=array($alink,'');
+ echo '
'.str_replace($a,$c,$text).'
';
+ }elseif(strpos($text,'[http://')!== false||strpos($text,'[ http://')!== false){
+ $a=array('[',']');
+ $b=array('
','');
+ $test=str_replace($a,$b,$text);
+ preg_match_all("|<[^>]+>(.*)[^>]+>|U",$test,$out,PREG_PATTERN_ORDER);
+ $name=$out[1][0];//还有问题,测试遇到再解决!
+ $href='
';
+ $value=mb_strstr($name,' ',false).'';
+ echo str_replace($name,$href.$value,$test);
+ }elseif(strpos($text,'{|')!== false) {
+ $wikitable=str_replace("{|",'
';
+ }elseif(strpos($text,'colspan')) {
+ if(substr($text,-2)=='| '||substr($text,-2)==' |') {
+ $wikicolspan=array(' |','| ');
+ $colspan=array('>','',' | ';
+ }
+ }elseif(strpos($text,'|+ ')!== false) {
+ $wikitr=str_replace('|+ ','',$text);
+ echo $wikitr.' | ';
+ }elseif(strpos($text,'!!')!== false||substr($text,0,1)=='!') {
+ $thh=str_replace("!!",'',$text);
+ $wikith=str_replace('!',' | ',$thh);
+ echo $wikith.' | ';
+ }elseif(strpos($text,'||')!== false||substr($text,0,1)=='|'&&substr($text,0,2)!=='||'&&substr($text,0,2)!=='|+'&&substr($text,0,2)!=='|-'&&substr($text,0,2)!=='|}') {
+ $tdd=str_replace('||','',$text);
+ $wikitd=str_replace('|',' | ',$tdd);
+ echo $wikitd.' | ';
+ }elseif(substr($text,0,2)=='|-') {
+ $wikitrr=str_replace('|-','',$text);
+ echo$wikitrr;
+ }elseif(substr($text,0,2)=='|}') {
+ $wikitables=str_replace("|}",'
',$text);
+ echo $wikitables;
+ }elseif(substr($text,0,1)=='#') {
+ echo str_replace('#',' ',$text);
+ }elseif(strpos($text,"'''")!==false) {
+ echo str_replace("'''",'',$text);
+ }elseif(substr($text,0,1)=="*") {
+ echo str_replace('*','',$text);
+ }else {
+ echo "
$text
";
+ }
+}
+$wikifp=$this->title;
+while (!feof($wikifp)) {
+ $wikiLines=fgets($wikifp);
+ $yuchuli=array('";}}}}}}','**','*');
+ $chulihou=array('',' ·','·');
+ $wikiLine=str_replace($yuchuli,$chulihou,$wikiLines);
+ if(substr($wikiLine,0,2)=='a:') {
+ if(strpos($wikiLine,'==')!== false){
+ $wikititle=mb_strstr($wikiLine,'==',false);
+ wikitransform($wikititle);
+ }
+ }else { wikitransform($wikiLine);}
+}
+?>
+
\ No newline at end of file