From svnnotify ¡÷ sourceforge.jp Mon Mar 3 20:04:23 2008 From: svnnotify ¡÷ sourceforge.jp (svnnotify ¡÷ sourceforge.jp) Date: Mon, 03 Mar 2008 20:04:23 +0900 Subject: [Slashdotjp-dev 997] [524] * Fix email message for new user creation Message-ID: <1204542263.536261.3620.nullmailer@users.sourceforge.jp> Revision: 524 http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=slashdotjp&view=rev&rev=524 Author: tach Date: 2008-03-03 20:04:23 +0900 (Mon, 03 Mar 2008) Log Message: ----------- * Fix email message for new user creation - You should create "mail_msg_newuser" data to template "data;login;default" Modified Paths: -------------- slashjp/branches/2.5.0.192/debian/changelog slashjp/branches/2.5.0.192/plugins/Login/login.pl -------------- next part -------------- Modified: slashjp/branches/2.5.0.192/debian/changelog =================================================================== --- slashjp/branches/2.5.0.192/debian/changelog 2008-02-26 11:58:41 UTC (rev 523) +++ slashjp/branches/2.5.0.192/debian/changelog 2008-03-03 11:04:23 UTC (rev 524) @@ -1,3 +1,11 @@ +slash (2.5.0.192-6) unstable; urgency=low + + * Fix email message for new user creation + - You should create "mail_msg_newuser" data to template + "data;login;default" + + -- Taku YASUI Mon, 3 Mar 2008 10:06:08 +0000 + slash (2.5.0.192-5) unstable; urgency=low * Fix admin topic select window to change tree/alpabetical Modified: slashjp/branches/2.5.0.192/plugins/Login/login.pl =================================================================== --- slashjp/branches/2.5.0.192/plugins/Login/login.pl 2008-02-26 11:58:41 UTC (rev 523) +++ slashjp/branches/2.5.0.192/plugins/Login/login.pl 2008-03-03 11:04:23 UTC (rev 524) @@ -278,6 +278,7 @@ my $newpasswd = $slashdb->getNewPasswd($uid); my $tempnick = $user_send->{nickname}; my $subject = getData('mail_subject', { nickname => $user_send->{nickname} }); + my $mail_template = $form->{op} eq "newuser" ? "mail_msg_newuser" : "mail_msg"; # Pull out some data passed in with the request. Only the IP # number is actually trustworthy, the others could be forged. @@ -295,7 +296,7 @@ $ua =~ s/\s+/ /g; $ua = substr(strip_attribute($ua), 0, 60); - my $msg = getData('mail_msg', { + my $msg = getData($mail_template, { newpasswd => $newpasswd, tempnick => $tempnick, remote_ip => $remote_ip, From svnnotify ¡÷ sourceforge.jp Mon Mar 3 20:10:18 2008 From: svnnotify ¡÷ sourceforge.jp (svnnotify ¡÷ sourceforge.jp) Date: Mon, 03 Mar 2008 20:10:18 +0900 Subject: [Slashdotjp-dev 998] [525] [svn-buildpackage] Tagging slash (2.5.0.192-6) Message-ID: <1204542618.478281.6756.nullmailer@users.sourceforge.jp> Revision: 525 http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=slashdotjp&view=rev&rev=525 Author: tach Date: 2008-03-03 20:10:18 +0900 (Mon, 03 Mar 2008) Log Message: ----------- [svn-buildpackage] Tagging slash (2.5.0.192-6) Added Paths: ----------- slashjp/tags/2.5.0.192-6/ -------------- next part -------------- Copied: slashjp/tags/2.5.0.192-6 (from rev 524, slashjp/branches/2.5.0.192) From svnnotify ¡÷ sourceforge.jp Mon Mar 3 20:14:27 2008 From: svnnotify ¡÷ sourceforge.jp (svnnotify ¡÷ sourceforge.jp) Date: Mon, 03 Mar 2008 20:14:27 +0900 Subject: [Slashdotjp-dev 999] [526] merged from 2.5.0.192 branch to fix newuser email message Message-ID: <1204542867.990154.10043.nullmailer@users.sourceforge.jp> Revision: 526 http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=slashdotjp&view=rev&rev=526 Author: tach Date: 2008-03-03 20:14:27 +0900 (Mon, 03 Mar 2008) Log Message: ----------- merged from 2.5.0.192 branch to fix newuser email message Modified Paths: -------------- slashjp/trunk/plugins/Login/login.pl -------------- next part -------------- Modified: slashjp/trunk/plugins/Login/login.pl =================================================================== --- slashjp/trunk/plugins/Login/login.pl 2008-03-03 11:10:18 UTC (rev 525) +++ slashjp/trunk/plugins/Login/login.pl 2008-03-03 11:14:27 UTC (rev 526) @@ -278,6 +278,7 @@ my $newpasswd = $slashdb->getNewPasswd($uid); my $tempnick = $user_send->{nickname}; my $subject = getData('mail_subject', { nickname => $user_send->{nickname} }); + my $mail_template = $form->{op} eq "newuser" ? "mail_msg_newuser" : "mail_msg"; # Pull out some data passed in with the request. Only the IP # number is actually trustworthy, the others could be forged. @@ -295,7 +296,7 @@ $ua =~ s/\s+/ /g; $ua = substr(strip_attribute($ua), 0, 60); - my $msg = getData('mail_msg', { + my $msg = getData($mail_template, { newpasswd => $newpasswd, tempnick => $tempnick, remote_ip => $remote_ip, From svnnotify ¡÷ sourceforge.jp Tue Mar 4 18:02:09 2008 From: svnnotify ¡÷ sourceforge.jp (svnnotify ¡÷ sourceforge.jp) Date: Tue, 04 Mar 2008 18:02:09 +0900 Subject: [Slashdotjp-dev 1000] [527] merged from upstream T_2_5_0_196 Message-ID: <1204621329.351293.1994.nullmailer@users.sourceforge.jp> Revision: 527 http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=slashdotjp&view=rev&rev=527 Author: tach Date: 2008-03-04 18:02:07 +0900 (Tue, 04 Mar 2008) Log Message: ----------- merged from upstream T_2_5_0_196 Modified Paths: -------------- slashjp/branches/upstream/current/Slash/Hook/Hook.pm slashjp/branches/upstream/current/Slash/Utility/Comments/Comments.pm slashjp/branches/upstream/current/Slash/Utility/Environment/Environment.pm slashjp/branches/upstream/current/plugins/Admin/admin.pl slashjp/branches/upstream/current/plugins/Ajax/PLUGIN slashjp/branches/upstream/current/plugins/Ajax/htdocs/ajax.pl slashjp/branches/upstream/current/plugins/Ajax/htdocs/images/common.js slashjp/branches/upstream/current/plugins/Ajax/templates/prefs_admin;ajax;default slashjp/branches/upstream/current/plugins/Ajax/templates/prefs_d2;ajax;default slashjp/branches/upstream/current/plugins/Ajax/templates/prefs_d2_posting;ajax;default slashjp/branches/upstream/current/plugins/Ajax/templates/prefs_home;ajax;default slashjp/branches/upstream/current/plugins/Ajax/templates/prefs_main;ajax;default slashjp/branches/upstream/current/plugins/Ajax/templates/prefs_user;ajax;default slashjp/branches/upstream/current/plugins/FAQSlashdot/faq/UI.shtml slashjp/branches/upstream/current/plugins/FAQSlashdot/faq/accounts.shtml slashjp/branches/upstream/current/plugins/FAQSlashdot/faq/advertising.shtml slashjp/branches/upstream/current/plugins/FAQSlashdot/faq/badges.shtml slashjp/branches/upstream/current/plugins/FAQSlashdot/faq/com-mod.shtml slashjp/branches/upstream/current/plugins/FAQSlashdot/faq/editorial.shtml slashjp/branches/upstream/current/plugins/FAQSlashdot/faq/faq-meta.shtml slashjp/branches/upstream/current/plugins/FAQSlashdot/faq/feeds.shtml slashjp/branches/upstream/current/plugins/FAQSlashdot/faq/firehose.shtml slashjp/branches/upstream/current/plugins/FAQSlashdot/faq/index.shtml slashjp/branches/upstream/current/plugins/FAQSlashdot/faq/interviews.shtml slashjp/branches/upstream/current/plugins/FAQSlashdot/faq/metamod.shtml slashjp/branches/upstream/current/plugins/FAQSlashdot/faq/slashmeta.shtml slashjp/branches/upstream/current/plugins/FAQSlashdot/faq/subscriptions.shtml slashjp/branches/upstream/current/plugins/FAQSlashdot/faq/suggestions.shtml slashjp/branches/upstream/current/plugins/FAQSlashdot/faq/tags.shtml slashjp/branches/upstream/current/plugins/FAQSlashdot/faq/tech.shtml slashjp/branches/upstream/current/plugins/FireHose/FireHose.pm slashjp/branches/upstream/current/plugins/FireHose/templates/fhadvprefpane;misc;default slashjp/branches/upstream/current/plugins/FireHose/templates/list;firehose;default slashjp/branches/upstream/current/plugins/Stats/Stats.pm slashjp/branches/upstream/current/plugins/Tags/Tags.pm slashjp/branches/upstream/current/plugins/Tags/mysql_dump.sql slashjp/branches/upstream/current/plugins/Tags/templates/taghistory;misc;default slashjp/branches/upstream/current/sql/mysql/defaults.sql slashjp/branches/upstream/current/sql/mysql/upgrades slashjp/branches/upstream/current/tagboxes/Top/Top.pm slashjp/branches/upstream/current/themes/slashcode/htdocs/comments.pl slashjp/branches/upstream/current/themes/slashcode/htdocs/images/comments.js slashjp/branches/upstream/current/themes/slashcode/templates/dispLinkComment;misc;default slashjp/branches/upstream/current/themes/slashcode/templates/help_anon;misc;default slashjp/branches/upstream/current/themes/slashcode/templates/help_main;misc;default Added Paths: ----------- slashjp/branches/upstream/current/plugins/Ajax/templates/edit_comment;ajax;default -------------- next part -------------- Modified: slashjp/branches/upstream/current/Slash/Hook/Hook.pm =================================================================== --- slashjp/branches/upstream/current/Slash/Hook/Hook.pm 2008-03-03 11:14:27 UTC (rev 526) +++ slashjp/branches/upstream/current/Slash/Hook/Hook.pm 2008-03-04 09:02:07 UTC (rev 527) @@ -1,14 +1,14 @@ # This code is a part of Slash, and is released under the GPL. # Copyright 1997-2005 by Open Source Technology Group. See README # and COPYING for more information, or see http://slashcode.com/. -# $Id: Hook.pm,v 1.10 2006/02/03 23:43:46 pudge Exp $ +# $Id: Hook.pm,v 1.11 2008/02/28 19:26:58 pudge Exp $ package Slash::Hook; use strict; use DBIx::Password; use Slash; use Slash::DB; -use Slash::Utility; +use Slash::Utility::Environment; # avoid cross-caller issues use vars qw($VERSION); # Arrrr Matey... @@ -16,7 +16,7 @@ use base 'Exporter'; use vars qw($VERSION @EXPORT); -($VERSION) = ' $Revision: 1.10 $ ' =~ /\$Revision:\s+([^\s]+)/; +($VERSION) = ' $Revision: 1.11 $ ' =~ /\$Revision:\s+([^\s]+)/; @EXPORT = qw(slashHook); my %classes; Modified: slashjp/branches/upstream/current/Slash/Utility/Comments/Comments.pm =================================================================== --- slashjp/branches/upstream/current/Slash/Utility/Comments/Comments.pm 2008-03-03 11:14:27 UTC (rev 526) +++ slashjp/branches/upstream/current/Slash/Utility/Comments/Comments.pm 2008-03-04 09:02:07 UTC (rev 527) @@ -1,7 +1,7 @@ # This code is a part of Slash, and is released under the GPL. # Copyright 1997-2005 by Open Source Technology Group. See README # and COPYING for more information, or see http://slashcode.com/. -# $Id: Comments.pm,v 1.1 2008/02/21 01:01:52 pudge Exp $ +# $Id: Comments.pm,v 1.2 2008/02/28 19:26:58 pudge Exp $ package Slash::Utility::Comments; @@ -23,22 +23,23 @@ use strict; use Fcntl; -use Slash::Display; use Slash::Utility::Access; use Slash::Utility::Data; use Slash::Utility::Display; use Slash::Utility::Environment; -use Slash::Constants qw(:strip :people); +use Slash::Display; +use Slash::Hook; +use Slash::Constants qw(:strip :people :messages); use base 'Exporter'; use vars qw($VERSION @EXPORT); -($VERSION) = ' $Revision: 1.1 $ ' =~ /\$Revision:\s+([^\s]+)/; +($VERSION) = ' $Revision: 1.2 $ ' =~ /\$Revision:\s+([^\s]+)/; @EXPORT = qw( constrain_score dispComment displayThread printComments jsSelectComments commentCountThreshold commentThresholds discussion2 tempUofmLinkGenerate tempUofmCipherObj selectComments - getPoints preProcessComment postProcessComment prevComment + getPoints preProcessComment postProcessComment prevComment saveComment ); @@ -333,8 +334,6 @@ sub jsSelectComments { #slashProf("jsSelectComments"); - # XXXd2 selectComments() is being called twice in same request ... compare and consolidate - # also consolidate code with ajax.pl:fetchComments # version 0.9 is broken; 0.6 and 1.00 seem to work -- pudge 2006-12-19 require Data::JavaScript::Anon; my($slashdb, $constants, $user, $form, $gSkin) = @_; @@ -366,7 +365,7 @@ $comments = _get_thread($comments, $pid); } - my @roots = $pid ? $pid : grep { $_ && !$comments->{$_}{pid} } keys %$comments; + my @roots = $pid ? $pid : @{$comments->{$pid}{kids}}; my %roots_hash = ( map { $_ => 1 } @roots ); my $thresh_totals; @@ -1328,6 +1327,12 @@ my $constants = getCurrentStatic(); my $reader = getObject('Slash::DB', { db_type => 'reader' }); + $discussion->{type} = isDiscussionOpen($discussion); + if ($discussion->{type} eq 'archived') { + $$error_message = getError('archive_error'); + return -1; + } + my $tempSubject = strip_notags($comm->{postersubj}); my $tempComment = $comm->{postercomment}; @@ -1449,7 +1454,214 @@ return $previewForm; } +sub saveComment { + my($comm, $comment, $user, $discussion, $error_message) = @_; # probably $comm = $form + my $slashdb = getCurrentDB(); + my $constants = getCurrentStatic(); + my $reader = getObject('Slash::DB', { db_type => 'reader' }); + $comm->{nobonus} = $user->{nobonus} unless $comm->{nobonus_present}; + $comm->{postanon} = $user->{postanon} unless $comm->{postanon_present}; + $comm->{nosubscriberbonus} = $user->{nosubscriberbonus} + unless $comm->{nosubscriberbonus_present}; + +#print STDERR scalar(localtime) . " $$ E header_emitted=$header_emitted do_emit_html=$do_emit_html redirect_to=" . (defined($redirect_to) ? $redirect_to : "undef") . "\n"; + + # Set starting points to the AC's starting points, by default. + # If the user is posting under their own name, we'll reset this + # value (and add other modifiers) in a moment. + my $pts = getCurrentAnonymousCoward('defaultpoints'); + my $karma_bonus = 0; + my $subscriber_bonus = 0; + my $tweak = 0; + + if (!$comm->{anon}) { + $pts = $user->{defaultpoints}; + + if ($constants->{karma_posting_penalty_style} == 0) { + $pts-- if $user->{karma} < 0; + $pts-- if $user->{karma} < $constants->{badkarma}; + } else { + $tweak-- if $user->{karma} < 0; + $tweak-- if $user->{karma} < $constants->{badkarma}; + } + # Enforce proper ranges on comment points. + my($minScore, $maxScore) = + ($constants->{comment_minscore}, $constants->{comment_maxscore}); + $pts = $minScore if $pts < $minScore; + $pts = $maxScore if $pts > $maxScore; + $karma_bonus = 1 if $pts >= 1 && $user->{karma} > $constants->{goodkarma} + && !$comm->{nobonus}; + $subscriber_bonus = 1 if $constants->{plugin}{Subscribe} + && $user->{is_subscriber} + && (!$comm->{nosubscriberbonus} || $comm->{nosubscriberbonus} ne 'on'); + } + +#print STDERR scalar(localtime) . " $$ F header_emitted=$header_emitted do_emit_html=$do_emit_html\n"; + + my $clean_comment = { + subject => $comment->{subject}, + comment => $comment->{comment}, + sid => $comment->{sid}, + pid => $comment->{pid}, + ipid => $user->{ipid}, + subnetid => $user->{subnetid}, + uid => $comment->{uid}, + points => $pts, + tweak => $tweak, + tweak_orig => $tweak, + karma_bonus => $karma_bonus ? 'yes' : 'no', + }; + + if ($constants->{plugin}{Subscribe}) { + $clean_comment->{subscriber_bonus} = $subscriber_bonus ? 'yes' : 'no'; + } + + my $maxCid = $slashdb->createComment($clean_comment); + if ($constants->{comment_karma_disable_and_log}) { + my $post_str = ""; + $post_str .= "NO_ANON " if $user->{state}{commentkarma_no_anon}; + $post_str .= "NO_POST " if $user->{state}{commentkarma_no_post}; + if (isAnon($comment->{uid}) && $user->{state}{commentkarma_no_anon}) { + $slashdb->createCommentLog({ + cid => $maxCid, + logtext => "COMMENTKARMA ANON: $post_str" + }); + } elsif (!isAnon($comment->{uid}) && $user->{state}{commentkarma_no_post}) { + $slashdb->createCommentLog({ + cid => $maxCid, + logtext => "COMMENTKARMA USER: $post_str" + }); + } + } + if ($constants->{comment_is_troll_disable_and_log}) { + $slashdb->createCommentLog({ + cid => $maxCid, + logtext => "ISTROLL" + }); + } + +#print STDERR scalar(localtime) . " $$ G maxCid=$maxCid\n"; + + # make the formkeys happy + $comm->{maxCid} = $maxCid; + + $slashdb->setUser($user->{uid}, { + '-expiry_comm' => 'expiry_comm-1', + }) if allowExpiry(); + + if ($maxCid == -1) { + $$error_message = getError('submission error'); + return -1; + + } elsif (!$maxCid) { + # This site has more than 2**32 comments? Wow. + $$error_message = getError('maxcid exceeded'); + return -1; + } + + + my $saved_comment = $slashdb->getComment($maxCid); + slashHook('comment_save_success', { comment => $saved_comment }); + + my $moddb = getObject("Slash::$constants->{m1_pluginname}"); + if ($moddb) { + my $text = $moddb->checkDiscussionForUndoModeration($comm->{sid}); + # XXX + print $text if $text; + } + + my $tc = $slashdb->getVar('totalComments', 'value', 1); + $slashdb->setVar('totalComments', ++$tc); + + + if ($discussion->{sid}) { + $slashdb->setStory($discussion->{sid}, { writestatus => 'dirty' }); + } + + $slashdb->setUser($clean_comment->{uid}, { + -totalcomments => 'totalcomments+1', + }) if !isAnon($clean_comment->{uid}); + + my($messages, $reply, %users); + my $kinds = $reader->getDescriptions('discussion_kinds'); + if ($comm->{pid} + || $kinds->{ $discussion->{dkid} } =~ /^journal/ + || $constants->{commentnew_msg}) { + $messages = getObject('Slash::Messages'); + $reply = $slashdb->getCommentReply($comm->{sid}, $maxCid); + } + + $clean_comment->{pointsorig} = $clean_comment->{points}; + + # reply to comment + if ($messages && $comm->{pid}) { + my $parent = $slashdb->getCommentReply($comm->{sid}, $comm->{pid}); + my $users = $messages->checkMessageCodes(MSG_CODE_COMMENT_REPLY, [$parent->{uid}]); + if (_send_comment_msg($users->[0], \%users, $pts, $clean_comment)) { + my $data = { + template_name => 'reply_msg', + subject => { template_name => 'reply_msg_subj' }, + reply => $reply, + parent => $parent, + discussion => $discussion, + }; + + $messages->create($users->[0], MSG_CODE_COMMENT_REPLY, $data); + $users{$users->[0]}++; + } + } + + # reply to journal + if ($messages && $kinds->{ $discussion->{dkid} } =~ /^journal/) { + my $users = $messages->checkMessageCodes(MSG_CODE_JOURNAL_REPLY, [$discussion->{uid}]); + if (_send_comment_msg($users->[0], \%users, $pts, $clean_comment)) { + my $data = { + template_name => 'journrep', + subject => { template_name => 'journrep_subj' }, + reply => $reply, + discussion => $discussion, + }; + + $messages->create($users->[0], MSG_CODE_JOURNAL_REPLY, $data); + $users{$users->[0]}++; + } + } + + # comment posted + if ($messages && $constants->{commentnew_msg}) { + my $users = $messages->getMessageUsers(MSG_CODE_NEW_COMMENT); + + my $data = { + template_name => 'commnew', + subject => { template_name => 'commnew_subj' }, + reply => $reply, + discussion => $discussion, + }; + + my @users_send; + for my $usera (@$users) { + next if $users{$usera}; + push @users_send, $usera; + $users{$usera}++; + } + $messages->create(\@users_send, MSG_CODE_NEW_COMMENT, $data) if @users_send; + } + + if ($constants->{validate_html}) { + my $validator = getObject('Slash::Validator'); + my $test = parseDomainTags($comment->{comment}); + $validator->isValid($test, { + data_type => 'comment', + data_id => $maxCid, + message => 1 + }) if $validator; + } + + return $saved_comment; +} + + #======================================================================== =head2 dispComment(COMMENT) @@ -1725,7 +1937,7 @@ op => 'Reply', subject => 'Reply to This', subject_only => 1, - #onclick => ($discussion2 ? "replyTo($comment->{cid}); return false;" : '') + onclick => (($discussion2 && $user->{test_code}) ? "replyTo($comment->{cid}); return false;" : '') }) unless $user->{state}{discussion_archived}; push @link, linkComment({ @@ -2164,6 +2376,40 @@ } ################################################################## +# Decide whether or not to send a given message to a given user +sub _send_comment_msg { + my($uid, $uids, $pts, $C) = @_; + my $constants = getCurrentStatic(); + my $reader = getObject('Slash::DB', { db_type => 'reader' }); + my $user = getCurrentUser(); + + return unless $uid; # no user + return if $uids->{$uid}; # user not already being msgd + return if $user->{uid} == $uid; # don't msg yourself + + my $otheruser = $reader->getUser($uid); + + # use message_threshold in vars, unless user has one + # a message_threshold of 0 is valid, but "" is not + my $message_threshold = length($otheruser->{message_threshold}) + ? $otheruser->{message_threshold} + : length($constants->{message_threshold}) + ? $constants->{message_threshold} + : undef; + + my $mod_reader = getObject("Slash::$constants->{m1_pluginname}", { db_type => 'reader' }); + my $newpts = getPoints($C, $otheruser, + $constants->{comment_minscore}, $constants->{comment_maxscore}, + $reader->countUsers({ max => 1 }), $mod_reader->getReasons, + ); + + # only if reply pts meets message threshold + return if defined $message_threshold && $newpts < $message_threshold; + + return 1; +} + +################################################################## # Troll Detection: checks to see if this IP or UID has been # abusing the system in the last 24 hours. # 1=Troll 0=Good Little Goober @@ -2244,4 +2490,4 @@ =head1 VERSION -$Id: Comments.pm,v 1.1 2008/02/21 01:01:52 pudge Exp $ +$Id: Comments.pm,v 1.2 2008/02/28 19:26:58 pudge Exp $ Modified: slashjp/branches/upstream/current/Slash/Utility/Environment/Environment.pm =================================================================== --- slashjp/branches/upstream/current/Slash/Utility/Environment/Environment.pm 2008-03-03 11:14:27 UTC (rev 526) +++ slashjp/branches/upstream/current/Slash/Utility/Environment/Environment.pm 2008-03-04 09:02:07 UTC (rev 527) @@ -1,7 +1,7 @@ # This code is a part of Slash, and is released under the GPL. # Copyright 1997-2005 by Open Source Technology Group. See README # and COPYING for more information, or see http://slashcode.com/. -# $Id: Environment.pm,v 1.233 2008/02/08 04:27:03 jamiemccarthy Exp $ +# $Id: Environment.pm,v 1.234 2008/02/28 19:26:58 pudge Exp $ package Slash::Utility::Environment; @@ -33,7 +33,7 @@ use base 'Exporter'; use vars qw($VERSION @EXPORT); -($VERSION) = ' $Revision: 1.233 $ ' =~ /\$Revision:\s+([^\s]+)/; +($VERSION) = ' $Revision: 1.234 $ ' =~ /\$Revision:\s+([^\s]+)/; @EXPORT = qw( dbAvailable @@ -1693,6 +1693,8 @@ $user->{state}{lostprivs} = 1; } + $user->{test_code} ||= $constants->{test_code}; + if ($constants->{plugin}{Tags}) { my $max_uid; my $write = $constants->{tags_stories_allowwrite} || 0; @@ -3524,4 +3526,4 @@ =head1 VERSION -$Id: Environment.pm,v 1.233 2008/02/08 04:27:03 jamiemccarthy Exp $ +$Id: Environment.pm,v 1.234 2008/02/28 19:26:58 pudge Exp $ Modified: slashjp/branches/upstream/current/plugins/Admin/admin.pl =================================================================== --- slashjp/branches/upstream/current/plugins/Admin/admin.pl 2008-03-03 11:14:27 UTC (rev 526) +++ slashjp/branches/upstream/current/plugins/Admin/admin.pl 2008-03-04 09:02:07 UTC (rev 527) @@ -2,7 +2,7 @@ # This code is a part of Slash, and is released under the GPL. # Copyright 1997-2005 by Open Source Technology Group. See README # and COPYING for more information, or see http://slashcode.com/. -# $Id: admin.pl,v 1.330 2008/01/30 22:46:10 jamiemccarthy Exp $ +# $Id: admin.pl,v 1.331 2008/02/27 19:00:15 jamiemccarthy Exp $ use strict; use File::Temp 'tempfile'; @@ -2059,14 +2059,31 @@ } $data->{neverdisplay} = $form->{display} ? '' : 1; - -#print STDERR "admin.pl before updateStory data: " . Dumper($data); if ($data->{neverdisplay}) { print STDERR "Setting sid: $form->{sid} to neverdisplay\n"; use Data::Dumper; print STDERR Dumper($form); print STDERR Dumper($data); } + + if ($constants->{brief_sectional_mainpage}) { + $data->{offmainpage} = undef; + my $sectional_weight = $constants->{topics_sectional_weight} || 10; + if (!$rendered_hr->{ $constants->{mainpage_nexus_tid} }) { + my $mdn_ar = $slashdb->getMainpageDisplayableNexuses(); + my $mdn_hr = { map { ($_, 1) } @$mdn_ar }; + my $any_sectional = 0; + for my $tid (keys %$rendered_hr) { + $any_sectional = 1, last + if $rendered_hr->{$tid} >= $sectional_weight + && $mdn_hr->{$tid}; + } + $data->{offmainpage} = 1 if !$any_sectional; + } + + } + +#print STDERR "admin.pl before updateStory data: " . Dumper($data); if (!$slashdb->updateStory($form->{sid}, $data)) { titlebar('100%', getTitle('story_update_failed')); editStory(@_); Modified: slashjp/branches/upstream/current/plugins/Ajax/PLUGIN =================================================================== --- slashjp/branches/upstream/current/plugins/Ajax/PLUGIN 2008-03-03 11:14:27 UTC (rev 526) +++ slashjp/branches/upstream/current/plugins/Ajax/PLUGIN 2008-03-04 09:02:07 UTC (rev 527) @@ -1,4 +1,4 @@ -# $Id: PLUGIN,v 1.39 2008/02/20 16:30:47 entweichen Exp $ +# $Id: PLUGIN,v 1.40 2008/02/28 19:26:58 pudge Exp $ name=Ajax description="Ajax (Asynchronous Javascript and XML)" mysql_dump=mysql_dump.sql @@ -35,6 +35,7 @@ template=templates/ajax_reskey_tag;misc;default template=templates/data;ajax;default template=templates/datewidget;misc;default +template=templates/edit_comment;ajax;default template=templates/modal_footer;misc;default template=templates/prefs_d2;ajax;default template=templates/prefs_d2_posting;ajax;default Modified: slashjp/branches/upstream/current/plugins/Ajax/htdocs/ajax.pl =================================================================== --- slashjp/branches/upstream/current/plugins/Ajax/htdocs/ajax.pl 2008-03-03 11:14:27 UTC (rev 526) +++ slashjp/branches/upstream/current/plugins/Ajax/htdocs/ajax.pl 2008-03-04 09:02:07 UTC (rev 527) @@ -2,7 +2,7 @@ # This code is a part of Slash, and is released under the GPL. # Copyright 1997-2005 by Open Source Technology Group. See README # and COPYING for more information, or see http://slashcode.com/. -# $Id: ajax.pl,v 1.72 2008/02/21 01:01:52 pudge Exp $ +# $Id: ajax.pl,v 1.74 2008/02/28 19:26:58 pudge Exp $ use strict; use warnings; @@ -14,7 +14,7 @@ use Slash::Utility; use vars qw($VERSION); -($VERSION) = ' $Revision: 1.72 $ ' =~ /\$Revision:\s+([^\s]+)/; +($VERSION) = ' $Revision: 1.74 $ ' =~ /\$Revision:\s+([^\s]+)/; ################################################################## sub main { @@ -63,7 +63,9 @@ } if ($ops->{$op}{reskey_type} eq 'createuse') { $rkey->createuse; - } else { + } elsif ($ops->{$op}{reskey_type} eq 'touch') { + $rkey->touch; + } else { $rkey->use; } if (!$rkey->success) { @@ -266,6 +268,71 @@ ################### # comments +sub submitReply { + my($slashdb, $constants, $user, $form, $options) = @_; + my $pid = $form->{pid} || 0; + my $sid = $form->{sid} or return; + +} + +sub previewReply { + my($slashdb, $constants, $user, $form, $options) = @_; + my $pid = $form->{pid} || 0; + my $sid = $form->{sid} or return; + + $user->{state}{ajax_accesslog_op} = 'comments_preview_reply'; + + my $discussion = $slashdb->getDiscussion($sid); + my $comment = preProcessComment($form, $user, $discussion); + my $preview = postProcessComment({ %$comment, %$user }, 0, $discussion); + my $html = prevComment($preview, $user); + + + $options->{content_type} = 'application/json'; + my %to_dump = (html => { "replyto_preview_$pid" => $html }); +#use Data::Dumper; print STDERR Dumper \%to_dump; + + return Data::JavaScript::Anon->anon_dump(\%to_dump); +} + + +sub replyForm { + my($slashdb, $constants, $user, $form, $options) = @_; + my $pid = $form->{pid} || 0; + my $sid = $form->{sid} or return; + + $user->{state}{ajax_accesslog_op} = 'comments_reply_form'; + + my($reply, $pid_reply); + $reply = $slashdb->getCommentReply($sid, $pid) if $pid; + $pid_reply = prepareQuoteReply($reply) if $pid && $reply; + + my $reskey = getObject('Slash::ResKey'); + my $rkey = $reskey->key('comments', { nostate => 1 }); + $rkey->create; + + my %to_dump; + if ($rkey->success) { + my $reply_html = slashDisplay('edit_comment', { + sid => $sid, + pid => $pid, + reply => $reply, + rkey => $rkey + }, { Return => 1 }); + %to_dump = (html => { "replyto_$pid" => $reply_html }); + } else { + %to_dump = (html => { "replyto_$pid" => $rkey->errstr }); + } + + $options->{content_type} = 'application/json'; + $to_dump{eval_first} = "comment_body_reply[$pid] = '$pid_reply';" if $pid_reply; + +#use Data::Dumper; print STDERR Dumper \%to_dump; + + return Data::JavaScript::Anon->anon_dump(\%to_dump); +} + + sub readRest { my($slashdb, $constants, $user, $form) = @_; my $cid = $form->{cid} or return; @@ -550,90 +617,103 @@ { Return => 1 } ); } elsif ($form->{'section'} eq 'sectional') { - - getSectionPrefsHTML($slashdb, $constants, $user, $form); + getSectionPrefsHTML($slashdb, $constants, $user, $form); - } elsif ($form->{'section'} eq 'slashboxes') { - my $section_descref = { }; - my $box_order; - my $sections_description = $slashdb->getSectionBlocks(); - my $slashboxes_hr = { }; - my $slashboxes_textlist = $user->{slashboxes}; - my $userspace = $user->{mylinks} || ""; + } elsif ($form->{'section'} eq 'slashboxes') { + my $section_descref = { }; + my $box_order; + my $sections_description = $slashdb->getSectionBlocks(); + my $slashboxes_hr = { }; + my $slashboxes_textlist = $user->{slashboxes}; + my $userspace = $user->{mylinks} || ""; - if (!$slashboxes_textlist) { - my($boxes, $skinBoxes) = $slashdb->getPortalsCommon(); - $slashboxes_textlist = join ",", @{$skinBoxes->{$constants->{mainpage_skid}}}; - } + if (!$slashboxes_textlist) { + my($boxes, $skinBoxes) = $slashdb->getPortalsCommon(); + $slashboxes_textlist = join ",", @{$skinBoxes->{$constants->{mainpage_skid}}}; + } - for my $bid (map { /^'?([^']+)'?$/; $1 } split(/,/, $slashboxes_textlist)) { - $slashboxes_hr->{$bid} = 1; - } + for my $bid (map { /^'?([^']+)'?$/; $1 } split(/,/, $slashboxes_textlist)) { + $slashboxes_hr->{$bid} = 1; + } - for my $ary (sort { lc $a->[1] cmp lc $b->[1]} @$sections_description) { - my($bid, $title, $boldflag) = @$ary; - push @$box_order, $bid; - $section_descref->{$bid}{checked} = $slashboxes_hr->{$bid} ? $constants->{markup_checked_attribute} : ''; - $title =~ s/<(.*?)>//g; - $section_descref->{$bid}{title} = $title; - } + for my $ary (sort { lc $a->[1] cmp lc $b->[1]} @$sections_description) { + my($bid, $title, $boldflag) = @$ary; + push @$box_order, $bid; + $section_descref->{$bid}{checked} = $slashboxes_hr->{$bid} ? $constants->{markup_checked_attribute} : ''; + $title =~ s/<(.*?)>//g; + $section_descref->{$bid}{title} = $title; + } - return - slashDisplay('prefs_slashboxes', { - box_order => $box_order, - section_descref => $section_descref, - userspace => $userspace, - tabbed => $form->{'tabbed'}, - }, - { Return => 1 } - ); + return + slashDisplay('prefs_slashboxes', { + box_order => $box_order, + section_descref => $section_descref, + userspace => $userspace, + tabbed => $form->{'tabbed'}, + }, + { Return => 1 } + ); - } elsif ($form->{'section'} eq 'authors') { + } elsif ($form->{'section'} eq 'authors') { - my $author_hr = $slashdb->getDescriptions('authors'); - my @aid_order = sort { lc $author_hr->{$a} cmp lc $author_hr->{$b} } keys %$author_hr; - my %story_never_author; - map { $story_never_author{$_} = 1 } keys %$author_hr; - map { $story_never_author{$_} = 0 } split(/,/, $user->{story_never_author}); + my $author_hr = $slashdb->getDescriptions('authors'); + my @aid_order = sort { lc $author_hr->{$a} cmp lc $author_hr->{$b} } keys %$author_hr; + my %story_never_author; + map { $story_never_author{$_} = 1 } keys %$author_hr; + map { $story_never_author{$_} = 0 } split(/,/, $user->{story_never_author}); - return - slashDisplay('prefs_authors', { - aid_order => \@aid_order, - author_hr => $author_hr, - story_never_author => \%story_never_author, - tabbed => $form->{'tabbed'}, - }, - { Return => 1 } - ); + return + slashDisplay('prefs_authors', { + aid_order => \@aid_order, + author_hr => $author_hr, + story_never_author => \%story_never_author, + tabbed => $form->{'tabbed'}, + }, + { Return => 1 } + ); - } elsif ($form->{'section'} eq 'admin') { - return if !$user->{is_admin}; + } elsif ($form->{'section'} eq 'admin') { + return if !$user->{is_admin}; - return - slashDisplay('prefs_admin', { - user => $user, - tabbed => $form->{'tabbed'}, - }, - { Return => 1 } - ); + return + slashDisplay('prefs_admin', { + user => $user, + tabbed => $form->{'tabbed'}, + }, + { Return => 1 } + ); - } elsif ($form->{'section'} eq 'fh') { + } elsif ($form->{'section'} eq 'fh') { - my $firehose = getObject("Slash::FireHose"); - my $opts = $firehose->getAndSetOptions(); - $opts->{firehose_usermode} = $user->{firehose_usermode} if $user->{is_admin}; + my $firehose = getObject("Slash::FireHose"); + my $opts = $firehose->getAndSetOptions(); + $opts->{firehose_usermode} = $user->{firehose_usermode} if $user->{is_admin}; - return - slashDisplay('fhadvprefpane', { - options => $opts, - user => $user, - }, - { Return => 1 } - ); - - } else { - - return + return + slashDisplay('fhadvprefpane', { + options => $opts, + user => $user, + }, + { Return => 1 } + ); + + } elsif ($form->{'section'} eq 'ifh') { + + my $firehose = getObject("Slash::FireHose"); + my $opts = $firehose->getAndSetOptions(); + $opts->{firehose_usermode} = $user->{firehose_usermode} if $user->{is_admin}; + + return + slashDisplay('fhadvprefpane', { + options => $opts, + user => $user, + }, + { Page => 'misc', Skin => 'idle', Return => 1 } + ); + + } else { + + return slashDisplay('prefs_' . $form->{'section'}, { user => $user, tabbed => $form->{'tabbed'}, @@ -701,229 +781,230 @@ }; } - # Generic user - if ($params{'formname'} eq 'user') { - my $user_edit = $slashdb->getUser($params{uid}); - my $gSkin = getCurrentSkin(); + # Generic user + if ($params{'formname'} eq 'user') { + my $user_edit = $slashdb->getUser($params{uid}); + my $gSkin = getCurrentSkin(); - # Real Email - if ($user_edit->{realemail} ne $params{realemail}) { - if ($slashdb->existsEmail($params{realemail})) { - $params{realemail} = $user_edit->{realemail}; - } - } + # Real Email + if ($user_edit->{realemail} ne $params{realemail}) { + if ($slashdb->existsEmail($params{realemail})) { + $params{realemail} = $user_edit->{realemail}; + } + } - # Homepage - my $homepage = $params{homepage}; - $homepage = '' if $homepage eq 'http://'; - $homepage = fudgeurl($homepage); - $homepage = URI->new_abs($homepage, $gSkin->{absolutedir}) - ->canonical - ->as_string if $homepage ne ''; - $homepage = substr($homepage, 0, 100) if $homepage ne ''; + # Homepage + my $homepage = $params{homepage}; + $homepage = '' if $homepage eq 'http://'; + $homepage = fudgeurl($homepage); + $homepage = URI->new_abs($homepage, $gSkin->{absolutedir}) + ->canonical + ->as_string if $homepage ne ''; + $homepage = substr($homepage, 0, 100) if $homepage ne ''; - # Calendar - my $calendar_url = $params{calendar_url}; - if (length $calendar_url) { - $calendar_url =~ s/^webcal/http/i; - $calendar_url = fudgeurl($calendar_url); - $calendar_url = URI->new_abs($calendar_url, $gSkin->{absolutedir}) - ->canonical - ->as_string if $calendar_url ne ''; - $calendar_url =~ s|^http://||i; - $calendar_url = substr($calendar_url, 0, 200) if $calendar_url ne ''; - } + # Calendar + my $calendar_url = $params{calendar_url}; + if (length $calendar_url) { + $calendar_url =~ s/^webcal/http/i; + $calendar_url = fudgeurl($calendar_url); + $calendar_url = URI->new_abs($calendar_url, $gSkin->{absolutedir}) + ->canonical + ->as_string if $calendar_url ne ''; + $calendar_url =~ s|^http://||i; + $calendar_url = substr($calendar_url, 0, 200) if $calendar_url ne ''; + } - my(%extr, $err_message, %limit); - $limit{sig} = 120; - $limit{bio} = $constants->{users_bio_length} || 1024; + my(%extr, $err_message, %limit); + $limit{sig} = 120; + $limit{bio} = $constants->{users_bio_length} || 1024; - for my $key (keys %limit) { - my $dat = chopEntity($params{$key}, $limit{$key}); - $dat = strip_html($dat); - $dat = balanceTags($dat, { deep_nesting => 2, length => $limit{$key} }); - $dat = addDomainTags($dat) if $dat; + for my $key (keys %limit) { + my $dat = chopEntity($params{$key}, $limit{$key}); + $dat = strip_html($dat); + $dat = balanceTags($dat, { deep_nesting => 2, length => $limit{$key} }); + $dat = addDomainTags($dat) if $dat; - if ($key eq 'sig' && defined($dat) && length($dat) > 200) { - $extr{sig} = undef; - } + if ($key eq 'sig' && defined($dat) && length($dat) > 200) { + $extr{sig} = undef; + } - if ((length($dat) > 1 && !filterOk('comments', 'postersubj', $dat, \$err_message)) || - (!compressOk('comments', 'postersubj', $dat))) { - $extr{$key} = undef; - } - else { - $extr{$key} = $dat; - } - } + if ((length($dat) > 1 && !filterOk('comments', 'postersubj', $dat, \$err_message)) || + (!compressOk('comments', 'postersubj', $dat))) { + $extr{$key} = undef; + } + else { + $extr{$key} = $dat; + } + } - $user_edits_table = { - homepage => $homepage, - realname => $params{realname}, - calendar_url => $calendar_url, - yahoo => $params{yahoo}, - jabber => $params{jabber}, - aim => $params{aim}, - aimdisplay => $params{aimdisplay}, - icq => $params{icq}, - mobile_text_address => $params{mobile_text_address}, - }; + $user_edits_table = { + homepage => $homepage, + realname => $params{realname}, + calendar_url => $calendar_url, + yahoo => $params{yahoo}, + jabber => $params{jabber}, + aim => $params{aim}, + aimdisplay => $params{aimdisplay}, + icq => $params{icq}, + mobile_text_address => $params{mobile_text_address}, + }; - for (keys %extr) { - $user_edits_table->{$_} = $extr{$_} if defined $extr{$_}; - } + for (keys %extr) { + $user_edits_table->{$_} = $extr{$_} if defined $extr{$_}; + } - for (keys %$user_edits_table) { - $user_edits_table->{$_} = '' unless defined $user_edits_table->{$_}; - } + for (keys %$user_edits_table) { + $user_edits_table->{$_} = '' unless defined $user_edits_table->{$_}; + } - if ($user_edit->{realemail} ne $params{realemail}) { - $user_edits_table->{realemail} = chopEntity($params{realemail}, 50); - my $new_fakeemail = ''; + if ($user_edit->{realemail} ne $params{realemail}) { + $user_edits_table->{realemail} = chopEntity($params{realemail}, 50); + my $new_fakeemail = ''; - if ($user->{emaildisplay}) { - $new_fakeemail = getArmoredEmail($params{uid}, $user_edits_table->{realemail}) if $user->{emaildisplay} == 1; - $new_fakeemail = $user_edits_table->{realemail} if $user->{emaildisplay} == 2; - } - $user_edits_table->{fakeemail} = $new_fakeemail; - } + if ($user->{emaildisplay}) { + $new_fakeemail = getArmoredEmail($params{uid}, $user_edits_table->{realemail}) if $user->{emaildisplay} == 1; + $new_fakeemail = $user_edits_table->{realemail} if $user->{emaildisplay} == 2; + } + $user_edits_table->{fakeemail} = $new_fakeemail; + } - my $reader = getObject('Slash::DB', { db_type => 'reader' }); - my $otherparams = $reader->getDescriptions('otherusersparam'); - for my $param (keys %$otherparams) { - if (exists $params{$param}) { - $user_edits_table->{$param} = $user->{$param} = $params{$param} || undef; - } - } - } + my $reader = getObject('Slash::DB', { db_type => 'reader' }); + my $otherparams = $reader->getDescriptions('otherusersparam'); + for my $param (keys %$otherparams) { + if (exists $params{$param}) { + $user_edits_table->{$param} = $user->{$param} = $params{$param} || undef; + } + } + } - # Sections - if ($params{'formname'} eq "sectional") { - setSectionNexusPrefs($slashdb, $constants, $user, \%params); - } + # Sections + if ($params{'formname'} eq "sectional") { + setSectionNexusPrefs($slashdb, $constants, $user, \%params); + } - # Homepage - if ($params{'formname'} eq "home") { - $user_edits_table = { - maxstories => 30, - lowbandwidth => ($params{lowbandwidth} ? 1 : 0), - simpledesign => ($params{simpledesign} ? 1 : 0), - noicons => ($params{noicons} ? 1 : 0), - willing => ($params{willing} ? 1 : 0), - tags_turnedoff => ($params{showtags} ? undef : 1), - opt_osdn_navbar => ($params{opt_osdn_navbar} ? 1 : 0), - }; + # Homepage + if ($params{'formname'} eq "home") { + $user_edits_table = { + maxstories => 30, + lowbandwidth => ($params{lowbandwidth} ? 1 : 0), + simpledesign => ($params{simpledesign} ? 1 : 0), + noicons => ($params{noicons} ? 1 : 0), + willing => ($params{willing} ? 1 : 0), + tags_turnedoff => ($params{showtags} ? undef : 1), + opt_osdn_navbar => ($params{opt_osdn_navbar} ? 1 : 0), + }; - if (defined $params{tzcode} && defined $params{tzformat}) { - $user_edits_table->{tzcode} = $params{tzcode}; - $user_edits_table->{dfid} = $params{tzformat}; - $user_edits_table->{dst} = $params{dst}; - } + if (defined $params{tzcode} && defined $params{tzformat}) { + $user_edits_table->{tzcode} = $params{tzcode}; + $user_edits_table->{dfid} = $params{tzformat}; + $user_edits_table->{dst} = $params{dst}; + } - if (!isAnon($params{uid}) && !$params{willing}) { - $slashdb->setUser($params{uid}, { points => 0 }); - } - } + if (!isAnon($params{uid}) && !$params{willing}) { + $slashdb->setUser($params{uid}, { points => 0 }); + } + } - if ($params{'formname'} eq "slashboxes") { - my $slashboxes = $user->{slashboxes}; - my($boxes, $skinBoxes) = $slashdb->getPortalsCommon(); - my $default_slashboxes_textlist = join ",", - @{$skinBoxes->{$constants->{mainpage_skid}}}; + if ($params{'formname'} eq "slashboxes") { + my $slashboxes = $user->{slashboxes}; + my($boxes, $skinBoxes) = $slashdb->getPortalsCommon(); + my $default_slashboxes_textlist = join ",", + @{$skinBoxes->{$constants->{mainpage_skid}}}; - $slashboxes = $default_slashboxes_textlist if !$slashboxes; - my @slashboxes = split /,/, $slashboxes; - my %slashboxes = ( ); + $slashboxes = $default_slashboxes_textlist if !$slashboxes; + my @slashboxes = split /,/, $slashboxes; + my %slashboxes = ( ); - for my $i (0..$#slashboxes) { - $slashboxes{$slashboxes[$i]} = $i; - } + for my $i (0..$#slashboxes) { + $slashboxes{$slashboxes[$i]} = $i; + } - for my $key (sort grep /^showbox_/, keys %params) { - my($bid) = $key =~ /^showbox_(\w+)$/; - next if length($bid) < 1 || length($bid) > 30 || $bid !~ /^\w+$/; - if (! exists $slashboxes{$bid}) { - $slashboxes{$bid} = 999; - } - } + for my $key (sort grep /^showbox_/, keys %params) { + my($bid) = $key =~ /^showbox_(\w+)$/; + next if length($bid) < 1 || length($bid) > 30 || $bid !~ /^\w+$/; + if (! exists $slashboxes{$bid}) { + $slashboxes{$bid} = 999; + } + } - for my $bid (@slashboxes) { - delete $slashboxes{$bid} unless $params{"showbox_$bid"}; - } + for my $bid (@slashboxes) { + delete $slashboxes{$bid} unless $params{"showbox_$bid"}; + } - @slashboxes = sort { $slashboxes{$a} <=> $slashboxes{$b} || $a cmp $b } keys %slashboxes; - $#slashboxes = 19 if $#slashboxes > 19; - $slashboxes = join ",", @slashboxes; - $slashboxes = "" if ($slashboxes eq $default_slashboxes_textlist); + @slashboxes = sort { $slashboxes{$a} <=> $slashboxes{$b} || $a cmp $b } keys %slashboxes; + $#slashboxes = 19 if $#slashboxes > 19; + $slashboxes = join ",", @slashboxes; + $slashboxes = "" if ($slashboxes eq $default_slashboxes_textlist); - $slashboxes =~ s/[^\w,-]//g; - my @items = grep { $_ } split /,/, $slashboxes; - $slashboxes = join ",", @items; + $slashboxes =~ s/[^\w,-]//g; + my @items = grep { $_ } split /,/, $slashboxes; + $slashboxes = join ",", @items; - if (length($slashboxes) > 1024) { - $slashboxes = substr($slashboxes, 0, 1024); - $slashboxes =~ s/,?\w*$//g; - } elsif (length($slashboxes) < 1) { - $slashboxes = ''; - } + if (length($slashboxes) > 1024) { + $slashboxes = substr($slashboxes, 0, 1024); + $slashboxes =~ s/,?\w*$//g; + } elsif (length($slashboxes) < 1) { + $slashboxes = ''; + } - $user_edits_table->{slashboxes} = $slashboxes; + $user_edits_table->{slashboxes} = $slashboxes; - $user_edits_table->{mylinks} = balanceTags(strip_html( - chopEntity($params{mylinks} || '', 255) - ), { deep_nesting => 2, length => 255 }); + $user_edits_table->{mylinks} = balanceTags(strip_html( + chopEntity($params{mylinks} || '', 255) + ), { deep_nesting => 2, length => 255 }); - $user_edits_table->{mylinks} = '' unless defined $user_edits_table->{mylinks}; + $user_edits_table->{mylinks} = '' unless defined $user_edits_table->{mylinks}; - } + } - if ($params{'formname'} eq "authors") { - my $author_hr = $slashdb->getDescriptions('authors'); - my ($story_author_all, @story_never_author); + if ($params{'formname'} eq "authors") { + my $author_hr = $slashdb->getDescriptions('authors'); + my ($story_author_all, @story_never_author); - for my $aid (sort { $a <=> $b } keys %$author_hr) { - my $key = "aid$aid"; - $story_author_all++; - push(@story_never_author, $aid) if (!$params{$key}); - } + for my $aid (sort { $a <=> $b } keys %$author_hr) { + my $key = "aid$aid"; + $story_author_all++; + push(@story_never_author, $aid) if (!$params{$key}); + } - $#story_never_author = 299 if $#story_never_author > 299; + $#story_never_author = 299 if $#story_never_author > 299; - my $story_never_author = join(",", @story_never_author); - $story_never_author =~ s/[^\w,-]//g; - my @items = grep { $_ } split /,/, $story_never_author; - $story_never_author = join ",", @items; + my $story_never_author = join(",", @story_never_author); + $story_never_author =~ s/[^\w,-]//g; + my @items = grep { $_ } split /,/, $story_never_author; + $story_never_author = join ",", @items; - my $len ||= $constants->{checklist_length} || 255; - if (length($story_never_author) > $len) { - $story_never_author = substr($story_never_author, 0, $len); - $story_never_author =~ s/,?\w*$//g; - } elsif (length($story_never_author) < 1) { - $story_never_author = ''; - } + my $len ||= $constants->{checklist_length} || 255; + if (length($story_never_author) > $len) { + $story_never_author = substr($story_never_author, 0, $len); + $story_never_author =~ s/,?\w*$//g; + } elsif (length($story_never_author) < 1) { + $story_never_author = ''; + } - $user_edits_table = { - story_never_author => $story_never_author, - }; + $user_edits_table = { + story_never_author => $story_never_author, + }; - } + } - if ($params{'formname'} eq "admin") { - return if !$user->{is_admin}; + if ($params{'formname'} eq "admin") { + return if !$user->{is_admin}; - $user_edits_table = { - playing => $params{playing}, - no_spell => ($params{'no_spell'} ? 1 : undef), - mod_with_comm => ($params{'mod_with_comm'} ? 1 : undef), - m2_with_mod => ($params{'m2_with_mod'} ? 1 : undef), - m2_with_comm_mod => ($params{'m2_with_mod_on_comm'} ? 1 : undef), - }; - } + $user_edits_table = { + test_code => ($params{'test_code'} ? 1 : undef), + playing => $params{playing}, + no_spell => ($params{'no_spell'} ? 1 : undef), + mod_with_comm => ($params{'mod_with_comm'} ? 1 : undef), + m2_with_mod => ($params{'m2_with_mod'} ? 1 : undef), + m2_with_comm_mod => ($params{'m2_with_mod_on_comm'} ? 1 : undef), + }; + } # Everything but Sections is saved here. - if ($params{'formname'} ne "sectional") { - $slashdb->setUser($params{uid}, $user_edits_table); - } + if ($params{'formname'} ne "sectional") { + $slashdb->setUser($params{uid}, $user_edits_table); + } } # comments @@ -961,6 +1042,21 @@ ); my %mainops = ( + comments_submit_reply => { + function => \&previewReply, + reskey_name => 'comments', + reskey_type => 'use', + }, + comments_preview_reply => { + function => \&previewReply, + reskey_name => 'comments', + reskey_type => 'touch', + }, + comments_reply_form => { + function => \&replyForm, + reskey_name => 'ajax_base', + reskey_type => 'createuse', + }, comments_read_rest => { function => \&readRest, reskey_name => 'ajax_base', Modified: slashjp/branches/upstream/current/plugins/Ajax/htdocs/images/common.js =================================================================== --- slashjp/branches/upstream/current/plugins/Ajax/htdocs/images/common.js 2008-03-03 11:14:27 UTC (rev 526) +++ slashjp/branches/upstream/current/plugins/Ajax/htdocs/images/common.js 2008-03-04 09:02:07 UTC (rev 527) @@ -1,5 +1,5 @@ // _*_ Mode: JavaScript; tab-width: 8; indent-tabs-mode: true _*_ -// $Id: common.js,v 1.172 2008/02/22 03:38:41 tvroom Exp $ +// $Id: common.js,v 1.174 2008/02/28 19:26:58 pudge Exp $ // global settings, but a firehose might use a local settings object instead var firehose_settings = {}; @@ -1211,6 +1211,10 @@ } } +function firehose_slider_set_color(color) { + fh_colorslider.setValue(fh_ticksize * fh_colors_hash[color] , 1); +} + function firehose_change_section_anon(section) { window.location.href= window.location.protocol + "//" + window.location.host + "/firehose.pl?section=" + encodeURIComponent(section) + "&tabtype=tabsection"; } @@ -1227,7 +1231,7 @@ function vendorStoryPopup() { id = vendor_popup_id; - var title = "Intel's Opinion Center"; + var title = "Intel's Opinion Center"; var buttons = createPopupButtons("[X]"); title = title + buttons; var closepopup = function (e) { @@ -1252,7 +1256,7 @@ function vendorStoryPopup2() { id = vendor_popup_id; - var title = "Intel's Opinion Center"; + var title = "Intel's Opinion Center"; var buttons = createPopupButtons("[X]"); title = title + buttons; var closepopup = function (e) { Added: slashjp/branches/upstream/current/plugins/Ajax/templates/edit_comment;ajax;default =================================================================== --- slashjp/branches/upstream/current/plugins/Ajax/templates/edit_comment;ajax;default 2008-03-03 11:14:27 UTC (rev 526) +++ slashjp/branches/upstream/current/plugins/Ajax/templates/edit_comment;ajax;default 2008-03-04 09:02:07 UTC (rev 527) @@ -0,0 +1,70 @@ +__section__ +default +__description__ +Template which renders the comment editor. + +* error_message = error message if there is an error +* preview = preview of comment, if applicable +* reply = hashref of comment replying to +* hide_name = hide name / log out link +* hide_email = hide email display +* extras = array of any extras associated with this comment + +__title__ + +__page__ +ajax +__lang__ +en_US +__name__ +edit_comment +__template__ +
+[% IF pid %] + [% PROCESS titlebar title="Reply to: $reply.subject" %] +[% ELSE %] + [% PROCESS titlebar title="Reply to: XXXXX" %] +[% END %] + +[% IF user.is_anon %]

