Index: lams_central/conf/language/lams/ApplicationResources.properties =================================================================== diff -u -red69b9ac6d0b83c7f679152d7c791319fc18b6d8 -r45fed3363a33132c11cbe19c2bc8e8c7f053f69b --- lams_central/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision ed69b9ac6d0b83c7f679152d7c791319fc18b6d8) +++ lams_central/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 45fed3363a33132c11cbe19c2bc8e8c7f053f69b) @@ -533,7 +533,7 @@ authoring.fla.save.sequence.title.prompt =Please enter a title for the sequence authoring.fla.import.part.choose.prompt =Click on activities to choose them for import authoring.fla.folder.not.selected.error =Please choose a folder -authoring.fla.title.validation.error =The title can not contain any of these characters < > ^ * @ % $ +authoring.fla.title.validation.error =The title must not be blank and must not contain any of these characters < > ^ * @ % $ authoring.fla.folder.exists.error =A folder with this name already exists. authoring.fla.sequence.exists.error =A sequence with this name already exists. authoring.fla.sequence.save.error =Error while saving sequence @@ -599,7 +599,7 @@ authoring.fla.groups.to.default.branch.confirm =All remaining groups will be mapped to the default branch authoring.fla.range.condition.add.start.error =The start value can not be within the range of an existing condition authoring.fla.range.condition.add.end.error =The end value can not be within the range of an existing condition -authoring.fla.group.title.validation.erorr =Group name can not contain any of these characters < > ^ * @ % $ +authoring.fla.group.title.validation.erorr =Group name must not be blank and must not contain any of these characters < > ^ * @ % $ authoring.fla.page.title =Authoring authoring.fla.page.menu.new =New authoring.fla.page.menu.open =Open Index: lams_central/conf/language/lams/ApplicationResources_en_AU.properties =================================================================== diff -u -red69b9ac6d0b83c7f679152d7c791319fc18b6d8 -r45fed3363a33132c11cbe19c2bc8e8c7f053f69b --- lams_central/conf/language/lams/ApplicationResources_en_AU.properties (.../ApplicationResources_en_AU.properties) (revision ed69b9ac6d0b83c7f679152d7c791319fc18b6d8) +++ lams_central/conf/language/lams/ApplicationResources_en_AU.properties (.../ApplicationResources_en_AU.properties) (revision 45fed3363a33132c11cbe19c2bc8e8c7f053f69b) @@ -533,7 +533,7 @@ authoring.fla.save.sequence.title.prompt =Please enter a title for the sequence authoring.fla.import.part.choose.prompt =Click on activities to choose them for import authoring.fla.folder.not.selected.error =Please choose a folder -authoring.fla.title.validation.error =The title can not contain any of these characters < > ^ * @ % $ +authoring.fla.title.validation.error =The title must not be blank and must not contain any of these characters < > ^ * @ % $ authoring.fla.folder.exists.error =A folder with this name already exists. authoring.fla.sequence.exists.error =A sequence with this name already exists. authoring.fla.sequence.save.error =Error while saving sequence @@ -599,7 +599,7 @@ authoring.fla.groups.to.default.branch.confirm =All remaining groups will be mapped to the default branch authoring.fla.range.condition.add.start.error =The start value can not be within the range of an existing condition authoring.fla.range.condition.add.end.error =The end value can not be within the range of an existing condition -authoring.fla.group.title.validation.erorr =Group name can not contain any of these characters < > ^ * @ % $ +authoring.fla.group.title.validation.erorr =Group name must not be blank and must not contain any of these characters < > ^ * @ % $ authoring.fla.page.title =Authoring authoring.fla.page.menu.new =New authoring.fla.page.menu.open =Open Index: lams_central/web/includes/javascript/authoring/authoringGeneral.js =================================================================== diff -u -rc0139ca013c585dddf14207a53412df2b7f65924 -r45fed3363a33132c11cbe19c2bc8e8c7f053f69b --- lams_central/web/includes/javascript/authoring/authoringGeneral.js (.../authoringGeneral.js) (revision c0139ca013c585dddf14207a53412df2b7f65924) +++ lams_central/web/includes/javascript/authoring/authoringGeneral.js (.../authoringGeneral.js) (revision 45fed3363a33132c11cbe19c2bc8e8c7f053f69b) @@ -327,7 +327,7 @@ if (!title) { return; } - if (!GeneralLib.nameValidator.test(title)) { + if (!GeneralLib.validateName(title)) { alert(LABELS.TITLE_VALIDATION_ERROR); return; } @@ -490,7 +490,7 @@ if (!title || ldNode.label == title) { return; } - if (!GeneralLib.nameValidator.test(title)) { + if (!GeneralLib.validateName(title)) { alert(LABELS.TITLE_VALIDATION_ERROR); return; } @@ -549,7 +549,7 @@ return; } - if (!GeneralLib.nameValidator.test(title)) { + if (!GeneralLib.validateName(title)) { alert(LABELS.TITLE_VALIDATION_ERROR); return; } @@ -2828,5 +2828,12 @@ }); }); } - } + }, + + /** + * Checks if activity, LD etc. name is correct + */ + validateName : function(name) { + return name && GeneralLib.nameValidator.test(name); + } }; \ No newline at end of file Index: lams_central/web/includes/javascript/authoring/authoringProperty.js =================================================================== diff -u -r3cf8e8bc79ba0a47cc19adeb1caa23284a3aedd0 -r45fed3363a33132c11cbe19c2bc8e8c7f053f69b --- lams_central/web/includes/javascript/authoring/authoringProperty.js (.../authoringProperty.js) (revision 3cf8e8bc79ba0a47cc19adeb1caa23284a3aedd0) +++ lams_central/web/includes/javascript/authoring/authoringProperty.js (.../authoringProperty.js) (revision 45fed3363a33132c11cbe19c2bc8e8c7f053f69b) @@ -68,11 +68,12 @@ } // validate and save the title if (newTitle != branchingActivity.title) { - if (GeneralLib.nameValidator.test(newTitle)) { + if (GeneralLib.validateName(newTitle)) { branchingActivity.title = newTitle; redrawNeeded = true; } else { alert(LABELS.TITLE_VALIDATION_ERROR); + $('.propertiesContentFieldTitle', content).val(branchingActivity.title); } } branchingActivity.branchingType = $('.propertiesContentFieldBranchingType', content).val(); @@ -198,11 +199,12 @@ } // validate and save the title if (newTitle != activity.title) { - if (GeneralLib.nameValidator.test(newTitle)) { + if (GeneralLib.validateName(newTitle)) { activity.title = newTitle; redrawNeeded = true; } else { alert(LABELS.TITLE_VALIDATION_ERROR); + $('.propertiesContentFieldTitle', content).val(activity.title); } } @@ -306,11 +308,12 @@ } // validate and save the title if (newTitle != activity.title) { - if (GeneralLib.nameValidator.test(newTitle)) { + if (GeneralLib.validateName(newTitle)) { activity.title = newTitle; redrawNeeded = true; } else { alert(LABELS.TITLE_VALIDATION_ERROR); + $('.propertiesContentFieldTitle', content).val(activity.title); } } @@ -432,11 +435,12 @@ } // validate and save the title if (newTitle != label.title) { - if (GeneralLib.nameValidator.test(newTitle)) { + if (GeneralLib.validateName(newTitle)) { label.title = newTitle; redrawNeeded = true; } else { alert(LABELS.TITLE_VALIDATION_ERROR); + $('.propertiesContentFieldTitle', content).val(label.title); } } @@ -492,14 +496,15 @@ } // validate and save the title if (newTitle != activity.title) { - if (GeneralLib.nameValidator.test(newTitle)) { + if (GeneralLib.validateName(newTitle)) { activity.title = newTitle; ActivityLib.removeSelectEffect(activity); activity.draw(); ActivityLib.addSelectEffect(activity, true); GeneralLib.setModified(true); } else { alert(LABELS.TITLE_VALIDATION_ERROR); + $('.propertiesContentFieldTitle', content).val(activity.title); } } }); @@ -563,11 +568,12 @@ } // validate and save the title if (newTitle != activity.title) { - if (GeneralLib.nameValidator.test(newTitle)) { + if (GeneralLib.validateName(newTitle)) { activity.title = newTitle; redrawNeeded = true; } else { alert(LABELS.TITLE_VALIDATION_ERROR); + $('.propertiesContentFieldTitle', content).val(activity.title); } } var newGroupingValue = $('.propertiesContentFieldGrouping option:selected', content) @@ -630,11 +636,12 @@ } // validate and save the title if (newTitle != region.title) { - if (GeneralLib.nameValidator.test(newTitle)) { + if (GeneralLib.validateName(newTitle)) { region.title = newTitle; redrawNeeded = true; } else { alert(LABELS.TITLE_VALIDATION_ERROR); + $('.propertiesContentFieldTitle', content).val(region.title); } } redrawNeeded |= newColor != color; @@ -682,11 +689,12 @@ } // validate and save the title if (newTitle != activity.title) { - if (GeneralLib.nameValidator.test(newTitle)) { + if (GeneralLib.validateName(newTitle)) { activity.title = newTitle; redrawNeeded = true; } else { alert(LABELS.TITLE_VALIDATION_ERROR); + $('.propertiesContentFieldTitle', content).val(activity.title); } } @@ -745,14 +753,15 @@ // validate and save the title if (newTitle != transition.title) { - if (GeneralLib.nameValidator.test(newTitle)) { + if (GeneralLib.validateName(newTitle)) { transition.title = newTitle; if (transition.branch) { transition.branch.title = newTitle; } redrawNeeded = true; } else { alert(LABELS.TITLE_VALIDATION_ERROR); + $('.propertiesContentFieldTitle', content).val(transition.title); } } @@ -820,7 +829,7 @@ // extract group names from text fields and validate them $('input', groupNamingContent).each(function(){ var groupName = $(this).val().trim(); - if (GeneralLib.nameValidator.test(groupName)) { + if (GeneralLib.validateName(groupName)) { names.push(groupName); } else { error = LABELS.GROUP_TITLE_VALIDATION_ERORR;