madeon (madeon) wrote in changelog,
madeon
madeon
changelog

[livejournal] r20917: LJSUP-9307: Added link to create new del...

Committer: sbelyaev
LJSUP-9307: Added link to create new delayed entry
U   trunk/bin/upgrading/en.dat
U   trunk/cgi-bin/LJ/DelayedEntry.pm
U   trunk/cgi-bin/ljprotocol.pl
U   trunk/htdocs/manage/scheduled_posts.bml
U   trunk/htdocs/manage/scheduled_posts.bml.text
U   trunk/htdocs/update.bml
Modified: trunk/bin/upgrading/en.dat
===================================================================
--- trunk/bin/upgrading/en.dat	2012-01-17 13:03:48 UTC (rev 20916)
+++ trunk/bin/upgrading/en.dat	2012-01-17 13:13:59 UTC (rev 20917)
@@ -658,6 +658,8 @@
 
 crumb.editentries=Edit Entries
 
+crumb.scheduledposts=Edit Scheduled  Entries
+
 crumb.editentries_do=Edit Entry
 
 crumb.editfriendgrps=Edit Friends Groups

Modified: trunk/cgi-bin/LJ/DelayedEntry.pm
===================================================================
--- trunk/cgi-bin/LJ/DelayedEntry.pm	2012-01-17 13:03:48 UTC (rev 20916)
+++ trunk/cgi-bin/LJ/DelayedEntry.pm	2012-01-17 13:13:59 UTC (rev 20917)
@@ -75,13 +75,24 @@
                   "logtime, posttime, security, allowmask, year, month, day, rlogtime, revptime, is_sticky) " .
                   "VALUES (?, ?, ?, ?, NOW(), ?, ?, ?, ?, ?, ?, ?, ?, ?)",
                   undef, 
-                  $journalid, $delayedid, $posterid, LJ::text_trim($req->{'subject'}, 30, 0), 
-                  $posttime, $security, $allowmask,
+                  $journalid,
+                  $delayedid,
+                  $posterid,
+                  LJ::text_trim($req->{'subject'}, 30, 0), 
+                  $posttime,
+                  $security,
+                  $allowmask,
                   $req->{year}, $req->{mon}, $req->{day},
-                  $rlogtime, $rposttime, $sticky_type);
-    
+                  $rlogtime,
+                  $rposttime,
+                  $sticky_type );
+
     $journal->do( "INSERT INTO delayedblob2 ".
-                  "VALUES (?, ?, ?)", undef, $journalid, $delayedid, $data_ser);
+                  "VALUES (?, ?, ?)",
+                  undef,
+                  $journalid,
+                  $delayedid,
+                  $data_ser );
 
     my $memcache_key = "delayed_entry:$journalid:$delayedid";
     LJ::MemCache::set($memcache_key, $data_ser, 3600);
@@ -94,7 +105,6 @@
     $self->{delayed_id} = $delayedid;
 
     $self->{default_dateformat} = $opts->{'dateformat'} || 'S2';
-    
     __statistics_absorber($journal, $poster);
 
     return $self;
@@ -162,12 +172,12 @@
 sub posttime_as_unixtime {
     my ($self) = @_;
     my $req = $self->data;
-    my $dt = DateTime->new(  year       => $req->{year},
-                             month      => $req->{mon},
-                             day        => $req->{day},
-                             hour       => $req->{hour},
-                             minute     => $req->{min},
-                             time_zone  => $req->{tz} );
+    my $dt = DateTime->new( year       => $req->{year},
+                            month      => $req->{mon},
+                            day        => $req->{day},
+                            hour       => $req->{hour},
+                            minute     => $req->{min},
+                            time_zone  => $req->{tz} );
     return $dt->epoch;
 }
 

Modified: trunk/cgi-bin/ljprotocol.pl
===================================================================
--- trunk/cgi-bin/ljprotocol.pl	2012-01-17 13:03:48 UTC (rev 20916)
+++ trunk/cgi-bin/ljprotocol.pl	2012-01-17 13:13:59 UTC (rev 20917)
@@ -2352,9 +2352,7 @@
     }
 
     if ( $req->{ver} > 1  && LJ::is_enabled("delayed_entries") ) {
-        my $use_delayed = ($req->{'custom_time'} && $flags->{'use_custom_time'}) ||
-                            !(exists $flags->{'use_custom_time'});
-        if ( $use_delayed && LJ::DelayedEntry::is_future_date($req) ) {
+        if ( $req->{'posttype'} eq 'scheduled' ) {
             return fail($err, 215) unless $req->{tz};
 
             # if posting to a moderated community, store and bail out here

Modified: trunk/htdocs/manage/scheduled_posts.bml
===================================================================
--- trunk/htdocs/manage/scheduled_posts.bml	2012-01-17 13:03:48 UTC (rev 20916)
+++ trunk/htdocs/manage/scheduled_posts.bml	2012-01-17 13:13:59 UTC (rev 20917)
@@ -19,6 +19,9 @@
                     js/photobucket_jw.js
                     ));
 
+    if (!LJ::is_enabled("delayed_entries")) {
+          return LJ::error_list("This feature is disabled.");
+    }
 
     my $page_name = 'scheduled_posts.bml';
     my $items_per_page = 20;
@@ -107,11 +110,9 @@
                             'anum'        => 0,
                            };
         }
