Skip to content
Permalink
Browse files

fix coding style

  • Loading branch information...
Charles SANQUER
Charles SANQUER committed Feb 17, 2013
1 parent ca87dba commit 8693e30b17287fd28b3bd3e74c37a6531dfec282
Showing with 413 additions and 384 deletions.
  1. +1 −0 .php_cs
  2. +19 −20 app/bootstrap.php
  3. +1 −1 app/translations/messages.fr.yml
  4. +0 −1 app/translations/validators.en.yml
  5. +0 −1 app/translations/validators.fr.yml
  6. +5 −6 app/views/base.html.twig
  7. +1 −1 app/views/datalea/config_file_form.html.twig
  8. +0 −2 app/views/datalea/dump.html.twig
  9. +17 −18 app/views/datalea/generate.html.twig
  10. +5 −5 app/views/twitter_bootstrap_form_layout.html.twig
  11. +24 −25 src/Spyrit/Datalea/Controller/MainControllerProvider.php
  12. +3 −2 src/Spyrit/Datalea/Faker/Dump/CdataSimpleXMLElement.php
  13. +118 −113 src/Spyrit/Datalea/Faker/Dump/Dumper.php
  14. +10 −10 src/Spyrit/Datalea/Faker/Dump/Loader.php
  15. +43 −39 src/Spyrit/Datalea/Faker/Model/ColumnConfig.php
  16. +61 −51 src/Spyrit/Datalea/Faker/Model/Config.php
  17. +11 −6 src/Spyrit/Datalea/Faker/Model/CsvFormat.php
  18. +19 −16 src/Spyrit/Datalea/Faker/Model/UniqueTuple.php
  19. +16 −14 src/Spyrit/Datalea/Faker/Model/UniqueTupleCollection.php
  20. +39 −33 src/Spyrit/Datalea/Faker/Model/VariableConfig.php
  21. +3 −3 src/Spyrit/Datalea/Form/Type/ColumnConfigType.php
  22. +1 −1 src/Spyrit/Datalea/Form/Type/ConfigFileType.php
  23. +4 −4 src/Spyrit/Datalea/Form/Type/ConfigType.php
  24. +3 −3 src/Spyrit/Datalea/Form/Type/CsvFormatType.php
  25. +6 −6 src/Spyrit/Datalea/Form/Type/VariableConfigType.php
  26. +1 −1 src/Spyrit/Datalea/Form/extension/BootstrapFormExtension.php
  27. +1 −1 src/Spyrit/Datalea/Form/extension/Type/HelpFormTypeExtension.php
  28. +1 −1 src/Spyrit/Datalea/Form/extension/Type/RowContainerFormTypeExtension.php
