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

View file

@ -5,7 +5,8 @@
<#-- some additional processing here which shows or hides the class group selection and classes based on initial action-->
<#assign existingClassGroupStyle = " " />
<#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 selectClassGroupStyle = " " />
</#if>
@ -38,16 +39,16 @@
<label class="inline" for="custom"> Custom template</label>
<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 id="existingContentType" name="existingContentType" ${existingClassGroupStyle} role="region">
<p>Selected content type for the associated page</p>
<p>
<span id="selectedContentTypeValue" name="selectedContentTypeValue">${associatedPage}</span>
<a href="#" id="changeContentType" name="changeContentType">Change content type</a>
</p>
</section>
<section id="existingContentType" name="existingContentType" ${existingClassGroupStyle} role="region">
<p>Selected content type for the associated page</p>
<p>
<span id="selectedContentTypeValue" name="selectedContentTypeValue">${associatedPage}</span>
<a href="#" id="changeContentType" name="changeContentType">Change content type</a>
</p>
</section>
<#-- Select class group -->
<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>
</#list>
</select>
</section>
</section>
<section id="classesInSelectedGroup" name="classesInSelectedGroup" ${existingClassGroupStyle}>
<#-- Select classes in a class group -->
<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">
<#--Adding a default class for "ALL" in case all classes selected-->
<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>
</li>
<#list classGroup as classInClassGroup>