Skip to content

Commit

Permalink
bump 3.0.0-rc1
Browse files Browse the repository at this point in the history
  • Loading branch information
goldsky committed Apr 15, 2016
1 parent 80406f8 commit 3df7c74
Show file tree
Hide file tree
Showing 19 changed files with 1,927 additions and 78 deletions.
172 changes: 97 additions & 75 deletions _build/build.transport.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* Babel
*
Expand All @@ -23,174 +24,195 @@
*/
/**
* Babel build script
*
*
* @author Jakob Class <jakob.class@class-zec.de>
* goldsky <goldsky@virtudraft.com>
*
* @package babel
* @subpackage build
*/
$mtime = microtime();
$mtime = explode(' ', $mtime);
$mtime = $mtime[1] + $mtime[0];
$mtime = microtime();
$mtime = explode(' ', $mtime);
$mtime = $mtime[1] + $mtime[0];
$tstart = $mtime;
set_time_limit(0);

/* define package */
define('PKG_NAME','Babel');
define('PKG_NAME_LOWER',strtolower(PKG_NAME));
define('PKG_NAME', 'Babel');
define('PKG_NAME_LOWER', strtolower(PKG_NAME));

/* define sources */
$root = dirname(dirname(__FILE__)).'/';
$root = dirname(dirname(__FILE__)).'/';
$sources = array(
'root' => $root,
'build' => $root . '_build/',
'resolvers' => $root . '_build/resolvers/',
'data' => $root . '_build/data/',
'events' => $root . '_build/data/events/',
'chunks' => $root.'core/components/'.PKG_NAME_LOWER.'/elements/chunks/',
'snippets' => $root.'core/components/'.PKG_NAME_LOWER.'/elements/snippets/',
'plugins' => $root.'core/components/'.PKG_NAME_LOWER.'/elements/plugins/',
'lexicon' => $root . 'core/components/'.PKG_NAME_LOWER.'/lexicon/',
'docs' => $root.'core/components/'.PKG_NAME_LOWER.'/docs/',
'root' => $root,
'build' => $root.'_build/',
'resolvers' => $root.'_build/resolvers/',
'data' => $root.'_build/data/',
'events' => $root.'_build/data/events/',
'chunks' => $root.'core/components/'.PKG_NAME_LOWER.'/elements/chunks/',
'snippets' => $root.'core/components/'.PKG_NAME_LOWER.'/elements/snippets/',
'plugins' => $root.'core/components/'.PKG_NAME_LOWER.'/elements/plugins/',
'lexicon' => $root.'core/components/'.PKG_NAME_LOWER.'/lexicon/',
'docs' => $root.'core/components/'.PKG_NAME_LOWER.'/docs/',
'source_assets' => $root.'assets/components/'.PKG_NAME_LOWER,
'source_core' => $root.'core/components/'.PKG_NAME_LOWER,
'source_core' => $root.'core/components/'.PKG_NAME_LOWER,
);
unset($root);

/* override with your own defines here (see build.config.sample.php) */
require_once $sources['build'] . '/build.config.php';
require_once MODX_CORE_PATH . 'model/modx/modx.class.php';
require_once $sources['build'] . '/includes/functions.php';
require_once $sources['build'].'/build.config.php';
require_once MODX_CORE_PATH.'model/modx/modx.class.php';
require_once $sources['build'].'/includes/functions.php';

$modx= new modX();
$modx = new modX();
$modx->initialize('mgr');
echo '<pre>'; /* used for nice formatting of log messages */
$modx->setLogLevel(modX::LOG_LEVEL_INFO);
$modx->setLogTarget('ECHO');

$babel = $modx->getService('babel', 'Babel', MODX_CORE_PATH . 'components/babel/model/babel/');
$babel = $modx->getService('babel', 'Babel', MODX_CORE_PATH.'components/babel/model/babel/');

if (!($babel instanceof Babel)) {
return '';
}
define('PKG_VERSION', Babel::VERSION);
define('PKG_RELEASE', Babel::RELEASE);

