Selaa lähdekoodia

Merge branch 'stable/v0.9.7' of peyruis.bux.fr:/home/git/repositories/muzich into stable/v0.9.7

Sevajol Bastien 11 vuotta sitten
vanhempi
commit
c52325eae7
29 muutettua tiedostoa jossa 1309 lisäystä ja 425 poistoa
  1. 1 0
      app/AppKernel.php
  2. 2 1
      app/Resources/translations/text.fr.yml
  3. 1 1
      app/Resources/translations/userui.en.yml
  4. 1 1
      app/Resources/translations/userui.fr.yml
  5. 6 0
      app/config/routing.yml
  6. 3 2
      composer.json
  7. 173 69
      composer.lock
  8. 4 0
      src/Muzich/AdminBundle/Resources/config/Moderate_tag-generator.yml
  9. 2 7
      src/Muzich/CoreBundle/Controller/ElementController.php
  10. 29 0
      src/Muzich/CoreBundle/Entity/User.php
  11. 8 0
      src/Muzich/CoreBundle/Repository/UserRepository.php
  12. 10 3
      src/Muzich/CoreBundle/Resources/config/security.yml
  13. 15 2
      src/Muzich/CoreBundle/Resources/public/css/main.css
  14. 5 0
      src/Muzich/CoreBundle/Resources/public/js/muzich.js
  15. 23 0
      src/Muzich/CoreBundle/Resources/views/Component/facebook.html.twig
  16. 5 3
      src/Muzich/CoreBundle/Resources/views/Element/form.add.html.twig
  17. 6 1
      src/Muzich/CoreBundle/Resources/views/Helpbox/element_add_url.html.twig
  18. 2 1
      src/Muzich/CoreBundle/Resources/views/layout.html.twig
  19. 13 1
      src/Muzich/CoreBundle/Searcher/ElementSearcherQueryBuilder.php
  20. 84 0
      src/Muzich/CoreBundle/Security/User/Provider/FacebookProvider.php
  21. 1 52
      src/Muzich/UserBundle/Controller/UserController.php
  22. 53 0
      src/Muzich/UserBundle/Entity/UserManager.php
  23. 1 1
      src/Muzich/UserBundle/Resources/views/Account/subscribe_or_login.html.twig
  24. 1 4
      web/bundles/admingeneratorgenerator/javascripts/double_list.js
  25. 26 6
      web/bundles/admingeneratorgenerator/js/admingenerator/general.js
  26. 97 0
      web/bundles/admingeneratorgenerator/js/jquery-bbq/jquery.deparam.js
  27. 190 16
      web/bundles/muzichcore/css/main.css
  28. 31 28
      web/bundles/muzichcore/js/TagPrompt.js
  29. 516 226
      web/bundles/muzichcore/js/muzich.js

+ 1 - 0
app/AppKernel.php Näytä tiedosto

@@ -32,6 +32,7 @@ class AppKernel extends Kernel
32 32
             new Knp\Bundle\MenuBundle\KnpMenuBundle(),
33 33
             new WhiteOctober\PagerfantaBundle\WhiteOctoberPagerfantaBundle(),
34 34
             new Shtumi\UsefulBundle\ShtumiUsefulBundle(),
35
+            new FOS\FacebookBundle\FOSFacebookBundle(),
35 36
             
36 37
             new Muzich\CoreBundle\MuzichCoreBundle(),
37 38
             new Muzich\UserBundle\MuzichUserBundle(),

+ 2 - 1
app/Resources/translations/text.fr.yml Näytä tiedosto

@@ -103,9 +103,10 @@ help:
103 103
     text1:            |
104 104
                       Vous devez mettre dans ce champ l'adresse de la page internet
105 105
                       contenant la musique à partager. Faites bien attention a vous 
106
-                      trouver sur la page représentant la musique que vous souahitez 
106
+                      trouver sur la page représentant la musique que vous souaihtez 
107 107
                       partager. Evitez par exemple de partager une adresse après 
108 108
                       avoir effectué une recherche.
