updating bake templates for i18n, fixes for scaffold templates

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5280 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
gwoo 2007-06-16 02:19:31 +00:00
parent b1c551f10a
commit 6d91aad41e
6 changed files with 57 additions and 62 deletions

View file

@ -17,7 +17,7 @@
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
* @package cake
* @subpackage cake.cake.console.libs.templates.views
* @since CakePHP(tm) v 0.10.0.1076
* @since CakePHP(tm) v 1.2.0.5234
* @version $Revision$
* @modifiedby $LastChangedBy$
* @lastmodified $Date$
@ -27,7 +27,7 @@
<div class="<?php echo $singularVar;?>">
<?php echo "<?php echo \$form->create('{$modelClass}');?>\n";?>
<fieldset>
<legend><?php echo Inflector::humanize($action).' '. $singularHumanName;?></legend>
<legend><?php echo "<?php __('".Inflector::humanize($action).", true);?> <?php __('{$singularHumanName}');?>";?></legend>
<?php
echo "\t<?php\n";
foreach($fields as $field) {
@ -50,9 +50,9 @@
<div class="actions">
<ul>
<?php if($action != 'add'):?>
<li><?php echo "<?php echo \$html->link('Delete', array('action'=>'delete', \$form->value('{$modelClass}.{$primaryKey}')), null, 'Are you sure you want to delete #' . \$form->value('{$modelClass}.{$primaryKey}')); ?>";?></li>
<li><?php echo "<?php echo \$html->link(__('Delete', true), array('action'=>'delete', \$form->value('{$modelClass}.{$primaryKey}')), null, __('Are you sure you want to delete', true).' #' . \$form->value('{$modelClass}.{$primaryKey}')); ?>";?></li>
<?php endif;?>
<li><?php echo "<?php echo \$html->link('List {$pluralHumanName}', array('action'=>'index'));?>";?></li>
<li><?php echo "<?php echo \$html->link(__('List', true).' '.__('{$pluralHumanName}', true), array('action'=>'index'));?>";?></li>
<?php
foreach($foreignKeys as $field => $value) {
$otherModelClass = $value['1'];
@ -63,8 +63,8 @@
$otherSingularName = Inflector::variable($otherModelClass);
$otherPluralHumanName = Inflector::humanize($otherControllerPath);
$otherSingularHumanName = Inflector::humanize($otherModelKey);
echo "\t\t<li><?php echo \$html->link('List {$otherPluralHumanName}', array('controller'=> '{$otherControllerPath}', 'action'=>'index')); ?> </li>\n";
echo "\t\t<li><?php echo \$html->link('New {$otherSingularHumanName}', array('controller'=> '{$otherControllerPath}', 'action'=>'add')); ?> </li>\n";
echo "\t\t<li><?php echo \$html->link(__('List', true).' '.__('{$otherPluralHumanName}', true), array('controller'=> '{$otherControllerPath}', 'action'=>'index')); ?> </li>\n";
echo "\t\t<li><?php echo \$html->link(__('New', true).' '.__('{$otherSingularHumanName}', true), array('controller'=> '{$otherControllerPath}', 'action'=>'add')); ?> </li>\n";
}
}
?>

View file

