213 lines
6.3 KiB
Plaintext
213 lines
6.3 KiB
Plaintext
// create the controller and inject Angular's $scope
|
|
scotchApp.controller('mainController',
|
|
// create a message to display in our view
|
|
function($scope ,$q ,$rootScope ,$route ,$modal ,$location ,$routeParams ,appSharedService) {
|
|
|
|
var h = $(window).height();
|
|
$('#mains').height(h - 100);
|
|
|
|
init();
|
|
|
|
function init() {
|
|
|
|
//alert("init");
|
|
try {
|
|
$scope.wleft = 450;
|
|
$scope.wright = 462;
|
|
//bootbox.alert("Are you sure?");
|
|
//alert("init");
|
|
//$rootScope.$broadcast("@PagesMain",'1');
|
|
$scope.mainUrl = '';
|
|
$scope.logIn = {};
|
|
//var deferred01 = $q.defer();
|
|
|
|
var url = window.location.href;
|
|
|
|
var intPam = url.indexOf('?');
|
|
var p = url.substring(url.indexOf('?') + 1, url.length);
|
|
//alert("intPam"+intPam);
|
|
//alert("p"+p);
|
|
|
|
if (intPam > 0 && null != p && p != '') {
|
|
//p = '';
|
|
p = "?" + p;
|
|
} else {
|
|
p = '';
|
|
}
|
|
|
|
} catch (e) {
|
|
$location.path("/logout");
|
|
}
|
|
}
|
|
|
|
function isEntry(data){
|
|
if(typeof(data) == "undefined"){
|
|
return true;
|
|
}else
|
|
if(data == null){
|
|
return true;
|
|
}else
|
|
if(data == 'null'){
|
|
return true;
|
|
}else
|
|
if(data == ''){
|
|
return true;
|
|
}else
|
|
if(data == ' '){
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
$scope.doGetIdLeft = function (flagShowMenu,flagShowSch){
|
|
if(flagShowSch){
|
|
if(flagShowMenu){
|
|
return "jobstep-left";
|
|
}else{
|
|
return "obstep-lefts";
|
|
}
|
|
}else{
|
|
if(flagShowMenu){
|
|
return "jobstep-left-no-search";
|
|
}else{
|
|
return "obstep-lefts";
|
|
}
|
|
}
|
|
};
|
|
|
|
$scope.doGetIdRight = function (flagShowMenu,flagShowSch){
|
|
if(flagShowSch){
|
|
if(flagShowMenu){
|
|
return "jobstep-right";
|
|
}else{
|
|
return "jobstep-rights";
|
|
}
|
|
}else{
|
|
if(flagShowMenu){
|
|
return "jobstep-right-no-search";
|
|
}else{
|
|
return "jobstep-rights";
|
|
}
|
|
}
|
|
};
|
|
|
|
$scope.doGetIdSideBar = function (flagShowMenu,flagShowSch){
|
|
if(flagShowSch){
|
|
if(flagShowMenu){
|
|
return "jobstep-sidebar-resizer";
|
|
}else{
|
|
return "jobstep-sidebar-resizer-s";
|
|
}
|
|
}else{
|
|
if(flagShowMenu){
|
|
return "jobstep-sidebar-resizer-no-search";
|
|
}else{
|
|
return "jobstep-sidebar-resizer-no-search-s";
|
|
}
|
|
}
|
|
};
|
|
|
|
function doSetShowPage(menuBean) {
|
|
|
|
var urlDF = "/" + menuBean.menuCode;
|
|
if (null == urlDF || urlDF == "") {
|
|
urlDF = "/defaults";
|
|
}
|
|
//alert(urlDF);
|
|
$scope.searchUrl = '';
|
|
$scope.menuUrl = '';
|
|
//$scope.$digest();
|
|
|
|
$scope.flagShowSch = false;
|
|
|
|
if (menuBean.pageSchFlag == '1') {
|
|
$scope.flagShowSch = true;
|
|
$scope.searchUrl = doGetPath('/pages/' + menuBean.menuLink + '_01.jsp');
|
|
$scope.$apply();
|
|
}
|
|
|
|
$scope.flagShowMenu = false;
|
|
if (menuBean.pageMenuFlag == '1') {
|
|
$scope.flagShowMenu = true;
|
|
$scope.menuUrl = doGetPath('/pages/' + menuBean.menuLink + '.jsp');
|
|
}
|
|
|
|
$scope.headTitlePages = menuBean.menuCode + ' : ' + menuBean.menuName;
|
|
$scope.$apply();
|
|
|
|
return urlDF;
|
|
}
|
|
|
|
$scope.doGoToJobStep = function () {
|
|
try {
|
|
|
|
appSharedService.jobStepList = [];
|
|
|
|
var jsLoadJobStep = $.ajax(doGetPath('/json/changeMenuJobStep.json'),
|
|
{
|
|
ajax: true,
|
|
dataType: 'json',
|
|
type: "POST"
|
|
});
|
|
jsLoadJobStep.then(
|
|
function (data) {
|
|
appSharedService.setChangeMenu(data[1]);
|
|
appSharedService.setRefreshSch();
|
|
$location.path("/LPC001");
|
|
$scope.$apply();
|
|
}
|
|
);
|
|
} catch (e) {
|
|
//
|
|
}
|
|
};
|
|
|
|
$scope.doGoToUserInfo = function () {
|
|
try {
|
|
|
|
//alert(" ");
|
|
appSharedService.jobStepList = [];
|
|
|
|
var jsLoadJobStep = $.ajax(doGetPath('/json/changeMenu.json'),
|
|
{
|
|
ajax: true,
|
|
dataType: 'json',
|
|
type: "POST",
|
|
data:{
|
|
menuCode : 'LMT001'
|
|
}
|
|
});
|
|
jsLoadJobStep.then(
|
|
function (data) {
|
|
appSharedService.setChangeMenu(data[1]);
|
|
appSharedService.setRefreshSch();
|
|
$location.path("/"+data[1].menuCode);
|
|
$scope.$apply();
|
|
}
|
|
);
|
|
} catch (e) {
|
|
//
|
|
}
|
|
};
|
|
|
|
$scope.doLogout = function () {
|
|
$location.path("/logout");
|
|
};
|
|
|
|
$scope.doWleft = function () {
|
|
if ($scope.wleft > 0) {
|
|
$scope.wleft = 0;
|
|
$scope.wright = 7;
|
|
} else {
|
|
$scope.wleft = 450;
|
|
$scope.wright = 462;
|
|
}
|
|
};
|
|
|
|
$scope.$on("handleBroadcastChangeMenu",function(){
|
|
var df = doSetShowPage(appSharedService.changeMenu);
|
|
//$location.path(df);
|
|
$scope.$apply();
|
|
});
|
|
}); |