diff --git a/webapp/web/i18n/all.properties b/webapp/web/i18n/all.properties
index d201b66c9..818c27c4a 100644
--- a/webapp/web/i18n/all.properties
+++ b/webapp/web/i18n/all.properties
@@ -697,6 +697,7 @@ select_existing_collaborator = Select an existing Collaborator for {0}
selected = Selected
change_selection = change selection
there_are_no_entries_for_selection = There are no entries in the system from which to select.
+the_range_class_does_not_exist= The range class for this property does not exist in the system.
editing_prohibited = This property is currently configured to prohibit editing.
confirm_entry_deletion_from = Are you sure you want to delete the following entry from
@@ -752,6 +753,7 @@ custom_template_containing_content = Custom template containing all content
a_menu_page = This is a menu page
menu_item_name = Menu Item Name
if_blank_page_title_used = If left blank, the page title will be used.
+multiple_content_default_template_error = With multiple content types, you must specify a custom template.
label = label
no_classes_to_select = There are no Classes in the system from which to select.
diff --git a/webapp/web/js/menupage/pageManagementUtils.js b/webapp/web/js/menupage/pageManagementUtils.js
index 20b95899b..54b6cfa45 100644
--- a/webapp/web/js/menupage/pageManagementUtils.js
+++ b/webapp/web/js/menupage/pageManagementUtils.js
@@ -205,13 +205,15 @@ var pageManagementUtils = {
//Also clear custom template value so as not to submit it
pageManagementUtils.clearInputs(pageManagementUtils.customTemplate);
pageManagementUtils.rightSideDiv.show();
- pageManagementUtils.disablePageSave();
+ //Check to see if there is already content on page, in which case save should be enabled
+ var pageContentSections = $("section[class='pageContent']");
+ if(pageContentSections.length == 0) {
+ pageManagementUtils.disablePageSave();
+ }
});
this.customTemplateRadio.click( function() {
- pageManagementUtils.customTemplate.removeClass('hidden');
- pageManagementUtils.rightSideDiv.show();
- pageManagementUtils.disablePageSave();
+ pageManagementUtils.handleSelectCustomTemplate();
});
this.selfContainedTemplateRadio.click( function() {
@@ -265,6 +267,16 @@ var pageManagementUtils = {
});
},
+ handleSelectCustomTemplate: function() {
+ pageManagementUtils.customTemplate.removeClass('hidden');
+ pageManagementUtils.rightSideDiv.show();
+ //Check to see if there is already content on page, in which case save should be enabled
+ var pageContentSections = $("section[class='pageContent']");
+ if(pageContentSections.length == 0) {
+ pageManagementUtils.disablePageSave();
+ }
+ },
+
handleClickDone:function() {
var selectedType = pageManagementUtils.contentTypeSelect.val();
var selectedTypeText = $("#typeSelect option:selected").text();
@@ -392,6 +404,9 @@ var pageManagementUtils = {
pageManagementUtils.adjustSaveButtonHeight();
//Disable save button until the user has clicked done or cancel from the addition
pageManagementUtils.disablePageSave();
+ //If the default template is selected, there is already content on the page, and the user is selecting new content
+ //display alert message that they must select a custom template and select
+ pageManagementUtils.checkTemplateForMultipleContent(_this.contentTypeSelect.val());
},
disablePageSave:function() {
pageManagementUtils.pageSaveButton.attr("disabled", "disabled");
@@ -430,6 +445,21 @@ var pageManagementUtils = {
$el.find("select option:eq(0)").attr("selected", "selected");
},
+ checkTemplateForMultipleContent:function(contentTypeSelected) {
+ if(contentTypeSelected != "") {
+ var pageContentSections = $("section[class='pageContent']");
+ var selectedTemplateValue = $('input:radio[name=selectedTemplate]:checked').val();
+ //A new section hasn't been added yet so check to see if there is at least one content type already on page
+ if(selectedTemplateValue == "default" && pageContentSections.length >= 1) {
+ //alert the user that they should be picking custom template instead
+ alert(pageManagementUtils.multipleContentWithDefaultTemplateError);
+ //pick custom template
+ $('input:radio[name=selectedTemplate][value="custom"]').attr("checked", true);
+ pageManagementUtils.handleSelectCustomTemplate();
+
+ }
+ }
+ },
//Clone content area
//When adding a new content type, this function will copy the values from the new content form and generate
//the content for the new section containing the content
@@ -874,7 +904,12 @@ var pageManagementUtils = {
if(pageContentSections.length == 0) {
validationErrorMsg = pageManagementUtils.selectContentType + " ";
} else {
- //For each, based on type, validate if a validation function exists
+ //If there are multiple content types, and the default template option is selected, then display error message
+ var selectedTemplateValue = $('input:radio[name=selectedTemplate]:checked').val();
+ if(selectedTemplateValue == "default") {
+ validationErrorMsg += pageManagementUtils.multipleContentWithDefaultTemplateError;
+ }
+ //For each, based on type, validate if a validation function exists
$.each(pageContentSections, function(i) {
if(pageManagementUtils.processDataGetterUtils != null) {
var dataGetterType = pageManagementUtils.processDataGetterUtils.selectDataGetterType($(this));
diff --git a/webapp/web/templates/freemarker/body/menupage/menupage--exampleMultipleContentTypes.ftl b/webapp/web/templates/freemarker/body/menupage/menupage--exampleMultipleContentTypes.ftl
new file mode 100644
index 000000000..7eca46eac
--- /dev/null
+++ b/webapp/web/templates/freemarker/body/menupage/menupage--exampleMultipleContentTypes.ftl
@@ -0,0 +1,84 @@
+<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
+<#--This is an example of including multiple content types in the same template, this combines the default templates for Fixed HTML, Class groups and Solr Individuals in one template-->
+<#include "menupage-checkForData.ftl">
+<#--Fixed HTML portion-->
+<#--Note that variableName is employed by both the fixed html and sparql query templates, this is used to store the
+actual name of the variable that is used to store either the fixed html or sparql query results. If combining fixed html
+and sparql query results in a custom template, the template can utilize the actual variable name e.g. "query results" instead of how
+variableName is used below.-->
+<#assign htmlExists = false/>
+
+<#if variableName?has_content>
+ <#assign htmlExists = true />
+#if>
+<#if htmlExists>
+ ${.globals[variableName]}
+<#else>
+ ${i18n().no_html_specified}
+#if>
+
+<#--Class grou section-->
+<#if !noData>
+
+