@ -17,7 +17,7 @@
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
* @package cake
* @subpackage cake.cake.console.libs.templates.views
* @since CakePHP(tm) v 0.10.0.1076
* @since CakePHP(tm) v 1.2.0.5234
* @version $Revision$
* @modifiedby $LastChangedBy$
* @lastmodified $Date$
@ -25,22 +25,21 @@
*/
?>
<div class="<?php echo $pluralVar;?>">
<h2>List <?php echo $pluralHumanName;?></h2>
<h2><?php echo "<?php __('{$pluralHumanName}');?>";?></h2>
<table cellpadding="0" cellspacing="0">
<tr>
<?php foreach($fields as $field):?>
<th><?php echo "<?php echo \$paginator->sort('{$field['name']}');?>";?></th>
<?php endforeach;?>
<th>Actions</th>
<th class="actions"><?php echo "<?php __('Actions');?>"</th>
</tr>
<?php
echo "<?php
\$i = 0;
foreach(\${$pluralVar} as \${$singularVar}):
\$class = null;
if(\$i++ % 2 == 0) {
\$class = ' class=\"altrow\"';
} else {
\$class = null;
}
?>\n";
echo "\t<tr<?php echo \$class;?>>\n";
@ -65,9 +64,9 @@ foreach(\${$pluralVar} as \${$singularVar}):
}
echo "\t\t<td class=\"actions\">\n";
echo "\t\t\t<?php echo \$html->link('View', array('action'=>'view', \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?>\n";
echo "\t\t\t<?php echo \$html->link('Edit', array('action'=>'edit', \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?>\n";
echo "\t\t\t<?php echo \$html->link('Delete', array('action'=>'delete', \${$singularVar}['{$modelClass}']['{$primaryKey}']), null, 'Are you sure you want to delete #' . \${$singularVar}['{$modelClass}']['{$primaryKey}']); ?>\n";
echo "\t\t\t<?php echo \$html->link(__('View', true), array('action'=>'view', \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?>\n";
echo "\t\t\t<?php echo \$html->link(__('Edit', true), array('action'=>'edit', \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?>\n";
echo "\t\t\t<?php echo \$html->link(__('Delete', true), array('action'=>'delete', \${$singularVar}['{$modelClass}']['{$primaryKey}']), null, __('Are you sure you want to delete', true).' #' . \${$singularVar}['{$modelClass}']['{$primaryKey}']); ?>\n";
echo "\t\t</td>\n";
echo "\t</tr>\n";
@ -76,13 +75,13 @@ echo "<?php endforeach; ?>\n";
</table>
</div>
<div class="paging">
<?php echo "\t<?php echo \$paginator->prev('<< previous', array(), null, array('class'=>'disabled'));?>\n";?>
<?php echo "\t<?php echo \$paginator->prev('<< '.__('previous', true), array(), null, array('class'=>'disabled'));?>\n";?>
| <?php echo "\t<?php echo \$paginator->numbers();?>\n"?>
<?php echo "\t<?php echo \$paginator->next('next >>', array(), null, array('class'=>'disabled'));?>\n";?>
<?php echo "\t<?php echo \$paginator->next(_('next', true).' >>', array(), null, array('class'=>'disabled'));?>\n";?>
</div>
<div class="actions">
<ul>
<li><?php echo "<?php echo \$html->link('New {$singularHumanName}', array('action'=>'add')); ?>";?></li>
<li><?php echo "<?php echo \$html->link(__('New', true).' '.__('{$singularHumanName}', true), array('action'=>'add')); ?>";?></li>
<?php
foreach($foreignKeys as $field => $value) {
$otherModelClass = $value['1'];
@ -93,8 +92,8 @@ echo "<?php endforeach; ?>\n";
$otherVariableName = Inflector::variable($otherModelClass);
$otherPluralHumanName = Inflector::humanize($otherControllerPath);
$otherSingularHumanName = Inflector::humanize($otherModelKey);
echo "\t\t<li><?php echo \$html->link('List {$otherPluralHumanName}', array('controller'=> '{$otherControllerPath}', 'action'=>'index')); ?> </li>\n";
echo "\t\t<li><?php echo \$html->link('New {$otherSingularHumanName}', array('controller'=> '{$otherControllerPath}', 'action'=>'add')); ?> </li>\n";
echo "\t\t<li><?php echo \$html->link(__('List', true).' '.__('{$otherPluralHumanName}', true), array('controller'=> '{$otherControllerPath}', 'action'=>'index')); ?> </li>\n";
echo "\t\t<li><?php echo \$html->link(__('New', true).' '.__('{$otherSingularHumanName}', true), array('controller'=> '{$otherControllerPath}', 'action'=>'add')); ?> </li>\n";
}
}
?>

View file

