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