commit | author | age
|
05e9c4
|
1 |
/* |
U |
2 |
Dateiverwaltung - File management in your browser |
|
3 |
Copyright (C) 2017 Ulrich Hilger, http://uhilger.de |
|
4 |
|
|
5 |
This program is free software: you can redistribute it and/or modify |
|
6 |
it under the terms of the GNU Affero General Public License as |
|
7 |
published by the Free Software Foundation, either version 3 of the |
|
8 |
License, or (at your option) any later version. |
|
9 |
|
|
10 |
This program is distributed in the hope that it will be useful, |
|
11 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
GNU Affero General Public License for more details. |
|
14 |
|
|
15 |
You should have received a copy of the GNU Affero General Public License |
|
16 |
along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
17 |
*/ |
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
/* |
|
22 |
* In data.js finden sich die Objekte vom Browser-Client |
|
23 |
* der Dateiverwaltung |
|
24 |
*/ |
|
25 |
|
|
26 |
|
|
27 |
|
|
28 |
/* ----- Objekte ----- */ |
|
29 |
|
e3cec2
|
30 |
function Meldung(tx) { |
U |
31 |
this.mtext = tx; |
|
32 |
} |
|
33 |
|
05e9c4
|
34 |
function IssueList(il) { |
U |
35 |
this.issues = il; |
|
36 |
} |
|
37 |
|
|
38 |
function CompilerIssue(sn, ms, ki, ln) { |
|
39 |
var self = this; |
|
40 |
this.sourceName = sn; |
|
41 |
this.message = ms; |
|
42 |
this.kind = ki; |
|
43 |
this.lineNumber = ln; |
|
44 |
} |
|
45 |
|
|
46 |
function FileList(fl) { |
|
47 |
this.files = fl; |
|
48 |
} |
|
49 |
|
|
50 |
function FileRef(obj) { |
|
51 |
var self = this; |
|
52 |
this.fr = obj; |
|
53 |
this.fnx; |
|
54 |
this.fext = ''; |
|
55 |
|
|
56 |
this.typeClass = function () { |
41ab37
|
57 |
if (app.modus == 'kacheln') { |
05e9c4
|
58 |
if (self.fr.isDirectory) { |
41ab37
|
59 |
return 'icon-folder ordner'; |
05e9c4
|
60 |
} else { |
41ab37
|
61 |
return 'icon-doc-text-inv datei'; |
05e9c4
|
62 |
} |
U |
63 |
} else { |
|
64 |
if (self.fr.isDirectory) { |
41ab37
|
65 |
return 'icon-folder ordner'; |
05e9c4
|
66 |
} else { |
41ab37
|
67 |
return 'icon-doc-text-inv datei'; |
05e9c4
|
68 |
} |
U |
69 |
} |
|
70 |
}; |
|
71 |
|
|
72 |
this.mini = function () { |
|
73 |
var miniatur = false; |
|
74 |
var namen = self.fr.absolutePath.split('/'); |
|
75 |
if (namen.length > 0) { |
|
76 |
self.fnx = decodeURIComponent(namen[namen.length - 1]); |
|
77 |
} else { |
|
78 |
self.fnx = decodeURIComponent(self.fr.absolutePath); |
|
79 |
} |
|
80 |
if (self.fnx.indexOf('.jpg') > -1 || self.fnx.indexOf('.png') > -1 || |
|
81 |
self.fnx.indexOf('.gif') > -1 || self.fnx.indexOf('.jpeg') > -1) { |
|
82 |
miniatur = true; |
|
83 |
} |
|
84 |
return miniatur; |
|
85 |
}; |
|
86 |
|
|
87 |
this.dia = function () { |
41ab37
|
88 |
return app.fm_slideshow; |
05e9c4
|
89 |
}; |
U |
90 |
|
|
91 |
this.miniurl = function () { |
58bcbd
|
92 |
// var userid = $('#userMenu').text(); |
05e9c4
|
93 |
if (self.fext === '') { |
U |
94 |
//self.fext = ''; |
|
95 |
var dotpos = self.fnx.indexOf('.'); |
|
96 |
if (dotpos > -1) { |
|
97 |
var fny = self.fnx; |
|
98 |
self.fnx = self.fnx.substring(0, dotpos); |
|
99 |
self.fext = fny.substr(dotpos); |
|
100 |
} |
|
101 |
} |
41ab37
|
102 |
var path = app.fm_get_path(app.userid); |
U |
103 |
var imgurl = app.loc + path + '/' + self.fnx + '_tn' + self.fext; |
05e9c4
|
104 |
return imgurl; |
U |
105 |
|
|
106 |
}; |
|
107 |
|
|
108 |
this.bildurl = function () { |
58bcbd
|
109 |
// var userid = $('#userMenu').text(); |
05e9c4
|
110 |
if (self.fext === '') { |
U |
111 |
//self.fext = ''; |
|
112 |
var dotpos = self.fnx.indexOf('.'); |
|
113 |
if (dotpos > -1) { |
|
114 |
var fny = self.fnx; |
|
115 |
self.fnx = self.fnx.substring(0, dotpos); |
|
116 |
self.fext = fny.substr(dotpos); |
|
117 |
} |
|
118 |
} |
9350c9
|
119 |
var path = app.fm_get_path(app.userid); |
41ab37
|
120 |
var imgurl = app.loc + path + '/' + self.fnx + self.fext; |
05e9c4
|
121 |
return imgurl; |
U |
122 |
}; |
|
123 |
|
|
124 |
this.fileName = function () { |
|
125 |
|
|
126 |
var namen = self.fr.absolutePath.split('/'); |
|
127 |
if (namen.length > 0) { |
|
128 |
return decodeURIComponent(namen[namen.length - 1]); |
|
129 |
} else { |
|
130 |
return decodeURIComponent(self.fr.absolutePath); |
|
131 |
} |
|
132 |
|
|
133 |
}; |
|
134 |
|
|
135 |
this.fileDate = function () { |
|
136 |
return moment(self.fr.lastModified).format("YYYY-MM-DD-hh-mm-ss-SSS"); |
|
137 |
}; |
|
138 |
|
|
139 |
this.fileSize = function () { |
|
140 |
return numeral(self.fr.length).format("0.00 b"); |
|
141 |
}; |
|
142 |
} |
|
143 |
|
|
144 |
function BcrFiles(fl) { |
|
145 |
this.files = fl; |
|
146 |
} |
|
147 |
|
|
148 |
function BcrFile(rp, n) { |
|
149 |
this.relPath = rp; |
|
150 |
this.fName = n; |
|
151 |
} |
|
152 |
|