sam is net langsgeweest... measurement toevoegen nu.

This commit is contained in:
Joachim Nielandt 2015-09-13 18:28:54 +02:00
parent 235f2383c6
commit b278781b95
36 changed files with 1866 additions and 1063 deletions

16
css/app.css Normal file
View File

@ -0,0 +1,16 @@
body {
padding-top: 58px;
overflow-x: hidden;
}
.breadcrumbddd {
position: fixed;
top: 56px;
display: inline-block;
z-index: 1030;
}
.large-glyph {
font-size : 24px;
color:lightgray;
}

View File

@ -7,83 +7,69 @@
<!-- but may lead to some differences in layout. -->
<html ng-app="bananaraceApp">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<!-- enable bootstrap -->
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- enable bootstrap -->
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- enable angular -->
<title>TimeY - Time Yourself!</title>
<script src="node_modules/angular/angular.js"></script>
<!-- enable angular -->
<title>Race manager</title>
<script src="node_modules/angular/angular.js"></script>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="node_modules/jquery/dist/jquery.min.js"></script>
<script src="node_modules/angular-route/angular-route.min.js"></script>
<script src="node_modules/angular-md5/angular-md5.min.js"></script>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="node_modules/jquery/dist/jquery.min.js"></script>
<script src="node_modules/angular-route/angular-route.min.js"></script>
<script src="node_modules/angular-md5/angular-md5.min.js"></script>
<!-- Bootstrap -->
<link href="node_modules/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="node_modules/bootstrap/dist/css/bootstrap-theme.min.css">
<script src="node_modules/bootstrap/dist/js/bootstrap.min.js"></script>
<!-- <script src="node_modules/angular-bootstrap/dist/ui-bootstrap.min.js"></script> -->
<!-- <script src="node_modules/angular-bootstrap/dist/ui-bootstrap-tpls.min.js"></script> -->
<!-- enable cookies -->
<script src="node_modules/angular-cookies/angular-cookies.min.js"></script>
<!-- local files -->
<script src="js/app.js"></script>
<script src="js/filters.js"></script>
<script src="js/services.js"></script>
<script src="js/controllers.js"></script>
<script src="js/directives.js"></script>
<!-- Bootstrap -->
<link href="node_modules/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="node_modules/bootstrap/dist/css/bootstrap-theme.min.css">
<link rel="stylesheet" href="css/app.css">
<script src="node_modules/bootstrap/dist/js/bootstrap.min.js"></script>
<!-- <script src="node_modules/angular-bootstrap/dist/ui-bootstrap.min.js"></script> -->
<!-- <script src="node_modules/angular-bootstrap/dist/ui-bootstrap-tpls.min.js"></script> -->
</head>
<!-- local files -->
<script src="js/app.js"></script>
<script src="js/filters.js"></script>
<script src="js/services.js"></script>
<script src="js/controllers.js"></script>
<script src="js/directives.js"></script>
<body>
</head>
<!-- the navbar on top ... -->
<nav class="navbar navbar-default" ng-controller="NavCtrl">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<a class="navbar-brand" href="">Race - title?</a>
</div>
<body>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li ng-class="getActiveCss('/championships');"><a href="#/championships">Championships</a></li>
<li ng-class="getActiveCss('/poules');"><a href="#/poules">Poules</a></li>
<li ng-class="getActiveCss('/teams');"><a href="#/teams">Teams</a></li>
</ul>
<!-- the navbar on top ... -->
<nav class="navbar navbar-default navbar-fixed-top" ng-controller="NavCtrl">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<a class="navbar-brand" href="">Ra-ra-ra-race</a>
</div>
<ul class="nav navbar-nav navbar-right" ng-controller="LoginCtrl">
<li class="dropdown">
<a href="" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><span class="glyphicon glyphicon-user" aria-hidden="true"></span> {{loggedIn()?loggedInUsername():'Not logged in'}}<span class="caret"></span>
</a>
<ul class="dropdown-menu stay-open" role="menu">
<li><a href="#/login" ng-show="!loggedIn();">Log in</a></li>
<li><a href="#/register" ng-show="!loggedIn();">Register</a></li>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li ng-class="getActiveCss('/championships');"><a href="#/championships">Championships</a></li>
</ul>
<!-- <div class="input-group">
<span class="glyphicon glyphicon-user input-group-addon" aria-hidden="true"></span>
<input type="text" class="form-control" placeholder="Username" aria-describedby="basic-addon1">
</div>
<div class="input-group">
<span class="glyphicon glyphicon-lock input-group-addon" aria-hidden="true"></span>
<input type="password" class="form-control" placeholder="Password" aria-describedby="basic-addon1">
</div> -->
<!-- <li><button type="button" class="btn btn-default">Login</button></li> -->
<li><a href="" ng-click="logout()" ng-show="loggedIn();">Log out</a></li>
</ul>
</li>
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</nav>
<ul class="nav navbar-nav navbar-right" style="margin-right:20px">
<li ng-show="getActiveRace()!=null">
<a href="#/championship/{{getActiveRace().idchampionship}}/poule/{{getActiveRace().tier}}/{{getActiveRace().poule}}/race/{{getActiveRace().idrace}}/drives">Active race: {{getActiveRace().idrace}}</a>
</li>
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</nav>
<!-- the main view div... here's where the partials are served -->
<div ng-view></div>
<div ng-view></div>
</body>
</html>
</body>
</html>

View File

