diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/edit/MenuManagementEdit.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/edit/MenuManagementEdit.java index 022847953..ad9592637 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/edit/MenuManagementEdit.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/edit/MenuManagementEdit.java @@ -155,8 +155,8 @@ public class MenuManagementEdit extends VitroHttpServlet { addStatements.write(a, "N3"); log.debug(a.toString()); a.close(); - //displayModel.remove(removeStatements); - //displayModel.add(addStatements); + displayModel.remove(removeStatements); + displayModel.add(addStatements); } catch(Exception ex) { @@ -448,8 +448,11 @@ public class MenuManagementEdit extends VitroHttpServlet { private void removeMenuName(OntModel displayModel, Model removeModel, VitroRequest vreq, Resource menuItemResource, Resource pageResource) { String menuName = vreq.getParameter("menuName"); - removeModel.add(displayModel.listStatements(menuItemResource, DisplayVocabulary.LINK_TEXT, (RDFNode) null)); - removeModel.add(removeModel.createStatement( + removeModel.add(displayModel.listStatements( + menuItemResource, + DisplayVocabulary.LINK_TEXT, + (RDFNode) null)); + removeModel.add(displayModel.listStatements( pageResource, ResourceFactory.createProperty(DisplayVocabulary.TITLE), (RDFNode) null)); @@ -459,6 +462,10 @@ public class MenuManagementEdit extends VitroHttpServlet { private void generateStatementsForAdd(Model addModel, OntModel displayModel, Resource menuItemResource, Resource pageResource) { //Need to generate the menu item and page in their entirety //Menu item + addModel.add(addModel.createStatement( + ResourceFactory.createResource(DisplayVocabulary.DEFAULT_MENU) + ,ResourceFactory.createProperty(DisplayVocabulary.HAS_ELEMENT), + menuItemResource)); addModel.add(addModel.createStatement(menuItemResource, RDF.type, DisplayVocabulary.NAVIGATION_ELEMENT)); addModel.add(addModel.createStatement(menuItemResource, DisplayVocabulary.MENU_POSITION, diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/InstitutionalInternalClassController.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/InstitutionalInternalClassController.java index 07b5c8980..e8d9273a8 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/InstitutionalInternalClassController.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/InstitutionalInternalClassController.java @@ -39,7 +39,7 @@ public class InstitutionalInternalClassController extends FreemarkerHttpServlet private static List localNamespaces = new ArrayList(); private static List localNamespaceClasses = new ArrayList(); private static final String CREATE_CLASS_PARAM = "createClass"; - + private static final String REDIRECT_PAGE = "/siteAdmin"; @Override protected Actions requiredActions(VitroRequest vreq) { return REQUIRED_ACTIONS; @@ -93,7 +93,6 @@ public class InstitutionalInternalClassController extends FreemarkerHttpServlet } private void processCreateOntologies(VitroRequest vreq, Map data) { - data.put("ontologiesExist", false); data.put("submitAction", ""); } @@ -106,22 +105,22 @@ public class InstitutionalInternalClassController extends FreemarkerHttpServlet private void processCreateNewClass(VitroRequest vreq, Map data) { //this may need to be changed on the basis of how new classes interact with new ontologies - data.put("ontolgiesExist", true); data.put("submitAction", "createClass"); + data.put("createNewClass", true); } private boolean isCreateNewClass(VitroRequest vreq) { String command = vreq.getParameter("cmd"); - if(command.equals(CREATE_CLASS_PARAM)) { + if(command != null && command.equals(CREATE_CLASS_PARAM)) { return true; } - //If no classes in local namespaces, then need to enable creation of new classes - return(localNamespaceClasses.size() == 0); + //If local namespace exists but no classes in local namespaces, then need to enable creation of new classes + return(localNamespaces.size() > 0 && localNamespaceClasses.size() == 0); } private void processSelectExistingClass(VitroRequest vreq, Map data) { //Check if internal class is already set and be sure to include that in the data to be returned - data.put("ontologiesExist", true); + data.put("useExistingInternalClass", true); data.put("submitAction", "save"); } @@ -140,8 +139,14 @@ public class InstitutionalInternalClassController extends FreemarkerHttpServlet data.put("existingLocalNamespaces", localNamespaceClasses); String noLocalOntologiesMessage = "There are currently no local ontologies. You must create a new ontology"; data.put("noLocalOntologiesMessage", noLocalOntologiesMessage); - if(localNamespaces.size() > 1) { - data.put("multipleLocalNamespaces", true); + if(localNamespaces.size() == 0) { + data.put("ontologiesExist", false); + } + else { + data.put("ontologiesExist", true); + if(localNamespaces.size() > 1) { + data.put("multipleLocalNamespaces", true); + } } } diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/MenuManagementController.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/MenuManagementController.java index 1df4407a2..3cd7cfbde 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/MenuManagementController.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/MenuManagementController.java @@ -38,7 +38,7 @@ public class MenuManagementController extends FreemarkerHttpServlet { private static final Log log = LogFactory.getLog(MenuManagementController.class); protected final static String SUBMIT_FORM = "/processEditDisplayModel"; protected final static String CANCEL_FORM = "/individual?uri=http%3A%2F%2Fvitro.mannlib.cornell.edu%2Fontologies%2Fdisplay%2F1.1%23DefaultMenu&switchToDisplayModel=true"; - + protected final static String DELETE_FORM = "menuManagement-remove.ftl"; protected final static String EDIT_FORM = "testMenuManagement.ftl"; protected final static String CMD_PARAM = "cmd"; protected final static String EDIT_PARAM_VALUE = "edit"; @@ -64,18 +64,19 @@ public class MenuManagementController extends FreemarkerHttpServlet { //if no menu item passed, return empty data //TODO: Check if exception needs to be thrown String cmd = getCommand(vreq); - + String template = EDIT_FORM; if(cmd.equals(ADD_PARAM_VALUE)) { processAddMenuItem(vreq, data); } else if(cmd.equals(EDIT_PARAM_VALUE)) { processEditMenuItem(vreq, data); } else if(cmd.equals(DELETE_PARAM_VALUE)) { processDeleteMenuItem(vreq, data); + template = DELETE_FORM; } else { //Throw some kind of error or do nothing } - return new TemplateResponseValues(EDIT_FORM, data); + return new TemplateResponseValues(template, data); } @@ -109,8 +110,8 @@ public class MenuManagementController extends FreemarkerHttpServlet { data.put("menuAction", "Remove"); //Generate empty values for fields //TODO: Remove these if only portion of template utilized - data.put("menuItem", ""); - data.put("menuName", ""); + + data.put("prettyUrl", ""); data.put("associatedPage", ""); data.put("associatedPageURI", ""); diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/DisplayVocabulary.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/DisplayVocabulary.java index a1017f6bb..4e1f574e0 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/DisplayVocabulary.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/DisplayVocabulary.java @@ -26,6 +26,7 @@ public class DisplayVocabulary { private static final String NS = DISPLAY_NS; /* Individuals */ + public static final String DEFAULT_MENU = NS + "DefaultMenu"; public static final String SEARCH_INDEX_URI = NS + "SearchIndex"; //bk392 for extracting properties beyond context nodes. @@ -43,11 +44,13 @@ public class DisplayVocabulary { public static final String CLASS_INTERSECTION = NS + "intersectsWithClass"; public static final String HAS_CLASS_INTERSECTION = NS + "hasClassIntersection"; public static final String ITEM_TO_PAGE = NS + "toPage"; + public static final String HAS_ELEMENT = NS + "hasElement"; + /**Data Getter object properties **/ public static final String HAS_DATA_GETTER = NS + "hasDataGetter"; public static final String GETINDIVIDUALS_FOR_CLASS = NS + "getIndividualsForClass"; public static final String RESTRICT_RESULTS_BY = NS + "restrictResultsByClass"; - + /* Data Properties */ public static final DatatypeProperty URL_MAPPING = m_model.createDatatypeProperty(NS + "urlMapping"); diff --git a/webapp/web/templates/freemarker/edit/forms/institutionalInternalClassForm.ftl b/webapp/web/templates/freemarker/edit/forms/institutionalInternalClassForm.ftl index 604bed6d2..7e538d5a6 100644 --- a/webapp/web/templates/freemarker/edit/forms/institutionalInternalClassForm.ftl +++ b/webapp/web/templates/freemarker/edit/forms/institutionalInternalClassForm.ftl @@ -24,7 +24,7 @@ edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.Institu ${noLocalOntologiesMessage} - <#else if useExistingInternalClass = true> + <#elseif useExistingInternalClass?has_content>
<#--Populated based on class list returned-->
- <#else if createNewClass = true> + <#elseif createNewClass?has_content>

Create a new class