mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-18 10:36:16 +00:00
refactoring view classes, added ScaffoldView that extends ThemeView in scaffold.php, adding tests, adding test_app with files
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6155 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
26247895aa
commit
67bbb0e93e
33 changed files with 1135 additions and 758 deletions
|
@ -171,29 +171,25 @@ class Configure extends Object {
|
|||
return false;
|
||||
}
|
||||
|
||||
$objects = array();
|
||||
|
||||
if (empty($path)) {
|
||||
$pathVar = $type . 'Paths';
|
||||
$path = $_this->{$pathVar};
|
||||
}
|
||||
$objects = array();
|
||||
$search = array_merge(array(APP), $_this->corePaths($type));
|
||||
|
||||
foreach ($search as $delete) {
|
||||
if (is_array($path) && in_array($delete, $path)) {
|
||||
$remove = array_flip($path);
|
||||
unset($remove[$delete]);
|
||||
$path = array_flip($remove);
|
||||
}
|
||||
}
|
||||
|
||||
$items = array();
|
||||
foreach ((array)$path as $dir) {
|
||||
$items = $_this->__list($dir, $types[$type]['suffix'], $extension);
|
||||
$objects = array_merge($items, $objects);
|
||||
if($type === 'file' || $type === 'class' || strpos($dir, $type) !== false) {
|
||||
$items = $_this->__list($dir, $types[$type]['suffix'], $extension);
|
||||
$objects = array_merge($items, array_diff($objects, $items));
|
||||
}
|
||||
}
|
||||
|
||||
if ($type !== 'file') {
|
||||
$objects = array_map(array(&$Inflector, 'camelize'), $objects);
|
||||
}
|
||||
|
||||
$_this->__objects[$name] = $objects;
|
||||
$_this->__cache = true;
|
||||
}
|
||||
|
@ -207,6 +203,7 @@ class Configure extends Object {
|
|||
* @return array List of directories or files in directory
|
||||
*/
|
||||
function __list($path, $suffix = false, $extension = false) {
|
||||
$_this =& Configure::getInstance();
|
||||
if (!class_exists('folder')) {
|
||||
uses('folder');
|
||||
}
|
||||
|
@ -443,42 +440,42 @@ class Configure extends Object {
|
|||
*/
|
||||
function corePaths($type = null) {
|
||||
$paths = Cache::read('core_paths', '_cake_core_');
|
||||
|
||||
$paths = false;
|
||||
if (!$paths) {
|
||||
$all = explode(PATH_SEPARATOR, ini_get('include_path'));
|
||||
$all = array_flip(array_flip((array_merge(array(CAKE_CORE_INCLUDE_PATH), $all))));
|
||||
|
||||
$used = array();
|
||||
foreach ($all as $path) {
|
||||
$path = rtrim($path, DS);
|
||||
|
||||
if ($path == '.') {
|
||||
if ($path == '.' || in_array(realpath($path), $used)) {
|
||||
continue;
|
||||
}
|
||||
if (is_dir($path . DS . 'cake' . DS . 'libs' . DS . 'model')) {
|
||||
$paths['model'][] = $path . DS . 'cake' . DS . 'libs' . DS . 'model';
|
||||
$paths['model'][] = $path . DS . 'cake' . DS . 'libs' . DS . 'model' . DS;
|
||||
}
|
||||
if (is_dir($path . DS . 'cake' . DS . 'libs' . DS . 'model' . DS . 'behaviors')) {
|
||||
$paths['behavior'][] = $path . DS . 'cake' . DS . 'libs' . DS . 'model' . DS . 'behaviors';
|
||||
$paths['behavior'][] = $path . DS . 'cake' . DS . 'libs' . DS . 'model' . DS . 'behaviors' . DS;
|
||||
}
|
||||
if (is_dir($path . DS . 'cake' . DS . 'libs' . DS . 'controller')) {
|
||||
$paths['controller'][] = $path . DS . 'cake' . DS . 'libs' . DS . 'controller';
|
||||
$paths['controller'][] = $path . DS . 'cake' . DS . 'libs' . DS . 'controller' . DS;
|
||||
}
|
||||
if (is_dir($path . DS . 'cake' . DS . 'libs' . DS . 'controller' . DS . 'components')) {
|
||||
$paths['component'][] = $path . DS . 'cake' . DS . 'libs' . DS . 'controller' . DS . 'components';
|
||||
$paths['component'][] = $path . DS . 'cake' . DS . 'libs' . DS . 'controller' . DS . 'components' . DS;
|
||||
}
|
||||
if (is_dir($path . DS . 'cake' . DS . 'libs' . DS . 'view')) {
|
||||
$paths['view'][] = $path . DS . 'cake' . DS . 'libs' . DS . 'view';
|
||||
$paths['view'][] = $path . DS . 'cake' . DS . 'libs' . DS . 'view' . DS;
|
||||
}
|
||||
if (is_dir($path . DS . 'cake' . DS . 'libs' . DS . 'view' . DS . 'helpers')) {
|
||||
$paths['helper'][] = $path . DS . 'cake' . DS . 'libs' . DS . 'view' . DS . 'helpers';
|
||||
$paths['helper'][] = $path . DS . 'cake' . DS . 'libs' . DS . 'view' . DS . 'helpers' . DS;
|
||||
}
|
||||
if (is_dir($path . DS . 'cake' . DS . 'libs')) {
|
||||
$paths['libs'][] = $path . DS . 'cake' . DS . 'libs';
|
||||
$paths['libs'][] = $path . DS . 'cake' . DS . 'libs' . DS;
|
||||
}
|
||||
if (is_dir($path . DS . 'cake')) {
|
||||
$paths['cake'][] = $path . DS . 'cake';
|
||||
$paths['class'][] = $path . DS . 'cake';
|
||||
$paths['cake'][] = $path . DS . 'cake' . DS;
|
||||
$paths['class'][] = $path . DS . 'cake' . DS;
|
||||
}
|
||||
$used[] = $path;
|
||||
}
|
||||
Cache::write('core_paths', array_filter($paths), '_cake_core_');
|
||||
}
|
||||
|
@ -897,7 +894,7 @@ class App extends Object {
|
|||
}
|
||||
|
||||
foreach ($_this->__paths[$path] as $directory) {
|
||||
if ($_this->__load($directory . DS . $file)) {
|
||||
if ($_this->__load($directory . DS . $file)) {
|
||||
return $directory . DS;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -187,6 +187,7 @@ class Scaffold extends Object {
|
|||
$this->controller->set(compact('modelClass', 'primaryKey', 'displayField', 'singularVar', 'pluralVar',
|
||||
'singularHumanName', 'pluralHumanName', 'scaffoldFields', 'associations'));
|
||||
|
||||
$this->controller->view = 'scaffold';
|
||||
$this->__scaffold($params);
|
||||
}
|
||||
/**
|
||||
|
@ -211,7 +212,7 @@ class Scaffold extends Object {
|
|||
|
||||
$this->controller->data = $this->ScaffoldModel->read();
|
||||
$this->controller->set(Inflector::variable($this->controller->modelClass), $this->controller->data);
|
||||
$this->controller->render($this->action, $this->layout, $this->__getViewFileName($params['action']));
|
||||
$this->controller->render($this->action, $this->layout);
|
||||
} elseif ($this->controller->_scaffoldError('view') === false) {
|
||||
return $this->__scaffoldError();
|
||||
}
|
||||
|
@ -227,7 +228,7 @@ class Scaffold extends Object {
|
|||
if ($this->controller->_beforeScaffold('index')) {
|
||||
$this->ScaffoldModel->recursive = 0;
|
||||
$this->controller->set(Inflector::variable($this->controller->name), $this->controller->paginate());
|
||||
$this->controller->render($this->action, $this->layout, $this->__getViewFileName($params['action']));
|
||||
$this->controller->render($this->action, $this->layout);
|
||||
} elseif ($this->controller->_scaffoldError('index') === false) {
|
||||
return $this->__scaffoldError();
|
||||
}
|
||||
|
@ -240,7 +241,7 @@ class Scaffold extends Object {
|
|||
* @access private
|
||||
*/
|
||||
function __scaffoldForm($action = 'edit') {
|
||||
$this->controller->render($action, $this->layout, $this->__getViewFileName($action));
|
||||
$this->controller->render($action, $this->layout);
|
||||
}
|
||||
/**
|
||||
* Saves or updates the scaffolded model.
|
||||
|
@ -443,66 +444,6 @@ class Scaffold extends Object {
|
|||
return $this->cakeError('missingDatabase', array(array('webroot' => $this->controller->webroot)));
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Returns scaffold view filename of given action's template file (.ctp) as a string.
|
||||
*
|
||||
* @param string $action Controller action to find template filename for
|
||||
* @return string Template filename
|
||||
* @access private
|
||||
*/
|
||||
function __getViewFileName($action) {
|
||||
$action = Inflector::underscore($action);
|
||||
$scaffoldAction = 'scaffold.'.$action;
|
||||
$paths = Configure::getInstance();
|
||||
|
||||
if (!is_null($this->webservices)) {
|
||||
$type = strtolower($this->webservices) . DS;
|
||||
} else {
|
||||
$type = null;
|
||||
}
|
||||
|
||||
if (!is_null($this->plugin)) {
|
||||
if (file_exists(APP . 'views' . DS . 'plugins' . DS . $this->plugin . DS . $this->subDir . $type . $scaffoldAction . $this->ext)) {
|
||||
return APP . 'views' . DS . 'plugins' . DS . $this->plugin . DS . $this->subDir . $type . $scaffoldAction . $this->ext;
|
||||
} elseif (file_exists(APP . 'views' . DS . 'plugins' . DS . $this->plugin . DS . $this->subDir . $type . $scaffoldAction . $this->ext)) {
|
||||
return APP . 'views' . DS . 'plugins' . DS . $this->plugin . DS . $this->subDir . $type . $scaffoldAction . $this->ext;
|
||||
} elseif (file_exists(APP . 'plugins' . DS . $this->plugin . DS . 'views' . DS . $this->viewPath . DS . $scaffoldAction . $this->ext)) {
|
||||
return APP . 'plugins' . DS . $this->plugin . DS . 'views' . DS . $this->viewPath . DS . $scaffoldAction . $this->ext;
|
||||
} elseif (file_exists(APP . 'views' . DS . 'plugins' . DS . $this->plugin . DS . $this->subDir . $type . $scaffoldAction . '.ctp')) {
|
||||
return APP . 'views' . DS . 'plugins' . DS . $this->plugin . DS . $this->subDir . $type . $scaffoldAction . '.ctp';
|
||||
} elseif (file_exists(APP . 'views' . DS . 'plugins' . DS . $this->plugin . DS . $this->subDir . $type . $scaffoldAction . '.thtml')) {
|
||||
return APP . 'views' . DS . 'plugins' . DS . $this->plugin . DS . $this->subDir . $type . $scaffoldAction . '.thtml';
|
||||
} elseif (file_exists(APP . 'views' . DS . 'plugins' . DS . 'scaffolds'. DS . $this->subDir . $type . $scaffoldAction . '.ctp')) {
|
||||
return APP . 'views' . DS . 'plugins' . DS . 'scaffolds'. DS . $this->subDir . $type . $scaffoldAction . '.ctp';
|
||||
} elseif (file_exists(APP . 'views' . DS . 'plugins' . DS . 'scaffolds'. DS . $this->subDir . $type . $scaffoldAction . '.thtml')) {
|
||||
return APP . 'views' . DS . 'plugins' . DS . 'scaffolds'. DS . $this->subDir . $type . $scaffoldAction . '.thtml';
|
||||
} elseif (file_exists(APP . 'plugins' . DS . $this->plugin . DS . 'views' . DS . $this->viewPath . DS . $scaffoldAction . '.ctp')) {
|
||||
return APP . 'plugins' . DS . $this->plugin . DS . 'views' . DS . $this->viewPath . DS . $scaffoldAction . '.ctp';
|
||||
} elseif (file_exists(APP . 'plugins' . DS . $this->plugin . DS . 'views' . DS . $this->viewPath . DS . $scaffoldAction . '.thtml')) {
|
||||
return APP . 'plugins' . DS . $this->plugin . DS . 'views' . DS . $this->viewPath . DS . $scaffoldAction . '.thtml';
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($paths->viewPaths as $path) {
|
||||
if (file_exists($path . $this->viewPath . DS . $this->subDir . $type . $scaffoldAction . $this->ext)) {
|
||||
return $path . $this->viewPath . DS . $this->subDir . $type . $scaffoldAction . $this->ext;
|
||||
} elseif (file_exists($path . 'scaffolds' . DS . $this->subDir . $type . $scaffoldAction . $this->ext)) {
|
||||
return $path . 'scaffolds' . DS . $this->subDir . $type . $scaffoldAction . $this->ext;
|
||||
} elseif (file_exists($path . $this->viewPath . DS . $this->subDir . $type . $scaffoldAction . '.ctp')) {
|
||||
return $path . $this->viewPath . DS . $this->subDir . $type . $scaffoldAction . '.ctp';
|
||||
} elseif (file_exists($path . $this->viewPath . DS . $this->subDir . $type . $scaffoldAction . '.thtml')) {
|
||||
return $path . $this->viewPath . DS . $this->subDir . $type . $scaffoldAction . '.thtml';
|
||||
} elseif (file_exists($path . 'scaffolds' . DS . $this->subDir . $type . $scaffoldAction . '.ctp')) {
|
||||
return $path . 'scaffolds' . DS . $this->subDir . $type . $scaffoldAction . '.ctp';
|
||||
} elseif (file_exists($path . 'scaffolds' . DS . $this->subDir . $type . $scaffoldAction . '.thtml')) {
|
||||
return $path . 'scaffolds' . DS . $this->subDir . $type . $scaffoldAction . '.thtml';
|
||||
}
|
||||
}
|
||||
if ($action === 'add') {
|
||||
$action = 'edit';
|
||||
}
|
||||
return LIBS . 'view' . DS . 'templates' . DS . 'scaffolds' . DS . $action . '.ctp';
|
||||
}
|
||||
/**
|
||||
* Returns associations for controllers models.
|
||||
*
|
||||
|
@ -524,4 +465,62 @@ class Scaffold extends Object {
|
|||
return $associations;
|
||||
}
|
||||
}
|
||||
?>
|
||||
/**
|
||||
* Scaffold View.
|
||||
*
|
||||
* @package cake
|
||||
* @subpackage cake.cake.libs.controller
|
||||
*/
|
||||
if (!class_exists('ThemeView')) {
|
||||
App::import('View', 'Theme');
|
||||
}
|
||||
class ScaffoldView extends ThemeView {
|
||||
/**
|
||||
* Override _getViewFileName
|
||||
*
|
||||
* @return string action
|
||||
* @access protected
|
||||
*/
|
||||
function _getViewFileName($name = null) {
|
||||
if ($name === null) {
|
||||
$name = $this->action;
|
||||
}
|
||||
$name = Inflector::underscore($name);
|
||||
$scaffoldAction = 'scaffold.'.$name;
|
||||
|
||||
if (!is_null($this->webservices)) {
|
||||
$subDir = strtolower($this->webservices) . DS;
|
||||
} else {
|
||||
$subDir = null;
|
||||
}
|
||||
if (!is_null($this->subDir)) {
|
||||
$subDir = strtolower($this->subDir) . DS;
|
||||
} else {
|
||||
$subDir = null;
|
||||
}
|
||||
|
||||
if ($name === 'add') {
|
||||
$name = 'edit';
|
||||
}
|
||||
|
||||
$names[] = $this->viewPath . DS . $subDir . $scaffoldAction;
|
||||
$names[] = 'scaffolds' . DS . $subDir . $name;
|
||||
|
||||
$paths = $this->_paths($this->plugin);
|
||||
|
||||
foreach ($paths as $path) {
|
||||
foreach ($names as $name) {
|
||||
if (file_exists($path . $name . $this->ext)) {
|
||||
return $path . $name . $this->ext;
|
||||
} elseif (file_exists($path . $name . '.ctp')) {
|
||||
return $path . $name . '.thtml';
|
||||
} elseif (file_exists($path . $name . '.thtml')) {
|
||||
return $path . $name . '.thtml';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $this->_missingView($paths[0] . $name . $this->ext, 'missingView');
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -64,6 +64,7 @@ class ThemeView extends View {
|
|||
if (is_dir(WWW_ROOT . 'themed' . DS . $this->theme)) {
|
||||
$this->themeWeb = 'themed/'. $this->theme .'/';
|
||||
}
|
||||
/* deprecated: as of 6128 the following properties are no longer needed */
|
||||
$this->themeElement = 'themed'. DS . $this->theme . DS .'elements'. DS;
|
||||
$this->themeLayout = 'themed'. DS . $this->theme . DS .'layouts'. DS;
|
||||
$this->themePath = 'themed'. DS . $this->theme . DS;
|
||||
|
@ -71,201 +72,28 @@ class ThemeView extends View {
|
|||
}
|
||||
|
||||
/**
|
||||
* Enter description here...
|
||||
* Return all possible paths to find view files in order
|
||||
*
|
||||
* @param unknown_type $code
|
||||
* @param unknown_type $name
|
||||
* @param unknown_type $message
|
||||
* @param string $plugin
|
||||
* @return array paths
|
||||
* @access private
|
||||
*/
|
||||
function error($code, $name, $message) {
|
||||
$file = VIEWS . $this->themeLayout.'error'.$this->ext;
|
||||
if (!file_exists($file)) {
|
||||
$file = LAYOUTS.'error'.$this->ext;
|
||||
}
|
||||
header ("HTTP/1.0 {$code} {$name}");
|
||||
print ($this->_render($file, array('code' => $code,
|
||||
'name' => $name,
|
||||
'message' => $message)));
|
||||
}
|
||||
/**
|
||||
* Renders a piece of PHP with provided parameters and returns HTML, XML, or any other string.
|
||||
*
|
||||
* This realizes the concept of Elements, (or "partial layouts")
|
||||
* and the $params array is used to send data to be used in the
|
||||
* Element.
|
||||
*
|
||||
* @link
|
||||
* @param string $name Name of template file in the/app/views/elements/ folder
|
||||
* @param array $params Array of data to be made available to the for rendered view (i.e. the Element)
|
||||
* @return string Rendered output
|
||||
*/
|
||||
function renderElement($name, $params = array(), $loadHelpers = false) {
|
||||
function _paths($plugin = null, $cached = true) {
|
||||
$paths = parent::_paths($plugin, $cached);
|
||||
|
||||
if (isset($params['plugin'])) {
|
||||
$reset = array('plugin' => $this->plugin,
|
||||
'pluginPath' => $this->pluginPath,
|
||||
'pluginPaths' => $this->pluginPaths);
|
||||
$this->plugin = $params['plugin'];
|
||||
$this->pluginPath = 'plugins' . DS . $this->plugin . DS;
|
||||
$this->pluginPaths = array(
|
||||
VIEWS . $this->pluginPath,
|
||||
APP . $this->pluginPath . 'views' . DS,
|
||||
);
|
||||
}
|
||||
|
||||
$paths = Configure::getInstance();
|
||||
$viewPaths = array_merge($this->pluginPaths, $paths->viewPaths);
|
||||
|
||||
$file = null;
|
||||
foreach ($viewPaths as $path) {
|
||||
if (file_exists($path . $this->themeElement . $name . $this->ext)) {
|
||||
$file = $path . $this->themeElement . $name . $this->ext;
|
||||
break;
|
||||
} elseif (file_exists($path . $this->themeElement . $name . '.thtml')) {
|
||||
$file = $path . $this->themeElement . $name . '.thtml';
|
||||
break;
|
||||
} elseif (file_exists($path . 'elements' . DS . $name . $this->ext)) {
|
||||
$file = $path . 'elements' . DS . $name . $this->ext;
|
||||
break;
|
||||
} elseif (file_exists($path . 'elements' . DS . $name . '.thtml')) {
|
||||
$file = $path . 'elements' . DS . $name . '.thtml';
|
||||
break;
|
||||
if (!empty($this->theme)) {
|
||||
$count = count($paths);
|
||||
for ($i = 0; $i < $count; $i++) {
|
||||
$themePaths[] = $paths[$i] . 'themed'. DS . $this->theme . DS;
|
||||
}
|
||||
$paths = array_merge($themePaths, $paths);
|
||||
}
|
||||
|
||||
if (is_null($file)) {
|
||||
$file = fileExistsInPath(LIBS . 'view' . DS . 'templates' . DS . 'elements' . DS . $name. '.ctp');
|
||||
if(empty($this->__paths)) {
|
||||
$this->__paths = $paths;
|
||||
}
|
||||
|
||||
if ($file) {
|
||||
$params = array_merge_recursive($params, $this->loaded);
|
||||
$return = $this->_render($file, array_merge($this->viewVars, $params), $loadHelpers);
|
||||
} else {
|
||||
if (!is_null($this->pluginPath)) {
|
||||
$file = APP . $this->pluginPath . $this->themeElement . $name . $this->ext;
|
||||
} else {
|
||||
$file = VIEWS . $this->themeElement . $name . $this->ext;
|
||||
}
|
||||
|
||||
if (Configure::read() > 0) {
|
||||
$return = 'Not Found: ' . $file;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($params['plugin'])) {
|
||||
$this->plugin = $reset['plugin'];
|
||||
$this->pluginPath = $reset['pluginPath'];
|
||||
$this->pluginPaths = $reset['pluginPaths'];
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enter description here...
|
||||
*
|
||||
* @param unknown_type $action
|
||||
* @return unknown
|
||||
*/
|
||||
function _getViewFileName($action) {
|
||||
$action = Inflector::underscore($action);
|
||||
|
||||
if (!is_null($this->webservices)) {
|
||||
$type = strtolower($this->webservices) . DS;
|
||||
} else {
|
||||
$type = null;
|
||||
}
|
||||
|
||||
$position = strpos($action, '..');
|
||||
if ($position !== false) {
|
||||
$action = explode('/', $action);
|
||||
$i = array_search('..', $action);
|
||||
unset($action[$i - 1]);
|
||||
unset($action[$i]);
|
||||
$action = '..' . DS . implode(DS, $action);
|
||||
}
|
||||
|
||||
$paths = Configure::getInstance();
|
||||
$viewPaths = array_merge($this->pluginPaths, $paths->viewPaths);
|
||||
|
||||
$name = $this->viewPath . DS . $this->subDir . $type . $action;
|
||||
foreach ($viewPaths as $path) {
|
||||
if (file_exists($path . $this->themePath . $name . $this->ext)) {
|
||||
return $path . $this->themePath . $name . $this->ext;
|
||||
} elseif (file_exists($path . $this->themePath . $name . '.thtml')) {
|
||||
return $path . $this->themePath . $name . '.thtml';
|
||||
} elseif (file_exists($path . $name . $this->ext)) {
|
||||
return $path . $name . $this->ext;
|
||||
} elseif (file_exists($path . $name . '.thtml')) {
|
||||
return $path . $name . '.thtml';
|
||||
}
|
||||
}
|
||||
|
||||
if ($viewFileName = fileExistsInPath(LIBS . 'view' . DS . 'templates' . DS . 'errors' . DS . $type . $action . '.ctp')) {
|
||||
return $viewFileName;
|
||||
} elseif ($viewFileName = fileExistsInPath(LIBS . 'view' . DS . 'templates' . DS . $this->viewPath . DS . $type . $action . '.ctp')) {
|
||||
return $viewFileName;
|
||||
} else {
|
||||
if (!is_null($this->pluginPath)) {
|
||||
$viewFileName = APP . $this->pluginPath . $this->themePath . $name . $this->ext;
|
||||
} else {
|
||||
$viewFileName = VIEWS . $this->themePath . $name . $this->ext;
|
||||
}
|
||||
$this->_missingView($viewFileName, $action);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enter description here...
|
||||
*
|
||||
* @return unknown
|
||||
*/
|
||||
function _getLayoutFileName() {
|
||||
if (isset($this->webservices) && !is_null($this->webservices)) {
|
||||
$type = strtolower($this->webservices) . DS;
|
||||
} else {
|
||||
$type = null;
|
||||
}
|
||||
|
||||
if (!is_null($this->layoutPath)) {
|
||||
$type = $this->layoutPath . DS;
|
||||
}
|
||||
|
||||
$paths = Configure::getInstance();
|
||||
$viewPaths = array_merge($this->pluginPaths, $paths->viewPaths);
|
||||
|
||||
$name = $this->subDir . $type . $this->layout;
|
||||
foreach ($viewPaths as $path) {
|
||||
if (file_exists($path . $this->themeLayout . $name . $this->ext)) {
|
||||
return $path . $this->themeLayout . $name . $this->ext;
|
||||
} elseif (file_exists($path . $this->themeLayout . $name . '.thtml')) {
|
||||
return $path . $this->themeLayout . $name . '.thtml';
|
||||
} elseif (file_exists($path . 'layouts' . DS . $name . $this->ext)) {
|
||||
return $path . 'layouts' . DS . $name . $this->ext;
|
||||
} elseif (file_exists($path . 'layouts' . DS . $name . '.thtml')) {
|
||||
return $path . 'layouts' . DS . $name . '.thtml';
|
||||
}
|
||||
}
|
||||
|
||||
if (!is_null($this->pluginPath)) {
|
||||
$layoutFileName = APP . $this->pluginPath . 'views' . DS . $this->themeLayout . $name . $this->ext;
|
||||
} else {
|
||||
$layoutFileName = VIEWS . $this->themeLayout . $name . $this->ext;
|
||||
}
|
||||
|
||||
$default = fileExistsInPath(LIBS . 'view' . DS . 'templates' . DS . 'layouts' . DS . $type . $this->layout . '.ctp');
|
||||
if (empty($default) && !empty($type)) {
|
||||
$default = fileExistsInPath(LIBS . 'view' . DS . 'templates' . DS . 'layouts' . DS . $type . 'default.ctp');
|
||||
}
|
||||
if (empty($default)) {
|
||||
$default = fileExistsInPath(LIBS . 'view' . DS . 'templates' . DS . 'layouts' . DS . $this->layout . '.ctp');
|
||||
}
|
||||
|
||||
if (!empty($default)) {
|
||||
return $default;
|
||||
}
|
||||
return $layoutFileName;
|
||||
return $paths;
|
||||
}
|
||||
}
|
||||
?>
|
File diff suppressed because it is too large
Load diff
|
@ -44,6 +44,24 @@ class ConfigureTest extends UnitTestCase {
|
|||
$this->assertTrue(in_array('Xml', $result));
|
||||
$this->assertTrue(in_array('Cache', $result));
|
||||
$this->assertTrue(in_array('HttpSocket', $result));
|
||||
|
||||
$result = $this->Configure->listObjects('model');
|
||||
$this->assertTrue(in_array('Model', $result));
|
||||
|
||||
$result = $this->Configure->listObjects('behavior');
|
||||
$this->assertTrue(in_array('Tree', $result));
|
||||
|
||||
$result = $this->Configure->listObjects('controller');
|
||||
$this->assertTrue(in_array('Pages', $result));
|
||||
|
||||
$result = $this->Configure->listObjects('component');
|
||||
$this->assertTrue(in_array('Auth', $result));
|
||||
|
||||
$result = $this->Configure->listObjects('view');
|
||||
$this->assertTrue(in_array('Media', $result));
|
||||
|
||||
$result = $this->Configure->listObjects('helper');
|
||||
$this->assertTrue(in_array('Html', $result));
|
||||
}
|
||||
|
||||
function tearDown() {
|
||||
|
|
|
@ -27,6 +27,23 @@
|
|||
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
|
||||
*/
|
||||
uses('controller' . DS . 'scaffold');
|
||||
class ScaffoldMockController extends Controller {
|
||||
|
||||
var $name = 'ScaffoldMock';
|
||||
|
||||
var $scaffold;
|
||||
}
|
||||
class ScaffoldMock extends CakeTestModel {
|
||||
|
||||
var $useTable = 'posts';
|
||||
|
||||
}
|
||||
class TestScaffoldView extends ScaffoldView {
|
||||
|
||||
function testGetFilename($action) {
|
||||
return $this->_getViewFileName($action);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Short description for class.
|
||||
*
|
||||
|
@ -35,8 +52,21 @@ uses('controller' . DS . 'scaffold');
|
|||
*/
|
||||
class ScaffoldTest extends CakeTestCase {
|
||||
|
||||
function skip() {
|
||||
$this->skipif (true, 'ScaffoldTest not implemented');
|
||||
var $fixtures = array('core.post');
|
||||
|
||||
function setUp() {
|
||||
$this->Controller = new ScaffoldMockController();
|
||||
}
|
||||
|
||||
function tearDown() {
|
||||
unset($this->Controller);
|
||||
}
|
||||
function testGetViewFilename() {
|
||||
$this->Controller->action = 'index';
|
||||
$ScaffoldView =& new TestScaffoldView($this->Controller);
|
||||
$result = $ScaffoldView->testGetFilename('index');
|
||||
$expected = TEST_CAKE_CORE_INCLUDE_PATH . 'libs' . DS . 'view' . DS . 'scaffolds' . DS . 'index.ctp';
|
||||
$this->assertEqual($result, $expected);
|
||||
}
|
||||
}
|
||||
?>
|
165
cake/tests/cases/libs/view/theme.test.php
Normal file
165
cake/tests/cases/libs/view/theme.test.php
Normal file
|
@ -0,0 +1,165 @@
|
|||
<?php
|
||||
/* SVN FILE: $Id$ */
|
||||
/**
|
||||
* Short description for file.
|
||||
*
|
||||
* Long description for file
|
||||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||
* Copyright 2005-2007, Cake Software Foundation, Inc.
|
||||
* 1785 E. Sahara Avenue, Suite 490-204
|
||||
* Las Vegas, Nevada 89104
|
||||
*
|
||||
* Licensed under The Open Group Test Suite License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @filesource
|
||||
* @copyright Copyright 2005-2007, Cake Software Foundation, Inc.
|
||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||
* @package cake.tests
|
||||
* @subpackage cake.tests.cases.libs
|
||||
* @since CakePHP(tm) v 1.2.0.4206
|
||||
* @version $Revision$
|
||||
* @modifiedby $LastChangedBy$
|
||||
* @lastmodified $Date$
|
||||
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
|
||||
*/
|
||||
uses('controller' . DS . 'controller', 'view'.DS.'theme');
|
||||
|
||||
class PostsController extends Controller {
|
||||
var $name = 'Posts';
|
||||
function index() {
|
||||
$this->set('testData', 'Some test data');
|
||||
$test2 = 'more data';
|
||||
$test3 = 'even more data';
|
||||
$this->set(compact('test2', 'test3'));
|
||||
}
|
||||
}
|
||||
|
||||
class TestView extends ThemeView {
|
||||
|
||||
function renderElement($name, $params = array()) {
|
||||
return $name;
|
||||
}
|
||||
|
||||
function getViewFileName($name = null) {
|
||||
return $this->_getViewFileName($name);
|
||||
}
|
||||
function getLayoutFileName($name = null) {
|
||||
return $this->_getLayoutFileName($name);
|
||||
}
|
||||
|
||||
function cakeError($name, $params) {
|
||||
return $name;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Short description for class.
|
||||
*
|
||||
* @package cake.tests
|
||||
* @subpackage cake.tests.cases.libs
|
||||
*/
|
||||
class ViewTest extends UnitTestCase {
|
||||
|
||||
function setUp() {
|
||||
Router::reload();
|
||||
$this->Controller = new Controller();
|
||||
$this->PostsController = new PostsController();
|
||||
$this->PostsController->index();
|
||||
$this->ThemeView = new View($this->PostsController);
|
||||
}
|
||||
|
||||
function testPluginGetTemplate() {
|
||||
$this->Controller->plugin = 'test_plugin';
|
||||
$this->Controller->name = 'TestPlugin';
|
||||
$this->Controller->viewPath = 'test_plugin';
|
||||
$this->Controller->action = 'index';
|
||||
$this->Controller->theme = 'test_plugin_theme';
|
||||
|
||||
$ThemeView = new TestView($this->Controller);
|
||||
Configure::write('pluginPaths', array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS));
|
||||
Configure::write('viewPaths', array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views'. DS));
|
||||
|
||||
$expected = TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS .'test_plugin' . DS . 'views' . DS . 'themed' . DS . 'test_plugin_theme' . DS .'test_plugin' . DS .'index.ctp';
|
||||
$result = $ThemeView->getViewFileName('index');
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
$expected = TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS .'test_plugin' . DS . 'views' . DS . 'themed' . DS . 'test_plugin_theme' . DS . 'layouts' . DS .'default.ctp';
|
||||
$result = $ThemeView->getLayoutFileName();
|
||||
$this->assertEqual($result, $expected);
|
||||
}
|
||||
|
||||
function testGetTemplate() {
|
||||
$this->Controller->plugin = null;
|
||||
$this->Controller->name = 'Pages';
|
||||
$this->Controller->viewPath = 'pages';
|
||||
$this->Controller->action = 'display';
|
||||
$this->Controller->params['pass'] = array('home');
|
||||
|
||||
$ThemeView = new TestView($this->Controller);
|
||||
$ThemeView->theme = 'test_theme';
|
||||
|
||||
Configure::write('pluginPaths', array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS));
|
||||
Configure::write('viewPaths', array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views'. DS, TEST_CAKE_CORE_INCLUDE_PATH . 'libs' . DS . 'view' . DS));
|
||||
|
||||
$expected = TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views' . DS .'pages' . DS .'home.ctp';
|
||||
$result = $ThemeView->getViewFileName('home');
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
$expected = TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views' . DS . 'themed' . DS . 'test_theme' . DS . 'posts' . DS .'index.ctp';
|
||||
$result = $ThemeView->getViewFileName('/posts/index');
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
$expected = TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views' . DS . 'themed' . DS . 'test_theme' . DS . 'layouts' . DS .'default.ctp';
|
||||
$result = $ThemeView->getLayoutFileName();
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
$ThemeView->layoutPath = 'rss';
|
||||
$expected = TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views' . DS . 'layouts' . DS . 'rss' . DS . 'default.ctp';
|
||||
$result = $ThemeView->getLayoutFileName();
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
$ThemeView->layoutPath = 'email' . DS . 'html';
|
||||
$expected = TEST_CAKE_CORE_INCLUDE_PATH . 'libs' . DS . 'view' . DS . 'layouts' . DS . 'email' . DS . 'html' . DS . 'default.ctp';
|
||||
$result = $ThemeView->getLayoutFileName();
|
||||
$this->assertEqual($result, $expected);
|
||||
}
|
||||
|
||||
function testMissingView() {
|
||||
$this->Controller->plugin = null;
|
||||
$this->Controller->name = 'Pages';
|
||||
$this->Controller->viewPath = 'pages';
|
||||
$this->Controller->action = 'display';
|
||||
$this->Controller->params['pass'] = array('home');
|
||||
|
||||
$ThemeView = new TestView($this->Controller);
|
||||
|
||||
$expected = 'missingView';
|
||||
$result = $ThemeView->getViewFileName('does_not_exist');
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
}
|
||||
|
||||
function testMissingLayout() {
|
||||
$this->Controller->plugin = null;
|
||||
$this->Controller->name = 'Posts';
|
||||
$this->Controller->viewPath = 'posts';
|
||||
$this->Controller->layout = 'whatever';
|
||||
|
||||
$ThemeView = new TestView($this->Controller);
|
||||
$expected = 'missingLayout';
|
||||
$result = $ThemeView->getLayoutFileName();
|
||||
$this->assertEqual($result, $expected);
|
||||
}
|
||||
|
||||
function tearDown() {
|
||||
unset($this->ThemeView);
|
||||
unset($this->PostsController);
|
||||
unset($this->Controller);
|
||||
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -43,6 +43,17 @@ class TestView extends View {
|
|||
function renderElement($name, $params = array()) {
|
||||
return $name;
|
||||
}
|
||||
|
||||
function getViewFileName($name = null) {
|
||||
return $this->_getViewFileName($name);
|
||||
}
|
||||
function getLayoutFileName($name = null) {
|
||||
return $this->_getLayoutFileName($name);
|
||||
}
|
||||
|
||||
function cakeError($name, $params) {
|
||||
return $name;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -55,31 +66,113 @@ class ViewTest extends UnitTestCase {
|
|||
|
||||
function setUp() {
|
||||
Router::reload();
|
||||
$this->Controller = new Controller();
|
||||
$this->PostsController = new PostsController();
|
||||
$this->PostsController->index();
|
||||
$this->view = new View($this->PostsController);
|
||||
$this->View = new View($this->PostsController);
|
||||
}
|
||||
|
||||
function testPluginGetTemplate() {
|
||||
$this->Controller->plugin = 'test_plugin';
|
||||
$this->Controller->name = 'TestPlugin';
|
||||
$this->Controller->viewPath = 'test_plugin';
|
||||
$this->Controller->action = 'index';
|
||||
|
||||
$View = new TestView($this->Controller);
|
||||
Configure::write('pluginPaths', array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS));
|
||||
Configure::write('viewPaths', array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views'. DS));
|
||||
|
||||
$expected = TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS .'test_plugin' . DS . 'views' . DS .'test_plugin' . DS .'index.ctp';
|
||||
$result = $View->getViewFileName('index');
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
$expected = TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS .'test_plugin' . DS . 'views' . DS . 'layouts' . DS .'default.ctp';
|
||||
$result = $View->getLayoutFileName();
|
||||
$this->assertEqual($result, $expected);
|
||||
}
|
||||
|
||||
function testGetTemplate() {
|
||||
$this->Controller->plugin = null;
|
||||
$this->Controller->name = 'Pages';
|
||||
$this->Controller->viewPath = 'pages';
|
||||
$this->Controller->action = 'display';
|
||||
$this->Controller->params['pass'] = array('home');
|
||||
|
||||
$View = new TestView($this->Controller);
|
||||
Configure::write('pluginPaths', array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS));
|
||||
Configure::write('viewPaths', array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views'. DS, TEST_CAKE_CORE_INCLUDE_PATH . 'libs' . DS . 'view' . DS));
|
||||
|
||||
$expected = TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views' . DS .'pages' . DS .'home.ctp';
|
||||
$result = $View->getViewFileName('home');
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
$expected = TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views' . DS .'posts' . DS .'index.ctp';
|
||||
$result = $View->getViewFileName('/posts/index');
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
|
||||
$expected = TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views' . DS . 'layouts' . DS .'default.ctp';
|
||||
$result = $View->getLayoutFileName();
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
$View->layoutPath = 'rss';
|
||||
$expected = TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views' . DS . 'layouts' . DS . 'rss' . DS . 'default.ctp';
|
||||
$result = $View->getLayoutFileName();
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
$View->layoutPath = 'email' . DS . 'html';
|
||||
$expected = TEST_CAKE_CORE_INCLUDE_PATH . 'libs' . DS . 'view' . DS . 'layouts' . DS . 'email' . DS . 'html' . DS . 'default.ctp';
|
||||
$result = $View->getLayoutFileName();
|
||||
$this->assertEqual($result, $expected);
|
||||
}
|
||||
|
||||
function testMissingView() {
|
||||
$this->Controller->plugin = null;
|
||||
$this->Controller->name = 'Pages';
|
||||
$this->Controller->viewPath = 'pages';
|
||||
$this->Controller->action = 'display';
|
||||
$this->Controller->params['pass'] = array('home');
|
||||
|
||||
$View = new TestView($this->Controller);
|
||||
|
||||
$expected = 'missingView';
|
||||
$result = $View->getViewFileName('does_not_exist');
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
}
|
||||
|
||||
function testMissingLayout() {
|
||||
$this->Controller->plugin = null;
|
||||
$this->Controller->name = 'Posts';
|
||||
$this->Controller->viewPath = 'posts';
|
||||
$this->Controller->layout = 'whatever';
|
||||
|
||||
$View = new TestView($this->Controller);
|
||||
$expected = 'missingLayout';
|
||||
$result = $View->getLayoutFileName();
|
||||
$this->assertEqual($result, $expected);
|
||||
}
|
||||
|
||||
function testViewVars() {
|
||||
$this->assertEqual($this->view->viewVars, array('testData' => 'Some test data', 'test2' => 'more data', 'test3' => 'even more data'));
|
||||
$this->assertEqual($this->View->viewVars, array('testData' => 'Some test data', 'test2' => 'more data', 'test3' => 'even more data'));
|
||||
}
|
||||
|
||||
function testUUIDGeneration() {
|
||||
$result = $this->view->uuid('form', array('controller' => 'posts', 'action' => 'index'));
|
||||
$result = $this->View->uuid('form', array('controller' => 'posts', 'action' => 'index'));
|
||||
$this->assertEqual($result, 'form0425fe3bad');
|
||||
$result = $this->view->uuid('form', array('controller' => 'posts', 'action' => 'index'));
|
||||
$result = $this->View->uuid('form', array('controller' => 'posts', 'action' => 'index'));
|
||||
$this->assertEqual($result, 'forma9918342a7');
|
||||
$result = $this->view->uuid('form', array('controller' => 'posts', 'action' => 'index'));
|
||||
$result = $this->View->uuid('form', array('controller' => 'posts', 'action' => 'index'));
|
||||
$this->assertEqual($result, 'form3ecf2e3e96');
|
||||
}
|
||||
|
||||
function testAddInlineScripts() {
|
||||
$this->view->addScript('prototype.js');
|
||||
$this->view->addScript('prototype.js');
|
||||
$this->assertEqual($this->view->__scripts, array('prototype.js'));
|
||||
$this->View->addScript('prototype.js');
|
||||
$this->View->addScript('prototype.js');
|
||||
$this->assertEqual($this->View->__scripts, array('prototype.js'));
|
||||
|
||||
$this->view->addScript('mainEvent', 'Event.observe(window, "load", function() { doSomething(); }, true);');
|
||||
$this->assertEqual($this->view->__scripts, array('prototype.js', 'mainEvent' => 'Event.observe(window, "load", function() { doSomething(); }, true);'));
|
||||
$this->View->addScript('mainEvent', 'Event.observe(window, "load", function() { doSomething(); }, true);');
|
||||
$this->assertEqual($this->View->__scripts, array('prototype.js', 'mainEvent' => 'Event.observe(window, "load", function() { doSomething(); }, true);'));
|
||||
}
|
||||
|
||||
function testElementCache() {
|
||||
|
@ -124,8 +217,10 @@ class ViewTest extends UnitTestCase {
|
|||
}
|
||||
|
||||
function tearDown() {
|
||||
unset($this->view);
|
||||
unset($this->View);
|
||||
unset($this->PostsController);
|
||||
unset($this->Controller);
|
||||
|
||||
}
|
||||
}
|
||||
?>
|
45
cake/tests/groups/view.group.php
Normal file
45
cake/tests/groups/view.group.php
Normal file
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
/* SVN FILE: $Id$ */
|
||||
/**
|
||||
* Short description for file.
|
||||
*
|
||||
* Long description for file
|
||||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||
* Copyright 2005-2007, Cake Software Foundation, Inc.
|
||||
* 1785 E. Sahara Avenue, Suite 490-204
|
||||
* Las Vegas, Nevada 89104
|
||||
*
|
||||
* Licensed under The Open Group Test Suite License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @filesource
|
||||
* @copyright Copyright 2005-2007, Cake Software Foundation, Inc.
|
||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||
* @package cake.tests
|
||||
* @subpackage cake.tests.groups
|
||||
* @since CakePHP(tm) v 1.2.0.4206
|
||||
* @version $Revision$
|
||||
* @modifiedby $LastChangedBy$
|
||||
* @lastmodified $Date$
|
||||
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
|
||||
*/
|
||||
/** AllCoreHelpersGroupTest
|
||||
*
|
||||
* This test group will run all test in the cases/libs/view/helpers directory.
|
||||
*
|
||||
* @package cake.tests
|
||||
* @subpackage cake.tests.groups
|
||||
*/
|
||||
class AllCoreViewsGroupTest extends GroupTest {
|
||||
|
||||
var $label = 'All core views';
|
||||
|
||||
function AllCoreViewsGroupTest() {
|
||||
TestManager::addTestFile($this, CORE_TEST_CASES . DS . 'libs' . DS . 'view' . DS . 'view',
|
||||
CORE_TEST_CASES . DS . 'libs' . DS . 'view' . DS . 'theme');
|
||||
}
|
||||
}
|
||||
?>
|
0
cake/tests/test_app/controllers/components/empty
Executable file
0
cake/tests/test_app/controllers/components/empty
Executable file
0
cake/tests/test_app/models/behaviors/empty
Executable file
0
cake/tests/test_app/models/behaviors/empty
Executable file
0
cake/tests/test_app/models/datasources/empty
Executable file
0
cake/tests/test_app/models/datasources/empty
Executable file
|
@ -0,0 +1 @@
|
|||
test plugin default layout
|
|
@ -0,0 +1 @@
|
|||
test plugin index
|
|
@ -0,0 +1 @@
|
|||
test_plugin test_plugin_theme default layout
|
|
@ -0,0 +1 @@
|
|||
test plugin index theme view
|
0
cake/tests/test_app/vendors/shells/tasks/empty
vendored
Executable file
0
cake/tests/test_app/vendors/shells/tasks/empty
vendored
Executable file
0
cake/tests/test_app/vendors/shells/templates/empty
vendored
Executable file
0
cake/tests/test_app/vendors/shells/templates/empty
vendored
Executable file
0
cake/tests/test_app/views/elements/empty
Executable file
0
cake/tests/test_app/views/elements/empty
Executable file
0
cake/tests/test_app/views/errors/empty
Executable file
0
cake/tests/test_app/views/errors/empty
Executable file
0
cake/tests/test_app/views/helpers/empty
Executable file
0
cake/tests/test_app/views/helpers/empty
Executable file
27
cake/tests/test_app/views/layouts/ajax.ctp
Executable file
27
cake/tests/test_app/views/layouts/ajax.ctp
Executable file
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
/* SVN FILE: $Id$ */
|
||||
/**
|
||||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) : Rapid Development Framework <http://www.cakephp.org/>
|
||||
* Copyright 2005-2007, Cake Software Foundation, Inc.
|
||||
* 1785 E. Sahara Avenue, Suite 490-204
|
||||
* Las Vegas, Nevada 89104
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @filesource
|
||||
* @copyright Copyright 2005-2007, Cake Software Foundation, Inc.
|
||||
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
|
||||
* @package cake
|
||||
* @subpackage cake.cake.libs.view.templates.layouts
|
||||
* @since CakePHP(tm) v 0.10.0.1076
|
||||
* @version $Revision$
|
||||
* @modifiedby $LastChangedBy$
|
||||
* @lastmodified $Date$
|
||||
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
||||
*/
|
||||
?>
|
||||
<?php echo $content_for_layout; ?>
|
68
cake/tests/test_app/views/layouts/default.ctp
Executable file
68
cake/tests/test_app/views/layouts/default.ctp
Executable file
|
@ -0,0 +1,68 @@
|
|||
<?php
|
||||
/* SVN FILE: $Id$ */
|
||||
/**
|
||||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) : Rapid Development Framework <http://www.cakephp.org/>
|
||||
* Copyright 2005-2007, Cake Software Foundation, Inc.
|
||||
* 1785 E. Sahara Avenue, Suite 490-204
|
||||
* Las Vegas, Nevada 89104
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @filesource
|
||||
* @copyright Copyright 2005-2007, Cake Software Foundation, Inc.
|
||||
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
|
||||
* @package cake
|
||||
* @subpackage cake.cake.libs.view.templates.pages
|
||||
* @since CakePHP(tm) v 0.10.0.1076
|
||||
* @version $Revision$
|
||||
* @modifiedby $LastChangedBy$
|
||||
* @lastmodified $Date$
|
||||
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
||||
*/
|
||||
?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>
|
||||
<?php __('CakePHP: the rapid development php framework:'); ?>
|
||||
<?php echo $title_for_layout;?>
|
||||
</title>
|
||||
|
||||
<?php echo $html->charset();?>
|
||||
|
||||
<link rel="icon" href="<?php echo $this->webroot;?>favicon.ico" type="image/x-icon" />
|
||||
<link rel="shortcut icon" href="<?php echo $this->webroot;?>favicon.ico" type="image/x-icon" />
|
||||
<?php echo $html->css('cake.generic');?>
|
||||
<?php echo $scripts_for_layout;?>
|
||||
</head>
|
||||
<body>
|
||||
<div id="container">
|
||||
<div id="header">
|
||||
<h1><?php echo $html->link(__('CakePHP: the rapid development php framework', true), 'http://cakephp.org');?></h1>
|
||||
</div>
|
||||
<div id="content">
|
||||
<?php
|
||||
if ($session->check('Message.flash')):
|
||||
$session->flash();
|
||||
endif;
|
||||
?>
|
||||
|
||||
<?php echo $content_for_layout;?>
|
||||
|
||||
</div>
|
||||
<div id="footer">
|
||||
<?php echo $html->link(
|
||||
$html->image('cake.power.gif', array('alt'=> __("CakePHP: the rapid development php framework", true), 'border'=>"0")),
|
||||
'http://www.cakephp.org/',
|
||||
array('target'=>'_new'), null, false
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo $cakeDebug?>
|
||||
</body>
|
||||
</html>
|
45
cake/tests/test_app/views/layouts/flash.ctp
Executable file
45
cake/tests/test_app/views/layouts/flash.ctp
Executable file
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
/* SVN FILE: $Id$ */
|
||||
/**
|
||||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) : Rapid Development Framework <http://www.cakephp.org/>
|
||||
* Copyright 2005-2007, Cake Software Foundation, Inc.
|
||||
* 1785 E. Sahara Avenue, Suite 490-204
|
||||
* Las Vegas, Nevada 89104
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @filesource
|
||||
* @copyright Copyright 2005-2007, Cake Software Foundation, Inc.
|
||||
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
|
||||
* @package cake
|
||||
* @subpackage cake.cake.libs.view.templates.layouts
|
||||
* @since CakePHP(tm) v 0.10.0.1076
|
||||
* @version $Revision$
|
||||
* @modifiedby $LastChangedBy$
|
||||
* @lastmodified $Date$
|
||||
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
||||
*/
|
||||
?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title><?php echo $page_title?></title>
|
||||
<?php echo $html->charset(); ?>
|
||||
|
||||
<?php if (Configure::read() == 0) { ?>
|
||||
<meta http-equiv="Refresh" content="<?php echo $pause?>;url=<?php echo $url?>"/>
|
||||
<?php } ?>
|
||||
<style><!--
|
||||
P { text-align:center; font:bold 1.1em sans-serif }
|
||||
A { color:#444; text-decoration:none }
|
||||
A:HOVER { text-decoration: underline; color:#44E }
|
||||
--></style>
|
||||
</head>
|
||||
<body>
|
||||
<p><a href="<?php echo $url?>"><?php echo $message?></a></p>
|
||||
</body>
|
||||
</html>
|
2
cake/tests/test_app/views/layouts/js/default.ctp
Executable file
2
cake/tests/test_app/views/layouts/js/default.ctp
Executable file
|
@ -0,0 +1,2 @@
|
|||
<?php echo $scripts_for_layout; ?>
|
||||
<script type="text/javascript"><?php echo $content_for_layout; ?></script>
|
17
cake/tests/test_app/views/layouts/rss/default.ctp
Executable file
17
cake/tests/test_app/views/layouts/rss/default.ctp
Executable file
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
echo $rss->header();
|
||||
|
||||
if (!isset($channel)) {
|
||||
$channel = array();
|
||||
}
|
||||
if (!isset($channel['title'])) {
|
||||
$channel['title'] = $title_for_layout;
|
||||
}
|
||||
|
||||
echo $rss->document(
|
||||
$rss->channel(
|
||||
array(), $channel, $content_for_layout
|
||||
)
|
||||
);
|
||||
|
||||
?>
|
2
cake/tests/test_app/views/layouts/xml/default.ctp
Executable file
2
cake/tests/test_app/views/layouts/xml/default.ctp
Executable file
|
@ -0,0 +1,2 @@
|
|||
<?php e($xml->header()); ?>
|
||||
<?php echo $content_for_layout; ?>
|
0
cake/tests/test_app/views/pages/empty
Executable file
0
cake/tests/test_app/views/pages/empty
Executable file
80
cake/tests/test_app/views/pages/home.ctp
Normal file
80
cake/tests/test_app/views/pages/home.ctp
Normal file
|
@ -0,0 +1,80 @@
|
|||
<h2>Sweet, "Test App" got Baked by CakePHP!</h2>
|
||||
|
||||
<?php
|
||||
if(Configure::read() > 0):
|
||||
Debugger::checkSessionKey();
|
||||
endif;
|
||||
?>
|
||||
<p>
|
||||
<?php
|
||||
if (is_writable(TMP)):
|
||||
echo '<span class="notice success">';
|
||||
__('Your tmp directory is writable.');
|
||||
echo '</span>';
|
||||
else:
|
||||
echo '<span class="notice">';
|
||||
__('Your tmp directory is NOT writable.');
|
||||
echo '</span>';
|
||||
endif;
|
||||
?>
|
||||
</p>
|
||||
<p>
|
||||
<?php
|
||||
$settings = Cache::settings();
|
||||
if (!empty($settings)):
|
||||
echo '<span class="notice success">';
|
||||
echo sprintf(__('The %s is being used for caching. To change the config edit APP/config/core.php ', true), '<em>'. $settings['engine'] . 'Engine</em>');
|
||||
echo '</span>';
|
||||
else:
|
||||
echo '<span class="notice">';
|
||||
__('Your cache is NOT working. Please check the settings in APP/config/core.php');
|
||||
echo '</span>';
|
||||
endif;
|
||||
?>
|
||||
</p>
|
||||
<p>
|
||||
<?php
|
||||
$filePresent = null;
|
||||
if (file_exists(CONFIGS . 'database.php')):
|
||||
echo '<span class="notice success">';
|
||||
__('Your database configuration file is present.');
|
||||
$filePresent = true;
|
||||
echo '</span>';
|
||||
else:
|
||||
echo '<span class="notice">';
|
||||
__('Your database configuration file is NOT present.');
|
||||
echo '<br/>';
|
||||
__('Rename config/database.php.default to config/database.php');
|
||||
echo '</span>';
|
||||
endif;
|
||||
?>
|
||||
</p>
|
||||
<?php
|
||||
if (!empty($filePresent)):
|
||||
uses('model' . DS . 'connection_manager');
|
||||
$db = ConnectionManager::getInstance();
|
||||
$connected = $db->getDataSource('default');
|
||||
?>
|
||||
<p>
|
||||
<?php
|
||||
if ($connected->isConnected()):
|
||||
echo '<span class="notice success">';
|
||||
__('Cake is able to connect to the database.');
|
||||
echo '</span>';
|
||||
else:
|
||||
echo '<span class="notice">';
|
||||
__('Cake is NOT able to connect to the database.');
|
||||
echo '</span>';
|
||||
endif;
|
||||
?>
|
||||
</p>
|
||||
<?php endif;?>
|
||||
<h3><?php __('Editing this Page') ?></h3>
|
||||
<p>
|
||||
<?php
|
||||
echo sprintf(__('To change the content of this page, edit: %s
|
||||
To change its layout, edit: %s
|
||||
You can also add some CSS styles for your pages at: %s', true),
|
||||
APP . 'views' . DS . 'pages' . DS . 'home.ctp.<br />', APP . 'views' . DS . 'layouts' . DS . 'default.ctp.<br />', APP . 'webroot' . DS . 'css');
|
||||
?>
|
||||
</p>
|
1
cake/tests/test_app/views/posts/index.ctp
Normal file
1
cake/tests/test_app/views/posts/index.ctp
Normal file
|
@ -0,0 +1 @@
|
|||
posts index
|
0
cake/tests/test_app/views/scaffolds/empty
Executable file
0
cake/tests/test_app/views/scaffolds/empty
Executable file
|
@ -0,0 +1 @@
|
|||
default test_theme layout
|
|
@ -0,0 +1 @@
|
|||
posts index themed view
|
Loading…
Add table
Reference in a new issue