Смекни!
smekni.com

Обеспечение всемирной трансляции спортивных шахматных соревнований с применением разработанного в ходе проекта законченного программного продукта (стр. 18 из 27)

moves += image_tag('go_prev.jpg', :id => 'go_prev', :onclick => 'goPrev();') :onmouseover => 'new Effect.Scale("go_prev", 110)', :onmouseout => 'new Effect.Scale("go_prev", 90)') + ' '

moves += image_tag('go_refresh.jpg', :id => 'go_refresh', :onclick => 'goRefresh();') :onmouseover => 'new Effect.Scale("go_refresh", 110)', :onmouseout => 'new Effect.Scale("go_refresh", 90)') + ' '

moves += image_tag('go_next.jpg', :id => 'go_next', :onclick => 'goNext();'):onmouseover => 'new Effect.Scale("go_next", 110)', :onmouseout => 'new Effect.Scale("go_next", 90)') + ' '

moves += image_tag('go_end.jpg', :id => 'go_end', :onclick => 'goEnd();')#:onmouseover => 'new Effect.Scale("go_end", 110)', :onmouseout => 'new Effect.Scale("go_end", 90)') + ' '

moves += "</td></tr>"

moves += "</table>";

moves

end

def render_board

return "<table class=&bsol;"board&bsol;" id=&bsol;"board&bsol;">

<tr>

<td class=&bsol;"board_label_digit&bsol;">8</td>

<td class=&bsol;"board_white_field&bsol;" id=&bsol;"fieldA8&bsol;"></td>

<td class=&bsol;"board_black_field&bsol;" id=&bsol;"fieldB8&bsol;"></td>

<td class=&bsol;"board_white_field&bsol;" id=&bsol;"fieldC8&bsol;"></td>

<td class=&bsol;"board_black_field&bsol;" id=&bsol;"fieldD8&bsol;"></td>

<td class=&bsol;"board_white_field&bsol;" id=&bsol;"fieldE8&bsol;"></td>

<td class=&bsol;"board_black_field&bsol;" id=&bsol;"fieldF8&bsol;"></td>

<td class=&bsol;"board_white_field&bsol;" id=&bsol;"fieldG8&bsol;"></td>

<td class=&bsol;"board_black_field&bsol;" id=&bsol;"fieldH8&bsol;"></td>

</tr>

<tr>

<td class=&bsol;"board_label_digit&bsol;">7</td>

<td class=&bsol;"board_black_field&bsol;" id=&bsol;"fieldA7&bsol;"></td>

<td class=&bsol;"board_white_field&bsol;" id=&bsol;"fieldB7&bsol;"></td>

<td class=&bsol;"board_black_field&bsol;" id=&bsol;"fieldC7&bsol;"></td>

<td class=&bsol;"board_white_field&bsol;" id=&bsol;"fieldD7&bsol;"></td>

<td class=&bsol;"board_black_field&bsol;" id=&bsol;"fieldE7&bsol;"></td>

<td class=&bsol;"board_white_field&bsol;" id=&bsol;"fieldF7&bsol;"></td>

<td class=&bsol;"board_black_field&bsol;" id=&bsol;"fieldG7&bsol;"></td>

<td class=&bsol;"board_white_field&bsol;" id=&bsol;"fieldH7&bsol;"></td>

</tr>

<tr>

<td class=&bsol;"board_label_digit&bsol;">6</td>

<td class=&bsol;"board_white_field&bsol;" id=&bsol;"fieldA6&bsol;"></td>

<td class=&bsol;"board_black_field&bsol;" id=&bsol;"fieldB6&bsol;"></td>

<td class=&bsol;"board_white_field&bsol;" id=&bsol;"fieldC6&bsol;"></td>

<td class=&bsol;"board_black_field&bsol;" id=&bsol;"fieldD6&bsol;"></td>

<td class=&bsol;"board_white_field&bsol;" id=&bsol;"fieldE6&bsol;"></td>

