Compare commits

...
45 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
gruenzingerxe68435 bac8786ab4 Merge remote-tracking branch 'origin/developer' into developer
# Conflicts:
#	public/routes/home.js
#	public/style/style.css
#	public/style/style.less
2019-07-23 17:38:11 +02:00
gruenzingerxe68435 6529b1d937 verschiedenes 2019-07-23 17:34:57 +02:00
roemmelter63329 2d4850520d Vue Rerender function 2019-07-23 17:22:01 +02:00
mandutzse68104 b1d0a0f095 bookmark without color change 2019-07-23 16:07:14 +02:00
roemmelter63329 ae5360386a Session object deletion on logout; 2019-07-23 13:31:39 +02:00
roemmelter63329 85bca37a8c User creation on login (server-seitig) 2019-07-23 10:34:20 +02:00
mandutzse68104 a6dd34cf81 adding/ loading of bookmarks implemented (only for fixed User) 2019-07-22 23:01:01 +02:00
Edwina Barbalan 9eaf71ec3d Desktopansicht Profil und Home angepasst 2019-07-22 18:51:02 +02:00
gruenzingerxe68435 6eb741760f Button und Link für die Suche 2019-07-22 18:40:51 +02:00
roemmelter63329 3550f1558b Merge remote-tracking branch 'origin/developer' into developer 2019-07-22 16:56:33 +02:00
Edwina Barbalan b62927c28d Merge remote-tracking branch 'origin/developer' into developer
# Conflicts:
#	public/routes/createMessage.js
#	public/routes/files.js
2019-07-22 16:51:34 +02:00
Edwina Barbalan 0f06d8fcd7 Kleiner Fehler in buefy.css ausgebessert 2019-07-22 16:36:56 +02:00
Edwina Barbalan 613041d5cb Desktopansicht bei Suche/CreateMsg "verbessert" (Ohne doppelte Komponente" 2019-07-22 16:22:27 +02:00
roemmelter63329 783938821c Outsource global variables into 'initGlobals.js' 2019-07-22 14:15:20 +02:00
mandutzse68104 1f6261dba0 Merge remote-tracking branch 'origin/developer' into developer
# Conflicts:
#	public/routes/files.js
2019-07-21 15:27:04 +02:00
mandutzse68104 4aa5856fbc fixed createMessage/ files Tag autocomplete 2019-07-21 15:24:40 +02:00
Edwina Barbalan 57901853a9 Merge remote-tracking branch 'origin/developer' into developer 2019-07-21 15:20:42 +02:00
Edwina Barbalan 3eb0a99813 Desktopansicht auf allen Seiten angepasst 2019-07-21 15:20:32 +02:00
mandutzse68104 d003166e33 merge conflict 2019-07-21 14:22:37 +02:00
mandutzse68104 0097de5122 Merge remote-tracking branch 'origin/developer' into developer
# Conflicts:
#	public/index.html
#	public/routes/createMessage.js
2019-07-21 14:22:16 +02:00
mandutzse68104 5a4faca86f extended search 2019-07-21 14:12:16 +02:00
45 changed files with 2279 additions and 461 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
+10 -7
View File
@@ -1,12 +1,15 @@
var db = db.getSiblingDB('omdb'); var db = db.getSiblingDB('om');
// Insert data in collections
load('mong_msg.js');
load('mong_tag.js');
load('mong_usr.js');
// Delete all collections + all records // 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 // Print all collections + records count
var collections = db.getCollectionNames(); var collections = db.getCollectionNames();
+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"}
]) ])
+5 -5
View File
@@ -1,8 +1,8 @@
db.user.insert([ db.users.insert([
// author,OHMNEWS2019 // User: author, Pwd: author
{"_id":"author","name":"Test Author","type":"author","roles":["user","author"],"hash":"sha256","salt":"cy5CkPrplcEze6o4psURhw==","pwd":"Gc8ozlxjEGITkS+fW9tz2xLROzws44s04EOCWuP04qE=","tags":["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","author","admin"],"hash":"sha256","salt":"PoIUHbDp7tP34ji31iQ0zw==","pwd":"mJpIfIksYs6LJJwYRBemFKqR6TacsSl2E0ZtpO1GMuk=","tags":["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'),
+6 -16
View File
@@ -69,6 +69,7 @@
<script src="lib/jquery-3.3.1.min.js"></script> <script src="lib/jquery-3.3.1.min.js"></script>
<!-- NOTE: Include .js Routes --> <!-- NOTE: Include .js Routes -->
<script src="routes/initGlobals.js"></script>
<script src="routes/auth.js"></script><!-- Must load before profile.js --> <script src="routes/auth.js"></script><!-- Must load before profile.js -->
<script src="routes/home.js"></script> <script src="routes/home.js"></script>
<script src="routes/files.js"></script> <script src="routes/files.js"></script>
@@ -76,9 +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/messageData.js"></script>
<script src="routes/tagData.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>
@@ -89,14 +87,14 @@
<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="auth.user"></router-view> <router-view :key="vueRender.key"></router-view>
</div> </div>
</div> </div>
@@ -104,22 +102,14 @@
new Vue({ new Vue({
router, router,
el: '#api', el: '#api',
components: {
// Locally registered components
},
data: { data: {
// Locally registered variables vueRender : vueRender,
auth: auth, auth: auth,
}, },
computed:{
// Methods to change data appearance, does cache results
},
methods: {
// Methods to change data content, run always again
},
}); });
</script> </script>
<!-- NOTE: Call SW registration --> <!-- NOTE: Call SW registration -->
<script src="registerSW.js"></script> <script src="registerSW.js"></script>
+15 -5
View File
@@ -442,6 +442,15 @@ body {
line-height: 1.5; } line-height: 1.5; }
a { a {
color: #0046a0;
cursor: pointer;
text-decoration: none; }
a strong {
color: currentColor; }
a:hover {
color: #0046a0; }
a.menu-list {
color: white; color: white;
cursor: pointer; cursor: pointer;
text-decoration: none; } text-decoration: none; }
@@ -4139,7 +4148,7 @@ a.list-item {
font-size: 1.5rem; } font-size: 1.5rem; }
.menu-list { .menu-list {
line-height: 1.25; line-height: 1.5;
float: left; float: left;
width: 230px; width: 230px;
height: 100%; height: 100%;
@@ -4152,9 +4161,11 @@ a.list-item {
color: white; } color: white; }
.menu-list a { .menu-list a {
border-radius: 2px; border-radius: 2px;
padding-bottom: 5px;
display: block; display: block;
padding: 0.5em 0.75em; padding: 0.5em 0.75em;
background-color: #0046a0; } background-color: #0046a0;
color: white !important;}
.menu-list a:hover { .menu-list a:hover {
background-color: #01295d; background-color: #01295d;
color: white; } color: white; }
@@ -4166,9 +4177,8 @@ a.list-item {
margin: 0.75em; margin: 0.75em;
padding-left: 0.75em; padding-left: 0.75em;
background-color: #0046a0; } background-color: #0046a0; }
.menu-item li a { .menu-item li {
display: block; line-height: 1.5;
padding: 8px 16px;
text-decoration: none; text-decoration: none;
color: white; color: white;
} }
+41 -16
View File
@@ -1,12 +1,12 @@
var auth = {};
function clearAuthState() { function clearAuthState() {
auth.user = ''; // Login name auth.user = ''; // Login name
auth.name = ''; // Full name auth.name = ''; // Full name
auth.type = ''; // type of login (domain specific)
auth.mail = ''; // Full mail address auth.mail = ''; // Full mail address
auth.type = ''; // type of login (domain specific)
auth.roles = {}; // Role authorizations e.g. {user: true} auth.roles = {}; // Role authorizations e.g. {user: true}
auth.gender = ''; // Gender (e.g. Frau) auth.gender = ''; // Gender (e.g. Frau)
auth.abos = []; // Followed tags
auth.bookmarks = []; // Ids of bookmarks
} }
clearAuthState(); 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) // Login component: Login panel (if not logged in) or Logout element (if logged in)
Vue.component('login-panel', { Vue.component('login-panel', {
template: ` template: `
@@ -48,7 +75,7 @@ Vue.component('login-panel', {
</b-input> </b-input>
</b-field> </b-field>
<b-checkbox>Eingeloggt bleiben</b-checkbox> <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> </section>
<footer class="modal-card-foot"> <footer class="modal-card-foot">
<button class="button" type="button" @click.prevent="$parent.close()">Close</button> <button class="button" type="button" @click.prevent="$parent.close()">Close</button>
@@ -57,16 +84,16 @@ Vue.component('login-panel', {
</div>`, </div>`,
data: function () { data: function () {
return { return {
auth: auth,
user: '', user: '',
pwd: '', pwd: '',
error: false, error: false,
}; };
}, },
// TODO: Check if enough for session cookie re-login; checkbox // TODO: Check if enough for session cookie re-login; checkbox
// mounted: function() { // Doesn't work
// this.checkData(); beforeMount: function() {
// }, this.checkData();
},
methods: { methods: {
closeLoginPanel: function() { closeLoginPanel: function() {
this.$emit('close-login-panel'); this.$emit('close-login-panel');
@@ -94,6 +121,9 @@ Vue.component('login-panel', {
function successful_login(resData) { function successful_login(resData) {
fillAuthState(resData); fillAuthState(resData);
// updateUserInDB();
auth.abos = [];
auth.bookmarks = [];
console.info("Correct credentials"); console.info("Correct credentials");
this.closeLoginPanel; this.closeLoginPanel;
@@ -103,7 +133,7 @@ Vue.component('login-panel', {
function failed_login(err) { function failed_login(err) {
console.info("Wrong credentials"); console.info("Wrong credentials");
this.showError=true; this.error=true;
this.showLoginPanel; this.showLoginPanel;
console.log("error: " + err.responseText); console.log("error: " + err.responseText);
@@ -122,6 +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('key');
//console.log(res); //console.log(res);
router.push('/home') router.push('/home')
@@ -129,17 +160,11 @@ Vue.component('login-panel', {
function failed_login(err) { function failed_login(err) {
console.info("Re-Auth: Wrong credentials"); console.info("Re-Auth: Wrong credentials");
this.showError=true; this.error=true;
this.showLoginPanel; this.showLoginPanel;
console.log("error: " + err.responseText);
console.log(err); console.log(err);
} }
}, },
logout: function() {
clearAuthState();
$.ajax({ url: "api/logout", method: "POST" });
this.closeLoginPanel;
}
}, },
}); });
+69 -104
View File
@@ -1,120 +1,85 @@
const BookmarkRouter = { const BookmarkRouter = {
template: ` template: `
<div class="content"> <div class="content">
<div class="is-hidden-desktop"> <div id="om-msg-cards" class="column pull-right-sm is-four-fifths-desktop">
<div class="bookmark-headline"><h4>Gepeicherte Beiträge</h4></div> <h3>Gespeicherte Nachrichten </h3>
<div class="om-card card"> <MsgCard
<h6 class="msg-head"> v-for="id in msgDisplay"
<b>Betreff</b> :key="id"
<img src="favicon.ico" width=20px height=20px> :msg="messages[id] || {}"
</h6> :isBookmark="bookmarkArray[id]"
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> ></MsgCard>
<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> </div>
</div>`, </div>`,
data: function () { data: function () {
return { return {
messagelist: _messagelist,
messages: _messages, messages: _messages,
isActive: false, isActive: true,
messageId: '',
bookmarkArray: auth.bookmarks,
}
},
computed:{
msgDisplay: function(){
return (this.messagelist.slice().reverse());
} }
}, },
methods: { methods: {
myFilter () { myFilter: function() {
this.isActive = !this.isActive; 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();
},
}; };
+37 -68
View File
@@ -1,19 +1,14 @@
var tagArray = [];
const data=[
'th',
'efi',
'wichtig',
];
const CreateMsgRouter = { const CreateMsgRouter = {
template: ` template: `
<div class="content"> <div class="content">
<div class="is-hidden-desktop"> <div class="column pull-right-sm is-four-fifths-desktop">
<div id="mobile" class="content card om-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>
@@ -22,46 +17,12 @@ const CreateMsgRouter = {
<b-taginput <b-taginput
id="tag" id="tag"
v-model="selected" v-model="selected"
:data=taglist :data="filteredDataArray"
autocomplete autocomplete
allow-new:false allow-new:false
icon="label" icon="label"
placeholder="#" 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 class="column is-three-quarters is-pulled-right is-hidden-touch content-desktop">
<div id="desktop" class="content card om-card">
<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"> @input="saveTagsToArray">
</b-taginput> </b-taginput>
</b-field> </b-field>
@@ -81,9 +42,23 @@ const CreateMsgRouter = {
auth: auth, auth: auth,
isDisabled: false, isDisabled: false,
selected: [], selected: [],
searchtext : "",
taglist: data, 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: { methods: {
saveTagsToArray: function() { saveTagsToArray: function() {
tagArray = this.selected; tagArray = this.selected;
@@ -92,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",
@@ -128,6 +114,8 @@ const CreateMsgRouter = {
$.ajax({url: "api/tag/ids",method: "GET"}) $.ajax({url: "api/tag/ids",method: "GET"})
.done(jd => { .done(jd => {
// NICHT SO wg. Vue: _messagelist = jd; // NICHT SO wg. Vue: _messagelist = jd;
console.log("DATA: "+data);
if(data == ""){
_taglist.splice(0, _taglist.length); _taglist.splice(0, _taglist.length);
_taglist.push.apply(_taglist, jd); _taglist.push.apply(_taglist, jd);
console.log("tag: jd: " + jd); console.log("tag: jd: " + jd);
@@ -136,35 +124,16 @@ const CreateMsgRouter = {
get_insert_tag(jd[e]); get_insert_tag(jd[e]);
} }
} }
}
}).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'); //this.list_tags();
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();
if ($(this).bootstrapMaterialDesign) if ($(this).bootstrapMaterialDesign)
$(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);
})
}
+10 -11
View File
@@ -1,8 +1,7 @@
var tagArray = [];
const FileRouter = { const FileRouter = {
template: ` template: `
<div class="content"> <div class="content">
<div class="column is-four-fifths-desktop pull-right-sm">
<h4>Erweiterte Suche</h4> <h4>Erweiterte Suche</h4>
<b-field label="Suche nach"> <b-field label="Suche nach">
<b-select <b-select
@@ -21,16 +20,16 @@ const FileRouter = {
</b-field> </b-field>
<b-field v-if="selectedOptions=='tags'"> <b-field v-if="selectedOptions=='tags'">
<b-autocomplete rounded v-model="searchtext" <b-autocomplete v-model="searchtext"
:data="filteredDataArray" :data="filteredDataArray"
placeholder="suche..." icon="magnify" placeholder="#" icon="label"
@select="option => selected = option"> @select="option => selected = option">
</b-autocomplete> </b-autocomplete>
</b-field> </b-field>
<b-button type="is-primary" @click="search">SUCHE</b-button> <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 <MsgCard
v-for="id in messagelist.slice().reverse()" v-for="id in messagelist.slice().reverse()"
:key="id" :key="id"
@@ -38,6 +37,7 @@ const FileRouter = {
></MsgCard> ></MsgCard>
</div> </div>
</div> </div>
</div>
`, `,
data: function () { data: function () {
return { return {
@@ -47,6 +47,7 @@ const FileRouter = {
taglist: data, taglist: data,
messagelist: _messagelist, messagelist: _messagelist,
messages: _messages, messages: _messages,
isExtendedSearch: false,
} }
}, },
computed: { computed: {
@@ -63,10 +64,6 @@ const FileRouter = {
list_messages: function () { list_messages: function () {
messages(); messages();
}, },
saveTagsToArray: function () {
tagArray = this.selected;
console.info(tagArray);
},
getFilteredTags(text) { getFilteredTags(text) {
this.taglist = data.filter((option) => { this.taglist = data.filter((option) => {
return option return option
@@ -74,7 +71,6 @@ const FileRouter = {
.toLowerCase() .toLowerCase()
.indexOf(text.toLowerCase()) >= 0 .indexOf(text.toLowerCase()) >= 0
}) })
this.search();
}, },
list_tags: function () { list_tags: function () {
$.ajax({ $.ajax({
@@ -83,6 +79,7 @@ const FileRouter = {
}) })
.done(jd => { .done(jd => {
// NICHT SO wg. Vue: _messagelist = jd; // NICHT SO wg. Vue: _messagelist = jd;
if(data == ""){
_taglist.splice(0, _taglist.length); _taglist.splice(0, _taglist.length);
_taglist.push.apply(_taglist, jd); _taglist.push.apply(_taglist, jd);
console.log("tag: jd: " + jd); console.log("tag: jd: " + jd);
@@ -91,6 +88,7 @@ const FileRouter = {
get_insert_tag(jd[e]); get_insert_tag(jd[e]);
} }
} }
}
}).fail(function (e, f, g) { }).fail(function (e, f, g) {
console.log("err: " + e + f + g); console.log("err: " + e + f + g);
}); });
@@ -101,6 +99,7 @@ const FileRouter = {
}, },
search: function () { search: function () {
searching(this.searchtext); searching(this.searchtext);
this.isExtendedSearch=true;
}, },
list_messages: function () { list_messages: function () {
messages(); messages();
@@ -108,7 +107,7 @@ const FileRouter = {
}, },
mounted: function () { mounted: function () {
//this.search(); //this.search();
this.list_tags(); //this.list_tags();
//this.list_messages(); //this.list_messages();
}, },
}; };
+60 -66
View File
@@ -1,62 +1,81 @@
const HomeRouter = { const HomeRouter = {
template: ` template: `
<div id="om-msg-cards"> <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 <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] || {}"
></MsgCard> :isBookmark="bookmarkArray[id]">
</MsgCard>
</div>
</div>`, </div>`,
data: function () { data: function () {
return { return {
messagelist: _messagelist, messagelist: _messagelist,
messages: _messages, messages: _messages,
isSearchActiv: _isSearchActiv,
isSubscripeButtonActiv: _isSubscripeButtonActiv,
isSubscriped: false,
subscripeTagName: '',
bookmarkArray: auth.bookmarks,
vueRender: vueRender,
}; };
}, },
methods: { methods: {
/*refresh_messages: function () { updateHomeAboButton: function(content) {
_messages.push({ //////// alt this.subscripeTagName = content;
id: 42, console.info( this.subscripeTagName);
subject: "xxx", vueForceRender('key');
message: "warum habt ihr auch so viel", },
user: "nobody", toggleEscapeSearchLink: function() {
tags: "foo" console.info('got called');
}); this.isSearchActive = !this.isSearchActive;
},*/ vueForceRender('key');
console.info( this.isSearchActive);
},
list_messages: function() { list_messages: function() {
messages(); 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 () { mounted: function () {
this.list_messages(); this.list_messages();
//this.refresh_messages(); //this.refresh_messages();
@@ -70,28 +89,3 @@ function get_insert_message(id) {
console.log("cannot load " + id + ".json: " + e + f + g); 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);
});
});*/
+94
View File
@@ -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]++;
}
-46
View File
@@ -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'},
];
-2
View File
@@ -1,2 +0,0 @@
_messagelist = [];
_messages = {};
+71 -11
View File
@@ -1,5 +1,6 @@
Vue.component('MsgCard', { Vue.component('MsgCard', {
template: `<div class="om-card card"> template: `
<div class="om-card card">
<h6 class="msg-head"> <h6 class="msg-head">
<b>{{ msg.subject }}</b> <b>{{ msg.subject }}</b>
<img src="favicon.ico" width=20px height=20px> <img src="favicon.ico" width=20px height=20px>
@@ -7,28 +8,87 @@ Vue.component('MsgCard', {
{{ msg.message }}<br> {{ msg.message }}<br>
<a v-for="tag in msg.tag" @click="filterForTag(tag)">#{{ tag }} </a> <a v-for="tag in msg.tag" @click="filterForTag(tag)">#{{ tag }} </a>
<br> <br>
</p> <div class="om-card-footer">
<div class="om-card-footer"> <div class="om-user-line"> <div class="om-user-line">
<i class="material-icons">account_circle</i> <i class="material-icons">account_circle</i>
Erstellt von {{ msg.user }}</div> Erstellt von {{ msg.user }}
<i class="material-icons" @click="myFilter()" v-if="!isActive">bookmark_border</i> </div>
<i class="material-icons" @click="myFilter()" v-else="isActive">bookmark</i> <i id="bockmark-not-active" class="material-icons" :key="vueRender.key" @click="myFilter(msg._id)" v-if="!isActive">bookmark_border</i>
</div></div>`, <i id="bockmark-active" class="material-icons" :key="vueRender.key" @click="myFilter(msg._id)" v-else>bookmark</i>
props: ['msg'], </div>
</div>`,
props: ['msg', 'isBookmark'],
data: function () { data: function () {
return { return {
isActive: false, isActive: this.isBookmark,
msgid: this.msg._id,
bookmarkArray: auth.bookmarks,
vueRender: vueRender,
}; };
}, },
methods: { 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; 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) { 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) {
//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();
} }
}); });
+12 -7
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 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>
@@ -29,23 +29,23 @@ Vue.component('nav-router', {
<div class="column is-sidebar-menu is-hidden-touch"> <div class="column is-sidebar-menu is-hidden-touch">
<aside class="menu is-medium"> <aside class="menu is-medium">
<ul class="menu-list"> <ul class="menu-list">
<li><router-link to="/home" class="is-hidden-touch"> <li><router-link to="/home">
<i class="material-icons">home</i> Home <i class="material-icons">home</i> Home
</router-link></li> </router-link></li>
<li><router-link to="/files" class="is-hidden-touch"> <li><router-link to="/files">
<i class="material-icons">language</i> Language <i class="material-icons">search</i> Search
</router-link></li> </router-link></li>
<li><router-link to="/createMessage" class="is-hidden-touch"> <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>
<li><router-link to="/bookmark" class="is-hidden-touch"> <li><router-link to="/bookmark">
<i class="material-icons">bookmark</i> Bookmark <i class="material-icons">bookmark</i> Bookmark
</router-link></li> </router-link></li>
<li><router-link to="/profil" class="is-hidden-touch"> <li><router-link to="/profil">
<i class="material-icons">person</i> Profil <i class="material-icons">person</i> Profil
</router-link></li> </router-link></li>
</ul> </ul>
@@ -53,6 +53,11 @@ Vue.component('nav-router', {
</div> </div>
</div> </div>
</div>`, </div>`,
data: function() {
return {
auth: auth,
};
},
}); });
const routes = [ const routes = [
+2
View File
@@ -1,6 +1,7 @@
const ProfilRouter = { const ProfilRouter = {
template: ` template: `
<div> <div>
<div class="column pull-right-sm is-four-fifths-desktop">
<div v-if="isAuth"> <div v-if="isAuth">
<profil-card></profil-card> <profil-card></profil-card>
</div> </div>
@@ -17,6 +18,7 @@ const ProfilRouter = {
<login-panel></login-panel> <login-panel></login-panel>
</b-modal> </b-modal>
</div> </div>
</div>
</div>`, </div>`,
data: function () { data: function () {
return { return {
+30 -7
View File
@@ -11,22 +11,24 @@ 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>
<hr class="first"> <hr class="first">
<div class="btnprofil"> <div class="btnprofil">
<button @click="isCardModalActive = true"><b>Abonniert: <br/>{{ abo }}</b> <br/></button> <button @click="isCardModalActive = true"><b>Abonniert: <br/>{{ abos }}</b> <br/></button>
<button @click="$router.push('/bookmark')"><b>Gespeichert:<br/> {{ saved }}</b><br/></button> <button @click="$router.push('/bookmark')"><b>Gespeichert:<br/> {{ bookmarks }}</b><br/></button>
</div> </div>
<section> <section>
<b-modal :active.sync="isCardModalActive" :width="600" scroll="keep"> <b-modal :active.sync="isCardModalActive" :width="600" scroll="keep">
<div class="card"> <div class="card">
<header class="modal-card-head"> <header class="modal-card-head">
<p class="modal-card-title">Abonnierte Kanäle</p> <p class="modal-card-title">Abonnierte Tags</p>
</header> </header>
<div class="card-content"> <div class="card-content">
<div class="content"> <div class="content">
@@ -51,14 +53,26 @@ Vue.component('profil-card', {
data: function () { data: function () {
return { return {
auth: auth, auth: auth,
abo: 7, abos: auth.abos ? auth.abos.length : '-',
saved: 3, bookmarks: auth.bookmarks ? auth.bookmarks.length : '-',
isCardModalActive: false, isCardModalActive: false,
}; };
}, },
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,12 +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('key');
router.push('/profil'); router.push('/profil');
}, },
} }
-2
View File
@@ -1,2 +0,0 @@
_taglist = [];
_tags = [];
+46 -24
View File
@@ -1,13 +1,3 @@
var isSearchActive = false,
tagArray = ["lorem"];
const dat=[
'th',
'efi',
'wichtig',
],
search_data = [];
Vue.component('search',{ Vue.component('search',{
template: ` template: `
<form class="om-searchbar" @submit.prevent="search()"> <form class="om-searchbar" @submit.prevent="search()">
@@ -18,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>
@@ -27,22 +18,25 @@ Vue.component('search',{
return { return {
searchtext: "", searchtext: "",
selected: [], selected: [],
taglist: dat, taglist: data,
}; };
}, },
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.taglist = dat.filter((option) => { this.searchtext = param;
},
getFilteredTags: function(text) {
this.taglist = data.filter((option) => {
return option return option
.toString() .toString()
.toLowerCase() .toLowerCase()
@@ -51,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;
@@ -64,6 +63,7 @@ Vue.component('search',{
$.ajax({url: "api/tag/ids", method: "GET"}) $.ajax({url: "api/tag/ids", method: "GET"})
.done(jd => { .done(jd => {
// NICHT SO wg. Vue: _messagelist = jd; // NICHT SO wg. Vue: _messagelist = jd;
if(data == ""){
_taglist.splice(0, _taglist.length); _taglist.splice(0, _taglist.length);
_taglist.push.apply(_taglist, jd); _taglist.push.apply(_taglist, jd);
// console.log("tag: jd: " + jd); // console.log("tag: jd: " + jd);
@@ -72,16 +72,23 @@ Vue.component('search',{
get_insert_tag(jd[e]); get_insert_tag(jd[e]);
} }
} }
}
}).fail(function (e, f, g) { }).fail(function (e, f, g) {
console.log("err: " + e + f + g); console.log("err: " + e + f + g);
}); });
}, },
clear: function() { clear: function() {
console.log("clear");
isSearchActiv = false;
this.searchtext = ""; this.searchtext = "";
this.list_messages(); 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() { mounted: function() {
@@ -96,15 +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) {
dat.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;
console.log("Searchtext: " + searchtext.replace(/#/g, '')); // $("#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({ $.ajax({
url: "api/msg/search/" + searchtext.replace(/#/g, ''), url: "api/msg/search/" + searchtext.replace(/#/g, ''),
method: "GET" method: "GET"
@@ -122,6 +142,8 @@ function searching(searchtext) {
console.log("searching: err: " + e + f + g); console.log("searching: err: " + e + f + g);
}) })
} }
return btnString;
}
function messages() { function messages() {
$.ajax({ $.ajax({
+17 -2
View File
@@ -31,10 +31,10 @@
overflow: hidden; overflow: hidden;
} }
.om-content a { .om-content a {
color: white; color: #0046a0;
} }
.om-content a:hover { .om-content a:hover {
color: white; color: #0046a0;
} }
.content-desktop { .content-desktop {
margin-right: 30px; margin-right: 30px;
@@ -236,3 +236,18 @@ button.clearButton {
.taglink { .taglink {
color: #0046a0; 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;
}
+21 -2
View File
@@ -37,8 +37,8 @@
width: auto; width: auto;
overflow: hidden; overflow: hidden;
a{ a{
color: white; color: #0046a0;
&:hover{color:white;} &:hover{color: #0046a0;}
} }
} }
@@ -279,3 +279,22 @@ button.clearButton{
color: @color; 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;
}
+3 -3
View File
@@ -53,8 +53,8 @@ app.disable('x-powered-by');
app.set('trust proxy', 1) // trust first proxy, neccessary for cookie secure: true flag app.set('trust proxy', 1) // trust first proxy, neccessary for cookie secure: true flag
app.use(session({ app.use(session({
secret: 'ahhgylhuvh', // caesar(3) 2 letter surname secret: 'ahhgylhuvh', // caesar(3) 2 letter surname
resave: false, saveUninitialized: false, // don't create session until something stored
saveUninitialized: false, resave: false, //don't save session if unmodified
cookie: { cookie: {
maxAge: 30 * 24 * 3600 * 1000, // TODO: ttl for session as well (Store) 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) secure: true, // true for https only (since our app works only with https)
@@ -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) {
+69 -3
View File
@@ -12,21 +12,76 @@ const ldap = require ('./ldap_ohm'),
const serverVisibleSession = { user: true, name: true, type: true, mail: true, roles: true, gender: true, deactivated: true, host: true }; 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 }; 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 // Fill in session object
function fillSession (req, user, roles, cb) { function fillSession (req, user, roles, cb) {
if (req.session === undefined) if (req.session === undefined)
next (common.genError (500, "Error")); next (common.genError (500, "Error"));
// regenerate a new session-id with clean instance
if (user !== undefined && roles !== undefined) {
req.session.regenerate (function (err) { req.session.regenerate (function (err) {
if (user !== undefined && ! err) { if (user !== undefined && ! err) {
common.shallowCopy (user, serverVisibleSession, {roles: true}, req.session); common.shallowCopy (user, serverVisibleSession, {roles: true}, req.session);
// console.info(req.session);
if (user._id) { if (user._id) {
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);
}); });
} 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);
}
});
} }
const authorization = { const authorization = {
@@ -62,7 +117,7 @@ const authorization = {
// Check whether to just validate current session ID // Check whether to just validate current session ID
if (user === '' && pwd === '') { if (user === '' && pwd === '') {
console.log ("auth revalidate: " + req.session.user); console.log ("auth revalidate: " + req.session._id);
if (req.session.user === undefined) if (req.session.user === undefined)
return returnError(); return returnError();
return returnSession (); return returnSession ();
@@ -72,8 +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)) {
return fillSession (req, entry, common.arrayToHash(entry.roles), returnSession); return fillSession (req, entry, entry.roles, returnSession);
} }
return returnError (); return returnError ();
} }
@@ -95,15 +151,25 @@ 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
saveFoundToDB(found, function() {
return fillSession (req, found, {user:true}, returnSession); return fillSession (req, found, {user:true}, returnSession);
}); });
}); });
});
}, },
logout: function (req, res, next) { logout: function (req, res, next) {
fillSession (req, undefined, undefined, function (err) { 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 ({}); return res.json ({});
}); });
}, },
+121 -52
View File
@@ -17,7 +17,9 @@ const dbs = {
* Get ALL known message ids * Get ALL known message ids
*/ */
get: function (req, res) { get: function (req, res) {
model.Messages.find({},{_id: true}).exec() model.Messages.find({}, {
_id: true
}).exec()
.then(results => { .then(results => {
//selects id from message: //selects id from message:
var parsed = []; var parsed = [];
@@ -57,9 +59,14 @@ const dbs = {
* Get a particular message * Get a particular message
*/ */
get: function (req, res) { get: function (req, res) {
model.Messages.find( model.Messages.find({
{$text: {$search: req.params.phrase}}) $text: {
.sort({tag:1, user:1, message:1, subject:1}) $search: req.params.phrase
}
})
.sort({
tag: -1
})
.exec().then(results => { .exec().then(results => {
//selects id from message: //selects id from message:
var parsed = []; var parsed = [];
@@ -96,7 +103,9 @@ const dbs = {
if (err) { if (err) {
return res.status(401).json(err.message); return res.status(401).json(err.message);
} else { } else {
res.json({message: "Message created!!"}); res.json({
message: "Message created!!"
});
} }
if (result == null) { if (result == null) {
return res.status(500).json("Can not create message.") return res.status(500).json("Can not create message.")
@@ -116,7 +125,9 @@ const dbs = {
* Get ALL known tag ids * Get ALL known tag ids
*/ */
get: function (req, res) { get: function (req, res) {
model.Tags.find({},{_id: true}).exec() model.Tags.find({}, {
_id: true
}).exec()
.then(results => { .then(results => {
//selects id from tag: //selects id from tag:
var parsed = []; var parsed = [];
@@ -144,12 +155,38 @@ const dbs = {
console.log(err); console.log(err);
res.status(404).json(err); res.status(404).json(err);
} else { } else {
//console.log(JSON.stringify(result)); //console.log(req.params.id);
res.json(result); 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": { "usr/id": {
params: ":id", params: ":id",
/* GET /api/usr/[usr-id] /* GET /api/usr/[usr-id]
@@ -157,13 +194,15 @@ const dbs = {
* Get a particular user * Get a particular user
*/ */
get: function (req, res) { get: function (req, res) {
model.Users.findById(req.params.id) model.Users.find({
_id: req.params.id
})
.exec(function (err, result) { .exec(function (err, result) {
if (err) { if (err) {
console.log(err); console.log(err);
res.status(404).json(err); res.status(404).json(err);
} else { } else {
//console.log(JSON.stringify(result)); console.log(result);
res.json(result); res.json(result);
} }
}); });
@@ -176,22 +215,22 @@ const dbs = {
* Create a new user * Create a new user
*/ */
post: function(req, res) { post: function(req, res) {
model.User.create({ // console.info(req.body);
_id: req.body.id, model.Users.create({
_id: req.body._id,
name: req.body.name, name: req.body.name,
mail: req.body.mail,
type: req.body.type, type: req.body.type,
roles: req.body.roles, gender: req.body.gender,
hash: req.body.hash,
salt: req.body.salt,
pwd: req.body.pwd,
abos: req.body.abos, abos: req.body.abos,
bookmarks: req.body.bookmarks, bookmarks: req.body.bookmarks,
roles: req.body.roles,
}, function(err, result) { }, function(err, result) {
if (err) { if (err) {
console.log(err); console.log(err);
return res.status(401).json(err.message); return res.status(401).json(err.message);
} else { } else {
res.json({message: "User created!!"}); res.json({message: "User created!", user: req.body});
} }
if (result == null) { if (result == null) {
return res.status(500).json("Can not create user.") return res.status(500).json("Can not create user.")
@@ -204,14 +243,40 @@ const dbs = {
* Change a user * Change a user
*/ */
put: function (req, res) { put: function (req, res) {
model.Users.findById(reg.body._id)
model.Users.find({
_id: req.body.userid
})
.exec(function (err, entry) { .exec(function (err, entry) {
if (err) if (err) {
console.log(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) if (entry == null)
return res.status(404).json(err.message); return res.status(404).json(err.message);
// TODO Catch edge cases // TODO Catch edge cases
entry.save(function(err, data) {
// TODO Save/Update user // TODO Save/Update user
/* /*
_id: req.body.id, _id: req.body.id,
@@ -224,8 +289,7 @@ const dbs = {
abos: req.body.abos, abos: req.body.abos,
bookmarks: req.body.bookmarks, bookmarks: req.body.bookmarks,
*/ */
res.json(data); // res.json(data);
});
}); });
}, },
}, },
@@ -241,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.");
@@ -258,44 +322,63 @@ const dbs = {
* - per entry: _comment: Comment for Admin UI - TODO: not working yet * - per entry: _comment: Comment for Admin UI - TODO: not working yet
*/ */
var messageSchema = common.mongoose.Schema({ var messageSchema = common.mongoose.Schema({
subject: { type: String, required: true, subject: {
_comment: "" }, type: String,
message: { type: String, required: true, required: true,
_comment: "" }, _comment: ""
user: { type: String, required: true, },
_comment: "" }, message: {
tag: { type: [String], type: String,
_comment: "" }, required: true,
_comment: ""
},
user: {
type: String,
required: true,
_comment: ""
},
tag: {
type: [String],
_comment: ""
},
//createtime: { type: Date, default: Date.now }, //createtime: { type: Date, default: Date.now },
}); });
messageSchema.index({ "$**":'text' }); messageSchema.index({
"$**": 'text'
});
model.Messages = common.mongoose.model('messages', messageSchema); model.Messages = common.mongoose.model('messages', messageSchema);
model.Messages._list = [""]; model.Messages._list = [""];
var tagSchema = common.mongoose.Schema({ var tagSchema = common.mongoose.Schema({
name: { type: String, required: true, name: {
_comment: "" }, //unique type: String,
required: true,
_comment: ""
}, //unique
}); });
model.Tags = common.mongoose.model('tags', messageSchema); model.Tags = common.mongoose.model('tags', messageSchema);
model.Tags._list = [""]; model.Tags._list = [""];
var userSchema = common.mongoose.Schema({ var userSchema = common.mongoose.Schema({
_id: { type: String }, _id: { type: String, required: true },
name: { type: String, required: true, name: { type: String,
_comment: "" }, _comment: "" },
mail: { type: String },
type: { type: String },
gender: { type: String },
pwd: { type: String, pwd: { type: String,
_comment: "" }, _comment: "" },
hash: { type: String }, hash: { type: String },
salt: { type: String }, salt: { type: String },
type: { type: String },
roles: { type: [String], required: true,
_comment: "" },
abos: { type: [String], abos: { type: [String],
_comment: "" }, _comment: "" },
//deactivated: { type: Boolean }, //deactivated: { type: Boolean },
//host: { type: Boolean }, //host: { type: Boolean },
bookmarks: { type: [String], bookmarks: { type: [String],
_comment: "" }, _comment: "" },
sessionid: { type: String },
roles: { type: String, required: true,
_comment: "" },
}); });
model.Users = common.mongoose.model('users', userSchema); model.Users = common.mongoose.model('users', userSchema);
model.Users._list = [""]; model.Users._list = [""];
@@ -303,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",