summaryrefslogtreecommitdiff
path: root/external/ZendFramework-1.9.5/externals/dojo/demos/flashCards
diff options
context:
space:
mode:
Diffstat (limited to 'external/ZendFramework-1.9.5/externals/dojo/demos/flashCards')
-rw-r--r--external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/README32
-rw-r--r--external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/demo.css139
-rw-r--r--external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/demo.html53
-rw-r--r--external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/demo.profile.js17
-rw-r--r--external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/images/alarm.pngbin0 -> 1194 bytes
-rw-r--r--external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/images/bg.pngbin0 -> 3356 bytes
-rw-r--r--external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/images/board.pngbin0 -> 7834 bytes
-rw-r--r--external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/images/bubble.pngbin0 -> 3627 bytes
-rw-r--r--external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/images/correct.pngbin0 -> 442 bytes
-rw-r--r--external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/images/incorrect.pngbin0 -> 494 bytes
-rw-r--r--external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/images/questions.pngbin0 -> 1426 bytes
-rw-r--r--external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/images/remaining.pngbin0 -> 677 bytes
-rw-r--r--external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/images/slow.pngbin0 -> 768 bytes
-rw-r--r--external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/images/teacher_body.pngbin0 -> 28391 bytes
-rw-r--r--external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/images/teacher_eyes_closed.pngbin0 -> 1309 bytes
-rw-r--r--external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/images/teacher_mouth_angry.pngbin0 -> 919 bytes
-rw-r--r--external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/images/try_again.pngbin0 -> 884 bytes
-rw-r--r--external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/src.js198
-rw-r--r--external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/src/MathFlashCard.html20
-rw-r--r--external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/src/MathFlashCard.js159
-rw-r--r--external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/src/Teacher.css69
-rw-r--r--external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/src/Teacher.html9
-rw-r--r--external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/src/Teacher.js58
-rw-r--r--external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/src/tests/test_Teacher.html46
24 files changed, 800 insertions, 0 deletions
diff --git a/external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/README b/external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/README
new file mode 100644
index 0000000..aa735c2
--- /dev/null
+++ b/external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/README
@@ -0,0 +1,32 @@
+-------------------------------------------------------------------------------
+Flash Cards - Simple interactive math game
+-------------------------------------------------------------------------------
+Author: Dustin Machi (dmachi)
+-------------------------------------------------------------------------------
+Demo description
+
+ A small demo showing off some of the capabilities of the Dojo Toolkit.
+ Animations, Custom Widgetry, Keyboard interaction, and time-based
+ controls.
+
+ Backend/code courtesy Nikolai Onken and Dustin Machi.
+ Design courtesy Victoria Ionushonis
+
+-------------------------------------------------------------------------------
+Dependencies:
+
+ Dojo Core
+ Dijit
+
+-------------------------------------------------------------------------------
+Installation instructions
+
+ Simply run the included demo.html
+
+ To build, use the supplied demo.profile.js as your profileFile,
+ or run the included buildDemo.sh -- which [should] create an
+ archive called skewDemo.tar.gz that you [should] be able to drop
+ on any webserver and view (only optimized, instead)
+
+-------------------------------------------------------------------------------
+@rank:7
diff --git a/external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/demo.css b/external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/demo.css
new file mode 100644
index 0000000..ee29e4a
--- /dev/null
+++ b/external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/demo.css
@@ -0,0 +1,139 @@
+@import "../../dojo/resources/dojo.css";
+@import "../../dijit/themes/tundra/tundra.css";
+@import "src/Teacher.css";
+
+.tundra {
+ margin:0;
+ background:#9A8312;
+}
+
+.classContainer {
+ width: 900px;
+ margin-left: auto;
+ margin-right: auto;
+}
+
+.classRoomOutline {
+ position: relative;
+ margin-top: 60px;
+ width: 868px;
+ height: 546px;
+ background: url("images/bg.png");
+}
+
+.classRoomBoard {
+ position: absolute;
+ top: -30px;
+ left: 120px;
+ width: 449px;
+ height: 550px;
+ background: url("images/board.png");
+}
+
+.classRoomTeacher {
+ z-index: 100;
+ top: 100px;
+ left: 30px;
+}
+
+.classRoomResult {
+ position: absolute;
+ left: 575px;
+ top: 115px;
+}
+
+.classRoomStart {
+ background: url("images/try_again.png");
+ width: 80px;
+ height: 17px;
+ position: absolute;
+ bottom: 20px;
+ right: 20px;
+ padding: 22px;
+}
+
+.classRoomStartContent {
+ font-size: 20px;
+ color: #FF0000;
+ text-align: center;
+ cursor: pointer;
+}
+
+.container {
+ padding: 10px 10px;
+ cursor: default;
+ font-size: 72pt;
+ color:#FFF;
+ width:200px;
+ position: absolute;
+ top: 130px;
+ left: 150px;
+}
+
+.container input {
+ background:#304535;
+}
+
+#scoreTable {
+ color:#FFF;
+ font-size:15pt;
+ text-align:left;
+}
+
+#score {
+ font-size:25pt;
+ padding-left: 30px;
+ margin-bottom: 20px;
+}
+
+#remaining {
+ background:url("images/remaining.png") no-repeat center left;
+ padding-left:35px;
+ padding: 10px 0 10px 30px;
+}
+
+#correct {
+ background:url("images/correct.png") no-repeat center left;
+ padding-left:35px;
+ padding: 10px 0 10px 30px;
+}
+
+#incorrect {
+ background:url("images/incorrect.png") no-repeat center left;
+ padding-left:35px;
+ padding: 10px 0 10px 30px;
+}
+
+#tooSlow {
+ background:url("images/slow.png") no-repeat center left;
+ padding-left:35px;
+ padding: 10px 0 10px 30px;
+}
+
+#correctTd,
+#incorrectTd,
+#tooSlowTd,
+#remainingTd {
+ padding-left: 5px;
+ font-weight: bold;
+}
+
+.answerInput {
+ width:100%;
+ height: 100%;
+ font-size: 72pt;
+ border: 0px;
+ color: #FFF;
+ text-align: right;
+ outline:0;
+}
+
+.answerWrap {
+ margin: 0px;
+ padding:0px;
+}
+
+.dividerLine {
+ border-bottom: 4px solid white;
+ height:4px;
+} \ No newline at end of file
diff --git a/external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/demo.html b/external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/demo.html
new file mode 100644
index 0000000..51346be
--- /dev/null
+++ b/external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/demo.html
@@ -0,0 +1,53 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
+ "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+
+ <title>Dojo.schools()</title>
+
+ <link rel="stylesheet" href="demo.css">
+
+ <script type="text/javascript" src="../../dojo/dojo.js" charset="utf-8"></script>
+ <script type="text/javascript" src="src.js" charset="utf-8"></script>
+
+</head>
+<body class="tundra">
+ <div class="classContainer">
+ <div class="classRoomOutline">
+ <div dojoType="demo.Teacher" id="teacher" class="classRoomTeacher"></div>
+ <div class="classRoomBoard">
+ <div layoutAlign="client" class="container" id="card"
+ dojoType="dojofun.widget.MathFlashCard" numberProblems="20" maxInt="10"
+ timer="5" problemType="addition" style="display:none"></div>
+ </div>
+ <div class="classRoomResult">
+ <table id="scoreTable" style="display:none">
+ <tr><td id="score"colspan="2">Your Score</td></tr>
+ <tr>
+ <td id="remaining" align="left">Questions Remaining: </td>
+ <td id="remainingTd"></td>
+ </tr>
+ <tr>
+ <td id="correct" align="left">Correct Answers:</td>
+ <td id="correctTd"></td>
+ </tr>
+ <tr>
+ <td id="incorrect" align="left">Incorrect Answers:</td>
+ <td id="incorrectTd"></td>
+ </tr>
+ <tr>
+ <td id="tooSlow" align="left">Too Slow:</td>
+ <td id="tooSlowTd"></td>
+ </tr>
+ </table>
+ </div>
+ <div class="classRoomStart" id="start">
+ <div class="classRoomStartContent" onClick="getStarted()" dojoAttachPoint="roomControl">Start</div>
+ </div>
+ <div class="classRoomStart" id="restart" style="display: none">
+ <div class="classRoomStartContent" onClick="restart()" dojoAttachPoint="roomControl" >Restart</div>
+ </div>
+ </div>
+ </div>
+</body>
+</html>
diff --git a/external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/demo.profile.js b/external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/demo.profile.js
new file mode 100644
index 0000000..522ca04
--- /dev/null
+++ b/external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/demo.profile.js
@@ -0,0 +1,17 @@
+dependencies = {
+ layers: [
+ {
+ name: "../demos/flashCards/src.js",
+ resourceName: "demos.flashCards.src",
+ dependencies: [
+ "demos.flashCards.src"
+ ]
+ }
+ ],
+
+ prefixes: [
+ [ "dijit", "../dijit" ],
+ [ "dojox", "../dojox" ],
+ [ "demos", "../demos" ]
+ ]
+}
diff --git a/external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/images/alarm.png b/external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/images/alarm.png
new file mode 100644
index 0000000..2ef9f7e
--- /dev/null
+++ b/external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/images/alarm.png
Binary files differ
diff --git a/external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/images/bg.png b/external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/images/bg.png
new file mode 100644
index 0000000..0800f61
--- /dev/null
+++ b/external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/images/bg.png
Binary files differ
diff --git a/external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/images/board.png b/external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/images/board.png
new file mode 100644
index 0000000..af3155d
--- /dev/null
+++ b/external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/images/board.png
Binary files differ
diff --git a/external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/images/bubble.png b/external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/images/bubble.png
new file mode 100644
index 0000000..5b8e850
--- /dev/null
+++ b/external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/images/bubble.png
Binary files differ
diff --git a/external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/images/correct.png b/external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/images/correct.png
new file mode 100644
index 0000000..38b8deb
--- /dev/null
+++ b/external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/images/correct.png
Binary files differ
diff --git a/external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/images/incorrect.png b/external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/images/incorrect.png
new file mode 100644
index 0000000..41f1ca7
--- /dev/null
+++ b/external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/images/incorrect.png
Binary files differ
diff --git a/external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/images/questions.png b/external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/images/questions.png
new file mode 100644
index 0000000..410e693
--- /dev/null
+++ b/external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/images/questions.png
Binary files differ
diff --git a/external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/images/remaining.png b/external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/images/remaining.png
new file mode 100644
index 0000000..6fffafc
--- /dev/null
+++ b/external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/images/remaining.png
Binary files differ
diff --git a/external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/images/slow.png b/external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/images/slow.png
new file mode 100644
index 0000000..517a625
--- /dev/null
+++ b/external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/images/slow.png
Binary files differ
diff --git a/external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/images/teacher_body.png b/external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/images/teacher_body.png
new file mode 100644
index 0000000..5be1a62
--- /dev/null
+++ b/external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/images/teacher_body.png
Binary files differ
diff --git a/external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/images/teacher_eyes_closed.png b/external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/images/teacher_eyes_closed.png
new file mode 100644
index 0000000..f8d72c0
--- /dev/null
+++ b/external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/images/teacher_eyes_closed.png
Binary files differ
diff --git a/external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/images/teacher_mouth_angry.png b/external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/images/teacher_mouth_angry.png
new file mode 100644
index 0000000..7b8d83b
--- /dev/null
+++ b/external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/images/teacher_mouth_angry.png
Binary files differ
diff --git a/external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/images/try_again.png b/external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/images/try_again.png
new file mode 100644
index 0000000..f5a3912
--- /dev/null
+++ b/external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/images/try_again.png
Binary files differ
diff --git a/external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/src.js b/external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/src.js
new file mode 100644
index 0000000..34fb3c1
--- /dev/null
+++ b/external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/src.js
@@ -0,0 +1,198 @@
+dojo.require("dojo.parser");
+
+dojo.require("dijit.Dialog");
+dojo.require("dijit.form.Button");
+dojo.require("dijit.layout.LayoutContainer");
+dojo.require("dijit.layout.ContentPane");
+dojo.require("dojox.analytics.Urchin")
+dojo.require("demos.flashCards.src.MathFlashCard");
+dojo.require("demos.flashCards.src.Teacher");
+
+//global storage point for our fade animations
+var messageFadeEvent = null;
+
+//reset the score board
+var resetScore = function(){
+ var card = dijit.byId("card");
+ dojo.byId("remainingTd").innerHTML = card.numberProblems;
+ dojo.byId("correctTd").innerHTML = 0;
+ dojo.byId("incorrectTd").innerHTML = 0;
+ dojo.byId("tooSlowTd").innerHTML = 0;
+ dojo.style("scoreTable", "display", "");
+};
+
+var goodAnswers = ["Great job. Did you know that doing math regularly keeps you sharp?", "Hey, this is correct, did you ever concider joining a math competition?", "I am impressed! Not so many students are good in math, congratulations!"];
+var indexGood = 0;
+var countGood = 0;
+
+var badAnswers = ["Hmm, you are letting me down! Did you practice enough?", "This is wrong, why don't you know such a simple answer?", "I might have to send you back to school, this is not good"];
+var indexBad = 0;
+
+var slowAnswers = ["Hmm, I thought you could have beena little faster to be honest", "You could have counted the result on your fingers my friend.", "Slow slow slow, what are we going to do about this?"];
+var indexSlow = 0;
+
+var countBad = 0;
+
+//start the flashcards, result of pressing "getStarted"
+var getStarted = function(){
+ dijit.byId("teacher").speak("Hi student! Let's go. Just enter the correct results and press enter.");
+
+ //call the card widgets getStarted() method
+ var c = dijit.byId("card");
+ c.getStarted();
+
+ //display(unhide) the card
+ dojo.style(c.domNode,"display","");
+
+ //hide the getStarted Button
+ dojo.style("start", "display", "none");
+
+ //reset the score board
+ resetScore();
+
+ //attach to the onCorrect event of the card. When this event happens
+ //we want to display a fading message and update the score board
+ dojo.connect(c, "onCorrect", function(e){
+ if (messageFadeEvent){
+ messageFadeEvent.stop();
+ }
+
+ countGood++;
+ countBad = 0;
+ if (countGood == 2){
+ dijit.byId("teacher").frown(false);
+ }
+
+ dojo.byId("correctTd").innerHTML = c.correctAnswers;
+
+ if (c.started){
+ dojo.byId("remainingTd").innerHTML = c.numberProblems - c.currentProblem;
+ // FIXME: which node?
+ dojo.removeClass("incorrect");
+ dojo.addClass("correct");
+
+ dijit.byId("teacher").speak(goodAnswers[indexGood], 5000);
+ indexGood++;
+ if (indexGood == goodAnswers.length) { indexGood=0; }
+ }
+ });
+
+ //attach to the onIncorrect event of the card. When this event happens
+ //we want to display a fading message and update the score board
+ dojo.connect(c, "onIncorrect", function(e){
+ if(messageFadeEvent){
+ messageFadeEvent.stop();
+ }
+
+ countBad++;
+ countGood = 0;
+ if (countBad == 2){
+ dijit.byId("teacher").frown(true);
+ }
+
+ dojo.byId("incorrectTd").innerHTML = c.incorrectAnswers;
+
+ if(c.started){
+ dojo.byId("remainingTd").innerHTML = c.numberProblems - c.currentProblem;
+ dojo.addClass("incorrect");
+ dojo.removeClass("correct");
+
+ dijit.byId("teacher").speak(badAnswers[indexBad], 5000);
+ indexBad++;
+ if (indexBad == badAnswers.length) { indexBad=0; }
+ }
+ });
+
+ //attach to the onTooSlow event of the card. When this event happens
+ //we want to display a fading message and update the score board
+ dojo.connect(c, "onTooSlow", function(e){
+ if(messageFadeEvent){
+ messageFadeEvent.stop();
+ }
+
+ countBad++;
+ countGood = 0;
+ if (countBad == 2){
+ dijit.byId("teacher").frown(true);
+ }
+
+ dojo.byId("tooSlowTd").innerHTML = c.tooSlow;
+
+ if(c.started){
+ dojo.byId("remainingTd").innerHTML = c.numberProblems - c.currentProblem;
+ // FIXME: which node?
+ dojo.addClass("incorrect");
+ dojo.removeClass("correct");
+
+ dijit.byId("teacher").speak(slowAnswers[indexSlow], 5000);
+ indexSlow++;
+ if (indexSlow == slowAnswers.length) { indexSlow=0; }
+ }
+
+ });
+
+ //attach to the onEnd event of the card. When this event happens
+ //we want to display a final message,update the score board, and show
+ //the restart button
+
+ dojo.connect(c, "onEnd", function(correct, total, slow){
+ if (messageFadeEvent){
+ messageFadeEvent.stop();
+ }
+
+ //create ending message/summary
+ var msg = "You got " + correct + " out of " + total + " correct.";
+ if(slow > 0){
+ msg += " You were too slow on ";
+ if(slow == 1){
+ msg += "1 problem.";
+ } else {
+ msg += slow + " problems.";
+ }
+ }
+
+ if (c.correctAnswers > 8){
+ dijit.byId("teacher").frown(false);
+ }
+
+ dijit.byId("teacher").speak(msg);
+
+ dojo.style(c.domNode, "display", "none");
+ dojo.style(dojo.byId("restart"), "display", "");
+ dojo.byId("remainingTd").innerHTML = "0";
+
+ });
+
+ //attach to the restart method of the card. We dont' want to reset the
+ //score onEnd since people want a chance to review their score, this won't
+ //happen until they actually click restart
+ dojo.connect(c, "restart", resetScore);
+};
+
+//the restart function
+var restart = function(){
+ dojo.style(dojo.byId("restart"),"display","none");
+ dojo.style(dijit.byId("card").domNode,"display","");
+ dijit.byId("teacher").speak("What a delightful student you are, keep practicing! Your way to success.");
+ dijit.byId("card").restart();
+};
+
+dojo.addOnLoad(function(){
+
+ dojo.parser.parse();
+
+ setInterval(function(){
+ dijit.byId("teacher").blink();
+ }, 2500);
+
+ // stall this just a little
+ setTimeout(function(){
+ new dojox.analytics.Urchin({
+ acct: "UA-3572741-1",
+ GAonLoad: function(){
+ this.trackPageView("/demos/flashCards");
+ }
+ });
+ }, 1500);
+
+}); \ No newline at end of file
diff --git a/external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/src/MathFlashCard.html b/external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/src/MathFlashCard.html
new file mode 100644
index 0000000..c2f9d55
--- /dev/null
+++ b/external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/src/MathFlashCard.html
@@ -0,0 +1,20 @@
+<div>
+ <table width="100%">
+ <tr>
+ <td dojoAttachPoint="topL"></td>
+ <td dojoAttachPoint="topR"></td>
+ </tr>
+ <tr>
+ <td dojoAttachPoint="bottomL"></td>
+ <td dojoAttachPoint="bottomR"></td>
+ </tr>
+ <tr>
+ <td colspan="2" class="dividerLine"></td>
+ </tr>
+ <tr>
+ <td dojoAttachPoint="answer" colspan=2 class="answerWrap">
+ <input dojoAttachPoint="answerInput" class="answerInput">
+ </td>
+ </tr>
+ </table>
+</div> \ No newline at end of file
diff --git a/external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/src/MathFlashCard.js b/external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/src/MathFlashCard.js
new file mode 100644
index 0000000..b426769
--- /dev/null
+++ b/external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/src/MathFlashCard.js
@@ -0,0 +1,159 @@
+dojo.provide("demos.flashCards.src.MathFlashCard");
+
+dojo.require("dijit._Widget");
+dojo.require("dijit._Templated");
+
+dojo.declare("dojofun.widget.MathFlashCard",
+ [dijit._Widget, dijit._Templated],
+ {
+ numberProblems: 20,
+ minInt: 0,
+ maxInt: 10,
+ timer: 15,
+ betweenTime: 5,
+ problemType: "addition",
+ currentProblem: 0,
+ correctAnswers: 0,
+ incorrectAnswers: 0,
+ problemSet: null,
+ started: false,
+ tooSlow: 0,
+
+ templatePath: dojo.moduleUrl("demos.flashCards","src/MathFlashCard.html"),
+
+ generateProblemSet: function(){
+ var problems=[];
+
+ if (this.problemType=="addition"){
+ for (var i=0; i<this.numberProblems; i++){
+ problems.push({
+ x: Math.floor(Math.random()*(this.maxInt+1)),
+ y: Math.floor(Math.random()*(this.maxInt+1)),
+ type: "addition"
+ });
+ }
+ }
+
+ return problems;
+ },
+
+ restart: function(){
+ this.problemSet = this.generateProblemSet();
+ dojo.forEach(["currentProblem","correctAnswers","incorrectAnswers","tooSlow"],
+ function(attr){
+ this[attr] = 0;
+ }, this)
+ this.renderProblem(0);
+ this.getStarted();
+ },
+
+ renderProblem: function(prob){
+ this.topR.innerHTML = this.problemSet[prob].x;
+ this.bottomR.innerHTML = this.problemSet[prob].y;
+ this.answerInput.value = "";
+ if (this.problemSet[prob].type == "addition"){
+ this.bottomL.innerHTML = "+";
+ }
+
+ if (this.started){
+ this.getStarted();
+ }
+
+ },
+
+ getStarted: function(){
+ dojo.style(this.domNode, "opacity", 100);
+ this.fadeOp = dojo.fadeOut({
+ node: this.domNode,
+ duration: (this.timer * 1000),
+ onEnd: dojo.hitch(this, "onTooSlow")
+ }).play();
+
+ if (!this.started){
+ this.started = true;
+ var func = dojo.hitch(dijit,"focus", this.answerInput);
+ this.connect(this.answerInput,"onblur", function(){
+ setTimeout(func, 10);
+ });
+ setTimeout(func, 10);
+ this.listenForKeyEvents();
+ }
+ },
+
+ listenForKeyEvents: function(){
+
+ this.onKeyDownEvent = this.connect(dojo.doc,"onkeydown", function(e){
+ var key = e.keyCode || e.charCode;
+ var k = dojo.keys;
+ switch(key){
+ case k.ENTER:
+ if(this.checkAnswer()){
+ this.onCorrect();
+ }else{
+ this.onIncorrect();
+ }
+ break;
+ }
+ });
+ },
+
+ stopListening: function(){
+ this.disconnect(this.onKeyDownEvent);
+ delete this.onKeyDownEvent;
+ },
+
+ checkAnswer: function(){
+ var prob = this.problemSet[this.currentProblem];
+
+ if(prob.type=="addition"){
+ var correct = prob.x + prob.y;
+ }
+ console.log(this.answerInput.value,"value");
+ if (correct && this.answerInput.value==correct){
+ return true;
+ }
+ },
+
+ onCorrect: function(){
+ this.correctAnswers++;
+ this.fadeOp.stop();
+ delete this.fadeOp;
+ if ((this.currentProblem+1)<this.problemSet.length){
+ this.renderProblem(++this.currentProblem);
+ } else {
+ this.onEnd(this.correctAnswers,this.problemSet.length,this.tooSlow);
+ }
+
+ },
+
+ onIncorrect: function(){
+ this.incorrectAnswers++;
+ this.fadeOp.stop();
+ delete this.fadeOp;
+ if ((this.currentProblem+1)<this.problemSet.length){
+ this.renderProblem(++this.currentProblem);
+ } else {
+ this.onEnd(this.correctAnswers,this.problemSet.length,this.tooSlow);
+ }
+ },
+
+ onTooSlow: function(){
+ this.tooSlow++;
+ if ((this.currentProblem+1)<this.problemSet.length){
+ this.renderProblem(++this.currentProblem);
+ } else {
+ this.onEnd(this.correctAnswers,this.problemSet.length,this.tooSlow);
+ }
+ },
+
+ onEnd: function(correct, set, tooSlow){
+ this.stopListening();
+ this.started=false;
+ },
+
+ postCreate:function(){
+ this.problemSet = this.generateProblemSet();
+ this.renderProblem(0);
+ }
+ }
+);
diff --git a/external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/src/Teacher.css b/external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/src/Teacher.css
new file mode 100644
index 0000000..980117e
--- /dev/null
+++ b/external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/src/Teacher.css
@@ -0,0 +1,69 @@
+div.teacher {
+ background: url("../images/teacher_body.png");
+ width: 187px;
+ height: 493px;
+ position: absolute;
+}
+
+div.beerLadyInner {
+ width: 187px;
+ height: 493px;
+ position:relative;
+ top:0; left:0;
+}
+
+div.teacherAngry {
+ background:url('../images/teacher_mouth_angry.png') no-repeat center center;
+ height:18px;
+ width:27px;
+ top:48px;
+ left:42px;
+}
+div.teacherBlink {
+ background:url('../images/teacher_eyes_closed.png') no-repeat center center;
+ top: 31px;
+ left: 33px;
+ width: 39px;
+ height: 19px;
+}
+
+div.teacherBlink,
+div.teacherAngry {
+ visibility:hidden;
+ position:absolute;
+}
+
+div.teacher .teacherBlinking .teacherBlink,
+div.teacher .teacherBeingAngry .teacherAngry {
+ visibility:visible;
+}
+
+div.teacherBubble {
+ background:url('../images/bubble.png') no-repeat center center;
+ width: 200px;
+ height: 130px;
+ position: absolute;
+ top: -105px;
+ left: 65px;
+}
+
+div.teacherSilent {
+ display: none;
+}
+
+div.teacherSpeaking {
+ display: inherit;
+}
+
+div.teacherBubbleContent {
+ position: absolute;
+ top: 10px;
+ left: 10px;
+ height: 50px;
+ left: 26px;
+ top: 25px;
+ width: 140px;
+ padding: 5px;
+ font-family: Tahoma;
+ text-align: center;
+} \ No newline at end of file
diff --git a/external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/src/Teacher.html b/external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/src/Teacher.html
new file mode 100644
index 0000000..caa5b97
--- /dev/null
+++ b/external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/src/Teacher.html
@@ -0,0 +1,9 @@
+<div class="teacher">
+ <div class="teacherInner" dojoAttachPoint="innerNode">
+ <div class="teacherAngry"></div>
+ <div class="teacherBlink"></div>
+ <div dojoAttachPoint="teacherBubbleOuter" class="teacherBubble teacherSilent">
+ <div dojoAttachPoint="teacherBubble" class="teacherBubbleContent"></div>
+ </div>
+ </div>
+</div> \ No newline at end of file
diff --git a/external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/src/Teacher.js b/external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/src/Teacher.js
new file mode 100644
index 0000000..0b6e8d7
--- /dev/null
+++ b/external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/src/Teacher.js
@@ -0,0 +1,58 @@
+dojo.provide("demos.flashCards.src.Teacher");
+
+dojo.require("dijit._Widget");
+dojo.require("dijit._Templated");
+dojo.require("dojox.timing.Sequence");
+
+dojo.declare("demo._TeacherBehavior", null, {
+
+ constructor: function(){
+ this._batEyes = [
+ { func: [dojo.hitch(this,"angry",true), this], pauseAfter:200 },
+ { func: [dojo.hitch(this,"blink",45), this], repeat: 3, pauseAfter: 100 },
+ { func: [dojo.hitch(this,"angry",false), this], pauseBefore:200 }
+ ];
+
+ },
+
+ bat: function(){
+ this.actions.go(this._batEyes);
+ }
+
+});
+
+dojo.declare("demo.Teacher", [dijit._Widget, dijit._Templated, demo._TeacherBehavior], {
+
+ templatePath: dojo.moduleUrl("demos.flashCards.src","Teacher.html"),
+
+ constructor: function(args, node){
+ dojo.mixin(this, args);
+ this.actions = new dojox.timing.Sequence({});
+ },
+
+ frown: function(/* Boolean */on){
+ var n = this.innerNode;
+ dojo[(on ? "addClass" : "removeClass")](n,"teacherBeingAngry");
+ },
+
+ blink: function(closeDuration, forced){
+ if(this._blinking && !forced){ clearTimeout(this._blinking); }
+ dojo.addClass(this.innerNode, "teacherBlinking");
+ this._blinking = setTimeout(dojo.hitch(this,function(){
+ dojo.removeClass(this.innerNode,"teacherBlinking");
+ }), closeDuration || 275);
+ },
+
+ speak: function(speach, timeout){
+ if (!timeout) { timeout = 5000; }
+
+ this.teacherBubble.innerHTML = speach;
+ dojo.addClass(this.teacherBubbleOuter, "teacherSpeaking");
+
+ if (this._timeout) { clearTimeout(this._timeout); }
+ this._timeout = setTimeout(dojo.hitch(this, function(){
+ dojo.removeClass(this.teacherBubbleOuter, "teacherSpeaking")
+ }), timeout);
+ }
+
+});
diff --git a/external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/src/tests/test_Teacher.html b/external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/src/tests/test_Teacher.html
new file mode 100644
index 0000000..e3a9ff3
--- /dev/null
+++ b/external/ZendFramework-1.9.5/externals/dojo/demos/flashCards/src/tests/test_Teacher.html
@@ -0,0 +1,46 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html lang="en">
+<head>
+
+ <title>Did you practice your Dojo today?</title>
+
+ <link type="text/css" rel="stylesheet" href="../Teacher.css">
+
+ <script type="text/javascript" src="../../../../dojo/dojo.js"></script>
+
+ <script type="text/javascript">
+ dojo.require("demos.flashCards.src.Teacher");
+
+ dojo.addOnLoad(function(){
+
+ var lady = new demo.Teacher({
+ id:"lady1",
+ style: "top: 200px; left: 200px"
+ }).placeAt(dojo.body(),"last");
+
+ var words = ["Hi friend", "How are you?", "Lets practice your math."];
+ var counter = 0;
+
+ setTimeout(dojo.hitch(lady,"frown"), 1500);
+ setTimeout(dojo.hitch(lady,"frown", false), 3500);
+ setInterval(dojo.hitch(lady,"blink"), 2500);
+
+ var smiling = false;
+ dojo.connect(lady.domNode,"onclick", lady, function(){
+ smiling = !smiling;
+ this.frown(smiling);
+
+ this.speak(words[counter]);
+ counter++;
+ if (counter == words.length) counter = 0;
+ });
+
+ });
+ </script>
+
+</head>
+<body>
+
+
+</body>
+</html>