updating scaffolding and css

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5038 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
gwoo 2007-05-10 16:19:23 +00:00
parent 2131b074f6
commit d1d583f0cd
7 changed files with 367 additions and 237 deletions

View file

@ -7,16 +7,16 @@ padding:0;
body {
background-color: #2C6877;
color: #fff;
font-family: "frutiger linotype", "lucida grande", "helvetica", "arial", sans-serif;
font-size: 76%;
font-family: "frutiger linotype", "lucida grande", "verdana", sans-serif;
}
a {
background-color: #fff;
background-color: inherit;
color: #003d4c;
text-decoration: underline;
font-weight: bold;
}
a:hover {
background-color: #fff;
background-color: inherit;
color: #003d4c;
text-decoration:none;
}
@ -27,23 +27,23 @@ em {
font-size: 12px;
}
h1, h2, h3, h4 {
background-color: #fff;
background-color: inherit;
font-weight:normal;
}
h1 {
color: #003d4c;
font-size: 180%;
margin: 0.3em 0;
font-size: 160%;
margin: 0.1em 0;
}
h2 {
color: #2C6877;
font-size: 180%;
font-size: 160%;
margin: 0.3em 0;
padding-top: 1em;
}
h3 {
color: #c6c65b;
font-size: 140%;
font-size: 120%;
padding-top: 2em;
}
h4 {
@ -63,13 +63,13 @@ ul, li {
#header{
background-color: #2C6877;
padding: 10px 20px 0 20px;
height: 83px;
height: 5em;
}
#header h1 {
color: #ffffff;
background: url('../img/cake.icon.png') no-repeat;
padding: 5px 50px;
height: 60px;
height: 5em;
}
#header h1 a {
color: #ffffff;
@ -111,12 +111,25 @@ th {
border-left: 1px solid #fff;
border-right: 1px solid #bbb;
border-bottom: 1px solid #bbb;
padding: 1px 4px;
text-align: center;
}
th a {
display: block;
padding: 2px 4px;
text-decoration: none;
}
th a:hover {
background-color: #ccc;
color: #333;
text-decoration: none;
}
table tr td {
border-right: 1px solid #ddd;
padding: 4px 4px;
background: #fff;
border-right: 1px solid #ccc;
padding: 4px;
text-align: center;
vertical-align: top;
}
@ -124,14 +137,17 @@ table tr.altrow td {
background: #f4f4f4;
}
td.actions {
text-align: center;
white-space: nowrap;
}
td.actions a {
padding: 0 6px;
display: inline;
margin: 0px 6px;
}
#cakeSqlLog td {
background: #fff;
border-bottom: 2px solid #ccc;
.cakeSqlLog table {
background: #f4f4f4;
}
.cakeSqlLog td {
padding: 4px 8px;
text-align: left;
}
@ -139,6 +155,7 @@ td.actions a {
/* Paging */
div.paging {
color: #ccc;
margin-bottom: 2em;
}
div.paging div.disabled {
color: #ddd;
@ -167,25 +184,32 @@ dd {
/* Forms */
form {
margin-top: 0;
clear: both;
margin-right: 20px;
padding: 0;
width: 50%;
width: 60%;
}
fieldset {
border: 1px solid #ccc;
margin-top: 30px;
padding: 16px 20px;
}
fieldset legend {
color: #2C6877;
font-size: 160%;
font-weight: bold;
}
form div {
border: 1px solid #ddd;
clear: both;
margin-bottom: 1em;
padding: .8em 2em 1em 1.4em;
padding: .5em;
vertical-align: text-top;
}
form div.required {
color: #333;
background: #f2f2f2;
font-weight: bold;
}
form div.optional, form div.input {
background: #f6f6f6;
color: #444;
}
form div.submit {
@ -196,44 +220,47 @@ form div.submit {
}
label {
display: block;
font-size: 14px;
font-size: 110%;
padding-right: 20px;
}
input, textarea {
clear: both;
display: block;
font-size: 14px;
font-size: 140%;
font-family: "frutiger linotype", "lucida grande", "verdana", sans-serif;
padding: 2px;
width: 100%;
}
select {
clear: both;
font-size: 14px;
font-size: 120%;
vertical-align: text-bottom;
}
select[multiple=multiple] {
width: 100%;
}
option {
font-size: 14px;
padding: 0 0.3em;
font-size: 120%;
padding: 0 3px;
}
input[type=checkbox] {
clear: left;
float: left;
margin: 2px 6px 7px 2px;
margin: 0px 6px 7px 2px;
width: auto;
}
input[type=submit] {
display: inline;
padding: 0 .4em;
padding: 2px 5px;
width: auto;
font-size: 110%;
vertical-align: bottom;
}
/* Notices and Errors */
div.message, p.error, div.error-message {
color: #900;
font-size: 16px;
font-size: 140%;
font-weight: bold;
margin: 8px 0px;
}
@ -241,48 +268,78 @@ div.error-message {
clear: both;
}
div.error em {
font-size: 18px;
font-size: 140%;
color: #003d4c;
}
span.notice {
background-color: #c6c65b;
color: #fff;
display: block;
font-size: 16px;
font-size: 140%;
padding: 0.5em;
margin: 1em 0;
}
/* Actions */
div.actions {
/* Nav & Actions */
div.nav {
text-align: left;
position: absolute;
top: 75px;
left: 25px;
top: 9em;
left: 60%;
}
div.nav ul li a {
display: block;
background: #fff;
color: #003d4c;
padding: 3px 8px;
text-decoration: none;
}
div.nav ul {
background: #003d4c;
margin: 0;
padding: 0;
list-style-type: none;
}
div.nav li {
list-style-type: none;
margin: 0;
padding: 0;
}
div.nav ul li a {
background: #fff;
color: #003d4c;
padding: 3px 8px;
text-decoration: none;
}
div.nav ul li a:hover {
background: #003d4c;
color: #fff;
}
/* Actions */
div.actions {
clear: both;
margin-top: .2em;
text-align: left;
}
div.actions ul {
margin: 0;
padding: 2px 6px;
list-style-type: none;
display: inline;
padding: 0;
}
div.actions li {
display: inline;
list-style-type: none;
margin: 0px 0px 3px 0px;
padding: 0px 2px;
margin: 0 2em 0 0;
padding: 0;
}
div.actions ul li a{
background: #003d4c;
border: 0px solid #656565;
border-width: 1px 1px 0px 1px;
color: #ddd;
padding: 3px 8px;
div.actions ul li a {
background: #fff;
color: #003d4c;
text-decoration: none;
}
div.actions ul li a:hover {
background:#fff;
color: #003d4c;
background: #003d4c;
color: #fff;
}
/* Related */
@ -290,72 +347,51 @@ div.related {
clear: both;
display: block;
}
div.related div.actions {
position: relative;
top: 4px;
left: 0;
text-align: left;
}
div.related div.actions ul {
list-style-type: none;
margin: 0;
padding: 0;
}
div.related div.actions li {
list-style-type: none;
margin: 0 0 4px 0px;
padding: 0;
}
div.related div.actions ul li a {
background:#fff;
color: #2C6877;
padding: 0;
text-decoration: underline;
}
div.related div.actions ul li a:hover {
background:#fff;
color: #2C6877;
text-decoration: none;
}
/* Debugging */
pre {
background: #f0f0f0;
padding: 1em;
}
pre.cake_debug {
margin: 2px;
font-size: 12px;
background: #ffcc00;
font-size: 120%;
line-height: 18px;
margin: 4px 2px;
overflow: auto;
position: relative;
}
div.cake-stack-trace {
margin: 2px 2px 0 2px;
font-size: 12px;
background: #fff;
color: #333;
margin: 4px 2px;
padding: 4px;
font-size: 120%;
line-height: 18px;
overflow: auto;
position: relative;
}
div.cake-code-dump pre {
position: relative;
overflow: auto;
}
div.cake-stack-trace pre, div.cake-code-dump pre {
color: #000000;
background-color: #F0F0F0;
border: 1px dotted #606060;
padding: 2px 0 2px 5px;
margin: 0px 4px 5px 5px;
margin: 4px 2px;
padding: 4px;
overflow: auto;
}
div.cake-code-dump pre, div.cake-code-dump pre code {
clear: both;
font-size: 12px;
line-height: 5px;
margin: 0;
padding: 0 0 10px 0;
margin: 4px 2px;
padding: 4px;
overflow: auto;
}
div.cake-code-dump pre {
padding: 7px 8px;
margin: 1px 4px 2px 6px;
}
div.cake-code-dump span.code-highlight {
background-color: #FFFF00;
}
}

View file

@ -7,16 +7,16 @@ padding:0;
body {
background-color: #2C6877;
color: #fff;
font-family: "frutiger linotype", "lucida grande", "helvetica", "arial", sans-serif;
font-size: 76%;
font-family: "frutiger linotype", "lucida grande", "verdana", sans-serif;
}
a {
background-color: #fff;
background-color: inherit;
color: #003d4c;
text-decoration: underline;
font-weight: bold;
}
a:hover {
background-color: #fff;
background-color: inherit;
color: #003d4c;
text-decoration:none;
}
@ -27,23 +27,23 @@ em {
font-size: 12px;
}
h1, h2, h3, h4 {
background-color: #fff;
background-color: inherit;
font-weight:normal;
}
h1 {
color: #003d4c;
font-size: 180%;
margin: 0.3em 0;
font-size: 160%;
margin: 0.1em 0;
}
h2 {
color: #2C6877;
font-size: 180%;
font-size: 160%;
margin: 0.3em 0;
padding-top: 1em;
}
h3 {
color: #c6c65b;
font-size: 140%;
font-size: 120%;
padding-top: 2em;
}
h4 {
@ -63,13 +63,13 @@ ul, li {
#header{
background-color: #2C6877;
padding: 10px 20px 0 20px;
height: 83px;
height: 5em;
}
#header h1 {
color: #ffffff;
background: url('../img/cake.icon.png') no-repeat;
padding: 5px 50px;
height: 60px;
height: 5em;
}
#header h1 a {
color: #ffffff;
@ -111,12 +111,25 @@ th {
border-left: 1px solid #fff;
border-right: 1px solid #bbb;
border-bottom: 1px solid #bbb;
padding: 1px 4px;
text-align: center;
}
th a {
display: block;
padding: 2px 4px;
text-decoration: none;
}
th a:hover {
background-color: #ccc;
color: #333;
text-decoration: none;
}
table tr td {
border-right: 1px solid #ddd;
padding: 4px 4px;
background: #fff;
border-right: 1px solid #ccc;
padding: 4px;
text-align: center;
vertical-align: top;
}
@ -124,14 +137,17 @@ table tr.altrow td {
background: #f4f4f4;
}
td.actions {
text-align: center;
white-space: nowrap;
}
td.actions a {
padding: 0 6px;
display: inline;
margin: 0px 6px;
}
#cakeSqlLog td {
background: #fff;
border-bottom: 2px solid #ccc;
.cakeSqlLog table {
background: #f4f4f4;
}
.cakeSqlLog td {
padding: 4px 8px;
text-align: left;
}
@ -139,6 +155,7 @@ td.actions a {
/* Paging */
div.paging {
color: #ccc;
margin-bottom: 2em;
}
div.paging div.disabled {
color: #ddd;
@ -167,25 +184,32 @@ dd {
/* Forms */
form {
margin-top: 0;
clear: both;
margin-right: 20px;
padding: 0;
width: 50%;
width: 60%;
}
fieldset {
border: 1px solid #ccc;
margin-top: 30px;
padding: 16px 20px;
}
fieldset legend {
color: #2C6877;
font-size: 160%;
font-weight: bold;
}
form div {
border: 1px solid #ddd;
clear: both;
margin-bottom: 1em;
padding: .8em 2em 1em 1.4em;
padding: .5em;
vertical-align: text-top;
}
form div.required {
color: #333;
background: #f2f2f2;
font-weight: bold;
}
form div.optional, form div.input {
background: #f6f6f6;
color: #444;
}
form div.submit {
@ -196,44 +220,47 @@ form div.submit {
}
label {
display: block;
font-size: 14px;
font-size: 110%;
padding-right: 20px;
}
input, textarea {
clear: both;
display: block;
font-size: 14px;
font-size: 140%;
font-family: "frutiger linotype", "lucida grande", "verdana", sans-serif;
padding: 2px;
width: 100%;
}
select {
clear: both;
font-size: 14px;
font-size: 120%;
vertical-align: text-bottom;
}
select[multiple=multiple] {
width: 100%;
}
option {
font-size: 14px;
padding: 0 0.3em;
font-size: 120%;
padding: 0 3px;
}
input[type=checkbox] {
clear: left;
float: left;
margin: 2px 6px 7px 2px;
margin: 0px 6px 7px 2px;
width: auto;
}
input[type=submit] {
display: inline;
padding: 0 .4em;
padding: 2px 5px;
width: auto;
font-size: 110%;
vertical-align: bottom;
}
/* Notices and Errors */
div.message, p.error, div.error-message {
color: #900;
font-size: 16px;
font-size: 140%;
font-weight: bold;
margin: 8px 0px;
}
@ -241,48 +268,78 @@ div.error-message {
clear: both;
}
div.error em {
font-size: 18px;
font-size: 140%;
color: #003d4c;
}
span.notice {
background-color: #c6c65b;
color: #fff;
display: block;
font-size: 16px;
font-size: 140%;
padding: 0.5em;
margin: 1em 0;
}
/* Actions */
div.actions {
/* Nav & Actions */
div.nav {
text-align: left;
position: absolute;
top: 75px;
left: 25px;
top: 9em;
left: 60%;
}
div.nav ul li a {
display: block;
background: #fff;
color: #003d4c;
padding: 3px 8px;
text-decoration: none;
}
div.nav ul {
background: #003d4c;
margin: 0;
padding: 0;
list-style-type: none;
}
div.nav li {
list-style-type: none;
margin: 0;
padding: 0;
}
div.nav ul li a {
background: #fff;
color: #003d4c;
padding: 3px 8px;
text-decoration: none;
}
div.nav ul li a:hover {
background: #003d4c;
color: #fff;
}
/* Actions */
div.actions {
clear: both;
margin-top: .2em;
text-align: left;
}
div.actions ul {
margin: 0;
padding: 2px 6px;
list-style-type: none;
display: inline;
padding: 0;
}
div.actions li {
display: inline;
list-style-type: none;
margin: 0px 0px 3px 0px;
padding: 0px 2px;
margin: 0 2em 0 0;
padding: 0;
}
div.actions ul li a{
background: #003d4c;
border: 0px solid #656565;
border-width: 1px 1px 0px 1px;
color: #ddd;
padding: 3px 8px;
div.actions ul li a {
background: #fff;
color: #003d4c;
text-decoration: none;
}
div.actions ul li a:hover {
background:#fff;
color: #003d4c;
background: #003d4c;
color: #fff;
}
/* Related */
@ -290,35 +347,51 @@ div.related {
clear: both;
display: block;
}
div.related div.actions {
position: relative;
top: 4px;
left: 0;
text-align: left;
}
div.related div.actions ul {
list-style-type: none;
margin: 0;
padding: 0;
}
div.related div.actions li {
list-style-type: none;
margin: 0 0 4px 0px;
padding: 0;
}
div.related div.actions ul li a{
background:#fff;
color: #2C6877;
padding: 0;
text-decoration: underline;
}
div.related div.actions ul li a:hover {
background:#fff;
color: #2C6877;
text-decoration: none;
/* Debugging */
pre {
background: #f0f0f0;
padding: 1em;
}
/* Other */
pre {
padding: 1em;
pre.cake_debug {
background: #ffcc00;
font-size: 120%;
line-height: 18px;
margin: 4px 2px;
overflow: auto;
position: relative;
}
div.cake-stack-trace {
background: #fff;
color: #333;
margin: 4px 2px;
padding: 4px;
font-size: 120%;
line-height: 18px;
overflow: auto;
position: relative;
}
div.cake-code-dump pre {
position: relative;
overflow: auto;
}
div.cake-stack-trace pre, div.cake-code-dump pre {
color: #000000;
background-color: #F0F0F0;
border: 1px dotted #606060;
margin: 4px 2px;
padding: 4px;
overflow: auto;
}
div.cake-code-dump pre, div.cake-code-dump pre code {
clear: both;
font-size: 12px;
line-height: 5px;
margin: 4px 2px;
padding: 4px;
overflow: auto;
}
div.cake-code-dump span.code-highlight {
background-color: #FFFF00;
}

View file

@ -697,13 +697,13 @@ class Controller extends Object {
$modelObj =& ClassRegistry::getObject($modelKey);
foreach($modelObj->_tableInfo->value as $column) {
$humanName = $column['name'];
if ($modelObj->isForeignKey($column['name'])) {
foreach($modelObj->belongsTo as $associationName => $assoc) {
if($column['name'] == $assoc['foreignKey']) {
$humanName = Inflector::underscore($associationName);
$fkNames = $modelObj->keyToTable[$column['name']];
$fieldNames[$column['name']]['table'] = $fkNames[0];
$fieldNames[$column['name']]['label'] = Inflector::humanize($associationName);
$fieldNames[$column['name']]['prompt'] = $fieldNames[$column['name']]['label'];
$fieldNames[$column['name']]['model'] = Inflector::classify($associationName);
$fieldNames[$column['name']]['modelKey'] = Inflector::underscore($modelObj->tableToModel[$fieldNames[$column['name']]['table']]);
$fieldNames[$column['name']]['controller'] = Inflector::pluralize($fieldNames[$column['name']]['modelKey']);
@ -711,12 +711,11 @@ class Controller extends Object {
break;
}
}
}
$fieldNames[$column['name']]['label'] = Inflector::humanize($humanName);
$fieldNames[$column['name']]['prompt'] = $fieldNames[$column['name']]['label'];
} else {
$fieldNames[$column['name']]['label'] = Inflector::humanize($column['name']);
$fieldNames[$column['name']]['prompt'] = $fieldNames[$column['name']]['label'];
}
$fieldNames[$column['name']]['tagName'] = $model . '/' . $column['name'];
$fieldNames[$column['name']]['name'] = $column['name'];
$fieldNames[$column['name']]['class'] = 'optional';
@ -816,8 +815,10 @@ class Controller extends Object {
$otherModelKey = Inflector::underscore($assocData['className']);
$otherModelObj = &ClassRegistry::getObject($otherModelKey);
if ($doCreateOptions) {
$fkName = $modelObj->alias[$associationName];
$fieldNames[$associationName]['table'] = $assocData['joinTable'];
$fieldNames[$associationName]['model'] = $associationName;
$fieldNames[$associationName]['label'] = "Related " . Inflector::humanize(Inflector::pluralize($associationName));
$fieldNames[$associationName]['label'] = "Related " . Inflector::humanize($fkName);
$fieldNames[$associationName]['prompt'] = $fieldNames[$associationName]['label'];
$fieldNames[$associationName]['type'] = "select";
$fieldNames[$associationName]['multiple'] = "multiple";

View file

@ -370,7 +370,9 @@ class FormHelper extends AppHelper {
function inputs($fields = null, $blacklist = null) {
if(!is_array($fields)) {
$fieldset = $fields;
} else if(isset($fields['fieldset'])) {
$fields = array_keys($this->fieldset['fields']);
}
if(isset($fields['fieldset'])) {
$fieldset = $fields['fieldset'];
unset($fields['fieldset']);
} else {
@ -378,13 +380,16 @@ class FormHelper extends AppHelper {
}
if($fieldset === true) {
$legend = Inflector::humanize($this->action .' to '. $this->model());
$legend = 'New ';
if(in_array($this->action, array('update', 'edit'))) {
$legend = 'Edit ';
}
$legend .= Inflector::humanize(Inflector::underscore($this->model()));
} else if(is_string($fieldset)){
$legend = $fields;
}
if(!is_array($fields)) {
$fields = array_keys($this->fieldset['fields']);
$legend = $fieldset;
} else if(isset($fieldset['legend'])) {
$legend = $fields['legend'];
unset($fields['legend']);
}
$out = null;

View file

@ -24,25 +24,33 @@
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
?>
<h2><?php echo $formName.' '.$humanSingularName;?></h2>
<?php
echo $form->create($modelClass);
echo $form->inputs($fieldNames);
echo $form->end(array('submit' => __('Save', true))); ?>
<div class='actions'>
<ul>
<?php
if($formName == 'Edit') {
echo "<li>".$html->link(__('Delete ', true).$humanSingularName, array('action' => 'delete', $data[$modelClass][$primaryKey]), null, 'Are you sure you want to delete '.$data[$modelClass][$displayField])."</li>";
}
echo "<li>".$html->link(__('List ', true).$humanPluralName, array('action' => 'index'))."</li>";
if($formName == 'Edit') {
foreach($fieldNames as $field => $value) {
if(isset($value['foreignKey'])) {
echo '<li>' . $html->link(__('View ', true) . Inflector::humanize($value['controller']), array('action' => 'index')) . '</li>';
echo '<li>' . $html->link(__('Add ', true) . Inflector::humanize($value['modelKey']), array('action' => 'add')) . '</li>';
}
}
}?>
</ul>
echo $form->end(__('Save', true)); ?>
<div class="nav">
<ul>
<?php
if($formName == 'Edit') {
echo "<li>".$html->link(__('Delete ', true).$humanSingularName, array('action' => 'delete', $data[$modelClass][$primaryKey]), null, 'Are you sure you want to delete '.$data[$modelClass][$displayField])."</li>";
foreach($fieldNames as $field => $value) {
if(isset($value['foreignKey'])) {
echo '<li>' . $html->link(__('View ', true) . Inflector::humanize($value['controller']), array('action' => 'index')) . '</li>';
echo '<li>' . $html->link(__('Add ', true) . Inflector::humanize($value['modelKey']), array('action' => 'add')) . '</li>';
}
}
}
echo "<li>".$html->link($humanPluralName, array('action' => 'index'))."</li>";
foreach($alias as $nav) {
if(!strpos($nav, $modelClass)) {
$navKey = Inflector::pluralize(Inflector::underscore($nav));
echo '<li>'.$html->link(Inflector::humanize($navKey), array('controller'=> $navKey)).'</li>';
}
}
?>
</ul>
</div>

View file

@ -24,7 +24,7 @@
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
?>
<h2>List <?php echo $humanPluralName;?></h2>
<h2><?php echo $humanPluralName;?></h2>
<?php
$modelObj =& ClassRegistry::getObject($modelKey);
?>
@ -39,8 +39,7 @@ echo $paginator->counter(array(
<?php foreach ($fieldNames as $fieldName) { ?>
<th>
<?php
$tag = explode('/', $fieldName['tagName']);
echo $paginator->sort($fieldName['label'], $tag[1]);
echo $paginator->sort($fieldName['label'], $fieldName['name']);
?>
</th>
<?php }?>
@ -91,13 +90,21 @@ if(is_array($data)) {
</table>
<div class="paging">
<?php echo $paginator->prev('<< previous', array(), null, array('class'=>'disabled'));?>
|
| <?php echo $paginator->numbers();?>
<?php echo $paginator->next('next >>', array(), null, array('class'=>'disabled'));?>
</div>
<div class="actions">
<ul>
<li>
<?php echo $html->link(__('New ', true).$humanSingularName, array('action' => 'add')); ?>
</li>
<?php
echo '<li>'.$html->link(__('New ', true).$humanSingularName, array('action' => 'add')).'</li>';
foreach($alias as $nav) {
if(!strpos($nav, $modelClass)) {
$navKey = Inflector::pluralize(Inflector::underscore($nav));
echo '<li>'.$html->link(Inflector::humanize($navKey), array('controller'=> $navKey)).'</li>';
}
}
?>
</ul>
</div>

View file

@ -59,26 +59,26 @@ foreach($fieldNames as $field => $value) {
}
}?>
</dl>
<div class='actions'>
<ul>
<?php
echo '<li>' . $html->link(sprintf(__("Edit %s", true), $humanSingularName), array('action' => 'edit', $data[$modelClass][$modelObj->primaryKey])) . '</li>';
echo '<li>' . $html->link(sprintf(__("Delete %s", true), $humanSingularName), array('action' => 'delete', $data[$modelClass][$modelObj->primaryKey]), null, sprintf(__("Are you sure you want to delete id %s?", true), $data[$modelClass][$modelObj->primaryKey])) . '</li>';
echo '<li>' . $html->link(sprintf(__("List %s", true), $humanPluralName), array('action' => 'index')) . '</li>';
echo '<li>' . $html->link(sprintf(__("New %s", true), $humanSingularName), array('action' => 'add')) . '</li>';
<div class="nav">
<ul>
<?php
echo '<li>' . $html->link(sprintf(__("Edit %s", true), $humanSingularName), array('action' => 'edit', $data[$modelClass][$modelObj->primaryKey])) . '</li>';
echo '<li>' . $html->link(sprintf(__("Delete %s", true), $humanSingularName), array('action' => 'delete', $data[$modelClass][$modelObj->primaryKey]), null, sprintf(__("Are you sure you want to delete id %s?", true), $data[$modelClass][$modelObj->primaryKey])) . '</li>';
echo '<li>' . $html->link(sprintf(__("List %s", true), $humanPluralName), array('action' => 'index')) . '</li>';
echo '<li>' . $html->link(sprintf(__("New %s", true), $humanSingularName), array('action' => 'add')) . '</li>';
foreach($fieldNames as $field => $value) {
if(isset($value['foreignKey'])) {
echo "<li>".$html->link(sprintf(__("List %s", true), Inflector::humanize($value['controller'])), array('controller' => $value['controller'], 'action' => 'index')) . '</li>';
echo "<li>".$html->link(sprintf(__("Add %s", true), Inflector::humanize($value['controller'])), array('controller' => $value['controller'], 'action'=>'add'))."</li>";
}
}?>
</ul>
foreach($fieldNames as $field => $value) {
if(isset($value['foreignKey']) && $value['modelKey'] != $modelKey) {
echo "<li>".$html->link(sprintf(__("List %s", true), Inflector::humanize($value['controller'])), array('controller' => $value['controller'], 'action' => 'index')) . '</li>';
echo "<li>".$html->link(sprintf(__("Add %s", true), Inflector::humanize($value['controller'])), array('controller' => $value['controller'], 'action'=>'add'))."</li>";
}
}?>
</ul>
</div>
<!--hasOne relationships -->
<?php
$j = 0;
foreach ($modelObj->hasOne as $associationNameName => $relation) {
foreach ($modelObj->hasOne as $associationName => $relation) {
$otherModelKey = Inflector::underscore($relation['className']);
$otherModelObj =& ClassRegistry::getObject($otherModelKey);
$otherControllerPath = Inflector::pluralize($otherModelKey);
@ -89,10 +89,10 @@ foreach ($modelObj->hasOne as $associationNameName => $relation) {
$class = null;
}
echo "<div class=\"related\">";
echo "<h3>".sprintf(__("Related %s", true), Inflector::humanize($associationNameName))."</h3>";
if(!empty($data[$associationNameName])) {
echo "<h3>".sprintf(__("Related %s", true), Inflector::humanize($associationName))."</h3>";
if(!empty($data[$associationName])) {
echo "<dl>";
foreach($data[$associationNameName] as $field => $value) {
foreach($data[$associationName] as $field => $value) {
if(isset($value)) {
echo "<dt {$class}>".Inflector::humanize($field)."</dt>";
if(!empty($value)) {
@ -108,9 +108,9 @@ foreach ($modelObj->hasOne as $associationNameName => $relation) {
echo "<div class=\"actions\">";
echo "<ul>";
if($new == null) {
echo "<li>".$html->link(sprintf(__("Edit %s", true), Inflector::humanize($associationNameName)), array('controller'=> $otherControllerPath, 'action'=>'edit', $data[$associationNameName][$otherModelObj->primaryKey]))."</li>";
echo "<li>".$html->link(sprintf(__("Edit %s", true), Inflector::humanize($associationName)), array('controller'=> $otherControllerPath, 'action'=>'edit', $data[$associationName][$otherModelObj->primaryKey]))."</li>";
} else {
echo "<li>".$html->link(sprintf(__("New %s", true), Inflector::humanize($associationNameName)), array('controller'=> $otherControllerPath, 'action'=>'add'))."</li>";
echo "<li>".$html->link(sprintf(__("New %s", true), Inflector::humanize($associationName)), array('controller'=> $otherControllerPath, 'action'=>'add'))."</li>";
}
echo "</ul>";
echo "</div>";
@ -166,7 +166,7 @@ foreach($relations as $associationName => $relation) {
}?>
<div class="actions">
<ul>
<?php echo "<li>".$html->link(__('New ', true).Inflector::humanize($associationName), array('controller'=> $otherControllerPath, 'action'=>'add')) . '</li>'; ?>
<?php echo "<li>".$html->link(__('New ', true).Inflector::humanize($otherModelKey), array('controller'=> $otherControllerPath, 'action'=>'add')) . '</li>'; ?>
</ul>
</div>
</div>