NIHVIVO-3062 Merged r8856 from maint-rel-vivo-1.3 branch.

This commit is contained in:
cappadona 2011-07-26 21:08:34 +00:00
parent fc029333b9
commit b97cbb60e3
2 changed files with 39 additions and 54 deletions

View file

@ -5,7 +5,6 @@ var menuManagementEdit = {
this.initObjects(); this.initObjects();
this.bindEventListeners(); this.bindEventListeners();
this.toggleClassSelection(); this.toggleClassSelection();
//this.validateMenuItemForm();
}, },
initObjects: function() { initObjects: function() {
this.defaultTemplateRadio = $('input.default-template'); this.defaultTemplateRadio = $('input.default-template');
@ -17,7 +16,6 @@ var menuManagementEdit = {
this.selectClassGroupDropdown = $('#selectClassGroup'); this.selectClassGroupDropdown = $('#selectClassGroup');
this.classesForClassGroup = $('#classesInSelectedGroup'); this.classesForClassGroup = $('#classesInSelectedGroup');
this.selectedGroupForPage = $('#selectedContentTypeValue'); this.selectedGroupForPage = $('#selectedContentTypeValue');
// this.selectClassesMessage = $('#selectClassesMessage');
this.allClassesSelectedCheckbox = $('#allSelected'); this.allClassesSelectedCheckbox = $('#allSelected');
this.displayInternalMessage = $('#internal-class label em'); this.displayInternalMessage = $('#internal-class label em');
}, },
@ -31,9 +29,6 @@ var menuManagementEdit = {
this.selectClassGroupDropdown.change(function() { this.selectClassGroupDropdown.change(function() {
menuManagementEdit.chooseClassGroup(); menuManagementEdit.chooseClassGroup();
}); });
// this.allClassesSelectedCheckbox.change(function() {
// menuManagementEdit.toggleClassSelection();
// });
// Listeners for template field // Listeners for template field
this.defaultTemplateRadio.click(function(){ this.defaultTemplateRadio.click(function(){
@ -56,39 +51,29 @@ var menuManagementEdit = {
}); });
}, },
updateInternalClassMessage:function(classGroupName) { //User has changed content type updateInternalClassMessage:function(classGroupName) { //User has changed content type
//Set content type within internal class message //Set content type within internal class message
this.displayInternalMessage.filter(":first").html(classGroupName); this.displayInternalMessage.filter(":first").html(classGroupName);
}, },
showClassGroups: function() { //User has clicked change content type showClassGroups: function() { //User has clicked change content type
//Show the section with the class group dropdown //Show the section with the class group dropdown
this.selectContentType.removeClass("hidden"); this.selectContentType.removeClass("hidden");
//Hide the "change content type" section which shows the selected class group //Hide the "change content type" section which shows the selected class group
this.existingContentType.addClass("hidden"); this.existingContentType.addClass("hidden");
//Hide the checkboxes for classes within the class group //Hide the checkboxes for classes within the class group
this.classesForClassGroup.addClass("hidden"); this.classesForClassGroup.addClass("hidden");
}, },
hideClassGroups: function() { //User has selected class group/content type, page should show classes for class group and 'existing' type with change link hideClassGroups: function() { //User has selected class group/content type, page should show classes for class group and 'existing' type with change link
//Hide the class group dropdown //Hide the class group dropdown
this.selectContentType.addClass("hidden"); this.selectContentType.addClass("hidden");
//Show the "change content type" section which shows the selected class group //Show the "change content type" section which shows the selected class group
this.existingContentType.removeClass("hidden"); this.existingContentType.removeClass("hidden");
//Show the classes in the class group //Show the classes in the class group
this.classesForClassGroup.removeClass("hidden"); this.classesForClassGroup.removeClass("hidden");
}, },
toggleClassSelection: function() { toggleClassSelection: function() {
/*To do: please fix so selecting all selects all classes and deselecting
* any class will deselect all
*/
/*
if(this.allClassesSelectedCheckbox.is(':checked')) {
$('#classInClassGroup').attr('checked', 'checked');
} else {
$('#classInClassGroup').removeAttr('checked');
}*/
// Check/unckeck all classes for selection // Check/unckeck all classes for selection
$('input:checkbox[name=allSelected]').click(function(){ $('input:checkbox[name=allSelected]').click(function(){
// alert($('input:checkbox[name=classInClassGroup]'));
if ( this.checked ) { if ( this.checked ) {
// if checked, select all the checkboxes // if checked, select all the checkboxes
$('input:checkbox[name=classInClassGroup]').attr('checked','checked'); $('input:checkbox[name=classInClassGroup]').attr('checked','checked');
@ -116,21 +101,22 @@ var menuManagementEdit = {
} }
if ($("input:radio[name=selectedTemplate]:checked").val() == "custom") { if ($("input:radio[name=selectedTemplate]:checked").val() == "custom") {
if($("input[name=customTemplate]").val() == "") { if ($("input[name=customTemplate]").val() == "") {
validationError += "You must supply a template<br />"; validationError += "You must supply a template<br />";
} }
} }
//if no class group selected, this is an error //if no class group selected, this is an error
if ($("#selectClassGroup").val() =='-1'){ if ($("#selectClassGroup").val() =='-1'){
validationError += "You must supply a content type<br />"; validationError += "You must supply a content type<br />";
} else { } else {
//class group has been selected, make sure there is at least one class selected //class group has been selected, make sure there is at least one class selected
var noClassesSelected = $("input[name='classInClassGroup']:checked").length; var allSelected = $('input[name="allSelected"]:checked').length;
if(noClassesSelected == 0) { var noClassesSelected = $("input[name='classInClassGroup']:checked").length;
//at least one class should be selected if (allSelected == 0 && noClassesSelected == 0) {
validationError += "You must supply some content to display<br />"; //at least one class should be selected
} validationError += "You must select the type of content to display<br />";
}
} }

View file

@ -5,7 +5,8 @@
<#-- some additional processing here which shows or hides the class group selection and classes based on initial action--> <#-- some additional processing here which shows or hides the class group selection and classes based on initial action-->
<#assign existingClassGroupStyle = " " /> <#assign existingClassGroupStyle = " " />
<#assign selectClassGroupStyle = 'class="hidden"' /> <#assign selectClassGroupStyle = 'class="hidden"' />
<#if menuAction = "Add"> <#-- Reveal the class group and hide the class selects if adding a new menu item or editing an existing menu item with an empty class group (no classes)-->
<#if menuAction == "Add" || !classGroup?has_content>
<#assign existingClassGroupStyle = 'class="hidden"' /> <#assign existingClassGroupStyle = 'class="hidden"' />
<#assign selectClassGroupStyle = " " /> <#assign selectClassGroupStyle = " " />
</#if> </#if>
@ -38,16 +39,16 @@
<label class="inline" for="custom"> Custom template</label> <label class="inline" for="custom"> Custom template</label>
<section id="custom-template" <#if selectedTemplateType != 'custom'>class="hidden" </#if>role="region"> <section id="custom-template" <#if selectedTemplateType != 'custom'>class="hidden" </#if>role="region">
<input type="text" name="customTemplate" value="${customTemplate!}" size="30" role="input" /><span class="requiredHint"> *</span> <input type="text" name="customTemplate" value="${customTemplate!}" size="40" role="input" /><span class="requiredHint"> *</span>
</section> </section>
<section id="existingContentType" name="existingContentType" ${existingClassGroupStyle} role="region"> <section id="existingContentType" name="existingContentType" ${existingClassGroupStyle} role="region">
<p>Selected content type for the associated page</p> <p>Selected content type for the associated page</p>
<p> <p>
<span id="selectedContentTypeValue" name="selectedContentTypeValue">${associatedPage}</span> <span id="selectedContentTypeValue" name="selectedContentTypeValue">${associatedPage}</span>
<a href="#" id="changeContentType" name="changeContentType">Change content type</a> <a href="#" id="changeContentType" name="changeContentType">Change content type</a>
</p> </p>
</section> </section>
<#-- Select class group --> <#-- Select class group -->
<section id="selectContentType" name="selectContentType" ${selectClassGroupStyle} role="region"> <section id="selectContentType" name="selectContentType" ${selectClassGroupStyle} role="region">
@ -59,19 +60,17 @@
<option value="${aClassGroup.URI}" <#if aClassGroup.URI = associatedPageURI>selected</#if> role="option">${aClassGroup.publicName}</option> <option value="${aClassGroup.URI}" <#if aClassGroup.URI = associatedPageURI>selected</#if> role="option">${aClassGroup.publicName}</option>
</#list> </#list>
</select> </select>
</section> </section>
<section id="classesInSelectedGroup" name="classesInSelectedGroup" ${existingClassGroupStyle}> <section id="classesInSelectedGroup" name="classesInSelectedGroup" ${existingClassGroupStyle}>
<#-- Select classes in a class group --> <#-- Select classes in a class group -->
<p id="selectClassesMessage" name="selectClassesMessage">Select content to display<span class="requiredHint"> *</span></p> <p id="selectClassesMessage" name="selectClassesMessage">Select content to display<span class="requiredHint"> *</span></p>
<#include "menuManagement--classIntersections.ftl"> <#include "menuManagement--classIntersections.ftl">
<ul id="selectedClasses" name="selectedClasses" role="menu"> <ul id="selectedClasses" name="selectedClasses" role="menu">
<#--Adding a default class for "ALL" in case all classes selected--> <#--Adding a default class for "ALL" in case all classes selected-->
<li class="ui-state-default" role="menuitem"> <li class="ui-state-default" role="menuitem">
<input type="checkbox" name="allSelected" id="allSelected" value="all" <#if isClassGroupPage = true || includeAllClasses = true>checked</#if> /> <input type="checkbox" name="allSelected" id="allSelected" value="all" <#if !isIndividualsForClassesPage?has_content>checked</#if> />
<label class="inline" for="All"> All</label> <label class="inline" for="All"> All</label>
</li> </li>
<#list classGroup as classInClassGroup> <#list classGroup as classInClassGroup>