-        
         return @ordered;
     };
 
-
     my $delayed_entries = LJ::DelayedEntry->get_entries_by_journal($usejournal_u,
                                                                    { 'skip'    => $skip,
                                                                      'show'    => $items_per_page + 1,
@@ -123,9 +124,8 @@
     }
     my @recent_entries = $append_delayed->($usejournal_u, $delayed_entries);
 
-
     # draw the page
-    LJ::set_active_crumb('editentries');
+    LJ::set_active_crumb('scheduledposts');
 
     $ret .= "<table style='width: 100%;'><tr><td>";
 
@@ -133,30 +133,34 @@
     $ret .= "<div class='b-editentries-header'>";
     $ret .= "<h1>" . BML::ml('.title') . "</h1>";
 
+    $ret .= '<a href="/update.bml?type=scheduled">';
+    $ret .= BML::ml('.newpost') . '</a>';
+
     $ret .= "<form action='$page_name$getextra' method='get' class='b-editentries-form'>\n";
-    $ret .= "<p>" . LJ::html_text({ 'name'        => 'usejournal', 
-                                    'size'        => '20', 
-                                    'mfaxlength'  => '15', 
-                                    'value'       => $GET{'usejournal'} || $POST{'usejournal'}, 
-                                    'class'       => 'b-editentries-comm', 
-                                    'placeholder' => BML::ml('.input.journal') });
+    $ret .= "<p>" . LJ::html_text( { 'name'        => 'usejournal', 
+                                     'size'        => '20', 
+                                     'mfaxlength'  => '15', 
+                                     'value'       => $GET{'usejournal'} || $POST{'usejournal'}, 
+                                     'class'       => 'b-editentries-comm', 
+                                     'placeholder' => BML::ml('.input.journal') } );
 
     $ret .= LJ::html_submit(undef, $ML{'.btn.search'}) . "</p>";
-    $ret .= "<p>" . LJ::html_check({ 'name'     => 'only_me', 
-                                     'id'       => 'only_me',
-                                     'value'    => '1', 
-                                     'selected' =>  $only_me_checked });
+    $ret .= "<p>" . LJ::html_check( { 'name'     => 'only_me', 
+                                      'id'       => 'only_me',
+                                      'value'    => '1', 
+                                      'selected' =>  $only_me_checked } );
 
     $ret .= "<label for='only_me'>".$ML{'.only_my_entries'}."</label></p>";
     $ret .= "</form>\n";
-    if (!$usejournal_u || $usejournal_u->is_community) {
+
+    if ( !$usejournal_u || $usejournal_u->is_community ) {
         $ret .= "<p><a href='$LJ::SITEROOT/manage/$page_name'>" . BML::ml('.lnk.journal') . "</a></p>";
     }
 
-    $ret .= $entry_chooser->(\@recent_entries,
+    $ret .= $entry_chooser->( \@recent_entries,
                                 first_page   => $skip ? 0 : 1,
                                 prev         => $skip > $items_per_page ? $skip - $items_per_page : 0,
-                                next         => $have_next_page         ? $skip + $items_per_page : 0);
+                                next         => $have_next_page         ? $skip + $items_per_page : 0 );
 
     $ret .= "</div></td></tr></table>";
     return $ret;    

Modified: trunk/htdocs/manage/scheduled_posts.bml.text
===================================================================
--- trunk/htdocs/manage/scheduled_posts.bml.text	2012-01-17 13:03:48 UTC (rev 20916)
+++ trunk/htdocs/manage/scheduled_posts.bml.text	2012-01-17 13:13:59 UTC (rev 20917)
@@ -13,3 +13,5 @@
 
 .input.journal=Show entries from community
 
+.newpost=New Sheduled Entry
+

Modified: trunk/htdocs/update.bml
===================================================================
--- trunk/htdocs/update.bml	2012-01-17 13:03:48 UTC (rev 20916)
+++ trunk/htdocs/update.bml	2012-01-17 13:13:59 UTC (rev 20917)
@@ -503,10 +503,12 @@
             $$body .= "<?p <strong>$ML{'.loggingin'}</strong> $ML{'.servermsg'} p?><div style='margin-left: 40px'><b>$login_message</b></div>";
         }
 
-        my $sticky = $POST{'sticky_type'} || $GET{'sticky_type'};
-        my $timezone = $POST{'timezone'} || $GET{'timezone'};
+        my $sticky      = $POST{'sticky_type'} || $GET{'sticky_type'};
+        my $type        = $POST{'type'} || $GET{'type'};
+        my $timezone    = $POST{'timezone'} || $GET{'timezone'};
         my $custom_time = $POST{'custom_time'} || $GET{'custom_time'};
-        $timezone =  sprintf("%+.4d", $timezone);
+        $timezone       =  sprintf("%+.4d", $timezone);
+
         my %req = (
                     'ver'         => 2,
                     'username'    => $user,
@@ -514,7 +516,8 @@
                     'usejournal'  => ($usejournalu) ? $usejournalu->user : undef,
                     'sticky'      => $sticky,
                     'custom_time' => $custom_time,
-                    'tz'          => $timezone, 
+                    'tz'          => $timezone,
+                    'posttype'    => $type,
                     );
 
         $flags->{'use_custom_time'} = 1; 

Tags: bml, dat, livejournal, madeon, pl, pm, sbelyaev, text
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments