i18n updates to javascript files and related templates

This commit is contained in:
tworrall 2013-06-11 12:25:01 -04:00
parent 57c962e82a
commit d74176f18d
40 changed files with 373 additions and 106 deletions

View file

@ -12,6 +12,7 @@ var browseByVClass = {
// Add variables from menupage template
mergeFromTemplate: function() {
$.extend(this, menupageData);
$.extend(this, i18nStrings);
},
// Create references to frequently used elements for convenience
@ -165,10 +166,12 @@ var browseByVClass = {
// Print out the pagination nav if called
pagination: function(pages, page) {
var pagination = '<div class="pagination menupage">';
pagination += '<h3>page</h3>';
pagination += '<h3>' + browseByVClass.pageString + '</h3>';
pagination += '<ul>';
$.each(pages, function(i, item) {
var anchorOpen = '<a class="round" href="#" title="View page '+ pages[i].text +' of the results" data-page="'+ pages[i].index +'">';
var anchorOpen = '<a class="round" href="#" title="' + browseByVClass.viewPageString + ' '
+ pages[i].text + ' '
+ browseByVClass.ofTheResults + ' " data-page="'+ pages[i].index +'">';
var anchorClose = '</a>';
pagination += '<li class="round';
@ -231,9 +234,9 @@ var browseByVClass = {
var alpha = this.selectedAlpha(alpha);
if ( alpha != "all" ) {
nothingToSeeHere = '<p class="no-individuals">There are no '+ vclass.name +' individuals whose name starts with <em>'+ alpha.toUpperCase() +'</em>.</p> <p class="no-individuals">Please try another letter or browse all.</p>';
nothingToSeeHere = '<p class="no-individuals">' + browseByVClass.thereAreNo + ' ' + vclass.name + ' ' + browseByVClass.indNamesStartWith + ' <em>'+ alpha.toUpperCase() +'</em>.</p> <p class="no-individuals">' + browseByVClass.tryAnotherLetter + '</p>';
} else {
nothingToSeeHere = '<p class="no-individuals">There are no '+ vclass.name +' individuals in the system.</p> <p class="no-individuals">Please select another class from the list.</p>';
nothingToSeeHere = '<p class="no-individuals">' + browseByVClass.thereAreNo + ' ' + vclass.name + ' ' + browseByVClass.indsInSystem + '</p> <p class="no-individuals">' + browseByVClass.selectAnotherClass + '</p>';
}
browseByVClass.individualsContainer.prepend(nothingToSeeHere);

View file

@ -2,6 +2,7 @@
var menuManagementEdit = {
onLoad: function() {
$.extend(this, i18nStrings);
this.initObjects();
this.bindEventListeners();
this.toggleClassSelection();
@ -93,33 +94,33 @@ var menuManagementEdit = {
// Check menu name
if ($('input[type=text][name=menuName]').val() == "") {
validationError += "You must supply a name<br />";
validationError += menuManagementEdit.supplyName + "<br />";
}
// Check pretty url
if ($('input[type=text][name=prettyUrl]').val() == "") {
validationError += "You must supply a pretty URL<br />";
validationError += menuManagementEdit.supplyPrettyUrl + "<br />";
}
if ($('input[type=text][name=prettyUrl]').val().charAt(0) != "/") {
validationError += "The pretty URL must begin with a leading forward slash<br />";
validationError += menuManagementEdit.startUrlWithSlash + "<br />";
}
// Check custom template
if ($('input:radio[name=selectedTemplate]:checked').val() == "custom") {
if ($('input[name=customTemplate]').val() == "") {
validationError += "You must supply a template<br />";
validationError += menuManagementEdit.supplyTemplate + "<br />";
}
}
// if no class group selected, this is an error
if ($('#selectClassGroup').val() =='-1') {
validationError += "You must supply a content type<br />";
validationError += menuManagementEdit.supplyContentType + "<br />";
} else {
//class group has been selected, make sure there is at least one class selected
var allSelected = $('input[name="allSelected"]:checked').length;
var noClassesSelected = $('input[name="classInClassGroup"]:checked').length;
if (allSelected == 0 && noClassesSelected == 0) {
//at least one class should be selected
validationError += "You must select the type of content to display<br />";
validationError += menuManagementEdit.selectContentType + "<br />";
}
}
@ -149,7 +150,7 @@ var menuManagementEdit = {
var selectedClassesList = menuManagementEdit.classesForClassGroup.children('ul#selectedClasses');
selectedClassesList.empty();
selectedClassesList.append('<li class="ui-state-default"> <input type="checkbox" name="allSelected" id="allSelected" value="all" checked="checked" /> <label class="inline" for="All"> All</label> </li>');
selectedClassesList.append('<li class="ui-state-default"> <input type="checkbox" name="allSelected" id="allSelected" value="all" checked="checked" /> <label class="inline" for="All"> ' + menuManagementEdit.allCapitalized + '</label> </li>');
$.each(results.classes, function(i, item) {
var thisClass = results.classes[i];

View file

@ -93,6 +93,8 @@ var pageManagementUtils = {
$.extend(this, vitro.customFormUtils);
// Get the custom form data from the page
$.extend(this, customFormData);
$.extend(this, i18nStrings);
},
initObjects:function(){
this.counter = 0;
@ -297,7 +299,7 @@ var pageManagementUtils = {
pageManagementUtils.classGroupSection.show();
pageManagementUtils.fixedHTMLSection.hide();
pageManagementUtils.sparqlQuerySection.hide();
pageManagementUtils.headerBar.text("Browse Class Group - ");
pageManagementUtils.headerBar.text(pageManagementUtils.browseClassGroup + " - ");
pageManagementUtils.headerBar.show();
$('div#selfContainedDiv').hide();
}
@ -305,12 +307,12 @@ var pageManagementUtils = {
pageManagementUtils.classGroupSection.hide();
//if fixed html show that, otherwise show sparql results
if ( _this.contentTypeSelect.val() == "fixedHtml" ) {
pageManagementUtils.headerBar.text("Fixed HTML - ");
pageManagementUtils.headerBar.text(pageManagementUtils.fixedHtml + " - ");
pageManagementUtils.fixedHTMLSection.show();
pageManagementUtils.sparqlQuerySection.hide();
}
else {
pageManagementUtils.headerBar.text("SPARQL Query Results - ");
pageManagementUtils.headerBar.text(pageManagementUtils.sparqlResults + " - ");
pageManagementUtils.sparqlQuerySection.show();
pageManagementUtils.fixedHTMLSection.hide();
}
@ -420,8 +422,8 @@ var pageManagementUtils = {
html: "<span class='pageContentTypeLabel'>" + contentTypeLabel + " - " + varOrClass
+ "</span><span id='clickable" + counter
+ "' class='pageContentExpand'><div id='woof' class='arrow expandArrow'></div></span><div id='innerContainer" + counter
+ "' class='pageContentWrapper'><span class='deleteLinkContainer'>&nbsp;or&nbsp;<a id='remove" + counter // changed button to a link
+ "' href='' >delete</a></span></div>"
+ "' class='pageContentWrapper'><span class='deleteLinkContainer'>&nbsp;" + pageManagementUtils.orString + "&nbsp;<a id='remove" + counter // changed button to a link
+ "' href='' >" + pageManagementUtils.deleteString + "</a></span></div>"
});
//Hide inner div
var $innerDiv = $newDivContainer.children('div#innerContainer' + counter);
@ -638,7 +640,7 @@ var pageManagementUtils = {
var selectedClassesList = pageManagementUtils.classesForClassGroup.children('ul#selectedClasses');
selectedClassesList.empty();
selectedClassesList.append('<li class="ui-state-default"> <input type="checkbox" name="allSelected" id="allSelected" value="all" checked="checked" /> <label class="inline" for="All"> All</label> </li>');
selectedClassesList.append('<li class="ui-state-default"> <input type="checkbox" name="allSelected" id="allSelected" value="all" checked="checked" /> <label class="inline" for="All"> ' + pageManagementUtils.allCapitalized + '</label> </li>');
$.each(results.classes, function(i, item) {
var thisClass = results.classes[i];
@ -740,11 +742,11 @@ var pageManagementUtils = {
return jsonObject;
} else {
//ERROR handling
alert("An error has occurred and the map of processors for this content is missing. Please contact the administrator");
alert(pageManagementUtils.mapProcessorError);
return null;
}
}
alert("An error has occurred and the code for processing this content is missing a component. Please contact the administrator.");
alert(pageManagementUtils.codeProcessingError);
//Error handling here
return null;
},
@ -785,21 +787,21 @@ var pageManagementUtils = {
// Check menu name
if ($('input[type=text][name=pageName]').val() == "") {
validationError += "You must supply a name<br />";
validationError += pageManagementUtils.supplyName + "<br />";
}
// Check pretty url
if ($('input[type=text][name=prettyUrl]').val() == "") {
validationError += "You must supply a pretty URL<br />";
validationError += pageManagementUtils.supplyPrettyUrl + "<br />";
}
if ($('input[type=text][name=prettyUrl]').val().charAt(0) != "/") {
validationError += "The pretty URL must begin with a leading forward slash<br />";
validationError += pageManagementUtils.startUrlWithSlash + "<br />";
}
// Check custom template and self contained template
var selectedTemplateValue = $('input:radio[name=selectedTemplate]:checked').val();
if (selectedTemplateValue == "custom" || selectedTemplateValue == "selfContained") {
if ($('input[name=customTemplate]').val() == "") {
validationError += "You must supply a template<br />";
validationError += pageManagementUtils.supplyTemplate + "<br />";
}
}
@ -813,7 +815,7 @@ var pageManagementUtils = {
var validationErrorMsg = "";
//If there ARE not contents selected, then error message should indicate user needs to add them
if(pageContentSections.length == 0) {
validationErrorMsg = "You must select content to be included on the page <br /> ";
validationErrorMsg = pageManagementUtils.selectContentType + " <br /> ";
} else {
//For each, based on type, validate if a validation function exists
$.each(pageContentSections, function(i) {

View file

@ -1,5 +1,6 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
$.extend(this, i18nStringsBrowseGroups);
//Process sparql data getter and provide a json object with the necessary information
//Depending on what is included here, a different type of data getter might be used
var processClassGroupDataGetterContent = {
@ -34,7 +35,7 @@ var processClassGroupDataGetterContent = {
},
//For the label of the content section for editing, need to add additional value
retrieveContentLabel:function() {
return "Browse Class Group";
return i18nStringsBrowseGroups.browseClassGroup;
},
retrieveAdditionalLabelText:function(existingContentObject) {
var label = "";
@ -61,7 +62,7 @@ var processClassGroupDataGetterContent = {
selectedClassesList.empty();
var newId = "allSelected" + contentNumber;
selectedClassesList.append('<li class="ui-state-default"> <input type="checkbox" name="allSelected" id="' + contentNumber + '" value="all" checked="checked" /> <label class="inline" for="All"> All</label> </li>');
selectedClassesList.append('<li class="ui-state-default"> <input type="checkbox" name="allSelected" id="' + contentNumber + '" value="all" checked="checked" /> <label class="inline" for="All"> ' + i18nStringsBrowseGroups.allCapitalized + '</label> </li>');
$.each(results.classes, function(i, item) {
var thisClass = results.classes[i];
@ -134,14 +135,14 @@ var processClassGroupDataGetterContent = {
validateFormSubmission: function(pageContentSection, pageContentSectionLabel) {
var validationError = "";
if (pageContentSection.find('select[name="selectClassGroup"]').val() =='-1') {
validationError += pageContentSectionLabel + ": You must supply a class group <br />";
validationError += pageContentSectionLabel + ": " + i18nStringsBrowseGroups.supplyClassGroup + " <br />";
} else {
//class group has been selected, make sure there is at least one class selected
var allSelected = pageContentSection.find('input[name="allSelected"]:checked').length;
var noClassesSelected = pageContentSection.find('input[name="classInClassGroup"]:checked').length;
if (allSelected == 0 && noClassesSelected == 0) {
//at least one class should be selected
validationError += pageContentSectionLabel + ":You must select the classes to display<br />";
validationError += pageContentSectionLabel + ": " + i18nStringsBrowseGroups.selectClasses + "<br />";
}
}
return validationError;

View file

@ -1,5 +1,6 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
$.extend(this, i18nStringsFixedHtml);
//Process sparql data getter and provide a json object with the necessary information
var processFixedHTMLDataGetterContent = {
dataGetterClass:null,
@ -30,7 +31,7 @@ var processFixedHTMLDataGetterContent = {
},
//For the label of the content section for editing, need to add additional value
retrieveContentLabel:function() {
return "Fixed HTML";
return i18nStringsFixedHtml.fixedHtml;
},
//For the label of the content section for editing, need to add additional value
retrieveAdditionalLabelText:function(existingContentObject) {
@ -43,17 +44,17 @@ var processFixedHTMLDataGetterContent = {
//Check that query and saveToVar have been input
var variableValue = pageContentSection.find("input[name='saveToVar']").val();
if(variableValue == "") {
validationError += pageContentSectionLabel + ": You must supply a variable to save HTML content. <br />";
validationError += pageContentSectionLabel + ": " + i18nStringsFixedHtml.supplyVariableName + " <br />";
}
if(processFixedHTMLDataGetterContent.stringHasSingleQuote(variableValue)) {
validationError += pageContentSectionLabel + ": The variable name should not have an apostrophe . <br />";
validationError += pageContentSectionLabel + ": " + i18nStringsFixedHtml.noApostrophes + " <br />";
}
if(processFixedHTMLDataGetterContent.stringHasDoubleQuote(variableValue)) {
validationError += pageContentSectionLabel + ": The variable name should not have a double quote . <br />";
validationError += pageContentSectionLabel + ": " + i18nStringsFixedHtml.noDoubleQuotes + " <br />";
}
var htmlValue = pageContentSection.find("textarea[name='htmlValue']").val();
if(htmlValue == "") {
validationError += pageContentSectionLabel + ": You must supply some HTML or text. <br />";
validationError += pageContentSectionLabel + ": " + i18nStringsFixedHtml.supplyHtml + " <br />";
}
return validationError;
},

View file

@ -1,5 +1,7 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
$.extend(this, i18nStringsSparqlQuery);
//Process sparql data getter and provide a json object with the necessary information
var processSparqlDataGetterContent = {
dataGetterClass:null,
@ -35,7 +37,7 @@ var processSparqlDataGetterContent = {
},
//For the label of the content section for editing, need to add additional value
retrieveContentLabel:function() {
return "SPARQL Query Results";
return i18nStringsSparqlQuery.sparqlResults;
},
//For the label of the content section for editing, need to add additional value
retrieveAdditionalLabelText:function(existingContentObject) {
@ -48,13 +50,13 @@ var processSparqlDataGetterContent = {
//Check that query and saveToVar have been input
var variableValue = pageContentSection.find("input[name='saveToVar']").val();
if(variableValue == "") {
validationError += pageContentSectionLabel + ": You must supply a variable to save query results. <br />"
validationError += pageContentSectionLabel + ": " + i18nStringsSparqlQuery.supplyQueryVariable + " <br />"
}
if(processSparqlDataGetterContent.stringHasSingleQuote(variableValue)) {
validationError += pageContentSectionLabel + ": The variable name should not have an apostrophe . <br />";
validationError += pageContentSectionLabel + ": " + i18nStringsSparqlQuery.noApostrophes + " <br />";
}
if(processSparqlDataGetterContent.stringHasDoubleQuote(variableValue)) {
validationError += pageContentSectionLabel + ": The variable name should not have a double quote . <br />";
validationError += pageContentSectionLabel + ": " + i18nStringsSparqlQuery.noDoubleQuotes + " <br />";
}
//Check that query model does not have single or double quotes within it
//Uncomment this/adapt this when we actually allow display the query model input
@ -71,7 +73,7 @@ var processSparqlDataGetterContent = {
var queryValue = pageContentSection.find("textarea[name='query']").val();
if(queryValue == "") {
validationError += pageContentSectionLabel + ": You must supply a Sparql query. <br />";
validationError += pageContentSectionLabel + ": " + i18nStringsSparqlQuery.supplyQuery + " <br />";
}
return validationError;
},