[Solar-svn] Revision 2878
pmjones at solarphp.com
pmjones at solarphp.com
Sun Oct 14 09:50:34 CDT 2007
cleaning up "hold" directory with expanded names
Deleted: hold/Auth_Adapter_Multi.php
===================================================================
--- hold/Auth_Adapter_Multi.php 2007-10-14 14:40:10 UTC (rev 2877)
+++ hold/Auth_Adapter_Multi.php 2007-10-14 14:50:33 UTC (rev 2878)
@@ -1,108 +0,0 @@
-<?php
-/**
- *
- * Authenticate against multiple sources, falling back as needed.
- *
- * @category Solar
- *
- * @package Solar_Auth
- *
- * @author Paul M. Jones <pmjones at solarphp.com>
- *
- * @license http://opensource.org/licenses/bsd-license.php BSD
- *
- * @version $Id$
- *
- */
-
-/**
- *
- * Authenticate against multiple sources, falling back as needed.
- *
- * @category Solar
- *
- * @package Solar_Auth
- *
- */
-class Solar_Auth_Adapter_Multi extends Solar_Auth_Adapter {
-
- /**
- *
- * User-provided configuration values.
- *
- * Keys are:
- *
- * : \\adapters\\ : (array) The array of adapter classes and optional configs.
- *
- * @var array
- *
- */
- protected $_config = array(
- 'adapters' => array(
- 'Solar_Auth_None'
- )
- );
-
- /**
- *
- * An array of the multiple adapter instances.
- *
- * @var array
- *
- */
- protected $_adapter = array();
-
- /**
- *
- * Constructor.
- *
- * @param array $config User-supplied configuration.
- *
- */
- public function __construct($config = null)
- {
- // basic construction
- parent::__construct($config);
-
- // make sure the adapters config is an array
- settype($this->_config['adapters'], 'array');
-
- // instantiate the adapter objects
- foreach ($this->_config['adapters'] as $key => $info) {
-
- // is the adapter value an array (for custom configs)
- // or a string (for default configs)?
- if (is_array($info)) {
- $class = $info[0];
- $opts = $info[1];
- } else {
- $class = $info;
- $opts = null;
- }
-
- // add the adapter instance
- $this->_adapter[] = Solar::factory($class, $opts);
- }
- }
-
- /**
- *
- * Verifies a username handle and password.
- *
- * @return bool True if valid, false if not.
- *
- */
- protected function _verify()
- {
- $handle = $this->_handle;
- $passwd = $this->_passwd;
-
- foreach ($this->_adapter as $adapter) {
- if ($adapter->isValid($handle, $passwd)) {
- return true;
- }
- }
- return false;
- }
-}
-?>
\ No newline at end of file
Deleted: hold/Blogs.php
===================================================================
--- hold/Blogs.php 2007-10-14 14:40:10 UTC (rev 2877)
+++ hold/Blogs.php 2007-10-14 14:50:33 UTC (rev 2878)
@@ -1,21 +0,0 @@
-<?php
-class Solar_Model_Nodes_Blogs extends Solar_Model_Nodes {
- protected function _setup()
- {
- parent::_setup();
-
- /**
- * Relationships.
- */
-
- $this->_belongsTo('area', array(
- 'foreign_class' => 'areas',
- 'foreign_key' => 'area_id',
- ));
-
- $this->_hasMany('comments', array(
- 'foreign_class' => 'comments',
- 'foreign_key' => 'parent_id',
- ));
- }
-}
Deleted: hold/Comments.php
===================================================================
--- hold/Comments.php 2007-10-14 14:40:10 UTC (rev 2877)
+++ hold/Comments.php 2007-10-14 14:50:33 UTC (rev 2878)
@@ -1,14 +0,0 @@
-<?php
-class Solar_Model_Nodes_Comments extends Solar_Model_Nodes {
- protected function _setup()
- {
- parent::_setup();
- $this->_belongsTo('node', array(
- 'foreign_class' => 'nodes',
- 'foreign_key' => 'parent_id', // normally node_id
- ));
-
- $this->_fetch_cols = array('id', 'created', 'updated', 'subj', 'body',
- 'inherit', 'area_id', 'parent_id', 'moniker', 'email', 'uri', );
- }
-}
Deleted: hold/Js.php
===================================================================
--- hold/Js.php 2007-10-14 14:40:10 UTC (rev 2877)
+++ hold/Js.php 2007-10-14 14:50:33 UTC (rev 2878)
@@ -1,308 +0,0 @@
-<?php
-/**
- *
- * Helper for building JavaScript-powered applications.
- *
- * @category Solar
- *
- * @package Solar_View_Helper_Js
- *
- * @author Clay Loveless <clay at killersoft.com>
- *
- * @license http://opensource.org/licenses/bsd-license.php BSD
- *
- * @version $Id$
- *
- */
-
-/**
- *
- * Helper for building JavaScript-powered applications.
- *
- * This is a fluent class; all method calls except fetch() return
- * $this, which means you can chain method calls for easier readability.
- *
- * @category Solar
- *
- * @package Solar_View_Helper_Js
- *
- * @author Clay Loveless <clay at killersoft.com>
- *
- */
-class Solar_View_Helper_Js extends Solar_View_Helper_JsLibrary {
-
- /**
- *
- * User-provided configuration values.
- *
- * @var array
- *
- */
- protected $_Solar_View_Helper_Js = array(
- 'attribs' => array(),
- );
-
- /**
- *
- * Array of JavaScript files needed to provide specified functionality.
- *
- * @var array
- *
- */
- public $files;
-
- /**
- *
- * Array of CSS files required by a JavaScript class.
- *
- * @var array
- *
- */
- public $styles;
-
- /**
- *
- * Array of inline JavaScript needed to provide specified functionality.
- *
- * @var array
- *
- */
- public $scripts;
-
- /**
- *
- * Array of CSS selectors and their corresponding rules.
- *
- * @var array
- *
- */
- public $selectors;
-
- /**
- *
- * Array of JavaScript objects and their corresponding rules.
- *
- * @var array
- *
- */
- public $objects;
-
- /**
- *
- * Constructor.
- *
- * @param array $config User-provided configuration values.
- *
- */
- public function __construct($config = null)
- {
- parent::__construct($config);
- $this->reset();
- }
-
- /**
- *
- * Build and return JavaScript for page header.
- *
- * @return string Block of JavaScript with <script src ...> for view-defined
- * script requirements.
- *
- */
- public function fetchFiles()
- {
- $js = '';
-
- if (!empty($this->files)) {
- foreach ($this->files as $file) {
- $js .= ' ' . $this->_view->script($file) . "\n";
- }
- }
-
- return $js;
- }
-
- /**
- *
- * Build and return list of CSS files for page header.
- *
- * @return string Block of HTML with <style> tags for JavaScript-defined
- * style requirements.
- *
- */
- public function fetchStyles()
- {
- $str = '';
-
- if (!empty($this->styles)) {
- foreach ($this->styles as $style) {
- $str .= ' ' . $this->_view->style($style) . "\n";
- }
- }
-
- return $str;
- }
-
- /**
- *
- * Returns all defined inline scripts. This is a separate fetch method
- * so that any/all external (standalone JS file) scripts required by the
- * App or the View that the inline scripts depend on can be loaded prior to
- * the output of the inline script.
- *
- * @return string All inline JavaScripts
- *
- */
- public function fetchInline()
- {
- $js = '';
-
- // Loop through selectors for registered actions
- $f = '';
- if (!empty($this->selectors)) {
-
- foreach ($this->selectors as $selector => $actions) {
-
- // Wrap in selector loop
- $f .= " \$\$('$selector').each(function(el){\n";
-
- foreach ($actions as $a) {
- // add in loop with indent for easy reading
- $f .= ' '
- . trim($this->_view->getHelper($a['type'])->fetch($selector, $a))
- . "\n";
- }
-
- // Close off selector loop wrapper
- $f .= " });\n";
-
- }
-
- // Register window onload event to process CSS selector actions
- if ($f != '') {
- $f = "function() {\n" . rtrim($f) . "\n}";
- $this->_view->JsPrototype()->event->observeObject('window', 'load', $f);
- }
- }
-
- // Loop through registered object actions/observers
- if (!empty($this->objects)) {
- foreach ($this->objects as $object => $actions) {
- foreach ($actions as $a) {
- $this->scripts[] = $this->_view->getHelper($a['type'])->fetch($object, $a, true);
- }
- }
- }
-
- // Gather all registered scripts for output
- if (!empty($this->scripts)) {
- $scripts = implode("\n\n", $this->scripts);
- $scripts = trim($scripts);
- $js = $this->_view->inlineScript($scripts);
- }
-
- return $js;
- }
-
- /**
- *
- * Fluent interface.
- *
- * @return Solar_View_Helper_Js
- *
- */
- public function js()
- {
- return $this;
- }
-
- /**
- *
- * Add the specified JavaScript file to the Helper_Js file list
- * if it's not already present.
- *
- * Paths should be releative to the 'path' configuration value for the
- * corresponding Solar_View_Helper class.
- *
- * @param mixed $file Name of .js file to add to the header of the page, or
- * (optionally) an array of files to add.
- *
- * @return Solar_View_Helper_Js
- *
- */
- public function addFile($file)
- {
- if ($this->files === null) {
- $this->files = array();
- }
-
- if (is_array($file)) {
- $this->files = array_merge($this->files, $file);
- } elseif ($file !== null && !in_array($file, $this->files, true)) {
- $this->files[] = $file;
- }
-
- return $this;
- }
-
- /**
- *
- * Add the specified CSS file to the Helper_Js styles list
- * if it's not already present.
- *
- * Paths should be releative to the 'styles' configuration value for the
- * corresponding Solar_View_Helper class.
- *
- * @param mixed $file Name of .css file to add to the header of the page, or
- * (optionally) an array of files to add.
- *
- * @return Solar_View_Helper_Js
- *
- */
- public function addStyle($file)
- {
- if ($this->files === null) {
- $this->files = array();
- }
-
- if (is_array($file)) {
- $this->styles = array_merge($this->styles, $file);
- } elseif ($file !== null && !in_array($file, $this->styles, true)) {
- $this->styles[] = $file;
- }
-
- return $this;
- }
-
- /**
- *
- * Add the script defined in $src to the inline scripts array.
- *
- * @param string $src A snippet of JavaScript to be inserted in the head
- * of a document.
- *
- * @return Solar_View_Helper_Js
- */
- public function addInlineScript($src)
- {
- $this->scripts[] = $src;
- return $this;
- }
-
- /**
- *
- * Resets the helper entirely.
- *
- * @return object Solar_View_Helper_Js
- *
- */
- public function reset()
- {
- $this->selectors = array();
- $this->objects = array();
- $this->files = array();
- $this->scripts = array();
- $this->styles = array();
-
- return $this;
- }
-}
Deleted: hold/JsLibrary.php
===================================================================
--- hold/JsLibrary.php 2007-10-14 14:40:10 UTC (rev 2877)
+++ hold/JsLibrary.php 2007-10-14 14:50:33 UTC (rev 2878)
@@ -1,161 +0,0 @@
-<?php
-/**
- *
- * Abstract helper for JavaScript support.
- *
- * @category Solar
- *
- * @package Solar_View_Helper_Js
- *
- * @author Clay Loveless <clay at killersoft.com>
- *
- * @license http://opensource.org/licenses/bsd-license.php BSD
- *
- * @version $Id$
- *
- */
-
-/**
- *
- * Abstract helper for JavaScript support.
- *
- * @category Solar
- *
- * @package Solar_View_Helper_Js
- *
- */
-abstract class Solar_View_Helper_JsLibrary extends Solar_View_Helper {
-
- /**
- *
- * User-provided configuration values
- *
- * Keys are ...
- *
- * `events`
- * :_(array)_ An array of JavaScript events that the JavaScript
- * environment is aware of. Used to manage quoting of strings generated
- * by Solar_Json.
- *
- * @var array
- *
- */
- protected $_Solar_View_Helper_JsLibrary = array(
- 'events' => array(
- 'uninitialized',
- 'loading',
- 'loaded',
- 'interactive',
- 'complete',
- 'failure',
- 'success',
- ),
- );
-
- /**
- *
- * Valid events for JavaScript environment.
- *
- * @var array
- *
- */
- protected $_valid_events;
-
- /**
- *
- * Constructor.
- *
- * @param array $config User-defined configuration.
- *
- */
- public function __construct($config = null)
- {
- parent::__construct($config);
-
- // Event Callbacks are also valid on any HTTP response code
- $codes = range(100, 599);
- $this->_valid_events = array_merge($this->_config['events'], $codes);
- }
-
- /**
- *
- * Method interface.
- *
- * @return Child JsLibrary object
- */
- public function jsLibrary()
- {
- return $this;
- }
-
- /**
- *
- * Add the specified JavaScript file to the Helper_Js file list
- * if it's not already present.
- *
- * @param string $file Name of .js file needed by Helper class
- *
- * @return Child JsLibrary object
- *
- */
- protected function _needsFile($file = null)
- {
- // Add configured path
- $file = $this->_config['path'] . $file;
-
- $this->_view->js()->addFile($file);
- return $this;
- }
-
- /**
- *
- * Add the specified JavaScript file to the Helper_Js file list
- * if it's not already present.
- *
- * @param string $file Name of .js file needed by Helper class
- *
- * @return Child JsLibrary object
- *
- */
- protected function _needsStyle($file = null)
- {
- // Add configured path
- $file = $this->_config['styles'] . $file;
-
- $this->_view->js()->addStyle($file);
- return $this;
- }
-
- /**
- *
- * Returns options keys whose values should be dequoted, as the values are
- * expected to be `function() {...}` or names of pre-defined functions
- * elsewhere in the JavaScript environment.
- *
- * @param bool $expand Expand events into full 'onxxx' strings. 'success'
- * would become 'onSuccess'. Defaults to true
- *
- * @return array List of keys to dequote from a JSON string
- *
- */
- public function getFunctionKeys($expand = true)
- {
- $keys = $this->_valid_events;
- if ($expand) {
- foreach ($keys as $key => $val) {
- $keys[$key] = 'on' . ucfirst($val);
- }
- }
-
- // These callback hooks aren't true JavaScript events, but their values
- // will be a function
- $keys[] = 'callback';
- $keys[] = 'beforeStart';
- $keys[] = 'beforeUpdate';
- $keys[] = 'afterUpdate';
- $keys[] = 'afterFinish';
-
- return $keys;
- }
-
-}
Deleted: hold/Revisions.php
===================================================================
--- hold/Revisions.php 2007-10-14 14:40:10 UTC (rev 2877)
+++ hold/Revisions.php 2007-10-14 14:50:33 UTC (rev 2878)
@@ -1,16 +0,0 @@
-<?php
-
-class Solar_Model_Nodes_Revisions extends Solar_Model_Nodes {
- protected function _setup()
- {
- parent::_setup();
-
- /**
- * Relationships.
- */
- $this->_belongsTo('node', array(
- 'foreign_class' => 'node',
- 'foreign_key' => 'parent_id',
- ));
- }
-}
Copied: hold/Solar_Auth_Adapter_Multi.php (from rev 2853, hold/Auth_Adapter_Multi.php)
===================================================================
--- hold/Solar_Auth_Adapter_Multi.php (rev 0)
+++ hold/Solar_Auth_Adapter_Multi.php 2007-10-14 14:50:33 UTC (rev 2878)
@@ -0,0 +1,108 @@
+<?php
+/**
+ *
+ * Authenticate against multiple sources, falling back as needed.
+ *
+ * @category Solar
+ *
+ * @package Solar_Auth
+ *
+ * @author Paul M. Jones <pmjones at solarphp.com>
+ *
+ * @license http://opensource.org/licenses/bsd-license.php BSD
+ *
+ * @version $Id$
+ *
+ */
+
+/**
+ *
+ * Authenticate against multiple sources, falling back as needed.
+ *
+ * @category Solar
+ *
+ * @package Solar_Auth
+ *
+ */
+class Solar_Auth_Adapter_Multi extends Solar_Auth_Adapter {
+
+ /**
+ *
+ * User-provided configuration values.
+ *
+ * Keys are:
+ *
+ * : \\adapters\\ : (array) The array of adapter classes and optional configs.
+ *
+ * @var array
+ *
+ */
+ protected $_config = array(
+ 'adapters' => array(
+ 'Solar_Auth_None'
+ )
+ );
+
+ /**
+ *
+ * An array of the multiple adapter instances.
+ *
+ * @var array
+ *
+ */
+ protected $_adapter = array();
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param array $config User-supplied configuration.
+ *
+ */
+ public function __construct($config = null)
+ {
+ // basic construction
+ parent::__construct($config);
+
+ // make sure the adapters config is an array
+ settype($this->_config['adapters'], 'array');
+
+ // instantiate the adapter objects
+ foreach ($this->_config['adapters'] as $key => $info) {
+
+ // is the adapter value an array (for custom configs)
+ // or a string (for default configs)?
+ if (is_array($info)) {
+ $class = $info[0];
+ $opts = $info[1];
+ } else {
+ $class = $info;
+ $opts = null;
+ }
+
+ // add the adapter instance
+ $this->_adapter[] = Solar::factory($class, $opts);
+ }
+ }
+
+ /**
+ *
+ * Verifies a username handle and password.
+ *
+ * @return bool True if valid, false if not.
+ *
+ */
+ protected function _verify()
+ {
+ $handle = $this->_handle;
+ $passwd = $this->_passwd;
+
+ foreach ($this->_adapter as $adapter) {
+ if ($adapter->isValid($handle, $passwd)) {
+ return true;
+ }
+ }
+ return false;
+ }
+}
+?>
\ No newline at end of file
Copied: hold/Solar_Model_Nodes_Blogs.php (from rev 2858, hold/Blogs.php)
===================================================================
--- hold/Solar_Model_Nodes_Blogs.php (rev 0)
+++ hold/Solar_Model_Nodes_Blogs.php 2007-10-14 14:50:33 UTC (rev 2878)
@@ -0,0 +1,21 @@
+<?php
+class Solar_Model_Nodes_Blogs extends Solar_Model_Nodes {
+ protected function _setup()
+ {
+ parent::_setup();
+
+ /**
+ * Relationships.
+ */
+
+ $this->_belongsTo('area', array(
+ 'foreign_class' => 'areas',
+ 'foreign_key' => 'area_id',
+ ));
+
+ $this->_hasMany('comments', array(
+ 'foreign_class' => 'comments',
+ 'foreign_key' => 'parent_id',
+ ));
+ }
+}
Copied: hold/Solar_Model_Nodes_Comments.php (from rev 2858, hold/Comments.php)
===================================================================
--- hold/Solar_Model_Nodes_Comments.php (rev 0)
+++ hold/Solar_Model_Nodes_Comments.php 2007-10-14 14:50:33 UTC (rev 2878)
@@ -0,0 +1,14 @@
+<?php
+class Solar_Model_Nodes_Comments extends Solar_Model_Nodes {
+ protected function _setup()
+ {
+ parent::_setup();
+ $this->_belongsTo('node', array(
+ 'foreign_class' => 'nodes',
+ 'foreign_key' => 'parent_id', // normally node_id
+ ));
+
+ $this->_fetch_cols = array('id', 'created', 'updated', 'subj', 'body',
+ 'inherit', 'area_id', 'parent_id', 'moniker', 'email', 'uri', );
+ }
+}
Copied: hold/Solar_Model_Nodes_Revisions (from rev 2858, hold/Revisions)
Copied: hold/Solar_Model_Nodes_Revisions.php (from rev 2858, hold/Revisions.php)
===================================================================
--- hold/Solar_Model_Nodes_Revisions.php (rev 0)
+++ hold/Solar_Model_Nodes_Revisions.php 2007-10-14 14:50:33 UTC (rev 2878)
@@ -0,0 +1,16 @@
+<?php
+
+class Solar_Model_Nodes_Revisions extends Solar_Model_Nodes {
+ protected function _setup()
+ {
+ parent::_setup();
+
+ /**
+ * Relationships.
+ */
+ $this->_belongsTo('node', array(
+ 'foreign_class' => 'node',
+ 'foreign_key' => 'parent_id',
+ ));
+ }
+}
Copied: hold/Solar_Model_Nodes_Trackbacks.php (from rev 2858, hold/Trackbacks.php)
===================================================================
--- hold/Solar_Model_Nodes_Trackbacks.php (rev 0)
+++ hold/Solar_Model_Nodes_Trackbacks.php 2007-10-14 14:50:33 UTC (rev 2878)
@@ -0,0 +1,14 @@
+<?php
+class Solar_Model_Nodes_Trackbacks extends Solar_Model_Nodes {
+ protected function _setup()
+ {
+ parent::_setup();
+ $this->_belongsTo('node', array(
+ 'foreign_class' => 'nodes',
+ 'foreign_key' => 'parent_id', // normally node_id
+ ));
+
+ $this->_fetch_cols = array('id', 'created', 'updated', 'subj', 'body',
+ 'inherit', 'area_id', 'parent_id', 'moniker', 'email', 'uri', );
+ }
+}
Copied: hold/Solar_Model_Nodes_Wikis.php (from rev 2858, hold/Wikis.php)
===================================================================
--- hold/Solar_Model_Nodes_Wikis.php (rev 0)
+++ hold/Solar_Model_Nodes_Wikis.php 2007-10-14 14:50:33 UTC (rev 2878)
@@ -0,0 +1,21 @@
+<?php
+class Solar_Model_Nodes_Wikis extends Solar_Model_Nodes {
+ protected function _setup()
+ {
+ parent::_setup();
+
+ /**
+ * Relationships.
+ */
+ $this->_hasMany('revisions', array(
+ 'foreign_class' => 'revision',
+ 'foreign_key' => 'parent_id',
+ 'order' => 'id DESC',
+ ));
+
+ $this->_hasMany('comments', array(
+ 'foreign_class' => 'comment',
+ 'foreign_key' => 'parent_id',
+ ));
+ }
+}
Copied: hold/Solar_View_Helper_Js.php (from rev 2877, hold/Js.php)
===================================================================
--- hold/Solar_View_Helper_Js.php (rev 0)
+++ hold/Solar_View_Helper_Js.php 2007-10-14 14:50:33 UTC (rev 2878)
@@ -0,0 +1,308 @@
+<?php
+/**
+ *
+ * Helper for building JavaScript-powered applications.
+ *
+ * @category Solar
+ *
+ * @package Solar_View_Helper_Js
+ *
+ * @author Clay Loveless <clay at killersoft.com>
+ *
+ * @license http://opensource.org/licenses/bsd-license.php BSD
+ *
+ * @version $Id$
+ *
+ */
+
+/**
+ *
+ * Helper for building JavaScript-powered applications.
+ *
+ * This is a fluent class; all method calls except fetch() return
+ * $this, which means you can chain method calls for easier readability.
+ *
+ * @category Solar
+ *
+ * @package Solar_View_Helper_Js
+ *
+ * @author Clay Loveless <clay at killersoft.com>
+ *
+ */
+class Solar_View_Helper_Js extends Solar_View_Helper_JsLibrary {
+
+ /**
+ *
+ * User-provided configuration values.
+ *
+ * @var array
+ *
+ */
+ protected $_Solar_View_Helper_Js = array(
+ 'attribs' => array(),
+ );
+
+ /**
+ *
+ * Array of JavaScript files needed to provide specified functionality.
+ *
+ * @var array
+ *
+ */
+ public $files;
+
+ /**
+ *
+ * Array of CSS files required by a JavaScript class.
+ *
+ * @var array
+ *
+ */
+ public $styles;
+
+ /**
+ *
+ * Array of inline JavaScript needed to provide specified functionality.
+ *
+ * @var array
+ *
+ */
+ public $scripts;
+
+ /**
+ *
+ * Array of CSS selectors and their corresponding rules.
+ *
+ * @var array
+ *
+ */
+ public $selectors;
+
+ /**
+ *
+ * Array of JavaScript objects and their corresponding rules.
+ *
+ * @var array
+ *
+ */
+ public $objects;
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param array $config User-provided configuration values.
+ *
+ */
+ public function __construct($config = null)
+ {
+ parent::__construct($config);
+ $this->reset();
+ }
+
+ /**
+ *
+ * Build and return JavaScript for page header.
+ *
+ * @return string Block of JavaScript with <script src ...> for view-defined
+ * script requirements.
+ *
+ */
+ public function fetchFiles()
+ {
+ $js = '';
+
+ if (!empty($this->files)) {
+ foreach ($this->files as $file) {
+ $js .= ' ' . $this->_view->script($file) . "\n";
+ }
+ }
+
+ return $js;
+ }
+
+ /**
+ *
+ * Build and return list of CSS files for page header.
+ *
+ * @return string Block of HTML with <style> tags for JavaScript-defined
+ * style requirements.
+ *
+ */
+ public function fetchStyles()
+ {
+ $str = '';
+
+ if (!empty($this->styles)) {
+ foreach ($this->styles as $style) {
+ $str .= ' ' . $this->_view->style($style) . "\n";
+ }
+ }
+
+ return $str;
+ }
+
+ /**
+ *
+ * Returns all defined inline scripts. This is a separate fetch method
+ * so that any/all external (standalone JS file) scripts required by the
+ * App or the View that the inline scripts depend on can be loaded prior to
+ * the output of the inline script.
+ *
+ * @return string All inline JavaScripts
+ *
+ */
+ public function fetchInline()
+ {
+ $js = '';
+
+ // Loop through selectors for registered actions
+ $f = '';
+ if (!empty($this->selectors)) {
+
+ foreach ($this->selectors as $selector => $actions) {
+
+ // Wrap in selector loop
+ $f .= " \$\$('$selector').each(function(el){\n";
+
+ foreach ($actions as $a) {
+ // add in loop with indent for easy reading
+ $f .= ' '
+ . trim($this->_view->getHelper($a['type'])->fetch($selector, $a))
+ . "\n";
+ }
+
+ // Close off selector loop wrapper
+ $f .= " });\n";
+
+ }
+
+ // Register window onload event to process CSS selector actions
+ if ($f != '') {
+ $f = "function() {\n" . rtrim($f) . "\n}";
+ $this->_view->JsPrototype()->event->observeObject('window', 'load', $f);
+ }
+ }
+
+ // Loop through registered object actions/observers
+ if (!empty($this->objects)) {
+ foreach ($this->objects as $object => $actions) {
+ foreach ($actions as $a) {
+ $this->scripts[] = $this->_view->getHelper($a['type'])->fetch($object, $a, true);
+ }
+ }
+ }
+
+ // Gather all registered scripts for output
+ if (!empty($this->scripts)) {
+ $scripts = implode("\n\n", $this->scripts);
+ $scripts = trim($scripts);
+ $js = $this->_view->inlineScript($scripts);
+ }
+
+ return $js;
+ }
+
+ /**
+ *
+ * Fluent interface.
+ *
+ * @return Solar_View_Helper_Js
+ *
+ */
+ public function js()
+ {
+ return $this;
+ }
+
+ /**
+ *
+ * Add the specified JavaScript file to the Helper_Js file list
+ * if it's not already present.
+ *
+ * Paths should be releative to the 'path' configuration value for the
+ * corresponding Solar_View_Helper class.
+ *
+ * @param mixed $file Name of .js file to add to the header of the page, or
+ * (optionally) an array of files to add.
+ *
+ * @return Solar_View_Helper_Js
+ *
+ */
+ public function addFile($file)
+ {
+ if ($this->files === null) {
+ $this->files = array();
+ }
+
+ if (is_array($file)) {
+ $this->files = array_merge($this->files, $file);
+ } elseif ($file !== null && !in_array($file, $this->files, true)) {
+ $this->files[] = $file;
+ }
+
+ return $this;
+ }
+
+ /**
+ *
+ * Add the specified CSS file to the Helper_Js styles list
+ * if it's not already present.
+ *
+ * Paths should be releative to the 'styles' configuration value for the
+ * corresponding Solar_View_Helper class.
+ *
+ * @param mixed $file Name of .css file to add to the header of the page, or
+ * (optionally) an array of files to add.
+ *
+ * @return Solar_View_Helper_Js
+ *
+ */
+ public function addStyle($file)
+ {
+ if ($this->files === null) {
+ $this->files = array();
+ }
+
+ if (is_array($file)) {
+ $this->styles = array_merge($this->styles, $file);
+ } elseif ($file !== null && !in_array($file, $this->styles, true)) {
+ $this->styles[] = $file;
+ }
+
+ return $this;
+ }
+
+ /**
+ *
+ * Add the script defined in $src to the inline scripts array.
+ *
+ * @param string $src A snippet of JavaScript to be inserted in the head
+ * of a document.
+ *
+ * @return Solar_View_Helper_Js
+ */
+ public function addInlineScript($src)
+ {
+ $this->scripts[] = $src;
+ return $this;
+ }
+
+ /**
+ *
+ * Resets the helper entirely.
+ *
+ * @return object Solar_View_Helper_Js
+ *
+ */
+ public function reset()
+ {
+ $this->selectors = array();
+ $this->objects = array();
+ $this->files = array();
+ $this->scripts = array();
+ $this->styles = array();
+
+ return $this;
+ }
+}
Copied: hold/Solar_View_Helper_JsLibrary.php (from rev 2877, hold/JsLibrary.php)
===================================================================
--- hold/Solar_View_Helper_JsLibrary.php (rev 0)
+++ hold/Solar_View_Helper_JsLibrary.php 2007-10-14 14:50:33 UTC (rev 2878)
@@ -0,0 +1,161 @@
+<?php
+/**
+ *
+ * Abstract helper for JavaScript support.
+ *
+ * @category Solar
+ *
+ * @package Solar_View_Helper_Js
+ *
+ * @author Clay Loveless <clay at killersoft.com>
+ *
+ * @license http://opensource.org/licenses/bsd-license.php BSD
+ *
+ * @version $Id$
+ *
+ */
+
+/**
+ *
+ * Abstract helper for JavaScript support.
+ *
+ * @category Solar
+ *
+ * @package Solar_View_Helper_Js
+ *
+ */
+abstract class Solar_View_Helper_JsLibrary extends Solar_View_Helper {
+
+ /**
+ *
+ * User-provided configuration values
+ *
+ * Keys are ...
+ *
+ * `events`
+ * :_(array)_ An array of JavaScript events that the JavaScript
+ * environment is aware of. Used to manage quoting of strings generated
+ * by Solar_Json.
+ *
+ * @var array
+ *
+ */
+ protected $_Solar_View_Helper_JsLibrary = array(
+ 'events' => array(
+ 'uninitialized',
+ 'loading',
+ 'loaded',
+ 'interactive',
+ 'complete',
+ 'failure',
+ 'success',
+ ),
+ );
+
+ /**
+ *
+ * Valid events for JavaScript environment.
+ *
+ * @var array
+ *
+ */
+ protected $_valid_events;
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param array $config User-defined configuration.
+ *
+ */
+ public function __construct($config = null)
+ {
+ parent::__construct($config);
+
+ // Event Callbacks are also valid on any HTTP response code
+ $codes = range(100, 599);
+ $this->_valid_events = array_merge($this->_config['events'], $codes);
+ }
+
+ /**
+ *
+ * Method interface.
+ *
+ * @return Child JsLibrary object
+ */
+ public function jsLibrary()
+ {
+ return $this;
+ }
+
+ /**
+ *
+ * Add the specified JavaScript file to the Helper_Js file list
+ * if it's not already present.
+ *
+ * @param string $file Name of .js file needed by Helper class
+ *
+ * @return Child JsLibrary object
+ *
+ */
+ protected function _needsFile($file = null)
+ {
+ // Add configured path
+ $file = $this->_config['path'] . $file;
+
+ $this->_view->js()->addFile($file);
+ return $this;
+ }
+
+ /**
+ *
+ * Add the specified JavaScript file to the Helper_Js file list
+ * if it's not already present.
+ *
+ * @param string $file Name of .js file needed by Helper class
+ *
+ * @return Child JsLibrary object
+ *
+ */
+ protected function _needsStyle($file = null)
+ {
+ // Add configured path
+ $file = $this->_config['styles'] . $file;
+
+ $this->_view->js()->addStyle($file);
+ return $this;
+ }
+
+ /**
+ *
+ * Returns options keys whose values should be dequoted, as the values are
+ * expected to be `function() {...}` or names of pre-defined functions
+ * elsewhere in the JavaScript environment.
+ *
+ * @param bool $expand Expand events into full 'onxxx' strings. 'success'
+ * would become 'onSuccess'. Defaults to true
+ *
+ * @return array List of keys to dequote from a JSON string
+ *
+ */
+ public function getFunctionKeys($expand = true)
+ {
+ $keys = $this->_valid_events;
+ if ($expand) {
+ foreach ($keys as $key => $val) {
+ $keys[$key] = 'on' . ucfirst($val);
+ }
+ }
+
+ // These callback hooks aren't true JavaScript events, but their values
+ // will be a function
+ $keys[] = 'callback';
+ $keys[] = 'beforeStart';
+ $keys[] = 'beforeUpdate';
+ $keys[] = 'afterUpdate';
+ $keys[] = 'afterFinish';
+
+ return $keys;
+ }
+
+}
Deleted: hold/Trackbacks.php
===================================================================
--- hold/Trackbacks.php 2007-10-14 14:40:10 UTC (rev 2877)
+++ hold/Trackbacks.php 2007-10-14 14:50:33 UTC (rev 2878)
@@ -1,14 +0,0 @@
-<?php
-class Solar_Model_Nodes_Trackbacks extends Solar_Model_Nodes {
- protected function _setup()
- {
- parent::_setup();
- $this->_belongsTo('node', array(
- 'foreign_class' => 'nodes',
- 'foreign_key' => 'parent_id', // normally node_id
- ));
-
- $this->_fetch_cols = array('id', 'created', 'updated', 'subj', 'body',
- 'inherit', 'area_id', 'parent_id', 'moniker', 'email', 'uri', );
- }
-}
Deleted: hold/Wikis.php
===================================================================
--- hold/Wikis.php 2007-10-14 14:40:10 UTC (rev 2877)
+++ hold/Wikis.php 2007-10-14 14:50:33 UTC (rev 2878)
@@ -1,21 +0,0 @@
-<?php
-class Solar_Model_Nodes_Wikis extends Solar_Model_Nodes {
- protected function _setup()
- {
- parent::_setup();
-
- /**
- * Relationships.
- */
- $this->_hasMany('revisions', array(
- 'foreign_class' => 'revision',
- 'foreign_key' => 'parent_id',
- 'order' => 'id DESC',
- ));
-
- $this->_hasMany('comments', array(
- 'foreign_class' => 'comment',
- 'foreign_key' => 'parent_id',
- ));
- }
-}
More information about the Solar-svn
mailing list