├── .gitignore ├── .php_cs ├── CREDITS ├── LICENSE ├── README.md ├── app ├── app.php ├── bootstrap.php ├── config │ └── config.php.dist ├── console ├── sql │ └── database.sql ├── translations │ ├── messages.en.yml │ ├── messages.fr.yml │ ├── validators.en.yml │ └── validators.fr.yml └── views │ ├── base.html.twig │ ├── datalea │ ├── about.html.twig │ ├── config_file_form.html.twig │ ├── dump.html.twig │ ├── form │ │ └── fields.html.twig │ ├── generate.html.twig │ ├── index.html.twig │ ├── introduction.html.twig │ └── tutorial.html.twig │ └── twitter_bootstrap_form_layout.html.twig ├── composer.json ├── composer.lock ├── console ├── src └── Spyrit │ └── Datalea │ ├── Controller │ └── MainControllerProvider.php │ ├── Faker │ ├── Dump │ │ ├── CdataSimpleXMLElement.php │ │ ├── Dumper.php │ │ └── Loader.php │ └── Model │ │ ├── ColumnConfig.php │ │ ├── Config.php │ │ ├── CsvFormat.php │ │ ├── FakerMethod.php │ │ ├── FakerMethodCollection.php │ │ ├── UniqueTuple.php │ │ ├── UniqueTupleCollection.php │ │ └── VariableConfig.php │ └── Form │ ├── Type │ ├── ColumnConfigType.php │ ├── ConfigFileType.php │ ├── ConfigType.php │ ├── CsvFormatType.php │ └── VariableConfigType.php │ └── extension │ ├── BootstrapFormExtension.php │ └── Type │ ├── HelpFormTypeExtension.php │ └── RowContainerFormTypeExtension.php └── web ├── .htaccess ├── css ├── bootstrap-responsive.css ├── bootstrap-responsive.min.css ├── bootstrap.css ├── bootstrap.min.css ├── font-awesome-ie7.min.css ├── font-awesome.css ├── font-awesome.min.css ├── layout.css └── styles.css ├── fancybox ├── blank.gif ├── fancy_close.png ├── fancy_loading.png ├── fancy_nav_left.png ├── fancy_nav_right.png ├── fancy_shadow_e.png ├── fancy_shadow_n.png ├── fancy_shadow_ne.png ├── fancy_shadow_nw.png ├── fancy_shadow_s.png ├── fancy_shadow_se.png ├── fancy_shadow_sw.png ├── fancy_shadow_w.png ├── fancy_title_left.png ├── fancy_title_main.png ├── fancy_title_over.png ├── fancy_title_right.png ├── fancybox-x.png ├── fancybox-y.png ├── fancybox.png ├── jquery.easing-1.3.pack.js ├── jquery.fancybox-1.3.4.css ├── jquery.fancybox-1.3.4.js ├── jquery.fancybox-1.3.4.pack.js └── jquery.mousewheel-3.0.4.pack.js ├── font ├── FontAwesome.otf ├── fontawesome-webfont.eot ├── fontawesome-webfont.svg ├── fontawesome-webfont.ttf ├── fontawesome-webfont.woff └── source │ ├── SIL OFL Font License - Source Sans Pro.txt │ ├── SourceSansPro-Black-webfont.eot │ ├── SourceSansPro-Black-webfont.svg │ ├── SourceSansPro-Black-webfont.ttf │ ├── SourceSansPro-Black-webfont.woff │ ├── SourceSansPro-BlackIt-webfont.eot │ ├── SourceSansPro-BlackIt-webfont.svg │ ├── SourceSansPro-BlackIt-webfont.ttf │ ├── SourceSansPro-BlackIt-webfont.woff │ ├── SourceSansPro-Bold-webfont.eot │ ├── SourceSansPro-Bold-webfont.svg │ ├── SourceSansPro-Bold-webfont.ttf │ ├── SourceSansPro-Bold-webfont.woff │ ├── SourceSansPro-BoldIt-webfont.eot │ ├── SourceSansPro-BoldIt-webfont.svg │ ├── SourceSansPro-BoldIt-webfont.ttf │ ├── SourceSansPro-BoldIt-webfont.woff │ ├── SourceSansPro-ExtraLight-webfont.eot │ ├── SourceSansPro-ExtraLight-webfont.svg │ ├── SourceSansPro-ExtraLight-webfont.ttf │ ├── SourceSansPro-ExtraLight-webfont.woff │ ├── SourceSansPro-ExtraLightIt-webfont.eot │ ├── SourceSansPro-ExtraLightIt-webfont.svg │ ├── SourceSansPro-ExtraLightIt-webfont.ttf │ ├── SourceSansPro-ExtraLightIt-webfont.woff │ ├── SourceSansPro-It-webfont.eot │ ├── SourceSansPro-It-webfont.svg │ ├── SourceSansPro-It-webfont.ttf │ ├── SourceSansPro-It-webfont.woff │ ├── SourceSansPro-Light-webfont.eot │ ├── SourceSansPro-Light-webfont.svg │ ├── SourceSansPro-Light-webfont.ttf │ ├── SourceSansPro-Light-webfont.woff │ ├── SourceSansPro-LightIt-webfont.eot │ ├── SourceSansPro-LightIt-webfont.svg │ ├── SourceSansPro-LightIt-webfont.ttf │ ├── SourceSansPro-LightIt-webfont.woff │ ├── SourceSansPro-Regular-webfont.eot │ ├── SourceSansPro-Regular-webfont.svg │ ├── SourceSansPro-Regular-webfont.ttf │ ├── SourceSansPro-Regular-webfont.woff │ ├── SourceSansPro-Semibold-webfont.eot │ ├── SourceSansPro-Semibold-webfont.svg │ ├── SourceSansPro-Semibold-webfont.ttf │ ├── SourceSansPro-Semibold-webfont.woff │ ├── SourceSansPro-SemiboldIt-webfont.eot │ ├── SourceSansPro-SemiboldIt-webfont.svg │ ├── SourceSansPro-SemiboldIt-webfont.ttf │ └── SourceSansPro-SemiboldIt-webfont.woff ├── img ├── db.png ├── flags │ ├── png │ │ ├── ad.png │ │ ├── ae.png │ │ ├── af.png │ │ ├── ag.png │ │ ├── ai.png │ │ ├── al.png │ │ ├── am.png │ │ ├── an.png │ │ ├── ao.png │ │ ├── ar.png │ │ ├── as.png │ │ ├── at.png │ │ ├── au.png │ │ ├── aw.png │ │ ├── ax.png │ │ ├── az.png │ │ ├── ba.png │ │ ├── bb.png │ │ ├── bd.png │ │ ├── be.png │ │ ├── bf.png │ │ ├── bg.png │ │ ├── bh.png │ │ ├── bi.png │ │ ├── bj.png │ │ ├── bm.png │ │ ├── bn.png │ │ ├── bo.png │ │ ├── br.png │ │ ├── bs.png │ │ ├── bt.png │ │ ├── bv.png │ │ ├── bw.png │ │ ├── by.png │ │ ├── bz.png │ │ ├── ca.png │ │ ├── catalonia.png │ │ ├── cc.png │ │ ├── cd.png │ │ ├── cf.png │ │ ├── cg.png │ │ ├── ch.png │ │ ├── ci.png │ │ ├── ck.png │ │ ├── cl.png │ │ ├── cm.png │ │ ├── cn.png │ │ ├── co.png │ │ ├── cr.png │ │ ├── cs.png │ │ ├── cu.png │ │ ├── cv.png │ │ ├── cx.png │ │ ├── cy.png │ │ ├── cz.png │ │ ├── de.png │ │ ├── dj.png │ │ ├── dk.png │ │ ├── dm.png │ │ ├── do.png │ │ ├── dz.png │ │ ├── ec.png │ │ ├── ee.png │ │ ├── eg.png │ │ ├── eh.png │ │ ├── england.png │ │ ├── er.png │ │ ├── es.png │ │ ├── et.png │ │ ├── europeanunion.png │ │ ├── fam.png │ │ ├── fi.png │ │ ├── fj.png │ │ ├── fk.png │ │ ├── fm.png │ │ ├── fo.png │ │ ├── fr.png │ │ ├── ga.png │ │ ├── gb.png │ │ ├── gd.png │ │ ├── ge.png │ │ ├── gf.png │ │ ├── gh.png │ │ ├── gi.png │ │ ├── gl.png │ │ ├── gm.png │ │ ├── gn.png │ │ ├── gp.png │ │ ├── gq.png │ │ ├── gr.png │ │ ├── gs.png │ │ ├── gt.png │ │ ├── gu.png │ │ ├── gw.png │ │ ├── gy.png │ │ ├── hk.png │ │ ├── hm.png │ │ ├── hn.png │ │ ├── hr.png │ │ ├── ht.png │ │ ├── hu.png │ │ ├── id.png │ │ ├── ie.png │ │ ├── il.png │ │ ├── in.png │ │ ├── io.png │ │ ├── iq.png │ │ ├── ir.png │ │ ├── is.png │ │ ├── it.png │ │ ├── jm.png │ │ ├── jo.png │ │ ├── jp.png │ │ ├── ke.png │ │ ├── kg.png │ │ ├── kh.png │ │ ├── ki.png │ │ ├── km.png │ │ ├── kn.png │ │ ├── kp.png │ │ ├── kr.png │ │ ├── kw.png │ │ ├── ky.png │ │ ├── kz.png │ │ ├── la.png │ │ ├── lb.png │ │ ├── lc.png │ │ ├── li.png │ │ ├── lk.png │ │ ├── lr.png │ │ ├── ls.png │ │ ├── lt.png │ │ ├── lu.png │ │ ├── lv.png │ │ ├── ly.png │ │ ├── ma.png │ │ ├── mc.png │ │ ├── md.png │ │ ├── me.png │ │ ├── mg.png │ │ ├── mh.png │ │ ├── mk.png │ │ ├── ml.png │ │ ├── mm.png │ │ ├── mn.png │ │ ├── mo.png │ │ ├── mp.png │ │ ├── mq.png │ │ ├── mr.png │ │ ├── ms.png │ │ ├── mt.png │ │ ├── mu.png │ │ ├── mv.png │ │ ├── mw.png │ │ ├── mx.png │ │ ├── my.png │ │ ├── mz.png │ │ ├── na.png │ │ ├── nc.png │ │ ├── ne.png │ │ ├── nf.png │ │ ├── ng.png │ │ ├── ni.png │ │ ├── nl.png │ │ ├── no.png │ │ ├── np.png │ │ ├── nr.png │ │ ├── nu.png │ │ ├── nz.png │ │ ├── om.png │ │ ├── pa.png │ │ ├── pe.png │ │ ├── pf.png │ │ ├── pg.png │ │ ├── ph.png │ │ ├── pk.png │ │ ├── pl.png │ │ ├── pm.png │ │ ├── pn.png │ │ ├── pr.png │ │ ├── ps.png │ │ ├── pt.png │ │ ├── pw.png │ │ ├── py.png │ │ ├── qa.png │ │ ├── re.png │ │ ├── ro.png │ │ ├── rs.png │ │ ├── ru.png │ │ ├── rw.png │ │ ├── sa.png │ │ ├── sb.png │ │ ├── sc.png │ │ ├── scotland.png │ │ ├── sd.png │ │ ├── se.png │ │ ├── sg.png │ │ ├── sh.png │ │ ├── si.png │ │ ├── sj.png │ │ ├── sk.png │ │ ├── sl.png │ │ ├── sm.png │ │ ├── sn.png │ │ ├── so.png │ │ ├── sr.png │ │ ├── st.png │ │ ├── sv.png │ │ ├── sy.png │ │ ├── sz.png │ │ ├── tc.png │ │ ├── td.png │ │ ├── tf.png │ │ ├── tg.png │ │ ├── th.png │ │ ├── tj.png │ │ ├── tk.png │ │ ├── tl.png │ │ ├── tm.png │ │ ├── tn.png │ │ ├── to.png │ │ ├── tr.png │ │ ├── tt.png │ │ ├── tv.png │ │ ├── tw.png │ │ ├── tz.png │ │ ├── ua.png │ │ ├── ug.png │ │ ├── um.png │ │ ├── us.png │ │ ├── uy.png │ │ ├── uz.png │ │ ├── va.png │ │ ├── vc.png │ │ ├── ve.png │ │ ├── vg.png │ │ ├── vi.png │ │ ├── vn.png │ │ ├── vu.png │ │ ├── wales.png │ │ ├── wf.png │ │ ├── ws.png │ │ ├── ye.png │ │ ├── yt.png │ │ ├── za.png │ │ ├── zm.png │ │ └── zw.png │ └── readme.txt ├── glyphicons-halflings-white.png ├── glyphicons-halflings.png ├── logo.png ├── screencast │ ├── 1.png │ ├── 2.png │ └── 3.png └── tutorial │ ├── step1-1.png │ ├── step1-2.png │ └── step2-1.png ├── index.php ├── index_dev.php ├── js ├── bootstrap.js ├── bootstrap.min.js ├── global.js ├── jquery-1.9.1.min.js └── jquery-migrate-1.1.0.min.js └── select2 ├── LICENSE ├── README.md ├── component.json ├── release.sh ├── select2-spinner.gif ├── select2.css ├── select2.jquery.json ├── select2.js ├── select2.png ├── select2_locale_it.js └── select2x2.png /.gitignore: -------------------------------------------------------------------------------- 1 | vendor 2 | app/cache 3 | app/log 4 | app/logs 5 | app/config/config.yml 6 | app/config/config.php 7 | bin 8 | data 9 | web/uploads 10 | composer.phar 11 | -------------------------------------------------------------------------------- /.php_cs: -------------------------------------------------------------------------------- 1 | exclude(array( 5 | 'app/cache', 6 | 'model/om', 7 | 'model/map', 8 | 'vendor', 9 | 'web/images', 10 | 'Symfony/Tests/Component/ClassLoader/ClassCollectionLoaderTest.php', 11 | 'Symfony/Tests/Component/DependencyInjection/Fixtures/containers/container9.php', 12 | 'Symfony/Tests/Component/DependencyInjection/Fixtures/includes/foo.php', 13 | 'Symfony/Tests/Component/DependencyInjection/Fixtures/php/services9.php', 14 | 'Symfony/Tests/Component/DependencyInjection/Fixtures/yaml/services9.yml', 15 | 'Symfony/Tests/Component/Routing/Fixtures/dumper/url_matcher1.php', 16 | 'Symfony/Tests/Component/Routing/Fixtures/dumper/url_matcher2.php', 17 | 'Symfony/Tests/Component/Yaml/Fixtures/sfTests.yml', 18 | )) 19 | ->notName('/.*\.(ico|gif|png|jpeg|jpg|bmp|zip|gz|tar|7z|tiff|log|phar|jar)/') 20 | ->in(array( 21 | __DIR__.'/src', 22 | )) 23 | ; 24 | 25 | return Symfony\CS\Config\Config::create() 26 | ->fixers(array( 27 | 'indentation', 28 | 'linefeed', 29 | 'unused_use', 30 | 'trailing_spaces', 31 | 'php_closing_tag', 32 | 'short_tag', 33 | 'return', 34 | 'visibility', 35 | 'braces', 36 | 'phpdoc_params', 37 | 'eof_ending', 38 | 'extra_empty_lines', 39 | 'include', 40 | 'psr0', 41 | 'controls_spaces', 42 | 'elseif', 43 | )) 44 | ->finder($finder) 45 | ; 46 | -------------------------------------------------------------------------------- /CREDITS: -------------------------------------------------------------------------------- 1 | Charles SANQUER (Spyrit Systeme) 2 | Maxime Corson (Spyrit Systeme) -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Datalea - a Random Test Data Generator 2 | ====================================== 3 | 4 | Install 5 | ------- 6 | 7 | * copy config sample file and edit the copy with your environment values 8 | 9 | ```bash 10 | cp app/config/config.php.dist app/config/config.php 11 | ``` 12 | 13 | * get composer http://getcomposer.org/ and install dependencies 14 | 15 | ```bash 16 | curl -s https://getcomposer.org/installer | php 17 | ``` 18 | 19 | * install dependencies 20 | 21 | ```bash 22 | php composer.phar install 23 | ``` 24 | 25 | * set your web server document root to web directory 26 | 27 | * clean cache 28 | 29 | ```bash 30 | php app/console cache:clear 31 | ``` 32 | 33 | Licensing 34 | --------- 35 | 36 | License GPL 3 37 | 38 | * Copyright (C) 2012-2013 Spyrit Systeme 39 | 40 | This file is part of Datalea. 41 | 42 | Datalea is free software: you can redistribute it and/or modify 43 | it under the terms of the GNU General Public License as published by 44 | the Free Software Foundation, either version 3 of the License, or 45 | (at your option) any later version. 46 | 47 | Datalea is distributed in the hope that it will be useful, 48 | but WITHOUT ANY WARRANTY; without even the implied warranty of 49 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 50 | GNU General Public License for more details. 51 | 52 | You should have received a copy of the GNU General Public License 53 | along with Datalea. If not, see . 54 | 55 | FAMFAMFAM flags icons 56 | --------------------- 57 | see http://www.famfamfam.com/lab/icons/flags/ 58 | -------------------------------------------------------------------------------- /app/app.php: -------------------------------------------------------------------------------- 1 | mount('/', new \Spyrit\Datalea\Controller\MainControllerProvider()); 29 | 30 | /* 31 | * run silex application 32 | */ 33 | $app->run(); 34 | 35 | //var_dump($app); 36 | -------------------------------------------------------------------------------- /app/config/config.php.dist: -------------------------------------------------------------------------------- 1 | 'en', 4 | 'umask' => 0000, 5 | 'cache_access' => 0777, 6 | 'max_variables' => 100, 7 | 'max_columns' => 80, 8 | 'max_rows' => 2000, 9 | 'google_analytics_account' => '', 10 | 'contact_address' => 'support@spyrit.net', 11 | ); -------------------------------------------------------------------------------- /app/console: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | add(new CacheClearCommand()); 34 | $this->projectDir = realpath(__DIR__.DS.'..'); 35 | } 36 | 37 | public function getProjectDir() 38 | { 39 | return $this->projectDir; 40 | } 41 | 42 | public function getBinDir() 43 | { 44 | return $this->projectDir.DS.'bin'; 45 | } 46 | } 47 | 48 | $console = new Application(); 49 | $console->run(); -------------------------------------------------------------------------------- /app/sql/database.sql: -------------------------------------------------------------------------------- 1 | # This is a fix for InnoDB in MySQL >= 4.1.x 2 | # It "suspends judgement" for fkey relationships until are tables are set. 3 | SET FOREIGN_KEY_CHECKS = 0; 4 | 5 | # This restores the fkey checks, after having unset them earlier 6 | SET FOREIGN_KEY_CHECKS = 1; -------------------------------------------------------------------------------- /app/translations/validators.en.yml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spyrit/datalea/140f112e037451e9c8476c6a4fab082115c90416/app/translations/validators.en.yml -------------------------------------------------------------------------------- /app/translations/validators.fr.yml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spyrit/datalea/140f112e037451e9c8476c6a4fab082115c90416/app/translations/validators.fr.yml -------------------------------------------------------------------------------- /app/views/base.html.twig: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Datalea 8 | 11 | 12 | 13 | 14 | 17 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | {% set bodyId = bodyId|default('global') %} 36 | 37 | 64 | 65 | {% block header %} 66 | 73 | {% endblock header %} 74 | 75 | {% block main_body %} 76 |
77 |
78 | {% block body %} 79 | 80 | {% endblock %} 81 |
82 |
83 | {% endblock main_body %} 84 | 85 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | {% if google_analytics_account is not empty %} 113 | 123 | {% endif %} 124 | 125 | {% block javascripts %} 126 | {% endblock %} 127 | 128 | 129 | -------------------------------------------------------------------------------- /app/views/datalea/about.html.twig: -------------------------------------------------------------------------------- 1 | {% extends "base.html.twig" %} 2 | 3 | {% set currentPage = 'about' %} 4 | {% set bodyId = currentPage %} 5 | 6 | {% block header_content %} 7 |
8 |
9 |

