Index: README.txt =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/chessboard/README.txt,v retrieving revision 1.6 diff -u -p -r1.6 README.txt --- README.txt 6 Sep 2006 09:51:10 -0000 1.6 +++ README.txt 24 Apr 2010 16:02:53 -0000 @@ -1,8 +1,8 @@ -Chessboard Module -README.txt - $Id: README.txt,v 1.6 2006/09/06 09:51:10 vyvee Exp $ +Chessboard Module +================= + This module renders chessboard diagrams specified with the FEN syntax or a simple piece placement format. Index: chessboard.css =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/chessboard/chessboard.css,v retrieving revision 1.3 diff -u -p -r1.3 chessboard.css --- chessboard.css 6 Sep 2006 09:51:10 -0000 1.3 +++ chessboard.css 24 Apr 2010 16:02:53 -0000 @@ -3,17 +3,11 @@ * $Id: chessboard.css,v 1.3 2006/09/06 09:51:10 vyvee Exp $ */ -div.chessboard { - /* 'font-size: 0;' is required is fight against the descender - characters for page to be rendered in strict mode. - Omitting this causes an old bottom margin, actually reserved for - possible descender characters (such as g, j, q, or y), below each - image. - Is there a better solution? - */ - font-size: 0; - white-space: nowrap; +.chessboard .row { + height: 40px; } .chessboard img { + width: 40px; + height: 40px; } Index: chessboard.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/chessboard/chessboard.module,v retrieving revision 1.5 diff -u -p -r1.5 chessboard.module --- chessboard.module 6 Sep 2006 09:51:10 -0000 1.5 +++ chessboard.module 24 Apr 2010 16:02:53 -0000 @@ -6,14 +6,10 @@ $Id: chessboard.module,v 1.5 2006/09/06 /** * Implementation of hook_help(). */ -function chessboard_help($section='') { +function chessboard_help($path, $arg) { - switch ($section) { - case 'admin/modules#name': - $output = t('chessboard'); - break; - - case 'admin/modules#description': + switch ($path) { + case 'admin/help#chessboard': $output = t('Renders chessboard diagrams specified with the FEN syntax or a simple piece placement format.'); break; @@ -27,14 +23,10 @@ function chessboard_help($section='') { /** - * Implementation of hook_menu(). + * Implementation of hook_init(). */ -function chessboard_menu($may_cache) { - if (!$may_cache) { - theme('add_style', drupal_get_path('module', 'chessboard') .'/chessboard.css'); - } - - return array(); +function chessboard_init() { + drupal_add_css(drupal_get_path('module', 'chessboard') .'/chessboard.css'); } @@ -137,6 +129,32 @@ function chessboard_filter($op, $delta=0 } } +/** + * Implementation of hook_theme(). + */ +function chessboard_theme() { + return array( + 'chessboard' => array( + 'arguments' => array('variables' => array('notation' => '')), + ), + ); +} + +/** + * Formats Chessboard Renderer notation syntax in HTML. + * + * @param $variables + * An associative array containing: + * - notation: The Chessboard Renderer notation string that is being formatted. + * + * @ingroup themable + */ +function theme_chessboard($variables) { + require_once 'chessboard_render.php'; + chessboard_image_path(base_path() . drupal_get_path('module', 'chessboard') .'/default/'); + // ????? chessboard_image_path('/main/modules/chessboard/default/'); + return '
'. chessboard_render($variables['notation']) .'
'; +} /** * Returns the replacement text. Called as a callback from @@ -150,6 +168,5 @@ function chessboard_filter($op, $delta=0 * A string containing the replacement text. */ function _chessboard_filter_callback($matches) { - return '
'. chessboard_render($matches[1]) - .'
'; + return theme('chessboard', array('notation' => $matches[1])); } Index: chessboard_render.php =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/chessboard/chessboard_render.php,v retrieving revision 1.3 diff -u -p -r1.3 chessboard_render.php --- chessboard_render.php 6 Sep 2006 09:51:10 -0000 1.3 +++ chessboard_render.php 24 Apr 2010 16:02:53 -0000 @@ -190,6 +190,7 @@ function chessboard_render($content) // Top border if ($border['T']) { + $xhtml .= '
'; if ($border['L']) $xhtml .= $table_xhtml['TL']; $xhtml .= str_repeat($table_xhtml['T'], $file_max); @@ -203,6 +204,8 @@ function chessboard_render($content) $square_color_first = 1 - $square_color_first; } + $xhtml .= '
'; + // Left border, board, right border for ($i=0; isset($board[$i]); $i++) { @@ -212,7 +215,7 @@ function chessboard_render($content) } if ($file >= $file_max) { - $xhtml .= '
'; + $xhtml .= '
'; $file = 0; $square_color = $square_color_first; $square_color_first = 1 - $square_color_first; @@ -242,14 +245,17 @@ function chessboard_render($content) } } + $xhtml .= '
'; + // Bottom border if ($border['B']) { - $xhtml .= '
'; + $xhtml .= '
'; if ($border['L']) $xhtml .= $table_xhtml['BL']; $xhtml .= str_repeat($table_xhtml['B'], $file_max); if ($border['R']) $xhtml .= $table_xhtml['BR']; + $xhtml .= '
'; } return $xhtml;