<td class=&bsol;"board_black_field&bsol;" id=&bsol;"fieldF6&bsol;"></td>

<td class=&bsol;"board_white_field&bsol;" id=&bsol;"fieldG6&bsol;"></td>

<td class=&bsol;"board_black_field&bsol;" id=&bsol;"fieldH6&bsol;"></td>

</tr>

<tr>

<td class=&bsol;"board_label_digit&bsol;">5</td>

<td nowrap class=&bsol;"board_black_field&bsol;" id=&bsol;"fieldA5&bsol;"></td>

<td nowrap class=&bsol;"board_white_field&bsol;" id=&bsol;"fieldB5&bsol;"></td>

<td nowrap class=&bsol;"board_black_field&bsol;" id=&bsol;"fieldC5&bsol;"></td>

<td nowrap class=&bsol;"board_white_field&bsol;" id=&bsol;"fieldD5&bsol;"></td>

<td nowrap class=&bsol;"board_black_field&bsol;" id=&bsol;"fieldE5&bsol;"></td>

<td nowrap class=&bsol;"board_white_field&bsol;" id=&bsol;"fieldF5&bsol;"></td>

<td nowrap class=&bsol;"board_black_field&bsol;" id=&bsol;"fieldG5&bsol;"></td>

<td nowrap class=&bsol;"board_white_field&bsol;" id=&bsol;"fieldH5&bsol;"></td>

</tr>

<tr>

<td class=&bsol;"board_label_digit&bsol;">4</td>

<td class=&bsol;"board_white_field&bsol;" id=&bsol;"fieldA4&bsol;"></td>

<td class=&bsol;"board_black_field&bsol;" id=&bsol;"fieldB4&bsol;"></td>

<td class=&bsol;"board_white_field&bsol;" id=&bsol;"fieldC4&bsol;"></td>

<td class=&bsol;"board_black_field&bsol;" id=&bsol;"fieldD4&bsol;"></td>

<td class=&bsol;"board_white_field&bsol;" id=&bsol;"fieldE4&bsol;"></td>

<td class=&bsol;"board_black_field&bsol;" id=&bsol;"fieldF4&bsol;"></td>

<td class=&bsol;"board_white_field&bsol;" id=&bsol;"fieldG4&bsol;"></td>

<td class=&bsol;"board_black_field&bsol;" id=&bsol;"fieldH4&bsol;"></td>

</tr>

<tr>

<td class=&bsol;"board_label_digit&bsol;">3</td>

<td class=&bsol;"board_black_field&bsol;" id=&bsol;"fieldA3&bsol;"></td>

<td class=&bsol;"board_white_field&bsol;" id=&bsol;"fieldB3&bsol;"></td>

<td class=&bsol;"board_black_field&bsol;" id=&bsol;"fieldC3&bsol;"></td>

<td class=&bsol;"board_white_field&bsol;" id=&bsol;"fieldD3&bsol;"></td>

<td class=&bsol;"board_black_field&bsol;" id=&bsol;"fieldE3&bsol;"></td>

<td class=&bsol;"board_white_field&bsol;" id=&bsol;"fieldF3&bsol;"></td>

<td class=&bsol;"board_black_field&bsol;" id=&bsol;"fieldG3&bsol;"></td>

<td class=&bsol;"board_white_field&bsol;" id=&bsol;"fieldH3&bsol;"></td>

</tr>

<tr>

<td class=&bsol;"board_label_digit&bsol;">2</td>

<td class=&bsol;"board_white_field&bsol;" id=&bsol;"fieldA2&bsol;"></td>

<td class=&bsol;"board_black_field&bsol;" id=&bsol;"fieldB2&bsol;"></td>

<td class=&bsol;"board_white_field&bsol;" id=&bsol;"fieldC2&bsol;"></td>

<td class=&bsol;"board_black_field&bsol;" id=&bsol;"fieldD2&bsol;"></td>

<td class=&bsol;"board_white_field&bsol;" id=&bsol;"fieldE2&bsol;"></td>

