From 61ffa182ee90e1a08538f438fb5528e32b3cf70a Mon Sep 17 00:00:00 2001 From: Jakob Sack Date: Wed, 2 Mar 2011 23:06:23 +0100 Subject: [PATCH] Application "files" is able to list the files again, start of splitting css files --- css/styles.css | 21 ----------------- files/css/files.css | 48 +++++++++++++++++++++++++++++++++++++++ files/index.php | 28 +++++++++++++++++++++-- files/js/files.js | 39 +++++++++++++++++++++++++++++++ files/templates/index.php | 44 ++++++++++++++++++++++++++++++++++- js/js.js | 38 ------------------------------- lib/template.php | 2 +- log/index.php | 2 +- 8 files changed, 158 insertions(+), 64 deletions(-) create mode 100644 files/css/files.css create mode 100644 files/js/files.js diff --git a/css/styles.css b/css/styles.css index 771c430c72..4fc5a39b8c 100644 --- a/css/styles.css +++ b/css/styles.css @@ -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 ------------------------------------------------------------ */ diff --git a/files/css/files.css b/files/css/files.css new file mode 100644 index 0000000000..8ab07d4524 --- /dev/null +++ b/files/css/files.css @@ -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; +} + diff --git a/files/index.php b/files/index.php index 538bd87971..25a9f0297d 100644 --- a/files/index.php +++ b/files/index.php @@ -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(); ?> diff --git a/files/js/files.js b/files/js/files.js new file mode 100644 index 0000000000..9ab573ee92 --- /dev/null +++ b/files/js/files.js @@ -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); + }); +}); diff --git a/files/templates/index.php b/files/templates/index.php index 9e271bbbcd..fe7ec903c2 100644 --- a/files/templates/index.php +++ b/files/templates/index.php @@ -5,4 +5,46 @@ ?>

Files

-# TBD (again) \ No newline at end of file +
+

+ UploadNew folderDownloadDelete +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
NameSizeModified
)" href="" title="">+
+ +
+ +
diff --git a/js/js.js b/js/js.js index c9ab2222e7..244433184f 100644 --- a/js/js.js +++ b/js/js.js @@ -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); - }); }); diff --git a/lib/template.php b/lib/template.php index bdb2ebab03..79899efee4 100644 --- a/lib/template.php +++ b/lib/template.php @@ -41,7 +41,7 @@ function image_path( $app, $file ){ * */ function mimetype_icon( $mimetype ){ - return OC_HELPER::mimetypeIcon( $app, $file ); + return OC_HELPER::mimetypeIcon( $mimetype ); } /** diff --git a/log/index.php b/log/index.php index 58cc1f5402..3cdf3d7c64 100644 --- a/log/index.php +++ b/log/index.php @@ -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(); ?>