diff src/main/webapp/pages/books.jsp @ 22:2c6f44ef34ab

new: add comment textarea
author Zoe Hong <zhong@mpiwg-berlin.mpg.de>
date Tue, 23 Jun 2015 16:18:52 +0200
parents 5b1856cd6b4f
children 07f7594ba56e
line wrap: on
line diff
--- a/src/main/webapp/pages/books.jsp	Tue Jun 23 14:20:36 2015 +0200
+++ b/src/main/webapp/pages/books.jsp	Tue Jun 23 16:18:52 2015 +0200
@@ -13,28 +13,17 @@
 	<jsp:include page="../componentes/headContent.jsp"/>	
 
 <script>
-	// TODO delete this function
-	function setTocComment(t) {
+
+	function setComment(t) {
 		var notes = t.value;
-		var bookId = t.name;
-		console.log(notes);
-		console.log(bookId);
-		$.ajax({
-			url: "<%=sessionBean.getApplicationBean().getRootServer()%>/methods/setTocComment.jsp",
-			type: 'POST',
-			dataType : 'json',
-			data : {
-				bookId : bookId,
-				notes : notes
-			},
-			success: function(data){
-	        	console.log("You've updated the comments of book: " + data);
-	        },
-	        error: function(error) {
-	        	console.log("error to update toc comments"+ error);
-	        	alert('You have NOT updated the status of book. If this issue remains, please contact us. Thanks.');
-	        }
-		});
+		//var bookId = t.name;
+		
+		var theForm = document.forms['booksForm'];
+	    var input = document.createElement('input');
+	    input.type = 'hidden';
+	    input.name = 'bookComment';
+	    input.value = notes;
+	    theForm.appendChild(input); 
 	}
 	
 </script>
@@ -449,17 +438,12 @@
 						<td><%= (book.getCurrentSectionVersion() == null) ? "" : book.getCurrentSectionVersion().getEditor() %></td>
 						<td><%= (book.getCurrentSectionVersion() == null) ? "" : book.getCurrentSectionVersion().getDate() %></td>
 						
-						<td>
-							<!--
-							<div>  
-								<textarea rows="2" cols="15" maxlength="100" name=<%=book.getId() %> > <%= book.getComments() %></textarea>
-								
-								<input type="image" alt="save comments" 
-									onclick="setAction0('saveComment', 'booksForm', 'bookId', '<%=book.getId()%>');" 
-									src="<%=sessionBean.getApplicationBean().getSaveImage()%>" width="20" height="20"/>
-								
-							</div>
-							-->
+						<td>			
+							<textarea rows="2" cols="15" maxlength="100" name='<%=book.getId()%>' onchange="setComment(this)" ><%=book.getComments()%></textarea>
+							<input type="image" alt="save comment" 
+								onclick="setAction0('saveComment', 'booksForm', 'currentBookId', '<%=book.getId()%>');" 
+								src="<%=sessionBean.getApplicationBean().getSaveImage()%>" width="20" height="20"/>							
+							
 						</td>
 						
 					</tr>