View Source

<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[{zone-template-instance:ZFPROP:Proposal Zone Template}




1.0 - 27 May 2008: Initial Draft.

Using dojo requires a number of view integration points; these include requiring the dojo.js file itself, dojo.require calls, loading appropriate stylesheets, etc. ZF should make including these as easy as possible.

* [Dojo Toolkit Manual|]

* MUST be a single view helper with multiple methods
* MUST be able to render as string
* MUST have methods for setting dojo include metadata
** MUST support using via CDN, using specified version
*** SHOULD allow specifying either AOL or Google as CDN
** MUST support using local install, via path
** MUST allow specifying djConfig key/value pairs
** SHOULD default to CDN if no path specified
* MUST have method for requiring components
** MUST have method for specifying module paths
* MUST emit default dojo.js stylesheet
** SHOULD default to CDN location if no path specified
** MUST allow specifying CDN version
** MUST allow specifying dojo install location by local path
** MUST allow specifying dijit themes by module

* Zend_View_Exception
* Zend_View_Helper_Placeholder

This component provides a fluent, PHP5 interface for programmatically setting up your Dojo environment within your view scripts. You may specify whether Dojo loads from a local path or the AOL CDN, paths to any custom modules, stylesheet modules to use, and more. Within your layout script, you will then echo the placeholder to setup the appropriate style and script tags based on the settings provided.

* Milestone 1: \[DONE\] Prepare API
* Milestone 2: Publish this proposal
* Milestone 3: Complete first working code and tests
* Milestone 4: Write documentation

* Zend_View_Helper_Dojo

h3. require a dojo component:

h3. register a module path
$this->dojo()->registerModulePath('custom', '../custom')

h3. tell dojo to use the CDN, version 1.0

h3. tell dojo to use the Google CDN

h3. tell dojo to use local install

h3. tell dojo to parse on load
$this->dojo()->setDjConfig('parseOnLoad', 'true');

h3. specify a stylesheet by module notation

h3. require a custom stylesheet

h3. specify a function to run onLoad

h3. specify an object method to run onLoad
$this->dojo()->addOnLoad('foo', 'bar'); //

h3. capture JS to use as a named callback to run onLoad
<? $this->dojo()->onLoadCaptureStart('foo') ?>
<? $this-.dojo()->onLoadCaptureStop('foo') ?>

h3. enable dojo (minimally, loads dojo.js and dojo.css)

h3. disable dojo (will not enable any functionality when rendered)

h3. test if dojo is enabled
if ($this->dojo()->isEnabled()) {

h3. echo the dojo requirements
<?= $this->dojo() ?>

class Zend_View_Helper_Dojo extends Zend_View_Helper_Placeholder_Container_Standalone
const CDN_AOL_BASE = '';

const CDN_GOOGLE_BASE = '';

const CDN_DOJO_PATH = '/dojo/dojo.xd.js';

public $view;

public function setView(Zend_View_Interface $view);

public function enableDojo();

public function disableDojo();

public function isEnabled();

public function requireModule($module);

public function getModules();

public function registerModulePath($path);

public function getModulePaths();

public function setCdnVersion($version = null);

public function getCdnVersion();

public function setCdn($cdn = 'aol');

public function getCdn();

public function setLocalPath($path);

public function getLocalPath();

public function useLocalPath();

public function setDjConfig($option, $value);

public function getDjConfig($option = null);

public function addStyleSheetModule($module);

public function getStyleSheetModules();

public function addStyleSheet($path);

public function getStyleSheets();

public function addOnLoad($script);

public function getOnLoadActions();

public function onLoadCaptureStart($action);

public function onLoadCaptureStop($action);

public function dojo();

public function __toString();