Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a6b7389201 | ||
|
|
5ccde1e34c | ||
|
|
8e018ad74a | ||
|
|
9e3981a7b1 | ||
|
|
f727a5c44a | ||
|
|
1165918cd6 | ||
|
|
b891d8f516 | ||
|
|
0a3a45107a | ||
|
|
90c5362a57 | ||
|
|
675b9051dc | ||
|
|
e063535127 | ||
|
|
2686af2208 | ||
|
|
81e6a60def | ||
|
|
389a744ebe | ||
|
|
84e73466e1 | ||
|
|
31ba4a0b8b | ||
|
|
dda5e89990 | ||
|
|
6a69bbcaf7 | ||
|
|
577f041928 | ||
|
|
285249254a | ||
|
|
9f9d3c1480 | ||
|
|
9a16ed0480 | ||
|
|
ce740b61ec | ||
|
|
499f0764da | ||
|
|
bac8786ab4 | ||
|
|
6529b1d937 | ||
|
|
2d4850520d | ||
|
|
b1d0a0f095 | ||
|
|
ae5360386a | ||
|
|
85bca37a8c | ||
|
|
a6dd34cf81 | ||
|
|
9eaf71ec3d | ||
|
|
6eb741760f | ||
|
|
3550f1558b | ||
|
|
b62927c28d | ||
|
|
0f06d8fcd7 | ||
|
|
613041d5cb | ||
|
|
783938821c | ||
|
|
1f6261dba0 | ||
|
|
4aa5856fbc | ||
|
|
d003166e33 | ||
|
|
0097de5122 | ||
|
|
5a4faca86f |
No files matched your search
|
After Width: | Height: | Size: 46 KiB |
|
After Width: | Height: | Size: 96 KiB |
|
After Width: | Height: | Size: 131 KiB |
|
After Width: | Height: | Size: 129 KiB |
|
After Width: | Height: | Size: 99 KiB |
|
After Width: | Height: | Size: 599 KiB |
|
After Width: | Height: | Size: 1.8 MiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 165 KiB |
|
After Width: | Height: | Size: 8.0 KiB |
|
After Width: | Height: | Size: 23 KiB |
|
After Width: | Height: | Size: 110 KiB |
|
After Width: | Height: | Size: 43 KiB |
|
After Width: | Height: | Size: 35 KiB |
|
After Width: | Height: | Size: 62 KiB |
|
After Width: | Height: | Size: 7.7 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 59 KiB |
@@ -0,0 +1,361 @@
|
||||
@online{spa:1,
|
||||
author = {t3n},
|
||||
title = {Was ist eigentlich eine Single-Page-Webanwendung?},
|
||||
month = {04},
|
||||
year = {2018},
|
||||
url = {https://t3n.de/news/single-page-webanwendung-1023623/},
|
||||
note = {Zuletzt besucht am 26.02.2019}
|
||||
}
|
||||
|
||||
@online{spa:2,
|
||||
author = {Nebil Aboobacker},
|
||||
title = {Was ist eine Single Page Application (SPA)?},
|
||||
month = {05},
|
||||
year = {2018},
|
||||
url = {https://www.yuhiro.de/was-ist-eine-single-page-application-spa/},
|
||||
note = {Zuletzt besucht am 26.02.2019}
|
||||
}
|
||||
|
||||
@online{vue,
|
||||
author = {Marc Teufel},
|
||||
title = {Vue.js Tutorial: So entwickelt man Komponenten mit Vue.js},
|
||||
month = {07},
|
||||
year = {2018},
|
||||
url = {https://entwickler.de/online/javascript/einfuehrung-vuejs-vue-579851816.html},
|
||||
note = {Zuletzt besucht am 26.02.2019}
|
||||
}
|
||||
|
||||
@online{vue:warum,
|
||||
author = {Verena Sappelt},
|
||||
title = {Vue.js – Vorteile: Das Beste aus zwei Welten},
|
||||
month = {01},
|
||||
year = {2019},
|
||||
url = {https://www.ppw.de/blog/vue-js-vorteile-das-beste-aus-zwei-welten/},
|
||||
note = {Zuletzt besucht am 26.02.2019}
|
||||
}
|
||||
|
||||
@online{vue:router,
|
||||
author = {Said Hayani},
|
||||
title = {How to use routing in Vue.js to create a better user experience},
|
||||
month = {06},
|
||||
year = {2018},
|
||||
url = {https://medium.freecodecamp.org/how-to-use-routing-in-vue-js-to-create-a-better-user-experience-98d225bbcdd9},
|
||||
note = {Zuletzt besucht am 26.02.2019}
|
||||
}
|
||||
|
||||
@online{vue:router2,
|
||||
title = {Vue Router - Getting Started},
|
||||
month = {01},
|
||||
year = {2014},
|
||||
url = {https://router.vuejs.org/guide/#javascript},
|
||||
note = {Zuletzt besucht am 26.02.2019}
|
||||
}
|
||||
|
||||
@online{vue:router3,
|
||||
author = {Raymond Camden},
|
||||
title = {Working with Routes in Vue.js},
|
||||
month = {012},
|
||||
year = {2017},
|
||||
url = {https://www.raymondcamden.com/2017/11/12/working-with-routes-in-vue},
|
||||
note = {Zuletzt besucht am 26.02.2019}
|
||||
}
|
||||
|
||||
@online{api2,
|
||||
author = {Björn Behrendt},
|
||||
title = {Application-Programming-Interface (API)},
|
||||
month = {06},
|
||||
year = {2018},
|
||||
url = {https://www.gruenderszene.de/lexikon/begriffe/application-programming-interface-api?interstitial},
|
||||
note = {Zuletzt besucht am 26.02.2019}
|
||||
}
|
||||
|
||||
@online{scrib,
|
||||
title = {Scribble},
|
||||
month = {08},
|
||||
year = {2017},
|
||||
url = {https://de.wikipedia.org/wiki/Scribble},
|
||||
note = {Zuletzt besucht am 26.02.2019}
|
||||
}
|
||||
|
||||
@online{md,
|
||||
title = {Material Design},
|
||||
month = {01},
|
||||
year = {2019},
|
||||
url = {https://de.wikipedia.org/wiki/Material_Design},
|
||||
note = {Zuletzt besucht am 26.02.2019}
|
||||
}
|
||||
|
||||
@online{md2,
|
||||
author = {Google},
|
||||
title = {Homepage Material Design},
|
||||
url = {https://material.io},
|
||||
note = {(o.D.), Zuletzt besucht am 26.02.2019}
|
||||
}
|
||||
|
||||
@online{bootstrap,
|
||||
author = {Federico Zivolo and Bootstrap contributors},
|
||||
title = {Bootstrap Material Design},
|
||||
month = {08},
|
||||
year = {2018},
|
||||
url = {https://fezvrasta.github.io/bootstrap-material-design/},
|
||||
note = {Zuletzt besucht am 26.02.2019}
|
||||
}
|
||||
|
||||
@online{less,
|
||||
author = {Alexis Sellier },
|
||||
title = {LESS - Die dynamische Stylesheet Sprache},
|
||||
month = {01},
|
||||
year = {2013},
|
||||
url = {http://www.lesscss.de},
|
||||
note = {Zuletzt besucht am 26.02.2019}
|
||||
}
|
||||
|
||||
@online{ajax1,
|
||||
author = {Jesse James Garret},
|
||||
title = {Ajax: A New Approach to Web Applications},
|
||||
month = {07},
|
||||
year = {2008},
|
||||
url = {https://web.archive.org/web/20080702075113/http://www.adaptivepath.com/ideas/essays/archives/000385.php},
|
||||
note = {Zuletzt besucht am 26.02.2019}
|
||||
}
|
||||
|
||||
@online{ajax2,
|
||||
author = {Matthias Hertel},
|
||||
title = {The AJAX Engine},
|
||||
month = {02},
|
||||
year = {2007},
|
||||
url = {http://www.mathertel.de/AJAXEngine/#view=Home},
|
||||
note = {Zuletzt besucht am 26.02.2019}
|
||||
}
|
||||
|
||||
|
||||
@book{ajax3,
|
||||
author = {David Sawyer McFarland},
|
||||
title = {JavaScript \& jQuery - the missing manual},
|
||||
year = {2012},
|
||||
publisher = {O'Reilly Media, inc.},
|
||||
address = {1005 Gravenstein Highway North, Sebastopol, CA 95472},
|
||||
}
|
||||
|
||||
@online{api,
|
||||
title = {Programmierschnittstelle},
|
||||
month = {02},
|
||||
year = {2019},
|
||||
url = {https://de.wikipedia.org/wiki/Programmierschnittstelle},
|
||||
note = {Zuletzt besucht am 26.02.2019}
|
||||
}
|
||||
|
||||
@online{rest,
|
||||
author = {Thomas Bayer},
|
||||
title = {REST Web Services},
|
||||
month = {11},
|
||||
year = {2002},
|
||||
url = {https://www.oio.de/public/xml/rest-webservices.htm},
|
||||
note = {Zuletzt besucht am 26.02.2019}
|
||||
}
|
||||
|
||||
@online{mongo,
|
||||
title = {What is MongoDB?},
|
||||
year = {2019},
|
||||
url = {https://www.mongodb.com/what-is-mongodb},
|
||||
note = {Zuletzt besucht am 26.02.2019}
|
||||
}
|
||||
|
||||
|
||||
@online{mongoose,
|
||||
author = {Nick Karnik},
|
||||
title = {Introduction to Mongoose for MongoDB},
|
||||
month = {02},
|
||||
year = {2018},
|
||||
url = {https://medium.freecodecamp.org/introduction-to-mongoose-for-mongodb-d2a7aa593c57},
|
||||
note = {Zuletzt besucht am 26.02.2019}
|
||||
}
|
||||
|
||||
@online{Bear,
|
||||
author = {Sevilleja, Chris},
|
||||
month = {02},
|
||||
year = {2019},
|
||||
title = {Build a RESTful API Using Node and Express 4},
|
||||
url = {https://scotch.io/tutorials/build-a-restful-api-using-node-and-express-4},
|
||||
note = {Zuletzt besucht am 01.03.219}
|
||||
}
|
||||
|
||||
|
||||
@online{gitefi,
|
||||
author = {Matthias Hopf},
|
||||
month = {02},
|
||||
year = {2019},
|
||||
title = {Git efi},
|
||||
url = {https://git.efi.th-nuernberg.de/gitea/hopfma/om/wiki/_pages},
|
||||
note = {Zuletzt besucht am 25.02.2019}
|
||||
}
|
||||
|
||||
|
||||
@online{Powtoon,
|
||||
title = {Powtoon - Brings Awesomeness to your presentations},
|
||||
month = {02},
|
||||
year = {2019},
|
||||
url = {https://www.powtoon.com/my-powtoons/#/},
|
||||
note = {Zuletzt besucht am 01.03.219}
|
||||
}
|
||||
|
||||
|
||||
@online{Risingstack,
|
||||
author = {Gergely Nemeth},
|
||||
year = {2017},
|
||||
title = {10 Best Practices for Writing Node.js REST APIs | @RisingStack},
|
||||
url = {https://blog.risingstack.com/10-best-practices-for-writing-node-js-rest-apis/},
|
||||
note = {Zuletzt besucht am 01.03.2019}
|
||||
}
|
||||
|
||||
@online{trello:uri,
|
||||
author = {ATLASSIAN},
|
||||
title = {Trello},
|
||||
year = {2019},
|
||||
url = {https://trello.com/home},
|
||||
note = {(Zuletzt besucht am 25.02.2019)}
|
||||
}
|
||||
@online{trello:price,
|
||||
author = {ATLASSIAN},
|
||||
title = {Trello-Preisliste},
|
||||
year = {2019},
|
||||
url = {https://trello.com/pricing},
|
||||
note = {(Zuletzt besucht am 25.02.2019)}
|
||||
}
|
||||
|
||||
@online{bitrix:uri,
|
||||
author = {Bitrix, Inc.},
|
||||
title = {Führende Kostenlose Plattform Für Kommunikation Und Zusammenarbeit Mit Aufgaben, Projekten, CRM, Dokumenten, Chat u.v.a.m.},
|
||||
year = {2019},
|
||||
url = {https://www.bitrix24.de/},
|
||||
note = {(Zuletzt besucht am 25.02.2019)}
|
||||
}
|
||||
@online{bitrix:feature,
|
||||
author = {Bitrix, Inc.},
|
||||
title = {Bitrix24: Führende kostenlose Software zum Projektmanagement},
|
||||
year = {2019},
|
||||
url = {https://www.bitrix24.de/tools/tasks_and_projects/},
|
||||
note = {(Zuletzt besucht am 25.02.2019)}
|
||||
}
|
||||
|
||||
@online{sw:staleWhileRevalidate,
|
||||
author = {Jake Archibald},
|
||||
title = {The offline cookbook - JakeArchibald.com},
|
||||
month = {12},
|
||||
year = {2014},
|
||||
url = {https://jakearchibald.com/2014/offline-cookbook/#stale-while-revalidate},
|
||||
note = {(Zuletzt besucht am 26.02.2019)}
|
||||
}
|
||||
|
||||
@online{sw:cacheBackToNetwork,
|
||||
author = {Jake Archibald},
|
||||
title = {The offline cookbook - JakeArchibald.com},
|
||||
month = {12},
|
||||
year = {2014},
|
||||
url = {https://jakearchibald.com/2014/offline-cookbook/#cache-falling-back-to-network},
|
||||
note = {(Zuletzt besucht am 26.02.2019)}
|
||||
}
|
||||
|
||||
@online{sw:networkBackToCache,
|
||||
author = {Jake Archibald},
|
||||
title = {The offline cookbook - JakeArchibald.com},
|
||||
month = {12},
|
||||
year = {2014},
|
||||
url = {https://jakearchibald.com/2014/offline-cookbook/#network-falling-back-to-cache},
|
||||
note = {(Zuletzt besucht am 26.02.2019)}
|
||||
}
|
||||
|
||||
@online{sw:cacheThenNetwork,
|
||||
author = {Jake Archibald},
|
||||
title = {The offline cookbook - JakeArchibald.com},
|
||||
month = {12},
|
||||
year = {2014},
|
||||
url = {https://jakearchibald.com/2014/offline-cookbook/#cache-then-network},
|
||||
note = {(Zuletzt besucht am 26.02.2019)}
|
||||
}
|
||||
|
||||
@online{api:doku,
|
||||
author = {Erik Römmelt},
|
||||
title = {Build, Collaborate \& Integrate APIs | SwaggerHub - OHM News API},
|
||||
month = {02},
|
||||
year = {2019},
|
||||
url = {https://app.swaggerhub.com/apis-docs/roemmelter/om_api/1.0},
|
||||
note = {(Zuletzt besucht am 26.02.2019)}
|
||||
}
|
||||
|
||||
@online{dev:homescreen,
|
||||
author = {Pete LePage},
|
||||
title = {Your First Progressive Web App | Web Fundamentals | Google Developers},
|
||||
month = {01},
|
||||
year = {2019},
|
||||
url = {https://developers.google.com/web/fundamentals/codelabs/your-first-pwapp/#support_native_integration},
|
||||
note = {(Zuletzt besucht am 26.02.2019)}
|
||||
}
|
||||
|
||||
@online{dev:codeSource,
|
||||
author = {Pete LePage},
|
||||
title = {Your First Progressive Web App | Web Fundamentals | Google Developers},
|
||||
month = {01},
|
||||
year = {2019},
|
||||
url = {https://developers.google.com/web/fundamentals/codelabs/your-first-pwapp/},
|
||||
note = {(Zuletzt besucht am 26.02.2019)}
|
||||
}
|
||||
|
||||
%Senta:
|
||||
@online{q1,
|
||||
author = {Rafael Beraldo},
|
||||
title = {Buefy Autocomplete},
|
||||
year = {2019},
|
||||
url = {https://buefy.org/documentation/autocomplete/},
|
||||
note = {Zuletzt besucht am 07.08.2019}
|
||||
}
|
||||
|
||||
@online{q2,
|
||||
author = {MongoDB,Inc},
|
||||
title = {Mongodb Manual Text Index},
|
||||
year = {2019},
|
||||
url = {https://docs.mongodb.com/manual/core/index-text/},
|
||||
note = {Zuletzt besucht am 07.08.2019}
|
||||
}
|
||||
|
||||
@online{q3,
|
||||
author = {MongoDB,Inc},
|
||||
title = {Mongodb Manual Text Search},
|
||||
year = {2019},
|
||||
url = {https://docs.mongodb.com/manual/text-search/},
|
||||
note = {Zuletzt besucht am 07.08.2019}
|
||||
}
|
||||
|
||||
@book{q4,
|
||||
title = {JavaScript \& jQuery - the missing manual},
|
||||
author = {D. S. McFarland},
|
||||
year = {2012},
|
||||
publisher = {O’Reilly Media, inc.}
|
||||
}
|
||||
%Edwina:
|
||||
@online{vuetify,
|
||||
author = {Vuetify},
|
||||
title = {Why Vuetify?},
|
||||
year = {2016-2019},
|
||||
url = {https://vuetifyjs.com/en/getting-started/why-vuetify},
|
||||
note = {Zuletzt besucht am 07.08.2019}
|
||||
}
|
||||
|
||||
@online{buefy,
|
||||
author = {Stackshare},
|
||||
title = {Buefy vs. Vuetify},
|
||||
year = {2019},
|
||||
url = {https://stackshare.io/stackups/buefy-vs-vuetify},
|
||||
note = {Zuletzt besucht am 07.08.2019}
|
||||
}
|
||||
|
||||
@online{bulma,
|
||||
author = {Wikipedia},
|
||||
title = {Bulma (Framework)},
|
||||
day = {23},
|
||||
month = {05},
|
||||
year = {2019},
|
||||
url = {https://de.wikipedia.org/wiki/Bulma_(Framework)},
|
||||
note = {Zuletzt besucht am 07.08.2019}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
var db = db.getSiblingDB('omdb');
|
||||
|
||||
// Insert data in collections
|
||||
load('mong_msg.js');
|
||||
load('mong_tag.js');
|
||||
load('mong_usr.js');
|
||||
var db = db.getSiblingDB('om');
|
||||
|
||||
// Delete all collections + all records
|
||||
//db.messages.drop(); db.tags.drop(); db.user.drop(); db.sessions.drop()
|
||||
//db.messages.deleteMany({});
|
||||
//db.tags.deleteMany({});
|
||||
//db.users.deleteMany({});
|
||||
//db.sessions.deleteMany({});
|
||||
|
||||
// Insert data in collections
|
||||
//load('mong_msg.js');
|
||||
load('mong_tag.js');
|
||||
load('mong_usr.js');
|
||||
|
||||
// Print all collections + records count
|
||||
var collections = db.getCollectionNames();
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
db.tags.insert([
|
||||
{"name":"Lorem"},{"name":"fugiat"},{"name":"aliqua"},{"name":"consequat"},{"name":"mollit"},{"name":"aet"},{"name":"consectetur"},{"name":"dolore"},{"name":"nulla"},{"name":"tempor"},{"name":"veniam"},{"name":"ipsum"},{"name":"adipisicing"},{"name":"qui"},{"name":"sint"},{"name":"ullamco"},{"name":"incididunt"},{"name":"nisi"},{"name":"sit"},{"name":"minim"},{"name":"labore"},{"name":"sunt"},{"name":"in"}
|
||||
{"name":"efi"},{"name":"wichtig"},{"name":"Wintersemester19/20"},{"name":"Rückmeldung"},{"name":"bme6"},{"name":"Mkz"},{"name":"Freizeit"},{"name":"Prüfungsanmeldung"},{"name":"THNürnberg"},{"name":"Prüfung"},{"name":"Stundenplan"}
|
||||
])
|
||||
@@ -1,8 +1,8 @@
|
||||
db.user.insert([
|
||||
// author,OHMNEWS2019
|
||||
{"_id":"author","name":"Test Author","type":"author","roles":["user","author"],"hash":"sha256","salt":"cy5CkPrplcEze6o4psURhw==","pwd":"Gc8ozlxjEGITkS+fW9tz2xLROzws44s04EOCWuP04qE=","tags":["wichtig","th"],"bookmarks":["th"],},
|
||||
// admin,oZuse1
|
||||
{"_id":"admin","name":"Test Admin","type":"admin","roles":["user","author","admin"],"hash":"sha256","salt":"PoIUHbDp7tP34ji31iQ0zw==","pwd":"mJpIfIksYs6LJJwYRBemFKqR6TacsSl2E0ZtpO1GMuk=","tags":["wichtig","th"],"bookmarks":["wichtig"],},
|
||||
db.users.insert([
|
||||
// User: author, Pwd: author
|
||||
{"_id":"author","name":"Author","type":"PF@EFI;","roles":{"user":true,"author":true},"hash":"sha256","salt":"SIzKNsNKsCRVr8a9U90q6A==","pwd":"HZly68TSAKHioz6Kz0QCbXVTHpT6hMmabUbFYVlCMeE=","abos":[],"bookmarks":[]},
|
||||
// User: admin, Pwd: SwenMho
|
||||
// {"_id":"admin","name":"Test Admin","type":"MA@AMP;","roles":'{"user":true,"author":true,"admin":true}',"hash":"sha256","salt":"z3PNXGmQaWvaT7m2ZlT+0w==","pwd":"nfUfNv032J745xj3Hzya3Mkk43Dz/H0BmNTZhtx8UM0=","abos":["veniam","ipsum"],"bookmarks":[],},
|
||||
])
|
||||
|
||||
//var c = require('./server/crypto.js'),
|
||||
|
||||
@@ -26,4 +26,4 @@ return t(n),n},o.thru=function(n,t){return t(n)},o.toArray=function(n){return M(
|
||||
},o.isDate=function(n){return H(n)&&"[object Date]"==hn.call(n)},o.isEmpty=function(t){return M(t)&&(Nn(t)||L(t)||U(t.splice)||n(t))?!t.length:!_n(t).length},o.isEqual=function(n,t){return b(n,t)},o.isFinite=function(n){return typeof n=="number"&&gn(n)},o.isFunction=U,o.isNaN=function(n){return K(n)&&n!=+n},o.isNull=function(n){return null===n},o.isNumber=K,o.isObject=V,o.isRegExp=function(n){return H(n)&&"[object RegExp]"==hn.call(n)},o.isString=L,o.isUndefined=function(n){return n===Z},o.last=function(n){
|
||||
var t=null==n?0:n.length;return t?n[t-1]:Z},o.max=function(n){return n&&n.length?a(n,X,v):Z},o.min=function(n){return n&&n.length?a(n,X,_):Z},o.noConflict=function(){return on._===this&&(on._=vn),this},o.noop=function(){},o.reduce=C,o.result=function(n,t,r){return t=null==n?Z:n[t],t===Z&&(t=r),U(t)?t.call(n):t},o.size=function(n){return null==n?0:(n=M(n)?n:_n(n),n.length)},o.some=function(n,t,r){return t=r?Z:t,E(n,g(t))},o.uniqueId=function(n){var t=++sn;return Q(n)+t},o.each=z,o.first=q,Y(o,function(){
|
||||
var n={};return s(o,function(t,r){pn.call(o.prototype,r)||(n[r]=t)}),n}(),{chain:false}),o.VERSION="4.17.15",mn("pop join replace reverse split push shift sort splice unshift".split(" "),function(n){var t=(/^(?:replace|split)$/.test(n)?String.prototype:an)[n],r=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",e=/^(?:pop|join|replace|shift)$/.test(n);o.prototype[n]=function(){var n=arguments;if(e&&!this.__chain__){var u=this.value();return t.apply(Nn(u)?u:[],n)}return this[r](function(r){return t.apply(Nn(r)?r:[],n);
|
||||
})}}),o.prototype.toJSON=o.prototype.valueOf=o.prototype.value=function(){return w(this.__wrapped__,this.__actions__)},typeof define=="function"&&typeof define.amd=="object"&&define.amd?(on._=o, define(function(){return o})):cn?((cn.exports=o)._=o,un._=o):on._=o}).call(this);
|
||||
})}}),o.prototype.toJSON=o.prototype.valueOf=o.prototype.value=function(){return w(this.__wrapped__,this.__actions__)},typeof define=="function"&&typeof define.amd=="object"&&define.amd?(on._=o, define(function(){return o})):cn?((cn.exports=o)._=o,un._=o):on._=o}).call(this);
|
||||
@@ -1 +1 @@
|
||||
module.exports = require('./lodash');
|
||||
module.exports = require('./lodash');
|
||||
@@ -134,4 +134,4 @@ return!i&&s?(o=c?o:new Un(this),o=n.apply(o,f),o.__actions__.push({func:Qe,args:
|
||||
n.__dir__=-1,n.__filtered__=true}else n=this.clone(),n.__dir__*=-1;return n},Un.prototype.value=function(){var n,t=this.__wrapped__.value(),r=this.__dir__,e=ff(t),u=0>r,i=e?t.length:0;n=i;for(var o=this.__views__,f=0,c=-1,a=o.length;++c<a;){var l=o[c],s=l.size;switch(l.type){case"drop":f+=s;break;case"dropRight":n-=s;break;case"take":n=Ci(n,f+s);break;case"takeRight":f=Ui(f,n-s)}}if(n={start:f,end:n},o=n.start,f=n.end,n=f-o,o=u?f:o-1,f=this.__iteratees__,c=f.length,a=0,l=Ci(n,this.__takeCount__),!e||!u&&i==n&&l==n)return wr(t,this.__actions__);
|
||||
e=[];n:for(;n--&&a<l;){for(o+=r,u=-1,i=t[o];++u<c;){var h=f[u],s=h.type,h=(0,h.iteratee)(i);if(2==s)i=h;else if(!h){if(1==s)continue n;break n}}e[a++]=i}return e},An.prototype.at=To,An.prototype.chain=function(){return Ye(this)},An.prototype.commit=function(){return new On(this.value(),this.__chain__)},An.prototype.next=function(){this.__values__===T&&(this.__values__=mu(this.value()));var n=this.__index__>=this.__values__.length;return{done:n,value:n?T:this.__values__[this.__index__++]}},An.prototype.plant=function(n){
|
||||
for(var t,r=this;r instanceof En;){var e=Fe(r);e.__index__=0,e.__values__=T,t?u.__wrapped__=e:t=e;var u=e,r=r.__wrapped__}return u.__wrapped__=n,t},An.prototype.reverse=function(){var n=this.__wrapped__;return n instanceof Un?(this.__actions__.length&&(n=new Un(this)),n=n.reverse(),n.__actions__.push({func:Qe,args:[Ge],thisArg:T}),new On(n,this.__chain__)):this.thru(Ge)},An.prototype.toJSON=An.prototype.valueOf=An.prototype.value=function(){return wr(this.__wrapped__,this.__actions__)},An.prototype.first=An.prototype.head,
|
||||
wi&&(An.prototype[wi]=Xe),An}();typeof define=="function"&&typeof define.amd=="object"&&define.amd?($n._=rt, define(function(){return rt})):Nn?((Nn.exports=rt)._=rt,Fn._=rt):$n._=rt}).call(this);
|
||||
wi&&(An.prototype[wi]=Xe),An}();typeof define=="function"&&typeof define.amd=="object"&&define.amd?($n._=rt, define(function(){return rt})):Nn?((Nn.exports=rt)._=rt,Fn._=rt):$n._=rt}).call(this);
|
||||
@@ -69,6 +69,7 @@
|
||||
<script src="lib/jquery-3.3.1.min.js"></script>
|
||||
|
||||
<!-- NOTE: Include .js Routes -->
|
||||
<script src="routes/initGlobals.js"></script>
|
||||
<script src="routes/auth.js"></script><!-- Must load before profile.js -->
|
||||
<script src="routes/home.js"></script>
|
||||
<script src="routes/files.js"></script>
|
||||
@@ -76,9 +77,6 @@
|
||||
<script src="routes/bookmark.js"></script>
|
||||
<script src="routes/profil.js"></script>
|
||||
<script src="routes/msgCard.js"></script>
|
||||
<script src="routes/messageData.js"></script>
|
||||
<script src="routes/tagData.js"></script>
|
||||
<script src="routes/majorData.js"></script>
|
||||
<script src="routes/profilCard.js"></script>
|
||||
<script src="routes/navRoutes.js"></script>
|
||||
<script src="search.js"></script>
|
||||
@@ -89,14 +87,14 @@
|
||||
<div class="om-header">
|
||||
<a class="logo-img is-hidden-desktop" href="index.html"><img src="img/app_icon.png" width=45px height=45px></a>
|
||||
<a class="logo-img is-hidden-touch" href="index.html"><img src="img/app_icon_desk.png" width=100px height=100px></a>
|
||||
<search></search>
|
||||
<search :key="vueRender.search"></search>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="om-content">
|
||||
<div id=xxx></div>
|
||||
<nav-router></nav-router>
|
||||
<router-view :key="auth.user"></router-view>
|
||||
<nav-router :key="auth.user"></nav-router>
|
||||
<router-view :key="vueRender.key"></router-view>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -104,22 +102,14 @@
|
||||
new Vue({
|
||||
router,
|
||||
el: '#api',
|
||||
components: {
|
||||
// Locally registered components
|
||||
},
|
||||
data: {
|
||||
// Locally registered variables
|
||||
vueRender : vueRender,
|
||||
auth: auth,
|
||||
},
|
||||
computed:{
|
||||
// Methods to change data appearance, does cache results
|
||||
},
|
||||
methods: {
|
||||
// Methods to change data content, run always again
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
<!-- NOTE: Call SW registration -->
|
||||
<script src="registerSW.js"></script>
|
||||
|
||||
|
||||
@@ -4148,7 +4148,7 @@ a.list-item {
|
||||
font-size: 1.5rem; }
|
||||
|
||||
.menu-list {
|
||||
line-height: 1.25;
|
||||
line-height: 1.5;
|
||||
float: left;
|
||||
width: 230px;
|
||||
height: 100%;
|
||||
@@ -4161,6 +4161,7 @@ a.list-item {
|
||||
color: white; }
|
||||
.menu-list a {
|
||||
border-radius: 2px;
|
||||
padding-bottom: 5px;
|
||||
display: block;
|
||||
padding: 0.5em 0.75em;
|
||||
background-color: #0046a0;
|
||||
@@ -4176,9 +4177,8 @@ a.list-item {
|
||||
margin: 0.75em;
|
||||
padding-left: 0.75em;
|
||||
background-color: #0046a0; }
|
||||
.menu-item li a {
|
||||
display: block;
|
||||
padding: 8px 16px;
|
||||
.menu-item li {
|
||||
line-height: 1.5;
|
||||
text-decoration: none;
|
||||
color: white;
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
var auth = {};
|
||||
|
||||
function clearAuthState() {
|
||||
auth.user = ''; // Login name
|
||||
auth.name = ''; // Full name
|
||||
auth.type = ''; // type of login (domain specific)
|
||||
auth.mail = ''; // Full mail address
|
||||
auth.type = ''; // type of login (domain specific)
|
||||
auth.roles = {}; // Role authorizations e.g. {user: true}
|
||||
auth.gender = ''; // Gender (e.g. Frau)
|
||||
auth.abos = []; // Followed tags
|
||||
auth.bookmarks = []; // Ids of bookmarks
|
||||
}
|
||||
clearAuthState();
|
||||
|
||||
@@ -20,6 +20,33 @@ function fillAuthState(state) {
|
||||
}
|
||||
}
|
||||
|
||||
function updateUserInDB() {
|
||||
$.ajax({
|
||||
url: "api/usr",
|
||||
data: {
|
||||
_id: auth.user,
|
||||
name: auth.name,
|
||||
mail: auth.mail,
|
||||
type: auth.type,
|
||||
gender: auth.gender,
|
||||
roles: JSON.stringify(auth.roles),
|
||||
abos: JSON.stringify(auth.abos),
|
||||
bookmarks: JSON.stringify(auth.bookmarks),
|
||||
},
|
||||
method: "PUT"
|
||||
}).done(successful_save).fail(failed_save);
|
||||
|
||||
function successful_save(res) {
|
||||
console.info("User-save: Successful.");
|
||||
console.info(res);
|
||||
}
|
||||
|
||||
function failed_save(err) {
|
||||
console.info("User-save: Failed.");
|
||||
console.error(err);
|
||||
}
|
||||
}
|
||||
|
||||
// Login component: Login panel (if not logged in) or Logout element (if logged in)
|
||||
Vue.component('login-panel', {
|
||||
template: `
|
||||
@@ -48,7 +75,7 @@ Vue.component('login-panel', {
|
||||
</b-input>
|
||||
</b-field>
|
||||
<b-checkbox>Eingeloggt bleiben</b-checkbox>
|
||||
<div v-if="error" style="color:red;"> Versuche es nochmal.</div>
|
||||
<div v-if="error" :key="error" style="color:red;"> Versuche es nochmal.</div>
|
||||
</section>
|
||||
<footer class="modal-card-foot">
|
||||
<button class="button" type="button" @click.prevent="$parent.close()">Close</button>
|
||||
@@ -57,16 +84,16 @@ Vue.component('login-panel', {
|
||||
</div>`,
|
||||
data: function () {
|
||||
return {
|
||||
auth: auth,
|
||||
user: '',
|
||||
pwd: '',
|
||||
error: false,
|
||||
};
|
||||
},
|
||||
// TODO: Check if enough for session cookie re-login; checkbox
|
||||
// mounted: function() {
|
||||
// this.checkData();
|
||||
// },
|
||||
// Doesn't work
|
||||
beforeMount: function() {
|
||||
this.checkData();
|
||||
},
|
||||
methods: {
|
||||
closeLoginPanel: function() {
|
||||
this.$emit('close-login-panel');
|
||||
@@ -94,6 +121,9 @@ Vue.component('login-panel', {
|
||||
|
||||
function successful_login(resData) {
|
||||
fillAuthState(resData);
|
||||
// updateUserInDB();
|
||||
auth.abos = [];
|
||||
auth.bookmarks = [];
|
||||
console.info("Correct credentials");
|
||||
this.closeLoginPanel;
|
||||
|
||||
@@ -103,7 +133,7 @@ Vue.component('login-panel', {
|
||||
|
||||
function failed_login(err) {
|
||||
console.info("Wrong credentials");
|
||||
this.showError=true;
|
||||
this.error=true;
|
||||
this.showLoginPanel;
|
||||
|
||||
console.log("error: " + err.responseText);
|
||||
@@ -122,6 +152,7 @@ Vue.component('login-panel', {
|
||||
function successful_login(res) {
|
||||
console.info("Re-Auth: Correct credentials");
|
||||
this.closeLoginPanel;
|
||||
vueForceRender('key');
|
||||
|
||||
//console.log(res);
|
||||
router.push('/home')
|
||||
@@ -129,17 +160,11 @@ Vue.component('login-panel', {
|
||||
|
||||
function failed_login(err) {
|
||||
console.info("Re-Auth: Wrong credentials");
|
||||
this.showError=true;
|
||||
this.error=true;
|
||||
this.showLoginPanel;
|
||||
|
||||
console.log("error: " + err.responseText);
|
||||
console.log(err);
|
||||
}
|
||||
},
|
||||
logout: function() {
|
||||
clearAuthState();
|
||||
$.ajax({ url: "api/logout", method: "POST" });
|
||||
this.closeLoginPanel;
|
||||
}
|
||||
},
|
||||
});
|
||||
@@ -1,120 +1,85 @@
|
||||
const BookmarkRouter = {
|
||||
template: `
|
||||
<div class="content">
|
||||
<div class="is-hidden-desktop">
|
||||
<div class="bookmark-headline"><h4>Gepeicherte Beiträge</h4></div>
|
||||
<div class="om-card card">
|
||||
<h6 class="msg-head">
|
||||
<b>Betreff</b>
|
||||
<img src="favicon.ico" width=20px height=20px>
|
||||
</h6>
|
||||
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. <br><br>
|
||||
<a href="#">#beispiel #tag</a>
|
||||
<div class="om-card-footer">
|
||||
<div class="om-user-line">
|
||||
<i class="material-icons">account_circle</i>
|
||||
Erstellt von User 1
|
||||
</div>
|
||||
<i class="material-icons" @click="myFilter" v-if="!isActive">bookmark_border</i>
|
||||
<i class="material-icons" @click="myFilter" v-else="isActive">bookmark</i>
|
||||
</div>
|
||||
</div>
|
||||
<div class="om-card card">
|
||||
<h6 class="msg-head">
|
||||
<b>Betreff</b>
|
||||
<img src="favicon.ico" width=20px height=20px>
|
||||
</h6>
|
||||
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. <br><br>
|
||||
<a href="#">#beispiel #tag</a>
|
||||
<div class="om-card-footer">
|
||||
<div class="om-user-line">
|
||||
<i class="material-icons">account_circle</i>
|
||||
Erstellt von User 2
|
||||
</div>
|
||||
<i class="material-icons" @click="myFilter" v-if="!isActive">bookmark_border</i>
|
||||
<i class="material-icons" @click="myFilter" v-else="isActive">bookmark</i>
|
||||
</div>
|
||||
</div>
|
||||
<div class="om-card card">
|
||||
<h6 class="msg-head">
|
||||
<b>Betreff</b>
|
||||
<img src="favicon.ico" width=20px height=20px>
|
||||
</h6>
|
||||
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. <br><br>
|
||||
<a href="#">#beispiel #tag</a>
|
||||
<div class="om-card-footer">
|
||||
<div class="om-user-line">
|
||||
<i class="material-icons">account_circle</i>
|
||||
Erstellt von User 3
|
||||
</div>
|
||||
<i class="material-icons" @click="myFilter" v-if="!isActive">bookmark_border</i>
|
||||
<i class="material-icons" @click="myFilter" v-else="isActive">bookmark</i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="column is-three-quarters is-pulled-right is-hidden-touch content-desktop">
|
||||
<div class="bookmark-headline"><h4>Gepeicherte Beiträge</h4></div>
|
||||
<div class="om-card card">
|
||||
<h6 class="msg-head">
|
||||
<b>Betreff</b>
|
||||
<img src="favicon.ico" width=20px height=20px>
|
||||
</h6>
|
||||
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. <br><br>
|
||||
<a href="#">#beispiel #tag</a>
|
||||
<div class="om-card-footer">
|
||||
<div class="om-user-line">
|
||||
<i class="material-icons">account_circle</i>
|
||||
Erstellt von User 1
|
||||
</div>
|
||||
<i class="material-icons" @click="myFilter" v-if="!isActive">bookmark_border</i>
|
||||
<i class="material-icons" @click="myFilter" v-else="isActive">bookmark</i>
|
||||
</div>
|
||||
</div>
|
||||
<div class="om-card card">
|
||||
<h6 class="msg-head">
|
||||
<b>Betreff</b>
|
||||
<img src="favicon.ico" width=20px height=20px>
|
||||
</h6>
|
||||
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. <br><br>
|
||||
<a href="#">#beispiel #tag</a>
|
||||
<div class="om-card-footer">
|
||||
<div class="om-user-line">
|
||||
<i class="material-icons">account_circle</i>
|
||||
Erstellt von User 2
|
||||
</div>
|
||||
<i class="material-icons" @click="myFilter" v-if="!isActive">bookmark_border</i>
|
||||
<i class="material-icons" @click="myFilter" v-else="isActive">bookmark</i>
|
||||
</div>
|
||||
</div>
|
||||
<div class="om-card card">
|
||||
<h6 class="msg-head">
|
||||
<b>Betreff</b>
|
||||
<img src="favicon.ico" width=20px height=20px>
|
||||
</h6>
|
||||
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. <br><br>
|
||||
<a href="#">#beispiel #tag</a>
|
||||
<div class="om-card-footer">
|
||||
<div class="om-user-line">
|
||||
<i class="material-icons">account_circle</i>
|
||||
Erstellt von User 3
|
||||
</div>
|
||||
<i class="material-icons" @click="myFilter" v-if="!isActive">bookmark_border</i>
|
||||
<i class="material-icons" @click="myFilter" v-else="isActive">bookmark</i>
|
||||
</div>
|
||||
</div>
|
||||
<div id="om-msg-cards" class="column pull-right-sm is-four-fifths-desktop">
|
||||
<h3>Gespeicherte Nachrichten </h3>
|
||||
<MsgCard
|
||||
v-for="id in msgDisplay"
|
||||
:key="id"
|
||||
:msg="messages[id] || {}"
|
||||
:isBookmark="bookmarkArray[id]"
|
||||
></MsgCard>
|
||||
</div>
|
||||
</div>`,
|
||||
|
||||
data: function () {
|
||||
return {
|
||||
messagelist: _messagelist,
|
||||
messages: _messages,
|
||||
isActive: false,
|
||||
isActive: true,
|
||||
messageId: '',
|
||||
bookmarkArray: auth.bookmarks,
|
||||
}
|
||||
},
|
||||
computed:{
|
||||
msgDisplay: function(){
|
||||
return (this.messagelist.slice().reverse());
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
myFilter () {
|
||||
myFilter: function() {
|
||||
this.isActive = !this.isActive;
|
||||
},
|
||||
getMessageId: function(){
|
||||
|
||||
},
|
||||
getMessages: function(){
|
||||
var arr = auth.bookmarks;
|
||||
console.log("arr: "+arr+" auth.bookmarks: "+auth.bookmarks);
|
||||
_messagelist.splice(0, _messagelist.length);
|
||||
_messagelist.push.apply(_messagelist, arr);
|
||||
for (var e in arr) {
|
||||
if (!_messages[arr[e]]) {
|
||||
//arr[e] =arr[e].replace(/\[/g, '').replace(/\"/g, '').replace(/\]/g, '')
|
||||
console.log("getinsertmessage: "+ arr[e]);
|
||||
get_insert_message(arr[e]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*var _usrid = auth.user;
|
||||
$.ajax({
|
||||
url: "api/usr/id/" + _usrid,
|
||||
method: "GET"
|
||||
})
|
||||
.done(have_result).fail(have_error);
|
||||
|
||||
function have_result(res) {
|
||||
var str = JSON.stringify(res[0].bookmarks).split(",");
|
||||
_messagelist.splice(0, _messagelist.length);
|
||||
for (var e in str) {
|
||||
if (!_messages[str[e]]) {
|
||||
str[e] =str[e].replace(/\[/g, '').replace(/\"/g, '').replace(/\]/g, '')
|
||||
get_insert_message(str[e]);
|
||||
}
|
||||
}
|
||||
_messagelist.push.apply(_messagelist, str);
|
||||
//console.log("bookmark str: "+str);
|
||||
}
|
||||
|
||||
function have_error(err) {
|
||||
console.log("error: " + err.responseText);
|
||||
console.log(err);
|
||||
}*/
|
||||
}
|
||||
},
|
||||
beforeMount: function(){
|
||||
|
||||
},
|
||||
mounted: function (){
|
||||
this.getMessages();
|
||||
},
|
||||
|
||||
};
|
||||
@@ -1,19 +1,14 @@
|
||||
var tagArray = [];
|
||||
const data=[
|
||||
'th',
|
||||
'efi',
|
||||
'wichtig',
|
||||
];
|
||||
const CreateMsgRouter = {
|
||||
template: `
|
||||
<div class="content">
|
||||
<div class="is-hidden-desktop">
|
||||
<div id="mobile" class="content card om-card">
|
||||
<div class="column pull-right-sm is-four-fifths-desktop">
|
||||
<div id="mobile" class="om-card card">
|
||||
<h4>Neue Nachricht erstellen</h4>
|
||||
<b-field>
|
||||
<b-input placeholder="User" id="user"></b-input>
|
||||
</b-field>
|
||||
<!--<b-field>
|
||||
<b-input placeholder="User" id="user"></b-input>
|
||||
</b-field>-->
|
||||
|
||||
<label class="label">{{ userName }}</label>
|
||||
<b-field>
|
||||
<b-input placeholder="Betreff" id="subject"></b-input>
|
||||
</b-field>
|
||||
@@ -22,12 +17,12 @@ const CreateMsgRouter = {
|
||||
<b-taginput
|
||||
id="tag"
|
||||
v-model="selected"
|
||||
:data=taglist
|
||||
:data="filteredDataArray"
|
||||
autocomplete
|
||||
allow-new:false
|
||||
icon="label"
|
||||
placeholder="#"
|
||||
@typing="getFilteredTags"
|
||||
|
||||
@input="saveTagsToArray">
|
||||
</b-taginput>
|
||||
</b-field>
|
||||
@@ -40,40 +35,6 @@ const CreateMsgRouter = {
|
||||
<b-button type="is-primary" @click="createMsg">SENDEN</b-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="column is-three-quarters is-pulled-right is-hidden-touch content-desktop">
|
||||
<div id="desktop" class="content">
|
||||
<h4>Neue Nachricht erstellen</h4>
|
||||
<b-field>
|
||||
<b-input placeholder="User" id="user"></b-input>
|
||||
</b-field>
|
||||
|
||||
<b-field>
|
||||
<b-input placeholder="Betreff" id="subject"></b-input>
|
||||
</b-field>
|
||||
|
||||
<b-field label="Tags">
|
||||
<b-taginput
|
||||
id="tag"
|
||||
v-model="selected"
|
||||
:data=taglist
|
||||
autocomplete
|
||||
allow-new:false
|
||||
icon="label"
|
||||
placeholder="#"
|
||||
@typing="getFilteredTags"
|
||||
@input="saveTagsToArray">
|
||||
</b-taginput>
|
||||
</b-field>
|
||||
|
||||
<b-field>
|
||||
<b-input placeholder="Nachricht" id="message" type="textarea"></b-input>
|
||||
</b-field>
|
||||
|
||||
<b-button @click="$router.go(-1)">ABBRECHEN</b-button>
|
||||
<b-button type="is-primary" @click="createMsg">SENDEN</b-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>`,
|
||||
|
||||
data: function () {
|
||||
@@ -81,19 +42,44 @@ const CreateMsgRouter = {
|
||||
auth: auth,
|
||||
isDisabled: false,
|
||||
selected: [],
|
||||
searchtext : "",
|
||||
taglist: data,
|
||||
};
|
||||
},
|
||||
computed:{
|
||||
filteredDataArray: function() {
|
||||
return this.taglist.filter((option) => {
|
||||
return option
|
||||
.toString()
|
||||
.toLowerCase()
|
||||
.indexOf(this.searchtext.toLowerCase()) >= 0
|
||||
})
|
||||
},
|
||||
userName: function() {
|
||||
return 'User: '+auth.name;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
saveTagsToArray: function() {
|
||||
tagArray = this.selected;
|
||||
tagArray = this.selected;
|
||||
console.info(tagArray);
|
||||
},
|
||||
createMsg: function () {
|
||||
var _subject = $("#subject").val();
|
||||
var _message = $("#message").val();
|
||||
var _tag = tagArray;
|
||||
var _user = auth.name ? auth.name : $("#user").val();
|
||||
var tmpArr = [];
|
||||
tagArray.forEach(function(tag) {
|
||||
console.info(tag);
|
||||
tmpArr.push(tag.replace(/#/g, ''));
|
||||
});
|
||||
tagArray = tmpArr;
|
||||
var _tag = tagArray;
|
||||
var _user = auth.name.split(' ');
|
||||
if (_user.length < 2) {
|
||||
_user = _user[0];
|
||||
} else {
|
||||
_user = _user[1] + ', ' + _user[0];
|
||||
}
|
||||
//console.log("Message Created: " + _tag + " " + _message + " " + _user);
|
||||
$.ajax({
|
||||
url: "api/msg",
|
||||
@@ -125,9 +111,11 @@ const CreateMsgRouter = {
|
||||
})
|
||||
},
|
||||
list_tags: function () {
|
||||
$.ajax({url: "api/tag/ids",method: "GET"})
|
||||
.done(jd => {
|
||||
// NICHT SO wg. Vue: _messagelist = jd;
|
||||
$.ajax({url: "api/tag/ids",method: "GET"})
|
||||
.done(jd => {
|
||||
// NICHT SO wg. Vue: _messagelist = jd;
|
||||
console.log("DATA: "+data);
|
||||
if(data == ""){
|
||||
_taglist.splice(0, _taglist.length);
|
||||
_taglist.push.apply(_taglist, jd);
|
||||
console.log("tag: jd: " + jd);
|
||||
@@ -136,35 +124,16 @@ const CreateMsgRouter = {
|
||||
get_insert_tag(jd[e]);
|
||||
}
|
||||
}
|
||||
}).fail(function (e, f, g) {
|
||||
console.log("err: " + e + f + g);
|
||||
});
|
||||
}
|
||||
}
|
||||
}).fail(function (e, f, g) {
|
||||
console.log("err: " + e + f + g);
|
||||
});
|
||||
},
|
||||
},
|
||||
mounted: function () {
|
||||
var userField = $('#user');
|
||||
if (auth != null && auth.mail != '') {
|
||||
// userField.prop('placeholder',auth.name);
|
||||
var authorName = auth.name.split(' ');
|
||||
authorName = authorName[1] + ', ' + authorName[0];
|
||||
userField.val(authorName);
|
||||
userField.prop('disabled',true);
|
||||
} else {
|
||||
userField.prop('placeholder','User');
|
||||
userField.prop('disabled',false);
|
||||
}
|
||||
|
||||
this.list_tags();
|
||||
//this.list_tags();
|
||||
if ($(this).bootstrapMaterialDesign)
|
||||
$(this).bootstrapMaterialDesign();
|
||||
},
|
||||
};
|
||||
|
||||
function get_insert_tag(id){
|
||||
$.ajax({ url: "api/tag/id/"+id, method: "GET" }).done(function (tag) {
|
||||
data.push("#" + tag.name);
|
||||
console.log("Array:"+this.data);
|
||||
}).fail(function (e, f, g) {
|
||||
console.log("cannot load " + id + ".json: " + e + f + g);
|
||||
})
|
||||
}
|
||||
@@ -1,10 +1,7 @@
|
||||
var tagArray = [];
|
||||
|
||||
const FileRouter = {
|
||||
template: `
|
||||
<div class="content">
|
||||
|
||||
<div class="is-hidden-desktop">
|
||||
<div class="column is-four-fifths-desktop pull-right-sm">
|
||||
<h4>Erweiterte Suche</h4>
|
||||
<b-field label="Suche nach">
|
||||
<b-select
|
||||
@@ -23,16 +20,16 @@ const FileRouter = {
|
||||
</b-field>
|
||||
|
||||
<b-field v-if="selectedOptions=='tags'">
|
||||
<b-autocomplete rounded v-model="searchtext"
|
||||
<b-autocomplete v-model="searchtext"
|
||||
:data="filteredDataArray"
|
||||
placeholder="suche..." icon="magnify"
|
||||
placeholder="#" icon="label"
|
||||
@select="option => selected = option">
|
||||
</b-autocomplete>
|
||||
</b-field>
|
||||
|
||||
<b-button type="is-primary" @click="search">SUCHE</b-button>
|
||||
|
||||
<div id="om-msg-cards">
|
||||
<div id="om-msg-cards" v-if="isExtendedSearch==true">
|
||||
<MsgCard
|
||||
v-for="id in messagelist.slice().reverse()"
|
||||
:key="id"
|
||||
@@ -40,44 +37,6 @@ const FileRouter = {
|
||||
></MsgCard>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="column is-three-quarters is-pulled-right is-hidden-touch content-desktop">
|
||||
<h4>Erweiterte Suche</h4>
|
||||
<b-field label="Suche nach">
|
||||
<b-select
|
||||
placeholder="Wähle eine Suchform"
|
||||
v-model="selectedOptions">
|
||||
<option value="freeSearch">Freie Suche</option>
|
||||
<option value="subject">Betreff</option>
|
||||
<option value="tags">Tags</option>
|
||||
<option value="text">Nachrichtentext</option>
|
||||
<option value="user">User</option>
|
||||
</b-select>
|
||||
</b-field>
|
||||
|
||||
<b-field v-if="selectedOptions=='freeSearch'||selectedOptions=='subject'|| selectedOptions=='text' || selectedOptions=='user'">
|
||||
<b-input id="freeSe"></b-input>
|
||||
</b-field>
|
||||
|
||||
<b-field v-if="selectedOptions=='tags'">
|
||||
<b-autocomplete rounded v-model="searchtext"
|
||||
:data="filteredDataArray"
|
||||
placeholder="suche..." icon="magnify"
|
||||
@select="option => selected = option">
|
||||
</b-autocomplete>
|
||||
</b-field>
|
||||
|
||||
<b-button type="is-primary" @click="search">SUCHE</b-button>
|
||||
|
||||
<div id="om-msg-cards">
|
||||
<MsgCard
|
||||
v-for="id in messagelist.slice().reverse()"
|
||||
:key="id"
|
||||
:msg="messages[id] || {}"
|
||||
></MsgCard>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
`,
|
||||
data: function () {
|
||||
@@ -88,6 +47,7 @@ const FileRouter = {
|
||||
taglist: data,
|
||||
messagelist: _messagelist,
|
||||
messages: _messages,
|
||||
isExtendedSearch: false,
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -104,10 +64,6 @@ const FileRouter = {
|
||||
list_messages: function () {
|
||||
messages();
|
||||
},
|
||||
saveTagsToArray: function () {
|
||||
tagArray = this.selected;
|
||||
console.info(tagArray);
|
||||
},
|
||||
getFilteredTags(text) {
|
||||
this.taglist = data.filter((option) => {
|
||||
return option
|
||||
@@ -115,7 +71,6 @@ const FileRouter = {
|
||||
.toLowerCase()
|
||||
.indexOf(text.toLowerCase()) >= 0
|
||||
})
|
||||
this.search();
|
||||
},
|
||||
list_tags: function () {
|
||||
$.ajax({
|
||||
@@ -124,6 +79,7 @@ const FileRouter = {
|
||||
})
|
||||
.done(jd => {
|
||||
// NICHT SO wg. Vue: _messagelist = jd;
|
||||
if(data == ""){
|
||||
_taglist.splice(0, _taglist.length);
|
||||
_taglist.push.apply(_taglist, jd);
|
||||
console.log("tag: jd: " + jd);
|
||||
@@ -132,6 +88,7 @@ const FileRouter = {
|
||||
get_insert_tag(jd[e]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}).fail(function (e, f, g) {
|
||||
console.log("err: " + e + f + g);
|
||||
});
|
||||
@@ -142,6 +99,7 @@ const FileRouter = {
|
||||
},
|
||||
search: function () {
|
||||
searching(this.searchtext);
|
||||
this.isExtendedSearch=true;
|
||||
},
|
||||
list_messages: function () {
|
||||
messages();
|
||||
@@ -149,7 +107,7 @@ const FileRouter = {
|
||||
},
|
||||
mounted: function () {
|
||||
//this.search();
|
||||
this.list_tags();
|
||||
//this.list_tags();
|
||||
//this.list_messages();
|
||||
},
|
||||
};
|
||||
@@ -1,72 +1,81 @@
|
||||
const HomeRouter = {
|
||||
template: `
|
||||
<div>
|
||||
<div id="om-msg-cards" class="is-hidden-desktop">
|
||||
<MsgCard
|
||||
v-for="id in messagelist.slice().reverse()"
|
||||
:key="id"
|
||||
:msg="messages[id] || {}"
|
||||
></MsgCard>
|
||||
</div>
|
||||
|
||||
<div id="om-msg-cards" class="column is-three-quarters is-pulled-right is-hidden-touch content-desktop">
|
||||
<MsgCard
|
||||
v-for="id in messagelist.slice().reverse()"
|
||||
:key="id"
|
||||
:msg="messages[id] || {}"
|
||||
></MsgCard>
|
||||
</div>
|
||||
<div id="om-msg-cards" class="column pull-right-sm is-four-fifths-desktop">
|
||||
<b-button id="escape-search-link"
|
||||
v-if="_isSearchActiv"
|
||||
@click="goBackToDashboard"
|
||||
icon-left="arrow-left"
|
||||
type="is-primary"
|
||||
@toggle-escape-search-link="toggleEscapeSearchLink"
|
||||
outlined>
|
||||
zurück zu allen Einträgen
|
||||
</b-button>
|
||||
<!--<b-button id="subscribe-btn" type="is-primary" v-if="_isSubscripeButtonActiv" @update-home-abo-button="updateHomeAboButton" @click="changeSubscribtion">
|
||||
{{ subscripeTagName }}
|
||||
</b-button>--><br><br>
|
||||
<MsgCard
|
||||
v-for="id in messagelist.slice().reverse()"
|
||||
:key="id"
|
||||
:msg="messages[id] || {}"
|
||||
:isBookmark="bookmarkArray[id]">
|
||||
</MsgCard>
|
||||
</div>
|
||||
</div>`,
|
||||
data: function () {
|
||||
return {
|
||||
messagelist: _messagelist,
|
||||
messages: _messages,
|
||||
isSearchActiv: _isSearchActiv,
|
||||
isSubscripeButtonActiv: _isSubscripeButtonActiv,
|
||||
isSubscriped: false,
|
||||
subscripeTagName: '',
|
||||
bookmarkArray: auth.bookmarks,
|
||||
vueRender: vueRender,
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
/*refresh_messages: function () {
|
||||
_messages.push({ //////// alt
|
||||
id: 42,
|
||||
subject: "xxx",
|
||||
message: "warum habt ihr auch so viel",
|
||||
user: "nobody",
|
||||
tags: "foo"
|
||||
});
|
||||
},*/
|
||||
updateHomeAboButton: function(content) {
|
||||
this.subscripeTagName = content;
|
||||
console.info( this.subscripeTagName);
|
||||
vueForceRender('key');
|
||||
},
|
||||
toggleEscapeSearchLink: function() {
|
||||
console.info('got called');
|
||||
this.isSearchActive = !this.isSearchActive;
|
||||
vueForceRender('key');
|
||||
console.info( this.isSearchActive);
|
||||
},
|
||||
list_messages: function() {
|
||||
messages();
|
||||
}
|
||||
/*list_messages: function () {
|
||||
$.ajax({url: "api/msg/ids", method: "GET"})
|
||||
.done(jd => {
|
||||
// NICHT SO wg. Vue: _messagelist = jd;
|
||||
_messagelist.splice(0, _messagelist.length);
|
||||
_messagelist.push.apply(_messagelist, jd);
|
||||
//console.log("jd: "+jd);
|
||||
for (var e in jd) {
|
||||
if (!_messages[jd[e]]) {
|
||||
get_insert_message(jd[e]);
|
||||
}
|
||||
}
|
||||
if(!($".om-searchbar" = "")){
|
||||
for (var e in jd) {
|
||||
if (!_messages[jd[e]]) {
|
||||
get_insert_message(jd[e]);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
for (var e in jd) {
|
||||
if (!_messages[jd[e]]) {
|
||||
get_search_message(jd[e]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}).fail(function (e, f, g) {
|
||||
console.log("list_msg: err: " + e + f + g);
|
||||
});
|
||||
}*/
|
||||
},
|
||||
},
|
||||
goBackToDashboard: function() {
|
||||
_isSearchActiv = false;
|
||||
this.$emit('reset-searchtext','');
|
||||
// $("#escape-search-link").css("visibility", "hidden");
|
||||
// $("#subscribe-btn").css("visibility", "hidden");
|
||||
_isSubscripeButtonActiv = false;
|
||||
vueForceRender('key');
|
||||
vueForceRender('search');
|
||||
},
|
||||
changeSubscribtion: function(){
|
||||
var btnString = $("#btn-text").text();
|
||||
console.log(btnString);
|
||||
|
||||
if(this.isSubscriped){
|
||||
this.subscripeTagName.replace(/deabonnieren/g, '') + "abonnieren";
|
||||
//console.log(btnString);
|
||||
// $("#btn-text").text(newBtnString);
|
||||
}else{
|
||||
this.subscripeTagName.replace(/abonnieren/g, '') + "deabonnieren";
|
||||
//console.log(newBtnString);
|
||||
// $("#btn-text").text(newBtnString);
|
||||
}
|
||||
this.isSubscriped = !this.isSubscriped;
|
||||
vueForceRender('key');
|
||||
}
|
||||
|
||||
},
|
||||
mounted: function () {
|
||||
this.list_messages();
|
||||
//this.refresh_messages();
|
||||
@@ -80,28 +89,3 @@ function get_insert_message(id) {
|
||||
console.log("cannot load " + id + ".json: " + e + f + g);
|
||||
})
|
||||
}
|
||||
|
||||
/*function get_search_message(phrase) {
|
||||
$.ajax({ url: "api/msg/search/"+phrase, method: "GET" }).done(function (msg) {
|
||||
Vue.set(_messages, id, msg);
|
||||
}).fail(function (e, f, g) {
|
||||
console.log("cannot load " + id + ".json: " + e + f + g);
|
||||
})
|
||||
}
|
||||
$(document).ready(function () {
|
||||
console.log("egal");
|
||||
$.get('list.json').done(function (jd) {
|
||||
// _messagelist = jd;
|
||||
_messagelist.splice(0, _messagelist.length);
|
||||
_messagelist.push.apply(_messagelist, jd);
|
||||
console.log("egal2");
|
||||
//$('#xxx').text(jd[0]);
|
||||
for (var e in jd) {
|
||||
if (!_messages[jd[e]]) {
|
||||
get_insert_message(jd[e]);
|
||||
}
|
||||
}
|
||||
}).fail(function (e, f, g) {
|
||||
console.log("egal3: " + e + f + g);
|
||||
});
|
||||
});*/
|
||||
@@ -0,0 +1,94 @@
|
||||
// Global Variables
|
||||
// User
|
||||
var auth = {},
|
||||
|
||||
// Message
|
||||
_messagelist = [],
|
||||
_messages = {},
|
||||
|
||||
// Tag
|
||||
_taglist = [],
|
||||
_tags = [],
|
||||
tagArray = [],
|
||||
|
||||
// Search
|
||||
_isSearchActiv = false,
|
||||
_isSubscripeButtonActiv = false,
|
||||
data = [],
|
||||
search_data = [],
|
||||
|
||||
// Vue Rerender Key
|
||||
vueRender = {
|
||||
key: 0,
|
||||
search: 0,
|
||||
};
|
||||
|
||||
const authorRole = 'author',
|
||||
majorList = [
|
||||
{id:'B-AC',name:'Bachelor Angewandte Chemie'},
|
||||
{id:'B-AMP',name:'Bachelor Angewandte Mathematik und Physik'},
|
||||
{id:'B-TJ',name:'Bachelor Technikjournalismus/Technik-PR'},
|
||||
{id:'B-AR',name:'Bachelor Architektur'},
|
||||
{id:'B-BI',name:'Bachelor Bauingenieurwesen'},
|
||||
{id:'B-BW',name:'Bachelor Betriebswirtschaft'},
|
||||
{id:'B-BIO',name:'Bachelor Management in der Biobranche'},
|
||||
{id:'B-IB',name:'Bachelor International Business'},
|
||||
{id:'B-IBT',name:'Bachelor International Business and Technology'},
|
||||
{id:'B-DE',name:'Bachelor Design'},
|
||||
{id:'B-EI',name:'Bachelor Elektrotechnik und Informationstechnik'},
|
||||
{id:'B-MED',name:'Bachelor Medizintechnik'},
|
||||
{id:'B-MF',name:'Bachelor Mechatronik/Feinwerktechnik'},
|
||||
{id:'B-ME',name:'Bachelor Media Engineering'},
|
||||
{id:'B-IN',name:'Bachelor Informatik'},
|
||||
{id:'B-MIN',name:'Bachelor Medieninformatik'},
|
||||
{id:'B-WIN',name:'Bachelor Wirtschaftsinformatik'},
|
||||
{id:'B-MB',name:'Bachelor Maschinenbau'},
|
||||
{id:'B-EGT',name:'Bachelor Energie- und Gebäudetechnik'},
|
||||
{id:'B-EBL',name:'Bachelor Soziale Arbeit: Erziehung und Bildung im Lebenslauf'},
|
||||
{id:'B-SA',name:'Bachelor Soziale Arbeit'},
|
||||
{id:'B-EPT',name:'Bachelor Energieprozesstechnik'},
|
||||
{id:'B-VT',name:'Bachelor Verfahrenstechnik'},
|
||||
{id:'B-WT',name:'Bachelor Werkstofftechnik'},
|
||||
{id:'M-AMP',name:'Master Angewandte Mathematik und Physik'},
|
||||
{id:'M-AR',name:'Master Architektur'},
|
||||
{id:'M-BI',name:'Master Internationales Bauwesen'},
|
||||
{id:'M-URB',name:'Master Urbane Mobilität (Verkehrsingenieurwesen)'},
|
||||
{id:'M-BW',name:'Master Betriebswirtschaft'},
|
||||
{id:'M-TAX',name:'Master Steuerberatung'},
|
||||
{id:'M-WR',name:'Master Wirtschaftsrecht'},
|
||||
{id:'M-IFE',name:'Master International Finance and Economics'},
|
||||
{id:'M-IMA',name:'Master International Marketing'},
|
||||
{id:'M-APR',name:'Master Applied Research in Engineering Sciences'},
|
||||
{id:'M-SY',name:'Master Elektronische und Mechatronische Systeme'},
|
||||
{id:'M-IN',name:'Master Informatik'},
|
||||
{id:'M-MIN',name:'Master Medieninformatik'},
|
||||
{id:'M-WIN',name:'Master Wirtschaftsinformatik'},
|
||||
{id:'M-MB',name:'Master Maschinenbau'},
|
||||
{id:'M-EE',name:'Master Energiemanagement und Energietechnik'},
|
||||
{id:'M-GT',name:'Master Gebäudetechnik'},
|
||||
{id:'M-SA',name:'Master Soziale Arbeit'},
|
||||
{id:'M-VT',name:'Master Chemieingenieurwesen und Verfahrenstechnik'},
|
||||
{id:'M-WT',name:'Master Werkstofftechnik'},
|
||||
],
|
||||
facultyList = [
|
||||
{id:'AC',name:'Angewandte Chemie'},
|
||||
{id:'AMP',name:'Angewandte Mathematik, Physik und Allgemeinwissenschaften'},
|
||||
{id:'AR',name:'Architektur'},
|
||||
{id:'BI',name:'Bauingeneurwesen'},
|
||||
{id:'BW',name:'Betriebswirtschaft'},
|
||||
{id:'D',name:'Design'},
|
||||
{id:'EFI',name:'Elektrotechnik Feinwerktechnik Informationstechnik'},
|
||||
{id:'IN',name:'Informatik'},
|
||||
{id:'MB-VS',name:'Maschinenbau und Versorgungstechnik'},
|
||||
{id:'SW',name:'Sozialwissenschaften'},
|
||||
{id:'VT',name:'Verfahrenstechnik'},
|
||||
{id:'WT',name:'Werkstofftechnik'},
|
||||
];
|
||||
|
||||
// Global Functions
|
||||
function vueForceRender(keyName) {
|
||||
if (vueRender[keyName] >= 10) {
|
||||
vueRender[keyName] = 0;
|
||||
}
|
||||
vueRender[keyName]++;
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
var majorList = [
|
||||
{id:'B-AC',name:'Bachelor Angewandte Chemie'},
|
||||
{id:'B-AMP',name:'Bachelor Angewandte Mathematik und Physik'},
|
||||
{id:'B-TJ',name:'Bachelor Technikjournalismus/Technik-PR'},
|
||||
{id:'B-AR',name:'Bachelor Architektur'},
|
||||
{id:'B-BI',name:'Bachelor Bauingenieurwesen'},
|
||||
{id:'B-BW',name:'Bachelor Betriebswirtschaft'},
|
||||
{id:'B-BIO',name:'Bachelor Management in der Biobranche'},
|
||||
{id:'B-IB',name:'Bachelor International Business'},
|
||||
{id:'B-IBT',name:'Bachelor International Business and Technology'},
|
||||
{id:'B-DE',name:'Bachelor Design'},
|
||||
{id:'B-EI',name:'Bachelor Elektrotechnik und Informationstechnik'},
|
||||
{id:'B-MED',name:'Bachelor Medizintechnik'},
|
||||
{id:'B-MF',name:'Bachelor Mechatronik/Feinwerktechnik'},
|
||||
{id:'B-ME',name:'Bachelor Media Engineering'},
|
||||
{id:'B-IN',name:'Bachelor Informatik'},
|
||||
{id:'B-MIN',name:'Bachelor Medieninformatik'},
|
||||
{id:'B-WIN',name:'Bachelor Wirtschaftsinformatik'},
|
||||
{id:'B-MB',name:'Bachelor Maschinenbau'},
|
||||
{id:'B-EGT',name:'Bachelor Energie- und Gebäudetechnik'},
|
||||
{id:'B-EBL',name:'Bachelor Soziale Arbeit: Erziehung und Bildung im Lebenslauf'},
|
||||
{id:'B-SA',name:'Bachelor Soziale Arbeit'},
|
||||
{id:'B-EPT',name:'Bachelor Energieprozesstechnik'},
|
||||
{id:'B-VT',name:'Bachelor Verfahrenstechnik'},
|
||||
{id:'B-WT',name:'Bachelor Werkstofftechnik'},
|
||||
{id:'M-AMP',name:'Master Angewandte Mathematik und Physik'},
|
||||
{id:'M-AR',name:'Master Architektur'},
|
||||
{id:'M-BI',name:'Master Internationales Bauwesen'},
|
||||
{id:'M-URB',name:'Master Urbane Mobilität (Verkehrsingenieurwesen)'},
|
||||
{id:'M-BW',name:'Master Betriebswirtschaft'},
|
||||
{id:'M-TAX',name:'Master Steuerberatung'},
|
||||
{id:'M-WR',name:'Master Wirtschaftsrecht'},
|
||||
{id:'M-IFE',name:'Master International Finance and Economics'},
|
||||
{id:'M-IMA',name:'Master International Marketing'},
|
||||
{id:'M-APR',name:'Master Applied Research in Engineering Sciences'},
|
||||
{id:'M-SY',name:'Master Elektronische und Mechatronische Systeme'},
|
||||
{id:'M-IN',name:'Master Informatik'},
|
||||
{id:'M-MIN',name:'Master Medieninformatik'},
|
||||
{id:'M-WIN',name:'Master Wirtschaftsinformatik'},
|
||||
{id:'M-MB',name:'Master Maschinenbau'},
|
||||
{id:'M-EE',name:'Master Energiemanagement und Energietechnik'},
|
||||
{id:'M-GT',name:'Master Gebäudetechnik'},
|
||||
{id:'M-SA',name:'Master Soziale Arbeit'},
|
||||
{id:'M-VT',name:'Master Chemieingenieurwesen und Verfahrenstechnik'},
|
||||
{id:'M-WT',name:'Master Werkstofftechnik'},
|
||||
];
|
||||
@@ -1,2 +0,0 @@
|
||||
_messagelist = [];
|
||||
_messages = {};
|
||||
@@ -1,34 +1,94 @@
|
||||
Vue.component('MsgCard', {
|
||||
template: `<div class="om-card card">
|
||||
<h6 class="msg-head">
|
||||
template: `
|
||||
<div class="om-card card">
|
||||
<h6 class="msg-head">
|
||||
<b>{{ msg.subject }}</b>
|
||||
<img src="favicon.ico" width=20px height=20px>
|
||||
</h6>
|
||||
{{ msg.message }}<br>
|
||||
<a v-for="tag in msg.tag" @click="filterForTag(tag)">#{{ tag }} </a>
|
||||
<br>
|
||||
</p>
|
||||
<div class="om-card-footer"> <div class="om-user-line">
|
||||
<i class="material-icons">account_circle</i>
|
||||
Erstellt von {{ msg.user }}</div>
|
||||
<i class="material-icons" @click="myFilter()" v-if="!isActive">bookmark_border</i>
|
||||
<i class="material-icons" @click="myFilter()" v-else="isActive">bookmark</i>
|
||||
</div></div>`,
|
||||
props: ['msg'],
|
||||
</h6>
|
||||
{{ msg.message }}<br>
|
||||
<a v-for="tag in msg.tag" @click="filterForTag(tag)">#{{ tag }} </a>
|
||||
<br>
|
||||
<div class="om-card-footer">
|
||||
<div class="om-user-line">
|
||||
<i class="material-icons">account_circle</i>
|
||||
Erstellt von {{ msg.user }}
|
||||
</div>
|
||||
<i id="bockmark-not-active" class="material-icons" :key="vueRender.key" @click="myFilter(msg._id)" v-if="!isActive">bookmark_border</i>
|
||||
<i id="bockmark-active" class="material-icons" :key="vueRender.key" @click="myFilter(msg._id)" v-else>bookmark</i>
|
||||
</div>
|
||||
</div>`,
|
||||
props: ['msg', 'isBookmark'],
|
||||
|
||||
data: function () {
|
||||
return {
|
||||
isActive: false,
|
||||
isActive: this.isBookmark,
|
||||
msgid: this.msg._id,
|
||||
bookmarkArray: auth.bookmarks,
|
||||
vueRender: vueRender,
|
||||
};
|
||||
},
|
||||
|
||||
methods: {
|
||||
myFilter: function() {
|
||||
myFilter: function (_messageid) {
|
||||
//var _messageid = $("#msgid").text();
|
||||
if (this.isActive == true) {
|
||||
var index = this.bookmarkArray.indexOf(_messageid);
|
||||
|
||||
if (index > -1) {
|
||||
this.bookmarkArray.splice(index, 1);
|
||||
}
|
||||
this.isActive = false;
|
||||
} else {
|
||||
console.log("_messsageid: "+_messageid+" bookmarks: "+this.bookmarkArray);
|
||||
this.bookmarkArray.push(_messageid);
|
||||
this.isActive =true;
|
||||
}
|
||||
/*console.log("msgid"+_bookmark);
|
||||
var _userid = auth.user;
|
||||
this.isActive = !this.isActive;
|
||||
if(this.isActive){
|
||||
$.ajax({
|
||||
url: "api/usr",
|
||||
data: {
|
||||
userid: _userid,
|
||||
bookmark: _bookmark
|
||||
},
|
||||
method: "PUT"
|
||||
}).done(have_result).fail(have_error);
|
||||
|
||||
function have_result(res) {
|
||||
console.log(res);
|
||||
}
|
||||
|
||||
function have_error(err) {
|
||||
console.log("error: " + err.responseText);
|
||||
console.log(err);
|
||||
}
|
||||
}*/
|
||||
},
|
||||
filterForTag: function(tag) {
|
||||
console.log("link: " +tag);
|
||||
filterForTag: function (tag) {
|
||||
var btnString = "#" + tag + " abonnieren";
|
||||
$("#btn-text").text(btnString);
|
||||
$("#subscribe-btn").css("visibility", "visible");
|
||||
//console.log("link: " + tag);
|
||||
searching(tag);
|
||||
var btnString = "#" + tag + " abonnieren";
|
||||
$("#btn-text").text(btnString);
|
||||
$("#subscribe-btn").css("visibility", "visible");
|
||||
},
|
||||
isBookmarkActive: function (msgid) {
|
||||
//console.log("isBookmarkActive(): " + msgid);
|
||||
if (this.bookmarkArray.indexOf(msgid) > -1) {
|
||||
// $("#bockmark-not-active").css("visibility","hidden");
|
||||
// $("#bockmark-active").css("visibility","visible");
|
||||
this.isActive = true;
|
||||
//console.log("isBookmarkActive(): " + this.isActive);
|
||||
this.isActive_ = 1;
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
beforeMount: function () {
|
||||
//this.isBookmarkActive();
|
||||
}
|
||||
});
|
||||
@@ -11,7 +11,7 @@ Vue.component('nav-router', {
|
||||
<i class="material-icons">search</i>
|
||||
</router-link>
|
||||
|
||||
<router-link to="/createMessage" class="navbar-item is-primary is-expanded is-hidden-desktop">
|
||||
<router-link v-if="auth.roles.author" to="/createMessage" class="navbar-item is-primary is-expanded is-hidden-desktop">
|
||||
<i class="material-icons">add_circle</i>
|
||||
</router-link>
|
||||
|
||||
@@ -37,7 +37,7 @@ Vue.component('nav-router', {
|
||||
<i class="material-icons">search</i> Search
|
||||
</router-link></li>
|
||||
|
||||
<li><router-link to="/createMessage">
|
||||
<li><router-link v-if="auth.roles.author" to="/createMessage">
|
||||
<i class="material-icons">add_circle</i> Create Message
|
||||
</router-link></li>
|
||||
|
||||
@@ -53,6 +53,11 @@ Vue.component('nav-router', {
|
||||
</div>
|
||||
</div>
|
||||
</div>`,
|
||||
data: function() {
|
||||
return {
|
||||
auth: auth,
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
const routes = [
|
||||
|
||||
@@ -1,42 +1,23 @@
|
||||
const ProfilRouter = {
|
||||
template: `
|
||||
<div>
|
||||
<div class="is-hidden-desktop">
|
||||
<div v-if="isAuth">
|
||||
<profil-card></profil-card>
|
||||
</div>
|
||||
<div v-else>
|
||||
<button class="button is-primary is-medium"
|
||||
@click="isLPVisible = true">
|
||||
Login
|
||||
</button>
|
||||
<div class="column pull-right-sm is-four-fifths-desktop">
|
||||
<div v-if="isAuth">
|
||||
<profil-card></profil-card>
|
||||
</div>
|
||||
<div v-else>
|
||||
<button class="button is-primary is-medium"
|
||||
@click="isLPVisible = true">
|
||||
Login
|
||||
</button>
|
||||
|
||||
<b-modal :active.sync="isLPVisible"
|
||||
@close-login-panel="closeLoginPanel"
|
||||
@show-login-panel="showLoginPanel"
|
||||
has-modal-card>
|
||||
<login-panel></login-panel>
|
||||
</b-modal>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="column is-three-quarters is-pulled-right is-hidden-touch content-desktop">
|
||||
<div v-if="isAuth">
|
||||
<profil-card></profil-card>
|
||||
</div>
|
||||
<div v-else>
|
||||
<button class="button is-primary is-medium"
|
||||
@click="isLPVisible = true">
|
||||
Login
|
||||
</button>
|
||||
|
||||
<b-modal :active.sync="isLPVisible"
|
||||
@close-login-panel="closeLoginPanel"
|
||||
@show-login-panel="showLoginPanel"
|
||||
has-modal-card>
|
||||
<login-panel></login-panel>
|
||||
</b-modal>
|
||||
</div>
|
||||
<b-modal :active.sync="isLPVisible"
|
||||
@close-login-panel="closeLoginPanel"
|
||||
@show-login-panel="showLoginPanel"
|
||||
has-modal-card>
|
||||
<login-panel></login-panel>
|
||||
</b-modal>
|
||||
</div>
|
||||
</div>
|
||||
</div>`,
|
||||
data: function () {
|
||||
|
||||
@@ -11,22 +11,24 @@ Vue.component('profil-card', {
|
||||
|
||||
<div class="profil-text">
|
||||
<span style="font-size:120%; display:inline-block; margin: 0.8rem 0 0 0;"><b>{{ auth.name }}</b></span><br><br>
|
||||
<span style="font-size:90%; display:inline-block; margin: 0 0 0.8rem 0;"><b>{{ major }}</b></span>
|
||||
<span style="font-size:100%; display:inline-block; margin: 0 0 0.8rem 0;"><b>{{ labelMajorOrFaculty }}</b></span>
|
||||
<br>
|
||||
<span style="font-size:90%; display:inline-block; margin: 0 0 0.8rem 0;"><b>{{ majorOrFaculty }}</b></span>
|
||||
<br><br>
|
||||
</div>
|
||||
|
||||
<hr class="first">
|
||||
|
||||
<div class="btnprofil">
|
||||
<button @click="isCardModalActive = true"><b>Abonniert: <br/>{{ abo }}</b> <br/></button>
|
||||
<button @click="$router.push('/bookmark')"><b>Gespeichert:<br/> {{ saved }}</b><br/></button>
|
||||
<button @click="isCardModalActive = true"><b>Abonniert: <br/>{{ abos }}</b> <br/></button>
|
||||
<button @click="$router.push('/bookmark')"><b>Gespeichert:<br/> {{ bookmarks }}</b><br/></button>
|
||||
</div>
|
||||
|
||||
<section>
|
||||
<b-modal :active.sync="isCardModalActive" :width="600" scroll="keep">
|
||||
<div class="card">
|
||||
<header class="modal-card-head">
|
||||
<p class="modal-card-title">Abonnierte Kanäle</p>
|
||||
<p class="modal-card-title">Abonnierte Tags</p>
|
||||
</header>
|
||||
<div class="card-content">
|
||||
<div class="content">
|
||||
@@ -51,30 +53,51 @@ Vue.component('profil-card', {
|
||||
data: function () {
|
||||
return {
|
||||
auth: auth,
|
||||
abo: 7,
|
||||
saved: 3,
|
||||
abos: auth.abos ? auth.abos.length : '-',
|
||||
bookmarks: auth.bookmarks ? auth.bookmarks.length : '-',
|
||||
isCardModalActive: false,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
major: function() {
|
||||
majorOrFaculty: function() {
|
||||
// e.g. ST@B-ME;ST@EFI;
|
||||
var majorID = auth.type.split(';')[0].split('@')[1];
|
||||
//console.info(majorID);
|
||||
//console.info(majorList);
|
||||
var majorName = 'Studiengang Unbekannt';
|
||||
majorList.forEach(function(major) {
|
||||
if (major.id == majorID) {
|
||||
majorName = major.name;
|
||||
}
|
||||
});
|
||||
return majorName;
|
||||
if (auth.roles.author) {
|
||||
var facultyID = auth.type.split(';');
|
||||
console.info(facultyID[facultyID.length-2]);
|
||||
facultyID = facultyID[facultyID.length-2].split('@')[1];
|
||||
var facultyName = '';
|
||||
facultyList.forEach(function(faculty) {
|
||||
if (faculty.id == facultyID) {
|
||||
facultyName = faculty.name;
|
||||
}
|
||||
});
|
||||
return facultyName;
|
||||
} else {
|
||||
var majorID = auth.type.split(';')[0].split('@')[1];
|
||||
//console.info(majorID);
|
||||
//console.info(majorList);
|
||||
var majorName = 'Studiengang Unbekannt';
|
||||
majorList.forEach(function(major) {
|
||||
if (major.id == majorID) {
|
||||
majorName = major.name;
|
||||
}
|
||||
});
|
||||
return majorName;
|
||||
}
|
||||
},
|
||||
labelMajorOrFaculty: function() {
|
||||
if (auth.roles.author) {
|
||||
return 'Fakultät:'
|
||||
} else {
|
||||
return 'Studiengang:'
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
logout: function() {
|
||||
clearAuthState();
|
||||
$.ajax({ url: "api/logout", method: "POST" });
|
||||
vueForceRender('key');
|
||||
router.push('/profil');
|
||||
},
|
||||
}
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
_taglist = [];
|
||||
_tags = [];
|
||||
@@ -1,13 +1,3 @@
|
||||
var isSearchActive = false,
|
||||
tagArray = ["lorem"];
|
||||
|
||||
const dat=[
|
||||
'th',
|
||||
'efi',
|
||||
'wichtig',
|
||||
],
|
||||
search_data = [];
|
||||
|
||||
Vue.component('search',{
|
||||
template: `
|
||||
<form class="om-searchbar" @submit.prevent="search()">
|
||||
@@ -18,31 +8,35 @@ Vue.component('search',{
|
||||
:data="filteredDataArray"
|
||||
placeholder="suche..."
|
||||
icon="magnify"
|
||||
@reset-searchtext="resetSearchtext($event)"
|
||||
@select="option => selected = option">
|
||||
</b-autocomplete>
|
||||
<button class="clearButton" @click="clear">x</button>
|
||||
</b-field>
|
||||
</form>`,
|
||||
data: function() {
|
||||
return{
|
||||
return {
|
||||
searchtext: "",
|
||||
selected: [],
|
||||
taglist: dat,
|
||||
taglist: data,
|
||||
};
|
||||
},
|
||||
computed:{
|
||||
filteredDataArray() {
|
||||
filteredDataArray: function() {
|
||||
return this.taglist.filter((option) => {
|
||||
return option
|
||||
.toString()
|
||||
.toLowerCase()
|
||||
.indexOf(this.searchtext.toLowerCase()) >= 0
|
||||
})
|
||||
}
|
||||
});
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
getFilteredTags(text) {
|
||||
this.taglist = dat.filter((option) => {
|
||||
resetSearchtext: function(param) {
|
||||
this.searchtext = param;
|
||||
},
|
||||
getFilteredTags: function(text) {
|
||||
this.taglist = data.filter((option) => {
|
||||
return option
|
||||
.toString()
|
||||
.toLowerCase()
|
||||
@@ -51,7 +45,12 @@ Vue.component('search',{
|
||||
this.search();
|
||||
},
|
||||
search: function() {
|
||||
searching(this.searchtext);
|
||||
var btnString = '';
|
||||
btnString = searching(this.searchtext, btnString);
|
||||
console.info(btnString);
|
||||
this.$emit('update-home-abo-button', btnString);
|
||||
vueForceRender('key');
|
||||
|
||||
},
|
||||
saveTagsToArray: function() {
|
||||
tagArray = this.selected;
|
||||
@@ -64,6 +63,7 @@ Vue.component('search',{
|
||||
$.ajax({url: "api/tag/ids", method: "GET"})
|
||||
.done(jd => {
|
||||
// NICHT SO wg. Vue: _messagelist = jd;
|
||||
if(data == ""){
|
||||
_taglist.splice(0, _taglist.length);
|
||||
_taglist.push.apply(_taglist, jd);
|
||||
// console.log("tag: jd: " + jd);
|
||||
@@ -72,16 +72,23 @@ Vue.component('search',{
|
||||
get_insert_tag(jd[e]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}).fail(function (e, f, g) {
|
||||
console.log("err: " + e + f + g);
|
||||
});
|
||||
},
|
||||
clear: function() {
|
||||
console.log("clear");
|
||||
|
||||
isSearchActiv = false;
|
||||
this.searchtext = "";
|
||||
this.searchtext = "";
|
||||
this.list_messages();
|
||||
//router.push('/files')
|
||||
//router.push('/home')
|
||||
_isSearchActiv = false;
|
||||
_isSubscripeButtonActiv = false;
|
||||
this.$emit('toggle-escape-search-link');
|
||||
vueForceRender('key');
|
||||
console.info('done');
|
||||
// $("#escape-search-link").css("visibility", "hidden");
|
||||
// $("#subscribe-btn").css("visibility", "hidden");
|
||||
},
|
||||
},
|
||||
mounted: function() {
|
||||
@@ -96,31 +103,46 @@ function get_insert_tag(id) {
|
||||
url: "api/tag/id/" + id,
|
||||
method: "GET"
|
||||
}).done(function(tag) {
|
||||
dat.push("#" + tag.name);
|
||||
data.push('#'+tag.name);
|
||||
}).fail(function(e, f, g) {
|
||||
console.log("cannot load " + id + ".json: " + e + f + g);
|
||||
})
|
||||
}
|
||||
|
||||
function searching(searchtext) {
|
||||
isSearchActiv = true;
|
||||
console.log("Searchtext: " + searchtext.replace(/#/g, ''));
|
||||
$.ajax({
|
||||
url: "api/msg/search/" + searchtext.replace(/#/g, ''),
|
||||
method: "GET"
|
||||
}).done(jd => {
|
||||
// NICHT SO wg. Vue: _messagelist = jd;
|
||||
_messagelist.splice(0, _messagelist.length);
|
||||
_messagelist.push.apply(_messagelist, jd);
|
||||
//console.log("jd: "+jd);
|
||||
for (var e in jd) {
|
||||
if (!_messages[jd[e]]) {
|
||||
get_insert_message(jd[e]);
|
||||
function searching(searchtext,btnString) {
|
||||
_isSearchActiv = true;
|
||||
// $("#escape-search-link").css("visibility", "visible");
|
||||
//console.log(_tags);
|
||||
// console.log(data);
|
||||
if(data.indexOf(searchtext) > -1){
|
||||
btnString = searchtext + " abonnieren";
|
||||
// $("#btn-text").text(btnString);
|
||||
// $("#subscribe-btn").css("visibility", "visible");
|
||||
_isSubscripeButtonActiv = true;
|
||||
}else{
|
||||
// $("#subscribe-btn").css("visibility", "hidden");
|
||||
_isSubscripeButtonActiv = false;
|
||||
}
|
||||
|
||||
if (searchtext !== '') {
|
||||
$.ajax({
|
||||
url: "api/msg/search/" + searchtext.replace(/#/g, ''),
|
||||
method: "GET"
|
||||
}).done(jd => {
|
||||
// NICHT SO wg. Vue: _messagelist = jd;
|
||||
_messagelist.splice(0, _messagelist.length);
|
||||
_messagelist.push.apply(_messagelist, jd);
|
||||
//console.log("jd: "+jd);
|
||||
for (var e in jd) {
|
||||
if (!_messages[jd[e]]) {
|
||||
get_insert_message(jd[e]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}).fail(function(e, f, g) {
|
||||
console.log("searching: err: " + e + f + g);
|
||||
})
|
||||
}).fail(function(e, f, g) {
|
||||
console.log("searching: err: " + e + f + g);
|
||||
})
|
||||
}
|
||||
return btnString;
|
||||
}
|
||||
|
||||
function messages() {
|
||||
|
||||
@@ -36,12 +36,6 @@
|
||||
.om-content a:hover {
|
||||
color: #0046a0;
|
||||
}
|
||||
.om-content a .menu-list {
|
||||
color: white !important;
|
||||
}
|
||||
.om-content a .menu-list:hover {
|
||||
color: white !important;
|
||||
}
|
||||
.content-desktop {
|
||||
margin-right: 30px;
|
||||
}
|
||||
@@ -242,3 +236,18 @@ button.clearButton {
|
||||
.taglink {
|
||||
color: #0046a0;
|
||||
}
|
||||
@media (min-width: 1088px) {
|
||||
.pull-right-sm {
|
||||
float: right;
|
||||
}
|
||||
}
|
||||
#subscribe-btn {
|
||||
float: right;
|
||||
-visibility: hidden;
|
||||
}
|
||||
#escape-search-link {
|
||||
-visibility: hidden;
|
||||
}
|
||||
#bockmark-not-active {
|
||||
visibility: visible;
|
||||
}
|
||||
@@ -39,10 +39,7 @@
|
||||
a{
|
||||
color: #0046a0;
|
||||
&:hover{color: #0046a0;}
|
||||
.menu-list {
|
||||
color: white !important;
|
||||
&:hover{color: white !important; }
|
||||
}}
|
||||
}
|
||||
}
|
||||
|
||||
.content-desktop {
|
||||
@@ -282,3 +279,22 @@ button.clearButton{
|
||||
color: @color;
|
||||
}
|
||||
|
||||
@media (min-width: 1088px) {
|
||||
.pull-right-sm {
|
||||
float: right;
|
||||
}
|
||||
}
|
||||
|
||||
#subscribe-btn{
|
||||
float: right;
|
||||
-visibility: hidden;
|
||||
}
|
||||
#escape-search-link{
|
||||
-visibility: hidden;
|
||||
}
|
||||
#bockmark-not-active{
|
||||
visibility: visible;
|
||||
}
|
||||
#bockmark-active{
|
||||
//visibility: hidden;
|
||||
}
|
||||
@@ -53,8 +53,8 @@ app.disable('x-powered-by');
|
||||
app.set('trust proxy', 1) // trust first proxy, neccessary for cookie secure: true flag
|
||||
app.use(session({
|
||||
secret: 'ahhgylhuvh', // caesar(3) 2 letter surname
|
||||
resave: false,
|
||||
saveUninitialized: false,
|
||||
saveUninitialized: false, // don't create session until something stored
|
||||
resave: false, //don't save session if unmodified
|
||||
cookie: {
|
||||
maxAge: 30 * 24 * 3600 * 1000, // TODO: ttl for session as well (Store)
|
||||
secure: true, // true for https only (since our app works only with https)
|
||||
@@ -64,7 +64,7 @@ app.use(session({
|
||||
mongooseConnection: mong.connection,
|
||||
ttl: 30 * 24 * 3600,
|
||||
}), // mongoose + connect-mongo
|
||||
//store: new MemoryStore ({checkPeriod: 24*3600*1000}), // memorystore
|
||||
// store: new MemoryStore ({checkPeriod: 24*3600*1000}), // memorystore
|
||||
}));
|
||||
|
||||
// Favicon for Desktop
|
||||
@@ -112,7 +112,7 @@ app.use('/api', api_routes);
|
||||
app.use(express.static(__dirname + '/public'));
|
||||
|
||||
// Other stuff is NOT authorized unless logged in
|
||||
app.use (authorize.genCheckAuthorized ('user'));
|
||||
//app.use (authorize.genCheckAuthorized ('user'));
|
||||
|
||||
// No error so far? Then it's a 404!
|
||||
app.use(function (req, res, next) {
|
||||
|
||||
@@ -12,20 +12,75 @@ const ldap = require ('./ldap_ohm'),
|
||||
const serverVisibleSession = { user: true, name: true, type: true, mail: true, roles: true, gender: true, deactivated: true, host: true };
|
||||
const clientVisibleSession = { user: true, name: true, type: true, mail: true, roles: true, gender: true };
|
||||
|
||||
// Return user role, query from found.mail
|
||||
function getUserRole(found) {
|
||||
var roles = "user:true";
|
||||
var mail = found.mail;
|
||||
if (!/\d/.test(mail)) {
|
||||
// Mail contains no number
|
||||
roles += ',"author:true"';
|
||||
}
|
||||
return ('{'+roles+'}');
|
||||
}
|
||||
|
||||
// Fill in session object
|
||||
function fillSession (req, user, roles, cb) {
|
||||
if (req.session === undefined)
|
||||
next (common.genError (500, "Error"));
|
||||
req.session.regenerate (function (err) {
|
||||
if (user !== undefined && ! err) {
|
||||
common.shallowCopy (user, serverVisibleSession, {roles: true}, req.session);
|
||||
if (user._id) {
|
||||
req.session.user = user._id;
|
||||
// regenerate a new session-id with clean instance
|
||||
if (user !== undefined && roles !== undefined) {
|
||||
req.session.regenerate (function (err) {
|
||||
if (user !== undefined && ! err) {
|
||||
common.shallowCopy (user, serverVisibleSession, {roles: true}, req.session);
|
||||
// console.info(req.session);
|
||||
if (user._id) {
|
||||
req.session.user = user._id;
|
||||
}
|
||||
req.session.roles = roles;
|
||||
console.info(req.session);
|
||||
}
|
||||
req.session.roles = roles;
|
||||
return cb (err);
|
||||
});
|
||||
} else {
|
||||
return cb ();
|
||||
}
|
||||
}
|
||||
|
||||
// Save found user into DB, if not already exists
|
||||
function saveFoundToDB(found, cb) {
|
||||
// console.info(found);
|
||||
Users.findById(found.user)
|
||||
.exec(function(err, result){
|
||||
if (err) {
|
||||
console.error("Error: Users collection.");
|
||||
console.error(err);
|
||||
}
|
||||
// User doesn't exist
|
||||
if (found !== undefined && !result) {
|
||||
Users.create({
|
||||
_id: found.user,
|
||||
name: found.name,
|
||||
mail: found.mail,
|
||||
type: found.type,
|
||||
gender: found.gender,
|
||||
abos: '',
|
||||
bookmarks: '',
|
||||
roles: getUserRole(found),
|
||||
}, function(err, done) {
|
||||
if (err) {
|
||||
console.error("User creation: Failed");
|
||||
console.error(err);
|
||||
} else {
|
||||
console.info("User created: "+ found.user);
|
||||
}
|
||||
if (done == null) {
|
||||
console.error("Can not create user.");
|
||||
}
|
||||
return cb(err);
|
||||
});
|
||||
} else {
|
||||
return cb(err);
|
||||
}
|
||||
return cb (err);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -62,7 +117,7 @@ const authorization = {
|
||||
|
||||
// Check whether to just validate current session ID
|
||||
if (user === '' && pwd === '') {
|
||||
console.log ("auth revalidate: " + req.session.user);
|
||||
console.log ("auth revalidate: " + req.session._id);
|
||||
if (req.session.user === undefined)
|
||||
return returnError();
|
||||
return returnSession ();
|
||||
@@ -72,8 +127,9 @@ const authorization = {
|
||||
Users.findById (req.body.user) .exec (function (err, entry) {
|
||||
// If there is a local user AND it has a password associated, test against this, and only this
|
||||
if (entry != null && entry.pwd) {
|
||||
console.info(entry);
|
||||
if (crypto.checkLocalAuth (entry, req.body.pwd)) {
|
||||
return fillSession (req, entry, common.arrayToHash(entry.roles), returnSession);
|
||||
return fillSession (req, entry, entry.roles, returnSession);
|
||||
}
|
||||
return returnError ();
|
||||
}
|
||||
@@ -95,15 +151,25 @@ const authorization = {
|
||||
entry.type = found.type;
|
||||
if (! entry.orclgender || entry.orclgender === "")
|
||||
entry.orclgender = found.orclgender;
|
||||
return fillSession (req, entry, entry.roles.length > 0 ? common.arrayToHash(entry.roles) : {user:true}, returnSession);
|
||||
return fillSession (req, entry, entry.roles.length > 0 ? entry.roles : {user:true}, returnSession);
|
||||
}
|
||||
|
||||
// Otherwise create standard user entry
|
||||
return fillSession (req, found, {user:true}, returnSession);
|
||||
saveFoundToDB(found, function() {
|
||||
return fillSession (req, found, {user:true}, returnSession);
|
||||
});
|
||||
});
|
||||
});
|
||||
},
|
||||
logout: function (req, res, next) {
|
||||
fillSession (req, undefined, undefined, function (err) {
|
||||
// Session delete, exists further in db
|
||||
req.session.destroy(function(err) {
|
||||
if (err) {
|
||||
console.error(err);
|
||||
}
|
||||
});
|
||||
// console.info(req.session);
|
||||
return res.json ({});
|
||||
});
|
||||
},
|
||||
|
||||
@@ -16,20 +16,22 @@ const dbs = {
|
||||
* -> Array of message schema object ids
|
||||
* Get ALL known message ids
|
||||
*/
|
||||
get: function(req, res) {
|
||||
model.Messages.find({},{_id: true}).exec()
|
||||
get: function (req, res) {
|
||||
model.Messages.find({}, {
|
||||
_id: true
|
||||
}).exec()
|
||||
.then(results => {
|
||||
//selects id from message:
|
||||
var parsed = [];
|
||||
for (var i in results) {
|
||||
parsed.push (results[i]._id);
|
||||
}
|
||||
res.send(parsed);
|
||||
} )
|
||||
.catch(err => {
|
||||
console.log (err);
|
||||
res.status(500).json(err);
|
||||
});
|
||||
//selects id from message:
|
||||
var parsed = [];
|
||||
for (var i in results) {
|
||||
parsed.push(results[i]._id);
|
||||
}
|
||||
res.send(parsed);
|
||||
})
|
||||
.catch(err => {
|
||||
console.log(err);
|
||||
res.status(500).json(err);
|
||||
});
|
||||
},
|
||||
},
|
||||
"msg/id": {
|
||||
@@ -38,10 +40,10 @@ const dbs = {
|
||||
* -> Message schema
|
||||
* Get a particular message
|
||||
*/
|
||||
get: function(req, res) {
|
||||
model.Messages.findById(req.params.id) .exec(function(err, result) {
|
||||
get: function (req, res) {
|
||||
model.Messages.findById(req.params.id).exec(function (err, result) {
|
||||
if (err) {
|
||||
console.log (err);
|
||||
console.log(err);
|
||||
res.status(404).json(err);
|
||||
} else {
|
||||
//console.log(JSON.stringify(result));
|
||||
@@ -56,22 +58,27 @@ const dbs = {
|
||||
* -> Message schema
|
||||
* Get a particular message
|
||||
*/
|
||||
get: function(req, res) {
|
||||
model.Messages.find(
|
||||
{$text: {$search: req.params.phrase}})
|
||||
.sort({tag:1, user:1, message:1, subject:1})
|
||||
.exec().then(results => {
|
||||
//selects id from message:
|
||||
var parsed = [];
|
||||
for (var i in results) {
|
||||
parsed.push (results[i]._id);
|
||||
}
|
||||
res.send(parsed);
|
||||
} )
|
||||
.catch(err => {
|
||||
console.log (err);
|
||||
res.status(500).json(err);
|
||||
});
|
||||
get: function (req, res) {
|
||||
model.Messages.find({
|
||||
$text: {
|
||||
$search: req.params.phrase
|
||||
}
|
||||
})
|
||||
.sort({
|
||||
tag: -1
|
||||
})
|
||||
.exec().then(results => {
|
||||
//selects id from message:
|
||||
var parsed = [];
|
||||
for (var i in results) {
|
||||
parsed.push(results[i]._id);
|
||||
}
|
||||
res.send(parsed);
|
||||
})
|
||||
.catch(err => {
|
||||
console.log(err);
|
||||
res.status(500).json(err);
|
||||
});
|
||||
},
|
||||
},
|
||||
"msg": {
|
||||
@@ -80,7 +87,7 @@ const dbs = {
|
||||
* -> Message schema
|
||||
* Create a new message
|
||||
*/
|
||||
post: function(req, res) {
|
||||
post: function (req, res) {
|
||||
/*
|
||||
if ( !(req.body.tags instanceof Array) ) {
|
||||
return res.status(400).json({ error: "bad request" });
|
||||
@@ -92,11 +99,13 @@ const dbs = {
|
||||
message: req.body.message,
|
||||
user: req.body.user,
|
||||
tag: req.body.tag
|
||||
}, function(err, result) {
|
||||
}, function (err, result) {
|
||||
if (err) {
|
||||
return res.status(401).json(err.message);
|
||||
} else {
|
||||
res.json({message: "Message created!!"});
|
||||
res.json({
|
||||
message: "Message created!!"
|
||||
});
|
||||
}
|
||||
if (result == null) {
|
||||
return res.status(500).json("Can not create message.")
|
||||
@@ -115,20 +124,22 @@ const dbs = {
|
||||
* -> Array of tag schema object ids
|
||||
* Get ALL known tag ids
|
||||
*/
|
||||
get: function(req, res) {
|
||||
model.Tags.find({},{_id: true}).exec()
|
||||
get: function (req, res) {
|
||||
model.Tags.find({}, {
|
||||
_id: true
|
||||
}).exec()
|
||||
.then(results => {
|
||||
//selects id from tag:
|
||||
var parsed = [];
|
||||
for (var i in results) {
|
||||
parsed.push (results[i]._id);
|
||||
}
|
||||
res.send(parsed);
|
||||
} )
|
||||
.catch(err => {
|
||||
console.log (err);
|
||||
res.status(500).json(err);
|
||||
});
|
||||
//selects id from tag:
|
||||
var parsed = [];
|
||||
for (var i in results) {
|
||||
parsed.push(results[i]._id);
|
||||
}
|
||||
res.send(parsed);
|
||||
})
|
||||
.catch(err => {
|
||||
console.log(err);
|
||||
res.status(500).json(err);
|
||||
});
|
||||
},
|
||||
},
|
||||
"tag/id": {
|
||||
@@ -137,17 +148,43 @@ const dbs = {
|
||||
* -> Tag schema
|
||||
* Get a particular tag
|
||||
*/
|
||||
get: function(req, res) {
|
||||
get: function (req, res) {
|
||||
model.Tags.findById(req.params.id)
|
||||
.exec(function(err, result) {
|
||||
if (err) {
|
||||
console.log (err);
|
||||
res.status(404).json(err);
|
||||
} else {
|
||||
//console.log(JSON.stringify(result));
|
||||
res.json(result);
|
||||
}
|
||||
});
|
||||
.exec(function (err, result) {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
res.status(404).json(err);
|
||||
} else {
|
||||
//console.log(req.params.id);
|
||||
res.json(result);
|
||||
}
|
||||
});
|
||||
},
|
||||
},
|
||||
"usr/bookmark/ids": {
|
||||
/* GET /api/usr/bookmark/ids [no args]
|
||||
* -> Array of message schema object ids
|
||||
* Get bookmark message ids
|
||||
*/
|
||||
|
||||
get: function (req, res) {
|
||||
model.Users.find({
|
||||
},
|
||||
function (err, result) {
|
||||
if (err) {
|
||||
return res.status(401).json(err.message);
|
||||
} else {
|
||||
var parsed = [];
|
||||
for (var i in result) {
|
||||
parsed.push(result[i].bookmarks);
|
||||
}
|
||||
console.log("bookmarks:" + JSON.stringify(parsed));
|
||||
res.send(parsed);
|
||||
}
|
||||
if (result == null) {
|
||||
return res.status(500).json("Can save bookmark.")
|
||||
}
|
||||
});
|
||||
},
|
||||
},
|
||||
"usr/id": {
|
||||
@@ -156,17 +193,19 @@ const dbs = {
|
||||
* -> User Schema
|
||||
* Get a particular user
|
||||
*/
|
||||
get: function(req, res) {
|
||||
model.Users.findById(req.params.id)
|
||||
.exec(function(err, result) {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
res.status(404).json(err);
|
||||
} else {
|
||||
//console.log(JSON.stringify(result));
|
||||
res.json(result);
|
||||
}
|
||||
});
|
||||
get: function (req, res) {
|
||||
model.Users.find({
|
||||
_id: req.params.id
|
||||
})
|
||||
.exec(function (err, result) {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
res.status(404).json(err);
|
||||
} else {
|
||||
console.log(result);
|
||||
res.json(result);
|
||||
}
|
||||
});
|
||||
},
|
||||
},
|
||||
"usr": {
|
||||
@@ -176,22 +215,22 @@ const dbs = {
|
||||
* Create a new user
|
||||
*/
|
||||
post: function(req, res) {
|
||||
model.User.create({
|
||||
_id: req.body.id,
|
||||
// console.info(req.body);
|
||||
model.Users.create({
|
||||
_id: req.body._id,
|
||||
name: req.body.name,
|
||||
mail: req.body.mail,
|
||||
type: req.body.type,
|
||||
roles: req.body.roles,
|
||||
hash: req.body.hash,
|
||||
salt: req.body.salt,
|
||||
pwd: req.body.pwd,
|
||||
gender: req.body.gender,
|
||||
abos: req.body.abos,
|
||||
bookmarks: req.body.bookmarks,
|
||||
roles: req.body.roles,
|
||||
}, function(err, result) {
|
||||
if (err) {
|
||||
console.log (err);
|
||||
console.log(err);
|
||||
return res.status(401).json(err.message);
|
||||
} else {
|
||||
res.json({message: "User created!!"});
|
||||
res.json({message: "User created!", user: req.body});
|
||||
}
|
||||
if (result == null) {
|
||||
return res.status(500).json("Can not create user.")
|
||||
@@ -203,15 +242,41 @@ const dbs = {
|
||||
* -> User schema
|
||||
* Change a user
|
||||
*/
|
||||
put: function(req, res) {
|
||||
model.Users.findById(reg.body._id)
|
||||
.exec(function(err, entry) {
|
||||
if (err)
|
||||
console.log (err);
|
||||
if (entry == null)
|
||||
return res.status(404).json(err.message);
|
||||
// TODO Catch edge cases
|
||||
entry.save(function(err, data) {
|
||||
put: function (req, res) {
|
||||
|
||||
model.Users.find({
|
||||
_id: req.body.userid
|
||||
})
|
||||
.exec(function (err, entry) {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
} else {
|
||||
|
||||
model.Users.update({
|
||||
_id: req.body.userid
|
||||
}, {
|
||||
bookmarks: req.body.bookmark
|
||||
}, function (err, data) {
|
||||
|
||||
if (err) {
|
||||
console.log(err);
|
||||
} else {
|
||||
res.json({
|
||||
id: "Bookmark saved"
|
||||
});
|
||||
}
|
||||
if (data == null) {
|
||||
return res.status(404).json(err.message);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
if (entry == null)
|
||||
return res.status(404).json(err.message);
|
||||
// TODO Catch edge cases
|
||||
|
||||
// TODO Save/Update user
|
||||
/*
|
||||
_id: req.body.id,
|
||||
@@ -224,9 +289,8 @@ const dbs = {
|
||||
abos: req.body.abos,
|
||||
bookmarks: req.body.bookmarks,
|
||||
*/
|
||||
res.json(data);
|
||||
// res.json(data);
|
||||
});
|
||||
});
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -241,7 +305,7 @@ const dbs = {
|
||||
* Local db: common.config.dbLocalConn
|
||||
* TH db: common.config.dbConn
|
||||
*/
|
||||
common.mongoose.connect (common.config.dbLocalConn, {
|
||||
common.mongoose.connect(common.config.dbConn, {
|
||||
useNewUrlParser: true
|
||||
}).then(() => {
|
||||
console.log("Database connected successfully.");
|
||||
@@ -258,63 +322,68 @@ const dbs = {
|
||||
* - per entry: _comment: Comment for Admin UI - TODO: not working yet
|
||||
*/
|
||||
var messageSchema = common.mongoose.Schema({
|
||||
subject: { type: String, required: true,
|
||||
_comment: "" },
|
||||
message: { type: String, required: true,
|
||||
_comment: "" },
|
||||
user: { type: String, required: true,
|
||||
_comment: "" },
|
||||
tag: { type: [String],
|
||||
_comment: "" },
|
||||
subject: {
|
||||
type: String,
|
||||
required: true,
|
||||
_comment: ""
|
||||
},
|
||||
message: {
|
||||
type: String,
|
||||
required: true,
|
||||
_comment: ""
|
||||
},
|
||||
user: {
|
||||
type: String,
|
||||
required: true,
|
||||
_comment: ""
|
||||
},
|
||||
tag: {
|
||||
type: [String],
|
||||
_comment: ""
|
||||
},
|
||||
//createtime: { type: Date, default: Date.now },
|
||||
});
|
||||
messageSchema.index({ "$**":'text' });
|
||||
messageSchema.index({
|
||||
"$**": 'text'
|
||||
});
|
||||
model.Messages = common.mongoose.model('messages', messageSchema);
|
||||
model.Messages._list = [ "" ];
|
||||
model.Messages._list = [""];
|
||||
|
||||
var tagSchema = common.mongoose.Schema({
|
||||
name: { type: String, required: true,
|
||||
_comment: "" }, //unique
|
||||
name: {
|
||||
type: String,
|
||||
required: true,
|
||||
_comment: ""
|
||||
}, //unique
|
||||
});
|
||||
model.Tags = common.mongoose.model('tags', messageSchema);
|
||||
model.Tags._list = [ "" ];
|
||||
model.Tags._list = [""];
|
||||
|
||||
var userSchema = common.mongoose.Schema({
|
||||
_id: { type: String },
|
||||
name: { type: String, required: true,
|
||||
_id: { type: String, required: true },
|
||||
name: { type: String,
|
||||
_comment: "" },
|
||||
mail: { type: String },
|
||||
type: { type: String },
|
||||
gender: { type: String },
|
||||
pwd: { type: String,
|
||||
_comment: "" },
|
||||
hash: { type: String },
|
||||
salt: { type: String },
|
||||
type: { type: String },
|
||||
roles: { type: [String], required: true,
|
||||
_comment: "" },
|
||||
abos: { type: [String],
|
||||
_comment: "" },
|
||||
//deactivated: { type: Boolean },
|
||||
//host: { type: Boolean },
|
||||
bookmarks: { type: [String],
|
||||
_comment: "" },
|
||||
sessionid: { type: String },
|
||||
roles: { type: String, required: true,
|
||||
_comment: "" },
|
||||
});
|
||||
model.Users = common.mongoose.model('users', userSchema);
|
||||
model.Users._list = [ "" ];
|
||||
model.Users._list = [""];
|
||||
},
|
||||
models: model,
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
app.get ("/api/msg/search/:phrase", function (req, res) {
|
||||
Message.find ({$text: {$search: req.params.phrase}) .then (function (err, results){
|
||||
if (err) {
|
||||
console.log (err);
|
||||
res .status(404) .json (err);
|
||||
} else {
|
||||
console.log(JSON.stringify(results));
|
||||
res.json(results);
|
||||
}
|
||||
});
|
||||
});
|
||||
*/
|
||||
module.exports = dbs;
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"dbConn": "mongodb://127.0.0.1:27017/om",
|
||||
"dbConn": "mongodb://om:aeg1phuKeDaixese@127.0.0.1:27017/om",
|
||||
"dbLocalConn": "mongodb://localhost:27017/omdb",
|
||||
"dbUser": "om",
|
||||
"dbPwd": "aeg1phuKeDaixese",
|
||||
|
||||