Browse Source

extended the deploy.sh script (closes #30)

Jeroen De Meerleer 3 years ago
parent
commit
33814feb09

+ 3 - 3
.gitlab-ci.yml

@@ -1,3 +1,3 @@
-symfony:
-  script:
-    - bash deploy.sh
+symfony:
+  script:
+    - bash system.sh install

+ 103 - 103
app/config/config.yml

@@ -1,103 +1,103 @@
-imports:
-    - { resource: parameters.yml }
-    - { resource: security.yml }
-    - { resource: services.yml }
-
-framework:
-    #esi:             ~
-    #translator:      { fallbacks: ["%locale%"] }
-    secret:          "%secret%"
-    router:
-        resource: "%kernel.root_dir%/config/routing.yml"
-        strict_requirements: ~
-    form:            ~
-    csrf_protection: ~
-    validation:      { enable_annotations: true }
-    templating:
-        engines: ['twig']
-        #assets_version: SomeVersionScheme
-    default_locale:  "%locale%"
-    trusted_hosts:   ~
-    trusted_proxies: ~
-    session:
-        # handler_id set to null will use default session handler from php.ini
-        handler_id:  ~
-    fragments:       ~
-    http_method_override: true
-
-# Twig Configuration
-twig:
-    debug:            "%kernel.debug%"
-    strict_variables: "%kernel.debug%"
-    globals:
-        version:       "v1.0.1608"
-
-# Assetic Configuration
-assetic:
-    debug:          "%kernel.debug%"
-    use_controller: false
-    bundles:        [ JeroenEDPortfolioBundle, JeroenEDCmsEDBundle ]
-    #java: /usr/bin/java
-    filters:
-        cssrewrite: ~
-        jsqueeze: ~
-        scssphp:
-            formatter: 'Leafo\ScssPhp\Formatter\Compressed'
-        #closure:
-        #    jar: "%kernel.root_dir%/Resources/java/compiler.jar"
-        #yui_css:
-        #    jar: "%kernel.root_dir%/Resources/java/yuicompressor-2.4.7.jar"
-
-# Doctrine Configuration
-doctrine:
-    dbal:
-        driver:   "%database_driver%"
-        host:     "%database_host%"
-        port:     "%database_port%"
-        dbname:   "%database_name%"
-        user:     "%database_user%"
-        password: "%database_password%"
-        charset:  UTF8
-        # if using pdo_sqlite as your database driver:
-        #   1. add the path in parameters.yml
-        #     e.g. database_path: "%kernel.root_dir%/data/data.db3"
-        #   2. Uncomment database_path in parameters.yml.dist
-        #   3. Uncomment next line:
-        #     path:     "%database_path%"
-
-    orm:
-        auto_generate_proxy_classes: "%kernel.debug%"
-        auto_mapping: true
-
-# Swiftmailer Configuration
-swiftmailer:
-    transport: "%mailer_transport%"
-    host:      "%mailer_host%"
-    username:  "%mailer_user%"
-    password:  "%mailer_password%"
-    spool:     { type: memory }
-
-fm_elfinder:
-    #assets_path: / # default is /assets, this is where css/js elfinder files are
-    instances:
-        default:
-            locale: %locale% # defaults to current request locale
-            editor: ckeditor # other options are tinymce, tinymce4, fm_tinymce, form, simple, custom
-            #editor_template: custom template for your editor # default null
-            #path_prefix: / # for setting custom assets path prefix, useful for non vhost configurations, i.e. http://127.0.0.1/mysite/
-            #fullscreen: true|false # default is true, applies to simple and ckeditor editors
-            #theme: smoothness # jquery theme, default is 'smoothness'
-            include_assets: true # disable if you want to manage loading of javascript and css assets manually
-            #visible_mime_types: ['image/png', 'image/jpg', 'image/jpeg'] # only show these mime types, defaults to show all
-            connector:
-                #debug: true|false # defaults to false
-                roots:       # at least one root must be defined, defines root filemanager directories
-                    uploads:
-                        #show_hidden: true|false # defaults to false, hides dotfiles
-                        driver: LocalFileSystem
-                        path: bundles/jeroenedportfolio
-                        upload_allow: ['all']
-                        upload_deny: ['none']
-                        upload_max_size: 2M # also file upload sizes restricted in php.ini
-                        #attributes: example of setting attributes permission
-                        #    - { pattern: '/(.*?)/', read: true, write: false, locked: true }
+imports:
+    - { resource: parameters.yml }
+    - { resource: security.yml }
+    - { resource: services.yml }
+
+framework:
+    #esi:             ~
+    #translator:      { fallbacks: ["%locale%"] }
+    secret:          "%secret%"
+    router:
+        resource: "%kernel.root_dir%/config/routing.yml"
+        strict_requirements: ~
+    form:            ~
+    csrf_protection: ~
+    validation:      { enable_annotations: true }
+    templating:
+        engines: ['twig']
+        #assets_version: SomeVersionScheme
+    default_locale:  "%locale%"
+    trusted_hosts:   ~
+    trusted_proxies: ~
+    session:
+        # handler_id set to null will use default session handler from php.ini
+        handler_id:  ~
+    fragments:       ~
+    http_method_override: true
+
+# Twig Configuration
+twig:
+    debug:            "%kernel.debug%"
+    strict_variables: "%kernel.debug%"
+    globals:
+        version:       "v1.0.1608"
+
+# Assetic Configuration
+assetic:
+    debug:          "%kernel.debug%"
+    use_controller: false
+    bundles:        [ JeroenEDPortfolioBundle, JeroenEDCmsEDBundle ]
+    #java: /usr/bin/java
+    filters:
+        cssrewrite: ~
+        jsqueeze: ~
+        scssphp:
+            formatter: 'Leafo\ScssPhp\Formatter\Compressed'
+        #closure:
+        #    jar: "%kernel.root_dir%/Resources/java/compiler.jar"
+        #yui_css:
+        #    jar: "%kernel.root_dir%/Resources/java/yuicompressor-2.4.7.jar"
+
+# Doctrine Configuration
+doctrine:
+    dbal:
+        driver:   "%database_driver%"
+        host:     "%database_host%"
+        port:     "%database_port%"
+        dbname:   "%database_name%"
+        user:     "%database_user%"
+        password: "%database_password%"
+        charset:  UTF8
+        # if using pdo_sqlite as your database driver:
+        #   1. add the path in parameters.yml
+        #     e.g. database_path: "%kernel.root_dir%/data/data.db3"
+        #   2. Uncomment database_path in parameters.yml.dist
+        #   3. Uncomment next line:
+        #     path:     "%database_path%"
+
+    orm:
+        auto_generate_proxy_classes: "%kernel.debug%"
+        auto_mapping: true
+
+# Swiftmailer Configuration
+swiftmailer:
+    transport: "%mailer_transport%"
+    host:      "%mailer_host%"
+    username:  "%mailer_user%"
+    password:  "%mailer_password%"
+    spool:     { type: memory }
+
+fm_elfinder:
+    #assets_path: / # default is /assets, this is where css/js elfinder files are
+    instances:
+        default:
+            locale: %locale% # defaults to current request locale
+            editor: ckeditor # other options are tinymce, tinymce4, fm_tinymce, form, simple, custom
+            #editor_template: custom template for your editor # default null
+            #path_prefix: / # for setting custom assets path prefix, useful for non vhost configurations, i.e. http://127.0.0.1/mysite/
+            #fullscreen: true|false # default is true, applies to simple and ckeditor editors
+            #theme: smoothness # jquery theme, default is 'smoothness'
+            include_assets: true # disable if you want to manage loading of javascript and css assets manually
+            #visible_mime_types: ['image/png', 'image/jpg', 'image/jpeg'] # only show these mime types, defaults to show all
+            connector:
+                #debug: true|false # defaults to false
+                roots:       # at least one root must be defined, defines root filemanager directories
+                    uploads:
+                        #show_hidden: true|false # defaults to false, hides dotfiles
+                        driver: LocalFileSystem
+                        path: bundles/jeroenedportfolio
+                        upload_allow: ['all']
+                        upload_deny: ['none']
+                        upload_max_size: 2M # also file upload sizes restricted in php.ini
+                        #attributes: example of setting attributes permission
+                        #    - { pattern: '/(.*?)/', read: true, write: false, locked: true }

+ 200 - 200
changelog.md

@@ -1,200 +1,200 @@
-# Changelog JeroenED.be
-
-## Changelog 2016-08 (Bugs Bunny)
-
-Omwille van de vele bugs die de voorbije dagen zijn ontdekt heb ik beslist om een tussentijdse release te doen met als naam "Bugs Bunny".
-
-Dus, een kat is geen mus en werden bugs geplet. Er zijn niet minder dan 7 bugs geplet, 1 verbetering aangebracht, en dan is er nog een project afgewerkt
-
-### Bugs
-* #21: Download field should not be required
-* #23: Height of vertical navigation does not equal the document height 
-* #24: Design bug when moving a portfolio item 
-* #25: style not applied anymore when changing background of portfolioitem
-* #26: ElFinder not closable
-* #27: Add a page link when page is open does not clear current page
-* #28: Jquery-UI Broken
-
-### Nieuwe functies
-* (none)
-
-### Verbeteringen
-* #22: Add browse button to fields pointing to files (project)
-* #29: Updating order of menu is not intuitive
-
-### Off-code wijzigingen
-* (none)
-## Changelog 2016-08
-
-Nieuwe maand, nieuwe update.
-
-Er zijn wat wijzigingen gebeurt buiten de code om. Zo zal nu elke wijziging als een issue worden vermeld in de Issue-tracker in Gitlab en zijn de nodige tags hiervoor gecreëerd. Ook ben ik terug beginnen gebruik te maken van milestones.
-
-Op code-vlak is er een belangrijke wijziging gebeurt waarbij het nu mogelijk is om een relevante download mee te geven. Op een contact-pagina kan dit bijvoorbeeld een PGP-key zijn, of op de resume-pagina een PDF-versie van de resume.
-
-Daarnaast is een opvallende wijziging dat kcfinder eruit geknikkerd is en vervangen is door het beheerbaardere ElFinder.
-
-### Bugs
-* (none)
-
-### Nieuwe functies
-* #17: Add link to page to download relevant extra's 
-
-### Verbeteringen
-* #16: Confirming a portfolio edit while a page is open should give a warning
-* #18: Button for updating a portfoliopage should be modified according to situation
-* #19: Drop html5shiv from base code 
-* #20: Replacing KcFinder 
-
-### Off-code wijzigingen
-* Gitlab meer betrokken bij ontwikkelingsproces
-
-## Changelog 2016-07
-Een kleine update deze maand. Het belangrijkste deze maand is dat gitlab-ci is geïntegreerd en volledig actief. Deze release is dan ook via CI gedeployed.
-
-### Issues
-* #??: Could not update order of portfolio.
-
-### Nieuwe functies
-* CI
-
-### Belangrijke wijzigingen
-* Deployment gebeurt nu via CI.
-
-## Changelog 2016-06
-Deze maand is de laatste commit gedaan voor het afwerken van het archief. Meer bepaald het toevoegen van het archief aan het administratiepaneel. Dan is er ook een aanpassing op de mainpage waarbij de paginatitel van een pagina op de titelbalk verschijnt bij het openen. Daarnaast is er ook een probleem opgelost waarbij pagina's heropent werden na het sliden door de presentatie.
-
-### Issues
-* #14: Page is loaded over and over again when sliding through presentation
-
-### Nieuwe functies
-* Archief-weergave in administratiepaneel
-* Pagina-titel in titelbalk.
-
-### Belangrijke wijzigingen
-* (none)
-
-## Changelog 2016-05
-Deze maand een belangrijke functie geïmplementeerd: de vorige- en volgende knop is volledig werkende. Daarnaast is de uri van de pagina's gewijzigd en staat de fugly "/page" er niet meer bij.
-
-### Issues
-* (none)
-
-### Nieuwe functies
-* Vorige- en Volgende-knoppen zijn werkende
-
-### Belangrijke wijzigingen
-* URI van pagina's gewijzigd naar /{{ slug }}
-
-## Changelog 2016-04
-Na de uitzonderlijke B-for-Brussels release van vorige maand weer een iets normalere release. Wijzigingen zijn vooral in het administratiepaneel te vinden. Ook is er een issue van het archief gefixet waarbij de closepage functie niet reageerde zoals zou moeten.
-
-### Issues
-* (none)
-
-### Nieuwe functies
-* SASS geactiveerd op administratie paneel
-
-### Belangrijke wijzigingen
-* De fugly overloop op de homepage is eindelijk verwijderd
-* Css in CKeditor is toegepast
-
-## Changelog 2016-03 (B-for-Brussels)
-Omwille van de recente gebeurtenissen in Brussel heb ik beslist om een tussentijdse release te doen van de laatste wijzigingen. De wijzigigingen zijn zichtbaarder dan de vorige release en omvatten een archiveringsfunctie en de activatie van de leesweergave op de changelog. Daarnaast is de changelog verplaatst naar een iets logischere locatie en is syntax coloring eindelijk geactiveerd in de bron weergave van CKeditor.
-
-### Issues
-* (none)
-
-### Nieuwe functies
-* Lezersweergave geactiveerd op changelog.
-* Archiveren 
-
-### Belangrijke wijzigingen
-* Nieuwe URL voor changelog (changelog in plaats van changelog.md)
-* Syntax coloring in CKeditor
-
-## Changelog 2016-03
-Na lange periode eindelijk nog eens een update. Weliswaar een update achter de schermen namelijk een upgrade naar symfony 3. Daarnaast zijn de fout-pagina's onder handen genomen.
-
-### Issues
-* (none)
-
-### Nieuwe functies
-* (none)
-
-### Belangrijke wijzigingen
-* Update naar Symfony 3
-* Nieuwe fout-paginas's
-
-## Changelog 2015-11
-Eindelijk een grafische update. Voor de eerste keer sinds het online komen van de website is er een grafische update. Het hoofdlettertype is gewijzigd. Een andere belangrijke wijziging: een Git-flow systeem. Met andere woorden: geen minuut stilgezeten.
-
-### Issues
-* (none)
-
-### Nieuwe functies
-* #13 Add slug to duplicate page-names
-
-### Belangrijke wijzigingen
-* Git flow system
-* Nieuw lettertype
-* Updated start-data (Git-issue)
-
-## Changelog 2015-10
-Geen zware wijziginging dit keer. De enige wijziging is een kleine JavaScript-edit op hoe de pagina's worden geopent.
-De echte wijzigingen zijn de overstap naar Linux als main-OS en de overstap naar VMWare als Hypervisor voor de virtuële machine
-
-### Issues
-* (none)
-
-### Nieuwe functies
-* (none)
-
-### Belangrijke wijzigingen
-* (none)
-
-## Changelog 2015-09
-Deze sprint stond in het teken van best practices. Vele zaken die normaal anders zouden moeten, zijn nu gebeurd.
-
-### Issues
-* (none)
-
-### Nieuwe functies
-* (none)
-
-### Belangrijke wijzigingen
-* scss-files moeten op voorhand gedumpt worden in plaats van "on-the-fly"
-* Niet bestaande pagina's zijn geven status-code 404 in plaats van 200 pagina met tekst "page not found"
-* A lot of desktop/mobile optimizations
-
-## Changelog 2015-08
-Voor de sprint van augustus had wat extra zaken in gedachten. Zo is er ondersteuning voor scss ingebouwd en word automatisch minified javascript gegenereerd.
-Daarnaast is symfony geüpdate naar de laatste versie (2.7) en is ervoor gezorgd dat er geen wijzigingen in composer.json moeten worden doorgevoerd om de laatste versie te kunnen installeren.
-
-### Issues
-* #11: Media query for touch-devices is not reliable for tablets (Thanks to Marie-Jeanne Thys)
-
-### Nieuwe functies
-* Ondersteuning voor scss
-* Automatisch minified Javascript
-* Stylesheet voor media Print
-
-### Belangrijke wijzigingen
-* Upgrade naar Symfony 2.7
-* Versienummer uitgebreid met monthstamp
-* Venster vergrootten of verkleinen sluit niet meer de pagina
-
-## Changelog 2015-07
-De eerste sprint is afgelopen. Alle bug reports die zijn gemeld zijn opgelost.
-
-### Issues
-* #8: Encrypt email-addresses to prevent e-mail harvesting
-* #9: Connect CKEditor to KCFinder
-* #10: Fugly border around embedded images
-
-### Nieuwe functies
-(geen)
-
-### Vooruitzicht naar volgende sprint
-Op dit moment is er slechts 1 bug gemeld. Daarnaast zal er worden gewerkt aan stylesheet voor afdrukken van pagina's
-
+# Changelog JeroenED.be
+
+## Changelog 2016-08 (Bugs Bunny)
+
+Omwille van de vele bugs die de voorbije dagen zijn ontdekt heb ik beslist om een tussentijdse release te doen met als naam "Bugs Bunny".
+
+Dus, een kat is geen mus en werden bugs geplet. Er zijn niet minder dan 7 bugs geplet, 1 verbetering aangebracht, en dan zijn er nog 2 projecten afgewerkt
+
+### Bugs
+* #21: Download field should not be required
+* #23: Height of vertical navigation does not equal the document height 
+* #24: Design bug when moving a portfolio item 
+* #25: style not applied anymore when changing background of portfolioitem
+* #26: ElFinder not closable
+* #27: Add a page link when page is open does not clear current page
+* #28: Jquery-UI Broken
+
+### Nieuwe functies
+* #30: Extend deploy.sh script with more options 
+
+### Verbeteringen
+* #22: Add browse button to fields pointing to files (project)
+* #29: Updating order of menu is not intuitive
+
+### Off-code wijzigingen
+* (none)
+## Changelog 2016-08
+
+Nieuwe maand, nieuwe update.
+
+Er zijn wat wijzigingen gebeurt buiten de code om. Zo zal nu elke wijziging als een issue worden vermeld in de Issue-tracker in Gitlab en zijn de nodige tags hiervoor gecreëerd. Ook ben ik terug beginnen gebruik te maken van milestones.
+
+Op code-vlak is er een belangrijke wijziging gebeurt waarbij het nu mogelijk is om een relevante download mee te geven. Op een contact-pagina kan dit bijvoorbeeld een PGP-key zijn, of op de resume-pagina een PDF-versie van de resume.
+
+Daarnaast is een opvallende wijziging dat kcfinder eruit geknikkerd is en vervangen is door het beheerbaardere ElFinder.
+
+### Bugs
+* (none)
+
+### Nieuwe functies
+* #17: Add link to page to download relevant extra's 
+
+### Verbeteringen
+* #16: Confirming a portfolio edit while a page is open should give a warning
+* #18: Button for updating a portfoliopage should be modified according to situation
+* #19: Drop html5shiv from base code 
+* #20: Replacing KcFinder 
+
+### Off-code wijzigingen
+* Gitlab meer betrokken bij ontwikkelingsproces
+
+## Changelog 2016-07
+Een kleine update deze maand. Het belangrijkste deze maand is dat gitlab-ci is geïntegreerd en volledig actief. Deze release is dan ook via CI gedeployed.
+
+### Issues
+* #??: Could not update order of portfolio.
+
+### Nieuwe functies
+* CI
+
+### Belangrijke wijzigingen
+* Deployment gebeurt nu via CI.
+
+## Changelog 2016-06
+Deze maand is de laatste commit gedaan voor het afwerken van het archief. Meer bepaald het toevoegen van het archief aan het administratiepaneel. Dan is er ook een aanpassing op de mainpage waarbij de paginatitel van een pagina op de titelbalk verschijnt bij het openen. Daarnaast is er ook een probleem opgelost waarbij pagina's heropent werden na het sliden door de presentatie.
+
+### Issues
+* #14: Page is loaded over and over again when sliding through presentation
+
+### Nieuwe functies
+* Archief-weergave in administratiepaneel
+* Pagina-titel in titelbalk.
+
+### Belangrijke wijzigingen
+* (none)
+
+## Changelog 2016-05
+Deze maand een belangrijke functie geïmplementeerd: de vorige- en volgende knop is volledig werkende. Daarnaast is de uri van de pagina's gewijzigd en staat de fugly "/page" er niet meer bij.
+
+### Issues
+* (none)
+
+### Nieuwe functies
+* Vorige- en Volgende-knoppen zijn werkende
+
+### Belangrijke wijzigingen
+* URI van pagina's gewijzigd naar /{{ slug }}
+
+## Changelog 2016-04
+Na de uitzonderlijke B-for-Brussels release van vorige maand weer een iets normalere release. Wijzigingen zijn vooral in het administratiepaneel te vinden. Ook is er een issue van het archief gefixet waarbij de closepage functie niet reageerde zoals zou moeten.
+
+### Issues
+* (none)
+
+### Nieuwe functies
+* SASS geactiveerd op administratie paneel
+
+### Belangrijke wijzigingen
+* De fugly overloop op de homepage is eindelijk verwijderd
+* Css in CKeditor is toegepast
+
+## Changelog 2016-03 (B-for-Brussels)
+Omwille van de recente gebeurtenissen in Brussel heb ik beslist om een tussentijdse release te doen van de laatste wijzigingen. De wijzigigingen zijn zichtbaarder dan de vorige release en omvatten een archiveringsfunctie en de activatie van de leesweergave op de changelog. Daarnaast is de changelog verplaatst naar een iets logischere locatie en is syntax coloring eindelijk geactiveerd in de bron weergave van CKeditor.
+
+### Issues
+* (none)
+
+### Nieuwe functies
+* Lezersweergave geactiveerd op changelog.
+* Archiveren 
+
+### Belangrijke wijzigingen
+* Nieuwe URL voor changelog (changelog in plaats van changelog.md)
+* Syntax coloring in CKeditor
+
+## Changelog 2016-03
+Na lange periode eindelijk nog eens een update. Weliswaar een update achter de schermen namelijk een upgrade naar symfony 3. Daarnaast zijn de fout-pagina's onder handen genomen.
+
+### Issues
+* (none)
+
+### Nieuwe functies
+* (none)
+
+### Belangrijke wijzigingen
+* Update naar Symfony 3
+* Nieuwe fout-paginas's
+
+## Changelog 2015-11
+Eindelijk een grafische update. Voor de eerste keer sinds het online komen van de website is er een grafische update. Het hoofdlettertype is gewijzigd. Een andere belangrijke wijziging: een Git-flow systeem. Met andere woorden: geen minuut stilgezeten.
+
+### Issues
+* (none)
+
+### Nieuwe functies
+* #13 Add slug to duplicate page-names
+
+### Belangrijke wijzigingen
+* Git flow system
+* Nieuw lettertype
+* Updated start-data (Git-issue)
+
+## Changelog 2015-10
+Geen zware wijziginging dit keer. De enige wijziging is een kleine JavaScript-edit op hoe de pagina's worden geopent.
+De echte wijzigingen zijn de overstap naar Linux als main-OS en de overstap naar VMWare als Hypervisor voor de virtuële machine
+
+### Issues
+* (none)
+
+### Nieuwe functies
+* (none)
+
+### Belangrijke wijzigingen
+* (none)
+
+## Changelog 2015-09
+Deze sprint stond in het teken van best practices. Vele zaken die normaal anders zouden moeten, zijn nu gebeurd.
+
+### Issues
+* (none)
+
+### Nieuwe functies
+* (none)
+
+### Belangrijke wijzigingen
+* scss-files moeten op voorhand gedumpt worden in plaats van "on-the-fly"
+* Niet bestaande pagina's zijn geven status-code 404 in plaats van 200 pagina met tekst "page not found"
+* A lot of desktop/mobile optimizations
+
+## Changelog 2015-08
+Voor de sprint van augustus had wat extra zaken in gedachten. Zo is er ondersteuning voor scss ingebouwd en word automatisch minified javascript gegenereerd.
+Daarnaast is symfony geüpdate naar de laatste versie (2.7) en is ervoor gezorgd dat er geen wijzigingen in composer.json moeten worden doorgevoerd om de laatste versie te kunnen installeren.
+
+### Issues
+* #11: Media query for touch-devices is not reliable for tablets (Thanks to Marie-Jeanne Thys)
+
+### Nieuwe functies
+* Ondersteuning voor scss
+* Automatisch minified Javascript
+* Stylesheet voor media Print
+
+### Belangrijke wijzigingen
+* Upgrade naar Symfony 2.7
+* Versienummer uitgebreid met monthstamp
+* Venster vergrootten of verkleinen sluit niet meer de pagina
+
+## Changelog 2015-07
+De eerste sprint is afgelopen. Alle bug reports die zijn gemeld zijn opgelost.
+
+### Issues
+* #8: Encrypt email-addresses to prevent e-mail harvesting
+* #9: Connect CKEditor to KCFinder
+* #10: Fugly border around embedded images
+
+### Nieuwe functies
+(geen)
+
+### Vooruitzicht naar volgende sprint
+Op dit moment is er slechts 1 bug gemeld. Daarnaast zal er worden gewerkt aan stylesheet voor afdrukken van pagina's
+

+ 0 - 15
deploy.sh

@@ -1,15 +0,0 @@
-#!/bin/bash
-
-if [[ ${CI_BUILD_REF_NAME} == "release" ]]; then
-	deployto=${release}	
-	cp -r ./* ${release}
-else
-	deployto=${master}
-	cp -r ./* ${master}
-fi
-
-cd ${deployto}
-composer install --no-dev --optimize-autoloader
-php bin/console assetic:dump
-php bin/console doctrine:schema:update --force
-php bin/console cache:clear

+ 121 - 121
src/JeroenED/CmsEDBundle/Controller/MenuController.php

@@ -1,121 +1,121 @@
-<?php
-namespace JeroenED\CmsEDBundle\Controller;
-
-use Symfony\Bundle\FrameworkBundle\Controller\Controller;
-use Symfony\Component\HttpFoundation\Request;
-use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
-use JeroenED\CmsEDBundle\Form\Type\MenuType;
-use JeroenED\PortfolioBundle\Entity\MenuItem;
-use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage;
-use JeroenED\CmsEDBundle\Initialize\Initializer;
-use JeroenED\CmsEDBundle\Entity\User;
-use Symfony\Component\Form\Extension\Core\Type\SubmitType;
-
-/**
- * Description of MenuController
- *
- * @author Jeroen De Meerleer <me@jeroened.be>
- */
-class MenuController extends Controller  {
-    
-    /**
-     * @Route("/admin/menu", name="menu_index")
-     */
-    public function indexAction(Request $request) {
-		$initializer = new Initializer;
-        $user = $this->getUser()->getUsername();
-        $menus = $initializer->getMenus($request);
-        $message = $request->query->get('message') ? $request->query->get('message') : '';
-        $repository = $this->getDoctrine()->getRepository('JeroenEDPortfolioBundle:MenuItem');
-        $menuitems = $repository->findBy(array(), array('rank' => 'asc'));
-        return $this->render("JeroenEDCmsEDBundle:Menu:index.html.twig", array('menuitems' => $menuitems, 'message' => $message, 'title' => 'Menus', 'user' => $user, 'menus' => $menus));
-    }
-    
-    /**
-     * @Route("/admin/menu/edit/{id}", name="menu_edit", defaults={ "id" = "-1"})
-     */
-    public function editAction($id, Request $request) {
-		$initializer = new Initializer;
-        $user = $this->getUser()->getUsername();
-        $menus = $initializer->getMenus($request);
-        $db = $this->getDoctrine()->getManager();
-        $menu = $db->getRepository('JeroenEDPortfolioBundle:MenuItem')->find($id);
-        $form = $this->createForm(MenuType::Class, $menu, array('action' => $this->generateUrl($request->attributes->get('_route'), array('id' => $menu->getId()))));
-        $form->add('register', SubmitType::Class, array('label' => 'Confirm'));
-        $form->handleRequest($request);
-        
-        $form_errors = $this->get('form_errors')->getArray($form, true);
-        if($form->isValid()) {
-            $db->flush();
-            return $this->redirectToRoute('menu_index', array('message' => 'Menuitem ' . $menu->getLabel() . ' has been modified'));
-            
-        } else {
-            return $this->render('JeroenEDCmsEDBundle:Menu:edit.html.twig', array('form' => $form->createView(), 'errors' => $form_errors,  'title' => 'Menus :: Modify ' . $menu->getLabel(), 'user' => $user, 'menus' => $menus));
-        }
-    }
-    
-    /**
-     * @Route("/admin/menu/details/{id}", name="menu_details", defaults={ "id" = "-1"})
-     */
-    public function detailsAction($id, Request $request) {
-		$initializer = new Initializer;
-        $user = $this->getUser()->getUsername();
-        $menus = $initializer->getMenus($request);
-        $db = $this->getDoctrine()->getManager();
-        $menu = $db->getRepository('JeroenEDPortfolioBundle:MenuItem')->find($id);
-        return $this->render('JeroenEDCmsEDBundle:Menu:details.html.twig', array('menu' => $menu,  'title' => 'Menus :: Details of ' . $menu->getLabel(), 'user' => $user, 'menus' => $menus));
-    }
-    
-    /**
-     * @Route("/admin/menu/delete/{id}", name="menu_delete", defaults={ "id" = "-1"})
-     */
-    public function deleteAction($id) {
-        $db = $this->getDoctrine()->getManager();
-        $menu = $db->getRepository('JeroenEDPortfolioBundle:MenuItem')->find($id);
-        $db->remove($menu);
-        $db->flush();
-        return $this->redirectToRoute('menu_index', array('message' => 'Menuitem ' . $menu->getLabel() . ' has been deleted'));
-    }
-    
-    /**
-     * @Route("/admin/menu/create", name="menu_create")
-     */
-    public function createAction(Request $request) {
-		$initializer = new Initializer;
-        $user = $this->getUser()->getUsername();
-        $menus = $initializer->getMenus($request);
-        $menu = new MenuItem();
-        $db = $this->getDoctrine()->getManager();
-        $form = $this->createForm(MenuType::Class, $menu, array('action' => $this->generateUrl($request->attributes->get('_route'))));
-        $form->add('register', SubmitType::Class, array('label' => 'Confirm'));
-        $form->handleRequest($request);
-        
-        $form_errors = $this->get('form_errors')->getArray($form, true);
-        if($form->isValid()) {
-            $repository = $this->getDoctrine()->getRepository('JeroenEDPortfolioBundle:PortfolioItem');
-            $rank = count($repository->findAll())+1;
-            $menu->setRank($rank);
-            $db->persist($menu);
-            $db->flush();
-            
-            return $this->redirectToRoute('menu_index', array('message' => 'Menuitem ' . $menu->getLabel() . ' has been created'));
-            
-        } else {
-            return $this->render('JeroenEDCmsEDBundle:Menu:create.html.twig', array('form' => $form->createView(), 'errors' => $form_errors,  'title' => 'Menus :: Create new menu', 'user' => $user, 'menus' => $menus));
-        }
-    }
-
-    /**
-     * @Route("/admin/menu/rankupdate", name="menu_ranks", defaults={ "id" = "-1"})
-     */
-    public function rankAction(Request $request) {
-        $ranks = json_decode($request->request->get('ranks'), true);
-        $db = $this->getDoctrine()->getManager();
-        foreach($ranks as $key=>$value) {
-            $item = $db->getRepository('JeroenEDPortfolioBundle:MenuItem')->find($key);
-            $item->setRank($value);
-        }
-        $db->flush();
-        return $this->redirectToRoute('menu_index', array('message' => 'The order has been updated'));
-    }
-}
+<?php
+namespace JeroenED\CmsEDBundle\Controller;
+
+use Symfony\Bundle\FrameworkBundle\Controller\Controller;
+use Symfony\Component\HttpFoundation\Request;
+use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
+use JeroenED\CmsEDBundle\Form\Type\MenuType;
+use JeroenED\PortfolioBundle\Entity\MenuItem;
+use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage;
+use JeroenED\CmsEDBundle\Initialize\Initializer;
+use JeroenED\CmsEDBundle\Entity\User;
+use Symfony\Component\Form\Extension\Core\Type\SubmitType;
+
+/**
+ * Description of MenuController
+ *
+ * @author Jeroen De Meerleer <me@jeroened.be>
+ */
+class MenuController extends Controller  {
+    
+    /**
+     * @Route("/admin/menu", name="menu_index")
+     */
+    public function indexAction(Request $request) {
+		$initializer = new Initializer;
+        $user = $this->getUser()->getUsername();
+        $menus = $initializer->getMenus($request);
+        $message = $request->query->get('message') ? $request->query->get('message') : '';
+        $repository = $this->getDoctrine()->getRepository('JeroenEDPortfolioBundle:MenuItem');
+        $menuitems = $repository->findBy(array(), array('rank' => 'asc'));
+        return $this->render("JeroenEDCmsEDBundle:Menu:index.html.twig", array('menuitems' => $menuitems, 'message' => $message, 'title' => 'Menus', 'user' => $user, 'menus' => $menus));
+    }
+    
+    /**
+     * @Route("/admin/menu/edit/{id}", name="menu_edit", defaults={ "id" = "-1"})
+     */
+    public function editAction($id, Request $request) {
+		$initializer = new Initializer;
+        $user = $this->getUser()->getUsername();
+        $menus = $initializer->getMenus($request);
+        $db = $this->getDoctrine()->getManager();
+        $menu = $db->getRepository('JeroenEDPortfolioBundle:MenuItem')->find($id);
+        $form = $this->createForm(MenuType::Class, $menu, array('action' => $this->generateUrl($request->attributes->get('_route'), array('id' => $menu->getId()))));
+        $form->add('register', SubmitType::Class, array('label' => 'Confirm'));
+        $form->handleRequest($request);
+        
+        $form_errors = $this->get('form_errors')->getArray($form, true);
+        if($form->isValid()) {
+            $db->flush();
+            return $this->redirectToRoute('menu_index', array('message' => 'Menuitem ' . $menu->getLabel() . ' has been modified'));
+            
+        } else {
+            return $this->render('JeroenEDCmsEDBundle:Menu:edit.html.twig', array('form' => $form->createView(), 'errors' => $form_errors,  'title' => 'Menus :: Modify ' . $menu->getLabel(), 'user' => $user, 'menus' => $menus));
+        }
+    }
+    
+    /**
+     * @Route("/admin/menu/details/{id}", name="menu_details", defaults={ "id" = "-1"})
+     */
+    public function detailsAction($id, Request $request) {
+		$initializer = new Initializer;
+        $user = $this->getUser()->getUsername();
+        $menus = $initializer->getMenus($request);
+        $db = $this->getDoctrine()->getManager();
+        $menu = $db->getRepository('JeroenEDPortfolioBundle:MenuItem')->find($id);
+        return $this->render('JeroenEDCmsEDBundle:Menu:details.html.twig', array('menu' => $menu,  'title' => 'Menus :: Details of ' . $menu->getLabel(), 'user' => $user, 'menus' => $menus));
+    }
+    
+    /**
+     * @Route("/admin/menu/delete/{id}", name="menu_delete", defaults={ "id" = "-1"})
+     */
+    public function deleteAction($id) {
+        $db = $this->getDoctrine()->getManager();
+        $menu = $db->getRepository('JeroenEDPortfolioBundle:MenuItem')->find($id);
+        $db->remove($menu);
+        $db->flush();
+        return $this->redirectToRoute('menu_index', array('message' => 'Menuitem ' . $menu->getLabel() . ' has been deleted'));
+    }
+    
+    /**
+     * @Route("/admin/menu/create", name="menu_create")
+     */
+    public function createAction(Request $request) {
+		$initializer = new Initializer;
+        $user = $this->getUser()->getUsername();
+        $menus = $initializer->getMenus($request);
+        $menu = new MenuItem();
+        $db = $this->getDoctrine()->getManager();
+        $form = $this->createForm(MenuType::Class, $menu, array('action' => $this->generateUrl($request->attributes->get('_route'))));
+        $form->add('register', SubmitType::Class, array('label' => 'Confirm'));
+        $form->handleRequest($request);
+        
+        $form_errors = $this->get('form_errors')->getArray($form, true);
+        if($form->isValid()) {
+            $repository = $this->getDoctrine()->getRepository('JeroenEDPortfolioBundle:PortfolioItem');
+            $rank = count($repository->findAll())+1;
+            $menu->setRank($rank);
+            $db->persist($menu);
+            $db->flush();
+            
+            return $this->redirectToRoute('menu_index', array('message' => 'Menuitem ' . $menu->getLabel() . ' has been created'));
+            
+        } else {
+            return $this->render('JeroenEDCmsEDBundle:Menu:create.html.twig', array('form' => $form->createView(), 'errors' => $form_errors,  'title' => 'Menus :: Create new menu', 'user' => $user, 'menus' => $menus));
+        }
+    }
+
+    /**
+     * @Route("/admin/menu/rankupdate", name="menu_ranks", defaults={ "id" = "-1"})
+     */
+    public function rankAction(Request $request) {
+        $ranks = json_decode($request->request->get('ranks'), true);
+        $db = $this->getDoctrine()->getManager();
+        foreach($ranks as $key=>$value) {
+            $item = $db->getRepository('JeroenEDPortfolioBundle:MenuItem')->find($key);
+            $item->setRank($value);
+        }
+        $db->flush();
+        return $this->redirectToRoute('menu_index', array('message' => 'The order has been updated'));
+    }
+}

+ 148 - 148
src/JeroenED/CmsEDBundle/Controller/PortfolioController.php

@@ -1,148 +1,148 @@
-<?php
-namespace JeroenED\CmsEDBundle\Controller;
-
-use Symfony\Bundle\FrameworkBundle\Controller\Controller;
-use Symfony\Component\HttpFoundation\Request;
-use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
-use JeroenED\CmsEDBundle\Form\Type\PortfolioType;
-use JeroenED\CmsEDBundle\Form\Type\PortfolioPageType;
-use JeroenED\PortfolioBundle\Entity\PortfolioItem;
-use Symfony\Component\HttpFoundation\Response;
-use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage;
-use JeroenED\CmsEDBundle\Initialize\Initializer;
-use JeroenED\CmsEDBundle\Entity\User;
-use Symfony\Component\Form\Extension\Core\Type\SubmitType;
-use Symfony\Component\Form\Extension\Core\Type\ButtonType;
-
-/**
- * Description of PortfolioController
- *
- * @author Jeroen De Meerleer <me@jeroened.be>
- */
-class PortfolioController extends Controller  {
-	
-    /**
-     * @Route("/admin/portfolio", name="portfolio_index")
-     */
-    public function indexAction(Request $request) {
-		$initializer = new Initializer;
-        $user = $this->getUser()->getUsername();
-        $menus = $initializer->getMenus($request);
-        $message = $request->query->get('message') ? $request->query->get('message') : '';
-        $repository = $this->getDoctrine()->getRepository('JeroenEDPortfolioBundle:PortfolioItem');
-        $portfolio = $repository->findBy(array('archived' => false), array('rank' => 'asc'));
-        return $this->render("JeroenEDCmsEDBundle:Portfolio:index.html.twig", array('portfolio' => $portfolio, 'message' => $message, 'title' => 'Portfolio', 'user' => $user, 'menus' => $menus));
-    }
-	
-	/**
-     * @Route("/admin/portfolio/archive", name="portfolio_archive")
-     */
-    public function archiveAction(Request $request) {
-		$initializer = new Initializer;
-        $user = $this->getUser()->getUsername();
-        $menus = $initializer->getMenus($request);
-        $message = $request->query->get('message') ? $request->query->get('message') : '';
-        $repository = $this->getDoctrine()->getRepository('JeroenEDPortfolioBundle:PortfolioItem');
-        $portfolio = $repository->findBy(array('archived' => true), array('rank' => 'asc'));
-        return $this->render("JeroenEDCmsEDBundle:Portfolio:archive.html.twig", array('portfolio' => $portfolio, 'message' => $message, 'title' => 'Portfolio', 'user' => $user, 'menus' => $menus));
-    }
-    
-    /**
-     * @Route("/admin/portfolio/edit/{id}", name="portfolio_edit", defaults={ "id" = "-1"})
-     */
-    public function editAction($id, Request $request) {
-		$initializer = new Initializer;
-        $user = $this->getUser()->getUsername();
-        $menus = $initializer->getMenus($request);
-        $db = $this->getDoctrine()->getManager();
-        $item = $db->getRepository('JeroenEDPortfolioBundle:PortfolioItem')->find($id);
-        $pages = json_decode($item->getPages(), true);
-        $form = $this->createForm(PortfolioType::class, $item, array('action' => $this->generateUrl($request->attributes->get('_route'), array('id' => $item->getId()))));
-        $form->add('register', SubmitType::class, array('label' => 'Confirm'));
-        $pageform = $this->createForm(PortfolioPageType::class, null, array('action' => "#"));
-        $pageform->add('register', ButtonType::class, array('label' => 'Add page'));
-        $form->handleRequest($request);
-        
-        $form_errors = $this->get('form_errors')->getArray($form, true);
-        if($form->isValid()) {
-            $db->flush();
-			$returnurl = $item->getArchived() ? "portfolio_archive" : "portfolio_index";
-            return $this->redirectToRoute($returnurl, array('message' => 'Portfolioitem ' . $item->getTitle() . ' has been modified'));
-            
-        } else {
-            return $this->render('JeroenEDCmsEDBundle:Portfolio:edit.html.twig', array('form' => $form->createView(), 'pageform' => $pageform->createView(), 'pages' => $pages, 'errors' => $form_errors,  'title' => 'Portfolio :: Modify ' . $item->getTitle(), 'user' => $user, 'menus' => $menus));
-        }
-    }
-    
-    /**
-     * @Route("/admin/portfolio/details/{id}", name="portfolio_details", defaults={ "id" = "-1"})
-     */
-    public function detailsAction($id, Request $request) {
-		$initializer = new Initializer;
-        $user = $this->getUser()->getUsername();
-        $menus = $initializer->getMenus($request);
-        $db = $this->getDoctrine()->getManager();
-        $item = $db->getRepository('JeroenEDPortfolioBundle:PortfolioItem')->find($id);
-        $pages = json_decode($item->getPages());
-        return $this->render('JeroenEDCmsEDBundle:Portfolio:details.html.twig', array('portfolio' => $item, 'pages' => $pages, 'title' => 'Portfolio :: Details of ' . $item->getTitle(), 'user' => $user, 'menus' => $menus));
-    }
-    
-    /**
-     * @Route("/admin/portfolio/delete/{id}", name="portfolio_delete", defaults={ "id" = "-1"})
-     */
-    public function deleteAction(Request $request, $id) {
-		$returnurl = $request->query->get('returnurl') ? $request->query->get('returnurl') : 'portfolio_index';
-        $db = $this->getDoctrine()->getManager();
-        $item = $db->getRepository('JeroenEDPortfolioBundle:PortfolioItem')->find($id);
-        $db->remove($item);
-        $db->flush();
-        return $this->redirectToRoute($returnurl, array('message' => 'Portfolioitem ' . $item->getTitle() . ' has been deleted'));
-    }
-    
-    /**
-     * @Route("/admin/portfolio/create", name="portfolio_create")
-     */
-    public function createAction(Request $request) {
-		$initializer = new Initializer;
-        $user = $this->getUser()->getUsername();
-        $menus = $initializer->getMenus($request);
-        $item = new PortfolioItem();
-        $db = $this->getDoctrine()->getManager();
-        $form = $this->createForm(PortfolioType::class, $item, array('action' => $this->generateUrl($request->attributes->get('_route'))));
-         $form->add('register', SubmitType::class, array('label' => 'Confirm'));
-        $pageform = $this->createForm(PortfolioPageType::class, null, array('action' => "#"));
-        $pageform->add('register', ButtonType::class, array('label' => 'Add page'));
-        $form->handleRequest($request);
-        
-        $form_errors = $this->get('form_errors')->getArray($form, true);
-        if($form->isValid()) {
-       	    $repository = $this->getDoctrine()->getRepository('JeroenEDPortfolioBundle:PortfolioItem');
-            $rank = count($repository->findAll())+1;
-            $item->setRank($rank);
-			$returnurl = $item->getArchived() ? "portfolio_archive" : "portfolio_index";
-            $db->persist($item);
-            $db->flush();
-            
-            return $this->redirectToRoute($returnurl, array('message' => 'Portfolioitem ' . $item->getTitle() . ' has been created'));
-            
-        } else {
-            return $this->render('JeroenEDCmsEDBundle:Portfolio:create.html.twig', array('form' => $form->createView(), 'pageform' => $pageform->createView(), 'errors' => $form_errors,   'title' => 'Portfolio :: Create new item', 'user' => $user, 'menus' => $menus));
-        }
-    }
-    
-    
-    /**
-     * @Route("/admin/portfolio/rankupdate", name="portfolio_ranks", defaults={ "id" = "-1"})
-     */
-    public function rankAction(Request $request) {
-        $ranks = json_decode($request->request->get('ranks'), true);
-        $returnurl = $request->request->get('returnurl') ? $request->request->get('returnurl') : 'portfolio_index';
-        $db = $this->getDoctrine()->getManager();
-        foreach($ranks as $key=>$value) {
-            $item = $db->getRepository('JeroenEDPortfolioBundle:PortfolioItem')->find($key);
-            $item->setRank($value);
-        }
-        $db->flush();
-        return $this->redirectToRoute($returnurl, array('message' => 'The order has been updated'));
-    }
-}
+<?php
+namespace JeroenED\CmsEDBundle\Controller;
+
+use Symfony\Bundle\FrameworkBundle\Controller\Controller;
+use Symfony\Component\HttpFoundation\Request;
+use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
+use JeroenED\CmsEDBundle\Form\Type\PortfolioType;
+use JeroenED\CmsEDBundle\Form\Type\PortfolioPageType;
+use JeroenED\PortfolioBundle\Entity\PortfolioItem;
+use Symfony\Component\HttpFoundation\Response;
+use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage;
+use JeroenED\CmsEDBundle\Initialize\Initializer;
+use JeroenED\CmsEDBundle\Entity\User;
+use Symfony\Component\Form\Extension\Core\Type\SubmitType;
+use Symfony\Component\Form\Extension\Core\Type\ButtonType;
+
+/**
+ * Description of PortfolioController
+ *
+ * @author Jeroen De Meerleer <me@jeroened.be>
+ */
+class PortfolioController extends Controller  {
+	
+    /**
+     * @Route("/admin/portfolio", name="portfolio_index")
+     */
+    public function indexAction(Request $request) {
+		$initializer = new Initializer;
+        $user = $this->getUser()->getUsername();
+        $menus = $initializer->getMenus($request);
+        $message = $request->query->get('message') ? $request->query->get('message') : '';
+        $repository = $this->getDoctrine()->getRepository('JeroenEDPortfolioBundle:PortfolioItem');
+        $portfolio = $repository->findBy(array('archived' => false), array('rank' => 'asc'));
+        return $this->render("JeroenEDCmsEDBundle:Portfolio:index.html.twig", array('portfolio' => $portfolio, 'message' => $message, 'title' => 'Portfolio', 'user' => $user, 'menus' => $menus));
+    }
+	
+	/**
+     * @Route("/admin/portfolio/archive", name="portfolio_archive")
+     */
+    public function archiveAction(Request $request) {
+		$initializer = new Initializer;
+        $user = $this->getUser()->getUsername();
+        $menus = $initializer->getMenus($request);
+        $message = $request->query->get('message') ? $request->query->get('message') : '';
+        $repository = $this->getDoctrine()->getRepository('JeroenEDPortfolioBundle:PortfolioItem');
+        $portfolio = $repository->findBy(array('archived' => true), array('rank' => 'asc'));
+        return $this->render("JeroenEDCmsEDBundle:Portfolio:archive.html.twig", array('portfolio' => $portfolio, 'message' => $message, 'title' => 'Portfolio', 'user' => $user, 'menus' => $menus));
+    }
+    
+    /**
+     * @Route("/admin/portfolio/edit/{id}", name="portfolio_edit", defaults={ "id" = "-1"})
+     */
+    public function editAction($id, Request $request) {
+		$initializer = new Initializer;
+        $user = $this->getUser()->getUsername();
+        $menus = $initializer->getMenus($request);
+        $db = $this->getDoctrine()->getManager();
+        $item = $db->getRepository('JeroenEDPortfolioBundle:PortfolioItem')->find($id);
+        $pages = json_decode($item->getPages(), true);
+        $form = $this->createForm(PortfolioType::class, $item, array('action' => $this->generateUrl($request->attributes->get('_route'), array('id' => $item->getId()))));
+        $form->add('register', SubmitType::class, array('label' => 'Confirm'));
+        $pageform = $this->createForm(PortfolioPageType::class, null, array('action' => "#"));
+        $pageform->add('register', ButtonType::class, array('label' => 'Add page'));
+        $form->handleRequest($request);
+        
+        $form_errors = $this->get('form_errors')->getArray($form, true);
+        if($form->isValid()) {
+            $db->flush();
+			$returnurl = $item->getArchived() ? "portfolio_archive" : "portfolio_index";
+            return $this->redirectToRoute($returnurl, array('message' => 'Portfolioitem ' . $item->getTitle() . ' has been modified'));
+            
+        } else {
+            return $this->render('JeroenEDCmsEDBundle:Portfolio:edit.html.twig', array('form' => $form->createView(), 'pageform' => $pageform->createView(), 'pages' => $pages, 'errors' => $form_errors,  'title' => 'Portfolio :: Modify ' . $item->getTitle(), 'user' => $user, 'menus' => $menus));
+        }
+    }
+    
+    /**
+     * @Route("/admin/portfolio/details/{id}", name="portfolio_details", defaults={ "id" = "-1"})
+     */
+    public function detailsAction($id, Request $request) {
+		$initializer = new Initializer;
+        $user = $this->getUser()->getUsername();
+        $menus = $initializer->getMenus($request);
+        $db = $this->getDoctrine()->getManager();
+        $item = $db->getRepository('JeroenEDPortfolioBundle:PortfolioItem')->find($id);
+        $pages = json_decode($item->getPages());
+        return $this->render('JeroenEDCmsEDBundle:Portfolio:details.html.twig', array('portfolio' => $item, 'pages' => $pages, 'title' => 'Portfolio :: Details of ' . $item->getTitle(), 'user' => $user, 'menus' => $menus));
+    }
+    
+    /**
+     * @Route("/admin/portfolio/delete/{id}", name="portfolio_delete", defaults={ "id" = "-1"})
+     */
+    public function deleteAction(Request $request, $id) {
+		$returnurl = $request->query->get('returnurl') ? $request->query->get('returnurl') : 'portfolio_index';
+        $db = $this->getDoctrine()->getManager();
+        $item = $db->getRepository('JeroenEDPortfolioBundle:PortfolioItem')->find($id);
+        $db->remove($item);
+        $db->flush();
+        return $this->redirectToRoute($returnurl, array('message' => 'Portfolioitem ' . $item->getTitle() . ' has been deleted'));
+    }
+    
+    /**
+     * @Route("/admin/portfolio/create", name="portfolio_create")
+     */
+    public function createAction(Request $request) {
+		$initializer = new Initializer;
+        $user = $this->getUser()->getUsername();
+        $menus = $initializer->getMenus($request);
+        $item = new PortfolioItem();
+        $db = $this->getDoctrine()->getManager();
+        $form = $this->createForm(PortfolioType::class, $item, array('action' => $this->generateUrl($request->attributes->get('_route'))));
+         $form->add('register', SubmitType::class, array('label' => 'Confirm'));
+        $pageform = $this->createForm(PortfolioPageType::class, null, array('action' => "#"));
+        $pageform->add('register', ButtonType::class, array('label' => 'Add page'));
+        $form->handleRequest($request);
+        
+        $form_errors = $this->get('form_errors')->getArray($form, true);
+        if($form->isValid()) {
+       	    $repository = $this->getDoctrine()->getRepository('JeroenEDPortfolioBundle:PortfolioItem');
+            $rank = count($repository->findAll())+1;
+            $item->setRank($rank);
+			$returnurl = $item->getArchived() ? "portfolio_archive" : "portfolio_index";
+            $db->persist($item);
+            $db->flush();
+            
+            return $this->redirectToRoute($returnurl, array('message' => 'Portfolioitem ' . $item->getTitle() . ' has been created'));
+            
+        } else {
+            return $this->render('JeroenEDCmsEDBundle:Portfolio:create.html.twig', array('form' => $form->createView(), 'pageform' => $pageform->createView(), 'errors' => $form_errors,   'title' => 'Portfolio :: Create new item', 'user' => $user, 'menus' => $menus));
+        }
+    }
+    
+    
+    /**
+     * @Route("/admin/portfolio/rankupdate", name="portfolio_ranks", defaults={ "id" = "-1"})
+     */
+    public function rankAction(Request $request) {
+        $ranks = json_decode($request->request->get('ranks'), true);
+        $returnurl = $request->request->get('returnurl') ? $request->request->get('returnurl') : 'portfolio_index';
+        $db = $this->getDoctrine()->getManager();
+        foreach($ranks as $key=>$value) {
+            $item = $db->getRepository('JeroenEDPortfolioBundle:PortfolioItem')->find($key);
+            $item->setRank($value);
+        }
+        $db->flush();
+        return $this->redirectToRoute($returnurl, array('message' => 'The order has been updated'));
+    }
+}

+ 37 - 37
src/JeroenED/CmsEDBundle/Form/Type/MenuType.php

@@ -1,37 +1,37 @@
-<?php
-
-namespace JeroenED\CmsEDBundle\Form\Type;
-
-
-use Symfony\Component\Form\AbstractType;
-use Symfony\Component\Form\FormBuilderInterface;
-use Symfony\Component\OptionsResolver\OptionsResolverInterface;
-use Symfony\Component\Form\Extension\Core\Type\TextType;
-use Symfony\Component\Form\Extension\Core\Type\IntegerType;
-use Symfony\Component\Form\Extension\Core\Type\HiddenType;
-
-/**
- * Description of MenuType
- *
- * @author Jeroen De Meerleer <me@jeroened.be>
- */
-class MenuType extends AbstractType {
-    
-    public function buildForm(FormBuilderInterface $builder, array $options) {
-        $builder->add('label', TextType::class, array('label' => 'Label'));
-        $builder->add('destination', TextType::class, array('label' => 'Destination'));
-        $builder->add('rank', HiddenType::class);
-    }
-    
-    public function setDefaultOptions(OptionsResolverInterface $resolver) {
-        $resolver->setDefaults(array(
-            'data_class' => 'JeroenED\PortfolioBundle\Entity\MenuItem',
-            'error_bubbling' => true
-        ));
-    }
-
-    public function getName() {
-        return 'Menu';
-    }
-    
-}
+<?php
+
+namespace JeroenED\CmsEDBundle\Form\Type;
+
+
+use Symfony\Component\Form\AbstractType;
+use Symfony\Component\Form\FormBuilderInterface;
+use Symfony\Component\OptionsResolver\OptionsResolverInterface;
+use Symfony\Component\Form\Extension\Core\Type\TextType;
+use Symfony\Component\Form\Extension\Core\Type\IntegerType;
+use Symfony\Component\Form\Extension\Core\Type\HiddenType;
+
+/**
+ * Description of MenuType
+ *
+ * @author Jeroen De Meerleer <me@jeroened.be>
+ */
+class MenuType extends AbstractType {
+    
+    public function buildForm(FormBuilderInterface $builder, array $options) {
+        $builder->add('label', TextType::class, array('label' => 'Label'));
+        $builder->add('destination', TextType::class, array('label' => 'Destination'));
+        $builder->add('rank', HiddenType::class);
+    }
+    
+    public function setDefaultOptions(OptionsResolverInterface $resolver) {
+        $resolver->setDefaults(array(
+            'data_class' => 'JeroenED\PortfolioBundle\Entity\MenuItem',
+            'error_bubbling' => true
+        ));
+    }
+
+    public function getName() {
+        return 'Menu';
+    }
+    
+}

+ 37 - 37
src/JeroenED/CmsEDBundle/Form/Type/PageType.php

@@ -1,37 +1,37 @@
-<?php
-
-namespace JeroenED\CmsEDBundle\Form\Type;
-
-
-use Symfony\Component\Form\AbstractType;
-use Symfony\Component\Form\FormBuilderInterface;
-use Symfony\Component\OptionsResolver\OptionsResolverInterface;
-use Symfony\Component\Form\Extension\Core\Type\TextType;
-use Symfony\Component\Form\Extension\Core\Type\TextareaType;
-
-/**
- * Description of MenuType
- *
- * @author Jeroen De Meerleer <me@jeroened.be>
- */
-class PageType extends AbstractType {
-    
-    public function buildForm(FormBuilderInterface $builder, array $options) {
-        $builder->add('title', TextType::Class, array('label' => 'Title'));
-        $builder->add('download', TextType::Class, array('label' => 'Download', 'required' => false, 'attr' => array('class' => 'typefile')));
-        $builder->add('html', TextareaType::Class, array('label' => 'Html'));
-        $builder->add('slug', TextType::Class, array('label' => 'Slug'));
-    }
-    
-    public function setDefaultOptions(OptionsResolverInterface $resolver) {
-        $resolver->setDefaults(array(
-            'data_class' => 'JeroenED\PortfolioBundle\Entity\Page',
-            'error_bubbling' => true
-        ));
-    }
-
-    public function getName() {
-        return 'page';
-    }
-    
-}
+<?php
+
+namespace JeroenED\CmsEDBundle\Form\Type;
+
+
+use Symfony\Component\Form\AbstractType;
+use Symfony\Component\Form\FormBuilderInterface;
+use Symfony\Component\OptionsResolver\OptionsResolverInterface;
+use Symfony\Component\Form\Extension\Core\Type\TextType;
+use Symfony\Component\Form\Extension\Core\Type\TextareaType;
+
+/**
+ * Description of MenuType
+ *
+ * @author Jeroen De Meerleer <me@jeroened.be>
+ */
+class PageType extends AbstractType {
+    
+    public function buildForm(FormBuilderInterface $builder, array $options) {
+        $builder->add('title', TextType::Class, array('label' => 'Title'));
+        $builder->add('download', TextType::Class, array('label' => 'Download', 'required' => false, 'attr' => array('class' => 'typefile')));
+        $builder->add('html', TextareaType::Class, array('label' => 'Html'));
+        $builder->add('slug', TextType::Class, array('label' => 'Slug'));
+    }
+    
+    public function setDefaultOptions(OptionsResolverInterface $resolver) {
+        $resolver->setDefaults(array(
+            'data_class' => 'JeroenED\PortfolioBundle\Entity\Page',
+            'error_bubbling' => true
+        ));
+    }
+
+    public function getName() {
+        return 'page';
+    }
+    
+}

+ 38 - 38
src/JeroenED/CmsEDBundle/Form/Type/PortfolioPageType.php

@@ -1,38 +1,38 @@
-<?php
-
-
-namespace JeroenED\CmsEDBundle\Form\Type;
-
-
-use Symfony\Component\Form\AbstractType;
-use Symfony\Component\Form\FormBuilderInterface;
-use Symfony\Component\OptionsResolver\OptionsResolverInterface;
-use Symfony\Component\Form\Extension\Core\Type\TextType;
-use Symfony\Component\Form\Extension\Core\Type\HiddenType;
-use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
-use Symfony\Component\Form\Extension\Core\Type\TextareaType;
-
-/**
- * Description of MenuType
- *
- * @author Jeroen De Meerleer <me@jeroened.be>
- */
-class PortfolioPageType extends AbstractType {
-    
-    public function buildForm(FormBuilderInterface $builder, array $options) {
-        $builder->add('slug', TextType::class, array('label' => 'Slug'));
-        $builder->add('showtitle', CheckboxType::class, array('label' => 'Show title', 'required' => false));
-        $builder->add('background', TextType::class, array('label' => 'Background image', 'required' => false, 'attr' => array('class' => 'typefile')));
-        $builder->add('html', TextareaType::class, array('label' => 'Html'));
-        $builder->add('index', HiddenType::class);
-    }
-    
-    public function setDefaultOptions(OptionsResolverInterface $resolver) {
-        $resolver->setDefaults(array('mapped' => false));
-    }
-
-    public function getName() {
-        return 'PortfolioPage';
-    }
-    
-}
+<?php
+
+
+namespace JeroenED\CmsEDBundle\Form\Type;
+
+
+use Symfony\Component\Form\AbstractType;
+use Symfony\Component\Form\FormBuilderInterface;
+use Symfony\Component\OptionsResolver\OptionsResolverInterface;
+use Symfony\Component\Form\Extension\Core\Type\TextType;
+use Symfony\Component\Form\Extension\Core\Type\HiddenType;
+use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
+use Symfony\Component\Form\Extension\Core\Type\TextareaType;
+
+/**
+ * Description of MenuType
+ *
+ * @author Jeroen De Meerleer <me@jeroened.be>
+ */
+class PortfolioPageType extends AbstractType {
+    
+    public function buildForm(FormBuilderInterface $builder, array $options) {
+        $builder->add('slug', TextType::class, array('label' => 'Slug'));
+        $builder->add('showtitle', CheckboxType::class, array('label' => 'Show title', 'required' => false));
+        $builder->add('background', TextType::class, array('label' => 'Background image', 'required' => false, 'attr' => array('class' => 'typefile')));
+        $builder->add('html', TextareaType::class, array('label' => 'Html'));
+        $builder->add('index', HiddenType::class);
+    }
+    
+    public function setDefaultOptions(OptionsResolverInterface $resolver) {
+        $resolver->setDefaults(array('mapped' => false));
+    }
+
+    public function getName() {
+        return 'PortfolioPage';
+    }
+    
+}

+ 44 - 44
src/JeroenED/CmsEDBundle/Resources/public/js/cmsed.js

@@ -1,45 +1,45 @@
-$(document).ready(function() {
-	$("#dialog").dialog({
-		autoOpen: false,
-		modal: true
-	});
-	$(".confirmLink").click(function(e) {
-		$('#dialog').html($(this).data('text'));
-		e.preventDefault();
-		var targetUrl = $(this).data('link');
-		$("#dialog").dialog({
-			buttons: {
-				"Confirm": function() {
-					window.location.href = targetUrl;
-				},
-				"Cancel": function() {
-					$(this).dialog("close");
-				}
-			}
-		});
-		$("#dialog").dialog("open");
-	});
-
-	$('.typefile').parent().append('<button type="button" class="openfilebrowser">Browse...</button>');
-   	$('nav').height($(document).height() - 150);
-
-    CKEDITOR.on('instanceReady', function(e) {
-    	$('nav').height($(document).height() - 150);
-    });
-});
-
-function loadCKeditor(instance, style) {
-    CKEDITOR.replace( instance, {
-        customConfig: '/bundles/jeroenedcmsed/js/ckeditor.js',
-        extraPlugins: 'codemirror',
-        bodyClass: style
-    });
-}
-function UrlExists(url)
-{
-    if(url == '') return false;
-    var http = new XMLHttpRequest();
-    http.open('HEAD', url, false);
-    http.send();
-    return http.status!=404;
+$(document).ready(function() {
+	$("#dialog").dialog({
+		autoOpen: false,
+		modal: true
+	});
+	$(".confirmLink").click(function(e) {
+		$('#dialog').html($(this).data('text'));
+		e.preventDefault();
+		var targetUrl = $(this).data('link');
+		$("#dialog").dialog({
+			buttons: {
+				"Confirm": function() {
+					window.location.href = targetUrl;
+				},
+				"Cancel": function() {
+					$(this).dialog("close");
+				}
+			}
+		});
+		$("#dialog").dialog("open");
+	});
+
+	$('.typefile').parent().append('<button type="button" class="openfilebrowser">Browse...</button>');
+   	$('nav').height($(document).height() - 150);
+
+    CKEDITOR.on('instanceReady', function(e) {
+    	$('nav').height($(document).height() - 150);
+    });
+});
+
+function loadCKeditor(instance, style) {
+    CKEDITOR.replace( instance, {
+        customConfig: '/bundles/jeroenedcmsed/js/ckeditor.js',
+        extraPlugins: 'codemirror',
+        bodyClass: style
+    });
+}
+function UrlExists(url)
+{
+    if(url == '') return false;
+    var http = new XMLHttpRequest();
+    http.open('HEAD', url, false);
+    http.send();
+    return http.status!=404;
 }

File diff suppressed because it is too large
+ 279 - 279
src/JeroenED/CmsEDBundle/Resources/public/scss/cmsed.scss


+ 63 - 63
src/JeroenED/CmsEDBundle/Resources/views/Menu/index.html.twig

@@ -1,63 +1,63 @@
-{% extends 'JeroenEDCmsEDBundle::base.html.twig' %}
-{% block body %}
-<h1>Menu Module</h1>
-{% if not message is  empty %}
-    <div class="message">{{ message }}</div>
-{% endif %}
-<table>
-    <thead>
-        <tr>
-            <th>id</th>
-            <th>Label</th>
-            <th></th>
-        </tr>
-    </thead>
-    <tbody>
-        {% for menu in menuitems %}
-            <tr>
-                <td class="col-id">{{ menu.id }}</td>
-                <td class="col-label">{{ menu.label }}</td>
-                <td class="col-actions">
-                    <a href="{{ path('menu_edit', { 'id': menu.id }) }}">edit</a> |
-                    <a href="{{ path('menu_details', { 'id': menu.id }) }}">details</a> |
-                    <a href="javascript: void(0);" class="confirmLink"  data-text="Are you sure you want to delete {{ menu.label }}?" data-link="{{ path('menu_delete', { 'id': menu.id }) }}">delete</a>
-                </td>
-            </tr>
-        {% endfor %}
-    </tbody>
-</table>
-<form action="{{ path('menu_ranks') }}" method="post">
-    <input type="hidden" name="ranks" id="ranks">
-    <input type="submit" id="ranks_submit" name="submit" value="Update order" style="display: none;">
-</form>
-{% endblock %}
-
-{% block javascript %}
-<script type="text/javascript">
-    $(document).ready(function() {
-        var fixHelperModified = function(e, tr) {
-            var $originals = tr.children();
-            var $helper = tr.clone();
-            $helper.children().each(function(index) {
-                $(this).width($originals.eq(index).width())
-            });
-            return $helper;
-        },
-        updateIndex = function(e, ui) {
-            var ranks = {};
-            $('td.col-id', ui.item.parent()).each(function (i) {
-                i++;
-                ranks[$(this).html()] = i;
-            });
-            $('#ranks').val(JSON.stringify(ranks));
-            $("#ranks_submit").css('display', 'block');
-                };
-
-        $("table tbody").sortable({
-            helper: fixHelperModified,
-            stop: updateIndex
-        }).disableSelection();
-    });
-
-</script>
-{% endblock %}
+{% extends 'JeroenEDCmsEDBundle::base.html.twig' %}
+{% block body %}
+<h1>Menu Module</h1>
+{% if not message is  empty %}
+    <div class="message">{{ message }}</div>
+{% endif %}
+<table>
+    <thead>
+        <tr>
+            <th>id</th>
+            <th>Label</th>
+            <th></th>
+        </tr>
+    </thead>
+    <tbody>
+        {% for menu in menuitems %}
+            <tr>
+                <td class="col-id">{{ menu.id }}</td>
+                <td class="col-label">{{ menu.label }}</td>
+                <td class="col-actions">
+                    <a href="{{ path('menu_edit', { 'id': menu.id }) }}">edit</a> |
+                    <a href="{{ path('menu_details', { 'id': menu.id }) }}">details</a> |
+                    <a href="javascript: void(0);" class="confirmLink"  data-text="Are you sure you want to delete {{ menu.label }}?" data-link="{{ path('menu_delete', { 'id': menu.id }) }}">delete</a>
+                </td>
+            </tr>
+        {% endfor %}
+    </tbody>
+</table>
+<form action="{{ path('menu_ranks') }}" method="post">
+    <input type="hidden" name="ranks" id="ranks">
+    <input type="submit" id="ranks_submit" name="submit" value="Update order" style="display: none;">
+</form>
+{% endblock %}
+
+{% block javascript %}
+<script type="text/javascript">
+    $(document).ready(function() {
+        var fixHelperModified = function(e, tr) {
+            var $originals = tr.children();
+            var $helper = tr.clone();
+            $helper.children().each(function(index) {
+                $(this).width($originals.eq(index).width())
+            });
+            return $helper;
+        },
+        updateIndex = function(e, ui) {
+            var ranks = {};
+            $('td.col-id', ui.item.parent()).each(function (i) {
+                i++;
+                ranks[$(this).html()] = i;
+            });
+            $('#ranks').val(JSON.stringify(ranks));
+            $("#ranks_submit").css('display', 'block');
+                };
+
+        $("table tbody").sortable({
+            helper: fixHelperModified,
+            stop: updateIndex
+        }).disableSelection();
+    });
+
+</script>
+{% endblock %}

+ 57 - 57
src/JeroenED/CmsEDBundle/Resources/views/Pages/create.html.twig

@@ -1,57 +1,57 @@
-{% extends 'JeroenEDCmsEDBundle::base.html.twig' %}
-{% block body %}
-{{ form_start(form) }}
-{% if errors is iterable %}
-    <ul>
-        {% for error in errors %}
-            <li>{{ error }}</li>
-        {% endfor %}
-    </ul>
-{% endif %}
-
-<p>{{ form_label(form.title) }}{{form_widget(form.title)}}</p>
-<p>{{ form_label(form.download) }}{{form_widget(form.download)}}</p>
-<p>{{form_widget(form.html)}}</p>
-<p>{{ form_label(form.slug) }}{{form_widget(form.slug)}}</p>
-<p>{{ form_widget(form.register)}}</p>
-
-{{ form_end(form) }}
-{% endblock %}
-
-{% block javascript %}
-    <script type="text/javascript">
-        $(document).ready(function () {
-            loadCKeditor('page[html]', 'page');
-            
-            $('body').on('click', '#overlay', function() {
-                $('#elfinder').remove();  //remove Elfinder
-                $('#overlay').remove();
-            });
-            
-            $('.openfilebrowser').click(function() {
-
-                $('body').append('<div id="elfinder"></div>');
-                $("#elfinder").css("position", "fixed");
-                var height = ($(window).innerHeight() - 520) / 2;
-                var width = ($(window).innerWidth() - 1280) / 2;
-                $("#elfinder").css("top", height + "px");
-                $("#elfinder").css("left", width + "px");
-                $("#elfinder").css("z-index", 10);
-                $("body").append('<div id="overlay"></div>');
-
-                var f = $('#elfinder').elfinder({
-                    url : '{{ path('ef_connect') }}',
-                    height: 520,
-                    width: 1280,
-                    closeOnEditorCallback: true,
-                    getFileCallback: function(url) {
-                        $('#page_download').val('/bundles/' + url.path);
-                        $('#elfinder').remove();  //remove Elfinder
-                        $('#overlay').remove();
-                    }
-                }).elfinder('instance');
-            });
-        } );
-        
-    </script>
-{% endblock %}
+{% extends 'JeroenEDCmsEDBundle::base.html.twig' %}
+{% block body %}
+{{ form_start(form) }}
+{% if errors is iterable %}
+    <ul>
+        {% for error in errors %}
+            <li>{{ error }}</li>
+        {% endfor %}
+    </ul>
+{% endif %}
+
+<p>{{ form_label(form.title) }}{{form_widget(form.title)}}</p>
+<p>{{ form_label(form.download) }}{{form_widget(form.download)}}</p>
+<p>{{form_widget(form.html)}}</p>
+<p>{{ form_label(form.slug) }}{{form_widget(form.slug)}}</p>
+<p>{{ form_widget(form.register)}}</p>
+
+{{ form_end(form) }}
+{% endblock %}
+
+{% block javascript %}
+    <script type="text/javascript">
+        $(document).ready(function () {
+            loadCKeditor('page[html]', 'page');
+            
+            $('body').on('click', '#overlay', function() {
+                $('#elfinder').remove();  //remove Elfinder
+                $('#overlay').remove();
+            });
+            
+            $('.openfilebrowser').click(function() {
+
+                $('body').append('<div id="elfinder"></div>');
+                $("#elfinder").css("position", "fixed");
+                var height = ($(window).innerHeight() - 520) / 2;
+                var width = ($(window).innerWidth() - 1280) / 2;
+                $("#elfinder").css("top", height + "px");
+                $("#elfinder").css("left", width + "px");
+                $("#elfinder").css("z-index", 10);
+                $("body").append('<div id="overlay"></div>');
+
+                var f = $('#elfinder').elfinder({
+                    url : '{{ path('ef_connect') }}',
+                    height: 520,
+                    width: 1280,
+                    closeOnEditorCallback: true,
+                    getFileCallback: function(url) {
+                        $('#page_download').val('/bundles/' + url.path);
+                        $('#elfinder').remove();  //remove Elfinder
+                        $('#overlay').remove();
+                    }
+                }).elfinder('instance');
+            });
+        } );
+        
+    </script>
+{% endblock %}

+ 55 - 55
src/JeroenED/CmsEDBundle/Resources/views/Pages/edit.html.twig

@@ -1,55 +1,55 @@
-{% extends 'JeroenEDCmsEDBundle::base.html.twig' %}
-{% block body %}
-{{ form_start(form) }}
-{% if errors is iterable %}
-    <ul>
-        {% for error in errors %}
-            <li>{{ error }}</li>
-        {% endfor %}
-    </ul>
-{% endif %}
-
-<p>{{ form_label(form.title) }}{{form_widget(form.title)}}</p>
-<p>{{ form_label(form.download) }}{{form_widget(form.download)}}</p>
-<p>{{ form_widget(form.html)}} </p>
-<p>{{ form_label(form.slug) }}{{form_widget(form.slug)}}</p>
-<p>{{ form_widget(form.register)}}</p>
-{{ form_end(form) }}
-{% endblock %}
-
-{% block javascript %}
-    <script type="text/javascript">
-        $(document).ready(function () {
-            loadCKeditor('page[html]', 'page');
-
-            $('body').on('click', '#overlay', function() {
-            	$('#elfinder').remove();  //remove Elfinder
-			    $('#overlay').remove();
-            });
-            
-            $('.openfilebrowser').click(function() {
-
-			    $('body').append('<div id="elfinder"></div>');
-				$("#elfinder").css("position", "fixed");
-				var height = ($(window).innerHeight() - 520) / 2;
-				var width = ($(window).innerWidth() - 1020) / 2;
-				$("#elfinder").css("top", height + "px");
-				$("#elfinder").css("left", width + "px");
-				$("#elfinder").css("z-index", 10);
-				$("body").append('<div id="overlay"></div>');
-
-            	var f = $('#elfinder').elfinder({
-			        url : '{{ path('ef_connect') }}',
-			        height: 520,
-			        width: 1020,
-			        closeOnEditorCallback: true,
-			        getFileCallback: function(url) {
-			            $('#page_download').val('/bundles/' + url.path);
-			            $('#elfinder').remove();  //remove Elfinder
-			            $('#overlay').remove();
-			        }
-			    }).elfinder('instance');
-            });
-        } );
-	</script>
-{% endblock %}
+{% extends 'JeroenEDCmsEDBundle::base.html.twig' %}
+{% block body %}
+{{ form_start(form) }}
+{% if errors is iterable %}
+    <ul>
+        {% for error in errors %}
+            <li>{{ error }}</li>
+        {% endfor %}
+    </ul>
+{% endif %}
+
+<p>{{ form_label(form.title) }}{{form_widget(form.title)}}</p>
+<p>{{ form_label(form.download) }}{{form_widget(form.download)}}</p>
+<p>{{ form_widget(form.html)}} </p>
+<p>{{ form_label(form.slug) }}{{form_widget(form.slug)}}</p>
+<p>{{ form_widget(form.register)}}</p>
+{{ form_end(form) }}
+{% endblock %}
+
+{% block javascript %}
+    <script type="text/javascript">
+        $(document).ready(function () {
+            loadCKeditor('page[html]', 'page');
+
+            $('body').on('click', '#overlay', function() {
+            	$('#elfinder').remove();  //remove Elfinder
+			    $('#overlay').remove();
+            });
+            
+            $('.openfilebrowser').click(function() {
+
+			    $('body').append('<div id="elfinder"></div>');
+				$("#elfinder").css("position", "fixed");
+				var height = ($(window).innerHeight() - 520) / 2;
+				var width = ($(window).innerWidth() - 1020) / 2;
+				$("#elfinder").css("top", height + "px");
+				$("#elfinder").css("left", width + "px");
+				$("#elfinder").css("z-index", 10);
+				$("body").append('<div id="overlay"></div>');
+
+            	var f = $('#elfinder').elfinder({
+			        url : '{{ path('ef_connect') }}',
+			        height: 520,
+			        width: 1020,
+			        closeOnEditorCallback: true,
+			        getFileCallback: function(url) {
+			            $('#page_download').val('/bundles/' + url.path);
+			            $('#elfinder').remove();  //remove Elfinder
+			            $('#overlay').remove();
+			        }
+			    }).elfinder('instance');
+            });
+        } );
+	</script>
+{% endblock %}

+ 28 - 28
src/JeroenED/CmsEDBundle/Resources/views/Pages/index.html.twig

@@ -1,29 +1,29 @@
-{% extends 'JeroenEDCmsEDBundle::base.html.twig' %}
-{% block body %}
-<h1>Pages Module</h1>
-{% if not message is  empty %}
-    <div class="message">{{ message }}</div>
-{% endif %}
-<table>
-    <thead>
-        <tr>
-            <th>id</th>
-            <th>title</th>
-            <th></th>
-        </tr>
-    </thead>
-    <tbody>
-        {% for page in pages %}
-            <tr>
-                <td class="col-id">{{ page.id }}</td>
-                <td class="col-label">{{ page.title }} ({{ page.slug }})</td>
-                <td class="col-actions">
-                    <a href="{{ path('page_edit', { 'id': page.id }) }}">edit</a> |
-                    <a href="{{ path('page_details', { 'id': page.id }) }}">details</a> |
-                    <a href="javascript: void(0);" class="confirmLink" data-text="Are you sure you want to delete {{ page.title }}?" data-link="{{ path('page_delete', { 'id': page.id }) }}">delete</a>
-                </td>
-            </tr>
-        {% endfor %}
-    </tbody>
-</table>
+{% extends 'JeroenEDCmsEDBundle::base.html.twig' %}
+{% block body %}
+<h1>Pages Module</h1>
+{% if not message is  empty %}
+    <div class="message">{{ message }}</div>
+{% endif %}
+<table>
+    <thead>
+        <tr>
+            <th>id</th>
+            <th>title</th>
+            <th></th>
+        </tr>
+    </thead>
+    <tbody>
+        {% for page in pages %}
+            <tr>
+                <td class="col-id">{{ page.id }}</td>
+                <td class="col-label">{{ page.title }} ({{ page.slug }})</td>
+                <td class="col-actions">
+                    <a href="{{ path('page_edit', { 'id': page.id }) }}">edit</a> |
+                    <a href="{{ path('page_details', { 'id': page.id }) }}">details</a> |
+                    <a href="javascript: void(0);" class="confirmLink" data-text="Are you sure you want to delete {{ page.title }}?" data-link="{{ path('page_delete', { 'id': page.id }) }}">delete</a>
+                </td>
+            </tr>
+        {% endfor %}
+    </tbody>
+</table>
 {% endblock %}

+ 64 - 64
src/JeroenED/CmsEDBundle/Resources/views/Portfolio/archive.html.twig

@@ -1,64 +1,64 @@
-{% extends 'JeroenEDCmsEDBundle::base.html.twig' %}
-{% block body %}
-<h1>Portfolio Module</h1>
-{% if not message is empty %}
-    <div class="message">{{ message }}</div>
-{% endif %}
-<table>
-    <thead>
-        <tr>
-            <th>id</th>
-            <th>title</th>
-            <th>action</th>
-        </tr>
-    </thead>
-    <tbody>
-        {% for item in portfolio %}
-            <tr>
-                <td class="col-id">{{ item.id }}</td>
-                <td class="col-label">{{ item.title }}</td>
-                <td class="col-actions">
-                    <a href="{{ path('portfolio_edit', { 'id': item.id }) }}">edit</a> |
-                    <a href="{{ path('portfolio_details', { 'id': item.id }) }}">details</a> |
-                    <a href="javascript: void(0);" class="confirmLink"  data-text="Are you sure you want to delete {{ item.title }}?" data-link="{{ path('portfolio_delete', { 'id': item.id }) }}?returnurl=portfolio_archive">delete</a>
-                </td>
-            </tr>
-        {% endfor %}
-    </tbody>
-</table>
-<form action="{{ path('portfolio_ranks') }}" method="post">
-    <input type="hidden" name="ranks" id="ranks">
-    <input type="hidden" name="returnurl" id="returnurl" value="portfolio_archive">
-    <input type="submit" id="ranks_submit" name="submit" value="Update order" style="display: none;">
-</form>
-{% endblock %}
-
-{% block javascript %}
-<script type="text/javascript">
-    $(document).ready(function() {
-        var fixHelperModified = function(e, tr) {
-            var $originals = tr.children();
-            var $helper = tr.clone();
-            $helper.children().each(function(index) {
-                $(this).width($originals.eq(index).width())
-            });
-            return $helper;
-        },
-        updateIndex = function(e, ui) {
-            var ranks = {};
-            $('td.col-id', ui.item.parent()).each(function (i) {
-                i++;
-                ranks[$(this).html()] = i;
-            });
-            $('#ranks').val(JSON.stringify(ranks));
-            $("#ranks_submit").css('display', 'block');
-                };
-
-        $("table tbody").sortable({
-            helper: fixHelperModified,
-            stop: updateIndex
-        }).disableSelection();
-    });
-
-</script>
-{% endblock %}
+{% extends 'JeroenEDCmsEDBundle::base.html.twig' %}
+{% block body %}
+<h1>Portfolio Module</h1>
+{% if not message is empty %}
+    <div class="message">{{ message }}</div>
+{% endif %}
+<table>
+    <thead>
+        <tr>
+            <th>id</th>
+            <th>title</th>
+            <th>action</th>
+        </tr>
+    </thead>
+    <tbody>
+        {% for item in portfolio %}
+            <tr>
+                <td class="col-id">{{ item.id }}</td>
+                <td class="col-label">{{ item.title }}</td>
+                <td class="col-actions">
+                    <a href="{{ path('portfolio_edit', { 'id': item.id }) }}">edit</a> |
+                    <a href="{{ path('portfolio_details', { 'id': item.id }) }}">details</a> |
+                    <a href="javascript: void(0);" class="confirmLink"  data-text="Are you sure you want to delete {{ item.title }}?" data-link="{{ path('portfolio_delete', { 'id': item.id }) }}?returnurl=portfolio_archive">delete</a>
+                </td>
+            </tr>
+        {% endfor %}
+    </tbody>
+</table>
+<form action="{{ path('portfolio_ranks') }}" method="post">
+    <input type="hidden" name="ranks" id="ranks">
+    <input type="hidden" name="returnurl" id="returnurl" value="portfolio_archive">
+    <input type="submit" id="ranks_submit" name="submit" value="Update order" style="display: none;">
+</form>
+{% endblock %}
+
+{% block javascript %}
+<script type="text/javascript">
+    $(document).ready(function() {
+        var fixHelperModified = function(e, tr) {
+            var $originals = tr.children();
+            var $helper = tr.clone();
+            $helper.children().each(function(index) {
+                $(this).width($originals.eq(index).width())
+            });
+            return $helper;
+        },
+        updateIndex = function(e, ui) {
+            var ranks = {};
+            $('td.col-id', ui.item.parent()).each(function (i) {
+                i++;
+                ranks[$(this).html()] = i;
+            });
+            $('#ranks').val(JSON.stringify(ranks));
+            $("#ranks_submit").css('display', 'block');
+                };
+
+        $("table tbody").sortable({
+            helper: fixHelperModified,
+            stop: updateIndex
+        }).disableSelection();
+    });
+
+</script>
+{% endblock %}

+ 251 - 251
src/JeroenED/CmsEDBundle/Resources/views/Portfolio/create.html.twig

@@ -1,251 +1,251 @@
-{% extends 'JeroenEDCmsEDBundle::base.html.twig' %}
-{% block body %}
-{{ form_start(form) }}
-{% if errors is iterable %}
-    <ul>
-        {% for error in errors %}
-            <li>{{ error }}</li>
-        {% endfor %}
-    </ul>
-{% endif %}
-
-<p>{{ form_label(form.title) }}{{form_widget(form.title)}}</p>
-<p>{{ form_label(form.archived) }}{{form_widget(form.archived)}}</p>
-<p>{{ form_widget(form.rank) }}</p>
-<p>{{ form_widget(form.register) }}</p>
-<p>{{ form_widget(form.pages) }}</p>
-
-{{ form_end(form) }}
-<table>
-    <thead>
-        <tr>
-            <th>id</th>
-            <th>Slug</th>
-            <th></th>
-        </tr>
-    </thead>
-    <tbody class="pages">
-        <tr class="nopages">
-            <td colspan="3">No pages, yet</td>
-        </tr>
-    </tbody>
-</table>
-
-<p><a href="javascript:void(0);" class="addPage">Add a page</a></p>
-{{ form_start(pageform, { 'attr': {'style': 'display: none;'} }) }}
-
-<p>{{ form_label(pageform.slug) }}{{form_widget(pageform.slug)}}</p>
-<p>{{ form_label(pageform.showtitle) }}{{form_widget(pageform.showtitle)}}</p>
-<p>{{ form_label(pageform.background) }}{{form_widget(pageform.background)}}</p>
-<p>{{ form_label(pageform.html) }}{{form_widget(pageform.html)}}</p>
-<p>{{ form_widget(pageform.register)}}</p>
-
-{{ form_end(pageform) }}
-
-{% endblock %}
-
-{% block javascript %}
-    <script type="text/javascript">
-$(document).ready(function() {
-    $('body').on('click', '.addPage', function() {
-        if($('form[name=portfolio_page]').css('display') == "block") {
-            $('#dialog').html('The open page is not saved yet. Are you sure you want to proceed?');
-            $("#dialog").dialog({
-                buttons: {
-                    "Confirm": function() {
-                        clearPage();
-                        $(this).dialog("close");
-                    },
-                    "Cancel": function() {
-                        $(this).dialog("close");
-                    }
-                }
-            });
-            $("#dialog").dialog("open");
-        } else {
-            clearPage();
-        }
-        
-    });
-    
-    $('body').on('click', '#overlay', function() {
-        $('#elfinder').remove();  //remove Elfinder
-        $('#overlay').remove();
-    });
-            
-    $('body').on('click', '.openfilebrowser', function() {
-        $('body').append('<div id="elfinder"></div>');
-        $("#elfinder").css("position", "fixed");
-        var height = ($(window).innerHeight() - 520) / 2;
-        var width = ($(window).innerWidth() - 1280) / 2;
-        $("#elfinder").css("top", height + "px");
-        $("#elfinder").css("left", width + "px");
-        $("#elfinder").css("z-index", 10);
-        $("body").append('<div id="overlay"></div>');
-
-        var f = $('#elfinder').elfinder({
-            url : '{{ path('ef_connect') }}',
-            height: 520,
-            width: 1280,
-            closeOnEditorCallback: true,
-            getFileCallback: function(url) {
-                $('#portfolio_page_background').val('/bundles/' + url.path);
-                $('#elfinder').remove();  //remove Elfinder    
-                var urlpath = $('#portfolio_page_background').val();
-                CKEDITOR.instances.portfolio_page_html.destroy();
-                if(!UrlExists(urlpath)) { urlpath = "/bundles/jeroenedportfolio/images/background.png"; }
-                CKEDITOR.addCss('.cke_editable{ background-image: url("' + urlpath + '"); background-position: center top; }');
-                loadCKeditor('portfolio_page[html]', 'reveal');
-                $('#overlay').remove();
-            }
-        }).elfinder('instance');
-    });
-
-    $("body").on("focusout", "#portfolio_page_background", function() {
-        var urlpath = $('#portfolio_page_background').val();
-        CKEDITOR.instances.portfolio_page_html.destroy();
-        if(!UrlExists(urlpath)) { urlpath = "/bundles/jeroenedportfolio/images/background.png"; }
-        CKEDITOR.addCss('.cke_editable{ background-image: url("' + urlpath + '"); background-position: center top; }');
-        loadCKeditor('portfolio_page[html]', 'reveal');
-    });
-    
-    $('#portfolio_page_register').click(function() {
-        var newObject = {
-            Slug: $("#portfolio_page_slug").val(),
-            Background: $("#portfolio_page_background").val(),
-            Html: CKEDITOR.instances.portfolio_page_html.getData(),
-            ShowTitle: $("#portfolio_page_showtitle")[0].checked ? true : false
-        };
-        var oldObjects = [];
-        if ($('#portfolio_pages').val() !== '') oldObjects = $.parseJSON($('#portfolio_pages').val());
-        if ($('#portfolio_page_index').val() !== '') {
-            var index =$('#portfolio_page_index').val()
-            oldObjects[index] = newObject;
-            $('.pages tr td.col-id:contains('+ index +')').closest('tr').html('<td class="col-id">' + index + '</td><td class="col-label">' + $("#portfolio_page_slug").val() + '</td><td class="col-actions"><a href="javascript:void(0);" data-action="edit">edit</a> | <a href="javascript:void(0);" data-action="remove">remove</a></td>');
-        }else { 
-            var index = oldObjects.push(newObject) - 1; 
-            $('.pages').append('<tr><td class="col-id">' + index + '</td><td class="col-label">' + $("#portfolio_page_slug").val() + '</td><td class="col-actions"><a href="javascript:void(0);" data-action="edit">edit</a> | <a href="javascript:void(0);" data-action="remove">remove</a></td></tr>');
-        }
-        $('#portfolio_pages').val(JSON.stringify(oldObjects));
-        $('.nopages').css('display', 'none');
-        $('form[name=portfolio_page]').css('display', 'none');
-        $("#portfolio_page_slug").val('');
-        $("#portfolio_page_background").val('');
-        $("#portfolio_page_html").val('');
-        CKEDITOR.instances.portfolio_page_html.setData('');
-        $("#portfolio_page_showtitle")[0].checked = false;
-        $("#portfolio_page_index").val('');
-    });
-    $('table').on('click', 'a[data-action]', function() {
-        var index = $(this).closest('td').siblings(".col-id").html(); 
-        var pages = $.parseJSON($('#portfolio_pages').val());
-        switch ($(this).data('action')) {
-            case 'edit':
-                $("#portfolio_page_slug").val(pages[index].Slug);
-                $("#portfolio_page_background").val(pages[index].Background);
-                $("#portfolio_page_html").val(pages[index].Html);
-                $("#portfolio_page_register").html("Update page");
-                CKEDITOR.instances.portfolio_page_html.setData(pages[index].Html);
-                $("#portfolio_page_showtitle")[0].checked = pages[index].ShowTitle;
-                $("#portfolio_page_index").val(index);
-                $('form[name=portfolio_page]').css('display', 'block');
-                $('nav').css("height", ($(document).innerHeight() - 150 + "px"));
-                CKEDITOR.instances.portfolio_page_html.destroy();
-                if(!UrlExists(url)) { url = "/bundles/jeroenedportfolio/images/background.png"; }
-		        CKEDITOR.addCss('.cke_editable{ background-image: url("' + url + '"); background-position: center top; }');
-                loadCKeditor('portfolio_page[html]', 'reveal');
-                break;
-            case 'remove':
-                $('#dialog').html('Are you sure you want to delete this page?');
-		        e.preventDefault();
-        		$("#dialog").dialog({
-                    buttons: {
-                        "Confirm": function() {
-                            pages.splice(index, 1);
-                            $('#portfolio_pages').val(JSON.stringify(pages));
-                            $('.pages tr td.col-id:contains('+ index +')').closest('tr').remove();
-                            if (pages.length == 0){
-                                $('.nopages').css('display', '');
-                            }
-                            else { 
-                                var i = 0;
-                                $('.pages tr td.col-id').each( function () {
-                                    $(this).html(i);
-                                    i++;
-                                });
-                            }
-                            $(this).dialog("close");
-                        },
-                        "Cancel": function() {
-                            $(this).dialog("close");
-                        }
-                    }
-        		});
-        		$("#dialog").dialog("open");
-                break;
-        }
-    });
-    
-    $("body").on("click", "#portfolio_register", function (e) {
-        if ($('form[name=portfolio_page]').css('display') == "block") {
-            $('#dialog').html('The open page is not saved. Are you sure you want to submit this item anyway?');
-            e.preventDefault();
-            $("#dialog").dialog({
-                buttons: {
-                    "Save anyway": function() {
-                        document.forms["portfolio"].submit();
-                        $(this).dialog("close");
-                    },
-                    "Cancel": function() {
-                        $(this).dialog("close");
-                    }
-                }
-            });
-            $("#dialog").dialog("open");
-        }
-    });
-    $(document).ready(function() {
-        var fixHelperModified = function(e, tr) {
-            var $originals = tr.children();
-            var $helper = tr.clone();
-            $helper.children().each(function(index) {
-                $(this).width($originals.eq(index).width())
-            });
-            return $helper;
-        },
-        updateIndex = function(e, ui) {
-            var oldOrder = $.parseJSON($('#portfolio_pages').val());
-            var newOrder = [];
-            $('td.col-id', ui.item.parent()).each(function (i) {
-                newOrder[i] = oldOrder[$(this).html()];
-                $(this).html(i);
-            });
-            $('#portfolio_pages').val(JSON.stringify(newOrder));
-        };
-
-        $("table tbody").sortable({
-            helper: fixHelperModified,
-            stop: updateIndex
-        }).disableSelection();
-    });
-    
-    loadCKeditor('portfolio_page[html]', 'reveal');
-});
-
-function clearPage() {
-    $("#portfolio_page_slug").val('');
-    $("#portfolio_page_background").val('');
-    $("#portfolio_page_html").val('');
-    CKEDITOR.instances.portfolio_page_html.setData('');
-    $("#portfolio_page_showtitle")[0].checked = false;
-    $("#portfolio_page_index").val('');
-    $('form[name=portfolio_page]').css('display', 'block');
-    $("#portfolio_page_register").html("Add page");
-    $('nav').css("height", ($(document).innerHeight() - 150 + "px"));
-    url = "/bundles/jeroenedportfolio/images/background.png";
-    CKEDITOR.instances.portfolio_page_html.destroy();
-    CKEDITOR.addCss('.cke_editable{ background-image: url("' + url + '"); background-position: center top; }');
-    loadCKeditor('portfolio_page[html]',  'reveal');
-}
-</script>
-{% endblock %}
+{% extends 'JeroenEDCmsEDBundle::base.html.twig' %}
+{% block body %}
+{{ form_start(form) }}
+{% if errors is iterable %}
+    <ul>
+        {% for error in errors %}
+            <li>{{ error }}</li>
+        {% endfor %}
+    </ul>
+{% endif %}
+
+<p>{{ form_label(form.title) }}{{form_widget(form.title)}}</p>
+<p>{{ form_label(form.archived) }}{{form_widget(form.archived)}}</p>
+<p>{{ form_widget(form.rank) }}</p>
+<p>{{ form_widget(form.register) }}</p>
+<p>{{ form_widget(form.pages) }}</p>
+
+{{ form_end(form) }}
+<table>
+    <thead>
+        <tr>
+            <th>id</th>
+            <th>Slug</th>
+            <th></th>
+        </tr>
+    </thead>
+    <tbody class="pages">
+        <tr class="nopages">
+            <td colspan="3">No pages, yet</td>
+        </tr>
+    </tbody>
+</table>
+
+<p><a href="javascript:void(0);" class="addPage">Add a page</a></p>
+{{ form_start(pageform, { 'attr': {'style': 'display: none;'} }) }}
+
+<p>{{ form_label(pageform.slug) }}{{form_widget(pageform.slug)}}</p>
+<p>{{ form_label(pageform.showtitle) }}{{form_widget(pageform.showtitle)}}</p>
+<p>{{ form_label(pageform.background) }}{{form_widget(pageform.background)}}</p>
+<p>{{ form_label(pageform.html) }}{{form_widget(pageform.html)}}</p>
+<p>{{ form_widget(pageform.register)}}</p>
+
+{{ form_end(pageform) }}
+
+{% endblock %}
+
+{% block javascript %}
+    <script type="text/javascript">
+$(document).ready(function() {
+    $('body').on('click', '.addPage', function() {
+        if($('form[name=portfolio_page]').css('display') == "block") {
+            $('#dialog').html('The open page is not saved yet. Are you sure you want to proceed?');
+            $("#dialog").dialog({
+                buttons: {
+                    "Confirm": function() {
+                        clearPage();
+                        $(this).dialog("close");
+                    },
+                    "Cancel": function() {
+                        $(this).dialog("close");
+                    }
+                }
+            });
+            $("#dialog").dialog("open");
+        } else {
+            clearPage();
+        }
+        
+    });
+    
+    $('body').on('click', '#overlay', function() {
+        $('#elfinder').remove();  //remove Elfinder
+        $('#overlay').remove();
+    });
+            
+    $('body').on('click', '.openfilebrowser', function() {
+        $('body').append('<div id="elfinder"></div>');
+        $("#elfinder").css("position", "fixed");
+        var height = ($(window).innerHeight() - 520) / 2;
+        var width = ($(window).innerWidth() - 1280) / 2;
+        $("#elfinder").css("top", height + "px");
+        $("#elfinder").css("left", width + "px");
+        $("#elfinder").css("z-index", 10);
+        $("body").append('<div id="overlay"></div>');
+
+        var f = $('#elfinder').elfinder({
+            url : '{{ path('ef_connect') }}',
+            height: 520,
+            width: 1280,
+            closeOnEditorCallback: true,
+            getFileCallback: function(url) {
+                $('#portfolio_page_background').val('/bundles/' + url.path);
+                $('#elfinder').remove();  //remove Elfinder    
+                var urlpath = $('#portfolio_page_background').val();
+                CKEDITOR.instances.portfolio_page_html.destroy();
+                if(!UrlExists(urlpath)) { urlpath = "/bundles/jeroenedportfolio/images/background.png"; }
+                CKEDITOR.addCss('.cke_editable{ background-image: url("' + urlpath + '"); background-position: center top; }');
+                loadCKeditor('portfolio_page[html]', 'reveal');
+                $('#overlay').remove();
+            }
+        }).elfinder('instance');
+    });
+
+    $("body").on("focusout", "#portfolio_page_background", function() {
+        var urlpath = $('#portfolio_page_background').val();
+        CKEDITOR.instances.portfolio_page_html.destroy();
+        if(!UrlExists(urlpath)) { urlpath = "/bundles/jeroenedportfolio/images/background.png"; }
+        CKEDITOR.addCss('.cke_editable{ background-image: url("' + urlpath + '"); background-position: center top; }');
+        loadCKeditor('portfolio_page[html]', 'reveal');
+    });
+    
+    $('#portfolio_page_register').click(function() {
+        var newObject = {
+            Slug: $("#portfolio_page_slug").val(),
+            Background: $("#portfolio_page_background").val(),
+            Html: CKEDITOR.instances.portfolio_page_html.getData(),
+            ShowTitle: $("#portfolio_page_showtitle")[0].checked ? true : false
+        };
+        var oldObjects = [];
+        if ($('#portfolio_pages').val() !== '') oldObjects = $.parseJSON($('#portfolio_pages').val());
+        if ($('#portfolio_page_index').val() !== '') {
+            var index =$('#portfolio_page_index').val()
+            oldObjects[index] = newObject;
+            $('.pages tr td.col-id:contains('+ index +')').closest('tr').html('<td class="col-id">' + index + '</td><td class="col-label">' + $("#portfolio_page_slug").val() + '</td><td class="col-actions"><a href="javascript:void(0);" data-action="edit">edit</a> | <a href="javascript:void(0);" data-action="remove">remove</a></td>');
+        }else { 
+            var index = oldObjects.push(newObject) - 1; 
+            $('.pages').append('<tr><td class="col-id">' + index + '</td><td class="col-label">' + $("#portfolio_page_slug").val() + '</td><td class="col-actions"><a href="javascript:void(0);" data-action="edit">edit</a> | <a href="javascript:void(0);" data-action="remove">remove</a></td></tr>');
+        }
+        $('#portfolio_pages').val(JSON.stringify(oldObjects));
+        $('.nopages').css('display', 'none');
+        $('form[name=portfolio_page]').css('display', 'none');
+        $("#portfolio_page_slug").val('');
+        $("#portfolio_page_background").val('');
+        $("#portfolio_page_html").val('');
+        CKEDITOR.instances.portfolio_page_html.setData('');
+        $("#portfolio_page_showtitle")[0].checked = false;
+        $("#portfolio_page_index").val('');
+    });
+    $('table').on('click', 'a[data-action]', function() {
+        var index = $(this).closest('td').siblings(".col-id").html(); 
+        var pages = $.parseJSON($('#portfolio_pages').val());
+        switch ($(this).data('action')) {
+            case 'edit':
+                $("#portfolio_page_slug").val(pages[index].Slug);
+                $("#portfolio_page_background").val(pages[index].Background);
+                $("#portfolio_page_html").val(pages[index].Html);
+                $("#portfolio_page_register").html("Update page");
+                CKEDITOR.instances.portfolio_page_html.setData(pages[index].Html);
+                $("#portfolio_page_showtitle")[0].checked = pages[index].ShowTitle;
+                $("#portfolio_page_index").val(index);
+                $('form[name=portfolio_page]').css('display', 'block');
+                $('nav').css("height", ($(document).innerHeight() - 150 + "px"));
+                CKEDITOR.instances.portfolio_page_html.destroy();
+                if(!UrlExists(url)) { url = "/bundles/jeroenedportfolio/images/background.png"; }
+		        CKEDITOR.addCss('.cke_editable{ background-image: url("' + url + '"); background-position: center top; }');
+                loadCKeditor('portfolio_page[html]', 'reveal');
+                break;
+            case 'remove':
+                $('#dialog').html('Are you sure you want to delete this page?');
+		        e.preventDefault();
+        		$("#dialog").dialog({
+                    buttons: {
+                        "Confirm": function() {
+                            pages.splice(index, 1);
+                            $('#portfolio_pages').val(JSON.stringify(pages));
+                            $('.pages tr td.col-id:contains('+ index +')').closest('tr').remove();
+                            if (pages.length == 0){
+                                $('.nopages').css('display', '');
+                            }
+                            else { 
+                                var i = 0;
+                                $('.pages tr td.col-id').each( function () {
+                                    $(this).html(i);
+                                    i++;
+                                });
+                            }
+                            $(this).dialog("close");
+                        },
+                        "Cancel": function() {
+                            $(this).dialog("close");
+                        }
+                    }
+        		});
+        		$("#dialog").dialog("open");
+                break;
+        }
+    });
+    
+    $("body").on("click", "#portfolio_register", function (e) {
+        if ($('form[name=portfolio_page]').css('display') == "block") {
+            $('#dialog').html('The open page is not saved. Are you sure you want to submit this item anyway?');
+            e.preventDefault();
+            $("#dialog").dialog({
+                buttons: {
+                    "Save anyway": function() {
+                        document.forms["portfolio"].submit();
+                        $(this).dialog("close");
+                    },
+                    "Cancel": function() {
+                        $(this).dialog("close");
+                    }
+                }
+            });
+            $("#dialog").dialog("open");
+        }
+    });
+    $(document).ready(function() {
+        var fixHelperModified = function(e, tr) {
+            var $originals = tr.children();
+            var $helper = tr.clone();
+            $helper.children().each(function(index) {
+                $(this).width($originals.eq(index).width())
+            });
+            return $helper;
+        },
+        updateIndex = function(e, ui) {
+            var oldOrder = $.parseJSON($('#portfolio_pages').val());
+            var newOrder = [];
+            $('td.col-id', ui.item.parent()).each(function (i) {
+                newOrder[i] = oldOrder[$(this).html()];
+                $(this).html(i);
+            });
+            $('#portfolio_pages').val(JSON.stringify(newOrder));
+        };
+
+        $("table tbody").sortable({
+            helper: fixHelperModified,
+            stop: updateIndex
+        }).disableSelection();
+    });
+    
+    loadCKeditor('portfolio_page[html]', 'reveal');
+});
+
+function clearPage() {
+    $("#portfolio_page_slug").val('');
+    $("#portfolio_page_background").val('');
+    $("#portfolio_page_html").val('');
+    CKEDITOR.instances.portfolio_page_html.setData('');
+    $("#portfolio_page_showtitle")[0].checked = false;
+    $("#portfolio_page_index").val('');
+    $('form[name=portfolio_page]').css('display', 'block');
+    $("#portfolio_page_register").html("Add page");
+    $('nav').css("height", ($(document).innerHeight() - 150 + "px"));
+    url = "/bundles/jeroenedportfolio/images/background.png";
+    CKEDITOR.instances.portfolio_page_html.destroy();
+    CKEDITOR.addCss('.cke_editable{ background-image: url("' + url + '"); background-position: center top; }');
+    loadCKeditor('portfolio_page[html]',  'reveal');
+}
+</script>
+{% endblock %}

+ 257 - 257
src/JeroenED/CmsEDBundle/Resources/views/Portfolio/edit.html.twig

@@ -1,257 +1,257 @@
-{% extends 'JeroenEDCmsEDBundle::base.html.twig' %}
-{% block body %}
-{{ form_start(form) }}
-{% if errors is iterable %}
-    <ul>
-        {% for error in errors %}
-            <li>{{ error }}</li>
-        {% endfor %}
-    </ul>
-{% endif %}
-
-<p>{{ form_label(form.title) }}{{form_widget(form.title)}}</p>
-<p>{{ form_label(form.archived) }}{{form_widget(form.archived)}}</p>
-<p>{{ form_widget(form.rank) }}</p>
-<p>{{ form_widget(form.register)}}</p>
-<p>{{ form_widget(form.pages)}}</p>
-
-{{ form_end(form) }}
-<table>
-    <thead>
-        <tr>
-            <th>id</th>
-            <th>Slug</th>
-            <th></th>
-        </tr>
-    </thead>
-    <tbody class="pages">
-        {% for key,page in pages %}
-            <tr><td class="col-id">{{ key }}</td><td class="col-label">{{ page.Slug }}</td><td class="col-actions"><a href="javascript:void(0);" data-action="edit">edit</a> | <a href="javascript:void(0);" data-action="remove">remove</a></td></tr>
-        {% endfor %}
-        <tr class="nopages">
-            <td colspan="3" style="display: none;">No pages, yet</td>
-        </tr>
-    </tbody>
-</table>
-<p><a href="javascript:void(0);" class="addPage">Add a page</a></p>
-{{ form_start(pageform, { 'attr': {'style': 'display: none;'} }) }}
-
-<p>{{ form_label(pageform.slug) }}{{form_widget(pageform.slug)}}</p>
-<p>{{ form_label(pageform.showtitle) }}{{form_widget(pageform.showtitle)}}</p>
-<p>{{ form_label(pageform.background) }}{{form_widget(pageform.background)}}</p>
-<p>{{ form_label(pageform.html) }}{{form_widget(pageform.html)}}</p>
-<p>{{ form_widget(pageform.register)}}</p>
-
-{{ form_end(pageform) }}
-
-{% endblock %}
-
-{% block javascript %}
-    <script type="text/javascript">
-$(document).ready(function() {
-    $('body').on('click', '.addPage', function() {
-        if($('form[name=portfolio_page]').css('display') == "block") {
-            $('#dialog').html('The open page is not saved yet. Are you sure you want to proceed?');
-            $("#dialog").dialog({
-                buttons: {
-                    "Confirm": function() {
-                        clearPage();
-                        $(this).dialog("close");
-                    },
-                    "Cancel": function() {
-                        $(this).dialog("close");
-                    }
-                }
-            });
-            $("#dialog").dialog("open");
-        } else {
-            clearPage();
-        }
-        
-    });
-
-    $('body').on('click', '#overlay', function() {
-        $('#elfinder').remove();  //remove Elfinder
-        $('#overlay').remove();
-    });
-            
-    $('body').on('click', '.openfilebrowser', function() {
-        $('body').append('<div id="elfinder"></div>');
-        $("#elfinder").css("position", "fixed");
-        var height = ($(window).innerHeight() - 520) / 2;
-        var width = ($(window).innerWidth() - 1280) / 2;
-        $("#elfinder").css("top", height + "px");
-        $("#elfinder").css("left", width + "px");
-        $("#elfinder").css("z-index", 10);
-        $("body").append('<div id="overlay"></div>');
-
-        var f = $('#elfinder').elfinder({
-            url : '{{ path('ef_connect') }}',
-            height: 520,
-            width: 1280,
-            closeOnEditorCallback: true,
-            getFileCallback: function(url) {
-                $('#portfolio_page_background').val('/bundles/' + url.path);
-                $('#elfinder').remove();  //remove Elfinder    
-                var urlpath = $('#portfolio_page_background').val();
-                CKEDITOR.instances.portfolio_page_html.destroy();
-                if(!UrlExists(urlpath)) { urlpath = "/bundles/jeroenedportfolio/images/background.png"; }
-                CKEDITOR.addCss('.cke_editable{ background-image: url("' + urlpath + '"); background-position: center top; }');
-                loadCKeditor('portfolio_page[html]', 'reveal');
-                $('#overlay').remove();
-            }
-        }).elfinder('instance');
-    });
-
-    $("body").on("focusout", "#portfolio_page_background", function() {
-    	var urlpath = $('#portfolio_page_background').val();
-        CKEDITOR.instances.portfolio_page_html.destroy();
-        if(!UrlExists(urlpath)) { urlpath = "/bundles/jeroenedportfolio/images/background.png"; }
-        CKEDITOR.addCss('.cke_editable{ background-image: url("' + urlpath + '"); background-position: center top; }');
-        loadCKeditor('portfolio_page[html]', 'reveal');
-    });
-    
-    $('#portfolio_page_register').click(function() {
-        var newObject = {
-            Slug: $("#portfolio_page_slug").val(),
-            Background: $("#portfolio_page_background").val(),
-            Html: CKEDITOR.instances.portfolio_page_html.getData(),
-            ShowTitle: $("#portfolio_page_showtitle")[0].checked ? true : false
-        };
-        var oldObjects = [];
-        if ($('#portfolio_pages').val() !== '') oldObjects = $.parseJSON($('#portfolio_pages').val());
-        if ($('#portfolio_page_index').val() !== '') {
-            var index =$('#portfolio_page_index').val()
-            oldObjects[index] = newObject;
-            $('.pages tr td.col-id:contains('+ index +')').closest('tr').html('<td class="col-id">' + index + '</td><td class="col-label">' + $("#portfolio_page_slug").val() + '</td><td class="col-actions"><a href="javascript:void(0);" data-action="edit">edit</a> | <a href="javascript:void(0);" data-action="remove">remove</a></td>');
-        }else { 
-            var index = oldObjects.push(newObject) - 1; 
-            $('.pages').append('<tr><td class="col-id">' + index + '</td><td class="col-label">' + $("#portfolio_page_slug").val() + '</td><td class="col-actions"><a href="javascript:void(0);" data-action="edit">edit</a> | <a href="javascript:void(0);" data-action="remove">remove</a></td></tr>');
-        }
-        $('#portfolio_pages').val(JSON.stringify(oldObjects));
-        $('.nopages').css('display', 'none');
-        $('form[name=portfolio_page]').css('display', 'none');
-        $("#portfolio_page_slug").val('');
-        $("#portfolio_page_background").val('');
-        $("#portfolio_page_html").val('');
-        CKEDITOR.instances.portfolio_page_html.setData('');
-        $("#portfolio_page_showtitle")[0].checked = false;
-        $("#portfolio_page_index").val('');
-    });
-    $('table').on('click', 'a[data-action]', function(e) {
-        var index = $(this).closest('td').siblings(".col-id").html(); 
-        var pages = $.parseJSON($('#portfolio_pages').val());
-        switch ($(this).data('action')) {
-            case 'edit':
-                $("#portfolio_page_slug").val(pages[index].Slug);
-                $("#portfolio_page_background").val(pages[index].Background);
-                $("#portfolio_page_html").val(pages[index].Html);
-                $("#portfolio_page_register").html("Update page");
-                CKEDITOR.instances.portfolio_page_html.setData(pages[index].Html);
-                $("#portfolio_page_showtitle")[0].checked = pages[index].ShowTitle;
-                $("#portfolio_page_index").val(index);
-                $('form[name=portfolio_page]').css('display', 'block');
-                url = $('#portfolio_page_background').val();
-                $('nav').css("height", ($(document).innerHeight() - 150 + "px"));
-                CKEDITOR.instances.portfolio_page_html.destroy();
-                if(!UrlExists(url)) { url = "/bundles/jeroenedportfolio/images/background.png"; }
-		CKEDITOR.addCss('.cke_editable{ background-image: url("' + url + '"); background-position: center top; }');
-                loadCKeditor('portfolio_page[html]', 'reveal');
-                break;
-            case 'remove':
-                $('#dialog').html('Are you sure you want to delete this page?');
-		e.preventDefault();
-		$("#dialog").dialog({
-                    buttons: {
-                        "Confirm": function() {
-                            pages.splice(index, 1);
-                            $('#portfolio_pages').val(JSON.stringify(pages));
-                            $('.pages tr td.col-id:contains('+ index +')').closest('tr').remove();
-                            if (pages.length == 0){
-                                $('.nopages').css('display', '');
-                            }
-                            else { 
-                                var i = 0;
-                                $('.pages tr td.col-id').each( function () {
-                                    $(this).html(i);
-                                    i++;
-                                });
-                            }
-                            $(this).dialog("close");
-                        },
-                        "Cancel": function() {
-                            $(this).dialog("close");
-                        }
-                    }
-		});