updates for page management issues vivo622 and 616

This commit is contained in:
hudajkhan 2013-12-05 16:20:55 -05:00
parent 89d4fc9228
commit 0944a0d883
4 changed files with 128 additions and 6 deletions

View file

@ -697,6 +697,7 @@ select_existing_collaborator = Select an existing Collaborator for {0}
selected = Selected selected = Selected
change_selection = change selection change_selection = change selection
there_are_no_entries_for_selection = There are no entries in the system from which to select. 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. 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 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 a_menu_page = This is a menu page
menu_item_name = Menu Item Name menu_item_name = Menu Item Name
if_blank_page_title_used = If left blank, the page title will be used. 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 label = label
no_classes_to_select = There are no Classes in the system from which to select. no_classes_to_select = There are no Classes in the system from which to select.

View file

@ -205,13 +205,15 @@ var pageManagementUtils = {
//Also clear custom template value so as not to submit it //Also clear custom template value so as not to submit it
pageManagementUtils.clearInputs(pageManagementUtils.customTemplate); pageManagementUtils.clearInputs(pageManagementUtils.customTemplate);
pageManagementUtils.rightSideDiv.show(); 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() { this.customTemplateRadio.click( function() {
pageManagementUtils.customTemplate.removeClass('hidden'); pageManagementUtils.handleSelectCustomTemplate();
pageManagementUtils.rightSideDiv.show();
pageManagementUtils.disablePageSave();
}); });
this.selfContainedTemplateRadio.click( function() { 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() { handleClickDone:function() {
var selectedType = pageManagementUtils.contentTypeSelect.val(); var selectedType = pageManagementUtils.contentTypeSelect.val();
var selectedTypeText = $("#typeSelect option:selected").text(); var selectedTypeText = $("#typeSelect option:selected").text();
@ -392,6 +404,9 @@ var pageManagementUtils = {
pageManagementUtils.adjustSaveButtonHeight(); pageManagementUtils.adjustSaveButtonHeight();
//Disable save button until the user has clicked done or cancel from the addition //Disable save button until the user has clicked done or cancel from the addition
pageManagementUtils.disablePageSave(); 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() { disablePageSave:function() {
pageManagementUtils.pageSaveButton.attr("disabled", "disabled"); pageManagementUtils.pageSaveButton.attr("disabled", "disabled");
@ -430,6 +445,21 @@ var pageManagementUtils = {
$el.find("select option:eq(0)").attr("selected", "selected"); $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 //Clone content area
//When adding a new content type, this function will copy the values from the new content form and generate //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 //the content for the new section containing the content
@ -874,7 +904,12 @@ var pageManagementUtils = {
if(pageContentSections.length == 0) { if(pageContentSections.length == 0) {
validationErrorMsg = pageManagementUtils.selectContentType + " <br /> "; validationErrorMsg = pageManagementUtils.selectContentType + " <br /> ";
} else { } 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) { $.each(pageContentSections, function(i) {
if(pageManagementUtils.processDataGetterUtils != null) { if(pageManagementUtils.processDataGetterUtils != null) {
var dataGetterType = pageManagementUtils.processDataGetterUtils.selectDataGetterType($(this)); var dataGetterType = pageManagementUtils.processDataGetterUtils.selectDataGetterType($(this));

View file

@ -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>
<section id="menupage-intro" role="region">
<h2>${page.title}</h2>
</section>
<#include "menupage-browse.ftl">
${stylesheets.add('<link rel="stylesheet" href="${urls.base}/css/menupage/menupage.css" />')}
<#include "menupage-scripts.ftl">
<#else>
${noDataNotification}
</#if>
<#--Solr Individuals section-->
<#import "lib-list.ftl" as l>
<#include "individualList-checkForData.ftl">
${stylesheets.add('<link rel="stylesheet" href="${urls.base}/css/browseIndex.css" />')}
<section class="individualList">
<h2>${title}
</h2>
<#if subtitle?has_content>
<h4>${subtitle}</h4>
</#if>
<#if (!noData)>
<#if errorMessage?has_content>
<p>${errorMessage}</p>
<#else>
<#assign pagination>
<#if (pages?has_content && pages?size > 1)>
${i18n().pages}:
<ul class="pagination">
<#list pages as page>
<#if page.selected>
<li class="selectedNavPage">${page.text}</li>
<#else>
<#-- RY Ideally the urls would be generated by the controller; see search-pagedResults.ftl -->
<li><a href="${urls.base}/individuallist?${page.param}&vclassId=${vclassId?url}" title="${i18n().page_text}">${page.text}</a></li>
</#if>
</#list>
</ul>
</#if>
</#assign>
${pagination}
<ul>
<#list individuals as individual>
<li>
<@shortView uri=individual.uri viewContext="index" />
</li>
</#list>
</ul>
${pagination}
</#if>
<#else>
${noDataNotification}
</#if>
</section> <!-- .individualList -->

View file

@ -189,7 +189,8 @@
supplyPrettyUrl: '${i18n().supply_url}', supplyPrettyUrl: '${i18n().supply_url}',
startUrlWithSlash: '${i18n().start_url_with_slash}', startUrlWithSlash: '${i18n().start_url_with_slash}',
supplyTemplate: '${i18n().supply_template}', supplyTemplate: '${i18n().supply_template}',
selectContentType: '${i18n().select_content_type}' selectContentType: '${i18n().select_content_type}',
multipleContentWithDefaultTemplateError: '${i18n().multiple_content_default_template_error}'
}; };
</script> </script>