NIHVIVO-2288: new templates versions of custom forms

This commit is contained in:
tworrall 2011-10-31 15:22:34 +00:00
parent 1225f4f4cf
commit 7c2cefdcfc
3 changed files with 202 additions and 0 deletions

View file

@ -0,0 +1,69 @@
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
<#-- autocomplete template for data properties -->
<#-- NOTE the jsp contained the following which has not been converted
<jsp:include page="${preForm}">
<jsp:param name="useTinyMCE" value="false"/>
<jsp:param name="useAutoComplete" value="true"/>
</jsp:include>
-->
<script type="text/javascript" language="javascript">
$(this).load($(this).parent().children('a').attr('src')+" .editForm");
$(document).ready(function() {
var key = $("input[name='editKey']").attr("value");
$.getJSON("<c:url value="/dataservice"/>", {getN3EditOptionList:"1", field: "${dataLiteral}", editKey: key}, function(json){
$("select#${dataLiteral}").replaceWith("<input type='hidden' id='${dataLiteral}' name='${dataLiteral}' /><input type='text' id='${dataLiteral}-entry' name='${dataLiteral}-entry' />");
$("#${dataLiteral}-entry").autocomplete(json, {
minChars: 1,
width: 320,
matchContains: true,
mustMatch: 0,
autoFill: false,
// formatItem: function(row, i, max) {
// return row[0];
// },
// formatMatch: function(row, i, max) {
// return row[0];
// },
// formatResult: function(row) {
// return row[0];
// }
}).result(function(event, data, formatted) {
$("input#${dataLiteral}-entry").attr("value", data[0]); // dump the string into the text box
$("input#${dataLiteral}").attr("value", data[1]); // dump the uri into the hidden form input
});
}
);
})
</script>
<h2>${formTitle}</h2>
<form id="autoCompleteDatapropForm" class="editForm" action="${submitUrl}" role="autocomplete">
<#if predicate.publicDescription?has_content >
<p class="propEntryHelpText">${predicate.publicDescription}</p>
</#if>
<p>
<select id="dataLiteral" name="dataLiteral">
<#list dataLiteral as key>
<opton value="${key}"
<#if editConfiguration.objectUri?has_contant && editConfiguration.object.Uri = key>selected</#if>
</#list>
</select>
</p>
<p class="submit">
<input type="submit" id="submit" value="editConfiguration.submitLabel"/>
<span class="or"> or <a class="cancel" href="${editConfiguration.cancelUrl}">Cancel</a>
</p>
</form>

View file

@ -0,0 +1,92 @@
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
<#-- autocomplete template for object properties -->
<#-- NOTE the jsp contained the following which has not been converted
<jsp:include page="${preForm}">
<jsp:param name="useTinyMCE" value="false"/>
<jsp:param name="useAutoComplete" value="true"/>
</jsp:include>
-->
<script type="text/javascript" language="javascript">
$(this).load($(this).parent().children('a').attr('src')+" .editForm");
$(document).ready(function() {
var key = $("input[name='editKey']").attr("value");
$.getJSON("<c:url value="/dataservice"/>", {getN3EditOptionList:"1", field: "${objectVar}", editKey: key}, function(json){
$("select#${objectVar}").replaceWith("<input type='hidden' id='${objectVar}' name='${objectVar}' /><input type='text' id='${objectVar}-entry' name='${objectVar}-entry' />");
$("#${objectVar}-entry").autocomplete(json, {
minChars: 1,
width: 320,
matchContains: true,
mustMatch: 1,
autoFill: true,
// formatItem: function(row, i, max) {
// return row[0];
// },
// formatMatch: function(row, i, max) {
// return row[0];
// },
// formatResult: function(row) {
// return row[0];
// }
}).result(function(event, data, formatted) {
$("input#${objectVar}-entry").attr("value", data[0]); // dump the string into the text box
$("input#${objectVar}").attr("value", data[1]); // dump the uri into the hidden form input
});
}
);
})
</script>
<h2>${formTitle}</h2>
<form id="autoCompleteDatapropForm" class="editForm" action="${submitUrl}" role="autocomplete">
<#if predicate.offerCreateNewOption >
<#assign var="createNewUrl = "/edit/editRequestDispatch.jsp?subjectUri=${param.subjectUri}&predicateUri=${param.predicateUri}&clearEditConfig=true&cmd=create >
</#if>
<#if predicate.publicDescription?has_content >
<p class="propEntryHelpText">${predicate.publicDescription}</p>
</#if>
<p>
<select id="objectVar" name="objectVar">
<#list objectVar as key>
<opton value="${key}"
<#if editConfiguration.objectUri?has_contant && editConfiguration.object.Uri = key>selected</#if>
</#list>
</select>
</p>
<p class="submit">
<input type="submit" id="submit" value="editConfiguration.submitLabel"/>
<span class="or"> or <a class="cancel" href="${editConfiguration.cancelUrl}">Cancel</a>
</p>
<#if predicate.offerCreateNewOption>
<p>If you don't find the appropriate entry on the selection list,
<button type="button" onclick="javascript:document.location.href='${createNewUrl}'">Add a new item to this list</button>
</p>
</#if>
</form>
<#if ! param.objectUri?has_content >
<form class="deleteForm" action="${???}" method="get">
<label for="delete"><h3>Delete this entry?</h3></label>
<input type="hidden" name="subjectUri" value="${param.subjectUri}"/>
<input type="hidden" name="predicateUri" value="${param.predicateUri}"/>
<input type="hidden" name="objectUri" value="${param.objectUri}"/>
<input type="hidden" name="cmd" value="delete"/>
<input type="submit" id="delete" value="Delete"/>
</form>
</#if>

View file

@ -0,0 +1,41 @@
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
<#-- Template for adding a new individual from the Site Admin page: VIVO version -->
<h2>Create a new ${subclassName}</h2>
<#if errorNameFieldIsEmpty??>
<#assign errorMessage = "Enter a name." />
</#if>
<#if errorMessage?has_content>
<section id="error-alert" role="alert">
<img src="${urls.images}/iconAlert.png" width="24" height="24" alert="Error alert icon" />
<p>${errorMessage}</p>
</section>
</#if>
<#assign requiredHint = "<span class='requiredHint'> *</span>" />
<section id="newIndividual" role="region">
<form id="newIndividual" class="customForm noIE67" action="${submitUrl}" role="add new individual">
<p>
<label for="name">Name ${requiredHint}</label>
<input size="30" type="text" id="name" name="name" value="" />
</p>
<p class="submit">
<input type="hidden" name = "editKey" value="${???}"/>
<input type="submit" id="submit" value="editConfiguration.submitLabel"/>
<span class="or"> or <a class="cancel" href="${editConfiguration.cancelUrl}">Cancel</a>
</p>
<p id="requiredLegend" class="requiredHint">* required fields</p>
</form>
</section>