Lemonldap-NG-Manager
view release on metacpan or search on metacpan
site/htdocs/static/js/viewer.js view on Meta::CPAN
$scope.message = {
title: 'badRequest',
message: j,
items: []
};
} else {
$scope.message = {
title: 'networkProblem',
message: '',
items: []
};
}
return $scope.showModal('message.html');
};
// Modal launcher
$scope.showModal = function (tpl, init) {
var d, modalInstance;
modalInstance = $uibModal.open({
templateUrl: tpl,
controller: 'ModalInstanceCtrl',
size: 'lg',
resolve: {
elem: function () {
return function (s) {
return $scope[s];
};
},
set: function () {
return function (f, s) {
return $scope[f] = s;
};
},
init: function () {
return init;
}
}
});
d = $q.defer();
modalInstance.result.then(function (msgok) {
$scope.message = {
title: '',
message: '',
items: []
};
return d.resolve(msgok);
}, function (msgnok) {
$scope.message = {
title: '',
message: '',
items: []
};
return d.reject(msgnok);
});
return d.promise;
};
// FORM DISPLAY FUNCTIONS
// Function called when a menu item is selected. It launch function stored in
// "action" or "title"
$scope.menuClick = function (button) {
if (button.popup) {
window.open(button.popup);
} else {
if (!button.action) {
button.action = button.title;
}
switch (typeof button.action) {
case 'function':
button.action($scope.currentNode, $scope);
break;
case 'string':
$scope[button.action]();
break;
default:
console.warn('Unknown action type', typeof button.action);
}
}
return $scope.showM = false;
};
// Display main form
$scope.home = function () {
$scope.form = 'homeViewer';
return $scope.showM = false;
};
// Download raw conf
$scope.downloadConf = function () {
return window.open($scope.viewPrefix + $scope.currentCfg.cfgNum + '?full=1');
};
// NODES MANAGEMENT
id = 1;
$scope._findContainer = function () {
return $scope._findScopeContainer().$modelValue;
};
$scope._findScopeContainer = function () {
var cs;
cs = $scope.currentScope;
while (!cs.$modelValue.type.match(/Container$/)) {
cs = cs.$parentNodeScope;
}
return cs;
};
$scope._findScopeByKey = function (k) {
var cs;
cs = $scope.currentScope;
while (!(cs.$modelValue.title === k)) {
cs = cs.$parentNodeScope;
}
return cs;
};
$scope.down = function () {
var i, ind, l, len, n, p, ref, tmp;
id = $scope.currentNode.id;
p = $scope.currentScope.$parentNodeScope.$modelValue;
ind = p.nodes.length;
ref = p.nodes;
for (i = l = 0, len = ref.length; l < len; i = ++l) {
n = ref[i];
if (n.id === id) {
ind = i;
}
}
if (ind < p.nodes.length - 1) {
( run in 0.715 second using v1.01-cache-2.11-cpan-364913b4093 )