blob: 37cda883c8a420f99d87e98c4f7d779a5a8cf6eb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
|
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<!-- Optional: Include the jQuery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<!-- Optional: Incorporate the Bootstrap JavaScript plugins -->
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.26/angular.min.js"></script>
<base url="/">
</head>
<body>
<style>
.navbar-vfs{
background-color: #3083D6;
}
#vfs-logo{
height: 70px;
width: 70px;
margin: 5px;
padding: 0;
background-image: url('img/logo.png');
background-repeat: no-repeat;
background-size: 66px 66px;
background-position: center center;
}
#vfs-logo:hover{
background:#2669AB;
border-radius: 10px;
box-shadow: 3px -3px 5px black;
background-image: url('img/logo.png');
background-repeat: no-repeat;
background-size: 66px 66px;
background-position: center center;
}
.navbar-brand{
padding: 0;
}
.navbar-brand,
.navbar-nav li a {
line-height: 80px;
height: 80px;
padding-top: 0;
}
tr.file{
height: 30px;
width: 100%;
}
tr.file:hover{
background: #CCCCCC;
cursor: pointer;
}
table.file-browser{
width: 100%;
}
td.fileicon{
font-size: 25px;
width: 30px;
}
td.filename{
text-align: right;
}
</style>
<nav class="navbar navbar-vfs navbar-static-top">
<div class="navbar-header">
<div class="navbar-brand" href="#">
<div id="vfs-logo"></div>
</div>
</div>
</nav>
<!--File Browser-->
<div class="container-fluid" ng-app="fileBrowser" ng-init="loggedin = true" ng-controller="fileListController" ng-show="loggedin" >
<table class="file-browser">
<tr ng-click="up()" class="file" >
<td colspan="0"><b>..</b></td>
</tr>
<tr class="file" ng-repeat="ob in files" ng-click="open(ob)">
<td class="fileicon"><spans class="file-browser fileicon" ng-class="icon(ob)"></span></td><td class="file-browser filename"> {{ob.folder.name || ob.file.name}}</td><td>{{ob.file.size? ob.file.size +"kB" : ""}}</td>
</tr>
</table>
</div>
<!--Login-->
<!-- <div class="container-fluid col-sm-4 col-sm-offset-4" ng-app="login" ng-hide="loggedin">
<form action="return false">
<input type="text" placeholder="username" class="form-control">
<input type="password" placeholder="password" class="form-control">
<button class="form-control">Login</button>
</form>
</div>-->
<script>
fileBrowser = angular.module("fileBrowser", []);
fileBrowser.config(function($locationProvider){
$locationProvider.html5Mode(true);
});
fileBrowser.controller("fileListController", function ($scope, $http, $location){
$http.get("json.php").success(function(response){$scope.files = response;});
$scope.icon = function(ob){
if(ob.folder){
return "glyphicon glyphicon-folder-close";
}else{
switch(ob.file.mime){
default: return "glyphicon glyphicon-file";
}
}
};
$scope.up = function(){
path = $location.path();
endsWithSlash = path.lastIndexOf('/') == path.length-1;
if(endsWithSlash)
path = path.substr(0,path.length-1);
$location.path(path.substring(0,path.lastIndexOf('/')));
//TODO reload filelist
}
$scope.open = function(ob){
endsWithSlash = $location.path().lastIndexOf('/') == $location.path().length-1;
name = ob.file ? ob.file.name : ob.folder.name;
slash = endsWithSlash ? "" : "/";
$location.path($location.path()+slash+name+"/");
}
});
</script>
</body>
</html>
|