Changeset 3366 for trunk/system/views

Show
Ignore:
Timestamp:
08/27/2008 05:15:39 PM (3 months ago)
Author:
Shadowhand
Message:

API CHANGE! Major changes to error reporting, routing, and class naming!

Complete change of autoloading: classes are now loaded by changing underscores to slashes to create a path, eg: Controller_Admin_User would be found at classes/admin/user.php (See routing changes below for more information)

  • All classes (libraries, helpers, controllers, and models) are now stored under the classes/ directory
  • Controllers and models are now prefixed instead of suffixed (eg: Controller_Welcome instead of Welcome_Controller)
  • All classes can now become transparently extensible by adding a "Core" suffix (eg: User_Model_Core extends Model)
  • Archive module has had it's drivers updated with new paths, but other modules will need to be updated, and will be non-functional temporarily

Complete routing change: routes are now defined similar to Horde Routes (see http://dev.horde.org/routes/manual/nitty-gritty-route-setup.html ), see http://paste.isanonymo.us/Dmq6n6FYfHnFFhbFs0weS8KqfDgBiGkS for an example of new routes configuration. Official documentation to follow.

  • Default route in system/config/routes.php changed
  • URI class removed because all arguments are now named (eg: Router::$argumentsid? to fetch the :id arg)
  • Added Router::compile to compile the regex for given route (protected)
  • Added Router::keys to find the :keys from a URI string
  • Added Router::uri to generate a URI from a route name and values (not complete)

Other misc changes:

  • Errors and exceptions are now inline, rather than replacing the entire page. Having core.display_errors disabled has no effect (not complete)
  • Added application/i18n/en_US directory for application language files (eg: Validation errors)
  • UTF-8 environment check moved to bootstrap.php
Location:
trunk/system/views/kohana
Files:
1 added
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/system/views/kohana/error.php

    r3345 r3366  
    1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
    2 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> 
    3 <head> 
    4         <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> 
    5         <title><?php echo $error ?></title> 
    6         <base href="http://php.net/" /> 
    7         <style type="text/css"> 
    8         <?php include Kohana::find_file('views', 'kohana/error_style', FALSE, 'css') ?> 
    9         </style> 
    10 </head> 
    11 <body> 
    12         <div id="framework_error" style="width:42em;margin:20px auto;"> 
    13                 <h3><?php echo html::specialchars($error) ?></h3> 
    14                 <p><?php echo html::specialchars($description) ?></p> 
    15                 <?php if ( ! empty($line) AND ! empty($file)): ?> 
    16                         <p><?php echo Kohana::lang('core.error_file_line', $file, $line) ?></p> 
    17                 <?php endif ?> 
    18                 <p><code class="block"><?php echo $message ?></code></p> 
    19                 <?php if ( ! empty($trace)): ?> 
    20                         <h3><?php echo Kohana::lang('core.stack_trace') ?></h3> 
    21                         <?php echo $trace ?> 
    22                 <?php endif ?> 
    23                 <p class="stats"><?php echo Kohana::lang('core.stats_footer') ?></p> 
    24         </div> 
    25 </body> 
    26 </html> 
     1<pre class="kohana_error"><a href="#show_trace"><?php echo $code ?></a>: <code><?php echo $error ?></code> [ <strong><?php echo $file ?></strong>, line <strong><?php echo $line ?></strong> ]</pre> 
     2<?php if ( ! empty($trace)): ?> 
     3<div class="kohana_trace"> 
     4<?php if ( ! empty($source)): ?> 
     5<div class="source"><a href="#show_source">Source</a><pre><?php echo $source ?></pre></div> 
     6<?php endif ?> 
     7<pre class="trace"><?php echo implode("\n", $trace) ?></pre> 
     8</div> 
     9<?php endif ?> 
  • trunk/system/views/kohana/error_style.css

    r3345 r3366  
    1 div#framework_error { background:#fff; border:solid 1px #ccc; font-family:sans-serif; color:#111; font-size:14px; line-height:130%; } 
    2 div#framework_error h3 { color:#fff; font-size:16px; padding:8px 6px; margin:0 0 8px; background:#f15a00; text-align:center; } 
    3 div#framework_error a { color:#228; text-decoration:none; } 
    4 div#framework_error a:hover { text-decoration:underline; } 
    5 div#framework_error strong { color:#900; } 
    6 div#framework_error p { margin:0; padding:4px 6px 10px; } 
    7 div#framework_error tt, 
    8 div#framework_error pre, 
    9 div#framework_error code { font-family:monospace; padding:2px 4px; font-size:12px; color:#333; 
    10         white-space:pre-wrap; /* CSS 2.1 */ 
    11         white-space:-moz-pre-wrap; /* For Mozilla */ 
    12         word-wrap:break-word; /* For IE5.5+ */ 
    13 } 
    14 div#framework_error tt { font-style:italic; } 
    15 div#framework_error tt:before { content:">"; color:#aaa; } 
    16 div#framework_error code tt:before { content:""; } 
    17 div#framework_error pre, 
    18 div#framework_error code { background:#eaeee5; border:solid 0 #D6D8D1; border-width:0 1px 1px 0; } 
    19 div#framework_error .block { display:block; text-align:left; } 
    20 div#framework_error .stats { padding:4px; background: #eee; border-top:solid 1px #ccc; text-align:center; font-size:10px; color:#888; } 
    21 div#framework_error .backtrace { margin:0; padding:0 6px; list-style:none; line-height:12px; } 
     1pre.kohana_error, 
     2div.kohana_trace { width: 100%; padding: 1em; margin: 0; overflow: auto; background: #cff292; text-align: left; font-size: 100%; font-family: sans-serif; color: #000; } 
     3pre.kohana_error a, 
     4div.kohana_trace a { font-weight: bold; text-decoration: underline; color: #005; background: transparent; } 
     5pre.kohana_error { margin-top: 1em; } 
     6        pre.kohana_error code { font-size: 1em; font-family: monospace; padding: 0 0.5em; } 
     7        pre.kohana_error strong { font-weight: bold; } 
     8div.kohana_trace { display: none; border-top: dotted 1px #809953; } 
     9        div.kohana_trace div.source { margin-bottom: 1em; } 
     10                div.kohana_trace div.source a { display: block; } 
     11                div.kohana_trace div.source pre { display: none; padding: 1em; background: #fff; border: dotted 1px #809953; } 
     12                        div.kohana_trace div.source pre span { background: #ede33b; } 
     13        div.kohana_trace ul.trace { list-style: none; padding: 0; margin: 0; line-height: 120%; } 
     14                div.kohana_trace ul.trace li { display: list-item; font-family: monospace; } 
  • trunk/system/views/kohana/template.php

    r3292 r3366  
    1313        a { color: inherit; } 
    1414        code { font-size: 1.3em; } 
    15         ul { list-style: none; padding: 2em 0; } 
    16         ul li { display: inline; padding-right: 1em; text-transform: uppercase; } 
    17         ul li a { padding: 0.5em 1em; background: #69ad0f; border: 1px solid #569f09; color: #fff; text-decoration: none; } 
    18         ul li a:hover { background: #569f09; } 
     15/*      ul { list-style: none; padding: 2em 0; }*/ 
     16/*              ul li { display: inline; padding-right: 1em; text-transform: uppercase; }*/ 
     17/*                      ul li a { padding: 0.5em 1em; background: #69ad0f; border: 1px solid #569f09; color: #fff; text-decoration: none; }*/ 
     18/*                      ul li a:hover { background: #569f09; }*/ 
     19        form { margin: 0 0 1em; background: #eee; text-align: left; } 
     20                form fieldset { display: block; border: 0; padding: 1em; } 
     21                form fieldset.submit { text-align: right; } 
     22                        form fieldset.submit a { float: left; } 
     23                form label { display: block; margin: 0 0 0.6em; } 
     24                        form label span { display: block; font-size: 80%; padding: 0.1em 0; } 
     25                form ul.errors { list-style: outside square; padding: 1em 2em; } 
     26                form ul.errors li { display: list-item; text-transform: none; } 
    1927        .box { padding: 2em; background: #98cc2b; border: 1px solid #569f09; } 
    2028        .copyright { font-size: 0.9em; text-transform: uppercase; color: #557d10; }