You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by mi...@apache.org on 2003/08/12 00:19:26 UTC
cvs commit: cocoon-lenya/src/webapp/lenya/pubs/blog/java/src/org/apache/lenya/cms/authoring NewBlogEntryCreator.java
michi 2003/08/11 15:19:26
Modified: src/java/org/apache/lenya/util DateUtil.java
src/webapp/lenya/pubs/blog/java/src/org/apache/lenya/cms/authoring
NewBlogEntryCreator.java
Log:
Date created added
Revision Changes Path
1.10 +19 -2 cocoon-lenya/src/java/org/apache/lenya/util/DateUtil.java
Index: DateUtil.java
===================================================================
RCS file: /home/cvs/cocoon-lenya/src/java/org/apache/lenya/util/DateUtil.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- DateUtil.java 17 Jul 2003 10:20:46 -0000 1.9
+++ DateUtil.java 11 Aug 2003 22:19:25 -0000 1.10
@@ -1,5 +1,4 @@
/*
-$Id$
<License>
============================================================================
@@ -55,12 +54,16 @@
*/
package org.apache.lenya.util;
+import java.util.Calendar;
+import java.util.GregorianCalendar;
/**
* DOCUMENT ME!
*
* @author Edith Chevrier
- * @version 2002.7.8
+ * @author Christian Egli
+ * @author Michael Wechner
+ * @version $Id$
* @deprecated use java.text.DateFormat instead
*/
public class DateUtil {
@@ -267,5 +270,19 @@
}
return name;
+ }
+
+ /**
+ * 2003-08-11T23:14:48
+ */
+ public static String getCurrentDate() {
+ Calendar cal = new GregorianCalendar();
+ String year = "" + cal.get(Calendar.YEAR);
+ String month = oneToTwoDigits("" + (cal.get(Calendar.MONTH) + 1));
+ String day = oneToTwoDigits("" + cal.get(Calendar.DAY_OF_MONTH));
+ String hour = oneToTwoDigits("" + cal.get(Calendar.HOUR));
+ String minute = oneToTwoDigits("" + cal.get(Calendar.MINUTE));
+ String second = oneToTwoDigits("" + cal.get(Calendar.SECOND));
+ return year + "-" + month + "-" + day + "T" + hour + ":" + minute + ":" + second;
}
}
1.2 +7 -1 cocoon-lenya/src/webapp/lenya/pubs/blog/java/src/org/apache/lenya/cms/authoring/NewBlogEntryCreator.java
Index: NewBlogEntryCreator.java
===================================================================
RCS file: /home/cvs/cocoon-lenya/src/webapp/lenya/pubs/blog/java/src/org/apache/lenya/cms/authoring/NewBlogEntryCreator.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- NewBlogEntryCreator.java 5 Aug 2003 19:50:48 -0000 1.1
+++ NewBlogEntryCreator.java 11 Aug 2003 22:19:25 -0000 1.2
@@ -110,5 +110,11 @@
// Replace author
Identity identity = (Identity)parameters.get("org.apache.lenya.cms.ac2.Identity");
du.setElementValue(doc, "/echo:entry/echo:author/echo:name", identity.getUser().getId());
+
+ // Replace date created (and issued and modified, FIXME: issued should be set during first time publishing, modified should be set during re-publishing)
+ String date = org.apache.lenya.util.DateUtil.getCurrentDate();
+ du.setElementValue(doc, "/echo:entry/echo:created", date);
+ du.setElementValue(doc, "/echo:entry/echo:issued", date);
+ du.setElementValue(doc, "/echo:entry/echo:modified", date);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: lenya-cvs-unsubscribe@cocoon.apache.org
For additional commands, e-mail: lenya-cvs-help@cocoon.apache.org
Re: dateUtil deprecation
Posted by Michael Wechner <mi...@wyona.org>.
Gregor J. Rothfuss wrote:
> Michael Wechner wrote:
>
>>> did you see that the class is deprecated?
>>
>>
>> yes, after I have implemented my stuff (too late unfortunately).
>
>
> i guess running the deprecation target isn't very convenient. what can
> we do to catch these earlier given that your editor doesn't show them?
I will try to run the deprecation target in the future.
Thanks
Michael
>
>
> the problem with dateUtil is that it will likely fail when someone
> switches locales.
>
---------------------------------------------------------------------
To unsubscribe, e-mail: lenya-dev-unsubscribe@cocoon.apache.org
For additional commands, e-mail: lenya-dev-help@cocoon.apache.org
Re: dateUtil deprecation
Posted by "Gregor J. Rothfuss" <gr...@apache.org>.
Michael Wechner wrote:
>> did you see that the class is deprecated?
>
> yes, after I have implemented my stuff (too late unfortunately).
i guess running the deprecation target isn't very convenient. what can
we do to catch these earlier given that your editor doesn't show them?
the problem with dateUtil is that it will likely fail when someone
switches locales.
--
Gregor J. Rothfuss
Wyona Ltd. - Open Source Content Management - Apache Lenya
http://wyona.com http://cocoon.apache.org/lenya
gregor.rothfuss@wyona.com gregor@apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: lenya-dev-unsubscribe@cocoon.apache.org
For additional commands, e-mail: lenya-dev-help@cocoon.apache.org
Re: dateUtil deprecation
Posted by Michael Wechner <mi...@wyona.org>.
Gregor J. Rothfuss wrote:
> michi@apache.org wrote:
>
>> * @deprecated use java.text.DateFormat instead
>> */
>> public class DateUtil {
>> +
>> + /**
>> + * 2003-08-11T23:14:48
>> + */
>> + public static String getCurrentDate() {
>
>
> did you see that the class is deprecated?
yes, after I have implemented my stuff (too late unfortunately).
Feel free to replace the DateUtil within the "blog" publication:
src/webapp/lenya/pubs/blog/java/src/org/apache/lenya/cms/authoring/NewBlogEntryCreator.java
Thanks
Michael
>
>
> -gregor
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lenya-dev-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: lenya-dev-help@cocoon.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: lenya-dev-unsubscribe@cocoon.apache.org
For additional commands, e-mail: lenya-dev-help@cocoon.apache.org
dateUtil deprecation
Posted by "Gregor J. Rothfuss" <gr...@apache.org>.
michi@apache.org wrote:
> * @deprecated use java.text.DateFormat instead
> */
> public class DateUtil {
> +
> + /**
> + * 2003-08-11T23:14:48
> + */
> + public static String getCurrentDate() {
did you see that the class is deprecated?
-gregor
---------------------------------------------------------------------
To unsubscribe, e-mail: lenya-dev-unsubscribe@cocoon.apache.org
For additional commands, e-mail: lenya-dev-help@cocoon.apache.org