+ [% IF constants.allow_anonymous %] +You are not logged in. You can log +in now, or Create an Account/ + [% ELSE %] +You are not logged in. You can log +in now, Create an Account, +or post as [% user.nickname | strip_literal %]. + [% END %] +

[% END %] + +[% IF !user.is_anon || constants.allow_anonymous %] +
+
+
+ +[% IF pid %][% END %] +[% IF gotmodwarning %][% END # XXXXX %] +[% reskey_label = "reskey_reply_$pid"; PROCESS reskey_tag %] +

+[Customize Posting Preferences]

+

+ +[% IF constants.allow_anonymous && user.karma > -1 && !user.is_anon && (discussion.commentstatus == 'enabled' || discussion.commentstatus == 'logged_in') %] +

Post Anonymously

+[% END %] + +
+
+
+ + + +
+
+[% END # IF !user.is_anon || constants.allow_anonymous %] +
+ +__seclev__ +1000 +__version__ +$Id: edit_comment;ajax;default,v 1.1 2008/02/28 21:39:31 pudge Exp $ Modified: slashjp/branches/upstream/current/plugins/Ajax/templates/prefs_admin;ajax;default =================================================================== --- slashjp/branches/upstream/current/plugins/Ajax/templates/prefs_admin;ajax;default 2008-03-03 11:14:27 UTC (rev 526) +++ slashjp/branches/upstream/current/plugins/Ajax/templates/prefs_admin;ajax;default 2008-03-04 09:02:07 UTC (rev 527) @@ -30,6 +30,8 @@ +  Enable Test Code + [% IF constants.slashbox_whatsplaying %]

User Info

What I'm Playing For  @@ -82,4 +84,4 @@ __seclev__ 500 __version__ -$Id: prefs_admin;ajax;default,v 1.1 2008/02/12 22:15:36 entweichen Exp $ +$Id: prefs_admin;ajax;default,v 1.2 2008/02/28 19:26:58 pudge Exp $ Modified: slashjp/branches/upstream/current/plugins/Ajax/templates/prefs_d2;ajax;default =================================================================== --- slashjp/branches/upstream/current/plugins/Ajax/templates/prefs_d2;ajax;default 2008-03-03 11:14:27 UTC (rev 526) +++ slashjp/branches/upstream/current/plugins/Ajax/templates/prefs_d2;ajax;default 2008-03-04 09:02:07 UTC (rev 527) @@ -33,7 +33,7 @@ IF user.discussion2 == 'slashdot'; d2_check = constants.markup_checked_attribute; END %] -  Enable Dynamic Discussions [?] +  Enable Dynamic Discussions ?