diff options
author | Jakob Sack <kde@jakobsack.de> | 2011-04-18 11:49:23 +0200 |
---|---|---|
committer | Jakob Sack <kde@jakobsack.de> | 2011-04-18 11:49:23 +0200 |
commit | dd0eb9dd8dbc0d0eff559775d346b5fe04705554 (patch) | |
tree | 3b0ee44ee8fab49179dd0d038c709d888b5eb257 | |
parent | f22c05deab263129c7d278d5e4d097cd9ec5573a (diff) | |
parent | b4a74f895efdcc949731abf70c44580461c5c864 (diff) | |
download | nextcloud-server-dd0eb9dd8dbc0d0eff559775d346b5fe04705554.tar.gz nextcloud-server-dd0eb9dd8dbc0d0eff559775d346b5fe04705554.zip |
Merge branch 'refactoring' of git://anongit.kde.org/owncloud into refactoring
30 files changed, 197 insertions, 70 deletions
diff --git a/.gitignore b/.gitignore index 71e3ec1baf9..9cfb7a5861e 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,5 @@ _darcs/* CVS/* .svn/* RCS/* +.kdev +*.kdev4 diff --git a/admin/appinfo/app.php b/admin/appinfo/app.php index 04f8caf138c..e87013bd993 100644 --- a/admin/appinfo/app.php +++ b/admin/appinfo/app.php @@ -2,10 +2,10 @@ OC_APP::register( array( "order" => 1, "id" => "admin", "name" => "Administration" )); -OC_APP::addAdminPage( array( "id" => "core_system", "order" => 1, "href" => OC_HELPER::linkTo( "admin", "system.php" ), "name" => "System setting", "icon" => OC_HELPER::imagePath( "admin", "administration.png" ))); +OC_APP::addAdminPage( array( "id" => "core_system", "order" => 1, "href" => OC_HELPER::linkTo( "admin", "system.php" ), "name" =>"System", "icon" => OC_HELPER::imagePath( "admin", "administration.png" ))); OC_APP::addAdminPage( array( "id" => "core_users", "order" => 2, "href" => OC_HELPER::linkTo( "admin", "users.php" ), "name" => "Users", "icon" => OC_HELPER::imagePath( "admin", "users.png" ))); OC_APP::addAdminPage( array( "id" => "core_apps", "order" => 3, "href" => OC_HELPER::linkTo( "admin", "apps.php" ), "name" => "Apps", "icon" => OC_HELPER::imagePath( "admin", "apps.png" ))); -OC_APP::addAdminPage( array( "id" => "core_plugins", "order" => 4, "href" => OC_HELPER::linkTo( "admin", "plugins.php" ), "name" => "Plugins", "icon" => OC_HELPER::imagePath( "admin", "apps.png" ))); +OC_APP::addAdminPage( array( "id" => "core_plugins", "order" => 4, "href" => OC_HELPER::linkTo( "admin", "plugins.php" ), "name" => "Plugins", "icon" => OC_HELPER::imagePath( "admin", "plugins.png" ))); // Add subentries for App installer OC_APP::addNavigationSubEntry( "core_apps", array( "id" => "core_apps_installed", "order" => 4, "href" => OC_HELPER::linkTo( "admin", "apps.php?add=some¶meters=here" ), "name" => "Installed apps", "icon" => OC_HELPER::imagePath( "admin", "navicon.png" ))); diff --git a/admin/img/apps.png b/admin/img/apps.png Binary files differindex 1e6f16651c2..ee3e8355e66 100644 --- a/admin/img/apps.png +++ b/admin/img/apps.png diff --git a/admin/img/plugins.png b/admin/img/plugins.png Binary files differnew file mode 100644 index 00000000000..1e6f16651c2 --- /dev/null +++ b/admin/img/plugins.png diff --git a/admin/img/users.png b/admin/img/users.png Binary files differindex 0d3701918b9..ea2ed9e3335 100644 --- a/admin/img/users.png +++ b/admin/img/users.png diff --git a/css/styles.css b/css/styles.css index f0832d05947..d5b5f59f70c 100644 --- a/css/styles.css +++ b/css/styles.css @@ -99,6 +99,9 @@ table td.download { background-image:url('../img/download.png'); } table td.upload { background-image:url('../img/upload.png'); } table td.create { background-image:url('../img/folder-new.png'); } table td.delete { background-image:url('../img/delete.png'); } +#fileList tr input[type=checkbox] { display:none; } +#fileList tr input[type=checkbox]:checked { display:inline; } +#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; } diff --git a/files/appinfo/app.php b/files/appinfo/app.php index c542f47b24f..bf67812cf38 100644 --- a/files/appinfo/app.php +++ b/files/appinfo/app.php @@ -2,7 +2,7 @@ OC_APP::register( array( "order" => 2, "id" => "files", "name" => "Files" )); -OC_APP::addNavigationEntry( array( "id" => "files_index", "order" => 1, "href" => OC_HELPER::linkTo( "files", "index.php" ), "icon" => OC_HELPER::imagePath( "files", "navicon.png" ), "name" => "Files" )); +OC_APP::addNavigationEntry( array( "id" => "files_index", "order" => 1, "href" => OC_HELPER::linkTo( "files", "index.php" ), "icon" => OC_HELPER::imagePath( "files", "home.png" ), "name" => "Files" )); OC_APP::addSettingsPage( array( "id" => "files_administration", "order" => 1, "href" => OC_HELPER::linkTo( "files", "admin.php" ), "name" => "Files", "icon" => OC_HELPER::imagePath( "files", "folder.png" ))); diff --git a/files/img/file.png b/files/img/file.png Binary files differnew file mode 100644 index 00000000000..49790448897 --- /dev/null +++ b/files/img/file.png diff --git a/files/img/folder.png b/files/img/folder.png Binary files differindex 3e7a3ba8cfe..3edbe257a34 100644 --- a/files/img/folder.png +++ b/files/img/folder.png diff --git a/files/img/home.png b/files/img/home.png Binary files differnew file mode 100644 index 00000000000..b3fb9bbaf6f --- /dev/null +++ b/files/img/home.png diff --git a/files/img/navicon.png b/files/img/navicon.png Binary files differdeleted file mode 100644 index 3802c98fc46..00000000000 --- a/files/img/navicon.png +++ /dev/null diff --git a/files/index.php b/files/index.php index 2a78e8a438e..7ac3bce6051 100644 --- a/files/index.php +++ b/files/index.php @@ -42,6 +42,9 @@ $dir = isset( $_GET['dir'] ) ? $_GET['dir'] : ''; $files = array(); foreach( OC_FILES::getdirectorycontent( $dir ) as $i ){ $i["date"] = OC_UTIL::formatDate($i["mtime"] ); + if($i['directory']=='/'){ + $i['directory']=''; + } $files[] = $i; } diff --git a/files/js/files.js b/files/js/files.js index 5c11bddeb56..019758dc497 100644 --- a/files/js/files.js +++ b/files/js/files.js @@ -39,6 +39,19 @@ $(document).ready(function() { $('.browser input:checkbox').attr('checked', 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() { $('#file_upload_target').load(uploadFinished); }); @@ -47,7 +60,7 @@ $(document).ready(function() { $.ajax({ url: 'ajax/newfolder.php', data: "dir="+$('#dir').val()+"&foldername="+$('#file_new_dir_name').val(), - complete: boolOpFinished + complete: function(data){boolOperationFinished(data, false);} }); }); @@ -98,14 +111,20 @@ function resetFileActionPanel() { $('#file_action_panel').attr('activeAction', false); } -function boolOpFinished(data) { +function boolOperationFinished(data, single, el) { result = eval("("+data.responseText+");"); if(result.status == 'success'){ - $.ajax({ - url: 'ajax/list.php', - data: "dir="+$('#dir').val(), - complete: refreshContents - }); + if(single) { + $('#file_menu').slideToggle(0); + $('body').append($('#file_menu')); + $(el).remove(); + } else { + $.ajax({ + url: 'ajax/list.php', + data: "dir="+$('#dir').val(), + complete: refreshContents + }); + } } else { alert(result.data.message); } @@ -117,7 +136,11 @@ function refreshContents(data) { updateBreadcrumb(result.data.breadcrumb); } updateFileList(result.data.files); - $('#file_upload_button').click(); + $('td.fileaction a').click(function() { + $(this).parent().append($('#file_menu')); + $('#file_menu').slideToggle(250); + return false; + }); resetFileActionPanel(); } diff --git a/files/templates/index.php b/files/templates/index.php index 75eef0d16e4..d38e771c2e1 100644 --- a/files/templates/index.php +++ b/files/templates/index.php @@ -40,6 +40,6 @@ name="file_upload_target" src=""></iframe></form> <ul> <li><a href="" title="">Download</a></li> <li><a href="" title="">Share</a></li> - <li><a href="" title="">Delete</a></li> + <li><a href="" title="" id="delete_single_file">Delete</a></li> </ul> </div> diff --git a/files/templates/part.breadcrumb.php b/files/templates/part.breadcrumb.php index 4d11edb984a..da9544008b9 100644 --- a/files/templates/part.breadcrumb.php +++ b/files/templates/part.breadcrumb.php @@ -1,4 +1,4 @@ <a href="<?php echo link_to("files", "index.php?dir=/"); ?>"><img src="<?php echo image_path("", "actions/go-home.png"); ?>" alt="Root" /></a> <?php foreach($_["breadcrumb"] as $crumb): ?> - <a href="<?php echo link_to("files", "index.php?dir=".$crumb["dir"]); ?>"><?php echo $crumb["name"]; ?></a> + <a href="<?php echo link_to("files", "index.php?dir=".$crumb["dir"]); ?>"><?php echo htmlspecialchars($crumb["name"]); ?></a> <?php endforeach; ?>
\ No newline at end of file diff --git a/files/templates/part.list.php b/files/templates/part.list.php index 76d938326b6..0d4fcc75489 100644 --- a/files/templates/part.list.php +++ b/files/templates/part.list.php @@ -1,9 +1,9 @@ <?php foreach($_["files"] as $file): ?> <tr> <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 $file["name"]; ?></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 echo htmlspecialchars($file["name"]); ?></a></td> <td class="filesize"><?php echo human_file_size($file["size"]); ?></td> - <td class="date"><?php if($file["type"] != "dir") echo $file["date"]; ?></td> + <td class="date"><?php echo $file["date"]; ?></td> <td class="fileaction"><a href="" title=""><img src="images/drop-arrow.png" alt="+" /></a></td> </tr> <?php endforeach; ?>
\ No newline at end of file diff --git a/help/img/help.png b/help/img/help.png Binary files differindex aa222ed83b3..487c6e6fd92 100644 --- a/help/img/help.png +++ b/help/img/help.png diff --git a/img/help_about.png b/img/help_about.png Binary files differdeleted file mode 100644 index 792d18b1a53..00000000000 --- a/img/help_about.png +++ /dev/null diff --git a/img/mimetypes/application-octet-stream.png b/img/mimetypes/application-octet-stream.png Binary files differindex 0a90cf06b5f..49790448897 100644 --- a/img/mimetypes/application-octet-stream.png +++ b/img/mimetypes/application-octet-stream.png diff --git a/img/places/folder.png b/img/places/folder.png Binary files differindex 3e7a3ba8cfe..3edbe257a34 100644 --- a/img/places/folder.png +++ b/img/places/folder.png diff --git a/img/task-attention.png b/img/task-attention.png Binary files differdeleted file mode 100644 index 35a112e9d53..00000000000 --- a/img/task-attention.png +++ /dev/null diff --git a/lib/base.php b/lib/base.php index ec305250809..352474e1e83 100644 --- a/lib/base.php +++ b/lib/base.php @@ -242,35 +242,20 @@ class OC_UTIL { public static function showPageNavi($pagecount,$page,$url) { $pagelinkcount=8; - $txt=''; if ($pagecount>1) { - $txt.='<center><table class="pager" cellspacing="0" cellpadding="0" border="0"><tr><td width="1">'; - - if ($page>'0') { - $txt.='<span class="pagerbutton1"><a href="'.$url.($page-1).'">prev</a> </span>'; - } - $txt.='</td><td width="1">'; - $pagestart=$page-$pagelinkcount; if($pagestart<0) $pagestart=0; $pagestop=$page+$pagelinkcount; if($pagestop>$pagecount) $pagestop=$pagecount; - if ($pagestart<>0) $txt.='...'; - for ($i=$pagestart; $i < $pagestop;$i++) { - if ($i<>$page) { - $txt.='<a href="'.$url.$i.'"> '.($i+1).' </a>'; - } else { - $txt.=' <b>'.($i+1).'</b> '; - } - } - if ($pagecount>$pagestop) $txt.='...'; - $txt.='</td><td width="1">'; - if (($page+1)<$pagecount) { - $txt.='<span class="pagerbutton2"><a href="'.$url.($page+1).'">next</a></span>'; - } - $txt.='</td></tr></table></center>'; + + $tmpl = new OC_TEMPLATE( '', 'part.pagenavi', '' ); + $tmpl->assign('page',$page); + $tmpl->assign('pagecount',$pagecount); + $tmpl->assign('pagestart',$pagestart); + $tmpl->assign('pagestop',$pagestop); + $tmpl->assign('url',$url); + $tmpl->printPage(); } - echo($txt); } diff --git a/plugins/publiclink/get.php b/plugins/publiclink/get.php new file mode 100644 index 00000000000..cdfe42ef262 --- /dev/null +++ b/plugins/publiclink/get.php @@ -0,0 +1,76 @@ +<?php +$RUNTIME_NOAPPS=true; //no need to load the apps +$RUNTIME_NOSETUPFS=true; //don't setup the fs yet + +require_once '../../lib/base.php'; +require( 'template.php' ); + +require_once 'lib_public.php'; + +//get the path of the shared file +$token=$_GET['token']; +$path=OC_PublicLink::getPath($token); +$root=$path; + +if($path!==false){ + if(isset($_GET['path']) and !strstr($_GET['path'],'..')){ + $subPath=$_GET['path']; + }else{ + $subPath=''; + } + $path.=$subPath; + if(OC_FILESYSTEM::is_dir($path)){ + $files = array(); + $rootLength=strlen($root); + foreach( OC_FILES::getdirectorycontent( $path ) as $i ){ + $i['date'] = OC_UTIL::formatDate($i['mtime'] ); + $i['directory']=substr($i['directory'],$rootLength); + if($i['directory']=='/'){ + $i['directory']=''; + } + $files[] = $i; + } + + // Make breadcrumb + $breadcrumb = array(); + $pathtohere = "/"; + foreach( explode( "/", $subPath ) as $i ){ + if( $i != "" ){ + $pathtohere .= "$i/"; + $breadcrumb[] = array( "dir" => $pathtohere, "name" => $i ); + } + } + + $breadcrumbNav = new OC_TEMPLATE( "plugins/publiclink", "breadcrumb", "" ); + $breadcrumbNav->assign( "breadcrumb", $breadcrumb ); + $breadcrumbNav->assign('token',$token); + + $list = new OC_TEMPLATE( 'plugins/publiclink', 'files', '' ); + $list->assign( 'files', $files ); + $list->assign('token',$token); + + $tmpl = new OC_TEMPLATE( 'plugins/publiclink', 'index', 'user' ); + $tmpl->assign('fileList', $list->fetchPage()); + $tmpl->assign( "breadcrumb", $breadcrumbNav->fetchPage() ); + $tmpl->printPage(); + }else{ + //get time mimetype and set the headers + $mimetype=OC_FILESYSTEM::getMimeType($path); + header('Content-Transfer-Encoding: binary'); + header('Content-Disposition: attachment; filename="'.basename($path).'"'); + header('Expires: 0'); + header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); + header('Pragma: public'); + header('Content-Type: ' . $mimetype); + header('Content-Length: ' . OC_FILESYSTEM::filesize($path)); + + //download the file + ob_clean(); + OC_FILESYSTEM::readfile($path); + } +}else{ + header("HTTP/1.0 404 Not Found"); + echo '404 Not Found'; + die(); +} +?>
\ No newline at end of file diff --git a/plugins/publiclink/getfile.php b/plugins/publiclink/getfile.php deleted file mode 100644 index 15a568df3dc..00000000000 --- a/plugins/publiclink/getfile.php +++ /dev/null @@ -1,11 +0,0 @@ -<?php -$RUNTIME_NOAPPS=true; //no need to load the apps -$RUNTIME_NOSETUPFS=true; //don't setup the fs yet - -require_once '../../lib/base.php'; - -require_once 'lib_public.php'; - -$token=$_GET['token']; -OC_PublicLink::downloadFile($token); -?>
\ No newline at end of file diff --git a/plugins/publiclink/lib_public.php b/plugins/publiclink/lib_public.php index 7c25c938fda..20b538d3ac9 100644 --- a/plugins/publiclink/lib_public.php +++ b/plugins/publiclink/lib_public.php @@ -6,9 +6,9 @@ class OC_PublicLink{ * @param int (optional) expiretime time the link expires, as timestamp */ public function __construct($path,$expiretime=0){ - if($path && OC_FILESYSTEM::file_exists($path)){ - $token=sha1("$path-$expiretime"); + if($path and OC_FILESYSTEM::file_exists($path) and OC_FILESYSTEM::is_readable($path)){ $user=$_SESSION['user_id']; + $token=sha1("$user-$path-$expiretime"); $query=OC_DB::prepare("INSERT INTO *PREFIX*publiclink VALUES(?,?,?,?)"); $result=$query->execute(array($token,$path,$user,$expiretime)); if( PEAR::isError($result)) { @@ -22,10 +22,9 @@ class OC_PublicLink{ } /** - * download a file shared by a public link - * @param string token + * get the path of that shared file */ - public static function downloadFile($token){ + public static function getPath($token){ //remove expired links $query=OC_DB::prepare("DELETE FROM *PREFIX*publiclink WHERE expire_time < NOW() AND expire_time!=0"); $query->execute(); @@ -41,23 +40,9 @@ class OC_PublicLink{ //prepare the filesystem OC_UTIL::setupFS($user); - //get time mimetype and set the headers - $mimetype=OC_FILESYSTEM::getMimeType($path); - // header('Content-Disposition: attachment; filename="'.basename($path).'"'); - header('Content-Transfer-Encoding: binary'); - header('Expires: 0'); - header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); - header('Pragma: public'); - header('Content-Type: ' . $mimetype); - header('Content-Length: ' . OC_FILESYSTEM::filesize($path)); - - //download the file - ob_clean(); - OC_FILESYSTEM::readfile($path); + return $path; }else{ - header("HTTP/1.0 404 Not Found"); - echo '404 Not Found'; - die(); + return false; } } diff --git a/plugins/publiclink/templates/breadcrumb.php b/plugins/publiclink/templates/breadcrumb.php new file mode 100644 index 00000000000..3f4ae863ee0 --- /dev/null +++ b/plugins/publiclink/templates/breadcrumb.php @@ -0,0 +1,4 @@ + <a href="<?php echo link_to("plugins/publiclink", "get.php?token=".$_['token']); ?>"><img src="<?php echo image_path("", "actions/go-home.png"); ?>" alt="Root" /></a> + <?php foreach($_["breadcrumb"] as $crumb): ?> + <a href="<?php echo link_to("plugins/publiclink", "get.php?token=".$_['token']."&path=".$crumb["dir"]); ?>"><?php echo htmlspecialchars($crumb["name"]); ?></a> + <?php endforeach; ?>
\ No newline at end of file diff --git a/plugins/publiclink/templates/files.php b/plugins/publiclink/templates/files.php new file mode 100644 index 00000000000..6473ad4c5c8 --- /dev/null +++ b/plugins/publiclink/templates/files.php @@ -0,0 +1,9 @@ + <?php foreach($_["files"] as $file): ?> + <tr> + <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("plugins/publiclink", "get.php?token=".$_['token']."&path=".$file["directory"]."/".$file["name"]); else echo link_to("plugins/publiclink", "get.php?token=".$_['token']."&path=".$file["directory"]."/".$file["name"]); ?>" title=""><?php echo htmlspecialchars($file["name"]); ?></a></td> + <td class="filesize"><?php echo human_file_size($file["size"]); ?></td> + <td class="date"><?php if($file["type"] != "dir") echo $file["date"]; ?></td> + <td class="fileaction"><a href="" title=""><img src="images/drop-arrow.png" alt="+" /></a></td> + </tr> + <?php endforeach; ?>
\ No newline at end of file diff --git a/plugins/publiclink/templates/index.php b/plugins/publiclink/templates/index.php new file mode 100644 index 00000000000..9e238452603 --- /dev/null +++ b/plugins/publiclink/templates/index.php @@ -0,0 +1,17 @@ +<p class="nav"> + <?php echo($_['breadcrumb']); ?> +</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 id="fileList"> + <?php echo($_['fileList']); ?> + </tbody> +</table>
\ No newline at end of file diff --git a/settings/img/personal.png b/settings/img/personal.png Binary files differindex 95b4ca396c1..ae22c1c1dab 100644 --- a/settings/img/personal.png +++ b/settings/img/personal.png diff --git a/templates/part.pagenavi.php b/templates/part.pagenavi.php new file mode 100644 index 00000000000..d48d0cada32 --- /dev/null +++ b/templates/part.pagenavi.php @@ -0,0 +1,31 @@ +<center> + <table class="pager" cellspacing="0" cellpadding="0" border="0"> + <tr> + <td width="1"> + <?php if($_['page']>0):?> + <span class="pagerbutton1"><a href="<?php echo $_['url'].($_['page']-1);?>">prev</a> </span> + <?php endif; ?> + </td> + <td> + <?php if ($_['pagestart']>0):?> + ... + <?php endif;?> + <?php for ($i=$_['pagestart']; $i < $_['pagestop'];$i++):?> + <?php if ($_['page']!=$i):?> + <a href="<?php echo $_['url'].$i;?>"><?php echo $i+1;?> </a> + <?php else:?> + <?php echo $i+1;?> + <?php endif?> + <?php endfor;?> + <?php if ($_['pagestop']<$_['pagecount']):?> + ... + <?php endif;?> + </td> + <td width="1"> + <?php if(($_['page']+1)<$_['pagecount']):?> + <span class="pagerbutton2"><a href="<?php echo $_['url'].($_['page']+1);?>">next</a></span> + <?php endif; ?> + </td> + </tr> + </table> +</center>
\ No newline at end of file |