{{ 'about.title' | trans }}

10 |
11 |
12 | {% endblock header_content %} 13 | 14 | {% block main_body %} 15 | 16 |
17 |
18 |
19 |
20 | 21 |

{{ 'about.text1' | trans }}

22 |

{{ 'about.components_used.text' | trans }}

23 |
    24 |
  • {{ 'about.components_used.silex' | trans | raw }}
  • 25 |
  • {{ 'about.components_used.bootstrap' | trans | raw }}
  • 26 |
  • {{ 'about.components_used.faker' | trans | raw }}
  • 27 |
28 |
29 |
30 | {{ 'about.thanks' | trans }} 31 | 32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 | 40 | 41 | 42 | 43 |
44 |
45 |
46 |
47 | 48 |

{{ 'about.prerequisite.title' | trans }}

49 |

{{ 'about.prerequisite.text1' | trans }}

50 |

{{ 'about.prerequisite.text2' | trans }} 51 |

    52 |
  • {{ 'about.prerequisite.php' | trans }}
  • 53 |
  • {{ 'about.prerequisite.server' | trans }}
  • 54 |
55 |   56 |
57 |
58 |
59 |
60 | 61 |
62 |
63 |
64 |
65 |

{{ 'about.confidentiality.title' | trans }}

66 |

{{ 'about.confidentiality.text1' | trans }}

67 |
68 |
69 |
70 |
71 | 72 | {% endblock %} -------------------------------------------------------------------------------- /app/views/datalea/config_file_form.html.twig: -------------------------------------------------------------------------------- 1 |

2 | {{ 'generator.form.configuration.description1'|trans({'%file%': 'datalea_config.xml'})|raw}}
3 | {{ 'generator.form.configuration.description2'|trans}} 4 |

5 | 6 |
7 | {% if form.vars.errors|length > 0 %} 8 |
9 | × 10 |
11 | {{ form_errors(form) }} 12 |
13 |
14 | {% endif %} 15 |
16 | {{ form_errors(form.configFile) }} 17 | {{ form_label(form.configFile) }} 18 | {{ form_widget(form.configFile) }} 19 | {{ form_rest(form) }} 20 | 21 |
22 |
23 | -------------------------------------------------------------------------------- /app/views/datalea/dump.html.twig: -------------------------------------------------------------------------------- 1 | {% extends "base.html.twig" %} 2 | 3 | {% set currentPage = 'dump' %} 4 | 5 | {% block body %} 6 | 7 | {% for format, fakeDump in dumps %} 8 |

{{ format|upper }}

9 |
10 | 
11 | {{ fakeDump }}
12 | 
13 | 
14 | {% endfor %} 15 | 16 | {% endblock %} 17 | -------------------------------------------------------------------------------- /app/views/datalea/form/fields.html.twig: -------------------------------------------------------------------------------- 1 | {% block datalea_generator_variable_config_widget %} 2 | {% spaceless %} 3 |
4 |
{{ form_row(form.name) }}
5 |
{{ form_row(form.fakerMethod) }}
6 |
7 |
8 |
{{ form_row(form.fakerMethodArg1) }}
9 |
{{ form_row(form.fakerMethodArg2) }}
10 |
{{ form_row(form.fakerMethodArg3) }}
11 |
12 | {% endspaceless %} 13 | {% endblock datalea_generator_variable_config_widget %} 14 | 15 | {% block datalea_generator_column_config_widget %} 16 | {% spaceless %} 17 |
18 |
{{ form_row(form.name) }}
19 |
{{ form_row(form.value) }}
20 |
{{ form_row(form.convertMethod) }}
21 |
{{ form_row(form.unique) }}
22 |
23 | {% endspaceless %} 24 | {% endblock datalea_generator_column_config_widget %} 25 | 26 | {% macro helpPopover(title, text, placement = 'top', trigger = 'hover') %} 27 | 28 | 29 | 30 | {% endmacro %} 31 | -------------------------------------------------------------------------------- /app/views/datalea/generate.html.twig: -------------------------------------------------------------------------------- 1 | {% extends "base.html.twig" %} 2 | 3 | {% set currentPage = 'generate' %} 4 | 5 | {% form_theme form 'datalea/form/fields.html.twig' %} 6 | 7 | {% block header_content %} 8 | 9 | {% include 'datalea/config_file_form.html.twig' with {'form': configFileForm} %} 10 | 11 | {% endblock header_content %} 12 | 13 | 14 | {% block main_body %} 15 | 16 |
17 | 18 | {% if form.vars.errors|length > 0 %} 19 |
20 |
21 | 22 |
23 | × 24 |
25 | {{ form_errors(form) }} 26 |
27 |
28 |
29 |
30 | {% endif %} 31 | 32 |
33 |
34 | {{ form_row(form.variableConfigs) }} 35 |
36 |
37 | 38 |
39 |
40 | {{ form_row(form.columnConfigs) }} 41 |
42 |
43 | 44 |
45 |
46 |
47 |
48 |
49 | {{ 'generator.form.settings.title' | trans }} 50 |
51 |
52 | {{ form_row(form.className) }} 53 |
54 |
55 | {{ form_row(form.locale) }} 56 |
57 |
58 |
59 |
60 | {{ form_row(form.seed) }} 61 |
62 |
63 | {{ form_row(form.fakeNumber) }} 64 |
65 |
66 |
67 |
68 | 69 |
70 |
71 | {{ 'generator.form.output.title' | trans }} 72 | {{ form_row(form.formats) }} 73 |

{{ 'generator.form.output.generator' | trans }}

74 |
75 |
76 |
77 |
78 |
79 |
80 | {{ 'generator.form.csv.title' | trans }} 81 |
82 |
83 |
84 |
85 | {{ form_row(form.csvFormat.encoding) }} 86 |
87 |
88 | {{ form_row(form.csvFormat.eol) }} 89 |
90 |
91 |
92 | 93 |
94 |
95 |
96 | {{ form_row(form.csvFormat.delimiter) }} 97 |
98 |
99 | {{ form_row(form.csvFormat.enclosure) }} 100 |
101 |
102 | {{ form_row(form.csvFormat.escape) }} 103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 | 111 |
112 | {{ form_rest(form) }} 113 |
114 |
115 | 116 |
117 | 120 |
121 |
122 |
123 | 124 | 125 | {% endblock %} 126 | 127 | {% block javascripts %} 128 | {{ parent() }} 129 | 210 | 211 | {% endblock %} 212 | -------------------------------------------------------------------------------- /app/views/datalea/introduction.html.twig: -------------------------------------------------------------------------------- 1 | {% extends "base.html.twig" %} 2 | 3 | {% set currentPage = 'introduction' %} 4 | {% set bodyId = currentPage %} 5 | 6 | {% block header_content %} 7 |
8 |
9 |
10 |

{{ 'introduction.title' | trans }}

11 |
12 |
13 |
14 | {% endblock header_content %} 15 | 16 | {% block main_body %} 17 | 18 |
19 |
20 |
21 | 22 |
23 | 24 |

{{ 'introduction.text1' | trans }}

25 |

{{ 'introduction.text2' | trans }}

26 |

{{ 'introduction.assets.text' | trans }}

27 |
    28 |
  • {{ 'introduction.assets.variables' | trans }}
  • 29 |
  • {{ 'introduction.assets.unicity' | trans }}
  • 30 |
  • {{ 'introduction.assets.config_variables' | trans }}
  • 31 |
32 |

{{ 'introduction.assets.note1' | trans }}

33 |
34 |
35 |
36 |
37 | 38 | {% endblock main_body %} -------------------------------------------------------------------------------- /app/views/datalea/tutorial.html.twig: -------------------------------------------------------------------------------- 1 | {% extends "base.html.twig" %} 2 | 3 | {% set currentPage = 'tutorial' %} 4 | {% set bodyId = currentPage %} 5 | 6 | {% block header_content %} 7 |
8 |
9 |

{{ 'tutorial.title' | trans }}

