Compare commits

...
24 Commits
Author SHA1 Message Date
mandutzse68104 a6b7389201 Bericht ändernung 2019-08-09 13:12:58 +02:00
mandutzse68104 5ccde1e34c Merge remote-tracking branch 'origin/developer' into developer 2019-08-09 13:08:20 +02:00
mandutzse68104 8e018ad74a gesamtbericht 2019-08-09 13:07:53 +02:00
roemmelter63329 9e3981a7b1 Demo:fix 2019-07-24 19:00:53 +02:00
roemmelter63329 f727a5c44a Demo:fix 2019-07-24 18:53:48 +02:00
roemmelter63329 1165918cd6 Demo: fix 2019-07-24 18:50:30 +02:00
roemmelter63329 b891d8f516 Demo: fix3 2019-07-24 18:46:08 +02:00
roemmelter63329 0a3a45107a Demo: fix 2019-07-24 18:40:23 +02:00
roemmelter63329 90c5362a57 Demo: fix 2019-07-24 17:56:30 +02:00
roemmelter63329 675b9051dc Demo: exclude MemoryStore 2019-07-24 17:45:55 +02:00
roemmelter63329 e063535127 Demo: Update author role 2019-07-24 17:42:51 +02:00
roemmelter63329 2686af2208 Demo: Update Connection to MongoDB 2019-07-24 17:22:34 +02:00
roemmelter63329 81e6a60def Demo: Changes for ohm-server 2019-07-24 16:55:02 +02:00
roemmelter63329 389a744ebe Demo: changes for remote mongoDB 2019-07-24 16:54:35 +02:00
roemmelter63329 84e73466e1 Demo: out comment mong.js; changes for remote mongoDB 2019-07-24 16:37:22 +02:00
roemmelter63329 31ba4a0b8b Demo: out comment route validator only-login 2019-07-24 16:28:20 +02:00
roemmelter63329 dda5e89990 Demo: comment out session store 2019-07-24 16:12:04 +02:00
roemmelter63329 6a69bbcaf7 Global refactor 2019-07-24 12:36:43 +02:00
mandutzse68104 577f041928 mong.tags 2019-07-24 12:16:02 +02:00
mandutzse68104 285249254a Merge remote-tracking branch 'origin/developer' into developer
# Conflicts:
#	public/routes/msgCard.js
2019-07-23 21:42:14 +02:00
mandutzse68104 9f9d3c1480 bookmars 2019-07-23 21:41:27 +02:00
gruenzingerxe68435 9a16ed0480 Geht bei der Suche zurück zum Dashboard 2019-07-23 21:25:44 +02:00
gruenzingerxe68435 ce740b61ec Suche nach Links 2019-07-23 18:39:31 +02:00
gruenzingerxe68435 499f0764da fixed subscribe-btn 2019-07-23 17:44:03 +02:00
40 changed files with 1815 additions and 215 deletions

