view src/main/webapp/pages/createFile.jsp @ 58:b8ad346e39a0

new: modify based on doc 'Improving LGServices interface.docx': user workflow improvement, functions like adding task into a topic and search suggestions.
author Zoe Hong <zhong@mpiwg-berlin.mpg.de>
date Mon, 02 May 2016 12:03:30 +0200
parents 3e62083dbcbf
children b27a99201cbe
line wrap: on
line source

<%@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"/>
	
	<script>
		$(function() {
			$("#sectionId").autocomplete({
				source : function(request, response) {
					$.ajax({
						url : "<%=sessionBean.getApplicationBean().getRootServer()%>/methods/sectionIdAutocomplete.jsp",
						type : "POST",
						dataType : "json",
						data : {
							term : request.term
						},
						success : function(data) {
	
							response($.map(data, function(item) {
								return {
									label : item.name,
									value : item.value,
								}
							}));
						},
						error : function(error) {
							alert('error: ' + error);
						}
					});
				},
				minLength : 0
			});
		});			
	</script>
	
	
</head>

<body>

	<jsp:include page="../componentes/template.jsp"/>

	<div id="page">
	
		<% if(sessionBean.getUser() == null) { %>
			<label>You must login!</label>
		<% } else { %>
		
			<label class="subTitel">Create New File (Branch)</label>
			
			<form name="createFileForm"
				action="<%=sessionBean.getApplicationBean().getRootServer()%>/proxy.jsp"
				method="post"
				class="contentForm">
				<input name="bean" type="hidden" value="createFileBean" /> 
			
				<table style="width: 300px; margin-left: auto;margin-right: auto;">
					<tr>
						<td><label>Section Id</label></td>
						<td>
							<input
								id="sectionId"
								name="sectionId"		 
								type="text"
								class="searchInput"
								value="<%=(sessionBean.getCreateFilePage().getSectionId() == null) ? "" : sessionBean.getCreateFilePage().getSectionId()%>"
								style="width: 150px;" />						
						</td>
						<td>
							<input type="submit" value="Load" onclick="setAction('loadSection', 'createFileForm');"/>
						</td>
					</tr>
				</table>
				
				<% if(sessionBean.getCreateFilePage().getSection() != null) { %>
					
					<table style="width: 300px; margin-left: auto;margin-right: auto;">
						<tr>
							<td><label>Section Name</label></td>
							<td><label><%= sessionBean.getCreateFilePage().getSection().getName() %></label></td>
						</tr>
						<tr>
							<td><label>Book Id</label></td>
							<td><label><%= sessionBean.getCreateFilePage().getSection().getBook().getId() %></label></td>
						</tr>
						<tr>
							<td><label>Book Name</label></td>
							<td><label><%= sessionBean.getCreateFilePage().getSection().getBook().getName() %></label></td>
						</tr>
						<tr>
							<td><label>Text</label></td>
							<td>
								<textarea rows=20" cols="70">
									<%=sessionBean.getCreateFilePage().getSection().getText() %>
								</textarea>
								
							</td>
						</tr>
						<tr>
							<td></td>
							<td>
								<input type="submit"
									value="Create"
							 		title="Create Branch in Extraction Interface"
									onclick="sectionInExtractionInterface(<%=sessionBean.getCreateFilePage().getSectionId() %>, '<%=sessionBean.getCreateFilePage().getSection().getName()%>', <%=sessionBean.getCreateFilePage().getSection().getBook().getId() %>, '<%=sessionBean.getCreateFilePage().getSection().getBook().getName() %>', <%=sessionBean.getUser().getId() %>, '<%=sessionBean.getApplicationBean().getExtractionInterfaceUrl() %>');"/>
									
								<input type="submit" value="Reset" onclick="setAction('reset', 'createFileForm');"/>
							</td>
						</tr>
					</table>
					
					
				<% } %>
				
			</form>
		<% } %>
	
	</div>
	
</body>