Dateiverwaltung für die WebBox
ulrich
2017-08-03 630c3f3cb7bf2679e7a96a9bc9c076ea350a13eb
commit | author | age
2f9e6f 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;
630c3f 50   this.fext = '';
2f9e6f 51   
U 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 || self.fnx.indexOf('.gif') > -1 || self.fnx.indexOf('.jpeg') > -1) {
77       miniatur = true;
78     }
79     return miniatur;
80   };
81   
82   this.miniurl = function() {
83       var userid = $('#userMenu').text();
630c3f 84       if(self.fext === '') {
U 85         //self.fext = '';
86         var dotpos = self.fnx.indexOf('.');
87         if(dotpos > -1) {
88           var fny = self.fnx;
89           self.fnx = self.fnx.substring(0, dotpos);
90           self.fext = fny.substr(dotpos);
91         }
2f9e6f 92       }
U 93       var path = fm_get_path(userid);
630c3f 94       var imgurl = loc + path + '/' + self.fnx + '_tn' + self.fext;
2f9e6f 95       return imgurl;
U 96     
97   };
98   
630c3f 99   this.bildurl = function() {
U 100       var userid = $('#userMenu').text();
101       if(self.fext === '') {
102         //self.fext = '';
103         var dotpos = self.fnx.indexOf('.');
104         if(dotpos > -1) {
105           var fny = self.fnx;
106           self.fnx = self.fnx.substring(0, dotpos);
107           self.fext = fny.substr(dotpos);
108         }
109       }
110       var path = fm_get_path(userid);
111       var imgurl = loc + path + '/' + self.fnx + self.fext;
112       return imgurl;
113   };
114   
2f9e6f 115   this.fileName = function() {
U 116     
117     var namen = self.fr.absolutePath.split('/');
118     if(namen.length > 0) {
119       return decodeURIComponent(namen[namen.length - 1]);
120     } else {
121       return decodeURIComponent(self.fr.absolutePath);
122     }
123     
124   };
125 }
126
127 function BcrFiles(fl) {
128   this.files = fl;
129 }
130
131 function BcrFile(rp, n) {
132   this.relPath = rp;
133   this.fName = n;
134 }
135