Merge branch 'master' into sharing
This commit is contained in:
commit
467778d66f
|
@ -0,0 +1,4 @@
|
|||
ErrorDocument 404 //owncloud/templates/404.php
|
||||
php_value upload_max_filesize 20M
|
||||
php_value post_max_size 20M
|
||||
SetEnv htaccessWorking true
|
|
@ -0,0 +1,6 @@
|
|||
<?php
|
||||
|
||||
OC_UTIL::addScript( 'files_imageviewer', 'lightbox' );
|
||||
OC_UTIL::addStyle( 'files_imageviewer', 'lightbox' );
|
||||
|
||||
?>
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0"?>
|
||||
<info>
|
||||
<id>files_imageview</id>
|
||||
<name>Imageviewer</name>
|
||||
<description>Simple image viewer for owncloud</description>
|
||||
<version>1.0</version>
|
||||
<licence>AGPL</licence>
|
||||
<author>Robin Appelman</author>
|
||||
<require>2</require>
|
||||
</info>
|
|
@ -0,0 +1,23 @@
|
|||
#lightbox_overlay{
|
||||
position:fixed;
|
||||
display:none;
|
||||
height:100%;
|
||||
width:100%;
|
||||
top:0px;
|
||||
left:0px;
|
||||
opacity:0.5;
|
||||
filter: alpha(opacity = 50);
|
||||
background-color:black;
|
||||
z-index:9999;
|
||||
}
|
||||
|
||||
#lightbox{
|
||||
position:fixed;
|
||||
display:none;
|
||||
max-height:90%;
|
||||
max-width:90%;
|
||||
top:10px;
|
||||
margin-left:auto;
|
||||
margin-right:auto;
|
||||
z-index:9999;
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
|
||||
var lightBoxShown=false;
|
||||
$(document).ready(function() {
|
||||
if(typeof FileActions!=='undefined'){
|
||||
images={};//image cache
|
||||
var overlay=$('<div id="lightbox_overlay"/>');
|
||||
$( 'body' ).append(overlay);
|
||||
var container=$('<div id="lightbox"/>');
|
||||
$( 'body' ).append(container);
|
||||
FileActions.register('image','View',function(filename){
|
||||
var location='ajax/download.php?files='+filename+'&dir='+$('#dir').val();
|
||||
overlay.show();
|
||||
if(!images[location]){
|
||||
var img = new Image();
|
||||
img.onload = function(){
|
||||
images[location]=img;
|
||||
showLightbox(container,img);
|
||||
}
|
||||
img.src = location;
|
||||
}else{
|
||||
showLightbox(container,images[location]);
|
||||
}
|
||||
});
|
||||
$( 'body' ).click(hideLightbox);
|
||||
FileActions.setDefault('image','View');
|
||||
}
|
||||
});
|
||||
|
||||
function showLightbox(container,img){
|
||||
var maxWidth = $( window ).width() - 50;
|
||||
var maxHeight = $( window ).height() - 50;
|
||||
if( img.width > maxWidth || img.height > maxHeight ) { // One of these is larger than the window
|
||||
var ratio = img.width / img.height;
|
||||
if( img.height >= maxHeight ) {
|
||||
img.height = maxHeight;
|
||||
img.width = maxHeight * ratio;
|
||||
} else {
|
||||
img.width = maxWidth;
|
||||
img.height = maxWidth * ratio;
|
||||
}
|
||||
}
|
||||
container.empty();
|
||||
container.append(img);
|
||||
container.css('top',Math.round( ($( window ).height() - img.height)/2));
|
||||
container.css('left',Math.round( ($( window ).width() - img.width)/2));
|
||||
$('#lightbox').show();
|
||||
setTimeout(function(){
|
||||
lightBoxShown=true;
|
||||
},100);
|
||||
}
|
||||
|
||||
function hideLightbox(){
|
||||
if(lightBoxShown){
|
||||
$('#lightbox_overlay').hide();
|
||||
$('#lightbox').hide();
|
||||
lightBoxShown=false;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
<?php
|
||||
session_start();
|
||||
$_SESSION['timezone'] = $_GET['time'];
|
||||
?>
|
|
@ -21,7 +21,7 @@ if(!empty($dir)) $dir .= '/';
|
|||
$target='/' . stripslashes($dir) . $fileName;
|
||||
if(strpos($dir,'..') === false){
|
||||
if(OC_FILESYSTEM::fromUploadedFile($source,$target)){
|
||||
echo json_encode(array( "status" => "success"));
|
||||
echo json_encode(array( "status" => "success", 'mime'=>OC_FILESYSTEM::getMimeType($target),'size'=>OC_FILESYSTEM::filesize($target)));
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
{
|
||||
display: none;
|
||||
position: absolute;
|
||||
right:0px;
|
||||
background-color: #EEE;
|
||||
}
|
||||
|
||||
|
@ -23,24 +24,44 @@
|
|||
display: inline;
|
||||
}
|
||||
|
||||
#fileSelector, #file_upload_cancel, #file_newfolder_submit {
|
||||
#fileSelector, #file_upload_submit, #file_newfolder_submit {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#file_upload_start, #file_newfolder_name {
|
||||
#file_upload_filename, #file_newfolder_name {
|
||||
background-repeat: no-repeat;
|
||||
background-position: 0.5em 0;
|
||||
padding-left: 2em;
|
||||
}
|
||||
|
||||
#file_upload_start {background-image:url(../../img/mimetypes/file.png);}
|
||||
#file_upload_filename {
|
||||
background-image:url(../../img/mimetypes/file.png);
|
||||
}
|
||||
#file_upload_start {opacity:0;filter: alpha(opacity = 0);}
|
||||
|
||||
#file_newfolder_name {
|
||||
background-image:url(../../img/places/folder.png); font-weight: bold;
|
||||
width: 14em;
|
||||
}
|
||||
|
||||
#file_newfolder_submit {
|
||||
#file_upload_start, #file_upload_filename{
|
||||
position:absolute;
|
||||
top:0px;
|
||||
left:0px;
|
||||
width:30ex;
|
||||
font-size: 0.9em;
|
||||
}
|
||||
|
||||
#file_upload_wrapper{
|
||||
position:relative;
|
||||
top:-1.2em;
|
||||
left:-2em;
|
||||
display: -moz-inline-box; /* fallback for older firefox versions*/
|
||||
display: inline-block;
|
||||
width:30ex;
|
||||
}
|
||||
|
||||
#file_newfolder_submit, #file_upload_submit {
|
||||
width: 3em;
|
||||
}
|
||||
|
||||
|
@ -84,3 +105,10 @@ table td.filename a
|
|||
text-decoration: none;
|
||||
}
|
||||
|
||||
.dropArrow{
|
||||
height:16px;
|
||||
width:16px;
|
||||
display: -moz-inline-box; /* fallback for older firefox versions*/
|
||||
display: inline-block;
|
||||
background-image:url('../../img/drop-arrow.png');
|
||||
}
|
|
@ -35,6 +35,11 @@ if( !OC_USER::isLoggedIn()){
|
|||
// Load the files we need
|
||||
OC_UTIL::addStyle( "files", "files" );
|
||||
OC_UTIL::addScript( "files", "files" );
|
||||
OC_UTIL::addScript( 'files', 'filelist' );
|
||||
OC_UTIL::addScript( 'files', 'fileactions' );
|
||||
if(!isset($_SESSION['timezone'])){
|
||||
OC_UTIL::addScript( 'files', 'timezone' );
|
||||
}
|
||||
OC_APP::setActiveNavigationEntry( "files_index" );
|
||||
// Load the files
|
||||
$dir = isset( $_GET['dir'] ) ? $_GET['dir'] : '';
|
||||
|
|
|
@ -0,0 +1,101 @@
|
|||
FileActions={
|
||||
actions:{},
|
||||
defaults:{},
|
||||
register:function(mime,name,action){
|
||||
if(!FileActions.actions[mime]){
|
||||
FileActions.actions[mime]={};
|
||||
}
|
||||
FileActions.actions[mime][name]=action;
|
||||
},
|
||||
setDefault:function(mime,name){
|
||||
FileActions.defaults[mime]=FileActions.actions[mime][name];
|
||||
},
|
||||
get:function(mime,type){
|
||||
var actions={};
|
||||
if(FileActions.actions.all){
|
||||
actions=$.extend( actions, FileActions.actions.all )
|
||||
}
|
||||
if(mime){
|
||||
if(FileActions.actions[mime]){
|
||||
actions=$.extend( actions, FileActions.actions[mime] )
|
||||
}
|
||||
var mimePart=mime.substr(0,mime.indexOf('/'));
|
||||
if(FileActions.actions[mimePart]){
|
||||
actions=$.extend( actions, FileActions.actions[mimePart] )
|
||||
}
|
||||
}
|
||||
if(type){//type is 'dir' or 'file'
|
||||
if(FileActions.actions[type]){
|
||||
actions=$.extend( actions, FileActions.actions[type] )
|
||||
}
|
||||
}
|
||||
return actions;
|
||||
},
|
||||
getDefault:function(mime,type){
|
||||
if(mime){
|
||||
var mimePart=mime.substr(0,mime.indexOf('/'));
|
||||
}
|
||||
if(mime && FileActions.defaults[mime]){
|
||||
return FileActions.defaults[mime];
|
||||
}else if(mime && FileActions.defaults[mimePart]){
|
||||
return FileActions.defaults[mimePart];
|
||||
}else if(type && FileActions.defaults[type]){
|
||||
return FileActions.defaults[type];
|
||||
}else{
|
||||
return FileActions.defaults.all;
|
||||
}
|
||||
},
|
||||
display:function(parent){
|
||||
$('#file_menu ul').empty();
|
||||
parent.append($('#file_menu'));
|
||||
var actions=FileActions.get(FileActions.getCurrentMimeType(),FileActions.getCurrentType());
|
||||
for(name in actions){
|
||||
var html='<li><a href="" alt="'+name+'">'+name+'</a></li>';
|
||||
var element=$(html);
|
||||
element.data('action',name);
|
||||
element.click(function(event){
|
||||
event.preventDefault();
|
||||
$('#file_menu').slideToggle(250);
|
||||
var action=actions[$(this).data('action')];
|
||||
$('#file_menu ul').empty();
|
||||
action(FileActions.getCurrentFile());
|
||||
});
|
||||
$('#file_menu>ul').append(element);
|
||||
}
|
||||
$('#file_menu').slideToggle(250);
|
||||
return false;
|
||||
},
|
||||
getCurrentFile:function(){
|
||||
return $('#file_menu').parents('tr:first').attr('data-file');
|
||||
},
|
||||
getCurrentMimeType:function(){
|
||||
return $('#file_menu').parents('tr:first').attr('data-mime');
|
||||
},
|
||||
getCurrentType:function(){
|
||||
return $('#file_menu').parents('tr:first').attr('data-type');
|
||||
}
|
||||
}
|
||||
|
||||
FileActions.register('all','Download',function(filename){
|
||||
window.location='ajax/download.php?files='+filename+'&dir='+$('#dir').val();
|
||||
});
|
||||
|
||||
FileActions.register('all','Delete',function(filename){
|
||||
$.ajax({
|
||||
url: 'ajax/delete.php',
|
||||
data: "dir="+$('#dir').val()+"&file="+filename,
|
||||
complete: function(data){
|
||||
boolOperationFinished(data, function(){
|
||||
FileList.remove(filename);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
FileActions.setDefault('all','Download');
|
||||
|
||||
FileActions.register('dir','Open',function(filename){
|
||||
window.location='index.php?dir='+$('#dir').val()+'/'+filename;
|
||||
});
|
||||
|
||||
FileActions.setDefault('dir','Open');
|
|
@ -0,0 +1,54 @@
|
|||
FileList={
|
||||
update:function(fileListHtml) {
|
||||
$('#fileList').empty().html(fileListHtml);
|
||||
},
|
||||
addFile:function(name,size,lastModified){
|
||||
var html='<tr data-file="'+name+'" data-type="file">';
|
||||
html+='<td class="selection"><input type="checkbox" /></td>';
|
||||
html+='<td class="filename"><a style="background-image:url(img/file.png)" href="download.php?file='+$('#dir').val()+'/'+name+'">'+name+'</a></td>';
|
||||
html+='<td class="filesize">'+size+'</td>';
|
||||
html+='<td class="date">'+lastModified+'</td>';
|
||||
html+='<td class="fileaction"><a href="" title="+" class="dropArrow"></a></td>';
|
||||
html+='</tr>';
|
||||
FileList.insertElement(name,'file',$(html));
|
||||
},
|
||||
addDir:function(name,size,lastModified){
|
||||
var html='<tr data-file="'+name+'" data-type="dir">';
|
||||
html+='<td class="selection"><input type="checkbox" /></td>';
|
||||
html+='<td class="filename"><a style="background-image:url(img/folder.png)" href="index.php?dir='+$('#dir').val()+'/'+name+'">'+name+'</a></td>';
|
||||
html+='<td class="filesize">'+size+'</td>';
|
||||
html+='<td class="date">'+lastModified+'</td>';
|
||||
html+='<td class="fileaction"><a href="" title="+" class="dropArrow"></a></td>';
|
||||
html+='</tr>';
|
||||
|
||||
FileList.insertElement(name,'dir',$(html));
|
||||
},
|
||||
refresh:function(data) {
|
||||
result = jQuery.parseJSON(data.responseText);
|
||||
if(typeof(result.data.breadcrumb) != 'undefined'){
|
||||
updateBreadcrumb(result.data.breadcrumb);
|
||||
}
|
||||
FileList.update(result.data.files);
|
||||
resetFileActionPanel();
|
||||
},
|
||||
remove:function(name){
|
||||
$('tr[data-file="'+name+'"]').remove();
|
||||
},
|
||||
insertElement:function(name,type,element){
|
||||
//find the correct spot to insert the file or folder
|
||||
var fileElements=$('tr[data-file][data-type="'+type+'"]');
|
||||
var pos;
|
||||
if(name.localeCompare($(fileElements[0]).attr('data-file'))<0){
|
||||
pos=0;
|
||||
}else if(name.localeCompare($(fileElements[fileElements.length-1]).attr('data-file'))>0){
|
||||
pos=fileElements.length-1;
|
||||
}else{
|
||||
for(var pos=1;pos<fileElements.length-1;pos++){
|
||||
if(name.localeCompare($(fileElements[pos]).attr('data-file'))>0 && name.localeCompare($(fileElements[pos+1]).attr('data-file'))<0){
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
$(fileElements[pos]).after(element);
|
||||
}
|
||||
}
|
|
@ -1,7 +1,5 @@
|
|||
$(document).ready(function() {
|
||||
$('#file_action_panel').attr('activeAction', false);
|
||||
$('#file_upload_start').attr('mode', 'menu');
|
||||
$('#file_upload_form').attr('uploading', false);
|
||||
$('#file_newfolder_name').css('width', '14em');
|
||||
$('#file_newfolder_submit').css('width', '3em');
|
||||
|
||||
|
@ -15,26 +13,26 @@ $(document).ready(function() {
|
|||
}
|
||||
);
|
||||
|
||||
// Sets logs table behaviour :
|
||||
$('.logs tr').hover(
|
||||
function() {
|
||||
$(this).addClass('mouseOver');
|
||||
},
|
||||
function() {
|
||||
$(this).removeClass('mouseOver');
|
||||
}
|
||||
);
|
||||
|
||||
// Sets the file-action buttons behaviour :
|
||||
$('td.fileaction a').click(function() {
|
||||
$(this).parent().append($('#file_menu'));
|
||||
$('#file_menu').slideToggle(250);
|
||||
return false;
|
||||
$('td.fileaction a').live('click',function(event) {
|
||||
event.preventDefault();
|
||||
FileActions.display($(this).parent());
|
||||
});
|
||||
|
||||
// Sets the file link behaviour :
|
||||
$('td.filename a').live('click',function(event) {
|
||||
event.preventDefault();
|
||||
var filename=$(this).text();
|
||||
var mime=$(this).parent().parent().attr('data-mime');
|
||||
var type=$(this).parent().parent().attr('data-type');
|
||||
var action=FileActions.getDefault(mime,type);
|
||||
if(action){
|
||||
action(filename);
|
||||
}
|
||||
});
|
||||
|
||||
// Sets the select_all checkbox behaviour :
|
||||
$('#select_all').click(function() {
|
||||
|
||||
if($(this).attr('checked'))
|
||||
// Check all
|
||||
$('td.selection input:checkbox').attr('checked', true);
|
||||
|
@ -43,7 +41,7 @@ $(document).ready(function() {
|
|||
$('td.selection input:checkbox').attr('checked', false);
|
||||
});
|
||||
|
||||
$('td.selection input:checkbox').click(function() {
|
||||
$('td.selection input:checkbox').live('click',function() {
|
||||
if(!$(this).attr('checked')){
|
||||
$('#select_all').attr('checked',false);
|
||||
}else{
|
||||
|
@ -53,80 +51,16 @@ $(document).ready(function() {
|
|||
}
|
||||
});
|
||||
|
||||
// Download current file
|
||||
$('#download_single_file').click(function() {
|
||||
filename = $('#file_menu').parents('tr:first').find('.filename:first').children('a:first').text();
|
||||
window.location='ajax/download.php?files='+filename+'&dir='+$('#dir').val();
|
||||
$('#file_menu').slideToggle(250);
|
||||
return false;
|
||||
});
|
||||
|
||||
// Delete current file
|
||||
$('#delete_single_file').click(function() {
|
||||
filename = $('#file_menu').parents('tr:first').find('.filename:first').children('a:first').text();
|
||||
$.ajax({
|
||||
url: 'ajax/delete.php',
|
||||
data: "dir="+$('#dir').val()+"&file="+filename,
|
||||
complete: function(data){
|
||||
boolOperationFinished(data, true, $('#file_menu').parents('tr:first'));
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
$('#file_upload_start').click(function() {
|
||||
if($('#file_upload_start').attr('mode') == 'menu') {
|
||||
$('#file_upload_form')[0].reset();
|
||||
$('#fileSelector').change(function() {
|
||||
//Chromium prepends C:\fakepath....
|
||||
bspos = $('#fileSelector').val().lastIndexOf('\\')+1;
|
||||
filename = $('#fileSelector').val().substr(bspos);
|
||||
|
||||
$('#file_upload_start').val('Upload ' + filename);
|
||||
$('#fileSelector').hide();
|
||||
$('#file_upload_cancel').slideDown(250);
|
||||
$('#file_upload_start').attr('mode', 'action');
|
||||
});
|
||||
$('#file_upload_start').focusin(function() {
|
||||
if($('#fileSelector').val() == '') {
|
||||
$('#fileSelector').hide();
|
||||
$('#file_upload_start').unbind('focusin');
|
||||
}
|
||||
});
|
||||
$('#fileSelector').focusout(function() {
|
||||
if($('#fileSelector').val() == '') {
|
||||
$('#fileSelector').hide();
|
||||
}
|
||||
});
|
||||
$('#fileSelector').show(); //needed for Chromium compatibility
|
||||
//rekonq does not call change-event, when click() is executed by script
|
||||
if(navigator.userAgent.indexOf('rekonq') == -1){
|
||||
$('#fileSelector').click();
|
||||
}
|
||||
$('#fileSelector').focus();
|
||||
} else if($('#file_upload_start').attr('mode') == 'action') {
|
||||
$('#file_upload_cancel').slideUp(250);
|
||||
$('#file_upload_form').attr('uploading', true);
|
||||
$('#file_upload_target').load(uploadFinished);
|
||||
}
|
||||
});
|
||||
|
||||
$('#file_upload_cancel').click(function() {
|
||||
$('#file_upload_form')[0].reset();
|
||||
$('#file_upload_start').val('Upload ' + $('.max_human_file_size:first').val());
|
||||
$('#file_upload_start').attr('mode', 'menu');
|
||||
$('#file_upload_cancel').hide();
|
||||
// $('#file_action_panel').attr('activeAction', 'false');
|
||||
// $('#file_upload_form').hide();
|
||||
// $('p.actions a.upload:first').show();
|
||||
});
|
||||
|
||||
$('#file_new_dir_submit').click(function() {
|
||||
$('#file_newfolder_submit').click(function() {
|
||||
$.ajax({
|
||||
url: 'ajax/newfolder.php',
|
||||
data: "dir="+$('#dir').val()+"&foldername="+$('#file_new_dir_name').val(),
|
||||
complete: function(data){boolOperationFinished(data, false);}
|
||||
data: "dir="+$('#dir').val()+"&foldername="+$('#file_newfolder_name').val(),
|
||||
complete: function(data){boolOperationFinished(data, function(){
|
||||
var date=formatDate(new Date());
|
||||
FileList.addDir($('#file_newfolder_name').val(),'0 B',date)
|
||||
});}
|
||||
});
|
||||
$('#file_newfolder_submit').fadeOut(250).trigger('vanish');
|
||||
});
|
||||
|
||||
$('#file_newfolder_name').click(function(){
|
||||
|
@ -149,60 +83,10 @@ $(document).ready(function() {
|
|||
}
|
||||
});
|
||||
|
||||
$('#file_newfolder_submit').click(function() {
|
||||
if($('#file_newfolder_name').val() != '') {
|
||||
$.ajax({
|
||||
url: 'ajax/newfolder.php',
|
||||
data: "dir="+$('#dir').val()+"&foldername="+$('#file_newfolder_name').val(),
|
||||
complete: function(data){
|
||||
boolOperationFinished(data, false);
|
||||
$('#file_newfolder_form')[0].reset();
|
||||
}
|
||||
});
|
||||
}
|
||||
$('#file_newfolder_submit').fadeOut(250).trigger('vanish');
|
||||
});
|
||||
|
||||
// $('.upload').click(function(){
|
||||
// if($('#file_action_panel').attr('activeAction') != 'upload') {
|
||||
// $('#file_action_panel').attr('activeAction', 'upload');
|
||||
// $('#fileSelector').replaceWith('<input type="file" name="file" id="fileSelector">');
|
||||
// $('#fileSelector').change(function() {
|
||||
// $('#file_upload_start').val('Upload ' + $('#fileSelector').val());
|
||||
// $('p.actions a.upload:first').after($('#file_upload_form'));
|
||||
// $('#file_upload_form').css('display', 'inline');
|
||||
// $('p.actions a.upload:first').hide();
|
||||
// $('#fileSelector').hide();
|
||||
// });
|
||||
// $('#file_action_panel form').slideUp(250);
|
||||
// // $('#file_upload_form').slideDown(250);
|
||||
// $('#fileSelector').click();
|
||||
// } else {
|
||||
// $('#file_action_panel').attr('activeAction', 'false');
|
||||
// $('#file_upload_form').slideUp(250);
|
||||
// }
|
||||
// return false;
|
||||
// });
|
||||
|
||||
|
||||
|
||||
// $('.new-dir').click(function(){
|
||||
// if($('#file_action_panel').attr('activeAction') != 'new-dir') {
|
||||
// $('#file_action_panel').attr('activeAction', 'new-dir');
|
||||
// $('#file_new_dir_name').val('');
|
||||
// $('#file_action_panel form').slideUp(250);
|
||||
// $('#file_newfolder_form').slideDown(250);
|
||||
// } else {
|
||||
// $('#file_newfolder_form').slideUp(250);
|
||||
// $('#file_action_panel').attr('activeAction', false);
|
||||
// }
|
||||
// return false;
|
||||
// });
|
||||
|
||||
$('.download').click(function(event) {
|
||||
$('.download').live('click',function(event) {
|
||||
var files='';
|
||||
$('td.selection input:checkbox:checked').parent().parent().children('.filename').each(function(i,element){
|
||||
files+=';'+$(element).text();
|
||||
$('td.selection input:checkbox:checked').parent().parent().each(function(i,element){
|
||||
files+=';'+$(element).attr('data-file');
|
||||
});
|
||||
files=files.substr(1);//remove leading ;
|
||||
|
||||
|
@ -213,10 +97,10 @@ $(document).ready(function() {
|
|||
return false;
|
||||
});
|
||||
|
||||
$('.delete').click(function(event) {
|
||||
$('.delete').live('click',function(event) {
|
||||
var files='';
|
||||
$('td.selection input:checkbox:checked').parent().parent().children('.filename').each(function(i,element){
|
||||
files+=';'+$(element).text();
|
||||
$('td.selection input:checkbox:checked').parent().parent().each(function(i,element){
|
||||
files+=';'+$(element).attr('data-file');
|
||||
});
|
||||
files=files.substr(1);//remove leading ;
|
||||
|
||||
|
@ -224,12 +108,47 @@ $(document).ready(function() {
|
|||
url: 'ajax/delete.php',
|
||||
data: "dir="+$('#dir').val()+"&files="+files,
|
||||
complete: function(data){
|
||||
boolOperationFinished(data, false);
|
||||
boolOperationFinished(data, function(){
|
||||
$('td.selection input:checkbox:checked').parent().parent().each(function(i,element){
|
||||
FileList.remove($(element).attr('data-file'));
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
$('#file_upload_start').change(function(){
|
||||
var filename=$(this).val();
|
||||
filename=filename.replace(/^.*[\/\\]/g, '');
|
||||
$('#file_upload_filename').val(filename);
|
||||
$('#file_upload_submit').show();
|
||||
})
|
||||
|
||||
$('#file_upload_submit').click(function(){
|
||||
var name=$('#file_upload_filename').val();
|
||||
if($('#file_upload_start')[0].files[0] && $('#file_upload_start')[0].files[0].size>0){
|
||||
var size=humanFileSize($('#file_upload_start')[0].files[0].size);
|
||||
}else{
|
||||
var size='Pending';
|
||||
}
|
||||
$('#file_upload_target').load(function(){
|
||||
var response=jQuery.parseJSON($('#file_upload_target').contents().find('body').text());
|
||||
//set mimetype and if needed filesize
|
||||
$('tr[data-file="'+name+'"]').attr('data-mime',response.mime);
|
||||
if(size=='Pending'){
|
||||
$('tr[data-file='+name+'] td.filesize').text(response.size);
|
||||
}
|
||||
});
|
||||
$('#file_upload_form').submit();
|
||||
var date=new Date();
|
||||
var uploadTime=formatDate(date);
|
||||
FileList.addFile(name,size,uploadTime);
|
||||
$('#file_upload_filename').val($('#file_upload_filename').data('upload_text'));
|
||||
});
|
||||
//save the original upload button text
|
||||
$('#file_upload_filename').data('upload_text',$('#file_upload_filename').val());
|
||||
});
|
||||
|
||||
var adjustNewFolderSize = function() {
|
||||
|
@ -251,74 +170,44 @@ function unsplitSize(stayingEl, vanishingEl) {
|
|||
$(vanishingEl).fadeOut(250);
|
||||
}
|
||||
|
||||
function uploadFinished() {
|
||||
result = $('#file_upload_target').contents().text();
|
||||
result = eval("(" + result + ");");
|
||||
$('#file_upload_target').load(function(){});
|
||||
if(result.status == "error") {
|
||||
if($('#file_upload_form').attr('uploading') == true) {
|
||||
alert('An error occcured, upload failed.\nError code: ' + result.data.error + '\nFilename: ' + result.data.file);
|
||||
}
|
||||
} else {
|
||||
dir = $('#dir').val();
|
||||
$.ajax({
|
||||
url: 'ajax/list.php',
|
||||
data: "dir="+dir,
|
||||
complete: function(data) {
|
||||
refreshContents(data);
|
||||
// $('#file_action_panel').prepend($('#file_upload_form'));
|
||||
// $('#file_upload_form').css('display', 'block').hide();
|
||||
// $('p.actions a.upload:first').show();
|
||||
$('#file_upload_start').val('Upload ' + $('.max_human_file_size:first').val());
|
||||
$('#file_upload_start').attr('mode', 'menu');
|
||||
}
|
||||
});
|
||||
}
|
||||
$('#file_upload_form').attr('uploading', false);
|
||||
}
|
||||
|
||||
function resetFileActionPanel() {
|
||||
$('#file_action_panel form').css({"display":"none"});
|
||||
$('#file_action_panel').attr('activeAction', false);
|
||||
}
|
||||
|
||||
function boolOperationFinished(data, single, el) {
|
||||
result = eval("("+data.responseText+");");
|
||||
function boolOperationFinished(data, callback) {
|
||||
result = jQuery.parseJSON(data.responseText);
|
||||
if(result.status == 'success'){
|
||||
if(single) {
|
||||
$('#file_menu').slideToggle(0);
|
||||
$('body').append($('#file_menu'));
|
||||
$(el).remove();
|
||||
} else {
|
||||
$.ajax({
|
||||
url: 'ajax/list.php',
|
||||
data: "dir="+$('#dir').val(),
|
||||
complete: refreshContents
|
||||
});
|
||||
}
|
||||
callback.call();
|
||||
} else {
|
||||
alert(result.data.message);
|
||||
}
|
||||
}
|
||||
|
||||
function refreshContents(data) {
|
||||
result = eval("("+data.responseText+");");
|
||||
if(typeof(result.data.breadcrumb) != 'undefined'){
|
||||
updateBreadcrumb(result.data.breadcrumb);
|
||||
}
|
||||
updateFileList(result.data.files);
|
||||
$('td.fileaction a').click(function() {
|
||||
$(this).parent().append($('#file_menu'));
|
||||
$('#file_menu').slideToggle(250);
|
||||
return false;
|
||||
});
|
||||
resetFileActionPanel();
|
||||
}
|
||||
|
||||
function updateBreadcrumb(breadcrumbHtml) {
|
||||
$('p.nav').empty().html(breadcrumbHtml);
|
||||
}
|
||||
|
||||
function updateFileList(fileListHtml) {
|
||||
$('#fileList').empty().html(fileListHtml);
|
||||
function humanFileSize(bytes){
|
||||
if( bytes < 1024 ){
|
||||
return bytes+' B';
|
||||
}
|
||||
bytes = Math.round(bytes / 1024, 1 );
|
||||
if( bytes < 1024 ){
|
||||
return bytes+' kB';
|
||||
}
|
||||
bytes = Math.round( bytes / 1024, 1 );
|
||||
if( bytes < 1024 ){
|
||||
return bytes+' MB';
|
||||
}
|
||||
|
||||
// Wow, heavy duty for owncloud
|
||||
bytes = Math.round( bytes / 1024, 1 );
|
||||
return bytes+' GB';
|
||||
}
|
||||
|
||||
function formatDate(date){
|
||||
var monthNames = [ "January", "February", "March", "April", "May", "June",
|
||||
"July", "August", "September", "October", "November", "December" ];
|
||||
return monthNames[date.getMonth()]+' '+date.getDate()+', '+date.getFullYear()+', '+((date.getHours()<10)?'0':'')+date.getHours()+':'+date.getMinutes();
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
//send the clients time zone to the server
|
||||
$(document).ready(function() {
|
||||
var visitortimezone = (-new Date().getTimezoneOffset()/60);
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "ajax/timezone.php",
|
||||
data: 'time='+ visitortimezone,
|
||||
success: function(){
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
});
|
|
@ -1,9 +1,23 @@
|
|||
<div class="controls">
|
||||
<div class="actions">
|
||||
<form id="file_upload_form" action="ajax/upload.php"
|
||||
method="post" enctype="multipart/form-data" target="file_upload_target"><input
|
||||
type="hidden" name="MAX_FILE_SIZE" value="<?php echo $_["uploadMaxFilesize"] ?>" id="max_upload"><input
|
||||
type="hidden" class="max_human_file_size" value="(max <?php echo $_["uploadMaxHumanFilesize"]; ?>)"><input type="hidden" name="dir" value="<?php echo $_["dir"] ?>" id="dir"><input class="prettybutton" type="submit" id="file_upload_start" value="Upload (max <?php echo $_["uploadMaxHumanFilesize"];?>)" /> <input class="prettybutton" type="button" id="file_upload_cancel" value="X" /><input type="file" name="file" id="fileSelector"><iframe id="file_upload_target" name="file_upload_target" src=""></iframe></form><form id="file_newfolder_form"><input type="text" class="prettybutton" name="file_newfolder_name" id="file_newfolder_name" value="New Folder" /> <input class="prettybutton" type="button" id="file_newfolder_submit" name="file_newfolder_submit" value="OK" /></form><a href="" title="" class="download">Download</a><a href="" title="" class="share">Share</a><a href="" title="" class="delete">Delete</a>
|
||||
<form id="file_upload_form" action="ajax/upload.php" method="post" enctype="multipart/form-data" target="file_upload_target">
|
||||
<input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $_["uploadMaxFilesize"] ?>" id="max_upload">
|
||||
<input type="hidden" class="max_human_file_size" value="(max <?php echo $_["uploadMaxHumanFilesize"]; ?>)">
|
||||
<input type="hidden" name="dir" value="<?php echo $_["dir"] ?>" id="dir">
|
||||
<div id='file_upload_wrapper'>
|
||||
<input class="prettybutton" id='file_upload_filename' value="Upload (max <?php echo $_["uploadMaxHumanFilesize"];?>)"/>
|
||||
<input class="prettybutton" type="file" id="file_upload_start" name='file'/>
|
||||
</div>
|
||||
<input class="prettybutton" type="button" id="file_upload_submit" name="file_upload_submit" value="OK" />
|
||||
<iframe id="file_upload_target" name="file_upload_target" src=""></iframe>
|
||||
</form>
|
||||
<form id="file_newfolder_form">
|
||||
<input type="text" class="prettybutton" name="file_newfolder_name" id="file_newfolder_name" value="New Folder" />
|
||||
<input class="prettybutton" type="button" id="file_newfolder_submit" name="file_newfolder_submit" value="OK" />
|
||||
</form>
|
||||
<a href="" title="" class="download">Download</a>
|
||||
<a href="" title="" class="share">Share</a>
|
||||
<a href="" title="" class="delete">Delete</a>
|
||||
</div>
|
||||
<div id="file_action_panel">
|
||||
</div>
|
||||
|
@ -30,8 +44,5 @@ type="hidden" class="max_human_file_size" value="(max <?php echo $_["uploadMaxHu
|
|||
|
||||
<div id="file_menu">
|
||||
<ul>
|
||||
<li><a href="" title="" id="download_single_file">Download</a></li>
|
||||
<li><a href="" title="">Share</a></li>
|
||||
<li><a href="" title="" id="delete_single_file">Delete</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?php foreach($_["files"] as $file): ?>
|
||||
<tr>
|
||||
<tr data-file='<?php echo $file['name'];?>' data-type='<?php echo ($file["type"] == "dir")?'dir':'file'?>' data-mime='<?php echo $file["mime"]?>'>
|
||||
<td class="selection"><input type="checkbox" /></td>
|
||||
<td class="filename"><a style="background-image:url(<?php if($file["type"] == "dir") echo mimetype_icon("dir"); else echo mimetype_icon($file["mime"]); ?>)" href="<?php if($file["type"] == "dir") echo link_to("files", "index.php?dir=".$file["directory"]."/".$file["name"]); else echo link_to("files", "download.php?file=".$file["directory"]."/".$file["name"]); ?>" title=""><?php echo htmlspecialchars($file["name"]); ?></a></td>
|
||||
<td class="filesize"><?php echo human_file_size($file["size"]); ?></td>
|
||||
|
|
|
@ -236,6 +236,13 @@ class OC_UTIL {
|
|||
* @param bool dateOnly option to ommit time from the result
|
||||
*/
|
||||
public static function formatDate( $timestamp,$dateOnly=false){
|
||||
if(isset($_SESSION['timezone'])){//adjust to clients timezone if we know it
|
||||
$systemTimeZone = intval(exec('date +%z'));
|
||||
$systemTimeZone=(round($systemTimeZone/100,0)*60)+($systemTimeZone%100);
|
||||
$clientTimeZone=$_SESSION['timezone']*60;
|
||||
$offset=$clientTimeZone-$systemTimeZone;
|
||||
$timestamp=$timestamp+$offset*60;
|
||||
}
|
||||
$timeformat=$dateOnly?'F j, Y':'F j, Y, H:i';
|
||||
return date($timeformat,$timestamp);
|
||||
}
|
||||
|
|
|
@ -386,7 +386,7 @@ class OC_FILESTORAGE_LOCAL extends OC_FILESTORAGE{
|
|||
}
|
||||
}
|
||||
if($return=rmdir($dir)){
|
||||
$this->clearFolderSizeCache($path);
|
||||
$this->clearFolderSizeCache($dir);
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue