Commit f92871f7 authored by kajdehoop's avatar kajdehoop

removed files

parent e10060a6

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.
The MIT License
Copyright (c) 2015-2016 Google, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
<div id="wrapper" class="toggled">
<div id="sidebar-wrapper">
<ul class="sidebar-nav">
<li class="sidebar-brand">
<a [routerLink]="['/login']" class="navbar-block" style="border-bottom: #999 solid 1px;">
<img alt="Brand" class="img-circle navbar-image" [src]="ZonImg">
<img alt="Brand" class="navbar-image" style="height:100px;" [src]="SUNlogoImg">
</a>
</li>
<li *ngFor="let profile of profile;">
<a [routerLink]="['/profile', profile.student_number]" class="navbar-block">
<img *ngIf="profile.img==null" class="img-circle navbar-image" [src]="AvatarImg">
<img *ngIf="profile.img!=null" class="img-circle navbar-image" [src]="profile.img">
<span style="line-height:40px">
<strong>{{profile.name}} {{profile.sur_name}}</strong>
</span>
</a>
</li>
<li *ngFor="let item of associations;let i = index;" class="dropdown" id="association{{i}}">
<a [routerLink]="['/association', item.slug]" class="dropdown-toggle navbar-item" data-toggle="dropdown">
<img class="img-circle navbar-image association-image" style="height:50px;width:50px;" [src]="item.img" />
<strong class="association-title">{{item.title}}</strong><br>
<span class="association-role">{{item.role}}</span>
</a>
<ul class="association-item">
<li *ngFor="let page of item.pages">
<a [routerLink]="[page.routerlink, item.slug]" class="dropdown-item">{{page.title}}</a>
</li>
</ul>
</li>
</ul>
<div id="search-association">
<i class="material-icons add">search</i>
<input id="search-association-field" type="text" name="associationName" maxlength="20" value="Search...">
</div>
</div>
<div id="page-content-wrapper">
<router-outlet></router-outlet>
</div>
</div>
\ No newline at end of file
import { MyProfileComponent } from './views/profile.component';
import { MembersComponent } from './views/members.component';
import { AssociationComponent } from './views/association.component';
import { Component } from '@angular/core';
import { OAuthService } from 'angular-oauth2-oidc';
import { Local } from './settings/local';
import { Develop } from './settings/develop';
import { Production } from './settings/production';
import { User, API } from './settings/settings';
import { Http, Headers, RequestOptions, Response } from '@angular/http';
@Component({
selector: 'sun-app',
templateUrl: './app.component.html'
})
export class AppComponent {
public info: string = "Student Union Network";
associations = [];
profile = [];
ZonImg = "images/zon.jpg";
SUNlogoImg = "images/sun-logo-01.png";
AvatarImg = "images/icon-user-default.png";
authauthenticated = true;
constructor(private http: Http, private oauthService: OAuthService) {
var env = Production;
// URL of the SPA to redirect the user to after login
this.oauthService.redirectUri = env.redirectUri//window.location.origin + "/index.html";
// The SPA's id. The SPA is registerd with this id at the auth-server
this.oauthService.clientId = env.clientId;
// set the scope for the permissions the client should request
// The first three are defined by OIDC. The 4th is a usecase-specific one
this.oauthService.scope = env.scope;
// set to true, to receive also an id_token via OpenId Connect (OIDC) in addition to the
// OAuth2-based access_token
this.oauthService.oidc = true;
// Use setStorage to use sessionStorage or another implementation of the TS-type Storage
// instead of localStorage
this.oauthService.setStorage(sessionStorage);
this.oauthService.issuer = env.issuer;
// Set a dummy secret
// Please note that the auth-server used here demand the client to transmit a client secret, although
// the standard explicitly cites that the password flow can also be used without it. Using a client secret
// does not make sense for a SPA that runs in the browser. That's why the property is called dummyClientSecret
// Using such a dummy secreat is as safe as using no secret.
//this.oauthService.dummyClientSecret = "Aigh#ei8ahn3";
// Load Discovery Document and then try to login the user
this.oauthService.loadDiscoveryDocument().then(() => {
// This method just tries to parse the token(s) within the url when
// the auth-server redirects the user back to the web-app
// It dosn't send the user the the login page
this.oauthService.tryLogin({});
});
}
ngOnInit() {
let headers: Headers = new Headers();
headers.append('Content-Type', 'application/json');
headers.append('Authorization', 'JWT ' + User.APIkey);
let options = new RequestOptions({ headers: headers });
this.http.get(API.url + 'profiles/' + User.selected_profile, options).map(res => res.json()).subscribe(response => {
this.profile.push({ name: response.given_name, sur_name: response.surname, student_number: response.student_number });
});
this.http.get(API.url + 'profiles/' + User.selected_profile, { headers: headers }).map(res => res.json()).subscribe(response => {
for (var key in response.associations) {
let url = response.associations[key].association;
this.http.get(url, { headers: headers }).map(r => r.json()).subscribe(result => {
this.associations.push({
title: result.name, slug: result.slug, role: 'board', img: 'images/' + result.logo, pages: [
{ title: 'All members', routerlink: '/members' }
]
});
});
};
});
}
}
import { AppComponent } from "./app.component";
import { NgModule } from "@angular/core";
import { BrowserModule } from "@angular/platform-browser";
import { HttpModule } from "@angular/http";
import { FormsModule, ReactiveFormsModule } from "@angular/forms";
import { BASE_URL } from "./app.tokens";
import { SharedModule } from "./shared/shared.module";
import { AppRouterModule } from "./app.routes";
import { HomeComponent } from "./home/home.component";
import { MyProfileComponent } from "./views/profile.component";
import { OAuthModule } from 'angular-oauth2-oidc';
import { MembersComponent } from "./views/members.component";
import { AssociationComponent } from "./views/association.component";
@NgModule({
imports: [
BrowserModule,
HttpModule,
FormsModule,
ReactiveFormsModule,
SharedModule.forRoot(),
AppRouterModule,
OAuthModule.forRoot()
],
declarations: [
AppComponent,
HomeComponent,
MyProfileComponent,
MembersComponent,
AssociationComponent,
],
providers: [{ provide: BASE_URL, useValue: "https://localhost:3000" }],
bootstrap: [AppComponent]
})
export class AppModule { }
import { Routes, RouterModule } from "@angular/router";
import { HomeComponent } from "./home/home.component";
import { MyProfileComponent } from "./views/profile.component";
import { AuthGuard } from "./shared/auth/auth.guard";
import { MembersComponent } from "./views/members.component";
import { AssociationComponent } from "./views/association.component";
let APP_ROUTES: Routes = [
{
path: 'profile/:slug',
component: MyProfileComponent,
//canActivate: [AuthGuard]
},
{
path: 'members/:slug',
component: MembersComponent,
//canActivate: [AuthGuard]
},
{
path: 'association/:slug',
component: AssociationComponent,
//canActivate: [AuthGuard]
},
{
path: 'login',
component: HomeComponent
},
{
path: '**',
//redirectTo: 'login'
component: MyProfileComponent
}
];
export let AppRouterModule = RouterModule.forRoot(APP_ROUTES);
import {OpaqueToken} from "@angular/core";
export const BASE_URL = new OpaqueToken("BASE_URL");
import { Component, OnInit } from '@angular/core';
import {OAuthService} from "angular-oauth2-oidc";
@Component({
template: `
<div class="panel panel-default">
<div class="panel-body">
<button class="btn btn-default" (click)="login()">Login with SURFconext</button>
<!--<button class="btn btn-default" (click)="logout()">Logout</button>-->
</div>
</div>
`
})
export class HomeComponent implements OnInit{
constructor(
private oauthService: OAuthService,
//private authguard: AuthGuard
) {}
login() {
this.oauthService.initImplicitFlow();
}
logout() {
this.oauthService.logOut();
}
get givenName() {
var claims = this.oauthService.getIdentityClaims();
if (!claims) return null;
return claims.given_name;
}
ngOnInit(){}
}
\ No newline at end of file
import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
import {AppModule} from "./app.module";
platformBrowserDynamic().bootstrapModule(AppModule)
//.catch(err => console.error(err));
.catch(function(err) { console.error(err) });
// Polyfills
import 'ie-shim'; // Internet Explorer 9 support
// import 'core-js/es6';
// Added parts of es6 which are necessary for your project or your browser support requirements.
import 'core-js/es6/symbol';
import 'core-js/es6/object';
import 'core-js/es6/function';
import 'core-js/es6/parse-int';
import 'core-js/es6/parse-float';
import 'core-js/es6/number';
import 'core-js/es6/math';
import 'core-js/es6/string';
import 'core-js/es6/date';
import 'core-js/es6/array';
import 'core-js/es6/regexp';
import 'core-js/es6/map';
import 'core-js/es6/set';
import 'core-js/es6/weak-map';
import 'core-js/es6/weak-set';
import 'core-js/es6/typed';
import 'core-js/es6/reflect';
// see issue https://github.com/AngularClass/angular2-webpack-starter/issues/709
// import 'core-js/es6/promise';
import 'core-js/es7/reflect';
import 'zone.js/dist/zone';
import 'zone.js/dist/long-stack-trace-zone';
export class Develop {
public static redirectUri = "https://sun.snt.utwente.nl";
public static clientId = "https@//sun-dev.utsp.utwente.nl";
public static scope = "openid";
public static issuer = "https://oidc.connect.surfconext.nl";
}
export class Local {
}
export class Production {
public static redirectUri = "https://sun-dev.utsp.utwente.nl/";
public static clientId = "https@//sun-dev.utsp.utwente.nl";
public static scope = "openid profile email eduPersonPrincipalName";
public static issuer = "https://oidc.connect.surfconext.nl";
}
export class User {
public static APIkey = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6IjE3OWY5NmEwLTU4NjEtNDE2My05Y2VjLTM1ZGRkYmIwMWFjOCIsInVuaXF1ZV9pZCI6IjE3OWY5NmEwLTU4NjEtNDE2My05Y2VjLTM1ZGRkYmIwMWFjOCIsInVzZXJfaWQiOm51bGwsImV4cCI6MTUxMjA2ODEyOH0.r_U6t5xcxtg8TpK8d1SJM3ACjFBKjx6pjHk8UqlnH9U'
public static sunmember = 'test'
public static password = '';
public static selected_profile = '6a497bcc-f27b-4d1c-9c41-13eab2d55932';
}
export class API {
public static url = 'https://open-dev.sun.snt.utwente.nl/';
}
import {Injectable} from "@angular/core";
import {CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot} from "@angular/router";
import {OAuthService} from "angular-oauth2-oidc";
@Injectable()
export class AuthGuard implements CanActivate {
public getAccessToken() {
return this._storage.getItem("access_token")
}
private _storage: Storage = localStorage
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean {
if (this.getAccessToken()) {
var expiresAt = this._storage.getItem("expires_at")
var now = new Date()
if (expiresAt && parseInt(expiresAt) < now.getTime()) {
return false
}
return true
}
return true; //set to false
}
}
import {NgModule, ModuleWithProviders} from "@angular/core";
import {FormsModule} from "@angular/forms";
import {CommonModule} from "@angular/common";
import {AuthGuard} from "./auth/auth.guard";
@NgModule({
imports: [
FormsModule, // [(ngModel)]
CommonModule // ngFor, ngIf, ngStyle, ngClass, date, json
],
providers: [],
declarations: [],
exports:[]
})
export class SharedModule {
static forRoot(): ModuleWithProviders {
return {
providers: [
AuthGuard
],
ngModule: SharedModule
};
}
}
\ No newline at end of file
// Vendors
// Angular 2
import '@angular/platform-browser-dynamic';
import '@angular/platform-browser';
import '@angular/core';
import '@angular/http';
import '@angular/router';
// RxJS 5
// import 'rxjs/Rx';
import 'rxjs/add/operator/map';
// For vendors for example jQuery, Lodash, angular2-jwt import them here
// Also see src/typings.d.ts as you also need to run `typings install x` where `x` is your module
.tab {
line-height: 50px;
background-color: white;
border-top:1px solid #dce1e1;
border-left:1px solid #dce1e1;
border-bottom:1px solid #dce1e1;
}
.last-tab {
border-right:1px solid #dce1e1;
}
.tab:hover, .tab.active {
background-color: #dce1e1;
color: white;
}
.info-box {
padding-top: 10px;
padding-bottom: 10px;
border-bottom: 1px solid #dce1e1;
}
.switch {
position: relative;
display: inline-block;
min-width: 30px;
height: 17px;
}
/* Hide default HTML checkbox */
.switch input {display:none;}
/* The slider */
.slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #ccc;
-webkit-transition: .4s;
transition: .4s;
}
.slider:before {
position: absolute;
content: "";
height: 13px;
width: 13px;
left: 4px;
bottom: 4px;
background-color: white;
-webkit-transition: .4s;
transition: .4s;
}
input:checked + .slider {
background-color: #2196F3 ;
}
input:focus + .slider {
box-shadow: 0 0 1px #2196F3 ;
}
input:checked + .slider:before {
-webkit-transform: translateX(13px);
-ms-transform: translateX(13px);
transform: translateX(13px);
}
/* Rounded sliders */
.slider.round {
border-radius: 17px;
}
.slider.round:before {
border-radius: 50%;
top: 2px;
left: 2px;
}
<div class="row header">
<div class="col-sm-8 col-lg-10">
<h1>Information of <strong>{{associationName}}</strong> </h1>
</div>
</div>
<div class="row">
<div *ngFor="let item of association">
<div *ngIf="item.title != 'slug' && item.title != 'short_name' && item.title != 'dissolution_date'" class="col-md-8">
<div class="info-box col-xs-12">
<div class="col-xs-6 table_label">
<span>{{item.title}}</span>
</div>
<div class="col-xs-6">
<span>{{item.value}}</span>
</div>
</div>
</div>
</div>
</div>
import { Component, OnInit } from "@angular/core";
import { ActivatedRoute, Params } from "@angular/router";
import { Http, Headers, RequestOptions, Response } from '@angular/http';
import { Location } from "@angular/common";
import 'rxjs/add/operator/switchMap';
import { API, User } from "../settings/settings";
@Component({
selector: 'association',
templateUrl: 'association.component.html',
styleUrls: ['association.component.css'],
})
export class AssociationComponent implements OnInit {
association = [];
associationName = '';
constructor(private http: Http, private route: ActivatedRoute, private location: Location) { }
ngOnInit() {
let headers: Headers = new Headers();
headers.append('Content-Type', 'application/json');
headers.append('Authorization', 'JWT ' + User.APIkey);
let options = new RequestOptions({ headers: headers });
this.route.params.switchMap((params: Params) => this.http.get(API.url + 'associations/' + params['slug'], options)).map(res => res.json()).subscribe(response => {
this.association = [
{ title: 'Phone number', value: response.phone_number },
{ title: 'Street name', value: response.street_name },
{ title: 'Zip code', value: response.zip_code },
{ title: 'City', value: response.city },
{ title: 'Country', value: response.country },
{ title: 'slug', value: response.slug },
{ title: 'Name', value: response.name },
{ title: 'short_name', value: response.short_name },
{ title: 'Founding date', value: response.founding_date },
{ title: 'dissolution_date', value: response.dissolution_date },
{ title: 'Postal address', value: response.postal_address }
];
this.associationName = response.name;
});
}
}
.tab {
line-height: 50px;
background-color: white;
border-top: 1px solid #dce1e1;
border-left: 1px solid #dce1e1;
border-bottom: 1px solid #dce1e1;
}
.last-tab {
border-right: 1px solid #dce1e1;
}
.tab:hover, .tab.active {
background-color: #dce1e1;
color: white;
}
.info-box {
padding-top: 10px;
padding-bottom: 10px;