Merge branch 'master' into sharing

This commit is contained in:
Michael Gapczynski 2011-07-07 17:00:20 -04:00
commit a51628187a
9 changed files with 100 additions and 23 deletions

View file

@ -211,6 +211,7 @@ form.searchbox { display:inline; position:fixed; top:2em; right:10em; margin:0;
#plugins a.active, #plugins a:hover, #plugins a:focus, #plugins a.selected { background-color:#ccc; border-top:1px solid #ccc; border-bottom:1px solid #ccc; color:#000; outline:0; }
#plugins a:active { outline:0; }
#plugins .subentry { background-color:#ddd; border-top:1px solid #aaa; border-bottom:1px solid #ccc; color:#000; outline:0; }
#plugins .subentry.active { background-color:#bbb; border-top:1px solid #aaa; border-bottom:1px solid #ccc; color:#000; outline:0; }
/* CONTENT ------------------------------------------------------------------ */
#content { margin:7em 0 0 16em; }
@ -224,7 +225,7 @@ table td.date { width:11em; }
table td.selection, table th.selection, table td.fileaction { width:2em; text-align:center; }
table td.filename a { display:block; background-image:url('../img/file.png'); text-decoration:none; }
table td.filename a, table td.login, table td.logout, table td.download, table td.upload, table td.create, table td.delete { padding:0.5em 0.5em 0.5em 3em; background-position:1em center; background-repeat:no-repeat; }
table td.filename a:hover, table td.filename a:focus { text-decoration:underline; outline:0; }
table td.filename a:hover, table td.filename a:focus { outline:0; }
table td.filename a:active { outline:0; }
table em { font-weight:bold; }
table td.filename a.folder-up { background-image:url('../img/back.png'); font-style:italic; }
@ -248,9 +249,9 @@ table td.delete { background-image:url('../img/delete.png'); }
#fileList tr:hover input[type=checkbox] { display:inline; }
/* NAVIGATION BAR */
p.nav { margin:1em 0 0 2em; padding:0.8em; line-height:16px; font-weight:bold; }
p.nav a { padding:0.5em 1.5em 0.5em 0.5em; background-position:right center; background-repeat:no-repeat; background-image:url('../img/arrow.png'); text-decoration:none; }
p.nav a img { height:16px; vertical-align:text-top; }
span.nav { margin:1em 0 0 2em; padding:0.8em; line-height:16px; font-weight:bold; display:block}
span.nav a { padding:0.5em 1.5em 0.5em 0.5em; background-position:right center; background-repeat:no-repeat; background-image:url('../img/arrow.png'); text-decoration:none; }
span.nav a img { height:16px; vertical-align:text-top; }
/* ACTIONS BAR */
p.actions, div.actions { padding:0; }

View file

@ -43,7 +43,7 @@
<li><a style="background-image:url(<?php echo $entry['icon']; ?>)" href="<?php echo $entry['href']; ?>" title="" <?php if( $entry["active"] ): ?> class="active"<?php endif; ?>><?php echo $entry['name'] ?></a></li>
<?php if( sizeof( $entry["subnavigation"] )): ?>
<?php foreach($entry["subnavigation"] as $subentry):?>
<li><a href="<?php echo $subentry['href']; ?>" title="" <?php if( $subentry["active"] ): ?> class="active"<?php endif; ?>><?php echo $subentry['name'] ?></a></li>
<li><a href="<?php echo $subentry['href']; ?>" title="" <?php if( $subentry['active'] ): ?>class="active"<?php endif; ?>><?php echo $subentry['name'] ?></a></li>
<?php endforeach; ?>
<?php endif; ?>
<?php endforeach; ?>
@ -52,7 +52,7 @@
<li><a style="background-image:url(<?php echo $entry['icon']; ?>)" href="<?php echo $entry['href']; ?>" title="" <?php if( $entry["active"] ): ?> class="active"<?php endif; ?>><?php echo $entry['name'] ?></a></li>
<?php if( sizeof( $entry["subnavigation"] )): ?>
<?php foreach($entry["subnavigation"] as $subentry):?>
<li><a class="subentry" href="<?php echo $subentry['href']; ?>" title=""><?php echo $subentry['name'] ?></a></li>
<li><a class="subentry<?php if( $subentry['active'] ): ?> active<?php endif; ?>" href="<?php echo $subentry['href']; ?>" title=""><?php echo $subentry['name'] ?></a></li>
<?php endforeach; ?>
<?php endif; ?>
<?php endforeach; ?>

View file

@ -75,7 +75,7 @@ table {
width: 90%;
}
tbody tr:hover, tbody tr:active { background-color:#eee; }
tbody tr:hover, tbody tr:active, tbody tr.selected { background-color:#eee; }
tbody a { color:#000; }
table td.filesize, table td.date
@ -110,3 +110,11 @@ table td.filename a
display: inline-block;
background-image:url('../img/drop-arrow.png');
}
span.extention{
color:#999;
}
div.crumb{
float:left;
}

View file

@ -47,6 +47,10 @@ $dir = isset( $_GET['dir'] ) ? $_GET['dir'] : '';
$files = array();
foreach( OC_FILES::getdirectorycontent( $dir ) as $i ){
$i["date"] = OC_UTIL::formatDate($i["mtime"] );
if($i['type']=='file'){
$i['extention']=substr($i['name'],strrpos($i['name'],'.'));
$i['basename']=substr($i['name'],0,strrpos($i['name'],'.'));
}
if($i['directory']=='/'){
$i['directory']='';
}

View file

@ -11,6 +11,7 @@ FileList={
html+='<td class="fileaction"><a href="" title="+" class="dropArrow"></a></td>';
html+='</tr>';
FileList.insertElement(name,'file',$(html));
$('tr[data-file="'+name+'"] td.filename').draggable(dragOptions);
},
addDir:function(name,size,lastModified){
var html='<tr data-file="'+name+'" data-type="dir">';
@ -22,6 +23,8 @@ FileList={
html+='</tr>';
FileList.insertElement(name,'dir',$(html));
$('tr[data-file="'+name+'"] td.filename').draggable(dragOptions);
$('tr[data-file="'+name+'"] td.filename').droppable(folderDropOptions);
},
refresh:function(data) {
result = jQuery.parseJSON(data.responseText);
@ -32,6 +35,7 @@ FileList={
resetFileActionPanel();
},
remove:function(name){
$('tr[data-file="'+name+'"] td.filename').draggable('destroy');
$('tr[data-file="'+name+'"]').remove();
},
insertElement:function(name,type,element){

View file

@ -1,16 +1,35 @@
$(document).ready(function() {
$('#file_action_panel').attr('activeAction', false);
// Sets browser table behaviour :
$('.browser tr').hover(
function() {
$(this).addClass('mouseOver');
//drag/drop of files
$('#fileList tr td.filename').draggable(dragOptions);
$('#fileList tr[data-type="dir"] td.filename').droppable(folderDropOptions);
$('div.crumb').droppable({
drop: function( event, ui ) {
var file=ui.draggable.text().trim();
var target=$(this).attr('data-dir');
var dir=$('#dir').val();
while(dir.substr(0,1)=='/'){//remove extra leading /'s
dir=dir.substr(1);
}
dir='/'+dir;
if(dir.substr(-1,1)!='/'){
dir=dir+'/';
}
if(target==dir){
return;
}
$.ajax({
url: 'ajax/move.php',
data: "dir="+dir+"&file="+file+'&target='+target,
complete: function(data){boolOperationFinished(data, function(){
FileList.remove(file);
});}
});
},
function() {
$(this).removeClass('mouseOver');
}
);
tolerance: 'pointer'
});
// Sets the file-action buttons behaviour :
$('td.fileaction a').live('click',function(event) {
event.preventDefault();
@ -31,15 +50,19 @@ $(document).ready(function() {
// Sets the select_all checkbox behaviour :
$('#select_all').click(function() {
if($(this).attr('checked'))
if($(this).attr('checked')){
// Check all
$('td.selection input:checkbox').attr('checked', true);
else
$('td.selection input:checkbox').parent().parent().addClass('selected');
}else{
// Uncheck all
$('td.selection input:checkbox').attr('checked', false);
$('td.selection input:checkbox').parent().parent().removeClass('selected');
}
});
$('td.selection input:checkbox').live('click',function() {
$(this).parent().parent().toggleClass('selected');
if(!$(this).attr('checked')){
$('#select_all').attr('checked',false);
}else{
@ -218,3 +241,28 @@ function formatDate(date){
"July", "August", "September", "October", "November", "December" ];
return monthNames[date.getMonth()]+' '+date.getDate()+', '+date.getFullYear()+', '+((date.getHours()<10)?'0':'')+date.getHours()+':'+date.getMinutes();
}
//options for file drag/dropp
var dragOptions={
distance: 20, revert: true, opacity: 0.7,
stop: function(event, ui) {
$('#fileList tr td.filename').addClass('ui-draggable');
}
};
var folderDropOptions={
drop: function( event, ui ) {
var file=ui.draggable.text().trim();
var target=$(this).text().trim();
var dir=$('#dir').val();
$.ajax({
url: 'ajax/move.php',
data: "dir="+dir+"&file="+file+'&target='+dir+'/'+target,
complete: function(data){boolOperationFinished(data, function(){
var el=$('#fileList tr[data-file="'+file+'"] td.filename');
el.draggable('destroy');
FileList.remove(file);
});}
});
}
}

View file

@ -23,9 +23,9 @@
</div>
</div>
<p class="nav">
<span class="nav">
<?php echo($_['breadcrumb']); ?>
</p>
</span>
<table cellspacing="0">
<thead>

View file

@ -1,4 +1,8 @@
<a href="<?php echo link_to("files", "index.php?dir=/"); ?>"><img src="<?php echo image_path("", "actions/go-home.png"); ?>" alt="Root" /></a>
<div class='crumb' data-dir='/'>
<a href="<?php echo link_to("files", "index.php?dir=/"); ?>"><img src="<?php echo image_path("", "actions/go-home.png"); ?>" alt="Root"/></a>
</div>
<?php foreach($_["breadcrumb"] as $crumb): ?>
<a href="<?php echo link_to("files", "index.php?dir=".$crumb["dir"]); ?>"><?php echo htmlspecialchars($crumb["name"]); ?></a>
<div class='crumb' data-dir='<?php echo $crumb["dir"];?>'>
<a href="<?php echo link_to("files", "index.php?dir=".$crumb["dir"]); ?>"><?php echo htmlspecialchars($crumb["name"]); ?></a>
</div>
<?php endforeach; ?>

View file

@ -3,7 +3,15 @@
$simple_size_color = 200-intval(pow($simple_file_size,3)); ?>
<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 if($file['type'] == 'dir') echo "<strong>"; echo htmlspecialchars($file['name']); if($file['type'] == 'dir') echo "</strong>"; ?></a></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 if($file['type'] == 'dir'):?>
<strong><?php echo htmlspecialchars($file['name']);?></strong>
<?php else:?>
<?php echo htmlspecialchars($file['basename']);?><span class='extention'><?php echo $file['extention'];?></span>
<?php endif;?>
</a>
</td>
<td class="filesize" title="<?php echo human_file_size($file['size']); ?>" style="color:rgb(<?php echo $simple_size_color.','.$simple_size_color.','.$simple_size_color ?>)"><?php echo $simple_file_size; ?></td>
<td class="date"><?php echo $file['date']; ?></td>
<td class="fileaction"><a href="" title="+" class="dropArrow"></a></td>