Author: phpnut
Date: 4:44:45 AM, Wednesday, October 26, 2005
Message:
AJAX is now available as a by default in the $html variable in the templates.
You access it like this:
$html->Ajax->xxx();
Updated default templates.

[1208]
Author: phpnut
Date: 6:49:26 PM, Tuesday, October 25, 2005
Message:
Adding fix in Controller::generateFieldNames();

[1203]
Author: phpnut
Date: 10:40:28 AM, Tuesday, October 25, 2005
Message:
Changes made to core templates and css.
Fixed added for Ticket #60

[1202]
Author: phpnut
Date: 2:30:58 AM, Tuesday, October 25, 2005
Message:
Fix for cake error templates
Fixed a key for tables that are underscored in scaffolded code.

git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1211 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
phpnut 2005-10-26 10:55:44 +00:00
parent 690d088329
commit 4b9df4fda4
16 changed files with 153 additions and 125 deletions

View file

@ -20,8 +20,20 @@ h1 em {
font-weight: normal; font-weight: normal;
font-variant: normal; font-variant: normal;
} }
h2 a {
color: #fff;
font-style: normal;
font-weight: normal;
font-variant: normal;
}
h2 a:hover {
color: #DBA941;
font-style: normal;
font-weight: normal;
font-variant: normal;
}
h2 h2.cake
{ {
margin-top: 20px; margin-top: 20px;
margin-bottom: 6px; margin-bottom: 6px;
@ -80,7 +92,7 @@ p
height: 114px; height: 114px;
background: #fff url("../img/cake.bg.header.gif") repeat-x; background: #fff url("../img/cake.bg.header.gif") repeat-x;
border-bottom: 1px solid #D2D7D8; border-bottom: 1px solid #D2D7D8;
margin-bottom: 30px; margin-bottom: 16px;
text-align: right; text-align: right;
} }
#header img #header img
@ -89,24 +101,24 @@ p
vertical-align: middle; vertical-align: middle;
border: 0; border: 0;
} }
.headerNav #headerNav
{ {
float: right; float: left;
margin-top: 3px; margin-top: 56px;
padding-right: 30px; margin-left: 20px;
font-size: 13px; font-size: 15px;
font-weight: bold; font-weight: bold;
color: #71300F; color: #71300F;
} }
.headerNav a { #headerNav a {
padding: 4px 10px; padding: 4px 10px;
} }
.headerNav a:hover { #headerNav a:hover {
padding: 4px 10px; padding: 4px 10px;
background-color: #fff; background-color: #D2D7D8;
} }
.headerNav .active { #headerNav .active {
padding: 4px 10px; padding: 4px 10px;
background-color: #fff; background-color: #fff;
} }
@ -151,6 +163,7 @@ p
border-left: 1px solid #D2D7D8; border-left: 1px solid #D2D7D8;
border-right: 1px solid #D2D7D8; border-right: 1px solid #D2D7D8;
border-bottom: 1px solid #D2D7D8; border-bottom: 1px solid #D2D7D8;
text-align: left;
} }
a a
{ {

View file

@ -134,6 +134,8 @@ form div fieldset label.labelCheckbox, form div fieldset label.labelRadio {
p.error { p.error {
color: #71300F; color: #71300F;
background-color: #DBA941; background-color: #DBA941;
font-size: 14px;
padding: 1em;
} }
form div input, form div select, form div textarea { form div input, form div select, form div textarea {

View file

@ -43,11 +43,14 @@ li {
color: #71300F; color: #71300F;
background-color: #DBA941; background-color: #DBA941;
font-family: Verdana; font-family: Verdana;
display: block;
padding: 1em; padding: 1em;
} }
.tip { .tip {
color: #71300F; color: #71300F;
font-size: 14px;
background-color: #DBA941; background-color: #DBA941;
display: block;
padding: 1em; padding: 1em;
} }

View file

@ -275,7 +275,7 @@ class Dispatcher extends Object
{ {
if(!empty($r[1])) if(!empty($r[1]))
{ {
return $r[1]; return $base.$r[1];
} }
} }
} }

View file

@ -83,17 +83,18 @@ class Component extends Object
{ {
if(in_array($component, array_keys($loaded)) !== true) if(in_array($component, array_keys($loaded)) !== true)
{ {
$componentFn = COMPONENTS.Inflector::underscore($component).'.php'; $componentFn = Inflector::underscore($component).'.php';
if(file_exists(COMPONENTS.Inflector::underscore($component).'.php'))
if(file_exists(COMPONENTS.$componentFn))
{ {
$componentFn = COMPONENTS.Inflector::underscore($component).'.php'; $componentFn = COMPONENTS.$componentFn;
} }
else if(file_exists(LIBS.'controller'.DS.'components'.DS.Inflector::underscore($component).'.php')) else if(file_exists(LIBS.'controller'.DS.'components'.DS.$componentFn))
{ {
$componentFn = LIBS.'controller'.DS.'components'.DS.Inflector::underscore($component).'.php'; $componentFn = LIBS.'controller'.DS.'components'.DS.$componentFn;
} }
$componentCn = ucfirst($component).'Component'; $componentCn = $component.'Component';
if (is_file($componentFn)) if (is_file($componentFn))
{ {

View file

@ -94,7 +94,7 @@ class Controller extends Object
* @var mixed A single name as a string or a list of names as an array. * @var mixed A single name as a string or a list of names as an array.
* @access protected * @access protected
*/ */
var $helpers = array('html'); var $helpers = array('Html');
/** /**
* Enter description here... * Enter description here...
@ -731,7 +731,7 @@ class Controller extends Object
// get the list of options from the other model. // get the list of options from the other model.
$registry = ClassRegistry::getInstance(); $registry = ClassRegistry::getInstance();
$otherModel = $registry->getObject($fieldNames[$tabl['name']]['model']); $otherModel = $registry->getObject(Inflector::underscore($fieldNames[$tabl['name']]['model']));
if( is_object($otherModel) ) if( is_object($otherModel) )
{ {

View file

@ -288,9 +288,9 @@ class Scaffold extends Object {
*/ */
function _scaffoldView ($params) function _scaffoldView ($params)
{ {
if(!in_array('form', $this->controllerClass->helpers)) if(!in_array('Form', $this->controllerClass->helpers))
{ {
$this->controllerClass->helpers[] = 'form'; $this->controllerClass->helpers[] = 'Form';
} }
$isDataBaseSet = DboFactory::getInstance($this->controllerClass->useDbConfig); $isDataBaseSet = DboFactory::getInstance($this->controllerClass->useDbConfig);

View file

@ -31,6 +31,7 @@
$modelName = Inflector::singularize($this->name); $modelName = Inflector::singularize($this->name);
$modelKey = $modelName; $modelKey = $modelName;
?> ?>
<h1>Edit <?php echo Inflector::humanize($modelName);?></h1> <h1>Edit <?php echo Inflector::humanize($modelName);?></h1>

View file

@ -34,7 +34,7 @@
$modelName = Inflector::singularize($this->name); $modelName = Inflector::singularize($this->name);
$modelKey = Inflector::underscore($modelName); $modelKey = Inflector::underscore($modelName);
$registry =& ClassRegistry::getInstance(); $registry =& ClassRegistry::getInstance();
$objModel = $registry->getObject($modelName); $objModel = $registry->getObject($modelKey);
?> ?>
<h1>Show <?php echo Inflector::humanize($modelName)?></h1> <h1>Show <?php echo Inflector::humanize($modelName)?></h1>
@ -45,7 +45,8 @@
echo "<dt>".$value['prompt']."</dt>"; echo "<dt>".$value['prompt']."</dt>";
if(isset($value['foreignKey'])) if(isset($value['foreignKey']))
{ {
$otherModelObject = $registry->getObject($objModel->tableToModel[$value['table']]);
$otherModelObject = $registry->getObject(Inflector::underscore($objModel->tableToModel[$value['table']]));
$displayField = $otherModelObject->getDisplayField(); $displayField = $otherModelObject->getDisplayField();
$displayText = $data[$objModel->tableToModel[$value['table']]][$displayField]; $displayText = $data[$objModel->tableToModel[$value['table']]][$displayField];

View file

@ -226,7 +226,7 @@ class Model extends Object
$this->setTablePrefix(); $this->setTablePrefix();
} }
$this->tablePrefix? $this->useTable($this->tablePrefix.$tableName): $this->useTable ($tableName); $this->tablePrefix? $this->setTable($this->tablePrefix.$tableName): $this->setTable($tableName);
parent::__construct(); parent::__construct();
$this->createLinks(); $this->createLinks();
@ -551,7 +551,7 @@ class Model extends Object
* *
* @param string $tableName Name of the custom table * @param string $tableName Name of the custom table
*/ */
function useTable ($tableName) function setTable($tableName)
{ {
if (!in_array(strtolower($tableName), $this->db->tables())) if (!in_array(strtolower($tableName), $this->db->tables()))
{ {
@ -666,28 +666,26 @@ class Model extends Object
*/ */
function field ($name, $conditions=null, $order=null) function field ($name, $conditions=null, $order=null)
{ {
if (isset($this->data[$this->name][$name]))
{
return $this->data[$this->name][$name];
}
if ($conditions) if ($conditions)
{ {
$conditions = $this->parseConditions($conditions); $conditions = $this->parseConditions($conditions);
$data = $this->find($conditions, $name, $order);
return $data[$name];
} }
elseif (isset($this->data[$name]))
if ($data = $this->find($conditions, $name, $order))
{ {
return $this->data[$name]; return isset($data[$this->name][$name])? $data[$this->name][$name]: false;
} }
else else
{ {
if ($this->id && $data = $this->read($name)) return false;
{
return isset($data[$name])? $data[$name]: false;
}
else
{
return false;
}
} }
} }
/** /**
* Saves a single field to the database. * Saves a single field to the database.

View file

@ -52,7 +52,7 @@ class AjaxHelper extends Helper
* *
* @var array * @var array
*/ */
var $helpers = array('html', 'javascript'); var $helpers = array('Html', 'Javascript');
/** /**
* Enter description here... * Enter description here...
@ -156,12 +156,12 @@ class AjaxHelper extends Helper
$href = (!empty($options['fallback'])) ? $options['fallback'] : '#'; $href = (!empty($options['fallback'])) ? $options['fallback'] : '#';
if(isset($html_options['id'])) if(isset($html_options['id']))
{ {
return $this->html->link($title, $href, $html_options) . $this->javascript->event("$('{$html_options['id']}')", "click", "function() {" . $this->remoteFunction($options) . "; return true; }"); return $this->Html->link($title, $href, $html_options) . $this->Javascript->event("$('{$html_options['id']}')", "click", "function() {" . $this->remoteFunction($options) . "; return true; }");
} }
else else
{ {
$html_options['onclick'] = $this->remoteFunction($options); $html_options['onclick'] = $this->remoteFunction($options);
return $this->html->link($title, $href, $html_options); return $this->Html->link($title, $href, $html_options);
} }
} }
@ -181,7 +181,7 @@ class AjaxHelper extends Helper
$javascript_options = $this->_optionsForAjax($options); $javascript_options = $this->_optionsForAjax($options);
$func = isset($options['update']) ? "new Ajax.Updater('{$options['update']}'," : "new Ajax.Request("; $func = isset($options['update']) ? "new Ajax.Updater('{$options['update']}'," : "new Ajax.Request(";
$func .= "'" . $this->html->url(isset($options['url']) ? $options['url'] : "") . "'"; $func .= "'" . $this->Html->url(isset($options['url']) ? $options['url'] : "") . "'";
$func .= "$javascript_options)"; $func .= "$javascript_options)";
if (isset($options['before'])) if (isset($options['before']))
@ -198,7 +198,7 @@ class AjaxHelper extends Helper
} }
if (isset($options['confirm'])) if (isset($options['confirm']))
{ {
$func = "if (confirm('" . $this->javascript->escapeScript($options['confirm']) . "')) { $func; } else { return false; }"; $func = "if (confirm('" . $this->Javascript->escapeScript($options['confirm']) . "')) { $func; } else { return false; }";
} }
return $func; return $func;
} }
@ -217,7 +217,7 @@ class AjaxHelper extends Helper
{ {
$frequency = (isset($options['frequency']))? $options['frequency'] : 10; $frequency = (isset($options['frequency']))? $options['frequency'] : 10;
$code = "new PeriodicalExecuter(function() {" . $this->remote_function($options) . "}, $frequency)"; $code = "new PeriodicalExecuter(function() {" . $this->remote_function($options) . "}, $frequency)";
return $this->javascript->codeBlock($code); return $this->Javascript->codeBlock($code);
} }
/** /**
@ -236,7 +236,7 @@ class AjaxHelper extends Helper
{ {
$options['id'] = $id; $options['id'] = $id;
//$options['html']['onsubmit'] = $this->remoteFunction($options) . "; return false;"; //$options['html']['onsubmit'] = $this->remoteFunction($options) . "; return false;";
return $this->html->formTag(null, "post", $options) . $this->javascript->event("$('$id')", "submit", "function(){" . $this->remoteFunction($options) . "; return false;}"); return $this->Html->formTag(null, "post", $options) . $this->Javascript->event("$('$id')", "submit", "function(){" . $this->remoteFunction($options) . "; return false;}");
} }
/** /**
@ -257,7 +257,7 @@ class AjaxHelper extends Helper
$options['html']['onclick'] = $this->remoteFunction($options) . "; return false;"; $options['html']['onclick'] = $this->remoteFunction($options) . "; return false;";
$options['html']['name'] = $name; $options['html']['name'] = $name;
$options['html']['value'] = $value; $options['html']['value'] = $value;
return $this->html->tag("input", $options['html'], false); return $this->Html->tag("input", $options['html'], false);
} }
/** /**
@ -294,7 +294,7 @@ class AjaxHelper extends Helper
{ {
$options['with'] = "Form.Element.serialize('$field_id')"; $options['with'] = "Form.Element.serialize('$field_id')";
} }
return $this->javascript->codeBlock($this->_buildObserver('Form.Element.Observer', $field_id, $options)); return $this->Javascript->codeBlock($this->_buildObserver('Form.Element.Observer', $field_id, $options));
} }
/** /**
@ -315,7 +315,7 @@ class AjaxHelper extends Helper
{ {
$options['with'] = 'Form.serialize(this.form)'; $options['with'] = 'Form.serialize(this.form)';
} }
return $this->javascript->codeBlock($this->_buildObserver('Form.Observer', $field_id, $options)); return $this->Javascript->codeBlock($this->_buildObserver('Form.Observer', $field_id, $options));
} }
/** /**
@ -356,16 +356,16 @@ class AjaxHelper extends Helper
$divOptions = array('id' => $options['id'] . "_autoComplete", 'class' => "auto_complete"); $divOptions = array('id' => $options['id'] . "_autoComplete", 'class' => "auto_complete");
return $this->html->input($field, $htmlOptions) . return $this->Html->input($field, $htmlOptions) .
$this->html->tag("div", $divOptions, true) . "</div>" . $this->Html->tag("div", $divOptions, true) . "</div>" .
$this->javascript->codeBlock("new Ajax.Autocompleter('" . $options['id'] . "', '" . $this->Javascript->codeBlock("new Ajax.Autocompleter('" . $options['id'] . "', '" .
$divOptions['id'] . "', '" . $this->html->url($url) . "', " . $this->_optionsForAjax($ajaxOptions) . ");"); $divOptions['id'] . "', '" . $this->Html->url($url) . "', " . $this->_optionsForAjax($ajaxOptions) . ");");
} }
function drag($id, $options = array()) function drag($id, $options = array())
{ {
$options = $this->_optionsForDraggable($options); $options = $this->_optionsForDraggable($options);
return $this->javascript->codeBlock("new Draggable('$id'$options);"); return $this->Javascript->codeBlock("new Draggable('$id'$options);");
} }
/** /**
@ -389,7 +389,7 @@ class AjaxHelper extends Helper
function drop($id, $options = array()) function drop($id, $options = array())
{ {
$options = $this->_optionsForDroppable($options); $options = $this->_optionsForDroppable($options);
return $this->javascript->codeBlock("Droppables.add('$id'$options);"); return $this->Javascript->codeBlock("Droppables.add('$id'$options);");
} }
function _optionsForDroppable ($options) function _optionsForDroppable ($options)
@ -421,7 +421,7 @@ class AjaxHelper extends Helper
$options['onUpdate'] = 'function(sortable){' . $this->remoteFunction($options).'}'; $options['onUpdate'] = 'function(sortable){' . $this->remoteFunction($options).'}';
} }
$options = $this->_optionsForSortable($options); $options = $this->_optionsForSortable($options);
return $this->javascript->codeBlock("Sortable.create('$id'$options);"); return $this->Javascript->codeBlock("Sortable.create('$id'$options);");
} }
function _optionsForSortable ($options) function _optionsForSortable ($options)

View file

@ -65,7 +65,7 @@ define('TAG_FIELDSET', '<fieldset><legend>%s</legend>%s</label>');
class FormHelper extends Helper class FormHelper extends Helper
{ {
var $helpers = array('html'); var $helpers = array('Html');
/** /**
* Constructor which takes an instance of the HtmlHelper class. * Constructor which takes an instance of the HtmlHelper class.
* *
@ -85,8 +85,8 @@ class FormHelper extends Helper
function isFieldError($field ) function isFieldError($field )
{ {
$error = 1; $error = 1;
$this->html->setFormTag( $field ); $this->Html->setFormTag( $field );
if( $error == $this->html->tagIsInvalid( $this->html->model, $this->html->field) ) if( $error == $this->Html->tagIsInvalid( $this->Html->model, $this->Html->field) )
{ {
return true; return true;
} else { } else {
@ -143,7 +143,7 @@ class FormHelper extends Helper
*/ */
function generateInputDiv($tagName, $prompt, $required=false, $errorMsg=null, $size=20, $htmlOptions=null ) function generateInputDiv($tagName, $prompt, $required=false, $errorMsg=null, $size=20, $htmlOptions=null )
{ {
$str = $this->html->inputTag( $tagName, $size, $htmlOptions ); $str = $this->Html->inputTag( $tagName, $size, $htmlOptions );
$strLabel = $this->labelTag( $tagName, $prompt ); $strLabel = $this->labelTag( $tagName, $prompt );
$divClass = "optional"; $divClass = "optional";
@ -180,7 +180,7 @@ class FormHelper extends Helper
function generateCheckboxDiv($tagName, $prompt, $required=false, $errorMsg=null, $htmlOptions=null ) function generateCheckboxDiv($tagName, $prompt, $required=false, $errorMsg=null, $htmlOptions=null )
{ {
$htmlOptions['class'] = "inputCheckbox"; $htmlOptions['class'] = "inputCheckbox";
$str = $this->html->checkbox( $tagName, null, $htmlOptions ); $str = $this->Html->checkbox( $tagName, null, $htmlOptions );
$strLabel = $this->labelTag( $tagName, $prompt ); $strLabel = $this->labelTag( $tagName, $prompt );
$divClass = "optional"; $divClass = "optional";
@ -215,7 +215,7 @@ class FormHelper extends Helper
*/ */
function generateDate($tagName, $prompt, $required=false, $errorMsg=null, $size=20, $htmlOptions=null ) function generateDate($tagName, $prompt, $required=false, $errorMsg=null, $size=20, $htmlOptions=null )
{ {
$str = $this->html->dateTimeOptionTag( $tagName, 'MDY' , 'NONE' ); $str = $this->Html->dateTimeOptionTag( $tagName, 'MDY' , 'NONE' );
$strLabel = $this->labelTag( $tagName, $prompt ); $strLabel = $this->labelTag( $tagName, $prompt );
$divClass = "optional"; $divClass = "optional";
@ -251,7 +251,7 @@ class FormHelper extends Helper
*/ */
function generateDateTime($tagName, $prompt, $required=false, $errorMsg=null, $size=20, $htmlOptions=null ) function generateDateTime($tagName, $prompt, $required=false, $errorMsg=null, $size=20, $htmlOptions=null )
{ {
$str = $this->html->dateTimeOptionTag( $tagName, 'MDY' , '12' ); $str = $this->Html->dateTimeOptionTag( $tagName, 'MDY' , '12' );
$strLabel = $this->labelTag( $tagName, $prompt ); $strLabel = $this->labelTag( $tagName, $prompt );
$divClass = "optional"; $divClass = "optional";
@ -288,7 +288,7 @@ class FormHelper extends Helper
*/ */
function generateAreaDiv($tagName, $prompt, $required=false, $errorMsg=null, $cols=60, $rows=10, $htmlOptions=null ) function generateAreaDiv($tagName, $prompt, $required=false, $errorMsg=null, $cols=60, $rows=10, $htmlOptions=null )
{ {
$str = $this->html->areaTag( $tagName, $cols, $rows, $htmlOptions ); $str = $this->Html->areaTag( $tagName, $cols, $rows, $htmlOptions );
$strLabel = $this->labelTag( $tagName, $prompt ); $strLabel = $this->labelTag( $tagName, $prompt );
$divClass = "optional"; $divClass = "optional";
@ -325,7 +325,7 @@ class FormHelper extends Helper
*/ */
function generateSelectDiv($tagName, $prompt, $options, $selected=null, $selectAttr=null, $optionAttr=null, $required=false, $errorMsg=null) function generateSelectDiv($tagName, $prompt, $options, $selected=null, $selectAttr=null, $optionAttr=null, $required=false, $errorMsg=null)
{ {
$str = $this->html->selectTag( $tagName, $options, $selected, $selectAttr, $optionAttr ); $str = $this->Html->selectTag( $tagName, $options, $selected, $selectAttr, $optionAttr );
$strLabel = $this->labelTag( $tagName, $prompt ); $strLabel = $this->labelTag( $tagName, $prompt );
$divClass = "optional"; $divClass = "optional";
@ -356,7 +356,7 @@ class FormHelper extends Helper
*/ */
function generateSubmitDiv($displayText, $htmlOptions = null) function generateSubmitDiv($displayText, $htmlOptions = null)
{ {
return $this->divTag( 'submit', $this->html->submitTag( $displayText, $htmlOptions) ); return $this->divTag( 'submit', $this->Html->submitTag( $displayText, $htmlOptions) );
} }
@ -446,7 +446,7 @@ class FormHelper extends Helper
$strFormFields = $strFormFields.$strFieldSet; $strFormFields = $strFormFields.$strFieldSet;
break; break;
case "hidden"; case "hidden";
$strFormFields = $strFormFields . $this->html->hiddenTag( $field['tagName']); $strFormFields = $strFormFields . $this->Html->hiddenTag( $field['tagName']);
break; break;
case "date": case "date":
$strFormFields = $strFormFields.$this->generateDate( $field['tagName'], $field['prompt'] ); $strFormFields = $strFormFields.$this->generateDate( $field['tagName'], $field['prompt'] );

View file

@ -47,7 +47,13 @@ class HtmlHelper extends Helper
/**#@+ /**#@+
* @access public * @access public
*/ */
/**
* Included helpers.
*
* @var array
*/
var $helpers = array('Ajax');
/** /**
* Base URL * Base URL
* *

View file

@ -16,36 +16,35 @@
<?php echo $html->image('cake.logo.png', array('alt'=>"CakePHP : Rapid Development Framework")); ?> <?php echo $html->image('cake.logo.png', array('alt'=>"CakePHP : Rapid Development Framework")); ?>
</a> </a>
</div> </div>
<span class="headerNav"> <div id="headerNav">
<?php <?php
$css_class = ($title_for_layout == 'Blog') ? 'active' : ''; echo $html->link('API', 'http://api.cakephp.org/');
echo $html->link('Blog', 'blog',array('class'=>$css_class));
echo $html->link('Wiki', 'http://wiki.cakephp.org');
echo $html->link('Wiki', 'http://wiki.cakephp.org',array('class'=>$css_class)); echo $html->link('CakeForge', 'http://cakeforge.org');
echo $html->link('CakeForge', 'http://cakeforge.org',array('class'=>$css_class)); echo $html->link('Trac', 'https://trac.cakephp.org');
echo $html->link('Trac', 'https://trac.cakephp.org',array('class'=>$css_class));
$css_class = ($title_for_layout == 'Pastes') ? 'active' : '';
echo $html->link('CakeBin', 'http://cakephp.org/pastes/',array('class'=>$css_class));
?> ?>
</class> </div>
</div> </div>
<div id="pageNav"> <div id="pageNav">
<?php <?php
$css_class = ($title_for_layout == 'Home') ? 'active' : ''; $css_class = ($title_for_layout == 'Home') ? 'active' : '';
echo $html->link('Home', 'http://cakephp.org/',array('class'=>$css_class)); echo $html->link('Home', 'http://cakephp.org/',array('class'=>$css_class));
echo '&nbsp;'; echo '&nbsp;';
$css_class = ($title_for_layout == 'Documentation') ? 'active' : ''; $css_class = ($title_for_layout == 'Blogs') ? 'active' : '';
echo $html->link('Documentation', 'http://cakephp.org/pages/documentation',array('class'=>$css_class)); echo $html->link('Blog', 'http://cakephp.org/blogs',array('class'=>$css_class));
echo '&nbsp;'; echo '&nbsp;';
$css_class = ($title_for_layout == 'Downloads') ? 'active' : ''; $css_class = ($title_for_layout == 'Downloads') ? 'active' : '';
echo $html->link('Downloads', 'http://cakephp.org/downloads/',array('class'=>$css_class)); echo $html->link('Downloads', 'http://cakephp.org/downloads/',array('class'=>$css_class));
echo '&nbsp;'; echo '&nbsp;';
$css_class = ($title_for_layout == 'Support') ? 'active' : ''; $css_class = ($title_for_layout == 'Support') ? 'active' : '';
echo $html->link('Support', 'http://cakephp.org/pages/support/',array('class'=>$css_class)); echo $html->link('Support', 'http://cakephp.org/pages/support/',array('class'=>$css_class));
echo '&nbsp;';
$css_class = ($title_for_layout == 'Pastes') ? 'active' : '';
echo $html->link('CakeBin', 'http://cakephp.org/pastes/',array('class'=>$css_class));
?> ?>
</div> </div>
<div id="content"> <div id="content">
@ -54,7 +53,7 @@
<div id="pb-cake"> <div id="pb-cake">
&copy; 2005 CakePHP :: &copy; 2005 CakePHP ::
<a href="https://trac.cakephp.org/wiki/Authors">CakePHP Developers and Authors</a> <a href="https://trac.cakephp.org/wiki/Authors">CakePHP Developers and Authors</a>
<p>CakePHP version 0.10.0.1076_dev</p> <p>CakePHP version 0.10.0.1211_alpha</p>
<a href="http://www.cakephp.org/" target="_new" class="simple"> <a href="http://www.cakephp.org/" target="_new" class="simple">
<?php echo $html->image('cake.power.png', array('alt'=>"CakePHP : Rapid Development Framework", 'border'=>"0"))?> <?php echo $html->image('cake.power.png', array('alt'=>"CakePHP : Rapid Development Framework", 'border'=>"0"))?>
</a> </a>

View file

@ -32,42 +32,40 @@
*/ */
?> ?>
<br/> <br/>
<h1>CakePHP <em>Works!</em></h1> <h1>Cake <em>Alpha</em> is sooo tasty</h1>
<h3 style="background:#DBA941;padding:4px;">Your database configuration file is <?php echo file_exists(CONFIGS.'database.php') ? 'present.'. $filePresent = ' ' : 'not present.';?></h3> <p>
The Alpha release is exciting. We changed quite a few things, but hope you agree with
our efforts to make the code easier to read and handle.
It all comes back to our desire to make the best RAD framework available.
</p>
<p>See <a href="http://cakephp.org/">CakePHP.org</a> for major changes in this release</p>
<p>If you plan to upgrade from an older version, you may also want to read the <a href="http://cakephp.org/pages/changelog">changelog</a></p>
<h3></h3>
<p style="background:#DBA941;padding:4px;font-size: 16px;">Your database configuration file is <?php echo file_exists(CONFIGS.'database.php') ? 'present.'. $filePresent = ' ' : 'not present.';?></p>
<?php $db = DboFactory::getInstance(); ?> <?php $db = DboFactory::getInstance(); ?>
<?php if (!empty($filePresent)):?> <?php if (!empty($filePresent)):?>
<h3 style="background:#DBA941;padding:4px;">Cake <?php echo $db->connected ? "is able to" : "is not able to" ?> connect to the database.</h3> <p style="background:#DBA941;padding:4px;font-size: 16px;">Cake <?php echo $db->connected ? "is able to" : "is not able to" ?> connect to the database.</p>
<?php endif; ?> <?php endif; ?>
<h2>Editing <em>this Page</em></h2> <h2>Editing <em>this Page</em></h2>
<p> <p>
To change the content of this page, create <code>/app/views/pages/home.thtml</code>. To change it's layout, create <code>/app/views/layouts/default.thtml</code>. You can also add some CSS styles for your pages at <code>/webroot/css/</code>. To change the content of this page, create <code>/app/views/pages/home.thtml</code>.
To change it's layout, create <code>/app/views/layouts/default.thtml</code>.
<a href="http://wiki.cakephp.org/tutorials:sample_layout">see the wiki for more info</a>
You can also add some CSS styles for your pages at <code>/webroot/css/</code>.
</p> </p>
<h2>Introducing <em>Cake</em></h2> <h2>More about <em>Cake</em></h2>
<p> <p>
Cake is a rapid development framework for PHP which uses commonly known design patterns like Cake is a rapid development framework for PHP which uses commonly known design patterns like
ActiveRecord, Association Data Mapping, Front Controller and MVC. ActiveRecord, Association Data Mapping, Front Controller and MVC.
Our primary goal is to provide a structured framework that enables PHP users at all levels Our primary goal is to provide a structured framework that enables PHP users at all levels
to rapidly develop robust web applications, without any loss to flexibility. to rapidly develop robust web applications, without any loss to flexibility.
</p> </p>
<h2><a href="http://cakephp.org/downloads/index/release">What's <em>New</em></a></h2>
<p>Release 0.10.0.1076_dev with:</p>
<ul>
<li>Scaffolding</li>
<li>Output Types</li>
<li>Standard Modules (ACL, etc.)</li>
<li>Associations</li>
<li>Evolved Directory Structure and API to make your life easier.</li>
</ul>
<h2>Getting <em>Involved</em></h2>
<p>We are always looking for people to help with tutorials, bug requests, and documenation.
Best place to get involved is IRC. We will be implementing some contributor guidlines shortly for those of you who would like to code for the project.
Obviously, everyone and anyone can always make a suggestion, raise a new idea, help us brainstorm, and all that stuff that makes this fun.
</p>
<p> <p>
<b>#cakephp at irc.freenode.net</b> <b>#cakephp at irc.freenode.net</b>
&middot; &middot;
<a href="http://groups-beta.google.com/group/cake-php">Cake PHP Google Group</a> <a href="http://groups-beta.google.com/group/cake-php">Cake PHP Google Group</a>
&middot; &middot;
<a href="https://trac.cakephp.org/">Cake TRAC (Wiki, SVN repository, etc.)</a> <a href="https://trac.cakephp.org/">Cake TRAC (Wiki, SVN repository, etc.)</a>
</p> </p>
<br/>

View file

@ -91,7 +91,7 @@ class View extends Object
* @var mixed A single name as a string or a list of names as an array. * @var mixed A single name as a string or a list of names as an array.
* @access protected * @access protected
*/ */
var $helpers = array('html'); var $helpers = array('Html');
/** /**
* Path to View. * Path to View.
@ -525,12 +525,15 @@ class View extends Object
foreach(array_keys($loadedHelpers) as $helper) foreach(array_keys($loadedHelpers) as $helper)
{ {
${$helper} =& $loadedHelpers[$helper]; $replace = strtolower(substr($helper, 0, 1));
if(isset(${$helper}->helpers) && is_array(${$helper}->helpers)) $camelBackedHelper = preg_replace('/\\w/', $replace, $helper, 1);
${$camelBackedHelper} =& $loadedHelpers[$helper];
if(isset(${$camelBackedHelper}->helpers) && is_array(${$camelBackedHelper}->helpers))
{ {
foreach(${$helper}->helpers as $subHelper) foreach(${$camelBackedHelper}->helpers as $subHelper)
{ {
${$helper}->{$subHelper} =& $loadedHelpers[$subHelper]; ${$camelBackedHelper}->{$subHelper} =& $loadedHelpers[$subHelper];
} }
} }
} }
@ -572,41 +575,44 @@ class View extends Object
{ {
if(in_array($helper, array_keys($loaded)) !== true) if(in_array($helper, array_keys($loaded)) !== true)
{ {
$helperFn = HELPERS.Inflector::underscore($helper).'.php'; $helperFn = Inflector::underscore($helper).'.php';
if(file_exists(HELPERS.Inflector::underscore($helper).'.php'))
if(file_exists(HELPERS.$helperFn))
{ {
$helperFn = HELPERS.Inflector::underscore($helper).'.php'; $helperFn = HELPERS.$helperFn;
} }
else if(file_exists(LIBS.'view'.DS.'helpers'.DS.Inflector::underscore($helper).'.php')) else if(file_exists(LIBS.'view'.DS.'helpers'.DS.$helperFn))
{ {
$helperFn = LIBS.'view'.DS.'helpers'.DS.Inflector::underscore($helper).'.php'; $helperFn = LIBS.'view'.DS.'helpers'.DS.$helperFn;
} }
$helperCn = ucfirst($helper).'Helper'; $helperCn = $helper.'Helper';
$replace = strtolower(substr($helper, 0, 1));
$camelBackedHelper = preg_replace('/\\w/', $replace, $helper, 1);
if (is_file($helperFn)) if (is_file($helperFn))
{ {
require_once $helperFn; require_once $helperFn;
if(class_exists($helperCn)===true) if(class_exists($helperCn)===true)
{ {
${$helper} =& new $helperCn; ${$camelBackedHelper} =& new $helperCn;
${$helper}->base = $this->base; ${$camelBackedHelper}->base = $this->base;
${$helper}->webroot = $this->webroot; ${$camelBackedHelper}->webroot = $this->webroot;
${$helper}->here = $this->here; ${$camelBackedHelper}->here = $this->here;
${$helper}->params = $this->params; ${$camelBackedHelper}->params = $this->params;
${$helper}->action = $this->action; ${$camelBackedHelper}->action = $this->action;
${$helper}->data = $this->data; ${$camelBackedHelper}->data = $this->data;
if(!empty($this->validationErrors)) if(!empty($this->validationErrors))
{ {
${$helper}->validationErrors = $this->validationErrors; ${$camelBackedHelper}->validationErrors = $this->validationErrors;
} }
$loaded[$helper] =& ${$helper}; $loaded[$helper] =& ${$camelBackedHelper};
// Find and load helper dependencies // Find and load helper dependencies
if (isset(${$helper}->helpers) && is_array(${$helper}->helpers)) if (isset(${$camelBackedHelper}->helpers) && is_array(${$camelBackedHelper}->helpers))
{ {
$loaded =& $this->_loadHelpers($loaded, ${$helper}->helpers); $loaded =& $this->_loadHelpers($loaded, ${$camelBackedHelper}->helpers);
} }
} }
else else