madeon (madeon) wrote in changelog,
madeon
madeon
changelog

[livejournal] r20964: LJSUP-10439: remove functionality and ad...

Committer: sbelyaev
LJSUP-10439: remove functionality and add edit tags link
U   trunk/cgi-bin/LJ/S2.pm
U   trunk/cgi-bin/LJ/Widget/EntryChooser.pm
U   trunk/htdocs/manage/scheduled_posts.bml
U   trunk/htdocs/preview/entry.bml
U   trunk/templates/Widgets/entry_chooser.tmpl
Modified: trunk/cgi-bin/LJ/S2.pm
===================================================================
--- trunk/cgi-bin/LJ/S2.pm	2012-01-24 07:21:01 UTC (rev 20963)
+++ trunk/cgi-bin/LJ/S2.pm	2012-01-24 08:18:01 UTC (rev 20964)
@@ -685,7 +685,7 @@
     my $have_style = 0;
 
     if ($verify && $styleid) {
-        #my $dbr = LJ::S2::get_s2_reader();       LJSV-1375
+        #my $dbr = LJ::S2::get_s2_reader();       LJSVD375
         my $dbr = LJ::get_db_writer();
         my $style = $dbr->selectrow_hashref("SELECT * FROM s2styles WHERE styleid=$styleid");
         die "ERROR: " . $dbr->errstr if $dbr->err;
@@ -2029,11 +2029,6 @@
         }
     }
 
-    if ($arg->{'delayed'}) {
-        $e->{'delayed'} = 1;
-        $e->{'delayed_icon'} = Image_std("delayed-entry"); 
-    }
-
     if (!$e->{delayedid}) {
         # custom friend groups
         my $entry = LJ::Entry->new($e->{journal}->{_u}, ditemid => $e->{itemid});
@@ -2053,9 +2048,9 @@
    
      } else {
         my $entry = LJ::DelayedEntry->get_entry_by_id( $e->{journal}->{_u}, 
-                                                        $e->{delayedid} );
+                                                       $e->{delayedid} );
         
