Application "files" is able to list the files again, start of splitting css files

This commit is contained in:
Jakob Sack 2011-03-02 23:06:23 +01:00
parent e5ea0a3daa
commit 61ffa182ee
8 changed files with 158 additions and 64 deletions

View file

@ -571,27 +571,6 @@ p.actions a.delete
/* FILE MENU */
#file_menu
{
display: none;
position: absolute;
background-color: #EEE;
}
#file_menu ul
{
list-style-type: none;
}
#file_menu li a
{
display: block;
padding: 0.5em 5em 0.5em 2em;
text-decoration: none;
}
/* USER SETTINGS ------------------------------------------------------------ */

48
files/css/files.css Normal file
View file

@ -0,0 +1,48 @@
/* FILE MENU */
#file_menu
{
display: none;
position: absolute;
background-color: #EEE;
}
#file_menu ul
{
list-style-type: none;
}
#file_menu li a
{
display: block;
padding: 0.5em 5em 0.5em 2em;
text-decoration: none;
}
/* FILE TABLE */
table td.filesize, table td.date
{
width: 5em;
padding: 0.5em 1em;
text-align: right;
}
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;
}

View file

@ -22,19 +22,43 @@
*/
// Init owncloud
require_once('../lib/base.php');
oc_require( 'template.php' );
// Check if we are a user
if( !OC_USER::isLoggedIn()){
header( "Location: ".OC_UTIL::linkto( "index.php" ));
header( "Location: ".OC_HELPER::linkTo( "index.php" ));
exit();
}
// Load the files we need
OC_UTIL::addStyle( "files", "files" );
OC_UTIL::addScript( "files", "files" );
// Load the files
$dir = isset( $_GET['dir'] ) ? $_GET['dir'] : '';
$files=OC_FILES::getdirectorycontent( $dir );
$files = array();
foreach( OC_FILES::getdirectorycontent( $dir ) as $i ){
$i["date"] = date( $CONFIG_DATEFORMAT, $i["mtime"] );
$files[] = $i;
}
// Make breadcrumb
$breadcrumb = array();
$pathtohere = "/";
foreach( explode( "/", $dir ) as $i ){
if( $i != "" ){
$pathtohere .= "$i/";
$breadcrumb[] = array( "dir" => $pathtohere, "name" => $i );
}
}
// return template
$tmpl = new OC_TEMPLATE( "files", "index", "user" );
$tmpl->assign( "files", $files );
$tmpl->assign( "breadcrumb", $breadcrumb );
$tmpl->printPage();
?>

39
files/js/files.js Normal file
View file

@ -0,0 +1,39 @@
$(document).ready(function() {
// Sets browser table behaviour :
$('.browser tr').hover(
function() {
$(this).addClass('mouseOver');
},
function() {
$(this).removeClass('mouseOver');
}
);
// 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;
});
// Sets the select_all checkbox behaviour :
$('#select_all').click(function() {
if($(this).attr('checked'))
// Check all
$('.browser input:checkbox').attr('checked', true);
else
// Uncheck all
$('.browser input:checkbox').attr('checked', false);
});
});

View file

@ -5,4 +5,46 @@
?>
<h1>Files</h1>
# TBD (again)
<div class="controls">
<p class="actions">
<a href="" title="" class="upload">Upload</a><a href="" title="" class="new-dir">New folder</a><a href="" title="" class="download">Download</a><a href="" title="" class="share">Share</a><a href="" title="" class="delete">Delete</a>
</p>
</div>
<p class="nav">
<a href="<? echo link_to( "files", "index.php?dir=/" ) ?>"><img src="<? echo image_path( "", "actions/go-home.png" ) ?>" alt="Root" /></a>
<? foreach( $_["breadcrumb"] as $crumb ){ ?>
<a href="<? echo link_to( "files", "index.php?dir=".$crumb["dir"] ) ?>"><? echo $crumb["name"] ?></a>
<? } ?>
</p>
<table cellspacing="0">
<thead>
<tr>
<th><input type="checkbox" id="select_all" /></th>
<th>Name</th>
<th>Size</th>
<th>Modified</th>
<th></th>
</tr>
</thead>
<tbody>
<? foreach( $_["files"] as $file ){ ?>
<tr>
<td class="selection"><input type="checkbox" /></td>
<td class="filename"><a style="background-image:url(<? if( $file["type"] == "dir" ) echo mimetype_icon( "dir" ); else echo mimetype_icon( $file["mime"] ) ?>)" href="<? 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=""><? echo $file["name"] ?></a></td>
<td class="filesize"><? if( $file["type"] != "dir" ) echo human_file_size( $file["size"] ) ?></td>
<td class="date"><? if( $file["type"] != "dir" ) echo $file["date"] ?></td>
<td class="fileaction"><a href="" title=""><img src="images/drop-arrow.png" alt="+" /></a></td>
</tr>
<? } ?>
</tbody>
</table>
<div id="file_menu">
<ul>
<li><a href="" title="">Download</a></li>
<li><a href="" title="">Share</a></li>
<li><a href="" title="">Delete</a></li>
</ul>
</div>

View file

@ -9,42 +9,4 @@ $(document).ready(function() {
$('#user_menu').slideToggle(250);
return false;
});
// Sets browser table behaviour :
$('.browser tr').hover(
function() {
$(this).addClass('mouseOver');
},
function() {
$(this).removeClass('mouseOver');
}
);
// 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;
});
// Sets the select_all checkbox behaviour :
$('#select_all').click(function() {
if($(this).attr('checked'))
// Check all
$('.browser input:checkbox').attr('checked', true);
else
// Uncheck all
$('.browser input:checkbox').attr('checked', false);
});
});

View file

@ -41,7 +41,7 @@ function image_path( $app, $file ){
*
*/
function mimetype_icon( $mimetype ){
return OC_HELPER::mimetypeIcon( $app, $file );
return OC_HELPER::mimetypeIcon( $mimetype );
}
/**

View file

@ -38,7 +38,7 @@ foreach( $logs as &$i ){
}
$tmpl = new OC_TEMPLATE( "log", "index", "user" );
$tmpl->assign( "log", $logs );
$tmpl->assign( "logs", $logs );
$tmpl->printPage();
?>