function manageGroup(E,F,C){var B="/cbi/admin_manage/manage";var A=new Array(E,F,C);var D=new Ajax(B,{method:"post",data:Json.toString(A),onSuccess:function(G,H){window.location.reload()}});D.request()}function addToGroup(B,A){manageGroup("add_member",B,A)}function promoteInGroup(B,A){manageGroup("promote_member",B,A)}function demoteInGroup(B,A){manageGroup("demote_member",B,A)}function removeFromGroup(B,A){manageGroup("remove_member",B,A)}function makePublic(A){manageGroup("make_public",null,A)}function destroyGroup(A){manageGroup("destroy_group",A,null)}function restrictContent(B,A){manageGroup("restrict_content",B,A)}function saveToCollection(D,A){var B="/cbi/collection/collectionAddTo";var C=new Ajax(B,{method:"post",data:Json.toString(new Array(D,A)),onSuccess:function(E,F){Log.logDebug("recvd at point response: "+String(E))}});C.request()}function saveAllCollection(B,D){var A="/cbi/collection/collectionAddAll";var C=new Ajax(A,{method:"post",data:Json.toString(new Array(B,D)),onSuccess:function(E,F){Log.logDebug("recvd at point response: "+String(E))}});C.request()}function saveAllViz(D,B){var A="/cbi/collection/collectionAddViz";var C=new Ajax(A,{method:"post",data:Json.toString(new Array(D,B)),onSuccess:function(E,F){Log.logDebug("recvd at point response: "+String(E))}});C.request()}function removeFromCollection(C,D){console.log("REMOVE FROM COLLECTION");console.log(C);console.log(D);var A="/cbi/collection/collectionRemove";var B=new Ajax(A,{method:"post",data:Json.toString(new Array(C,D)),onSuccess:function(E,F){if(String(E)=='["Success"]'){window.location.reload()}else{Log.logDebug("recvd at point response: "+String(E))}}});B.request()}function setDefaultView(E){var A=$("select_type").value;var G=$("select_view").value;var H=window.frames.table_frame;var D=H.document.sort;var B=D.sort_by_attr.value;var C="/cbi/collection/saveDefaultView";var F=new Ajax(C,{method:"post",data:Json.toString({"uuid":E,"filter":A,"view":G,"sort":B}),onSuccess:function(I,J){Log.logDebug("recvd at point response: "+String(I))}});F.request()}var DeleteConfirmer=new Class({options:{creatorId:"delete_confirmation",onComplete:Class.empty,url:"/cbi/collection/systemDelete",uuid:null},initialize:function(A){this.setOptions(A);this.node=$(this.options.creatorId);console.log("Got node: "+this.node);this.cancelButton=this.node.getElement("[id=cancel]");this.submitButton=this.node.getElement("[id=ok]");this.spinner=this.node.getElement("[id=spinner]");console.log("Got all ancillary elements");this.remoteCall=null;this.uuid=this.options.uuid;this.configure();this.registerhandlers()},configure:function(){},registerhandlers:function(){this.submitButton.removeEvents("click");this.submitButton.addEvent("click",(function(){this.submit()}).bind(this));this.cancelButton.removeEvents("click");this.cancelButton.addEvent("click",(function(){this.cancel()}).bind(this))},submit:function(){this.deleteEntity()},cancel:function(){this.hide()},show:function(){console.log("[delete confirmer] showing widget");var A=$("scroller");var B=null;if(!$defined(A)){B={x:0,y:0}}else{B=A.getPosition()}this.node.setStyles({display:"block",left:B.x+50,top:B.y+50});this.spinner.setStyles({display:"none"})},hide:function(){this.node.setStyle("display","none")},deleteEntity:function(){this.remoteCall=new Ajax(this.options.url,{method:"post",data:Json.toString([this.uuid]),autoCancel:true,onComplete:(function(A){var B=Json.evaluate(A)[0];this.handleresponse(B)}).bind(this)});this.spinner.setStyles({display:"block"});this.remoteCall.request()},handleresponse:function(A){this.spinner.setStyle("display","none");if(A=="Success"){window.location.reload();this.hide()}else{this.hide()}}});DeleteConfirmer.implement(new Options,new Events);function deleteEntity(B){var A=new DeleteConfirmer({uuid:B});A.show()}function removeFromViz(B,A){pageManager.removeDatasetFromSession(B);pageManager.remove(B)}function openDatasetBalloonStyle(E,D,A){if(!$defined(D)){D=pageManager.concept}var B="/cbi/template/present_template?session_uuid="+D+"&viz_rule_key="+E;if($defined(A)){B+="&record_uid="+A}var C=window.open(B,"template_binder","status=no,width=650px,height=860px,resizable=yes,scrollbars=yes",true);C.focus();return }function createNewCollectionAll(A){try{collectionMaker.options.onComplete=function(C){saveAllCollection(C,A)};collectionMaker.show()}catch(B){console.log("no local collectionMaker");parent.document.collectionMaker.options.onComplete=function(C){saveAllCollection(C,A)};parent.document.collectionMaker.show()}}function createNewCollection(A){try{collectionMaker.options.onComplete=function(C){saveToCollection(C,A)};collectionMaker.show()}catch(B){console.log("no local collectionMaker");parent.document.collectionMaker.options.onComplete=function(C){saveToCollection(C,A)};parent.document.collectionMaker.show()}}function createCollectionVizAll(A){collectionMaker.options.onComplete=function(B){saveAllViz(B,A)};collectionMaker.show()}function saveVisualization(A){namer.show({onSubmit:function(E,D,C){var B;console.log("op",E,"value",D);switch(E){case"save":B=new Ajax("/cbi/visualize/save",{method:"post",data:Json.toString({uuids:[A],render:false,name:D}),onSuccess:function(F){console.log("txt",F);var G=Json.evaluate(F)[0];C.hide();C._reset()}});C.loadingImg.setStyle("display","inline");B.request();break;default:console.assert(false,"unsupported opcode");break}}})}function createVisualization(A){fo=new Ajax("/cbi/visualize/create",{method:"post",data:Json.toString({uuids:[A],render:false,name:"Untitled"}),onSuccess:function(B){console.log("txt",B);var C=Json.evaluate(B)[0];top.location="/cbi/visualize/render?concept="+C}});fo.request();return }function copyVisualization(B){var A=new Ajax("/cbi/visualize/copy",{method:"post",data:Json.toString({concept:B,render:false}),onSuccess:function(C){console.log("txt",C);var D=Json.evaluate(C)[0];top.location="/cbi/visualize/render?concept="+D}}).request()}function shareSnapshot(B){var A=new ShareSnapshot({uuid:B});A.show()}function shareCollection(A){var B=new ShareCollection({uuid:A});B.show()}