var CURRENT_ADD_AREA = null; var CURRENT_ADD_AREA_NODEID = null; var CURRENT_ADD_AREA_NODE = null; var CURRENT_ADD_AREA_HAS_UP = null var CHAT_LOADED_ARRAY = {}; var CHAT_TIMER = null; var DEBATE_TREE_SMALL = true; var DEBATE_LOADED_ARRAY = {}; var DEBATE_TIMER = null; function toggleDebateMode() { if ($('toggleDebateButton').innerHTML == "(View wider knowledge trees)") { DEBATE_TREE_SMALL = false; $('toggleDebateButton').innerHTML = "(View narrower knowledge trees)"; $('toggleDebateButton').title = "See only the immediate knowledge trees that the current item is a part of"; drawDebates(false, ""); } else { DEBATE_TREE_SMALL = true; $('toggleDebateButton').innerHTML = "(View wider knowledge trees)"; $('toggleDebateButton').title = "See the full and wider knowledge trees that the current item is a part of. This can take a while to load."; drawDebates(false, ""); } } function getExploreViz(viz) { if (viz == "" || (viz != "linear" && viz != "widget" && viz != "net")) { viz = DEFAULT_VIZ; var allcookies = document.cookie; if (allcookies != null) { var cookiearray = allcookies.split(';'); for(var i=0; i"+title+" "+name); } var nodetype = nodeObj.role.name; var title=getNodeTitleAntecedence(nodetype); var type = ''; if (nodetype == 'Challenge') { type = 'challenge'; } else if (nodetype == 'Issue') { type = 'issue'; } else if (nodetype == 'Claim') { type = 'claim'; } else if (nodetype == 'Solution') { type = 'solution'; } else if (nodetype == 'Organization') { type = 'org'; } else if (nodetype == 'Project') { type = 'project'; } else if (nodetype == "Theme") { type = 'theme' } else if (EVIDENCE_TYPES_STR.indexOf(type) != -1) { type = 'evidence'; } else if (RESOURCE_TYPES_STR.indexOf(type) != -1) { type = 'web'; } else if (nodetype == "News") { type = 'news'; } if (type != 'news') { buildExploreToolbar($('headertoolbar'), title+name, type, nodeObj, from); } } function buildSearchTitle(type, query, tagsonly) { //var name = search; var widgetHeaderLabel = $('exploreheaderlabel'); if (widgetHeaderLabel) { if (type == 'tree') { if (tagsonly == true) { widgetHeaderLabel.insert('Knowledge Trees for Tag search results on: '+query); } else { widgetHeaderLabel.insert('Knowledge Trees for Search results on: '+query); } } else if (type == 'net') { if (tagsonly == true) { widgetHeaderLabel.insert('Networks for Tag search results on: '+query); } else { widgetHeaderLabel.insert('Networks for Search results on: '+query); } } } } function buildExploreToolbar(container, name, type, node, from) { var nodeid = node.nodeid; // parent list button if (type == 'issue') { var homelink = new Element('a',{'class':'exploreToolbarIcon'}); homelink.href="https://test.evidence-hub.net/index.php?#issue-list"; var homebutton = new Element('img',{'class':'active','src': 'https://test.evidence-hub.net/images/list.png', 'title':'Click to go to the Issues List'}); homelink.insert(homebutton); container.insert(homelink); } else if (type == 'challenge') { var homelink = new Element('a',{'class':'exploreToolbarIcon'}); homelink.href="https://test.evidence-hub.net/index.php?#challenge-list"; var homebutton = new Element('img',{'class':'active','src': 'https://test.evidence-hub.net/images/list.png', 'title':'Click to go to the Key Challenges List'}); homelink.insert(homebutton); container.insert(homelink); } else if (type == 'claim') { var homelink = new Element('a',{'class':'exploreToolbarIcon'}); homelink.href="https://test.evidence-hub.net/index.php?#claim-list"; var homebutton = new Element('img',{'class':'active','src': 'https://test.evidence-hub.net/images/list.png', 'title':'Click to go to the Research Claims List'}); homelink.insert(homebutton); container.insert(homelink); } else if (type == 'solution') { var homelink = new Element('a',{'class':'exploreToolbarIcon'}); homelink.href="https://test.evidence-hub.net/index.php?#solution-list"; var homebutton = new Element('img',{'class':'active','src': 'https://test.evidence-hub.net/images/list.png', 'title':'Click to go to the Potential Solutions List'}); homelink.insert(homebutton); container.insert(homelink); } else if (type == 'org') { var homelink = new Element('a',{'class':'exploreToolbarIcon'}); homelink.href="https://test.evidence-hub.net/index.php?#org-list"; var homebutton = new Element('img',{'class':'active','src': 'https://test.evidence-hub.net/images/list.png', 'title':'Click to go to the Organizations List'}); homelink.insert(homebutton); container.insert(homelink); } else if (type == 'project') { var homelink = new Element('a',{'class':'exploreToolbarIcon'}); homelink.href="https://test.evidence-hub.net/index.php?#project-list"; var homebutton = new Element('img',{'class':'active','src': 'https://test.evidence-hub.net/images/list.png', 'title':'Click to go to the Projects List'}); homelink.insert(homebutton); container.insert(homelink); } else if (type == 'evidence') { var homelink = new Element('a',{'class':'exploreToolbarIcon'}); homelink.href="https://test.evidence-hub.net/index.php?#evidence-list"; var homebutton = new Element('img',{'class':'active','src': 'https://test.evidence-hub.net/images/list.png', 'title':'Click to go to the Evidence List'}); homelink.insert(homebutton); container.insert(homelink); } else if (type == 'web') { var homelink = new Element('a',{'class':'exploreToolbarIcon'}); homelink.href="https://test.evidence-hub.net/index.php?#web-list"; var homebutton = new Element('img',{'class':'active','src': 'https://test.evidence-hub.net/images/list.png', 'title':'Click to go to the Resources List'}); homelink.insert(homebutton); container.insert(homelink); } // print button var print = new Element("img", {'src': 'https://test.evidence-hub.net/images/printer.png', 'alt': 'Print this item', 'title': 'Print this item', 'class': 'active exploreToolbarIcon'}); container.insert(print); Event.observe(print,'click',function(){ if (from == 'trees') { printKnowledgeTreeExplore(NODE_ARGS, name, nodeid, node.name); } else { printNodeExplore(NODE_ARGS, name, nodeid); } }); // Add spam icon var spaming = new Element('img', {'class':'exploreToolbarIcon'}); if (node.status == 1) { spaming.setAttribute('alt', 'Reported as Spam'); spaming.setAttribute('title', 'This has been reported as Spam / Inappropriate content'); spaming.setAttribute('src', 'https://test.evidence-hub.net/images/spam-reported.png'); } else if (node.status == 0) { if(USER != ""){ spaming.setAttribute('alt', 'Report as Spam'); spaming.setAttribute('title', 'Report this as Spam / Inappropriate content'); spaming.setAttribute('src', 'https://test.evidence-hub.net/images/spam.png'); Event.observe(spaming,'click',function (){ reportNodeSpamAlert(this, type, node); } ); } else { spaming.setAttribute('alt', 'Sign In to Report as Spam'); spaming.setAttribute('title', 'Sign In to Report this as Spam / Inappropriate content'); spaming.setAttribute('src', 'https://test.evidence-hub.net/images/spam-disabled.png'); Event.observe(spaming,'click',function (){ $('loginsubmit').click(); return true; } ); } } container.insert(spaming); // edit button if (USER != "") { var userid = node.users[0].userid; if (userid == USER) { var otheruserconnections = node.otheruserconnections; if (type == 'issue') { var edit = new Element('img',{'class':'exploreToolbarIcon','alt':'Edit', 'title': 'Edit this Issue', 'src': 'https://test.evidence-hub.net/images/edit.png'}); Event.observe(edit,'click',function (){loadDialog('editissue',URL_ROOT+"ui/popups/issueedit.php?nodeid="+nodeid, 770,500)}); container.appendChild(edit); } if (type == 'challenge') { var edit = new Element('img',{'class':'exploreToolbarIcon','alt':'Edit', 'title': 'Edit this Key Challenge', 'src': 'https://test.evidence-hub.net/images/edit.png'}); Event.observe(edit,'click',function (){loadDialog('editchallenge',URL_ROOT+"ui/popups/challengeedit.php?nodeid="+nodeid, 770,500)}); container.appendChild(edit); } else if (type == 'claim') { var edit = new Element('img',{'class':'exploreToolbarIcon','alt':'Edit', 'title': 'Edit this Research Claim', 'src': 'https://test.evidence-hub.net/images/edit.png'}); Event.observe(edit,'click',function (){loadDialog('editclaim',URL_ROOT+"ui/popups/claimedit.php?nodeid="+nodeid, 770,500)}); container.appendChild(edit); } else if (type == 'solution') { var edit = new Element('img',{'class':'exploreToolbarIcon','alt':'Edit', 'title': 'Edit this Potential Solution', 'src': 'https://test.evidence-hub.net/images/edit.png'}); Event.observe(edit,'click',function (){loadDialog('editsolution',URL_ROOT+"ui/popups/solutionedit.php?nodeid="+nodeid, 770,500)}); container.appendChild(edit); } else if (type == 'org' || type == 'project') { var edit = new Element('img',{'class':'exploreToolbarIcon','alt':'Edit', 'title': 'Edit this item', 'src': 'https://test.evidence-hub.net/images/edit.png'}); Event.observe(edit,'click',function (){loadDialog('editorg',URL_ROOT+"ui/popups/organizationedit.php?nodeid="+nodeid, 770,500)}); container.appendChild(edit); } else if (type == 'evidence') { var edit = new Element('img',{'class':'exploreToolbarIcon','alt':'Edit', 'title': 'Edit this Evidence', 'src': 'https://test.evidence-hub.net/images/edit.png'}); Event.observe(edit,'click',function (){loadDialog('editevidence',URL_ROOT+"ui/popups/evidenceedit.php?nodeid="+nodeid, 770,500)}); container.appendChild(edit); } else if (type == 'web') { var edit = new Element('img',{'class':'exploreToolbarIcon','alt':'Edit', 'title': 'Edit this Resource', 'src': 'https://test.evidence-hub.net/images/edit.png'}); Event.observe(edit,'click',function (){loadDialog('editresource',URL_ROOT+"ui/popups/resourceedit.php?nodeid="+nodeid, 770,500)}); container.appendChild(edit); } if (otheruserconnections == 0) { var del = new Element('img',{'class':'exploreToolbarIcon','alt':'Delete', 'src': 'https://test.evidence-hub.net/images/delete.png'}); Event.observe(del,'click',function (){ deleteNode(node.nodeid, node.name, node.role.name, 'gotoHomeList', type); }); container.appendChild(del); } else { var del = new Element('img',{'alt':'Delete unavailable', 'title': 'You cannot delete this item. Someone else has connected to it', 'class':'exploreToolbarIcon', 'src': 'https://test.evidence-hub.net/images/delete-off.png'}); container.appendChild(del); } } } // follow button if (USER != "") { var followbutton = new Element('img', {'class':'exploreToolbarIcon'}); followbutton.setAttribute('src', 'https://test.evidence-hub.net/images/follow.png'); followbutton.setAttribute('alt', 'Follow'); followbutton.setAttribute('id','follow'+nodeid); followbutton.nodeid = nodeid; container.insert(followbutton); if (node.userfollow && node.userfollow == "Y") { Event.observe(followbutton,'click',function (){ unfollowNode(node, this, "refreshWidgetFollowers()") } ); followbutton.setAttribute('src', 'https://test.evidence-hub.net/images/follow.png'); followbutton.setAttribute('title', 'Unfollow this item...'); } else { Event.observe(followbutton,'click',function (){ followNode(node, this, "refreshWidgetFollowers()") } ); followbutton.setAttribute('src', 'https://test.evidence-hub.net/images/follow.png'); followbutton.setAttribute('title', 'Follow this item...'); } } else { container.insert(""); } // add explore button on all non explore views if (from != 'explore') { var explore = new Element('a',{'class':'exploreToolbarIcon'}); explore.href="https://test.evidence-hub.net/explore.php?id="+nodeid; var image = new Element('img',{'class':'active','src': 'https://test.evidence-hub.net/images/explore.png', 'alt':'Go to full information on this item.'}); explore.insert(image); explore.title = 'Go to full information on this item.'; container.appendChild(explore); } // Add Chat view button var chat = new Element('a',{'class':'exploreToolbarIcon'}); if (from == 'explore') { chat.style.marginLeft ='20px'; } chat.href="https://test.evidence-hub.net/chats.php?id="+nodeid; var image = new Element('img',{'class':'active','src': 'https://test.evidence-hub.net/images/chat.png', 'alt':'Click to view any Chats on this item'}); chat.insert(image); chat.title = 'Click to view any Chats on this item'; container.appendChild(chat); if (from == 'chat') { image.style.border = "1px dashed blue"; } // Add Linear/tree view button if (type != 'org' && type != 'project') { var tree = new Element('a',{'class':'exploreToolbarIcon'}); tree.href="https://test.evidence-hub.net/knowledgetrees.php?id="+nodeid; var image = new Element('img',{'class':'active','src': 'https://test.evidence-hub.net/images/knowledge-tree2.png', 'alt':'Click to view any Knowledge Trees for this item'}); tree.insert(image); tree.title = 'Click to view any Knowledge Trees for this item'; container.appendChild(tree); if (from == 'trees') { image.style.border = "1px dashed blue"; } } // Add Network view button var net = new Element('a',{'class':'exploreToolbarIcon'}); net.href="https://test.evidence-hub.net/networkgraph.php?id="+nodeid; var image = new Element('img',{'class':'active','src': 'https://test.evidence-hub.net/images/network-graph.png', 'alt':'Click to view the Network Graph for this item'}); net.insert(image); net.title = 'Click to view the Network Graph for this item'; container.appendChild(net); if (from == 'network') { image.style.border = "1px dashed blue"; } // Add Debate View button only on Issues } function buildChatHeader() { var keyDiv = new Element("div"); keyDiv.className = 'plainborder col-auto recentReply'; keyDiv.insert('Most Recent Reply'); if (USER != "") { var toolbar = new Element("div", {'id':'commenttoolbar', 'class':'widgetheaderinner widgetheaderinnerChat row'}); var link = new Element("a", {'title':"Start a new Chat about the current focal item", 'class':'col-auto'}); link.insert(' Start a New Chat'); Event.observe(link,"click", function(){ $('commenthidden').style.display = 'block'; $('commenttoolbar').style.display = 'none'; $('comment').focus(); }); toolbar.insert(link); toolbar.insert(keyDiv); $('chattoolbar').update(toolbar); var hidden = new Element("div", {'class':'widgetheaderinner', 'id':'commenthidden','class':'commentdiv', 'style':'display:none;'}); $('chattoolbar').insert(hidden); var box = new Element("textarea", {'value':'', 'id':'comment', 'class':'form-control', 'aria-label':'enter comment'}); hidden.insert(box); var button = new Element("input", {'value':'Add', 'type':'button', 'class':'btn btn-primary m-2 ms-0'}); Event.observe(button,"click", function(){ var comment = $('comment').value; $('comment').value = ""; $("chatarea").style.display = 'block'; $('commenthidden').style.display = 'none'; $('commenttoolbar').style.display = 'block'; if (comment != "") { var type = "Comment"; var reqUrl = SERVICE_ROOT + "&method=connectnodetocomment&nodetypename="+type+"&nodeid="+chatnodeid+"&comment="+encodeURIComponent(comment); new Ajax.Request(reqUrl, { method:'get', onSuccess: function(transport){ var json = transport.responseText.evalJSON(); if(json.error){ alert(json.error[0].message); } else { getAllChatConnections(); } } }); } }); hidden.insert(button); var button = new Element("input", {'value':'Close', 'type':'button', 'class':'btn btn-secondary m-2'}); Event.observe(button,"click", function(){ $('comment').value = ""; $('chatarea').style.display = 'block'; $('commenthidden').style.display = 'none'; $('commenttoolbar').style.display = 'block'; }); hidden.insert(button); } else { var toolbar = new Element("div", {'id':'commenttoolbar', 'class':'widgetheaderinner '}); let spancontent = '