mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
merging from source:whiteboard/sandbox/phpnut/pre_0.9.2 at [404]
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@405 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
f0075a2bd0
commit
9d1d0201ec
17 changed files with 1939 additions and 122 deletions
|
@ -4,6 +4,7 @@
|
|||
<title><?=$title_for_layout?></title>
|
||||
<?=$html->charsetTag('UTF-8')?>
|
||||
<?=$html->cssTag('default')?>
|
||||
<?=$html->cssTag('forms')?>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
|
102
libs/controllers/templates/scaffolds/edit.thtml
Normal file
102
libs/controllers/templates/scaffolds/edit.thtml
Normal file
|
@ -0,0 +1,102 @@
|
|||
<h1>Editing <?php echo Inflector::camelize($this->name); ?></h1>
|
||||
<?php echo $html->formTag('/'.$this->viewPath.'/update');?>
|
||||
<table cellspacing="0" class="inav">
|
||||
<tr>
|
||||
<th>Column Type</th>
|
||||
<th>Column Name</th>
|
||||
<th>Value</th>
|
||||
</tr>
|
||||
<?php
|
||||
$model = Inflector::pluralize($this->name);
|
||||
$table = Inflector::singularize($this->name);
|
||||
$evenNum = 1;
|
||||
$css = false;
|
||||
|
||||
foreach ($this->$table->_table_info as $tables) {
|
||||
$columnCount = 0;
|
||||
foreach ($tables as $tabl) {
|
||||
foreach ($this->_viewVars as $names) {?>
|
||||
<?php
|
||||
|
||||
if ($evenNum % 2 == 0 ){
|
||||
$css = ' class="or"';
|
||||
}else{
|
||||
$css = false;
|
||||
}
|
||||
$evenNum++;
|
||||
?>
|
||||
|
||||
<?php echo "<tr$css>";?>
|
||||
<td> <?php echo $tabl['type'];?> </td>
|
||||
<td> <?php echo $tabl['name'];?> </td>
|
||||
<td><?php echo $names[$table][$tabl['name']]?></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
$columnCount++;
|
||||
}
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
<?php
|
||||
if(!empty($this->$table->joinedHasOne)){?>
|
||||
|
||||
<table cellspacing="0" class="inav">
|
||||
|
||||
<tr>
|
||||
<th> </th>
|
||||
<th>Joined Table</th>
|
||||
<th> </th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Column Type</th>
|
||||
<th>Column Name</th>
|
||||
<th>Value</th>
|
||||
</tr>
|
||||
<?php
|
||||
|
||||
$joinedCount = count($this->$table->joinedHasOne);
|
||||
$count = $columnCount;
|
||||
$evenNum = 1;
|
||||
$css = false;
|
||||
|
||||
for ($i = 0; $i <= $joinedCount-1; $i++) {
|
||||
foreach ($this->$table->joinedHasOne[$i]->_table_info as $tab) {
|
||||
foreach($tab as $test){
|
||||
?>
|
||||
|
||||
<?php
|
||||
|
||||
if ($evenNum % 2 == 0 ){
|
||||
$css = ' class="or"';
|
||||
}else{
|
||||
$css = false;
|
||||
}
|
||||
$evenNum++;
|
||||
?>
|
||||
|
||||
<?php echo "<tr$css>";?>
|
||||
<td> <?php echo $test['type'];?> </td>
|
||||
<td> <?php echo $test['name'];?> </td>
|
||||
<td><?php echo $names[Inflector::singularize($this->$table->joinedHasOne[$i]->table)][$test['name']]?></td>
|
||||
</tr>
|
||||
<?php
|
||||
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
<?php }?>
|
||||
|
||||
|
||||
<table cellspacing="0" class="inav">
|
||||
<br /><?php echo $html->submitTag('Save')?></p>
|
||||
</form>
|
||||
<tr>
|
||||
<td>
|
||||
<?php echo $html->linkTo('<span style="color: red;">Back</span>', "/{$this->viewPath}/list/")?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
105
libs/controllers/templates/scaffolds/list.thtml
Normal file
105
libs/controllers/templates/scaffolds/list.thtml
Normal file
|
@ -0,0 +1,105 @@
|
|||
<h1>Listing <?php echo Inflector::humanize($this->name); ?></h1>
|
||||
<table cellspacing="0" class="inav">
|
||||
<tr>
|
||||
<?php
|
||||
$model = Inflector::pluralize($this->name);
|
||||
$table = Inflector::singularize($this->name);
|
||||
|
||||
foreach ($this->$table->_table_info as $tables) {
|
||||
|
||||
|
||||
foreach ($tables as $tabl) {
|
||||
$tableHeader = Inflector::humanize($tabl['name']);
|
||||
|
||||
?>
|
||||
<th><?php echo $tableHeader;?></th>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
if(!empty($this->$table->joinedHasOne)){
|
||||
|
||||
echo" <th>Joined Table Actions</th>";
|
||||
}
|
||||
|
||||
if(!empty($this->$table->_hasMany)){
|
||||
|
||||
echo" <th>Has Many ";
|
||||
for ($i = 0; $i <= count($this->$table->_hasMany)-1; $i++) {
|
||||
echo Inflector::humanize($this->$table->_hasMany[$i]);
|
||||
}
|
||||
echo "</th>";
|
||||
} ?>
|
||||
|
||||
<th>Actions for <?php echo Inflector::humanize($this->name);?></th>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
$evenNum = 1;
|
||||
$css = false;
|
||||
foreach ($this->$table->findAll() as $columns){
|
||||
if ($evenNum % 2 == 0 ){
|
||||
$css = ' class="or"';
|
||||
}else{
|
||||
$css = false;
|
||||
}
|
||||
$evenNum++;
|
||||
?>
|
||||
|
||||
<?php echo "<tr$css>";?>
|
||||
<?php foreach ($tables as $tabl) {?>
|
||||
<td><?php echo $columns[$table][$tabl['name']]?></td>
|
||||
<?php
|
||||
}
|
||||
if(!empty($this->$table->joinedHasOne)){echo" <td>";?>
|
||||
<?php
|
||||
$joinedCount = count($this->$table->joinedHasOne);
|
||||
|
||||
for ($i = 0; $i <= $joinedCount-1; $i++) {
|
||||
foreach ($this->$table->joinedHasOne[$i]->_table_info as $tab) {
|
||||
foreach($tab as $test){
|
||||
if($test['name'] === 'id'){
|
||||
echo $html->linkTo('<span style="color: red;">Edit: <b>'. Inflector::humanize(Inflector::singularize($this->$table->joinedHasOne[$i]->table)) .'</b></span>',"/{$this->$table->joinedHasOne[$i]->table}/edit/{$columns[Inflector::singularize($this->$table->joinedHasOne[$i]->table)][$test['name']]}");
|
||||
echo '<br /><b>' . Inflector::humanize($test['name']) .':</b> ' . $columns[Inflector::singularize($this->$table->joinedHasOne[$i]->table)][$test['name']] .'<br />';
|
||||
} else{
|
||||
echo '<b>' . Inflector::humanize($test['name']) .':</b> ' . $columns[Inflector::singularize($this->$table->joinedHasOne[$i]->table)][$test['name']] .'<br />';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($this->$table->joinedHasOne)){ echo" </td>";}?>
|
||||
|
||||
<?php if(!empty($this->$table->_hasMany)){ echo" <td>";?>
|
||||
<?php
|
||||
for ($i = 0; $i <= count($this->$table->_hasMany)-1; $i++) {
|
||||
for ($ia = 0; $ia <= count($columns)-2; $ia++) {
|
||||
foreach ($this->$table->joinedHasMany[0] as $tab) {
|
||||
foreach($tab as $test){
|
||||
if($test['name'] === 'id'){
|
||||
echo $html->linkTo('<span style="color: red;">Edit: <b>'. Inflector::humanize(Inflector::singularize($this->$table->_hasMany[$i])) .'</b></span>',"/{$this->$table->_hasMany[$i]}/edit/{$columns[$ia][Inflector::singularize($this->$table->_hasMany[$i])][$test['name']]}");
|
||||
echo '<br /><b>' . Inflector::humanize($test['name']) .':</b> ' . $columns[$ia][Inflector::singularize($this->$table->_hasMany[$i])][$test['name']] .'<br />';
|
||||
} else{
|
||||
echo '<b>' . Inflector::humanize($test['name']) .':</b> ' . $columns[$ia][Inflector::singularize($this->$table->_hasMany[$i])][$test['name']] .'<br />';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(!empty($this->$table->hasMany)){ echo" </td>";}?>
|
||||
|
||||
<td><?php echo $html->linkTo('<span style="color: red;">Show</span>', "/{$this->viewPath}/show/{$columns[Inflector::singularize($this->name)]['id']}")?>
|
||||
<?php echo $html->linkTo('<span style="color: red;">Edit</span>',"/{$this->viewPath}/edit/{$columns[Inflector::singularize($this->name)]['id']}")?>
|
||||
<?php echo $html->linkTo('<span style="color: red;">Destroy</span>',"/{$this->viewPath}/destroy/{$columns[Inflector::singularize($this->name)]['id']}")?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</table>
|
||||
<table>
|
||||
<tr>
|
||||
<td colspan="3"><?php echo $html->linkTo('Add New '.Inflector::humanize(Inflector::singularize($this->viewPath)).'', "/{$this->viewPath}/new/") ?></td>
|
||||
</tr>
|
||||
</table>
|
94
libs/controllers/templates/scaffolds/new.thtml
Normal file
94
libs/controllers/templates/scaffolds/new.thtml
Normal file
|
@ -0,0 +1,94 @@
|
|||
<h1>New <?php echo Inflector::camelize($this->name); ?></h1>
|
||||
<?php echo $html->formTag('/'.$this->viewPath.'/create');?>
|
||||
<table cellspacing="0" class="inav">
|
||||
<tr>
|
||||
<th>Column Type</th>
|
||||
<th>Column Name</th>
|
||||
</tr>
|
||||
<?php
|
||||
$model = Inflector::pluralize($this->name);
|
||||
$table = Inflector::singularize($this->name);
|
||||
$columnCount = 0;
|
||||
$evenNum = 1;
|
||||
$css = false;
|
||||
|
||||
foreach ($this->$table->_table_info as $tables) {
|
||||
foreach ($tables as $tabl) {?>
|
||||
|
||||
<?php
|
||||
|
||||
if ($evenNum % 2 == 0 ){
|
||||
$css = ' class="or"';
|
||||
}else{
|
||||
$css = false;
|
||||
}
|
||||
$evenNum++;
|
||||
?>
|
||||
<?php echo "<tr$css>";?>
|
||||
<td> <?php echo $tabl['type'];?> </td>
|
||||
<td> <?php echo $tabl['name'];?> </td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
$columnCount++;
|
||||
}
|
||||
?>
|
||||
|
||||
</table>
|
||||
<?php
|
||||
if(!empty($this->$table->joinedHasOne)){?>
|
||||
<table cellspacing="0" class="inav">
|
||||
<tr>
|
||||
<th>Joined Table</th>
|
||||
<th> </th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Column Type</th>
|
||||
<th>Column Name</th>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
$joinedCount = count($this->$table->joinedHasOne);
|
||||
$count = $columnCount;
|
||||
$evenNum = 1;
|
||||
$css = false;
|
||||
|
||||
for ($i = 0; $i <= $joinedCount-1; $i++) {
|
||||
foreach ($this->$table->joinedHasOne[$i]->_table_info as $tab) {
|
||||
foreach($tab as $test){?>
|
||||
<?php
|
||||
|
||||
if ($evenNum % 2 == 0 ){
|
||||
$css = ' class="or"';
|
||||
}else{
|
||||
$css = false;
|
||||
}
|
||||
$evenNum++;
|
||||
?>
|
||||
<?php echo "<tr$css>";?>
|
||||
<td> <?php echo $test['type'];?> </td>
|
||||
<td> <?php echo $test['name'];?> </td>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
<?php }?>
|
||||
|
||||
|
||||
<table cellspacing="0" class="inav">
|
||||
<br /><?php echo $html->submitTag('Save')?></p>
|
||||
</form>
|
||||
<tr>
|
||||
<td>
|
||||
<?php echo $html->linkTo('<span style="color: red;">Back</span>', "/{$this->viewPath}/list/")?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
16
libs/controllers/templates/scaffolds/scaffold.thtml
Normal file
16
libs/controllers/templates/scaffolds/scaffold.thtml
Normal file
|
@ -0,0 +1,16 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
|
||||
<head>
|
||||
<title><?=$title_for_layout?></title>
|
||||
<?=$html->charsetTag('UTF-8')?>
|
||||
<?=$html->cssTag('scaffold')?>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h1><?=$title_for_layout?></h1>
|
||||
|
||||
<?=$content_for_layout?>
|
||||
|
||||
</body>
|
||||
</html>
|
93
libs/controllers/templates/scaffolds/show.thtml
Normal file
93
libs/controllers/templates/scaffolds/show.thtml
Normal file
|
@ -0,0 +1,93 @@
|
|||
<?php
|
||||
$model = Inflector::pluralize($this->name);
|
||||
$table = Inflector::singularize($this->name);
|
||||
$evenNum = 1;
|
||||
$css = false;
|
||||
?>
|
||||
|
||||
<h1>Showing <?php echo Inflector::camelize($this->name); ?></h1>
|
||||
<table cellspacing="0" class="inav">
|
||||
<tr>
|
||||
<th>Field</th>
|
||||
<th>Value</th>
|
||||
<?php
|
||||
if(!empty($this->$table->joinedHasOne)){
|
||||
|
||||
echo" <th>Joined Table</th>";
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
</tr>
|
||||
<?php
|
||||
foreach ($this->$table->_table_info as $tables) {
|
||||
$columnCount = 0;
|
||||
|
||||
foreach ($tables as $tabl) {
|
||||
$tableName[] = $tabl['name'];
|
||||
|
||||
foreach ($this->_viewVars as $names) {
|
||||
|
||||
?>
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
if ($evenNum % 2 == 0 ){
|
||||
$css = ' class="or"';
|
||||
}else{
|
||||
$css = false;
|
||||
}
|
||||
$evenNum++;
|
||||
?>
|
||||
|
||||
<?php echo "<tr$css>";?>
|
||||
<td><?php echo Inflector::humanize($tableName[$columnCount]);?></td>
|
||||
<td><?php echo $names[$table][$tabl['name']]?></td>
|
||||
|
||||
<?php
|
||||
}
|
||||
$columnCount++;
|
||||
}
|
||||
}
|
||||
?>
|
||||
</tr>
|
||||
<?php
|
||||
if(!empty($this->$table->joinedHasOne)){?>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td>
|
||||
<?php
|
||||
|
||||
$joinedCount = count($this->$table->joinedHasOne);
|
||||
$count = $columnCount;
|
||||
|
||||
for ($i = 0; $i <= $joinedCount-1; $i++) {
|
||||
foreach ($this->$table->joinedHasOne[$i]->_table_info as $tab) {
|
||||
foreach($tab as $test){
|
||||
if($test['name'] === 'id'){
|
||||
echo $html->linkTo('<span style="color: red;">Edit: <b>'. Inflector::humanize(Inflector::singularize($this->$table->joinedHasOne[$i]->table)) .'</b></span>',"/{$this->$table->joinedHasOne[$i]->table}/edit/{$names[Inflector::singularize($this->$table->joinedHasOne[$i]->table)][$test['name']]}");
|
||||
echo '<br /><b>' . Inflector::humanize($test['name']) .':</b> ' . $names[Inflector::singularize($this->$table->joinedHasOne[$i]->table)][$test['name']];
|
||||
} else{
|
||||
echo '<br /><b>' . Inflector::humanize($test['name']) .':</b> ' . $names[Inflector::singularize($this->$table->joinedHasOne[$i]->table)][$test['name']];
|
||||
}
|
||||
$count++;
|
||||
}
|
||||
echo '<br />';
|
||||
}
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<?php }?>
|
||||
<table cellspacing="0" class="inav">
|
||||
<tr>
|
||||
<td>
|
||||
<?php echo $html->linkTo('<span style="color: red;">Back</span>', "/{$this->viewPath}/list/")?>
|
||||
<?php echo $html->linkTo('<span style="color: red;">Edit</span>',"/{$this->viewPath}/edit/{$names[Inflector::singularize($this->name)]['id']}")?>
|
||||
<?php echo $html->linkTo('<span style="color: red;">Destroy</span>',"/{$this->viewPath}/destroy/{$names[Inflector::singularize($this->name)]['id']}")?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
|
@ -42,7 +42,7 @@ define('DISPATCHER_UNKNOWN_VIEW', 'missingView');
|
|||
/**
|
||||
* Add Description
|
||||
*/
|
||||
uses('error_messages', 'object', 'router', 'controller');
|
||||
uses('error_messages', 'object', 'router', 'controller', 'scaffold');
|
||||
|
||||
/**
|
||||
* Dispatches the request, creating appropriate models and controllers.
|
||||
|
@ -134,6 +134,20 @@ class Dispatcher extends Object
|
|||
}
|
||||
else
|
||||
{
|
||||
// Check to see if controller is scaffolded
|
||||
$classVars = get_class_vars($ctrlClass);
|
||||
foreach ($classVars as $name => $value)
|
||||
{
|
||||
if($name === 'scaffold')
|
||||
{
|
||||
if (empty($params['action']))
|
||||
{
|
||||
$params['action'] = 'index';
|
||||
}
|
||||
$this->scaffoldView($url, $ctrlClass, $params);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
$missingAction = true;
|
||||
}
|
||||
}
|
||||
|
@ -141,6 +155,16 @@ class Dispatcher extends Object
|
|||
// if the requested action doesn't exist
|
||||
if (!method_exists($controller, $params['action']))
|
||||
{
|
||||
// Check to see if controller is scaffolded
|
||||
$classVars = get_class_vars($ctrlClass);
|
||||
foreach ($classVars as $name => $value)
|
||||
{
|
||||
if($name === 'scaffold')
|
||||
{
|
||||
$this->scaffoldView($url, $ctrlClass, $params);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
$missingAction = true;
|
||||
}
|
||||
|
||||
|
@ -318,6 +342,71 @@ class Dispatcher extends Object
|
|||
$this->error404($url, "missing controller \"{$controller_class}\"");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* When now methods are present in a controller
|
||||
* scaffoldView is used to call default Scaffold methods if:
|
||||
* <code>
|
||||
* var $scaffold;
|
||||
* </code>
|
||||
* is placed in the controller class definition
|
||||
*
|
||||
* @param string $url
|
||||
* @param string $controller_class
|
||||
* @param array $params
|
||||
* @since Cake v 1.0.0.172
|
||||
*/
|
||||
function scaffoldView ($url, $controller_class, $params)
|
||||
{
|
||||
if($params['action'] === 'index' || $params['action'] === 'list' ||
|
||||
$params['action'] === 'show' || $params['action'] === 'new' ||
|
||||
$params['action'] === 'create' || $params['action'] === 'edit' ||
|
||||
$params['action'] === 'update' || $params['action'] === 'destroy')
|
||||
{
|
||||
$scaffolding = new Scaffold($controller_class, $params);
|
||||
$scaffolding->base = $this->base;
|
||||
$scaffolding->constructClasses($params);
|
||||
|
||||
switch ($params['action'])
|
||||
{
|
||||
case 'index':
|
||||
$scaffolding->showScaffoldIndex($params);
|
||||
break;
|
||||
|
||||
case 'show':
|
||||
$scaffolding->showScaffoldShow($params);
|
||||
break;
|
||||
|
||||
case 'list':
|
||||
$scaffolding->showScaffoldList($params);
|
||||
break;
|
||||
|
||||
case 'new':
|
||||
$scaffolding->showScaffoldNew($params);
|
||||
break;
|
||||
|
||||
case 'edit':
|
||||
$scaffolding->showScaffoldEdit($params);
|
||||
break;
|
||||
|
||||
case 'create':
|
||||
$scaffolding->scaffoldCreate($params);
|
||||
break;
|
||||
|
||||
case 'update':
|
||||
$scaffolding->scaffoldUpdate($params);
|
||||
break;
|
||||
|
||||
case 'destroy':
|
||||
$scaffolding->scaffoldDestroy($params);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errorUnknownAction($url, $controller_class, $params['action']);
|
||||
}
|
||||
exit;
|
||||
}
|
||||
}
|
||||
?>
|
53
libs/helpers/acl.php
Normal file
53
libs/helpers/acl.php
Normal file
|
@ -0,0 +1,53 @@
|
|||
<?php
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// + $Id: $
|
||||
// +------------------------------------------------------------------+ //
|
||||
// + Cake PHP : Rapid Development Framework <http://www.cakephp.org/> + //
|
||||
// + Copyright: (c) 2005, CakePHP Authors/Developers + //
|
||||
// + Author(s): Michal Tatarynowicz aka Pies <tatarynowicz@gmail.com> + //
|
||||
// + Larry E. Masters aka PhpNut <nut@phpnut.com> + //
|
||||
// + Kamil Dzielinski aka Brego <brego.dk@gmail.com> + //
|
||||
// +------------------------------------------------------------------+ //
|
||||
// + Licensed under The MIT License + //
|
||||
// + Redistributions of files must retain the above copyright notice. + //
|
||||
// + See: http://www.opensource.org/licenses/mit-license.php + //
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Access Control List.
|
||||
*
|
||||
* @filesource
|
||||
* @author CakePHP Authors/Developers
|
||||
* @copyright Copyright (c) 2005, CakePHP Authors/Developers
|
||||
* @link https://trac.cakephp.org/wiki/Authors Authors/Developers
|
||||
* @package cake
|
||||
* @subpackage cake.libs.helpers
|
||||
* @since CakePHP v 0.9.2
|
||||
* @version $Revision: $
|
||||
* @modifiedby $LastChangedBy: $
|
||||
* @lastmodified $Date: $
|
||||
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Access Control List helper library.
|
||||
*
|
||||
* @package cake
|
||||
* @subpackage cake.libs.helpers
|
||||
* @since CakePHP v 0.9.2
|
||||
*
|
||||
*/
|
||||
class AclHelper
|
||||
{
|
||||
|
||||
/**
|
||||
* Enter description here...
|
||||
*
|
||||
* @return AclHelper
|
||||
*/
|
||||
function AclHelper()
|
||||
{
|
||||
}
|
||||
}
|
||||
?>
|
276
libs/helpers/form.php
Normal file
276
libs/helpers/form.php
Normal file
|
@ -0,0 +1,276 @@
|
|||
<?php
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// + $Id$
|
||||
// +------------------------------------------------------------------+ //
|
||||
// + Cake PHP : Rapid Development Framework <http://www.cakephp.org/> + //
|
||||
// + Copyright: (c) 2005, CakePHP Authors/Developers + //
|
||||
// + Author(s): Michal Tatarynowicz aka Pies <tatarynowicz@gmail.com> + //
|
||||
// + Larry E. Masters aka PhpNut <nut@phpnut.com> + //
|
||||
// + Kamil Dzielinski aka Brego <brego.dk@gmail.com> + //
|
||||
// +------------------------------------------------------------------+ //
|
||||
// + Licensed under The MIT License + //
|
||||
// + Redistributions of files must retain the above copyright notice. + //
|
||||
// + See: http://www.opensource.org/licenses/mit-license.php + //
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Purpose: Dispatcher
|
||||
* Dispatches the request, creating aproppriate models and controllers.
|
||||
*
|
||||
* @filesource
|
||||
* @author CakePHP Authors/Developers
|
||||
* @copyright Copyright (c) 2005, CakePHP Authors/Developers
|
||||
* @link https://trac.cakephp.org/wiki/Authors Authors/Developers
|
||||
* @package cake
|
||||
* @subpackage cake.libs.helpers
|
||||
* @since CakePHP v 0.9.2
|
||||
* @version $Revision$
|
||||
* @modifiedby $LastChangedBy$
|
||||
* @lastmodified $Date$
|
||||
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
||||
*/
|
||||
|
||||
uses( 'helpers/html' );
|
||||
|
||||
/**
|
||||
* Tag template for a div.
|
||||
*/
|
||||
define('TAG_DIV', '<div class="%s">%s</div>');
|
||||
|
||||
/**
|
||||
* Tag template for a div.
|
||||
*/
|
||||
define('TAG_P_CLASS', '<p class="%s">%s</p>');
|
||||
|
||||
/**
|
||||
* Tag template for a label.
|
||||
*/
|
||||
define('TAG_LABEL', '<label for="%s">%s</label>');
|
||||
|
||||
/**
|
||||
* Tag template for a fieldset.
|
||||
*/
|
||||
define('TAG_FIELDSET', '<fieldset><legend>%s</legend>%s</label>');
|
||||
|
||||
/**
|
||||
* Form helper library.
|
||||
*
|
||||
* @package cake
|
||||
* @subpackage cake.libs.helpers
|
||||
* @since CakePHP v 0.9.1
|
||||
*
|
||||
*/
|
||||
class FormHelper
|
||||
{
|
||||
|
||||
/**
|
||||
* Constructor which takes an instance of the HtmlHelper class.
|
||||
*
|
||||
* @param object $htmlHelper the HtmlHelper object to use as our helper.
|
||||
* @return void
|
||||
*/
|
||||
function FormHelper()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a formatted error message for given FORM field, NULL if no errors.
|
||||
*
|
||||
* @param string $field If field is to be used for CRUD, this should be modelName/fieldName
|
||||
* @return bool If there are errors this method returns true, else false.
|
||||
*/
|
||||
function isFieldError(HtmlHelper $html, $field )
|
||||
{
|
||||
$error = 1;
|
||||
$html->setFormTag( $field );
|
||||
if( $error == $html->tagIsInvalid( $html->model, $html->field) )
|
||||
{
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a formatted LABEL tag for HTML FORMs.
|
||||
*
|
||||
* @param string $tagName If field is to be used for CRUD, this should be modelName/fieldName
|
||||
* @param string $text Text that will appear in the label field.
|
||||
* @return string The formatted LABEL element
|
||||
*/
|
||||
function labelTag( $tagName, $text )
|
||||
{
|
||||
return sprintf( TAG_LABEL, $tagName, $text );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a formatted DIV tag for HTML FORMs.
|
||||
*
|
||||
* @param string $class If field is to be used for CRUD, this should be modelName/fieldName
|
||||
* @param string $text Text that will appear in the label field.
|
||||
* @return string The formatted DIV element
|
||||
*/
|
||||
function divTag( $class, $text )
|
||||
{
|
||||
return sprintf( TAG_DIV, $class, $text );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a formatted P tag with class for HTML FORMs.
|
||||
*
|
||||
* @param string $class If field is to be used for CRUD, this should be modelName/fieldName
|
||||
* @param string $text Text that will appear in the label field.
|
||||
* @return string The formatted DIV element
|
||||
*/
|
||||
function pTag( $class, $text )
|
||||
{
|
||||
return sprintf( TAG_P_CLASS, $class, $text );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a formatted INPUT tag for HTML FORMs.
|
||||
*
|
||||
* @param HtmlHelper $html The HtmlHelper object which is creating this form.
|
||||
* @param string $tagName If field is to be used for CRUD, this should be modelName/fieldName
|
||||
* @param string $prompt Text that will appear in the label field.
|
||||
* @param bool $required True if this field is required.
|
||||
* @param string $errorMsg Text that will appear if an error has occurred.
|
||||
* @param int $size Size attribute for INPUT element
|
||||
* @param array $htmlOptions
|
||||
* @return string The formatted INPUT element
|
||||
*/
|
||||
function generateInputDiv(HtmlHelper $html, $tagName, $prompt, $required=false, $errorMsg=null, $size=20, $htmlOptions=null )
|
||||
{
|
||||
$str = $html->inputTag( $tagName, $size, $htmlOptions );
|
||||
$strLabel = $this->labelTag( $tagName, $prompt );
|
||||
|
||||
$divClass = "optional";
|
||||
|
||||
if( $required )
|
||||
$divClass = "required";
|
||||
|
||||
$strError = ""; // initialize the error to empty.
|
||||
|
||||
if( $this->isFieldError( $html, $tagName ) )
|
||||
{
|
||||
// if it was an error that occured, then add the error message, and append " error" to the div tag.
|
||||
$strError = $this->pTag( 'error', $errorMsg );
|
||||
$divClass = sprintf( "%s error", $divClass );
|
||||
}
|
||||
$divTagInside = sprintf( "%s %s %s", $strError, $strLabel, $str );
|
||||
|
||||
return $this->divTag( $divClass, $divTagInside );
|
||||
|
||||
}
|
||||
|
||||
function generateAreaDiv(HtmlHelper $html, $tagName, $prompt, $required=false, $errorMsg=null, $cols=60, $rows=10, $htmlOptions=null )
|
||||
{
|
||||
$str = $html->areaTag( $tagName, $cols, $rows, $htmlOptions );
|
||||
$strLabel = $this->labelTag( $tagName, $prompt );
|
||||
|
||||
$divClass = "optional";
|
||||
|
||||
if( $required )
|
||||
$divClass = "required";
|
||||
|
||||
$strError = ""; // initialize the error to empty.
|
||||
|
||||
if( $this->isFieldError( $html, $tagName ) )
|
||||
{
|
||||
// if it was an error that occured, then add the error message, and append " error" to the div tag.
|
||||
$strError = $this->pTag( 'error', $errorMsg );
|
||||
$divClass = sprintf( "%s error", $divClass );
|
||||
}
|
||||
$divTagInside = sprintf( "%s %s %s", $strError, $strLabel, $str );
|
||||
|
||||
return $this->divTag( $divClass, $divTagInside );
|
||||
|
||||
}
|
||||
/**
|
||||
* Returns a formatted SELECT tag for HTML FORMs.
|
||||
*
|
||||
* @param HtmlHelper $html The HtmlHelper object which is creating this form.
|
||||
* @param string $tagName If field is to be used for CRUD, this should be modelName/fieldName
|
||||
* @param string $prompt Text that will appear in the label field.
|
||||
* @param array $options Options to be contained in SELECT element
|
||||
* @param bool $required True if this field is required.
|
||||
* @param string $selected Text of the currently selected item
|
||||
* @param bool $required True if this field is required.
|
||||
* @param bool $required True if this field is required.
|
||||
* @param string $errorMsg Text that will appear if an error has occurred.
|
||||
* @param array $selectAttr
|
||||
* @param array $optionAttr
|
||||
* @return string The formatted INPUT element
|
||||
*/
|
||||
function generateSelectDiv(HtmlHelper $html, $tagName, $prompt, $options, $selected=null, $selectAttr=null, $optionAttr=null, $required=false, $errorMsg=null)
|
||||
{
|
||||
$str = $html->selectTag( $tagName, $options, $selected, $selectAttr, $optionAttr );
|
||||
$strLabel = $this->labelTag( $tagName, $prompt );
|
||||
|
||||
$divClass = "optional";
|
||||
|
||||
if( $required )
|
||||
$divClass = "required";
|
||||
|
||||
$strError = ""; // initialize the error to empty.
|
||||
|
||||
if( $this->isFieldError( $html, $tagName ) )
|
||||
{
|
||||
// if it was an error that occured, then add the error message, and append " error" to the div tag.
|
||||
$strError = $this->pTag( 'error', $errorMsg );
|
||||
$divClass = sprintf( "%s error", $divClass );
|
||||
}
|
||||
$divTagInside = sprintf( "%s %s %s", $strError, $strLabel, $str );
|
||||
|
||||
return $this->divTag( $divClass, $divTagInside );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates an form to go onto a HtmlHelper object.
|
||||
*
|
||||
* @param HtmlHelper $html The HtmlHelper object which is creating this form.
|
||||
* @param array $fields An array of form field definitions.
|
||||
* @return string The completed form specified by the $fields praameter.
|
||||
*/
|
||||
function generateFields( $html, $fields )
|
||||
{
|
||||
$strFormFields = '';
|
||||
|
||||
foreach( $fields as $field )
|
||||
{
|
||||
switch( $field['type'] )
|
||||
{
|
||||
case "input" :
|
||||
$strFormFields = $strFormFields.$this->generateInputDiv( $html, $field['tagName'], $field['prompt'], $field['required'], $field['errorMsg'], $field['size'], $field['htmlOptions'] );
|
||||
break;
|
||||
case "select";
|
||||
$strFormFields = $strFormFields.$this->generateSelectDiv( $html, $field['tagName'], $field['prompt'], $field['options'], $field['selected'], $field['selectAttr'], $field['optionsAttr'], $field['required'], $field['errorMsg'] );
|
||||
break;
|
||||
case "area";
|
||||
$strFormFields = $strFormFields.$this->generateAreaDiv( $html, $field['tagName'], $field['prompt'], $field['required'], $field['errorMsg'], $field['cols'], $field['rows'], $field['htmlOptions'] );
|
||||
break;
|
||||
case "fieldset";
|
||||
$strFieldsetFields = $this->generateFields( $html, $field['fields'] );
|
||||
|
||||
$strFieldSet = sprintf( '
|
||||
<fieldset>
|
||||
<legend>%s</legend>
|
||||
<div class="notes">
|
||||
<h4>%s</h4>
|
||||
<p class="last">%s</p>
|
||||
</div>
|
||||
%s
|
||||
</fieldset>', $field['legend'], $field['noteHeading'], $field['note'], $strFieldsetFields );
|
||||
return $strFieldSet;
|
||||
break;
|
||||
default:
|
||||
//bugbug: i don't know how to put out a notice that an unknown type was entered.
|
||||
break;
|
||||
}
|
||||
}
|
||||
return $strFormFields;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -192,16 +192,35 @@ class Inflector extends Object
|
|||
return Inflector::underscore($class_name) . "_id";
|
||||
}
|
||||
|
||||
/**
|
||||
* Enter description here...
|
||||
*
|
||||
* @param unknown_type $name
|
||||
* @return unknown
|
||||
*/
|
||||
function toControllerFilename($name)
|
||||
{
|
||||
return CONTROLLERS.Inflector::underscore($name).'.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* Enter description here...
|
||||
*
|
||||
* @param unknown_type $name
|
||||
* @return unknown
|
||||
*/
|
||||
function toHelperFilename($name)
|
||||
{
|
||||
return HELPERS.Inflector::underscore($name).'.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* Enter description here...
|
||||
*
|
||||
* @param unknown_type $name
|
||||
* @param unknown_type $correct
|
||||
* @return unknown
|
||||
*/
|
||||
function toFullName($name, $correct)
|
||||
{
|
||||
if (strstr($name, '_') && (strtolower($name) == $name))
|
||||
|
@ -226,6 +245,12 @@ class Inflector extends Object
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Enter description here...
|
||||
*
|
||||
* @param unknown_type $name
|
||||
* @return unknown
|
||||
*/
|
||||
function toLibraryFilename ($name)
|
||||
{
|
||||
return LIBS.Inflector::underscore($name).'.php';
|
||||
|
|
440
libs/model.php
440
libs/model.php
|
@ -15,7 +15,7 @@
|
|||
|
||||
/**
|
||||
* Purpose: Model
|
||||
* DBO-backed object data model, loosely based on RoR (www.rubyonrails.com).
|
||||
* DBO-backed object data model, loosely based on RoR concepts (www.rubyonrails.com).
|
||||
* Automatically selects a database table name based on a pluralized lowercase object class name
|
||||
* (i.e. class 'User' => table 'users'; class 'Man' => table 'men')
|
||||
* The table is required to have at least 'id auto_increment', 'created datetime',
|
||||
|
@ -43,7 +43,7 @@
|
|||
uses('object', 'validators', 'inflector');
|
||||
|
||||
/**
|
||||
* DBO-backed object data model, loosely based on RoR (www.rubyonrails.com).
|
||||
* DBO-backed object data model, loosely based on RoR concepts (www.rubyonrails.com).
|
||||
* Automatically selects a database table name based on a pluralized lowercase object class name
|
||||
* (i.e. class 'User' => table 'users'; class 'Man' => table 'men')
|
||||
* The table is required to have at least 'id auto_increment', 'created datetime',
|
||||
|
@ -96,7 +96,7 @@ class Model extends Object
|
|||
* @access public
|
||||
*/
|
||||
var $table = false;
|
||||
// private
|
||||
|
||||
/**
|
||||
* Table metadata
|
||||
*
|
||||
|
@ -113,6 +113,14 @@ class Model extends Object
|
|||
*/
|
||||
var $_hasOne = array();
|
||||
|
||||
/**
|
||||
* Enter description here...
|
||||
*
|
||||
* @var unknown_type
|
||||
* @access private
|
||||
*/
|
||||
var $_belongsTo = array();
|
||||
|
||||
|
||||
/**
|
||||
* Array of other Models this Model references in a one-to-many relationship.
|
||||
|
@ -189,20 +197,122 @@ class Model extends Object
|
|||
*/
|
||||
function createLinks()
|
||||
{
|
||||
if (!empty($this->belongsTo))
|
||||
{
|
||||
return $this->_belongsToLink();
|
||||
}
|
||||
|
||||
if (!empty($this->hasOne))
|
||||
{
|
||||
$this->_hasOneLink();
|
||||
}
|
||||
if (!empty($this->hasMany))
|
||||
{
|
||||
return $this->_hasManyLinks();
|
||||
}
|
||||
}
|
||||
if (!empty($this->hasMany))
|
||||
{
|
||||
return $this->_hasManyLinks();
|
||||
}
|
||||
|
||||
if (!empty($this->hasAndBelongsToMany))
|
||||
{
|
||||
return $this->_hasAndBelongsToManyLinks();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Enter description here...
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
function _belongsToLink()
|
||||
{
|
||||
if(is_array($this->belongsTo))
|
||||
{
|
||||
if (count($this->id) > 1)
|
||||
{
|
||||
$this->_count++;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->_count = false;
|
||||
}
|
||||
|
||||
function _resetCount()
|
||||
{
|
||||
return $this->_count = 0;
|
||||
foreach ($this->belongsTo as $association => $associationValue)
|
||||
{
|
||||
$className = $association;
|
||||
$classCreated = false;
|
||||
|
||||
foreach ($associationValue as $option => $optionValue)
|
||||
{
|
||||
if (($option === 'className') && ($classCreated === false))
|
||||
{
|
||||
$className = $optionValue;
|
||||
}
|
||||
|
||||
if ($classCreated === false)
|
||||
{
|
||||
$this->$className = &new $className();
|
||||
$classCreated = true;
|
||||
$this->_belongsTo = array($association,$className);
|
||||
}
|
||||
|
||||
switch($option)
|
||||
{
|
||||
case 'conditions':
|
||||
$modelConditions = $this->table .'To'. $association . 'Conditions';
|
||||
$conditions = $optionValue;
|
||||
$this->$modelConditions = $conditions;
|
||||
unset($modelConditions);
|
||||
break;
|
||||
|
||||
case 'order':
|
||||
$modelOrder = $this->table .'To'. $association . 'Order';
|
||||
$order = $optionValue;
|
||||
$this->$modelOrder = $order;
|
||||
unset($modelOrder);
|
||||
break;
|
||||
|
||||
case 'foreignKey':
|
||||
$modelForeignKey = $this->table .'To'. $association . 'ForeignKey';
|
||||
$foreignKey = $optionValue;
|
||||
$this->$modelForeignKey = $foreignKey;
|
||||
unset($modelForeignKey);
|
||||
break;
|
||||
|
||||
case 'counterCache':
|
||||
$modelCounterCache= $this->table .'To'. $association . 'counterCache';
|
||||
$counterCache = $optionValue;
|
||||
$this->$modelCounterCache = $counterCache;
|
||||
unset($modelCounterCache);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$this->_constructAssociatedModels($className , 'Belongs');
|
||||
unset($className);
|
||||
|
||||
if (!count($this->id) > 1)
|
||||
{
|
||||
$this->_resetCount();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->_resetCount();
|
||||
if (count($this->id) > 1)
|
||||
{
|
||||
$this->_count++;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->_count = false;
|
||||
}
|
||||
|
||||
$association = explode(',', $this->belongsTo);
|
||||
foreach ($association as $modelName)
|
||||
{
|
||||
$this->_constructAssociatedModels($modelName , 'Belongs');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -304,6 +414,10 @@ class Model extends Object
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Enter description here...
|
||||
*
|
||||
*/
|
||||
function _hasManyLinks()
|
||||
{
|
||||
if(is_array($this->hasMany))
|
||||
|
@ -313,7 +427,7 @@ class Model extends Object
|
|||
foreach ($this->hasMany as $association => $associationValue)
|
||||
{
|
||||
$className = $association;
|
||||
$this->_hasMany = array($className,$association);
|
||||
$this->_hasMany = array($association,$className);
|
||||
|
||||
foreach ($associationValue as $option => $optionValue)
|
||||
{
|
||||
|
@ -356,21 +470,48 @@ class Model extends Object
|
|||
break;
|
||||
}
|
||||
}
|
||||
$this->linkManyToOne($className, $this->id[$this->_count]);
|
||||
$this->linkAssociation('Many', $className, $this->id[$this->_count]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->_hasMany = explode(',', $this->hasMany);
|
||||
$this->_resetCount();
|
||||
{
|
||||
$this->_resetCount();
|
||||
if (count($this->id) > 1)
|
||||
{
|
||||
$this->_count++;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->_count = false;
|
||||
}
|
||||
|
||||
foreach ($this->_hasMany as $modelName)
|
||||
{
|
||||
$this->_constructAssociatedModels($modelName , 'Many');
|
||||
}
|
||||
}
|
||||
$association = explode(',', $this->hasMany);
|
||||
foreach ($association as $modelName)
|
||||
{
|
||||
$this->linkAssociation('Many', $modelName, $this->id[$this->_count]);;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function _hasAndBelongsToManyLinks()
|
||||
{
|
||||
if(is_array($this->hasAndBelongsToMany))
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->_hasAndBelongsToMany = explode(',', $this->hasAndBelongsToMany);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Enter description here...
|
||||
*
|
||||
* @return unknown
|
||||
*/
|
||||
function _resetCount()
|
||||
{
|
||||
return $this->_count = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enter description here...
|
||||
|
@ -380,116 +521,141 @@ class Model extends Object
|
|||
* @param unknown_type $settings
|
||||
* @access private
|
||||
*/
|
||||
function _constructAssociatedModels($className, $type = false, $settings = false)
|
||||
function _constructAssociatedModels($className, $type, $settings = false)
|
||||
{
|
||||
$modelName = Inflector::singularize($className);
|
||||
|
||||
switch($type)
|
||||
{
|
||||
case 'Belongs':
|
||||
$joinedHas = 'joinedBelongsTo';
|
||||
break;
|
||||
|
||||
case 'One':
|
||||
$this->linkOneToOne($modelName, $this->id[$this->_count++]);
|
||||
$joinedHas = 'joinedHasOne';
|
||||
break;
|
||||
|
||||
case 'Many':
|
||||
$this->linkManyToOne($modelName, $this->id[$this->_count++]);
|
||||
$joinedHas = 'joinedHasMany';
|
||||
break;
|
||||
|
||||
case 'ManyTo':
|
||||
$joinedHas = 'joinedHasAndBelongs';
|
||||
break;
|
||||
|
||||
default:
|
||||
//nothing
|
||||
break;
|
||||
}
|
||||
$this->linkAssociation($type, $modelName, $this->id[$this->_count]);
|
||||
|
||||
if(!isset($this->$className))
|
||||
{
|
||||
$this->$className = &new $className();
|
||||
$this->$className = new $className();
|
||||
}
|
||||
$this->{$joinedHas}[] = $this->$className;
|
||||
$this->relink();
|
||||
$this->relink($type);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Updates this model's association links, by emptying the links list, and then link"*Association Type" again.
|
||||
*
|
||||
* @param unknown_type $type
|
||||
*/
|
||||
function relink ()
|
||||
function relink ($type)
|
||||
{
|
||||
switch ($type)
|
||||
{
|
||||
case 'Belongs':
|
||||
foreach ($this->_belongsTo as $table)
|
||||
{
|
||||
if(is_array($table))
|
||||
{
|
||||
$names[] = explode(',', $table);
|
||||
}
|
||||
else
|
||||
{
|
||||
$names[0] = $table;
|
||||
$names[1] = $table;
|
||||
}
|
||||
$className = $names[1];
|
||||
$tableName = Inflector::singularize($names[0]);
|
||||
$this->$className->clearLinks($type);
|
||||
$this->$className->linkAssociation($type, $tableName, $this->id);
|
||||
}
|
||||
break;
|
||||
|
||||
if(!empty($this->id))
|
||||
{
|
||||
$i = 1;
|
||||
}
|
||||
case 'One':
|
||||
foreach ($this->_hasOne as $table)
|
||||
{
|
||||
if(is_array($table))
|
||||
{
|
||||
$names[] = explode(',', $table);
|
||||
}
|
||||
else
|
||||
{
|
||||
$names[0] = $table;
|
||||
$names[1] = $table;
|
||||
}
|
||||
$className = $names[1];
|
||||
$tableName = Inflector::singularize($names[0]);
|
||||
$this->$className->clearLinks($type);
|
||||
$this->$className->linkAssociation($type, $tableName, $this->id);
|
||||
}
|
||||
break;
|
||||
|
||||
foreach ($this->_hasOne as $table)
|
||||
{
|
||||
if(is_array($table))
|
||||
{
|
||||
$names[] = explode(',', $table);
|
||||
}
|
||||
else
|
||||
{
|
||||
$names[0] = $table;
|
||||
$names[1] = $table;
|
||||
}
|
||||
$className = $names[1];
|
||||
$tableName = Inflector::singularize($names[0]);
|
||||
$this->$className->clearLinks();
|
||||
$this->$className->linkOneToOne($tableName, $this->id[$i]);
|
||||
}
|
||||
foreach ($this->_hasMany as $table)
|
||||
{
|
||||
if(is_array($table))
|
||||
{
|
||||
$names[] = explode(',', $table);
|
||||
}
|
||||
else
|
||||
{
|
||||
$names[0] = $table;
|
||||
$names[1] = $table;
|
||||
}
|
||||
$className = $names[1];
|
||||
$tableName = Inflector::singularize($names[0]);
|
||||
$this->clearLinks();
|
||||
$this->linkManyToOne($tableName, $this->id[0]);
|
||||
}
|
||||
case 'Many':
|
||||
foreach ($this->_hasMany as $table)
|
||||
{
|
||||
if(is_array($table))
|
||||
{
|
||||
$names[] = explode(',', $table);
|
||||
}
|
||||
else
|
||||
{
|
||||
$names[0] = $table;
|
||||
$names[1] = $table;
|
||||
}
|
||||
$className = $names[1];
|
||||
$tableName = Inflector::singularize($names[0]);
|
||||
$this->clearLinks($type);
|
||||
$this->linkAssociation($type, $tableName, $this->id[0]);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'ManyTo':
|
||||
foreach ($this->_manyToMany as $table)
|
||||
{
|
||||
if(is_array($table))
|
||||
{
|
||||
$names[] = explode(',', $table);
|
||||
}
|
||||
else
|
||||
{
|
||||
$names[0] = $table;
|
||||
$names[1] = $table;
|
||||
}
|
||||
$className = $names[1];
|
||||
$tableName = Inflector::singularize($names[0]);
|
||||
$this->clearLinks($type);
|
||||
$this->linkAssociation($type, $tableName, $this->id[0]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates a many-to-one link for given $model_name.
|
||||
* First it gets Inflector to derive a table name and a foreign key field name.
|
||||
* Then, these are stored in the Model.
|
||||
*
|
||||
* @param string $model_name Name of model to link to
|
||||
* @param unknown_type $value Defaults to NULL.
|
||||
*/
|
||||
function linkManyToOne ($tableName, $value=null)
|
||||
{
|
||||
$tableName = Inflector::tableize($tableName);
|
||||
$fieldKey = $this->table .'To'. Inflector::singularize($tableName) . 'ForeignKey';
|
||||
|
||||
if(!empty($this->$fieldKey))
|
||||
{
|
||||
$field_name = $this->$fieldKey;
|
||||
}
|
||||
else
|
||||
{
|
||||
$field_name = Inflector::singularize($this->table).'_id';
|
||||
}
|
||||
$this->_oneToMany[] = array($tableName, $field_name, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Enter description here...
|
||||
*
|
||||
* @param unknown_type $type
|
||||
* @param unknown_type $tableName
|
||||
* @param unknown_type $value
|
||||
*/
|
||||
function linkOneToOne ($tableName, $value=null)
|
||||
function linkAssociation ($type, $tableName, $value=null)
|
||||
{
|
||||
|
||||
$tableName = Inflector::tableize($tableName);
|
||||
$fieldKey = $this->table .'To'. Inflector::singularize($tableName) . 'ForeignKey';
|
||||
|
||||
|
@ -499,19 +665,64 @@ class Model extends Object
|
|||
}
|
||||
else
|
||||
{
|
||||
$field_name = Inflector::singularize($tableName).'_id';
|
||||
if ($type === 'Belongs' || $type === 'One')
|
||||
{
|
||||
$field_name = Inflector::singularize($tableName).'_id';
|
||||
}
|
||||
else
|
||||
{
|
||||
$field_name = Inflector::singularize($this->table).'_id';
|
||||
}
|
||||
}
|
||||
|
||||
switch ($type)
|
||||
{
|
||||
case 'Belongs':
|
||||
|
||||
$this->_belongsToOther[] = array($tableName, $field_name, $value);
|
||||
break;
|
||||
|
||||
case 'One':
|
||||
//$field_name = Inflector::singularize($tableName).'_id';
|
||||
$this->_oneToOne[] = array($tableName, $field_name, $value);
|
||||
break;
|
||||
|
||||
case 'Many':
|
||||
|
||||
$this->_oneToMany[] = array($tableName, $field_name, $value);
|
||||
break;
|
||||
|
||||
case 'ManyTo':
|
||||
|
||||
$this->_manyToMany = array();
|
||||
break;
|
||||
}
|
||||
$this->_oneToOne[] = array($tableName, $field_name, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes all one-to-many links to other Models.
|
||||
* Removes all oassociation links to other Models.
|
||||
*
|
||||
*/
|
||||
function clearLinks()
|
||||
function clearLinks($type)
|
||||
{
|
||||
$this->_oneToMany = array();
|
||||
$this->_oneToOne = array();
|
||||
switch ($type)
|
||||
{
|
||||
case 'Belongs':
|
||||
$this->_belongsToOther = array();
|
||||
break;
|
||||
|
||||
case 'One':
|
||||
$this->_oneToOne = array();
|
||||
break;
|
||||
|
||||
case 'Many':
|
||||
$this->_oneToMany = array();
|
||||
break;
|
||||
|
||||
case 'ManyTo':
|
||||
$this->_manyToMany = array();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -586,7 +797,26 @@ class Model extends Object
|
|||
function setId ($id)
|
||||
{
|
||||
$this->id = $id;
|
||||
$this->relink();
|
||||
|
||||
if(!empty($this->_belongsToOther))
|
||||
{
|
||||
$this->relink('Belongs');
|
||||
}
|
||||
|
||||
if(!empty($this->_oneToOne))
|
||||
{
|
||||
$this->relink('One');
|
||||
}
|
||||
|
||||
if(!empty($this->_oneToMany))
|
||||
{
|
||||
$this->relink('Many');
|
||||
}
|
||||
|
||||
if(!empty($this->_manyToMany))
|
||||
{
|
||||
$this->relink('ManyTo');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -899,10 +1129,22 @@ class Model extends Object
|
|||
|
||||
$joins = $whers = array();
|
||||
|
||||
foreach ($this->_oneToOne as $rule)
|
||||
if(!empty($this->_oneToOne))
|
||||
{
|
||||
list($table, $field, $value) = $rule;
|
||||
$joins[] = "LEFT JOIN {$table} ON {$this->table}.{$field} = {$table}.id";
|
||||
foreach ($this->_oneToOne as $rule)
|
||||
{
|
||||
list($table, $field, $value) = $rule;
|
||||
$joins[] = "LEFT JOIN {$table} ON {$this->table}.{$field} = {$table}.id";
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($this->_belongsToOther))
|
||||
{
|
||||
foreach ($this->_belongsToOther as $rule)
|
||||
{
|
||||
list($table, $field, $value) = $rule;
|
||||
$joins[] = "LEFT JOIN {$table} ON {$this->table}.{$field} = {$table}.id";
|
||||
}
|
||||
}
|
||||
|
||||
$joins = count($joins)? join(' ', $joins): null;
|
||||
|
|
53
libs/sanitize.php
Normal file
53
libs/sanitize.php
Normal file
|
@ -0,0 +1,53 @@
|
|||
<?php
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// + $Id:$
|
||||
// +------------------------------------------------------------------+ //
|
||||
// + Cake PHP : Rapid Development Framework <http://www.cakephp.org/> + //
|
||||
// + Copyright: (c) 2005, CakePHP Authors/Developers + //
|
||||
// + Author(s): Michal Tatarynowicz aka Pies <tatarynowicz@gmail.com> + //
|
||||
// + Larry E. Masters aka PhpNut <nut@phpnut.com> + //
|
||||
// + Kamil Dzielinski aka Brego <brego.dk@gmail.com> + //
|
||||
// +------------------------------------------------------------------+ //
|
||||
// + Licensed under The MIT License + //
|
||||
// + Redistributions of files must retain the above copyright notice. + //
|
||||
// + See: http://www.opensource.org/licenses/mit-license.php + //
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Data Sanitization
|
||||
*
|
||||
* @filesource
|
||||
* @author CakePHP Authors/Developers
|
||||
* @copyright Copyright (c) 2005, CakePHP Authors/Developers
|
||||
* @link https://trac.cakephp.org/wiki/Authors Authors/Developers
|
||||
* @package cake
|
||||
* @subpackage cake.libs
|
||||
* @since CakePHP v 0.9.2
|
||||
* @version $Revision: 356 $
|
||||
* @modifiedby $LastChangedBy:$
|
||||
* @lastmodified $Date:$
|
||||
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Data Sanitization.
|
||||
*
|
||||
* @package cake
|
||||
* @subpackage cake.libs
|
||||
* @since CakePHP v 0.9.2
|
||||
*
|
||||
*/
|
||||
class Sanitize
|
||||
{
|
||||
|
||||
/**
|
||||
* Enter description here...
|
||||
*
|
||||
* @return Sanitize
|
||||
*/
|
||||
function Sanitize()
|
||||
{
|
||||
}
|
||||
}
|
||||
?>
|
202
libs/scaffold.php
Normal file
202
libs/scaffold.php
Normal file
|
@ -0,0 +1,202 @@
|
|||
<?PHP
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// + $Id$
|
||||
// +------------------------------------------------------------------+ //
|
||||
// + Cake <https://developers.nextco.com/cake/> + //
|
||||
// + Copyright: (c) 2005, Cake Authors/Developers + //
|
||||
// + Author(s): Michal Tatarynowicz aka Pies <tatarynowicz@gmail.com> + //
|
||||
// + Larry E. Masters aka PhpNut <nut@phpnut.com> + //
|
||||
// + Kamil Dzielinski aka Brego <brego.dk@gmail.com> + //
|
||||
// +------------------------------------------------------------------+ //
|
||||
// + Licensed under The MIT License + //
|
||||
// + Redistributions of files must retain the above copyright notice. + //
|
||||
// + See: http://www.opensource.org/licenses/mit-license.php + //
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Purpose: Scaffold
|
||||
*
|
||||
*
|
||||
* @filesource
|
||||
* @author Cake Authors/Developers
|
||||
* @copyright Copyright (c) 2005, Cake Authors/Developers
|
||||
* @link https://developers.nextco.com/cake/wiki/Authors Authors/Developers
|
||||
* @package cake
|
||||
* @subpackage cake.libs
|
||||
* @since Cake v 1.0.0.172
|
||||
* @version $Revision$
|
||||
* @modifiedby $LastChangedBy$
|
||||
* @lastmodified $Date$
|
||||
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Enter description here...
|
||||
*/
|
||||
uses('model', 'template', 'inflector', 'object');
|
||||
|
||||
/**
|
||||
* Enter description here...
|
||||
*
|
||||
*
|
||||
* @package cake
|
||||
* @subpackage cake.libs
|
||||
* @since Cake v 1.0.0.172
|
||||
*
|
||||
*/
|
||||
class Scaffold extends Object {
|
||||
|
||||
/**
|
||||
* Enter description here...
|
||||
*
|
||||
* @var unknown_type
|
||||
*/
|
||||
var $clazz = null;
|
||||
|
||||
/**
|
||||
* Enter description here...
|
||||
*
|
||||
* @var unknown_type
|
||||
*/
|
||||
var $actionView = null;
|
||||
|
||||
/**
|
||||
* Enter description here...
|
||||
*
|
||||
* @var unknown_type
|
||||
*/
|
||||
var $model = null;
|
||||
|
||||
/**
|
||||
* Enter description here...
|
||||
*
|
||||
* @var unknown_type
|
||||
*/
|
||||
var $controllerClass = null;
|
||||
|
||||
/**
|
||||
* Enter description here...
|
||||
*
|
||||
* @var unknown_type
|
||||
*/
|
||||
var $modelName = null;
|
||||
|
||||
/**
|
||||
* Enter description here...
|
||||
*
|
||||
* @var unknown_type
|
||||
*/
|
||||
var $scaffoldTitle = null;
|
||||
|
||||
/**
|
||||
* Enter description here...
|
||||
*
|
||||
* @var unknown_type
|
||||
*/
|
||||
var $base = false;
|
||||
|
||||
/**
|
||||
* Enter description here...
|
||||
*
|
||||
* @param unknown_type $controller_class
|
||||
* @param unknown_type $action
|
||||
*/
|
||||
function __construct($controller_class, $params){
|
||||
$this->clazz = $controller_class;
|
||||
$this->actionView = $params['action'];
|
||||
|
||||
$r = null;
|
||||
if (!preg_match('/(.*)Controller/i', $this->clazz, $r))
|
||||
die("Scaffold::__construct() : Can't get or parse class name.");
|
||||
$this->model = strtolower(Inflector::singularize($r[1]));
|
||||
$this->scaffoldTitle = Inflector::toString($this) . ' ' . $r[1];
|
||||
}
|
||||
|
||||
function constructClasses($params){
|
||||
|
||||
$this->controllerClass = new $this->clazz();
|
||||
$this->controllerClass->base = $this->base;
|
||||
$this->controllerClass->params = $params;
|
||||
$this->controllerClass->contructClasses();
|
||||
$this->controllerClass->layout = 'scaffold';
|
||||
$this->controllerClass->pageTitle = $this->scaffoldTitle;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enter description here...
|
||||
*
|
||||
* @return unknown
|
||||
*/
|
||||
function showScaffoldIndex($params){
|
||||
return $this->showScaffoldList($params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Enter description here...
|
||||
*
|
||||
*/
|
||||
function showScaffoldShow($params){
|
||||
$model = $this->model;
|
||||
$this->controllerClass->set('data', $this->controllerClass->models[$model]->read());
|
||||
$this->controllerClass->render($this->actionView, '', LIBS.'controllers'.DS.'templates'.DS.'scaffolds'.DS.'show.thtml');
|
||||
}
|
||||
|
||||
/**
|
||||
* Enter description here...
|
||||
*
|
||||
*/
|
||||
function showScaffoldList($params){
|
||||
$this->controllerClass->render($this->actionView, '', LIBS.'controllers'.DS.'templates'.DS.'scaffolds'.DS.'list.thtml');
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Enter description here...
|
||||
*
|
||||
*/
|
||||
function showScaffoldNew($params){
|
||||
|
||||
$this->controllerClass->render($this->actionView, '', LIBS.'controllers'.DS.'templates'.DS.'scaffolds'.DS.'new.thtml');
|
||||
}
|
||||
|
||||
/**
|
||||
* Enter description here...
|
||||
*
|
||||
*/
|
||||
function showScaffoldEdit($params){
|
||||
$model = $this->model;
|
||||
$this->controllerClass->set('data', $this->controllerClass->models[$model]->read());
|
||||
$this->controllerClass->render($this->actionView, '', LIBS.'controllers'.DS.'templates'.DS.'scaffolds'.DS.'edit.thtml');
|
||||
}
|
||||
|
||||
/**
|
||||
* Enter description here...
|
||||
*
|
||||
*/
|
||||
function scaffoldCreate($params){
|
||||
|
||||
$this->controllerClass->flash('Scaffold::scaffoldCreate not implemented yet', '/'.$this->controllerClass->viewPath, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Enter description here...
|
||||
*
|
||||
*/
|
||||
function scaffoldUpdate($params=array()){
|
||||
|
||||
$this->controllerClass->flash('Scaffold::scaffoldUpdate not implemented yet', '/'.$this->controllerClass->viewPath, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Enter description here...
|
||||
*
|
||||
*/
|
||||
function scaffoldDestroy($params=array()){
|
||||
|
||||
$this->controllerClass->flash('Scaffold::scaffoldDestroy not implemented yet', '/'.$this->controllerClass->viewPath, 1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
|
@ -96,6 +96,14 @@ class Time extends Object
|
|||
return date('Y-m-d', $date) == date('Y-m-d', time());
|
||||
}
|
||||
|
||||
/**
|
||||
* Enter description here...
|
||||
*
|
||||
* @param unknown_type $begin
|
||||
* @param unknown_type $end
|
||||
* @param unknown_type $field_name
|
||||
* @return unknown
|
||||
*/
|
||||
function daysAsSql ($begin, $end, $field_name)
|
||||
{
|
||||
$begin = date('Y-m-d', $begin).' 00:00:00';
|
||||
|
@ -104,6 +112,13 @@ class Time extends Object
|
|||
return "($field_name >= '$begin') AND ($field_name <= '$end')";
|
||||
}
|
||||
|
||||
/**
|
||||
* Enter description here...
|
||||
*
|
||||
* @param unknown_type $date
|
||||
* @param unknown_type $field_name
|
||||
* @return unknown
|
||||
*/
|
||||
function dayAsSql ($date, $field_name)
|
||||
{
|
||||
return Time::daysAsSql($date, $date, $field_name);
|
||||
|
|
|
@ -88,6 +88,11 @@ class View extends Object
|
|||
*/
|
||||
var $helpers = array('html');
|
||||
|
||||
/**
|
||||
* Enter description here...
|
||||
*
|
||||
* @var unknown_type
|
||||
*/
|
||||
var $viewPath;
|
||||
|
||||
/**
|
||||
|
@ -147,18 +152,39 @@ class View extends Object
|
|||
*/
|
||||
var $autoLayout = true;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Enter description here...
|
||||
*
|
||||
* @var unknown_type
|
||||
*/
|
||||
var $params;
|
||||
/**
|
||||
* Enter description here...
|
||||
*
|
||||
* @var unknown_type
|
||||
*/
|
||||
var $hasRendered = null;
|
||||
|
||||
/**
|
||||
* Enter description here...
|
||||
*
|
||||
* @var unknown_type
|
||||
*/
|
||||
var $modelsLoaded = false;
|
||||
|
||||
/**
|
||||
* Enter description here...
|
||||
*
|
||||
* @return View
|
||||
*/
|
||||
function View(){
|
||||
}
|
||||
|
||||
/**
|
||||
* Enter description here...
|
||||
*
|
||||
* @return unknown
|
||||
*/
|
||||
function getInstance()
|
||||
{
|
||||
static $instance;
|
||||
|
@ -392,18 +418,30 @@ class View extends Object
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Enter description here...
|
||||
*
|
||||
*/
|
||||
function missingController()
|
||||
{
|
||||
//We are simulating action call below, this is not a filename!
|
||||
$this->render('../errors/missingController');
|
||||
}
|
||||
|
||||
/**
|
||||
* Enter description here...
|
||||
*
|
||||
*/
|
||||
function missingAction()
|
||||
{
|
||||
//We are simulating action call below, this is not a filename!
|
||||
$this->render('../errors/missingAction');
|
||||
}
|
||||
|
||||
/**
|
||||
* Enter description here...
|
||||
*
|
||||
*/
|
||||
function missingView()
|
||||
{
|
||||
//We are simulating action call below, this is not a filename!
|
||||
|
@ -445,8 +483,17 @@ class View extends Object
|
|||
*/
|
||||
function _getLayoutFileName()
|
||||
{
|
||||
return VIEWS."layouts".DS."{$this->layout}.thtml";
|
||||
}
|
||||
if(file_exists(VIEWS."layouts".DS."{$this->layout}.thtml")){
|
||||
return VIEWS."layouts".DS."{$this->layout}.thtml";
|
||||
}
|
||||
elseif(file_exists(LIBS.'controllers'.DS.'templates'.DS.'scaffolds'.DS."{$this->layout}.thtml")){
|
||||
return LIBS.'controllers'.DS.'templates'.DS.'scaffolds'.DS."{$this->layout}.thtml";
|
||||
}
|
||||
else{//Let allows setting path to other layouts??
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Renders and returns output for given view filename with its
|
||||
|
|
309
public/css/forms.css
Normal file
309
public/css/forms.css
Normal file
|
@ -0,0 +1,309 @@
|
|||
/* form.css */
|
||||
|
||||
* {
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
form {
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
font-size: 100%;
|
||||
min-width: 560px;
|
||||
max-width: 620px;
|
||||
width: 590px;
|
||||
}
|
||||
|
||||
form fieldset {
|
||||
font-size: 100%;
|
||||
border-color: #000000;
|
||||
border-width: 1px 0px 0px 0px;
|
||||
border-style: solid none none none;
|
||||
padding: 10px;
|
||||
margin: 0px 0px 0px 0px;
|
||||
}
|
||||
|
||||
form fieldset legend {
|
||||
font-size: 150%;
|
||||
font-weight: normal;
|
||||
color: #000000;
|
||||
margin: 0px 0px 0px 0px;
|
||||
padding: 0px 5px;
|
||||
}
|
||||
|
||||
label {
|
||||
font-size: 100%;
|
||||
}
|
||||
|
||||
label u {
|
||||
font-style: normal;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
input, select, textarea {
|
||||
font-family: Tahoma, Arial, sans-serif;
|
||||
font-size: 100%;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
textarea {
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
form div {
|
||||
clear: left;
|
||||
display: block;
|
||||
width: 354px;
|
||||
height: expression('1%');
|
||||
margin: 5px 0px 0px 0px;
|
||||
padding: 1px 3px;
|
||||
}
|
||||
|
||||
form fieldset div.notes {
|
||||
float: right;
|
||||
width: 158px;
|
||||
height: auto;
|
||||
margin: 0px 0px 10px 10px;
|
||||
padding: 5px;
|
||||
border: 1px solid #666666;
|
||||
background-color: #ffffe1;
|
||||
color: #666666;
|
||||
font-size: 88%;
|
||||
}
|
||||
|
||||
form fieldset div.notes h4 {
|
||||
background-image: url(/images/icon_info.gif);
|
||||
background-repeat: no-repeat;
|
||||
background-position: top left;
|
||||
padding: 3px 0px 3px 27px;
|
||||
border-width: 0px 0px 1px 0px;
|
||||
border-style: solid;
|
||||
border-color: #666666;
|
||||
color: #666666;
|
||||
font-size: 110%;
|
||||
}
|
||||
|
||||
form fieldset div.notes p {
|
||||
margin: 0em 0em 1.2em 0em;
|
||||
color: #666666;
|
||||
}
|
||||
|
||||
form fieldset div.notes p.last {
|
||||
margin: 0em;
|
||||
}
|
||||
|
||||
form div fieldset {
|
||||
clear: none;
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
border-color: #666666;
|
||||
margin: 0px 0px 0px 142px;
|
||||
padding: 0px 5px 5px 5px;
|
||||
width: 197px;
|
||||
}
|
||||
|
||||
form div fieldset legend {
|
||||
font-size: 100%;
|
||||
padding: 0px 3px 0px 9px;
|
||||
}
|
||||
|
||||
form div.required fieldset legend {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
form div label {
|
||||
display: block;
|
||||
float: left;
|
||||
width: 130px;
|
||||
padding: 3px 5px;
|
||||
margin: 0px 0px 5px 0px;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
form div.optional label, label.optional {
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
form div.required label, label.required {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
form div label.labelCheckbox, form div label.labelRadio {
|
||||
float: none;
|
||||
display: block;
|
||||
width: 200px;
|
||||
height: expression('1%');
|
||||
padding: 0px;
|
||||
margin: 0px 0px 5px 142px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
form div fieldset label.labelCheckbox, form div fieldset label.labelRadio {
|
||||
margin: 0px 0px 5px 0px;
|
||||
width: 170px;
|
||||
}
|
||||
|
||||
p.error {
|
||||
background-color: #ff0000;
|
||||
background-image: url(/images/icon_error.gif);
|
||||
background-repeat: no-repeat;
|
||||
background-position: 3px 3px;
|
||||
color: #ffffff;
|
||||
padding: 3px 3px 5px 27px;
|
||||
border: 1px solid #000000;
|
||||
margin: auto 100px;
|
||||
}
|
||||
|
||||
form div.error {
|
||||
background-color: #ffffe1;
|
||||
background-image: url(/images/required_bg.gif);
|
||||
background-repeat: no-repeat;
|
||||
background-position: top left;
|
||||
color: #666666;
|
||||
border: 1px solid #ff0000;
|
||||
}
|
||||
|
||||
form div.error p.error {
|
||||
background-image: url(/images/icon_error.gif);
|
||||
background-position: top left;
|
||||
background-color: transparent;
|
||||
border-style: none;
|
||||
font-size: 88%;
|
||||
font-weight: bold;
|
||||
margin: 0px 0px 0px 118px;
|
||||
width: 200px;
|
||||
color: #ff0000;
|
||||
}
|
||||
|
||||
form div input, form div select, form div textarea {
|
||||
width: 200px;
|
||||
padding: 1px 3px;
|
||||
margin: 0px 0px 0px 0px;
|
||||
}
|
||||
|
||||
form div input.inputFile {
|
||||
width: 211px;
|
||||
}
|
||||
|
||||
form div select.selectOne, form div select.selectMultiple {
|
||||
width: 211px;
|
||||
padding: 1px 3px;
|
||||
}
|
||||
|
||||
form div input.inputCheckbox, form div input.inputRadio, input.inputCheckbox, input.inputRadio {
|
||||
display: inline;
|
||||
height: 14px;
|
||||
width: 14px;
|
||||
background-color: transparent;
|
||||
border-width: 0px;
|
||||
padding: 0px;
|
||||
margin: 0px 0px 0px 140px;
|
||||
}
|
||||
|
||||
form div.submit {
|
||||
width: 214px;
|
||||
padding: 0px 0px 0px 140px;
|
||||
}
|
||||
|
||||
form div.submit div {
|
||||
display: inline;
|
||||
float: left;
|
||||
text-align: left;
|
||||
width: auto;
|
||||
padding: 0px;
|
||||
margin: 0px;
|
||||
}
|
||||
|
||||
form div input.inputSubmit, form div input.inputButton, input.inputSubmit, input.inputButton {
|
||||
background-color: #cccccc;
|
||||
color: #000000;
|
||||
width: auto;
|
||||
padding: 0px 6px;
|
||||
margin: 0px;
|
||||
}
|
||||
|
||||
form div.submit div input.inputSubmit, form div.submit div input.inputButton {
|
||||
float: right;
|
||||
margin: 0px 0px 0px 5px;
|
||||
}
|
||||
|
||||
form div small {
|
||||
display: block;
|
||||
margin: 0px 0px 5px 142px;
|
||||
padding: 1px 3px;
|
||||
font-size: 88%;
|
||||
height: expression('1%');
|
||||
}
|
||||
|
||||
/* form.import.css */
|
||||
|
||||
form fieldset legend {
|
||||
line-height: 150%;
|
||||
}
|
||||
|
||||
form input, form select, form textarea {
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
||||
form textarea.expanding {
|
||||
overflow: auto;
|
||||
overflow-x: auto;
|
||||
overflow-y: visible;
|
||||
}
|
||||
|
||||
div.optional label:before {
|
||||
content: '';
|
||||
}
|
||||
|
||||
div.required label:before {
|
||||
content: '';
|
||||
}
|
||||
|
||||
form div label.labelCheckbox, form div label.labelRadio, label.labelCheckbox, label.labelRadio {
|
||||
display: block;
|
||||
width: 190px;
|
||||
height: expression('1%');
|
||||
padding: 4px 0px 0px 18px;
|
||||
text-indent: -18px;
|
||||
line-height: 120%;
|
||||
}
|
||||
|
||||
form div label.labelCheckbox input.inputCheckbox, form div label.labelRadio input.inputRadio, label.labelCheckbox input.inputCheckbox, label.labelRadio input.inputRadio {
|
||||
margin: 0px 0px 0px 0px;
|
||||
}
|
||||
|
||||
form div fieldset input.inputText, form div fieldset input.inputPassword, form div fieldset input.inputFile, form div fieldset textarea.inputTextarea {
|
||||
width: 160px;
|
||||
margin: 0px 0px 0px 18px;
|
||||
margin: expression('0px 0px 0px -124px');
|
||||
}
|
||||
|
||||
form div label.compact {
|
||||
display: inline;
|
||||
width: auto;
|
||||
padding: 4px 10px 0px 0px;
|
||||
text-indent: 0px;
|
||||
margin: 0px 0px 0px 0px;
|
||||
}
|
||||
|
||||
form div.wide label {
|
||||
float: none;
|
||||
display: block;
|
||||
}
|
||||
|
||||
form div label.wide {
|
||||
width: 348px;
|
||||
}
|
||||
|
||||
form div.wide input.inputText, form div.wide input.inputPassword, form div.wide input.inputFile, form div.wide select, form div.wide textarea {
|
||||
width: 344px;
|
||||
margin: 0px;
|
||||
}
|
||||
|
||||
form div.notes p, form div small {
|
||||
line-height: 125%;
|
||||
}
|
||||
|
||||
form div.wide small {
|
||||
margin: 0px 0px 5px 0px;
|
||||
}
|
95
public/css/scaffold.css
Normal file
95
public/css/scaffold.css
Normal file
|
@ -0,0 +1,95 @@
|
|||
BODY {
|
||||
font-size:.9em;
|
||||
}
|
||||
|
||||
BODY, INPUT, TEXTAREA {
|
||||
font-family:sans-serif;
|
||||
}
|
||||
|
||||
H1 {
|
||||
font-size:2.1em;
|
||||
text-align:center;
|
||||
}
|
||||
|
||||
H2 {
|
||||
font-size:1.8em;
|
||||
}
|
||||
|
||||
H3 {
|
||||
font-size:1.5em;
|
||||
}
|
||||
|
||||
P {
|
||||
font-size:1em;
|
||||
margin-bottom:.5em;
|
||||
}
|
||||
|
||||
A {
|
||||
white-space:nowrap;
|
||||
text-decoration:underline;
|
||||
}
|
||||
|
||||
CODE, PRE {
|
||||
font-family:monospace;
|
||||
font-size:1.1em !important;
|
||||
font-size:.95em;
|
||||
color:#44A;
|
||||
margin:0;
|
||||
}
|
||||
|
||||
CODE {
|
||||
color:#227;
|
||||
white-space:nowrap;
|
||||
margin:0 .2em;
|
||||
}
|
||||
|
||||
PRE {
|
||||
margin-left:1em;
|
||||
}
|
||||
|
||||
ACRONYM {
|
||||
border-bottom:1px dotted;
|
||||
}
|
||||
|
||||
HR {
|
||||
height:0;
|
||||
border-top:1px solid #AAA;
|
||||
}
|
||||
|
||||
|
||||
/*table code */
|
||||
table.inav {
|
||||
width: 100%;
|
||||
border: 1px solid #686E74;
|
||||
margin: 1em 0 2em 0;
|
||||
background-color: #fff;
|
||||
}
|
||||
table.inav th {
|
||||
background-color: #ccc;
|
||||
text-align: left;
|
||||
border-top: 1px solid #fff;
|
||||
border-right: 1px solid #666;
|
||||
border-bottom: 1px solid #666;
|
||||
padding:3px;
|
||||
}
|
||||
table.inav tr td {
|
||||
padding:2px 0;
|
||||
border-right: 1px solid #ccc;
|
||||
}
|
||||
table.inav tr td {
|
||||
background: #fff;
|
||||
padding:2px 0;
|
||||
border-right: 1px solid #ccc;
|
||||
}
|
||||
table.inav tr.or td {
|
||||
background: #EBF4FD;
|
||||
}
|
||||
/* lists */
|
||||
ul.actions li {
|
||||
display:inline;
|
||||
border-right:1px solid #333;
|
||||
}
|
||||
ul.actions li a {
|
||||
color: #FF0000;
|
||||
padding:0 5px;
|
||||
}
|
Loading…
Reference in a new issue