NIHVIVO-3836 and 3857 changes to the addPubToPerson custom form

This commit is contained in:
tworrall 2012-06-29 14:31:44 +00:00
parent c5428e4d4c
commit a60f78004c
3 changed files with 32 additions and 5 deletions

View file

@ -64,6 +64,7 @@ Set this flag on the input acUriReceiver where you would like this behavior to o
<#assign volumeValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "volume") /> <#assign volumeValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "volume") />
<#assign numberValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "number") /> <#assign numberValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "number") />
<#assign issueValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "issue") /> <#assign issueValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "issue") />
<#assign chapterNbrValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "chapterNbr") />
<#assign startPageValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "startPage") /> <#assign startPageValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "startPage") />
<#assign endPageValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "endPage") /> <#assign endPageValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "endPage") />
@ -272,11 +273,13 @@ Set this flag on the input acUriReceiver where you would like this behavior to o
<label for="volume" id="volLabel">Volume</label> <label for="volume" id="volLabel">Volume</label>
<label for="number" id="nbrLabel" class="vniLabels">Number</label> <label for="number" id="nbrLabel" class="vniLabels">Number</label>
<label for="issue" id="issueLabel" class="vniLabels">Issue</label> <label for="issue" id="issueLabel" class="vniLabels">Issue</label>
<label for="issue" id="chapterNbrLabel" class="vniLabels">Chapter</label>
</p> </p>
<p> <p>
<input size="4" type="text" id="volume" name="volume" value="${volumeValue}" /> <input size="4" type="text" id="volume" name="volume" value="${volumeValue}" />
<input size="4" class="vniInputs" type="text" id="number" name="number" value="${numberValue}" /> <input size="4" class="vniInputs" type="text" id="number" name="number" value="${numberValue}" />
<input size="4" class="vniInputs" type="text" id="issue" name="issue" value="${issueValue}" /> <input size="4" class="vniInputs" type="text" id="issue" name="issue" value="${issueValue}" />
<input size="4" class="vniInputs" type="text" id="chapterNbr" name="chapterNbr" value="${chapterNbrValue}" />
</p> </p>
<#-- Start/End Pages --> <#-- Start/End Pages -->

View file

