ulrich@undisclosed
2020-05-14 c995b7aefb982338ad4bd82b57ccf9295363aff9
commit | author | age
002c44 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
30 function IssueList(il) {
31   this.issues = il;
32 }
33
34 function CompilerIssue(sn, ms, ki, ln) {
35   var self = this;
36   this.sourceName = sn;
37   this.message = ms;
38   this.kind = ki;
39   this.lineNumber = ln;
40 }
41
42 function FileList(fl) {
43   this.files = fl;
44 }
45
46 function FileRef(obj) {
47   var self = this;
48   this.fr = obj;
49   this.fnx;
50   this.fext = '';
51
52   this.typeClass = function () {
53     if (modus == 'kacheln') {
54       if (self.fr.isDirectory) {
55         return 'fa-folder ordner';
56       } else {
57         return 'fa-file datei';
58       }
59     } else {
60       if (self.fr.isDirectory) {
61         return 'fa-folder ordner';
62       } else {
63         return 'fa-file-o datei';
64       }
65     }
66   };
67
68   this.mini = function () {
69     var miniatur = false;
70     var namen = self.fr.absolutePath.split('/');
71     if (namen.length > 0) {
72       self.fnx = decodeURIComponent(namen[namen.length - 1]);
73     } else {
74       self.fnx = decodeURIComponent(self.fr.absolutePath);
75     }
76     if (self.fnx.indexOf('.jpg') > -1 || self.fnx.indexOf('.png') > -1 || 
77             self.fnx.indexOf('.gif') > -1 || self.fnx.indexOf('.jpeg') > -1) {
78       miniatur = true;
79     }
80     return miniatur;
81   };
82
83   this.dia = function () {
84     return fm_slideshow;
85   };
86
87   this.miniurl = function () {
88     // var userid = $('#userMenu').text();
89     if (self.fext === '') {
90       //self.fext = '';
91       var dotpos = self.fnx.indexOf('.');
92       if (dotpos > -1) {
93         var fny = self.fnx;
94         self.fnx = self.fnx.substring(0, dotpos);
95         self.fext = fny.substr(dotpos);
96       }
97     }
98     var path = fm_get_path(app.userid);
99     var imgurl = loc + path + '/' + self.fnx + '_tn' + self.fext;
100     return imgurl;
101
102   };
103
104   this.bildurl = function () {
105     // var userid = $('#userMenu').text();
106     if (self.fext === '') {
107       //self.fext = '';
108       var dotpos = self.fnx.indexOf('.');
109       if (dotpos > -1) {
110         var fny = self.fnx;
111         self.fnx = self.fnx.substring(0, dotpos);
112         self.fext = fny.substr(dotpos);
113       }
114     }
115     var path = fm_get_path(app.userid);
116     var imgurl = loc + path + '/' + self.fnx + self.fext;
117     return imgurl;
118   };
119
120   this.fileName = function () {
121
122     var namen = self.fr.absolutePath.split('/');
123     if (namen.length > 0) {
124       return decodeURIComponent(namen[namen.length - 1]);
125     } else {
126       return decodeURIComponent(self.fr.absolutePath);
127     }
128
129   };
130
131   this.fileDate = function () {
132     return moment(self.fr.lastModified).format("YYYY-MM-DD-hh-mm-ss-SSS");
133   };
134
135   this.fileSize = function () {
136     return numeral(self.fr.length).format("0.00 b");
137   };
138 }
139
140 function BcrFiles(fl) {
141   this.files = fl;
142 }
143
144 function BcrFile(rp, n) {
145   this.relPath = rp;
146   this.fName = n;
147 }
148