Add useful links to update page.

        Patch by afuna. 

diffs (59 lines):

diff -r 6b6a7be0e25c -r 40dcfc6f9aca bin/upgrading/en_DW.dat
--- a/bin/upgrading/en_DW.dat   Wed Jul 22 02:03:14 2009 +0000
+++ b/bin/upgrading/en_DW.dat   Wed Jul 22 02:22:02 2009 +0000
@@ -1,4 +1,6 @@
 ;; -*- coding: utf-8 -*-
+
+entryform.pollcreator=Poll Creator
 
 invitecodes.userclass.active30d=Users active during the past 30 days
 
diff -r 6b6a7be0e25c -r 40dcfc6f9aca cgi-bin/DW/Hooks/EntryForm.pm
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/cgi-bin/DW/Hooks/EntryForm.pm     Wed Jul 22 02:22:02 2009 +0000
@@ -0,0 +1,45 @@
+# Hooks for the entry form
+#
+# Authors:
+#     Afuna <[email protected]>
+#
+# Copyright (c) 2009 by Dreamwidth Studios, LLC.
+#
+# This program is NOT free software or open-source; you can use it as an
+# example of how to implement your own site-specific extensions to the
+# Dreamwidth Studios open-source code, but you cannot use it on your site
+# or redistribute it, with or without modifications.
+#
+
+package DW::Hooks::EntryForm;
+
+use strict;
+use warnings;
+
+LJ::register_hook( 'entryforminfo', sub {
+    my ( $journal, $remote ) = @_;
+
+    my $make_list = sub {
+        my $ret;
+        foreach my $link_info ( @_ ) {
+            $ret .= "<li><a href='$link_info->[0]'>$link_info->[1]</a></li>"
+                if $link_info->[2];
+        }
+        return "<ul>$ret</ul>";
+    };
+
+    my $usejournal = $journal ? "?usejournal=$journal" : "";
+
+    my $can_make_poll = 0;
+    $can_make_poll = LJ::get_cap( $remote, "makepoll" ) if $remote;
+    $can_make_poll ||= LJ::get_cap( LJ::load_user( $journal ), "makepoll" ) if 
$journal;
+
+    return $make_list->(
+        # URL, link text, whether to show or not
+        [ "/poll/create$usejournal", LJ::Lang::ml( 'entryform.pollcreator' ), 
$can_make_poll ]
+    );
+    
+} );
+
+1;
+
_______________________________________________
dw-changelog mailing list
[email protected]
http://lists.dwscoalition.org/mailman/listinfo/dw-changelog

Reply via email to