comparison 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
comparison
equal deleted inserted replaced
21:5b1856cd6b4f 22:2c6f44ef34ab
11 <head> 11 <head>
12 12
13 <jsp:include page="../componentes/headContent.jsp"/> 13 <jsp:include page="../componentes/headContent.jsp"/>
14 14
15 <script> 15 <script>
16 // TODO delete this function 16
17 function setTocComment(t) { 17 function setComment(t) {
18 var notes = t.value; 18 var notes = t.value;
19 var bookId = t.name; 19 //var bookId = t.name;
20 console.log(notes); 20
21 console.log(bookId); 21 var theForm = document.forms['booksForm'];
22 $.ajax({ 22 var input = document.createElement('input');
23 url: "<%=sessionBean.getApplicationBean().getRootServer()%>/methods/setTocComment.jsp", 23 input.type = 'hidden';
24 type: 'POST', 24 input.name = 'bookComment';
25 dataType : 'json', 25 input.value = notes;
26 data : { 26 theForm.appendChild(input);
27 bookId : bookId,
28 notes : notes
29 },
30 success: function(data){
31 console.log("You've updated the comments of book: " + data);
32 },
33 error: function(error) {
34 console.log("error to update toc comments"+ error);
35 alert('You have NOT updated the status of book. If this issue remains, please contact us. Thanks.');
36 }
37 });
38 } 27 }
39 28
40 </script> 29 </script>
41 </head> 30 </head>
42 31
447 </td> 436 </td>
448 437
449 <td><%= (book.getCurrentSectionVersion() == null) ? "" : book.getCurrentSectionVersion().getEditor() %></td> 438 <td><%= (book.getCurrentSectionVersion() == null) ? "" : book.getCurrentSectionVersion().getEditor() %></td>
450 <td><%= (book.getCurrentSectionVersion() == null) ? "" : book.getCurrentSectionVersion().getDate() %></td> 439 <td><%= (book.getCurrentSectionVersion() == null) ? "" : book.getCurrentSectionVersion().getDate() %></td>
451 440
452 <td> 441 <td>
453 <!-- 442 <textarea rows="2" cols="15" maxlength="100" name='<%=book.getId()%>' onchange="setComment(this)" ><%=book.getComments()%></textarea>
454 <div> 443 <input type="image" alt="save comment"
455 <textarea rows="2" cols="15" maxlength="100" name=<%=book.getId() %> > <%= book.getComments() %></textarea> 444 onclick="setAction0('saveComment', 'booksForm', 'currentBookId', '<%=book.getId()%>');"
456 445 src="<%=sessionBean.getApplicationBean().getSaveImage()%>" width="20" height="20"/>
457 <input type="image" alt="save comments" 446
458 onclick="setAction0('saveComment', 'booksForm', 'bookId', '<%=book.getId()%>');"
459 src="<%=sessionBean.getApplicationBean().getSaveImage()%>" width="20" height="20"/>
460
461 </div>
462 -->
463 </td> 447 </td>
464 448
465 </tr> 449 </tr>
466 450
467 <% } %> 451 <% } %>