metadata filelist

This commit is contained in:
4ngle 2010-03-10 06:49:31 +00:00
parent 5cd73a7480
commit 22be65d8d9
3 changed files with 141 additions and 3 deletions

View File

@ -52,7 +52,7 @@ ul{list-style-type: none;}
img{border:0px;} img{border:0px;}
.commentform{border:0;margin:0;padding:0;} .commentform{border:0;margin:0;padding:0;}
.submit-group{padding-left:300px;} .submit-group{padding-left:300px;}
.element-group {padding-left:100px;border:0;margin:0;} .element-group {padding-left:100px;border:0;margin:0;}
.zend_form dt{float:left;margin:0;text-align:center;} .zend_form dt{float:left;margin:0;text-align:center;}
#links dd {padding-bottom:5px;margin-left:5px;margin-top:-5px;} #links dd {padding-bottom:5px;margin-left:5px;margin-top:-5px;}
.note{font-size:10px;color:gray;} .note{font-size:10px;color:gray;}
@ -61,3 +61,33 @@ img{border:0px;}
#category fieldset {border-bottom:0;} #category fieldset {border-bottom:0;}
.clear-div{height:0px;overflow:hidden;} .clear-div{height:0px;overflow:hidden;}
#map{height:300px;width:400px;border:1px;float:right;} #map{height:300px;width:400px;border:1px;float:right;}
#window-outter {
background:#3d3d3d none repeat scroll 0 0;
border:1px solid #DDDDDD;
display:block;
position:absolute;
width:960px;
top:0;
}
#window-inner {
top:-3px;
left:-3px;
background:#FFFFFF none repeat scroll 0 0;
border:1px solid #555555;
font-weight:normal;
padding:2px;
position:relative;
}
#window-closer-container {
top:2px;
right:2px;
position:relative;
float:right;
}
#window-content-container{
margin:10px;
padding:0;
}
#window-loading {
text-align:center
}

View File

@ -8,8 +8,11 @@ set_include_path('.' . PATH_SEPARATOR . '../include/'
. PATH_SEPARATOR . '../application/models' . PATH_SEPARATOR . '../application/models'
. PATH_SEPARATOR . '../application/default/controllers' . PATH_SEPARATOR . '../application/default/controllers'
. PATH_SEPARATOR . get_include_path()); . PATH_SEPARATOR . get_include_path());
include "Zend/Loader.php"; //include "Zend/Loader.php";
Zend_Loader::registerAutoload(); //Zend_Loader::registerAutoload();
require_once 'Zend/Loader/Autoloader.php';
$loader = Zend_Loader_Autoloader::getInstance();
$loader->setFallbackAutoloader(true);
// load configuration // load configuration
$config = new Zend_Config_Ini('../application/config.ini', 'general'); $config = new Zend_Config_Ini('../application/config.ini', 'general');
@ -24,6 +27,8 @@ $auth->setStorage(new Zend_Auth_Storage_Session('westdc'));
$db = Zend_Db::factory($config->db); $db = Zend_Db::factory($config->db);
Zend_Db_Table::setDefaultAdapter($db); Zend_Db_Table::setDefaultAdapter($db);
$registry->set('db',$db); $registry->set('db',$db);
$filedb = Zend_Db::factory($config->filelist);
$registry->set('filelist', $filedb);
// setup controller // setup controller
$frontController = Zend_Controller_Front::getInstance(); $frontController = Zend_Controller_Front::getInstance();

103
htdocs/js/window.js Normal file
View File

@ -0,0 +1,103 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
var Window = Class.create();
Window.prototype = {
initialize:function(){
$('show-list').observe('click', (function(event) {
var screenSizes = this.getPageSize();
var width = (screenSizes[0]-960)/2;
$('window-outter').setStyle({
right: width + 'px'
}).show();
var target = event.element();
if(target){
this.getFiles(target.rel);
}
}).bind(this));
$('window-closer').observe('click',function(){
$('window-outter').hide();
});
},
getFiles: function(uuid){
var url = '/filelist/uuid/'+uuid;
new Ajax.Request(url, {
method: 'get',
onSuccess: function(transport) {
var json = transport.responseText.evalJSON(true);
var liTemplate = new Template("<li>#{file_name}</li>");
var lis = "";
if(json.length == 0){
lis = "<li>暂无数据</li>"
} else {
json.each(function(file){
lis += liTemplate.evaluate(file);
});
}
$('file-list').update(lis);
},
onComplete:function(){
$('window-loading').hide();
},
onException:function(){
alert('Something went wrong...');
},
onFailure: function(){
alert('Something went wrong...');
}
});
},
getPageSize: function() {
var xScroll, yScroll;
if (window.innerHeight && window.scrollMaxY) {
xScroll = window.innerWidth + window.scrollMaxX;
yScroll = window.innerHeight + window.scrollMaxY;
} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
xScroll = document.body.scrollWidth;
yScroll = document.body.scrollHeight;
} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
xScroll = document.body.offsetWidth;
yScroll = document.body.offsetHeight;
}
var windowWidth, windowHeight;
if (self.innerHeight) { // all except Explorer
if(document.documentElement.clientWidth){
windowWidth = document.documentElement.clientWidth;
} else {
windowWidth = self.innerWidth;
}
windowHeight = self.innerHeight;
} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
windowWidth = document.documentElement.clientWidth;
windowHeight = document.documentElement.clientHeight;
} else if (document.body) { // other Explorers
windowWidth = document.body.clientWidth;
windowHeight = document.body.clientHeight;
}
// for small pages with total height less then height of the viewport
if(yScroll < windowHeight){
pageHeight = windowHeight;
} else {
pageHeight = yScroll;
}
// for small pages with total width less then width of the viewport
if(xScroll < windowWidth){
pageWidth = xScroll;
} else {
pageWidth = windowWidth;
}
return [pageWidth,pageHeight];
}
}
document.observe('dom:loaded', function () {
new Window();
});