@ -36,6 +36,8 @@ var publicationToPersonUtils = {
this.volLabel = $('#volLabel'); this.volLabel = $('#volLabel');
this.number = $('#number'); this.number = $('#number');
this.nbrLabel = $('#nbrLabel'); this.nbrLabel = $('#nbrLabel');
this.chapterNbr = $('#chapterNbr');
this.chapterNbrLabel = $('#chapterNbrLabel');
this.issue = $('#issue'); this.issue = $('#issue');
this.issueLabel = $('#issueLabel'); this.issueLabel = $('#issueLabel');
this.startPage = $('#startPage'); this.startPage = $('#startPage');
@ -133,6 +135,8 @@ var publicationToPersonUtils = {
this.nbrLabel.hide(); this.nbrLabel.hide();
this.issue.hide(); this.issue.hide();
this.issueLabel.hide(); this.issueLabel.hide();
this.chapterNbr.hide();
this.chapterNbrLabel.hide();
this.startPage.parent('p').hide(); this.startPage.parent('p').hide();
this.sPLabel.parent('p').hide(); this.sPLabel.parent('p').hide();
}, },
@ -152,8 +156,6 @@ var publicationToPersonUtils = {
} }
this.volume.show(); this.volume.show();
this.volLabel.show(); this.volLabel.show();
this.number.show();
this.nbrLabel.show();
this.issue.show(); this.issue.show();
this.issueLabel.show(); this.issueLabel.show();
this.startPage.parent('p').show(); this.startPage.parent('p').show();
@ -183,6 +185,8 @@ var publicationToPersonUtils = {
} }
this.locale.val(''); this.locale.val('');
this.number.val('');
this.chapterNbr.val('');
} }
else if ( selectedType == 'Chapter' ) { else if ( selectedType == 'Chapter' ) {
// if the user has changed type, keep any relevant values and display the // if the user has changed type, keep any relevant values and display the
@ -203,8 +207,8 @@ var publicationToPersonUtils = {
this.locale.parent('p').show(); this.locale.parent('p').show();
this.volume.show(); this.volume.show();
this.volLabel.show(); this.volLabel.show();
this.number.show(); this.chapterNbr.show();
this.nbrLabel.show(); this.chapterNbrLabel.show();
this.startPage.parent('p').show(); this.startPage.parent('p').show();
this.sPLabel.parent('p').show(); this.sPLabel.parent('p').show();
@ -263,6 +267,7 @@ var publicationToPersonUtils = {
this.issue.val(''); this.issue.val('');
this.startPage.val(''); this.startPage.val('');
this.endPage.val(''); this.endPage.val('');
this.chapterNbr.val('');
} }
else if ( selectedType == 'Conference Paper' ) { else if ( selectedType == 'Conference Paper' ) {
// if the user has changed type, keep any relevant values and display the // if the user has changed type, keep any relevant values and display the
@ -302,6 +307,7 @@ var publicationToPersonUtils = {
this.issue.val(''); this.issue.val('');
this.startPage.val(''); this.startPage.val('');
this.endPage.val(''); this.endPage.val('');
this.chapterNbr.val('');
} }
else if ( selectedType == 'Conference Poster' || selectedType == 'Speech') { else if ( selectedType == 'Conference Poster' || selectedType == 'Speech') {
// if the user has changed type, keep any relevant values and display the // if the user has changed type, keep any relevant values and display the
@ -338,6 +344,7 @@ var publicationToPersonUtils = {
this.issue.val(''); this.issue.val('');
this.startPage.val(''); this.startPage.val('');
this.endPage.val(''); this.endPage.val('');
this.chapterNbr.val('');
} }
else { else {
@ -373,7 +380,7 @@ var publicationToPersonUtils = {
this.issue.val(''); this.issue.val('');
this.startPage.val(''); this.startPage.val('');
this.endPage.val(''); this.endPage.val('');
this.chapterNbr.val('');
} }
}, },

View file

@ -45,6 +45,7 @@ public class AddPublicationToPersonGenerator extends VivoBaseGenerator implement
final static String volumePred = bibo + "volume"; final static String volumePred = bibo + "volume";
final static String numberPred = bibo + "number"; final static String numberPred = bibo + "number";
final static String issuePred = bibo + "issue"; final static String issuePred = bibo + "issue";
final static String chapterNbrPred = bibo + "chapter";
final static String startPagePred = bibo + "pageStart"; final static String startPagePred = bibo + "pageStart";
final static String endPagePred = bibo + "pageEnd"; final static String endPagePred = bibo + "pageEnd";
final static String dateTimePred = vivoCore + "dateTimeValue"; final static String dateTimePred = vivoCore + "dateTimeValue";
@ -174,6 +175,7 @@ public class AddPublicationToPersonGenerator extends VivoBaseGenerator implement
getN3ForVolumeAssertion(), getN3ForVolumeAssertion(),
getN3ForNumberAssertion(), getN3ForNumberAssertion(),
getN3ForIssueAssertion(), getN3ForIssueAssertion(),
getN3ForChapterNbrAssertion(),
getN3ForStartPageAssertion(), getN3ForStartPageAssertion(),
getN3ForEndPageAssertion(), getN3ForEndPageAssertion(),
getN3ForDateTimeAssertion() getN3ForDateTimeAssertion()
@ -405,6 +407,11 @@ public class AddPublicationToPersonGenerator extends VivoBaseGenerator implement
"?newPublication <" + issuePred + "> ?issue . "; "?newPublication <" + issuePred + "> ?issue . ";
} }
private String getN3ForChapterNbrAssertion() {
return "@prefix vivo: <" + vivoCore + "> . \n" +
"?newPublication <" + chapterNbrPred + "> ?chapterNbr . ";
}
private String getN3ForStartPageAssertion() { private String getN3ForStartPageAssertion() {
return "@prefix vivo: <" + vivoCore + "> . \n" + return "@prefix vivo: <" + vivoCore + "> . \n" +
"?newPublication <" + startPagePred + "> ?startPage . "; "?newPublication <" + startPagePred + "> ?startPage . ";
@ -485,6 +492,7 @@ public class AddPublicationToPersonGenerator extends VivoBaseGenerator implement
literalsOnForm.add("volume"); literalsOnForm.add("volume");
literalsOnForm.add("number"); literalsOnForm.add("number");
literalsOnForm.add("issue"); literalsOnForm.add("issue");
literalsOnForm.add("chapterNbr");
literalsOnForm.add("startPage"); literalsOnForm.add("startPage");
literalsOnForm.add("endPage"); literalsOnForm.add("endPage");
literalsOnForm.add("firstName"); literalsOnForm.add("firstName");
@ -535,6 +543,7 @@ public class AddPublicationToPersonGenerator extends VivoBaseGenerator implement
setVolumeField(editConfiguration); setVolumeField(editConfiguration);
setNumberField(editConfiguration); setNumberField(editConfiguration);
setIssueField(editConfiguration); setIssueField(editConfiguration);
setChapterNbrField(editConfiguration);
setStartPageField(editConfiguration); setStartPageField(editConfiguration);
setEndPageField(editConfiguration); setEndPageField(editConfiguration);
setDateTimeField(editConfiguration); setDateTimeField(editConfiguration);
@ -735,6 +744,14 @@ public class AddPublicationToPersonGenerator extends VivoBaseGenerator implement
setRangeDatatypeUri(stringDatatypeUri)); setRangeDatatypeUri(stringDatatypeUri));
} }
private void setChapterNbrField(EditConfigurationVTwo editConfiguration) {
String stringDatatypeUri = XSD.xstring.toString();
editConfiguration.addField(new FieldVTwo().
setName("chapterNbr").
setValidators(list("datatype:" + stringDatatypeUri)).
setRangeDatatypeUri(stringDatatypeUri));
}
private void setStartPageField(EditConfigurationVTwo editConfiguration) { private void setStartPageField(EditConfigurationVTwo editConfiguration) {
String stringDatatypeUri = XSD.xstring.toString(); String stringDatatypeUri = XSD.xstring.toString();
editConfiguration.addField(new FieldVTwo(). editConfiguration.addField(new FieldVTwo().