10 |
11 |
12 | {% endblock header_content %} 13 | 14 | {% block main_body %} 15 | 16 |
17 |
18 |
19 | 20 |
21 |

{{ 'tutorial.subtitle1' | trans }}

22 | 23 |
24 |
25 | 26 |

1

27 | 28 |

{{ 'tutorial.steps.1.text' | trans }}

29 |
    30 |
  • {{ 'tutorial.steps.1.column_firstname' | trans }}
  • 31 |
  • {{ 'tutorial.steps.1.column_lastname' | trans }}
  • 32 |
  • {{ 'tutorial.steps.1.column_email' | trans }}
  • 33 |
  • {{ 'tutorial.steps.1.column_login' | trans }}
  • 34 |
  • {{ 'tutorial.steps.1.column_login_password' | trans }}
  • 35 |
36 | 37 |

{{ 'tutorial.steps.1.note' | trans }}

38 |
39 | 40 |
41 |
42 |
43 | 44 | {{ 'tutorial.subtitle1' | trans }} 45 | 46 |
47 |
48 | 49 | {{ 'tutorial.subtitle1' | trans }} 50 | 51 |
52 |
53 | 54 | 55 |
56 |
57 | 58 |
59 | 60 |
61 |

2

62 |

{{ 'tutorial.steps.2.text' | trans }}

63 |
    64 |
  • {{ 'tutorial.steps.2.language' | trans }}
  • 65 |
  • {{ 'tutorial.steps.2.encode' | trans }}
  • 66 |
  • {{ 'tutorial.steps.2.variables' | trans }}
  • 67 |
68 |
69 |
70 | 71 | {{ 'tutorial.subtitle1' | trans }} 72 | 73 |
74 |
75 |
76 |
77 |
78 |
79 | 80 |
81 |
82 |
83 |
84 |
85 |

{{ 'tutorial.note1' | trans }}

86 |
87 |
88 |
89 |
90 |
91 | 92 |
93 |
94 |
95 | 96 |
97 | 98 |

{{ 'tutorial.text3' | trans }}

99 |