-       if ( $entry->is_sticky || $arg->{'sticky_type'}) {
+        if ( $entry->is_sticky || $arg->{'sticky_type'}) {
             $e->{'sticky'} = 1;
             $e->{'sticky_icon'} = Image_std("sticky-entry");
         }
@@ -3978,10 +3973,11 @@
     my $journalu = LJ::load_user($journal);
     my $entry;
 
-    if ( $this->{itemid} ) {
+    if ( $this->{itemid} && !$this->{delayedid}) {
         $entry = LJ::Entry->new($journalu, ditemid => $this->{itemid});
-    } else {
-        $entry = LJ::DelayedEntry->get_entry_by_id($journalu, $this->{delayedid});
+    } if ($this->{delayedid}) {
+        $entry = LJ::DelayedEntry->get_entry_by_id( $this->{journal}->{_u}, 
+                                                    $this->{delayedid} );
     }
 
     if ($key eq "edit_entry") {
@@ -3990,31 +3986,19 @@
                                       LJ::u_equals( $remote, $posteru ) ||
                                       $remote->can_manage($journalu)
                                     );
-        
-        if ($entry->is_delayed) {
-            return LJ::S2::Link("$LJ::SITEROOT/editjournal.bml?journal=$journal&delayedid=" . $entry->delayedid,
+
+        return LJ::S2::Link("$LJ::SITEROOT/editjournal.bml?journal=$journal&itemid=$this->{'itemid'}",
                         $ctx->[S2::PROPS]->{"text_edit_entry"},
-                        LJ::S2::Image("$LJ::IMGPREFIX/btn_edit.gif", 24, 24));  
-        } else {
-            return LJ::S2::Link("$LJ::SITEROOT/editjournal.bml?journal=$journal&itemid=$this->{'itemid'}",
-                            $ctx->[S2::PROPS]->{"text_edit_entry"},
-                            LJ::S2::Image("$LJ::IMGPREFIX/btn_edit.gif", 24, 24));
-        }
+                        LJ::S2::Image("$LJ::IMGPREFIX/btn_edit.gif", 24, 24));
     }
 
     if ($key eq "edit_tags") {
         return $null_link 
             unless $remote && LJ::Tags::can_add_entry_tags( $remote, $entry );
-        if ($entry->is_delayed) {
-            return LJ::S2::Link("$LJ::SITEROOT/edittags.bml?journal=$journal&delayedid=" . $entry->delayedid,
-                                $ctx->[S2::PROPS]->{"text_edit_tags"},
-                                LJ::S2::Image("$LJ::IMGPREFIX/btn_edittags.gif", 24, 24));
 
-        } else {
-            return LJ::S2::Link("$LJ::SITEROOT/edittags.bml?journal=$journal&itemid=$this->{'itemid'}",
-                            $ctx->[S2::PROPS]->{"text_edit_tags"},
-                            LJ::S2::Image("$LJ::IMGPREFIX/btn_edittags.gif", 24, 24));
-        }
+        return LJ::S2::Link("$LJ::SITEROOT/edittags.bml?journal=$journal&itemid=$this->{'itemid'}",
+                        $ctx->[S2::PROPS]->{"text_edit_tags"},
+                        LJ::S2::Image("$LJ::IMGPREFIX/btn_edittags.gif", 24, 24));
     }
 
     if ($key eq "tell_friend") {
@@ -4038,7 +4022,6 @@
     }
 
     if ($key eq "share_facebook") {
-        return $null_link if $entry->is_delayed;
 
         my $entry = LJ::Entry->new($journalu->{'userid'}, ditemid => $this->{'itemid'});
         return $null_link unless $entry->security eq 'public';
@@ -4049,7 +4032,6 @@
     }
 
     if ($key eq "share_twitter") {
-        return $null_link if $entry->is_delayed;
 
         my $entry = LJ::Entry->new($journalu->{'userid'}, ditemid => $this->{'itemid'});
         return $null_link unless $entry->security eq 'public';
@@ -4061,7 +4043,6 @@
     }
 
     if ($key eq "share_email") {
-        return $null_link if $entry->is_delayed;
 
         my $entry = LJ::Entry->new($journalu->{'userid'}, ditemid => $this->{'itemid'});
         return $null_link unless $entry->security eq 'public';
@@ -4073,7 +4054,6 @@
     }
 
     if ($key eq "facebook_like") {
-        return $null_link if $entry->is_delayed;
 
         my $entry = LJ::Entry->new($journalu->{'userid'}, ditemid => $this->{'itemid'});
         return $null_link unless $entry->security eq 'public';
@@ -4085,7 +4065,6 @@
     }
 
     if ($key eq "mem_add") {
-        return $null_link if $entry->is_delayed;
         return $null_link if $LJ::DISABLED{'memories'};
         return LJ::S2::Link("$LJ::SITEROOT/tools/memadd.bml?journal=$journal&itemid=$this->{'itemid'}",
                             $ctx->[S2::PROPS]->{"text_mem_add"},
@@ -4098,10 +4077,6 @@
                         '_preview'   => $this->{'_preview'},
                       };
 
-        if ($entry->is_delayed) {
-            $options->{'delayedid'} = $entry->delayedid;
-        }
-
         my $jumplink = LJ::get_before_item_link($journalu, $options);
 
         if ($jumplink) {
@@ -4118,10 +4093,6 @@
                         'itemid'     => int($this->{'itemid'}/256),
                       };
 
-        if ($entry->is_delayed) {
-            $options->{'delayedid'} = $entry->delayedid;
-        }
-
         my $jumplink = LJ::get_after_item_link($journalu, $options);
 
         if ($jumplink) {
@@ -4134,7 +4105,6 @@
     }
 
     if ($key eq "flag") {
-        return $null_link if $entry->is_delayed;
         return $null_link unless LJ::is_enabled("content_flag");
         return $null_link unless $remote && $remote->can_see_content_flag_button( content => $entry );
         return LJ::S2::Link(LJ::ContentFlag->adult_flag_url($entry),
@@ -4169,7 +4139,6 @@
     }
 
     if ($key eq "watch_comments") {
-        return $null_link if $entry->is_delayed;
         return $null_link if $LJ::DISABLED{'esn'};
         return $null_link unless $remote && $remote->can_use_esn;
         return $null_link if $remote->has_subscription(
@@ -4201,7 +4170,6 @@
                                           'class'               => 'TrackButton'));
     }
     if ($key eq "unwatch_comments") {
-        return $null_link if $entry->is_delayed;
         return $null_link if $LJ::DISABLED{'esn'};
         return $null_link unless $remote && $remote->can_use_esn;
         my @subs = $remote->has_subscription(

Modified: trunk/cgi-bin/LJ/Widget/EntryChooser.pm
===================================================================
--- trunk/cgi-bin/LJ/Widget/EntryChooser.pm	2012-01-24 07:21:01 UTC (rev 20963)
+++ trunk/cgi-bin/LJ/Widget/EntryChooser.pm	2012-01-24 08:18:01 UTC (rev 20964)
@@ -48,12 +48,16 @@
             }
         }
 
+        my ($edittags_link, $entry_can_edittags);
         my $edit_link_base = "$LJ::SITEROOT/editjournal.bml?";
+        my $usejournal = $entry->journal->username;
+        $edit_link_base .= 'usejournal=' . $usejournal . '&';
 
-        $edit_link_base .= 'usejournal=' . $entry->journal->username . '&';
-
         if ( $entry->is_delayed ) {
             $edit_link_base .= 'delayedid=' . $entry->delayedid . '&';
+            $edittags_link  = "$LJ::SITEROOT/edittags.bml?" .
+                              "journal=$usejournal&delayedid=" .
+                              $entry->delayedid;
         } else {
             $edit_link_base .= 'itemid=' . $entry->ditemid . '&';
         }
@@ -66,7 +70,7 @@
             $entry_url = $entry->url;
         } else {
             my $delayed_id = $entry->delayedid;
-            $entry_url = "javascript:showEntry($delayed_id);";
+            $entry_url = "javascript:showEntry(\"$usejournal\", $delayed_id);";
         }
         my $entry_subject = $entry->subject_text;
 
@@ -92,13 +96,19 @@
             $entry_taglist = join( ', ', @taglist );
         }
 
