From 0c791852541f7bcf2089e2d668f8edf1d0b973f9 Mon Sep 17 00:00:00 2001
From: tworrall
Date: Tue, 10 Dec 2013 12:44:04 -0500
Subject: [PATCH] VIVO-637 date time generator changes for various date time
properties
---
.../generators/DateTimePropertyGenerator.java | 54 +++++++++++++++++++
.../edit/forms/dateTimeValueForm.ftl | 3 +-
2 files changed, 55 insertions(+), 2 deletions(-)
create mode 100644 webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/DateTimePropertyGenerator.java
diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/DateTimePropertyGenerator.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/DateTimePropertyGenerator.java
new file mode 100644
index 000000000..24ed50d68
--- /dev/null
+++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/DateTimePropertyGenerator.java
@@ -0,0 +1,54 @@
+/* $This file is distributed under the terms of the license in /doc/license.txt$ */
+
+package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators;
+
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+
+import javax.servlet.http.HttpSession;
+
+import com.hp.hpl.jena.rdf.model.Model;
+import com.hp.hpl.jena.vocabulary.XSD;
+
+import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
+import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
+import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.DateTimeWithPrecisionVTwo;
+import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationUtils;
+import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationVTwo;
+import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.FieldVTwo;
+import edu.cornell.mannlib.vitro.webapp.utils.FrontEndEditingUtils;
+import edu.cornell.mannlib.vitro.webapp.utils.FrontEndEditingUtils.EditMode;
+import edu.cornell.mannlib.vitro.webapp.utils.generators.EditModeUtils;
+
+/**
+ *
+ * @author hjk54
+ *
+ * There are multiple date time properties in VIVO, all of which have a DateTimeValue individual as an object.
+ * I am extending DateTimeValueFormGenerator to enable the predicate to be utilized as the "toDateTimeValue" property, i.e.
+ * the property associating the subject with the date time value individual. The dateTimeValueForm template has been
+ * used as the basis for the general form for this generator that can be applied to multiple properties.
+ */
+
+public class DateTimePropertyGenerator extends DateTimeValueFormGenerator {
+
+ String predicate = null;
+ @Override
+ public EditConfigurationVTwo getEditConfiguration(VitroRequest vreq,
+ HttpSession session) {
+ predicate = EditConfigurationUtils.getPredicateUri(vreq);
+ EditConfigurationVTwo conf = super.getEditConfiguration(vreq, session);
+ return conf;
+ }
+
+ //isolating the predicate in this fashion allows this class to be subclassed for other date time value
+ //properties
+ @Override
+ protected String getToDateTimeValuePredicate() {
+ return predicate;
+ }
+
+}
\ No newline at end of file
diff --git a/webapp/web/templates/freemarker/edit/forms/dateTimeValueForm.ftl b/webapp/web/templates/freemarker/edit/forms/dateTimeValueForm.ftl
index 8596e3497..b77192f64 100644
--- a/webapp/web/templates/freemarker/edit/forms/dateTimeValueForm.ftl
+++ b/webapp/web/templates/freemarker/edit/forms/dateTimeValueForm.ftl
@@ -33,8 +33,7 @@
${i18n().cancel_link}
-${stylesheets.add('',
- '')}
+${stylesheets.add('')}
${scripts.add('',
'')}
\ No newline at end of file