mark: A photo of Mark kneeling on top of the Taal Volcano in the Philippines. It was a long hike. (Default)
Mark Smith ([staff profile] mark) wrote in [site community profile] changelog2009-07-22 02:22 am

[dw-nonfree] Add "useful posting" links to update.bml

[commit: http://hg.dwscoalition.org/dw-nonfree/rev/40dcfc6f9aca]

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

Add useful links to update page.

Patch by [personal profile] afuna.

Files modified:
  • bin/upgrading/en_DW.dat
  • cgi-bin/DW/Hooks/EntryForm.pm
--------------------------------------------------------------------------------
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 <coder.dw@afunamatata.com>
+#
+# 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;
+
--------------------------------------------------------------------------------

Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org