diff --git a/webapp/web/css/menupage/pageManagement.css b/webapp/web/css/menupage/pageManagement.css index c0798f957..dfd3e97c9 100644 --- a/webapp/web/css/menupage/pageManagement.css +++ b/webapp/web/css/menupage/pageManagement.css @@ -31,7 +31,7 @@ float:right; padding-right:5px; } -.sparqlHtmlContent { +.contentSectionContainer { background-color:#f9f9f9; padding-left:6px; padding-top:2px; @@ -86,9 +86,9 @@ p#templatePTag { margin-top:8px; margin-bottom:2px; } -p#checkboxPTag { - margin-top:10px; - margin-bottom:0px; +p#menuCheckboxPTag { + margin-top:15px; + margin-bottom:3px; } section.hideMenuSection { margin-top:10px; @@ -97,6 +97,10 @@ section.hideMenuSection { section.showMenuSection { margin-top:10px; } +section#addPageOne { + margin-bottom:-12px; + margin-top:8px; +} input.doneWithContent { display: inline; padding: 5px 18px 7px; @@ -118,6 +122,12 @@ input.doneWithContent { margin-bottom:8px; margin-top:0px; } +input#contentCheckbox { + margin-left:30px; + margin-top:5px; + vertical-align:top; + padding: 0; +} span.deleteLinkContainer { float:left; margin-left:100px; diff --git a/webapp/web/js/menupage/pageManagementUtils.js b/webapp/web/js/menupage/pageManagementUtils.js index 63af344b3..b134b3b47 100644 --- a/webapp/web/js/menupage/pageManagementUtils.js +++ b/webapp/web/js/menupage/pageManagementUtils.js @@ -105,10 +105,11 @@ var pageManagementUtils = { //From original menu management edit this.defaultTemplateRadio = $('input.default-template'); this.customTemplateRadio = $('input.custom-template'); + this.selfContainedTemplateRadio = $('input.selfContained-template'); this.customTemplate = $('#custom-template'); //In this version, these don't exist but we can consider this later // this.changeContentType = $('#changeContentType'); - this.selectContentType = $('#selectContentType'); + // this.selectContentType = $('#selectContentType'); // this.existingContentType = $('#existingContentType'); this.selectClassGroupDropdown = $('select#selectClassGroup'); this.classesForClassGroup = $('section#classesInSelectedGroup'); @@ -141,7 +142,6 @@ var pageManagementUtils = { this.sparqlQuerySection.hide(); this.fixedHTMLSection.hide(); this.classesForClassGroup.addClass('hidden'); -// tlw72 this.moreContentButton.hide(); //left side components //These depend on whether or not this is an existing item or not if(this.isAdd()) { @@ -161,12 +161,22 @@ var pageManagementUtils = { pageManagementUtils.customTemplate.addClass('hidden'); //Also clear custom template value so as not to submit it pageManagementUtils.clearInputs(pageManagementUtils.customTemplate); + pageManagementUtils.rightSideDiv.show(); + pageManagementUtils.disablePageSave(); }); this.customTemplateRadio.click( function() { pageManagementUtils.customTemplate.removeClass('hidden'); + pageManagementUtils.rightSideDiv.show(); + pageManagementUtils.disablePageSave(); }); + this.selfContainedTemplateRadio.click( function() { + pageManagementUtils.customTemplate.removeClass('hidden'); + pageManagementUtils.rightSideDiv.hide(); + pageManagementUtils.enablePageSave(); + }); + this.isMenuCheckbox.click( function() { if ( pageManagementUtils.menuSection.is(':hidden') ) { pageManagementUtils.menuSection.show(); @@ -190,6 +200,8 @@ var pageManagementUtils = { pageManagementUtils.sparqlQuerySection.hide(); pageManagementUtils.contentTypeSelectOptions.eq(0).attr('selected', 'selected'); pageManagementUtils.contentTypeSelect.focus(); + pageManagementUtils.adjustSaveButtonHeight(); + pageManagementUtils.checkSelfContainedRadio(); }); //replacing with menu management edit version which is extended with some of the logic below this.selectClassGroupDropdown.change(function() { @@ -242,16 +254,19 @@ var pageManagementUtils = { //Form submission handleFormSubmission:function(event) { var validationError = pageManagementUtils.validateMenuItemForm(); - //Add any errors from page content sections - validationError += pageManagementUtils.validatePageContentSections(); + //Add any errors from page content sections if necessary + // Only validate the content sections if the self contained template section is NOT selected tlw72 + if ( !pageManagementUtils.selfContainedTemplate.is(':checked') ) { + validationError += pageManagementUtils.validatePageContentSections(); + } if (validationError == "") { //Check if menu label needs to be page title pageManagementUtils.checkMenuTitleSubmission(); - //Create the appropriate json objects + //Create the appropriate json objects if necessary pageManagementUtils.createPageContentForSubmission(); + pageManagementUtils.mapCustomTemplateName(); return true; } else{ - $('#error-alert').removeClass('hidden'); $('#error-alert p').html(validationError); event.preventDefault(); @@ -278,6 +293,7 @@ var pageManagementUtils = { pageManagementUtils.sparqlQuerySection.hide(); pageManagementUtils.headerBar.text("Browse Class Group - "); pageManagementUtils.headerBar.show(); + $('div#selfContainedDiv').hide(); } if ( _this.contentTypeSelect.val() == "fixedHtml" || _this.contentTypeSelect.val() == "sparqlQuery" ) { pageManagementUtils.classGroupSection.hide(); @@ -295,6 +311,7 @@ var pageManagementUtils = { pageManagementUtils.headerBar.show(); pageManagementUtils.classesForClassGroup.addClass('hidden'); + $('div#selfContainedDiv').hide(); } if ( _this.contentTypeSelect.val() == "" ) { pageManagementUtils.classGroupSection.hide(); @@ -303,6 +320,7 @@ var pageManagementUtils = { pageManagementUtils.classesForClassGroup.addClass('hidden'); pageManagementUtils.headerBar.hide(); pageManagementUtils.headerBar.text(""); + pageManagementUtils.checkSelfContainedRadio(); } //Collapse any divs for existing content if it exists pageManagementUtils.collapseAllExistingContent(); @@ -337,7 +355,6 @@ var pageManagementUtils = { }, clearInputs:function($el) { // jquery selector :input selects all input text area select and button elements - // $el.find("input").val(""); cannot delete the value of the done button -- tlw72 $el.find("input").each( function() { if ( $(this).attr('id') != "doneWithContent" ) { $(this).val(""); @@ -445,7 +462,7 @@ var pageManagementUtils = { }); //remove button - $newRemoveLink = $innerDiv.find('a#remove' + counter); // tlw72 changed button to link + $newRemoveLink = $innerDiv.find('a#remove' + counter); //remove the content entirely $newRemoveLink.click(function(event) { //if content type of what is being deleted is browse class group, then @@ -457,6 +474,7 @@ var pageManagementUtils = { //remove the section $innerDiv.parent("div").remove(); pageManagementUtils.adjustSaveButtonHeight(); + pageManagementUtils.checkSelfContainedRadio(); //Because this is now a link, have to prevent default action of navigating to link event.preventDefault(); }); @@ -465,7 +483,7 @@ var pageManagementUtils = { createCloneObject:function(contentType, counter) { var originalObjectPath = 'section#' + contentType; var $newContentObj = $(originalObjectPath).clone(); - $newContentObj.removeClass("sparqlHtmlContent"); + $newContentObj.removeClass("contentSectionContainer"); $newContentObj.addClass("pageContent"); $newContentObj.attr("contentNumber", counter); //Save content type @@ -794,6 +812,22 @@ var pageManagementUtils = { }); } return validationErrorMsg; + }, + + //If the selfContained-template radio is checked, copy the custom template name to the hidden + //selfContainedTemplate input element. We need that for edit mode to select the correct radio button. + mapCustomTemplateName:function() { + if ( this.selfContainedTemplateRadio.is(':checked') ) { + $("input[name='selfContainedTemplate']").val($("input[name='customTemplate']").val()); + } + }, + + //If any content is defined, keep the selContained radio button hidden + checkSelfContainedRadio:function() { + if ( pageManagementUtils.savedContentDivs.html().length == 0 ) { + $('div#selfContainedDiv').show(); + } + } } diff --git a/webapp/web/templates/freemarker/edit/forms/pageManagement--browseClassGroups.ftl b/webapp/web/templates/freemarker/edit/forms/pageManagement--browseClassGroups.ftl index 841a431a3..0b26408f3 100644 --- a/webapp/web/templates/freemarker/edit/forms/pageManagement--browseClassGroups.ftl +++ b/webapp/web/templates/freemarker/edit/forms/pageManagement--browseClassGroups.ftl @@ -17,7 +17,7 @@ <#--HTML Portion--> -
+
diff --git a/webapp/web/templates/freemarker/edit/forms/pageManagement--fixedHtml.ftl b/webapp/web/templates/freemarker/edit/forms/pageManagement--fixedHtml.ftl index 7f370d9d4..a0867b7dc 100644 --- a/webapp/web/templates/freemarker/edit/forms/pageManagement--fixedHtml.ftl +++ b/webapp/web/templates/freemarker/edit/forms/pageManagement--fixedHtml.ftl @@ -1,7 +1,7 @@ <#-- $This file is distributed under the terms of the license in /doc/license.txt$ --> <#--This contains the template for the fixed HTML content type that is to be cloned and used in page management--> -
+
diff --git a/webapp/web/templates/freemarker/edit/forms/pageManagement--sparqlQuery.ftl b/webapp/web/templates/freemarker/edit/forms/pageManagement--sparqlQuery.ftl index 701e9175a..0a4556f2e 100644 --- a/webapp/web/templates/freemarker/edit/forms/pageManagement--sparqlQuery.ftl +++ b/webapp/web/templates/freemarker/edit/forms/pageManagement--sparqlQuery.ftl @@ -1,6 +1,6 @@ <#-- $This file is distributed under the terms of the license in /doc/license.txt$ --> <#--This contains the template for the Sparql Query content type that is to be cloned and used in page management--> -
+
<#--Hiding query model for now--> diff --git a/webapp/web/templates/freemarker/edit/forms/pageManagement.ftl b/webapp/web/templates/freemarker/edit/forms/pageManagement.ftl index ce6e68e69..7bbfd170b 100644 --- a/webapp/web/templates/freemarker/edit/forms/pageManagement.ftl +++ b/webapp/web/templates/freemarker/edit/forms/pageManagement.ftl @@ -25,9 +25,14 @@ <#assign menuItem = lvf.getFormFieldValue(editSubmission, editConfiguration, "menuItem")/> <#assign menuLinkText = lvf.getFormFieldValue(editSubmission, editConfiguration, "menuLinkText")/> <#assign customTemplate = lvf.getFormFieldValue(editSubmission, editConfiguration, "customTemplate")/> + <#assign selfContainedTemplate = lvf.getFormFieldValue(editSubmission, editConfiguration, "selfContainedTemplate")/> <#assign pageHeading = "Edit Page" /> <#if customTemplate?has_content> - <#assign selectedTemplateType = "custom" /> + <#if selfContainedTemplate?has_content> + <#assign selectedTemplateType = "selfContained" /> + <#else> + <#assign selectedTemplateType = "custom" /> + <#assign editMenuPosition = lvf.getFormFieldValue(editSubmission, editConfiguration, "menuPosition")/> <#--if menu position exists for a menu item, then use that, otherwise use the highest available menu position number from page data--> @@ -64,13 +69,13 @@
- -  Add one or more content types + +  Add one or more types
@@ -95,11 +100,15 @@
checked="checked" role="input" /> - + +
+ checked="checked" role="input" /> +
class="hidden" role="region"> * +
-

checked="checked" > This is a menu page