@ -17,7 +17,7 @@
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
* @package cake
* @subpackage cake.cake.console.libs.templates.views
* @since CakePHP(tm) v 0.10.0.1076
* @since CakePHP(tm) v 1.2.0.5234
* @version $Revision$
* @modifiedby $LastChangedBy$
* @lastmodified $Date$
@ -25,16 +25,16 @@
*/
?>
<div class="<?php echo $singularVar;?>">
<h2>View <?php echo $singularHumanName;?></h2>
<h2><?php echo "<?php __('{$singularHumanName}');?>";?></h2>
<dl>
<?php
$i = 0;
foreach($fields as $field) {
$class = null;
if($i++ % 2 == 0) {
$class = ' class="altrow"';
} else {
$class = null;
}
if(in_array($field['name'], array_keys($foreignKeys))) {
$otherModelClass = $foreignKeys[$field['name']][1];
$otherModelKey = Inflector::underscore($otherModelClass);
@ -60,10 +60,10 @@ foreach($fields as $field) {
<div class="actions">
<ul>
<?php
echo "\t\t<li><?php echo \$html->link('Edit {$singularHumanName}', array('action'=>'edit', \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?> </li>\n";
echo "\t\t<li><?php echo \$html->link('Delete {$singularHumanName}', array('action'=>'delete', \${$singularVar}['{$modelClass}']['{$primaryKey}']), null, 'Are you sure you want to delete #' . \${$singularVar}['{$modelClass}']['{$primaryKey}'] . '?'); ?> </li>\n";
echo "\t\t<li><?php echo \$html->link('List {$pluralHumanName}', array('action'=>'index')); ?> </li>\n";
echo "\t\t<li><?php echo \$html->link('New {$singularHumanName}', array('action'=>'add')); ?> </li>\n";
echo "\t\t<li><?php echo \$html->link(__('Edit', true).' '.__('{$singularHumanName}', true), array('action'=>'edit', \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?> </li>\n";
echo "\t\t<li><?php echo \$html->link(__('Delete', true).' '.__('{$singularHumanName}', true), array('action'=>'delete', \${$singularVar}['{$modelClass}']['{$primaryKey}']), null, __('Are you sure you want to delete', true).' #' . \${$singularVar}['{$modelClass}']['{$primaryKey}'] . '?'); ?> </li>\n";
echo "\t\t<li><?php echo \$html->link(__('List', true).' '.__('{$pluralHumanName}', true), array('action'=>'index')); ?> </li>\n";
echo "\t\t<li><?php echo \$html->link(__('New', true).' '.__('{$singularHumanName}', true), array('action'=>'add')); ?> </li>\n";
foreach($foreignKeys as $field => $value) {
$otherModelClass = $value['1'];
@ -74,8 +74,8 @@ foreach($fields as $field) {
$otherSingularVar = Inflector::variable($otherModelClass);
$otherPluralHumanName = Inflector::humanize($otherControllerPath);
$otherSingularHumanName = Inflector::humanize($otherModelKey);
echo "\t\t<li><?php echo \$html->link('List {$otherPluralHumanName}', array('controller'=> '{$otherControllerPath}', 'action'=>'index')); ?> </li>\n";
echo "\t\t<li><?php echo \$html->link('New {$otherSingularHumanName}', array('controller'=> '{$otherControllerPath}', 'action'=>'add')); ?> </li>\n";
echo "\t\t<li><?php echo \$html->link(__('List', true).' '.__('{$otherPluralHumanName}', true), array('controller'=> '{$otherControllerPath}', 'action'=>'index')); ?> </li>\n";
echo "\t\t<li><?php echo \$html->link(__('New', true).' '.__('{$otherSingularHumanName}', true), array('controller'=> '{$otherControllerPath}', 'action'=>'add')); ?> </li>\n";
}
}
?>
@ -93,19 +93,19 @@ foreach ($hasOne as $assocName => $assocData):
$otherModelObj =& ClassRegistry::getObject($otherModelKey);
$otherFields = $otherModelObj->_tableInfo->value;
$otherPrimaryKey = $otherModelObj->primaryKey;
if($i++ % 2 == 0) {
$class = ' class="altrow"';
} else {
$class = null;
}
?>
<div class="related">
<h3>Related <?php echo $otherPluralHumanName;?></h3>
<h3><?php echo "<?php __('Related');?> <?php __('{$otherSingularHumanName}');?>";?></h3>
<?php echo "<?php if(!empty(\${$singularVar}['{$assocName}'])):?>\n";?>
<dl>
<?php
$i = 0;
foreach($otherFields as $field) {
$class = null;
if($i++ % 2 == 0) {
$class = ' class="altrow"';
}
echo "\t\t<dt{$class}>".Inflector::humanize($field['name'])."</dt>\n";
echo "\t\t<dd{$class}>\n\t<?php echo \${$singularVar}['{$assocName}']['{$field['name']}'] ?>\n&nbsp;</dd>\n";
}
@ -114,11 +114,12 @@ foreach ($hasOne as $assocName => $assocData):
<?php echo "<?php endif; ?>\n";?>
<div class="actions">
<ul>
<li><?php echo "<?php echo \$html->link('Edit $otherSingularHumanName}', array('controller'=> '{$otherControllerPath}', 'action'=>'edit', \${$singularVar}['{$assocName}']['{$otherPrimaryKey}']));?></li>\n";?>
<li><?php echo "<?php echo \$html->link(__('Edit', true).' '.__('{$otherSingularHumanName}', true), array('controller'=> '{$otherControllerPath}', 'action'=>'edit', \${$singularVar}['{$assocName}']['{$otherPrimaryKey}']));?></li>\n";?>
</ul>
</div>
</div>
<?php
$i++;
endforeach;
$relations = array_merge($hasMany, $hasAndBelongsToMany);
@ -136,7 +137,7 @@ foreach($relations as $assocName => $assocData):
$otherPrimaryKey = $otherModelObj->primaryKey;
?>
<div class="related">
<h3>Related <?php echo $otherPluralHumanName;?></h3>
<h3><?php echo "<?php __('Related');?> <?php __('{$otherPluralHumanName}');?>";?></h3>
<?php echo "<?php if(!empty(\${$singularVar}['{$assocName}'])):?>\n";?>
<table cellpadding = "0" cellspacing = "0">
<tr>
@ -145,16 +146,15 @@ foreach($relations as $assocName => $assocData):
echo "\t\t<th>".Inflector::humanize($field['name'])."</th>\n";
}
?>
<th class="actions">Actions</th>
<th class="actions"><?php echo "<?php __('Actions');?>";?></th>
</tr>
<?php
echo "\t<?php
\$i = 0;
foreach(\${$singularVar}['{$assocName}'] as \${$otherSingularVar}):
\$class = null;
if(\$i++ % 2 == 0) {
\$class = ' class=\"altrow\"';
} else {
\$class = null;
}
?>\n";
echo "\t\t<tr<?php echo \$class;?>>\n";
@ -164,9 +164,9 @@ echo "\t<?php
}
echo "\t\t\t<td class=\"actions\">\n";
echo "\t\t\t\t<?php echo \$html->link('View', array('controller'=> '{$otherControllerPath}', 'action'=>'view', \${$otherSingularVar}['{$otherPrimaryKey}'])); ?>\n";
echo "\t\t\t\t<?php echo \$html->link('Edit', array('controller'=> '{$otherControllerPath}', 'action'=>'edit', \${$otherSingularVar}['{$otherPrimaryKey}'])); ?>\n";
echo "\t\t\t\t<?php echo \$html->link('Delete', array('controller'=> '{$otherControllerPath}', 'action'=>'delete', \${$otherSingularVar}['{$otherPrimaryKey}']), null, 'Are you sure you want to delete #' . \${$otherSingularVar}['{$otherPrimaryKey}'] . '?'); ?>\n";
echo "\t\t\t\t<?php echo \$html->link(__('View', true), array('controller'=> '{$otherControllerPath}', 'action'=>'view', \${$otherSingularVar}['{$otherPrimaryKey}'])); ?>\n";
echo "\t\t\t\t<?php echo \$html->link(__('Edit', true), array('controller'=> '{$otherControllerPath}', 'action'=>'edit', \${$otherSingularVar}['{$otherPrimaryKey}'])); ?>\n";
echo "\t\t\t\t<?php echo \$html->link(__('Delete', true), array('controller'=> '{$otherControllerPath}', 'action'=>'delete', \${$otherSingularVar}['{$otherPrimaryKey}']), null, __('Are you sure you want to delete', true).' #' . \${$otherSingularVar}['{$otherPrimaryKey}'] . '?'); ?>\n";
echo "\t\t\t</td>\n";
echo "\t\t</tr>\n";
@ -176,7 +176,7 @@ echo "\t<?php
<?php echo "<?php endif; ?>\n\n";?>
<div class="actions">
<ul>
<li><?php echo "<?php echo \$html->link('New {$otherSingularHumanName}', array('controller'=> '{$otherControllerPath}', 'action'=>'add'));?> </li>\n";?>
<li><?php echo "<?php echo \$html->link(__('New', true).' '.__('{$otherSingularHumanName}', true), array('controller'=> '{$otherControllerPath}', 'action'=>'add'));?> </li>\n";?>
</ul>
</div>
</div>

View file

@ -48,7 +48,7 @@
<div class="actions">
<ul>
<?php if($this->action != 'add'):?>
<li><?php echo $html->link(__('Delete', true), array('action'=>'delete', $form->value($modelClass.'.'.$primaryKey)), null, 'Are you sure you want to delete #' . $form->value($modelClass.'.'.$primaryKey)); ?></li>
<li><?php echo $html->link(__('Delete', true), array('action'=>'delete', $form->value($modelClass.'.'.$primaryKey)), null, __('Are you sure you want to delete', true).' #' . $form->value($modelClass.'.'.$primaryKey)); ?></li>
<?php endif;?>
<li><?php echo $html->link(__('List', true).' '.$pluralHumanName, array('action'=>'index'));?></li>
<?php

View file

@ -41,10 +41,9 @@ echo $paginator->counter(array(
<?php
$i = 0;
foreach(${$pluralVar} as ${$singularVar}):
$class = null;
if($i++ % 2 == 0) {
$class = ' class=\"altrow\"';
} else {
$class = null;
}
echo "\n";
echo "\t<tr" . $class . ">\n";
@ -71,7 +70,7 @@ echo "\n";
echo "\t\t<td class=\"actions\">\n";
echo "\t\t\t" . $html->link(__('View', true), array('action'=>'view', ${$singularVar}[$modelClass][$primaryKey])) . "\n";
echo "\t\t\t" . $html->link(__('Edit', true), array('action'=>'edit', ${$singularVar}[$modelClass][$primaryKey])) . "\n";
echo "\t\t\t" . $html->link(__('Delete', true), array('action'=>'delete', ${$singularVar}[$modelClass][$primaryKey]), null, 'Are you sure you want to delete #' . ${$singularVar}[$modelClass][$primaryKey]) . "\n";
echo "\t\t\t" . $html->link(__('Delete', true), array('action'=>'delete', ${$singularVar}[$modelClass][$primaryKey]), null, __('Are you sure you want to delete', true).' #' . ${$singularVar}[$modelClass][$primaryKey]) . "\n";
echo "\t\t</td>\n";
echo "\t</tr>\n";

View file

@ -30,11 +30,11 @@
<?php
$i = 0;
foreach($fields as $field) {
$class = null;
if($i++ % 2 == 0) {
$class = ' class="altrow"';
} else {
$class = null;
}
if(in_array($field['name'], array_keys($foreignKeys))) {
$otherModelClass = $foreignKeys[$field['name']][1];
$otherModelKey = Inflector::underscore($otherModelClass);
@ -61,7 +61,7 @@ foreach($fields as $field) {
<ul>
<?php
echo "\t\t<li>" .$html->link(__('Edit', true)." ".$singularHumanName, array('action'=>'edit', ${$singularVar}[$modelClass][$primaryKey])). " </li>\n";
echo "\t\t<li>" .$html->link(__('Delete', true)." ".$singularHumanName, array('action'=>'delete', ${$singularVar}[$modelClass][$primaryKey]), null, 'Are you sure you want to delete #' . ${$singularVar}[$modelClass][$primaryKey] . '?'). " </li>\n";
echo "\t\t<li>" .$html->link(__('Delete', true)." ".$singularHumanName, array('action'=>'delete', ${$singularVar}[$modelClass][$primaryKey]), null, __('Are you sure you want to delete', true).' #' . ${$singularVar}[$modelClass][$primaryKey] . '?'). " </li>\n";
echo "\t\t<li>" .$html->link(__('List', true)." ".$pluralHumanName, array('action'=>'index')). " </li>\n";
echo "\t\t<li>" .$html->link(__('New', true)." ".$singularHumanName, array('action'=>'add')). " </li>\n";
@ -82,7 +82,6 @@ foreach($fields as $field) {
</ul>
</div>
<?php
$i = 0;
foreach ($hasOne as $assocName => $assocData):
$otherModelKey = Inflector::underscore($assocData['className']);
$otherControllerPath = Inflector::pluralize($otherModelKey);
@ -93,19 +92,18 @@ foreach ($hasOne as $assocName => $assocData):
$otherModelObj =& ClassRegistry::getObject($otherModelKey);
$otherFields = $otherModelObj->_tableInfo->value;
$otherPrimaryKey = $otherModelObj->primaryKey;
if($i++ % 2 == 0) {
$class = ' class="altrow"';
} else {
$class = null;
}
?>
<div class="related">
<h3><?php echo sprintf(__("Related %s", true), $otherPluralHumanName);?></h3>
<?php if(!empty(${$singularVar}[$assocName])):?>
<dl>
<?php
$i = 0;
foreach($otherFields as $field) {
$class = null;
if($i++ % 2 == 0) {
$class = ' class="altrow"';
}
echo "\t\t<dt{$class}>".Inflector::humanize($field['name'])."</dt>\n";
echo "\t\t<dd{$class}>\n\t" .${$singularVar}[$assocName][$field['name']] ."\n&nbsp;</dd>\n";
}
@ -153,10 +151,9 @@ foreach($relations as $assocName => $assocData):
<?php
$i = 0;
foreach(${$singularVar}[$assocName] as ${$otherSingularVar}):
$class = null;
if($i++ % 2 == 0) {
$class = ' class=\"altrow\"';
} else {
$class = null;
}
echo "\t\t<tr{$class}>\n";
@ -167,7 +164,7 @@ foreach($relations as $assocName => $assocData):
echo "\t\t\t<td class=\"actions\">\n";
echo "\t\t\t\t" . $html->link(__('View', true), array('controller'=> $otherControllerPath, 'action'=>'view', ${$otherSingularVar}[$otherPrimaryKey])). "\n";
echo "\t\t\t\t" . $html->link(__('Edit', true), array('controller'=> $otherControllerPath, 'action'=>'edit', ${$otherSingularVar}[$otherPrimaryKey])). "\n";
echo "\t\t\t\t" . $html->link(__('Delete', true), array('controller'=> $otherControllerPath, 'action'=>'delete', ${$otherSingularVar}[$otherPrimaryKey]), null, 'Are you sure you want to delete #' . ${$otherSingularVar}[$otherPrimaryKey] . '?'). "\n";
echo "\t\t\t\t" . $html->link(__('Delete', true), array('controller'=> $otherControllerPath, 'action'=>'delete', ${$otherSingularVar}[$otherPrimaryKey]), null, __('Are you sure you want to delete', true).' #' . ${$otherSingularVar}[$otherPrimaryKey] . '?'). "\n";
echo "\t\t\t</td>\n";
echo "\t\t</tr>\n";
endforeach;