This commit is contained in:
manzerbredes 2016-02-06 12:10:04 +01:00
parent e9e7ddf9b1
commit bd81674a85
7 changed files with 62 additions and 31 deletions

View file

@ -1,8 +1,13 @@
// Declare main app /**
* The main app module instance
* @type angular.module.angular-1_3_6_L1749.moduleInstance
*/
var mainApp=angular.module("mainApp",['ngRoute', 'ngSanitize']); var mainApp=angular.module("mainApp",['ngRoute', 'ngSanitize']);
/**
* Configure the router
*/
mainApp.config(['$routeProvider', function($routeProvider){ mainApp.config(['$routeProvider', function($routeProvider){
$routeProvider. $routeProvider.
when('/home',{ when('/home',{

View file

@ -1,9 +1,8 @@
/* /**
* home Controller * The home controller
*
* @param {$scope} $scope The $scope service from angular
*/ */
mainApp.controller('homeCtrl', function ($scope) mainApp.controller('homeCtrl', function ($scope)
{ {

View file

@ -1,7 +1,11 @@
/** /**
* Represents a book. * The login controler
* @constructor * @param {$scope} $scope The $scope angular service
* @param {$sce} $sce The $sce angular service
* @param {$http} $http The $http angular service
* @param {sharedProfile} sharedProfile The sharedProfile service
*/ */
mainApp.controller('loginCtrl', ['$scope','$sce','$http', 'sharedProfile', function ($scope,$sce, $http, sharedProfile) mainApp.controller('loginCtrl', ['$scope','$sce','$http', 'sharedProfile', function ($scope,$sce, $http, sharedProfile)
{ {

View file

@ -1,9 +1,8 @@
/* /**
* network Controller * The network controller
*
* @param {$scope} $scope The $scope service from angular
*/ */
mainApp.controller('networkCtrl', function ($scope) mainApp.controller('networkCtrl', function ($scope)
{ {
}); });

View file

@ -1,11 +1,11 @@
/*
* mainApp Controller
/**
* The status controller
*
* @param {$scope} $scope The $scope service from angular
* @param {sharedProfile} sharedProfile The sharedProfile build by ourself
*/ */
mainApp.controller('statusCtrl', ['$scope','sharedProfile', function ($scope, sharedProfile) mainApp.controller('statusCtrl', ['$scope','sharedProfile', function ($scope, sharedProfile)
{ {
$scope.profile=sharedProfile; $scope.profile=sharedProfile;

View file

@ -1,21 +1,43 @@
// Make Namespace /**
* Client Identity Module
* @namespace identity
*/
var identity = {}; var identity = {};
identity.request = {}; // Request part
identity.requestParser = {}; // Parser part /**
* Contain all request who can be send with http request
* @namespace request
*/
identity.request = {};
/**
* Contain parser for result of request made by {@link identity.request}
* @namespace request
*/
identity.requestParser = {};
/**
identity.request.login=function($http,username, password,projectname){ *
var requestResultObject={}; * @param {object} $http Angular $http service
* @param {string} username The user name
* @param {string} password The user password
* @param {string} projectname The user project name
* @returns {promise} The result of the request
*/
identity.request.login=function($http,username, password,projectname){
return $http.post('../server/index.php', return $http.post('../server/index.php',
$.param({"task" : "Authenticate", "user" : username, "password" : password, "project" : projectname}), $.param({"task" : "Authenticate", "user" : username, "password" : password, "project" : projectname}),
{headers: {'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'}}); {headers: {'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'}});
}; };
/**
*
* @param {string} response The response to parse
* @returns {requestParserResult} Formated data
*/
identity.requestParser.parseLoginAnswer=function(response){ identity.requestParser.parseLoginAnswer=function(response){
var requestParserResult={}; var requestParserResult={};

View file

@ -1,6 +1,8 @@
/**
* The sharedProfile service
* It's used to shared the profile between controller
*/
mainApp.factory('sharedProfile',[function(){ mainApp.factory('sharedProfile',[function(){
var profile={}; var profile={};