Skip to content

Sprint i18n whitespace #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,27 +22,50 @@ String getRoleType() {
@Override
FieldOptions getRoleActivityFieldOptions(VitroRequest vreq) throws Exception {
return new ConstantFieldOptions(
"", "Select type",
"http://purl.org/NET/c4dm/event.owl#Event", "Event",
"http://vivoweb.org/ontology/core#Competition", "Competition",
"http://purl.org/ontology/bibo/Conference", "Conference",
"http://vivoweb.org/ontology/core#Course", "Course",
"http://vivoweb.org/ontology/core#Exhibit", "Exhibit",
"http://purl.org/ontology/bibo/Hearing", "Hearing",
"http://purl.org/ontology/bibo/Interview", "Interview",
"http://vivoweb.org/ontology/core#Meeting", "Meeting",
"http://purl.org/ontology/bibo/Performance", "Performance",
"http://vivoweb.org/ontology/core#Presentation", "Presentation",
"http://vivoweb.org/ontology/core#InvitedTalk", "Invited Talk",
"http://purl.org/ontology/bibo/Workshop", "Workshop",
"http://vivoweb.org/ontology/core#EventSeries", "Event Series",
"http://vivoweb.org/ontology/core#ConferenceSeries", "Conference Series",
"http://vivoweb.org/ontology/core#SeminarSeries", "Seminar Series",
"http://vivoweb.org/ontology/core#WorkshopSeries", "Workshop Series"
);
}
// return new ConstantFieldOptions(
// "", "Select type",
// "http://purl.org/NET/c4dm/event.owl#Event", "Event",
// "http://vivoweb.org/ontology/core#Competition", "Competition",
// "http://purl.org/ontology/bibo/Conference", "Conference",
// "http://vivoweb.org/ontology/core#Course", "Course",
// "http://vivoweb.org/ontology/core#Exhibit", "Exhibit",
// "http://purl.org/ontology/bibo/Hearing", "Hearing",
// "http://purl.org/ontology/bibo/Interview", "Interview",
// "http://vivoweb.org/ontology/core#Meeting", "Meeting",
// "http://purl.org/ontology/bibo/Performance", "Performance",
// "http://vivoweb.org/ontology/core#Presentation", "Presentation",
// "http://vivoweb.org/ontology/core#InvitedTalk", "Invited Talk",
// "http://purl.org/ontology/bibo/Workshop", "Workshop",
// "http://vivoweb.org/ontology/core#EventSeries", "Event Series",
// "http://vivoweb.org/ontology/core#ConferenceSeries", "Conference Series",
// "http://vivoweb.org/ontology/core#SeminarSeries", "Seminar Series",
// "http://vivoweb.org/ontology/core#WorkshopSeries", "Workshop Series"
// );

@Override
// UQAM Replacing the above hard coding assignment by a dynamic assignment that takes into account the linguistic context
ConstantFieldOptions filedOptions = GeneratorUtil.buildConstantFieldOptions(vreq, DESCRIBE_QUERY);
return filedOptions;
}
/*
* UQAM get attributes for this specific subject
*/
private static String DESCRIBE_QUERY = " describe "+
"<http://purl.org/NET/c4dm/event.owl#Event> "+
"<http://vivoweb.org/ontology/core#Competition> "+
"<http://purl.org/ontology/bibo/Conference> "+
"<http://vivoweb.org/ontology/core#Course> "+
"<http://vivoweb.org/ontology/core#Exhibit> "+
"<http://purl.org/ontology/bibo/Hearing> "+
"<http://purl.org/ontology/bibo/Interview> "+
"<http://vivoweb.org/ontology/core#Meeting> "+
"<http://purl.org/ontology/bibo/Performance> "+
"<http://vivoweb.org/ontology/core#Presentation> "+
"<http://vivoweb.org/ontology/core#InvitedTalk> "+
"<http://purl.org/ontology/bibo/Workshop> "+
"<http://vivoweb.org/ontology/core#EventSeries> "+
"<http://vivoweb.org/ontology/core#ConferenceSeries> "+
"<http://vivoweb.org/ontology/core#SeminarSeries> "+
"<http://vivoweb.org/ontology/core#WorkshopSeries> ";
boolean isShowRoleLabelField() {
return false;
}
Expand All @@ -65,3 +88,4 @@ public String getEndDatePrecision() {
}
*/
}

Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ public class AddClinicalRoleToPersonGenerator extends AddRoleToPersonTwoStageGen

