<%-- Configuración de la actividad Sopa de letras. --%> <%@ page language="java" contentType="text/html;charset=UTF-8"%> <%@ page import="org.apache.struts.util.MessageResources"%> <%@ page import="org.apache.struts.util.PropertyMessageResources"%> <%@ page import="com.snr.lnr.activities.common.SessionKeys"%> <%@ page import="com.snr.lnr.activities.common.ActivityForm"%> <%@ page import="com.snr.lnr.common.ReadingKeys"%> <%@ page import="com.snr.lnr.activities.wordsearch.WordSearchActivityForm,com.snr.lnr.activities.util.TmpImageBean"%> <%@ page import="com.snr.lnr.bom.dto.DTOActivityUseWay"%> <%@taglib uri="/tags/struts-bean" prefix="bean" %> <%@taglib uri="/tags/struts-html" prefix="html" %> <%@taglib uri="/tags/reading-template" prefix="template" %> <%@ page import="com.snr.lnr.common.ReadingUtils"%> <% MessageResources msgRes = PropertyMessageResources.getMessageResources( SessionKeys.APPLICATION_RESOURCES ); String activityBeanName = request.getParameter( SessionKeys.BEAN_NAME_PARAM ); ActivityForm activityBean = (ActivityForm)request.getSession().getAttribute(activityBeanName); String savingText=msgRes.getMessage(ReadingUtils.getConfigurationLocale(),"global.saving"); String bookTitle= (String) request.getSession().getAttribute("bookTitle"); if (bookTitle == null) { bookTitle = ""; } if (bookTitle.length()>28){ bookTitle=bookTitle.substring(0,28); bookTitle+="..."; } String activityTitle=wordSearchActivityForm.getTitle(); if (activityTitle.length()>28){ activityTitle=activityTitle.substring(0,28); activityTitle+="..."; } String anchor=""+bookTitle+""; if (!"".equals(activityTitle)){ anchor+=" > "+activityTitle+""; } boolean reinforcementActivity=Integer.parseInt(request.getSession().getAttribute(ReadingKeys.ACTIVITY_USEWAY).toString())==DTOActivityUseWay.ACTIVITY_REINFORCEMENT; %>
" width="6" height="10"> 
" width="1" height="7">
" width="609" height="1">
" width="1" height="30">
"); for (int j = _XY, index = i * columns; j < columns; j++) { index = i * columns + j; if (coords[index] ) board.append(""); } } else { board = new StringBuffer(500); for (int i = _XY, rows = wordSearchActivityForm.getRows(), columns = wordSearchActivityForm.getColumns() ; i < rows; i++) { board.append(""); for (int j = _XY, index = i * columns; j < columns; j++) board.append(""); } } return board != null ? board.toString() : ""; } %>
 
 
">
<%! // Dibuja el tablero de la sopa de letras private String drawBoard(WordSearchActivityForm wordSearchActivityForm) { StringBuffer board = null; int _XY = 0; boolean coords[] = wordSearchActivityForm.getCoords(); if (coords != null) { char text[] = wordSearchActivityForm.getText(); board = new StringBuffer(25 * text.length); for (int i = _XY, rows = wordSearchActivityForm.getRows(), columns = wordSearchActivityForm.getColumns() ; i < rows; i++) { board.append("
").append(text[index]); else board.append("").append(text[index]); } board.append("
"); board.append("
">
<% // Se muestra el resumen if (request.getAttribute(SessionKeys._SAVED).equals(SessionKeys.TRUE_STRING)) { %>
<% if (!wordSearchActivityForm.isFromBlank()) { %>
<%=drawBoard(wordSearchActivityForm)%>
<% MessageResources msg = PropertyMessageResources.getMessageResources(SessionKeys.APPLICATION_RESOURCES); String list[] = wordSearchActivityForm.getWord(); if (wordSearchActivityForm.getDefinitionType() == WordSearchActivityForm._TEXT) { java.util.HashMap clues = wordSearchActivityForm.getTxtClues(); out.print(""); } else { %> <% } %>
 
" + msg.getMessage("wordSearch.text") + ": "); for (int i = 0, l = list.length; i< l; i++){ out.print((i+1) + "." + clues.get(new Integer(i)) + "
"); } } else if (wordSearchActivityForm.getDefinitionType() == WordSearchActivityForm._WORD) { out.print("
" + msg.getMessage("wordSearch.word") + ": "); for (int i = 0, l = list.length; i< l; i++){ out.print((i+1) + "." + list[i] + "
"); } } else if (wordSearchActivityForm.getDefinitionType() == WordSearchActivityForm._IMAGE) { java.util.HashMap clues = wordSearchActivityForm.getImgClues(); out.print("
" + msg.getMessage("wordSearch.image") + ": "); for (int i = 0, l = list.length; i< l; i++) { TmpImageBean tmp = (TmpImageBean)clues.get(new Integer(i)); String clue = tmp.getPath(); out.print((i+1) + "." + clue.substring(clue.lastIndexOf('/') + 1) + "
"); } } else { out.print("
General: "); out.print(wordSearchActivityForm.getActivityWording()); } out.print("
" width="9" height="4"> " width="1" height="1"> " width="9" height="4">
" width="1" height="1">
" width="1" height="1">
" width="9" height="4"> " width="1" height="1"> " width="9" height="4">
<% } // Se muestra el primer paso del asistente else if (wordSearchActivityForm.getStep() == ActivityForm.FIRST_STEP) { %>
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
2 3 4 5 6 7 8 9 10 11 12 13 14 15
" width="9" height="4"> " width="1" height="1"> " width="9" height="4">
" width="1" height="1"> " width="1" height="1">
" width="9" height="4"> " width="1" height="1"> " width="9" height="4">
" width="9" height="4"> " width="1" height="1"> " width="9" height="4">
" width="1" height="1"> " width="1" height="1">
" width="9" height="4"> " width="1" height="1"> " width="9" height="4">
<%=drawBoard(wordSearchActivityForm)%>
<% //Deshabilitar siguiente if (wordSearchActivityForm.getWord() != null && !wordSearchActivityForm.isFromBlank()) { %> <% } else { %> <% } %>
  ">
