/*
|
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 Meldung(tx) {
|
this.mtext = tx;
|
}
|
|
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 (app.modus == 'kacheln') {
|
if (self.fr.isDirectory) {
|
return 'icon-folder ordner';
|
} else {
|
return 'icon-doc-text-inv datei';
|
}
|
} else {
|
if (self.fr.isDirectory) {
|
return 'icon-folder ordner';
|
} else {
|
return 'icon-doc-text-inv 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 app.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 = app.fm_get_path(app.userid);
|
var imgurl = app.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 = app.fm_get_path(app.userid);
|
var imgurl = app.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);
|
}
|
|
};
|
|
this.fileDate = function () {
|
return moment(self.fr.lastModified).format("YYYY-MM-DD-hh-mm-ss-SSS");
|
};
|
|
this.fileSize = function () {
|
return numeral(self.fr.length).format("0.00 b");
|
};
|
}
|
|
function BcrFiles(fl) {
|
this.files = fl;
|
}
|
|
function BcrFile(rp, n) {
|
this.relPath = rp;
|
this.fName = n;
|
}
|