private static String template = "addClinicalRoleToPerson.ftl";

//Should this be overridden
//Should this be overridden
@Override
String getTemplate() {
return template;
return template;
}

@Override
Expand All @@ -22,29 +22,38 @@ String getRoleType() {
}

/** Clinical role involves hard-coded options for the "right side" of the role or activity. */
@Override
FieldOptions getRoleActivityFieldOptions(VitroRequest vreq) throws Exception {
return new ConstantFieldOptions(
"", "Select one",
"http://vivoweb.org/ontology/core#Project", "Project",
"http://purl.obolibrary.org/obo/ERO_0000005", "Service"
);
}
@Override
FieldOptions getRoleActivityFieldOptions(VitroRequest vreq) throws Exception {
// return new ConstantFieldOptions(
// "", "Select one",
// "http://vivoweb.org/ontology/core#Project", "Project",
// "http://purl.obolibrary.org/obo/ERO_0000005", "Service"
// );

//UQAM Replacing the above hard coding assigment by a dynamic assigment that takes into account the linguistic context
ConstantFieldOptions filedOptions = GeneratorUtil.buildConstantFieldOptions(vreq, DESCRIBE_QUERY);
return filedOptions;
}
/*
* UQAM get attributes for this specific subject
*/
private static String DESCRIBE_QUERY = " describe "+
"<http://vivoweb.org/ontology/core#Project> "+
"<http://purl.obolibrary.org/obo/ERO_0000005>";
//isShowRoleLabelField remains true for this so doesn't need to be overwritten
@Override
boolean isShowRoleLabelField(){
return true;
return true;
}


