Changes to vclass, object property, and data property editing forms (JSPs) and controllers, plus one new vitro.css class

This commit is contained in:
jcorson-rikert 2012-06-25 17:01:41 +00:00
parent c36d9565a1
commit 9c7e231324
7 changed files with 438 additions and 405 deletions

View file

@ -21,6 +21,7 @@ import edu.cornell.mannlib.vedit.beans.FormObject;
import edu.cornell.mannlib.vedit.controller.BaseEditController;
import edu.cornell.mannlib.vitro.webapp.auth.permissions.SimplePermission;
import edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty;
import edu.cornell.mannlib.vitro.webapp.beans.DataProperty;
import edu.cornell.mannlib.vitro.webapp.beans.PropertyGroup;
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
import edu.cornell.mannlib.vitro.webapp.controller.Controllers;
@ -28,6 +29,7 @@ import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
import edu.cornell.mannlib.vitro.webapp.dao.ObjectPropertyDao;
import edu.cornell.mannlib.vitro.webapp.dao.PropertyGroupDao;
import edu.cornell.mannlib.vitro.webapp.dao.VClassDao;
import edu.cornell.mannlib.vitro.webapp.dao.DataPropertyDao;
public class PropertyEditController extends BaseEditController {
@ -46,6 +48,7 @@ public class PropertyEditController extends BaseEditController {
ObjectPropertyDao propDao = vreq.getFullWebappDaoFactory().getObjectPropertyDao();
VClassDao vcDao = vreq.getFullWebappDaoFactory().getVClassDao();
PropertyGroupDao pgDao = vreq.getFullWebappDaoFactory().getPropertyGroupDao();
DataPropertyDao dpDao = vreq.getFullWebappDaoFactory().getDataPropertyDao();
ObjectProperty p = (ObjectProperty)propDao.getObjectPropertyByURI(request.getParameter("uri"));
request.setAttribute("property",p);
@ -57,15 +60,15 @@ public class PropertyEditController extends BaseEditController {
results.add("display name"); // column 5
results.add("group"); // column 6
results.add("display tier"); // column 7
results.add("example"); // column 8
results.add("description"); // column 9
results.add("public description"); // column 10
results.add("public description"); // column 8
results.add("example"); // column 9
results.add("editor description"); // column 10
results.add("display level"); //column 11
results.add("update level"); // column 12
results.add("custom entry form"); // column 13
results.add("select from existing"); // column 14
results.add("offer create new option"); // column 15
results.add("force stub object deletion"); // column 16
results.add("relatedsort direction"); // column 16
results.add("URI"); // column 17
String displayName = (p.getDomainPublic()==null) ? p.getLocalName() : p.getDomainPublic();
@ -135,12 +138,12 @@ public class PropertyEditController extends BaseEditController {
results.add("unspecified"); // column 6
}
results.add("domain: "+p.getDomainDisplayTier() + ", range: "+p.getRangeDisplayTier()); // column 7
String exampleStr = (p.getExample() == null) ? "" : p.getExample();
results.add(exampleStr); // column 8
String descriptionStr = (p.getDescription() == null) ? "" : p.getDescription();
results.add(descriptionStr); // column 9
String publicDescriptionStr = (p.getPublicDescription() == null) ? "" : p.getPublicDescription();
results.add(publicDescriptionStr); // column 10
results.add(publicDescriptionStr); // column 8
String exampleStr = (p.getExample() == null) ? "" : p.getExample();
results.add(exampleStr); // column 9
String descriptionStr = (p.getDescription() == null) ? "" : p.getDescription();
results.add(descriptionStr); // column 10
results.add(p.getHiddenFromDisplayBelowRoleLevel() == null ? "unspecified" : p.getHiddenFromDisplayBelowRoleLevel().getLabel()); // column 11
results.add(p.getProhibitedFromUpdateBelowRoleLevel() == null ? "unspecified" : p.getProhibitedFromUpdateBelowRoleLevel().getLabel()); // column 12
@ -148,7 +151,26 @@ public class PropertyEditController extends BaseEditController {
results.add(p.getCustomEntryForm() == null ? "unspecified" : p.getCustomEntryForm()); // column 13
results.add(p.getSelectFromExisting() ? "true" : "false"); // column 14
results.add(p.getOfferCreateNewOption() ? "true" : "false"); // column 15
results.add(p.getStubObjectRelation() ? "true" : "false"); // column 16
//results.add(p.getStubObjectRelation() ? "true" : "false"); // column 16
/*
String datapropStr = "";
if (p.getObjectIndividualSortPropertyURI() != null) {
DataProperty dProp = dpDao.getDataPropertyByURI(p.getObjectIndividualSortPropertyURI());
if (dProp != null && dProp.getURI() != null && dProp.getLocalNameWithPrefix() != null) {
try {
datapropStr = "<a href=\"datapropEdit?uri="+URLEncoder.encode(dProp.getURI(),"UTF-8")+"\">"+dProp.getLocalNameWithPrefix()+"</a>";
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
results.add(datapropStr); // column 16
} else {
results.add("name (rdfs:label)"); // column 16
}
*/
results.add(p.getDomainEntitySortDirection() == null ? "ascending" : p.getDomainEntitySortDirection()); // column 16
results.add(p.getURI()); // column 17
request.setAttribute("results",results);
request.setAttribute("columncount",NUM_COLS);

View file

@ -37,7 +37,6 @@ import edu.cornell.mannlib.vitro.webapp.beans.VClass;
import edu.cornell.mannlib.vitro.webapp.controller.Controllers;
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
import edu.cornell.mannlib.vitro.webapp.controller.edit.utils.RoleLevelOptionsSetup;
import edu.cornell.mannlib.vitro.webapp.dao.DataPropertyDao;
import edu.cornell.mannlib.vitro.webapp.dao.ObjectPropertyDao;
import edu.cornell.mannlib.vitro.webapp.dao.OntologyDao;
import edu.cornell.mannlib.vitro.webapp.dao.VClassDao;
@ -74,7 +73,6 @@ public class PropertyRetryController extends BaseEditController {
epo.setDataAccessObject(propDao);
OntologyDao ontDao = request.getFullWebappDaoFactory().getOntologyDao();
VClassDao vclassDao = request.getFullWebappDaoFactory().getVClassDao();
DataPropertyDao dpDao = request.getFullWebappDaoFactory().getDataPropertyDao();
ObjectProperty propertyForEditing = null;
if (!epo.getUseRecycledBean()){
@ -166,7 +164,9 @@ public class PropertyRetryController extends BaseEditController {
request.setAttribute("inverseFunctional",propertyForEditing.getInverseFunctional());
request.setAttribute("selectFromExisting",propertyForEditing.getSelectFromExisting());
request.setAttribute("offerCreateNewOption", propertyForEditing.getOfferCreateNewOption());
request.setAttribute("stubObjectRelation", propertyForEditing.getStubObjectRelation());
//request.setAttribute("stubObjectRelation", propertyForEditing.getStubObjectRelation());
request.setAttribute("objectIndividualSortPropertyURI", propertyForEditing.getObjectIndividualSortPropertyURI());
request.setAttribute("domainEntitySortDirection", propertyForEditing.getDomainEntitySortDirection());
request.setAttribute("collateBySubclass", propertyForEditing.getCollateBySubclass());
//checkboxes are pretty annoying : we don't know if someone *unchecked* a box, so we have to default to false on updates.
@ -177,7 +177,7 @@ public class PropertyRetryController extends BaseEditController {
propertyForEditing.setInverseFunctional(false);
propertyForEditing.setSelectFromExisting(false);
propertyForEditing.setOfferCreateNewOption(false);
propertyForEditing.setStubObjectRelation(false);
//propertyForEditing.setStubObjectRelation(false);
propertyForEditing.setCollateBySubclass(false);
}
@ -187,7 +187,7 @@ public class PropertyRetryController extends BaseEditController {
RequestDispatcher rd = request.getRequestDispatcher(Controllers.BASIC_JSP);
request.setAttribute("bodyJsp","/templates/edit/formBasic.jsp");
request.setAttribute("colspan","4");
request.setAttribute("colspan","5");
request.setAttribute("formJsp","/templates/edit/specific/property_retry.jsp");
request.setAttribute("scripts","/templates/edit/formBasic.js");
request.setAttribute("title","Property Editing Form");
@ -243,17 +243,19 @@ public class PropertyRetryController extends BaseEditController {
parentIdList.add(0,new Option("-1","none (root property)", false));
optionMap.put("ParentURI", parentIdList);
// List<DataProperty> dpList = dpDao.getAllDataProperties();
// Collections.sort(dpList);
// List<Option> objectIndividualSortPropertyList =
// FormUtils.makeOptionListFromBeans(
// dpList, "URI", "Name",
// propertyForEditing.getObjectIndividualSortPropertyURI(),
// null);
// objectIndividualSortPropertyList.add(0, new Option(
// "","- select data property -"));
// optionMap.put("ObjectIndividualSortPropertyURI",
// objectIndividualSortPropertyList);
/*
List<DataProperty> dpList = dpDao.getAllDataProperties();
Collections.sort(dpList);
List<Option> objectIndividualSortPropertyList =
FormUtils.makeOptionListFromBeans(
dpList, "URI", "Name",
propertyForEditing.getObjectIndividualSortPropertyURI(),
null);
objectIndividualSortPropertyList.add(0, new Option(
"","- name (rdfs:label) -"));
optionMap.put("ObjectIndividualSortPropertyURI",
objectIndividualSortPropertyList);
*/
List<Option> domainOptionList = FormUtils.makeVClassOptionList(
request.getFullWebappDaoFactory(),

View file

@ -31,7 +31,7 @@ import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
public class VclassEditController extends BaseEditController {
private static final Log log = LogFactory.getLog(VclassEditController.class.getName());
private static final int NUM_COLS = 12;
private static final int NUM_COLS = 10;
public void doPost (HttpServletRequest req, HttpServletResponse response) {
if (!isAuthorizedToDisplayPage(req, response, SimplePermission.EDIT_ONTOLOGY.ACTIONS)) {
@ -63,9 +63,7 @@ public class VclassEditController extends BaseEditController {
results.add("display level"); // 7
results.add("update level"); // 8
results.add("custom entry form"); // 9
results.add("custom display view"); // 10
results.add("custom search view"); // 11
results.add("URI"); // 12
results.add("URI"); // 10
String name = vcl.getLocalNameWithPrefix();
String shortDef = (vcl.getShortDef()==null) ? "" : vcl.getShortDef();
@ -116,9 +114,7 @@ public class VclassEditController extends BaseEditController {
results.add(hiddenFromDisplay); // 7
results.add(ProhibitedFromUpdate); // 8
results.add(customEntryForm); // 9
results.add(customDisplayView); // 10
results.add(customSearchView); // 11
results.add(uri); // 12
results.add(uri); // 10
request.setAttribute("results", results);
request.setAttribute("columncount", NUM_COLS);
request.setAttribute("suppressquery", "true");