Permalink
Browse files

More work in progress. index.html is mangled

and other stuff is mangled.
  • Loading branch information...
bvds committed Dec 27, 2013
1 parent daa7413 commit c1266a35d1bdafed8a971889e8797efe3b532385
Showing with 98 additions and 39 deletions.
  1. +6 −5 web-UI/andes/error.js
  2. +5 −3 web-UI/andes/help.js
  3. +3 −2 web-UI/andes/principles.js
  4. +7 −4 web-UI/andes/startup.js
  5. +4 −3 web-UI/andes/timer.js
  6. +13 −10 web-UI/andes/tracking.js
  7. +60 −12 web-UI/index.html
View
@@ -6,9 +6,8 @@ define([
"dojo/_base/declare",
"dijit/Dialog",
"dijit/form/Button"
-],function(andes,ready,declare,dialog){
+], function(andes,ready,declare,dialog){
- var dialog = null;
andes.errorLog = function(spec){
dojo.xhrPost({
@@ -95,6 +94,7 @@ define([
}
});
+ if(false){
ready(function(){
dialog = new _Error({
id: "andesErrorDialog",
@@ -103,14 +103,15 @@ define([
});
// This clobbers any existing onerror handler.
- // Perhaps one should use addHandler instead.
window.onerror = function(msg, url, line){
andes.errorLog({
title: "javascript-error",
message: url + ":" + line + " " + msg
});
- console.log("Window error: ",msg," url: ",url, " line: ",line);
+ console.log("Window error: ",msg,"; url: ",url, "; line: ",line,".");
+ // Returning 'false' triggers the execution of the built-in error handler.
+ return !dojoConfig.isDebug;
}
});
-
+ };
});
View
@@ -1,8 +1,10 @@
define([
"andes/startup",
"dojo/on",
+ "dojox/drawing/util/typeset",
+ "dojo/ready",
"andes/api"
-],function(andes,on){ // Pre-AMD version had a function wrapper.
+],function(andes,on,typeset,ready){ // Pre-AMD version had a function wrapper.
// It would be better that this module returns an object called "help."
// This is just to get things working with minimal changes to the pre-AMD version.
@@ -98,7 +100,7 @@ define([
dijit.byId("helpPane").open();
var style = r.style ? " class=\""+ r.style + "\"":"";
// Student math symbols may be echoed in help statements.
- hlp.containerNode.innerHTML = c + "\n<p" + style +">" + dojox.drawing.util.typeset.convertLaTeX(r.text) + "</p>";
+ hlp.containerNode.innerHTML = c + "\n<p" + style +">" + typeset.convertLaTeX(r.text) + "</p>";
break;
case "echo-get-help-text":
dijit.byId("helpPane").open();
@@ -128,7 +130,7 @@ define([
hlp.domNode.scrollTop = hlp.domNode.scrollHeight;
}
- dojo.addOnLoad(function(){
+ ready(function(){
on(dijit.byId("helpSubmit"), "onClick", function(){
var q = dijit.byId("helpInput").get("value"),
h = q ? {action:"get-help", text:q} : {action:"help-button"};
@@ -1,9 +1,10 @@
define([
"andes/principles",
"dojo/on",
+ "dojo/ready",
"dijit/Tree",
"dojo/data/ItemFileReadStore"
-],function(andes,on){
+],function(andes,on,ready){
// See review/principles-tree.html
dojo.ready(function(){ // wait until dom is loaded
@@ -85,7 +86,7 @@ andes.principles={
}
// This should be loaded after everything else, in the background
-dojo.addOnLoad(function() {
+ready(function() {
var principlesStore = new dojo.data.ItemFileReadStore({
url: "../review/principles.json"
View
@@ -6,8 +6,9 @@ define([
"dojo/json",
'dojo/_base/unload',
"andes/WordTip",
- "dojo/on"
-],function(cookie,ready,ioQuery,json,baseUnload,wordTip,on){ // Pre-AMD version had a function wrapper.
+ "dojo/on",
+ "dojo/ready"
+],function(cookie,ready,ioQuery,json,baseUnload,wordTip,on,ready){ // Pre-AMD version had a function wrapper.
// In the pre-AMD version, andes was a global variable
// Here we make it the object returned by this module.
@@ -90,12 +91,14 @@ define([
// but don't clear cookie
});
- dojo.addOnLoad(function(){
+ ready(function(){
// WordTip needs to be added before conEdit is removed by drawing
andes.WordTip = new wordTip();
// Problem close actions set
- on(dojo.byId("submitButton"), "click", function(){
+ submitButton=dojo.byId("submitButton");
+ console.log("About to connect submit button ",submitButton);
+ on(submitButton, "click", function(){
// Needs to be non-blocking
var closer = andes.api.close({});
closer.then(function(result){
View
@@ -1,6 +1,7 @@
define([
- "dojo/_base/declare"
-], function(declare){
+ "dojo/_base/declare",
+ "dojo/ready"
+], function(declare,ready){
return declare(null,{
// summary:
@@ -11,7 +12,7 @@ define([
ready:false,
constructor: function(st){
this.startTime = st;
- dojo.addOnLoad(this, function(){
+ ready(this, function(){
this.node = dojo.byId("timer");
this.ready = true;
if(this.display) this.displayTimer(true);
View
@@ -1,21 +1,24 @@
+/* global define, dojo */
define([
- "andes/drawing",
- "andes/startup",
- "dojo/on",
- "dijit/registry",
- "dojo/ready",
- "dojo/aspect"
+ "andes/drawing",
+ "andes/startup",
+ "dojo/on",
+ "dijit/registry",
+ "dojo/ready",
+ "dojo/aspect"
],function(drawing,andes,on,registry,ready,aspect){
// New to AMD version: this was pulled out of drawing.js
-
+
ready(function(){
- _drawing = registry.byId("drawing");
+ var _drawing = registry.byId("drawing");
console.log("got drawing widget: ",_drawing);
- // This was dojo.connect in pre-AMD version
+ // This was dojo.connect in pre-AMD version
var cn = aspect.after(_drawing, "onSurfaceReady", function(){
cn.remove();
andes.WordTip.add(_drawing);
- drawing.onSurfaceReady();
+ // This was in the pre-AMD version
+ // This seems to lead to a recursion?
+ // andes.drawing.onSurfaceReady();
if(_drawing.stencils){
console.warn("Label double click connected");
on(_drawing.stencils, "onLabelDoubleClick", drawing, "onLabelDoubleClick");
View
@@ -3,29 +3,74 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>Andes Physics Tutor</title>
- <script type="text/javascript">
+ <script type="text/javascript">
dojoConfig = {
isDebug:true,
parseOnLoad:true,
- async: true,
- popup:true,
- baseUrl: "./",
- packages: [
+ // async: true,
+ // popup:true,
+ baseUrl: "./",
+ packages: [
{name: "dojo", location: "dojo"},
{name: "dijit", location: "dijit"},
{name: "dojox", location: "dojox"},
- {name: "andes", location: "andes"}]
+ {name: "andes", location: "andes"}
+ ]
};
if(dojoConfig.isDebug){
document.write('<link href="css/andes.css" rel="stylesheet" />');
- document.write('<scr'+'ipt src="dojo/dojo.js"></scr'+'ipt>');
+ // document.write('<scr'+'ipt src="dojo/dojo.js"></scr'+'ipt>');
}else{
document.write('<link href="release/dojo/css/andes.css" rel="stylesheet" />');
document.write('<scr'+'ipt src="release/dojo/dojo/dojo.js"></scr'+'ipt>');
};
</script>
+ <script src="dojo/dojo.js"></script>
<script type="text/javascript">
- require([
+if(false){
+ // From dojox/drawing/tests/test_drawing_toolbar.html
+
+ dojo.require("dojo.parser");
+ dojo.require("dojox.drawing");
+}
+if(true){
+ // custom Tools and Plugins need to be required
+ dojo.require("dojox.drawing.tools.TextBlock");
+ dojo.require("dojox.drawing.tools.Rect");
+ dojo.require("dojox.drawing.tools.Ellipse");
+ dojo.require("dojox.drawing.tools.Line");
+ dojo.require("dojox.drawing.tools.Path");
+
+ dojo.require("dojox.drawing.annotations.Label");
+ dojo.require("dojox.drawing.annotations.Angle");
+ dojo.require("dojox.drawing.annotations.Arrow");
+ dojo.require("dojox.drawing.annotations.BoxShadow");
+};
+if(true){
+ dojo.require("dojox.drawing.tools.custom.Vector");
+ dojo.require("dojox.drawing.tools.custom.Axes");
+ dojo.require("dojox.drawing.tools.Arrow");
+ dojo.require("dojox.drawing.plugins.tools.Pan");
+ dojo.require("dojox.drawing.plugins.tools.Zoom");
+ dojo.require("dojox.drawing.plugins.drawing.Grid");
+ dojo.require("dojox.drawing.plugins.drawing.GreekPalette");
+};
+if(true){
+ dojo.require("dojox.drawing.ui.Toolbar");
+ dojo.require("dojox.drawing.ui.Button");
+ dojo.require("dojox.drawing.library.icons");
+};
+ // Stuff I added to get it to work
+if(false){
+ dojo.require("dijit.layout.BorderContainer");
+ dojo.require("dijit/MenuBar");
+ dojo.require("dijit/PopupMenuBarItem");
+ dojo.require("dijit/Menu"); // not in original require
+ dojo.require("dijit/form/Button"); // not in original
+};
+
+if(true){
+require([
"dojo/parser","andes",
"dijit/MenuBar","dijit/PopupMenuBarItem",
"dijit/layout/BorderContainer",
@@ -36,9 +81,12 @@
"dojox/drawing/plugins/drawing/GreekPalette",
"dojox/widget/DialogSimple",
"dijit/form/NumberSpinner",
- "dijit/form/ToggleButton"
+ "dijit/form/ToggleButton",
+ "dijit/layout/ContentPane"
]);
- </script>
+};
+
+</script>
</head>
<body class="tundra">
<div id="splashOverlay"></div>
@@ -75,9 +123,9 @@
<div id="timer"></div>
<div data-dojo-type="dijit.form.Button" id="submitButton" style="position:absolute; top:0; right:10px; margin:0;">Submit</div>
</div>
-
<div id="toolPane" data-dojo-type="dijit.layout.ContentPane" region="left" splitter="false">
- <div data-dojo-type="dojox.drawing.ui.Toolbar" id="gfxToolbarNode" drawingId="drawing" class="gfxToolbar" orient="V" tools="line,rect,ellipse,textBlock,equation,vector,axes" plugs="all" selected=""></div>
+ <!-- BvdS: for testing, remove explicit tool selection: line,rect,ellipse,textBlock,equation,vector,axes -->
+ <div data-dojo-type="dojox.drawing.ui.Toolbar" id="gfxToolbarNode" drawingId="drawing" class="gfxToolbar" orient="V" tools="all" plugs="all" selected=""></div>
</div>
<div id="drawingPane" data-dojo-type="dijit.layout.ContentPane" region="center" >
<div data-dojo-type="dojox.drawing.Drawing" id="drawing" data-dojo-id="myDrawing" class="drawing" defaults="andes.defaults">

0 comments on commit c1266a3

Please sign in to comment.