updates to validation for menu management and update for checking default namespace and not throwing error if /individual not found

This commit is contained in:
hjkhjk54 2011-07-15 20:35:14 +00:00
parent fdcdb4c34c
commit 1459228d5a
2 changed files with 23 additions and 12 deletions

View file

@ -56,6 +56,8 @@ public class LocalNamespaceClassUtils {
//Get all namespacs //Get all namespacs
//There's an APP for that! //There's an APP for that!
//defualt namespace pattern is null if the default namespace does not employ /individual
if(defaultNamespacePattern != null) {
OntologyDao dao = vreq.getFullWebappDaoFactory().getOntologyDao(); OntologyDao dao = vreq.getFullWebappDaoFactory().getOntologyDao();
List<Ontology> onts = dao.getAllOntologies(); List<Ontology> onts = dao.getAllOntologies();
for(Ontology on: onts) { for(Ontology on: onts) {
@ -66,6 +68,7 @@ public class LocalNamespaceClassUtils {
foundNamespaces.put(uri, name + " (" + prefix + ")"); foundNamespaces.put(uri, name + " (" + prefix + ")");
} }
} }
}
return foundNamespaces; return foundNamespaces;
} }
@ -73,7 +76,13 @@ public class LocalNamespaceClassUtils {
public static String getDefaultOntologyNamespace(VitroRequest vreq) { public static String getDefaultOntologyNamespace(VitroRequest vreq) {
String defaultNamespace= vreq.getWebappDaoFactory().getDefaultNamespace(); String defaultNamespace= vreq.getWebappDaoFactory().getDefaultNamespace();
//Assuming following linked data approach so expects /individual at end //Assuming following linked data approach so expects /individual at end
defaultNamespace = defaultNamespace.substring(0, defaultNamespace.lastIndexOf("/individual")) + "/ontology/"; int lastIndex = defaultNamespace.lastIndexOf("/individual");
//if namespace is correct
if(lastIndex != -1) {
defaultNamespace = defaultNamespace.substring(0, lastIndex) + "/ontology/";
return defaultNamespace; return defaultNamespace;
} else {
return null;
}
} }
} }

View file

@ -47,6 +47,7 @@ var menuManagementEdit = {
if (validationError == "") { if (validationError == "") {
$(this).submit(); $(this).submit();
} else{ } else{
alert(validationError);
$('#error-alert').removeClass('hidden'); $('#error-alert').removeClass('hidden');
$('#error-alert p').html(validationError); $('#error-alert p').html(validationError);
return false; return false;
@ -82,6 +83,7 @@ var menuManagementEdit = {
}*/ }*/
// 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');