@ -9,7 +9,7 @@ angular.module('bananaraceApp', [
'bananaraceApp.directives',
'bananaraceApp.controllers',
// // 'textAngular',
// 'ngCookies',
'ngCookies',
'angular-md5',
// 'ui.bootstrap',
// 'cfp.hotkeys',
@ -20,9 +20,14 @@ angular.module('bananaraceApp', [
config(['$routeProvider', function($routeProvider) {
// $routeProvider.when('/news', {templateUrl: 'partials/news.html', controller: 'NewsCtrl'});
// $routeProvider.when('/view2', {templateUrl: 'partials/partial2.html', controller: 'MyCtrl2'});
$routeProvider.when('/championships', {templateUrl: 'partials/championships.html', controller: 'ChampionshipCtrl'});
$routeProvider.when('/teams/:idchampionship', {templateUrl: 'partials/teams.html', controller: 'TeamCtrl'});
$routeProvider.when('/poules/:idchampionship', {templateUrl: 'partials/poules.html', controller: 'PouleCtrl'});
$routeProvider.when('/championships', {templateUrl: 'partials/championships.html', controller: 'ChampionshipsCtrl'});
$routeProvider.when('/championship/:idchampionship/poules', {templateUrl: 'partials/championship-poules.html', controller: 'ChampionshipCtrl'});
$routeProvider.when('/championship/:idchampionship/poule/:tier/:poule/races', {templateUrl: 'partials/championship-poule-races.html', controller: 'PouleCtrl'});
$routeProvider.when('/championship/:idchampionship/poule/:tier/:poule/teams', {templateUrl: 'partials/championship-poule-teams.html', controller: 'PouleCtrl'});
$routeProvider.when('/championship/:idchampionship/poule/:tier/:poule/race/:idrace/drives', {templateUrl: 'partials/championship-poule-race-drives.html', controller: 'RaceCtrl'});
$routeProvider.when('/championship/:idchampionship/teams', {templateUrl: 'partials/championship-teams.html', controller: 'TeamCtrl'});
$routeProvider.when('/championship/:idchampionship/team/:idteam/drivers', {templateUrl: 'partials/championship-team-drivers.html', controller: 'DriverCtrl'});
$routeProvider.when('/login', {templateUrl: 'partials/login.html', controller: 'LoginCtrl'});
$routeProvider.when('/register', {templateUrl: 'partials/register.html', controller: 'RegisterCtrl'});
// $routeProvider.when('/member', {templateUrl: 'partials/member.html', controller: 'MemberCtrl'});
@ -30,3 +35,14 @@ config(['$routeProvider', function($routeProvider) {
}]);
//$httpProvider.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded;charset=utf-8';
/*
/championships/:cid/teams
/championships/:cid/teams/:tid
/championships/:cid/poules
/championships/:cid/poules/:pid
/championships/:cid/poules/:pid/races
/championships/:cid/poules/:pid/races/:rid
/teams
/teams/:tid
/users
/users/:uid */

File diff suppressed because it is too large Load Diff

View File

@ -27,258 +27,153 @@ appServices.service('PouleService', function($http) {
this.addPoule = function(newpoule, idchampionship) {
return $http.post('server/addpoule.php', {tier:newpoule.tier, poule:newpoule.poule, idchampionship:idchampionship});
};
this.addTeam = function(team, idchampionship, tier, poule) {
return $http.post('server/addteamtopoule.php', {idteam:team.idteam, tier:tier, poule:poule, idchampionship:idchampionship});
};
this.removeTeam = function(team, idchampionship, tier, poule) {
return $http.post('server/removeteamfrompoule.php', {idteam:team.idteam, tier:tier, poule:poule, idchampionship:idchampionship});
};
this.getRacesInPoule = function(idchampionship, tier, poule) {
return $http.post('server/getracesinpoule.php', {tier:tier, poule:poule, idchampionship:idchampionship});
};
this.addRace = function(idchampionship, tier, poule, idteam) {
return $http.post('server/addracetopoule.php', {tier:tier, poule:poule, idchampionship:idchampionship, idteam:idteam});
};
this.deleteRace = function(idchampionship, tier, poule, idrace) {
return $http.post('server/deleterace.php', {tier:tier, poule:poule, idchampionship:idchampionship, idrace:idrace});
};
});
appServices.service('TeamService', function($http) {
this.getTeams = function(idchampionship) {
return $http.post('server/getteams.php', {idchampionship:idchampionship});
};
this.getTeamsInPoule = function(idchampionship, tier, poule) {
return $http.post('server/getteams.php', {idchampionship:idchampionship, tier:tier, poule:poule});
};
this.deleteTeam = function(team, idchampionship) {
return $http.post('server/deleteteam.php', {idteam:team.idteam, idchampionship:idchampionship});
};
/**
* Filters: teams that are from the given championship and haven't been used in another poule...
*/
this.getTeamsAvailableForPoule = function(idchampionship, tier, poule) {
return $http.post('server/getteams.php', {idchampionship:idchampionship, tier:tier, poule:poule, available:true});
};
this.addTeam = function(newteam, idchampionship) {
console.log('adding team');
return $http.post('server/addteam.php', {name:newteam.name, idchampionship:idchampionship});
};
});
appServices.service('StopwatchService', ['TemplateBackendService', function(TemplateBackendService) {
//init the stopwatch value in ms
var intervalMs = 0;
var startMs = null;
var running = false;
var timings = null;
//this is the currently tracked leaf
var templateItemIndex = -1;
//this is the starttime of the currently tracked leaf
var leafStart = null;
//the currently active template
var activeTemplate = null;
this.updateValue = function() {
var currentMs = +new Date();
intervalMs = currentMs - startMs;
}
this.isRunning = function() {
return running;
}
this.getValue = function() {
if(running) {
this.updateValue();
}
return intervalMs;
appServices.service('RaceService', function($http) {
this.getDrives = function(idrace) {
return $http.post('server/getdrives.php', {idrace:idrace});
};
this.currentlyRunningTemplateItemIndex = function() {
return templateItemIndex;
}
this.getTeam = function(idrace) {
return $http.post('server/getraceteam.php', {idrace:idrace});
};
this.getCurrentTemplateItems = function() {
if(activeTemplate != null && activeTemplate.templateitems != null) {
return activeTemplate.templateitems;
} else {
return [];
}
}
this.addDrive = function(race, driver, laps) {
return $http.post('server/adddrive.php', {idrace:race, iddriver:driver.iddriver, laps});
};
this.getActiveTemplate = function() {
return activeTemplate;
}
this.deleteDrive = function(drivenr, idrace) {
return $http.post('server/deletedrive.php', {drivenr:drivenr, idrace:idrace});
};
});
this.setActiveTemplate = function(template) {
console.log('setActiveTemplate called');
activeTemplate = template;
console.log('active template: '+template.templatename);
console.log(template);
appServices.service('DriverService', function($http) {
this.getDrivers = function(idchampionship, idteam) {
return $http.post('server/getdrivers.php', {idchampionship:idchampionship, idteam:idteam});
};
//now, set up the timer so we can process the active template
//1) active template needs to be read from left to right, leaf to leaf
//2) time each leaf: start , tap , tap , end > save timings to db
//-- stop will break off the attempt
this.addDriver = function(newdriver, idchampionship, idteam) {
console.log('adding driver');
return $http.post('server/adddriver.php', {idchampionship:idchampionship, name:newdriver.name, idteam:idteam});
};
//get the leafs of the active template
console.log('got these active items: ');
console.log(template.templateitems);
}
this.deleteDriver = function(driver) {
console.log('removing driver');
return $http.post('server/deletedriver.php', {iddriver:driver.iddriver});
};
});
this.cancel = function() {
running = false;
templateItemIndex = -1;
leafStart = 0;
}
appServices.service('MainService', function($http, $cookies) {
this.tap = function() {
//okay, if we are not running right now, initialise everything
var stopRunningTimer = false;
var activerace = null;
if(!running) {
//start up the first leaf
templateItemIndex = 0;
leafStart = 0;
running = true;
startMs = +new Date();
} else {
//already running!
var temptime = this.getValue();
var leafTime = temptime-leafStart;
activeTemplate.templateitems[templateItemIndex]['timing'] = leafTime;
//check if we're at the end
if(templateItemIndex==activeTemplate.templateitems.length-1) {
//reached the end, stop everything
console.log('got to the end...');
console.log('leaf '+activeTemplate.templateitems[templateItemIndex].templateitemname+' got: '+leafTime);
var currentMs = +new Date();
intervalMs = currentMs - startMs;
running = false;
templateItemIndex = -1;
stopRunningTimer = true;
this.refreshConfig = function() {
$http.post('server/config.php', {action:'getConfig'}).
success(function(data, status, headers, config) {
console.log('refreshConfig successful...');
//refresh activerace
if(data.activeidrace != null) {
console.log('setting the activerace...');
activerace = {
idrace:data.activeidrace,
tier:data.tier,
poule:data.poule,
idchampionship:data.idchampionship
};
} else {
//end the current leaf
console.log('leaf '+activeTemplate.templateitems[templateItemIndex].templateitemname+' got: '+leafTime);
//go to the next leaf
templateItemIndex++;
leafStart = temptime;
console.log('idrace was null, setting activerace to null');
activerace = null;
}
}
return stopRunningTimer;
}
}]);
appServices.service('TemplateBackendService', function($http) {
this.saveTemplate = function(templateName, templateItems) {
console.log('gonna save this');
console.log(templateName+' '+templateItems);
return $http.post('server/savetemplate.php', {templateName:templateName, templateItems:templateItems});
};
this.getTemplates = function() {
console.log('TemplateBackendService.getTemplates called');
return $http.post('server/gettemplates.php', {});
};
this.removeTemplate = function(template) {
var idtemplate = template.idtemplate;
// var templateid = template->{'$id'};
// console.log('going to remove: '+templateid);
return $http.post('server/removetemplate.php', {idtemplate:idtemplate});
};
/**
Templateid: dbid of the template. timings: assoc array with nodeid=>timing(ms)
*/
this.saveTiming = function(idtemplate, templateitems) {
console.log('saving timing...');
console.log(idtemplate);
console.log(templateitems);
return $http.post('server/savetiming.php', {idtemplate:idtemplate,templateitems:templateitems});
};
/**
Fetch an array with all the timings for the given templateid, sorted on insert date.
*/
this.getTimings = function(idtemplate) {
return $http.post('server/gettimings.php', {idtemplate:idtemplate});
}
this.removeTiming = function(idtimingrun) {
return $http.post('server/removetiming.php', {idtimingrun:idtimingrun});
}
});
appServices.service('TemplateCreationService', function() {
});
appServices.service('RegisterService', function($http) {
var url = "server/register.php";
//?email=emailtest&md5pass=passtest&username=usertest
this.register = function (username, email, md5pass) {
return $http.post(url, {
username:username,
md5pass:md5pass,
email:email
});
};
});
appServices.service('LoginService', function($http) {
var url = "server/login.php";
// var loggedIn = $cookieStore.get('loggedIn');
var email = null;
// console.log('cookiestore says loggedin is: '+loggedIn);
this.login = function (username, md5password) {
console.log('doing the login... '+username+' '+md5password);
return $http.post(url, {
md5password:md5password,
username:username
console.log(activerace);
}).
error(function(data, status, headers, config) {
console.log('getConfig failed...');
});
};
this.setLoggedInUsername = function(newusername) {
console.log('setting loggedin username: '+newusername);
$cookieStore.put('loggedInUsername', newusername);
this.setActiveRace = function(idrace, tier, poule, idchampionship) {
if(idrace == null) {
activerace = null;
} else {
activerace = {
idrace:idrace,
tier:tier,
poule:poule,
idchampionship:idchampionship
};
}
$http.post('server/config.php', {action:'setActiveIdRace', idrace:idrace}).
success(function(data, status, headers, config) {
//do something?
});
};
this.getLoggedInUsername = function() {
return $cookieStore.get('loggedInUsername');
this.getActiveRace = function() {
return activerace;
};
this.setLoggedIn = function(newValue) {
console.log('set logged in : '+newValue);
// loggedIn = newValue;
$cookieStore.put('loggedIn', newValue);
this.toggleActiveRace = function(idrace, tier, poule, idchampionship) {
console.log('toggling active race'+idrace);
//if the race is not the same as the currently active on: switch it
if(activerace == null || activerace.idrace!=idrace) {
this.setActiveRace(idrace, tier, poule, idchampionship);
} else {
//well, it's the same: we're disabling the activeness of the race
activerace = null;
this.setActiveRace(null, null, null, null);
}
};
this.isLoggedIn = function() {
return false;
};
this.logout = function() {
return $http.post("server/logout.php");
};
});
appServices.service('NewsService', function($http,$upload) {
this.fetchNews = function() {
return $http.post("phpservices/news.php");
};
this.submitNews = function(newNewsTitle, newNewsBody) {
var newNews = {
title:newNewsTitle,
body:newNewsBody
};
console.log("submitnewsing service: "+newNews);
return $http.post("phpservices/addnews.php",newNews);
};
this.removeNewsItem = function(newsItem) {
var postObj = {
idnews:newsItem.idnews
};
$http.post("phpservices/removenews.php", postObj);
};
this.saveNewsItemText = function(newsItemImage) {
return $http.post("phpservices/savenewsimagetext.php", newsItemImage);
};
this.deleteNewsItemImage = function(newsItemImage) {
return $http.post("phpservices/removenewsitemimage.php", newsItemImage);
};
//load the current config
this.refreshConfig();
});

68
node_modules/angular-cookies/README.md generated vendored Normal file
View File

@ -0,0 +1,68 @@
# packaged angular-cookies
This repo is for distribution on `npm` and `bower`. The source for this module is in the
[main AngularJS repo](https://github.com/angular/angular.js/tree/master/src/ngCookies).
Please file issues and pull requests against that repo.
## Install
You can install this package either with `npm` or with `bower`.
### npm
```shell
npm install angular-cookies
```
Then add `ngCookies` as a dependency for your app:
```javascript
angular.module('myApp', [require('angular-cookies')]);
```
### bower
```shell
bower install angular-cookies
```
Add a `<script>` to your `index.html`:
```html
<script src="/bower_components/angular-cookies/angular-cookies.js"></script>
```
Then add `ngCookies` as a dependency for your app:
```javascript
angular.module('myApp', ['ngCookies']);
```
## Documentation
Documentation is available on the
[AngularJS docs site](http://docs.angularjs.org/api/ngCookies).
## License
The MIT License
Copyright (c) 2010-2015 Google, Inc. http://angularjs.org
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.

321
node_modules/angular-cookies/angular-cookies.js generated vendored Normal file
View File

@ -0,0 +1,321 @@
/**
* @license AngularJS v1.4.5
* (c) 2010-2015 Google, Inc. http://angularjs.org
* License: MIT
*/
(function(window, angular, undefined) {'use strict';
/**
* @ngdoc module
* @name ngCookies
* @description
*
* # ngCookies
*
* The `ngCookies` module provides a convenient wrapper for reading and writing browser cookies.
*
*
* <div doc-module-components="ngCookies"></div>
*
* See {@link ngCookies.$cookies `$cookies`} for usage.
*/
angular.module('ngCookies', ['ng']).
/**
* @ngdoc provider
* @name $cookiesProvider
* @description
* Use `$cookiesProvider` to change the default behavior of the {@link ngCookies.$cookies $cookies} service.
* */
provider('$cookies', [function $CookiesProvider() {
/**
* @ngdoc property
* @name $cookiesProvider#defaults
* @description
*
* Object containing default options to pass when setting cookies.
*
* The object may have following properties:
*
* - **path** - `{string}` - The cookie will be available only for this path and its
* sub-paths. By default, this would be the URL that appears in your base tag.
* - **domain** - `{string}` - The cookie will be available only for this domain and
* its sub-domains. For obvious security reasons the user agent will not accept the
* cookie if the current domain is not a sub domain or equals to the requested domain.
* - **expires** - `{string|Date}` - String of the form "Wdy, DD Mon YYYY HH:MM:SS GMT"
* or a Date object indicating the exact date/time this cookie will expire.
* - **secure** - `{boolean}` - The cookie will be available only in secured connection.
*
* Note: by default the address that appears in your `<base>` tag will be used as path.
* This is important so that cookies will be visible for all routes in case html5mode is enabled
*
**/
var defaults = this.defaults = {};
function calcOptions(options) {
return options ? angular.extend({}, defaults, options) : defaults;
}
/**
* @ngdoc service
* @name $cookies
*
* @description
* Provides read/write access to browser's cookies.
*
* <div class="alert alert-info">
* Up until Angular 1.3, `$cookies` exposed properties that represented the
* current browser cookie values. In version 1.4, this behavior has changed, and
* `$cookies` now provides a standard api of getters, setters etc.
* </div>
*
* Requires the {@link ngCookies `ngCookies`} module to be installed.
*
* @example
*
* ```js
* angular.module('cookiesExample', ['ngCookies'])
* .controller('ExampleController', ['$cookies', function($cookies) {
* // Retrieving a cookie
* var favoriteCookie = $cookies.get('myFavorite');
* // Setting a cookie
* $cookies.put('myFavorite', 'oatmeal');
* }]);
* ```
*/
this.$get = ['$$cookieReader', '$$cookieWriter', function($$cookieReader, $$cookieWriter) {
return {
/**
* @ngdoc method
* @name $cookies#get
*
* @description
* Returns the value of given cookie key
*
* @param {string} key Id to use for lookup.
* @returns {string} Raw cookie value.
*/
get: function(key) {
return $$cookieReader()[key];
},
/**
* @ngdoc method
* @name $cookies#getObject
*
* @description
* Returns the deserialized value of given cookie key
*
* @param {string} key Id to use for lookup.
* @returns {Object} Deserialized cookie value.
*/
getObject: function(key) {
var value = this.get(key);
return value ? angular.fromJson(value) : value;
},
/**
* @ngdoc method
* @name $cookies#getAll
*
* @description
* Returns a key value object with all the cookies
*
* @returns {Object} All cookies
*/
getAll: function() {
return $$cookieReader();
},
/**
* @ngdoc method
* @name $cookies#put
*
* @description
* Sets a value for given cookie key
*
* @param {string} key Id for the `value`.
* @param {string} value Raw value to be stored.
* @param {Object=} options Options object.
* See {@link ngCookies.$cookiesProvider#defaults $cookiesProvider.defaults}
*/
put: function(key, value, options) {
$$cookieWriter(key, value, calcOptions(options));
},
/**
* @ngdoc method
* @name $cookies#putObject
*
* @description
* Serializes and sets a value for given cookie key
*
* @param {string} key Id for the `value`.
* @param {Object} value Value to be stored.
* @param {Object=} options Options object.
* See {@link ngCookies.$cookiesProvider#defaults $cookiesProvider.defaults}
*/
putObject: function(key, value, options) {
this.put(key, angular.toJson(value), options);
},
/**
* @ngdoc method
* @name $cookies#remove
*
* @description
* Remove given cookie
*
* @param {string} key Id of the key-value pair to delete.
* @param {Object=} options Options object.
* See {@link ngCookies.$cookiesProvider#defaults $cookiesProvider.defaults}
*/
remove: function(key, options) {
$$cookieWriter(key, undefined, calcOptions(options));
}
};
}];
}]);
angular.module('ngCookies').
/**
* @ngdoc service
* @name $cookieStore
* @deprecated
* @requires $cookies
*
* @description
* Provides a key-value (string-object) storage, that is backed by session cookies.
* Objects put or retrieved from this storage are automatically serialized or
* deserialized by angular's toJson/fromJson.
*
* Requires the {@link ngCookies `ngCookies`} module to be installed.
*
* <div class="alert alert-danger">
* **Note:** The $cookieStore service is **deprecated**.
* Please use the {@link ngCookies.$cookies `$cookies`} service instead.
* </div>
*
* @example
*
* ```js
* angular.module('cookieStoreExample', ['ngCookies'])
* .controller('ExampleController', ['$cookieStore', function($cookieStore) {
* // Put cookie
* $cookieStore.put('myFavorite','oatmeal');
* // Get cookie
* var favoriteCookie = $cookieStore.get('myFavorite');
* // Removing a cookie
* $cookieStore.remove('myFavorite');
* }]);
* ```
*/
factory('$cookieStore', ['$cookies', function($cookies) {
return {
/**
* @ngdoc method
* @name $cookieStore#get
*
* @description
* Returns the value of given cookie key
*
* @param {string} key Id to use for lookup.
* @returns {Object} Deserialized cookie value, undefined if the cookie does not exist.
*/
get: function(key) {
return $cookies.getObject(key);
},
/**
* @ngdoc method
* @name $cookieStore#put
*
* @description
* Sets a value for given cookie key
*
* @param {string} key Id for the `value`.
* @param {Object} value Value to be stored.
*/
put: function(key, value) {
$cookies.putObject(key, value);
},
/**
* @ngdoc method
* @name $cookieStore#remove
*
* @description
* Remove given cookie
*
* @param {string} key Id of the key-value pair to delete.
*/
remove: function(key) {
$cookies.remove(key);
}
};
}]);
/**
* @name $$cookieWriter
* @requires $document
*
* @description
* This is a private service for writing cookies
*
* @param {string} name Cookie name
* @param {string=} value Cookie value (if undefined, cookie will be deleted)
* @param {Object=} options Object with options that need to be stored for the cookie.
*/
function $$CookieWriter($document, $log, $browser) {
var cookiePath = $browser.baseHref();
var rawDocument = $document[0];
function buildCookieString(name, value, options) {
var path, expires;
options = options || {};
expires = options.expires;
path = angular.isDefined(options.path) ? options.path : cookiePath;
if (value === undefined) {
expires = 'Thu, 01 Jan 1970 00:00:00 GMT';
value = '';
}
if (angular.isString(expires)) {
expires = new Date(expires);
}
var str = encodeURIComponent(name) + '=' + encodeURIComponent(value);
str += path ? ';path=' + path : '';
str += options.domain ? ';domain=' + options.domain : '';
str += expires ? ';expires=' + expires.toUTCString() : '';
str += options.secure ? ';secure' : '';
// per http://www.ietf.org/rfc/rfc2109.txt browser must allow at minimum:
// - 300 cookies
// - 20 cookies per unique domain
// - 4096 bytes per cookie
var cookieLength = str.length + 1;
if (cookieLength > 4096) {
$log.warn("Cookie '" + name +
"' possibly not set or overflowed because it was too large (" +
cookieLength + " > 4096 bytes)!");
}
return str;
}
return function(name, value, options) {
rawDocument.cookie = buildCookieString(name, value, options);
};
}
$$CookieWriter.$inject = ['$document', '$log', '$browser'];
angular.module('ngCookies').provider('$$cookieWriter', function $$CookieWriterProvider() {
this.$get = $$CookieWriter;
});
})(window, window.angular);

9
node_modules/angular-cookies/angular-cookies.min.js generated vendored Normal file
View File

@ -0,0 +1,9 @@
/*
AngularJS v1.4.5
(c) 2010-2015 Google, Inc. http://angularjs.org
License: MIT
*/
(function(p,g,l){'use strict';function m(b,a,f){var c=f.baseHref(),k=b[0];return function(b,d,e){var f,h;e=e||{};h=e.expires;f=g.isDefined(e.path)?e.path:c;d===l&&(h="Thu, 01 Jan 1970 00:00:00 GMT",d="");g.isString(h)&&(h=new Date(h));d=encodeURIComponent(b)+"="+encodeURIComponent(d);d=d+(f?";path="+f:"")+(e.domain?";domain="+e.domain:"");d+=h?";expires="+h.toUTCString():"";d+=e.secure?";secure":"";e=d.length+1;4096<e&&a.warn("Cookie '"+b+"' possibly not set or overflowed because it was too large ("+
e+" > 4096 bytes)!");k.cookie=d}}g.module("ngCookies",["ng"]).provider("$cookies",[function(){var b=this.defaults={};this.$get=["$$cookieReader","$$cookieWriter",function(a,f){return{get:function(c){return a()[c]},getObject:function(c){return(c=this.get(c))?g.fromJson(c):c},getAll:function(){return a()},put:function(c,a,n){f(c,a,n?g.extend({},b,n):b)},putObject:function(c,b,a){this.put(c,g.toJson(b),a)},remove:function(a,k){f(a,l,k?g.extend({},b,k):b)}}}]}]);g.module("ngCookies").factory("$cookieStore",
["$cookies",function(b){return{get:function(a){return b.getObject(a)},put:function(a,f){b.putObject(a,f)},remove:function(a){b.remove(a)}}}]);m.$inject=["$document","$log","$browser"];g.module("ngCookies").provider("$$cookieWriter",function(){this.$get=m})})(window,window.angular);
//# sourceMappingURL=angular-cookies.min.js.map

View File

@ -0,0 +1,8 @@
{
"version":3,
"file":"angular-cookies.min.js",
"lineCount":8,
"mappings":"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",
"sources":["angular-cookies.js"],
"names":["window","angular","undefined","$$CookieWriter","$document","$log","$browser","cookiePath","baseHref","rawDocument","name","value","options","path","expires","isDefined","isString","Date","str","encodeURIComponent","domain","toUTCString","secure","cookieLength","length","warn","cookie","module","provider","$CookiesProvider","defaults","$get","$$cookieReader","$$cookieWriter","get","key","getObject","fromJson","getAll","put","extend","putObject","toJson","remove","factory","$cookies","$inject","$$CookieWriterProvider"]
}

9
node_modules/angular-cookies/bower.json generated vendored Normal file
View File

@ -0,0 +1,9 @@
{
"name": "angular-cookies",
"version": "1.4.5",
"main": "./angular-cookies.js",
"ignore": [],
"dependencies": {
"angular": "1.4.5"
}
}

2
node_modules/angular-cookies/index.js generated vendored Normal file
View File

@ -0,0 +1,2 @@
require('./angular-cookies');
module.exports = 'ngCookies';

37
node_modules/angular-cookies/package.json generated vendored Normal file
View File

@ -0,0 +1,37 @@
{
"name": "angular-cookies",
"version": "1.4.5",
"description": "AngularJS module for cookies",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "https://github.com/angular/angular.js.git"
},
"keywords": [
"angular",
"framework",
"browser",
"cookies",
"client-side"
],
"author": {
"name": "Angular Core Team",
"email": "angular-core+npm@google.com"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/angular/angular.js/issues"
},
"homepage": "http://angularjs.org",
"readme": "# packaged angular-cookies\n\nThis repo is for distribution on `npm` and `bower`. The source for this module is in the\n[main AngularJS repo](https://github.com/angular/angular.js/tree/master/src/ngCookies).\nPlease file issues and pull requests against that repo.\n\n## Install\n\nYou can install this package either with `npm` or with `bower`.\n\n### npm\n\n```shell\nnpm install angular-cookies\n```\n\nThen add `ngCookies` as a dependency for your app:\n\n```javascript\nangular.module('myApp', [require('angular-cookies')]);\n```\n\n### bower\n\n```shell\nbower install angular-cookies\n```\n\nAdd a `<script>` to your `index.html`:\n\n```html\n<script src=\"/bower_components/angular-cookies/angular-cookies.js\"></script>\n```\n\nThen add `ngCookies` as a dependency for your app:\n\n```javascript\nangular.module('myApp', ['ngCookies']);\n```\n\n## Documentation\n\nDocumentation is available on the\n[AngularJS docs site](http://docs.angularjs.org/api/ngCookies).\n\n## License\n\nThe MIT License\n\nCopyright (c) 2010-2015 Google, Inc. http://angularjs.org\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n",
"readmeFilename": "README.md",
"_id": "angular-cookies@1.4.5",
"dist": {
"shasum": "bf2642f5a11e30747348e35f1ee9cdcfa80a126e"
},
"_from": "angular-cookies@",
"_resolved": "https://registry.npmjs.org/angular-cookies/-/angular-cookies-1.4.5.tgz"
}

View File

@ -0,0 +1,67 @@
<ol class="breadcrumb">
<li><a href="#/championships/">Kampioenschappen</a></li>
<li><a href="#/championship/{{currentChampionship}}/poules">Poules voor {{currentChampionship}}</a></li>
<li><a href="#/championship/{{currentChampionship}}/poule/{{currentTier}}/{{currentPoule}}/races">Races voor poule {{currentTier}}/{{currentPoule}}</a></li>
<li class="active">Ritten voor race {{currentRace}}</li>
</ol>
<div class="row">
<div class="col-md-8">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Ritten</h3>
</div>
<div class="panel-body">
<table class="table">
<tr><th>Rit nr.</th><th>Laps</th><th>Chauffeur</th><th>Acties</th></tr>
<tr ng-repeat="drive in drives | orderBy:'drivenr'">
<td>{{drive.drivenr}}</td>
<td>{{drive.laps}}</td>
<td>{{drive.drivername}}</td>
<td>
<a class="btn btn-danger btn-sm" href="" ng-click="deleteDrive(drive.drivenr, drive.idrace)">Verwijder</a>
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="col-md-4">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Voeg rit toe</h3>
</div>
<div class="panel-body">
<div class="panel panel-default">
<div class="panel-heading">Kies chauffeur</div>
<div class="panel-body">
<div class="list-group">
<a href="" class="list-group-item" ng-repeat="driver in team.drivers" ng-click="setSelectedDriver(driver)" ng-class="{active: selectedDriver==driver}">
{{driver.drivername}}
</a>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">Opties en acties</div>
<div class="panel-body">
<div class="row">
<label class="col-md-3"><h4>Laps</h4></label>
<!-- <div class="col-md-1"><h4>Laps</h4></div> -->
<div class="col-md-9">
<div class="btn-group" role="group" aria-label="First group">
<button type="button" class="btn btn-default" ng-repeat="lapamount in lapamounts" ng-click="setSelectedLapamount(lapamount)" ng-class="{active:selectedLapamount==lapamount}">{{lapamount}}</button>
</div>
</div>
</div>
<button type="button" class="btn btn-default" ng-click="addDrive();" ng-disabled="selectedDriver == null">Voeg rit toe</button>
</div>
</div>
</div><!-- end row -->
</div>
</div>
</div>

View File

@ -0,0 +1,67 @@
<div class="row">
<div class="col-md-12">
<ol class="breadcrumb">
<li><a href="#/championships/">Kampioenschappen</a></li>
<li><a href="#/championship/{{currentChampionship}}/poules">Poules voor {{currentChampionship}}</a></li>
<li class="active">Races in poule/tier {{currentPoule}}/{{currentTier}}</li>
</ol>
</div></div>
<div class="row">
<div class="col-md-8">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Races</h3>
</div>
<div class="panel-body">
<table class="table">
<tr><th>Team</th><th>Raceid</th><th>Acties</th></tr>
<tr ng-repeat="race in racesInPoule">
<td>{{race.name}}</td>
<td>{{race.idrace}}</td>
<td>
<a class="btn btn-info btn-sm" href="#/championship/{{currentChampionship}}/poule/{{currentTier}}/{{currentPoule}}/race/{{race.idrace}}/drives">Ritten</a>
<button type="button" class="btn btn-default btn-sm"
ng-class="{'btn-success' : getActiveRace().idrace == race.idrace, 'btn-warning' : getActiveRace().idrace != race.idrace}"
ng-click="toggleActiveRace(race)" title="Zet deze race actief om metingen te registreren">
<span
class="glyphicon"
ng-class="{'glyphicon-play' : getActiveRace().idrace == race.idrace, 'glyphicon-pause' : getActiveRace().idrace != race.idrace}"
</span>
</button>
<a class="btn btn-danger btn-sm" href="" ng-click="deleteRace(race)">Verwijder</a>
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="col-md-4">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Voeg race toe</h3>
</div>
<div class="panel-body">
<div class="panel panel-default">
<div class="panel-heading">Kies team uit poule</div>
<div class="panel-body">
<div class="list-group">
<a href="" class="list-group-item" ng-repeat="team in teamsInPoule" ng-click="setSelectedTeam(team)" ng-class="{active: selectedTeam==team}">{{team.name}}</a>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">Opties en acties</div>
<div class="panel-body">
<button type="button" class="btn btn-default" ng-click="addRace(newrace);" ng-disabled="selectedTeam == null" title="Maak een nieuwe race aan voor het geselecteerde team.">Maak nieuwe race</button>
<button type="button" class="btn btn-default" ng-disabled="teamsInPoule.length == 0" ng-click="addRaceForAllteams();" title="Maak nieuwe races aan voor alle bovenstaande teams.">...voor alle teams</button>
</div>
</div>
</div><!-- end row -->
</div>
</div>
</div>

View File

@ -0,0 +1,44 @@
<ol class="breadcrumb">
<li><a href="#/championships/">Kampioenschappen</a></li>
<li><a href="#/championship/{{currentChampionship}}/poules">Poules voor {{currentChampionship}}</a></li>
<li class="active">Team in poule/tier {{currentPoule}}/{{currentTier}}</li>
</ol>
<div class="row">
<!-- linker panel -->
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">Deelnemers<br/><small>Deze teams zijn toegewezen aan de poule</div>
<div class="panel-body">
<div class="list-group" ng-show="teamsInPoule.length > 0">
<a href="" class="list-group-item" ng-repeat="team in teamsInPoule" aria-label="Verwijder team van poule" ng-click="removeTeamFromPoule(team);">
<span class="badge glyphicon glyphicon-chevron-right" aria-hidden="true"> </span>
{{team.name}}
</a>
</div>
<div ng-show="teamsInPoule.length == 0" class="text-center">
<span class="glyphicon glyphicon-circle-arrow-left large-glyph"> </span>
</div>
</div>
</div>
</div>
<!-- rechter panel -->
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">Beschikbare teams<br/><small>Deze teams zitten niet in de poule maar zitten wel in hetzelfde kampioenschap.</small></div>
<div class="panel-body">
<div class="list-group" ng-show="teamsAvailableForPoule.length > 0">
<a href="" class="list-group-item" ng-repeat="team in teamsAvailableForPoule" aria-label="Voeg team toe aan poule" ng-click="addTeamToPoule(team);">
<span class="badge glyphicon glyphicon-chevron-left" aria-hidden="true"> </span>
{{team.name}}
</a>
</div>
<div ng-show="teamsAvailableForPoule.length == 0" class="text-center">
<span class="glyphicon glyphicon-eject large-glyph" aria-hidden="true"></span>
</div>
</div><!-- panel body -->
</div>
</div>
</div><!-- end row -->

View File

@ -1,18 +1,36 @@
<div class="panel panel-default">
<ol class="breadcrumb">
<li><a href="#/championships/">Kampioenschappen</a></li>
<li class="active">Poules voor {{currentChampionship}}</li>
</ol>
<div class="row">
<div class="col-md-6">
<div class="panel panel-default" ng-show="poules.length > 0">
<div class="panel-heading">
<h3 class="panel-title">Poules</h3>
</div>
<div class="panel-body">
<table class="table">
<tr><th>Tier</th><th>Poule</th></tr>
<tr ng-repeat="poule in poules">
<tr><th>Tier</th><th>Poule</th><th>Acties</th></tr>
<tr ng-repeat="poule in poules | orderBy:'[tier,poule]'">
<td>{{poule.tier}}</td>
<td>{{poule.poule}}</td>
<td>
<a class="btn btn-info btn-sm" href="#/championship/{{poule.idchampionship}}/poule/{{poule.tier}}/{{poule.poule}}/races">
Bekijk races
</a>
<a class="btn btn-info btn-sm" href="#/championship/{{poule.idchampionship}}/poule/{{poule.tier}}/{{poule.poule}}/teams">
Bekijk teams
</a>
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Voeg poule toe</h3>
@ -32,3 +50,4 @@
<button type="button" class="btn btn-default" ng-click="addPoule(newpoule);">Voeg toe!</button>
</div>
</div>
</div>

View File

@ -0,0 +1,47 @@
<ol class="breadcrumb">
<li><a href="#/championships/">Kampioenschappen</a></li>
<li><a href="#/championship/{{currentChampionship}}/teams">Teams voor kampioenschap {{currentChampionship}}</a></li>
<li class="active">Drivers voor team {{currentTeam}}</li>
</ol>
<div class="row">
<div class="col-md-6">
<div class="panel panel-default" ng-show="drivers.length > 0">
<div class="panel-heading">
<h3 class="panel-title">Drivers</h3>
</div>
<div class="panel-body">
<table class="table">
<tr><th>Naam</th><th>Acties</th></tr>
<tr ng-repeat="driver in drivers">
<td>{{driver.name}}</td>
<td>
<a class="btn btn-danger btn-sm" ng-click="deleteDriver(driver);">
Verwijder
</a>
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Voeg chauffeur toe</h3>
</div>
<div class="panel-body">
<div class="input-group">
<span class="input-group-addon" id="sizing-addon2">Naam</span>
<input type="text" class="form-control" aria-describedby="sizing-addon2" ng-model="newdriver.name">
</div>
<button type="button" class="btn btn-default" ng-click="addDriver(newdriver);">Voeg toe!</button>
</div>
</div>
</div>
</div>

View File

@ -1,12 +1,20 @@
<ol class="breadcrumb">
<li><a href="#/championships/">Kampioenschappen</a></li>
<li class="active">Teams voor kampioenschap {{currentChampionship}}</li>
</ol>
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Teams</h3>
</div>
<div class="panel-body">
<table class="table">
<tr><th>Naam</th></tr>
<tr><th>Naam</th><th>Acties</th></tr>
<tr ng-repeat="team in teams">
<td>{{team.name}}</td>
<td>
<a class="btn btn-info btn-sm" href="#/championship/{{team.idchampionship}}/team/{{team.idteam}}/drivers">Bekijk chauffeurs</a>
<a class="btn btn-danger btn-sm" ng-click="deleteTeam(team)">Verwijder</a></td>
</tr>
</table>
</div>

View File

@ -1,20 +1,23 @@
<ol class="breadcrumb">
<li class="active">Kampioenschappen</li>
</ol>
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Kampioenschappen</h3>
</div>
<div class="panel-body">
<table class="table">
<tr><th>Selected</th><th>Naam</th></tr>
<table class="table table-striped table-condensed">
<tr><th>Naam</th><th>Acties</th></tr>
<tr ng-repeat="championship in championships">
<td><button ng-click="setSelectedChampionship(championship);" ng-disabled="isSelectedChampionship(championship)" ng-show="!isSelectedChampionship(championship)">
Select
</button>
<button ng-click="deleteChampionship(championship);">
Delete
</button>
<a href="#/poules/{{championship.idchampionship}}">Bekijk poules</a>
</td>
<td>{{championship.name}}</td>
<td>{{championship.name}}</td>
<td>
<a class="btn btn-info btn-sm" href="#/championship/{{championship.idchampionship}}/poules">Bekijk poules</a>
<a class="btn btn-info btn-sm" href="#/championship/{{championship.idchampionship}}/teams">Bekijk teams</a>
<button class="btn btn-danger btn-sm" ng-click="deleteChampionship(championship);">
Delete
</button>
</td>
</tr>
</table>
</div>

32
server/adddrive.php Normal file
View File

@ -0,0 +1,32 @@
<?php
include_once("db.php");
//make result object
$result = array();
$result['ok'] = false;
//get post data
$postdata = file_get_contents("php://input");
$post = json_decode($postdata, true);
$laps = $post['laps'];
$idrace = $post['idrace'];
$iddriver = $post['iddriver'];
// insert into drive (iddriver, idrace, laps, drivenr) values (13, 2, 6, (select coalesce(max(drivenr),0) from drive where iddriver = 13 and idrace = 2))
$adddrive= pg_prepare($dbconn, "adddrive", "insert into drive (iddriver, idrace, laps, drivenr) values ($1, $2, $3, (select coalesce(max(drivenr)+1,1) from drive where idrace = $2))");
$adddrive= pg_execute($dbconn, "adddrive", array($iddriver, $idrace, $laps));
if($adddrive===FALSE) {
$result['ok'] = false;
$result['error'] = 'insert drive failed: '.pg_last_error($dbconn);
} else {
$result['ok'] = true;
}
//print message
$resultjson = json_encode($result);
echo $resultjson;
?>

32
server/adddriver.php Normal file
View File

@ -0,0 +1,32 @@
<?php
include_once("db.php");
//make result object
$result = array();
$result['ok'] = false;
//get post data
$postdata = file_get_contents("php://input");
$post = json_decode($postdata, true);
$idchampionship = $post['idchampionship'];
$idteam = $post['idteam'];
$drivername = $post['name'];
$adddriver= pg_prepare($dbconn, "adddriver", "insert into driver (name, idchampionship, idteam) values ($1, $2, $3) returning iddriver");
$adddriver= pg_execute($dbconn, "adddriver", array($drivername, $idchampionship, $idteam));
if($adddriver===FALSE) {
$result['ok'] = false;
$result['error'] = 'insert driver failed: '.pg_last_error($dbconn);
// $result['debug1'] = "insert into driver (name, idchampionship, idteam) values ($1, $2, $3) returning iddriver";
// $result['debug2'] = $;
} else {
$result['ok'] = true;
}
//print message
$resultjson = json_encode($result);
echo $resultjson;
?>

33
server/addracetopoule.php Normal file
View File

@ -0,0 +1,33 @@
<?php
include_once("db.php");
//make result object
$result = array();
$result['ok'] = false;
//get post data
$postdata = file_get_contents("php://input");
$post = json_decode($postdata, true);
$idchampionship = $post['idchampionship'];
$idteam = $post['idteam'];
$tier = $post['tier'];
$poule = $post['poule'];
$addracetopoule= pg_prepare($dbconn, "addracetopoule", "insert into race (tier, poule, idchampionship, idteam) values ($1, $2, $3, $4) returning idrace");
$addracetopoule= pg_execute($dbconn, "addracetopoule", array($tier, $poule, $idchampionship, $idteam));
if($addracetopoule===FALSE) {
$result['ok'] = false;
$result['error'] = 'insert race to poule failed: '.pg_last_error($dbconn);
} else {
$result['ok'] = true;
}
$result['post'] = $post;
//print message
$resultjson = json_encode($result);
echo $resultjson;
?>

View File

@ -12,27 +12,28 @@
$idchampionship = $post['idchampionship'];
$teamname = $post['name'];
$addteam= pg_prepare($dbconn, "addteam", "insert into team (name) values ($1) returning idteam");
$addteam= pg_execute($dbconn, "addteam", array($teamname));
$addteam= pg_prepare($dbconn, "addteam", "insert into team (name, idchampionship) values ($1, $2) returning idteam");
$addteam= pg_execute($dbconn, "addteam", array($teamname, $idchampionship));
if($addpoule===FALSE) {
$result['ok'] = false;
$result['error'] = 'insert team failed: '.pg_last_error($dbconn);
} else {
//inserted team, now the link
$insertedteam = pg_fetch_assoc($addteam);
$insertedidteam = $insertedteam['idteam'];
$addteamlinks= pg_prepare($dbconn, "addteamlink", "insert into team_championship (idteam, idchampionship) values ($1, $2)");
$addteamlinks= pg_execute($dbconn, "addteamlink", array($insertedidteam, $idchampionship));
//check
if($addteamlinks===FALSE) {
$result['ok'] = false;
$result['error'] = "inserted team, couldn't insert the link to championship...";
} else {
//all went well
$result['ok'] = true;
}
// //inserted team, now the link
// $insertedteam = pg_fetch_assoc($addteam);
// $insertedidteam = $insertedteam['idteam'];
// $addteamlinks= pg_prepare($dbconn, "addteamlink", "insert into team_championship (idteam, idchampionship) values ($1, $2)");
// $addteamlinks= pg_execute($dbconn, "addteamlink", array($insertedidteam, $idchampionship));
//
// //check
// if($addteamlinks===FALSE) {
// $result['ok'] = false;
// $result['error'] = "inserted team, couldn't insert the link to championship...";
// } else {
// //all went well
// $result['ok'] = true;
// }
$result['ok'] = true;
}
//print message

31
server/addteamtopoule.php Normal file
View File

@ -0,0 +1,31 @@
<?php
include_once("db.php");
//make result object
$result = array();
$result['ok'] = false;
//get post data
$postdata = file_get_contents("php://input");
$post = json_decode($postdata, true);
$idchampionship = $post['idchampionship'];
$idteam = $post['idteam'];
$tier = $post['tier'];
$poule = $post['poule'];
$addteamtopoule= pg_prepare($dbconn, "addteamtopoule", "insert into team_poule (idteam, tier, poule, idchampionship) values ($1, $2, $3, $4)");
$addteamtopoule= pg_execute($dbconn, "addteamtopoule", array($idteam, $tier, $poule, $idchampionship));
if($addteamtopoule===FALSE) {
$result['ok'] = false;
$result['error'] = 'insert team_poule failed: '.pg_last_error($dbconn);
} else {
$result['ok'] = true;
}
//print message
$resultjson = json_encode($result);
echo $resultjson;
?>

26
server/config.php Normal file
View File

@ -0,0 +1,26 @@
<?php
include_once("db.php");
//make result object
$result = array();
$result['ok'] = false;
//get post data
$postdata = file_get_contents("php://input");
$post = json_decode($postdata, true);
$action = $post['action'];
if($action == 'setActiveIdRace') {
$idrace = $post['idrace'];
$setactiverace= pg_prepare($dbconn, "setactiverace", "update config set activerace = $1");
$setactiverace= pg_execute($dbconn, "setactiverace", array($idrace));
} else if($action == 'getConfig') {
$getconfig= pg_prepare($dbconn, "getconfig", "select activerace activeidrace, tier, poule, idchampionship from config inner join race on activerace = idrace");
$getconfig= pg_execute($dbconn, "getconfig", array());
$result = pg_fetch_assoc($getconfig);
//print message
$resultjson = json_encode($result);
echo $resultjson;
}
?>

41
server/deletedrive.php Normal file
View File

@ -0,0 +1,41 @@
<?php
include_once("db.php");
//make result object
$result = array();
$result['ok'] = false;
//get post data
$postdata = file_get_contents("php://input");
$post = json_decode($postdata, true);
$drivenr = $post['drivenr'];
$idrace = $post['idrace'];
// return $http.post('server/deleterace.php', {tier:tier, poule:poule, idchampionship:idchampionship, idteam:idteam});
$drivedelete = pg_prepare($dbconn, "drivedelete", "delete from drive where drivenr = $1 and idrace = $2");
$drivedelete = pg_execute($dbconn, "drivedelete", array($drivenr, $idrace));
if($drivedelete===FALSE) {
$result['ok'] = false;
$result['error'] = pg_last_error($dbconn);
} else {
//return data
$result['ok'] = true;
$result['debug'] = 'deleted idrace '.$post['idrace'];
}
//update drivenrs
$updatedrivenr= pg_prepare($dbconn, "updatedrivenr", "update drive set drivenr = sub.rnum from (select idrace, drivenr, row_number() OVER () as rnum from drive) sub where drive.drivenr = sub.drivenr and drive.idrace = $1");
if($updatedrivenr===false)
$result['debug2'] = pg_last_error();
$updatedrivenr= pg_execute($dbconn, "updatedrivenr", array($idrace));
if($updatedrivenr===false)
$result['debug3'] = pg_last_error();
//print message
$resultjson = json_encode($result);
echo $resultjson;
?>

28
server/deletedriver.php Normal file
View File

@ -0,0 +1,28 @@
<?php
include_once("db.php");
//make result object
$result = array();
$result['ok'] = false;
//get post data
$postdata = file_get_contents("php://input");
$post = json_decode($postdata, true);
$driverdelete = pg_prepare($dbconn, "driverdelete", "delete from driver where iddriver = $1");
$driverdelete = pg_execute($dbconn, "driverdelete", array($post['iddriver']));
if($driverdelete===FALSE) {
$result['ok'] = false;
$result['error'] = pg_last_error($dbconn);
} else {
//return data
$result['ok'] = true;
$result['debug'] = 'deleted iddriver '.$post['iddriver'];
}
//print message
$resultjson = json_encode($result);
echo $resultjson;
?>

30
server/deleterace.php Normal file
View File

@ -0,0 +1,30 @@
<?php
include_once("db.php");
//make result object
$result = array();
$result['ok'] = false;
//get post data
$postdata = file_get_contents("php://input");
$post = json_decode($postdata, true);
// return $http.post('server/deleterace.php', {tier:tier, poule:poule, idchampionship:idchampionship, idteam:idteam});
$racedelete = pg_prepare($dbconn, "racedelete", "delete from race where idrace = $1 and idchampionship = $2 and tier = $3 and poule = $4");
$racedelete = pg_execute($dbconn, "racedelete", array($post['idrace'], $post['idchampionship'], $post['tier'], $post['poule']));
if($racedelete===FALSE) {
$result['ok'] = false;
$result['error'] = pg_last_error($dbconn);
} else {
//return data
$result['ok'] = true;
$result['debug'] = 'deleted idrace '.$post['idrace'];
}
//print message
$resultjson = json_encode($result);
echo $resultjson;
?>

28
server/deleteteam.php Normal file
View File

@ -0,0 +1,28 @@
<?php
include_once("db.php");
//make result object
$result = array();
$result['ok'] = false;
//get post data
$postdata = file_get_contents("php://input");
$post = json_decode($postdata, true);
$teamdelete = pg_prepare($dbconn, "teamdelete", "delete from team where idteam = $1 and idchampionship = $2");
$teamdelete = pg_execute($dbconn, "teamdelete", array($post['idteam'], $post['idchampionship']));
if($teamdelete===FALSE) {
$result['ok'] = false;
$result['error'] = pg_last_error($dbconn);
} else {
//return data
$result['ok'] = true;
$result['debug'] = 'deleted team '.$post['idteam'];
}
//print message
$resultjson = json_encode($result);
echo $resultjson;
?>

34
server/getdrivers.php Normal file
View File

@ -0,0 +1,34 @@
<?php
include_once("db.php");
//make result object
$result = array();
$result['ok'] = false;
//get post data
$postdata = file_get_contents("php://input");
$post = json_decode($postdata, true);
$idchampionship = $post['idchampionship'];
$idteam = $post['idteam'];
//fetch the drivers
$driverfetch = pg_prepare($dbconn, "driverfetch", "select * from driver where idchampionship = $1 and idteam = $2");
$driverfetch = pg_execute($dbconn, "driverfetch", array($idchampionship, $idteam));
//build result object
$drivers = array();
while($row = pg_fetch_assoc($driverfetch)) {
$drivers[] = $row;
}
$result['drivers'] = $drivers;
//return data
$result['ok'] = true;
//print message
$resultjson = json_encode($result);
echo $resultjson;
?>

33
server/getdrives.php Normal file
View File

@ -0,0 +1,33 @@
<?php
include_once("db.php");
//make result object
$result = array();
$result['ok'] = false;
//get post data
$postdata = file_get_contents("php://input");
$post = json_decode($postdata, true);
$idrace = $post['idrace'];
//fetch the drive
$drivefetch = pg_prepare($dbconn, "drivefetch", "select drive.*, driver.name drivername from drive inner join driver using (iddriver) where idrace = $1");
$drivefetch = pg_execute($dbconn, "drivefetch", array($idrace));
//build result object
$drives = array();
while($row = pg_fetch_assoc($drivefetch)) {
$drives[] = $row;
}
$result['drives'] = $drives;
//return data
$result['ok'] = true;
//print message
$resultjson = json_encode($result);
echo $resultjson;
?>

View File

@ -12,7 +12,7 @@
$idchampionship = $post['idchampionship'];
//fetch the championships
$poulefetch = pg_prepare($dbconn, "poulefetch", "select * from poule where idchampionship = $1");
$poulefetch = pg_prepare($dbconn, "poulefetch", "select * from poule where idchampionship = $1 order by tier, poule");
$poulefetch = pg_execute($dbconn, "poulefetch", array($idchampionship));
//build result object

View File

@ -0,0 +1,35 @@
<?php
include_once("db.php");
//make result object
$result = array();
$result['ok'] = false;
//get post data
$postdata = file_get_contents("php://input");
$post = json_decode($postdata, true);
$idchampionship = $post['idchampionship'];
$tier = $post['tier'];
$poule = $post['poule'];
//fetch the championships
$racefetch = pg_prepare($dbconn, "racefetch", "select team.*, race.idrace from team inner join race using (idteam, idchampionship) where idchampionship = $1 and tier = $2 and poule = $3");
$racefetch = pg_execute($dbconn, "racefetch", array($idchampionship, $tier, $poule));
//build result object
$races = array();
while($row = pg_fetch_assoc($racefetch)) {
$races[] = $row;
}
$result['races'] = $races;
//return data
$result['ok'] = true;
//print message
$resultjson = json_encode($result);
echo $resultjson;
?>

47
server/getraceteam.php Normal file
View File

@ -0,0 +1,47 @@
<?php
include_once("db.php");
//make result object
$result = array();
$result['ok'] = false;
//get post data
$postdata = file_get_contents("php://input");
$post = json_decode($postdata, true);
$idrace = $post['idrace'];
//fetch the team
$teamfetch = pg_prepare($dbconn, "teamfetch", "SELECT team.* FROM team INNER JOIN race using (idteam) where idrace = $1");
$teamfetch = pg_execute($dbconn, "teamfetch", array($idrace));
$team = pg_fetch_assoc($teamfetch);
//fetch the drivers
$driverfetch = pg_prepare($dbconn, "driverfetch", "SELECT iddriver, idteam, driver.name drivername, team.name teamname, team.idchampionship from driver inner join team using (idteam) where idteam = $1");
if($driverfetch===FALSE) {
$result['ok'] = false;
$result['error'] = pg_last_error();
} else {
$driverfetch = pg_execute($dbconn, "driverfetch", array($team['idteam']));
if($driverfetch===FALSE) {
$result['ok'] = false;
$result['error'] = pg_last_error();
} else {
$drivers = array();
while($row = pg_fetch_assoc($driverfetch)) {
$drivers[] = $row;
}
//set the drivers in the team object
$team['drivers'] = $drivers;
//set the result object
$result['team'] = $team;
//return data
$result['ok'] = true;
}
}
//print message
$resultjson = json_encode($result);
echo $resultjson;
?>

View File

@ -11,23 +11,46 @@
$idchampionship = $post['idchampionship'];
//fetch the championships
$teamfetch = pg_prepare($dbconn, "teamfetch", "select team.* from team inner join team_championship using (idteam) where idchampionship = $1");
$teamfetch = pg_execute($dbconn, "teamfetch", array($idchampionship));
if(isset($post['tier']) && isset($post['poule']) && isset($post['available'])) {
//fetch everything not in the poule yet, but available in the championship
$tier = $post['tier'];
$poule = $post['poule'];
$teamfetch = pg_prepare($dbconn, "teamfetch", "select t.* from team t
where t.idchampionship = $1 and
t.idteam not in (select idteam from team_poule where team_poule.idchampionship = t.idchampionship
and team_poule.idteam = t.idteam
//build result object
$teams = array();
while($row = pg_fetch_assoc($teamfetch)) {
$teams[] = $row;
)"); //and team_poule.tier = $2 and team_poule.poule = $3
$teamfetch = pg_execute($dbconn, "teamfetch", array($idchampionship));
} else if(isset($post['tier']) && isset($post['poule'])) {
//fetch everything currently set in the poule
$tier = $post['tier'];
$poule = $post['poule'];
$teamfetch = pg_prepare($dbconn, "teamfetch", "select team.* from team inner join team_poule using (idteam,idchampionship) where idchampionship = $1 and tier = $2 and poule = $3");
$teamfetch = pg_execute($dbconn, "teamfetch", array($idchampionship, $tier, $poule));
} else {
//fetch the championships
$teamfetch = pg_prepare($dbconn, "teamfetch", "select team.* from team where idchampionship = $1");
$teamfetch = pg_execute($dbconn, "teamfetch", array($idchampionship));
}
$result['teams'] = $teams;
if($teamfetch === FALSE) {
$result['ok'] = false;
$result['error'] = pg_last_error($dbconn);
} else {
//build result object
$teams = array();
while($row = pg_fetch_assoc($teamfetch)) {
$teams[] = $row;
}
//return data
$result['ok'] = true;
$result['teams'] = $teams;
//return data
$result['ok'] = true;
}
//print message
$resultjson = json_encode($result);
echo $resultjson;
?>

View File

@ -0,0 +1,31 @@
<?php
include_once("db.php");
//make result object
$result = array();
$result['ok'] = false;
//get post data
$postdata = file_get_contents("php://input");
$post = json_decode($postdata, true);
$idchampionship = $post['idchampionship'];
$idteam = $post['idteam'];
$tier = $post['tier'];
$poule = $post['poule'];
$addteamtopoule= pg_prepare($dbconn, "addteamtopoule", "delete from team_poule where idteam = $1 and tier = $2 and poule = $3 and idchampionship = $4");
$addteamtopoule= pg_execute($dbconn, "addteamtopoule", array($idteam, $tier, $poule, $idchampionship));
if($addteamtopoule===FALSE) {
$result['ok'] = false;
$result['error'] = 'delete from team_poule failed: '.pg_last_error($dbconn);
} else {
$result['ok'] = true;
}
//print message
$resultjson = json_encode($result);
echo $resultjson;
?>