added necessary bits in templates and Database.java to make webdb_create modifiable...
authormh <mh>
Fri, 28 Jun 2002 20:42:13 +0000 (20:42 +0000)
committermh <mh>
Fri, 28 Jun 2002 20:42:13 +0000 (20:42 +0000)
bundles/admin_de.properties
bundles/admin_en.properties
bundles/admin_es.properties
bundles/admin_tr.properties
source/mir/storage/Database.java
templates-dist/admin/commentlist.template
templates-dist/admin/content.template

index cc30d23..a0baa32 100755 (executable)
@@ -1,4 +1,5 @@
 ########## admin ##########
+# $Id: admin_de.properties,v 1.11 2002/06/28 20:42:13 mh Exp $
 
 # general
 yes=ja
@@ -126,6 +127,9 @@ content.creationdate=date
 content.modificationdate=last change
 content.status=Status
 content.type=articletype
+content.import_date=Importiert
+content.lastchange_date=zuletzt geäendert 
+content.create_date=Datum
 
 contentlist.htmltitle=indymedia.de | contentlist
 
index a08730a..4985d9f 100755 (executable)
@@ -1,4 +1,5 @@
 ########## admin ##########
+# $Id: admin_en.properties,v 1.12 2002/06/28 20:42:13 mh Exp $
 
 # general
 yes=yes
@@ -126,6 +127,9 @@ content.creationdate=date
 content.modificationdate=last change
 content.status=Status
 content.type=articletype
+content.import_date=Import date
+content.lastchange_date=Last modified
+content.create_date=Date
 
 contentlist.htmltitle=indymedia.de | contentlist
 
index 6a89fcf..572b261 100755 (executable)
@@ -1,4 +1,5 @@
 ########## admin ##########\r
+# $Id: admin_es.properties,v 1.2 2002/06/28 20:42:13 mh Exp $\r
 \r
 # general\r
 yes=sí\r
index ef46e6e..3c2b8b9 100755 (executable)
Binary files a/bundles/admin_tr.properties and b/bundles/admin_tr.properties differ
index c04e992..2e8f893 100755 (executable)
@@ -7,6 +7,8 @@ import  java.sql.*;
 import  java.lang.*;
 import  java.io.*;
 import  java.util.*;
+import  java.text.SimpleDateFormat;
+import  java.text.ParseException;
 import  freemarker.template.*;
 import  com.codestudio.sql.*;
 import  com.codestudio.util.*;
@@ -25,8 +27,14 @@ import  mir.misc.*;
  * Treiber, Host, User und Passwort, ueber den der Zugriff auf die
  * Datenbank erfolgt.
  *