No files matched your search

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 131 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 129 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 599 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 165 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

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}
}
File diff suppressed because it is too large. Load diff
+6 -6
View File
@@ -1,13 +1,13 @@
var db = db.getSiblingDB('omdb'); var db = db.getSiblingDB('om');
// Delete all collections + all records // Delete all collections + all records
db.messages.deleteMany({}); //db.messages.deleteMany({});
db.tags.deleteMany({}); //db.tags.deleteMany({});
db.users.deleteMany({}); //db.users.deleteMany({});
db.sessions.deleteMany({}); //db.sessions.deleteMany({});
// Insert data in collections // Insert data in collections
load('mong_msg.js'); //load('mong_msg.js');
load('mong_tag.js'); load('mong_tag.js');
load('mong_usr.js'); load('mong_usr.js');
+1 -1
View File
@@ -1,3 +1,3 @@
db.tags.insert([ 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"}
]) ])
+4 -4
View File
@@ -1,8 +1,8 @@
db.users.insert([ db.users.insert([
// author,OHMNEWS2019 // User: author, Pwd: author
{"_id":"author","name":"Test Author","type":"author","roles":{"user":true,"author":true},"hash":"sha256","salt":"cy5CkPrplcEze6o4psURhw==","pwd":"Gc8ozlxjEGITkS+fW9tz2xLROzws44s04EOCWuP04qE=","abos":["wichtig","th"],"bookmarks":["th"],}, {"_id":"author","name":"Author","type":"PF@EFI;","roles":{"user":true,"author":true},"hash":"sha256","salt":"SIzKNsNKsCRVr8a9U90q6A==","pwd":"HZly68TSAKHioz6Kz0QCbXVTHpT6hMmabUbFYVlCMeE=","abos":[],"bookmarks":[]},
// admin,oZuse1 // User: admin, Pwd: SwenMho
{"_id":"admin","name":"Test Admin","type":"admin","roles":{"user":true,"author":true,"admin":true},"hash":"sha256","salt":"PoIUHbDp7tP34ji31iQ0zw==","pwd":"mJpIfIksYs6LJJwYRBemFKqR6TacsSl2E0ZtpO1GMuk=","abos":["wichtig","th"],"bookmarks":["wichtig"],}, // {"_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'), //var c = require('./server/crypto.js'),
+3 -4
View File
@@ -77,7 +77,6 @@
<script src="routes/bookmark.js"></script> <script src="routes/bookmark.js"></script>
<script src="routes/profil.js"></script> <script src="routes/profil.js"></script>
<script src="routes/msgCard.js"></script> <script src="routes/msgCard.js"></script>
<script src="routes/majorData.js"></script>
<script src="routes/profilCard.js"></script> <script src="routes/profilCard.js"></script>
<script src="routes/navRoutes.js"></script> <script src="routes/navRoutes.js"></script>
<script src="search.js"></script> <script src="search.js"></script>
@@ -88,13 +87,13 @@
<div class="om-header"> <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-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> <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> </div>
<div class="om-content"> <div class="om-content">
<div id=xxx></div> <div id=xxx></div>
<nav-router></nav-router> <nav-router :key="auth.user"></nav-router>
<router-view :key="vueRender.key"></router-view> <router-view :key="vueRender.key"></router-view>
</div> </div>
</div> </div>
@@ -104,8 +103,8 @@
router, router,
el: '#api', el: '#api',
data: { data: {
// Locally registered variables
vueRender : vueRender, vueRender : vueRender,
auth: auth,
}, },
}); });
</script> </script>
+1 -1
View File
@@ -152,7 +152,7 @@ Vue.component('login-panel', {
function successful_login(res) { function successful_login(res) {
console.info("Re-Auth: Correct credentials"); console.info("Re-Auth: Correct credentials");
this.closeLoginPanel; this.closeLoginPanel;
vueForceRender(); vueForceRender('key');
//console.log(res); //console.log(res);
router.push('/home') router.push('/home')
+10 -7
View File
@@ -1,18 +1,15 @@
const BookmarkRouter = { const BookmarkRouter = {
template: ` template: `
<div class="content"> <div class="content">
<div id="om-msg-cards" class="is-hidden-desktop"> <div id="om-msg-cards" class="column pull-right-sm is-four-fifths-desktop">
<h3>Gespeicherte Nachrichten </h3>
<MsgCard <MsgCard
v-for="id in msgDisplay" v-for="id in msgDisplay"
:key="id" :key="id"
:msg="messages[id] || {}" :msg="messages[id] || {}"
:isBookmark="bookmarkArray[id]"
></MsgCard> ></MsgCard>
</div> </div>
<div class="column is-three-quarters is-pulled-right is-hidden-touch content-desktop">
</div>
</div>`, </div>`,
data: function () { data: function () {
@@ -21,6 +18,7 @@ const BookmarkRouter = {
messages: _messages, messages: _messages,
isActive: true, isActive: true,
messageId: '', messageId: '',
bookmarkArray: auth.bookmarks,
} }
}, },
computed:{ computed:{
@@ -50,6 +48,7 @@ const BookmarkRouter = {
/*var _usrid = auth.user; /*var _usrid = auth.user;
$.ajax({ $.ajax({
url: "api/usr/id/" + _usrid, url: "api/usr/id/" + _usrid,
@@ -75,8 +74,12 @@ const BookmarkRouter = {
console.log(err); console.log(err);
}*/ }*/
} }
},
beforeMount: function(){
}, },
mounted: function (){ mounted: function (){
this.getMessages(); this.getMessages();
} },
}; };
+21 -17
View File
@@ -4,10 +4,11 @@ const CreateMsgRouter = {
<div class="column pull-right-sm is-four-fifths-desktop"> <div class="column pull-right-sm is-four-fifths-desktop">
<div id="mobile" class="om-card card"> <div id="mobile" class="om-card card">
<h4>Neue Nachricht erstellen</h4> <h4>Neue Nachricht erstellen</h4>
<b-field> <!--<b-field>
<b-input placeholder="User" id="user"></b-input> <b-input placeholder="User" id="user"></b-input>
</b-field> </b-field>-->
<label class="label">{{ userName }}</label>
<b-field> <b-field>
<b-input placeholder="Betreff" id="subject"></b-input> <b-input placeholder="Betreff" id="subject"></b-input>
</b-field> </b-field>
@@ -38,6 +39,7 @@ const CreateMsgRouter = {
data: function () { data: function () {
return { return {
auth: auth,
isDisabled: false, isDisabled: false,
selected: [], selected: [],
searchtext : "", searchtext : "",
@@ -45,13 +47,16 @@ const CreateMsgRouter = {
}; };
}, },
computed:{ computed:{
filteredDataArray() { filteredDataArray: function() {
return this.taglist.filter((option) => { return this.taglist.filter((option) => {
return option return option
.toString() .toString()
.toLowerCase() .toLowerCase()
.indexOf(this.searchtext.toLowerCase()) >= 0 .indexOf(this.searchtext.toLowerCase()) >= 0
}) })
},
userName: function() {
return 'User: '+auth.name;
} }
}, },
methods: { methods: {
@@ -62,8 +67,19 @@ const CreateMsgRouter = {
createMsg: function () { createMsg: function () {
var _subject = $("#subject").val(); var _subject = $("#subject").val();
var _message = $("#message").val(); var _message = $("#message").val();
var tmpArr = [];
tagArray.forEach(function(tag) {
console.info(tag);
tmpArr.push(tag.replace(/#/g, ''));
});
tagArray = tmpArr;
var _tag = tagArray; var _tag = tagArray;
var _user = auth.name != '' ? auth.name : $("#user").val(); 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); //console.log("Message Created: " + _tag + " " + _message + " " + _user);
$.ajax({ $.ajax({
url: "api/msg", url: "api/msg",
@@ -112,21 +128,9 @@ const CreateMsgRouter = {
}).fail(function (e, f, g) { }).fail(function (e, f, g) {
console.log("err: " + e + f + g); console.log("err: " + e + f + g);
}); });
} },
}, },
mounted: function () { 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) if ($(this).bootstrapMaterialDesign)
$(this).bootstrapMaterialDesign(); $(this).bootstrapMaterialDesign();
+43 -19
View File
@@ -2,14 +2,24 @@ const HomeRouter = {
template: ` template: `
<div> <div>
<div id="om-msg-cards" class="column pull-right-sm is-four-fifths-desktop"> <div id="om-msg-cards" class="column pull-right-sm is-four-fifths-desktop">
<a id="escape-search-link" @click="goBackToDashboard">< zurück zu allen Einträgen</a> <b-button id="escape-search-link"
<b-button id="subscribe-btn" type="is-primary" @click="changeSubscribtion"><div id="btn-text"></div></b-button> 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 <MsgCard
v-for="id in messagelist.slice().reverse()" v-for="id in messagelist.slice().reverse()"
:key="id" :key="id"
:msg="messages[id] || {}" :msg="messages[id] || {}"
:isBookmark="bookmarkArray[id]" :isBookmark="bookmarkArray[id]">
></MsgCard> </MsgCard>
</div> </div>
</div>`, </div>`,
data: function () { data: function () {
@@ -18,37 +28,51 @@ const HomeRouter = {
messages: _messages, messages: _messages,
isSearchActiv: _isSearchActiv, isSearchActiv: _isSearchActiv,
isSubscripeButtonActiv: _isSubscripeButtonActiv, isSubscripeButtonActiv: _isSubscripeButtonActiv,
isSubscriped: false,
subscripeTagName: '',
bookmarkArray: auth.bookmarks, bookmarkArray: auth.bookmarks,
vueRender: vueRender,
}; };
}, },
methods: { methods: {
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() { list_messages: function() {
messages(); messages();
}, },
goBackToDashboard: function() { goBackToDashboard: function() {
//Home neu rendern ... _isSearchActiv = false;
//windows.history.go(); this.$emit('reset-searchtext','');
router.push('/files') // $("#escape-search-link").css("visibility", "hidden");
router.push('/home') // $("#subscribe-btn").css("visibility", "hidden");
$("#escape-search-link").css("visibility", "hidden"); _isSubscripeButtonActiv = false;
$("#subscribe-btn").css("visibility", "hidden"); vueForceRender('key');
vueForceRender('search');
}, },
changeSubscribtion: function(){ changeSubscribtion: function(){
var btnString = $("#btn-text").text(); var btnString = $("#btn-text").text();
//console.log(btnString); console.log(btnString);
if($("#btn-text").hasClass("subscribed")){ if(this.isSubscriped){
$("#btn-text").removeClass("subscribed"); this.subscripeTagName.replace(/deabonnieren/g, '') + "abonnieren";
var newBtnString = "#" + $("#btn-text").text(/deabonnieren/g, '') + "abonnieren";
//console.log(btnString); //console.log(btnString);
$("#btn-text").text(newBtnString); // $("#btn-text").text(newBtnString);
}else{ }else{
$("#btn-text").addClass("subscribed"); this.subscripeTagName.replace(/abonnieren/g, '') + "deabonnieren";
var newBtnString = "#" + $("#btn-text").text(/abonnieren/g, '') + "deabonnieren";
//console.log(newBtnString); //console.log(newBtnString);
$("#btn-text").text(newBtnString); // $("#btn-text").text(newBtnString);
} }
this.isSubscriped = !this.isSubscriped;
vueForceRender('key');
} }
}, },
+71 -9
View File
@@ -1,32 +1,94 @@
// Global Variables // Global Variables
// User // User
var auth = {}, var auth = {},
majorList = [],
// Message // Message
_messagelist = [], _messagelist = [],
_messages = {}, _messages = {},
// Tag // Tag
_taglist = ["efi","wichtig"], _taglist = [],
_tags = [], _tags = [],
tagArray = [], tagArray = [],
// Search // Search
_isSearchActiv = false, _isSearchActiv = false,
_isSubscripeButtonActiv = true, _isSubscripeButtonActiv = false,
data = [], data = [],
search_data = [], search_data = [],
// Vue Rerender Key // Vue Rerender Key
vueRender = { key:0 }; vueRender = {
key: 0,
search: 0,
};
const authorRole = 'author'; 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 // Global Functions
function vueForceRender() { function vueForceRender(keyName) {
if (vueRender.key >= 10) { if (vueRender[keyName] >= 10) {
vueRender.key = 0; vueRender[keyName] = 0;
} }
vueRender.key++; vueRender[keyName]++;
} }
-46
View File
@@ -1,46 +0,0 @@
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'},
];
+10 -5
View File
@@ -3,7 +3,6 @@ Vue.component('MsgCard', {
<div class="om-card card"> <div class="om-card card">
<h6 class="msg-head"> <h6 class="msg-head">
<b>{{ msg.subject }}</b> <b>{{ msg.subject }}</b>
<div id="msgid" >{{msg._id}}</div>
<img src="favicon.ico" width=20px height=20px> <img src="favicon.ico" width=20px height=20px>
</h6> </h6>
{{ msg.message }}<br> {{ msg.message }}<br>
@@ -14,8 +13,8 @@ Vue.component('MsgCard', {
<i class="material-icons">account_circle</i> <i class="material-icons">account_circle</i>
Erstellt von {{ msg.user }} Erstellt von {{ msg.user }}
</div> </div>
<i id="bockmark-not-active" class="material-icons" :key="isActive" @click="myFilter(msg._id)" v-if="!isActive">bookmark_border</i> <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="isActive" @click="myFilter(msg._id)" v-else>bookmark</i> <i id="bockmark-active" class="material-icons" :key="vueRender.key" @click="myFilter(msg._id)" v-else>bookmark</i>
</div> </div>
</div>`, </div>`,
props: ['msg', 'isBookmark'], props: ['msg', 'isBookmark'],
@@ -23,9 +22,9 @@ Vue.component('MsgCard', {
data: function () { data: function () {
return { return {
isActive: this.isBookmark, isActive: this.isBookmark,
isActive_: 0,
msgid: this.msg._id, msgid: this.msg._id,
bookmarkArray: auth.bookmarks, bookmarkArray: auth.bookmarks,
vueRender: vueRender,
}; };
}, },
@@ -68,8 +67,14 @@ Vue.component('MsgCard', {
}*/ }*/
}, },
filterForTag: function (tag) { filterForTag: function (tag) {
console.log("link: " + tag); var btnString = "#" + tag + " abonnieren";
$("#btn-text").text(btnString);
$("#subscribe-btn").css("visibility", "visible");
//console.log("link: " + tag);
searching(tag); searching(tag);
var btnString = "#" + tag + " abonnieren";
$("#btn-text").text(btnString);
$("#subscribe-btn").css("visibility", "visible");
}, },
isBookmarkActive: function (msgid) { isBookmarkActive: function (msgid) {
//console.log("isBookmarkActive(): " + msgid); //console.log("isBookmarkActive(): " + msgid);
+3 -12
View File
@@ -11,7 +11,7 @@ Vue.component('nav-router', {
<i class="material-icons">search</i> <i class="material-icons">search</i>
</router-link> </router-link>
<router-link v-if="isAuthor" 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> <i class="material-icons">add_circle</i>
</router-link> </router-link>
@@ -37,7 +37,7 @@ Vue.component('nav-router', {
<i class="material-icons">search</i> Search <i class="material-icons">search</i> Search
</router-link></li> </router-link></li>
<li><router-link v-if="isAuthor" to="/createMessage"> <li><router-link v-if="auth.roles.author" to="/createMessage">
<i class="material-icons">add_circle</i> Create Message <i class="material-icons">add_circle</i> Create Message
</router-link></li> </router-link></li>
@@ -55,18 +55,9 @@ Vue.component('nav-router', {
</div>`, </div>`,
data: function() { data: function() {
return { return {
isAuthor: this.isAuthorCheck(), auth: auth,
}; };
}, },
methods: {
isAuthorCheck: function() {
console.info(auth.roles.author === authorRole);
return (auth.roles.author === authorRole);
},
},
updated: function() {
this.isAuthorChecked();
}
}); });
const routes = [ const routes = [
+25 -3
View File
@@ -11,7 +11,9 @@ Vue.component('profil-card', {
<div class="profil-text"> <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: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> <br><br>
</div> </div>
@@ -57,8 +59,20 @@ Vue.component('profil-card', {
}; };
}, },
computed: { computed: {
major: function() { majorOrFaculty: function() {
// e.g. ST@B-ME;ST@EFI; // e.g. ST@B-ME;ST@EFI;
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]; var majorID = auth.type.split(';')[0].split('@')[1];
//console.info(majorID); //console.info(majorID);
//console.info(majorList); //console.info(majorList);
@@ -69,13 +83,21 @@ Vue.component('profil-card', {
} }
}); });
return majorName; return majorName;
}
}, },
labelMajorOrFaculty: function() {
if (auth.roles.author) {
return 'Fakultät:'
} else {
return 'Studiengang:'
}
}
}, },
methods: { methods: {
logout: function() { logout: function() {
clearAuthState(); clearAuthState();
$.ajax({ url: "api/logout", method: "POST" }); $.ajax({ url: "api/logout", method: "POST" });
vueForceRender(); vueForceRender('key');
router.push('/profil'); router.push('/profil');
}, },
} }
+36 -20
View File
@@ -8,6 +8,7 @@ Vue.component('search',{
:data="filteredDataArray" :data="filteredDataArray"
placeholder="suche..." placeholder="suche..."
icon="magnify" icon="magnify"
@reset-searchtext="resetSearchtext($event)"
@select="option => selected = option"> @select="option => selected = option">
</b-autocomplete> </b-autocomplete>
<button class="clearButton" @click="clear">x</button> <button class="clearButton" @click="clear">x</button>
@@ -21,17 +22,20 @@ Vue.component('search',{
}; };
}, },
computed:{ computed:{
filteredDataArray() { filteredDataArray: function() {
return this.taglist.filter((option) => { return this.taglist.filter((option) => {
return option return option
.toString() .toString()
.toLowerCase() .toLowerCase()
.indexOf(this.searchtext.toLowerCase()) >= 0 .indexOf(this.searchtext.toLowerCase()) >= 0
}) });
} },
}, },
methods: { methods: {
getFilteredTags(text) { resetSearchtext: function(param) {
this.searchtext = param;
},
getFilteredTags: function(text) {
this.taglist = data.filter((option) => { this.taglist = data.filter((option) => {
return option return option
.toString() .toString()
@@ -41,7 +45,12 @@ Vue.component('search',{
this.search(); this.search();
}, },
search: function() { 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() { saveTagsToArray: function() {
tagArray = this.selected; tagArray = this.selected;
@@ -69,15 +78,17 @@ Vue.component('search',{
}); });
}, },
clear: function() { clear: function() {
//_isSearchActiv = false;
this.searchtext = ""; this.searchtext = "";
this.list_messages(); this.list_messages();
//router.push('/files') //router.push('/files')
//router.push('/home') //router.push('/home')
$("#escape-search-link").css("visibility", "hidden"); _isSearchActiv = false;
$("#subscribe-btn").css("visibility", "hidden"); _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() { mounted: function() {
@@ -92,24 +103,28 @@ function get_insert_tag(id) {
url: "api/tag/id/" + id, url: "api/tag/id/" + id,
method: "GET" method: "GET"
}).done(function(tag) { }).done(function(tag) {
data.push("#" + tag.name); data.push('#'+tag.name);
}).fail(function(e, f, g) { }).fail(function(e, f, g) {
console.log("cannot load " + id + ".json: " + e + f + g); console.log("cannot load " + id + ".json: " + e + f + g);
}) })
} }
function searching(searchtext) { function searching(searchtext,btnString) {
_isSearchActiv = true; _isSearchActiv = true;
$("#escape-search-link").css("visibility", "visible"); // $("#escape-search-link").css("visibility", "visible");
if(_taglist.indexOf(searchtext.replace(/#/g, '')) > -1){ //console.log(_tags);
var btnString = "#" + searchtext.replace(/#/g, '') + " abonnieren"; // console.log(data);
$("#btn-text").text(btnString); if(data.indexOf(searchtext) > -1){
$("#subscribe-btn").css("visibility", "visible"); btnString = searchtext + " abonnieren";
// $("#btn-text").text(btnString);
// $("#subscribe-btn").css("visibility", "visible");
_isSubscripeButtonActiv = true;
}else{ }else{
$("#subscribe-btn").css("visibility", "hidden"); // $("#subscribe-btn").css("visibility", "hidden");
_isSubscripeButtonActiv = false;
} }
if (searchtext !== '') {
$.ajax({ $.ajax({
url: "api/msg/search/" + searchtext.replace(/#/g, ''), url: "api/msg/search/" + searchtext.replace(/#/g, ''),
method: "GET" method: "GET"
@@ -126,7 +141,8 @@ function searching(searchtext) {
}).fail(function(e, f, g) { }).fail(function(e, f, g) {
console.log("searching: err: " + e + f + g); console.log("searching: err: " + e + f + g);
}) })
}
return btnString;
} }
function messages() { function messages() {
+3 -5
View File
@@ -241,15 +241,13 @@ button.clearButton {
float: right; float: right;
} }
} }
<<<<<<< HEAD
#subscribe-btn { #subscribe-btn {
float: right; float: right;
visibility: hidden; -visibility: hidden;
} }
#escape-search-link { #escape-search-link {
visibility: hidden; -visibility: hidden;
======= }
#bockmark-not-active { #bockmark-not-active {
visibility: visible; visibility: visible;
>>>>>>> origin/developer
} }
+3 -3
View File
@@ -287,11 +287,11 @@ button.clearButton{
#subscribe-btn{ #subscribe-btn{
float: right; float: right;
visibility: hidden; -visibility: hidden;
} }
#escape-search-link{ #escape-search-link{
visibility: hidden; -visibility: hidden;
}
#bockmark-not-active{ #bockmark-not-active{
visibility: visible; visibility: visible;
} }
+1 -1
View File
@@ -112,7 +112,7 @@ app.use('/api', api_routes);
app.use(express.static(__dirname + '/public')); app.use(express.static(__dirname + '/public'));
// Other stuff is NOT authorized unless logged in // 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! // No error so far? Then it's a 404!
app.use(function (req, res, next) { app.use(function (req, res, next) {
+7 -6
View File
@@ -14,13 +14,13 @@ const clientVisibleSession = { user: true, name: true, type: true, mail: true, r
// Return user role, query from found.mail // Return user role, query from found.mail
function getUserRole(found) { function getUserRole(found) {
var roles = "user"; var roles = "user:true";
var mail = found.mail; var mail = found.mail;
if (!/\d/.test(mail)) { if (!/\d/.test(mail)) {
// Mail contains no number // Mail contains no number
roles += ',"author"'; roles += ',"author:true"';
} }
return roles; return ('{'+roles+'}');
} }
// Fill in session object // Fill in session object
@@ -37,6 +37,7 @@ function fillSession (req, user, roles, cb) {
req.session.user = user._id; req.session.user = user._id;
} }
req.session.roles = roles; req.session.roles = roles;
console.info(req.session);
} }
return cb (err); return cb (err);
}); });
@@ -126,9 +127,9 @@ const authorization = {
Users.findById (req.body.user) .exec (function (err, entry) { 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 there is a local user AND it has a password associated, test against this, and only this
if (entry != null && entry.pwd) { if (entry != null && entry.pwd) {
console.info(entry);
if (crypto.checkLocalAuth (entry, req.body.pwd)) { if (crypto.checkLocalAuth (entry, req.body.pwd)) {
console.info(entry.roles); return fillSession (req, entry, entry.roles, returnSession);
return fillSession (req, entry, JSON.stringify(entry.roles), returnSession);
} }
return returnError (); return returnError ();
} }
@@ -150,7 +151,7 @@ const authorization = {
entry.type = found.type; entry.type = found.type;
if (! entry.orclgender || entry.orclgender === "") if (! entry.orclgender || entry.orclgender === "")
entry.orclgender = found.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 // Otherwise create standard user entry
+28 -45
View File
@@ -81,35 +81,6 @@ const dbs = {
}); });
}, },
}, },
"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.")
}
});
},
},
"msg": { "msg": {
/* POST /api/msg /* POST /api/msg
* <- Message schema * <- Message schema
@@ -190,6 +161,32 @@ const dbs = {
}); });
}, },
}, },
"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": { "usr/id": {
params: ":id", params: ":id",
/* GET /api/usr/[usr-id] /* GET /api/usr/[usr-id]
@@ -308,7 +305,7 @@ const dbs = {
* Local db: common.config.dbLocalConn * Local db: common.config.dbLocalConn
* TH db: common.config.dbConn * TH db: common.config.dbConn
*/ */
common.mongoose.connect(common.config.dbLocalConn, { common.mongoose.connect(common.config.dbConn, {
useNewUrlParser: true useNewUrlParser: true
}).then(() => { }).then(() => {
console.log("Database connected successfully."); console.log("Database connected successfully.");
@@ -380,7 +377,7 @@ const dbs = {
bookmarks: { type: [String], bookmarks: { type: [String],
_comment: "" }, _comment: "" },
sessionid: { type: String }, sessionid: { type: String },
roles: { type: [String], required: true, roles: { type: String, required: true,
_comment: "" }, _comment: "" },
}); });
model.Users = common.mongoose.model('users', userSchema); model.Users = common.mongoose.model('users', userSchema);
@@ -389,18 +386,4 @@ const dbs = {
models: model, 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; module.exports = dbs;
+1 -1
View File
@@ -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", "dbLocalConn": "mongodb://localhost:27017/omdb",
"dbUser": "om", "dbUser": "om",
"dbPwd": "aeg1phuKeDaixese", "dbPwd": "aeg1phuKeDaixese",