Cleaned up displayTBox.n3, updated menu management to remove special template for internal class and extended internal class data getter to utilize a custom restricted classes label called 'internal class'

This commit is contained in:
hjkhjk54 2011-07-15 18:26:19 +00:00
parent 414b84c2ad
commit 1059d4af68
6 changed files with 118 additions and 236 deletions

View file

@ -352,14 +352,7 @@ public class MenuManagementEdit extends VitroHttpServlet {
dataGetterModel = getIndividualsForClassesDataGetter(vreq, dataGetterResource, addModel, displayModel, pageResource);
}
addModel.add(dataGetterModel);
//Also add special template to page
addModel.add(addModel.createStatement(pageResource,
DisplayVocabulary.REQUIRES_BODY_TEMPLATE,
addModel.createTypedLiteral(DisplayVocabulary.INTERNAL_CLASS_TEMPLATE)));
}
}

View file

@ -83,6 +83,7 @@ public class MenuManagementController extends FreemarkerHttpServlet {
//Certain parameters are always passed
private void initializeData(Map<String, Object> data, VitroRequest vreq) {
//Form url submission
data.put("title", getCommand(vreq) + " Menu Item");
data.put("formUrls", vreq.getContextPath() + SUBMIT_FORM);
data.put("cancelUrl", vreq.getContextPath() + CANCEL_FORM);
data.put("internalClassUri", "");

View file

@ -120,7 +120,7 @@ public class DisplayVocabulary {
//URL for menu management
public static final String PROCESS_MENU_MANAGEMENT_URL = "/processEditDisplayModel";
public static final String REORDER_MENU_URL = PROCESS_MENU_MANAGEMENT_URL + "?cmd=Reorder&" + SWITCH_TO_DISPLAY_MODEL + "=true";
public static final String INTERNAL_CLASS_TEMPLATE = "menupage--individualsforclasses.ftl";
/* URIs for some individuals in the dispaly ontology */
public static final String HOME_MENU_ITEM = DISPLAY_NS + "HomeMenuItem";

View file

@ -31,7 +31,7 @@ import edu.cornell.mannlib.vitro.webapp.web.templatemodels.VClassGroupTemplateMo
*/
public class IndividualsForClassesDataGetter implements PageDataGetter{
private static final Log log = LogFactory.getLog(IndividualsForClassesDataGetter.class);
protected static String restrictClassesTemplateName = "restricted";
public Map<String,Object> getData(ServletContext context, VitroRequest vreq, String pageUri, Map<String, Object> page ){
HashMap<String, Object> data = new HashMap<String,Object>();
//This is the old technique of getting class intersections
@ -116,7 +116,7 @@ public class IndividualsForClassesDataGetter implements PageDataGetter{
restrictClassesArray = urlEncodedRestrictClasses.toArray(restrictClassesArray);
//In case just want uris
data.put("restrictClasses", StringUtils.join(restrictClassesArray, ","));
data.put(getRestrictClassesTemplateName(), StringUtils.join(restrictClassesArray, ","));
data.put("restrictVClasses", restrictVClasses);
//not sure if this is useful
data.put("restrictVClassGroup", restrictClassesGroup);
@ -204,4 +204,10 @@ public class IndividualsForClassesDataGetter implements PageDataGetter{
return 1;
}
}
//Get template parameter
private static String getRestrictClassesTemplateName() {
return restrictClassesTemplateName;
}
}

View file

@ -41,9 +41,12 @@ import edu.cornell.mannlib.vitro.webapp.dao.jena.ModelContext;
public class InternalClassesDataGetter extends IndividualsForClassesDataGetter{
private static final Log log = LogFactory.getLog(InternalClassesDataGetter.class);
@Override
public Map<String,Object> getData(ServletContext context, VitroRequest vreq, String pageUri, Map<String, Object> page ){
HashMap<String, Object> data = new HashMap<String,Object>();
//Set restricted classes template
super.restrictClassesTemplateName = "internalClass";
HashMap<String, Object> data = new HashMap<String,Object>();
//This is the old technique of getting class intersections
Map<String, Object> classIntersectionsMap = vreq.getWebappDaoFactory().getPageDao().getClassesAndCheckInternal(pageUri);