<td class=&bsol;"board_black_field&bsol;" id=&bsol;"fieldF2&bsol;"></td>

<td class=&bsol;"board_white_field&bsol;" id=&bsol;"fieldG2&bsol;"></td>

<td class=&bsol;"board_black_field&bsol;" id=&bsol;"fieldH2&bsol;"></td>

</tr>

<tr>

<td class=&bsol;"board_label_digit&bsol;">1</td>

<td class=&bsol;"board_black_field&bsol;" id=&bsol;"fieldA1&bsol;"></td>

<td class=&bsol;"board_white_field&bsol;" id=&bsol;"fieldB1&bsol;"></td>

<td class=&bsol;"board_black_field&bsol;" id=&bsol;"fieldC1&bsol;"></td>

<td class=&bsol;"board_white_field&bsol;" id=&bsol;"fieldD1&bsol;"></td>

<td class=&bsol;"board_black_field&bsol;" id=&bsol;"fieldE1&bsol;"></td>

<td class=&bsol;"board_white_field&bsol;" id=&bsol;"fieldF1&bsol;"></td>

<td class=&bsol;"board_black_field&bsol;" id=&bsol;"fieldG1&bsol;"></td>

<td class=&bsol;"board_white_field&bsol;" id=&bsol;"fieldH1&bsol;"></td>

</tr>

<tr>

<td class=&bsol;"board_lebel_letter&bsol;">&nbsp;</td>

<td class=&bsol;"board_lebel_letter&bsol;">A</td>

<td class=&bsol;"board_lebel_letter&bsol;">B</td>

<td class=&bsol;"board_lebel_letter&bsol;">C</td>

<td class=&bsol;"board_lebel_letter&bsol;">D</td>

<td class=&bsol;"board_lebel_letter&bsol;">E</td>

<td class=&bsol;"board_lebel_letter&bsol;">F</td>

<td class=&bsol;"board_lebel_letter&bsol;">G</td>

<td class=&bsol;"board_lebel_letter&bsol;">H</td>

</tr>

</table>"

end

def render_result

"1/2 - 1/2"

end

def render_black_time

"-:--:--"

end

def render_white_time

"-:--:--"

end

end

Представление (view)

layout/main.rhtml

---

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>

<meta http-equiv="content-type" content="text/html;charset=UTF-8" />

<title>Стартовая страница: <%= controller.action_name %></title>

<%= stylesheet_link_tag 'scaffold' %>

<%= stylesheet_link_tag 'main' %>

<%= stylesheet_link_tag 'game' %>

<%= javascript_include_tag :defaults %>

<%= javascript_include_tag 'game' %>

</head>

<body style='background-color: #000000'>

<table bgcolor="#f4f4f4" border="0" width="80%" align="center" cellpadding="0" cellspacing="0" >

<tr>

<td width='3%'></td>

<td>

<h1><%= link_to(image_tag('dgt.gif', :size => '42x25', :border => 0, :alt => 'http://dgtprojects.com'), 'http://dgtprojects.com') %>&nbsp;&nbsp;&nbsp;

Сервер трансляции шахматных партий <%= link_to 'rDGT', 'http://rdgt.org' %>&nbsp;&nbsp;&nbsp;

<%= link_to(image_tag('home.gif', :size => '12x12', :border => 0), '/main/index') %>

<%= link_to(image_tag('email.gif', :size => '12x12', :border => 0), '') %>

<%= link_to(image_tag('search.gif', :size => '12x12', :border => 0), '')%>

</h1><hr />

</td>

<td width='3%'></td>

</tr>

<tr>

<td></td>

<td>

<p style="color: green"><%= flash[:notice] %></p>

<%= yield %>

</td>

<td></td>

</tr>

<tr>

<td></td>

<td align="right"><br /><hr />

<%= mail_to 'zarstudio@gmail.com', '[ Разработчики ]' %><br />&nbsp;

</td>

<td></td>

</tr>

</table>

</body>

</html>

main/enter.rhtml

---

