var COOKIE_NAME = 'evidencehubmainviz'; //this list the tabs var TABS = {"home":true,"challenge":true, "social":true, "org":true,"project":true,"issue":true, "solution":true, "evidence":true, "web":true, "claim":true,"user":true }; var VIZ = {"overview":true,"list":true}; var USERVIZ = {"overview":true,"list":true, "usergmap":true, "nodegmap":true, "net":true}; var ORGVIZ = {"overview":true, "list":true, "gmap":true}; var COMMENTVIZ = {"list":true}; var NEWSVIZ = {"list":true}; var DEFAULT_TAB = 'home'; var DEFAULT_VIZ = 'list'; var CURRENT_VIZ = DEFAULT_VIZ; var CURRENT_TAB = DEFAULT_TAB; var DATA_LOADED = {"home":false, "org":false, "project":false, "projectoverview":false, "orgoverview":false, "challenge":false, "challengeoverview":false, "issue":false, "issueoverview":false, "solution":false, "solutionoverview":false, "claim":false, "claimoverview":false, "evidence":false, "evidenceoverview":false, "url":false, "urloverview":false, "user":false, "useroverview":false, "orgsimile":false,"issuesimile":false,"claimsimile":false,"evidencesimile":false,"orggmap":false,"projectgmap":false,"issuegmap":false,"claimgmap":false,"evidencegmap":false,"usergmap":false,"nodegmap":false, "commentlist":false, "newslist":false}; var NEGATIVE_LINKGROUP_NAME = "Negative"; var POSITIVE_LINKGROUP_NAME = "Positive"; var NEUTRAL_LINKGROUP_NAME = "Neutral"; //define events for clicking on the tabs var stpHomeOverview = setTabPushed.bindAsEventListener($('tab-home-list-obj'),'home-overview'); var stpHomeList = setTabPushed.bindAsEventListener($('tab-home-list-obj'),'home-list'); var stpHomeNet = setTabPushed.bindAsEventListener($('tab-home-list-obj'),'home-net'); var stpChallengeList = setTabPushed.bindAsEventListener($('tab-challenge-list-obj'),'challenge-list'); var stpChallengeNet = setTabPushed.bindAsEventListener($('tab-challenge-list-obj'),'challenge-net'); var stpChallengeOverview = setTabPushed.bindAsEventListener($('tab-challenge-list-obj'),'challenge-overview'); var stpOrgList = setTabPushed.bindAsEventListener($('tab-org-list-obj'),'org-list'); var stpOrgGMap = setTabPushed.bindAsEventListener($('tab-org-list-obj'),'org-gmap'); var stpOrgNet = setTabPushed.bindAsEventListener($('tab-org-list-obj'),'org-net'); var stpOrgOverview = setTabPushed.bindAsEventListener($('tab-org-list-obj'),'org-overview'); var stpProjectList = setTabPushed.bindAsEventListener($('tab-project-list-obj'),'project-list'); var stpProjectGMap = setTabPushed.bindAsEventListener($('tab-project-list-obj'),'project-gmap'); var stpProjectNet = setTabPushed.bindAsEventListener($('tab-project-list-obj'),'project-net'); var stpProjectOverview = setTabPushed.bindAsEventListener($('tab-project-list-obj'),'project-overview'); var stpIssueList = setTabPushed.bindAsEventListener($('tab-issue-list-obj'),'issue-list'); var stpIssueGMap = setTabPushed.bindAsEventListener($('tab-issue-list-obj'),'issue-gmap'); var stpIssueNet = setTabPushed.bindAsEventListener($('tab-issue-list-obj'),'issue-net'); var stpIssueOverview = setTabPushed.bindAsEventListener($('tab-issue-list-obj'),'issue-overview'); var stpSolutionList = setTabPushed.bindAsEventListener($('tab-solution-list-obj'),'solution-list'); var stpSolutionGMap = setTabPushed.bindAsEventListener($('tab-solution-list-obj'),'solution-gmap'); var stpSolutionNet = setTabPushed.bindAsEventListener($('tab-solution-list-obj'),'solution-net'); var stpSolutionOverview = setTabPushed.bindAsEventListener($('tab-solution-list-obj'),'solution-overview'); var stpClaimList = setTabPushed.bindAsEventListener($('tab-claim-list-obj'),'claim-list'); var stpClaimGMap = setTabPushed.bindAsEventListener($('tab-claim-list-obj'),'claim-gmap'); var stpClaimNet = setTabPushed.bindAsEventListener($('tab-claim-list-obj'),'claim-net'); var stpClaimOverview = setTabPushed.bindAsEventListener($('tab-claim-list-obj'),'claim-overview'); var stpEvidenceList = setTabPushed.bindAsEventListener($('tab-evidence-list-obj'),'evidence-list'); var stpEvidenceGMap = setTabPushed.bindAsEventListener($('tab-evidence-list-obj'),'evidence-gmap'); var stpEvidenceNet = setTabPushed.bindAsEventListener($('tab-evidence-list-obj'),'evidence-net'); var stpEvidenceOverview = setTabPushed.bindAsEventListener($('tab-evidence-list-obj'),'evidence-overview'); var stpWebList = setTabPushed.bindAsEventListener($('tab-web-list-obj'),'web-list'); var stpWebNet = setTabPushed.bindAsEventListener($('tab-web-list-obj'),'web-net'); var stpWebOverview = setTabPushed.bindAsEventListener($('tab-web-list-obj'),'web-overview'); var stpUserList = setTabPushed.bindAsEventListener($('tab-user-list-obj'),'user-list'); var stpUserGMap = setTabPushed.bindAsEventListener($('tab-user-list-obj'),'user-usergmap'); var stpUserOverview = setTabPushed.bindAsEventListener($('tab-user-list-obj'),'user-overview'); var stpUserNet = setTabPushed.bindAsEventListener($('tab-user-list-obj'),'user-net'); var stpUserNodeGMap = setTabPushed.bindAsEventListener($('tab-user-list-obj'),'user-nodegmap'); /** * set which tab to show and load first */ Event.observe(window, 'load', function() { // add events for clicking on the main tabs Event.observe('tab-home','click', stpHomeList); Event.observe('tab-issue','click', stpIssueOverview); Event.observe('tab-evidence','click', stpEvidenceOverview); Event.observe('tab-web','click', stpWebOverview); if (hasChallenge && $("tab-challenge")) { Event.observe('tab-challenge','click', stpChallengeOverview); } if (hasSolution) { Event.observe('tab-solution','click', stpSolutionOverview); } if (hasClaim) { Event.observe('tab-claim','click', stpClaimOverview); } if ($("tab-user")) { Event.observe('tab-user','click', stpUserOverview); } if ($("tab-org")) { Event.observe('tab-org','click', stpOrgOverview); } if ($("tab-project")) { Event.observe('tab-project','click', stpProjectOverview); } // add events for clicking on the viz tabs if (hasChallenge && $("tab-challenge")) { Event.observe('tab-challenge-list','click', stpChallengeList); Event.observe('tab-challenge-overview','click', stpChallengeOverview); //Event.observe('tab-challenge-net','click', stpChallengeNet); } Event.observe('tab-org-overview','click', stpOrgOverview); Event.observe('tab-org-list','click', stpOrgList); //Event.observe('tab-org-net','click', stpOrgNet); Event.observe('tab-org-gmap','click', stpOrgGMap); Event.observe('tab-project-overview','click', stpProjectOverview); Event.observe('tab-project-list','click', stpProjectList); //Event.observe('tab-project-net','click', stpProjectNet); Event.observe('tab-project-gmap','click', stpProjectGMap); Event.observe('tab-issue-overview','click', stpIssueOverview); Event.observe('tab-issue-list','click', stpIssueList); //Event.observe('tab-issue-net','click', stpIssueNet); if (hasSolution) { Event.observe('tab-solution-overview','click', stpSolutionOverview); Event.observe('tab-solution-list','click', stpSolutionList); //Event.observe('tab-solution-net','click', stpSolutionNet); } if (hasClaim) { Event.observe('tab-claim-overview','click', stpClaimOverview); Event.observe('tab-claim-list','click', stpClaimList); //Event.observe('tab-claim-net','click', stpClaimNet); } Event.observe('tab-evidence-overview','click', stpEvidenceOverview); Event.observe('tab-evidence-list','click', stpEvidenceList); //Event.observe('tab-evidence-net','click', stpEvidenceNet); Event.observe('tab-web-overview','click', stpWebOverview); Event.observe('tab-web-list','click', stpWebList); //Event.observe('tab-web-net','click', stpWebNet); if ($("tab-user-overview")) { Event.observe('tab-user-overview','click', stpUserOverview); } if ($("tab-user-list")) { Event.observe('tab-user-list','click', stpUserList); } if ($("tab-user-usergmap")) { Event.observe('tab-user-usergmap','click', stpUserGMap); } if ($("tab-user-nodegmap")) { Event.observe('tab-user-nodegmap','click', stpUserNodeGMap); } if ($("tab-user-net")) { Event.observe('tab-user-net','click', stpUserNet); } // create the social menu var socialsubmenu = new Element("div", {'id':'socialsubmenu', 'style':'z-index:100; left:-1px;top:-1px;clear:both;position:absolute;display:none;padding:5px;width:140px;border:1px solid gray;background:white'} ); var posme = getPosition($("tab-social-li")); var x=posme.x; var y=posme.y+23; socialsubmenu.style.left = x+"px"; socialsubmenu.style.top = y+"px"; var orgtab = new Element('span',{'class':'active', 'style':'margin-bottom:3px;clear:both;float:left;'}); orgtab.insert("Organizations"); Event.observe(orgtab,'click',function (){ hideBox('socialsubmenu'); setTabPushed($('tab-org-list-obj'), 'org-overview'); }); socialsubmenu.insert(orgtab); var projecttab = new Element('span',{'class':'active', 'style':'margin-bottom:3px;clear:both;float:left;'}); projecttab.insert("Projects"); Event.observe(projecttab,'click',function (){ hideBox('socialsubmenu'); setTabPushed($('tab-project-list-obj'), 'project-overview'); }); socialsubmenu.insert(projecttab); var usertab = new Element('span',{'class':'active', 'style':'margin-bottom:3px;clear:both;float:left;'}); usertab.insert("Users"); Event.observe(usertab,'click',function (){ hideBox('socialsubmenu'); setTabPushed($('tab-user-list-obj'), 'user-overview'); }); socialsubmenu.insert(usertab); Event.observe(socialsubmenu,'mouseout',function (event){ hideBox('socialsubmenu'); }); Event.observe(socialsubmenu,'mouseover',function (event){ showBox('socialsubmenu'); }); $("tab-social-li").appendChild(socialsubmenu); Event.observe($("socialmenuarrow"),'mouseover',function (event){ showBox('socialsubmenu'); }); Event.observe($("socialmenuarrow"),'mouseout',function (event){ hideBox('socialsubmenu'); }); //var viz = getViz(""); //setTabPushed($('tab-'+getAnchorVal(DEFAULT_TAB + "-" + viz)),getAnchorVal(DEFAULT_TAB + "-" + viz)); setTabPushed($('tab-'+getAnchorVal(DEFAULT_TAB + "-" + DEFAULT_VIZ)),getAnchorVal(DEFAULT_TAB + "-" + DEFAULT_VIZ)); }); /** * Return the viz and store in cookie */ function getViz(viz) { //alert("BEFORE:"+viz); if (viz == "" || (viz != 'list' && viz != "overview" && viz != "net" && viz != "usergmap" && viz != "gmap")) { viz = DEFAULT_VIZ; var allcookies = document.cookie; if (allcookies != null) { var cookiearray = allcookies.split(';'); for(var i=0; i < cookiearray.length; i++){ var param = cookiearray[i].split('=') var name = param[0]; var value = param[1]; if (name.trim() == COOKIE_NAME) { //alert("COOKIE:"+value); viz = value; } } } if (viz == "") { viz = DEFAULT_VIZ; } } else { if (viz != "net") { var date = new Date(); date.setTime(date.getTime()+(365*24*60*60*1000)); // 365 days document.cookie = COOKIE_NAME + "=" + viz + "; expires=" + date.toGMTString(); } } //alert("AFTER:"+viz); return viz; } /** * switch between tabs */ function setTabPushed(e) { var data = $A(arguments); var tabID = data[1]; // Social Sign On bug - returns strange #_=_ when calling index page if (tabID == '_=_') { tabID = 'home-overview'; window.location.hash = tabID; if (typeof window.history.replaceState == 'function') { window.history.replaceState("string", "Title", "#home-overview"); } } // get tab and the visualisation from the # var parts = tabID.split("-"); var tab = parts[0]; var viz=""; if (parts.length > 1) { viz = parts[1]; } var page=1; if (parts.length > 2) { page = parseInt(parts[2]); } //viz = getViz(viz); // Check tab is know else default to default if (!TABS.hasOwnProperty(tab)) { tab = DEFAULT_TAB; viz = DEFAULT_VIZ; } var i=""; var temptab = tab; if (tab == "org" || tab == "project" || tab == "user") { temptab = "social"; } for (i in TABS){ if(temptab == i){ if($("tab-"+i)) { $("tab-"+i).removeClassName("unselected"); $("tab-"+i).addClassName("current"); } } else { if($("tab-"+i)) { $("tab-"+i).removeClassName("current"); $("tab-"+i).addClassName("unselected"); } } if(tab == i){ if ($("tab-content-"+i+"-div")) { $("tab-content-"+i+"-div").show(); } } else { if ($("tab-content-"+i+"-div")) { $("tab-content-"+i+"-div").hide(); } } } if (tab == 'issue' || tab == 'solution' || tab == 'claim' || (tab == 'challenge' && hasChallenge) || tab == 'evidence' || tab == 'web') { for (i in VIZ){ if(viz == i){ $("tab-"+tab+"-"+i).removeClassName("unselected"); $("tab-"+tab+"-"+i).addClassName("current"); $("tab-content-"+tab+"-"+i).show(); } else { $("tab-"+tab+"-"+i).removeClassName("current"); $("tab-"+tab+"-"+i).addClassName("unselected"); $("tab-content-"+tab+"-"+i).hide(); } } } else if (tab == 'org' || tab == 'project') { if (tab == 'project') { $('tab-social-text').innerHTML = "Social-Projects"; $('tab-social').setAttribute("href","#project-overview"); } else { $('tab-social-text').innerHTML = "Social-Organizations"; $('tab-social').setAttribute("href","#org-overview"); } for (i in ORGVIZ){ if(viz == i){ if ($("tab-"+tab+"-"+i)) { $("tab-"+tab+"-"+i).removeClassName("unselected"); $("tab-"+tab+"-"+i).addClassName("current"); } if ($("tab-content-"+tab+"-"+i)) { $("tab-content-"+tab+"-"+i).show(); } } else { if ($("tab-"+tab+"-"+i)) { $("tab-"+tab+"-"+i).removeClassName("current"); $("tab-"+tab+"-"+i).addClassName("unselected"); } if ($("tab-content-"+tab+"-"+i)) { $("tab-content-"+tab+"-"+i).hide(); } } } } else if (tab == 'user') { $('tab-social-text').innerHTML = "Social-Users"; $('tab-social').setAttribute("href","#user-overview"); for (i in USERVIZ){ if(viz == i){ if ($("tab-"+tab+"-"+i)) { $("tab-"+tab+"-"+i).removeClassName("unselected"); $("tab-"+tab+"-"+i).addClassName("current"); } if ($("tab-content-"+tab+"-"+i)) { $("tab-content-"+tab+"-"+i).show(); } } else { if ($("tab-"+tab+"-"+i)) { $("tab-"+tab+"-"+i).removeClassName("current"); $("tab-"+tab+"-"+i).addClassName("unselected"); } if ($("tab-content-"+tab+"-"+i)) { $("tab-content-"+tab+"-"+i).hide(); } } } } else if (tab == 'comment' && $("tab-comment")) { for (i in COMMENTVIZ){ if(viz == i){ $("tab-"+tab+"-"+i).removeClassName("unselected"); $("tab-"+tab+"-"+i).addClassName("current"); $("tab-content-"+tab+"-"+i).show(); } else { $("tab-"+tab+"-"+i).removeClassName("current"); $("tab-"+tab+"-"+i).addClassName("unselected"); $("tab-content-"+tab+"-"+i).hide(); } } } else if (tab == 'news' && $("tab-news")) { for (i in NEWSVIZ){ if(viz == i){ $("tab-"+tab+"-"+i).removeClassName("unselected"); $("tab-"+tab+"-"+i).addClassName("current"); $("tab-content-"+tab+"-"+i).show(); } else { $("tab-"+tab+"-"+i).removeClassName("current"); $("tab-"+tab+"-"+i).addClassName("unselected"); $("tab-content-"+tab+"-"+i).hide(); } } } if (tab == 'user') { USER_ARGS['orderby'] = 'lastactive'; } CURRENT_TAB = tab; CURRENT_VIZ = viz; switch(viz){ case 'gmap': switch(tab) { case 'org': $('tab-social').setAttribute("href","#org-gmap"); Event.stopObserving('tab-social','click'); Event.observe('tab-social','click', stpOrgGMap); if(!DATA_LOADED.orggmap){ loadOrgNodesGMap(); } else { updateAddressParameters(ORG_ARGS); if (ORG_ARGS['zoomtocountry'] != 'undefined') { zoomToCountryOrg(ORG_ARGS['zoomtocountry']); } } break; case 'project': $('tab-social').setAttribute("href","#project-gmap"); Event.stopObserving('tab-social','click'); Event.observe('tab-social','click', stpProjectGMap); if(!DATA_LOADED.projectgmap){ loadProjectNodesGMap(); } else { updateAddressParameters(PROJECT_ARGS); if (PROJECT_ARGS['zoomtocountry'] != 'undefined') { zoomToCountryProject(PROJECT_ARGS['zoomtocountry']); } } break; } break; case 'usergmap': $('tab-social').setAttribute("href","#user-usergmap"); Event.stopObserving('tab-social','click'); Event.observe('tab-social','click', stpUserGMap); if(!DATA_LOADED.usergmap){ loadUserGMap(); } else { updateAddressParameters(USER_ARGS); if (USER_ARGS['zoomtocountry'] != 'undefined') { zoomToCountryUser(USER_ARGS['zoomtocountry']); } } //DATA_LOADED.user = false; break; case 'nodegmap': $('tab-social').setAttribute("href","#user-nodegmap"); Event.stopObserving('tab-social','click'); Event.observe('tab-social','click', stpUserNodeGMap); if(!DATA_LOADED.nodegmap){ loadUserNodeGMap(); } else { updateAddressParameters(USER_ARGS); if (USER_ARGS['zoomtocountry'] != 'undefined') { zoomToCountryUserNode(USER_ARGS['zoomtocountry']); } } //DATA_LOADED.user = false; break; case 'list': switch(tab) { case 'home': $('tab-home').setAttribute("href",'#home-list'); Event.observe('tab-home','click', stpHomeList); if(!DATA_LOADED.home){ NODE_ARGS['start'] = (page-1) * NODE_ARGS['max']; loadhome(CONTEXT,NODE_ARGS); } break; case 'challenge': $('tab-challenge').setAttribute("href", '#challenge-list'); Event.stopObserving('tab-challenge','click'); Event.observe('tab-challenge','click', stpChallengeList); if(!DATA_LOADED.challenge){ CHALLENGE_ARGS['start'] = (page-1) * CHALLENGE_ARGS['max']; loadchallenges(CONTEXT,CHALLENGE_ARGS); } else { updateAddressParameters(CHALLENGE_ARGS); } break; case 'org': $('tab-social').setAttribute("href",'#org-list'); Event.stopObserving('tab-social','click'); Event.observe('tab-social','click', stpOrgList); if(!DATA_LOADED.org){ ORG_ARGS['start'] = (page-1) * ORG_ARGS['max']; loadorgs(CONTEXT,ORG_ARGS); } else { updateAddressParameters(ORG_ARGS); } break; case 'project': $('tab-social').setAttribute("href","#project-list"); Event.stopObserving('tab-social','click'); Event.observe('tab-social','click', stpProjectList); if(!DATA_LOADED.project){ PROJECT_ARGS['start'] = (page-1) * PROJECT_ARGS['max']; loadprojects(CONTEXT,PROJECT_ARGS); } else { updateAddressParameters(PROJECT_ARGS); } break; case 'issue': $('tab-issue').setAttribute("href",'#issue-list'); Event.stopObserving('tab-issue','click'); Event.observe('tab-issue','click', stpIssueList); if(!DATA_LOADED.issue){ ISSUE_ARGS['start'] = (page-1) * ISSUE_ARGS['max']; loadissues(CONTEXT,ISSUE_ARGS); } else { updateAddressParameters(ISSUE_ARGS); } break; case 'solution': $('tab-solution').setAttribute("href",'#solution-list'); Event.stopObserving('tab-solution','click'); Event.observe('tab-solution','click', stpSolutionList); if(!DATA_LOADED.solution){ SOLUTION_ARGS['start'] = (page-1) * SOLUTION_ARGS['max']; loadsolutions(CONTEXT,SOLUTION_ARGS); } else { updateAddressParameters(SOLUTION_ARGS); } break; case 'claim': $('tab-claim').setAttribute("href",'#claim-list'); Event.stopObserving('tab-claim','click'); Event.observe('tab-claim','click', stpClaimList); if(!DATA_LOADED.claim){ CLAIM_ARGS['start'] = (page-1) * CLAIM_ARGS['max']; loadclaims(CONTEXT,CLAIM_ARGS); } else { updateAddressParameters(CLAIM_ARGS); } break; case 'evidence': $('tab-evidence').setAttribute("href",'#evidence-list'); Event.stopObserving('tab-evidence','click'); Event.observe('tab-evidence','click', stpEvidenceList); if(!DATA_LOADED.evidence){ EVIDENCE_ARGS['start'] = page-1 * EVIDENCE_ARGS['max']; loadevidence(CONTEXT,EVIDENCE_ARGS); } else { updateAddressParameters(EVIDENCE_ARGS); } break; case 'web': $('tab-web').setAttribute("href",'#web-list'); Event.stopObserving('tab-web','click'); Event.observe('tab-web','click', stpWebList); if(!DATA_LOADED.url){ URL_ARGS['start'] = (page-1) * URL_ARGS['max']; loadurls(CONTEXT,URL_ARGS); } else { updateAddressParameters(URL_ARGS); } break; case 'user': $('tab-social').setAttribute("href",'#user-list'); Event.stopObserving('tab-social','click'); Event.observe('tab-social','click', stpUserList); if(!DATA_LOADED.user){ USER_ARGS['start'] = (page-1) * USER_ARGS['max']; loadusers(CONTEXT,USER_ARGS); } else { updateAddressParameters(USER_ARGS); } break; case 'comment': $('tab-comment').setAttribute("href",'#comment-list'); Event.observe('tab-comment','click', stpCommentList); if(!DATA_LOADED.commentlist){ COMMENT_ARGS['start'] = (page-1) * COMMENT_ARGS['max']; loadcomments(CONTEXT,COMMENT_ARGS); } else { updateAddressParameters(COMMENT_ARGS); } break; case 'news': $('tab-news').setAttribute("href",'#news-list'); Event.observe('tab-news','click', stpNewsList); if(!DATA_LOADED.newslist){ NEWS_ARGS['start'] = (page-1) * NEWS_ARGS['max']; loadnews(CONTEXT,NEWS_ARGS); } else { updateAddressParameters(NEWS_ARGS); } break; } break; case 'overview': switch(tab){ case 'home': updateAddressParameters({}); // HERE ALSO FOR BACKWARD COMPATIBILITY $('tab-home').setAttribute("href","#home-list"); Event.observe('tab-home','click', stpHomeList); if(!DATA_LOADED.home){ loadhome(CONTEXT,NODE_ARGS); } break; case 'org': updateAddressParameters({}); $('tab-social').setAttribute("href","https://isave.evidence-hub.net/#org-overview"); Event.stopObserving('tab-social','click'); Event.observe('tab-social','click', stpOrgOverview); if(!DATA_LOADED.orgoverview){ loadOrgOverview(CONTEXT,ORG_ARGS); } break; case 'project': updateAddressParameters({}); $('tab-social').setAttribute("href","https://isave.evidence-hub.net/#project-overview"); Event.stopObserving('tab-social','click'); Event.observe('tab-social','click', stpProjectOverview); if(!DATA_LOADED.projectoverview){ loadProjectOverview(CONTEXT,PROJECT_ARGS); } break; case 'challenge': updateAddressParameters({}); $('tab-challenge').setAttribute("href","https://isave.evidence-hub.net/#challenge-overview"); Event.stopObserving('tab-challenge','click'); Event.observe('tab-challenge','click', stpChallengeOverview); if(!DATA_LOADED.challengeoverview){ loadChallengeOverview(CONTEXT,CHALLENGE_ARGS); } break; case 'issue': updateAddressParameters({}); $('tab-issue').setAttribute("href","https://isave.evidence-hub.net/#issue-overview"); Event.stopObserving('tab-issue','click'); Event.observe('tab-issue','click', stpIssueOverview); if(!DATA_LOADED.issueoverview){ loadIssueOverview(CONTEXT,ISSUE_ARGS); } break; case 'solution': updateAddressParameters({}); $('tab-solution').setAttribute("href","https://isave.evidence-hub.net/#solution-overview"); Event.stopObserving('tab-solution','click'); Event.observe('tab-solution','click', stpSolutionOverview); if(!DATA_LOADED.solutionoverview){ loadSolutionOverview(CONTEXT,SOLUTION_ARGS); } break; case 'claim': updateAddressParameters({}); $('tab-claim').setAttribute("href","https://isave.evidence-hub.net/#claim-overview"); Event.stopObserving('tab-claim','click'); Event.observe('tab-claim','click', stpClaimOverview); if(!DATA_LOADED.claimoverview){ loadClaimOverview(CONTEXT,CLAIM_ARGS); } break; case 'evidence': updateAddressParameters({}); $('tab-evidence').setAttribute("href","https://isave.evidence-hub.net/#evidence-overview"); Event.stopObserving('tab-evidence','click'); Event.observe('tab-evidence','click', stpEvidenceOverview); if(!DATA_LOADED.evidenceoverview){ loadEvidenceOverview(CONTEXT,EVIDENCE_ARGS); } break; case 'web': updateAddressParameters({}); $('tab-web').setAttribute("href","https://isave.evidence-hub.net/#web-overview"); Event.stopObserving('tab-web','click'); Event.observe('tab-web','click', stpWebOverview); if(!DATA_LOADED.urloverview){ loadWebOverview(CONTEXT,URL_ARGS); } break; case 'user': updateAddressParameters({}); $('tab-social').setAttribute("href","https://isave.evidence-hub.net/#user-overview"); Event.stopObserving('tab-social','click'); Event.observe('tab-social','click', stpUserOverview); if(!DATA_LOADED.useroverview){ loadUserOverview(CONTEXT,USER_ARGS); } break; } break; case 'net': switch(tab){ case 'org': $('tab-social').setAttribute("href","#org-net"); Event.stopObserving('tab-social','click'); Event.observe('tab-social','click', stpOrgNet); loadOrgNet(CONTEXT,ORG_ARGS); //DATA_LOADED.org = false; break; case 'project': $('tab-social').setAttribute("href","#project-net"); Event.stopObserving('tab-social','click'); Event.observe('tab-social','click', stpProjectNet); loadProjectNet(CONTEXT,PROJECT_ARGS); //DATA_LOADED.project = false; break; case 'challenge': $('tab-challenge').setAttribute("href","#challenge-net"); Event.stopObserving('tab-challenge','click'); Event.observe('tab-challenge','click', stpChallengeNet); loadChallengeNet(CONTEXT,CHALLENGE_ARGS); //DATA_LOADED.challenge = false; break; case 'issue': $('tab-issue').setAttribute("href","#issue-net"); Event.stopObserving('tab-issue','click'); Event.observe('tab-issue','click', stpIssueNet); loadIssueNet(CONTEXT,ISSUE_ARGS); //DATA_LOADED.issue = false; break; case 'solution': $('tab-solution').setAttribute("href","#solution-net"); Event.stopObserving('tab-solution','click'); Event.observe('tab-solution','click', stpSolutionNet); loadSolutionNet(CONTEXT,SOLUTION_ARGS); //DATA_LOADED.solution = false; break; case 'claim': $('tab-claim').setAttribute("href","#claim-net"); Event.stopObserving('tab-claim','click'); Event.observe('tab-claim','click', stpClaimNet); loadClaimNet(CONTEXT,CLAIM_ARGS); //DATA_LOADED.claim = false; break; case 'evidence': $('tab-evidence').setAttribute("href","#evidence-net"); Event.stopObserving('tab-evidence','click'); Event.observe('tab-evidence','click', stpEvidenceNet); loadEvidenceNet(CONTEXT,EVIDENCE_ARGS); //DATA_LOADED.evidence = false; break; case 'web': $('tab-web').setAttribute("href","#web-net"); Event.stopObserving('tab-web','click'); Event.observe('tab-web','click', stpWebNet); loadWebNet(CONTEXT,URL_ARGS); //DATA_LOADED.web = false; break; case 'user': $('tab-social').setAttribute("href","https://isave.evidence-hub.net/#user-net"); Event.stopObserving('tab-social','click'); Event.observe('tab-social','click', stpUserNet); loadUserNet(CONTEXT,USER_ARGS); //DATA_LOADED.usernet = false; break; } break; default: //alert("default"); } } /** * Called by forms to refresh the challenges view */ function refreshChallenges() { switch(CURRENT_VIZ){ case 'list': loadchallenges(CONTEXT,CHALLENGE_ARGS); break; case 'net': loadChallengeNet(CONTEXT,CHALLENGE_ARGS); break; default: } } /** * Called to refresh the current org view */ function refreshOrganizations() { switch(CURRENT_VIZ){ case 'list': loadorgs(CONTEXT,ORG_ARGS); break; case 'net': if ($('CohereOrgNet')) { loadOrgThemeApplet(); } else { loadOrgNet(CONTEXT,ORG_ARGS); } break; case 'gmap': loadOrgNodesGMap(CONTEXT,ORG_ARGS); break; default: } } /** * Called to refresh the current project view */ function refreshProjects() { switch(CURRENT_VIZ){ case 'list': loadprojects(CONTEXT,PROJECT_ARGS); break; case 'net': if ($('CohereProjectNet')) { loadProjectThemeApplet(); } else { loadProjectNet(CONTEXT,PROJECT_ARGS); } break; case 'gmap': loadProjectNodesGMap(CONTEXT,PROJECT_ARGS); break; default: } } /** * Called by forms to refresh the issues view */ function refreshIssues() { switch(CURRENT_VIZ){ case 'list': loadissues(CONTEXT,ISSUE_ARGS); break; case 'net': if ($('CohereIssueNet')) { loadIssueThemeApplet(); } else { loadIssueNet(CONTEXT,ISSUE_ARGS); } break; default: } } /** * Called by forms to refresh the solution view */ function refreshSolutions() { switch(CURRENT_VIZ){ case 'list': loadsolutions(CONTEXT,SOLUTION_ARGS); break; case 'net': if ($('CohereSolutionNet')) { loadSolutionThemeApplet(); } else { loadSolutionNet(CONTEXT,SOLUTION_ARGS); } break; default: } } /** * Called by forms to refresh the claims view */ function refreshClaims() { switch(CURRENT_VIZ){ case 'list': loadclaims(CONTEXT,CLAIM_ARGS); break; case 'net': if ($('CohereClaimNet')) { loadClaimThemeApplet(); } else { loadClaimNet(CONTEXT,CLAIM_ARGS); } break; default: } } /** * Called by forms to refresh the evidence view */ function refreshEvidence() { switch(CURRENT_VIZ){ case 'list': loadevidence(CONTEXT,EVIDENCE_ARGS); break; case 'net': if ($('CohereEvidenceNet')) { loadEvidenceThemeApplet(); } else { loadEvidenceNet(CONTEXT,EVIDENCE_ARGS); } break; default: } } function refreshWebsites() { switch(CURRENT_VIZ){ case 'list': loadurls(CONTEXT,URL_ARGS); break; case 'net': if ($('CohereResourceNet')) { loadResourceThemeApplet(); } else { loadResourceNet(CONTEXT,URL_ARGS); } break; default: } } function refreshUsers() { switch(CURRENT_VIZ){ case 'list': loadusers(CONTEXT,USER_ARGS); break; case 'usergmap': loadUserGMap(); break; case 'nodegmap': loadUserNodeGMap(); break; default: } } function refreshComments() { loadcomments(CONTEXT,COMMENT_ARGS); } function refreshNews() { loadnews(CONTEXT,NEWS_ARGS); } /** * load next/previous set of organisation nodes */ function loadhome(context,args){ loadHomePageOverview(context, args) //$("tab-content-home").update("Home page"); } // LOAD OVERVIEWS /** * Create the Home Overview page * @param context the current context * @param args the array of parameters for this category */ function loadHomePageOverview(context, args) { if ($("tab-content-home-overview")) { $("tab-content-home-overview").innerHTML = ""; var widget = overviewHomeNodeWidget(context, args, BASE_TYPES_STR+','+RESOURCE_TYPES_STR+','+EVIDENCE_TYPES_STR, 'date', 'DESC', '10', 230, 220, 'mostrecent'); if (widget.innerHTML == "") { $("tab-content-home-recent").style.display = "none"; } else { $("tab-content-home-overview").insert( widget ); DATA_LOADED.homeoverview = true; } } } /** * Create the Key Challenge Overview page * @param context the current context * @param args the array of parameters for this category */ function loadChallengeOverview(context, args) { $("tab-content-challenge-overview").innerHTML = ""; var row1 = new Element("div", {"class":"tab-content-overview row mb-3"}); var recentorgs = new Element("div", {"class":"col-md-6 col-sm-12"}); var set = overviewNodeWidget(context, args, 'Most Recent Key Challenges', "Challenge", 'date', 'DESC', '5', 350, 190, 'Explore all', 'challenge', 'Key Challenges', 'mostrecent'); recentorgs.insert(set); var connectedorgs = new Element("div", {"class":"col-md-6 col-sm-12"}); var set = overviewNodeWidget(context, args, 'Most Connected Key Challenges', "Challenge", 'connectedness', 'DESC', '5', 350, 190, 'Explore all', 'challenge', 'Key Challenges', 'mostconnected'); connectedorgs.insert(set); row1.insert(recentorgs); row1.insert(connectedorgs); var row2 = new Element("div", {"class":"tab-content-overview row mb-3"}); var voted = new Element("div", {"class":"col-md-6 col-sm-12"}); var set3 = overviewNodeWidget(context, args, 'Most Voted on Key Challenges', "Challenge", 'vote', 'DESC', '5', 350, 190, 'Explore all', 'challenge', 'Key Challenges', 'mostvoted'); voted.insert(set3); var poptheme = new Element("div", {"class":"col-md-6 col-sm-12"}); var set2 = overviewThemeWidget(context, args, 'Most Popular Themes for Key Challenges', 'Challenge', '5', 350, 201, 'Explore all', 'challenge', 'Key Challenges', 'mostthemes'); poptheme.insert(set2); row2.insert(voted); row2.insert(poptheme); $("tab-content-challenge-overview").insert( row1 ); $("tab-content-challenge-overview").insert( row2 ); DATA_LOADED.challengeoverview = true; } /** * Create the Issue Overview page * @param context the current context * @param args the array of parameters for this category */ function loadIssueOverview(context, args) { $("tab-content-issue-overview").innerHTML = ""; var row1 = new Element("div", {"class":"tab-content-overview row mb-3"}); var recentorgs = new Element("div", {"class":"col-md-6 col-sm-12"}); var set = overviewNodeWidget(context, args, 'Most Recent Issues', "Issue", 'date', 'DESC', '5', 350, 190, 'Explore all', 'issue', 'Issues', 'mostrecent'); recentorgs.insert(set); var connectedorgs = new Element("div", {"class":"col-md-6 col-sm-12"}); var set = overviewNodeWidget(context, args, 'Most Connected Issues', "Issue", 'connectedness', 'DESC', '5', 350, 190, 'Explore all', 'issue', 'Issues', 'mostconnected'); connectedorgs.insert(set); row1.insert(recentorgs); row1.insert(connectedorgs); var row2 = new Element("div", {"class":"tab-content-overview row mb-3"}); var voted = new Element("div", {"class":"col-md-6 col-sm-12"}); var set3 = overviewNodeWidget(context, args, 'Most Voted on Issues', "Issue", 'vote', 'DESC', '5', 350, 190, 'Explore all', 'issue', 'Issues', 'mostvoted'); voted.insert(set3); var poptheme = new Element("div", {"class":"col-md-6 col-sm-12"}); var set2 = overviewThemeWidget(context, args, 'Most Popular Themes for Issues', 'Issue', '5', 350, 201, 'Explore all', 'issue', 'Issues', 'mostthemes'); poptheme.insert(set2); row2.insert(voted); row2.insert(poptheme); $("tab-content-issue-overview").insert( row1 ); $("tab-content-issue-overview").insert( row2 ); DATA_LOADED.issueoverview = true; } /** * Create the Solution Overview page * @param context the current context * @param args the array of parameters for this category */ function loadSolutionOverview(context, args) { $("tab-content-solution-overview").innerHTML = ""; var row1 = new Element("div", {"class":"tab-content-overview row mb-3"}); var recent = new Element("div", {"class":"col-md-6 col-sm-12"}); var set = overviewNodeWidget(context, args, 'Most Recent Ideas', "Solution", 'date', 'DESC', '5', 350, 190, 'Explore all', 'solution', 'Ideas', 'mostrecent'); recent.insert(set); var connected = new Element("div", {"class":"col-md-6 col-sm-12"}); var set = overviewNodeWidget(context, args, 'Most Connected Ideas', "Solution", 'connectedness', 'DESC', '5', 350, 190, 'Explore all', 'solution', 'Ideas', 'mostconnected'); connected.insert(set); row1.insert(recent); row1.insert(connected); var row2 = new Element("div", {"class":"tab-content-overview row mb-3"}); var voted = new Element("div", {"class":"col-md-6 col-sm-12"}); var set3 = overviewNodeWidget(context, args, 'Most Voted on Ideas', "Solution", 'vote', 'DESC', '5', 350, 190, 'Explore all', 'solution', 'Ideas', 'mostvoted'); voted.insert(set3); var poptheme = new Element("div", {"class":"col-md-6 col-sm-12"}); var set2 = overviewThemeWidget(context, args, 'Most Popular Themes for Ideas', 'Solution', '5', 350, 201, 'Explore all', 'solution', 'Ideas', 'mostthemes'); poptheme.insert(set2); row2.insert(voted); row2.insert(poptheme); $("tab-content-solution-overview").insert( row1 ); $("tab-content-solution-overview").insert( row2 ); DATA_LOADED.solutionoverview = true; } /** * Create the Claim Overview page * @param context the current context * @param args the array of parameters for this category */ function loadClaimOverview(context, args) { $("tab-content-claim-overview").innerHTML = ""; var row1 = new Element("div", {"class":"tab-content-overview row mb-3"}); var recent = new Element("div", {"class":"col-md-6 col-sm-12"}); var set = overviewNodeWidget(context, args, 'Most Recent Facts', "Claim", 'date', 'DESC', '5', 350, 190, 'Explore all', 'claim', 'Facts', 'mostrecent'); recent.insert(set); row1.insert(recent); var connected = new Element("div", {"class":"col-md-6 col-sm-12"}); var set = overviewNodeWidget(context, args, 'Most Connected Facts', "Claim", 'connectedness', 'DESC', '5', 350, 190, 'Explore all', 'claim', 'Facts', 'mostconnected'); connected.insert(set); row1.insert(connected); var row2 = new Element("div", {"class":"tab-content-overview row mb-3"}); var voted = new Element("div", {"class":"col-md-6 col-sm-12"}); var set3 = overviewNodeWidget(context, args, 'Most Voted on Facts', "Claim", 'vote', 'DESC', '5', 350, 190, 'Explore all', 'claim', 'Facts', 'mostvoted'); voted.insert(set3); row2.insert(voted); var poptheme = new Element("div", {"class":"col-md-6 col-sm-12"}); var set2 = overviewThemeWidget(context, args, 'Most Popular Themes for Facts', 'Claim', '5', 350, 201, 'Explore all', 'claim', 'Facts', 'mostthemes'); poptheme.insert(set2); row2.insert(poptheme); $("tab-content-claim-overview").insert( row1 ); $("tab-content-claim-overview").insert( row2 ); DATA_LOADED.claimoverview = true; } /** * Create the Evidence Overview page * @param context the current context * @param args the array of parameters for this category */ function loadEvidenceOverview(context, args) { $("tab-content-evidence-overview").innerHTML = ""; var row1 = new Element("div", {"class":"tab-content-overview row mb-3"}); var recent = new Element("div", {"class":"col-md-6 col-sm-12"}); var set = overviewNodeWidget(context, args, 'Most Recent Arguments', EVIDENCE_TYPES_STR, 'date', 'DESC', '5', 350, 190, 'Explore all', 'evidence', 'Arguments', 'mostrecent'); recent.insert(set); row1.insert(recent); var connected = new Element("div", {"class":"col-md-6 col-sm-12"}); var set = overviewNodeWidget(context, args, 'Most Connected Arguments', EVIDENCE_TYPES_STR, 'connectedness', 'DESC', '5', 350, 190, 'Explore all', 'evidence', 'Arguments', 'mostconnected'); connected.insert(set); row1.insert(connected); var row2 = new Element("div", {"class":"tab-content-overview row mb-3"}); var voted = new Element("div", {"class":"col-md-6 col-sm-12"}); var set3 = overviewNodeWidget(context, args, 'Most Voted on Arguments', EVIDENCE_TYPES_STR, 'vote', 'DESC', '5', 350, 190, 'Explore all', 'evidence', 'Arguments', 'mostvoted'); voted.insert(set3); row2.insert(voted); var poptheme = new Element("div", {"class":"col-md-6 col-sm-12"}); var set2 = overviewThemeWidget(context, args, 'Most Popular Themes for Arguments', EVIDENCE_TYPES_STR, '5', 350, 201, 'Explore all', 'evidence', 'Arguments', 'mostthemes'); poptheme.insert(set2); row2.insert(poptheme); $("tab-content-evidence-overview").insert( row1 ); $("tab-content-evidence-overview").insert( row2 ); DATA_LOADED.evidenceoverview = true; } /** * Create the Resources Overview page * @param context the current context * @param args the array of parameters for this category */ function loadWebOverview(context, args) { $("tab-content-web-overview").innerHTML = ""; var row1 = new Element("div", {"class":"tab-content-overview row mb-3"}); var recent = new Element("div", {"class":"col-md-6 col-sm-12"}); var set = overviewNodeWidget(context, args, 'Most Recent Resources', RESOURCE_TYPES_STR, 'date', 'DESC', '5', 350, 190, 'Explore all', 'web', 'Resources', 'mostrecent'); recent.insert(set); row1.insert(recent); var connected = new Element("div", {"class":"col-md-6 col-sm-12"}); var set = overviewNodeWidget(context, args, 'Most Connected Resources', RESOURCE_TYPES_STR, 'connectedness', 'DESC', '5', 350, 190, 'Explore all', 'web', 'Resources', 'mostconnected'); connected.insert(set); row1.insert(connected); var row2 = new Element("div", {"class":"tab-content-overview row mb-3"}); var poptheme = new Element("div", {"class":"col-md-6 col-sm-12"}); var set2 = overviewThemeWidget(context, args, 'Most Popular Themes for Resources', RESOURCE_TYPES_STR, '5', 350, 191, 'Explore all', 'web', 'Resources', 'mostthemes'); poptheme.insert(set2); row2.insert(poptheme); $("tab-content-web-overview").insert( row1 ); $("tab-content-web-overview").insert( row2 ); DATA_LOADED.weboverview = true; } /** * Create the Users Overview page * @param context the current context * @param args the array of parameters for this category */ function loadUserOverview(context, args) { $("tab-content-user-overview").innerHTML = ""; var row1 = new Element("div", {"class":"tab-content-overview row mb-3"}); var recentusers = new Element("div", {"class":"col-md-6 col-sm-12"}); var set = overviewUserWidget(context, args, "Most Recent Users", 'date', 'DESC', '5', 350, 190, "Explore all", 'user', 'Users'); recentusers.insert(set); row1.insert(recentusers); var followedusers = new Element("div", {"class":"col-md-6 col-sm-12"}); var set = overviewFollowedUserWidget(context, args, "Most Followed Users", 'date', 'DESC', '5', 350, 190, "Explore all", 'user', 'Users'); followedusers.insert(set); row1.insert(followedusers); var row2 = new Element("div", {"class":"tab-content-overview row mb-3"}); var activeusers = new Element("div", {"class":"col-md-6 col-sm-12"}); var set = overviewActiveUserWidget(context, args, "Most Active Users in the past Month", 'date', 'DESC', '5', 350, 190, "Explore all", 'user', 'Users'); activeusers.insert(set); row2.insert(activeusers); var usercountries = new Element("div", {"class":"col-md-6 col-sm-12"}); var set2 = new Element("fieldset", {'class':'overviewfieldset'}); var legend2 = new Element("legend", {'class':'overviewlegend widgettextcolor'}); legend2.insert("User Countries"); set2.insert(legend2); var main2 = new Element("div", {"class":"overviewDiv", 'style':'height: 190px; overflow-y: auto; overflow-x: hidden;'}); var tagcloud = new Element("div", {'id':'tagcloud', "class": "user-tagcloud" }); tagcloud.insert(createCountryCloud(userscountrycloud, 'users')); main2.insert(tagcloud); set2.insert(main2); var buttondiv = new Element("div", {'style':'width: 100%; clear:both;float:left;'}); var allbutton = new Element("span", {'class':'active', 'title':"click to explore all Users", 'style':'float:right; font-weight:bold; margin: 5px;margin-top:0px;'}); allbutton.insert("View on Map"); Event.observe(allbutton,'click',function(){ setTabPushed( $('tab-user-list-obj'), 'user-usergmap'); }); buttondiv.insert(allbutton); set2.insert(buttondiv); usercountries.insert(set2); row2.insert(usercountries); $("tab-content-user-overview").insert( row1 ); $("tab-content-user-overview").insert( row2 ); DATA_LOADED.useroverview = true; } /** * Create the Organization/Project Overview page * @param context the current context * @param args the array of parameters for this category */ function loadOrgOverview(context, args) { $("tab-content-org-overview").innerHTML = ""; var row1 = new Element("div", {"class":"tab-content-overview row mb-3"}); var recentorgs = new Element("div", {"class":"col-md-6 col-sm-12"}); var set = overviewNodeWidget(context, args, 'Most Recent Organizations', "Organization", 'date', 'DESC', '5', 350, 190, 'Explore all', 'org', 'Organizations', 'recentorg', 'Organization'); recentorgs.insert(set); row1.insert(recentorgs); var connectedorgs = new Element("div", {"class":"col-md-6 col-sm-12"}); var set = overviewNodeWidget(context, args, 'Most Connected Organizations', "Organization", 'connectedness', 'DESC', '5', 350, 190, 'Explore all', 'org', 'Organizations', 'connectorg', 'Organization'); connectedorgs.insert(set); row1.insert(connectedorgs); var row2 = new Element("div", {"class":"tab-content-overview row mb-3"}); var orgcountries = new Element("div", {"class":"col-md-6 col-sm-12"}); var set2 = new Element("fieldset", {'class':'overviewfieldset'}); var legend2 = new Element("legend", {'class':'overviewlegend widgettextcolor'}); legend2.insert('Organization Countries'); set2.insert(legend2); var main2 = new Element("div", {"class":"overviewDiv", 'style':'height: 190px; overflow-y: auto; overflow-x: hidden;'}); var tagcloud = new Element("div", {'id':'tagcloud','style':'width: 350px;'}); tagcloud.insert(createCountryCloud(orgcountrycloud, 'orgs')); main2.insert(tagcloud); set2.insert(main2); var buttondiv = new Element("div", {'style':'width: 100%; clear:both;float:left;'}); var allbutton = new Element("span", {'class':'active', 'title':'click to explore all Organizations', 'style':'float:right; font-weight:bold; margin: 5px;margin-top:0px;'}); allbutton.insert('View on Map'); Event.observe(allbutton,'click',function(){ ORG_ARGS['filternodetypes'] = 'Project'; setTabPushed( $('tab-org-list-obj'), 'org-gmap'); }); buttondiv.insert(allbutton); set2.insert(buttondiv); orgcountries.insert(set2); row2.insert(orgcountries); var poptheme = new Element("div", {"class":"col-md-6 col-sm-12"}); var set2 = overviewThemeWidget(context, args, 'Most Popular Themes for Organizations', 'Organization', '5', 350, 201, 'Explore all', 'org', 'Organizations', 'mostthemes'); poptheme.insert(set2); row2.insert(poptheme); $("tab-content-org-overview").insert( row1 ); $("tab-content-org-overview").insert( row2 ); DATA_LOADED.orgoverview = true; } /** * Create the Project Overview page * @param context the current context * @param args the array of parameters for this category */ function loadProjectOverview(context, args) { $("tab-content-project-overview").innerHTML = ""; var row1 = new Element("div", {"class":"tab-content-overview row mb-3"}); var recentprojects = new Element("div", {"class":"col-md-6 col-sm-12"}); var set2 = overviewNodeWidget(context, args, 'Most Recent Projects', "Project", 'date', 'DESC', '5', 350, 190, 'Explore all', 'project', 'Projects', 'recentprojects', 'Project'); recentprojects.insert(set2); row1.insert(recentprojects); var connectedprojects = new Element("div", {"class":"col-md-6 col-sm-12"}); var set2 = overviewNodeWidget(context, args, 'Most Connected Projects', "Project", 'connectedness', 'DESC', '5', 350, 190, 'Explore all', 'project', 'Projects','connectedprojects', 'Project'); connectedprojects.insert(set2); row1.insert(connectedprojects); var row2 = new Element("div", {"class":"tab-content-overview row mb-3"}); var projectcountries = new Element("div", {"class":"col-md-6 col-sm-12"}); var set2 = new Element("fieldset", {'class':'overviewfieldset'}); var legend2 = new Element("legend", {'class':'overviewlegend widgettextcolor'}); legend2.insert('Project Countries'); set2.insert(legend2); var main2 = new Element("div", {'id':'tagcloud', 'style':'width:100%; float:left; height: 190px; overflow-y: auto; overflow-x: none; margin-left;5px;margin-top: 5px;'}); main2.insert(createCountryCloud(projectcountrycloud, 'projects')); set2.insert(main2); var buttondiv2 = new Element("div", {'style':'width: 100%; clear:both;float:left;'}); var allbutton = new Element("span", {'class':'active', 'title':'click to explore all Projects', 'style':'float:right; font-weight:bold; margin: 5px;margin-top:0px;'}); allbutton.insert('View on Map'); Event.observe(allbutton,'click',function(){ PROJECT_ARGS['filternodetypes'] = 'Project'; setTabPushed( $('tab-project-list-obj'), 'project-gmap'); }); buttondiv2.insert(allbutton); set2.insert(buttondiv2); projectcountries.insert(set2); row2.insert(projectcountries); var poptheme2 = new Element("div", {"class":"col-md-6 col-sm-12"}); var set2 = overviewThemeWidget(context, args, 'Most Popular Themes for Projects', 'Project', '5', 350, 211, 'Explore all', 'project', 'Projects', 'mostthemes'); poptheme2.insert(set2); row2.insert(poptheme2); $("tab-content-project-overview").insert( row1 ); $("tab-content-project-overview").insert( row2 ); DATA_LOADED.projectoverview = true; } function gotoCountry(type, country) { if (type == 'orgs') { ORG_ARGS['filternodetypes'] = 'Project'; ORG_ARGS['zoomtocountry'] = country; $('tab-social').setAttribute("href","#org-gmap"); Event.stopObserving('tab-social','click'); Event.observe('tab-social','click', stpOrgGMap); setTabPushed( $('tab-org-list-obj'), 'org-gmap'); } else if (type == 'projects') { PROJECT_ARGS['filternodetypes'] = 'Project'; PROJECT_ARGS['zoomtocountry'] = country; $('tab-social').setAttribute("href","#project-gmap"); Event.stopObserving('tab-social','click'); Event.observe('tab-social','click', stpProjectGMap); setTabPushed( $('tab-project-list-obj'), 'project-gmap'); } else if (type == 'users') { USER_ARGS['zoomtocountry'] = country; $('tab-social').setAttribute("href","#user-usergmap"); Event.stopObserving('tab-social','click'); Event.observe('tab-social','click', stpUserGMap); setTabPushed( $('tab-org-list-obj'), 'user-usergmap'); } } function createCountryCloud(countries, type) { var cloud = ""; return cloud; } // LOAD LISTS/// /** * load next/previous set of nodes */ function loadchallenges(context,args){ args['filternodetypes'] = "Challenge"; updateAddressParameters(args); $("tab-content-challenge-list").update(getLoading("(Loading Key Challenges...)")); var reqUrl = SERVICE_ROOT + "&method=getnodesby" + context + "&" + Object.toQueryString(args); new Ajax.Request(reqUrl, { method:'get', onSuccess: function(transport){ try { var json = transport.responseText.evalJSON(); } catch(err) { console.log(err); } if(json.error){ alert(json.error[0].message); return; } //set the count in tab header //$('challenge-list-count').innerHTML = ""; //$('challenge-list-count').insert("("+json.nodeset[0].totalno+")"); //$('challengebuttons').innerHTML = ""; //display nav var total = json.nodeset[0].totalno; if (CURRENT_VIZ == 'list') { var currentPage = (json.nodeset[0].start/args["max"]) + 1; window.location.hash = CURRENT_TAB+"-"+CURRENT_VIZ+"-"+currentPage; } $("tab-content-challenge-list").update(createNav(total,json.nodeset[0].start,json.nodeset[0].count,args,context,"challenges")); //display nodes if(json.nodeset[0].nodes.length > 0){ //preprosses nodes to add searchid if it is there if (args['searchid'] && args['searchid'] != "") { var nodes = json.nodeset[0].nodes; var count = nodes.length; for (var i=0; i < count; i++) { var node = nodes[i]; node.cnode.searchid = args['searchid']; } } var tb3 = new Element("div", {'class':'toolbarrow row'}); var sortOpts = {date: 'Creation Date', name: 'Title', moddate: 'Modification Date',connectedness:'Connections', vote:'Votes'}; tb3.insert(displaySortForm(sortOpts,args,'challenge',reorderChallenges)); tb3.insert(createThemeFilter(context, args, 'challenges')); tb3.insert(createConnectedFilter(context, args, 'challenges')); $("tab-content-challenge-list").insert(tb3); displayNodes($("tab-content-challenge-list"),json.nodeset[0].nodes,parseInt(args['start'])+1, true); } else { var tb3 = new Element("div", {'class':'toolbarrow row'}); tb3.insert(createThemeFilter(context, args, 'challenges')); tb3.insert(createConnectedFilter(context, args, 'challenges')); $("tab-content-challenge-list").insert(tb3); } //display nav if (total > parseInt( args["max"] )) { $("tab-content-challenge-list").insert(createNav(total,json.nodeset[0].start,json.nodeset[0].count,args,context,"challenges")); } } }); DATA_LOADED.challenge = true; DATA_LOADED.challengesimile = false; } /** * load next/previous set of organisation nodes */ function loadorgs(context,args){ var types = "Organization"; if (args['filternodetypes'] == "" || types.indexOf(args['filternodetypes']) == -1) { args['filternodetypes'] = types; } updateAddressParameters(args); $("tab-content-org-list").update(getLoading("(Loading Organizations...)")); var reqUrl = SERVICE_ROOT + "&method=getnodesby" + context + "&" + Object.toQueryString(args); new Ajax.Request(reqUrl, { method:'get', onSuccess: function(transport){ try { var json = transport.responseText.evalJSON(); } catch(err) { console.log(err); } if(json.error){ alert(json.error[0].message); return; } //set the count in tab header //$('org-list-count').innerHTML = ""; //$('org-list-count').insert("("+json.nodeset[0].totalno+")"); //$('orgbuttons').innerHTML = ""; var total = json.nodeset[0].totalno; if (CURRENT_VIZ == 'list') { var currentPage = (json.nodeset[0].start/args["max"]) + 1; window.location.hash = CURRENT_TAB+"-"+CURRENT_VIZ+"-"+currentPage; } var navbar = createNav(total,json.nodeset[0].start,json.nodeset[0].count,args,context,"orgs") $("tab-content-org-list").update(navbar); //display nodes if(json.nodeset[0].nodes.length > 0){ //preprosses nodes to add searchid if it is there if (args['searchid'] && args['searchid'] != "") { var nodes = json.nodeset[0].nodes; var count = nodes.length; for (var i=0; i < count; i++) { var node = nodes[i]; node.cnode.searchid = args['searchid']; } } var tb3 = new Element("div", {'class':'toolbarrow row'}); var sortOpts = {date: 'Creation Date', name: 'Title', moddate: 'Modification Date',connectedness:'Connections'}; tb3.insert(displaySortForm(sortOpts,args,'org',reorderOrgs)); tb3.insert(createThemeFilter(context, args, 'orgs')); tb3.insert(createConnectedFilter(context, args, 'orgs')); $("tab-content-org-list").insert(tb3); displayNodes($("tab-content-org-list"),json.nodeset[0].nodes,parseInt(args['start'])+1, true); } else { var tb3 = new Element("div", {'class':'toolbarrow row'}); tb3.insert(createThemeFilter(context, args, 'orgs')); tb3.insert(createConnectedFilter(context, args, 'orgs')); $("tab-content-org-list").insert(tb3); } //display nav if (total > parseInt( args["max"] )) { $("tab-content-org-list").insert(createNav(total,json.nodeset[0].start,json.nodeset[0].count,args,context,"orgs")); } } }); DATA_LOADED.org = true; DATA_LOADED.orgsimile = false; } /** * load next/previous set of project nodes */ function loadprojects(context,args){ var types = "Project"; if (args['filternodetypes'] == "" || types.indexOf(args['filternodetypes']) == -1) { args['filternodetypes'] = types; } updateAddressParameters(args); $("tab-content-project-list").update(getLoading("(Loading Projects...)")); var reqUrl = SERVICE_ROOT + "&method=getnodesby" + context + "&" + Object.toQueryString(args); new Ajax.Request(reqUrl, { method:'get', onSuccess: function(transport){ try { var json = transport.responseText.evalJSON(); } catch(err) { console.log(err); } if(json.error){ alert(json.error[0].message); return; } //set the count in tab header //$('project-list-count').innerHTML = ""; //$('project-list-count').insert("("+json.nodeset[0].totalno+")"); //$('orgbuttons').innerHTML = ""; var total = json.nodeset[0].totalno; if (CURRENT_VIZ == 'list') { var currentPage = (json.nodeset[0].start/args["max"]) + 1; window.location.hash = CURRENT_TAB+"-"+CURRENT_VIZ+"-"+currentPage; } var navbar = createNav(total,json.nodeset[0].start,json.nodeset[0].count,args,context,"projects") $("tab-content-project-list").update(navbar); //display nodes if(json.nodeset[0].nodes.length > 0){ //preprosses nodes to add searchid if it is there if (args['searchid'] && args['searchid'] != "") { var nodes = json.nodeset[0].nodes; var count = nodes.length; for (var i=0; i < count; i++) { var node = nodes[i]; node.cnode.searchid = args['searchid']; } } var tb3 = new Element("div", {'class':'toolbarrow row'}); var sortOpts = {date: 'Creation Date', name: 'Title', moddate: 'Modification Date',connectedness:'Connections'}; tb3.insert(displaySortForm(sortOpts,args,'project',reorderProjects)); tb3.insert(createThemeFilter(context, args, 'projects')); tb3.insert(createConnectedFilter(context, args, 'projects')); $("tab-content-project-list").insert(tb3); displayNodes($("tab-content-project-list"),json.nodeset[0].nodes,parseInt(args['start'])+1, true); } else { var tb3 = new Element("div", {'class':'toolbarrow row'}); tb3.insert(createThemeFilter(context, args, 'projects')); tb3.insert(createConnectedFilter(context, args, 'projects')); $("tab-content-project-list").insert(tb3); } //display nav if (total > parseInt( args["max"] )) { $("tab-content-org-list").insert(createNav(total,json.nodeset[0].start,json.nodeset[0].count,args,context,"projects")); } } }); DATA_LOADED.project = true; } /** * load next/previous set of nodes */ function loadissues(context,args){ args['filternodetypes'] = "Issue"; updateAddressParameters(args); $("tab-content-issue-list").update(getLoading("(Loading Issues...)")); var reqUrl = SERVICE_ROOT + "&method=getnodesby" + context + "&" + Object.toQueryString(args); new Ajax.Request(reqUrl, { method:'get', onSuccess: function(transport){ try { var json = transport.responseText.evalJSON(); } catch(err) { console.log(err); } if(json.error){ alert(json.error[0].message); return; } //set the count in tab header //$('issue-list-count').innerHTML = ""; //$('issue-list-count').insert("("+json.nodeset[0].totalno+")"); //$('issuebuttons').innerHTML = ""; //display nav var total = json.nodeset[0].totalno; if (CURRENT_VIZ == 'list') { var currentPage = (json.nodeset[0].start/args["max"]) + 1; window.location.hash = CURRENT_TAB+"-"+CURRENT_VIZ+"-"+currentPage; } $("tab-content-issue-list").update(createNav(total,json.nodeset[0].start,json.nodeset[0].count,args,context,"issues")); //display nodes if(json.nodeset[0].nodes.length > 0){ //preprosses nodes to add searchid if it is there if (args['searchid'] && args['searchid'] != "") { var nodes = json.nodeset[0].nodes; var count = nodes.length; for (var i=0; i < count; i++) { var node = nodes[i]; node.cnode.searchid = args['searchid']; } } var tb3 = new Element("div", {'class':'toolbarrow row'}); var sortOpts = {date: 'Creation Date', name: 'Title', moddate: 'Modification Date',connectedness:'Connections', vote:'Votes'}; tb3.insert(displaySortForm(sortOpts,args,'issue',reorderIssues)); tb3.insert(createThemeFilter(context, args, 'issues')); tb3.insert(createConnectedFilter(context, args, 'issues')); $("tab-content-issue-list").insert(tb3); displayNodes($("tab-content-issue-list"),json.nodeset[0].nodes,parseInt(args['start'])+1, true); } else { var tb3 = new Element("div", {'class':'toolbarrow row'}); tb3.insert(createThemeFilter(context, args, 'issues')); tb3.insert(createConnectedFilter(context, args, 'issues')); $("tab-content-issue-list").insert(tb3); } //display nav if (total > parseInt( args["max"] )) { $("tab-content-issue-list").insert(createNav(total,json.nodeset[0].start,json.nodeset[0].count,args,context,"issues")); } } }); DATA_LOADED.issue = true; DATA_LOADED.issuesimile = false; } /** * load next/previous set of nodes */ function loadsolutions(context,args){ args['filternodetypes'] = "Solution"; updateAddressParameters(args); $("tab-content-solution-list").update(getLoading("(Loading Ideas...)")); var reqUrl = SERVICE_ROOT + "&method=getnodesby" + context + "&" + Object.toQueryString(args); new Ajax.Request(reqUrl, { method:'get', onSuccess: function(transport){ try { var json = transport.responseText.evalJSON(); } catch(err) { console.log(err); } if(json.error){ alert(json.error[0].message); return; } //set the count in tab header //$('solution-list-count').innerHTML = ""; //$('solution-list-count').insert("("+json.nodeset[0].totalno+")"); //$('solutionbuttons').innerHTML = ""; //display nav var total = json.nodeset[0].totalno; if (CURRENT_VIZ == 'list') { var currentPage = (json.nodeset[0].start/args["max"]) + 1; window.location.hash = CURRENT_TAB+"-"+CURRENT_VIZ+"-"+currentPage; } $("tab-content-solution-list").update(createNav(total,json.nodeset[0].start,json.nodeset[0].count,args,context,"solutions")); if(json.nodeset[0].nodes.length > 0){ //preprosses nodes to add searchid if it is there if (args['searchid'] && args['searchid'] != "") { var nodes = json.nodeset[0].nodes; var count = nodes.length; for (var i=0; i < count; i++) { var node = nodes[i]; node.cnode.searchid = args['searchid']; } } var tb3 = new Element("div", {'class':'toolbarrow row'}); var sortOpts = {date: 'Creation Date', name: 'Title', moddate: 'Modification Date',connectedness:'Connections', vote:'Votes'}; tb3.insert(displaySortForm(sortOpts,args,'solution',reorderSolutions)); tb3.insert(createThemeFilter(context, args, 'solutions')); tb3.insert(createConnectedFilter(context, args, 'solutions')); $("tab-content-solution-list").insert(tb3); displayNodes($("tab-content-solution-list"),json.nodeset[0].nodes,parseInt(args['start'])+1, true); } else { var tb3 = new Element("div", {'class':'toolbarrow row'}); tb3.insert(createThemeFilter(context, args, 'solutions')); tb3.insert(createConnectedFilter(context, args, 'solutions')); $("tab-content-solution-list").insert(tb3); } //display nav if (total > parseInt( args["max"] )) { $("tab-content-solution-list").insert(createNav(total,json.nodeset[0].start,json.nodeset[0].count,args,context,"solutions")); } } }); DATA_LOADED.solution = true; DATA_LOADED.solutionsimile = false; } /** * load next/previous set of nodes */ function loadclaims(context,args){ args['filternodetypes'] = "Claim"; updateAddressParameters(args); $("tab-content-claim-list").update(getLoading("(Loading Facts...)")); var reqUrl = SERVICE_ROOT + "&method=getnodesby" + context + "&" + Object.toQueryString(args); new Ajax.Request(reqUrl, { method:'get', onSuccess: function(transport){ try { var json = transport.responseText.evalJSON(); } catch(err) { console.log(err); } if(json.error){ alert(json.error[0].message); return; } //set the count in tab header //$('claim-list-count').innerHTML = ""; //$('claim-list-count').insert("("+json.nodeset[0].totalno+")"); //$('claimbuttons').innerHTML = ""; //display nav var total = json.nodeset[0].totalno; if (CURRENT_VIZ == 'list') { var currentPage = (json.nodeset[0].start/args["max"]) + 1; window.location.hash = CURRENT_TAB+"-"+CURRENT_VIZ+"-"+currentPage; } $("tab-content-claim-list").update(createNav(total,json.nodeset[0].start,json.nodeset[0].count,args,context,"claims")); if(json.nodeset[0].nodes.length > 0){ //preprosses nodes to add searchid if it is there if (args['searchid'] && args['searchid'] != "") { var nodes = json.nodeset[0].nodes; var count = nodes.length; for (var i=0; i < count; i++) { var node = nodes[i]; node.cnode.searchid = args['searchid']; } } var tb3 = new Element("div", {'class':'toolbarrow row'}); var sortOpts = {date: 'Creation Date', name: 'Title', moddate: 'Modification Date',connectedness:'Connections', vote:'Votes'}; tb3.insert(displaySortForm(sortOpts,args,'claim',reorderClaims)); tb3.insert(createThemeFilter(context, args, 'claims')); tb3.insert(createConnectedFilter(context, args, 'claims')); $("tab-content-claim-list").insert(tb3); displayNodes($("tab-content-claim-list"),json.nodeset[0].nodes,parseInt(args['start'])+1, true); } else { var tb3 = new Element("div", {'class':'toolbarrow row'}); tb3.insert(createThemeFilter(context, args, 'claims')); tb3.insert(createConnectedFilter(context, args, 'claims')); $("tab-content-claim-list").insert(tb3); } //display nav if (total > parseInt( args["max"] )) { $("tab-content-claim-list").insert(createNav(total,json.nodeset[0].start,json.nodeset[0].count,args,context,"claims")); } } }); DATA_LOADED.claim = true; DATA_LOADED.claimsimile = false; } /** * load next/previous set of evidence nodes */ function loadevidence(context,args) { var types = EVIDENCE_TYPES_STR; if (args['filternodetypes'] == "" || types.indexOf(args['filternodetypes']) == -1) { args['filternodetypes'] = types; } updateAddressParameters(args); $("tab-content-evidence-list").update(getLoading("(Loading Arguments...)")); var reqUrl = SERVICE_ROOT + "&method=getnodesby" + context + "&" + Object.toQueryString(args); new Ajax.Request(reqUrl, { method:'get', onSuccess: function(transport){ try { var json = transport.responseText.evalJSON(); } catch(err) { console.log(err); } if(json.error){ alert(json.error[0].message); return; } //set the count in tab header //$('evidence-list-count').innerHTML = ""; //$('evidence-list-count').insert("("+json.nodeset[0].totalno+")"); //$('evidencebuttons').innerHTML = ""; //display nav var total = json.nodeset[0].totalno; if (CURRENT_VIZ == 'list') { var currentPage = (json.nodeset[0].start/args["max"]) + 1; window.location.hash = CURRENT_TAB+"-"+CURRENT_VIZ+"-"+currentPage; } $("tab-content-evidence-list").update(createNav(total,json.nodeset[0].start,json.nodeset[0].count,args,context,"evidence")); if(json.nodeset[0].nodes.length > 0){ //preprosses nodes to add searchid if it is there if (args['searchid'] && args['searchid'] != "") { var nodes = json.nodeset[0].nodes; var count = nodes.length; for (var i=0; i < count; i++) { var node = nodes[i]; node.cnode.searchid = args['searchid']; } } var tb3 = new Element("div", {'class':'toolbarrow row'}); var sortOpts = {date: 'Creation Date', name: 'Title', moddate: 'Modification Date',connectedness:'Connections', vote:'Votes'}; tb3.insert(displaySortForm(sortOpts,args,'evidence',reorderEvidence)); tb3.insert(createThemeFilter(context, args, 'evidence')); tb3.insert(createEvidenceFilter(context, args)); tb3.insert(createConnectedFilter(context, args, 'evidence')); $("tab-content-evidence-list").insert(tb3); displayNodes($("tab-content-evidence-list"),json.nodeset[0].nodes,parseInt(args['start'])+1, true); } else { // in case caused by filter. var tb3 = new Element("div", {'class':'toolbarrow row'}); tb3.insert(createThemeFilter(context, args, 'evidence')); tb3.insert(createEvidenceFilter(context, args)); tb3.insert(createConnectedFilter(context, args, 'evidence')); $("tab-content-evidence-list").insert(tb3); } //display nav if (total > parseInt( args["max"] )) { $("tab-content-evidence-list").insert(createNav(total,json.nodeset[0].start,json.nodeset[0].count,args,context,"evidence")); } } }); DATA_LOADED.evidence = true; DATA_LOADED.evidencesimile = false; } /** * load next/previous set of urls */ function loadurls(context,args){ var types = RESOURCE_TYPES_STR; if (args['filternodetypes'] == "" || types.indexOf(args['filternodetypes']) == -1) { args['filternodetypes'] = types; } updateAddressParameters(args); $("tab-content-web-list").update(getLoading("(Loading Resources...)")); var reqUrl = SERVICE_ROOT + "&method=getnodesby" + context + "&" + Object.toQueryString(args); new Ajax.Request(reqUrl, { method:'get', onSuccess: function(transport){ var json = transport.responseText.evalJSON(); if(json.error){ alert(json.error[0].message); return; } //set the count in tab header //$('web-list-count').innerHTML = ""; //$('web-list-count').insert("("+json.nodeset[0].totalno+")"); //$('webbuttons').innerHTML = ""; //display nav var total = json.nodeset[0].totalno; if (CURRENT_VIZ == 'list') { var currentPage = (json.nodeset[0].start/args["max"]) + 1; window.location.hash = CURRENT_TAB+"-"+CURRENT_VIZ+"-"+currentPage; } $("tab-content-web-list").update(createNav(total,json.nodeset[0].start,json.nodeset[0].count,args,context,"urls")); $("tab-content-web-list").insert('
'); if(total > 0){ //preprosses nodes to add searchid if it is there if (args['searchid'] && args['searchid'] != "") { var nodes = json.nodeset[0].nodes; var count = nodes.length; for (var i=0; i < count; i++) { var node = nodes[i]; node.cnode.searchid = args['searchid']; } } var tb2 = new Element("div", {'class':'toolbarrow row'}); var sortOpts = {date: 'Creation Date', name: 'Title', moddate: 'Modification Date',connectedness:'Connections'}; tb2.insert(displaySortForm(sortOpts,args,'urls',reorderURLs)); tb2.insert(createThemeFilter(context, args, 'web')); tb2.insert(createResourceFilter(context, args)); tb2.insert(createConnectedFilter(context, args, 'web')); $("tab-content-web-list").insert(tb2); displayNodes($("tab-content-web-list"),json.nodeset[0].nodes,parseInt(args['start'])+1, true); } else { // in case caused by filter. var tb2 = new Element("div", {'class':'toolbarrow row'}); tb2.insert(createThemeFilter(context, args, 'web')); tb2.insert(createResourceFilter(context, args)); tb2.insert(createConnectedFilter(context, args, 'web')); $("tab-content-web-list").insert(tb2); } //display nav if (total > parseInt( args["max"] )) { $("tab-content-web-list").insert(createNav(total,json.nodeset[0].start,json.nodeset[0].count,args,context,"urls")); } } }); DATA_LOADED.url = true; } /** * load next/previous set of users */ function loadusers(context,args){ updateAddressParameters(args); $("tab-content-user-list").update(getLoading("(Loading Users...)")); var reqUrl = SERVICE_ROOT + "&method=getusersby" + context + "&includegroups=false&" + Object.toQueryString(args); new Ajax.Request(reqUrl, { method:'get', onError: function(error) { alert(error); }, onSuccess: function(transport){ var json = transport.responseText.evalJSON(); if(json.error){ alert(json.error[0].message); return; } //set the count in tab header //$('user-list-count').innerHTML = ""; //$('user-list-count').insert("("+json.userset[0].totalno+")"); $("tab-content-user-list").innerHTML = ""; var tb1 = new Element("div", {'class':'toolbarrow row'}); $("tab-content-user-list").insert(tb1); //display nav var total = json.userset[0].totalno; if (CURRENT_VIZ == 'list') { var currentPage = (json.userset[0].start/args["max"]) + 1; window.location.hash = CURRENT_TAB+"-"+CURRENT_VIZ+"-"+currentPage; } $("tab-content-user-list").update(createNav(total,json.userset[0].start,json.userset[0].count,args,context,"users")); $("tab-content-user-list").insert('
'); if(json.userset[0].count > 0){ //preprosses nodes to add searchid if it is there if (args['searchid'] && args['searchid'] != "") { var users = json.userset[0].users; var count = users.length; for (var i=0; i < count; i++) { var user = users[i].user; user.searchid = args['searchid']; } } var tb2 = new Element("div", {'class':'toolbarrow row'}); var sortOpts = {lastactive: 'Last Active', name: 'Name', date: 'Date Joined'}; tb2.insert(displaySortForm(sortOpts,args,'user',reorderUsers)); $("tab-content-user-list").insert(tb2); $("tab-content-user-list").insert("

