Mercurial > hg > LGServices
diff src/main/webapp/pages/branchPage.jsp @ 0:3e62083dbcbf
First commit. This project comes from LGServer. We removed the framework icefaces. Now, LGServices uses just JSP and jquery.
author | "jurzua <jurzua@mpiwg-berlin.mpg.de>" |
---|---|
date | Thu, 23 Apr 2015 15:46:01 +0200 |
parents | |
children | 996f8f1b69db |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/webapp/pages/branchPage.jsp Thu Apr 23 15:46:01 2015 +0200 @@ -0,0 +1,330 @@ +<%@page import="de.mpiwg.gazetteer.dataverse.bo.VDCUser"%> +<%@page import="de.mpiwg.gazetteer.bo.LGFile"%> +<%@page import="org.apache.commons.lang.StringUtils"%> +<%@page import="de.mpiwg.gazetteer.db.DBSection"%> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> +<jsp:useBean id="sessionBean" class="de.mpiwg.web.jsp.SessionBean" scope="session" /> + +<html> +<head> + + <jsp:include page="../componentes/headContent.jsp"/> + <% + sessionBean.getBranchPage().loadParameters(request, response); + if(request.getParameter("branchId") != null){ + sessionBean.getBranchPage().loadBranch(request.getParameter("branchId")); + } + %> + <script> + $(function() { + + $( "#dialogDataverse" ).dialog({ + autoOpen: false, + modal: true, + width: 600, + position: { my: "center", at: "top", of: window }, + hide: { + effect: "explode", + duration: 1000 + } + }); + + $( ".get-studies" ).click(function() { + var fileId = $( this ).data('file-id'); + + var url0 = "<%=sessionBean.getApplicationBean().getRootServer()%>/methods/getDataverseForm.jsp?fileId=" + fileId; + + $.ajax( url0 ) + .done(function(data) { + $( "#dialogDataverseTable" ).replaceWith(data); + $( "#dialogDataverse" ).dialog( "open" ); + }) + .fail(function() { + console.error("Error calling: " + query); + }) + + }); + + + var dialog = $( "#dialogAddContributors" ).dialog( + {autoOpen: false} + ); + + $( "#addContributors" ).button().on( "click", function() { + dialog.dialog( "open" ); + }); + }); + </script> + +</head> + +<body> + <jsp:include page="../componentes/template.jsp"/> + + <div id="dialogDataverse" title="Select a study to publish your File" > + <div id="dialogDataverseTable">XXXX</div> + </div> + + <div id="page"> + + <% if(sessionBean.getUser() == null) { %> + <label>You must login!</label> + <% } else { %> + + <label class="subTitel">Branch Details</label> + + + <% if(sessionBean.getBranchPage().getBranch() != null) { %> + <div id="dialogAddContributors" title="Select a new Contributors:"> + <form name="contributorsForm" id="contributorsForm" + action="<%=sessionBean.getApplicationBean().getRootServer()%>/proxy.jsp" + method="post"> + <input name="bean" type="hidden" value="branchBean" /> + <table> + <% for(VDCUser user : sessionBean.getBranchPage().getSuggestionUserList()) { %> + <tr> + <td><a href="#" onclick="setAction0('addContributor', 'contributorsForm', 'userId', <%=user.getId() %>);document.getElementById('contributorsForm').submit();"><%=user.getUserName()%></a></td> + </tr> + <% } %> + </table> + </form> + </div> + <% } %> + <!-- + <form name="branchForm" + action="<%=sessionBean.getApplicationBean().getRootServer()%>/proxy.jsp" + method="post" + class="contentForm" + style="width: 70%; margin-left: auto;margin-right: auto;"> + <input name="bean" type="hidden" value="branchBean" /> + --> + <% if(sessionBean.getBranchPage().getBranch() == null) { %> + <label>Branch no found!</label> + <% } else { %> + + <table> + <tr> + <td><label class="subTitel">General Information</label></td> + <td> + <table class="tableComponent"> + <tr> + <td><label>Branch Id</label></td> + <td><label><%=sessionBean.getBranchPage().getBranch().getId() %></label></td> + </tr> + <tr> + <td><label>Label</label></td> + <td><label><%=sessionBean.getBranchPage().getBranch().getLabel() %></label></td> + </tr> + + <!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%% --> + <tr> + <td><label>Book Id</label></td> + <td><label><%=sessionBean.getBranchPage().getBranch().getBook().getId() %></label></td> + </tr> + <tr> + <td><label>Book Name</label></td> + <td><label><%=sessionBean.getBranchPage().getBranch().getBook().getName() %></label></td> + </tr> + <tr> + <td><label>Level 1</label></td> + <td><label><%=sessionBean.getBranchPage().getBranch().getBook().getLevel1() %></label></td> + </tr> + <tr> + <td><label>Level 2</label></td> + <td><label><%=sessionBean.getBranchPage().getBranch().getBook().getLevel2() %></label></td> + </tr> + <tr> + <td><label>Dynasty</label></td> + <td><label><%=sessionBean.getBranchPage().getBranch().getBook().getDynasty() %></label></td> + </tr> + <tr> + <td><label>Period</label></td> + <td><label><%=sessionBean.getBranchPage().getBranch().getBook().getPeriod() %></label></td> + </tr> + <tr> + <td><label>Admin Type</label></td> + <td><label><%=sessionBean.getBranchPage().getBranch().getBook().getAdmin_type() %></label></td> + </tr> + <tr> + <td><label>Volume</label></td> + <td><label><%=sessionBean.getBranchPage().getBranch().getBook().getVolume() %></label></td> + </tr> + <tr> + <td><label>Author</label></td> + <td><label><%=sessionBean.getBranchPage().getBranch().getBook().getAuthor() %></label></td> + </tr> + <tr> + <td><label>Edition</label></td> + <td><label><%=sessionBean.getBranchPage().getBranch().getBook().getEdition() %></label></td> + </tr> + + <!-- %%%%%%%%%%%%%%%%%%%%%%%% --> + <tr> + <td><label>Section Id</label></td> + <td><label><%=sessionBean.getBranchPage().getBranch().getSectionId() %></label></td> + </tr> + <tr> + <td><label>Section Name</label></td> + <td><label><%=sessionBean.getBranchPage().getBranch().getSection().getName() %></label></td> + </tr> + <tr> + <td><label>Pages</label></td> + <td><label><%=sessionBean.getBranchPage().getBranch().getSection().getPages()%></label></td> + </tr> + + + + + + + + + <tr> + <td><label>Created</label></td> + <td><label><%=sessionBean.getBranchPage().getBranch().getFomattedCreation() %></label></td> + </tr> + <tr> + <td><label>Creator</label></td> + <td><label><%=sessionBean.getBranchPage().getBranch().getUsername() %></label></td> + </tr><tr> + <td><label>Contributors</label></td> + <td> + <table> + <tr> + <td> + <form name="contributorForm" + action="<%=sessionBean.getApplicationBean().getRootServer()%>/proxy.jsp" + method="post"> + <input name="bean" type="hidden" value="branchBean" /> + <table style="width: 300px;" class="pageTable"> + <% for(VDCUser contr : sessionBean.getBranchPage().getContributors()) { %> + <tr> + <td><label><%=contr.getUserName() %></label></td> + <td> + <input type="image" + onclick="<%=sessionBean.getApplicationBean().getJSConfirmationDelete() %> setAction0('removeContributor', 'contributorForm', 'userId', <%=contr.getId() %>);" + src="<%=sessionBean.getApplicationBean().getDeleteImage()%>"/> + </td> + </tr> + <% } %> + </table> + </form> + </td> + <td> + <button id="addContributors" type="button" class="lgButton">Add Contributors</button> + </td> + </tr> + </table> + </td> + </tr> + </table> + </td> + </tr> + <tr> + <td><label class="subTitel">Current Version</label></td> + <td> + <table class="tableComponent"> + <tr> + <td><label>File Id</label></td> + <td><label><%=sessionBean.getBranchPage().getLastFile().getId() %></label></td> + </tr> + <tr> + <td><label>File Version</label></td> + <td><label><%=sessionBean.getBranchPage().getLastFile().getVersion() %></label></td> + </tr> + <tr> + <td><label>User</label></td> + <td><label><%=sessionBean.getBranchPage().getLastFile().getUsername() %></label></td> + </tr> + <tr> + <td><label>File Name</label></td> + <td><label><%=sessionBean.getBranchPage().getLastFile().getFileName() %></label></td> + </tr> + <tr> + <td><label>Created</label></td> + <td><label><%=sessionBean.getBranchPage().getLastFile().getFomattedCreation() %></label></td> + </tr> + <tr> + <td><label>Text</label></td> + <td> + <textarea rows=20" cols="70"> + <%=sessionBean.getBranchPage().getText() %> + </textarea> + </td> + </tr> + </table> + </td> + </tr> + <tr> + <td><label class="subTitel">All Versions</label></td> + <td> + <form name="filesForm" + action="<%=sessionBean.getApplicationBean().getRootServer()%>/proxy.jsp" + method="post"> + <input name="bean" type="hidden" value="branchBean" /> + + + <table class="pageTable tableComponent"> + <tr> + <th><label class="tableTitle">File Id</label></th> + <th><label class="tableTitle">Version</label></th> + <th><label class="tableTitle">User</label></th> + <th><label class="tableTitle">Created</label></th> + <th><label class="tableTitle">Text</label></th> + <th><label class="tableTitle">Table (to be published)</label></th> + <th><label class="tableTitle">Published in Dataverse?</label></th> + + <th><label class="tableTitle">Delete</label></th> + </tr> + + <% for(LGFile file : sessionBean.getBranchPage().getAllFiles()) { %> + <tr> + <td><label><%= file.getId() %></label></td> + <td><label><%= file.getVersion() %></label></td> + <td><label><%= file.getUsername() %></label></td> + <td><label><%= file.getFomattedCreation() %></label></td> + <td> + <a href="<%=sessionBean.getApplicationBean().getRootServer() %>/rest/text/getFileText?fileId=<%=file.getId() %>" + target="_blank"> + <img alt="Show text" src="<%=sessionBean.getApplicationBean().getShowImage()%>"/> + </a> + </td> + <td> + <a href="<%=sessionBean.getApplicationBean().getRootServer() %>/rest/text/getTable4File?fileId=<%=file.getId() %>" + target="_blank"> + <img alt="Show text" src="<%=sessionBean.getApplicationBean().getShowImage()%>"/> + </a> + </td> + <td> + <% if(file.getDvId() == null) {%> + <button type="button" class="get-studies" data-file-id="<%=file.getId()%>">load</button> + <% } else { %> + <label>Yes! Id in Dataverse: <%= file.getDvId() %></label> + <% } %> + </td> + <td> + <input type="image" + onclick="<%=sessionBean.getApplicationBean().getJSConfirmationDelete() %> setAction0('deleteFile', 'filesForm', 'fileId', <%=file.getId() %>);" + src="<%=sessionBean.getApplicationBean().getDeleteImage()%>"/> + </td> + </tr> + <% } %> + </table> + + </form> + </td> + </tr> + + </table> + + <% } %> + + + + + <!-- </form> --> + <% } %> + + </div> + +</body> \ No newline at end of file