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