2016-03-22 08:41:04 +01:00
|
|
|
(function(){var a;a=angular.module("llngManager",["ui.tree","ui.bootstrap","llApp","ngCookies"]);a.controller("TreeCtrl",["$scope","$http","$location","$q","$uibModal","$translator","$cookies","$htmlParams",function(q,m,i,j,f,e,g,r){var h,d,p,o,l,b,k,s,n;q.links=window.links;q.menu=r.menu;q.menulinks=window.menulinks;q.staticPrefix=window.staticPrefix;q.formPrefix=window.formPrefix;q.availableLanguages=window.availableLanguages;q.waiting=true;q.showM=false;q.showT=false;q.form="home";q.currentCfg={};q.confPrefix=window.confPrefix;q.message={};q.result="";q.translateTitle=function(c){return e.translateField(c,"title")};q.translateP=e.translateP;q.translate=e.translate;q.helpUrl="start.html#configuration";q.setShowHelp=function(t){var c;if(t==null){t=!q.showH}q.showH=t;c=new Date(Date.now());c.setFullYear(c.getFullYear()+1);return g.put("showhelp",(t?"true":"false"),{expires:c})};q.showH=g.get("showhelp")==="false"?false:true;if(q.showH==null){q.setShowHelp(true)}s=function(c){var u,t;u=c.status;t=c.statusLine;q.waiting=false;if(u===403){q.message={title:"forbidden",message:"",items:[]}}else{if(u===401){console.log("Authentication needed");q.message={title:"authenticationNeeded",message:"__waitOrF5__",items:[]}}else{if(u===400){q.message={title:"badRequest",message:t,items:[]}}else{if(u>0){q.message={title:"badRequest",message:t,items:[]}}else{q.message={title:"networkProblem",message:"",items:[]}}}}}return q.showModal("message.html")};q.showModal=function(t,v){var u,c;c=f.open({templateUrl:t,controller:"ModalInstanceCtrl",size:"lg",resolve:{elem:function(){return function(w){return q[w]}},set:function(){return function(x,w){return q[x]=w}},init:function(){return v}}});u=j.defer();c.result.then(function(w){q.message={title:"",message:"",items:[]};return u.resolve(w)},function(w){q.message={title:"",message:"",items:[]};return u.reject(w)});return u.promise};q.menuClick=function(c){if(c.popup){window.open(c.popup)}else{if(!c.action){c.action=c.title}switch(typeof c.action){case"function":c.action(q.currentNode,q);break;case"string":q[c.action]();break;default:console.log(typeof c.action)}}return q.showM=false};q.home=function(){q.form="home";return q.showM=false};h=function(t){var c;q.message={title:"",message:"",items:[]};if(t.message==="__needConfirmation__"){q.confirmNeeded=true}if(t.message){q.message.message=t.message}if(t.details){for(c in t.details){if(c!=="__changes__"){q.message.items.push({message:c,items:t.details[c]})}}}q.waiting=false;if(t.result===1){i.path("/confs/");q.message.title="successfullySaved"}else{q.message.title="saveReport"}return q.showModal("message.html")};q.save=function(){q.showModal("save.html").then(function(){q.waiting=true;q.data.push({id:"cfgLog",title:"cfgLog",data:q.result?q.result:""});return m.post(window.confPrefix+"?cfgNum="+q.currentCfg.cfgNum+(q.forceSave?"&force=1":""),q.data).then(function(c){q.data.pop();return h(c.data)},function(c){s(c);return q.data.pop()})},function(){return console.log("Saving canceled")});return q.showM=false};q.saveRawConf=function(c){q.waiting=true;return m.post(window.confPrefix+"/raw",c).then(function(t){return h(t.data)},s)};q.restore=function(){q.currentNode=null;return q.form="restore"};q.cancel=function(){q.currentNode.data=null;return q.getKey(q.currentNode)};b=1;q._findContainer=function(){return q._findScopeContainer().$modelValue};q._findScopeContainer=function(){var c;c=q.currentScope;while(!c.$modelValue.type.match(/Container$/)){c=c.$parentNodeScope}return c};q._findScopeByKey=function(c){var t;t=q.currentScope;while(!(t.$modelValue.title===c)){t=t.$parentNodeScope}return t};q.newGrantRule=function(){var c,u,t;t=q._findContainer();c=t.nodes.length;u=c>0?c-1:0;return t.nodes.splice(u,0,{id:t.id+"/n"+(b++),title:"New rule",re:"1",comment:"New rule",data:"Message",type:"grant"})};q.newRule=function(){var c,u,t;t=q._findContainer();c=t.nodes.length;u=c>0?c-1:0;return t.nodes.splice(u,0,{id:t.id+"/n"+(b++),title:"New rule",re:"^/new",comment:"New rule",data:"accept",type:"rule"})};q.newPost=function(){var c;c=q._findContainer();return c.nodes.
|