+        if ( $entry->is_delayed ) {
+            $entry_can_edittags = $entry_can_edit;
+        }
+
         push @entries_display, {
             'entry_can_edit'     => $entry_can_edit,
+            'entry_can_edittags' => $entry_can_edittags,
             'poster_ljuser'      => $poster_ljuser,
             'entry_is_delayed'   => $entry_is_delayed,
             'entry_is_sticky'    => $entry_is_sticky,
             'entry_security'     => $entry_security,
             'edit_link'          => $edit_link,
+            'edittags_link'      => $edittags_link,
             'delete_link'        => $delete_link,
             'entry_url'          => $entry_url,
             'entry_subject'      => $entry_subject,

Modified: trunk/htdocs/manage/scheduled_posts.bml
===================================================================
--- trunk/htdocs/manage/scheduled_posts.bml	2012-01-24 07:21:01 UTC (rev 20963)
+++ trunk/htdocs/manage/scheduled_posts.bml	2012-01-24 08:18:01 UTC (rev 20964)
@@ -3,18 +3,25 @@
 windowtitle=><?_ML .title _ML?>
 head<=
 <script type="text/javascript">
-function showEntry(delayedId) {
+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';
     
-    newInput = preview.document.createElement("input");
-    newInput.name = "delayed_id";
-    newInput.value = delayedId;
-    newInput.type = 'hidden';
-    entryForm.appendChild(newInput);
+    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;

Modified: trunk/htdocs/preview/entry.bml
===================================================================
--- trunk/htdocs/preview/entry.bml	2012-01-24 07:21:01 UTC (rev 20963)
+++ trunk/htdocs/preview/entry.bml	2012-01-24 08:18:01 UTC (rev 20964)
@@ -41,7 +41,7 @@
         LJ::entry_form_decode(\%req, \%POST);
     } else {
         $delayed_obj
-            = LJ::DelayedEntry->get_entry_by_id($remote, $delayed_id);
+            = LJ::DelayedEntry->get_entry_by_id($u, $delayed_id);
 
         if (!$delayed_obj) {
             return "unknown error";

Modified: trunk/templates/Widgets/entry_chooser.tmpl
===================================================================
--- trunk/templates/Widgets/entry_chooser.tmpl	2012-01-24 07:21:01 UTC (rev 20963)
+++ trunk/templates/Widgets/entry_chooser.tmpl	2012-01-24 08:18:01 UTC (rev 20964)
@@ -29,6 +29,10 @@
 					<TMPL_ELSE>
 						<a href='<TMPL_VAR delete_link ESCAPE=HTML>' class='b-editentry-del-btn b-editentry-ctrl-btn'></a>
 					</TMPL_IF>
+
+					<TMPL_IF entry_can_edittags>
+						<a href='<TMPL_VAR edittags_link ESCAPE=HTML>' class='b-editentry-edittags-btn b-editentry-ctrl-btn'></a>
+					</TMPL_IF>
 				</p>
 
 				<h2>

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