Page 1 of 46
SRS Development for DO-IT, EU Life Long Learning Project
Interim report from UOH team by Dr Joan Lu
Abstract This report includes two parts: Part 1 is for Technical report for the development of SRS software; Part 2is for UOH involvement with project work packages. Finally, activities involved in the project are listed in the appendix.
Part 1: Technical report for the language translation of SRS into Romania and Hungary languages
Executive summery Objective of DO-IT project is to dissiminate innovative technology into the real world, particularlly among partners in EU communities. Target groups are VET schools and QA companies that certify QA personnel in Romania, Hungary and Norway. Translation English based SRS into multiple languages becomes an immidiate task for achieving this objective. According to the work package of the project, UOH is responsible to translate the interfaces of SRS into Romania and Hungary languages, so that partners in Romania and Hungary can use their native languages whenever they are using the SRS in their class rooms. The translation is based on the existing interfaces in adobe air application for teacher side; and Java application for student side. It has been achieved that the translation in teacher side is working for the current version; student side is working for a relative older version. Both sides are not working at the latest version, but can be updated with the latest version when HiST team releases the latest version. Finally, current work has been published in an international conference in USA.
Page 2 of 46
1. Introduction This project is to disseminate the latest learning technology, i.e. Student Response System with handheld devices, e.g. ipod touch or iPhones, into target users in EU QA communities, particularly in Norway, Romania and Hungary. The languages translated are suitable for people whose first languages are Romania and Hungarian. Task set out for the UOH in wp3, consortium documents [1] aims to translate Student Response Systems for iPOD Touch or iPhone into Romania and Hungarian languages.
2. SRS translation requirements
2.1 User requirements
2.1.1 Teacher side: There are 58 elements for English words and phrases are needed to be translated. They are located in 5 interface pages, i.e. 1) Login page for the system; 2 Teacher control page; 3 Result display page; 4 data display page; 5 users sending evaluation page, see figures 1‐5. The detailed contents are listed in table 1. Table 1 Teacher side contents to be translated for SRS interfaces
English Words or Phrases
1. user name
2. password
3. web server address
4. advanced
5. anonymous session
6. get servers from localhost
7. login
8. exit
9. yes
10. no
11. don’t know
12. true
Page 3 of 46
13. false
14. seconds
15. minutes
16. version
17. run votes
18. results
19. redirect
20. parse data
21. configure
22. default
23. here you can give an URL to the students voting device (URL to an evaluation form, figure or similar sites)
24. take survey here
25. send
26. sessions
27. votes and results
28. monday, tuesday, wednesday, thursday, friday, saturday, sunday
29. january, february, march, april, may, june, july, august, september, october, november, december
30. name
31. total
32. option
33. count
34. date
35. time voting started
Page 4 of 46
36. participants in voting
37. save session to CSV file
38. users and response
39. ID
40. Voted
41. start time
42. time
43. response time
44. vote alternative
45. cumulative time graph
46. XML response
47. votes modifiable
48. vote created
49. responses total voted
50. response count
51. file data
52. text response
53. results presentation
54. simple colour
55. multicolour
56. application style
57. background colour
58. opacity
1. Login page has 7 elements to be translated, see table 1 and figure 1;
Page 5 of 46
Figure 1 Login page for the system
2. Control page has about 13 elements to be translated, see table 1 and figure 2;
Figure 2 Teacher control page
3. Result page has one element to be translated, see figure 3.
Page 6 of 46
Figure 3 Result display page
4. Data page has at least 5 phrases and other table attributes to be translated, see table 1 and figure 4.
Figure 4 Data display page
Page 7 of 46
5. Redirect page has two sentences and one word to be translated, see table 1 and figure 5.
Figure 5 Users sending evaluation page
2.1.2 Student side:
Student side pages are relatively simple than teacher side pages. It has only three pages to be translated and they are text display on the HTML web pages, see table 2 and figures 6 – 8. Translated contents need to be displayed on the screens of iPod touch/iPhones. The contents for final version have been decided in the second consortium meeting 1 – 4 August 2010 in Longyearbeen, Norway.
Table 2 Student side page to be translated for SRS
Translation for student pagesPages English1 Welcome to the Student
Response System Please enter the session code
and press “Go” Current session code GO2 System is ready for use Please wait for the voting to
start Code3 Please enter your vote Code
1. Session code input page, see figure 6;
Page 8 of 46
Figure 6 Student entering session code page
2. Waiting for alternative appearance page, see figure 7;
Figure 7 Waiting for alternative appearance page
Page 9 of 46
3. Voting page, see figure 8.
Figure 8 Voting page for students
3. Preparation for the project To achieve above requirements, UOH team initiated the following approaches: 1) Sending content lists, which are drafts of initially translated by UOH; 2) Obtain feedback from RO and HU partners; 3) Implementation of finalised RO and HU contents into the system. Table three shows the detailed translated contents in both Romania and Hungarian languages.
Table 3 Feedback from RO and HU partners
English Words or Phrases Hungarian Translation Romanian Translation
user name felhasználói név nume utilizator
password Jelszó parola
web server address web szerver címe adresa web a serverului
advanced Haladó avansată
anonymous session ülésszak névtelen sesiune anonimă
get servers from localhost szervert kap internetes legfelső szintű tartományból
conectare la serverul gazdă
Login Bejelentkezés conectare
Page 10 of 46
Exit Kilépés ieşire
Yes Igen da
No Nem nu
don’t know Nem tudom nu ştiu
True Igaz adevărat
False Hamis fals
Seconds Másodperc secunde
Minutes Perc minute
Version Változat versiune
run votes Szavazat start voturi
Results Eredmény rezultate
Redirect vissza irányít redirecţionare
parse data adatot elemez analiza datelor
configure Állítsd configurarea
Default Alapértelmezett implicit
here you can give an URL to the students voting device (URL to an evaluation form, figure or similar sites)
itt lehet adni egy URL-t, hogy a hallgatók szavazati eszköz (URL az értékelés formáját, a szám vagy hasonló oldalak)
acordare URL pentru dispozitivul de votare al studenţilor (URL pentru forma de evaluare, figura sau site-uri similare)
take survey here ellenőrizd le itt statistica votului
Send Elküld trimite
Sessions Ülésszakainak sesiuni
votes and results szavazat és eredmények voturi şi rezultate
monday, tuesday, wednesday, thursday, friday, saturday, sunday
hétfő, kedd, szerda, csütörtök, péntek, szombat, vasárnap
luni, marţi, miercuri, joi, vineri, sâmbătă, duminică
january, february, march, april, may, june, july, august, september, october,
január, február, március, április, május, június, július, augusztus, szeptember, október, november,
ianuarie, februarie, martie, aprilie, mai, iunie, iulie, august, septembrie, octombrie,
Page 11 of 46
november, december December noiembrie, decembrie
Name Név nume
Total Összesített total
Option Lehetőséget opţiunea
Count Számítanak numărare
Date Datum dată
time voting started Időre történő szavazás indul inceputul sesiunii de votare
participants in voting szavazás résztvevői participanţi la vot
save session to CSV file mentse az összejövetelt CSV fájlba
salvarea sesiunii în fişier CSV
users and response a felhasználók és válasz utilizatori şi răspunsuri
ID Azonosító ID
Voted Megszavazta votat
start time kezdési időpont timpul de începere
Time Idő durata
response time Válaszidőt durata de răspuns
vote alternative szavazás alternatíva alternative de vot
cumulative time graph kumulált idő grafikon grafic cumulativ de timp
XML response XML válasz răspuns XML
votes modifiable Módosítható szavazat voturi modificabile
vote created szavazás elkészült voturi efectuate
responses total voted A válaszok teljes szavazott totalul voturilor expediate
response count válasz számít numărului de răspuns
file data fájl adatok fişier de date
text response szöveges válasz răspuns text
results presentation eredmények bemutatása prezentarea rezultatelor
simple colour egyszerű színek monocolor
Page 12 of 46
multicolour Többszínnyomás multicolor
application style stílus alkalmazása modul de efectuare
background colour Háttérszín culoarea de fundal
Opacity fedőképesség opacitatea
4. Implementation and testing The processes are carried out in the following steps:
Step 1 Design the interface, which should be easy for users to operate, i.e. login page should be able to select which language the users are going to use. Thus, a drop down menu is designed. The flags of each country are linked to the country code, e.g. RO or HU or GB, see figure 9.
Figure 9 Login page for selecting the language to be used in SRS
Step 2 Implement teacher side pages. Once language has been selected, the interface will be changed into the selected language. Please see figures 10 to 14 for RO and figures 14 – 18 for HU.
a. Translations for Romania language In figure 10, an arrow indicated that Romania language has been selected with country code: RO.
Select a language here
Page 13 of 46
Figure 10 Romania language has been selected.
Romania language hasbeen selected.
Page 14 of 46
Page 15 of 46
Figure 11 Control page with Romania language
Page 16 of 46
Figure 12 timer page with Romania language
Page 17 of 46
Figure 13 Results page with Romania language
Page 18 of 46
Figure 14 User sending evaluation page with Romania language
Page 19 of 46
Figure 15 Data display page with Romania language
Page 20 of 46
Figure 16 Background colour page with Romania language
b. Translations for HU
Page 21 of 46
Figure 17 Hungarian language has been selected for teacher login page
Hungarian language has been selected.
Page 22 of 46
Figure 18 Teacher control page with Hungarian language
Page 23 of 46
Figure 19 Teacher control page with timer in Hungarian language
Page 24 of 46
Figure 20 Result display page with Hungarian language
Page 25 of 46
Figure 21 User sending evaluation page with Hungarian language
Page 26 of 46
Figure 22 Data display page with Hungarian language
Page 27 of 46
Figure 23 background colour page with Hungarian language
Table 4Testing results for teacher control pages
English Words or Phrases
Hungarian Translation Romanian Translation
Pass or fail
user name felhasználói név nume utilizator Pass
password Jelszó Parola Pass
web server address web szerver címe adresa web a serverului
Pass
advanced Haladó Avansată Pass
anonymous session ülésszak névtelen sesiune anonimă Pass
get servers from localhost
szervert kap internetes legfelső szintű tartományból
conectare la serverul gazdă
Pass
Login Bejelentkezés Conectare Pass
Page 28 of 46
Exit Kilépés Ieşire Pass
Yes Igen Da Pass
No Nem Nu Pass
don’t know Nem tudom nu ştiu Pass
True Igaz Adevărat Pass
False Hamis Fals Pass
Seconds Másodperc Secunde Pass
Minutes Perc Minute Pass
Version Változat Versiune Pass
run votes Szavazat start voturi Pass
Results Eredmény Rezultate Pass
Redirect vissza irányít redirecţionare Pass
parse data adatot elemez analiza datelor Pass
configure Állítsd configurarea Pass
Default Alapértelmezett Implicit Pass
here you can give an URL to the students voting device (URL to an evaluation form, figure or similar sites)
itt lehet adni egy URL-t, hogy a hallgatók szavazati eszköz (URL az értékelés formáját, a szám vagy hasonló oldalak)
acordare URL pentru dispozitivul de votare al studenţilor (URL pentru forma de evaluare, figura sau site-uri similare)
Pass
take survey here ellenőrizd le itt statistica votului Pass
Send Elküld Trimite Pass
Sessions Ülésszakainak Sesiuni Pass
votes and results szavazat és eredmények voturi şi rezultate Pass
monday, tuesday, wednesday, thursday, friday, saturday, sunday
hétfő, kedd, szerda, csütörtök, péntek, szombat, vasárnap
luni, marţi, miercuri, joi, vineri, sâmbătă, duminică
Pass
january, february, január, február, március, ianuarie, februarie, Pass
Page 29 of 46
march, april, may, june, july, august, september, october, november, december
április, május, június, július, augusztus, szeptember, október, november, December
martie, aprilie, mai, iunie, iulie, august, septembrie, octombrie, noiembrie, decembrie
Name Név Nume Pass
Total Összesített Total Pass
Option Lehetőséget Opţiunea Pass
Count Számítanak Numărare Pass
Date Datum Dată Pass
time voting started Időre történő szavazás indul
inceputul sesiunii de votare
Pass
participants in voting szavazás résztvevői participanţi la vot Pass
save session to CSV file
mentse az összejövetelt CSV fájlba
salvarea sesiunii în fişier CSV
Pass
users and response a felhasználók és válasz utilizatori şi răspunsuri Pass
ID Azonosító ID Pass
Voted Megszavazta Votat Pass
start time kezdési időpont timpul de începere Pass
Time Idő Durata Pass
response time Válaszidőt durata de răspuns Pass
vote alternative szavazás alternatíva alternative de vot Pass
cumulative time graph
kumulált idő grafikon grafic cumulativ de timp
Pass
XML response XML válasz răspuns XML Pass
votes modifiable Módosítható szavazat voturi modificabile Pass
vote created szavazás elkészült voturi efectuate Pass
responses total voted A válaszok teljes szavazott
totalul voturilor expediate
Pass
response count válasz számít numărului de răspuns Pass
Page 30 of 46
file data fájl adatok fişier de date Pass
text response szöveges válasz răspuns text Pass
results presentation eredmények bemutatása prezentarea rezultatelor
Pass
simple colour egyszerű színek Monocolor Pass
multicolour Többszínnyomás Multicolour Pass
application style stílus alkalmazása modul de efectuare Pass
background colour Háttérszín culoarea de fundal Pass
Opacity fedőképesség Opacitatea Pass
Table 5 Summary of implementation and testing section
No Teacher Pass/fail Student Pass/ fail1 PC or laptop Pass iPod touch/iPhones Pass2 Blackboard Pass PC/laptop Pass3 Projector Pass 4 Browser: Firefox or Safari Pass 5 Wireless network, e.g. wifi Pass Step 3: Student side implementation
Three pages are translated for both Romania and Hungary languages, for the version used so far.
Page 31 of 46
Figure 24 student page 1 for Romania language
Figure 25 Student page 2 for Romania language
Page 32 of 46
Figure 26 Student page 3 for Romania language
Figure 27 Student page 1 for Hungary language
Page 33 of 46
Figure 28 Student page 2 for Hungary language
Figure 29 Student page 3 for Hungary language
Page 34 of 46
5. Evaluation For teacher side, at this stage, translation is successful for both Romania and Hungarian languages. As the interface is based on HiST team’s version in May, it is for the question with single answer, which means one question can only be valid for one correct answer. The new version will implement the question with multiple answers, depending on how soon the new version’s interfaces will be obtained from HiST team. For student side, current version has been successfully translated into both Romania and Hungarian languages. Once new version’s interfaces are available, further work will be carried out for the version with multiple answers.
6. Conclusion and Future work 6.1 Achievements
From above report, it is concluded that the progress of translation teacher side pages is going well at this stage by:
1. Meet the discussed requirements; 2. Reach required quality; 3. Deliver the work in time; 4. Achieve the target set for this year in both Romania and Hungarian languages. 6.2 Future work
For the teacher side: Implementation for multiple answers for given questions with both languages.
For student side: Linking translated pages into teacher side pages of new version.
6.3 Suggestions
Some documentation provided from HiST team is needed, in case, if something has been changed by the programmer, which may cause the disruption for the users, Huddersfield team should be informed and investigate immediately.
References [1]. John B. Stav, Proposal of DO-IT, consortium documents, 2009, confidential. [2]. Joan Lu, Presentation for kick off meeting in RO, March, 2010
Page 35 of 46
Part 2: UOH involvement in work packages WP 1 - Project management UOH: Participating in project meetings WP 2 – User requirement specifications UOH: Not involved WP 3 – Language translation into RO and HU for the dissemination communities UOH: Involved WP 4 – Adaptation of quality assurance and quality management Educational material UOH: Not involved WP 5 – Quality Assurance Plan and Evaluation of projects results UOH: self evaluated for the version with translated languages WP 6 – Dissemination and valorization of project results
UOH: UOH has involved disseminations of project: 1. A list of dissemination activities carried out
1. Joan Lu, “Student Response System in mobile learning”, Research Festival, University of Huddersfield, March, 2010,
2. Joan Lu, “SRS with iPoD/iPhone”, Buckingham University, Buckingham, June 2010;
3. Joan Lu, “SRS for mobile learning”, Kennesaw State University, USA, July, 2010, 4. Joan Lu, “Mobile learning”, Computer Science, University of Georgia, USA, July
2010. 5. Joan Lu, “SRS for Edumecca project”, Research festival, University of Huddersfield,
May 2010. 6. Pascal Pein, S. Scanlon, Joan Lu, T. M. Thorseth, John B Stav, L. Moldovan “An
XML-Based Approach for Ubiquitous Response Systems – A Case study to demonstrate the Integrity of Web services and Localization”, International Conference on XMLTech10, Las Vegas, July 2010.
7. Joan Lu, “SRS for Education”, presentation in Education School, University of Huddersfield.
8. Joan Lu, “SRS for Teaching and learning”, presentation in Business School, University of Huddersfield.
2. Articles or publications relevant for the project 1. Joan Lu, Raoul Pascal Pein, Gabrielle Hansen, Kjetil L. Nielsen, John B Stav: “User
centred Mobile Aided learning System (SRS), CIT 2010, 2970-2975. 2. Pascal Pein, S. Scanlon, Joan Lu, T. M. Thorseth, John B Stav, L. Moldovan “An
XML-Based Approach for Ubiquitous Response Systems – A Case study to demonstrate the Integrity of Web services and Localization”, International Conference on XMLTech10, Las Vegas, July 2010.
WP 7 - Exploitation of project results UOH: in the discussion of Engineering and healthcare sectors within UOH.
Page 36 of 46
Appendix I: List of responsibilities in development team
Dr Joan Lu, leader of the team
Gehao Lu, leads translations for teacher and student pages
Guo Wei, translations for teacher and student pages
Jinyan Li, translations for teacher and student pages
Lan Wang, progress checking and testing
Shagutfa Juna, early stage of translation
Page 37 of 46
Appendix II: Activities of UOH involved for the project
3. Kick off meeting in Romania, March 2010 4. Second project meeting in Norway, August 2010 5. Third project meeting in UK, November 2010 6. Joan Lu, et al, “SRS in mobile computing”, International Conference, Bradford,
June, 2010 7. Joan Lu, “Student Response System in mobile learning”, Research Festival,
University of Huddersfield, March, 2010, 8. Joan Lu, “SRS with iPoD/iPhone”, Buckingham University, Buckingham, 2010; 9. Joan Lu, “SRS for mobile learning”, Kennesaw State University, USA, July, 2010, 10. Joan Lu, “Mobile learning”, Computer Science, University of Georgia, USA, July
2010. 11. Joan Lu, “Mobile learning with SRS”, International Conference, Las Vegas, USA,
July 2010. 12. Joan Lu, “SRS for Education”, presentation in Education School, University of
Huddersfield. 13. Joan Lu, “SRS for Education”, presentation in Business School, University of
Huddersfield 14. Individual Skype meetings between HiST team and UOH team since start of the
project, 2010
Page 38 of 46
Appendix III: List of the code examples and a CD that is posted to project co-ordinator <%@page import="java.util.Properties"%> <%@page import="edumecca.webui.Helper"%> <% response.sendRedirect("../index.jsp"); %> <% Helper h = new Helper(getServletContext()); //Properties props = h.getProps(); String navigationLayout = h.getProperty("navigationLayout", Helper.DEFAULT_STUDENT_NAVIGATION_LAYOUT); //h.getUiLogger().debug("test UI logging"); %> <!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"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!-- Set iPhone specific viewport --> <meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" /> <link rel="apple-touch-icon" href="../images/apple-touch-icon.png"/> <link rel="icon" type="../image/png" href="../images/icon.png" /> <title>SRS Login</title> <!-- short title, optimized for iPhone main page --> <!--<title>EduMECCA SRS Login</title> --> <link href="../css/style1.css" rel="stylesheet" type="text/css" /> </head> <body> <% if ("top".equalsIgnoreCase(navigationLayout)){ %> <%@include file='../templates/navigation.jsp'%> <% } %> <!-- <h1>Login</h1> --> <h1>Welcome</h1> <!-- <h2>To the Easy Student Response System</h2> --> <h2>To the Student Response System</h2> <ul> <li><a href="inputcode.jsp">Student</a></li> <li><a href="createlecturesession.jsp">Teacher</a></li> <!-- <li><a href="student.jsp">Student</a></li> <li><a href="teacher-createlecture.jsp">Teacher</a></li> --> </ul> <% if ("bottom".equalsIgnoreCase(navigationLayout)){ %> <%@include file='../templates/navigation.jsp'%> <% } %> </body> </html> <%@page
Page 39 of 46
import="java.util.*" import="java.io.*" import="java.net.*" import="javax.xml.parsers.*" import="org.restlet.data.*" import="org.w3c.dom.*" import="edumecca.webui.Tools" import="org.restlet.data.Cookie" import="edumecca.webui.Helper"%> <% // String test=""; response.setContentType("text/xml"); // TODO: login/account verification // parameter: full source URL or root URL Helper h = new Helper(getServletContext()); String votingServerUrl = h.getProperty("votingServerUrl"); // read maximum length of full reply, use identifier instead // String sMaxReplyLength = h.getProperty("maxReplyLength"); int maxReplyLength = h.getIntegerProperty("maxReplyLength",Helper.DEFAULT_MAX_REPLY_LENGTH); // read maximum number of columns // String sNumCols = h.getProperty("numCols"); int numCols = h.getIntegerProperty("numCols", Helper.DEFAULT_NUM_COLS); // read layout //layouts id=[id] + text, text=[text], short=[text OR id], ... String responseButtonLayout = h.getProperty("responseButtonLayout", Helper.DEFAULT_RESPONSE_BUTTON_LAYOUT); String sMaxImageWidth = h.getProperty("maxImageWidth"); int maxImageWidth; try{ maxImageWidth = Integer.parseInt(sMaxImageWidth); } catch (NumberFormatException e){ maxImageWidth = Helper.DEFAULT_MAX_IMAGE_WIDTH; } String sMaxImageHeight = h.getProperty("maxImageHeight"); int maxImageHeight; try{ maxImageHeight = Integer.parseInt(sMaxImageHeight); } catch (NumberFormatException e){ maxImageHeight = Helper.DEFAULT_MAX_IMAGE_HEIGHT; } Map<String,Cookie> cookieMap = h.convertCookies(request.getCookies()); // find or create URL to related vote: URL voteUrl = null; String code = null; boolean isDefaultSession = true;
Page 40 of 46
// try to find submitted parameter String sVoteUrl = request.getParameter("voteUrl"); if (sVoteUrl != null){ voteUrl = new URL(sVoteUrl); isDefaultSession = false; } if (voteUrl == null){ // try to assemble valid url // fall back to default vote if no code is specified voteUrl = new URL(votingServerUrl+"vote"); code = request.getParameter("code"); if (code != null) { code = code.trim(); if (!"".equals(code)){ voteUrl = new URL(votingServerUrl+"sessioncode/"+code+"/vote"); isDefaultSession = false; // out.print(voteUrl.toString()); } } } String isopen = null; String hasvoted = null; String image = null; NodeList voteOptionList = null; String question = null; String title = null; // Set<String> lastResponseValues = new HashSet<String>(); List<String> lastResponseValues = new ArrayList<String>(); // Document doc = h.getDocument(voteUrl, "guest", "guest"); Response resp = h.httpRequest(Method.GET, voteUrl, null, "guest", "guest"); // Document doc = resp.getEntityAsDom().getDocument(); Document doc = null; if ( resp.getStatus().isSuccess() && resp.isEntityAvailable()){ doc = resp.getEntityAsDom().getDocument(); // Document doc = Tools.getDocument(sessionsURL, "guest", "guest", sessionToken); // if no cookie is set at the client, do it now if (cookieMap.get(Tools.COOKIE_NAME_USER_SESSION_ID) == null){ CookieSetting cs = resp.getCookieSettings().getFirst(Tools.COOKIE_NAME_USER_SESSION_ID); if (cs != null){ String sessionToken = cs.getValue(); // new id from response if ( (sessionToken != null) && (!"".equals(sessionToken)) ){ javax.servlet.http.Cookie cookie = new javax.servlet.http.Cookie (Tools.COOKIE_NAME_USER_SESSION_ID,sessionToken); cookie.setMaxAge(10 * 365 * 24 * 60 * 60); // 10 years response.addCookie(cookie); System.out.println("setting new session cookie: "+sessionToken); }
Page 41 of 46
else{ System.err.println("No cookie set and no session token available!"); } } } NodeList voteList = doc.getElementsByTagName("vote"); Node voteElement = voteList.item(0); NodeList questionList = doc.getElementsByTagName("question"); Node questionElement = questionList.item(0); question = questionElement.getTextContent(); NodeList optionList = doc.getElementsByTagName("options"); // optionList. voteOptionList = optionList.item(0).getChildNodes(); if (voteElement.getAttributes().getNamedItem("isopen") != null){ isopen = voteElement.getAttributes().getNamedItem("isopen").getNodeValue(); } if (voteElement.getAttributes().getNamedItem("hasvoted") != null){ hasvoted = voteElement.getAttributes().getNamedItem("hasvoted").getNodeValue(); } if (voteElement.getAttributes().getNamedItem("image") != null){ image = voteElement.getAttributes().getNamedItem("image").getNodeValue(); } if (voteElement.getAttributes().getNamedItem("title") != null){ title = voteElement.getAttributes().getNamedItem("title").getNodeValue(); } NodeList lastResponseValueList; NodeList lastResponseList = doc.getElementsByTagName("lastResponse"); if (lastResponseList.item(0) != null){ lastResponseValueList = lastResponseList.item(0).getChildNodes(); for (int i= 0; i<lastResponseValueList.getLength(); i++){ Node valueNode = lastResponseValueList.item(i); if ("value".equals(valueNode.getNodeName())){ lastResponseValues.add(valueNode.getTextContent()); } } } } else{ // TODO display error } %> <vote-content-wrapper>
Page 42 of 46
<div id="test"> This is a test! </div> <div id="question"> PLACEHOLDER <%out.print(question);%> </div> <div id="image"> <% if (image != null){ out.println("<a href=\""+image+"\">"); out.println("<img width=\""+maxImageWidth+"\" src=\""+image+"\" alt=\""+image+"\" />"); out.println("</a>"); } %> </div> <div id="replies"> dhtrhrettrhreth <% if ( resp.getStatus().isSuccess() && doc != null){ if ("true".equals(isopen)){ // if open, assemble reply forms int col=0; boolean rowOpen = false; // create a table out.println("<table>"); for (int i= 0; i < voteOptionList.getLength(); i++){ Node voteOptionElement = voteOptionList.item(i); if ("vote-option".equals(voteOptionElement.getNodeName())){ // String href = voteOptionElement.getAttributes().getNamedItem("href").getNodeValue(); String voteid = voteOptionElement.getAttributes().getNamedItem("voteid").getNodeValue(); String voteHref = voteUrl.toString(); String voteText = voteOptionElement.getTextContent(); // defaults (short) String buttonLabel = voteid.toUpperCase(); String textLabel = ""; //layouts long=[id] + text, text=[text], dynamic=[text OR id], short=[id], ... if ("dynamic".equalsIgnoreCase(responseButtonLayout)){ if (voteText.length() < maxReplyLength){ buttonLabel = voteText; } } else if("long".equalsIgnoreCase(responseButtonLayout)){ textLabel = voteText; } else if("text".equalsIgnoreCase(responseButtonLayout)){ buttonLabel = voteText; }
Page 43 of 46
if (col==0){ out.println("<tr>"); rowOpen = true; } out.println(" <td>"); out.println(" <form method=\"post\" action=\"voteaccepted.jsp?voteid="+voteid+"&href="+voteHref+"\">"); String cssClass; if (lastResponseValues.contains(voteid)){ cssClass = "class=\"lastresponse\""; // out.println(" <label class=\"lastresponse\">"); } else{ cssClass = "class=\"response\""; // out.println(" <label class=\"response\">"); } out.println(" <label "+cssClass+">"); out.println(" <input name=\"answer\" value=\""+voteid+"\" type=\"hidden\" />"); // out.println(" <input type=\"submit\" value=\""+voteText+"\" />"); out.println(" <input "+cssClass+" type=\"submit\" value=\""+buttonLabel+"\" />"); out.println(textLabel); out.println(" <br />"); out.println(" </label>"); out.println(" </form>"); out.println(" </td>"); } if (col==numCols-1){ out.println("</tr>"); rowOpen = false; } col++; col = col%numCols; } if (rowOpen){ out.println("</tr>"); } out.println("</table>"); } } /* out.println("<hr />"); // visual end of options
Page 44 of 46
if ("true".equals(hasvoted)){ out.println("You have already voted."); // out.println("Response: "+lastResponseValues); } } else{ out.println("<h1>please wait</h1>"); } } else{ out.println("<h3>Session not available</h3>"); out.println("<p>"+resp.getStatus().getDescription()+"</p>"); out.println("<p>Please try again</p>"); */ %> <form method="get" action=""> Code: <input type="text" name="code" size="10" /> <input type="submit" value="GO"/> </form> <%//}%> </div> <!-- <body <%//if ("true".equals(hasvoted)){out.println("bgcolor=\"#cccccc\"");}%>> <% /* if ( resp.getStatus().isSuccess() && doc != null){ if ("true".equals(isopen)){ //out.println("<h3>"); //out.print(question); //out.println("</h3>"); out.println("<div class=\"question\">"); out.print(question); out.println("</div>"); // display optional image if (image != null){ out.println("<a href=\""+image+"\">"); out.println("<img width=\""+maxImageWidth+"\" src=\""+image+"\" alt=\""+image+"\" />"); out.println("</a>"); } int col=0; boolean rowOpen = false; // create a table out.println("<table>"); for (int i= 0; i < voteOptionList.getLength(); i++){ Node voteOptionElement = voteOptionList.item(i); if ("vote-option".equals(voteOptionElement.getNodeName())){ // String href = voteOptionElement.getAttributes().getNamedItem("href").getNodeValue(); String voteid = voteOptionElement.getAttributes().getNamedItem("voteid").getNodeValue(); String voteHref = voteUrl.toString(); String voteText = voteOptionElement.getTextContent();
Page 45 of 46
// defaults (short) String buttonLabel = voteid.toUpperCase(); String textLabel = ""; //layouts long=[id] + text, text=[text], dynamic=[text OR id], short=[id], ... if ("dynamic".equalsIgnoreCase(responseButtonLayout)){ if (voteText.length() < maxReplyLength){ buttonLabel = voteText; } } else if("long".equalsIgnoreCase(responseButtonLayout)){ textLabel = voteText; } else if("text".equalsIgnoreCase(responseButtonLayout)){ buttonLabel = voteText; } if (col==0){ out.println("<tr>"); rowOpen = true; } out.println(" <td>"); out.println(" <form method=\"post\" action=\"voteaccepted.jsp?voteid="+voteid+"&href="+voteHref+"\">"); String cssClass; if (lastResponseValues.contains(voteid)){ cssClass = "class=\"lastresponse\""; // out.println(" <label class=\"lastresponse\">"); } else{ cssClass = "class=\"response\""; // out.println(" <label class=\"response\">"); } out.println(" <label "+cssClass+">"); out.println(" <input name=\"answer\" value=\""+voteid+"\" type=\"hidden\" />"); // out.println(" <input type=\"submit\" value=\""+voteText+"\" />"); out.println(" <input "+cssClass+" type=\"submit\" value=\""+buttonLabel+"\" />"); out.println(textLabel); out.println(" <br />"); out.println(" </label>"); out.println(" </form>"); out.println(" </td>"); } if (col==numCols-1){ out.println("</tr>"); rowOpen = false; } col++;
Page 46 of 46
col = col%numCols; } if (rowOpen){ out.println("</tr>"); } out.println("</table>"); out.println("<hr />"); // visual end of options if ("true".equals(hasvoted)){ out.println("You have already voted."); // out.println("Response: "+lastResponseValues); } } else{ out.println("<h1>please wait</h1>"); } } else{ out.println("<h3>Session not available</h3>"); out.println("<p>"+resp.getStatus().getDescription()+"</p>"); out.println("<p>Please try again</p>"); */ %> <form method="get" action=""> Code: <input type="text" name="code" size="10" /> <input type="submit" value="GO"/> </form> <%//}%> </body> --> </vote-content-wrapper>