100 | {# [screenshot] #} 101 |

102 | 103 |

{{ 'tutorial.text4' | trans }}

104 | 105 |
106 | 107 |
108 |
109 |
110 | 111 | {% endblock %} 112 | -------------------------------------------------------------------------------- /app/views/twitter_bootstrap_form_layout.html.twig: -------------------------------------------------------------------------------- 1 | {# Symfony2 Twig Form theme for twitter bootstrap #} 2 | 3 | {% macro collection_item(form) %} 4 |
5 | 6 | {{ form_errors(form) }} 7 | {## 8 | {{ form_label(form) }} 9 | {##} 10 | {{ form_widget(form) }} 11 |
12 | {% endmacro %} 13 | 14 | {% block collection_row %} 15 | {% spaceless %} 16 |
17 | {{ block('collection_label') }} 18 |
19 | {{ block('collection_errors') }} 20 | {{ block('collection_widget') }} 21 |
22 |
23 | {% endspaceless %} 24 | {% endblock collection_row %} 25 | 26 | {% block collection_label %} 27 | {% spaceless %} 28 | {% if not compound %} 29 | {% set label_attr = label_attr|merge({'for': id}) %} 30 | {% endif %} 31 | {% if required %} 32 | {% set label_attr = label_attr|merge({'class': (label_attr.class|default('') ~ ' required')|trim}) %} 33 | {% endif %} 34 | {% if label is empty %} 35 | {% set label = name|humanize %} 36 | {% endif %} 37 | 38 | {{ label|trans({}, translation_domain)|raw }}{{ block('form_label_asterisk') }}{% if help_type == 'popover' %}{{ block('form_help') }}{% endif %} 39 | 40 | 41 | {% endspaceless %} 42 | {% endblock collection_label %} 43 | 44 | {% block collection_widget %} 45 | {% import _self as macros %} 46 | {% spaceless %} 47 |
48 | {% for child in form %} 49 | {{ macros.collection_item(child) }} 50 | {% endfor %} 51 |
52 | {##} 53 | {% endspaceless %} 54 | {% endblock collection_widget %} 55 | 56 | {% block form_errors %} 57 | {% spaceless %} 58 | {% if errors|length > 0 %} 59 | 60 |
    61 | {% for error in errors %} 62 |
  • {{ 63 | error.messagePluralization is null 64 | ? error.messageTemplate|trans(error.messageParameters, 'validators') 65 | : error.messageTemplate|transchoice(error.messagePluralization, error.messageParameters, 'validators') 66 | }}
  • 67 | {% endfor %} 68 |
69 |
70 | {% endif %} 71 | {% endspaceless %} 72 | {% endblock form_errors %} 73 | 74 | {% block form_label %} 75 | {% spaceless %} 76 | {% set default_classes = 'control-label ' ~ label_attr.class|default('') %} 77 | 78 | {% if not compound %} 79 | {% set label_attr = label_attr|merge({'for': id}) %} 80 | {% endif %} 81 | {% if required %} 82 | {% set label_attr = label_attr|merge({'class': (default_classes ~ 'required')|trim}) %} 83 | {% else %} 84 | {% set label_attr = label_attr|merge({'class': default_classes|trim}) %} 85 | {% endif %} 86 | {% if label is empty %} 87 | {% set label = name|humanize %} 88 | {% endif %} 89 | {{ label|trans({}, translation_domain)|raw }}{{ block('form_label_asterisk') }}{% if help_type == 'popover' %}{{ block('form_help') }}{% endif %} 90 | {% endspaceless %} 91 | {% endblock form_label %} 92 | 93 | {% block form_help %} 94 | {% spaceless %} 95 | {% if help is not empty %} 96 | {% if help_type == 'inline' or help_type == 'block' %} 97 | {{ help|raw| trans({}, translation_domain) }} 98 | {% elseif help_type == 'popover' %} 99 | 100 | 101 | 102 | {% endif %} 103 | {% endif %} 104 | {% endspaceless %} 105 | {% endblock form_help %} 106 | 107 | {% block form_label_asterisk %} 108 | {% spaceless %} 109 | {% if required and required_asterisk %}*{% endif %} 110 | {% endspaceless %} 111 | {% endblock form_label_asterisk %} 112 | 113 | {% block form_row %} 114 | {% spaceless %} 115 | {% set default_classes = 'control-group ' %} 116 | {% set row_attr = row_attr|merge({'class': (default_classes ~ row_attr.class|default(''))|trim}) %} 117 | {% if form.vars.errors|length > 0 %} 118 | {% set row_attr = row_attr|merge({'class': (default_classes ~ row_attr.class|default('') ~ ' error')|trim}) %} 119 | {% endif %} 120 |
121 | {{ form_label(form) }} 122 |
123 | {{ form_widget(form) }} 124 |
125 | {% if help_type == 'inline' or help_type== 'block' %}{{ block('form_help') }}{% endif %} 126 | {{ form_errors(form) }} 127 |
128 | {% endspaceless %} 129 | {% endblock form_row %} 130 | 131 | {% block choice_widget_expanded %} 132 | {% spaceless %} 133 |
134 | {% for child in form %} 135 | 139 | {% endfor %} 140 |
141 | {% endspaceless %} 142 | {% endblock choice_widget_expanded %} 143 | 144 | {% block widget_attributes %} 145 | {% spaceless %} 146 | id="{{ id }}" name="{{ full_name }}"{% if read_only %} readonly="readonly"{% endif %}{% if disabled %} disabled="disabled"{% endif %}{% if required %} required="required"{% endif %}{% if max_length %} maxlength="{{ max_length }}"{% endif %}{% if pattern %} pattern="{{ pattern }}"{% endif %} 147 | {% for attrname, attrvalue in attr %}{% if attrname not in ['inline'] %}{% if attrname in ['placeholder', 'title'] %}{{ attrname }}="{{ attrvalue|trans({}, translation_domain) }}" {% else %}{{ attrname }}="{{ attrvalue }}" {% endif %}{% endif %}{% endfor %} 148 | {% endspaceless %} 149 | {% endblock widget_attributes %} 150 | 151 | {% block widget_container_attributes %} 152 | {% spaceless %} 153 | {% if id is not empty %}id="{{ id }}" {% endif %} 154 | {% for attrname, attrvalue in attr %}{% if attrname not in ['inline'] %}{{ attrname }}="{{ attrvalue }}" {% endif %}{% endfor %} 155 | {% endspaceless %} 156 | {% endblock widget_container_attributes %} 157 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "spyrit/datalea", 3 | "description": "Spyrit Datalea Random Test Data Generator", 4 | "keywords": ["data", "generator", "random"], 5 | "authors": [ 6 | { 7 | "name": "Charles Sanquer", 8 | "email": "charles.sanquer@gmail.com", 9 | "role": "developer" 10 | }, 11 | { 12 | "name": "Maxime Corson", 13 | "email": "maxime.corson@spyrit.net", 14 | "role": "developer" 15 | } 16 | ], 17 | "license": "GPL-3.0+", 18 | "minimum-stability": "dev", 19 | "prefer-stable": true, 20 | "require": { 21 | "php": ">=5.3.3", 22 | "ext-mbstring": "*", 23 | "ext-SimpleXML": "*", 24 | "silex/silex": "~1.1", 25 | "silex/web-profiler": "~1.0", 26 | "symfony/web-profiler-bundle": "~2.3", 27 | "twig/twig": "~1.13", 28 | "twig/extensions": "~1.0", 29 | "symfony/twig-bridge": "~2.3", 30 | "symfony/form": "~2.3", 31 | "symfony/validator": "~2.3", 32 | "symfony/finder": "~2.3", 33 | "symfony/filesystem": "~2.3", 34 | "symfony/translation": "~2.3", 35 | "symfony/locale": "~2.3", 36 | "symfony/browser-kit": "~2.3", 37 | "symfony/class-loader": "~2.3", 38 | "symfony/css-selector": "~2.3", 39 | "symfony/console": "~2.3", 40 | "symfony/config": "~2.3", 41 | "symfony/yaml": "~2.3", 42 | "symfony/process": "~2.3", 43 | "symfony/security": "~2.3", 44 | "symfony/monolog-bridge": "~2.3", 45 | "spyrit/silex-utils": "dev-master", 46 | "fzaninotto/faker": "~1.1", 47 | "spyrit/light-csv": "~0.1", 48 | "CodePlex/PHPExcel": "~1.7" 49 | }, 50 | "suggest": { 51 | "php": ">=5.4.0" 52 | }, 53 | "autoload": { 54 | "psr-0": {"": "src/"} 55 | }, 56 | "config": { 57 | "bin-dir": "bin" 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /console: -------------------------------------------------------------------------------- 1 | app/console -------------------------------------------------------------------------------- /src/Spyrit/Datalea/Controller/MainControllerProvider.php: -------------------------------------------------------------------------------- 1 | 26 | */ 27 | class MainControllerProvider implements ControllerProviderInterface 28 | { 29 | public function connect(Application $app) 30 | { 31 | // creates a new controller based on the default route 32 | $controllers = $app['controllers_factory']; 33 | 34 | // controller name to use with method name (instead of using function closure for controller) 35 | $controller = 'Spyrit\Datalea\Controller\MainControllerProvider::'; 36 | 37 | $controllers 38 | ->get('/{_locale}', $controller.'homeAction') 39 | ->value('_locale', 'en') 40 | ->bind('datalea_homepage'); 41 | 42 | // set as many controllers as you want 43 | $controllers 44 | ->get('/{_locale}/about', $controller.'aboutAction') 45 | ->value('_locale', 'en') 46 | ->bind('datalea_about'); 47 | 48 | $controllers 49 | ->get('/{_locale}/tutorial', $controller.'tutorialAction') 50 | ->value('_locale', 'en') 51 | ->bind('datalea_tutorial'); 52 | 53 | $controllers 54 | ->get('/{_locale}/introduction', $controller.'introductionAction') 55 | ->value('_locale', 'en') 56 | ->bind('datalea_introduction'); 57 | 58 | // config form 59 | $controllers 60 | ->match('/{_locale}/generate', $controller.'generateAction') 61 | ->value('_locale', 'en') 62 | ->bind('datalea_generate'); //route name for use with url generator 63 | 64 | $controllers 65 | ->post('/{_locale}/load/config', $controller.'loadConfigAction') 66 | ->value('_locale', 'en') 67 | ->bind('datalea_load_config'); 68 | 69 | return $controllers; 70 | } 71 | 72 | public function homeAction(Request $request, Application $app) 73 | { 74 | return $app['twig']->render('datalea/index.html.twig', array()); 75 | } 76 | 77 | public function tutorialAction(Request $request, Application $app) 78 | { 79 | return $app['twig']->render('datalea/tutorial.html.twig', array()); 80 | } 81 | 82 | public function aboutAction(Request $request, Application $app) 83 | { 84 | return $app['twig']->render('datalea/about.html.twig', array()); 85 | } 86 | 87 | public function introductionAction(Request $request, Application $app) 88 | { 89 | return $app['twig']->render('datalea/introduction.html.twig', array()); 90 | } 91 | 92 | protected function setUserExampleConfig(Config $config) 93 | { 94 | $config->setClassname('User'); 95 | $config->setFakeNumber(100); 96 | $config->setLocale('fr_FR'); 97 | $config->setFormats(array('xml', 'yaml', 'json', 'sql', 'csv', 'php', 'perl', 'python', 'ruby')); 98 | 99 | $var1 = new VariableConfig('lastname', 'lastName'); 100 | $var2 = new VariableConfig('firstname', 'firstName'); 101 | $var3 = new VariableConfig('email_domain', 'safeEmailDomain'); 102 | $var4 = new VariableConfig('birth_date', 'dateTimeThisCentury'); 103 | 104 | $config->addVariableConfig($var1); 105 | $config->addVariableConfig($var2); 106 | $config->addVariableConfig($var3); 107 | $config->addVariableConfig($var4); 108 | $config->addColumnConfig(new ColumnConfig($var1->getName(), $var1->getVarName())); 109 | $config->addColumnConfig(new ColumnConfig($var2->getName(), $var2->getVarName())); 110 | $config->addColumnConfig(new ColumnConfig('username', $var1->getVarName().'.'.$var2->getVarName(), 'remove_accents_lowercase', true)); 111 | $config->addColumnConfig(new ColumnConfig('email', $var1->getVarName().'.'.$var2->getVarName().'@'.$var3->getVarName(), 'remove_accents_lowercase', true)); 112 | $config->addColumnConfig(new ColumnConfig($var4->getName(), $var4->getVarName())); 113 | } 114 | 115 | protected function setDefaultConfig(Config $config) 116 | { 117 | $config->setClassname(''); 118 | $config->setFakeNumber(10); 119 | $config->setFormats(array('csv')); 120 | 121 | $var1 = new VariableConfig('text1', 'text'); 122 | 123 | $config->addVariableConfig($var1); 124 | $config->addColumnConfig(new ColumnConfig($var1->getName(), $var1->getVarName())); 125 | } 126 | 127 | public function loadConfigAction(Request $request, Application $app) 128 | { 129 | $configFileForm = $app['form.factory']->create(new ConfigFileType()); 130 | 131 | if ('POST' == $request->getMethod()) { 132 | $configFileForm->bindRequest($request); 133 | 134 | if ($configFileForm->isValid()) { 135 | $data = $configFileForm->getData(); 136 | $loader = new Loader(); 137 | $config = $loader->loadXmlFakerConfig($data['configFile']->getPathname()); 138 | } 139 | } 140 | 141 | if (!isset($config) || !$config instanceof Config) { 142 | $config = new Config(); 143 | $this->setDefaultConfig($config); 144 | } 145 | 146 | $configForm = $app['form.factory']->create(new ConfigType(), $config, array( 147 | 'max_variables' => $app['datalea']['max_variables'], 148 | 'max_columns' => $app['datalea']['max_columns'], 149 | 'max_rows' => $app['datalea']['max_rows'], 150 | )); 151 | 152 | $fakerMethods = FakerMethodCollection::createDefaultCollection(); 153 | 154 | return $app['twig']->render('datalea/generate.html.twig', array( 155 | 'form' => $configForm->createView(), 156 | 'fakerMethods' => $fakerMethods->toArray(), 157 | 'fakerMethodsCulture' => $fakerMethods->getMethodsByCulture(), 158 | 'configFileForm' => $configFileForm->createView(), 159 | )); 160 | } 161 | 162 | public function generateAction(Request $request, Application $app) 163 | { 164 | $configFileForm = $app['form.factory']->create(new ConfigFileType()); 165 | 166 | $config = new Config(); 167 | 168 | if ('GET' == $request->getMethod()) { 169 | if ($request->get('reset', 0) != 1) { 170 | $this->setUserExampleConfig($config); 171 | } else { 172 | $this->setDefaultConfig($config); 173 | } 174 | } 175 | 176 | $configForm = $app['form.factory']->create(new ConfigType(), $config, array( 177 | 'max_variables' => $app['datalea']['max_variables'], 178 | 'max_columns' => $app['datalea']['max_columns'], 179 | 'max_rows' => $app['datalea']['max_rows'], 180 | )); 181 | 182 | if ('POST' == $request->getMethod()) { 183 | $configForm->submit($request); 184 | 185 | if ($configForm->isValid()) { 186 | $config = $configForm->getData(); 187 | $config->generateColumns(); 188 | $date = new DateTime(); 189 | 190 | $dumper = new Dumper($config); 191 | $file = $dumper->dump(realpath(sys_get_temp_dir()).DS.'Datalea', $date); 192 | $stream = function () use ($file) { 193 | readfile($file); 194 | }; 195 | 196 | return $app->stream($stream, 200, array( 197 | 'Content-Description' => 'File Transfer', 198 | 'Content-Type' => 'application/zip', 199 | 'Content-Disposition' => 'attachment; filename=datalea_'.$config->getClassNameLastPart().'_'.$date->format('Y-m-d_H-i-s').'.zip', 200 | 'Content-Transfer-Encoding' => 'binary', 201 | 'Content-Length' => filesize($file), 202 | )); 203 | } 204 | } 205 | 206 | $fakerMethods = FakerMethodCollection::createDefaultCollection(); 207 | 208 | // display the form 209 | return $app['twig']->render('datalea/generate.html.twig', array( 210 | 'form' => $configForm->createView(), 211 | 'fakerMethods' => $fakerMethods->toArray(), 212 | 'fakerMethodsCulture' => $fakerMethods->getMethodsByCulture(), 213 | 'configFileForm' => $configFileForm->createView(), 214 | )); 215 | } 216 | } 217 | -------------------------------------------------------------------------------- /src/Spyrit/Datalea/Faker/Dump/CdataSimpleXMLElement.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | class CdataSimpleXMLElement extends \SimpleXMLElement 11 | { 12 | /** 13 | * Add CDATA text in a node 14 | * @param string $cdata_text The CDATA value to add 15 | */ 16 | public function addCData($cdataText) 17 | { 18 | $node = dom_import_simplexml($this); 19 | $no = $node->ownerDocument; 20 | $node->appendChild($no->createCDATASection($cdataText)); 21 | } 22 | 23 | /** 24 | * Create a child with CDATA value 25 | * @param string $name The name of the child element to add. 26 | * @param string $cdata_text The CDATA value of the child element. 27 | * 28 | * @return CdataSimpleXMLElement child element 29 | */ 30 | public function addChildCData($name, $cdataText) 31 | { 32 | $child = $this->addChild($name); 33 | $child->addCData($cdataText); 34 | 35 | return $child; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/Spyrit/Datalea/Faker/Dump/Loader.php: -------------------------------------------------------------------------------- 1 | 14 | */ 15 | class Loader 16 | { 17 | /** 18 | * 19 | * @param string $file filename 20 | * @return Config 21 | */ 22 | public function loadXmlFakerConfig($file) 23 | { 24 | $root = simplexml_load_file($file, '\\Spyrit\\Datalea\\Faker\\Dump\\CdataSimpleXMLElement', LIBXML_NOCDATA); 25 | 26 | $config = new Config(); 27 | if (isset($root['classname'])) { 28 | $config->setClassName((string) $root['classname']); 29 | } 30 | if (isset($root['fakenumber'])) { 31 | $config->setFakeNumber((string) $root['fakenumber']); 32 | } 33 | if (isset($root['locale'])) { 34 | $config->setLocale((string) $root['locale']); 35 | } 36 | if (isset($root['seed'])) { 37 | $config->setSeed((string) $root['seed']); 38 | } 39 | 40 | if (isset($root->formats->format)) { 41 | $config->setFormats((array) $root->formats->format); 42 | } 43 | 44 | if (isset($root->formatOptions)) { 45 | if (isset($root->formatOptions->csv)) { 46 | $config->setCsvFormat(new CsvFormat( 47 | (string) $root->formatOptions->csv->delimiter, 48 | (string) $root->formatOptions->csv->enclosure, 49 | (string) $root->formatOptions->csv->encoding, 50 | (string) $root->formatOptions->csv->eol, 51 | (string) $root->formatOptions->csv->escape 52 | )); 53 | } 54 | } 55 | 56 | if (isset($root->variables->variable)) { 57 | foreach ($root->variables->variable as $variable) { 58 | $variableConfig = new VariableConfig(); 59 | $variableConfig->setName($variable['name']); 60 | $variableConfig->setFakerMethod((string) $variable->method); 61 | $variableConfig->setFakerMethodArg1((string) $variable->argument1); 62 | $variableConfig->setFakerMethodArg2((string) $variable->argument2); 63 | $variableConfig->setFakerMethodArg3((string) $variable->argument3); 64 | $config->addVariableConfig($variableConfig); 65 | } 66 | } 67 | 68 | if (isset($root->columns->column)) { 69 | foreach ($root->columns->column as $column) { 70 | $columnConfig = new ColumnConfig(); 71 | $columnConfig->setName($column['name']); 72 | $columnConfig->setUnique(!empty($column['unique'])); 73 | $columnConfig->setValue((string) $column->value); 74 | $columnConfig->setConvertMethod((string) $column->convert); 75 | $config->addColumnConfig($columnConfig); 76 | } 77 | } 78 | return $config; 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /src/Spyrit/Datalea/Faker/Model/CsvFormat.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | class CsvFormat 11 | { 12 | /** 13 | * 14 | * @var string 15 | */ 16 | protected $eol; 17 | 18 | /** 19 | * 20 | * @var string 21 | */ 22 | protected $encoding; 23 | 24 | /** 25 | * 26 | * @var string 27 | */ 28 | protected $enclosure; 29 | 30 | /** 31 | * 32 | * @var string 33 | */ 34 | protected $escape; 35 | 36 | /** 37 | * 38 | * @var string 39 | */ 40 | protected $delimiter; 41 | 42 | /** 43 | * 44 | * @param string $delimiter 45 | * @param string $enclosure 46 | * @param string $encoding 47 | * @param string $eol 48 | * @param string $escape 49 | */ 50 | public function __construct($delimiter = ';', $enclosure = '"', $encoding = 'WINDOWS-1252', $eol = 'windows', $escape = "\\") 51 | { 52 | $this->setDelimiter($delimiter); 53 | $this->setEnclosure($enclosure); 54 | $this->setEncoding($encoding); 55 | $this->setEol($eol); 56 | $this->setEscape($escape); 57 | } 58 | 59 | public static function getAvailableEols() 60 | { 61 | return array( 62 | 'windows' => 'windows', 63 | 'unix' => 'unix', 64 | ); 65 | } 66 | 67 | public static function getAvailableEncodings() 68 | { 69 | return array( 70 | 'WINDOWS-1252' => 'WINDOWS-1252', 71 | 'ISO_8859-1' => 'ISO_8859-1', 72 | 'ISO_8859-15' => 'ISO_8859-15', 73 | 'UTF-8' => 'UTF-8', 74 | ); 75 | } 76 | 77 | public function getEol() 78 | { 79 | return $this->eol; 80 | } 81 | 82 | public function setEol($eol) 83 | { 84 | $this->eol = in_array($eol, self::getAvailableEols()) ? $eol : 'windows' ; 85 | 86 | return $this; 87 | } 88 | 89 | public function getEncoding() 90 | { 91 | return $this->encoding; 92 | } 93 | 94 | public function setEncoding($encoding) 95 | { 96 | $this->encoding = in_array($encoding, self::getAvailableEncodings()) ? $encoding : 'WINDOWS-1252' ; 97 | $this->encoding = $encoding; 98 | 99 | return $this; 100 | } 101 | 102 | public function getEnclosure() 103 | { 104 | return $this->enclosure; 105 | } 106 | 107 | public function setEnclosure($enclosure) 108 | { 109 | $this->enclosure = $enclosure; 110 | 111 | return $this; 112 | } 113 | 114 | public function getEscape() 115 | { 116 | return $this->escape; 117 | } 118 | 119 | public function setEscape($escape) 120 | { 121 | $this->escape = $escape; 122 | 123 | return $this; 124 | } 125 | 126 | public function getDelimiter() 127 | { 128 | return $this->delimiter; 129 | } 130 | 131 | public function setDelimiter($delimiter) 132 | { 133 | $this->delimiter = $delimiter; 134 | 135 | return $this; 136 | } 137 | } 138 | -------------------------------------------------------------------------------- /src/Spyrit/Datalea/Faker/Model/FakerMethod.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | class FakerMethod 11 | { 12 | /** 13 | * 14 | * @var string 15 | */ 16 | protected $provider; 17 | 18 | /** 19 | * 20 | * @var string 21 | */ 22 | protected $method; 23 | 24 | /** 25 | * 26 | * @var array 27 | */ 28 | protected $cultures = array(); 29 | 30 | /** 31 | * 32 | * @var array 33 | */ 34 | protected $examples = array(); 35 | 36 | /** 37 | * 38 | * @var array 39 | */ 40 | protected $arguments = array(); 41 | 42 | /** 43 | * 44 | * @param string $provider 45 | * @param string $method 46 | * @param array|string $cultures 47 | * @param array|string $arguments 48 | * @param array|string $examples 49 | */ 50 | public function __construct($provider, $method, $cultures = array(), $arguments = array(), $examples = array()) 51 | { 52 | $this->setProvider($provider); 53 | $this->setCultures($cultures); 54 | $this->setMethod($method); 55 | $this->setExamples($examples); 56 | $this->setArguments($arguments); 57 | } 58 | 59 | /** 60 | * 61 | * @return string 62 | */ 63 | public function getProvider() 64 | { 65 | return $this->provider; 66 | } 67 | 68 | /** 69 | * 70 | * @param string $provider 71 | * @return \Spyrit\Datalea\Faker\Model\FakerMethod 72 | */ 73 | public function setProvider($provider) 74 | { 75 | $this->provider = $provider; 76 | 77 | return $this; 78 | } 79 | 80 | /** 81 | * 82 | * @return array 83 | */ 84 | public function getCultures() 85 | { 86 | return $this->cultures; 87 | } 88 | 89 | /** 90 | * 91 | * @param array|string $cultures 92 | * @return \Spyrit\Datalea\Faker\Model\FakerMethod 93 | */ 94 | public function setCultures($cultures) 95 | { 96 | $cultures = empty($cultures) ? array() : $cultures; 97 | $this->cultures = is_array($cultures) ? $cultures : array($cultures); 98 | 99 | return $this; 100 | } 101 | 102 | /** 103 | * 104 | * @return string 105 | */ 106 | public function getMethod() 107 | { 108 | return $this->method; 109 | } 110 | 111 | /** 112 | * 113 | * @param string $method 114 | * @return \Spyrit\Datalea\Faker\Model\FakerMethod 115 | */ 116 | public function setMethod($method) 117 | { 118 | $this->method = $method; 119 | 120 | return $this; 121 | } 122 | 123 | /** 124 | * 125 | * @return array 126 | */ 127 | public function getExamples() 128 | { 129 | return $this->examples; 130 | } 131 | 132 | /** 133 | * 134 | * @param array|string $cultures 135 | * @return \Spyrit\Datalea\Faker\Model\FakerMethod 136 | */ 137 | public function setExamples($examples) 138 | { 139 | $examples = empty($examples) ? array() : $examples; 140 | $this->examples = is_array($examples) ? $examples : array($examples); 141 | 142 | return $this; 143 | } 144 | 145 | /** 146 | * 147 | * @return array 148 | */ 149 | public function getArguments() 150 | { 151 | return $this->arguments; 152 | } 153 | 154 | /** 155 | * 156 | * @param array|string $cultures 157 | * @return \Spyrit\Datalea\Faker\Model\FakerMethod 158 | */ 159 | public function setArguments($arguments) 160 | { 161 | $arguments = empty($arguments) ? array() : $arguments; 162 | $this->arguments = is_array($arguments) ? $arguments : array($arguments); 163 | 164 | return $this; 165 | } 166 | 167 | /** 168 | * 169 | * @return string 170 | */ 171 | public function getMethodForSelect() 172 | { 173 | $cultures = array(); 174 | $availablesCultures = array_keys(FakerMethodCollection::getAvailableFakerCulture()); 175 | foreach ($this->cultures as $culture) { 176 | if (in_array($culture, $availablesCultures)) { 177 | $cultures[] = $culture; 178 | } 179 | } 180 | 181 | $args = array(); 182 | foreach ($this->getArguments() as $arg => $default) { 183 | $args[] = $arg.' = '.$default; 184 | } 185 | $result = $this->getMethod(). 186 | (!empty($args) ? '('.implode(', ', $args).')' : ''). 187 | (!empty($this->examples) ? ' // '.implode(', ', $this->examples).'' : ''). 188 | (!empty($cultures) ? ' // ('.implode(', ', $cultures).')' : '') 189 | ; 190 | 191 | return $result; 192 | } 193 | } 194 | -------------------------------------------------------------------------------- /src/Spyrit/Datalea/Faker/Model/UniqueTuple.php: -------------------------------------------------------------------------------- 1 | 12 | */ 13 | class UniqueTuple 14 | { 15 | /** 16 | * 17 | * @var ColumnConfig 18 | */ 19 | protected $columnConfig; 20 | 21 | /** 22 | * 23 | * @var array of \Spyrit\Datalea\Faker\Model\VariableConfig 24 | */ 25 | protected $variableConfigs; 26 | 27 | /** 28 | * 29 | * @var array 30 | */ 31 | protected $values = array(); 32 | 33 | /** 34 | * 35 | * @param ColumnConfig $columnConfig 36 | * @param array $variableConfigs 37 | */ 38 | public function __construct(ColumnConfig $columnConfig, array $variableConfigs = array()) 39 | { 40 | $this->setColumnConfig($columnConfig); 41 | $this->setVariableConfigs($variableConfigs); 42 | } 43 | 44 | /** 45 | * 46 | * @return ColumnConfig 47 | */ 48 | public function getColumnConfig() 49 | { 50 | return $this->columnConfig; 51 | } 52 | 53 | /** 54 | * 55 | * @param ColumnConfig $columnConfig 56 | * @return UniqueTuple 57 | */ 58 | public function setColumnConfig(ColumnConfig $columnConfig) 59 | { 60 | $this->columnConfig = $columnConfig; 61 | 62 | return $this; 63 | } 64 | 65 | /** 66 | * 67 | * @return array of \Spyrit\Datalea\Faker\Model\VariableConfig 68 | */ 69 | public function getVariableConfigs() 70 | { 71 | return $this->variableConfigs; 72 | } 73 | 74 | /** 75 | * 76 | * @param array of \Spyrit\Datalea\Faker\Model\VariableConfig $variableConfigs 77 | * @return UniqueTuple 78 | */ 79 | public function setVariableConfigs(array $variableConfigs) 80 | { 81 | $this->variableConfigs = $variableConfigs; 82 | 83 | return $this; 84 | } 85 | 86 | /** 87 | * 88 | * @param array $values 89 | * @return boolean 90 | */ 91 | public function areValuesUniques(array $values) 92 | { 93 | $valuesToCheck = array(); 94 | foreach ($this->variableConfigs as $variableConfig) { 95 | if (isset($values[$variableConfig->getName()])) { 96 | $valuesToCheck[] = $values[$variableConfig->getName()]; 97 | } 98 | } 99 | 100 | $valuesToCheckString = implode('-', $valuesToCheck); 101 | if (!in_array($valuesToCheckString, $this->values)) { 102 | $this->values[] = $valuesToCheckString; 103 | 104 | return true; 105 | } else { 106 | return false; 107 | } 108 | } 109 | } 110 | -------------------------------------------------------------------------------- /src/Spyrit/Datalea/Faker/Model/UniqueTupleCollection.php: -------------------------------------------------------------------------------- 1 | 11 | */ 12 | class UniqueTupleCollection 13 | { 14 | /** 15 | * 16 | * @var array of \Spyrit\Datalea\Faker\Model\UniqueTuple 17 | */ 18 | protected $uniqueTuples = array(); 19 | 20 | public function __construct(array $uniqueTuples = array()) 21 | { 22 | $this->uniqueTuples = $uniqueTuples; 23 | } 24 | 25 | public function getUniqueTuples() 26 | { 27 | return $this->uniqueTuples; 28 | } 29 | 30 | public function setUniqueTuples($uniqueTuples) 31 | { 32 | $this->uniqueTuples = $uniqueTuples; 33 | 34 | return $this; 35 | } 36 | 37 | public function addUniqueTuple(UniqueTuple $uniqueTuple) 38 | { 39 | $this->uniqueTuples[$uniqueTuple->getColumnConfig()->getName()] = $uniqueTuple; 40 | 41 | return $this; 42 | } 43 | 44 | public function hasUniqueTuple($name) 45 | { 46 | return isset($this->uniqueTuples[$name]); 47 | } 48 | 49 | public function getUniqueTuple($name) 50 | { 51 | return $this->hasUniqueTuple($name) ? $this->uniqueTuples[$name] : null; 52 | } 53 | 54 | /** 55 | * 56 | * @param \Faker\Generator $faker 57 | * @param array $values 58 | * @param array $variableConfigs 59 | */ 60 | public function unDuplicateValues(Generator $faker, array &$values, array $variableConfigs) 61 | { 62 | $try = 0; 63 | do { 64 | $try++; 65 | $allUniques = true; 66 | 67 | $uniqueTuplesToRegenerate = array(); 68 | foreach ($this->uniqueTuples as $name => $uniqueTuple) { 69 | if (!$uniqueTuple->areValuesUniques($values)) { 70 | $uniqueTuplesToRegenerate[$name] = $uniqueTuple; 71 | $allUniques = false; 72 | } 73 | } 74 | 75 | $variableConfigsToRegenerate = array(); 76 | foreach ($uniqueTuplesToRegenerate as $name => $uniqueTuple) { 77 | foreach ($uniqueTuple->getVariableConfigs() as $name => $variableConfig) { 78 | $variableConfigsToRegenerate[$name] = $variableConfig; 79 | } 80 | } 81 | 82 | $useIncrement = $try > 10; 83 | 84 | foreach ($variableConfigsToRegenerate as $name => $variableConfig) { 85 | $variableConfig->generateValue($faker, $values, $variableConfigs, true, $useIncrement, false); 86 | } 87 | } while (!$allUniques); 88 | } 89 | 90 | } 91 | -------------------------------------------------------------------------------- /src/Spyrit/Datalea/Form/Type/ColumnConfigType.php: -------------------------------------------------------------------------------- 1 | 15 | */ 16 | class ColumnConfigType extends AbstractType 17 | { 18 | public function buildForm(FormBuilderInterface $builder, array $options) 19 | { 20 | $convertMethods = ColumnConfig::getAvailableConvertMethods(); 21 | 22 | $builder 23 | ->add('name', 'text', array( 24 | 'required' => true, 25 | 'label' => 'generator.form.columns.name', 26 | 'help' => 'generator.form.columns.name_help', 27 | 'help_type' => 'popover', 28 | 'help_popover_position' => 'right', 29 | 'attr' => array( 30 | // 'style' => 'width: 95%', 31 | ), 32 | 'row_attr' => array( 33 | 'class' => 'name', 34 | ), 35 | 'constraints' => array( 36 | new Constraints\NotBlank(), 37 | new Constraints\Length(array('min' => 3)), 38 | ) 39 | )) 40 | ->add('value', 'text', array( 41 | 'required' => true, 42 | 'label' => 'generator.form.columns.value', 43 | 'help' => 'generator.form.columns.value_help', 44 | 'help_type' => 'popover', 45 | 'attr' => array( 46 | // 'style' => 'width: 95%', 47 | ), 48 | 'row_attr' => array( 49 | 'class' => 'value', 50 | ), 51 | 'constraints' => array( 52 | new Constraints\NotBlank(), 53 | new Constraints\Length(array('min' => 1)), 54 | ) 55 | )) 56 | ->add('convertMethod', 'choice', array( 57 | 'required' => false, 58 | 'empty_value' => '', 59 | 'label' => 'generator.form.columns.convert', 60 | 'help' => 'generator.form.columns.convert_help', 61 | 'help_type' => 'popover', 62 | 'choices' => $convertMethods, 63 | 'attr' => array( 64 | 'class' => 'select2-empty-box', 65 | 'style' => 'width: 100%', 66 | ), 67 | 'row_attr' => array( 68 | 'class' => 'convert-method', 69 | ), 70 | 'constraints' => array( 71 | new Constraints\Choice(array( 72 | 'choices' => array_keys($convertMethods), 73 | )), 74 | ) 75 | )) 76 | ->add('unique', 'checkbox', array( 77 | 'required' => false, 78 | 'label' => 'generator.form.columns.unique', 79 | 'help' => 'generator.form.columns.unique_help', 80 | 'help_type' => 'popover', 81 | 'help_popover_position' => 'top', 82 | 'attr' => array( 83 | 'style' => 'width: 95%', 84 | ), 85 | 'row_attr' => array( 86 | 'class' => 'unique', 87 | ), 88 | )) 89 | ; 90 | } 91 | 92 | /** 93 | * {@inheritdoc} 94 | */ 95 | public function setDefaultOptions(OptionsResolverInterface $resolver) 96 | { 97 | $resolver->setDefaults(array( 98 | 'data_class' => 'Spyrit\Datalea\Faker\Model\ColumnConfig', 99 | )); 100 | } 101 | 102 | public function getName() 103 | { 104 | return 'datalea_generator_column_config'; 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /src/Spyrit/Datalea/Form/Type/ConfigFileType.php: -------------------------------------------------------------------------------- 1 | 14 | */ 15 | class ConfigFileType extends AbstractType 16 | { 17 | public function buildForm(FormBuilderInterface $builder, array $options) 18 | { 19 | $builder 20 | ->add('configFile', 'file', array( 21 | 'required' => true, 22 | 'label' => 'generator.form.configuration.file', 23 | 'help' => 'generator.form.configuration.file_help', 24 | 'help_type' => 'popover', 25 | 'help_popover_position' => 'right', 26 | 'constraints' => array( 27 | new Constraints\File(array( 28 | 'maxSize' => '1024k', 29 | 'mimeTypes' => array( 30 | 'text/xml', 31 | 'application/xml', 32 | ), 33 | 'mimeTypesMessage' => 'Please upload a valid XML config file', 34 | )) 35 | ) 36 | )) 37 | ; 38 | } 39 | 40 | /** 41 | * {@inheritdoc} 42 | */ 43 | public function setDefaultOptions(OptionsResolverInterface $resolver) 44 | { 45 | $resolver->setDefaults(array( 46 | )); 47 | } 48 | 49 | public function getName() 50 | { 51 | return 'datalea_generator_config_file'; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/Spyrit/Datalea/Form/Type/ConfigType.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | class ConfigType extends AbstractType 18 | { 19 | public function buildForm(FormBuilderInterface $builder, array $options) 20 | { 21 | $locales = FakerMethodCollection::getAvailableFakerCulture(); 22 | $formats = Dumper::getAvailableFormats(); 23 | 24 | $builder 25 | ->add('className', 'text', array( 26 | 'required' => true, 27 | 'label' => 'generator.form.settings.class', 28 | 'help' => 'generator.form.settings.class_help', 29 | 'help_type' => 'popover', 30 | 'help_popover_position' => 'right', 31 | 'attr' => array( 32 | 'style' => 'width: 95%', 33 | ), 34 | 'row_attr' => array( 35 | 'class' => '', 36 | ), 37 | 'constraints' => array( 38 | new Constraints\NotBlank(), 39 | new Constraints\Length(array('min' => 3)), 40 | ) 41 | )) 42 | ->add('locale', 'choice', array( 43 | 'required' => true, 44 | 'label' => 'generator.form.settings.language', 45 | 'choices' => $locales, 46 | 'preferred_choices' => array('fr_FR', 'en_US', 'en_GB', ), 47 | 'attr' => array( 48 | 'class' => 'select2-box', 49 | 'style' => 'width: 95%', 50 | ), 51 | 'row_attr' => array( 52 | 'class' => '', 53 | ), 54 | 'constraints' => array( 55 | new Constraints\Choice(array( 56 | 'choices' => array_keys($locales), 57 | )), 58 | ) 59 | )) 60 | ->add('seed', 'integer', array( 61 | 'required' => false, 62 | 'label' => 'generator.form.settings.seed', 63 | 'help' => 'generator.form.settings.seed_help', 64 | 'help_type' => 'popover', 65 | 'help_popover_position' => 'right', 66 | 'attr' => array( 67 | 'style' => 'width: 95%', 68 | ), 69 | 'row_attr' => array( 70 | 'class' => '', 71 | ), 72 | 'constraints' => array( 73 | new Constraints\Type('integer'), 74 | new Constraints\Range(array('min' => 0, 'max' => 50000)), 75 | ) 76 | )) 77 | ->add('fakeNumber', 'integer', array( 78 | 'required' => true, 79 | 'label' => 'generator.form.settings.row_number', 80 | 'help' => 'generator.form.settings.row_number_help', 81 | 'help_type' => 'popover', 82 | 'attr' => array( 83 | 'style' => 'width: 95%', 84 | ), 85 | 'row_attr' => array( 86 | 'class' => '', 87 | ), 88 | 'constraints' => array( 89 | new Constraints\Type('integer'), 90 | new Constraints\Range(array('min' => 1, 'max' => $options['max_rows'])), 91 | ) 92 | )) 93 | ->add('variableConfigs', 'collection', array( 94 | // 'required' => false, 95 | 'label' => 'generator.form.variables.title', 96 | 'type' => new VariableConfigType(), 97 | 'prototype' => true, 98 | 'allow_add' => true, 99 | 'allow_delete' => true, 100 | 'by_reference' => false, 101 | 'options' => array( 102 | // 'required' => false, 103 | ), 104 | 'constraints' => array( 105 | new Constraints\Count(array( 106 | 'min' => 1, 107 | 'max' => $options['max_variables'], 108 | 'minMessage' => 'You must set {{ limit }} variable(s) or more.', 109 | 'maxMessage' => 'You must set {{ limit }} variable(s) or less.', 110 | 'exactMessage' => 'You must set exactly {{ limit }} variable(s).', 111 | )), 112 | ) 113 | 114 | )) 115 | ->add('columnConfigs', 'collection', array( 116 | // 'required' => false, 117 | 'label' => 'generator.form.columns.title', 118 | 'type' => new ColumnConfigType(), 119 | 'prototype' => true, 120 | 'allow_add' => true, 121 | 'allow_delete' => true, 122 | 'by_reference' => false, 123 | 'options' => array( 124 | // 'required' => false, 125 | ), 126 | 'constraints' => array( 127 | new Constraints\Count(array( 128 | 'min' => 0, 129 | 'max' => $options['max_columns'], 130 | 'minMessage' => 'You must set {{ limit }} column(s) or more.', 131 | 'maxMessage' => 'You must set {{ limit }} column(s) or less.', 132 | 'exactMessage' => 'You must set exactly {{ limit }} column(s).', 133 | )), 134 | ) 135 | 136 | )) 137 | ->add('formats', 'choice', array( 138 | 'required' => true, 139 | 'multiple' => true, 140 | 'expanded' => true, 141 | 'label' => 'generator.form.output.formats', 142 | 'help' => 'generator.form.output.formats_help', 143 | 'help_type' => 'popover', 144 | 'attr' => array( 145 | 'inline' => true, 146 | ), 147 | 'choices' => $formats, 148 | 'constraints' => array( 149 | new Constraints\Count(array( 150 | 'min' => 1, 151 | 'max' => count($formats), 152 | 'minMessage' => 'You must set {{ limit }} format(s) or more.', 153 | 'maxMessage' => 'You must set {{ limit }} format(s) or less.', 154 | 'exactMessage' => 'You must set exactly {{ limit }} format(s).', 155 | )), 156 | new Constraints\Choice(array( 157 | 'choices' => array_keys($formats), 158 | 'multiple' => true, 159 | )), 160 | ) 161 | )) 162 | ->add('csvFormat', new CsvFormatType(), array( 163 | 'label' => 'CSV options', 164 | )); 165 | ; 166 | } 167 | 168 | /** 169 | * {@inheritdoc} 170 | */ 171 | public function setDefaultOptions(OptionsResolverInterface $resolver) 172 | { 173 | $resolver 174 | ->setDefaults(array( 175 | 'data_class' => 'Spyrit\Datalea\Faker\Model\Config', 176 | 'cascade_validation' => true, 177 | 'max_variables' => 100, 178 | 'max_columns' => 80, 179 | 'max_rows' => 2000, 180 | )) 181 | ->setAllowedTypes(array( 182 | 'max_variables' => array('int'), 183 | 'max_columns' => array('int'), 184 | 'max_rows' => array('int'), 185 | )) 186 | ; 187 | } 188 | 189 | public function getName() 190 | { 191 | return 'datalea_generator_config'; 192 | } 193 | } 194 | -------------------------------------------------------------------------------- /src/Spyrit/Datalea/Form/Type/CsvFormatType.php: -------------------------------------------------------------------------------- 1 | 15 | */ 16 | class CsvFormatType extends AbstractType 17 | { 18 | public function buildForm(FormBuilderInterface $builder, array $options) 19 | { 20 | $eols = CsvFormat::getAvailableEols(); 21 | $encodings = CsvFormat::getAvailableEncodings(); 22 | 23 | $builder 24 | ->add('delimiter', 'text', array( 25 | 'required' => true, 26 | 'label' => 'generator.form.csv.delimiter', 27 | // 'help' => '', 28 | // 'help_type' => 'popover', 29 | // 'help_popover_position' => 'right', 30 | 'attr' => array( 31 | 'class' => 'input-mini', 32 | ), 33 | 'row_attr' => array( 34 | 'class' => '', 35 | ), 36 | 'constraints' => array( 37 | new Constraints\NotBlank(), 38 | new Constraints\Length(array('min' => 1, 'max' => 1)), 39 | ) 40 | )) 41 | ->add('enclosure', 'text', array( 42 | 'required' => true, 43 | 'label' => 'generator.form.csv.enclosure', 44 | // 'help' => '', 45 | // 'help_type' => 'popover', 46 | // 'help_popover_position' => 'top', 47 | 'attr' => array( 48 | 'class' => 'input-mini', 49 | ), 50 | 'row_attr' => array( 51 | 'class' => '', 52 | ), 53 | 'constraints' => array( 54 | new Constraints\NotBlank(), 55 | new Constraints\Length(array('min' => 1, 'max' => 1)), 56 | ) 57 | )) 58 | ->add('escape', 'text', array( 59 | 'required' => true, 60 | 'label' => 'generator.form.csv.escape', 61 | // 'help' => '', 62 | // 'help_type' => 'popover', 63 | // 'help_popover_position' => 'top', 64 | 'attr' => array( 65 | 'class' => 'input-mini', 66 | ), 67 | 'row_attr' => array( 68 | 'class' => '', 69 | ), 70 | 'constraints' => array( 71 | new Constraints\NotBlank(), 72 | new Constraints\Length(array('min' => 1, 'max' => 1)), 73 | ) 74 | )) 75 | ->add('eol', 'choice', array( 76 | 'required' => true, 77 | 'label' => 'generator.form.csv.eof', 78 | // 'help' => '', 79 | // 'help_type' => 'popover', 80 | 'choices' => $eols, 81 | 'attr' => array( 82 | 'class' => 'select2-box', 83 | 'style' => 'width: 95%', 84 | ), 85 | 'row_attr' => array( 86 | 'class' => '', 87 | ), 88 | 'constraints' => array( 89 | new Constraints\Choice(array( 90 | 'choices' => array_keys($eols), 91 | )), 92 | ) 93 | )) 94 | ->add('encoding', 'choice', array( 95 | 'required' => true, 96 | 'label' => 'generator.form.csv.encoding', 97 | // 'help' => '', 98 | // 'help_type' => 'popover', 99 | 'choices' => $encodings, 100 | 'attr' => array( 101 | 'class' => 'select2-box', 102 | 'style' => 'width: 95%', 103 | ), 104 | 'row_attr' => array( 105 | 'class' => '', 106 | ), 107 | 'constraints' => array( 108 | new Constraints\Choice(array( 109 | 'choices' => array_keys($encodings), 110 | )), 111 | ) 112 | )) 113 | ; 114 | } 115 | 116 | /** 117 | * {@inheritdoc} 118 | */ 119 | public function setDefaultOptions(OptionsResolverInterface $resolver) 120 | { 121 | $resolver->setDefaults(array( 122 | 'data_class' => 'Spyrit\Datalea\Faker\Model\CsvFormat', 123 | )); 124 | } 125 | 126 | public function getName() 127 | { 128 | return 'datalea_generator_csv_format'; 129 | } 130 | } 131 | -------------------------------------------------------------------------------- /src/Spyrit/Datalea/Form/Type/VariableConfigType.php: -------------------------------------------------------------------------------- 1 | 15 | */ 16 | class VariableConfigType extends AbstractType 17 | { 18 | public function buildForm(FormBuilderInterface $builder, array $options) 19 | { 20 | $methodsChoices = FakerMethodCollection::getAvailableFakerMethodsForSelect(); 21 | 22 | $methods = array(); 23 | foreach ($methodsChoices as $group => $methodsChoice) { 24 | $methods = array_merge($methods, array_keys($methodsChoice)); 25 | } 26 | 27 | $builder 28 | ->add('name', 'text', array( 29 | 'required' => true, 30 | 'label' => 'generator.form.variables.name', 31 | 'help' => 'generator.form.variables.name_help', 32 | 'help_type' => 'popover', 33 | 'help_popover_position' => 'right', 34 | 'attr' => array( 35 | 'style' => 'width: 95%', 36 | ), 37 | 'row_attr' => array( 38 | 'class' => 'name', 39 | ), 40 | 'constraints' => array( 41 | new Constraints\NotBlank(), 42 | new Constraints\Length(array('min' => 3)), 43 | ) 44 | )) 45 | ->add('fakerMethod', 'choice', array( 46 | 'required' => true, 47 | 'label' => 'generator.form.variables.method', 48 | 'help' => 'generator.form.variables.method_help', 49 | 'help_type' => 'popover', 50 | // 'help_popover_trigger' => 'click', 51 | 'choices' => $methodsChoices, 52 | 'attr' => array( 53 | 'class' => 'select2-box', 54 | 'style' => 'width: 95%', 55 | ), 56 | 'row_attr' => array( 57 | 'class' => 'faker-method', 58 | ), 59 | 'constraints' => array( 60 | new Constraints\Choice(array( 61 | 'choices' => $methods, 62 | )), 63 | ) 64 | )); 65 | 66 | $arguments = array( 67 | 'first', 68 | 'second', 69 | 'third', 70 | ); 71 | 72 | for ($i = 0; $i < count($arguments); $i++) { 73 | $builder->add('fakerMethodArg'.($i+1), 'text', array( 74 | 'label' => 'generator.form.variables.argument'.($i+1), 75 | 'help' => 'generator.form.variables.argument'.($i+1).'_help', 76 | 'help_type' => 'popover', 77 | 'help_popover_position' => $i == 0 ? 'right' : 'top', 78 | 'required' => false, 79 | 'attr' => array( 80 | 'style' => 'width: 95%', 81 | ), 82 | 'row_attr' => array( 83 | 'class' => 'argument '.$arguments[$i].'-arg', 84 | ), 85 | )); 86 | } 87 | } 88 | 89 | /** 90 | * {@inheritdoc} 91 | */ 92 | public function setDefaultOptions(OptionsResolverInterface $resolver) 93 | { 94 | $resolver->setDefaults(array( 95 | 'data_class' => 'Spyrit\Datalea\Faker\Model\VariableConfig', 96 | )); 97 | } 98 | 99 | public function getName() 100 | { 101 | return 'datalea_generator_variable_config'; 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /src/Spyrit/Datalea/Form/extension/BootstrapFormExtension.php: -------------------------------------------------------------------------------- 1 | 11 | */ 12 | class BootstrapFormExtension extends AbstractExtension 13 | { 14 | protected function loadTypeExtensions() 15 | { 16 | return array( 17 | new Type\RowContainerFormTypeExtension(), 18 | new Type\HelpFormTypeExtension(), 19 | ); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Spyrit/Datalea/Form/extension/Type/HelpFormTypeExtension.php: -------------------------------------------------------------------------------- 1 | 14 | */ 15 | class HelpFormTypeExtension extends AbstractTypeExtension 16 | { 17 | public function buildView(FormView $view, FormInterface $form, array $options) 18 | { 19 | $view->vars['help_type'] = $options['help_type']; 20 | $view->vars['help_popover_trigger'] = $options['help_popover_trigger']; 21 | $view->vars['help_popover_position'] = $options['help_popover_position']; 22 | $view->vars['help_popover_title'] = $options['help_popover_title']; 23 | $view->vars['help'] = $options['help']; 24 | $view->vars['required_asterisk'] = $options['required_asterisk']; 25 | } 26 | 27 | public function setDefaultOptions(OptionsResolverInterface $resolver) 28 | { 29 | $resolver->setDefaults(array( 30 | 'help_type' => 'inline', 31 | 'help_popover_trigger' => 'hover', 32 | 'help_popover_position' => 'top', 33 | 'help_popover_title' => 'Help', 34 | 'help' => null, 35 | 'required_asterisk' => false, 36 | )) 37 | ->setAllowedValues(array( 38 | 'help_type' => array('inline', 'block', 'popover'), 39 | 'help_popover_trigger' => array('hover', 'click', ), 40 | 'help_popover_position' => array('top', 'bottom', 'left', 'right',), 41 | )) 42 | ->setAllowedTypes(array( 43 | 'required_asterisk' => 'bool', 44 | )); 45 | } 46 | public function getExtendedType() 47 | { 48 | return 'form'; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/Spyrit/Datalea/Form/extension/Type/RowContainerFormTypeExtension.php: -------------------------------------------------------------------------------- 1 | 14 | */ 15 | class RowContainerFormTypeExtension extends AbstractTypeExtension 16 | { 17 | public function buildView(FormView $view, FormInterface $form, array $options) 18 | { 19 | $view->vars['row_attr'] = $options['row_attr']; 20 | } 21 | 22 | public function setDefaultOptions(OptionsResolverInterface $resolver) 23 | { 24 | $resolver->setDefaults(array( 25 | 'row_attr' => array(), 26 | )) 27 | ->setAllowedTypes(array( 28 | 'row_attr' => 'array', 29 | )); 30 | } 31 | public function getExtendedType() 32 | { 33 | return 'form'; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /web/.htaccess: -------------------------------------------------------------------------------- 1 | 2 | # Options -MultiViews 3 | 4 | RewriteEngine On 5 | RewriteCond %{REQUEST_FILENAME} !-f 6 | RewriteRule ^ index.php [L] 7 | 8 | -------------------------------------------------------------------------------- /web/css/styles.css: -------------------------------------------------------------------------------- 1 | /* 2 | Document : styles 3 | Created on : 14 déc. 2012, 17:50:32 4 | Author : Maxime CORSON 5 | Description: 6 | Purpose of the stylesheet follows. 7 | */ 8 | body { 9 | padding-bottom: 0; 10 | } 11 | 12 | .ml20 { 13 | margin-left: 20px; 14 | } 15 | .ml10 { 16 | margin-left: 10px; 17 | } 18 | .ml0 { 19 | margin-left: 0; 20 | } 21 | 22 | .mr20 { 23 | margin-right: 20px; 24 | } 25 | .mr10 { 26 | margin-right: 10px; 27 | } 28 | .mr0 { 29 | margin-right: 0; 30 | } 31 | 32 | .mt20 { 33 | margin-top: 20px; 34 | } 35 | .mt10 { 36 | margin-top: 10px; 37 | } 38 | .mt0 { 39 | margin-top: 0; 40 | } 41 | 42 | .mb20 { 43 | margin-bottom: 20px; 44 | } 45 | .mb10 { 46 | margin-bottom: 10px; 47 | } 48 | .mb0 { 49 | margin-bottom: 0; 50 | } 51 | 52 | table td input, 53 | table td select { 54 | margin-bottom: 0 !important; 55 | } 56 | 57 | .required-asterisk { 58 | color: red; 59 | width: 5px; 60 | padding-left: 5px; 61 | padding-right: 5px; 62 | } 63 | 64 | .help-popover { 65 | padding-left: 5px; 66 | padding-right: 5px; 67 | } 68 | 69 | a.no-decorate, a.no-decorate:hover, a.help-popover:hover { 70 | text-decoration: none; 71 | } 72 | -------------------------------------------------------------------------------- /web/fancybox/blank.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spyrit/datalea/140f112e037451e9c8476c6a4fab082115c90416/web/fancybox/blank.gif -------------------------------------------------------------------------------- /web/fancybox/fancy_close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spyrit/datalea/140f112e037451e9c8476c6a4fab082115c90416/web/fancybox/fancy_close.png -------------------------------------------------------------------------------- /web/fancybox/fancy_loading.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spyrit/datalea/140f112e037451e9c8476c6a4fab082115c90416/web/fancybox/fancy_loading.png -------------------------------------------------------------------------------- /web/fancybox/fancy_nav_left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spyrit/datalea/140f112e037451e9c8476c6a4fab082115c90416/web/fancybox/fancy_nav_left.png -------------------------------------------------------------------------------- /web/fancybox/fancy_nav_right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spyrit/datalea/140f112e037451e9c8476c6a4fab082115c90416/web/fancybox/fancy_nav_right.png -------------------------------------------------------------------------------- /web/fancybox/fancy_shadow_e.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spyrit/datalea/140f112e037451e9c8476c6a4fab082115c90416/web/fancybox/fancy_shadow_e.png -------------------------------------------------------------------------------- /web/fancybox/fancy_shadow_n.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spyrit/datalea/140f112e037451e9c8476c6a4fab082115c90416/web/fancybox/fancy_shadow_n.png -------------------------------------------------------------------------------- /web/fancybox/fancy_shadow_ne.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spyrit/datalea/140f112e037451e9c8476c6a4fab082115c90416/web/fancybox/fancy_shadow_ne.png -------------------------------------------------------------------------------- /web/fancybox/fancy_shadow_nw.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spyrit/datalea/140f112e037451e9c8476c6a4fab082115c90416/web/fancybox/fancy_shadow_nw.png -------------------------------------------------------------------------------- /web/fancybox/fancy_shadow_s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spyrit/datalea/140f112e037451e9c8476c6a4fab082115c90416/web/fancybox/fancy_shadow_s.png -------------------------------------------------------------------------------- /web/fancybox/fancy_shadow_se.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spyrit/datalea/140f112e037451e9c8476c6a4fab082115c90416/web/fancybox/fancy_shadow_se.png -------------------------------------------------------------------------------- /web/fancybox/fancy_shadow_sw.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spyrit/datalea/140f112e037451e9c8476c6a4fab082115c90416/web/fancybox/fancy_shadow_sw.png -------------------------------------------------------------------------------- /web/fancybox/fancy_shadow_w.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spyrit/datalea/140f112e037451e9c8476c6a4fab082115c90416/web/fancybox/fancy_shadow_w.png -------------------------------------------------------------------------------- /web/fancybox/fancy_title_left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spyrit/datalea/140f112e037451e9c8476c6a4fab082115c90416/web/fancybox/fancy_title_left.png -------------------------------------------------------------------------------- /web/fancybox/fancy_title_main.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spyrit/datalea/140f112e037451e9c8476c6a4fab082115c90416/web/fancybox/fancy_title_main.png -------------------------------------------------------------------------------- /web/fancybox/fancy_title_over.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spyrit/datalea/140f112e037451e9c8476c6a4fab082115c90416/web/fancybox/fancy_title_over.png -------------------------------------------------------------------------------- /web/fancybox/fancy_title_right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spyrit/datalea/140f112e037451e9c8476c6a4fab082115c90416/web/fancybox/fancy_title_right.png -------------------------------------------------------------------------------- /web/fancybox/fancybox-x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spyrit/datalea/140f112e037451e9c8476c6a4fab082115c90416/web/fancybox/fancybox-x.png -------------------------------------------------------------------------------- /web/fancybox/fancybox-y.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spyrit/datalea/140f112e037451e9c8476c6a4fab082115c90416/web/fancybox/fancybox-y.png -------------------------------------------------------------------------------- /web/fancybox/fancybox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spyrit/datalea/140f112e037451e9c8476c6a4fab082115c90416/web/fancybox/fancybox.png -------------------------------------------------------------------------------- /web/fancybox/jquery.easing-1.3.pack.js: -------------------------------------------------------------------------------- 1 | /* 2 | * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/ 3 | * 4 | * Uses the built in easing capabilities added In jQuery 1.1 5 | * to offer multiple easing options 6 | * 7 | * TERMS OF USE - jQuery Easing 8 | * 9 | * Open source under the BSD License. 10 | * 11 | * Copyright © 2008 George McGinley Smith 12 | * All rights reserved. 13 | * 14 | * Redistribution and use in source and binary forms, with or without modification, 15 | * are permitted provided that the following conditions are met: 16 | * 17 | * Redistributions of source code must retain the above copyright notice, this list of 18 | * conditions and the following disclaimer. 19 | * Redistributions in binary form must reproduce the above copyright notice, this list 20 | * of conditions and the following disclaimer in the documentation and/or other materials 21 | * provided with the distribution. 22 | * 23 | * Neither the name of the author nor the names of contributors may be used to endorse 24 | * or promote products derived from this software without specific prior written permission. 25 | * 26 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 27 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 28 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 29 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 30 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 31 | * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 32 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 33 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 34 | * OF THE POSSIBILITY OF SUCH DAMAGE. 35 | * 36 | */ 37 | 38 | // t: current time, b: begInnIng value, c: change In value, d: duration 39 | eval(function(p,a,c,k,e,r){e=function(c){return(c35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('h.i[\'1a\']=h.i[\'z\'];h.O(h.i,{y:\'D\',z:9(x,t,b,c,d){6 h.i[h.i.y](x,t,b,c,d)},17:9(x,t,b,c,d){6 c*(t/=d)*t+b},D:9(x,t,b,c,d){6-c*(t/=d)*(t-2)+b},13:9(x,t,b,c,d){e((t/=d/2)<1)6 c/2*t*t+b;6-c/2*((--t)*(t-2)-1)+b},X:9(x,t,b,c,d){6 c*(t/=d)*t*t+b},U:9(x,t,b,c,d){6 c*((t=t/d-1)*t*t+1)+b},R:9(x,t,b,c,d){e((t/=d/2)<1)6 c/2*t*t*t+b;6 c/2*((t-=2)*t*t+2)+b},N:9(x,t,b,c,d){6 c*(t/=d)*t*t*t+b},M:9(x,t,b,c,d){6-c*((t=t/d-1)*t*t*t-1)+b},L:9(x,t,b,c,d){e((t/=d/2)<1)6 c/2*t*t*t*t+b;6-c/2*((t-=2)*t*t*t-2)+b},K:9(x,t,b,c,d){6 c*(t/=d)*t*t*t*t+b},J:9(x,t,b,c,d){6 c*((t=t/d-1)*t*t*t*t+1)+b},I:9(x,t,b,c,d){e((t/=d/2)<1)6 c/2*t*t*t*t*t+b;6 c/2*((t-=2)*t*t*t*t+2)+b},G:9(x,t,b,c,d){6-c*8.C(t/d*(8.g/2))+c+b},15:9(x,t,b,c,d){6 c*8.n(t/d*(8.g/2))+b},12:9(x,t,b,c,d){6-c/2*(8.C(8.g*t/d)-1)+b},Z:9(x,t,b,c,d){6(t==0)?b:c*8.j(2,10*(t/d-1))+b},Y:9(x,t,b,c,d){6(t==d)?b+c:c*(-8.j(2,-10*t/d)+1)+b},W:9(x,t,b,c,d){e(t==0)6 b;e(t==d)6 b+c;e((t/=d/2)<1)6 c/2*8.j(2,10*(t-1))+b;6 c/2*(-8.j(2,-10*--t)+2)+b},V:9(x,t,b,c,d){6-c*(8.o(1-(t/=d)*t)-1)+b},S:9(x,t,b,c,d){6 c*8.o(1-(t=t/d-1)*t)+b},Q:9(x,t,b,c,d){e((t/=d/2)<1)6-c/2*(8.o(1-t*t)-1)+b;6 c/2*(8.o(1-(t-=2)*t)+1)+b},P:9(x,t,b,c,d){f s=1.l;f p=0;f a=c;e(t==0)6 b;e((t/=d)==1)6 b+c;e(!p)p=d*.3;e(a<8.w(c)){a=c;f s=p/4}m f s=p/(2*8.g)*8.r(c/a);6-(a*8.j(2,10*(t-=1))*8.n((t*d-s)*(2*8.g)/p))+b},H:9(x,t,b,c,d){f s=1.l;f p=0;f a=c;e(t==0)6 b;e((t/=d)==1)6 b+c;e(!p)p=d*.3;e(a<8.w(c)){a=c;f s=p/4}m f s=p/(2*8.g)*8.r(c/a);6 a*8.j(2,-10*t)*8.n((t*d-s)*(2*8.g)/p)+c+b},T:9(x,t,b,c,d){f s=1.l;f p=0;f a=c;e(t==0)6 b;e((t/=d/2)==2)6 b+c;e(!p)p=d*(.3*1.5);e(a<8.w(c)){a=c;f s=p/4}m f s=p/(2*8.g)*8.r(c/a);e(t<1)6-.5*(a*8.j(2,10*(t-=1))*8.n((t*d-s)*(2*8.g)/p))+b;6 a*8.j(2,-10*(t-=1))*8.n((t*d-s)*(2*8.g)/p)*.5+c+b},F:9(x,t,b,c,d,s){e(s==u)s=1.l;6 c*(t/=d)*t*((s+1)*t-s)+b},E:9(x,t,b,c,d,s){e(s==u)s=1.l;6 c*((t=t/d-1)*t*((s+1)*t+s)+1)+b},16:9(x,t,b,c,d,s){e(s==u)s=1.l;e((t/=d/2)<1)6 c/2*(t*t*(((s*=(1.B))+1)*t-s))+b;6 c/2*((t-=2)*t*(((s*=(1.B))+1)*t+s)+2)+b},A:9(x,t,b,c,d){6 c-h.i.v(x,d-t,0,c,d)+b},v:9(x,t,b,c,d){e((t/=d)<(1/2.k)){6 c*(7.q*t*t)+b}m e(t<(2/2.k)){6 c*(7.q*(t-=(1.5/2.k))*t+.k)+b}m e(t<(2.5/2.k)){6 c*(7.q*(t-=(2.14/2.k))*t+.11)+b}m{6 c*(7.q*(t-=(2.18/2.k))*t+.19)+b}},1b:9(x,t,b,c,d){e(ts.length&&(r("jQuery.fn.attr( props, pass ) is deprecated"),t&&!d.test(c)&&e.isFunction(e.fn[a]))?e(t)[a](o):("type"===a&&o!==n&&l.test(t.nodeName)&&t.parentNode&&r("Can't change the 'type' of an input or button in IE 6/7/8"),!e.attrHooks[u]&&p.test(u)&&(e.attrHooks[u]={get:function(t,r){var a,o=e.prop(t,r);return o===!0||"boolean"!=typeof o&&(a=t.getAttributeNode(r))&&a.nodeValue!==!1?r.toLowerCase():n},set:function(t,n,r){var a;return n===!1?e.removeAttr(t,r):(a=e.propFix[r]||r,a in t&&(t[a]=!0),t.setAttribute(r,r.toLowerCase())),r}},f.test(u)&&r("jQuery.fn.attr('"+u+"') may use property instead of attribute")),s.call(e,t,a,o))},e.attrHooks.value={get:function(e,t){var n=(e.nodeName||"").toLowerCase();return"button"===n?u.apply(this,arguments):("input"!==n&&"option"!==n&&r("jQuery.fn.attr('value') no longer gets properties"),t in e?e.value:null)},set:function(e,t){var a=(e.nodeName||"").toLowerCase();return"button"===a?c.apply(this,arguments):("input"!==a&&"option"!==a&&r("jQuery.fn.attr('value', val) no longer sets properties"),e.value=t,n)}};var g,h,v=e.fn.init,m=e.parseJSON,y=/^(?:[^<]*(<[\w\W]+>)[^>]*|#([\w\-]*))$/;e.fn.init=function(t,n,a){var o;return t&&"string"==typeof t&&!e.isPlainObject(n)&&(o=y.exec(t))&&o[1]&&("<"!==t.charAt(0)&&r("$(html) HTML strings must start with '<' character"),n&&n.context&&(n=n.context),e.parseHTML)?v.call(this,e.parseHTML(e.trim(t),n,!0),n,a):v.apply(this,arguments)},e.fn.init.prototype=e.fn,e.parseJSON=function(e){return e||null===e?m.apply(this,arguments):(r("jQuery.parseJSON requires a valid JSON string"),null)},e.uaMatch=function(e){e=e.toLowerCase();var t=/(chrome)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+)/.exec(e)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(e)||/(msie) ([\w.]+)/.exec(e)||0>e.indexOf("compatible")&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(e)||[];return{browser:t[1]||"",version:t[2]||"0"}},g=e.uaMatch(navigator.userAgent),h={},g.browser&&(h[g.browser]=!0,h.version=g.version),h.chrome?h.webkit=!0:h.webkit&&(h.safari=!0),e.browser=h,a(e,"browser",h,"jQuery.browser is deprecated"),e.sub=function(){function t(e,n){return new t.fn.init(e,n)}e.extend(!0,t,this),t.superclass=this,t.fn=t.prototype=this(),t.fn.constructor=t,t.sub=this.sub,t.fn.init=function(r,a){return a&&a instanceof e&&!(a instanceof t)&&(a=t(a)),e.fn.init.call(this,r,a,n)},t.fn.init.prototype=t.fn;var n=t(document);return r("jQuery.sub() is deprecated"),t};var b=e.fn.data;e.fn.data=function(t){var a,o,i=this[0];return!i||"events"!==t||1!==arguments.length||(a=e.data(i,t),o=e._data(i,t),a!==n&&a!==o||o===n)?b.apply(this,arguments):(r("Use of jQuery.fn.data('events') is deprecated"),o)};var j=/\/(java|ecma)script/i,w=e.fn.andSelf||e.fn.addBack;e.fn.andSelf=function(){return r("jQuery.fn.andSelf() replaced by jQuery.fn.addBack()"),w.apply(this,arguments)},e.clean||(e.clean=function(t,a,o,i){a=a||document,a=!a.nodeType&&a[0]||a,a=a.ownerDocument||a,r("jQuery.clean() is deprecated");var s,u,c,l,d=[];if(e.merge(d,e.buildFragment(t,a).childNodes),o)for(c=function(e){return!e.type||j.test(e.type)?i?i.push(e.parentNode?e.parentNode.removeChild(e):e):o.appendChild(e):n},s=0;null!=(u=d[s]);s++)e.nodeName(u,"script")&&c(u)||(o.appendChild(u),u.getElementsByTagName!==n&&(l=e.grep(e.merge([],u.getElementsByTagName("script")),c),d.splice.apply(d,[s+1,0].concat(l)),s+=l.length));return d});var Q=e.event.add,x=e.event.remove,k=e.event.trigger,N=e.fn.toggle,C=e.fn.live,T=e.fn.die,M="ajaxStart|ajaxStop|ajaxSend|ajaxComplete|ajaxError|ajaxSuccess",S=RegExp("\\b(?:"+M+")\\b"),H=/(?:^|\s)hover(\.\S+|)\b/,A=function(t){return"string"!=typeof t||e.event.special.hover?t:(H.test(t)&&r("'hover' pseudo-event is deprecated, use 'mouseenter mouseleave'"),t&&t.replace(H,"mouseenter$1 mouseleave$1"))};e.event.props&&"attrChange"!==e.event.props[0]&&e.event.props.unshift("attrChange","attrName","relatedNode","srcElement"),e.event.dispatch&&a(e.event,"handle",e.event.dispatch,"jQuery.event.handle is undocumented and deprecated"),e.event.add=function(e,t,n,a,o){e!==document&&S.test(t)&&r("AJAX events should be attached to document: "+t),Q.call(this,e,A(t||""),n,a,o)},e.event.remove=function(e,t,n,r,a){x.call(this,e,A(t)||"",n,r,a)},e.fn.error=function(){var e=Array.prototype.slice.call(arguments,0);return r("jQuery.fn.error() is deprecated"),e.splice(0,0,"error"),arguments.length?this.bind.apply(this,e):(this.triggerHandler.apply(this,e),this)},e.fn.toggle=function(t,n){if(!e.isFunction(t)||!e.isFunction(n))return N.apply(this,arguments);r("jQuery.fn.toggle(handler, handler...) is deprecated");var a=arguments,o=t.guid||e.guid++,i=0,s=function(n){var r=(e._data(this,"lastToggle"+t.guid)||0)%i;return e._data(this,"lastToggle"+t.guid,r+1),n.preventDefault(),a[r].apply(this,arguments)||!1};for(s.guid=o;a.length>i;)a[i++].guid=o;return this.click(s)},e.fn.live=function(t,n,a){return r("jQuery.fn.live() is deprecated"),C?C.apply(this,arguments):(e(this.context).on(t,this.selector,n,a),this)},e.fn.die=function(t,n){return r("jQuery.fn.die() is deprecated"),T?T.apply(this,arguments):(e(this.context).off(t,this.selector||"**",n),this)},e.event.trigger=function(e,t,n,a){return!n&!S.test(e)&&r("Global events are undocumented and deprecated"),k.call(this,e,t,n||document,a)},e.each(M.split("|"),function(t,n){e.event.special[n]={setup:function(){var t=this;return t!==document&&(e.event.add(document,n+"."+e.guid,function(){e.event.trigger(n,null,t,!0)}),e._data(this,n,e.guid++)),!1},teardown:function(){return this!==document&&e.event.remove(document,n+"."+e._data(this,n)),!1}}})}(jQuery,window); 3 | //@ sourceMappingURL=dist/jquery-migrate.min.map -------------------------------------------------------------------------------- /web/select2/README.md: -------------------------------------------------------------------------------- 1 | Select2 2 | ================= 3 | 4 | Select2 is a jQuery based replacement for select boxes. It supports searching, remote data sets, and infinite scrolling of results. Look and feel of Select2 is based on the excellent [Chosen](http://harvesthq.github.com/chosen/) library. 5 | 6 | To get started -- checkout http://ivaynberg.github.com/select2! 7 | 8 | What Does Select2 Support That Chosen Does Not? 9 | ------------------------------------------------- 10 | 11 | * Working with large datasets: Chosen requires the entire dataset to be loaded as `option` tags in the DOM, which limits 12 | it to working with small-ish datasets. Select2 uses a function to find results on-the-fly, which allows it to partially 13 | load results. 14 | * Paging of results: Since Select2 works with large datasets and only loads a small amount of matching results at a time 15 | it has to support paging. Select2 will call the search function when the user scrolls to the bottom of currently loaded 16 | result set allowing for the 'infinite scrolling' of results. 17 | * Custom markup for results: Chosen only supports rendering text results because that is the only markup supported by 18 | `option` tags. Select2 provides an extension point which can be used to produce any kind of markup to represent results. 19 | * Ability to add results on the fly: Select2 provides the ability to add results from the search term entered by the user, which allows it to be used for 20 | tagging. 21 | 22 | Browser Compatibility 23 | -------------------- 24 | * IE 8+ (7 mostly works except for [issue with z-index](https://github.com/ivaynberg/select2/issues/37)) 25 | * Chrome 8+ 26 | * Firefox 3.5+ 27 | * Safari 3+ 28 | * Opera 10.6+ 29 | 30 | Integrations 31 | ------------ 32 | 33 | * [Wicket-Select2](https://github.com/ivaynberg/wicket-select2) (Java / Apache Wicket) 34 | * [select2-rails](https://github.com/argerim/select2-rails) (Ruby on Rails) 35 | * [AngularUI](http://angular-ui.github.com/#directives-select2) ([AngularJS](angularjs.org)) 36 | * [Django](https://github.com/applegrew/django-select2) 37 | 38 | Bug tracker 39 | ----------- 40 | 41 | Have a bug? Please create an issue here on GitHub! 42 | 43 | https://github.com/ivaynberg/select2/issues 44 | 45 | 46 | Mailing list 47 | ------------ 48 | 49 | Have a question? Ask on our mailing list! 50 | 51 | select2@googlegroups.com 52 | 53 | https://groups.google.com/d/forum/select2 54 | 55 | 56 | Copyright and License 57 | --------------------- 58 | 59 | Copyright 2012 Igor Vaynberg 60 | 61 | This software is licensed under the Apache License, Version 2.0 (the "Apache License") or the GNU 62 | General Public License version 2 (the "GPL License"). You may choose either license to govern your 63 | use of this software only upon the condition that you accept all of the terms of either the Apache 64 | License or the GPL License. 65 | 66 | You may obtain a copy of the Apache License and the GPL License in the LICENSE file, or at: 67 | 68 | http://www.apache.org/licenses/LICENSE-2.0 69 | http://www.gnu.org/licenses/gpl-2.0.html 70 | 71 | Unless required by applicable law or agreed to in writing, software distributed under the Apache License 72 | or the GPL Licesnse is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 73 | either express or implied. See the Apache License and the GPL License for the specific language governing 74 | permissions and limitations under the Apache License and the GPL License. -------------------------------------------------------------------------------- /web/select2/component.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "select2", 3 | "version": "3.3.0", 4 | "main": ["select2.js", "select2.css", "select2.png", "select2x2.png", "spinner.gif"], 5 | "dependencies": { 6 | "jquery": "~1.4.4" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /web/select2/release.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | echo -n "Enter the version for this release: " 5 | 6 | read ver 7 | 8 | if [ ! $ver ]; then 9 | echo "Invalid version." 10 | exit 11 | fi 12 | 13 | name="select2" 14 | js="$name.js" 15 | mini="$name.min.js" 16 | css="$name.css" 17 | release="$name-$ver" 18 | tag="$ver" 19 | branch="build-$ver" 20 | curbranch=`git branch | grep "*" | sed "s/* //"` 21 | timestamp=$(date) 22 | tokens="s/@@ver@@/$ver/g;s/\@@timestamp@@/$timestamp/g" 23 | remote="github" 24 | 25 | echo "Updating Version Identifiers" 26 | 27 | sed -E -e "s/\"version\": \"([0-9\.]+)\",/\"version\": \"$ver\",/g" -i "" component.json select2.jquery.json 28 | git add component.json 29 | git add select2.jquery.json 30 | git commit -m "modified version identifiers in descriptors for release $ver" 31 | git push 32 | 33 | git branch "$branch" 34 | git checkout "$branch" 35 | 36 | echo "Tokenizing..." 37 | 38 | find . -name "$js" | xargs -I{} sed -e "$tokens" -i "" {} 39 | find . -name "$css" | xargs -I{} sed -e "$tokens" -i "" {} 40 | sed -e "s/latest/$ver/g" -i "" component.json 41 | 42 | git add "$js" 43 | git add "$css" 44 | 45 | echo "Minifying..." 46 | 47 | echo "/*" > "$mini" 48 | cat LICENSE | sed "$tokens" >> "$mini" 49 | echo "*/" >> "$mini" 50 | 51 | curl -s \ 52 | -d compilation_level=SIMPLE_OPTIMIZATIONS \ 53 | -d output_format=text \ 54 | -d output_info=compiled_code \ 55 | --data-urlencode "js_code@$js" \ 56 | http://closure-compiler.appspot.com/compile \ 57 | >> "$mini" 58 | 59 | git add "$mini" 60 | 61 | git commit -m "release $ver" 62 | 63 | echo "Tagging..." 64 | git tag -a "$tag" -m "tagged version $ver" 65 | git push "$remote" --tags 66 | 67 | echo "Cleaning Up..." 68 | 69 | git checkout "$curbranch" 70 | git branch -D "$branch" 71 | 72 | echo "Done" 73 | -------------------------------------------------------------------------------- /web/select2/select2-spinner.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spyrit/datalea/140f112e037451e9c8476c6a4fab082115c90416/web/select2/select2-spinner.gif -------------------------------------------------------------------------------- /web/select2/select2.jquery.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "select2", 3 | "title": "Select2", 4 | "description": "Select2 is a jQuery based replacement for select boxes. It supports searching, remote data sets, and infinite scrolling of results.", 5 | "keywords": [ 6 | "select", 7 | "autocomplete", 8 | "typeahead", 9 | "dropdown", 10 | "multiselect", 11 | "tag", 12 | "tagging" 13 | ], 14 | "version": "3.3.0", 15 | "author": { 16 | "name": "Igor Vaynberg", 17 | "url": "https://github.com/ivaynberg" 18 | }, 19 | "licenses": [ 20 | { 21 | "type": "Apache", 22 | "url": "http://www.apache.org/licenses/LICENSE-2.0" 23 | }, 24 | { 25 | "type": "GPL v2", 26 | "url": "http://www.gnu.org/licenses/gpl-2.0.html" 27 | } 28 | ], 29 | "bugs": "https://github.com/ivaynberg/select2/issues", 30 | "homepage": "http://ivaynberg.github.com/select2", 31 | "docs": "http://ivaynberg.github.com/select2/", 32 | "download": "https://github.com/ivaynberg/select2/tags", 33 | "dependencies": { 34 | "jquery": ">=1.4.6" 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /web/select2/select2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spyrit/datalea/140f112e037451e9c8476c6a4fab082115c90416/web/select2/select2.png -------------------------------------------------------------------------------- /web/select2/select2_locale_it.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Select2 Italian translation 3 | */ 4 | (function ($) { 5 | "use strict"; 6 | 7 | $.extend($.fn.select2.defaults, { 8 | formatNoMatches: function () { return "Nessuna corrispondenza trovata"; }, 9 | formatInputTooShort: function (input, min) { var n = min - input.length; return "Inserisci ancora " + n + " caratter" + (n == 1? "e" : "i"); }, 10 | formatInputTooLong: function (input, max) { var n = input.length - max; return "Inserisci " + n + " caratter" + (n == 1? "e" : "i") + " in meno"; }, 11 | formatSelectionTooBig: function (limit) { return "Puoi selezionare solo " + limit + " element" + (limit == 1 ? "o" : "i"); }, 12 | formatLoadMore: function (pageNumber) { return "Caricamento in corso..."; }, 13 | formatSearching: function () { return "Ricerca..."; } 14 | }); 15 | })(jQuery); -------------------------------------------------------------------------------- /web/select2/select2x2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spyrit/datalea/140f112e037451e9c8476c6a4fab082115c90416/web/select2/select2x2.png --------------------------------------------------------------------------------