/*
* Use the methods below to change the date/time precision in the
* custom form associated with this generator. When not used, the
* precision will be YEAR. The other precisons are MONTH, DAY, HOUR,
* MINUTE, TIME and NONE.
*/
/*
/*
* Use the methods below to change the date/time precision in the
* custom form associated with this generator. When not used, the
* precision will be YEAR. The other precisons are MONTH, DAY, HOUR,
* MINUTE, TIME and NONE.
*/
/*
public String getStartDatePrecision() {
String precision = VitroVocabulary.Precision.MONTH.uri();
return precision;
Expand All @@ -54,6 +63,6 @@ public String getEndDatePrecision() {
String precision = VitroVocabulary.Precision.DAY.uri();
return precision;
}
*/
*/

}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.ChildVClassesOptions;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.FieldOptions;
import edu.cornell.mannlib.vitro.webapp.i18n.I18n;
import edu.cornell.mannlib.vitro.webapp.i18n.I18nBundle;
/**
* Generates the edit configuration for adding a Role to a Person.

Expand Down Expand Up @@ -46,8 +48,13 @@ String getRoleType() {

@Override
FieldOptions getRoleActivityFieldOptions(VitroRequest vreq) throws Exception {
// UQAM Managing linguistic context
I18nBundle i18n = I18n.bundle(vreq);
String i18nSelectType = i18n.text("select_type");
String selectType = (i18nSelectType == null || i18nSelectType.isEmpty()) ? "Select type" : i18nSelectType ;

return new ChildVClassesOptions(OPTION_CLASS_URI)
.setDefaultOptionLabel("Select type");
.setDefaultOptionLabel(selectType);
}

/** Do not show the role label field for the AddEditorRoleToPerson form */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ protected EditConfigurationVTwo doAddNew(VitroRequest vreq,
conf.addField( new FieldVTwo().
setName("documentType").
setValidators( list("nonempty") ).
setOptions( new ConstantFieldOptions("documentType", getDocumentTypeLiteralOptions() ))
// UQAM vreq for linguistic context
setOptions( new ConstantFieldOptions("documentType", getDocumentTypeLiteralOptions(vreq) ))
);

conf.addField( new FieldVTwo().
Expand Down Expand Up @@ -203,21 +204,42 @@ private EditConfigurationVTwo doBadEditorshipNoPub(VitroRequest vreq) {
return null;
}

private List<List<String>> getDocumentTypeLiteralOptions() {
List<List<String>> literalOptions = new ArrayList<List<String>>();
literalOptions.add(list("http://purl.org/ontology/bibo/Book", "Book"));
literalOptions.add(list("http://purl.org/ontology/bibo/Chapter", "Chapter"));
literalOptions.add(list("http://purl.org/ontology/bibo/EditedBook", "Edited Book"));
literalOptions.add(list("http://purl.org/ontology/bibo/Film", "Film"));
literalOptions.add(list("http://purl.org/ontology/bibo/Magazine", "Magazine"));
literalOptions.add(list("http://vivoweb.org/ontology/core#Newsletter", "Newsletter"));
literalOptions.add(list("http://purl.org/ontology/bibo/Newspaper", "Newspaper"));
literalOptions.add(list("http://vivoweb.org/ontology/core#NewsRelease", "News Release"));
literalOptions.add(list("http://purl.org/ontology/bibo/Report", "Report"));
literalOptions.add(list("http://vivoweb.org/ontology/core#Video", "Video"));
literalOptions.add(list("http://purl.org/ontology/bibo/Webpage", "Webpage"));
literalOptions.add(list("http://purl.org/ontology/bibo/Website", "Website"));
return literalOptions;
private List<List<String>> getDocumentTypeLiteralOptions(VitroRequest vreq) throws Exception {
//UQAM Replacing hard coding assigment by a dynamic assigment that takes into account the linguistic context
List<List<String>> value = GeneratorUtil.builFieldOptionsList(vreq, DESCRIBE_QUERY);
return value;

// List<List<String>> literalOptions = new ArrayList<List<String>>();
// literalOptions.add(list("http://purl.org/ontology/bibo/Book", "Book"));
// literalOptions.add(list("http://purl.org/ontology/bibo/Chapter", "Chapter"));
// literalOptions.add(list("http://purl.org/ontology/bibo/EditedBook", "Edited Book"));
// literalOptions.add(list("http://purl.org/ontology/bibo/Film", "Film"));
// literalOptions.add(list("http://purl.org/ontology/bibo/Magazine", "Magazine"));
// literalOptions.add(list("http://vivoweb.org/ontology/core#Newsletter", "Newsletter"));
// literalOptions.add(list("http://purl.org/ontology/bibo/Newspaper", "Newspaper"));
// literalOptions.add(list("http://vivoweb.org/ontology/core#NewsRelease", "News Release"));
// literalOptions.add(list("http://purl.org/ontology/bibo/Report", "Report"));
// literalOptions.add(list("http://vivoweb.org/ontology/core#Video", "Video"));
// literalOptions.add(list("http://purl.org/ontology/bibo/Webpage", "Webpage"));
// literalOptions.add(list("http://purl.org/ontology/bibo/Website", "Website"));
// return literalOptions;
}
/*
* UQAM get attributes for this specific subject
*/
private static String DESCRIBE_QUERY = " describe "+
"<http://purl.org/ontology/bibo/Book> " +
"<http://purl.org/ontology/bibo/Chapter> " +
"<http://purl.org/ontology/bibo/EditedBook> " +
"<http://purl.org/ontology/bibo/Film> " +
"<http://purl.org/ontology/bibo/Magazine> " +
"<http://vivoweb.org/ontology/core#Newsletter> " +
"<http://purl.org/ontology/bibo/Newspaper> " +
"<http://vivoweb.org/ontology/core#NewsRelease> " +
"<http://purl.org/ontology/bibo/Report> " +
"<http://vivoweb.org/ontology/core#Video> " +
"<http://purl.org/ontology/bibo/Webpage> " +
"<http://purl.org/ontology/bibo/Website> ";


}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.ChildVClassesOptions;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.FieldOptions;
import edu.cornell.mannlib.vitro.webapp.i18n.I18n;
import edu.cornell.mannlib.vitro.webapp.i18n.I18nBundle;

public class AddHeadOfRoleToPersonGenerator extends AddRoleToPersonTwoStageGenerator {

Expand All @@ -25,10 +27,14 @@ String getRoleType() {
/** Head Of role involves hard-coded options for the "right side" of the role or activity */
@Override
FieldOptions getRoleActivityFieldOptions(VitroRequest vreq) throws Exception {
// UQAM Taking into account the linguistic context
I18nBundle i18n = I18n.bundle(vreq);
String i18nSelectType = i18n.text("select_type");
String selectType = (i18nSelectType == null || i18nSelectType.isEmpty()) ? "Select type" : i18nSelectType ;

return new
ChildVClassesOptions(OPTION_CLASS_URI)
.setDefaultOptionLabel("Select type");
.setDefaultOptionLabel(selectType);
}

@Override
Expand Down
Loading