<% }// Fin primer paso del asistente // Segundo paso del asistente else if (wordSearchActivityForm.getStep() > ActivityForm.FIRST_STEP) { String list[] = wordSearchActivityForm.getWord(); %>
<% // IMAGENES if (wordSearchActivityForm.getDefinitionType() == WordSearchActivityForm._IMAGE) { java.util.HashMap clues = wordSearchActivityForm.getImgClues(); %>
<% for (int i = 0, l = list.length; i < l; i++) { String word = list[i]; String file = "file[" + i + "]"; TmpImageBean clue = (TmpImageBean)clues.get(new Integer(i)); %> <% if (clue != null) { %> <% } %>
<%=word%>  
<%=clue.getPath().substring(clue.getPath().lastIndexOf('/') + 1)%>
 
" name="img<%=i%>" tabindex="22" checked> " onchange="doChange()"/>
  <%----%> <%----%>
" name=img<%=i%> tabindex=22 disabled>  
<% } // for }// if (wordSearchActivityForm.getDefinitionType() == WordSearchActivityForm._IMAGE) // TEXTO else if (wordSearchActivityForm.getDefinitionType() == WordSearchActivityForm._TEXT) { java.util.HashMap clues = wordSearchActivityForm.getTxtClues(); %>
<% for (int i = 0, l = list.length; i < l; i++) { String word = list[i]; %>
  <%=word%>
  size=55 class=SnRInput tabindex=1 value="<% String clue = (String)clues.get(new Integer(i)); out.print(clue != null ? clue : "");%>" onselect="testNavigator(event,'<%=i%>');" onmousedown="gestionaEtiquetas('reset','','');" onchange="doChange()">
<% }//for }// else if (wordSearchActivityForm.getDefinitionType() == WordSearchActivityForm._TEXT) // PALABRA else if (wordSearchActivityForm.getDefinitionType() == WordSearchActivityForm._WORD) { %>
<% for (int i = 0, l = list.length; i < l; i++) { String word = list[i]; %> <% }//for %>
  <%=word%>  
<% }// else if (wordSearchActivityForm.getDefinitionType() == WordSearchActivityForm._WORD) // GENERAL else { %>
  :  
  <%=wordSearchActivityForm.getActivityWording()%>  
<% } %>
<% }// Fin segundo paso del asistente %>
<% // Pie boolean enabled=!wordSearchActivityForm.isFromBlank() && request.getAttribute(SessionKeys._SAVED).equals(SessionKeys.TRUE_STRING); %>
>
">" width="9" height="4"> ">" width="1" height="1"> ">" width="9" height="4">
">" width="1" height="1"> ">"> ">" width="1" height="1">
">" width="9" height="4"> ">" width="1" height="1"> ">" width="9" height="4">
" width="9" height="4"> " width="1" height="1"> " width="9" height="4">
" width="1" height="1"> " width="1" height="1">
" width="9" height="4"> " width="1" height="1"> " width="9" height="4">
    <% if (reinforcementActivity){ %> > <%} else{ %>
> <%}%>
">" width="9" height="4"> ">" width="1" height="1"> ">" width="9" height="4">
">" width="1" height="1"> ">"> ">" width="1" height="1">
">" width="9" height="4"> ">" width="1" height="1"> ">" width="9" height="4">