Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also .

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also .
  • 12 commits
  • 21 files changed
  • 0 commit comments
  • 1 contributor
View
3 Application/Admin/template/layout.phtml
@@ -28,6 +28,9 @@
<li><a href="/admin/image">images</a></li>
<li><a href="/admin/page">pages</a></li>
<li><a href="/admin/image">settings</a></li>
+ <?php $this->block('main-navigation') ?>
+ <!-- define additional top level navigation here -->
+ <?php $this->endblock('main-navigation') ?>
</ul>
</div>
</div>
View
24 Application/plugin/Builder/hook.php
@@ -0,0 +1,24 @@
+<?php
+/**
+ * Application/plugin/ItemThumbnail/hook.php
+ *
+ * @author Matthijs van Henten <matthijs@ischen.nl>
+ * @package default
+ */
+
+
+@list( , $controller, $action, $item_id ) = $request->pathParts;
+?>
+
+<?php
+if ( $start ) {
+ Nano_Autoloader::registerNamespace( 'Builder', dirname(__FILE__) . '/lib' );
+ $this->router->prepend( '/admin/builder(/\w+)?(/\d+)?', 'Builder_View' );
+}
+?>
+
+<?php if ( $end ): ?>
+ <?php $this->template->block( 'main-navigation' ); ?>
+ <li><a href="/admin/builder">builder</a></li>
+ <?php $this->template->endblock('main-navigation') ?>
+<?php endif; ?>
View
89 Application/plugin/Builder/lib/Abc.php
@@ -0,0 +1,89 @@
+<?php
+/**
+ * Application/plugin/Builder/lib/Abc.php
+ *
+ * @author Matthijs van Henten <matthijs@ischen.nl>
+ * @package Pico
+ */
+
+
+abstract class Builder_Abc {
+ private $_constructor_args;
+
+
+
+ /**
+ *
+ *
+ * @param unknown $args
+ */
+ public function __construct( array $args = array() ) {
+ $this->_constructor_args = $args; //func_get_args();
+ }
+
+
+
+ /**
+ *
+ *
+ * @return unknown
+ */
+ public function __toString() {
+ return $this->as_string();
+ }
+
+
+ /**
+ *
+ *
+ * @param unknown $name
+ * @return unknown
+ */
+ public function __get( $name ) {
+ if ( ($property = "_$name")
+ && (isset($this->$property) || property_exists( $this, $property ))) {
+ if ( ! isset( $this->$property )
+ && method_exists( $this, "_build_$property" ) ) {
+ $method = "_build_$property";
+ $this->$property = $this->$method();
+ }
+ return $this->$property;
+ }
+ }
+
+
+
+ /**
+ *
+ *
+ * @param unknown $name
+ * @return unknown
+ */
+ public function arg( $name ) {
+ if ( isset( $this->_constructor_args[$name] ) ) {
+ return $this->_constructor_args[$name];
+ }
+
+ return array();
+ }
+
+
+
+ /**
+ *
+ *
+ * @param unknown $args
+ * @return unknown
+ */
+ public function element( $args ) {
+ $args = array_merge( array( 'type' => 'div', 'attributes' => array() ), $args );
+
+ if( $args['type'] == 'block' ){
+ return new Builder_Block( $args );
+ }
+
+ return new Nano_Element( $args['type'], $args['attributes']);
+ }
+
+
+}
View
40 Application/plugin/Builder/lib/Block.php
@@ -0,0 +1,40 @@
+<?php
+/**
+ * Application/plugin/Builder/lib/Block.php
+ *
+ * @author Matthijs van Henten <matthijs@ischen.nl>
+ * @package Pico
+ */
+
+
+class Builder_Block extends Builder_Abc {
+
+ protected $_element;
+
+
+
+ /**
+ *
+ *
+ * @return unknown
+ */
+ public function as_string() {
+ return (string) $this->element;
+ }
+
+
+
+ /**
+ *
+ *
+ * @return unknown
+ */
+ protected function _build__element() {
+ $div = new Nano_Element( 'div' );
+ $div->setVertile();
+
+ return $div;
+ }
+
+
+}
View
93 Application/plugin/Builder/lib/Editor/Decorator/Block.php
@@ -0,0 +1,93 @@
+<?php
+/**
+ * Application/plugin/Builder/lib/Editor/Decorator/Block.php
+ *
+ * @author Matthijs van Henten <matthijs@ischen.nl>
+ * @package Pico
+ */
+
+
+class Builder_Editor_Decorator_Block extends Builder_Abc {
+ protected $_style;
+ protected $_content;
+ protected $_id_title;
+
+ /**
+ *
+ *
+ * @return unknown
+ */
+ public function as_string() {
+ $style = $this->style;
+ $content = $this->content;
+
+ ob_start();
+ /// totod use Nano_element here
+
+?>
+ <div class="element-block" style="<?php echo $style->width ?>">
+ <div class="margin" style="<?php echo $style->display_margin ?>">
+ </div>
+ <div class="inner">
+ <div class="handle">
+ <?php echo $this->id_title ?>
+ </div>
+ <div class="height-spacer" style="<?php echo $style->height ?>">
+ <div class="padder" style="<?php echo $style->padding ?>">
+ <div class="body">
+ <?php echo $this->content ?>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ <?php
+
+ return ob_get_clean();
+ }
+
+
+ /**
+ *
+ *
+ * @return unknown
+ */
+ protected function _build__id_title() {
+ return '#Element ' . $this->arg('id');
+ }
+
+
+ /**
+ *
+ *
+ * @return unknown
+ */
+ protected function _build__style() {
+ return new Builder_Editor_Style( $this->arg('style') );
+ }
+
+
+ /**
+ *
+ *
+ * @return unknown
+ */
+ protected function _build__content() {
+ $children = $this->arg('children');
+ error_log( '$children: ' . print_r($children, true ) );
+
+ $html = '';
+
+ foreach ( $children as $child ) {
+ $block = new Builder_Editor_Decorator_Block( $child );
+ $html .= $block;
+ }
+
+ error_log( 'child: ' . print_r($html, true ) );
+
+
+ return $html;
+ }
+
+
+}
View
124 Application/plugin/Builder/lib/Editor/Form/Block.php
@@ -0,0 +1,124 @@
+<?php
+/**
+ * Application/plugin/Builder/lib/Editor/Form/Block.php
+ *
+ * @author Matthijs van Henten <matthijs@ischen.nl>
+ * @package Pico
+ */
+
+
+class Builder_Editor_Form_Block extends Nano_Form{
+
+ /**
+ *
+ */
+ public function __construct() {
+ parent::__construct();
+
+ $form = $this->_get_fieldset(
+ array(
+ 'name' => 'block-editor',
+ 'label' => 'CSS block',
+ 'elements' => $this->_get_css_block_editor()
+ )
+ );
+
+ $this->addElement( 'css-block', $form );
+ }
+
+
+ /**
+ *
+ *
+ * @return unknown
+ */
+ private function _get_css_block_editor() {
+ $collect = array();
+
+ $spec = array(
+ 'width-height' => array('Width and height', array('width', 'height') ),
+ 'padding' => array('Padding', array('top', 'right', 'left', 'bottom' ), 'padding' ),
+ 'margin' => array('Margin', array('top', 'right', 'left', 'bottom' ), 'margin' ),
+ );
+
+ foreach ( $spec as $name => $element_spec ) {
+ @list( $title, $elements, $prefix ) = $element_spec;
+
+ $collect[$name] = $this->_get_fieldset(
+ array(
+ 'name' => $name,
+ 'label' => $title,
+ 'elements' => $this->_build_css_block_elements( $elements, $prefix )
+ )
+ );
+ }
+
+ return $collect;
+ }
+
+
+ /**
+ *
+ *
+ * @param array $part
+ * @return unknown
+ */
+ private function _get_fieldset( array $part ) {
+ $part = (object) $part;
+
+ $css_class = isset($part->class) ? $part->class : 'element-editor';
+
+ return array(
+ 'type' => 'fieldset',
+ 'class' => $css_class,
+ 'id' => 'editor-' . $part->name,
+ 'label' => $part->label,
+ 'elements' =>
+ $part->elements
+
+ );
+ }
+
+
+ /**
+ *
+ *
+ * @param array $elements
+ * @param unknown $prefix (optional)
+ * @return unknown
+ */
+ private function _build_css_block_elements( array $elements, $prefix=null ) {
+ $collect = array();
+
+ foreach ( $elements as $name ) {
+ $name = join( '-', array_filter( array($prefix, $name) ) );
+ $collect["$name"] = $this->_build_css_block_element( "$name" );
+ }
+
+ return $collect;
+ }
+
+
+ /**
+ *
+ *
+ * @param unknown $name
+ * @return unknown
+ */
+ private function _build_css_block_element( $name ) {
+ return array(
+ 'type' => 'text',
+ 'value' => '',
+ 'label' => $name,
+ 'validators' => array(
+ array( 'preg_match',
+ array('/^\d+(\.\d+)?(em|px|pt|\%)$/'),
+ array("$name must be a valid css value")
+ )
+ )
+ );
+ }
+
+
+
+}
View
87 Application/plugin/Builder/lib/Editor/Style.php
@@ -0,0 +1,87 @@
+<?php
+/**
+ * Application/plugin/Builder/lib/Editor/Style.php
+ *
+ * @author Matthijs van Henten <matthijs@ischen.nl>
+ * @package Pico
+ */
+
+
+class Builder_Editor_Style extends Builder_Abc {
+ protected $_display_margin;
+ protected $_padding;
+ protected $_width;
+ protected $_height;
+
+ /**
+ * Inline css for editor margin display
+ *
+ * @return unknown
+ */
+ protected function _build__display_margin() {
+ $styles = $this->arg('margin');
+ $css = '';
+
+ foreach ( $styles as $pos => $value ) {
+ $css .= "$pos: -$value;";
+ }
+
+ return $css;
+ }
+
+
+ /**
+ *
+ *
+ * @return unknown
+ */
+ protected function _build__padding() {
+ $styles = $this->arg('padding');
+ $css = '';
+
+ foreach ( $styles as $pos => $value ) {
+ $css .= "$pos: $value;";
+ }
+
+ error_log( 'padding: ' . $css );
+
+ return $css;
+ }
+
+
+ /**
+ *
+ *
+ * @return unknown
+ */
+ protected function _build__height() {
+ $width = $this->arg( 'height' );
+
+ if ( !$width ) {
+ return '';
+ }
+
+ return "height: $width;";
+
+ }
+
+
+ /**
+ *
+ *
+ * @return unknown
+ */
+ protected function _build__width() {
+ $width = $this->arg( 'width' );
+
+ if ( !$width ) {
+ $width = '2em';
+ }
+
+ return "width: $width;";
+ }
+
+
+
+
+}
View
80 Application/plugin/Builder/lib/Model/Block.php
@@ -0,0 +1,80 @@
+<?php
+/**
+ * lib/Model/Block.php
+ *
+ * @author Matthijs van Henten <matthijs@ischen.nl>
+ * @package Builder
+ */
+
+
+class Builder_Model_Block extends Builder_Schema_Block {
+
+ /**
+ * Call store with our primary id.
+ */
+ public function save() {
+ $this->store( array( 'id' => $this->id ) );
+ }
+
+
+ /**
+ * Return all children of this parent
+ *
+ * @param array $args (optional)
+ * @return unknown
+ */
+ public function children( array $args = array() ) {
+ return $this->has_many( 'Builder_Model_Block', array(
+ 'parent_id' => 'id',
+ ), $args );
+ }
+
+
+ /**
+ * Return the parent, if there is one.
+ *
+ * @param array $args (optional)
+ * @return unknown
+ */
+ public function parent( array $args = array() ) {
+ return $this->has_one( 'Builder_Model_Block', array(
+ 'id' => 'parent_id'
+ ), $args
+ );
+ }
+
+
+ /**
+ * Post-process the data field - unserialize json
+ *
+ * @return unknown
+ */
+ public function data() {
+ $data = $this->get('data');
+
+ if ( is_string( $data ) ) {
+ $this->__set( 'appendix', json_decode($data));
+ }
+
+ if ( empty($data) ) {
+ $this->__set( 'appendix', new StdClass() );
+ }
+
+ return $this->get('appendix');
+ }
+
+
+ /**
+ * Pre-process the data value before storing ( serialize );
+ *
+ * @param unknown $data
+ * @return unknown
+ */
+ public function _filter_data( $data ) {
+ if ( is_object( $data ) ) {
+ return json_encode($data);
+ }
+ }
+
+
+}
View
103 Application/plugin/Builder/lib/Page.php
@@ -0,0 +1,103 @@
+<?php
+/**
+ * Application/plugin/Builder/lib/Page.php
+ *
+ * @author Matthijs van Henten <matthijs@ischen.nl>
+ * @package Pico
+ */
+
+
+class Builder_Page extends Builder_Abc {
+ protected $_doctype = 'html';
+
+ protected $_html;
+ protected $_body;
+ protected $_head;
+
+
+ //$builder = new Builder_Page(array(
+ // 'head' => array(
+ // 'children' => array(
+ // 'type' => 'link',
+ // 'attibutes' => array(
+ // 'href' => 'style.css',
+ // 'rel' => 'stylesheet',
+ // )
+ // )
+ // ),
+ // 'children' => array(
+ // array(
+ // 'type' => 'block',
+ // )
+ // )
+ //));
+
+
+ /**
+ *
+ *
+ * @return unknown
+ */
+ public function as_string() {
+ $doctype = sprintf('<!DOCTYPE %s>', $this->doctype );
+
+ return join( "\n", array( $doctype, $this->html ) );
+ }
+
+
+
+ /**
+ *
+ *
+ * @return unknown
+ */
+ protected function _build__html() {
+ $html = new Nano_Element( 'html' );
+ $html->addChild( $this->head );
+ $html->addChild( $this->body );
+
+ return $html;
+ }
+
+
+
+ /**
+ *
+ *
+ * @return unknown
+ */
+ protected function _build__head() {
+ $head = new Nano_Element( 'head' );
+ $head->setVertile();
+
+ $this->_parse_arg( $this->arg('head'), $head );
+
+ return $head;
+ }
+
+
+
+ /**
+ *
+ *
+ * @return unknown
+ */
+ protected function _build__body() {
+ $body = new Nano_Element( 'body' );
+ $body->setVertile();
+
+ $this->_parse_arg( $this->arg('body'), $body );
+
+ return $body;
+ }
+
+ protected function _parse_arg( array $args=array(), Nano_Element $parent ){
+ if ( !empty( $args ) && isset( $args['children'] ) ) {
+ foreach ( $args['children'] as $child ) {
+ $parent->addChild( $this->element( $child )) ;
+ }
+ }
+ }
+
+
+}
View
73 Application/plugin/Builder/lib/Schema/Block.php
@@ -0,0 +1,73 @@
+<?php
+/**
+ * lib/Schema/Block.php
+ *
+ * @author Matthijs van Henten <matthijs@ischen.nl>
+ * @package Pico
+ */
+
+
+class Builder_Schema_Block extends Nano_Db_Schema {
+
+ protected $_tableName = 'builder_block';
+
+ protected $_schema = array(
+ 'id' => array(
+ 'type' => 'int',
+ 'length' => 10,
+ 'default' => '',
+ 'name' => 'id',
+ 'extra' => 'auto_increment',
+ 'required' => true,
+ ),
+
+ 'parent_id' => array(
+ 'type' => 'int',
+ 'length' => 10,
+ 'default' => '',
+ 'name' => 'parent_id',
+ 'extra' => '',
+ 'required' => true,
+ ),
+
+ 'type' => array(
+ 'type' => 'varchar',
+ 'length' => 64,
+ 'default' => '',
+ 'name' => 'type',
+ 'extra' => '',
+ 'required' => true,
+ ),
+
+ 'data' => array(
+ 'type' => 'longblob',
+ 'length' => 0,
+ 'default' => '',
+ 'name' => 'data',
+ 'extra' => '',
+ 'required' => true,
+ ),
+
+ 'updated' => array(
+ 'type' => 'timestamp',
+ 'length' => 0,
+ 'default' => '0000-00-00 00:00:00',
+ 'name' => 'updated',
+ 'extra' => 'on update CURRENT_TIMESTAMP',
+ 'required' => true,
+ ),
+
+ 'inserted' => array(
+ 'type' => 'timestamp',
+ 'length' => 0,
+ 'default' => '0000-00-00 00:00:00',
+ 'name' => 'inserted',
+ 'extra' => '',
+ 'required' => true,
+ )
+ );
+
+ protected $_primary_key = array(
+ 'id'
+ );
+}
View
37 Application/plugin/Builder/lib/View.php
@@ -0,0 +1,37 @@
+<?php
+class Builder_View extends Pico_View_Admin_Base {
+
+ public function __construct( $request, $config ){
+ parent::__construct( $request, $config );
+
+ $this->template()->templatePath = 'Application';
+ }
+
+
+ /**
+ *
+ *
+ * @param object $request
+ * @param unknown $config
+ */
+ public function get( Nano_App_Request $request, $config ) {
+ @list( , , , $action, $item_id ) = $request->pathParts;
+
+
+ return $this->template()->render('plugin/Builder/template/main');
+ }
+
+
+ /**
+ *
+ *
+ * @param object $request
+ * @param unknown $config
+ */
+ public function post( Nano_App_Request $request, $config ) {
+ @list( , , , $action, $item_id ) = $request->pathParts;
+
+ }
+
+
+}
View
11 Application/plugin/Builder/sql/builder_block.40.sql
@@ -0,0 +1,11 @@
+CREATE TABLE `builder_block` (
+ `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `parent_id` int(10) unsigned NOT NULL DEFAULT '0',
+ `type` varchar(64) NOT NULL,
+ `data` longblob NOT NULL,
+ `updated` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
+ `inserted` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
+ PRIMARY KEY (`id`),
+ KEY `parent` (`parent_id`),
+ KEY `typek` (`type`)
+) TYPE=InnoDB AUTO_INCREMENT=100;
View
14 Application/plugin/Builder/sql/builder_block.sql
@@ -0,0 +1,14 @@
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `builder_block` (
+ `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `parent_id` int(10) unsigned NOT NULL DEFAULT '0',
+ `type` varchar(64) NOT NULL,
+ `data` longblob NOT NULL,
+ `updated` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP,
+ `inserted` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
+ PRIMARY KEY (`id`),
+ KEY `parent` (`parent_id`),
+ KEY `typek` (`type`) USING BTREE
+) ENGINE=InnoDB AUTO_INCREMENT=100 DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
View
40 Application/plugin/Builder/t/Block.php
@@ -0,0 +1,40 @@
+<?php
+/**
+ * Application/plugin/Builder/t/Block.php
+ *
+ * @author Matthijs van Henten <matthijs@ischen.nl>
+ * @package Pico
+ */
+
+define( 'NANO_ROOT', dirname(__FILE__) . '../../../../../../');
+
+class Builder_PageTest extends PHPUnit_Framework_TestCase{
+ private $config;
+
+ /**
+ *
+ */
+ protected function setUp() {
+ require_once NANO_ROOT . 'Nano/library/Nano/Autoloader.php';
+ Nano_Autoloader::register();
+ Nano_Autoloader::registerNamespace( 'Builder', dirname(__FILE__) . '/../lib' );
+ }
+
+
+
+ /**
+ *
+ */
+ public function testStringify() {
+ $builder = new Builder_Block();
+
+ print $builder;
+
+ $expect = ' <div>
+ </div>';
+
+ $this->assertEquals($expect, (string) $builder );
+ }
+
+
+}
View
135 Application/plugin/Builder/t/Model/Block.php
@@ -0,0 +1,135 @@
+<?php
+/**
+ * t/Model/Block.php
+ *
+ * @author Matthijs van Henten <matthijs@ischen.nl>
+ * @package Pico
+ */
+
+
+require dirname(__FILE__) . '/../bootstrap.php';
+
+class Builder_Model_BlockTest extends PHPUnit_Framework_TestCase{
+
+ /**
+ * Create a simple, dumbed down version of the table used
+ * in sqlite sufficient for unit testing.
+ */
+ protected function setUp() {
+ Nano_Db::setAdapter( array( 'dsn' => 'sqlite::memory:' ) );
+
+ $dbh = Nano_Db::getAdapter();
+
+ $dbh->query('
+ CREATE TABLE "builder_block" (
+ "id" INTEGER PRIMARY KEY NOT NULL,
+ "parent_id" INTEGER NOT NULL DEFAULT 0,
+ "type" TEXT NOT NULL,
+ "data" TEXT NOT NULL,
+ "updated" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ "inserted" DATETIME NOT NULL DEFAULT "0000-00-00 00:00:00"
+ );
+ ') or die('could not create db');
+ }
+
+
+ /**
+ * Test insert
+ */
+ public function testCreate() {
+ $expected_data = (object) array( 'test' => 1 );
+
+ $model = new Builder_Model_Block(array(
+ 'type' => 'foo',
+ 'data' => $expected_data,
+ 'parent_id' => 0
+ ));
+
+ $stored = $model->store();
+ $this->assertType( 'Builder_Model_Block', $stored, 'Successfully stored object' );
+
+ foreach ( array( 'parent_id', 'type', 'data' ) as $key ) {
+ $this->assertEquals( $model->$key, $stored->$key, 'Stored value retrieved');
+ }
+ }
+
+
+ /**
+ * Test simple find
+ */
+ public function testFind() {
+ $model = $this->_createModel();
+ $found = $model->find( array( 'id' => $model->id ) );
+
+ $this->assertType( 'Builder_Model_Block', $found, 'Successfully retrieved object' );
+ }
+
+
+ /**
+ * Test update using save
+ */
+ public function testUpdate() {
+ $model = $this->_createModel();
+
+ $model->type = 'bar';
+ $model->parent_id = 99;
+ $model->data = (object) array( 'one' => 90, 'two' => 'test' );
+
+ $model->save();
+ $found = $model->find( array( 'id' => $model->id ) );
+
+ foreach ( array( 'parent_id', 'id', 'type', 'data' ) as $key ) {
+ $this->assertEquals( $model->$key, $found->$key, 'Child parent retrieved');
+ }
+ }
+
+
+ /**
+ * Test $model->parent();
+ */
+ public function testParent() {
+ $parent = $this->_createModel();
+ $child = $this->_createModel( $parent->id );
+
+ $got_parent = $child->parent();
+
+ foreach ( array( 'parent_id', 'id', 'type', 'data' ) as $key ) {
+ $this->assertEquals( $parent->$key, $got_parent->$key, 'Child parent retrieved');
+ }
+ }
+
+
+ /**
+ * Test $model->children();
+ */
+ public function testChildren() {
+ $parent = $this->_createModel();
+ $n_children = 10;
+
+ foreach ( range( 1, $n_children ) as $i ) {
+ $this->_createModel( $parent->id );
+ }
+
+ $children = $parent->children()->fetchAll();
+ $this->assertEquals( $n_children, count( $children ), 'Sucessfully retrieved children' );
+ }
+
+
+ /**
+ * Create a model
+ *
+ * @param unknown $parent_id (optional)
+ * @return unknown
+ */
+ private function _createModel( $parent_id = 0 ) {
+ $model = new Builder_Model_Block(array(
+ 'type' => 'foo',
+ 'data' => (object) array( 'test' => 1 ),
+ 'parent_id' => $parent_id
+ ));
+
+ return $model->store();
+ }
+
+
+}
View
53 Application/plugin/Builder/t/Page.php
@@ -0,0 +1,53 @@
+<?php
+/**
+ * Application/plugin/Builder/t/Page.php
+ *
+ * @author Matthijs van Henten <matthijs@ischen.nl>
+ * @package Pico
+ */
+
+define( 'NANO_ROOT', dirname(__FILE__) . '../../../../../../');
+
+class Builder_PageTest extends PHPUnit_Framework_TestCase{
+ private $config;
+
+ /**
+ *
+ */
+ protected function setUp() {
+ require_once NANO_ROOT . 'Nano/library/Nano/Autoloader.php';
+ Nano_Autoloader::register();
+ Nano_Autoloader::registerNamespace( 'Builder', dirname(__FILE__) . '/../lib' );
+ }
+
+
+
+ /**
+ *
+ */
+ public function testSmoke() {
+ $builder = new Builder_Page(array(
+ 'head' => array(
+ 'children' => array(
+ array(
+ 'type' => 'link',
+ 'attributes' => array(
+ 'href' => 'style.css',
+ 'rel' => 'stylesheet',
+ ))
+ )
+ ),
+ 'body' => array(
+ 'children' => array(
+ array(
+ 'type' => 'block',
+ )
+ )
+ )
+ ));
+
+ echo $builder;
+ }
+
+
+}
View
14 Application/plugin/Builder/t/bootstrap.php
@@ -0,0 +1,14 @@
+<?php
+/**
+ * t/bootstrap.php
+ *
+ * @author Matthijs van Henten <matthijs@ischen.nl>
+ * @package Pico
+ */
+
+
+define( 'NANO_ROOT', dirname(__FILE__) . '../../../../../../');
+require_once NANO_ROOT . 'Nano/library/Nano/Autoloader.php';
+Nano_Autoloader::register();
+
+Nano_Autoloader::registerNamespace( 'Builder', dirname(__FILE__) . '/../lib' );
View
90 Application/plugin/Builder/template/main.phtml
@@ -0,0 +1,90 @@
+<?php $this->wrapper('Admin/template/layout') ?>
+
+<?php $this->block('titlebar') ?>
+<?php $this->integrate('plugin/Builder/template/style'); ?>
+
+<div class="wrap">
+ <h2>hier something</h2>
+</div>
+<?php $this->endblock('titlebar') ?>
+
+<?php $this->block('main') ?>
+
+<div style="overflow:auto;" class="itemlist">
+<div class="three-fifth">
+ <div id="builder-box">
+ <?php
+ $demo = array(
+ 'id' => 'Foobar',
+ 'style' => array(
+ 'width' => '800px',
+ 'padding' => array(
+ 'bottom' => '10px',
+ 'left' => '5em',
+ 'right' => '2em',
+ 'top' => '0.5em'
+ ),
+ 'margin' => array(
+ 'bottom' => '10px',
+ 'left' => '0.5em',
+ 'right' => '2em',
+ 'top' => '1em'
+ )
+ ),
+ 'children' => array(
+ array(
+ 'id' => 'Child 1 of Foobar',
+ 'style' => array(
+ 'width' => '300px',
+ 'height' => '200px',
+ 'padding' => array(
+ 'bottom' => '10px',
+ 'left' => '1em',
+ 'right' => '2em',
+ 'top' => '0.5em'
+ ),
+ 'margin' => array(
+ 'bottom' => '10px',
+ 'left' => '0.5em',
+ 'right' => '2em',
+ 'top' => '1em'
+ )
+ )
+ ),
+ array(
+ 'id' => 'Child 2 of Foobar',
+ 'style' => array(
+ 'width' => '300px',
+ 'height' => '200px',
+ 'padding' => array(
+ 'bottom' => '10px',
+ 'left' => '1em',
+ 'right' => '2em',
+ 'top' => '0.5em'
+ ),
+ 'margin' => array(
+ 'bottom' => '10px',
+ 'left' => '0.5em',
+ 'right' => '2em',
+ 'top' => '1em'
+ )
+ )
+ )
+ )
+ );
+
+ $decorator = new Builder_Editor_Decorator_Block( $demo );
+ echo $decorator;
+ ?>
+
+
+ </div>
+</div>
+<div id="vertical-nav" class="fifth">
+ <?php
+ $form = new Builder_Editor_Form_Block();
+ echo $form;
+ ?>
+</div>
+</div>
+<?php $this->endblock('main') ?>
View
79 Application/plugin/Builder/template/style.phtml
@@ -0,0 +1,79 @@
+<style>
+#builder-box {
+ background: #fff;
+ height: 100%;
+ margin: 0.5em;
+ min-height: 840px;
+ overflow: auto;
+}
+
+
+.element-block{
+ border: 1px solid red;
+ background-color: #444;
+ position: relative;
+ margin: 20px;
+}
+
+.margin {
+ position: absolute;
+ background-color: #f9f9f9;
+ top: 0px;
+ left: 0px;
+ right: 0px;
+ bottom: 0px;
+ border: 1px solid #f6f6f6;
+ border-bottom: 1px solid #e9e9e9;
+ border-right: 1px solid #e9e9e9;
+
+}
+
+.inner {
+ position: relative;
+ background-color: #eee;
+ border: 1px solid #f3f3f3;
+ border-bottom: 1px solid #e3e3e3;
+ border-right: 1px solid #e3e3e3;
+}
+
+.handle{
+ height: 1.5em;
+ background-color: #999;
+ font: bold 12px sans-serif;
+ color: #fff;
+ padding: 0 0.2em;
+}
+
+.width-spacer{
+ min-width: 4em;
+}
+
+.height-spacer{
+ min-height: 2em;
+ overflow: auto;
+ position: relative;
+}
+
+input {
+ border: 1px solid red;
+}
+/*
+.padder{
+ position: absolute;
+ top: 0px;
+ left: 0px;
+ right: 0px;
+ bottom: 0px;
+}
+
+.body {
+ position: relative;
+ background-color: #F9F9F9;
+ width: 100%;
+ height: 100%;
+
+
+}
+*/
+
+</style>
View
BIN Application/sql/pico-mysql40.sql.gz
Binary file not shown.
View
1 www/css/admin/layout.css
@@ -174,6 +174,7 @@ input.button{
overflow:hidden;
min-width: 960px;
max-width: 1480px;
+ padding: 0 1em;
}
#user-navigation{

No commit comments for this range

Something went wrong with that request. Please try again.