Skip to content

Commit

Permalink
hiding programs.
Browse files Browse the repository at this point in the history
  • Loading branch information
dyoo committed Apr 12, 2013
1 parent 06154d3 commit 97fc56a
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 8 deletions.
11 changes: 10 additions & 1 deletion war-src/js/openEditor/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,16 @@ var WeSchemeEditor;
"/openEditor?publicId=" +
encodeURIComponent(aProgram.getPublicId()));
that.filenameEntry.attr("value", aProgram.getTitle());
that.defn.setCode(aProgram.getSourceCode());

if (attrs.pid) {
that.defn.setCode(aProgram.getSourceCode());
} else {
if (attrs.publicId && aProgram.isSourcePublic()) {
that.defn.setCode(aProgram.getSourceCode());
} else {
that.defn.setCode(";; << Source code has not been shared >>");
}
}

if (that.userName === aProgram.getOwner()) {
that._setIsOwner(true);
Expand Down
37 changes: 35 additions & 2 deletions war-src/js/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
// interactive evaluation.

goog.require("plt.wescheme.AjaxActions");
goog.require("plt.wescheme.WeSchemeProperties");
goog.require("plt.wescheme.makeDynamicModuleLoader");

goog.require("plt.wescheme.RoundRobin");
goog.provide("plt.wescheme.runner");

(function() {
Expand Down Expand Up @@ -96,6 +97,32 @@ goog.provide("plt.wescheme.runner");
};


// Configures the evaluator to use round-robin compilation between
// a set of servers. Compilation will also fall back to other
// servers under network failure.
var initializeRoundRobinCompilation = function(evaluator, after) {
var that = this;
// Initializes the evaluator to use round-robin compilation, given a list of
// servers.
var compilation_servers = plt.wescheme.WeSchemeProperties.compilation_servers.split(/\s+/);
plt.wescheme.RoundRobin.initialize(
compilation_servers,
function() {
evaluator.setCompileProgram(
plt.wescheme.RoundRobin.roundRobinCompiler);
after();
},
function() {
// Under this situation, all compilation servers are inaccessible.
evaluator.setCompileProgram(plt.wescheme.RoundRobin.roundRobinCompiler);
alert("WeScheme appears to be busy or unavailable at this time." +
" Please try again later.");
after();
});
};




function init(compilationServerUrl, publicId) {
var runner =
Expand Down Expand Up @@ -146,10 +173,16 @@ goog.provide("plt.wescheme.runner");
if (programCode) {
runner.runCompiledCode(programCode, permissions);
} else {


///
// FIXME: add call to queue/retrieve a server-side compilation here.
///
runner.runSourceCode(title, sourceCode, permissions);
// Only do this if we have no other choice.
initializeRoundRobinCompilation(runner.evaluator,
function() {
runner.runSourceCode(title, sourceCode, permissions);
});
}
};
new plt.wescheme.AjaxActions().loadProject(
Expand Down
5 changes: 0 additions & 5 deletions war-src/js/sharingdialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,6 @@ goog.require("plt.wescheme.WeSchemeIntentBus");

// Quietly ignore errMessage.
// We'll deal with it during Run time.
try {
if (console.log && errMessage) {
console.log(errMessage);
}
} catch(e) {}
//
// // Add error message content if something weird happened during the build.
// if (errMessage !== false) {
Expand Down
4 changes: 4 additions & 0 deletions war/run.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@

<script src="/js/jquery/jquery-1.3.2-min.js" type="text/javascript"></script>
<script src="/editor/jquery.createdomnodes-min.js" type="text/javascript"></script>
<script src="/js/easyXDM/easyXDM-min.js" type="text/javascript"></script>
<script type="text/javascript">
easyXDM.DomHelper.requiresJSON("/js/easyXDM/json2-min.js");
</script>
<script src="/js/mzscheme-vm/support-min.js" type="text/javascript"></script>
<script src="/js/mzscheme-vm/evaluator-min.js" type="text/javascript"></script>
<script src="/js/loadScript-min.js" type="text/javascript"></script>
Expand Down

0 comments on commit 97fc56a

Please sign in to comment.