Closed (fixed)
Project:
Chess
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Reporter:
Created:
26 Jan 2011 at 20:17 UTC
Updated:
26 Feb 2011 at 13:33 UTC
Jump to comment: Most recent file
Hello I have been trying out this module and I have been having some problems with the settings.
I have tried to set the "allow undo" to false but it still shows up. I took a look at the code I can see that you're testing the number of moves made and if they are the right viewer but I don't see a test for whether "allow undo" was set in the admin settings.
I have made a few moves and the email are sent but for some reason the moves show your index value for the pieces instead of the piece letter (is 1 for Knight and 5 for Pawn) but in game page the moves are correctly showing the chess notation.
Can you tell me how to fix the emails?
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | chess_fix_undo.patch | 773 bytes | Tim_O |
Comments
Comment #1
Tim_O commentedFirst of all: Thank you for reporting your findings. But in general, please make seperate issues if you have several things to ask/discuss. This will be the issue for this undo-bug now ...
1) Undo
So you want to disable undo-moves in the module-settings under /admin/settings/chess but it still allows to undo? Hm ... will need to look into this, this might well be a bug. I myself never had the desire to dissallow this, so I haven't tested that.
2) Moves in mails
About the mail ... If you send the mail with something like
<?php echo $move?>in rules, then the mail will contain the move as it is contained in the database. To change this we would need to change the storage format (kind of a biiiig change). But as you are using PHP here, you could still do this by parsing the resulting string and replacing the number through a string. In case you want to do that, here is the mapping from the code:If you have a go for this, then please share your results with us. We could incorporate such a solution within the documentation, then.
Comment #2
Tim_O commentedOk, I had a look into it and in fact there was no check for that setting at all :o So thank you again for letting us know.
I added an according check and did a short test that it's not showing the undo-form anymore if the setting is disabled. I just commited that change, so there should be a new version of the module ready for download by tomorrow.
Marking this as fixed & closed for now ...
Comment #3
jenb919 commentedI used your existing function chess_piece_index and the emails now have the letter for the piece instead of the index.
line 1130
// If the rules module is installed, invoke our move-event
if (module_exists('rules')) {
$move_string = generate_move_pgn_string(array(
'game_id' => $nid,
'move_number' => $move_number,
'piece' => $piece,
'move_from_column' => $column_from,
'move_from_row' => $user_coord_from_row,
'captured_piece' => $captured_piece,
'move_to_column' => $column_to,
'move_to_row' => $user_coord_to_row,
));
to
// If the rules module is installed, invoke our move-event
if (module_exists('rules')) {
$move_string = generate_move_pgn_string(array(
'game_id' => $nid,
'move_number' => $move_number,
'piece' => chess_piece_index($piece),
'move_from_column' => $column_from,
'move_from_row' => $user_coord_from_row,
'captured_piece' => $captured_piece,
'move_to_column' => $column_to,
'move_to_row' => $user_coord_to_row,
));
Comment #4
Tim_O commentedWonder why I didn't notice, that this other issue is so simple to fix. I need to get the new github-system running and will include that then, thank you jenb919!
Comment #5
Tim_O commentedThink I got that commited now, also. Thx again!