@@ -2,6 +2,7 @@
$finder = Symfony\CS\Finder\DefaultFinder::create()
->exclude(array(
'app/cache',
'model/om',
'model/map',
'vendor',
@@ -51,7 +51,7 @@ function createDefaultSilexApp($appdir = __DIR__, $env = 'prod', $debug = false)
}
$app = new Application();
/*
* define environment variables
*/
@@ -65,7 +65,7 @@ function createDefaultSilexApp($appdir = __DIR__, $env = 'prod', $debug = false)
ExceptionHandler::register();
}
}
/*
* define main paths
*/
@@ -83,20 +83,19 @@ function createDefaultSilexApp($appdir = __DIR__, $env = 'prod', $debug = false)
printf("Unable to parse the YAML string: %s in config file", $e->getMessage());
exit();
}
}
else {
} else {
printf("no config file config file");
exit();
}
//set umask
$umask = isset($config['umask']) && is_int($config['umask']) ? $config['umask'] : 0002;
umask($umask);
//create cache and log directories
$app['cache_dir'] = $appdir.DS.'cache';
$app['log_dir'] = $appdir.DS.'logs';
if (!$fs->exists($app['cache_dir'])) {
$rights = isset($config['cache_access']) && is_int($config['cache_access']) ? $config['cache_access'] : 0775;
$fs->mkdir(array(
@@ -105,7 +104,7 @@ function createDefaultSilexApp($appdir = __DIR__, $env = 'prod', $debug = false)
$app['cache_dir'].DS.'twig',
$app['cache_dir'].DS.'profiler',
), $rights);
$fs->chmod($app['cache_dir'], $rights);
$fs->chmod($app['cache_dir'].DS.'http', $rights);
$fs->chmod($app['cache_dir'].DS.'twig', $rights);
@@ -116,25 +115,24 @@ function createDefaultSilexApp($appdir = __DIR__, $env = 'prod', $debug = false)
$fs->mkdir($app['log_dir'], 0775);
$fs->chmod($app['log_dir'], 0775);
}
$app['data_dir'] = $app['root_dir'].DS.'data';
if (!$fs->exists($app['data_dir'])) {
$fs->mkdir($app['data_dir'], 0777);
}
$app['uploads_dir'] = $app['web_dir'].DS.'uploads';
if (!$fs->exists($app['uploads_dir'])) {
$fs->mkdir($app['uploads_dir'], 0777);
}
// Application specific parameters
$app['datalea'] = array(
'max_variables' => isset($config['max_variables']) ? (int) $config['max_variables'] : 100,
'max_columns' => isset($config['max_columns']) ? (int) $config['max_columns'] : 80,
'max_rows' => isset($config['max_rows']) ? (int) $config['max_rows'] : 2000,
);
/*
* add service providers
*/
@@ -153,14 +151,15 @@ function createDefaultSilexApp($appdir = __DIR__, $env = 'prod', $debug = false)
$app->register(new ValidatorServiceProvider());
$app->register(new ServiceControllerServiceProvider());
// must be registered before twig
$app->register(new FormServiceProvider(), array(
'form.secret' => '4fws6dg4w6df4<qg4sh4646qfgsd4',
));
$app['form.extensions'] = $app->share($app->extend('form.extensions', function ($extensions) use ($app) {
$extensions[] = new BootstrapFormExtension();
return $extensions;
}));
@@ -178,16 +177,17 @@ function createDefaultSilexApp($appdir = __DIR__, $env = 'prod', $debug = false)
$translator->addResource('yaml', $app['app_dir'].DS.'translations'.DS.$domain.'.'.$lang.'.yml', $lang);
}
}
return $translator;
}));
$app->before(function () use ($app) {
if ($locale = $app['request']->get('_locale')) {
$app['locale'] = $locale;
$app['translator']->setLocale($app['locale']);
}
});
// add twig templating
$app->register(new TwigServiceProvider(), array(
'twig.path' => __DIR__.'/views',
@@ -205,10 +205,9 @@ function createDefaultSilexApp($appdir = __DIR__, $env = 'prod', $debug = false)
$app['twig'] = $app->share($app->extend('twig', function($twig, $app) {
// add custom globals, filters, tags, ...
return $twig;
}));
// Web Profiler and Monolog
if ($app['debug']) {
$app->register(new MonologServiceProvider(), array(
@@ -218,10 +217,10 @@ function createDefaultSilexApp($appdir = __DIR__, $env = 'prod', $debug = false)
$app->register($p = new WebProfilerServiceProvider(), array(
'profiler.cache_dir' => $app['cache_dir'].DS.'profiler',
));
$app->mount('/_profiler', $p);
}
//add swiftmailer with default SMTP transport
if (!empty($config['swiftmailer'])) {
$app->register(new SwiftmailerServiceProvider(), array(
@@ -13,4 +13,4 @@ about:
try_datalea: Essayez le générateur Datalea
try_it: Essayez le
fork_github: Voir les sources sur Github
fork_me: code source
fork_me: code source
@@ -1 +0,0 @@

@@ -1 +0,0 @@

@@ -63,7 +63,7 @@
{% endblock %}
</div>
</div>

<footer class="footer">
<div class="container">
<p class='mt10'>&copy; 2012-2013<br/>
@@ -83,16 +83,15 @@
</ul>
</div>
</footer>

<script src="/js/jquery-1.9.1.min.js"></script>
<script src="/js/jquery-migrate-1.1.0.min.js"></script>
<script src="/js/bootstrap.min.js"></script>
<script src="/select2/select2.js"></script>

{% block javascripts %}

{% endblock %}

</body>
</html>

@@ -2,7 +2,7 @@
{% if form.vars.errors|length > 0 %}
<div class="alert alert-error">
<a href="#" class="close" data-dismiss="alert">&times;</a>
<div class="control-group error">
<div class="control-group error">
{{ form_errors(form) }}
</div>
</div>
@@ -14,5 +14,3 @@
{% endfor %}

{% endblock %}


@@ -8,19 +8,19 @@
{% include 'datalea/config_file_form.html.twig' with {'form': configFileForm} %}

<form action="{{ path('datalea_generate') }}" method="post" {{ form_enctype(form) }}>

{% if form.vars.errors|length > 0 %}
<div class="alert alert-error">
<a href="#" class="close" data-dismiss="alert">&times;</a>
<div class="control-group error">
<div class="control-group error">
{{ form_errors(form) }}
</div>
</div>
{% endif %}

{{ form_row(form.variableConfigs) }}
{{ form_row(form.columnConfigs) }}

<div class="row-fluid">
<div class="span6">
<fieldset>
@@ -35,7 +35,7 @@
</div>
</fieldset>
</div>

<div class="span6">
<fieldset>
<legend>{{ 'Output' | trans }}</legend>
@@ -70,7 +70,7 @@
{% block javascripts %}
{{ parent() }}
<script type=text/javascript>
jQuery(document).ready(function() {
var $columnCollectionHolder = $('#datalea_generator_config_columnConfigs');
var addColumnConfigSelector = '.add-columnConfigs';
@@ -79,54 +79,54 @@ jQuery(document).ready(function() {
var removeConfigSelector = '.remove-collection-item-form';
var $csvFormatOption = $('input[type="checkbox"][name^="datalea_generator_config"][value="csv"]')
var $csvOptions = $('#csv-options');
$(addColumnConfigSelector).on('click', function(e) {
addConfigForm($columnCollectionHolder);
});
$(addVariableConfigSelector).on('click', function(e) {
addConfigForm($variableCollectionHolder);
});
addRemoveConfigListener($(removeConfigSelector));
$('select.select2-box').select2({
width: 'resolve',
});
$('select.select2-empty-box').select2({
width: 'resolve',
allowClear: true,
placeholder: 'select'
});
$('.required-asterisk').tooltip({
title: 'required field'
});
$('.help-popover').popover({
html: true
/*trigger: 'hover'*/
});
$('.help-popover').click(function(e){
e.preventDefault();
});
$csvOptions.toggle($csvFormatOption.prop("checked"));
$csvFormatOption.click(function(e){
$csvOptions.toggle($(this).prop("checked"));
});
function addRemoveConfigListener($object)
{
$object.on('click', function(e) {
$(this).parent().remove();
});
}
function addConfigForm($collectionHolder)
function addConfigForm($collectionHolder)
{
var prototype = $collectionHolder.attr('data-prototype');
var newForm = prototype.replace(/__name__/g, $collectionHolder.children().length);
@@ -146,4 +146,3 @@ jQuery(document).ready(function() {
</script>

{% endblock %}

@@ -40,7 +40,7 @@
</legend>
{% endspaceless %}
{% endblock collection_label %}

{% block collection_widget %}
{% import _self as macros %}
{% spaceless %}
@@ -98,14 +98,14 @@
{% endif %}
{% endif %}
{% endspaceless %}
{% endblock form_help %}
{% endblock form_help %}

{% block form_label_asterisk %}
{% spaceless %}
{% if required and required_asterisk %}<span class="required-asterisk">*</span>{% endif %}
{% endspaceless %}
{% endblock form_label_asterisk %}
{% endblock form_label_asterisk %}

{% block form_row %}
{% spaceless %}
{% set row_attr = row_attr|merge({'class': (row_attr.class|default('control-group'))|trim}) %}
Oops, something went wrong.

0 comments on commit 8693e30

Please sign in to comment.
You can’t perform that action at this time.