|
|
|
@ -2,6 +2,15 @@
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var me = this;
|
|
|
|
var me = this;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$scope.storeUserSession = new globals.dataService.store({
|
|
|
|
|
|
|
|
model: null,
|
|
|
|
|
|
|
|
actions: {
|
|
|
|
|
|
|
|
get: 'checkLogin',
|
|
|
|
|
|
|
|
destroy: 'doLogout'
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
$scope.storeUserSession.broadcastEvents = true;
|
|
|
|
|
|
|
|
|
|
|
|
//will contain all the application HTML
|
|
|
|
//will contain all the application HTML
|
|
|
|
$scope.viewCache = null;
|
|
|
|
$scope.viewCache = null;
|
|
|
|
|
|
|
|
|
|
|
|
@ -20,6 +29,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
$scope.menuItems = [];
|
|
|
|
$scope.menuItems = [];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//if true, indicates a session timeout
|
|
|
|
|
|
|
|
$scope.sessionTimeout = false;
|
|
|
|
|
|
|
|
$scope.beforeSessionTimeoutModule = null;
|
|
|
|
|
|
|
|
|
|
|
|
//this div will contain all modules currently not in view
|
|
|
|
//this div will contain all modules currently not in view
|
|
|
|
var divTemp = $('<div></div>');
|
|
|
|
var divTemp = $('<div></div>');
|
|
|
|
|
|
|
|
|
|
|
|
@ -28,52 +41,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
$scope.divMainPanel = $('body #main-panel');
|
|
|
|
$scope.divMainPanel = $('body #main-panel');
|
|
|
|
|
|
|
|
|
|
|
|
$scope.renderModule('body #main-panel', 'Login', null, true, function(className, scope){
|
|
|
|
$scope.storeUserSession.get(function(response, status, headers, config, items){
|
|
|
|
|
|
|
|
|
|
|
|
$timeout(function() {
|
|
|
|
if(response.success)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
//TODO: repeated code ???
|
|
|
|
$('#main-panel').show();
|
|
|
|
$('#main-panel').show();
|
|
|
|
|
|
|
|
|
|
|
|
//globals.plugins.setDefaults();
|
|
|
|
//globals.plugins.setDefaults();
|
|
|
|
//globals.plugins.setBootstrap();
|
|
|
|
//globals.plugins.setBootstrap();
|
|
|
|
|
|
|
|
|
|
|
|
$rootScope.$broadcast('loadingStatusInactive');
|
|
|
|
$rootScope.$broadcast('loadingStatusInactive');
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//$scope.buildTopMenu();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$rootScope.$emit('onloginsuccessfull', {response: response});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
$scope.renderModule('body #main-panel', 'Login', null, true, function(className, scope){
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
$timeout(function() {
|
|
|
|
|
|
|
|
|
|
|
|
$rootScope.$on('onloginsuccessfull', function(event, args){
|
|
|
|
//TODO: repeated code ???
|
|
|
|
|
|
|
|
$('#main-panel').show();
|
|
|
|
$scope.loadModule({Controller: 'Search'}, function(className, scope, isNewModule){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
//globals.plugins.setDefaults();
|
|
|
|
|
|
|
|
//globals.plugins.setBootstrap();
|
|
|
|
//$scope.renderModule('body #main-panel', 'Search', null, true, function(className, scope){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// $timeout(function() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
//});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//var form1 = $scope.getModule('Form1');
|
|
|
|
$rootScope.$broadcast('loadingStatusInactive');
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
////load default module: Form1
|
|
|
|
|
|
|
|
//$scope.renderModule('body #main-panel', 'Form1', null, true, function(className, scope){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// $timeout(function() {
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// //$('#main-panel').show();
|
|
|
|
$rootScope.$on('onloginsuccessfull', function(event, args){
|
|
|
|
|
|
|
|
|
|
|
|
// //globals.plugins.setDefaults();
|
|
|
|
|
|
|
|
// //globals.plugins.setBootstrap();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// //$rootScope.$broadcast('loadingStatusInactive');
|
|
|
|
// go to the default module and/or landing page
|
|
|
|
// });
|
|
|
|
$scope.loadModule({Controller: 'Search'}, function(className, scope, isNewModule){
|
|
|
|
//});
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
//creates/renders a new controller+view into the given placeholder
|
|
|
|
//creates/renders a new controller+view into the given placeholder
|
|
|
|
@ -307,7 +315,7 @@
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$scope.currentModuleName = subModule.Name;
|
|
|
|
$scope.currentModuleName = subModule.Controller;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
@ -365,6 +373,7 @@
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// executes a logout from the application and perfomrs cleanup operations
|
|
|
|
$scope.logout = function(){
|
|
|
|
$scope.logout = function(){
|
|
|
|
|
|
|
|
|
|
|
|
globals.message.confirm({
|
|
|
|
globals.message.confirm({
|
|
|
|
@ -373,9 +382,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
if(result)
|
|
|
|
if(result)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$scope.loadModule({Controller: 'Login'}, function(className, scope, isNewModule){
|
|
|
|
$scope.storeUserSession.broadcastEvents = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$scope.storeUserSession.destroy(null, function(response){
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
$scope.storeUserSession.broadcastEvents = true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(response.success)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
//TODO: cleanup the whole application ???
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$scope.loadModule({Controller: 'Login'}, function(className, scope, isNewModule){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
@ -405,9 +430,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
$scope.notification = null;
|
|
|
|
$scope.notification = null;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$scope.defaultExceptionMessage = {
|
|
|
|
|
|
|
|
success: false,
|
|
|
|
|
|
|
|
data: null,
|
|
|
|
|
|
|
|
messages: [
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
type: 'ERROR',
|
|
|
|
|
|
|
|
messageData: 'Ocorreu um erro de sistema.'
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
$rootScope.$on('response', function(event, args){
|
|
|
|
$rootScope.$on('response', function(event, args){
|
|
|
|
|
|
|
|
|
|
|
|
var response = args.response;
|
|
|
|
var response = args.response, msgCss = 'default';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(response.data == undefined || response.messages == undefined)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
response = $scope.defaultExceptionMessage;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(response != undefined && response != null && response.messages.length > 0)
|
|
|
|
if(response != undefined && response != null && response.messages.length > 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
@ -415,7 +456,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
$scope.FirstMessage = response.messages[0];
|
|
|
|
$scope.FirstMessage = response.messages[0];
|
|
|
|
|
|
|
|
|
|
|
|
$scope.FirstMessage.type = globals.utils.getMessageTypeCSS($scope.FirstMessage.type);
|
|
|
|
msgCss = globals.utils.getMessageTypeCSS($scope.FirstMessage.type);
|
|
|
|
|
|
|
|
|
|
|
|
$scope.MessageCount = response.messages.length;
|
|
|
|
$scope.MessageCount = response.messages.length;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -430,7 +471,7 @@
|
|
|
|
text: $scope.FirstMessage.messageData,
|
|
|
|
text: $scope.FirstMessage.messageData,
|
|
|
|
maxVisible: 1,
|
|
|
|
maxVisible: 1,
|
|
|
|
template:
|
|
|
|
template:
|
|
|
|
'<div ng-click="viewServerResponse()" class="bg-' + $scope.FirstMessage.type + ' noty_message">' +
|
|
|
|
'<div ng-click="viewServerResponse()" class="bg-' + msgCss + ' noty_message">' +
|
|
|
|
'<span ng-show="MessageCount > 1" class="label label-default pull-left noty-label">+{{MessageCount-1}}</span>' +
|
|
|
|
'<span ng-show="MessageCount > 1" class="label label-default pull-left noty-label">+{{MessageCount-1}}</span>' +
|
|
|
|
'<span class="noty_text"></span>' +
|
|
|
|
'<span class="noty_text"></span>' +
|
|
|
|
'<div class="noty_close"></div>' +
|
|
|
|
'<div class="noty_close"></div>' +
|
|
|
|
@ -462,6 +503,18 @@
|
|
|
|
//$scope.windowViewServerResponse.viewController.list($scope.ServerResponse);
|
|
|
|
//$scope.windowViewServerResponse.viewController.list($scope.ServerResponse);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$rootScope.$on('onsessiontimeout', function(event, args){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var eee = args.response;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$scope.sessionTimeout = true;
|
|
|
|
|
|
|
|
$scope.beforeSessionTimeoutModule = $scope.currentModule;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$scope.loadModule({Controller: 'Login'}, function(className, scope, isNewModule){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
|
|
|
|
//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
|
|
|
|
|
|
|
|
|
|
|
|
//fires whenever a new module is rendered, if broadcastCreation is true on method renderModule
|
|
|
|
//fires whenever a new module is rendered, if broadcastCreation is true on method renderModule
|
|
|
|
|