Permalink
Browse files

more work in progress

  • Loading branch information...
bvds committed Dec 24, 2013
1 parent 27a80d2 commit fc2e7aa487b34aabd932d391ac40459c0b040861
View
@@ -1,4 +1,6 @@
-define([],function(){
+define([
+ "andes/startup"
+],function(andes){
andes.Combo = dojox.drawing.util.oo.declare(
// summary:
@@ -1,5 +1,7 @@
// Pre-AMD version had a function wrapper.
-define([],function(){
+define([
+ "andes/startup"
+],function(andes){
// Summary:
// User preferences that can be saved are registered here.
View
@@ -1,4 +1,7 @@
-define(['dojo/_base/declare'], function(declare){
+define([
+ 'dojo/_base/declare',
+ 'andes/startup'
+], function(declare,andes){
return declare(null, {
// Summary:
View
@@ -1,10 +1,11 @@
define([
- "andes/api",
+ "andes/startup",
"andes/rpc",
+ "andes/timer",
+ "andes/api",
"andes/error",
- "andes/messages",
- "andes/timer"
-],function(){ // Pre-AMD version had a function wrapper.
+ "andes/messages"
+],function(andes,rpc,timer){ // Pre-AMD version had a function wrapper.
var startTime = null,
requestInFlight = false,
@@ -37,7 +38,7 @@ define([
var request = prepRequest(req.params);
requestInFlight = true;
req.startTime = (new Date()).getTime();
- andes.rpc[req.method](request).addCallbacks(
+ rpc[req.method](request).addCallbacks(
function(result){
requestInFlight = false;
var dt=(new Date()).getTime()-req.startTime;
@@ -124,7 +125,7 @@ define([
open: function(params){
//console.info("andes.api.open", params);
startTime = (new Date()).getTime();
- andes.timer = new andes.timer(startTime);
+ andes.timer = new timer(startTime);
var dfd = queueRequest("open-problem", params);
dfd.addCallback(function(result){
View
@@ -1,5 +1,7 @@
// Pre-AMD version had a function wrapper.
-define([],function(){
+define([
+ "andes/startup"
+],function(andes){
return {
// summary:
View
@@ -1,5 +1,7 @@
// Pre-AMD version had a function wrapper.
-define([],function(){
+define([
+ "andes/startup"
+],function(andes){
return {
// summary:
View
@@ -1,5 +1,12 @@
// Pre-AMD version had a function wrapper.
-define(["dojo/cookie","andes/startup"],function(cookie){
+define([
+ "dojo/cookie",
+ "andes/startup"
+],function(cookie,andes){
+
+ // It would be better that this module returns an object called "drawing."
+ // This is just to get things working with minimal changes to the pre-AMD version.
+ andes.drawing={};
cookie("mikeDev", null, { expires: -1 });
View
@@ -1,9 +1,10 @@
// Pre-AMD version had provides for "andes.error" and "andes.error._Error"
// Pre-AMD version had a function wrapper.
define([
+ "andes/startup",
"dijit/Dialog",
"dijit/form/Button"
-],function(){
+],function(andes){
var dialog = null;
View
@@ -1,6 +1,71 @@
define([
+ "andes/startup",
"andes/api"
-],function(){ // Pre-AMD version had a function wrapper.
+],function(andes){ // 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.
+ andes.help={};
+
+ andes.help.echo = function(value){
+ // summary:
+ // Echo any input text in the Tutor pane.
+ //
+ if(value == '!'){
+ value = "Ha! A rotten easter egg!";
+ }
+ if(value.length>0){
+ var hlp = dijit.byId("helpContentPane");
+ var c = hlp.get("content");
+ // note:
+ // setting to the node and not with attr
+ // because ContentPane is throwing errors that way
+ hlp.containerNode.innerHTML = c + "\n<p><span class=\"comment\">" + value + "</span></p>";
+ hlp.domNode.scrollTop = hlp.domNode.scrollHeight;
+ }
+ };
+
+ andes.help.processStep = function(result){
+ // summary:
+ // look for any help coming back from the server (such as in
+ // the results from andes.api.step()
+ handleHelp(result);
+ };
+
+ andes.help.explain = function(s){
+ andes.api.help({action:"get-help", value:s}).addCallback(handleHelp);
+ };
+
+ andes.help.principles = function(s){
+ andes.api.help({action:"principles-menu", value:s}).addCallback(handleHelp);
+ };
+
+ andes.help.link = function(href){
+ // summary:
+ // Calls api after a link in Tutor pane has been clicked.
+ dojo.xhrGet({
+ url: href,
+ handleAs: "text",
+ load: function(result){
+ // FIXME: This is untested. Should we stuff the content directly into the pane like this?
+ dijit.byId("helpContentPane").attr("content", result);
+ }
+ });
+ };
+
+ andes.help.score = function(value){
+ // summary:
+ // updates score
+ return dijit.byId("helpPane").score(value);
+ };
+
+ andes.help.link = function(name,value){
+ var s={type: "tutor-link",name: name};
+ if(value){
+ s.value=value; // value is optional
+ }
+ andes.api.recordAction(s);
+ };
function handleHelp(result){
// summary:
@@ -76,64 +141,5 @@ define([
});
});
- andes.help.echo = function(value){
- // summary:
- // Echo any input text in the Tutor pane.
- //
- if(value == '!'){
- value = "Ha! A rotten easter egg!";
- }
- if(value.length>0){
- var hlp = dijit.byId("helpContentPane");
- var c = hlp.get("content");
- // note:
- // setting to the node and not with attr
- // because ContentPane is throwing errors that way
- hlp.containerNode.innerHTML = c + "\n<p><span class=\"comment\">" + value + "</span></p>";
- hlp.domNode.scrollTop = hlp.domNode.scrollHeight;
- }
- };
-
- andes.help.processStep = function(result){
- // summary:
- // look for any help coming back from the server (such as in
- // the results from andes.api.step()
- handleHelp(result);
- };
-
- andes.help.explain = function(s){
- andes.api.help({action:"get-help", value:s}).addCallback(handleHelp);
- };
-
- andes.help.principles = function(s){
- andes.api.help({action:"principles-menu", value:s}).addCallback(handleHelp);
- };
-
- andes.help.link = function(href){
- // summary:
- // Calls api after a link in Tutor pane has been clicked.
- dojo.xhrGet({
- url: href,
- handleAs: "text",
- load: function(result){
- // FIXME: This is untested. Should we stuff the content directly into the pane like this?
- dijit.byId("helpContentPane").attr("content", result);
- }
- });
- };
-
- andes.help.score = function(value){
- // summary:
- // updates score
- return dijit.byId("helpPane").score(value);
- };
-
- andes.help.link = function(name,value){
- var s={type: "tutor-link",name: name};
- if(value){
- s.value=value; // value is optional
- }
- andes.api.recordAction(s);
- };
});
View
@@ -1,16 +1,17 @@
define([
+ "andes/drawing",
+ "andes/startup",
// In the pre-AMD version, these were all after the body of main.js:
"andes/defaults",
"andes/PreferenceRegistry",
"andes/convert",
- "andes/drawing",
"andes/menu",
"andes/help",
"andes/api",
"andes/error",
"andes/variablename"
-],function(){
+],function(drawing){
// Pre-AMD body of main.js moved to startup.js.
// Pre-AMD version had "andes.drawing.load();" at very end of the file.
- andes.drawing.load();
+ drawing.load();
});
View
@@ -2,14 +2,14 @@ define([
"dojo/dom",
"dijit/registry",
"andes/startup",
+ "dojo/ready",
"andes/options",
"dijit/Menu",
"dijit/MenuSeparator",
- "dojo/domReady!"
-],function(dom,registry,andes){
+],function(dom,registry,andes,ready){
// In the pre-AMD version, the body was wrapped
// in "dojo.addOnLoad(function(){ ... })
-
+ ready(function(){
// Add problem name to menu
dom.byId("problemName").innerHTML = andes.projectId;
@@ -83,17 +83,11 @@ define([
// Setup contextMenu and children
andes.contextMenu = new dijit.Menu();
- require(["dojo/ready","dijit/registry","andes/startup"],
- function(ready,registry,andes){
- ready(function(){
- // parser.parse();
var contextOptions = {};
for(var i in spec){
wireItem(i, spec[i]);
contextItem(i, spec[i]);
}
- });
- });
function contextItem(desc, fn){
var label = registry.byId(desc).get("label");
@@ -132,4 +126,5 @@ define([
function updateContext(){
console.log("yeps");
}
+ });
});
View
@@ -1,4 +1,6 @@
-define([], function(){
+define([
+ "andes/startup"
+], function(andes){
// This files contains general message strings
// used for error handling (and could be used
View
@@ -1,6 +1,7 @@
define([
+ "andes/startup",
"dijit/ColorPalette"
-],function(){
+],function(andes){
dojo.declare("andes.options",null,{
// Summary:
@@ -1,7 +1,8 @@
define([
+ "andes/principles",
"dijit/Tree",
"dojo/data/ItemFileReadStore"
-],function(){
+],function(andes){
// See review/principles-tree.html
dojo.ready(function(){ // wait until dom is loaded
View
@@ -1,4 +1,7 @@
-(function(){
+define([
+ "andes/startup"
+],function(andes){
+
var self = this;
var andes = window.opener.andes;
this.onfocus = function(){
@@ -20,4 +23,4 @@
andes.drawing.onWindowBlur.call(self);
//andes.api.recordAction({type:"window", name: "IntroVideo", value: "blur"});
}
-})();
+});
View
@@ -1,12 +1,13 @@
define([
+ "andes/startup",
"dojox/rpc/Service",
"dojox/rpc/JsonRPC",
"dojox/json/schema"
-],function(){
+],function(andes,rpc){
// summary:
// This stub is in place to make andes.rpc a swappable oject
// for other potential server connections, such as CometD.
- andes.rpc = new dojox.rpc.Service(require.toUrl("andes", "andes3.smd"));
+ return new rpc(require.toUrl("andes/andes3.smd"));
});
Oops, something went wrong.

0 comments on commit fc2e7aa

Please sign in to comment.