<% form_tag '/main/login' do %>

<table align='center' width='100%'>

<tr>

<td width='41%' align="right"><strong>Имя:&nbsp;<strong></td>

<td align="left"><%= text_field_tag :login, params[:login] %></td>

</tr>

<tr>

<td align="right"><strong>Пароль:&nbsp;</strong></td>

<td align="left"><%= password_field_tag :password, params[:password] %></td>

</tr>

<tr>

<td align="center" colspan="2"><%= submit_tag 'Войти' %></td>

</tr>

<tr>

<td align="center" colspan="2"><%= link_to '[ Регистрация ]', { :action => 'register' }%></td>

</tr>

<tr>

<td align="center" colspan="2"><%= link_to '[ Забыли логин или пароль? ]', { :action => 'remind' }%></td>

</tr>

</table>

<% end %>

<br />

main/game.rhtml

---

<%= render_game_info %>

<br />

<br />

<table width='100%' cellspacing="0" cellpadding="0" border="0" id='table_board'>

<tr align="center">

<td width='1%'></td>

<td width='50%' align="left"><%= image_tag 'seek_black.png', :size => '16x16' %></td>

<td></td>

<td width='45%'><%= link_to @game.black_player.to_s, { :controller => 'players', :action => 'show', :id => @game.black_player.id } %></td>

<td width='1%'></td>

</tr>

<tr align="center">

<td></td>

<td></td>

<td></td>

<td><%= render_black_time %></td>

<td></td>

</tr>

<tr>

<td></td>

<td><%= render_board %></td>

<td></td>

<td style="background-color: #dadada"><%= render_moves %></td>

<td></td>

</tr>

<tr align="center">

<td></td>

<td></td>

<td></td>

<td><%= render_white_time%></td>

<td></td>

</tr>

<tr align="center">

<td></td>

<td align="left"><%= image_tag 'seek_white.png', :size => '16x16' %></td>

<td></td>

<td><%= link_to @game.white_player.to_s, { :controller => 'players', :action => 'show', :id => @game.white_player.id} %></td>

<td></td>

</tr>

<tr align="center">

<td></td>

<td></td>

<td></td>

<td><%= render_result %></td>

<td></td>

</tr>

<tr>

<td colspan="5"></td>

</tr>

</table>

<%= link_to_remote 'Обновить', :update => 'moves', :url => { :action => 'game_moves', :id => @game.id } %>

<div id='debug'></div>

main/logo.rhtml

---

<table align='center'><tr><td align='center'>

<%= image_tag 'logo.jpg', :alt => 'Шахматный портал rDGT', :width => '400px', :height => '280px' %>

<br />

<br /><%= link_to '[ Трансляции ]', { :action => 'online' }%>

<br /><%= link_to '[ Турниры ]' , { :action => 'offline' }%>

<br /><%= link_to '[ Кабинет ]', { :action => 'enter' } %>

</td></tr></table>

main/online.rhtml

---

<!-- <%= link_to '[ Просмотр ]', { :action => 'game' }%>-->

<table width='80%' align='center'>

<tr>

<th></th>

<th width='10%'>Начало</th>

<th width='25%'>Турнир</th>

<th width='30%'>Белые</th>

<th width='30%'>Черные</th>

</tr>

<% @online_games.each do |game| %>

<tr align='center'>

<td class='td_info'><%= link_to(image_tag('eye.gif', :size => '16x16', :onclick => '', :alt => 'Просмотр трансляции'), { :action => 'game', :id => game.id }) %></td>

<td class='td_info'><%= game.begin.to_s %></td>

<td class='td_info'><%= link_to game.tournament.to_s, { :controller => 'tournaments', :action => 'show', :id => game.tournament.id } %></td>

<td class='td_info'><%= link_to game.white.to_s, { :controller => 'players', :action => 'show', :id => game.white.id } %></td>

<td class='td_info'><%= link_to game.black.to_s, { :controller => 'players', :action => 'show', :id => game.black.id } %></td>