http://communityname.dreamwidth.org/guidelines points to the 
community's posting guidelines entry if provided by the community (linked to 
when joining)

        Patch by afuna. 

diffs (128 lines):

diff -r e1b59dbfb947 -r f666763b15e4 bin/upgrading/en.dat
--- a/bin/upgrading/en.dat      Mon Aug 30 16:40:13 2010 +0800
+++ b/bin/upgrading/en.dat      Mon Aug 30 18:41:45 2010 +0800
@@ -1196,6 +1196,10 @@ error.deleted.title=Deleted Account
 error.deleted.title=Deleted Account
 
 error.expiredchal=Login window expired.  Please try again.
+
+error.guidelines.none=[[user]] has not defined an entry for their community 
guidelines. See <a [[aopts]]>their profile</a> for further information about 
the community.
+
+error.guidelines.notcomm=Community guidelines are only available for 
communities.
 
 error.interest.bytes=Sorry, you have listed an interest with [[bytes]] bytes.  
Each interest has a limit of [[bytes_max]] bytes.  Any changes you made to your 
interests were not saved.  Go back and remove, or modify "[[int]]".
 
diff -r e1b59dbfb947 -r f666763b15e4 cgi-bin/DW/Controller/Misc.pm
--- a/cgi-bin/DW/Controller/Misc.pm     Mon Aug 30 16:40:13 2010 +0800
+++ b/cgi-bin/DW/Controller/Misc.pm     Mon Aug 30 18:41:45 2010 +0800
@@ -27,6 +27,7 @@ use DW::Template;
 
 DW::Routing->register_string( '/misc/whereami', \&whereami_handler, app => 1 );
 DW::Routing->register_string( '/pubkey',        \&pubkey_handler,   app => 1 );
+DW::Routing->register_string( '/guidelines',    \&community_guidelines, user 
=> 1 );
 
 # handles the /misc/whereami page
 sub whereami_handler {
@@ -52,4 +53,22 @@ sub pubkey_handler {
     return DW::Template->render_template( 'misc/pubkey.tt', $rv );
 }
 
+sub community_guidelines {
+    my ( $opts ) = @_;
+    my $r = DW::Request->get;
+
+    my $u = LJ::load_user( $opts->username );
+    return error_ml( 'error.invaliduser' )  
+        unless LJ::isu( $u );
+
+    return error_ml( 'error.guidelines.notcomm' )
+        unless $u->is_community;
+
+    my $guidelines_entry = $u->get_posting_guidelines_entry;
+    return error_ml( 'error.guidelines.none', { user => $u->ljuser_display, 
aopts => "href='" . $u->profile_url . "'" } )
+        unless $guidelines_entry;
+
+    return $r->redirect( $guidelines_entry->url );
+}
+
 1;
diff -r e1b59dbfb947 -r f666763b15e4 cgi-bin/LJ/User.pm
--- a/cgi-bin/LJ/User.pm        Mon Aug 30 16:40:13 2010 +0800
+++ b/cgi-bin/LJ/User.pm        Mon Aug 30 18:41:45 2010 +0800
@@ -2704,6 +2704,16 @@ sub get_posting_guidelines_entry {
     return undef;
 }
 
+sub posting_guidelines_url {
+    my $u = $_[0];
+
+    return "" unless $u->is_community;
+
+    my $posting_guidelines = $u->posting_guidelines_entry;
+    return "" unless $posting_guidelines;
+
+    return $u->journal_base . "/guidelines";
+}
 
 sub profile_url {
     my ($u, %opts) = @_;
diff -r e1b59dbfb947 -r f666763b15e4 htdocs/community/join.bml
--- a/htdocs/community/join.bml Mon Aug 30 16:40:13 2010 +0800
+++ b/htdocs/community/join.bml Mon Aug 30 18:41:45 2010 +0800
@@ -135,10 +135,7 @@ body<=
         my $post_url;
         $post_url = $LJ::SITEROOT . "/update?usejournal=" . $cu->user
             if $show_join_post_link && $remote->can_post_to( $cu );
-        my $posting_guidelines_entry = $cu->get_posting_guidelines_entry;
-        my $posting_guidelines_entry_url;
-        $posting_guidelines_entry_url = $posting_guidelines_entry->url
-            if $posting_guidelines_entry;
+        my $posting_guidelines_entry_url = $cu->posting_guidelines_url;
 
         $ret .= "<?h1 $ML{'.success'} h1?><?p " . BML::ml('.label.membernow6',
                                                           { 'commname' => 
LJ::ljuser($cu) }) . " p?>";
diff -r e1b59dbfb947 -r f666763b15e4 htdocs/community/settings.bml
--- a/htdocs/community/settings.bml     Mon Aug 30 16:40:13 2010 +0800
+++ b/htdocs/community/settings.bml     Mon Aug 30 18:41:45 2010 +0800
@@ -191,8 +191,13 @@ body<=
             }
 
             $ret .= "<?p $ML{'.label.rellinks'} <ul><li><a href='" . 
$cu->journal_base . "'>$ML{'.label.commsite'}</a></li>";
-            $ret .= "<li><a href='" . $cu->profile_url() . 
"'>$ML{'.label.comminfo'}</a></li><li>"
-                . BML::ml('.label.managepage', { 'aopts' => 
'href="/community/manage"' }) . "</li></ul> p?>";
+            $ret .= "<li><a href='" . $cu->profile_url() . 
"'>$ML{'.label.comminfo'}</a></li>"
+                . "<li>" . BML::ml('.label.managepage', { aopts => 
'href="/community/manage"' }) . "</li>";
+
+            my $posting_guidelines_url = $cu->posting_guidelines_url;
+            $ret .= "<li>" . BML::ml('.label.guidelines', { aopts => 
"href='$posting_guidelines_url'"} ) . "</li>"
+                if $posting_guidelines_url;
+            $ret .= "</ul> p?>";
 
             return $ret;
         }
diff -r e1b59dbfb947 -r f666763b15e4 htdocs/community/settings.bml.text
--- a/htdocs/community/settings.bml.text        Mon Aug 30 16:40:13 2010 +0800
+++ b/htdocs/community/settings.bml.text        Mon Aug 30 18:41:45 2010 +0800
@@ -58,6 +58,8 @@
 
 .label.community=Community:
 
+.label.guidelines=<a [[aopts]]>Community guidelines</a> - consistent link to 
your community guidelines entry
+
 .label.howoperates=Choose how your community operates.  You can change these 
later.
 
 .label.maintainer=Maintainer:
diff -r e1b59dbfb947 -r f666763b15e4 htdocs/manage/circle/add.bml
--- a/htdocs/manage/circle/add.bml      Mon Aug 30 16:40:13 2010 +0800
+++ b/htdocs/manage/circle/add.bml      Mon Aug 30 18:41:45 2010 +0800
@@ -122,9 +122,7 @@ _c?>
         my $posting_guidelines_entry_url;
         my $post_url;
         if ( $u->is_community ) {
-            my $posting_guidelines_entry = $u->get_posting_guidelines_entry;
-            $posting_guidelines_entry_url = $posting_guidelines_entry->url
-                if $posting_guidelines_entry;
+            $posting_guidelines_entry_url = $u->posting_guidelines_url;
             my $show_join_post_link = $u->hide_join_post_link ? 0 : 1;
             $post_url = $LJ::SITEROOT . "/update?usejournal=" . $u->user
                 if $show_join_post_link && $remote->can_post_to( $u );
_______________________________________________
dw-changelog mailing list
[email protected]
http://lists.dwscoalition.org/mailman/listinfo/dw-changelog

Reply via email to