"); displayUsers($("tab-content-user-list"),json.userset[0].users,parseInt(args['start'])+1); } //display nav if (total > parseInt( args["max"] )) { $("tab-content-user-list").insert(createNav(total,json.userset[0].start,json.userset[0].count,args,context,"users")); } } }); DATA_LOADED.user = true; } /** * load next/previous set of comment nodes */ function loadcomments(context,args) { var types = 'Idea'; if (args['filternodetypes'] == "" || types.indexOf(args['filternodetypes']) == -1) { args['filternodetypes'] = types; } updateAddressParameters(args); $("tab-content-comment-list").update(getLoading("(Loading Open Comments...)")); var reqUrl = SERVICE_ROOT + "&method=getconnectednodesby" + context + "&" + Object.toQueryString(args); //alert(reqUrl); new Ajax.Request(reqUrl, { method:'post', onSuccess: function(transport){ try { var json = transport.responseText.evalJSON(); } catch(err) { console.log(err); } if(json.error){ alert(json.error[0].message); return; } var count = 0; if (json.nodeset[0].totalno) { count = json.nodeset[0].totalno; } //set the count in tab header //if ($('comment-list-count')) { // $('comment-list-count').innerHTML = ""; // $('comment-list-count').insert("("+count+")"); //} var nodes = json.nodeset[0].nodes; //display nav var total = json.nodeset[0].totalno; if (CURRENT_VIZ == 'list') { var currentPage = (json.nodeset[0].start/args["max"]) + 1; window.location.hash = CURRENT_TAB+"-"+CURRENT_VIZ+"-"+currentPage; } $("tab-content-comment-list").update(createNav(total,json.nodeset[0].start,json.nodeset[0].count,args,context,"comments")); if(nodes.length > 0){ //preprosses nodes to add searchid if it is there if (args['searchid'] && args['searchid'] != "") { var count = nodes.length; for (var i=0; i < count; i++) { var node = nodes[i]; node.cnode.searchid = args['searchid']; } } var tb3 = new Element("div", {'class':'toolbarrow row'}); var sortOpts = {date: 'Creation Date', name: 'Title'}; tb3.insert(displaySortForm(sortOpts,args,'comment',reorderComments)); var filter = createCommentFilter(context, args); tb3.insert(filter); $("tab-content-comment-list").insert(tb3); displayNodes($("tab-content-comment-list"),nodes,parseInt(args['start'])+1, true); } else { var tb3 = new Element("div", {'class':'toolbarrow row'}); var filter = createCommentFilter(context, args); tb3.insert(filter); $("tab-content-comment-list").insert(tb3); } //display nav if (total > parseInt( args["max"] )) { $("tab-content-comment-list").insert(createNav(total,json.nodeset[0].start,json.nodeset[0].count,args,context,"comments")); } } }); DATA_LOADED.commentlist = true; } /** * load next/previous set of news nodes */ function loadnews(context,args) { var types = 'News'; args['filternodetypes'] = types; updateAddressParameters(args); $("tab-content-news-list").update(getLoading("(Loading News article...)")); var reqUrl = SERVICE_ROOT + "&method=getnodesby" + context + "&" + Object.toQueryString(args); //alert(reqUrl); new Ajax.Request(reqUrl, { method:'post', onSuccess: function(transport){ try { var json = transport.responseText.evalJSON(); } catch(err) { console.log(err); } if(json.error){ alert(json.error[0].message); return; } var count = 0; if (json.nodeset[0].totalno) { count = json.nodeset[0].totalno; } var nodes = json.nodeset[0].nodes; //display nav var total = json.nodeset[0].totalno; if (CURRENT_VIZ == 'list') { var currentPage = (json.nodeset[0].start/args["max"]) + 1; window.location.hash = CURRENT_TAB+"-"+CURRENT_VIZ+"-"+currentPage; } $("tab-content-news-list").update(createNav(total,json.nodeset[0].start,json.nodeset[0].count,args,context,"comments")); if(nodes.length > 0){ //preprosses nodes to add searchid if it is there if (args['searchid'] && args['searchid'] != "") { var count = nodes.length; for (var i=0; i < count; i++) { var node = nodes[i]; node.cnode.searchid = args['searchid']; } } var tb3 = new Element("div", {'class':'toolbarrow row'}); var sortOpts = {date: 'Creation Date', name: 'Title'}; tb3.insert(displaySortForm(sortOpts,args,'news',reorderNews)); $("tab-content-news-list").insert(tb3); displayNewsNodes($("tab-content-news-list"),nodes); } //display nav if (total > parseInt( args["max"] )) { $("tab-content-news-list").insert(createNav(total,json.nodeset[0].start,json.nodeset[0].count,args,context,"news")); } } }); DATA_LOADED.newslist = true; } /** * Reorder the challenge tab */ function reorderChallenges(){ // change the sort and orderby ARG values CHALLENGE_ARGS['start'] = 0; CHALLENGE_ARGS['sort'] = $('select-sort-challenge').options[$('select-sort-challenge').selectedIndex].value; CHALLENGE_ARGS['orderby'] = $('select-orderby-challenge').options[$('select-orderby-challenge').selectedIndex].value; loadchallenges(CONTEXT,CHALLENGE_ARGS); } /** * Reorder the org tab */ function reorderOrgs(){ // change the sort and orderby ARG values ORG_ARGS['start'] = 0; ORG_ARGS['sort'] = $('select-sort-org').options[$('select-sort-org').selectedIndex].value; ORG_ARGS['orderby'] = $('select-orderby-org').options[$('select-orderby-org').selectedIndex].value; loadorgs(CONTEXT,ORG_ARGS); } /** * Reorder the projects tab */ function reorderProjects(){ // change the sort and orderby ARG values PROJECT_ARGS['start'] = 0; PROJECT_ARGS['sort'] = $('select-sort-project').options[$('select-sort-project').selectedIndex].value; PROJECT_ARGS['orderby'] = $('select-orderby-project').options[$('select-orderby-project').selectedIndex].value; loadprojects(CONTEXT,PROJECT_ARGS); } /** * Reorder the issue tab */ function reorderIssues(){ // change the sort and orderby ARG values ISSUE_ARGS['start'] = 0; ISSUE_ARGS['sort'] = $('select-sort-issue').options[$('select-sort-issue').selectedIndex].value; ISSUE_ARGS['orderby'] = $('select-orderby-issue').options[$('select-orderby-issue').selectedIndex].value; loadissues(CONTEXT,ISSUE_ARGS); } /** * Reorder the solutions tab */ function reorderSolutions(){ // change the sort and orderby ARG values SOLUTION_ARGS['start'] = 0; SOLUTION_ARGS['sort'] = $('select-sort-solution').options[$('select-sort-solution').selectedIndex].value; SOLUTION_ARGS['orderby'] = $('select-orderby-solution').options[$('select-orderby-solution').selectedIndex].value; loadsolutions(CONTEXT,SOLUTION_ARGS); } /** * Reorder the claims tab */ function reorderClaims(){ // change the sort and orderby ARG values CLAIM_ARGS['start'] = 0; CLAIM_ARGS['sort'] = $('select-sort-claim').options[$('select-sort-claim').selectedIndex].value; CLAIM_ARGS['orderby'] = $('select-orderby-claim').options[$('select-orderby-claim').selectedIndex].value; loadclaims(CONTEXT,CLAIM_ARGS); } /** * Reorder the evidence tab */ function reorderEvidence(){ // change the sort and orderby ARG values EVIDENCE_ARGS['start'] = 0; EVIDENCE_ARGS['sort'] = $('select-sort-evidence').options[$('select-sort-evidence').selectedIndex].value; EVIDENCE_ARGS['orderby'] = $('select-orderby-evidence').options[$('select-orderby-evidence').selectedIndex].value; loadevidence(CONTEXT,EVIDENCE_ARGS); } /** * Reorder the urls tab */ function reorderURLs(){ // change the sort and orderby ARG values URL_ARGS['start'] = 0; URL_ARGS['sort'] = $('select-sort-urls').options[$('select-sort-urls').selectedIndex].value; URL_ARGS['orderby'] = $('select-orderby-urls').options[$('select-orderby-urls').selectedIndex].value; loadurls(CONTEXT,URL_ARGS); } /** * Reorder the users tab */ function reorderUsers(){ // change the sort and orderby ARG values USER_ARGS['start'] = 0; USER_ARGS['sort'] = $('select-sort-user').options[$('select-sort-user').selectedIndex].value; USER_ARGS['orderby'] = $('select-orderby-user').options[$('select-orderby-user').selectedIndex].value; loadusers(CONTEXT,USER_ARGS); } /** * Reorder the comments tab */ function reorderComments(){ // change the sort and orderby ARG values COMMENT_ARGS['start'] = 0; COMMENT_ARGS['sort'] = $('select-sort-comment').options[$('select-sort-comment').selectedIndex].value; COMMENT_ARGS['orderby'] = $('select-orderby-comment').options[$('select-orderby-comment').selectedIndex].value; loadcomments(CONTEXT,COMMENT_ARGS); } /** * Reorder the news tab */ function reorderNews(){ // change the sort and orderby ARG values NEWS_ARGS['start'] = 0; NEWS_ARGS['sort'] = $('select-sort-news').options[$('select-sort-news').selectedIndex].value; NEWS_ARGS['orderby'] = $('select-orderby-news').options[$('select-orderby-news').selectedIndex].value; loadnews(CONTEXT,NEWS_ARGS); } /** * Filter the challenges by search criteria */ function filterSearchChallenges() { CHALLENGE_ARGS['q'] = $('qchallenge').value; var scope = 'all'; if ($('scopechallengemy') && $('scopechallengemy').selected) { scope = 'my'; } CHALLENGE_ARGS['scope'] = scope; var reqUrl = SERVICE_ROOT + "&method=auditsearch&type=challenge&format=text&q="+CHALLENGE_ARGS['q']; new Ajax.Request(reqUrl, { method:'get', onError: function(error) { alert(error); }, onSuccess: function(transport){ /*var json = transport.responseText.evalJSON(); if(json.error){ alert(json.error[0].message); return; }*/ alert(transport.responseText); DATA_LOADED.challenge = false; setTabPushed($('tab-challenge-list-obj'),'challenge-list'); } }); } /** * Filter the orgs by search criteria */ function filterSearchOrgs() { ORG_ARGS['q'] = $('qorg').value; var scope = 'all'; if ($('scopeorgmy') && $('scopeorgmy').selected) { scope = 'my'; } ORG_ARGS['scope'] = scope; if (USER != "") { var reqUrl = SERVICE_ROOT + "&method=auditsearch&type=org&format=text&q="+ORG_ARGS['q']; new Ajax.Request(reqUrl, { method:'get', onError: function(error) { alert(error); }, onSuccess: function(transport){ var searchid = transport.responseText; if (searchid != "") { ORG_ARGS['searchid'] = searchid; } var currentLocation = getAnchorVal(); if (currentLocation == "org-gmap") { DATA_LOADED.orggmap = false; setTabPushed($('tab-org-list-obj'),'org-gmap'); } else { DATA_LOADED.org = false; setTabPushed($('tab-org-list-obj'),'org-list'); } } }); } else { var currentLocation = getAnchorVal(); if (currentLocation == "org-gmap") { DATA_LOADED.orggmap = false; setTabPushed($('tab-org-list-obj'),'org-gmap'); } else { DATA_LOADED.org = false; setTabPushed($('tab-org-list-obj'),'org-list'); } } } /** * Filter the project by search criteria */ function filterSearchProjects() { PROJECT_ARGS['q'] = $('qproject').value; var scope = 'all'; if ($('scopeprojectmy') && $('scopeprojectmy').selected) { scope = 'my'; } PROJECT_ARGS['scope'] = scope; if (USER != "") { var reqUrl = SERVICE_ROOT + "&method=auditsearch&type=project&format=text&q="+PROJECT_ARGS['q']; new Ajax.Request(reqUrl, { method:'get', onError: function(error) { alert(error); }, onSuccess: function(transport){ var searchid = transport.responseText; if (searchid != "") { PROJECT_ARGS['searchid'] = searchid; } var currentLocation = getAnchorVal(); if (currentLocation == "project-gmap") { DATA_LOADED.projectgmap = false; setTabPushed($('tab-project-list-obj'),'project-gmap'); } else { DATA_LOADED.project = false; setTabPushed($('tab-project-list-obj'),'project-list'); } } }); } else { var currentLocation = getAnchorVal(); if (currentLocation == "project-gmap") { DATA_LOADED.projectgmap = false; setTabPushed($('tab-project-list-obj'),'project-gmap'); } else { DATA_LOADED.project = false; setTabPushed($('tab-project-list-obj'),'project-list'); } } } /** * Filter the issues by search criteria */ function filterSearchIssues() { ISSUE_ARGS['q'] = $('qissue').value; var scope = 'all'; if ($('scopeissuemy') && $('scopeissuemy').selected) { scope = 'my'; } ISSUE_ARGS['scope'] = scope; if (USER != "") { var reqUrl = SERVICE_ROOT + "&method=auditsearch&type=issue&format=text&q="+ISSUE_ARGS['q']; new Ajax.Request(reqUrl, { method:'get', onError: function(error) { alert(error); }, onSuccess: function(transport){ var searchid = transport.responseText; if (searchid != "") { ISSUE_ARGS['searchid'] = searchid; } DATA_LOADED.issue = false; setTabPushed($('tab-issue-list-obj'),'issue-list'); } }); } else { DATA_LOADED.issue = false; setTabPushed($('tab-issue-list-obj'),'issue-list'); } } /** * Filter the solutions by search criteria */ function filterSearchSolutions() { SOLUTION_ARGS['q'] = $('qsolution').value; var scope = 'all'; if ($('scopesolutionmy') && $('scopesolutionmy').selected) { scope = 'my'; } SOLUTION_ARGS['scope'] = scope; if (USER != "") { var reqUrl = SERVICE_ROOT + "&method=auditsearch&type=solution&format=text&q="+SOLUTION_ARGS['q']; new Ajax.Request(reqUrl, { method:'get', onError: function(error) { alert(error); }, onSuccess: function(transport){ var searchid = transport.responseText; if (searchid != "") { SOLUTION_ARGS['searchid'] = searchid; } DATA_LOADED.solution = false; setTabPushed($('tab-solution-list-obj'),'solution-list'); } }); } else { DATA_LOADED.solution = false; setTabPushed($('tab-solution-list-obj'),'solution-list'); } } /** * Filter the claims by search criteria */ function filterSearchClaims() { CLAIM_ARGS['q'] = $('qclaim').value; var scope = 'all'; if ($('scopeclaimmy') && $('scopeclaimmy').selected) { scope = 'my'; } CLAIM_ARGS['scope'] = scope; if (USER != "") { var reqUrl = SERVICE_ROOT + "&method=auditsearch&type=claim&format=text&q="+CLAIM_ARGS['q']; new Ajax.Request(reqUrl, { method:'get', onError: function(error) { alert(error); }, onSuccess: function(transport){ var searchid = transport.responseText; if (searchid != "") { CLAIM_ARGS['searchid'] = searchid; } DATA_LOADED.claim = false; setTabPushed($('tab-claim-list-obj'),'claim-list'); } }); } else { DATA_LOADED.claim = false; setTabPushed($('tab-claim-list-obj'),'claim-list'); } } /** * Filter the evidence by search criteria */ function filterSearchEvidence() { EVIDENCE_ARGS['q'] = $('qevidence').value; var scope = 'all'; if ($('scopeevidencemy') && $('scopeevidencemy').selected) { scope = 'my'; } if (SELECTED_NODETYPES != "") { NODE_ARGS['filternodetypes'] = SELECTED_NODETYPES; } EVIDENCE_ARGS['scope'] = scope; if (USER != "") { var reqUrl = SERVICE_ROOT + "&method=auditsearch&type=evidence&format=text&q="+EVIDENCE_ARGS['q']; new Ajax.Request(reqUrl, { method:'get', onError: function(error) { alert(error); }, onSuccess: function(transport){ var searchid = transport.responseText; if (searchid != "") { EVIDENCE_ARGS['searchid'] = searchid; } DATA_LOADED.evidence = false; setTabPushed($('tab-evidence-list-obj'),'evidence-list'); } }); } else { DATA_LOADED.evidence = false; setTabPushed($('tab-evidence-list-obj'),'evidence-list'); } } /** * Filter the websites by search criteria */ function filterSearchWebsites() { URL_ARGS['q'] = $('qweb').value; var scope = 'all'; if ($('scopewebmy') && $('scopewebmy').selected) { scope = 'my'; } URL_ARGS['scope'] = scope; if (USER != "") { var reqUrl = SERVICE_ROOT + "&method=auditsearch&type=resource&format=text&q="+URL_ARGS['q']; new Ajax.Request(reqUrl, { method:'get', onError: function(error) { alert(error); }, onSuccess: function(transport){ var searchid = transport.responseText; if (searchid != "") { URL_ARGS['searchid'] = searchid; } DATA_LOADED.url = false; setTabPushed($('tab-web-list-obj'),'web-list'); } }); } else { DATA_LOADED.url = false; setTabPushed($('tab-web-list-obj'),'web-list'); } } /** * Filter the users by search criteria */ function filterSearchUsers() { USER_ARGS['q'] = $('quser').value; CURRENT_VIZ = 'list'; var currentLocation = getAnchorVal(); if (USER != "") { var reqUrl = SERVICE_ROOT + "&method=auditsearch&type=user&format=text&q="+USER_ARGS['q']; new Ajax.Request(reqUrl, { method:'get', onError: function(error) { alert(error); }, onSuccess: function(transport){ var searchid = transport.responseText; if (searchid != "") { USER_ARGS['searchid'] = searchid; } if (currentLocation == "user-usergmap") { DATA_LOADED.usergmap = false; setTabPushed($('tab-user-list-obj'),'user-usergmap'); } else { DATA_LOADED.user = false; setTabPushed($('tab-user-list-obj'),'user-list'); } } }); } else { if (currentLocation == "user-usergmap") { DATA_LOADED.usergmap = false; setTabPushed($('tab-user-list-obj'),'user-usergmap'); } else { DATA_LOADED.user = false; setTabPushed($('tab-user-list-obj'),'user-list'); } } } /** * Filter the comments by search criteria */ function filterSearchComments() { COMMENT_ARGS['q'] = $('qcomment').value; CURRENT_VIZ = 'list'; if (USER != "") { var reqUrl = SERVICE_ROOT + "&method=auditsearch&type=comment&format=text&q="+NODE_ARGS['q']; new Ajax.Request(reqUrl, { method:'get', onError: function(error) { alert(error); }, onSuccess: function(transport){ var searchid = transport.responseText; if (searchid != "") { COMMENT_ARGS['searchid'] = searchid; } DATA_LOADED.commentlist = false; setTabPushed($('tab-comment-list-obj'),'comment-list'); } }); } else { DATA_LOADED.commentlist = false; setTabPushed($('tab-comment-list-obj'),'comment-list'); } } /** * Filter the news by search criteria */ function filterSearchNews() { NEWS_ARGS['q'] = $('qnews').value; CURRENT_VIZ = 'list'; if (USER != "") { var reqUrl = SERVICE_ROOT + "&method=auditsearch&type=news&format=text&q="+NODE_ARGS['q']; new Ajax.Request(reqUrl, { method:'get', onError: function(error) { alert(error); }, onSuccess: function(transport){ var searchid = transport.responseText; if (searchid != "") { NEWS_ARGS['searchid'] = searchid; } DATA_LOADED.newslist = false; setTabPushed($('tab-news-list-obj'),'news-list'); } }); } else { DATA_LOADED.newslist = false; setTabPushed($('tab-news-list-obj'),'news-list'); } } /** * Filter the websites tab */ function filterWebsites() { if (SELECTED_USERS != "") { URL_ARGS['filterusers'] = SELECTED_USERS; } DATA_LOADED.url = false; loadurls(CONTEXT,URL_ARGS); } /** * show the sort form */ function displaySortForm(sortOpts,args,tab,handler){ var sbTool = new Element("span", {'class':'sortback toolbar2 col-auto'}); sbTool.insert("Sort by "); var selOrd = new Element("select"); Event.observe(selOrd,'change',handler); selOrd.id = "select-orderby-"+tab; selOrd.className = "toolbar form-select"; selOrd.name = "orderby"; selOrd.setAttribute("aria-label","Sort by"); sbTool.insert(selOrd); for(var key in sortOpts){ var opt = new Element("option"); opt.value=key; opt.insert(sortOpts[key].valueOf()); selOrd.insert(opt); if(args.orderby == key){ opt.selected = true; } } var sortBys = {ASC: 'Ascending', DESC: 'Descending'}; var sortBy = new Element("select"); Event.observe(sortBy,'change',handler); sortBy.id = "select-sort-"+tab; sortBy.className = "toolbar form-select"; sortBy.name = "sort"; sortBy.setAttribute("aria-label","Order by"); sbTool.insert(sortBy); for(var key in sortBys){ var opt = new Element("option"); opt.value=key; opt.insert(sortBys[key]); sortBy.insert(opt); if(args.sort == key){ opt.selected = true; } } return sbTool; } /** * Called by the node type popup after node types have been selected. */ function setSelectedNodeTypes(types) { SELECTED_NODETYPES = types; if ($('select-filter-conn')) { $('select-filter-conn').options[0].selected = true; } else if ($('select-filter-neighbourhood')) { $('select-filter-neighbourhood').options[0].selected = true; } else if ($('nodetypegroups')) { ($('nodetypegroups')).options[0].selected = true; } } /** * Called by the link type popup after link types have been selected. */ function setSelectedLinkTypes(types) { SELECTED_LINKTYES = types; if ($('select-filter-conn')) { $('select-filter-conn').options[0].selected = true; } else if ($('select-filter-neighbourhood')) { $('select-filter-neighbourhood').options[0].selected = true; } else if ($('linktypegroups')) { ($('linktypegroups')).options[0].selected = true; } } /** * Called by the users popup after users have been selected. */ function setSelectedUsers(types) { SELECTED_USERS = types; } function createOrgFilter(context, args) { var sbTool = new Element("span", {'class':'toolbar2 col-auto'}); sbTool.insert("Filter by "); var filterMenu= new Element("select", {'class':'subforminput hgrselecthgrselect toolbar form-select'}); filterMenu.setAttribute("aria-label","Filter by"); var option = new Element("option", {'value':''}); option.insert('All Types'); filterMenu.insert(option); var option = new Element("option", {'value':'Organization'}); if (args['filternodetypes'] == "Organization") { option.selected = true; } option.insert("Organization"); filterMenu.insert(option); var option2 = new Element("option", {'value':'Project'}); if (args['filternodetypes'] == "Project") { option2.selected = true; } option2.insert("Project"); filterMenu.insert(option2); Event.observe(filterMenu,"change", function(){ switch(CURRENT_VIZ){ case 'net': if (args['filterthemes'] && args['filterthemes'] != "") { var linktype = this.value; args['filternodetypes'] = linktype; refreshOrganizations(); } else { alert('Please also select a Theme'); break; } default : var linktype = this.value; args['filternodetypes'] = linktype; refreshOrganizations(); break; } }); sbTool.insert(filterMenu); return sbTool; } function createThemeFilter(context, args, type) { var sbTool = new Element("span", {'class':'toolbar2 col-auto'}); sbTool.insert("Filter by "); var filterMenu= new Element("select", {'class':'subforminput hgrselecthgrselect toolbar form-select'}); filterMenu.setAttribute("aria-label","Filter by"); var option = new Element("option", {'value':''}); option.insert('All Themes'); filterMenu.insert(option); for(var i=0; i < THEMES.length; i++){ var option = new Element("option", {'value':THEMES[i]}); if (args['filterthemes'] && args['filterthemes'] == THEMES[i]) { option.selected = true; } option.insert(THEMES[i]); filterMenu.insert(option); } Event.observe(filterMenu,"change", function(){ var theme = this.value; args['filterthemes'] = theme; if( type == 'orgs') { refreshOrganizations(); } else if (type == 'projects') { refreshProjects(); } else if (type == 'claims') { refreshClaims(); } else if (type == 'evidence') { refreshEvidence(); } else if (type == 'issues') { refreshIssues(); } else if (type == 'solutions') { refreshSolutions(); } else if (type == 'web') { refreshWebsites(); } else if (type == 'challenges') { refreshChallenges(); } else if (type == 'user') { refreshUsers(); } }); sbTool.insert(filterMenu); return sbTool; } function createThemeFilterNet(context, args, type) { var sbTool = new Element("span", {'class':'toolbar2 col-auto'}); sbTool.insert("Theme: "); var filterMenu= new Element("select", {'class':'subforminput hgrselecthgrselect toolbar form-select'}); filterMenu.setAttribute("aria-label","Filter by"); var option = new Element("option", {'value':''}); option.insert('Please also select a Theme'); filterMenu.insert(option); for(var i=0; i < THEMES.length; i++){ var option = new Element("option", {'value':THEMES[i]}); if (args['filterthemes'] && args['filterthemes'] == THEMES[i]) { option.selected = true; } option.insert(THEMES[i]); filterMenu.insert(option); } Event.observe(filterMenu,"change", function(){ var theme = this.value; if (theme == "") { args['filterthemes'] = ""; if( type == 'orgs') { checkIsActiveOrgMessage(); } else if (type == 'projects') { checkIsActiveProjectMessage(); } else if (type == 'claims') { checkIsActiveClaimMessage(); } else if (type == 'evidence') { checkIsActiveEvidenceMessage(); } else if (type == 'issues') { checkIsActiveIssueMessage(); } else if (type == 'solutions') { checkIsActiveSolutionMessage(); } else if (type == 'web') { checkIsActiveWebMessage(); } else if (type == 'challenges') { checkIsActiveChallengeMessage(); } } else { args['filterthemes'] = theme; if( type == 'orgs') { refreshOrganizations(); } else if (type == 'projects') { refreshProjects(); } else if (type == 'claims') { refreshClaims(); } else if (type == 'evidence') { refreshEvidence(); } else if (type == 'issues') { refreshIssues(); } else if (type == 'solutions') { refreshSolutions(); } else if (type == 'web') { refreshWebsites(); } else if (type == 'challenges') { refreshChallenges(); } } }); sbTool.insert(filterMenu); return sbTool; } function createEvidenceFilter(context, args) { var sbTool = new Element("span", {'class':'toolbar2 col-auto'}); sbTool.insert("Filter by "); var resourceFilterMenu= new Element("select", {'class':'subforminput hgrselecthgrselect toolbar form-select'}); resourceFilterMenu.setAttribute("aria-label","Filter by"); var option = new Element("option", {'value':''}); option.insert('All Types'); resourceFilterMenu.insert(option); for(var i=0; i < EVIDENCE_TYPES.length; i++){ var option = new Element("option", {'value':EVIDENCE_TYPES[i]}); if (args['filternodetypes'] == EVIDENCE_TYPES[i]) { option.selected = true; } option.insert(EVIDENCE_TYPE_NAMES[i]); resourceFilterMenu.insert(option); } Event.observe(resourceFilterMenu,"change", function(){ switch(CURRENT_VIZ){ case 'net': if (args['filterthemes'] && args['filterthemes'] != "") { var type = this.value; args['filternodetypes'] = type; refreshEvidence(); } else { alert('Please also select a Theme'); break; } default : var type = this.value; args['filternodetypes'] = type; refreshEvidence(); break; } }); sbTool.insert(resourceFilterMenu); return sbTool; } function createResourceFilter(context, args) { var sbTool = new Element("span", {'class':'toolbar2 col-auto'}); sbTool.insert("Filter by "); var resourceFilterMenu= new Element("select", {'class':'subforminput hgrselecthgrselect toolbar form-select'}); resourceFilterMenu.setAttribute("aria-label","Filter by"); var option = new Element("option", {'value':''}); option.insert('All Types'); resourceFilterMenu.insert(option); for(var i=0; i < RESOURCE_TYPES.length; i++){ var option = new Element("option", {'value':RESOURCE_TYPES[i]}); if (args['filternodetypes'] == RESOURCE_TYPES[i]) { option.selected = true; } option.insert(RESOURCE_TYPE_NAMES[i]); resourceFilterMenu.insert(option); } Event.observe(resourceFilterMenu,"change", function(){ switch(CURRENT_VIZ){ case 'net': if (args['filterthemes'] && args['filterthemes'] != "") { var type = this.value; args['filternodetypes'] = type; refreshWebsites(); } else { alert('Please also select a Theme'); break; } default : var type = this.value; args['filternodetypes'] = type; updateAddressParameters(args); refreshWebsites(); break; } }); sbTool.insert(resourceFilterMenu); return sbTool; } function createNodeTypeFilter(context, args) { var sbTool = new Element("span", {'class':'toolbar2 col-auto'}); sbTool.insert("Filter by "); var filterMenu= new Element("select", {'class':'subforminput hgrselecthgrselect toolbar form-select'}); filterMenu.setAttribute("aria-label","Filter by"); var option = new Element("option", {'value':''}); option.insert('All Types'); filterMenu.insert(option); if (hasChallenge) { var option2 = new Element("option", {'value':'Challenge'}); if (args['filternodetypes'] == "Challenge") { option2.selected = true; } option2.insert("Key Challenge"); filterMenu.insert(option2); } var option = new Element("option", {'value':'Issue'}); if (args['filternodetypes'] == "Issue") { option.selected = true; } option.insert("Issue"); filterMenu.insert(option); if (hasClaim) { var option2 = new Element("option", {'value':'Claim'}); if (args['filternodetypes'] == "Claim") { option2.selected = true; } option2.insert("Fact"); filterMenu.insert(option2); } if (hasSolution) { var option2 = new Element("option", {'value':'Solution'}); if (args['filternodetypes'] == "Solution") { option2.selected = true; } option2.insert("Idea"); filterMenu.insert(option2); } var option = new Element("option", {'value':EVIDENCE_TYPES_STR}); if (args['filternodetypes'] == EVIDENCE_TYPES_STR) { option.selected = true; } option.insert("Argument"); filterMenu.insert(option); var option = new Element("option", {'value':RESOURCE_TYPES_STR}); if (args['filternodetypes'] == RESOURCE_TYPES_STR) { option.selected = true; } option.insert("Resource"); filterMenu.insert(option); Event.observe(filterMenu,"change", function(){ switch(CURRENT_VIZ){ case 'nodegmap': var linktype = this.value; args['filternodetypes'] = linktype; refreshUsers(); break; } }); sbTool.insert(filterMenu); return sbTool; } function createCountryFilter(context, args) { var sbTool = new Element("span", {'class':'toolbar2 col-auto'}); sbTool.insert("Zoom to "); var filterMenu= new Element("select", {'class':'subforminput hgrselecthgrselect toolbar form-select'}); filterMenu.setAttribute("aria-label","Filter by"); var option = new Element("option", {'value':''}); option.insert('Default view...'); filterMenu.insert(option); var option = new Element("option", {'value':"Afghanistan"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Afghanistan") { option.selected = true; } option.insert("Afghanistan"); filterMenu.insert(option); var option = new Element("option", {'value':"Albania"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Albania") { option.selected = true; } option.insert("Albania"); filterMenu.insert(option); var option = new Element("option", {'value':"Algeria"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Algeria") { option.selected = true; } option.insert("Algeria"); filterMenu.insert(option); var option = new Element("option", {'value':"American Samoa"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "American Samoa") { option.selected = true; } option.insert("American Samoa"); filterMenu.insert(option); var option = new Element("option", {'value':"Andorra"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Andorra") { option.selected = true; } option.insert("Andorra"); filterMenu.insert(option); var option = new Element("option", {'value':"Angola"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Angola") { option.selected = true; } option.insert("Angola"); filterMenu.insert(option); var option = new Element("option", {'value':"Anguilla"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Anguilla") { option.selected = true; } option.insert("Anguilla"); filterMenu.insert(option); var option = new Element("option", {'value':"Antarctica"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Antarctica") { option.selected = true; } option.insert("Antarctica"); filterMenu.insert(option); var option = new Element("option", {'value':"Antigua And Barbuda"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Antigua And Barbuda") { option.selected = true; } option.insert("Antigua And Barbuda"); filterMenu.insert(option); var option = new Element("option", {'value':"Argentina"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Argentina") { option.selected = true; } option.insert("Argentina"); filterMenu.insert(option); var option = new Element("option", {'value':"Armenia"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Armenia") { option.selected = true; } option.insert("Armenia"); filterMenu.insert(option); var option = new Element("option", {'value':"Aruba"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Aruba") { option.selected = true; } option.insert("Aruba"); filterMenu.insert(option); var option = new Element("option", {'value':"Australia"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Australia") { option.selected = true; } option.insert("Australia"); filterMenu.insert(option); var option = new Element("option", {'value':"Austria"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Austria") { option.selected = true; } option.insert("Austria"); filterMenu.insert(option); var option = new Element("option", {'value':"Azerbaijan"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Azerbaijan") { option.selected = true; } option.insert("Azerbaijan"); filterMenu.insert(option); var option = new Element("option", {'value':"Bahamas"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Bahamas") { option.selected = true; } option.insert("Bahamas"); filterMenu.insert(option); var option = new Element("option", {'value':"Bahrain"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Bahrain") { option.selected = true; } option.insert("Bahrain"); filterMenu.insert(option); var option = new Element("option", {'value':"Bangladesh"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Bangladesh") { option.selected = true; } option.insert("Bangladesh"); filterMenu.insert(option); var option = new Element("option", {'value':"Barbados"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Barbados") { option.selected = true; } option.insert("Barbados"); filterMenu.insert(option); var option = new Element("option", {'value':"Belarus"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Belarus") { option.selected = true; } option.insert("Belarus"); filterMenu.insert(option); var option = new Element("option", {'value':"Belgium"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Belgium") { option.selected = true; } option.insert("Belgium"); filterMenu.insert(option); var option = new Element("option", {'value':"Belize"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Belize") { option.selected = true; } option.insert("Belize"); filterMenu.insert(option); var option = new Element("option", {'value':"Benin"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Benin") { option.selected = true; } option.insert("Benin"); filterMenu.insert(option); var option = new Element("option", {'value':"Bermuda"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Bermuda") { option.selected = true; } option.insert("Bermuda"); filterMenu.insert(option); var option = new Element("option", {'value':"Bhutan"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Bhutan") { option.selected = true; } option.insert("Bhutan"); filterMenu.insert(option); var option = new Element("option", {'value':"Bolivia, Plurinational State Of"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Bolivia, Plurinational State Of") { option.selected = true; } option.insert("Bolivia, Plurinational State Of"); filterMenu.insert(option); var option = new Element("option", {'value':"Bonaire, Sint Eustatius and Saba"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Bonaire, Sint Eustatius and Saba") { option.selected = true; } option.insert("Bonaire, Sint Eustatius and Saba"); filterMenu.insert(option); var option = new Element("option", {'value':"Bosnia And Herzegovina"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Bosnia And Herzegovina") { option.selected = true; } option.insert("Bosnia And Herzegovina"); filterMenu.insert(option); var option = new Element("option", {'value':"Botswana"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Botswana") { option.selected = true; } option.insert("Botswana"); filterMenu.insert(option); var option = new Element("option", {'value':"Bouvet Island"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Bouvet Island") { option.selected = true; } option.insert("Bouvet Island"); filterMenu.insert(option); var option = new Element("option", {'value':"Brazil"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Brazil") { option.selected = true; } option.insert("Brazil"); filterMenu.insert(option); var option = new Element("option", {'value':"British Indian Ocean Territory"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "British Indian Ocean Territory") { option.selected = true; } option.insert("British Indian Ocean Territory"); filterMenu.insert(option); var option = new Element("option", {'value':"Brunei Darussalam"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Brunei Darussalam") { option.selected = true; } option.insert("Brunei Darussalam"); filterMenu.insert(option); var option = new Element("option", {'value':"Bulgaria"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Bulgaria") { option.selected = true; } option.insert("Bulgaria"); filterMenu.insert(option); var option = new Element("option", {'value':"Burkina Faso"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Burkina Faso") { option.selected = true; } option.insert("Burkina Faso"); filterMenu.insert(option); var option = new Element("option", {'value':"Burundi"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Burundi") { option.selected = true; } option.insert("Burundi"); filterMenu.insert(option); var option = new Element("option", {'value':"Cambodia"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Cambodia") { option.selected = true; } option.insert("Cambodia"); filterMenu.insert(option); var option = new Element("option", {'value':"Cameroon"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Cameroon") { option.selected = true; } option.insert("Cameroon"); filterMenu.insert(option); var option = new Element("option", {'value':"Canada"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Canada") { option.selected = true; } option.insert("Canada"); filterMenu.insert(option); var option = new Element("option", {'value':"Cape Verde"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Cape Verde") { option.selected = true; } option.insert("Cape Verde"); filterMenu.insert(option); var option = new Element("option", {'value':"Cayman Islands"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Cayman Islands") { option.selected = true; } option.insert("Cayman Islands"); filterMenu.insert(option); var option = new Element("option", {'value':"Central African Republic"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Central African Republic") { option.selected = true; } option.insert("Central African Republic"); filterMenu.insert(option); var option = new Element("option", {'value':"Chad"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Chad") { option.selected = true; } option.insert("Chad"); filterMenu.insert(option); var option = new Element("option", {'value':"Chile"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Chile") { option.selected = true; } option.insert("Chile"); filterMenu.insert(option); var option = new Element("option", {'value':"China"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "China") { option.selected = true; } option.insert("China"); filterMenu.insert(option); var option = new Element("option", {'value':"Christmas Island"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Christmas Island") { option.selected = true; } option.insert("Christmas Island"); filterMenu.insert(option); var option = new Element("option", {'value':"Cocos (Keeling) Islands"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Cocos (Keeling) Islands") { option.selected = true; } option.insert("Cocos (Keeling) Islands"); filterMenu.insert(option); var option = new Element("option", {'value':"Colombia"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Colombia") { option.selected = true; } option.insert("Colombia"); filterMenu.insert(option); var option = new Element("option", {'value':"Comoros"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Comoros") { option.selected = true; } option.insert("Comoros"); filterMenu.insert(option); var option = new Element("option", {'value':"Congo"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Congo") { option.selected = true; } option.insert("Congo"); filterMenu.insert(option); var option = new Element("option", {'value':"Congo, The Democratic Republic Of The"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Congo, The Democratic Republic Of The") { option.selected = true; } option.insert("Congo, The Democratic Republic Of The"); filterMenu.insert(option); var option = new Element("option", {'value':"Cook Islands"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Cook Islands") { option.selected = true; } option.insert("Cook Islands"); filterMenu.insert(option); var option = new Element("option", {'value':"Costa Rica"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Costa Rica") { option.selected = true; } option.insert("Costa Rica"); filterMenu.insert(option); var option = new Element("option", {'value':"Croatia"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Croatia") { option.selected = true; } option.insert("Croatia"); filterMenu.insert(option); var option = new Element("option", {'value':"Cuba"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Cuba") { option.selected = true; } option.insert("Cuba"); filterMenu.insert(option); var option = new Element("option", {'value':"Cyprus"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Cyprus") { option.selected = true; } option.insert("Cyprus"); filterMenu.insert(option); var option = new Element("option", {'value':"Czech Republic"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Czech Republic") { option.selected = true; } option.insert("Czech Republic"); filterMenu.insert(option); var option = new Element("option", {'value':"Côte D'Ivoire"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Côte D'Ivoire") { option.selected = true; } option.insert("Côte D'Ivoire"); filterMenu.insert(option); var option = new Element("option", {'value':"Denmark"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Denmark") { option.selected = true; } option.insert("Denmark"); filterMenu.insert(option); var option = new Element("option", {'value':"Djibouti"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Djibouti") { option.selected = true; } option.insert("Djibouti"); filterMenu.insert(option); var option = new Element("option", {'value':"Dominica"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Dominica") { option.selected = true; } option.insert("Dominica"); filterMenu.insert(option); var option = new Element("option", {'value':"Dominican Republic"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Dominican Republic") { option.selected = true; } option.insert("Dominican Republic"); filterMenu.insert(option); var option = new Element("option", {'value':"Ecuador"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Ecuador") { option.selected = true; } option.insert("Ecuador"); filterMenu.insert(option); var option = new Element("option", {'value':"Egypt"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Egypt") { option.selected = true; } option.insert("Egypt"); filterMenu.insert(option); var option = new Element("option", {'value':"El Salvador"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "El Salvador") { option.selected = true; } option.insert("El Salvador"); filterMenu.insert(option); var option = new Element("option", {'value':"Equatorial Guinea"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Equatorial Guinea") { option.selected = true; } option.insert("Equatorial Guinea"); filterMenu.insert(option); var option = new Element("option", {'value':"Eritrea"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Eritrea") { option.selected = true; } option.insert("Eritrea"); filterMenu.insert(option); var option = new Element("option", {'value':"Estonia"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Estonia") { option.selected = true; } option.insert("Estonia"); filterMenu.insert(option); var option = new Element("option", {'value':"Ethiopia"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Ethiopia") { option.selected = true; } option.insert("Ethiopia"); filterMenu.insert(option); var option = new Element("option", {'value':"Falkland Islands (Malvinas)"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Falkland Islands (Malvinas)") { option.selected = true; } option.insert("Falkland Islands (Malvinas)"); filterMenu.insert(option); var option = new Element("option", {'value':"Faroe Islands"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Faroe Islands") { option.selected = true; } option.insert("Faroe Islands"); filterMenu.insert(option); var option = new Element("option", {'value':"Fiji"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Fiji") { option.selected = true; } option.insert("Fiji"); filterMenu.insert(option); var option = new Element("option", {'value':"Finland"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Finland") { option.selected = true; } option.insert("Finland"); filterMenu.insert(option); var option = new Element("option", {'value':"France"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "France") { option.selected = true; } option.insert("France"); filterMenu.insert(option); var option = new Element("option", {'value':"French Guiana"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "French Guiana") { option.selected = true; } option.insert("French Guiana"); filterMenu.insert(option); var option = new Element("option", {'value':"French Polynesia"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "French Polynesia") { option.selected = true; } option.insert("French Polynesia"); filterMenu.insert(option); var option = new Element("option", {'value':"French Southern Territories"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "French Southern Territories") { option.selected = true; } option.insert("French Southern Territories"); filterMenu.insert(option); var option = new Element("option", {'value':"Gabon"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Gabon") { option.selected = true; } option.insert("Gabon"); filterMenu.insert(option); var option = new Element("option", {'value':"Gambia"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Gambia") { option.selected = true; } option.insert("Gambia"); filterMenu.insert(option); var option = new Element("option", {'value':"Georgia"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Georgia") { option.selected = true; } option.insert("Georgia"); filterMenu.insert(option); var option = new Element("option", {'value':"Germany"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Germany") { option.selected = true; } option.insert("Germany"); filterMenu.insert(option); var option = new Element("option", {'value':"Ghana"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Ghana") { option.selected = true; } option.insert("Ghana"); filterMenu.insert(option); var option = new Element("option", {'value':"Gibraltar"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Gibraltar") { option.selected = true; } option.insert("Gibraltar"); filterMenu.insert(option); var option = new Element("option", {'value':"Greece"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Greece") { option.selected = true; } option.insert("Greece"); filterMenu.insert(option); var option = new Element("option", {'value':"Greenland"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Greenland") { option.selected = true; } option.insert("Greenland"); filterMenu.insert(option); var option = new Element("option", {'value':"Grenada"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Grenada") { option.selected = true; } option.insert("Grenada"); filterMenu.insert(option); var option = new Element("option", {'value':"Guadeloupe"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Guadeloupe") { option.selected = true; } option.insert("Guadeloupe"); filterMenu.insert(option); var option = new Element("option", {'value':"Guam"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Guam") { option.selected = true; } option.insert("Guam"); filterMenu.insert(option); var option = new Element("option", {'value':"Guatemala"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Guatemala") { option.selected = true; } option.insert("Guatemala"); filterMenu.insert(option); var option = new Element("option", {'value':"Guernsey"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Guernsey") { option.selected = true; } option.insert("Guernsey"); filterMenu.insert(option); var option = new Element("option", {'value':"Guinea"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Guinea") { option.selected = true; } option.insert("Guinea"); filterMenu.insert(option); var option = new Element("option", {'value':"Guinea-Bissau"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Guinea-Bissau") { option.selected = true; } option.insert("Guinea-Bissau"); filterMenu.insert(option); var option = new Element("option", {'value':"Guyana"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Guyana") { option.selected = true; } option.insert("Guyana"); filterMenu.insert(option); var option = new Element("option", {'value':"Haiti"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Haiti") { option.selected = true; } option.insert("Haiti"); filterMenu.insert(option); var option = new Element("option", {'value':"Heard Island And Mcdonald Islands"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Heard Island And Mcdonald Islands") { option.selected = true; } option.insert("Heard Island And Mcdonald Islands"); filterMenu.insert(option); var option = new Element("option", {'value':"Holy See (Vatican City State)"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Holy See (Vatican City State)") { option.selected = true; } option.insert("Holy See (Vatican City State)"); filterMenu.insert(option); var option = new Element("option", {'value':"Honduras"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Honduras") { option.selected = true; } option.insert("Honduras"); filterMenu.insert(option); var option = new Element("option", {'value':"Hong Kong"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Hong Kong") { option.selected = true; } option.insert("Hong Kong"); filterMenu.insert(option); var option = new Element("option", {'value':"Hungary"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Hungary") { option.selected = true; } option.insert("Hungary"); filterMenu.insert(option); var option = new Element("option", {'value':"Iceland"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Iceland") { option.selected = true; } option.insert("Iceland"); filterMenu.insert(option); var option = new Element("option", {'value':"India"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "India") { option.selected = true; } option.insert("India"); filterMenu.insert(option); var option = new Element("option", {'value':"Indonesia"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Indonesia") { option.selected = true; } option.insert("Indonesia"); filterMenu.insert(option); var option = new Element("option", {'value':"Iran, Islamic Republic Of"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Iran, Islamic Republic Of") { option.selected = true; } option.insert("Iran, Islamic Republic Of"); filterMenu.insert(option); var option = new Element("option", {'value':"Iraq"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Iraq") { option.selected = true; } option.insert("Iraq"); filterMenu.insert(option); var option = new Element("option", {'value':"Ireland"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Ireland") { option.selected = true; } option.insert("Ireland"); filterMenu.insert(option); var option = new Element("option", {'value':"Isle Of Man"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Isle Of Man") { option.selected = true; } option.insert("Isle Of Man"); filterMenu.insert(option); var option = new Element("option", {'value':"Israel"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Israel") { option.selected = true; } option.insert("Israel"); filterMenu.insert(option); var option = new Element("option", {'value':"Italy"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Italy") { option.selected = true; } option.insert("Italy"); filterMenu.insert(option); var option = new Element("option", {'value':"Jamaica"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Jamaica") { option.selected = true; } option.insert("Jamaica"); filterMenu.insert(option); var option = new Element("option", {'value':"Japan"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Japan") { option.selected = true; } option.insert("Japan"); filterMenu.insert(option); var option = new Element("option", {'value':"Jersey"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Jersey") { option.selected = true; } option.insert("Jersey"); filterMenu.insert(option); var option = new Element("option", {'value':"Jordan"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Jordan") { option.selected = true; } option.insert("Jordan"); filterMenu.insert(option); var option = new Element("option", {'value':"Kazakhstan"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Kazakhstan") { option.selected = true; } option.insert("Kazakhstan"); filterMenu.insert(option); var option = new Element("option", {'value':"Kenya"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Kenya") { option.selected = true; } option.insert("Kenya"); filterMenu.insert(option); var option = new Element("option", {'value':"Kiribati"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Kiribati") { option.selected = true; } option.insert("Kiribati"); filterMenu.insert(option); var option = new Element("option", {'value':"Korea, Democratic People's Republic Of"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Korea, Democratic People's Republic Of") { option.selected = true; } option.insert("Korea, Democratic People's Republic Of"); filterMenu.insert(option); var option = new Element("option", {'value':"Korea, Republic Of"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Korea, Republic Of") { option.selected = true; } option.insert("Korea, Republic Of"); filterMenu.insert(option); var option = new Element("option", {'value':"Kuwait"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Kuwait") { option.selected = true; } option.insert("Kuwait"); filterMenu.insert(option); var option = new Element("option", {'value':"Kyrgyzstan"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Kyrgyzstan") { option.selected = true; } option.insert("Kyrgyzstan"); filterMenu.insert(option); var option = new Element("option", {'value':"Lao People's Democratic Republic"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Lao People's Democratic Republic") { option.selected = true; } option.insert("Lao People's Democratic Republic"); filterMenu.insert(option); var option = new Element("option", {'value':"Latvia"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Latvia") { option.selected = true; } option.insert("Latvia"); filterMenu.insert(option); var option = new Element("option", {'value':"Lebanon"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Lebanon") { option.selected = true; } option.insert("Lebanon"); filterMenu.insert(option); var option = new Element("option", {'value':"Lesotho"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Lesotho") { option.selected = true; } option.insert("Lesotho"); filterMenu.insert(option); var option = new Element("option", {'value':"Liberia"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Liberia") { option.selected = true; } option.insert("Liberia"); filterMenu.insert(option); var option = new Element("option", {'value':"Libya"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Libya") { option.selected = true; } option.insert("Libya"); filterMenu.insert(option); var option = new Element("option", {'value':"Liechtenstein"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Liechtenstein") { option.selected = true; } option.insert("Liechtenstein"); filterMenu.insert(option); var option = new Element("option", {'value':"Lithuania"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Lithuania") { option.selected = true; } option.insert("Lithuania"); filterMenu.insert(option); var option = new Element("option", {'value':"Luxembourg"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Luxembourg") { option.selected = true; } option.insert("Luxembourg"); filterMenu.insert(option); var option = new Element("option", {'value':"Macao"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Macao") { option.selected = true; } option.insert("Macao"); filterMenu.insert(option); var option = new Element("option", {'value':"Macedonia, The Former Yugoslav Republic Of"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Macedonia, The Former Yugoslav Republic Of") { option.selected = true; } option.insert("Macedonia, The Former Yugoslav Republic Of"); filterMenu.insert(option); var option = new Element("option", {'value':"Madagascar"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Madagascar") { option.selected = true; } option.insert("Madagascar"); filterMenu.insert(option); var option = new Element("option", {'value':"Malawi"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Malawi") { option.selected = true; } option.insert("Malawi"); filterMenu.insert(option); var option = new Element("option", {'value':"Malaysia"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Malaysia") { option.selected = true; } option.insert("Malaysia"); filterMenu.insert(option); var option = new Element("option", {'value':"Maldives"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Maldives") { option.selected = true; } option.insert("Maldives"); filterMenu.insert(option); var option = new Element("option", {'value':"Mali"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Mali") { option.selected = true; } option.insert("Mali"); filterMenu.insert(option); var option = new Element("option", {'value':"Malta"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Malta") { option.selected = true; } option.insert("Malta"); filterMenu.insert(option); var option = new Element("option", {'value':"Marshall Islands"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Marshall Islands") { option.selected = true; } option.insert("Marshall Islands"); filterMenu.insert(option); var option = new Element("option", {'value':"Martinique"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Martinique") { option.selected = true; } option.insert("Martinique"); filterMenu.insert(option); var option = new Element("option", {'value':"Mauritania"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Mauritania") { option.selected = true; } option.insert("Mauritania"); filterMenu.insert(option); var option = new Element("option", {'value':"Mauritius"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Mauritius") { option.selected = true; } option.insert("Mauritius"); filterMenu.insert(option); var option = new Element("option", {'value':"Mayotte"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Mayotte") { option.selected = true; } option.insert("Mayotte"); filterMenu.insert(option); var option = new Element("option", {'value':"Mexico"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Mexico") { option.selected = true; } option.insert("Mexico"); filterMenu.insert(option); var option = new Element("option", {'value':"Micronesia, Federated States Of"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Micronesia, Federated States Of") { option.selected = true; } option.insert("Micronesia, Federated States Of"); filterMenu.insert(option); var option = new Element("option", {'value':"Moldova, Republic Of"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Moldova, Republic Of") { option.selected = true; } option.insert("Moldova, Republic Of"); filterMenu.insert(option); var option = new Element("option", {'value':"Monaco"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Monaco") { option.selected = true; } option.insert("Monaco"); filterMenu.insert(option); var option = new Element("option", {'value':"Mongolia"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Mongolia") { option.selected = true; } option.insert("Mongolia"); filterMenu.insert(option); var option = new Element("option", {'value':"Montenegro"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Montenegro") { option.selected = true; } option.insert("Montenegro"); filterMenu.insert(option); var option = new Element("option", {'value':"Montserrat"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Montserrat") { option.selected = true; } option.insert("Montserrat"); filterMenu.insert(option); var option = new Element("option", {'value':"Morocco"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Morocco") { option.selected = true; } option.insert("Morocco"); filterMenu.insert(option); var option = new Element("option", {'value':"Mozambique"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Mozambique") { option.selected = true; } option.insert("Mozambique"); filterMenu.insert(option); var option = new Element("option", {'value':"Myanmar"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Myanmar") { option.selected = true; } option.insert("Myanmar"); filterMenu.insert(option); var option = new Element("option", {'value':"Namibia"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Namibia") { option.selected = true; } option.insert("Namibia"); filterMenu.insert(option); var option = new Element("option", {'value':"Nauru"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Nauru") { option.selected = true; } option.insert("Nauru"); filterMenu.insert(option); var option = new Element("option", {'value':"Nepal"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Nepal") { option.selected = true; } option.insert("Nepal"); filterMenu.insert(option); var option = new Element("option", {'value':"Netherlands"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Netherlands") { option.selected = true; } option.insert("Netherlands"); filterMenu.insert(option); var option = new Element("option", {'value':"New Caledonia"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "New Caledonia") { option.selected = true; } option.insert("New Caledonia"); filterMenu.insert(option); var option = new Element("option", {'value':"New Zealand"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "New Zealand") { option.selected = true; } option.insert("New Zealand"); filterMenu.insert(option); var option = new Element("option", {'value':"Nicaragua"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Nicaragua") { option.selected = true; } option.insert("Nicaragua"); filterMenu.insert(option); var option = new Element("option", {'value':"Niger"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Niger") { option.selected = true; } option.insert("Niger"); filterMenu.insert(option); var option = new Element("option", {'value':"Nigeria"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Nigeria") { option.selected = true; } option.insert("Nigeria"); filterMenu.insert(option); var option = new Element("option", {'value':"Niue"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Niue") { option.selected = true; } option.insert("Niue"); filterMenu.insert(option); var option = new Element("option", {'value':"Norfolk Island"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Norfolk Island") { option.selected = true; } option.insert("Norfolk Island"); filterMenu.insert(option); var option = new Element("option", {'value':"Northern Mariana Islands"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Northern Mariana Islands") { option.selected = true; } option.insert("Northern Mariana Islands"); filterMenu.insert(option); var option = new Element("option", {'value':"Norway"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Norway") { option.selected = true; } option.insert("Norway"); filterMenu.insert(option); var option = new Element("option", {'value':"Oman"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Oman") { option.selected = true; } option.insert("Oman"); filterMenu.insert(option); var option = new Element("option", {'value':"Pakistan"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Pakistan") { option.selected = true; } option.insert("Pakistan"); filterMenu.insert(option); var option = new Element("option", {'value':"Palau"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Palau") { option.selected = true; } option.insert("Palau"); filterMenu.insert(option); var option = new Element("option", {'value':"Palestinian Territory, Occupied"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Palestinian Territory, Occupied") { option.selected = true; } option.insert("Palestinian Territory, Occupied"); filterMenu.insert(option); var option = new Element("option", {'value':"Panama"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Panama") { option.selected = true; } option.insert("Panama"); filterMenu.insert(option); var option = new Element("option", {'value':"Papua New Guinea"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Papua New Guinea") { option.selected = true; } option.insert("Papua New Guinea"); filterMenu.insert(option); var option = new Element("option", {'value':"Paraguay"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Paraguay") { option.selected = true; } option.insert("Paraguay"); filterMenu.insert(option); var option = new Element("option", {'value':"Peru"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Peru") { option.selected = true; } option.insert("Peru"); filterMenu.insert(option); var option = new Element("option", {'value':"Philippines"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Philippines") { option.selected = true; } option.insert("Philippines"); filterMenu.insert(option); var option = new Element("option", {'value':"Pitcairn"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Pitcairn") { option.selected = true; } option.insert("Pitcairn"); filterMenu.insert(option); var option = new Element("option", {'value':"Poland"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Poland") { option.selected = true; } option.insert("Poland"); filterMenu.insert(option); var option = new Element("option", {'value':"Portugal"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Portugal") { option.selected = true; } option.insert("Portugal"); filterMenu.insert(option); var option = new Element("option", {'value':"Puerto Rico"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Puerto Rico") { option.selected = true; } option.insert("Puerto Rico"); filterMenu.insert(option); var option = new Element("option", {'value':"Qatar"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Qatar") { option.selected = true; } option.insert("Qatar"); filterMenu.insert(option); var option = new Element("option", {'value':"Romania"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Romania") { option.selected = true; } option.insert("Romania"); filterMenu.insert(option); var option = new Element("option", {'value':"Russian Federation"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Russian Federation") { option.selected = true; } option.insert("Russian Federation"); filterMenu.insert(option); var option = new Element("option", {'value':"Rwanda"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Rwanda") { option.selected = true; } option.insert("Rwanda"); filterMenu.insert(option); var option = new Element("option", {'value':"Réunion"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Réunion") { option.selected = true; } option.insert("Réunion"); filterMenu.insert(option); var option = new Element("option", {'value':"Saint Barthélemy"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Saint Barthélemy") { option.selected = true; } option.insert("Saint Barthélemy"); filterMenu.insert(option); var option = new Element("option", {'value':"Saint Helena"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Saint Helena") { option.selected = true; } option.insert("Saint Helena"); filterMenu.insert(option); var option = new Element("option", {'value':"Saint Kitts And Nevis"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Saint Kitts And Nevis") { option.selected = true; } option.insert("Saint Kitts And Nevis"); filterMenu.insert(option); var option = new Element("option", {'value':"Saint Lucia"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Saint Lucia") { option.selected = true; } option.insert("Saint Lucia"); filterMenu.insert(option); var option = new Element("option", {'value':"Saint Martin"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Saint Martin") { option.selected = true; } option.insert("Saint Martin"); filterMenu.insert(option); var option = new Element("option", {'value':"Saint Pierre And Miquelon"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Saint Pierre And Miquelon") { option.selected = true; } option.insert("Saint Pierre And Miquelon"); filterMenu.insert(option); var option = new Element("option", {'value':"Saint Vincent And The Grenadines"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Saint Vincent And The Grenadines") { option.selected = true; } option.insert("Saint Vincent And The Grenadines"); filterMenu.insert(option); var option = new Element("option", {'value':"Samoa"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Samoa") { option.selected = true; } option.insert("Samoa"); filterMenu.insert(option); var option = new Element("option", {'value':"San Marino"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "San Marino") { option.selected = true; } option.insert("San Marino"); filterMenu.insert(option); var option = new Element("option", {'value':"Sao Tome And Principe"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Sao Tome And Principe") { option.selected = true; } option.insert("Sao Tome And Principe"); filterMenu.insert(option); var option = new Element("option", {'value':"Saudi Arabia"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Saudi Arabia") { option.selected = true; } option.insert("Saudi Arabia"); filterMenu.insert(option); var option = new Element("option", {'value':"Senegal"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Senegal") { option.selected = true; } option.insert("Senegal"); filterMenu.insert(option); var option = new Element("option", {'value':"Serbia"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Serbia") { option.selected = true; } option.insert("Serbia"); filterMenu.insert(option); var option = new Element("option", {'value':"Seychelles"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Seychelles") { option.selected = true; } option.insert("Seychelles"); filterMenu.insert(option); var option = new Element("option", {'value':"Sierra Leone"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Sierra Leone") { option.selected = true; } option.insert("Sierra Leone"); filterMenu.insert(option); var option = new Element("option", {'value':"Singapore"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Singapore") { option.selected = true; } option.insert("Singapore"); filterMenu.insert(option); var option = new Element("option", {'value':"Sint Maarten (Dutch Part)"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Sint Maarten (Dutch Part)") { option.selected = true; } option.insert("Sint Maarten (Dutch Part)"); filterMenu.insert(option); var option = new Element("option", {'value':"Slovakia"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Slovakia") { option.selected = true; } option.insert("Slovakia"); filterMenu.insert(option); var option = new Element("option", {'value':"Slovenia"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Slovenia") { option.selected = true; } option.insert("Slovenia"); filterMenu.insert(option); var option = new Element("option", {'value':"Solomon Islands"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Solomon Islands") { option.selected = true; } option.insert("Solomon Islands"); filterMenu.insert(option); var option = new Element("option", {'value':"Somalia"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Somalia") { option.selected = true; } option.insert("Somalia"); filterMenu.insert(option); var option = new Element("option", {'value':"Sounth Sudan"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Sounth Sudan") { option.selected = true; } option.insert("Sounth Sudan"); filterMenu.insert(option); var option = new Element("option", {'value':"South Africa"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "South Africa") { option.selected = true; } option.insert("South Africa"); filterMenu.insert(option); var option = new Element("option", {'value':"South Georgia And The South Sandwich Islands"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "South Georgia And The South Sandwich Islands") { option.selected = true; } option.insert("South Georgia And The South Sandwich Islands"); filterMenu.insert(option); var option = new Element("option", {'value':"Spain"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Spain") { option.selected = true; } option.insert("Spain"); filterMenu.insert(option); var option = new Element("option", {'value':"Sri Lanka"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Sri Lanka") { option.selected = true; } option.insert("Sri Lanka"); filterMenu.insert(option); var option = new Element("option", {'value':"Sudan"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Sudan") { option.selected = true; } option.insert("Sudan"); filterMenu.insert(option); var option = new Element("option", {'value':"Suriname"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Suriname") { option.selected = true; } option.insert("Suriname"); filterMenu.insert(option); var option = new Element("option", {'value':"Svalbard And Jan Mayen"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Svalbard And Jan Mayen") { option.selected = true; } option.insert("Svalbard And Jan Mayen"); filterMenu.insert(option); var option = new Element("option", {'value':"Swaziland"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Swaziland") { option.selected = true; } option.insert("Swaziland"); filterMenu.insert(option); var option = new Element("option", {'value':"Sweden"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Sweden") { option.selected = true; } option.insert("Sweden"); filterMenu.insert(option); var option = new Element("option", {'value':"Switzerland"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Switzerland") { option.selected = true; } option.insert("Switzerland"); filterMenu.insert(option); var option = new Element("option", {'value':"Syrian Arab Republic"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Syrian Arab Republic") { option.selected = true; } option.insert("Syrian Arab Republic"); filterMenu.insert(option); var option = new Element("option", {'value':"Taiwan, Province Of China"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Taiwan, Province Of China") { option.selected = true; } option.insert("Taiwan, Province Of China"); filterMenu.insert(option); var option = new Element("option", {'value':"Tajikistan"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Tajikistan") { option.selected = true; } option.insert("Tajikistan"); filterMenu.insert(option); var option = new Element("option", {'value':"Tanzania, United Republic Of"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Tanzania, United Republic Of") { option.selected = true; } option.insert("Tanzania, United Republic Of"); filterMenu.insert(option); var option = new Element("option", {'value':"Thailand"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Thailand") { option.selected = true; } option.insert("Thailand"); filterMenu.insert(option); var option = new Element("option", {'value':"Timor-Leste"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Timor-Leste") { option.selected = true; } option.insert("Timor-Leste"); filterMenu.insert(option); var option = new Element("option", {'value':"Togo"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Togo") { option.selected = true; } option.insert("Togo"); filterMenu.insert(option); var option = new Element("option", {'value':"Tokelau"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Tokelau") { option.selected = true; } option.insert("Tokelau"); filterMenu.insert(option); var option = new Element("option", {'value':"Tonga"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Tonga") { option.selected = true; } option.insert("Tonga"); filterMenu.insert(option); var option = new Element("option", {'value':"Trinidad And Tobago"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Trinidad And Tobago") { option.selected = true; } option.insert("Trinidad And Tobago"); filterMenu.insert(option); var option = new Element("option", {'value':"Tunisia"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Tunisia") { option.selected = true; } option.insert("Tunisia"); filterMenu.insert(option); var option = new Element("option", {'value':"Turkey"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Turkey") { option.selected = true; } option.insert("Turkey"); filterMenu.insert(option); var option = new Element("option", {'value':"Turkmenistan"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Turkmenistan") { option.selected = true; } option.insert("Turkmenistan"); filterMenu.insert(option); var option = new Element("option", {'value':"Turks And Caicos Islands"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Turks And Caicos Islands") { option.selected = true; } option.insert("Turks And Caicos Islands"); filterMenu.insert(option); var option = new Element("option", {'value':"Tuvalu"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Tuvalu") { option.selected = true; } option.insert("Tuvalu"); filterMenu.insert(option); var option = new Element("option", {'value':"Uganda"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Uganda") { option.selected = true; } option.insert("Uganda"); filterMenu.insert(option); var option = new Element("option", {'value':"Ukraine"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Ukraine") { option.selected = true; } option.insert("Ukraine"); filterMenu.insert(option); var option = new Element("option", {'value':"United Arab Emirates"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "United Arab Emirates") { option.selected = true; } option.insert("United Arab Emirates"); filterMenu.insert(option); var option = new Element("option", {'value':"United Kingdom"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "United Kingdom") { option.selected = true; } option.insert("United Kingdom"); filterMenu.insert(option); var option = new Element("option", {'value':"United States"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "United States") { option.selected = true; } option.insert("United States"); filterMenu.insert(option); var option = new Element("option", {'value':"United States Minor Outlying Islands"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "United States Minor Outlying Islands") { option.selected = true; } option.insert("United States Minor Outlying Islands"); filterMenu.insert(option); var option = new Element("option", {'value':"Uruguay"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Uruguay") { option.selected = true; } option.insert("Uruguay"); filterMenu.insert(option); var option = new Element("option", {'value':"Uzbekistan"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Uzbekistan") { option.selected = true; } option.insert("Uzbekistan"); filterMenu.insert(option); var option = new Element("option", {'value':"Vanuatu"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Vanuatu") { option.selected = true; } option.insert("Vanuatu"); filterMenu.insert(option); var option = new Element("option", {'value':"Venezuela, Bolivarian Republic Of"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Venezuela, Bolivarian Republic Of") { option.selected = true; } option.insert("Venezuela, Bolivarian Republic Of"); filterMenu.insert(option); var option = new Element("option", {'value':"Viet Nam"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Viet Nam") { option.selected = true; } option.insert("Viet Nam"); filterMenu.insert(option); var option = new Element("option", {'value':"Virgin Islands, British"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Virgin Islands, British") { option.selected = true; } option.insert("Virgin Islands, British"); filterMenu.insert(option); var option = new Element("option", {'value':"Virgin Islands, U.S."}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Virgin Islands, U.S.") { option.selected = true; } option.insert("Virgin Islands, U.S."); filterMenu.insert(option); var option = new Element("option", {'value':"Wallis And Futuna"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Wallis And Futuna") { option.selected = true; } option.insert("Wallis And Futuna"); filterMenu.insert(option); var option = new Element("option", {'value':"Western Sahara"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Western Sahara") { option.selected = true; } option.insert("Western Sahara"); filterMenu.insert(option); var option = new Element("option", {'value':"Yemen"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Yemen") { option.selected = true; } option.insert("Yemen"); filterMenu.insert(option); var option = new Element("option", {'value':"Zambia"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Zambia") { option.selected = true; } option.insert("Zambia"); filterMenu.insert(option); var option = new Element("option", {'value':"Zimbabwe"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Zimbabwe") { option.selected = true; } option.insert("Zimbabwe"); filterMenu.insert(option); var option = new Element("option", {'value':"Åland Islands"}); if (args['zoomtocountry'] && args['zoomtocountry'] == "Åland Islands") { option.selected = true; } option.insert("Åland Islands"); filterMenu.insert(option); Event.observe(filterMenu,"change", function(){ var selected = this.value; args['zoomtocountry'] = selected; updateAddressParameters(args); switch(CURRENT_VIZ){ case 'nodegmap': zoomToCountryUserNode(selected); case 'usergmap': zoomToCountryUser(selected); case 'gmap': if (CURRENT_TAB == 'org') { zoomToCountryOrg(selected); } else if (CURRENT_TAB == 'project') { zoomToCountryProject(selected); } break; } }); sbTool.insert(filterMenu); return sbTool; } function createConnectedFilter(context, args, type) { var sbTool = new Element("span", {'class':'toolbar2 col-auto'}); sbTool.insert("Filter by "); var filterMenu= new Element("select", {'class':'subforminput hgrselecthgrselect toolbar form-select'}); filterMenu.setAttribute("aria-label","Filter by"); var option = new Element("option", {'value':''}); option.insert('All Items'); filterMenu.insert(option); var option = new Element("option", {'value':'connected'}); if (args['filterbyconnection'] && args['filterbyconnection'] == "connected") { option.selected = true; } option.insert("Connected Items"); filterMenu.insert(option); var option2 = new Element("option", {'value':'unconnected'}); if (args['filterbyconnection'] && args['filterbyconnection'] == "unconnected") { option2.selected = true; } option2.insert("Unconnected Items"); filterMenu.insert(option2); Event.observe(filterMenu,"change", function(){ var selection = this.value; args['filterbyconnection'] = selection; if( type == 'orgs') { refreshOrganizations(); } else if (type == 'projects') { refreshProjects(); } else if (type == 'claims') { refreshClaims(); } else if (type == 'evidence') { refreshEvidence(); } else if (type == 'issues') { refreshIssues(); } else if (type == 'solutions') { refreshSolutions(); } else if (type == 'web') { refreshWebsites(); } else if (type == 'challenges') { refreshChallenges(); } }); sbTool.insert(filterMenu); return sbTool; } /** * display Nav */ function createNav(total, start, count, argArray, context, type){ var nav = new Element ("div",{'id':'page-nav', 'class':'toolbarrow pb-3' }); var header = createNavCounter(total, start, count, type); nav.insert(header); if (total > parseInt( argArray["max"] )) { //previous var prevSpan = new Element("span", {'id':"nav-previous", "class": "page-nav page-chevron"}); if(start > 0){ prevSpan.update("Previous"); prevSpan.addClassName("active"); Event.observe(prevSpan,"click", function(){ var newArr = argArray; newArr["start"] = parseInt(start) - newArr["max"]; eval("load"+type+"(context,newArr)"); }); } else { prevSpan.update("No Previous"); prevSpan.addClassName("inactive"); } //pages var pageSpan = new Element("span", {'id':"nav-pages", "class": "page-nav"}); var totalPages = Math.ceil(total/argArray["max"]); var currentPage = (start/argArray["max"]) + 1; for (var i = 1; i < totalPages+1; i++){ var page = new Element("span", {'class':"nav-page"}).insert(i); if(i != currentPage){ page.addClassName("active"); var newArr = Object.clone(argArray); newArr["start"] = newArr["max"] * (i-1) ; Event.observe(page,"click", Pages.next.bindAsEventListener(Pages,type,context,newArr)); } else { page.addClassName("currentpage"); } pageSpan.insert(page); } //next var nextSpan = new Element("span", {'id':"nav-next", "class": "page-nav page-chevron"}); if(parseInt(start)+parseInt(count) < parseInt(total)){ nextSpan.update("Next"); nextSpan.addClassName("active"); Event.observe(nextSpan,"click", function(){ var newArr = argArray; newArr["start"] = parseInt(start) + parseInt(newArr["max"]); eval("load"+type+"(context, newArr)"); }); } else { nextSpan.update("No Next"); nextSpan.addClassName("inactive"); } if( start>0 || (parseInt(start)+parseInt(count) < parseInt(total))){ nav.insert(prevSpan).insert(pageSpan).insert(nextSpan); } } return nav; } /** * display nav header */ function createNavCounter(total, start, count, type){ if(count != 0){ var objH = new Element("span",{'class':'nav'}); var s1 = parseInt(start)+1; var s2 = parseInt(start)+parseInt(count); objH.insert("" + s1 + " to " + s2 + " (" + total + ")"); } else { var objH = new Element("span"); if (CONTEXT == 'user' && USER_ARGS.userid == USER){ switch(type){ case 'challenge': objH.insert("No Key Challenges found"); break; case 'orgs': objH.insert("

No Organizations found

"); break; case 'projects': objH.insert("

No Projects found

"); break; case 'issues': objH.insert("

No Issues found

"); break; case 'solutions': objH.insert("

No Ideas found

"); break; case 'claims': objH.insert("

No Facts found

"); break; case 'evidence': objH.insert("

No Arguments found

"); break; case 'urls': objH.insert("

No Resources found

"); break; case 'comment': objH.insert("

No Open Comments found

"); break; } } else { switch(type){ case 'challenge': objH.insert("There are no Key Challenges to display"); break; case 'evidence': objH.insert("There are no Argument items to display"); break; case 'orgs': objH.insert("There are no Organizations to display"); break; case 'projects': objH.insert("There are no Projects to display"); break; case 'urls': objH.insert("There are no Resources to display"); break; case 'issues': objH.insert("

There are no Issues to display

"); break; case 'solutions': objH.insert("

There are no Ideas to display

"); break; case 'claims': objH.insert("

There are no Facts to display

"); break; case 'news': objH.insert("

No News article found

"); break; default: objH.insert("There are no items to display"); } } } return objH; } var Pages = { next: function(e){ var data = $A(arguments); eval("load"+data[1]+"(data[2],data[3])"); } }; /** * load JS file for creating the connection network (applet) */ function loadChallengeNet(){ addScriptDynamically('https://isave.evidence-hub.net/ui/networkmaps/conn-challenge-net.js.php', 'conn-challenge-net-script'); } /** * Load JS files for creating google map */ function loadOrgNodesGMap(){ updateAddressParameters(ORG_ARGS); addScriptDynamically('https://isave.evidence-hub.net/ui/geomaps/orggmap.js.php', 'geomaps-orggmap-script'); DATA_LOADED.orggmap = true; } /** * Load JS files for creating google map */ function loadProjectNodesGMap(){ updateAddressParameters(PROJECT_ARGS); addScriptDynamically('https://isave.evidence-hub.net/ui/geomaps/projectgmap.js.php', 'geomaps-projectgmap-script'); DATA_LOADED.projectgmap = true; } /** * Load JS files for creating google map */ function loadUserGMap() { updateAddressParameters(USER_ARGS); addScriptDynamically('https://isave.evidence-hub.net/ui/geomaps/usergmap.js.php', 'geomaps-usergmap-script'); DATA_LOADED.usergmap = true; } /** * Load JS files for creating google map */ function loadUserNodeGMap(){ updateAddressParameters(USER_ARGS); addScriptDynamically('https://isave.evidence-hub.net/ui/geomaps/usernodegmap.js.php', 'geomaps-usernodegmap-script'); DATA_LOADED.nodegmap = true; } /** * load JS file for creating the connection network (applet) for Organizations */ function loadOrgNet(){ addScriptDynamically('https://isave.evidence-hub.net/ui/networkmaps/conn-orgtheme-net.js.php', 'conn-orgtheme-net-script'); } /** * load JS file for creating the connection network (applet) for Projects */ function loadProjectNet(){ addScriptDynamically('https://isave.evidence-hub.net/ui/networkmaps/conn-projecttheme-net.js.php', 'conn-projecttheme-net-script'); } /** * load JS file for creating the connection network (applet) for Issues */ function loadIssueNet(){ addScriptDynamically('https://isave.evidence-hub.net/ui/networkmaps/conn-issue-net.js.php', 'conn-issue-net-script'); } /** * load JS file for creating the connection network (applet) for Solutions */ function loadSolutionNet(){ addScriptDynamically('https://isave.evidence-hub.net/ui/networkmaps/conn-solution-net.js.php', 'conn-solution-net-script'); } /** * load JS file for creating the connection network (applet) for Claims */ function loadClaimNet(){ addScriptDynamically('https://isave.evidence-hub.net/ui/networkmaps/conn-claim-net.js.php', 'conn-claim-net-script'); } /** * load JS file for creating the connection network (applet) for Evidence */ function loadEvidenceNet(){ addScriptDynamically('https://isave.evidence-hub.net/ui/networkmaps/conn-evidence-net.js.php', 'conn-evidence-net-script'); } /** * load JS file for creating the connection network (applet) for Reources */ function loadWebNet(){ addScriptDynamically('https://isave.evidence-hub.net/ui/networkmaps/conn-resource-net.js.php', 'conn-resource-net-script'); } /** * load JS file for creating the connection network (applet) for user social network */ function loadUserNet(){ addScriptDynamically('https://isave.evidence-hub.net/ui/networkmaps/social-net.js.php', 'social-net-script'); }