$modx->loadClass('transport.modPackageBuilder','',false, true);
$modx->loadClass('transport.modPackageBuilder', '', false, true);
$builder = new modPackageBuilder($modx);
$builder->createPackage(PKG_NAME_LOWER,PKG_VERSION,PKG_RELEASE);
$builder->registerNamespace(PKG_NAME_LOWER,false,true,'{core_path}components/'.PKG_NAME_LOWER.'/');
$modx->log(modX::LOG_LEVEL_INFO,'Created Transport Package and Namespace.');
$builder->createPackage(PKG_NAME_LOWER, PKG_VERSION, PKG_RELEASE);
$builder->registerNamespace(PKG_NAME_LOWER, false, true, '{core_path}components/'.PKG_NAME_LOWER.'/');
$modx->log(modX::LOG_LEVEL_INFO, 'Created Transport Package and Namespace.');

/**
* MENU & ACTION
*/
$menu = include $sources['data'].'transport.menu.php';
if (empty($menu)) {
$modx->log(modX::LOG_LEVEL_ERROR, 'Could not package in menu.');
} else {
$menuVehicle = $builder->createVehicle($menu, array(
xPDOTransport::PRESERVE_KEYS => true,
xPDOTransport::UPDATE_OBJECT => true,
xPDOTransport::UNIQUE_KEY => 'text'
));
$builder->putVehicle($menuVehicle);
$modx->log(modX::LOG_LEVEL_INFO, 'Packaged in Menu');
unset($menuVehicle, $menu);
}

