svnno****@sourc*****
svnno****@sourc*****
2007年 11月 19日 (月) 18:29:47 JST
Revision: 264 http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=slashdotjp&view=rev&rev=264 Author: caesar Date: 2007-11-19 18:29:46 +0900 (Mon, 19 Nov 2007) Log Message: ----------- * tested template * deletion test is not completed yet Modified Paths: -------------- slashjp/branches/deluser/plugins/DelUser/deluser.pl slashjp/branches/deluser/plugins/DelUser/templates/deleteUser;deluser;default -------------- next part -------------- Modified: slashjp/branches/deluser/plugins/DelUser/deluser.pl =================================================================== --- slashjp/branches/deluser/plugins/DelUser/deluser.pl 2007-11-19 08:32:22 UTC (rev 263) +++ slashjp/branches/deluser/plugins/DelUser/deluser.pl 2007-11-19 09:29:46 UTC (rev 264) @@ -11,8 +11,10 @@ use utf8; use Slash; +use Slash::Constants qw(:web :messages); use Slash::Display; use Slash::Utility; +use Slash::XML; use Data::Dumper; sub main { @@ -23,12 +25,11 @@ my $constants = getCurrentStatic(); my $post_ok = $user->{state}{post}; my $user_ok = !$user->{is_anon}; - # lc just in case - my $op = lc($form->{op}); + my $delete_ok = $form->{delete_ok}; my %ops = ( deleteform => [$user_ok, \&deleteUserForm], - deleteok => [$post_ok && $user_ok , \&deleteUser], + deleteok => [$post_ok && $user_ok $$ $delete_ok, \&deleteUser], ); # set default op @@ -39,6 +40,7 @@ # if not logged in if (!$user_ok) { + my $rootdir = getCurrentStatic('rootdir'); redirect("$rootdir/"); } @@ -50,21 +52,21 @@ ################################################################## sub deleteUserForm { my($slashdb, $reader, $constants, $user, $form, $note) = @_; + header(); slashDisplay('deleteUser'); footer(); } sub deleteUser { my($slashdb, $reader, $constants, $user, $form) = @_; - my $note; my $uid = $user->{uid}; -# my $rows = $slashdb->deleteUser($uid); -# slashDisplay('deleteUserFinished'); -# footer(); - -# redirect("$rootdir/my/logout"); - deleteUserForm(@_, $note); + my $rows = $slashdb->deleteUser($uid); + if ($rows) { + my $rootdir = getCurrentStatic('rootdir'); + redirect("$rootdir/my/logout"); + } +# deleteUserForm(@_, $note); } createEnvironment(); Modified: slashjp/branches/deluser/plugins/DelUser/templates/deleteUser;deluser;default =================================================================== --- slashjp/branches/deluser/plugins/DelUser/templates/deleteUser;deluser;default 2007-11-19 08:32:22 UTC (rev 263) +++ slashjp/branches/deluser/plugins/DelUser/templates/deleteUser;deluser;default 2007-11-19 09:29:46 UTC (rev 264) @@ -34,24 +34,26 @@ } } function toggle_form(flag) { - toggle_recurse(document.getElementById("createuserform"), flag); + toggle_recurse(document.getElementById("deleteuserform"), flag); } // --> </script> - <form action="[% constants.real_rootdir %]/deluser.pl" method="post"> + <form id="deleteuserform" action="[% constants.real_rootdir %]/deluser.pl" method="post"> <fieldset> <legend></legend> - [% PROCESS formkey_tag %] <input type="hidden" name="uid" value="[% user.uid %]"> <p>アカウントを削除する場合は,以下のチェックボックスにチェックを入れ送信ボタンを押してください。</p> <div id="delete_ok_box"> - <input id="delete_ok" type="checkbox" name="delete_ok" value="delete_ok" onClick="toggle_form(this.checked)" onKeydown="toggle_form(this.checked)"> - <label for="delete_ok">本当に削除する</label> + <label> + <input id="delete_ok" type="checkbox" name="delete_ok" value="delete_ok" onClick="toggle_form(this.checked)" onKeydown="toggle_form(this.checked)">本当に削除する</label> </div> <input type="hidden" name="op" value="delete"> <input type="submit" value="送信" class="button"> </fieldset> </form> + <script language="JavaScript"> + toggle_form(document.getElementById("delete_ok").checked); + </script> </div> </div> __seclev__