diff options
-rw-r--r-- | css/styles.css | 21 | ||||
-rw-r--r-- | files/css/files.css | 48 | ||||
-rw-r--r-- | files/index.php | 28 | ||||
-rw-r--r-- | files/js/files.js | 39 | ||||
-rw-r--r-- | files/templates/index.php | 44 | ||||
-rw-r--r-- | js/js.js | 38 | ||||
-rw-r--r-- | lib/template.php | 2 | ||||
-rw-r--r-- | log/index.php | 2 |
8 files changed, 158 insertions, 64 deletions
diff --git a/css/styles.css b/css/styles.css index 771c430c723..4fc5a39b8c0 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 00000000000..8ab07d45241 --- /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 538bd87971d..25a9f0297dc 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 00000000000..9ab573ee92b --- /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 9e271bbbcd9..fe7ec903c2a 100644 --- a/files/templates/index.php +++ b/files/templates/index.php @@ -5,4 +5,46 @@ ?> <h1>Files</h1> -# TBD (again)
\ No newline at end of file +<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> @@ -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 bdb2ebab03b..79899efee49 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 58cc1f54021..3cdf3d7c649 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(); ?> |