109
+    text1_plugin:     Bientôt un plugin firefox, chrome (et d'autres) pour partager encore plus facilement !
109 110
     title2:           Exemple avec Youtube
110 111
     title3:           Exemple avec Soundcloud
111 112
   tags_prompt:

+ 1 - 1
app/Resources/translations/userui.en.yml Näytä tiedosto

@@ -170,7 +170,7 @@ element_add:
170 170
     help:     |
171 171
               Copier ici le lien internet (http://) pointant sur la ressource 
172 172
               que vous souhaitez partager.
173
-    more_help: Cliquez ici pour plus de détails
173
+    more_help: Cliquez ici pour plus d'aide
174 174
               
175 175
   need_tags:
176 176
     name:     Demander de l'aide pour tagger votre partage

+ 1 - 1
app/Resources/translations/userui.fr.yml Näytä tiedosto

@@ -175,7 +175,7 @@ element_add:
175 175
     help:     |
176 176
               Copier ici le lien internet (http://) pointant sur la ressource 
177 177
               que vous souhaitez partager.
178
-    more_help: Cliquez ici pour plus de détails
178
+    more_help: Cliquez ici pour plus d'aide
179 179
               
180 180
   need_tags:
181 181
     name:     Demander de l'aide pour tagger votre partage

+ 6 - 0
app/config/routing.yml Näytä tiedosto

@@ -1,3 +1,9 @@
1
+_security_check:
2
+  pattern:  /login_facebook_check
3
+  
4
+_security_logout:
5
+    pattern:  /logout
6
+
1 7
 MuzichIndexBundle:
2 8
   resource: "@MuzichIndexBundle/Resources/config/routing.yml"
3 9
   prefix: /

+ 3 - 2
composer.json Näytä tiedosto

@@ -28,13 +28,14 @@
28 28
         "gregwar/image-bundle": "dev-master",
29 29
         "cedriclombardot/admingenerator-generator-bundle": "2.1.*@dev",
30 30
         "cedriclombardot/twig-generator": "dev-master",
31
-        "white-october/pagerfanta-bundle": "1.0.*@dev",
31
+        "white-october/pagerfanta-bundle": "2.1.*@dev",
32 32
         "pagerfanta/pagerfanta": "1.0.*@dev",
33 33
         "shtumi/useful-bundle": "dev-master",
34 34
         "sonata-project/doctrine-orm-admin-bundle": "2.1.*@dev",
35 35
         "sonata-project/admin-bundle": "2.1.*@dev",
36 36
         "sonata-project/jquery-bundle": "1.8.*@dev",
37
-        "sonata-project/block-bundle": "2.1.*@dev"
37
+        "sonata-project/block-bundle": "2.1.*@dev",
38
+        "friendsofsymfony/facebook-bundle": "dev-master"
38 39
     },
39 40
     "scripts": {
40 41
         "post-install-cmd": [

+ 173 - 69
composer.lock Näytä tiedosto

@@ -1,5 +1,5 @@
1 1
 {
2
-    "hash": "dd5c41c30319b0b4e3eff5370c6bedd2",
2
+    "hash": "ca864c17169224f4d52600e48be0f467",
3 3
     "packages": [
4 4
         {
5 5
             "name": "cedriclombardot/admingenerator-generator-bundle",
@@ -8,12 +8,12 @@
8 8
             "source": {
9 9
                 "type": "git",
10 10
                 "url": "https://github.com/symfony2admingenerator/AdmingeneratorGeneratorBundle.git",
11
-                "reference": "1b2ea73c01a5b3d39ae8dd545e46966b5bb1a1e3"
11
+                "reference": "294adb5a1766445e2f2fd3f28c28279084c38435"
12 12
             },
13 13
             "dist": {
14 14
                 "type": "zip",
15
-                "url": "https://api.github.com/repos/symfony2admingenerator/AdmingeneratorGeneratorBundle/zipball/1b2ea73c01a5b3d39ae8dd545e46966b5bb1a1e3",
16
-                "reference": "1b2ea73c01a5b3d39ae8dd545e46966b5bb1a1e3",
15
+                "url": "https://api.github.com/repos/symfony2admingenerator/AdmingeneratorGeneratorBundle/zipball/294adb5a1766445e2f2fd3f28c28279084c38435",
16
+                "reference": "294adb5a1766445e2f2fd3f28c28279084c38435",
17 17
                 "shasum": ""
18 18
             },
19 19
             "require": {
@@ -22,7 +22,7 @@
22 22
                 "symfony/symfony": ">= 2.1.0",
23 23
                 "twig/extensions": "dev-master",
24 24
                 "twig/twig": ">= 1.9.0",
25
-                "white-october/pagerfanta-bundle": "dev-master"
25
+                "white-october/pagerfanta-bundle": "2.1.*@dev"
26 26
             },
27 27
             "require-dev": {
28 28
                 "doctrine/common": ">=2.2.3,<2.5-dev",
@@ -33,7 +33,7 @@
33 33
                 "avalanche123/imagine-bundle": "Image manipulation using Imagine and Twig Filters",
34 34
                 "cedriclombardot/admingenerator-user-bundle": "Help you to overwrite the base layout of FOSUserBundle or others giving a parameter key of the container"
35 35
             },
36
-            "time": "2013-04-14 09:22:28",
36
+            "time": "2013-05-14 12:00:41",
37 37
             "type": "symfony-bundle",
38 38
             "extra": {
39 39
                 "branch-alias": {
@@ -238,23 +238,23 @@
238 238
         },
239 239
         {
240 240
             "name": "doctrine/dbal",
241
-            "version": "2.3.3",
241
+            "version": "2.3.4",
242 242
             "source": {
243 243
                 "type": "git",
244 244
                 "url": "https://github.com/doctrine/dbal.git",
245
-                "reference": "2.3.3"
245
+                "reference": "2.3.4"
246 246
             },
247 247
             "dist": {
248 248
                 "type": "zip",
249
-                "url": "https://api.github.com/repos/doctrine/dbal/zipball/2.3.3",
250
-                "reference": "2.3.3",
249
+                "url": "https://api.github.com/repos/doctrine/dbal/zipball/2.3.4",
250
+                "reference": "2.3.4",
251 251
                 "shasum": ""
252 252
             },
253 253
             "require": {
254 254
                 "doctrine/common": ">=2.3.0,<2.5-dev",
255 255
                 "php": ">=5.3.2"
256 256
             },
257
-            "time": "2013-03-24 19:16:29",
257
+            "time": "2013-05-11 07:45:37",
258 258
             "type": "library",
259 259
             "extra": {
260 260
                 "branch-alias": {
@@ -428,16 +428,16 @@
428 428
         },
429 429
         {
430 430
             "name": "doctrine/orm",
431
-            "version": "2.3.3",
431
+            "version": "2.3.4",
432 432
             "source": {
433 433
                 "type": "git",
434 434
                 "url": "https://github.com/doctrine/doctrine2.git",
435
-                "reference": "2.3.3"
435
+                "reference": "2.3.4"
436 436
             },
437 437
             "dist": {
438 438
                 "type": "zip",
439
-                "url": "https://api.github.com/repos/doctrine/doctrine2/zipball/2.3.3",
440
-                "reference": "2.3.3",
439
+                "url": "https://api.github.com/repos/doctrine/doctrine2/zipball/2.3.4",
440
+                "reference": "2.3.4",
441 441
                 "shasum": ""
442 442
             },
443 443
             "require": {
@@ -449,7 +449,7 @@
449 449
             "suggest": {
450 450
                 "symfony/yaml": "If you want to use YAML Metadata Mapping Driver"
451 451
             },
452
-            "time": "2013-03-24 20:43:58",
452
+            "time": "2013-05-11 07:51:12",
453 453
             "bin": [
454 454
                 "bin/doctrine",
455 455
                 "bin/doctrine.php"
@@ -497,6 +497,109 @@
497 497
             ]
498 498
         },
499 499
         {
500
+            "name": "facebook/php-sdk",
501
+            "version": "v3.2.2",
502
+            "source": {
503
+                "type": "git",
504
+                "url": "https://github.com/facebook/facebook-php-sdk.git",
505
+                "reference": "v3.2.2"
506
+            },
507
+            "dist": {
508
+                "type": "zip",
509
+                "url": "https://api.github.com/repos/facebook/facebook-php-sdk/zipball/v3.2.2",
510
+                "reference": "v3.2.2",
511
+                "shasum": ""
512
+            },
513
+            "require": {
514
+                "ext-curl": "*",
515
+                "ext-json": "*",
516
+                "php": ">=5.2.0"
517
+            },
518
+            "time": "2013-01-15 21:37:15",
519
+            "type": "library",
520
+            "autoload": {
521
+                "classmap": [
522
+                    "src"
523
+                ]
524
+            },
525
+            "notification-url": "https://packagist.org/downloads/",
526
+            "license": [
527
+                "Apache2"
528
+            ],
529
+            "authors": [
530
+                {
531
+                    "name": "Facebook",
532
+                    "homepage": "https://github.com/facebook/facebook-php-sdk/contributors"
533
+                }
534
+            ],
535
+            "description": "Facebook PHP SDK",
536
+            "homepage": "https://github.com/facebook/facebook-php-sdk",
537
+            "keywords": [
538
+                "facebook",
539
+                "sdk"
540
+            ]
541
+        },
542
+        {
543
+            "name": "friendsofsymfony/facebook-bundle",
544
+            "version": "dev-master",
545
+            "target-dir": "FOS/FacebookBundle",
546
+            "source": {
547
+                "type": "git",
548
+                "url": "https://github.com/FriendsOfSymfony/FOSFacebookBundle.git",
549
+                "reference": "9c93669fd8f93941602d348daa58273c29be229f"
550
+            },
551
+            "dist": {
552
+                "type": "zip",
553
+                "url": "https://api.github.com/repos/FriendsOfSymfony/FOSFacebookBundle/zipball/9c93669fd8f93941602d348daa58273c29be229f",
554
+                "reference": "9c93669fd8f93941602d348daa58273c29be229f",
555
+                "shasum": ""
556
+            },
557
+            "require": {
558
+                "facebook/php-sdk": "3.2.*",
559
+                "php": ">=5.3.2",
560
+                "symfony/http-foundation": ">=2.1,<2.3",
561
+                "symfony/security": ">=2.1,<2.3"
562
+            },
563
+            "require-dev": {
564
+                "phpunit/phpunit": "3.7.*",
565
+                "symfony/framework-bundle": ">=2.1,<2.3",
566
+                "symfony/security-bundle": ">=2.1,<2.3",
567
+                "symfony/twig-bundle": ">=2.1,<2.3"
568
+            },
569
+            "time": "2013-05-14 18:06:07",
570
+            "type": "symfony-bundle",
571
+            "extra": {
572
+                "branch-alias": {
573
+                    "dev-master": "1.1.x-dev"
574
+                }
575
+            },
576
+            "autoload": {
577
+                "psr-0": {
578
+                    "FOS\\FacebookBundle": ""
579
+                }
580
+            },
581
+            "notification-url": "https://packagist.org/downloads/",
582
+            "license": [
583
+                "MIT"
584
+            ],
585
+            "authors": [
586
+                {
587
+                    "name": "Kris Wallsmith",
588
+                    "email": "kris.wallsmith@gmail.com",
589
+                    "homepage": "http://kriswallsmith.net/"
590
+                },
591
+                {
592
+                    "name": "FriendsOfSymfony Community",
593
+                    "homepage": "https://github.com/friendsofsymfony/FOSFacebookBundle/contributors"
594
+                }
595
+            ],
596
+            "description": "Integrate the Facebook Platform into your Symfony2 application.",
597
+            "homepage": "http://friendsofsymfony.github.com",
598
+            "keywords": [
599
+                "facebook"
600
+            ]
601
+        },
602
+        {
500 603
             "name": "friendsofsymfony/user-bundle",
501 604
             "version": "v1.3.1",
502 605
             "target-dir": "FOS/UserBundle",
@@ -647,19 +750,19 @@
647 750
             "source": {
648 751
                 "type": "git",
649 752
                 "url": "https://github.com/Gregwar/ImageBundle.git",
650
-                "reference": "255d20676a53c921a7a1832d360b6eca705f5b44"
753
+                "reference": "d6d8c1aa8c4fe03a9b8470d2bf195c4dbf89643b"
651 754
             },
652 755
             "dist": {
653 756
                 "type": "zip",
654
-                "url": "https://api.github.com/repos/Gregwar/ImageBundle/zipball/255d20676a53c921a7a1832d360b6eca705f5b44",
655
-                "reference": "255d20676a53c921a7a1832d360b6eca705f5b44",
757
+                "url": "https://api.github.com/repos/Gregwar/ImageBundle/zipball/d6d8c1aa8c4fe03a9b8470d2bf195c4dbf89643b",
758
+                "reference": "d6d8c1aa8c4fe03a9b8470d2bf195c4dbf89643b",
656 759
                 "shasum": ""
657 760
             },
658 761
             "require": {
659 762
                 "ext-gd": "*",
660 763
                 "php": ">=5.3.0"
661 764
             },
662
-            "time": "2013-04-25 11:48:38",
765
+            "time": "2013-05-09 10:44:43",
663 766
             "type": "symfony-bundle",
664 767
             "autoload": {
665 768
                 "psr-0": {
@@ -1108,12 +1211,12 @@
1108 1211
             "source": {
1109 1212
                 "type": "git",
1110 1213
                 "url": "https://github.com/kriswallsmith/assetic.git",
1111
-                "reference": "1b17f9a239276f24344f9f7d7be8293f6dca4e19"
1214
+                "reference": "5441014f28b8fe024c547fb7a15cd737c6cb1a05"
1112 1215
             },
1113 1216
             "dist": {
1114 1217
                 "type": "zip",
1115
-                "url": "https://api.github.com/repos/kriswallsmith/assetic/zipball/1b17f9a239276f24344f9f7d7be8293f6dca4e19",
1116
-                "reference": "1b17f9a239276f24344f9f7d7be8293f6dca4e19",
1218
+                "url": "https://api.github.com/repos/kriswallsmith/assetic/zipball/5441014f28b8fe024c547fb7a15cd737c6cb1a05",
1219
+                "reference": "5441014f28b8fe024c547fb7a15cd737c6cb1a05",
1117 1220
                 "shasum": ""
1118 1221
             },
1119 1222
             "require": {
@@ -1128,9 +1231,9 @@
1128 1231
                 "leafo/scssphp": "*",
1129 1232
                 "leafo/scssphp-compass": "*",
1130 1233
                 "mrclay/minify": "*",
1131
-                "phpunit/phpunit": "3.7.*",
1234
+                "phpunit/phpunit": ">=3.7,<4.0",
1132 1235
                 "ptachoire/cssembed": "*",
1133
-                "twig/twig": ">=1.6.0,<2.0"
1236
+                "twig/twig": ">=1.6,<2.0"
1134 1237
             },
1135 1238
             "suggest": {
1136 1239
                 "leafo/lessphp": "Assetic provides the integration with the lessphp LESS compiler",
@@ -1139,11 +1242,11 @@
1139 1242
                 "ptachoire/cssembed": "Assetic provides the integration with phpcssembed to embed data uris",
1140 1243
                 "twig/twig": "Assetic provides the integration with the Twig templating engine"
1141 1244
             },
1142
-            "time": "2013-04-27 14:32:20",
1245
+            "time": "2013-05-18 16:31:41",
1143 1246
             "type": "library",
1144 1247
             "extra": {
1145 1248
                 "branch-alias": {
1146
-                    "dev-master": "1.1-dev"
1249
+                    "dev-master": "1.2-dev"
1147 1250
                 }
1148 1251
             },
1149 1252
             "autoload": {
@@ -1235,12 +1338,12 @@
1235 1338
             "source": {
1236 1339
                 "type": "git",
1237 1340
                 "url": "https://github.com/whiteoctober/Pagerfanta.git",
1238
-                "reference": "65c24acf84410837aa873801f5a09b4039a5735b"
1341
+                "reference": "55544f3af5b409d4ee9d618934f4d92ef874672c"
1239 1342
             },
1240 1343
             "dist": {
1241 1344
                 "type": "zip",
1242
-                "url": "https://api.github.com/repos/whiteoctober/Pagerfanta/zipball/65c24acf84410837aa873801f5a09b4039a5735b",
1243
-                "reference": "65c24acf84410837aa873801f5a09b4039a5735b",
1345
+                "url": "https://api.github.com/repos/whiteoctober/Pagerfanta/zipball/55544f3af5b409d4ee9d618934f4d92ef874672c",
1346
+                "reference": "55544f3af5b409d4ee9d618934f4d92ef874672c",
1244 1347
                 "shasum": ""
1245 1348
             },
1246 1349
             "require": {
@@ -1260,7 +1363,7 @@
1260 1363
                 "propel/propel1": "To use the PropelAdapter",
1261 1364
                 "solarium/solarium": "To use the SolariumAdapter."
1262 1365
             },
1263
-            "time": "2013-04-24 11:37:27",
1366
+            "time": "2013-05-16 12:46:53",
1264 1367
             "type": "library",
1265 1368
             "extra": {
1266 1369
                 "branch-alias": {
@@ -1293,23 +1396,23 @@
1293 1396
         },
1294 1397
         {
1295 1398
             "name": "sensio/distribution-bundle",
1296
-            "version": "v2.1.9",
1399
+            "version": "v2.1.10",
1297 1400
             "target-dir": "Sensio/Bundle/DistributionBundle",
1298 1401
             "source": {
1299 1402
                 "type": "git",
1300 1403
                 "url": "https://github.com/sensio/SensioDistributionBundle.git",
1301
-                "reference": "v2.1.9"
1404
+                "reference": "v2.1.10"
1302 1405
             },
1303 1406
             "dist": {
1304 1407
                 "type": "zip",
1305
-                "url": "https://api.github.com/repos/sensio/SensioDistributionBundle/zipball/v2.1.9",
1306
-                "reference": "v2.1.9",
1408
+                "url": "https://api.github.com/repos/sensio/SensioDistributionBundle/zipball/v2.1.10",
1409
+                "reference": "v2.1.10",
1307 1410
                 "shasum": ""
1308 1411
             },
1309 1412
             "require": {
1310 1413
                 "symfony/framework-bundle": "2.1.*"
1311 1414
             },
1312
-            "time": "2013-02-04 19:54:42",
1415
+            "time": "2013-04-09 09:20:26",
1313 1416
             "type": "symfony-bundle",
1314 1417
             "extra": {
1315 1418
                 "branch-alias": {
@@ -1339,24 +1442,24 @@
1339 1442
         },
1340 1443
         {
1341 1444
             "name": "sensio/framework-extra-bundle",
1342
-            "version": "v2.1.9",
1445
+            "version": "v2.1.10",
1343 1446
             "target-dir": "Sensio/Bundle/FrameworkExtraBundle",
1344 1447
             "source": {
1345 1448
                 "type": "git",
1346 1449
                 "url": "https://github.com/sensio/SensioFrameworkExtraBundle.git",
1347
-                "reference": "v2.1.9"
1450
+                "reference": "v2.1.10"
1348 1451
             },
1349 1452
             "dist": {
1350 1453
                 "type": "zip",
1351
-                "url": "https://api.github.com/repos/sensio/SensioFrameworkExtraBundle/zipball/v2.1.9",
1352
-                "reference": "v2.1.9",
1454
+                "url": "https://api.github.com/repos/sensio/SensioFrameworkExtraBundle/zipball/v2.1.10",
1455
+                "reference": "v2.1.10",
1353 1456
                 "shasum": ""
1354 1457
             },
1355 1458
             "require": {
1356 1459
                 "doctrine/common": ">=2.1,<2.5-dev",
1357 1460
                 "symfony/framework-bundle": "2.1.*"
1358 1461
             },
1359
-            "time": "2013-02-22 17:57:31",
1462
+            "time": "2013-04-05 06:59:04",
1360 1463
             "type": "symfony-bundle",
1361 1464
             "extra": {
1362 1465
                 "branch-alias": {
@@ -1386,17 +1489,17 @@
1386 1489
         },
1387 1490
         {
1388 1491
             "name": "sensio/generator-bundle",
1389
-            "version": "v2.1.9",
1492
+            "version": "v2.1.10",
1390 1493
             "target-dir": "Sensio/Bundle/GeneratorBundle",
1391 1494
             "source": {
1392 1495
                 "type": "git",
1393 1496
                 "url": "https://github.com/sensio/SensioGeneratorBundle.git",
1394
-                "reference": "v2.1.9"
1497
+                "reference": "v2.1.10"
1395 1498
             },
1396 1499
             "dist": {
1397 1500
                 "type": "zip",
1398
-                "url": "https://api.github.com/repos/sensio/SensioGeneratorBundle/zipball/v2.1.9",
1399
-                "reference": "v2.1.9",
1501
+                "url": "https://api.github.com/repos/sensio/SensioGeneratorBundle/zipball/v2.1.10",
1502
+                "reference": "v2.1.10",
1400 1503
                 "shasum": ""
1401 1504
             },
1402 1505
             "require": {
@@ -1408,7 +1511,7 @@
1408 1511
                 "symfony/doctrine-bridge": "2.1.*",
1409 1512
                 "twig/twig": ">=1.8,<2.0-dev"
1410 1513
             },
1411
-            "time": "2013-01-04 17:09:08",
1514
+            "time": "2013-04-01 18:11:18",
1412 1515
             "type": "symfony-bundle",
1413 1516
             "extra": {
1414 1517
                 "branch-alias": {
@@ -1486,12 +1589,12 @@
1486 1589
             "source": {
1487 1590
                 "type": "git",
1488 1591
                 "url": "https://github.com/sonata-project/SonataAdminBundle.git",
1489
-                "reference": "c611614f23d5d42257747ae81bcc36df86216bae"
1592
+                "reference": "2.1.0"
1490 1593
             },
1491 1594
             "dist": {
1492 1595
                 "type": "zip",
1493
-                "url": "https://api.github.com/repos/sonata-project/SonataAdminBundle/zipball/c611614f23d5d42257747ae81bcc36df86216bae",
1494
-                "reference": "c611614f23d5d42257747ae81bcc36df86216bae",
1596
+                "url": "https://api.github.com/repos/sonata-project/SonataAdminBundle/zipball/2.1.0",
1597
+                "reference": "2.1.0",
1495 1598
                 "shasum": ""
1496 1599
             },
1497 1600
             "require": {
@@ -1562,12 +1665,12 @@
1562 1665
             "source": {
1563 1666
                 "type": "git",
1564 1667
                 "url": "https://github.com/sonata-project/SonataBlockBundle.git",
1565
-                "reference": "3f18e2df3171bb1149f55ffcb34ecc41169bf15f"
1668
+                "reference": "2.1.2"
1566 1669
             },
1567 1670
             "dist": {
1568 1671
                 "type": "zip",
1569
-                "url": "https://api.github.com/repos/sonata-project/SonataBlockBundle/zipball/3f18e2df3171bb1149f55ffcb34ecc41169bf15f",
1570
-                "reference": "3f18e2df3171bb1149f55ffcb34ecc41169bf15f",
1672
+                "url": "https://api.github.com/repos/sonata-project/SonataBlockBundle/zipball/2.1.2",
1673
+                "reference": "2.1.2",
1571 1674
                 "shasum": ""
1572 1675
             },
1573 1676
             "require": {
@@ -1677,16 +1780,16 @@
1677 1780
         },
1678 1781
         {
1679 1782
             "name": "sonata-project/exporter",
1680
-            "version": "1.2.1",
1783
+            "version": "1.2.2",
1681 1784
             "source": {
1682 1785
                 "type": "git",
1683 1786
                 "url": "https://github.com/sonata-project/exporter.git",
1684
-                "reference": "1.2.1"
1787
+                "reference": "1.2.2"
1685 1788
             },
1686 1789
             "dist": {
1687 1790
                 "type": "zip",
1688
-                "url": "https://api.github.com/repos/sonata-project/exporter/zipball/1.2.1",
1689
-                "reference": "1.2.1",
1791
+                "url": "https://api.github.com/repos/sonata-project/exporter/zipball/1.2.2",
1792
+                "reference": "1.2.2",
1690 1793
                 "shasum": ""
1691 1794
             },
1692 1795
             "require": {
@@ -1700,7 +1803,7 @@
1700 1803
                 "ext-curl": "*",
1701 1804
                 "symfony/routing": "*"
1702 1805
             },
1703
-            "time": "2013-03-04 14:20:46",
1806
+            "time": "2013-05-02 17:17:04",
1704 1807
             "type": "library",
1705 1808
             "autoload": {
1706 1809
                 "psr-0": {
@@ -2011,17 +2114,17 @@
2011 2114
         },
2012 2115
         {
2013 2116
             "name": "symfony/swiftmailer-bundle",
2014
-            "version": "v2.1.9",
2117
+            "version": "v2.1.10",
2015 2118
             "target-dir": "Symfony/Bundle/SwiftmailerBundle",
2016 2119
             "source": {
2017 2120
                 "type": "git",
2018 2121
                 "url": "https://github.com/symfony/SwiftmailerBundle.git",
2019
-                "reference": "v2.1.9"
2122
+                "reference": "v2.1.10"
2020 2123
             },
2021 2124
             "dist": {
2022 2125
                 "type": "zip",
2023
-                "url": "https://api.github.com/repos/symfony/SwiftmailerBundle/zipball/v2.1.9",
2024
-                "reference": "v2.1.9",
2126
+                "url": "https://api.github.com/repos/symfony/SwiftmailerBundle/zipball/v2.1.10",
2127
+                "reference": "v2.1.10",
2025 2128
                 "shasum": ""
2026 2129
             },
2027 2130
             "require": {
@@ -2201,26 +2304,26 @@
2201 2304
         },
2202 2305
         {
2203 2306
             "name": "twig/twig",
2204
-            "version": "v1.12.3",
2307
+            "version": "v1.13.0",
2205 2308
             "source": {
2206 2309
                 "type": "git",
2207 2310
                 "url": "https://github.com/fabpot/Twig.git",
2208
-                "reference": "v1.12.3"
2311
+                "reference": "v1.13.0"
2209 2312
             },
2210 2313
             "dist": {
2211 2314
                 "type": "zip",
2212
-                "url": "https://api.github.com/repos/fabpot/Twig/zipball/v1.12.3",
2213
-                "reference": "v1.12.3",
2315
+                "url": "https://api.github.com/repos/fabpot/Twig/zipball/v1.13.0",
2316
+                "reference": "v1.13.0",
2214 2317
                 "shasum": ""
2215 2318
             },
2216 2319
             "require": {
2217 2320
                 "php": ">=5.2.4"
2218 2321
             },
2219
-            "time": "2013-04-08 12:40:11",
2322
+            "time": "2013-05-10 15:12:43",
2220 2323
             "type": "library",
2221 2324
             "extra": {
2222 2325
                 "branch-alias": {
2223
-                    "dev-master": "1.12-dev"
2326
+                    "dev-master": "1.13-dev"
2224 2327
                 }
2225 2328
             },
2226 2329
             "autoload": {
@@ -2250,7 +2353,7 @@
2250 2353
         },
2251 2354
         {
2252 2355
             "name": "white-october/pagerfanta-bundle",
2253
-            "version": "dev-master",
2356
+            "version": "2.1.x-dev",
2254 2357
             "target-dir": "WhiteOctober/PagerfantaBundle",
2255 2358
             "source": {
2256 2359
                 "type": "git",
@@ -2317,6 +2420,7 @@
2317 2420
         "sonata-project/doctrine-orm-admin-bundle": 20,
2318 2421
         "sonata-project/admin-bundle": 20,
2319 2422
         "sonata-project/jquery-bundle": 20,
2320
-        "sonata-project/block-bundle": 20
2423
+        "sonata-project/block-bundle": 20,
2424
+        "friendsofsymfony/facebook-bundle": 20
2321 2425
     }
2322 2426
 }

+ 4 - 0
src/Muzich/AdminBundle/Resources/config/Moderate_tag-generator.yml Näytä tiedosto

@@ -14,10 +14,14 @@ builders:
14 14
       object_actions:
15 15
         accept:
16 16
           route: Muzich_AdminBundle_Moderate_tag_accept
17
+          params:
18
+            pk: "{{ Tag.id }}"
17 19
           icon: icon-ok-sign
18 20
           class: moderate_accept
19 21
         refuse:
20 22
           route: Muzich_AdminBundle_Moderate_tag_refuse
23
+          params:
24
+            pk: "{{ Tag.id }}"
21 25
           icon: icon-trash
22 26
           class: moderate_refuse
23 27
       sort: [ tomoderate, DESC ]

+ 2 - 7
src/Muzich/CoreBundle/Controller/ElementController.php Näytä tiedosto

@@ -364,11 +364,6 @@ class ElementController extends Controller
364 364
       return $this->redirect($this->generateUrl('home'));
365 365
     }
366 366
     
367
-    if (($response = $this->mustBeConnected()))
368
-    {
369
-      return $response;
370
-    }
371
-    
372 367
     if ($this->getRequest()->getMethod() != 'POST')
373 368
     {
374 369
       throw new \Symfony\Component\HttpKernel\Exception\NotFoundHttpException();
@@ -396,7 +391,7 @@ class ElementController extends Controller
396 391
     ));
397 392
     
398 393
     // Récupération de ces nouveaux élméents
399
-    $elements = $es->getElements($this->getDoctrine(), $this->getUserId());
394
+    $elements = $es->getElements($this->getDoctrine(), $this->getUserId(true));
400 395
     
401 396
     // On en fait un rendu graphique
402 397
     $html_elements = $this->render('MuzichCoreBundle:SearchElement:default.html.twig', array(
@@ -416,7 +411,7 @@ class ElementController extends Controller
416 411
         // On n'en récupère que x
417 412
         'count'     => $this->container->getParameter('search_default_count')
418 413
       ));
419
-      $count = $es->getElements($this->getDoctrine(), $this->getUserId(), 'count');
414
+      $count = $es->getElements($this->getDoctrine(), $this->getUserId(true), 'count');
420 415
     }
421 416
     
422 417
     return $this->jsonResponse(array(

+ 29 - 0
src/Muzich/CoreBundle/Entity/User.php Näytä tiedosto

@@ -281,6 +281,9 @@ class User extends BaseUser
281 281
    */
282 282
   private $password_set = true;
283 283
   
284
+  /** @ORM\Column(name="facebook_id", type="string", length=255, nullable=true) */
285
+  protected $facebook_id;
286
+  
284 287
   /**
285 288
    * 
286 289
    */
@@ -1172,4 +1175,30 @@ class User extends BaseUser
1172 1175
     $this->setPasswordSet(true);
1173 1176
   }
1174 1177
   
1178
+  /** @return void */
1179
+  public function setFacebookId($facebook_id)
1180
+  {
1181
+    $this->facebook_id = $facebook_id;
1182
+    $this->password_set = true;
1183
+    $this->setEmailConfirmed(true);
1184
+  }
1185
+
1186
+  /** @return string */
1187
+  public function getFacebookId()
1188
+  {
1189
+    return $this->facebook_id;
1190
+  }
1191
+  
1192
+  /** @param Array */
1193
+  public function setFBData($fbdata) // C'est dans cette méthode que vous ajouterez vos informations
1194
+  {
1195
+    if (isset($fbdata['id'])) {
1196
+      $this->setFacebookId($fbdata['id']);
1197
+      $this->addRole('ROLE_FACEBOOK');
1198
+    }
1199
+    if (isset($fbdata['email'])) {
1200
+      $this->setEmail($fbdata['email']);
1201
+    }
1202
+  }
1203
+  
1175 1204
 }

+ 8 - 0
src/Muzich/CoreBundle/Repository/UserRepository.php Näytä tiedosto

@@ -266,4 +266,12 @@ class UserRepository extends EntityRepository
266 266
     ;
267 267
   }
268 268
   
269
+  public function countUsers()
270
+  {
271
+    return $this->getEntityManager()
272
+      ->createQuery("SELECT COUNT(u.id) FROM MuzichCoreBundle:User u")
273
+      ->getSingleScalarResult()
274
+    ;
275
+  }
276
+  
269 277
 }  

+ 10 - 3
src/Muzich/CoreBundle/Resources/config/security.yml Näytä tiedosto

@@ -1,4 +1,4 @@
1
-parameters:
1
+#parameters:
2 2
     # ... other parameters
3 3
     #security.acl.permission.map.class: Sonata\AdminBundle\Security\Acl\Permission\AdminPermissionMap
4 4
     
@@ -6,6 +6,8 @@ security:
6 6
     providers:
7 7
         fos_userbundle:
8 8
             id: fos_user.user_provider.username_email
9
+        my_facebook_provider:
10
+            id: my_user.facebook_provider
9 11
     encoders:
10 12
         "FOS\UserBundle\Model\UserInterface":
11 13
             algorithm: sha512
@@ -22,8 +24,13 @@ security:
22 24
                 check_path:     /login_check
23 25
                 failure_path:   null
24 26
                 default_target_path: home
25
-                success_handler: security.authentication.success_handler
26
-                failure_handler: security.authentication.failure_handler
27
+                success_handler: muzich.security.authentication.success_handler
28
+                failure_handler: muzich.security.authentication.failure_handler
29
+            fos_facebook:
30
+                app_url: "%api_facebook_name%"
31
+                server_url: "%api_facebook_server%"
32
+                check_path: /login_facebook_check
33
+                provider: my_facebook_provider
27 34
                 
28 35
             logout:
29 36
                 path:   /logout

+ 15 - 2
src/Muzich/CoreBundle/Resources/public/css/main.css Näytä tiedosto

@@ -971,8 +971,8 @@ ul#favorite_tags li
971 971
 
972 972
 #registration_link, #login_link
973 973
 {
974
-  margin-right: -10px;
975
-  margin-top: -68px;
974
+  margin-right: -112px;
975
+  margin-top: -76px;
976 976
 }
977 977
 
978 978
 #element_add_link img, #element_add_close_link img, #group_add_link img, #group_add_link_disabled img, #group_add_close_link img, #registration_link img, #login_link img
@@ -2207,3 +2207,16 @@ div#helpbox div.center input.button
2207 2207
 {
2208 2208
   float: none;
2209 2209
 }
2210
+
2211
+div#facebook_login
2212
+{
2213
+  float: right;
2214
+  margin-bottom: 0;
2215
+  margin-right: 0;
2216
+  margin-top: -5px;
2217
+}
2218
+
2219
+div#login_box
2220
+{
2221
+  margin-top: 23px;
2222
+}

+ 5 - 0
src/Muzich/CoreBundle/Resources/public/js/muzich.js Näytä tiedosto

@@ -3171,12 +3171,17 @@ function open_connection_or_subscription_window(open_login_part)
3171 3171
         }
3172 3172
       });
3173 3173
       
3174
+      $('div#facebook_login').prependTo('div#helpbox');
3175
+      $('div#facebook_login').show();
3176
+      
3174 3177
     });
3175 3178
   }
3176 3179
 }
3177 3180
 
3178 3181
 function close_popin()
3179 3182
 {
3183
+  $('div#facebook_login').hide();
3184
+  $('div#facebook_login').appendTo('body');
3180 3185
   // Fond gris
3181 3186
   $('#fade').fadeOut(1000, function(){$('#fade').remove();});
3182 3187
   // On cache le lecteur

+ 23 - 0
src/Muzich/CoreBundle/Resources/views/Component/facebook.html.twig Näytä tiedosto

@@ -0,0 +1,23 @@
1
+{{ facebook_initialize({'xfbml': true, 'culture': 'fr_FR', 'fbAsyncInit': 'onFbInit();'}) }}
2
+<script type="text/javascript" > // Script for FOSFacebookBundle
3
+function goLogIn(){
4
+    window.location = "{{ path('_security_check') }}";
5
+}
6
+
7
+function onFbInit() {
8
+    if (typeof(FB) != 'undefined' && FB != null ) {
9
+        FB.Event.subscribe('auth.statusChange', function(response) {
10
+            if (response.session || response.authResponse) {
11
+                setTimeout(goLogIn, 50);
12
+            } else {
13
+                window.location = "{{ path('_security_logout') }}";
14
+            }
15
+        });
16
+    }
17
+}
18
+</script>
19
+
20
+<div id="facebook_login" style="display: none;">
21
+  {{ facebook_login_button({'autologoutlink': false}) }}
22
+</div>
23
+  

+ 5 - 3
src/Muzich/CoreBundle/Resources/views/Element/form.add.html.twig Näytä tiedosto

@@ -15,9 +15,11 @@
15 15
 
16 16
   <span class="help">
17 17
     {{ 'element_add.url.help'|trans({}, 'userui') }}
18
-    <a href="{{ path('helpbox_bootstrap', {'ressource_id':'element_add_url'}) }}" class="helpbox">
19
-      {{ 'element_add.url.more_help'|trans({}, 'userui') }}
20
-    </a>
18
+    <strong>
19
+      <a href="{{ path('helpbox_bootstrap', {'ressource_id':'element_add_url'}) }}" class="helpbox">
20
+        {{ 'element_add.url.more_help'|trans({}, 'userui') }}
21
+      </a>
22
+      </strong>
21 23
   </span>
22 24
   
23 25
 

+ 6 - 1
src/Muzich/CoreBundle/Resources/views/Helpbox/element_add_url.html.twig Näytä tiedosto

@@ -1,6 +1,11 @@
1 1
 <h1>{{ 'help.element_add_url.title1'|trans({}, 'text') }}</h1>
2 2
 
3
-<p>{{ 'help.element_add_url.text1'|trans({}, 'text') }}</p>
3
+<p>
4
+  {{ 'help.element_add_url.text1'|trans({}, 'text') }}
5
+  <strong>
6
+    {{ 'help.element_add_url.text1_plugin'|trans({}, 'text') }}
7
+  </strong>
8
+</p>
4 9
 
5 10
 <h2>{{ 'help.element_add_url.title2'|trans({}, 'text') }}</h2>
6 11
 

+ 2 - 1
src/Muzich/CoreBundle/Resources/views/layout.html.twig Näytä tiedosto

@@ -1,5 +1,5 @@
1 1
 <!doctype html>
2
-<html>
2
+<html xmlns:fb="http://www.facebook.com/2008/fbml">
3 3
   <head>
4 4
     <title>Muzi.ch - {% block title %}{% endblock %}</title>
5 5
     {% include 'MuzichCoreBundle:Layout:head.html.twig' %}
@@ -8,6 +8,7 @@
8 8
   </head>
9 9
   <body>
10 10
     
11
+    {% include 'MuzichCoreBundle:Component:facebook.html.twig' %}
11 12
     {% include 'MuzichCoreBundle:Layout:noscript.html.twig' %}
12 13
     {% include 'MuzichCoreBundle:Autoplay:autoplay.html.twig' %}
13 14
   

+ 13 - 1
src/Muzich/CoreBundle/Searcher/ElementSearcherQueryBuilder.php Näytä tiedosto

@@ -217,8 +217,20 @@ class ElementSearcherQueryBuilder
217 217
   private function buildStrict()
218 218
   {
219 219
     // Recherche strict ou non ?
220
-    if ($this->es->getTagStrict() && count(($tags = $this->es->getTags())))
220
+    if ($this->es->getTagStrict() && count(($tags = $this->es->getTags())) && $this->es->getTags() != '[]')
221 221
     {
222
+      if (is_null($tags) && !count($tags))
223
+      {
224
+        return;
225
+      }
226
+      
227
+      if (is_string($tags))
228
+      {
229
+        if (is_null(trim($tags)))
230
+        {
231
+          return;
232
+        }
233
+      }
222 234
       // On a besoin de récupérer la liste des element_id qui ont les tags
223 235
       // demandés.
224 236
       $tag_ids = '';

+ 84 - 0
src/Muzich/CoreBundle/Security/User/Provider/FacebookProvider.php Näytä tiedosto

@@ -0,0 +1,84 @@
1
+<?php
2
+
3
+namespace Muzich\CoreBundle\Security\User\Provider;
4
+
5
+use Symfony\Component\Security\Core\Exception\UsernameNotFoundException;
6
+use Symfony\Component\Security\Core\Exception\UnsupportedUserException;
7
+use Symfony\Component\Security\Core\User\UserProviderInterface;
8
+use Symfony\Component\Security\Core\User\UserInterface;
9
+
10
+use \BaseFacebook;
11
+use \FacebookApiException;
12
+
13
+class FacebookProvider implements UserProviderInterface
14
+{
15
+  /**
16
+   * @var \Facebook
17
+   */
18
+  protected $facebook;
19
+  protected $userManager;
20
+  protected $validator;
21
+
22
+  public function __construct(BaseFacebook $facebook, $userManager, $validator)
23
+  {
24
+    $this->facebook = $facebook;
25
+    $this->userManager = $userManager;
26
+    $this->validator = $validator;
27
+  }
28
+
29
+  public function supportsClass($class)
30
+  {
31
+    return $this->userManager->supportsClass($class);
32
+  }
33
+
34
+  public function findUserByFbId($fbId)
35
+  {
36
+    return $this->userManager->findUserBy(array('facebook_id' => $fbId));
37
+  }
38
+
39
+  public function findUserByEmail($email)
40
+  {
41
+    return $this->userManager->findUserBy(array('email' => $this->userManager->canonicalizeEmailLocal($email)));
42
+  }
43
+
44
+  public function loadUserByUsername($username)
45
+  {
46
+    $user = $this->findUserByFbId($username);
47
+
48
+    try {
49
+      $fbdata = $this->facebook->api('/me');
50
+    } catch (FacebookApiException $e) {
51
+      throw new UsernameNotFoundException('The user is not authenticated on facebook');
52
+      $fbdata = null;
53
+    }
54
+    
55
+    $user = $this->findUserByEmail($fbdata['email']);
56
+    
57
+    if (!empty($fbdata)) {
58
+      if (empty($user)) {
59
+        $user = $this->userManager->getNewReadyUser();
60
+        $user->setFBData($fbdata);
61
+      }
62
+
63
+      if (count($this->validator->validate($user, 'Facebook'))) {
64
+        throw new UsernameNotFoundException('The facebook user could not be stored');
65
+      }
66
+      $this->userManager->updateUser($user);
67
+    }
68
+
69
+    if (empty($user)) {
70
+      throw new UsernameNotFoundException('The user is not authenticated on facebook');
71
+    }
72
+
73
+    return $user;
74
+  }
75
+
76
+  public function refreshUser(UserInterface $user)
77
+  {
78
+    if (!$this->supportsClass(get_class($user)) || !$user->getFacebookId()) {
79
+      throw new UnsupportedUserException(sprintf('Instances of "%s" are not supported.', get_class($user)));
80
+    }
81
+    
82
+    return $this->loadUserByUsername($user->getFacebookId());
83
+  }
84
+}

+ 1 - 52
src/Muzich/UserBundle/Controller/UserController.php Näytä tiedosto

@@ -136,58 +136,7 @@ class UserController extends Controller
136 136
   /** @return User */
137 137
   protected function getNewUser()
138 138
   {
139
-    // Ce serais mieux d'appeler notre user manager et d'utiliser notre createUser
140
-    // avec ce code.
141
-    $userManager = $this->container->get('fos_user.user_manager');
142
-    $user = $userManager->createUser();
143
-    $user->setUsername($this->generateUsername());
144
-    $user->setPlainPassword($this->generatePassword(32));
145
-    $user->setEnabled(true);
146
-    $user->setCguAccepted(true);
147
-    $user->setEmailConfirmed(false);
148
-    $user->setUsernameUpdatable(true);
149
-    $user->setPasswordSet(false);
150
-    return $user;
151
-  }
152
-  
153
-  protected function generateUsername()
154
-  {
155
-    $qb = $this->getEntityManager()->createQueryBuilder();
156
-    $qb->select('count(id)');
157
-    $qb->from('MuzichCoreBundle:User','id');
158
-    $count = $qb->getQuery()->getSingleScalarResult();
159
-    
160
-    while ($this->usernameExist($count))
161
-    {
162
-      $count++;
163
-    }
164
-    
165
-    return 'User'.$count;
166
-  }
167
-  
168
-  protected function usernameExist($count)
169
-  {
170
-    $username = 'User'.$count;
171
-    if ($this->getEntityManager()->getRepository('MuzichCoreBundle:User')
172
-      ->findOneByUsername($username))
173
-    {
174
-      return true;
175
-    }
176
-    
177
-    return false;
178
-  }
179
-  
180
-  protected function generatePassword($length = 8)
181
-  {
182
-    $chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
183
-    $count = mb_strlen($chars);
184
-    
185
-    for ($i = 0, $result = ''; $i < $length; $i++) {
186
-        $index = rand(0, $count - 1);
187
-        $result .= mb_substr($chars, $index, 1);
188
-    }
189
-    
190
-    return $result;
139
+    return $this->container->get('muzich_user_manager')->getNewReadyUser();
191 140
   }
192 141
   
193 142
   protected function checkRegistrationValues($form)

+ 53 - 0
src/Muzich/UserBundle/Entity/UserManager.php Näytä tiedosto

@@ -32,5 +32,58 @@ class UserManager extends UserManagerBase
32 32
 
33 33
     $this->objectManager->getEventManager()->addEventSubscriber($sluggableListener);
34 34
   }
35
+  
36
+  public function getNewReadyUser()
37
+  {
38
+    $user = $this->createUser();
39
+    $user->setUsername($this->generateUsername());
40
+    $user->setPlainPassword($this->generatePassword(32));
41
+    $user->setEnabled(true);
42
+    $user->setCguAccepted(true);
43
+    $user->setEmailConfirmed(false);
44
+    $user->setUsernameUpdatable(true);
45
+    $user->setPasswordSet(false);
46
+    return $user;
47
+  }
48
+  
49
+  protected function generateUsername()
50
+  {
51
+    $count = $this->repository->countUsers();
52
+    while ($this->usernameExist($count))
53
+    {
54
+      $count++;
55
+    }
56
+    
57
+    return 'User'.$count;
58
+  }
59
+  
60
+  protected function usernameExist($count)
61
+  {
62
+    $username = 'User'.$count;
63
+    if ($this->repository->findOneByUsername($username))
64
+    {
65
+      return true;
66
+    }
67
+    
68
+    return false;
69
+  }
70
+  
71
+  protected function generatePassword($length = 8)
72
+  {
73
+    $chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
74
+    $count = mb_strlen($chars);
75
+    
76
+    for ($i = 0, $result = ''; $i < $length; $i++) {
77
+        $index = rand(0, $count - 1);
78
+        $result .= mb_substr($chars, $index, 1);
79
+    }
80
+    
81
+    return $result;
82
+  }
83
+  
84
+  public function canonicalizeEmailLocal($email)
85
+  {
86
+    return $this->emailCanonicalizer->canonicalize($email);
87
+  }
35 88
 
36 89
 }

+ 1 - 1
src/Muzich/UserBundle/Resources/views/Account/subscribe_or_login.html.twig Näytä tiedosto

@@ -20,4 +20,4 @@
20 20
   
21 21
   {% include "MuzichUserBundle:Registration:register.html.twig" %}
22 22
   
23
-</div>
23
+</div>

+ 1 - 4
web/bundles/admingeneratorgenerator/javascripts/double_list.js Näytä tiedosto

@@ -2,12 +2,9 @@ var sfDoubleList =
2 2
 {
3 3
   init: function(id, className)
4 4
   {
5
-    if(id == null)
6
-    return;
7
-    
8 5
     form = sfDoubleList.get_current_form(id);
9 6
 
10
-      callback = function() { sfDoubleList.submit(form, className) };
7
+    callback = function() { sfDoubleList.submit(form, className) };
11 8
 
12 9
     if (form.addEventListener)
13 10
     {

+ 26 - 6
web/bundles/admingeneratorgenerator/js/admingenerator/general.js Näytä tiedosto

@@ -1,10 +1,30 @@
1 1
 $(document).ready(function(){
2 2
     // Enable tooltips
3
-    $('a[rel="tooltip"]').tooltip();
3
+    $('td.actions button[rel="tooltip"]').tooltip();
4 4
     
5
-    // Enable confirm on object actions
6
-    $("td.actions a[data-confirm]").click(function(e) {
7
-        e.preventDefault();        
8
-    	if(confirm($(this).data('confirm'))) { window.location.href = $(this).attr('href'); }
5
+    // Convert object action buttons into POST requests
6
+    $("td.actions button, .form-actions .btn-toolbar button").click(function(e) {
7
+        e.preventDefault();
8
+        
9
+        // Create hidden form
10
+        var form = $('<form />').attr({
11
+            method: 'POST',
12
+            action: $(this).data('action'),
13
+            style:  'visibility: hidden'
14
+        }).appendTo($('body'));
15
+        
16
+        if($(this).data('csrf-token')) {
17
+            // Add csrf protection token
18
+            $('<input />').attr({
19
+                type:   'hidden',
20
+                name:   '_csrf_token',
21
+                value:  $(this).data('csrf-token')
22
+            }).appendTo(form);
23
+        }
24
+        
25
+        // Submit POST request, if required promt for confirmation
26
+        if(!$(this).data('confirm') || confirm($(this).data('confirm'))) {
27
+            form.submit();
28
+        }
9 29
     });
10
-});
30
+});

+ 97 - 0
web/bundles/admingeneratorgenerator/js/jquery-bbq/jquery.deparam.js Näytä tiedosto

@@ -0,0 +1,97 @@
1
+/*
2
+  jQuery deparam is an extraction of the deparam method from Ben Alman's jQuery BBQ
3
+  http://benalman.com/projects/jquery-bbq-plugin/
4
+*/
5
+(function ($) {
6
+  $.deparam = function (params, coerce) {
7
+    var obj = {},
8
+        coerce_types = { 'true': !0, 'false': !1, 'null': null };
9
+      
10
+    // Iterate over all name=value pairs.
11
+    $.each(params.replace(/\+/g, ' ').split('&'), function (j,v) {
12
+      var param = v.split('='),
13
+          key = decodeURIComponent(param[0]),
14
+          val,
15
+          cur = obj,
16
+          i = 0,
17
+            
18
+          // If key is more complex than 'foo', like 'a[]' or 'a[b][c]', split it
19
+          // into its component parts.
20
+          keys = key.split(']['),
21
+          keys_last = keys.length - 1;
22
+        
23
+      // If the first keys part contains [ and the last ends with ], then []
24
+      // are correctly balanced.
25
+      if (/\[/.test(keys[0]) && /\]$/.test(keys[keys_last])) {
26
+        // Remove the trailing ] from the last keys part.
27
+        keys[keys_last] = keys[keys_last].replace(/\]$/, '');
28
+          
29
+        // Split first keys part into two parts on the [ and add them back onto
30
+        // the beginning of the keys array.
31
+        keys = keys.shift().split('[').concat(keys);
32
+          
33
+        keys_last = keys.length - 1;
34
+      } else {
35
+        // Basic 'foo' style key.
36
+        keys_last = 0;
37
+      }
38
+        
39
+      // Are we dealing with a name=value pair, or just a name?
40
+      if (param.length === 2) {
41
+        val = decodeURIComponent(param[1]);
42
+          
43
+        // Coerce values.
44
+        if (coerce) {
45
+          val = val && !isNaN(val)              ? +val              // number
46
+              : val === 'undefined'             ? undefined         // undefined
47
+              : coerce_types[val] !== undefined ? coerce_types[val] // true, false, null
48
+              : val;                                                // string
49
+        }
50
+          
51
+        if ( keys_last ) {
52
+          // Complex key, build deep object structure based on a few rules:
53
+          // * The 'cur' pointer starts at the object top-level.
54
+          // * [] = array push (n is set to array length), [n] = array if n is 
55
+          //   numeric, otherwise object.
56
+          // * If at the last keys part, set the value.
57
+          // * For each keys part, if the current level is undefined create an
58
+          //   object or array based on the type of the next keys part.
59
+          // * Move the 'cur' pointer to the next level.
60
+          // * Rinse & repeat.
61
+          for (; i <= keys_last; i++) {
62
+            key = keys[i] === '' ? cur.length : keys[i];
63
+            cur = cur[key] = i < keys_last
64
+              ? cur[key] || (keys[i+1] && isNaN(keys[i+1]) ? {} : [])
65
+              : val;
66
+          }
67
+            
68
+        } else {
69
+          // Simple key, even simpler rules, since only scalars and shallow
70
+          // arrays are allowed.
71
+            
72
+          if ($.isArray(obj[key])) {
73
+            // val is already an array, so push on the next value.
74
+            obj[key].push( val );
75
+              
76
+          } else if (obj[key] !== undefined) {
77
+            // val isn't an array, but since a second value has been specified,
78
+            // convert val into an array.
79
+            obj[key] = [obj[key], val];
80
+              
81
+          } else {
82
+            // val is a scalar.
83
+            obj[key] = val;
84
+          }
85
+        }
86
+          
87
+      } else if (key) {
88
+        // No value was defined, so set something meaningful.
89
+        obj[key] = coerce
90
+          ? undefined
91
+          : '';
92
+      }
93
+    });
94
+      
95
+    return obj;
96
+  };
97
+})(jQuery);

+ 190 - 16
web/bundles/muzichcore/css/main.css Näytä tiedosto

@@ -544,7 +544,7 @@ img.tag_add_to_favorites
544 544
   margin-left: 1px;
545 545
 }
546 546
 
547
-td.element_content a.display_comments, td.element_content a.add_comment, td.element_content a.hide_comments, div.comments a.add_comment
547
+td.element_content a.display_comments, td.element_content a.add_comment, td.element_content a.add_comment_disabled, td.element_content a.hide_comments, div.comments a.add_comment
548 548
 {
549 549
   color: #404040;
550 550
 }
@@ -948,7 +948,7 @@ ul#favorite_tags li
948 948
   margin-right: 0px;
949 949
 }
950 950
 
951
-#element_add_link, #element_add_close_link, #group_add_link, #group_add_close_link, #registration_link, #login_link, #know_more
951
+#element_add_link, #element_add_close_link, #group_add_link, #group_add_link_disabled, #group_add_close_link, #registration_link, #login_link, #know_more, #launch_tour
952 952
 {
953 953
   float: right;
954 954
   margin-top: -58px;
@@ -971,17 +971,17 @@ ul#favorite_tags li
971 971
 
972 972
 #registration_link, #login_link
973 973
 {
974
-  margin-right: -10px;
975
-  margin-top: -68px;
974
+  margin-right: -112px;
975
+  margin-top: -76px;
976 976
 }
977 977
 
978
-#element_add_link img, #element_add_close_link img, #group_add_link img, #group_add_close_link img, #registration_link img, #login_link img
978
+#element_add_link img, #element_add_close_link img, #group_add_link img, #group_add_link_disabled img, #group_add_close_link img, #registration_link img, #login_link img
979 979
 {
980 980
   margin-bottom: -5px;
981 981
     margin-right: -5px;
982 982
 }
983 983
 
984
-#element_add_link.justtopright, #element_add_close_link.justtopright, #group_add_link.justtopright, #group_add_close_link.justtopright
984
+#element_add_link.justtopright, #element_add_close_link.justtopright, #group_add_link.justtopright, #group_add_link_disabled.justtopright, #group_add_close_link.justtopright
985 985
 {
986 986
   margin-top: 0px;
987 987
   margin-right: 0px;
@@ -1261,6 +1261,11 @@ div.search_tag_list ul.search_tag_list li.new
1261 1261
 {
1262 1262
   color: black;
1263 1263
 }
1264
+
1265
+#helpbox div.search_tag_list ul.search_tag_list li.new a
1266
+{
1267
+  color: black;
1268
+}
1264 1269
   
1265 1270
 
1266 1271
 div.search_tag_list ul.search_tag_list li:hover
@@ -1510,12 +1515,17 @@ div#group_add_box input[type="submit"]
1510 1515
 
1511 1516
 div#registration_box input.niceinput
1512 1517
 {
1513
-  width: 430px;
1518
+  width: 250px;
1514 1519
 }
1515 1520
 
1516 1521
 div#registration_box label
1517 1522
 {
1518
-  width: 170px;
1523
+  width: 70px;
1524
+}
1525
+
1526
+div#registration_box input[type="submit"]
1527
+{
1528
+  float: right;
1519 1529
 }
1520 1530
 
1521 1531
 div#registration_box div.field
@@ -1707,7 +1717,7 @@ div.show_options {
1707 1717
     float: right;
1708 1718
 }
1709 1719
 
1710
-#container #group_add_link, #container #group_add_close_link
1720
+#container #group_add_link, #container #group_add_link_disabled, #container #group_add_close_link
1711 1721
 {
1712 1722
   font-size: 120%;
1713 1723
   float: right;
@@ -1857,7 +1867,17 @@ p.group_description
1857 1867
 
1858 1868
 #login_box input[id="username"], #login_box input[id="password"]
1859 1869
 {
1860
-  width: 230px;
1870
+  width: 228px;
1871
+}
1872
+
1873
+#login_box div.login
1874
+{
1875
+  margin-top: 8px;
1876
+}
1877
+
1878
+#login_box div.textcenter
1879
+{
1880
+  margin-top: 12px;
1861 1881
 }
1862 1882
 
1863 1883
 /*#registration_link, #login_link
@@ -1996,12 +2016,13 @@ div#tourControls a#tourEnd
1996 2016
   float: right;
1997 2017
 }
1998 2018
 
1999
-a.tags_prompt_helpbox
2019
+a.tag_prompt_tool
2000 2020
 {
2001
-  float: left;
2021
+  float: right;
2002 2022
   margin-bottom: 0;
2003 2023
   margin-left: 0px;
2004 2024
   margin-top: 5px;
2025
+  margin-right: 11px;
2005 2026
 }
2006 2027
 
2007 2028
 form#address_update input.intext
@@ -2015,11 +2036,12 @@ div#form_add_thumb img
2015 2036
   height: 100px;
2016 2037
 }
2017 2038
   
2018
-#know_more
2039
+#know_more, #launch_tour
2019 2040
 {
2020
-  float: left;
2021
-  margin-left: -11px;
2022
-  margin-top: -67px;
2041
+  float: none;
2042
+  margin-bottom: 16px;
2043
+  margin-top: 0;
2044
+  width: 269px;
2023 2045
 }
2024 2046
 
2025 2047
 div.helpbox_image_container
@@ -2045,4 +2067,156 @@ div.helpbox_image_container img
2045 2067
 
2046 2068
 .fotter_muzich_little{
2047 2069
   font-size: 9px;
2070
+}
2071
+
2072
+div.side_margin_top
2073
+{
2074
+  margin-top: 25px;
2075
+}
2076
+
2077
+p.accept_cgu
2078
+{
2079
+  font-size: 11px;
2080
+}
2081
+
2082
+li.user_name a
2083
+{
2084
+  color: inherit;
2085
+}
2086
+
2087
+li.user_name a:hover
2088
+{
2089
+  text-decoration: underline;
2090
+}
2091
+
2092
+@-webkit-keyframes clignote
2093
+{
2094
+  0%{box-shadow:0px 0px 10px #909090;}
2095
+  50%{box-shadow:0px 0px 2px #909090;}
2096
+  100%{box-shadow:0px 0px 10px #909090;}
2097
+}
2098
+
2099
+@-moz-keyframes clignote
2100
+{
2101
+  0%{box-shadow:0px 0px 10px #909090;}
2102
+  50%{box-shadow:0px 0px 2px #909090;}
2103
+  100%{box-shadow:0px 0px 10px #909090;}
2104
+}
2105
+
2106
+@-ms-keyframes clignote
2107
+{
2108
+  0%{box-shadow:0px 0px 10px #909090;}
2109
+  50%{box-shadow:0px 0px 2px #909090;}
2110
+  100%{box-shadow:0px 0px 10px #909090;}
2111
+}
2112
+
2113
+@-o-keyframes clignote
2114
+{
2115
+  0%{box-shadow:0px 0px 10px #909090;}
2116
+  50%{box-shadow:0px 0px 2px #909090;}
2117
+  100%{box-shadow:0px 0px 10px #909090;}
2118
+}
2119
+
2120
+@keyframes clignote
2121
+{
2122
+  0%{box-shadow:0px 0px 10px #909090;}
2123
+  50%{box-shadow:0px 0px 2px #909090;}
2124
+  100%{box-shadow:0px 0px 10px #909090;}
2125
+}
2126
+
2127
+
2128
+.flashing
2129
+{
2130
+  font-weight: bold;
2131
+  text-shadow: 0 1px 0 white;
2132
+  border-radius: 3px;
2133
+  padding: 5px 10px;
2134
+  box-shadow:0px 0px 10px #909090;
2135
+  
2136
+  -webkit-animation-name: clignote;
2137
+  -webkit-animation-duration: 1s;
2138
+  -webkit-animation-iteration-count:infinite;
2139
+  
2140
+  -moz-animation-name: clignote;
2141
+  -moz-animation-duration: 1s;
2142
+  -moz-animation-iteration-count:infinite;
2143
+  
2144
+  -ms-animation-name: clignote;
2145
+  -ms-animation-duration: 1s;
2146
+  -ms-animation-iteration-count:infinite;
2147
+  
2148
+  -o-animation-name: clignote;
2149
+  -o-animation-duration: 1s;
2150
+  -o-animation-iteration-count:infinite;
2151
+  
2152
+  animation-name: clignote;
2153
+  animation-duration: 1s;
2154
+  animation-iteration-count:infinite;
2155
+}
2156
+
2157
+div.myaccount_part.flashing
2158
+{
2159
+  padding: 2px;
2160
+}
2161
+
2162
+div.choose_password
2163
+{
2164
+  text-align: center;
2165
+}
2166
+
2167
+div.center
2168
+{
2169
+  text-align: center;
2170
+}
2171
+
2172
+div#email_not_confirmed_box input
2173
+{
2174
+  margin: 10px;
2175
+}
2176
+
2177
+div#email_not_confirmed_box p.info
2178
+{
2179
+  font-style: italic;
2180
+}
2181
+
2182
+span.message_success
2183
+{
2184
+  font-weight: bold;
2185
+  color: green;
2186
+}
2187
+
2188
+span.message_error
2189
+{
2190
+  font-weight: bold;
2191
+  color: red;
2192
+}
2193
+
2194
+div#helpbox input.tag_prompt
2195
+{
2196
+  width: 480px;
2197
+}
2198
+
2199
+div#helpbox input.button
2200
+{
2201
+  float: right;
2202
+  margin-right: 11px;
2203
+  margin-top: 5px;
2204
+}
2205
+
2206
+div#helpbox div.center input.button
2207
+{
2208
+  float: none;
2209
+}
2210
+
2211
+div#facebook_login
2212
+{
2213
+  float: right;
2214
+  margin-bottom: 0;
2215
+  margin-right: 0;
2216
+  margin-top: -5px;
2217
+}
2218
+
2219
+div#login_box
2220
+{
2221
+  margin-top: 23px;
2048 2222
 }

+ 31 - 28
web/bundles/muzichcore/js/TagPrompt.js Näytä tiedosto

@@ -35,7 +35,14 @@ function TagPrompt(select_tag_callback, tag_prompt_connector)
35 35
   {
36 36
     if (!tag_id)
37 37
     {
38
-      openTagSubmission(tag_name);
38
+      if (!visitor)
39
+      {
40
+        openTagSubmission(tag_name);
41
+      }
42
+      else
43
+      {
44
+        open_connection_or_subscription_window();
45
+      }
39 46
     }
40 47
     else
41 48
     {
@@ -64,39 +71,34 @@ function TagPrompt(select_tag_callback, tag_prompt_connector)
64 71
       .attr('method', 'post')
65 72
       .attr('name', 'add_tag')
66 73
       .ajaxForm(function(response) {
67
-        /*
68
-        *
69
-        */
70
-  
71
-        if (response.status == 'mustbeconnected')
72
-        {
73
-          $(location).attr('href', url_index);
74
-        }
74
+       
75
+        window.ResponseController.execute(
76
+          response,
77
+          function(){},
78
+          function(response){
79
+            $('form[name="add_tag"]').find('ul.error_list').remove();
80
+            var ul_errors = $('<ul>').addClass('error_list');
81
+
82
+            for (i in response.errors)
83
+            {
84
+              ul_errors.append($('<li>').append(response.errors[i]));
85
+            }
86
+
87
+            $('form[name="add_tag"]').prepend(ul_errors);
88
+          }
89
+        );
75 90
   
76
-        if (response.status == 'success')
91
+        if (response.status === 'success')
77 92
         {
78 93
           var tag = new Tag(response.tag_id, response.tag_name);
79 94
           addTagToProposedTags(tag);
80 95
           addTagToSelectedTags(tag);
81 96
           _tag_prompt_connector.updateOutput(tags_selected);
82
-  
97
+
83 98
           $('#fade').fadeOut(400, function(){$('#fade').remove();});
84 99
           $('#add_tag').remove();
85 100
         }
86 101
   
87
-        if (response.status == 'error')
88
-        {
89
-          $('form[name="add_tag"]').find('ul.error_list').remove();
90
-          var ul_errors = $('<ul>').addClass('error_list');
91
-  
92
-          for (i in response.errors)
93
-          {
94
-            ul_errors.append($('<li>').append(response.errors[i]));
95
-          }
96
-  
97
-          $('form[name="add_tag"]').prepend(ul_errors);
98
-        }
99
-  
100 102
         return false;
101 103
       })
102 104
   
@@ -174,10 +176,11 @@ function TagPrompt(select_tag_callback, tag_prompt_connector)
174 176
         *
175 177
         */
176 178
   
177
-        if (response.status == 'mustbeconnected')
178
-        {
179
-          $(location).attr('href', url_index);
180
-        }
179
+        window.ResponseController.execute(
180
+          response,
181
+          function(){},
182
+          function(){}
183
+        );
181 184
   
182 185
         if (response.status == 'success')
183 186
         {

File diff suppressed because it is too large
+ 516 - 226
web/bundles/muzichcore/js/muzich.js