Commit 9630df20 authored by Jeremy Fischer's avatar Jeremy Fischer
Browse files

Add Basic MS-Status propagation (BUGGY!!)

Add Basic Document viewer
Add Zoom Buttons
parent cd82eb08
<div id="graphView" style="box-sizing: border-box; display: inline-block; position: absolute; top: 4.3em; left: 0px; width: 100%; height: calc( 100% - 4.3em); overflow: hidden;">
<div id="graph" style="border: 3px dotted; width: 10000px; height: 10000px; position: absolute; left: -5003px; top: -5003px;">
<svg id="graphLines" width="10000" height="10000" style="pointer-events: none;">
</svg>
</div>
<a style="position: absolute; bottom: 1em; right: 1em;" onclick="graphZoom(1);" class="btn-floating btn red"> <b style="font-size: 1.5em;">+</b> </a>
<a style="position: absolute; bottom: 4em; right: 1em;" onclick="graphZoom(-1);" class="btn-floating btn red"> <b style="font-size: 1.5em;">-</b> </a>
</div>
\ No newline at end of file
......@@ -11,6 +11,12 @@
<li $menu_leaderboard_class$>
<a onclick="nav_leaderboard()">$interface_tab_leaderboard_title$</a>
</li>
<li>
<a onclick="mscalc()">MS-Update</a>
</li>
<!-- <li $menu_planning_class$>
<a onclick="nav_planning()">$interface_tab_planning_title$</a>
</li>-->
</ul>
</div>
</nav>
\ No newline at end of file
......@@ -132,6 +132,8 @@ if (isset($_REQUEST['setNodeData'])) {
$data["isRoot"] = ($_REQUEST['isRoot'] == "true");
if (isset($_REQUEST['isDeleted']))
$data["isDeleted"] = ($_REQUEST['isDeleted'] == "true");
if (isset($_REQUEST['key']) && isset($_REQUEST['value']))
$data["kvdb_"+$_REQUEST['key']] = $_REQUEST['value'];
if (count($data) > 0) {
putNewData(array("nodes" => array($_REQUEST["node"] => $data)));
die();
......
......@@ -484,6 +484,17 @@ if (declare_load("appclient") !== TRUE)
}
}
function graphZoom(dist){
if (dist < 0) {
userScale += userScale * 0.1;
} else {
userScale -= userScale * 0.1;
}
if (userScale < 0.02)
userScale = 0.02;
calcScale(graph);
}
function calcScale(graph)
{
graph.style.transform = "translate("+userGraphOffset+") scale(" + userScale + ")";
......@@ -504,6 +515,7 @@ if (declare_load("appclient") !== TRUE)
updateNotificationBadge();
initGraph();
setTimeout(renderNodeTree,500);
setTimeout(mscalc,5000);
}
......@@ -743,6 +755,7 @@ if (declare_load("appclient") !== TRUE)
var currentDetailNode = "";
var currentDetailNodeEditor = null;
var currentDetailNodeRenderedDoc = "";
function nodeDetail(id){
if(id == undefined) return;
currentDetailNode = id.replace("node_","");
......@@ -769,7 +782,7 @@ if (declare_load("appclient") !== TRUE)
var titleCard = document.createElement("div");
titleCard.className = "card";
titleCard.setAttribute("style","max-height: 23em");
titleCard.innerHTML = '<div class="card-content black-text"><a onclick="node_edit_property_title_desc(this)" class="right btn-floating waves-effect waves-light red"><i class="material-icons">create</i></a><div style="transform: scale(0.5); transform-origin: top left; width: 200%; height: 50%; overflow: hidden; position: relative; top: -4em;" id="currentNodeDescPreview"></div></div><div style="visibility: hidden; position: absolute; overflow: hidden; height: 100%; top: 0%;" id="currentNodeDescEditorWrapper"><textarea height="100%" id="currentNodeDescEditor"></textarea></div>';
titleCard.innerHTML = '<div class="card-content black-text"><a onclick="node_edit_property_title_desc(this)" class="right btn-floating waves-effect waves-light red"><i class="material-icons">create</i></a><a onclick="node_view_doc(this)" class="right btn-floating waves-effect waves-light red"><i class="material-icons">pageview</i></a><div style="transform: scale(0.5); transform-origin: top left; width: 200%; height: 50%; overflow: hidden; position: relative; top: -4em;" id="currentNodeDescPreview"></div></div><div style="visibility: hidden; position: absolute; overflow: hidden; height: 100%; top: 0%;" id="currentNodeDescEditorWrapper"><textarea height="100%" id="currentNodeDescEditor"></textarea></div>';
flow.appendChild(titleCard);
//Normal State Card:
......@@ -919,12 +932,21 @@ if (declare_load("appclient") !== TRUE)
}, "|","bold","italic","strikethrough","heading","heading-smaller","heading-bigger","code","quote","table","unordered-list","ordered-list","link","image","horizontal-rule","|","preview","side-by-side","fullscreen","guide"]
});
console.log(currentDetailNodeEditor);
document.getElementById("currentNodeDescPreview").innerHTML = currentDetailNodeEditor.options.previewRender(descText);
currentDetailNodeRenderedDoc = currentDetailNodeEditor.options.previewRender(descText);
document.getElementById("currentNodeDescPreview").innerHTML = currentDetailNodeRenderedDoc;
//currentDetailNodeEditor.togglePreview();
console.log(currentDetailNodeEditor.options.previewRender(descText));
console.log(currentDetailNodeRenderedDoc);
details_show();
}
function node_view_doc(){
var win = window.open("#docview","","location=0,menubar=0,status=0,toolbar=0,height=600px,width=400px,scrollbars=1");
win.onload = function(){
win.document.body.innerHTML = '<head><link rel="stylesheet" href="res/materialize/css/materialize.css" /> <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"> <meta name="viewport" content="width=device-width, initial-scale=1.0"/></head><body>'
+ '<a style="opacity: 0.2;">Document Rendered at ' + new Date().toISOString() + '.</a>' + '<br>' + currentDetailNodeRenderedDoc +'</body>';
};
}
function node_delete_remap(){
var node = nodeTree[currentDetailNode];
async_post("?addChildren&node="+node["parent"], "&children="+encodeURIComponent(JSON.stringify(node["children"])), function() {
......@@ -1621,6 +1643,34 @@ if (declare_load("appclient") !== TRUE)
return member;
}
}
function getParentNodeAtLevel(node, targetLevel){
if(node["level"] > targetLevel){
return getParentNodeAtLevel(nodeTree[node["parent"]], targetLevel);
}else{
if(node["level"] == targetLevel){
return node;
}else{
return nodeTree[node["parent"]];
}
}
}
function mscalc(){
var nodes = [];
for(node in nodeTree){
if(nodeTree[node]["level"] >=3){
nodes.push(nodeTree[node]);
}
}
for(node in nodes){
if(getParentNodeAtLevel(nodes[node],3)["state"] == 0){
document.getElementById("node_"+nodes[node]["self"]).style.opacity = "0.5";
}
}
}
updateTeamData();
setInterval(updateTeamData, 120000);
......@@ -1635,6 +1685,8 @@ if (declare_load("appclient") !== TRUE)
setTimeout(nav_graph(),10);
}else if(window.location.hash.substring(1,12) == "leaderboard"){
setTimeout(nav_leaderboard(),10);
}else if(window.location.hash.substring(1,8) == "docview"){
//Wait for Window to get populated.
}else{
setTimeout(nav_dashboard(),10);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment