madeon (madeon) wrote in changelog,
madeon
madeon
changelog

[livejournal] r21049: LJSUP-11100: Permanent link and non-popu...

Committer: sbelyaev
LJSUP-11100: Permanent link and non-popup preview

U   trunk/cgi-bin/Apache/LiveJournal.pm
U   trunk/cgi-bin/LJ/DelayedEntry.pm
U   trunk/cgi-bin/LJ/Widget/EntryChooser.pm
U   trunk/htdocs/manage/scheduled_posts.bml
Modified: trunk/cgi-bin/Apache/LiveJournal.pm
===================================================================
--- trunk/cgi-bin/Apache/LiveJournal.pm	2012-01-31 09:12:46 UTC (rev 21048)
+++ trunk/cgi-bin/Apache/LiveJournal.pm	2012-01-31 11:34:03 UTC (rev 21049)
@@ -865,7 +865,22 @@
             } else {
                 $mode = "entry";
             }
+        }
+        elsif ($uuri =~ m#^/d(\d+)\.html$#) { #
+            my $delayed_id = $1;
+            my $u = LJ::load_user($user);
 
+            unless ($u) {
+                LJ::Request->pnotes ('error' => 'baduser');
+                LJ::Request->pnotes ('remote' => LJ::get_remote());
+                return LJ::Request::NOT_FOUND;
+            }
+
+            my $new_uri = "$LJ::SITEROOT/preview/entry.bml";
+            my $bml_file = "$ENV{LJHOME}/htdocs/preview/entry.bml";
+            LJ::Request->uri($new_uri);
+            LJ::Request->notes( 'delayed_id' => $delayed_id);
+            return $bml_handler->($bml_file);
         } elsif ($uuri =~ m#^/pics#) {
             $mode = "ljphotoalbums";
 

Modified: trunk/cgi-bin/LJ/DelayedEntry.pm
===================================================================
--- trunk/cgi-bin/LJ/DelayedEntry.pm	2012-01-31 09:12:46 UTC (rev 21048)
+++ trunk/cgi-bin/LJ/DelayedEntry.pm	2012-01-31 11:34:03 UTC (rev 21049)
@@ -460,8 +460,7 @@
 sub url {
     my ($self) = @_;
     my $journal = $self->journal;
-    my $url = "$LJ::SITEROOT/manage/scheduled_posts.bml?usejournal=" .
-              $journal->username . "#entry_" . $self->delayedid;
+    my $url = $journal->journal_base . "/d" . $self->delayedid . ".html";
     return $url;
 }
 
@@ -970,11 +969,7 @@
 
 sub item_link {
     my ($u, $delayedid, @args) = @_;
-    # XXX: should have an option of returning a url with escaped (&)
-    #      or non-escaped (&) arguments.  a new link object would be best.
-    my $args = @args ? "?" . join("&", @args) : "";
-    return "$LJ::SITEROOT/manage/scheduled_posts.bml?usejournal=" . $u->username . 
-           "#entry_$delayedid";
+    my $url = $u->journal_base . "/d" . $delayedid . ".html";
 }
 
 sub __delayed_entry_secwhere {

Modified: trunk/cgi-bin/LJ/Widget/EntryChooser.pm
===================================================================
--- trunk/cgi-bin/LJ/Widget/EntryChooser.pm	2012-01-31 09:12:46 UTC (rev 21048)
+++ trunk/cgi-bin/LJ/Widget/EntryChooser.pm	2012-01-31 11:34:03 UTC (rev 21049)
@@ -62,13 +62,7 @@
         my $edit_link   = $edit_link_base . 'mode=edit';
         my $delete_link = $edit_link_base . 'mode=delete';
 
-        my $entry_url;
-        if (!$entry->is_delayed) {
-            $entry_url = $entry->url;
-        } else {
-            my $delayed_id = $entry->delayedid;
-            $entry_url = "javascript:showEntry(\"$usejournal\", $delayed_id);";
-        }
+        my $entry_url =  $entry->url;
         my $entry_subject = $entry->subject_text;
 
         my $alldateparts;

Modified: trunk/htdocs/manage/scheduled_posts.bml
===================================================================
--- trunk/htdocs/manage/scheduled_posts.bml	2012-01-31 09:12:46 UTC (rev 21048)
+++ trunk/htdocs/manage/scheduled_posts.bml	2012-01-31 11:34:03 UTC (rev 21049)
@@ -1,35 +1,7 @@
 <?page
 title=><?_code return $title; _code?>
 windowtitle=><?_ML .title _ML?>
-head<=
-<script type="text/javascript">
-function showEntry(journal, delayedId) {
-    preview = window.open('', 'preview', 'width=760,height=600,resizable=yes,status=yes,toolbar=no,location=no,menubar=no,scrollbars=yes');
-    preview.document.writeln("<html><body></body></html>");
-    entryForm = preview.document.createElement("form");
-    entryForm.method = 'POST';
-    entryForm.action = '/preview/entry.bml';
-    
-    delayedInput = preview.document.createElement("input");
-    delayedInput.name = "delayed_id";
-    delayedInput.value = delayedId;
-    delayedInput.type = 'hidden';
-    entryForm.appendChild(delayedInput);
 
-    journalInput = preview.document.createElement("input");
-    journalInput.name = "usejournal";
-    journalInput.value = journal;
-    journalInput.type = 'hidden';
-    entryForm.appendChild(journalInput);
-
-    preview.document.getElementsByTagName('body')[0].appendChild(entryForm);
-    entryForm.submit();
-    return false;
-}
-
-</script>
-
-<=head
 body<=
 <?_code
 {
@@ -96,7 +68,7 @@
 
         my $journal = LJ::load_user($usejournal) || $remote;
         foreach my $e_raw (@res) {
-            if ( $e_raw->{'delayedid'} ) {
+            if ( $e_raw->{'delayed_obj'} ) {
                 push @entries,
                     $e_raw->{'delayed_obj'};
             }
@@ -134,9 +106,6 @@
                             'security'           => $entry->security,
                             'logtime'            => $entry->logtime,
                             'delayed_obj'        => $entry,
-                            'delayedid'          => $ditem,
-                            'use_js_function'
-                                => "javascript:showDelayedEntry($ditem);"
                            };
         }
         return @ordered;

Tags: bml, livejournal, madeon, pm, sbelyaev
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