annotate public/viewer/revisionviewer.html @ 123:bb930ac4cfd8 draft

remove createOptionTag method
author Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
date Fri, 19 Apr 2013 20:29:44 +0900
parents 9cfb52e94bd0
children 26896f0aed2a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
87
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
1 <meta http-equiv="content-type" content="text/html;charset=utf-8" />
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
2 <title>R-Consensus</title>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
3 <link rel='stylesheet' href="form.css">
119
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
4 <link rel="stylesheet" href="jquery-ui.css">
87
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
5 <script src='form.js'></script>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
6 <script type="text/javascript" src="js/lib/jquery-1.8.1-min.js"></script>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
7 <script type="text/javascript" src="js/lib/jquery-ui-1.8.23-min.js"></script>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
8 <script type="text/javascript" src="js/lib/jquery.ui.touch-punch.min.js"></script>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
9 <script type="text/javascript" src="js/lib/jsBezier-0.4-min.js"></script>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
10 <script type="text/javascript" src="js/1.3.15/jsPlumb-util-1.3.15-RC1.js"></script>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
11 <script type="text/javascript" src="js/1.3.15/jsPlumb-dom-adapter-1.3.15-RC1.js"></script>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
12 <script type="text/javascript" src="js/1.3.15/jsPlumb-1.3.15-RC1.js"></script>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
13 <script type="text/javascript" src="js/1.3.15/jsPlumb-defaults-1.3.15-RC1.js"></script>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
14 <script type="text/javascript" src="js/1.3.15/jsPlumb-renderers-svg-1.3.15-RC1.js"></script>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
15 <script type="text/javascript" src="js/1.3.15/jsPlumb-renderers-canvas-1.3.15-RC1.js"></script>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
16 <script type="text/javascript" src="js/1.3.15/jsPlumb-renderers-vml-1.3.15-RC1.js"></script>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
17 <script type="text/javascript" src="js/1.3.15/jquery.jsPlumb-1.3.15-RC1.js"></script>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
18 <script type="text/javascript" src='treeArrangement.js'></script>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
19 <script type="text/javascript">
119
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
20 var LOAD_INTERVAL=5;
87
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
21 var BASE_URL="";
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
22 if(!Array.prototype.filter){
119
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
23 Array.prototype.filter=function(func){
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
24 var arr=[];
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
25 for(var i=0;i<this.length;i++)if(func(this[i]))arr.push(this[i]);
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
26 return arr;
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
27 }
87
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
28 }
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
29
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
30 var userName;
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
31 var treeInfo;
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
32 var userList=[];
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
33 var root_id;
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
34 function loadConsensus(id){
119
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
35 function onload(json){
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
36 document.title="R-Consensus:"+json.toulmin.title;
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
37 $("#headertitle_main").text(json.toulmin.title)
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
38 if(treeInfo){
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
39 updateToNew(json);
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
40 }else{
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
41 console.log(JSON.parse(JSON.stringify(json)));
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
42 treeInfo=createJSONTreeInfo(json)
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
43 //userList=getUserListFromJSONTree(treeInfo.root);
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
44 showUserList([]);
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
45 updateNode(treeInfo.root);
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
46 updateTree();
87
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
47 }
119
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
48 }
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
49 $.ajax({
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
50 url:BASE_URL+"/consensus/browse/"+id,
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
51 success:function(o){onload(o)},
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
52 type:"GET",cache:false,
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
53 error:function(o){console.log("ERROR",o)}
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
54 });
87
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
55 }
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
56 function loadUserList(){
119
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
57 $.ajax({
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
58 url:BASE_URL+"/users/all",
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
59 success:function(o){userList=o.sort();showUserList([]);},
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
60 type:"GET",cache:false,
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
61 error:function(o){console.log("ERROR",o)}
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
62 });
87
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
63 }
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
64
88
75d45f808217 modified revisionviewer.html
one
parents: 87
diff changeset
65 function loadRevisionInfo(consensus_id) {
119
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
66 $.ajax({
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
67 url:BASE_URL+"/claims/get/revision/"+consensus_id,
123
bb930ac4cfd8 remove createOptionTag method
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 122
diff changeset
68 success:function(o){ console.log("revision = "+ o)
bb930ac4cfd8 remove createOptionTag method
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 122
diff changeset
69 createSlider(o);
122
9cfb52e94bd0 implemented slider
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 119
diff changeset
70 },
119
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
71 type:"GET",cache:false,
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
72 error:function(o){console.log("ERROR",o)}
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
73 });
88
75d45f808217 modified revisionviewer.html
one
parents: 87
diff changeset
74 }
75d45f808217 modified revisionviewer.html
one
parents: 87
diff changeset
75
90
812bcfae297f modified revisionviewer.html
one
parents: 89
diff changeset
76 function changeRevision(id) {
812bcfae297f modified revisionviewer.html
one
parents: 89
diff changeset
77 root_id = id;
812bcfae297f modified revisionviewer.html
one
parents: 89
diff changeset
78 loadConsensus(id);
812bcfae297f modified revisionviewer.html
one
parents: 89
diff changeset
79 }
812bcfae297f modified revisionviewer.html
one
parents: 89
diff changeset
80
122
9cfb52e94bd0 implemented slider
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 119
diff changeset
81 var REVISION_INFO = {};
9cfb52e94bd0 implemented slider
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 119
diff changeset
82 var STEP = 5;
9cfb52e94bd0 implemented slider
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 119
diff changeset
83 var SLIDE_DISTANCE = 20;
9cfb52e94bd0 implemented slider
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 119
diff changeset
84 function createSlider(revisionInfo) {
9cfb52e94bd0 implemented slider
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 119
diff changeset
85 $('#slider').css('width',revisionInfo.length * SLIDE_DISTANCE);
9cfb52e94bd0 implemented slider
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 119
diff changeset
86 var slideMax = 0;
9cfb52e94bd0 implemented slider
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 119
diff changeset
87 for (var i=0; i<revisionInfo.length; i++) {
9cfb52e94bd0 implemented slider
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 119
diff changeset
88 var r = revisionInfo[i];
9cfb52e94bd0 implemented slider
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 119
diff changeset
89 REVISION_INFO[i*STEP] = r;
9cfb52e94bd0 implemented slider
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 119
diff changeset
90 slideMax = i*STEP;
9cfb52e94bd0 implemented slider
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 119
diff changeset
91 }
9cfb52e94bd0 implemented slider
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 119
diff changeset
92 var MAX_REV = revisionInfo.length-1;
9cfb52e94bd0 implemented slider
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 119
diff changeset
93 $('#revisionDisplayId').val("0/"+MAX_REV);
9cfb52e94bd0 implemented slider
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 119
diff changeset
94 $('#slider').slider({ step:STEP,
9cfb52e94bd0 implemented slider
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 119
diff changeset
95 max:slideMax,
123
bb930ac4cfd8 remove createOptionTag method
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 122
diff changeset
96 slide: function(event, ui){ var id = REVISION_INFO[ui.value];
122
9cfb52e94bd0 implemented slider
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 119
diff changeset
97 $('#revisionDisplayId').val(ui.value/STEP+"/"+MAX_REV);
9cfb52e94bd0 implemented slider
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 119
diff changeset
98 changeRevision(id);
9cfb52e94bd0 implemented slider
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 119
diff changeset
99 },
9cfb52e94bd0 implemented slider
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 119
diff changeset
100 // stop: function(event, ui){ console.log(ui.value); }
9cfb52e94bd0 implemented slider
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 119
diff changeset
101 });
9cfb52e94bd0 implemented slider
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 119
diff changeset
102 $('#slider').slider('option','value',0);
9cfb52e94bd0 implemented slider
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 119
diff changeset
103 $('#slider').slider();
9cfb52e94bd0 implemented slider
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 119
diff changeset
104 }
9cfb52e94bd0 implemented slider
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 119
diff changeset
105
87
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
106 $(function(){
119
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
107 userName=localStorage.userName;
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
108 if(userName)start();
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
109 else $("#loginPopup").css("display","block");
87
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
110 })
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
111 function login(uname){
119
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
112 userName=localStorage.userName=uname;
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
113 start();
87
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
114 }
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
115 function start(){
119
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
116 popupInit();
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
117 jsPlumb.importDefaults({
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
118 Connector : [ "Straight", { curviness:50 } ],
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
119 PaintStyle : { strokeStyle:"gray", lineWidth:2 },
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
120 EndpointStyle : {},
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
121 Anchors: ["BottomCenter","TopCenter"]
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
122 });
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
123 var consensus_id=(location.search.match("[0-9]+")||[])[0];
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
124 if(consensus_id){
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
125 root_id=consensus_id;
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
126 loadUserList();
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
127 loadRevisionInfo(consensus_id);
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
128 loadConsensus(consensus_id);
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
129 }else{
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
130 document.body.innerHTML="<div style='color:white;font-size:64px'>No ClaimID Specified.<br><a href='index.html' style='color:#88f'>back</a></div>";
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
131 }
87
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
132 }
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
133
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
134 function updateToNew(json){
119
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
135 var t2=createJSONTreeInfo(json)
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
136 updateJSONTreeDiff(treeInfo.root,t2.root);
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
137
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
138 updateNode(treeInfo.root);
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
139 treeInfo.newLayout=t2.layout;
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
140 var cnt=0,time=500;
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
141 var time0=new Date();
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
142 var prevCnt=0;
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
143 function tfunc(t){return 2*t-t*t}
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
144 function animation(){
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
145 var cnt=(new Date()-time0)/time;
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
146 if(cnt<1){
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
147 if(prevCnt!=cnt){
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
148 var pt=tfunc(prevCnt);
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
149 var t=tfunc(cnt);
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
150 animateTree((t-1)/(pt-t));
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
151 prevCnt=cnt;
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
152
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
153 }
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
154 setTimeout(animation,10);
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
155 }else{
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
156 animateTree(0);
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
157 }
87
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
158 updateNode(treeInfo.root);
119
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
159 updateTree();
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
160 }
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
161 animation();
87
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
162 }
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
163
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
164 var ViewParam={
119
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
165 offsetTop:100,
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
166 offsetBottom:100,
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
167 offsetLeft:100,
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
168 offsetRight:100,
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
169 nodeWidth:120,
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
170 nodeHeight:60,
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
171 intervalX:140,
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
172 intervalY:120
87
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
173 };
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
174
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
175 function animateTree(t){
119
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
176 function animateNodePosition(node,t){
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
177 node.position.x=(node.position.x*t+node.newPosition.x)/(1+t);
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
178 node.position.y=(node.position.y*t+node.newPosition.y)/(1+t);
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
179 for(var i=0;i<node.mentions.length;i++){
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
180 animateNodePosition(node.mentions[i],t);
87
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
181 }
119
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
182 if(t==0){
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
183 if(node.newPosition.remove){
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
184 jsPlumb.removeAllEndpoints(node.view);
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
185 $(node.view).remove();
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
186 }
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
187 node.mentions=node.mentions.filter(function(n){return !n.newPosition.remove});
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
188 }
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
189 }
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
190 animateNodePosition(treeInfo.root,t);
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
191 treeInfo.layout.left=(treeInfo.layout.left*t+treeInfo.newLayout.left)/(1+t);
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
192 treeInfo.layout.right=(treeInfo.layout.right*t+treeInfo.newLayout.right)/(1+t);
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
193 treeInfo.layout.depth=(treeInfo.layout.depth*t+treeInfo.newLayout.depth)/(1+t);
87
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
194 }
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
195
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
196 function updateTree(){
119
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
197 with(treeInfo.layout){
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
198 $("#treeRoot").css({
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
199 left:ViewParam.offsetLeft+ViewParam.nodeWidth/2-ViewParam.intervalX*left,
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
200 top:ViewParam.offsetTop+ViewParam.nodeHeight/2});
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
201 $("#treeMain").css({
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
202 width:ViewParam.intervalX*(right-left)+ViewParam.nodeWidth+ViewParam.offsetLeft+ViewParam.offsetRight,
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
203 height:ViewParam.intervalY*(depth-1)+ViewParam.nodeHeight+ViewParam.offsetTop+ViewParam.offsetBottom,
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
204 top:50});
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
205 }
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
206 jsPlumb.repaintEverything();
87
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
207 }
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
208
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
209
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
210 var relationJPMap={
119
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
211 suggestion:"提案",
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
212 refutation:"反論",
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
213 question:"質問"
87
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
214 };
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
215 function updateNode(node){
119
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
216 if(updateClaimElement(node)){
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
217 var fc=$("#treeRoot")[0].firstChild;
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
218 if(fc)$("#treeRoot")[0].insertBefore(node.view[0],fc);
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
219 else $("#treeRoot").append(node.view);
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
220 }
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
221 node.view.css({
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
222 left:node.position.x*ViewParam.intervalX-ViewParam.nodeWidth/2,
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
223 top:node.position.y*ViewParam.intervalY-ViewParam.nodeHeight/2
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
224 });
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
225 var childs=node.mentions;
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
226 for(var i=0;i<childs.length;i++){
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
227 var child=childs[i];
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
228 var created=!child.view;
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
229 updateNode(child);
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
230 if(created){
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
231 var c=jsPlumb.connect({source:node.view[0],target:child.view[0]});
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
232 c.setLabel({label:"<span style='color:white'>"+(relationJPMap[child.relation]||child.relation)+"</span>",cssStyle:"color:white"});
87
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
233 }
119
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
234 }
87
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
235 }
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
236
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
237 var focusedUser=null;
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
238 function setFocusedShadowEverything(){
119
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
239 function recFocusShadow(node){
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
240 setFocusedShadow(node);
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
241 for(var i=0;i<node.mentions.length;i++){
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
242 recFocusShadow(node.mentions[i]);
87
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
243 }
119
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
244 }
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
245 recFocusShadow(treeInfo.root);
87
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
246 }
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
247 function setFocusedShadow(node){
119
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
248 var name=focusedUser||userName;
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
249 var color;
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
250 // console.log(node.info.author)
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
251 if(node.info.author==name)color="#afa";
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
252 else{
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
253 var users=node.info.users,status;
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
254 for(var i=0;i<users.length;i++){
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
255 var u=users[i];
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
256 if(u.id==name){status=u.status;break;}
87
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
257 }
119
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
258 color=({agreed:"#aaf",denied:"#faa",pend:"white",unknown:"white"})[status];
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
259 }
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
260 node.view.css("box-shadow",color?color+" 0 0 30px":"none");
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
261 }
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
262 function appendStatusElement(viewDiv, status){
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
263 var statusView = $("<div class='nodeStatus'/>");
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
264 statusView.text(status);
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
265 statusView.css({
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
266 left:0,
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
267 top:-5
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
268 });
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
269 viewDiv[0].appendChild(statusView[0]);
87
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
270 }
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
271 function updateClaimElement(node){
119
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
272 var created=false;
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
273 if(!node.view){
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
274 created=true
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
275 node.view=$("<div class='claimNode'/>");
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
276 node.view.click(function(){showClaim(node);});
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
277 node.view.hover(
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
278 function(){div.css("box-shadow","white 0 0 50px");showUserList(node.info.users,node.info.author)},
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
279 function(){try{setFocusedShadow(node);}catch(e){/*console.log(e)*/;}showUserList([])}
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
280 )
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
281 }
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
282 setFocusedShadow(node);
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
283 var div=node.view;
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
284 div.text(node.info.toulmin.title);
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
285 appendStatusElement(node.view, node.info.status);
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
286 var statusBackground={pass:"#aaf",unknown:"#fff",failed:"#faa",fail:"#faa"};
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
287 var statusBorder={pass:"#66a",unknown:"#aaa",failed:"#a66",fail:"#a66"};
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
288 div.css("background",statusBackground[node.info.status]||"white");
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
289 div.css("border-color",statusBorder[node.info.status]||"white");
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
290 return created;
87
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
291 }
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
292
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
293
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
294 function showUserList(users,author){
119
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
295 var statusMap={};
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
296 var userListElement=$(".userList");
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
297 userListElement.text('')
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
298 if(author)statusMap['#'+author]='author';
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
299 for(var i=0;i<users.length;i++){
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
300 statusMap['#'+users[i].id]=users[i].status;
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
301 }
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
302 for(var i=0;i<userList.length;i++){
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
303 var u=userList[i];
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
304 var ue=createUserElement(u==userName?"あなた("+u+")":u,statusMap['#'+u]);
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
305 if(u==userName){
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
306 ue.css({fontWeight:"bold"})
87
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
307 }
119
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
308 ue.appendTo(userListElement);
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
309 with({name:u,element:ue}){
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
310 ue.hover(
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
311 function(){
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
312 element.css("opacity",1);
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
313 focusedUser=name;setFocusedShadowEverything()
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
314 },
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
315 function(){
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
316 element.css("opacity",0.5);
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
317 focusedUser=userName;setFocusedShadowEverything()
87
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
318 }
119
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
319 )
87
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
320 }
119
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
321
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
322 }
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
323 $(".userList").css("opacity","1");
87
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
324 }
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
325 function hideUserList(){
119
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
326 $(".userStatus").css("background","none");
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
327 $(".userItem").css("opacity","1");
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
328 $(".userList").css("opacity","0.2");
87
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
329 }
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
330 </script>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
331 <style>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
332 body{background-color:black;}
122
9cfb52e94bd0 implemented slider
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 119
diff changeset
333 p.revisionDisplay{
9cfb52e94bd0 implemented slider
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 119
diff changeset
334 position:absolute;
9cfb52e94bd0 implemented slider
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 119
diff changeset
335 left:5px;
9cfb52e94bd0 implemented slider
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 119
diff changeset
336 top:60px;
9cfb52e94bd0 implemented slider
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 119
diff changeset
337 z-index:5;
9cfb52e94bd0 implemented slider
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 119
diff changeset
338 color:white;
9cfb52e94bd0 implemented slider
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 119
diff changeset
339 }
119
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
340 div.revisionSlider{
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
341 position:absolute;
122
9cfb52e94bd0 implemented slider
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 119
diff changeset
342 left:0;top:100px;
119
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
343 z-index:5;
aa5daf38f3e9 viewer.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 91
diff changeset
344 width:50%;
87
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
345 }
122
9cfb52e94bd0 implemented slider
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 119
diff changeset
346
87
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
347 </style>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
348 <script>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
349 function resetMentionForm(){
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
350 var keys=['title','contents','w','d','b','q','r'];
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
351 for(var i=0;i<keys.length;i++)$("#mentionform_"+keys[i]).val("");
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
352 $("#mention_option")[0].className="option";
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
353 }
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
354 var formClaim;
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
355 var claimUserMap,mentionUserMap;
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
356 function showClaim(claim){
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
357 formClaim=claim;
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
358 var info=claim.info;
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
359 var keys=['title','contents','w','d','b','q','r'];
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
360 for(var i=0;i<keys.length;i++)$("#claimform_"+keys[i]).val(info.toulmin[keys[i]]);
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
361
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
362 var status="";
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
363 for(var i=0;i<info.users.length;i++)if(info.users[i].id==userName)status=info.users[i].status;
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
364 var op=({denied:1,pend:2,agreed:3})[status];
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
365
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
366 $("#claim_status").text(info.status)
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
367 $("#claim_status").css("color",({pass:"blue",failed:"red",fail:"red",unknown:"black"})[info.status]);
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
368 $("#agree_option")[0].className="option"+(op?" option"+op:"");
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
369 $("#agree_option").css("display",status?"block":"none");
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
370
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
371 $("#claim_button").css("display",(userName==info.author)?"block":"none");
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
372 $("#claimvote_option").css("display",status?"block":"none");
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
373
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
374 $("#claimbody")[0].className="claim_contents";
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
375 $("#mentionbody")[0].className="mention_contents";
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
376
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
377 $("#claim_author").text(info.author);
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
378 $("#mention_author").text(userName);
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
379 $("#claimvote_option")[0].className="option option"+(claim.agreeType=="majority"?2:1);
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
380 $("#mentionvote_option")[0].className="option option1";
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
381 var stateMap={};
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
382 for(var i=0;i<info.users.length;i++)stateMap['#'+info.users[i].id]=info.users[i].status;
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
383 claimUserMap=new HashSet(info.users.map(function(u){return u.id}));
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
384 mentionUserMap=new HashSet();
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
385 $("#claim_users").text("");
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
386 $("#mention_users").text("");
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
387 if(userName!=info.author)mentionUserMap.add(info.author);
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
388 for(var i=0;i<userList.length;i++){
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
389 var name=userList[i];
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
390 if(name!=info.author){
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
391 var status=stateMap['#'+name];
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
392 createUserSelectItem(name,status,claimUserMap).appendTo($("#claim_users"));
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
393 }if(name!=userName){
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
394 createUserSelectItem(name,name==info.author?"unknown":"",mentionUserMap).appendTo($("#mention_users"));
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
395 }
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
396 }
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
397 resetMentionForm();
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
398 popupShowMain()
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
399 }
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
400
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
401
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
402 function claimSave(){
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
403 var claim=formClaim;
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
404 var info=claim.info;
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
405 var id=claim.id||root_id;
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
406 var agreeType=[null,"unanimously","majority"][($('#claimvote_option')[0].className.match("[0-9]+")||"0")[0]];
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
407 var title=$('#claimform_title').val();
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
408 var contents=$('#claimform_contents').val();
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
409 var d=$('#claimform_d').val();
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
410 var w=$('#claimform_w').val();
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
411 var b=$('#claimform_b').val();
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
412 var q=$('#claimform_q').val();
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
413 var r=$('#claimform_r').val();
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
414 var users=claimUserMap.toArray();
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
415 var errors=[];
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
416 if(!title)errors.push("タイトル");
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
417 if(!agreeType)errors.push("採決方法");
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
418 if(users.length==0)errors.push("同意を取るユーザ");
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
419 if(errors.length){
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
420 alert("未入力項目:"+errors.join(", "));
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
421 }else{
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
422 $.ajax({
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
423 url:BASE_URL+"/claims/edit/"+id,
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
424 success:function(o){loadConsensus(root_id)},
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
425 type:"POST",cache:false,
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
426 contentType:"application/json",
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
427 data:JSON.stringify({type:agreeType,toulmin:{title:title,contents:contents,q:q,d:d,w:w,b:b,r:r},author:userName,users:users}),
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
428 error:function(o){console.log("ERROR",o)}
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
429 });
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
430 popupHideAll();
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
431 }
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
432 }
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
433 function claimAgree(status){
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
434 var claim=formClaim;
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
435 var info=claim.info;
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
436 var id=claim.id||root_id;
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
437 $.ajax({
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
438 url:BASE_URL+"/claims/answer/"+id+"/"+userName+"/"+status,
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
439 success:function(o){loadConsensus(root_id)},
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
440 type:"POST",cache:false,
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
441 error:function(o){console.log("ERROR",o)}
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
442 });
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
443 popupHideAll();
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
444 }
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
445 function mentionSave(){
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
446 var claim=formClaim;
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
447 var info=claim.info;
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
448 var id=claim.id||root_id;
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
449 var mentionType=[null,"refutation","question","suggestion"][($('#mention_option')[0].className.match("[0-9]+")||"0")[0]];
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
450 var agreeType=[null,"unanimously","majority"][($('#mentionvote_option')[0].className.match("[0-9]+")||"0")[0]];
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
451 var title=$('#mentionform_title').val();
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
452 var contents=$('#mentionform_contents').val();
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
453 var d=$('#mentionform_d').val();
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
454 var w=$('#mentionform_w').val();
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
455 var b=$('#mentionform_b').val();
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
456 var q=$('#mentionform_q').val();
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
457 var r=$('#mentionform_r').val();
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
458 var users=mentionUserMap.toArray();
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
459 var author=userName;
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
460 var errors=[];
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
461 if(!title)errors.push("タイトル");
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
462 if(!agreeType)errors.push("採決方法");
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
463 if(!mentionType)errors.push("反論質問提案");
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
464 if(users.length==0)errors.push("同意を取るユーザ");
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
465 if(errors.length){
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
466 alert("未入力項目:"+errors.join(", "));
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
467 }else{
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
468 $.ajax({
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
469 url:BASE_URL+"/claims/"+mentionType+"/"+id+"/create",
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
470 success:function(o){loadConsensus(root_id)},
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
471 type:"POST",cache:false,contentType:"application/json",
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
472 data:JSON.stringify({type:agreeType,toulmin:{title:title,contents:contents,q:q,d:d,w:w,b:b,r:r},author:author,users:users}),
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
473 error:function(o){console.log("ERROR",o)}
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
474 });
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
475 popupHideAll();
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
476 }
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
477 }
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
478
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
479 </script>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
480 <div class='header'>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
481 <nobr id='header_title'><a href='index.html'>Home</a><span id='headertitle_main' style='margin-left:40px;'>loading</span></nobr>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
482 </div>
122
9cfb52e94bd0 implemented slider
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 119
diff changeset
483 <p class='revisionDisplay'>
9cfb52e94bd0 implemented slider
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 119
diff changeset
484 <label for="revInfo">Revision Number:</label>
9cfb52e94bd0 implemented slider
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 119
diff changeset
485 <input type="text" id="revisionDisplayId" style='background-color:black; border:0; color:white;'/>
9cfb52e94bd0 implemented slider
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 119
diff changeset
486 </p>
9cfb52e94bd0 implemented slider
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 119
diff changeset
487 <div class="revisionSlider" id="slider" style='left:20px;' ></div>
87
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
488
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
489 <div style="position:relative;left:0;top:0;" id='treeMain'>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
490 <div style="position:absolute;width:0;height:0;left:100;" id='treeRoot'>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
491 </div>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
492 </div>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
493
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
494 <div class='userList'></div>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
495
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
496
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
497 <div id='popup_base' style='display:none;z-index:100'>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
498 <div id='popup_background'></div>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
499 <div class='popup_center'>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
500 <div class='claiminfo' id='claiminfo'>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
501 <div class='claim_title'><input placeholder="title" id='claimform_title'></div>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
502 <div id='claimbody' class='claim_contents'>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
503 <div class='claim_menu'>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
504 <div class='menu_item menu_contents' onclick="$('#claimbody')[0].className='claim_contents'">Contents</div>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
505 <div class='menu_item menu_toulmin' onclick="$('#claimbody')[0].className='claim_toulmin'">Toulmin</div>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
506 <div class='menu_item menu_users' onclick="$('#claimbody')[0].className='claim_users'">Users</div>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
507 <div id='claim_status'></div>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
508 </div>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
509 <div class='claim_main main_contents'>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
510 <textarea placeholder='contents' id='claimform_contents'></textarea>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
511 </div>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
512 <div class='claim_main main_toulmin'>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
513 <div class='item_toulmin'><span>データ</span><input id='claimform_d'></div>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
514 <div class='item_toulmin'><span>論拠 </span><input id='claimform_w'></div>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
515 <div class='item_toulmin'><span>裏付け</span><input id='claimform_b'></div>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
516 <div class='item_toulmin'><span>限定詞</span><input id='claimform_q'></div>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
517 <div class='item_toulmin'><span>反駁 </span><input id='claimform_r'></div>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
518 </div>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
519 <div class='claim_main main_users'>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
520 <span class='author_label'>作者:</span>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
521 <span class='author_name' id='claim_author'></span>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
522 <div class='option option1' id='claimvote_option'>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
523 <span class='option option1 vote1' onclick="$('#claimvote_option')[0].className='option option1'">全会一致</span>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
524 <span class='option option2 vote2' onclick="$('#claimvote_option')[0].className='option option2'">多数決</span>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
525 </div>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
526 <div id='claim_users'></div>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
527 </div>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
528 </div>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
529 <div class='claim_footer'>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
530 <span onclick='popupShowSubMain()' class='button mention_button'>mention</span>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
531 <div class='option' id='agree_option'>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
532 <span class='option option1 agree1' onclick="$('#agree_option')[0].className='option option1';claimAgree('denied');">否認</span>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
533 <span class='option option2 agree2' onclick="$('#agree_option')[0].className='option option2';claimAgree('pend');">保留</span>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
534 <span class='option option3 agree3' onclick="$('#agree_option')[0].className='option option3';claimAgree('agreed');">合意</span>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
535 </div>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
536 <div id='claim_button'>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
537 <span class='button cancel' onclick="popupHideAll()">cancel</span>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
538 <span class='button save' onclick="claimSave()">save</span>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
539 </div>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
540 </div>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
541 <div class='cover' id='claim_cover'></div>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
542 </div>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
543
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
544
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
545 <div class='mentioninfo' id='mentioninfo'>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
546 <div class='claim_title'><input placeholder="title" id='mentionform_title'></div>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
547 <div id='mentionbody' class='mention_contents'>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
548 <div class='claim_menu'>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
549 <div class='menu_item menu_contents' onclick="$('#mentionbody')[0].className='mention_contents'">Contents</div>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
550 <div class='menu_item menu_toulmin' onclick="$('#mentionbody')[0].className='mention_toulmin'">Toulmin</div>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
551 <div class='menu_item menu_users' onclick="$('#mentionbody')[0].className='mention_users'">Users</div>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
552 </div>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
553 <div class='mention_main main_contents'>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
554 <textarea placeholder='contents' id='mentionform_contents'></textarea>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
555 </div>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
556 <div class='mention_main main_toulmin'>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
557 <div class='item_toulmin'><span>データ</span><input id='mentionform_d'></div>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
558 <div class='item_toulmin'><span>論拠 </span><input id='mentionform_w'></div>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
559 <div class='item_toulmin'><span>裏付け</span><input id='mentionform_b'></div>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
560 <div class='item_toulmin'><span>限定詞</span><input id='mentionform_q'></div>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
561 <div class='item_toulmin'><span>反駁 </span><input id='mentionform_r'></div>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
562 </div>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
563 <div class='mention_main main_users'>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
564 <span class='author_label'>作者:</span>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
565 <span class='author_name' id='mention_author'></span>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
566 <div class='option option1' id='mentionvote_option'>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
567 <span class='option option1 vote1' onclick="$('#mentionvote_option')[0].className='option option1'">全会一致</span>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
568 <span class='option option2 vote2' onclick="$('#mentionvote_option')[0].className='option option2'">多数決</span>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
569 </div>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
570 <div id='mention_users'></div>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
571 </div>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
572 </div>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
573 <div class='claim_footer'>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
574 <div class='option' id='mention_option'>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
575 <span class='option option1 mention1' onclick="$('#mention_option')[0].className='option option1'">反論</span>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
576 <span class='option option2 mention2' onclick="$('#mention_option')[0].className='option option2'">質問</span>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
577 <span class='option option3 mention3' onclick="$('#mention_option')[0].className='option option3'">提案</span>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
578 </div>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
579 <span class='button cancel' onclick="popupShowMain()">cancel</span>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
580 <span class='button save' onclick="mentionSave()">save</span>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
581 </div>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
582 <div class='cover' id='mention_cover'></div>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
583 </div>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
584 </div>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
585 </div>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
586
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
587
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
588
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
589
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
590 <div id="loginPopup" style='position:fixed;left:0;top:0;width:100%;height:100%;z-index:10;display:none;'>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
591 <div style='position:absolute;left:0;top:0;width:100%;height:100%;background:black;opacity:0.5'></div>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
592 <div style='position:absolute;left:50%;top:50%;'>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
593 <div style='position:absolute;left:-160px;top:-80px;width:320px;height:120px;background:white'>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
594 <form onsubmit="try{a=$('#loginUserName');if(a.val()){login(a.val());$('#loginPopup').remove();}}catch(e){console.log(e)}return false">
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
595 <div style='position:absolute;left:20px;top:15px;font-size:24px;width:280;text-align:center;'>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
596 R-Consensus Login
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
597 </div>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
598 <input type=text placeholder='username' style='position:absolute;left:20px;top:70px;width:180px;font-size:16px;height:24px;' id='loginUserName'>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
599 <span style='position:absolute;left:220px;top:70px;width:80px;font-size:16px;height:24px;line-height:24px;' class='button' value='login' onclick="try{a=$('#loginUserName');if(a.val()){login(a.val());$('#loginPopup').remove();}}catch(e){console.log(e)}return false">login</span>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
600 </form>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
601 </div>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
602 </div>
a067d8d6458e add revisionviewer.html
one
parents:
diff changeset
603 </div>