Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
A development sandbox geared toward dojo development
PHP JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
app
design
sql
.gitmodules
README
deploy-local.sh
deploy.sh

README

GETTING STARTED
---------------

To get the dojo-sandbox repo in a local dir:

$ git clone https://github.com/neekfenwick/dojo-sandbox.git

..edit files..

$ git commit -a
$ git push

dojo-sandbox runs off a custom build of dojo called dojo-sandbox, as well as
having various versions of dojo available for running each sandbox.  The actual
dojo-sandbox app lives in app/public/lib/dojo in which there are:

dojo - submodule pointing to github.com/dojo/dojo.git
dijit - submodule pointing to github.com/dojo/dijit.git
dojox - submodule pointing to github.com/dojo/dojox.git
util - submodule pointing to github.com/dojo/util.git
sandbox - our custom dijits for the dojo-sandbox GUI

To build the dojo-sandbox custom build to lib/dojo:

$ cd app/public/config
$ ./build-sandbox-dojo.js

To build all the versions of dojo available when running sandboxes, run the build script to run the build process in each one:

$ cd app/public/config
$ ./build-all-dojo.sh

This fetches and builds all the versions of dojo that are available in dojo-sandbox to run your buckets against (1.7.0, 1.7.2, 1.7.2, 1.7.3, 1.8.0 etc).

All libraries (dojo-sandbox and the various dojo-* builds) are built into app/lib,
not their respective <dojo-sdk-dir>/release directories.  You should get a set
of custom builds:

app/lib/dojo-1.4.3
app/lib/dojo-1.4.3-nooptimize
app/lib/dojo-1.5.0
.. etc

CALLING THE APP
---------------

For development, we have the option of running compiled or non-compiled versions of the code, and whether we include the layer .js files or not.  Note that debug=1 and no*layer=1 are incompatible, because the -src dir doesn't have the layer files.

To run in 'build' mode, using dojo in lib/dojo-sandbox and built layers (the default):
http://myserver.com/index.php

To run in 'debug' mode, using dojo in lib/dojo (i.e. unoptimised code, for developing dojo-sandbox itself):
http://myserver.com/index.php?debug=1

Turning on 'debug':
- uses the SDK version of dojo for the sandbox frontend
- uses the source 'app/lib/dojo//sandbox' directory for the sandbox/* modules
- turns on "debug: true" in djConfig

SETTING UP THE VIRTUAL HOST
-----------------

Its important to set AllowOverride All because in /public/backend/ is a .htaccess file that wraps all requests to the index.php

<VirtualHost *:80>
    	DocumentRoot "path/to/public"
    	ServerName dojo-sandbox.localhost
	
	<Directory "path/to/public">
		DirectoryIndex index.html index.php
    		AllowOverride All
		Order allow,deny
		Allow from all
	</Directory>
</VirtualHost>

CALLING DOJO-SANDBOX FROM EXTERNAL SYSTEMS
------------------------------------------

You may want to throw html/js/css at dojo-sandbox and be given a working frontend
where the code is runnable/editable.  To do this, use a similar system to that
employed by the "Save As New" feature in dojo-sandbox itself:

POST {
  save_as_new: 1
  name: 'something'
  description: 'something'
  dojo_version: '1.5.0'
  dj_config: 'parseOnLoad: true'
  html: '<p>woo</p>
  js: 'console.log("woo");'
  css: 'BODY { background: red; }'
  layers: 'dijit-all'
}

You should get a resonse to your post such as:

{"namespace":"public","id":"639df","version":0,"session_id":705557}

There is now a database entry on dojo-sandbox for this 'bucket', /public/639df/0,
which can be accessed via the frontend at http://dojo-sandbox.net/public/639df/0.
Alternatively, the contents has also been stored in a session variable and can
be run directly with http://dojo-sandbox.net/backend/run/index/session_id/705557.

EMBEDDING DOJO-SANDBOX VIA A DIALOG
-----------------------------------

Experimental sandbox/BucketButton and sandbox/BucketDialog dijits exist which
can be used to launch a bucket in a standalone dialog, their content enclosed
in an iframe and so distinct from the rest of the page's contents.  For example:

http://dojo-sandbox-local.com/lib/sandbox/tests/test_BucketButton.html

The BucketDialog may be instantiated with "showSource: false" to make it just
show the iframe, or "showSource: true" (default) to make it display a TabContainer
with html/js/css panes as well as the Run pane.

At present it's very basic and doesn't try to syntax highlight or present its
content well.  Anyone interested in this should speak to the project maintainers
to talk about the future direction of these modules.

--
End of file.
Something went wrong with that request. Please try again.