annotate public/viewer/revisionviewer.html @ 118:3440be06e501 draft

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