- * @author RK
- * @version 16.7.1999
+ * @version $Revision: 1.18 $ $Date: 2002/06/28 20:42:13 $
+ * @author $Author: mh $
+ *
+ * $Log: Database.java,v $
+ * Revision 1.18  2002/06/28 20:42:13  mh
+ * added necessary bits in templates and Database.java to make webdb_create modifiable. make the conversion from sql/Timestamp to String more robust
+ *
+ *
  */
 public class Database implements StorageObject {
 
@@ -52,6 +60,14 @@ public class Database implements StorageObject {
                                       STORABLE_OBJECT_ENTITY_CLASS=null;
   private static SimpleHash           POPUP_EMTYLINE=new SimpleHash();
   protected static final ObjectStore  o_store=ObjectStore.getInstance();
+  private SimpleDateFormat _dateFormatterOut = 
+                                    new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+  private SimpleDateFormat _dateFormatterIn = 
+                                    new SimpleDateFormat("yyyy-MM-dd");
+  private Calendar _cal = new GregorianCalendar();
+
+  private static final int _millisPerHour = 60 * 60 * 1000;
+  private static final int _millisPerMinute = 60 * 1000;
 
        static {
                // always same object saves a little space
@@ -249,17 +265,24 @@ public class Database implements StorageObject {
                                        case java.sql.Types.LONGVARBINARY:
                                                outValue = rs.getString(valueIndex);
                                                //if (outValue != null)
-                                                       //outValue = StringUtil.encodeHtml(StringUtil.unquote(outValue));
+                                               //outValue = StringUtil.encodeHtml(StringUtil.unquote(outValue));
                                                break;
                                        case java.sql.Types.TIMESTAMP:
-                                               //Timestamp timestamp = (rs.getTimestamp(valueIndex));
-                                               //jbdc drops time zone info, 
-                                               //so just get the string from 
-                                               //postgres
-                                               String timestamp = (rs.getString(valueIndex));
-                                               if (!rs.wasNull()) {
-                                                       outValue = timestamp;
-                                               }
+            // it's important to use Timestamp here as getting it
+            // as a string is undefined and is only there for debugging
+            // according to the API. we can make it a string through formatting.
+            // -mh
+                                         Timestamp timestamp = (rs.getTimestamp(valueIndex));
+            if(!rs.wasNull()) {
+              java.util.Date date = new java.util.Date(timestamp.getTime());
+              outValue = _dateFormatterOut.format(date);
+              _cal.setTime(date);
+              int offset = _cal.get(Calendar.ZONE_OFFSET)+
+                            _cal.get(Calendar.DST_OFFSET);
+              String tzOffset = StringUtil.zeroPaddingNumber(
+                                                     offset/_millisPerHour,2,2);
+              outValue = outValue+"+"+tzOffset;
+            }
                                                break;
                                        default:
                                                outValue = "<unsupported value>";
@@ -763,6 +786,18 @@ public class Database implements StorageObject {
                if (metadataFields.contains("webdb_lastchange")) {
                        sql.append(",webdb_lastchange=NOW()");
                }
+               if (metadataFields.contains("webdb_create") &&
+        theEntity.hasValueForField("webdb_create")) {
+      // TimeStamp stuff
+      try {
+        java.util.Date d = _dateFormatterIn.parse(
+                                            theEntity.getValue("webdb_create"));
+        Timestamp tStamp = new Timestamp(d.getTime());
+        sql.append(",webdb_create='"+tStamp.toString()+"'");
+      } catch (ParseException e) {
+        throw new StorageObjectException(e.toString());
+      }
+               }
                if (streamedInput != null) {
                        for (int i = 0; i < streamedInput.size(); i++) {
                                sql.append(",").append(streamedInput.get(i)).append("=?");
index cc5a45b..330fa7c 100755 (executable)
@@ -48,7 +48,7 @@
   <list data.contentlist as entry>
   <tr <if grey=="1"><assign grey="0">class="list1"<else><assign grey="1">class="list2"</if>>
 
-               <td>${entry.date_formatted}<br>
+               <td>${entry.webddb_create_short}<br>
        <if entry.is_published=="0"><font color="Brown">V</font><else>-</if>
                </td>
 
index bbe6068..7876698 100755 (executable)
@@ -28,11 +28,53 @@ p {  font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10pt}
 <tr>
        <font face="Verdana, Arial, Helvetica, sans-serif" size="-1" color="#FFFFFF">
        <td align="right" bgcolor="#AAAAAA">
-               <b>${lang("content.owner")}:</b></td>
-       <td> ${data.login_user.login}<br>${data.date}</td>
+         <font color="#FFFFFF">
+               <b>${lang("content.owner")}:</b>
+  </td>
+       <td>
+    ${data.login_user.login}
+  </td>
+       </font>
+       <td colspan="3">&nbsp;</td>
+</tr>
+<tr>
+  <td align="right" bgcolor="#AAAAAA">
+         <font color="#FFFFFF">
+    <b>${lang("content.import_date")}:</b>
+  </td>
+  <td>
+    ${data.date}
+  </td>
+       </font>
+       <td colspan="3">&nbsp;</td>
+</tr>
+
+<tr>
+  <td align="right" bgcolor="#AAAAAA">
+         <font color="#FFFFFF">
+    <b>${lang("content.lastchange_date")}:</b>
+  </td>
+  <td>
+               ${data.webdb_lastchange}
+    <br>
+  </td>
+       </font>
+       <td colspan="3">&nbsp;</td>
+</tr>
+
+<tr>
+  <td align="right" bgcolor="#AAAAAA">
+         <font color="#FFFFFF">
+    <b>${lang("content.create_date")}:</b>
+  </td>
+  <td>
+               <input type="text" size="10" maxlength="10" name="webdb_create" value="${data.webdb_create_short}">
+    <br>
+  </td>
        </font>
        <td colspan="3">&nbsp;</td>
 </tr>
+
 <tr>
        <td align="right" valign="top" bgcolor="#AAAAAA"><font color="#ffffff">
                <B>${lang("content.topic")}&nbsp;<a href="${config.docRoot}/help/content.html">