kareila: (Default)
kareila ([personal profile] kareila) wrote in [site community profile] changelog2009-11-23 05:34 pm

[dw-free] Add dynamic time options to the Post Entry page

[commit: http://hg.dwscoalition.org/dw-free/rev/14f4ca2b8912]

http://bugs.dwscoalition.org/show_bug.cgi?id=1586

Add 'Update Date' button to update.bml.

Patch by [personal profile] wyntarvox.

Files modified:
  • bin/upgrading/en.dat
  • cgi-bin/weblib.pl
  • htdocs/js/entry.js
--------------------------------------------------------------------------------
diff -r 5086f0e86f60 -r 14f4ca2b8912 bin/upgrading/en.dat
--- a/bin/upgrading/en.dat	Mon Nov 23 16:54:20 2009 +0000
+++ b/bin/upgrading/en.dat	Mon Nov 23 11:33:59 2009 -0600
@@ -1142,6 +1142,8 @@ entryform.date.24hournote=(24 hour time)
 
 entryform.date.edit=Edit
 
+entryform.dateupdated=Date updated to:
+
 entryform.delete=Delete Entry
 
 entryform.delete.confirm=Are you sure you want to delete this entry?
@@ -1247,6 +1249,8 @@ entryform.update3=Post to
 entryform.update3=Post to
 
 entryform.update4=Post Entry
+
+entryform.updatedate=Update Date
 
 entryform.userpic=Userpic:
 
diff -r 5086f0e86f60 -r 14f4ca2b8912 cgi-bin/weblib.pl
--- a/cgi-bin/weblib.pl	Mon Nov 23 16:54:20 2009 +0000
+++ b/cgi-bin/weblib.pl	Mon Nov 23 11:33:59 2009 -0600
@@ -1751,6 +1751,8 @@ PREVIEW
             if ($LJ::SPELLER && !$opts->{'disabled_save'}) {
                 $out .= LJ::html_submit('action:spellcheck', BML::ml('entryform.spellcheck'), { 'tabindex' => $tabindex->() }) . " ";
             }
+            # Update posting date/time
+            $out .= "<input type='button' value='" . BML::ml( 'entryform.updatedate' ) . "' onclick='settime(\"" . LJ::ejs( BML::ml( 'entryform.dateupdated' ) ) . "\", this);' tabindex='" . $tabindex->() . "' />";
             $out .= "</span>\n";
             $out .= "</p>\n";
         }
diff -r 5086f0e86f60 -r 14f4ca2b8912 htdocs/js/entry.js
--- a/htdocs/js/entry.js	Mon Nov 23 16:54:20 2009 +0000
+++ b/htdocs/js/entry.js	Mon Nov 23 11:33:59 2009 -0600
@@ -311,7 +311,7 @@ function setColumns(number) {
     listWrapper.removeChild(listObj);
 }
 
-function settime() {
+function settime( dateUpdatedText, fromButton ) {
     function twodigit (n) {
         if (n < 10) { return "0" + n; }
         else { return n; }
@@ -339,8 +339,13 @@ function settime() {
     var cYear = now.getYear() < 1900 ? now.getYear() + 1900 : now.getYear();
     var cHour = now.getHours();
     var cMinute = twodigit(now.getMinutes());
-    currentdate.innerHTML = mNames[cMonth] + " " + cDay + ", " + cYear + ", " + cHour + ":" + cMinute;
-    
+    var cDateText = mNames[cMonth] + " " + cDay + ", " + cYear + ", " + cHour + ":" + cMinute;
+    currentdate.innerHTML = cDateText;
+
+    if ( dateUpdatedText && fromButton ) {
+       return LJ_IPPU.showNote( dateUpdatedText + " " + cDateText, fromButton );
+    }
+
     return false;
 }
 
--------------------------------------------------------------------------------