Hallo,
mich stört immer wieder, daß sich das Datum von News-Einträgen ändert, wenn man irgendeine Änderung an einem bestehenden News-Eintrag vornimmt (zu einer Gruppe hinzufügen, Tippfehler beheben, ...).
Ich weiß, daß es ein aufgebohrtes Modul gibt, aber weder brauche ich dessen Funktionalität, noch will ich mir mit einem Austausch des Moduls ggf. später Probleme einhandeln. - Ich wäre mit dem Core-Module ja vollauf zufrieden, würde es nicht immer das Datum aktualisieren...

Darum habe ich eine Änderung am Core-Modul vorgenommen, die ich hier zur Übernahme Vorschlagen möchte:
- Das Datum wird beim ersten Anlegen eines News-Eintrags festgelegt.
- beim Ändern des Eintrags hat man eine Auswahlmöglichkeit ob man das Datum aktualisieren lassen will oder nicht (Voreinstellung: Nein). Dazu sind in der modify_post.php zwei radio-buttons hinzugefügt; hier ist der 'Titel' 'Update date' noch 'hard-coded' -- daß müßte man noch in alle Language-Files mit aufnehmen...
Im Anhang die geänderten Dateien.
MfG, thorn
diff -Naur news_old/add_post.php news/add_post.php
--- news_old/add_post.php 2007-03-25 14:39:47.000000000 +0200
+++ news/add_post.php 2007-03-31 22:12:34.000000000 +0200
@@ -40,7 +40,7 @@
$commenting = $fetch_settings['commenting'];
// Insert new row into database
-$database->query("INSERT INTO ".TABLE_PREFIX."mod_news_posts (section_id,page_id,position,commenting,active) VALUES ('$section_id','$page_id','$position','$commenting','1')");
+$database->query("INSERT INTO ".TABLE_PREFIX."mod_news_posts (section_id,page_id,position,commenting,active,posted_when) VALUES ('$section_id','$page_id','$position','$commenting','1','".mktime()."')");
// Get the id
$post_id = $database->get_one("SELECT LAST_INSERT_ID()");
@@ -55,4 +55,4 @@
// Print admin footer
$admin->print_footer();
-?>
\ No newline at end of file
+?>
diff -Naur news_old/modify_post.php news/modify_post.php
--- news_old/modify_post.php 2007-03-25 14:39:47.000000000 +0200
+++ news/modify_post.php 2007-03-31 22:32:40.000000000 +0200
@@ -108,6 +108,20 @@
</td>
</tr>
<tr>
+ <td><?php echo 'Update date'; ?>:</td>
+ <td>
+ <input type="radio" name="update_date" id="update_date_true" value="1" />
+ <a href="#" onclick="javascript: document.getElementById('update_date_true').checked = true;">
+ <?php echo $TEXT['YES']; ?>
+ </a>
+
+ <input type="radio" name="update_date" id="update_date_false" value="0" checked />
+ <a href="#" onclick="javascript: document.getElementById('update_date_false').checked = true;">
+ <?php echo $TEXT['NO']; ?>
+ </a>
+ </td>
+</tr>
+<tr>
<td valign="top"><?php echo $TEXT['SHORT']; ?>:</td>
<td>
<?php
@@ -195,4 +209,4 @@
// Print admin footer
$admin->print_footer();
-?>
\ No newline at end of file
+?>
diff -Naur news_old/save_post.php news/save_post.php
--- news_old/save_post.php 2007-03-25 14:39:47.000000000 +0200
+++ news/save_post.php 2007-03-31 22:28:57.000000000 +0200
@@ -47,6 +47,7 @@
$long = $admin->add_slashes($admin->get_post('long'));
$commenting = $admin->get_post('commenting');
$active = $admin->get_post('active');
+ $update_date = $admin->get_post('update_date');
$old_link = $admin->get_post('link');
$group_id = $admin->get_post('group');
}
@@ -101,7 +102,12 @@
}
// Update row
-$database->query("UPDATE ".TABLE_PREFIX."mod_news_posts SET group_id = '$group_id', title = '$title', link = '$post_link', content_short = '$short', content_long = '$long', commenting = '$commenting', active = '$active', posted_when = '".mktime()."', posted_by = '".$admin->get_user_id()."' WHERE post_id = '$post_id'");
+if($update_date==1) {
+ $database->query("UPDATE ".TABLE_PREFIX."mod_news_posts SET group_id = '$group_id', title = '$title', link = '$post_link', content_short = '$short', content_long = '$long', commenting = '$commenting', active = '$active', posted_when = '".mktime()."', posted_by = '".$admin->get_user_id()."' WHERE post_id = '$post_id'");
+}
+else {
+ $database->query("UPDATE ".TABLE_PREFIX."mod_news_posts SET group_id = '$group_id', title = '$title', link = '$post_link', content_short = '$short', content_long = '$long', commenting = '$commenting', active = '$active', posted_by = '".$admin->get_user_id()."' WHERE post_id = '$post_id'");
+}
// Check if there is a db error, otherwise say successful
if($database->is_error()) {
@@ -113,4 +119,4 @@
// Print admin footer
$admin->print_footer();
-?>
\ No newline at end of file
+?>