/* load system settings */
$settings = include $sources['data'].'transport.settings.php';
if (!is_array($settings)) {
$modx->log(modX::LOG_LEVEL_ERROR,'Could not package in settings.');
$modx->log(modX::LOG_LEVEL_ERROR, 'Could not package in settings.');
} else {
$attributes= array(
xPDOTransport::UNIQUE_KEY => 'key',
$attributes = array(
xPDOTransport::UNIQUE_KEY => 'key',
xPDOTransport::PRESERVE_KEYS => true,
xPDOTransport::UPDATE_OBJECT => false,
);
foreach ($settings as $setting) {
$vehicle = $builder->createVehicle($setting,$attributes);
$vehicle = $builder->createVehicle($setting, $attributes);
$builder->putVehicle($vehicle);
}
$modx->log(modX::LOG_LEVEL_INFO,'Packaged in '.count($settings).' System Settings.');
$modx->log(modX::LOG_LEVEL_INFO, 'Packaged in '.count($settings).' System Settings.');
}
unset($settings,$setting,$attributes);
unset($settings, $setting, $attributes);

/* add plugins */
$plugins = include $sources['data'].'transport.plugins.php';
if (!is_array($plugins)) { $modx->log(modX::LOG_LEVEL_FATAL,'Adding plugins failed.'); }
$attributes= array(
xPDOTransport::UNIQUE_KEY => 'name',
xPDOTransport::PRESERVE_KEYS => false,
xPDOTransport::UPDATE_OBJECT => true,
xPDOTransport::RELATED_OBJECTS => true,
xPDOTransport::RELATED_OBJECT_ATTRIBUTES => array (
if (!is_array($plugins)) {
$modx->log(modX::LOG_LEVEL_FATAL, 'Adding plugins failed.');
}
$attributes = array(
xPDOTransport::UNIQUE_KEY => 'name',
xPDOTransport::PRESERVE_KEYS => false,
xPDOTransport::UPDATE_OBJECT => true,
xPDOTransport::RELATED_OBJECTS => true,
xPDOTransport::RELATED_OBJECT_ATTRIBUTES => array(
'PluginEvents' => array(
xPDOTransport::PRESERVE_KEYS => true,
xPDOTransport::UPDATE_OBJECT => false,
xPDOTransport::UNIQUE_KEY => array('pluginid','event'),
xPDOTransport::UNIQUE_KEY => array('pluginid', 'event'),
),
),
);
foreach ($plugins as $plugin) {
$vehicle = $builder->createVehicle($plugin, $attributes);
$builder->putVehicle($vehicle);
}
$modx->log(modX::LOG_LEVEL_INFO,'Packaged in '.count($plugins).' plugins.'); flush();
unset($plugins,$plugin,$attributes);
$modx->log(modX::LOG_LEVEL_INFO, 'Packaged in '.count($plugins).' plugins.');
flush();
unset($plugins, $plugin, $attributes);

/* create category */
$category= $modx->newObject('modCategory');
$category->set('id',1);
$category->set('category',PKG_NAME);
$modx->log(modX::LOG_LEVEL_INFO,'Packaged in category.'); flush();
$category = $modx->newObject('modCategory');
$category->set('id', 1);
$category->set('category', PKG_NAME);
$modx->log(modX::LOG_LEVEL_INFO, 'Packaged in category.');
flush();

/* add snippets */
$snippets = include $sources['data'].'transport.snippets.php';
if (!is_array($snippets)) {
$modx->log(modX::LOG_LEVEL_ERROR,'Could not package in snippets.');
$modx->log(modX::LOG_LEVEL_ERROR, 'Could not package in snippets.');
} else {
$category->addMany($snippets);
$modx->log(modX::LOG_LEVEL_INFO,'Packaged in '.count($snippets).' snippets.');
$modx->log(modX::LOG_LEVEL_INFO, 'Packaged in '.count($snippets).' snippets.');
}

/* create category vehicle */
$attr = array(
xPDOTransport::UNIQUE_KEY => 'category',
xPDOTransport::PRESERVE_KEYS => false,
xPDOTransport::UPDATE_OBJECT => true,
xPDOTransport::RELATED_OBJECTS => true,
xPDOTransport::RELATED_OBJECT_ATTRIBUTES => array (
$attr = array(
xPDOTransport::UNIQUE_KEY => 'category',
xPDOTransport::PRESERVE_KEYS => false,
xPDOTransport::UPDATE_OBJECT => true,
xPDOTransport::RELATED_OBJECTS => true,
xPDOTransport::RELATED_OBJECT_ATTRIBUTES => array(
'Snippets' => array(
xPDOTransport::PRESERVE_KEYS => false,
xPDOTransport::UPDATE_OBJECT => true,
xPDOTransport::UNIQUE_KEY => 'name',
xPDOTransport::UNIQUE_KEY => 'name',
),
),
);
$vehicle = $builder->createVehicle($category,$attr);
$vehicle = $builder->createVehicle($category, $attr);

$modx->log(modX::LOG_LEVEL_INFO,'Adding file resolvers to category...');
$vehicle->resolve('file',array(
$modx->log(modX::LOG_LEVEL_INFO, 'Adding file resolvers to category...');
$vehicle->resolve('file', array(
'source' => $sources['source_assets'],
'target' => "return MODX_ASSETS_PATH . 'components/';",
));
$vehicle->resolve('file',array(
$vehicle->resolve('file', array(
'source' => $sources['source_core'],
'target' => "return MODX_CORE_PATH . 'components/';",
));
$vehicle->resolve('php',array(
'source' => $sources['resolvers'] . 'setupoptions.resolver.php',
$vehicle->resolve('php', array(
'source' => $sources['resolvers'].'setupoptions.resolver.php',
));
$builder->putVehicle($vehicle);

/* now pack in the license file, readme and setup options */
$builder->setPackageAttributes(array(
'license' => file_get_contents($sources['docs'] . 'license.txt'),
'changelog' => file_get_contents($sources['docs'] . 'changelog.txt'),
'readme' => file_get_contents($sources['docs'] . 'readme.txt'),
'license' => file_get_contents($sources['docs'].'license.txt'),
'changelog' => file_get_contents($sources['docs'].'changelog.txt'),
'readme' => file_get_contents($sources['docs'].'readme.txt'),
'setup-options' => array(
'source' => $sources['build'].'setup.options.php',
),
));
$modx->log(modX::LOG_LEVEL_INFO,'Added package attributes and setup options.');
$modx->log(modX::LOG_LEVEL_INFO, 'Added package attributes and setup options.');

/* zip up package */
$modx->log(modX::LOG_LEVEL_INFO,'Packing up transport package zip...');
$modx->log(modX::LOG_LEVEL_INFO, 'Packing up transport package zip...');
$builder->pack();

$mtime= microtime();
$mtime= explode(" ", $mtime);
$mtime= $mtime[1] + $mtime[0];
$tend= $mtime;
$totalTime= ($tend - $tstart);
$totalTime= sprintf("%2.4f s", $totalTime);
$mtime = microtime();
$mtime = explode(" ", $mtime);
$mtime = $mtime[1] + $mtime[0];
$tend = $mtime;
$totalTime = ($tend - $tstart);
$totalTime = sprintf("%2.4f s", $totalTime);

$modx->log(modX::LOG_LEVEL_INFO,"\n<br />Package Built.<br />\nExecution time: {$totalTime}\n");
$modx->log(modX::LOG_LEVEL_INFO, "\n<br />Package Built.<br />\nExecution time: {$totalTime}\n");

exit ();
exit();
47 changes: 47 additions & 0 deletions _build/data/transport.menu.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?php
/**
* Babel
*
* Copyright 2010 by Jakob Class <jakob.class@class-zec.de>
*
* This file is part of Babel.
*
* Babel is free software; you can redistribute it and/or modify it under the
* terms of the GNU General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option) any later
* version.
*
* Babel is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with
* Babel; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
* Suite 330, Boston, MA 02111-1307 USA
*
* @package babel
*/
/**
* Add menu to build
*
* @author Jakob Class <jakob.class@class-zec.de>
* goldsky <goldsky@virtudraft.com>
* @package babel
* @subpackage build
*/

$menu = $modx->newObject('modMenu');
$menu->fromArray(array(
'text' => 'babel',
'parent' => 'components',
'action' => 'index',
'description' => 'babel.desc',
'icon' => 'images/icons/plugin.gif',
'menuindex' => 0,
'params' => '',
'handler' => '',
'pemission' => '',
'namespace' => 'babel',
), '', true, true);

return $menu;
Empty file.
9 changes: 9 additions & 0 deletions assets/components/babel/js/mgr/babel.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
var Babel = function (config) {
config = config || {};
Babel.superclass.constructor.call(this, config);
};
Ext.extend(Babel, Ext.Component, {
page: {}, window: {}, grid: {}, tree: {}, panel: {}, combo: {}, config: {}
});
Ext.reg('babel', Babel);
Babel = new Babel();
15 changes: 15 additions & 0 deletions assets/components/babel/js/mgr/sections/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Ext.onReady(function () {
MODx.load({xtype: 'babel-page-home'});
});
Babel.page.Home = function (config) {
config = config || {};
Ext.applyIf(config, {
components: [{
xtype: 'babel-panel-home'
, renderTo: 'babel-panel-home-div'
}]
});
Babel.page.Home.superclass.constructor.call(this, config);
};
Ext.extend(Babel.page.Home, MODx.Component);
Ext.reg('babel-page-home', Babel.page.Home);
25 changes: 25 additions & 0 deletions assets/components/babel/js/mgr/widgets/combo.context.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
Babel.combo.Context = function (config) {
config = config || {};
Ext.applyIf(config, {
url: Babel.config.connectorUrl,
baseParams: {
action: 'mgr/context/getlist',
combo: true,
exclude: 'mgr'
}
});
Babel.combo.Context.superclass.constructor.call(this, config);

this.on('select', function (comp, record, index){
if (comp.getValue() === "" || comp.getValue() === "&nbsp;") {
comp.setValue(null);
}
});
this.on('change', function (comp, newValue, oldValue){
if (newValue === "" || newValue === "&nbsp;") {
comp.setValue(null);
}
});
};
Ext.extend(Babel.combo.Context, MODx.combo.Context);
Ext.reg('babel-combo-context', Babel.combo.Context);
Loading

0 comments on commit 3df7c74

Please sign in to comment.