Skip to content

Commit

Permalink
Model Helper
Browse files Browse the repository at this point in the history
  • Loading branch information
KrisJordan committed Dec 4, 2008
1 parent 2044b34 commit aad373c
Show file tree
Hide file tree
Showing 27 changed files with 622 additions and 133 deletions.
2 changes: 1 addition & 1 deletion TestRunner.php
Expand Up @@ -11,7 +11,7 @@ function __construct() {
$this->TestSuite('All Tests');
$this->addFile(dirname(__FILE__) . '/recess/test/lib/recess/lang/InflectorTest.class.php');
$this->addFile(dirname(__FILE__) . '/recess/test/lib/recess/lang/RecessObjectTest.class.php');
$this->addFile(dirname(__FILE__) . '/recess/test/lib/recess/framework/routing/RoutingNodeTest.class.php');
$this->addFile(dirname(__FILE__) . '/recess/test/lib/recess/framework/routing/RtNodeTest.class.php');
$this->addFile(dirname(__FILE__) . '/recess/test/lib/recess/sources/db/sql/SelectSqlBuilderTest.class.php');
$this->addFile(dirname(__FILE__) . '/recess/test/lib/recess/sources/db/pdo/PdoDataSetTest.class.php');
$this->addFile(dirname(__FILE__) . '/recess/test/lib/recess/sources/db/pdo/SqlitePdoDataSourceTest.class.php');
Expand Down
63 changes: 0 additions & 63 deletions apps/blog/controllers/PostsController.class.php

This file was deleted.

82 changes: 63 additions & 19 deletions blueprint.html
Expand Up @@ -14,10 +14,27 @@
window.onload = function() {
dp.SyntaxHighlighter.ClipboardSwf = '/content/flash/clipboard.swf';
dp.SyntaxHighlighter.HighlightAll('code');
}

addField = function() {
$("modelForm").append('<p>Hello</p>');

function addField() {
$("#modelForm .removeField:last").unbind('blur');
$("#rowTemplate").children().clone().appendTo("#modelForm");
$("#modelForm .removeField:last").click(function() { $(this).parent().parent().remove(); });
setFocus();
}

function setFocus() {
$("#modelForm .removeField:last").blur( addField );
$("#modelForm .fieldName:last").focus();
}

$(".addField").click( addField );

setFocus();

$("#modelForm .removeField:last").click(function() { $(this).parent().parent().remove(); });

$("#modelForm").children().clone().appendTo("#rowTemplate");

}
</script>
<script type="text/javascript" src="/content/js/jquery/jquery-1.2.6.js"></script>
Expand Down Expand Up @@ -56,24 +73,51 @@ <h3>Quick Links</h3>
</div>
<div class="span-16 last">
<h3>Package: <a href="">recess.lang</a></h3>
<form id="modelForm">
<div class="an-input"><label for="field[0]">Field:</label><input type="text" name="field[0]" id="field[0]" /></div>

<form class="modelForm">
<table>
<thead>
<tr>
<td>Property Name</td>
<td>Type</td>
<td>Nullable?</td>
<td>Default Value</td>
<td>Remove</td>
</tr>
</thead>
<tbody id="modelForm">
<tr>
<td><input type="text" name="field[]" class="fieldName" /></td>
<td><select name="type[]">
<option value="string">String</option>
<option value="text">Text</option>

<option value="integer">Integer</option>
<option value="decimal">Decimal</option>
<option value="float">Float</option>

<option value="time">Time</option>
<option value="timestamp">Timestamp</option>
<option value="date">Date</option>
<option value="datetime">Date/Time</option>

<option value="blob">Blob</option>
<option value="boolean">Boolean</option>
</select></td>
<td><input type="checkbox" name="nullable[]" value="1" /></td>
<td><input type="text" name="defaultValue[]" /></td>
<td><input class="removeField" type="button" value="X"></input></td>
</tr>
</tbody>
</table>
<input type="button" class="addField" value="Add Field" />
</form>
<a href="javascript:addField()">Add Field</a>



<table style="visibility:hidden;">
<tbody id="rowTemplate">
</tbody>
</table>

<h2>RecessObject <span class="quiet">extends <a href="">StdClass</a></span></h2>
<pre name="code" class="php">&lt;?php
class RecessObject extends StdClass {
public $array = array('john','jack');
function __construct() {
echo 'hello world!';
}
}
?&gt;
</pre>
</div>
</div>
<div class="span-5 last infobar">
Expand Down
2 changes: 1 addition & 1 deletion bootstrap.php
Expand Up @@ -18,5 +18,5 @@

Library::import('recess.framework.Coordinator');
Library::import('recess.http.Environment');
Coordinator::main(Environment::getRawRequest(), Config::$policy, Config::$applications, Config::getRouter(), Config::$plugins);
Coordinator::main(Environment::getRawRequest(), Config::$policy, Config::$applications, Config::getRoutes(), Config::$plugins);
?>
3 changes: 3 additions & 0 deletions phpinfo.php
@@ -0,0 +1,3 @@
<?php
phpinfo();
?>
18 changes: 8 additions & 10 deletions recess-config.php
Expand Up @@ -37,11 +37,7 @@
'Sqlite',
);

Config::$useTurboSpeed = true; // I wanna go FAST! (Note: Experimental feature.)

//Config::$plugins
// = array( 'recess.framework.plugins.ContentCaching'
// );
Config::$useTurboSpeed = false; // I wanna go FAST! (Note: Experimental feature.)

/* END OF BASIC CONFIGURATION SETTINGS */

Expand Down Expand Up @@ -123,17 +119,19 @@ static function init() {
self::$policy = new DefaultPolicy();
}

static function getRouter() {
Library::import('recess.framework.routing.RoutingNode');
const ROUTES_CACHE_KEY = 'Recess::Routes';

static function getRoutes() {
Library::import('recess.framework.routing.RtNode');
Library::import('recess.framework.routing.Route');

$router = Cache::get('router');
$router = Cache::get(self::ROUTES_CACHE_KEY);
if($router === false) {
$router = new RoutingNode();
$router = new RtNode();
foreach(self::$applications as $app) {
$app->addRoutesToRouter($router);
}
Cache::set('router', $router);
Cache::set(self::ROUTES_CACHE_KEY, $router);
}

return $router;
Expand Down
Expand Up @@ -162,9 +162,7 @@ private function getNewAppStep2Form($fillValues = array()) {
$form->fill($fillValues);
return $form;
}



/** !Route GET, $appClass */
public function app($appClass) {
$application = $this->getApplication($appClass);
Expand All @@ -175,12 +173,12 @@ public function app($appClass) {
$this->app = $application;
}

/** !Route GET, gen/model */
/** !Route GET, model/gen */
public function createModel() {

}

/** !Route GET, gen/controller */
/** !Route GET, controller/gen */
public function createController() {

}
Expand Down
2 changes: 1 addition & 1 deletion recess/lib/recess/apps/tools/views/apps/app.php
Expand Up @@ -50,7 +50,7 @@ function printClassesInNamespace($namespace, $codeController) {
<h2 class="bottom">Routes</h2>
<p class="bottom">Route Prefix: <?php echo $app->routingPrefix; ?></p>
<?php
$routes = new RoutingNode();
$routes = new RtNode();
$app->addRoutesToRouter($routes);
include_once($viewsDir . 'common/printRoutes.php');
printRoutes($routes, $codeController);
Expand Down

0 comments on commit aad373c

Please sign in to comment.