Merging fixes into trunk:

Revision: [3440]
Adding note to api doc of the redirect function (#1358)

Revision: [3439]
Revoking previous change, fixing bug in api doc

Revision: [3432]
added fix for #1352

Revision: [3430]
Adding nl2br in Sanitize::html

Revision: [3420]
Typo fixed

Revision: [3383]
Refactoring last commit for admin check

Revision: [3382]
Adding fix for admin being searched in entire string

Revision: [3379]
Fixing errors when CSS not showing after recent fixes to error class

Revision: [3376]
Backporting string-escaping fix from 1.2 for Ticket #

Revision: [3373]
Adding Windows-specific port delimiter for connecting to SQL Server (Ticket #1261).

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@3454 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
phpnut 2006-09-07 19:23:27 +00:00
parent fe903b2531
commit eb202d44f9
2 changed files with 146 additions and 123 deletions

View file

@ -310,7 +310,7 @@ class Bake {
$this->stdout('Possible models based on your current database:');
for ($i = 0; $i < count($tables); $i++) {
$this->stdout($i + 1 . ". " . $inflect->camelize($inflect->singularize($tables[$i])));
$this->stdout($i + 1 . ". " . $inflect->classify($tables[$i]));
}
while ($modelName == '') {
@ -324,7 +324,7 @@ class Bake {
}
if (intval($modelName) > 0 && intval($modelName) <= $i ) {
$modelClassName = $inflect->camelize($inflect->singularize($tables[$modelName - 1]));
$modelClassName = $inflect->classify($tables[$modelName - 1]);
$modelTableName = $tables[intval($modelName) - 1];
} else {
$modelClassName = $inflect->camelize($modelName);
@ -404,20 +404,20 @@ class Bake {
foreach($modelFieldsTemp as $field) {
if($field['name'] == $inflect->singularize($modelTableName).'_id') {
$hasOneClasses[] = $inflect->camelize($inflect->singularize($table));
$hasManyClasses[] = $inflect->camelize($inflect->singularize($table));
$hasOneClasses[] = $inflect->classify($table);
$hasManyClasses[] = $inflect->classify($table);
}
}
$offset = strpos($table, $modelTableName . '_');
if($offset !== false) {
$offset = strlen($modelTableName . '_');
$hasAndBelongsToManyClasses[] = $inflect->camelize($inflect->singularize(substr($table, $offset)));
$hasAndBelongsToManyClasses[] = $inflect->classify(substr($table, $offset));
}
$offset = strpos($table, '_' . $modelTableName);
if ($offset !== false) {
$hasAndBelongsToManyClasses[] = $inflect->camelize($inflect->singularize(substr($table, 0, $offset)));
$hasAndBelongsToManyClasses[] = $inflect->classify(substr($table, 0, $offset));
}
}
@ -535,7 +535,7 @@ class Bake {
$looksGood = $this->getInput('Look okay?', array('y','n'), 'y');
if (strtolower($looksGood) == 'y' || strtolower($looksGood) == 'yes') {
if ($modelTableName == $inflect->underscore($inflect->pluralize($modelClassName))) {
if ($modelTableName == $inflect->tableize($modelClassName)) {
// set it to null...
// putting $useTable in the model
// is unnecessary.
@ -667,7 +667,7 @@ class Bake {
if(isset($value['foreignKey'])) {
$otherModelObject =& ClassRegistry::getObject($inflect->underscore($objModel->tableToModel[$value['table']]));
$displayField = $otherModelObject->getDisplayField();
$viewView .= "\t<dd>&nbsp;<?php echo \$html->link(\$".$inflect->singularize($this->lowCtrl)."['{$alias[$count]}']['{$displayField}'], '/" . $inflect->underscore($value['controller']) . "/view/' . \${$this->lowCtrl}['{$objModel->tableToModel[$objModel->table]}']['{$field}'])?></dd>\n";
$viewView .= "\t<dd>&nbsp;<?php echo \$html->link(\$".$inflect->singularize($this->lowCtrl)."['{$alias[$count]}']['{$displayField}'], '/" . $inflect->underscore($value['controller']) . "/view/' .\$".$inflect->singularize($this->lowCtrl)."['{$objModel->tableToModel[$objModel->table]}']['{$field}'])?></dd>\n";
$count++;
} else {
$viewView .= "\t<dd>&nbsp;<?php echo \$".$inflect->singularize($this->lowCtrl)."['{$objModel->tableToModel[$objModel->table]}']['{$field}']?></dd>\n";
@ -692,7 +692,7 @@ class Bake {
$otherModelName = $objModel->tableToModel[$objModel->{$model}->table];
$controller = $inflect->pluralize($model);
$new = true;
$viewView .= "<div class='related'><h2>Related " . $inflect->humanize($association) . "</h2>\n";
$viewView .= "<div class='related'>\n<h3>Related " . $inflect->humanize($association) . "</h3>\n";
$viewView .= "<?php if(!empty(\$".$inflect->singularize($this->lowCtrl)."['{$association}'])): ?>\n";
$viewView .= "<dl>\n";
$viewView .= "\t<?php foreach(\$".$inflect->singularize($this->lowCtrl)."['{$association}'] as \$field => \$value): ?>\n";
@ -715,7 +715,7 @@ class Bake {
$count = 0;
$otherModelName = $inflect->singularize($model);
$controller = $inflect->pluralize($model);
$viewView .= "\n<div class='related'>\n<h2>Related " . $inflect->humanize($inflect->pluralize($association)) . "</h2>\n";
$viewView .= "\n<div class='related'>\n<h3>Related " . $inflect->humanize($inflect->pluralize($association)) . "</h3>\n";
$viewView .= "<?php if(!empty(\$".$inflect->singularize($this->lowCtrl)."['{$association}'])):?>\n";
$viewView .= "<table cellpadding=\"0\" cellspacing=\"0\">\n";
$viewView .= "<tr>\n";
@ -887,15 +887,17 @@ class Bake {
foreach($tempModel->hasAndBelongsToMany as $association => $relation) {
if(!empty($relation['className'])) {
$model = $relation['className'];
$lowerName = strtolower($association);
$lowerFirst = strtolower(substr($association, 0, 1));
$lowerName = preg_replace('/\\w/', $lowerFirst, $association, 1);
$actions .= "\t\t\t\$this->set('{$lowerName}Array', \$this->{$controllerModel}->{$model}->generateList());\n";
$actions .= "\t\t\t\$this->set('selected{$model}', null);\n";
$actions .= "\t\t\t\$this->set('selected{$association}', null);\n";
}
}
foreach($tempModel->belongsTo as $association => $relation) {
if(!empty($relation['className'])) {
$model = $relation['className'];
$lowerName = strtolower(substr( $relation['foreignKey'], 0, strpos( $relation['foreignKey'], "_id" ) ));
$lowerFirst = strtolower(substr($model, 0, 1));
$lowerName = preg_replace('/\\w/', $lowerFirst, $model, 1);
$actions .= "\t\t\t\$this->set('{$lowerName}Array', \$this->{$controllerModel}->{$model}->generateList());\n";
}
}
@ -918,16 +920,18 @@ class Bake {
if(!empty($relation['className'])) {
$model = $relation['className'];
$associationModel = new $model();
$lowerName = strtolower($association);
$lowerFirst = strtolower(substr($association, 0, 1));
$lowerName = preg_replace('/\\w/', $lowerFirst, $association, 1);
$actions .= "\t\t\t\t\$this->set('{$lowerName}Array', \$this->{$controllerModel}->{$model}->generateList());\n";
$actions .= "\t\t\t\tif(empty(\$this->data['{$model}']['{$model}'])) { \$this->data['{$model}']['{$model}'] = null; }\n";
$actions .= "\t\t\t\t\$this->set('selected{$model}', \$this->data['{$model}']['{$model}']);\n";
$actions .= "\t\t\t\tif(empty(\$this->data['{$association}']['{$association}'])) { \$this->data['{$association}']['{$association}'] = null; }\n";
$actions .= "\t\t\t\t\$this->set('selected{$association}', \$this->data['{$association}']['{$association}']);\n";
}
}
foreach($tempModel->belongsTo as $association => $relation) {
if(!empty($relation['className'])) {
$model = $relation['className'];
$lowerName = strtolower(substr( $relation['foreignKey'], 0, strpos( $relation['foreignKey'], "_id" ) ));
$lowerFirst = strtolower(substr($model, 0, 1));
$lowerName = preg_replace('/\\w/', $lowerFirst, $model, 1);
$actions .= "\t\t\t\t\$this->set('{$lowerName}Array', \$this->{$controllerModel}->{$model}->generateList());\n";
}
}
@ -943,15 +947,17 @@ class Bake {
if(!empty($relation['className'])) {
$model = $relation['className'];
$associationModel = new $model();
$lowerName = strtolower($association);
$lowerFirst = strtolower(substr($association, 0, 1));
$lowerName = preg_replace('/\\w/', $lowerFirst, $association, 1);
$actions .= "\t\t\t\$this->set('{$lowerName}Array', \$this->{$controllerModel}->{$model}->generateList());\n";
$actions .= "\t\t\t\$this->set('selected{$model}', \$this->_selectedArray(\$this->data['{$model}'], '{$associationModel->primaryKey}'));\n";
$actions .= "\t\t\t\$this->set('selected{$association}', \$this->_selectedArray(\$this->data['{$association}'], '{$associationModel->primaryKey}'));\n";
}
}
foreach($tempModel->belongsTo as $association => $relation) {
if(!empty($relation['className'])) {
$model = $relation['className'];
$lowerName = strtolower(substr( $relation['foreignKey'], 0, strpos( $relation['foreignKey'], "_id" ) ));
$lowerFirst = strtolower(substr($model, 0, 1));
$lowerName = preg_replace('/\\w/', $lowerFirst, $model, 1);
$actions .= "\t\t\t\$this->set('{$lowerName}Array', \$this->{$controllerModel}->{$model}->generateList());\n";
}
}
@ -973,16 +979,18 @@ class Bake {
if(!empty($relation['className'])) {
$model = $relation['className'];
$associationModel = new $model();
$lowerName = strtolower($association);
$lowerFirst = strtolower(substr($association, 0, 1));
$lowerName = preg_replace('/\\w/', $lowerFirst, $association, 1);
$actions .= "\t\t\t\t\$this->set('{$lowerName}Array', \$this->{$controllerModel}->{$model}->generateList());\n";
$actions .= "\t\t\t\tif(empty(\$this->data['{$model}']['{$model}'])) { \$this->data['{$model}']['{$model}'] = null; }\n";
$actions .= "\t\t\t\t\$this->set('selected{$model}', \$this->data['{$model}']['{$model}']);\n";
$actions .= "\t\t\t\tif(empty(\$this->data['{$association}']['{$association}'])) { \$this->data['{$association}']['{$association}'] = null; }\n";
$actions .= "\t\t\t\t\$this->set('selected{$association}', \$this->data['{$association}']['{$association}']);\n";
}
}
foreach($tempModel->belongsTo as $association => $relation) {
if(!empty($relation['className'])) {
$model = $relation['className'];
$lowerName = strtolower(substr( $relation['foreignKey'], 0, strpos( $relation['foreignKey'], "_id" ) ));
$lowerFirst = strtolower(substr($model, 0, 1));
$lowerName = preg_replace('/\\w/', $lowerFirst, $model, 1);
$actions .= "\t\t\t\t\$this->set('{$lowerName}Array', \$this->{$controllerModel}->{$model}->generateList());\n";
}
}
@ -1602,7 +1610,7 @@ class Bake {
$htmlAttributes['rows'] = $rows;
$tagNameArray = explode('/', $tagName);
$str = "\t<?php echo \$html->textarea('{$tagName}', " . $this->attributesToArray($htmlAttributes) . ");?>\n";
$str .= "\t<?php echo \$html->tagErrorMsg('{$tagName}', 'Please enter the {$tagNameArray[1]}.');?>\n";
$str .= "\t<?php echo \$html->tagErrorMsg('{$tagName}', 'Please enter the {$prompt}.');?>\n";
$strLabel = "\n\t<?php echo \$form->label( '{$tagName}', '{$prompt}' );?>\n";
$divClass = "optional";
@ -1634,7 +1642,7 @@ class Bake {
$htmlOptions['class'] = "inputCheckbox";
$tagNameArray = explode('/', $tagName);
$str = "\n\t<?php echo \$html->checkbox('{$tagName}', null, " . $this->attributesToArray($htmlAttributes) . ");?>\n";
$str .= "\t<?php echo \$html->tagErrorMsg('{$tagName}', 'Please enter the {$tagNameArray[1]}.');?>\n";
$str .= "\t<?php echo \$html->tagErrorMsg('{$tagName}', 'Please check the {$prompt}.');?>\n";
$strLabel = "\t<?php echo \$form->label('{$tagName}', '{$prompt}');?>\n";
$divClass = "optional";
@ -1666,7 +1674,7 @@ class Bake {
function generateDate($tagName, $prompt, $required=false, $errorMsg=null, $size=20, $htmlOptions=null, $selected=null ) {
$tagNameArray = explode('/', $tagName);
$str = "\t<?php echo \$html->dateTimeOptionTag('{$tagName}', 'MDY' , 'NONE', \$html->tagValue('{$tagName}'), " . $this->attributesToArray($htmlOptions) . ");?>\n";
$str .= "\t<?php echo \$html->tagErrorMsg('{$tagName}', 'Please enter the {$tagNameArray[1]}.');?>\n";
$str .= "\t<?php echo \$html->tagErrorMsg('{$tagName}', 'Please select the {$prompt}.');?>\n";
$strLabel = "\n\t<?php echo \$form->label('{$tagName}', '{$prompt}');?>\n";
$divClass = "optional";
@ -1726,7 +1734,7 @@ class Bake {
function generateDateTime($tagName, $prompt, $required=false, $errorMsg=null, $size=20, $htmlOptions=null, $selected = null ) {
$tagNameArray = explode('/', $tagName);
$str = "\t<?php echo \$html->dateTimeOptionTag('{$tagName}', 'MDY' , '12', \$html->tagValue('{$tagName}'), " . $this->attributesToArray($htmlOptions) . ");?>\n";
$str .= "\t<?php echo \$html->tagErrorMsg('{$tagName}', 'Please enter the {$tagNameArray[1]}.');?>\n";
$str .= "\t<?php echo \$html->tagErrorMsg('{$tagName}', 'Please select the {$prompt}.');?>\n";
$strLabel = "\n\t<?php echo \$form->label('{$tagName}', '{$prompt}');?>\n";
$divClass = "optional";
@ -1759,7 +1767,7 @@ class Bake {
$htmlAttributes['size'] = $size;
$tagNameArray = explode('/', $tagName);
$str = "\t<?php echo \$html->input('{$tagName}', " . $this->attributesToArray($htmlAttributes) . ");?>\n";
$str .= "\t<?php echo \$html->tagErrorMsg('{$tagName}', 'Please enter the {$tagNameArray[1]}.');?>\n";
$str .= "\t<?php echo \$html->tagErrorMsg('{$tagName}', 'Please enter the {$prompt}.');?>\n";
$strLabel = "\n\t<?php echo \$form->label('{$tagName}', '{$prompt}');?>\n";
$divClass = "optional";
@ -1797,14 +1805,15 @@ class Bake {
$controllerPath = strtolower(substr($inflect->pluralize($properModel), 0, 1)) . substr($inflect->pluralize($properModel), 1);
$actionPath = strtolower(substr($properModel, 0, 1)) . substr($properModel, 1) . 'List';
$path = "/$controllerPath/$actionPath";
$lowerName = strtolower($tagNameArray[0]);
$lowerFirst = strtolower(substr($tagNameArray[0], 0, 1));
$lowerName = preg_replace('/\\w/', $lowerFirst, $tagNameArray[0], 1);
if($selectAttr['multiple'] != 'multiple') {
$str = "\t<?php echo \$html->selectTag('{$tagName}', " . "\${$model}Array, \$html->tagValue('{$tagName}'), " . $this->attributesToArray($selectAttr) . ");?>\n";
$str .= "\t<?php echo \$html->tagErrorMsg('{$tagName}', 'Please enter the {$tagNameArray[1]}.') ?>\n";
$str .= "\t<?php echo \$html->tagErrorMsg('{$tagName}', 'Please select the {$prompt}.') ?>\n";
} else {
$str = "\t<?php echo \$html->selectTag('{$tagName}', \${$lowerName}Array, \$selected{$tagNameArray[0]}, array('multiple' => 'multiple', 'class' => 'selectMultiple'));?>\n";
$str .= "\t<?php echo \$html->tagErrorMsg('{$tagName}', 'Please enter the {$tagNameArray[1]}.');?>\n";
$str .= "\t<?php echo \$html->tagErrorMsg('{$tagName}', 'Please select the {$prompt}.');?>\n";
}
$strLabel = "\n\t<?php echo \$form->label('{$tagName}', '{$prompt}');?>\n";
$divClass = "optional";
@ -2012,7 +2021,7 @@ class Bake {
$this->hr();
$this->stdout("Skel Directory: $skel");
$this->stdout("Will be copied to:");
$this->stdout("New App Directory: $projectPath");
$this->stdout("New App Direcotry: $projectPath");
$this->hr();
$looksGood = $this->getInput('Look okay?', array('y', 'n', 'q'), 'y');

View file

@ -5,15 +5,12 @@ padding:0;
body{
font-family:"frutiger linotype","lucida grande",helvetica,arial,sans-serif;
font-size:76%;
text-align:center;
color:#333;
font-size: 76%;
}
/*
* General Style Info
*/
/* General Style Info */
a{
color:#003d4c;
text-decoration:underline;
@ -33,18 +30,21 @@ font-weight:normal;
h1{
color: #003d4c;
padding:0.3em 0;
margin:0.3em 0;
font-size: 180%;
}
h2{
color:#c6c65b;
padding-top: 1em;
margin:0.3em 0;
font-size: 180%;
}
h3{
color:#c6c65b;
padding-top:0.5em;
padding-top:2em;
font-size: 140%;
}
h4{
@ -54,31 +54,29 @@ font-weight:normal;
}
em {
font-size: 12px;
font-size: 12px;
}
ul, li {
margin: 0 12px;
}
/*
* Layout
*/
/* Layout */
#container{
text-align:left;
}
#header{
margin-top: 1em;
padding: 4px 20px;
}
#content{
clear:both;
padding: 10px 40px;
padding: 0px 40px 10px 40px;
background-color: #fff;
color: #333;
line-height: 18px;
}
#footer{
clear:both;
@ -87,98 +85,105 @@ text-align: right;
}
/* tables */
table {
width: 100%;
border-top: 1px solid #ccc;
border-left: 1px solid #ccc;
border-bottom: 1px solid #ccc;
color:#333;
background-color: #fff;
clear:both;
padding: 0;
margin: 0 0 2em 0;
white-space: normal;
width: 100%;
border-top: 1px solid #ccc;
border-left: 1px solid #ccc;
border-bottom: 1px solid #ccc;
color:#333;
background-color: #fff;
clear:both;
padding: 0;
margin: 0 0 2em 0;
white-space: normal;
}
th {
background-color: #e2e2e2;
border-top: 1px solid #fff;
border-left: 1px solid #fff;
border-right: 1px solid #003d4c;
border-bottom: 1px solid #003d4c;
text-align: center;
padding:1px 4px;
background-color: #e2e2e2;
border-top: 1px solid #fff;
border-left: 1px solid #fff;
border-right: 1px solid #003d4c;
border-bottom: 1px solid #003d4c;
text-align: center;
padding:1px 4px;
}
table tr td {
border-right: 1px solid #ddd;
padding:4px 4px;
vertical-align:top;
text-align: center;
border-right: 1px solid #ddd;
padding:4px 4px;
vertical-align:top;
text-align: center;
}
table tr.altRow td {
background: #f4f4f4;
background: #f4f4f4;
}
#cakeSqlLog td {
text-align: left;
padding: 4px 8px;
background: #fff;
border-bottom: 2px solid #ccc;
}
#cakeSqlLog td {
text-align: left;
padding: 4px 8px;
background: #fff;
border-right: 1px solid #ddd;
border-bottom: 1px solid #ccc;
}
/* scaffold show */
div.related {
clear:both;
display:block;
clear:both;
display:block;
}
dl {
line-height:2em;
margin:0em 1em;
float:left;
padding-right: 10px;
line-height:2em;
margin:0em 1em;
float:left;
width: 400px;
}
dt {
font-weight: bold;
vertical-align:top;
font-weight: bold;
vertical-align:top;
}
dd {
margin-left:14em;
margin-top:-2em;
vertical-align:top;
margin-left:10em;
margin-top:-2em;
vertical-align:top;
}
/* notices and errors */
#flashMessage, .error, .error_message {
color:#900;
font-size: 18px;
background-color: #fff;
margin: 8px 4px;
color:#900;
font-size: 16px;
background-color: #fff;
margin: 8px 0px;
font-weight: bold;
}
.error_message {
clear: both;
font-weight: bold;
clear: both;
}
.error em {
font-size: 18px;
color: #003d4c;
font-size: 18px;
color: #003d4c;
}
.notice {
color: #656565;
font-size: 14px;
padding: 4px 0;
display:block;
color: #656565;
font-size: 14px;
background-color: #f4f4f4;
padding: 0.5em;
margin: 1em 0;
display:block;
}
.tip {
color: #656565;
background-color: #ddd;
color: #656565;
background-color: #ddd;
}
/* forms */
form {
margin-top: 2em;
}
form div{
vertical-align: text-top;
margin-left: 2em;
margin-bottom:1em;
margin-left: 1em;
margin-bottom:2em;
overflow: auto;
}
form div.date{
margin-left: 0em;
@ -186,50 +191,59 @@ margin-left: 0em;
label {
display: block;
float:left;
min-width: 140px;
width: 140px;
font-size: 14px;
padding-right: 20px;
}
input[type=checkbox] {
float: left;
clear: left;
margin: 2px 6px 7px 2px;
float: left;
clear: left;
margin: 2px 6px 7px 2px;
}
input,textarea {
input, textarea {
clear: both;
display:block;
font-size: 14px;
font-family: inherit;
}
select {
clear: both;
vertical-align: text-top;
vertical-align: text-bottom;
font-size: 14px;
font-family: inherit;
}
option {
padding: 0 0.3em;
font-size: 14px;
font-family: inherit;
padding: 0 0.3em;
}
input[type=submit] {
display: inline;
vertical-align: bottom;
display: inline;
vertical-align: bottom;
}
.required{
clear: both;
color:#222;
font-weight:bold;
}
.optional{
clear: both;
color:#555;
}
.submit {
clear: both;
margin-top: 20px;
margin-left: 80px;
clear: both;
margin-top: 40px;
margin-left: 140px;
}
/* action links */
ul.actions {
float: left;
margin-left:20px;
width: 200px;
float: left;
margin-left:20px;
width: 200px;
}
ul.actions li {
margin-top: 4px;
}
margin-top: 4px;
}
pre {
padding: 1em;
}