Dateiverwaltung für die WebBox
ulrich
2017-08-05 76660f9ecd53c1a6f41433c0e68ba73b507a6d39
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   
76660f 82   this.dia = function() {
U 83     return fm_slideshow;
84   };
85   
2f9e6f 86   this.miniurl = function() {
U 87       var userid = $('#userMenu').text();
630c3f 88       if(self.fext === '') {
U 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         }
2f9e6f 96       }
U 97       var path = fm_get_path(userid);
630c3f 98       var imgurl = loc + path + '/' + self.fnx + '_tn' + self.fext;
2f9e6f 99       return imgurl;
U 100     
101   };
102   
630c3f 103   this.bildurl = function() {
U 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   
2f9e6f 119   this.fileName = function() {
U 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