changeset 17:02b5c7fe5d08 draft

implemented post function for state change and node position
author Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
date Thu, 21 Mar 2013 03:56:26 +0900
parents 1af36503e849
children cfdce8445a14
files show.html
diffstat 1 files changed, 29 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/show.html	Thu Mar 21 03:14:25 2013 +0900
+++ b/show.html	Thu Mar 21 03:56:26 2013 +0900
@@ -41,7 +41,7 @@
 	    </div>
 	</div>
     </div>
-    <span class='button display' style='position:absolute; width:100px; left:75px; bottom:5px; opacity:1;' onclick='traverseAction();'>traverse</span>
+    <span class='button' style='position:absolute; width:100px; left:75px; bottom:5px; opacity:1;' onclick='traverseAction();'>traverse</span>
 </div>
 
 <div id="miniDisplay" style='position:fixed; width:250px; height:250px; border:solid 1px; border-radius:5px; opacity:1; z-index:10; visibility:visible;'>
@@ -57,9 +57,9 @@
 	</div>
     </div>
     <nobr style='position:absolute; width:100%; bottom:5px;'>
-    <span class='button display' style='position:absolute; width:50px; left:5px; bottom:5px; opacity:1;' onclick='traverseAction();'>採用</span>
-    <span class='button display' style='position:absolute; width:50px; left:65px; bottom:5px; opacity:1;' onclick='traverseAction();'>不採用</span>
-    <span class='button display' style='position:absolute; width:50px; left:125px; bottom:5px; opacity:1;' onclick='traverseAction();'>放置</span>
+    <span class='button' id="acceptButton" style='position:absolute; width:50px; left:5px; bottom:5px; opacity:1;' value='accept' onclick="statePost($('#acceptButton'));">accept</span>
+    <span class='button' id="rejectButton" style='position:absolute; width:50px; left:65px; bottom:5px; opacity:1; ' value='rejecte' onclick="statePost($('#rejectButton'));">reject</span>
+    <span class='button' id="lateButton" style='position:absolute; width:50px; left:125px; bottom:5px; opacity:1; ' value='later' onclick="statePost($('#lateButton'));">later</span>
     </nobr>
 </div>
 
@@ -149,11 +149,14 @@
     },
     _dragEnd : function() {
 	var oElem = DragHandler._oElem;
-	var x = parseInt(oElem.style.left);
-	var y = parseInt(oElem.style.top);
 	document.onmousemove = null;
 	document.onmouseup = null;
 	DragHandler._oElem = null;
+	if (oElem.nodeId) {
+	    var x = parseInt(oElem.style.left);
+	    var y = parseInt(oElem.style.top);
+	    nodePositionPost(oElem.nodeId, x, y);
+	}
     }
 
 };
@@ -309,7 +312,26 @@
     });
 }
 
- function traverseAction() {
+function postToServer(parameter) {
+    $.ajax({
+	url:"/aat/aaevidencesiftingmodel.userdesktops/update?"+parameter,
+	success:function(o) {console.log("success postToServer URL:"+this.url); },
+	type:"POST", cache:true,
+	error:function(o) { console.log("post error : ", o); }
+    });
+}
+
+function statePost(buttonEle) {
+    var id = this.id;
+    var state = buttonEle.html();
+    postToServer("id="+id+"&state="+state);
+}
+
+function nodePositionPost(id, coordx, coordy) {
+    postToServer("id="+id+"&corrdx="+coordx+"&corrdy="+coordy);
+}
+
+function traverseAction() {
     var inDirChecked = $('#direction_in')[0].checked;
     var outDirChecked = $('#direction_out')[0].checked;
     var labelTags = $('[id=traverseLabel]');