From 6731d716f87cf22961c31b94af788f553db88d4b Mon Sep 17 00:00:00 2001 From: andibraeu Date: Sat, 16 Aug 2014 09:39:07 +0200 Subject: [PATCH 01/14] added link to ics file --- .../CalciferBundle/Resources/views/Event/index.html.twig | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Hackspace/Bundle/CalciferBundle/Resources/views/Event/index.html.twig b/src/Hackspace/Bundle/CalciferBundle/Resources/views/Event/index.html.twig index e820215..287a5a6 100755 --- a/src/Hackspace/Bundle/CalciferBundle/Resources/views/Event/index.html.twig +++ b/src/Hackspace/Bundle/CalciferBundle/Resources/views/Event/index.html.twig @@ -24,6 +24,9 @@ {% if tag|default(false) %} für Tag „{{ tag.name }}“{% endif %} {% if location|default(false) %} für Ort „{{ location.name }}“{% endif %} + {% if tag|default(false) %} + Link zur Kalenderdatei + {% endif %} From 1b3fc58d441aae194129ee7d07a6c7b22aed9a73 Mon Sep 17 00:00:00 2001 From: Tim Schumacher Date: Wed, 24 Sep 2014 23:25:19 +0200 Subject: [PATCH 02/14] Add the model stuff to the location. --- .../Bundle/CalciferBundle/Entity/Location.php | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/src/Hackspace/Bundle/CalciferBundle/Entity/Location.php b/src/Hackspace/Bundle/CalciferBundle/Entity/Location.php index afd6feb..477d42f 100755 --- a/src/Hackspace/Bundle/CalciferBundle/Entity/Location.php +++ b/src/Hackspace/Bundle/CalciferBundle/Entity/Location.php @@ -8,8 +8,13 @@ use Doctrine\ORM\Mapping as ORM; * Location * * @property string $name + * @property string $description * @property float $lon * @property float $lat + * @property string $streetaddress + * @property string $streetnumber + * @property string $zipcode; + * @property string $city * * @ORM\Table(name="locations") * @ORM\Entity @@ -23,6 +28,41 @@ class Location extends BaseEntity */ protected $name; + /** + * @var string + * + * @ORM\Column(name="description", type="text", nullable=true) + */ + protected $description; + + /** + * @var string + * + * @ORM\Column(name="streetaddress", type="string", length=255, nullable=true) + */ + protected $streetaddress; + + /** + * @var string + * + * @ORM\Column(name="streetnumber", type="string", length=255, nullable=true) + */ + protected $streetnumber; + + /** + * @var string + * + * @ORM\Column(name="zipcode", type="string", length=255, nullable=true) + */ + protected $zipcode; + + /** + * @var string + * + * @ORM\Column(name="city", type="string", length=255, nullable=true) + */ + protected $city; + /** * @var float * @@ -37,5 +77,9 @@ class Location extends BaseEntity */ protected $lat; + public function hasAddress() { + return ((strlen($this->streetaddress) > 0) && (strlen($this->city))); + } + } From 92270160868a39d33d0a22b4005055cf095ced48 Mon Sep 17 00:00:00 2001 From: Tim Schumacher Date: Wed, 24 Sep 2014 23:26:49 +0200 Subject: [PATCH 03/14] Add edit form for the location. --- .../Controller/LocationController.php | 79 ++++++++- .../Resources/assets/css/events.scss | 5 + .../Resources/views/Location/edit.html.twig | 166 ++++++++++++++++++ 3 files changed, 245 insertions(+), 5 deletions(-) create mode 100644 src/Hackspace/Bundle/CalciferBundle/Resources/views/Location/edit.html.twig diff --git a/src/Hackspace/Bundle/CalciferBundle/Controller/LocationController.php b/src/Hackspace/Bundle/CalciferBundle/Controller/LocationController.php index 631892a..bdf0945 100755 --- a/src/Hackspace/Bundle/CalciferBundle/Controller/LocationController.php +++ b/src/Hackspace/Bundle/CalciferBundle/Controller/LocationController.php @@ -40,7 +40,7 @@ class LocationController extends Controller * @Method("GET") * @Template("CalciferBundle:Event:index.html.twig") */ - public function showAction($slug,$format) + public function showAction($slug, $format) { /** @var EntityManager $em */ $em = $this->getDoctrine()->getManager(); @@ -58,17 +58,17 @@ class LocationController extends Controller $em = $this->getDoctrine()->getManager(); $now = new \DateTime(); - $now->setTime(0,0,0); + $now->setTime(0, 0, 0); /** @var QueryBuilder $qb */ $qb = $em->createQueryBuilder(); - $qb ->select(array('e')) + $qb->select(array('e')) ->from('CalciferBundle:Event', 'e') ->where('e.startdate >= :startdate') ->andWhere('e.locations_id = :location') ->orderBy('e.startdate') - ->setParameter('startdate',$now) - ->setParameter('location',$location->id); + ->setParameter('startdate', $now) + ->setParameter('location', $location->id); $entities = $qb->getQuery()->execute(); if ($format == 'ics') { @@ -118,4 +118,73 @@ class LocationController extends Controller ); } } + + /** + * Finds and displays a Event entity. + * + * @Route("/{slug}/bearbeiten", name="location_edit") + * @Method("GET") + * @Template() + */ + public function editAction($slug) + { + /** @var EntityManager $em */ + $em = $this->getDoctrine()->getManager(); + + /** @var EntityRepository $repo */ + $repo = $em->getRepository('CalciferBundle:Location'); + + /** @var Location $location */ + $location = $repo->findOneBy(['slug' => $slug]); + + if (!$location) { + throw $this->createNotFoundException('Unable to find Location entity.'); + } + + return [ + 'entity' => $location + ]; + } + + /** + * Finds and displays a Event entity. + * + * @Route("/{slug}/bearbeiten", name="location_update") + * @Method("POST") + */ + public function updateAction(Request $request, $slug) { + /** @var EntityManager $em */ + $em = $this->getDoctrine()->getManager(); + + /** @var EntityRepository $repo */ + $repo = $em->getRepository('CalciferBundle:Location'); + + /** @var Location $location */ + $location = $repo->findOneBy(['slug' => $slug]); + + if (!$location) { + throw $this->createNotFoundException('Unable to find Location entity.'); + } + + if ($location->name != $request->get('name')) { + $location->name = $request->get('name'); + $location->slug = $location->generateSlug($location->name,$em); + } + $location->streetaddress = $request->get('streetaddress'); + $location->streetnumber = $request->get('streetnumber'); + $location->zipcode = $request->get('zipcode'); + $location->city = $request->get('city'); + + $latlon = $request->get('geocords'); + $latlon = explode(',',$latlon); + if (count($latlon) == 2) { + $location->lat = $latlon[0]; + $location->lon = $latlon[1]; + } + + $em->persist($location); + $em->flush(); + + return $this->redirect($this->generateUrl('location_show', array('slug' => $location->slug))); + } } diff --git a/src/Hackspace/Bundle/CalciferBundle/Resources/assets/css/events.scss b/src/Hackspace/Bundle/CalciferBundle/Resources/assets/css/events.scss index 6b615cb..30f8f07 100755 --- a/src/Hackspace/Bundle/CalciferBundle/Resources/assets/css/events.scss +++ b/src/Hackspace/Bundle/CalciferBundle/Resources/assets/css/events.scss @@ -44,4 +44,9 @@ form .ui.form { #map { height: 20rem; + +.location-edit { + text-decoration: none; +} + } \ No newline at end of file diff --git a/src/Hackspace/Bundle/CalciferBundle/Resources/views/Location/edit.html.twig b/src/Hackspace/Bundle/CalciferBundle/Resources/views/Location/edit.html.twig new file mode 100644 index 0000000..f511f12 --- /dev/null +++ b/src/Hackspace/Bundle/CalciferBundle/Resources/views/Location/edit.html.twig @@ -0,0 +1,166 @@ +{% extends 'CalciferBundle::layout.html.twig' %} + +{% block css %} + {% stylesheets filter="compass" + "@CalciferBundle/Resources/assets/css/jquery.datetimepicker.scss" + "@CalciferBundle/Resources/assets/css/events.scss" + "@CalciferBundle/Resources/assets/css/leaflet.scss" %} + + {% endstylesheets %} +{% endblock %} + +{% block javascripts %} + {% javascripts + "@CalciferBundle/Resources/assets/js/jquery.datetimepicker.js" + "@CalciferBundle/Resources/assets/js/events.js" + "@CalciferBundle/Resources/assets/js/leaflet.js" %} + + {% endjavascripts %} +{% endblock %} + +{% block body -%} +
+
+

Termin bearbeiten

+
+
+ +
+
+
+
+
+ + +
+ + +
+ +
+
+
+ +
+ + +
+ + +
Du kannst hier Markdown benutzen. +
+
+
+ +
+ + +
+ + +
+
+ +
+ + +
+ + +
+
+ +
+ + +
+ + +
+
+ +
+ + +
+ + +
+
+ +
+ + +
+ + +
+ Gebe entweder Breitengrad und Längengrad (Mit Punkten!) kommasepariert ein oder wähle einen Punkt auf der Karte aus. +
+ +
+
+ + + + +
+ +
+
+
+ +{% endblock %} From 93da869e00b4833d1b6f82b3495412fb2cee20a3 Mon Sep 17 00:00:00 2001 From: Tim Schumacher Date: Wed, 24 Sep 2014 23:27:43 +0200 Subject: [PATCH 04/14] Extend the location detail page with the new informations. --- .../Resources/assets/css/events.scss | 13 +++- .../Resources/assets/js/events.js | 64 +++++++++++++++++-- .../Resources/views/Event/index.html.twig | 40 +++++++++++- 3 files changed, 109 insertions(+), 8 deletions(-) diff --git a/src/Hackspace/Bundle/CalciferBundle/Resources/assets/css/events.scss b/src/Hackspace/Bundle/CalciferBundle/Resources/assets/css/events.scss index 30f8f07..7e0730a 100755 --- a/src/Hackspace/Bundle/CalciferBundle/Resources/assets/css/events.scss +++ b/src/Hackspace/Bundle/CalciferBundle/Resources/assets/css/events.scss @@ -42,11 +42,22 @@ form .ui.form { } } -#map { +#view-map, #map { height: 20rem; +} .location-edit { text-decoration: none; } +#location-description { + p { + margin-top: 0.5rem; + margin-bottom: 0.5rem; + } + + .ui.section.divider { + margin-top: 0; + margin-bottom: 0; + } } \ No newline at end of file diff --git a/src/Hackspace/Bundle/CalciferBundle/Resources/assets/js/events.js b/src/Hackspace/Bundle/CalciferBundle/Resources/assets/js/events.js index b7a1dcc..c4dddbd 100755 --- a/src/Hackspace/Bundle/CalciferBundle/Resources/assets/js/events.js +++ b/src/Hackspace/Bundle/CalciferBundle/Resources/assets/js/events.js @@ -46,18 +46,30 @@ jQuery(document).ready(function () { closable: false, onApprove: function () { var coords = marker.getLatLng(); - jQuery('input[name=location_lat]').val(coords.lat); - jQuery('input[name=location_lon]').val(coords.lng); - jQuery('input[name=location]').css('margin-bottom', '3.2rem'); - jQuery('span.coords').text('Folgende Koordinaten sind angegeben: lat:' + coords.lat + ', lon:' + coords.lng); + if (!(jQuery('input[name=location_lat]').val() == undefined)) { + jQuery('input[name=location_lat]').val(coords.lat); + jQuery('input[name=location_lon]').val(coords.lng); + jQuery('input[name=location]').css('margin-bottom', '3.2rem'); + jQuery('span.coords').text('Folgende Koordinaten sind angegeben: lat:' + coords.lat + ', lon:' + coords.lng); + } else { + jQuery('input[name=geocords]').val(coords.lat + ',' + coords.lng); + } }, onDeny: function () { }, onVisible: function () { map.invalidateSize(true); - var lat = parseFloat(jQuery('input[name=location_lat]').val()); - var lon = parseFloat(jQuery('input[name=location_lon]').val()); + var lat = 0; + var lon = 0; + if (!(jQuery('input[name=location_lat]').val() == undefined)) { + lat = parseFloat(jQuery('input[name=location_lat]').val()); + lon = parseFloat(jQuery('input[name=location_lon]').val()); + } else { + var latlon = jQuery('input[name=geocords]').val(); + lat = latlon.split(',')[0]; + lon = latlon.split(',')[1]; + } if ((lat > 0) && (lon > 0)) { map.setView([lat, lon], 16); var latlng = new L.LatLng(lat, lon); @@ -70,3 +82,43 @@ jQuery(document).ready(function () { }).modal('attach events', '.add_geo', 'show'); } }); + +$(document).ready(function() { + + if (jQuery('#view-map').length == 1) { + jQuery('.show_map').click(addGeoCoordinates); + map = L.map('view-map'); + + // add an OpenStreetMap tile layer + L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', { + attribution: '© OpenStreetMap contributors' + }).addTo(map); + + map.setView([51.505, -0.09], 0); + + L.Icon.Default.imagePath = '/css/images'; + var popup = L.popup(); + + var marker = L.marker(); + + jQuery('.geo.viewer').modal('setting', { + closable: true, + onDeny: function () { + + }, + onVisible: function () { + map.invalidateSize(true); + var lat = $('#view-map').data('lat'); + var lon = $('#view-map').data('lon'); + if ((lat > 0) && (lon > 0)) { + map.setView([lat, lon], 16); + var latlng = new L.LatLng(lat, lon); + marker.setLatLng(latlng); + marker.addTo(map); + } else { + map.locate({setView: true}); + } + } + }).modal('attach events', '.show_map', 'show'); + } +}); \ No newline at end of file diff --git a/src/Hackspace/Bundle/CalciferBundle/Resources/views/Event/index.html.twig b/src/Hackspace/Bundle/CalciferBundle/Resources/views/Event/index.html.twig index e820215..60a4816 100755 --- a/src/Hackspace/Bundle/CalciferBundle/Resources/views/Event/index.html.twig +++ b/src/Hackspace/Bundle/CalciferBundle/Resources/views/Event/index.html.twig @@ -3,6 +3,7 @@ {% block css %} {% stylesheets filter="compass" "@CalciferBundle/Resources/assets/css/events.scss" + "@CalciferBundle/Resources/assets/css/leaflet.scss" %} {% endstylesheets %} @@ -11,6 +12,7 @@ {% block javascripts %} {% javascripts "@CalciferBundle/Resources/assets/js/events.js" + "@CalciferBundle/Resources/assets/js/leaflet.js" %} {% endjavascripts %} @@ -22,8 +24,44 @@

Termine {% if tag|default(false) %} für Tag „{{ tag.name }}“{% endif %} - {% if location|default(false) %} für Ort „{{ location.name }}“{% endif %} + {% if location|default(false) %} für Ort „{{ location.name }}“ {% endif %}

+ {% if location|default(false) %} + {% if (location.description|length > 0) or location.hasAddress() %} +
+ {% if (location.description|length > 0) %} +

{{ location.description|markdown }}

+ {% endif %} + {% if (location.hasAddress()) %} +
+

+ Anschrift:
+ {{ location.streetaddress }}{% if(location.streetnumber|length > 0) %} {{ location.streetnumber }}{% endif %}
+ {% if(location.zipcode|length > 0) %}{{ location.zipcode }} {% endif %}{{ location.city }} +

+ {% endif %} + {% if ((location.lon > 0) and (location.lat > 0)) %} +

Auf einer OpenStreetMap-Karte anzeigen

+ + {% endif %} +
+ {% endif %} + {% endif %} From 78b20716cd1815cd7c098a6f177794321f08f12a Mon Sep 17 00:00:00 2001 From: Tim Schumacher Date: Wed, 24 Sep 2014 23:28:38 +0200 Subject: [PATCH 05/14] Update the dependencies --- app/SymfonyRequirements.php | 58 ++++++++++++++-------------- composer.lock | 75 +++++++++++++++++-------------------- 2 files changed, 63 insertions(+), 70 deletions(-) diff --git a/app/SymfonyRequirements.php b/app/SymfonyRequirements.php index 25bc938..56bd35d 100644 --- a/app/SymfonyRequirements.php +++ b/app/SymfonyRequirements.php @@ -41,25 +41,25 @@ class Requirement /** * Constructor that initializes the requirement. * - * @param Boolean $fulfilled Whether the requirement is fulfilled + * @param bool $fulfilled Whether the requirement is fulfilled * @param string $testMessage The message for testing the requirement * @param string $helpHtml The help text formatted in HTML for resolving the problem * @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags) - * @param Boolean $optional Whether this is only an optional recommendation not a mandatory requirement + * @param bool $optional Whether this is only an optional recommendation not a mandatory requirement */ public function __construct($fulfilled, $testMessage, $helpHtml, $helpText = null, $optional = false) { - $this->fulfilled = (Boolean) $fulfilled; + $this->fulfilled = (bool) $fulfilled; $this->testMessage = (string) $testMessage; $this->helpHtml = (string) $helpHtml; $this->helpText = null === $helpText ? strip_tags($this->helpHtml) : (string) $helpText; - $this->optional = (Boolean) $optional; + $this->optional = (bool) $optional; } /** * Returns whether the requirement is fulfilled. * - * @return Boolean true if fulfilled, otherwise false + * @return bool true if fulfilled, otherwise false */ public function isFulfilled() { @@ -99,7 +99,7 @@ class Requirement /** * Returns whether this is only an optional recommendation and not a mandatory requirement. * - * @return Boolean true if optional, false if mandatory + * @return bool true if optional, false if mandatory */ public function isOptional() { @@ -117,16 +117,16 @@ class PhpIniRequirement extends Requirement /** * Constructor that initializes the requirement. * - * @param string $cfgName The configuration name used for ini_get() - * @param Boolean|callback $evaluation Either a Boolean indicating whether the configuration should evaluate to true or false, + * @param string $cfgName The configuration name used for ini_get() + * @param bool|callback $evaluation Either a boolean indicating whether the configuration should evaluate to true or false, or a callback function receiving the configuration value as parameter to determine the fulfillment of the requirement - * @param Boolean $approveCfgAbsence If true the Requirement will be fulfilled even if the configuration option does not exist, i.e. ini_get() returns false. + * @param bool $approveCfgAbsence If true the Requirement will be fulfilled even if the configuration option does not exist, i.e. ini_get() returns false. This is helpful for abandoned configs in later PHP versions or configs of an optional extension, like Suhosin. Example: You require a config to be true but PHP later removes this config and defaults it to true internally. - * @param string|null $testMessage The message for testing the requirement (when null and $evaluation is a Boolean a default message is derived) - * @param string|null $helpHtml The help text formatted in HTML for resolving the problem (when null and $evaluation is a Boolean a default help is derived) - * @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags) - * @param Boolean $optional Whether this is only an optional recommendation not a mandatory requirement + * @param string|null $testMessage The message for testing the requirement (when null and $evaluation is a boolean a default message is derived) + * @param string|null $helpHtml The help text formatted in HTML for resolving the problem (when null and $evaluation is a boolean a default help is derived) + * @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags) + * @param bool $optional Whether this is only an optional recommendation not a mandatory requirement */ public function __construct($cfgName, $evaluation, $approveCfgAbsence = false, $testMessage = null, $helpHtml = null, $helpText = null, $optional = false) { @@ -193,7 +193,7 @@ class RequirementCollection implements IteratorAggregate /** * Adds a mandatory requirement. * - * @param Boolean $fulfilled Whether the requirement is fulfilled + * @param bool $fulfilled Whether the requirement is fulfilled * @param string $testMessage The message for testing the requirement * @param string $helpHtml The help text formatted in HTML for resolving the problem * @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags) @@ -206,7 +206,7 @@ class RequirementCollection implements IteratorAggregate /** * Adds an optional recommendation. * - * @param Boolean $fulfilled Whether the recommendation is fulfilled + * @param bool $fulfilled Whether the recommendation is fulfilled * @param string $testMessage The message for testing the recommendation * @param string $helpHtml The help text formatted in HTML for resolving the problem * @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags) @@ -219,15 +219,15 @@ class RequirementCollection implements IteratorAggregate /** * Adds a mandatory requirement in form of a php.ini configuration. * - * @param string $cfgName The configuration name used for ini_get() - * @param Boolean|callback $evaluation Either a Boolean indicating whether the configuration should evaluate to true or false, + * @param string $cfgName The configuration name used for ini_get() + * @param bool|callback $evaluation Either a boolean indicating whether the configuration should evaluate to true or false, or a callback function receiving the configuration value as parameter to determine the fulfillment of the requirement - * @param Boolean $approveCfgAbsence If true the Requirement will be fulfilled even if the configuration option does not exist, i.e. ini_get() returns false. + * @param bool $approveCfgAbsence If true the Requirement will be fulfilled even if the configuration option does not exist, i.e. ini_get() returns false. This is helpful for abandoned configs in later PHP versions or configs of an optional extension, like Suhosin. Example: You require a config to be true but PHP later removes this config and defaults it to true internally. - * @param string $testMessage The message for testing the requirement (when null and $evaluation is a Boolean a default message is derived) - * @param string $helpHtml The help text formatted in HTML for resolving the problem (when null and $evaluation is a Boolean a default help is derived) - * @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags) + * @param string $testMessage The message for testing the requirement (when null and $evaluation is a boolean a default message is derived) + * @param string $helpHtml The help text formatted in HTML for resolving the problem (when null and $evaluation is a boolean a default help is derived) + * @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags) */ public function addPhpIniRequirement($cfgName, $evaluation, $approveCfgAbsence = false, $testMessage = null, $helpHtml = null, $helpText = null) { @@ -237,15 +237,15 @@ class RequirementCollection implements IteratorAggregate /** * Adds an optional recommendation in form of a php.ini configuration. * - * @param string $cfgName The configuration name used for ini_get() - * @param Boolean|callback $evaluation Either a Boolean indicating whether the configuration should evaluate to true or false, + * @param string $cfgName The configuration name used for ini_get() + * @param bool|callback $evaluation Either a boolean indicating whether the configuration should evaluate to true or false, or a callback function receiving the configuration value as parameter to determine the fulfillment of the requirement - * @param Boolean $approveCfgAbsence If true the Requirement will be fulfilled even if the configuration option does not exist, i.e. ini_get() returns false. + * @param bool $approveCfgAbsence If true the Requirement will be fulfilled even if the configuration option does not exist, i.e. ini_get() returns false. This is helpful for abandoned configs in later PHP versions or configs of an optional extension, like Suhosin. Example: You require a config to be true but PHP later removes this config and defaults it to true internally. - * @param string $testMessage The message for testing the requirement (when null and $evaluation is a Boolean a default message is derived) - * @param string $helpHtml The help text formatted in HTML for resolving the problem (when null and $evaluation is a Boolean a default help is derived) - * @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags) + * @param string $testMessage The message for testing the requirement (when null and $evaluation is a boolean a default message is derived) + * @param string $helpHtml The help text formatted in HTML for resolving the problem (when null and $evaluation is a boolean a default help is derived) + * @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags) */ public function addPhpIniRecommendation($cfgName, $evaluation, $approveCfgAbsence = false, $testMessage = null, $helpHtml = null, $helpText = null) { @@ -343,7 +343,7 @@ class RequirementCollection implements IteratorAggregate /** * Returns whether a php.ini configuration is not correct. * - * @return Boolean php.ini configuration problem? + * @return bool php.ini configuration problem? */ public function hasPhpIniConfigIssue() { @@ -405,7 +405,7 @@ class SymfonyRequirements extends RequirementCollection $this->addRequirement( is_dir(__DIR__.'/../vendor/composer'), 'Vendor libraries must be installed', - 'Vendor libraries are missing. Install composer following instructions from http://getcomposer.org/. ' . + 'Vendor libraries are missing. Install composer following instructions from http://getcomposer.org/. '. 'Then run "php composer.phar install" to install them.' ); diff --git a/composer.lock b/composer.lock index 0638791..f6c857b 100755 --- a/composer.lock +++ b/composer.lock @@ -66,7 +66,7 @@ { "name": "Johannes Schmitt", "email": "schmittjoh@gmail.com", - "homepage": "http://jmsyst.com", + "homepage": "https://github.com/schmittjoh", "role": "Developer of wrapped JMSSerializerBundle" } ], @@ -203,7 +203,7 @@ { "name": "Johannes Schmitt", "email": "schmittjoh@gmail.com", - "homepage": "http://jmsyst.com", + "homepage": "https://github.com/schmittjoh", "role": "Developer of wrapped JMSSerializerBundle" } ], @@ -279,7 +279,7 @@ { "name": "Johannes Schmitt", "email": "schmittjoh@gmail.com", - "homepage": "http://jmsyst.com", + "homepage": "https://github.com/schmittjoh", "role": "Developer of wrapped JMSSerializerBundle" } ], @@ -541,7 +541,7 @@ { "name": "Johannes Schmitt", "email": "schmittjoh@gmail.com", - "homepage": "http://jmsyst.com", + "homepage": "https://github.com/schmittjoh", "role": "Developer of wrapped JMSSerializerBundle" } ], @@ -595,7 +595,7 @@ { "name": "Johannes Schmitt", "email": "schmittjoh@gmail.com", - "homepage": "http://jmsyst.com", + "homepage": "https://github.com/schmittjoh", "role": "Developer of wrapped JMSSerializerBundle" } ], @@ -667,16 +667,16 @@ }, { "name": "doctrine/orm", - "version": "v2.4.4", + "version": "v2.4.5", "source": { "type": "git", "url": "https://github.com/doctrine/doctrine2.git", - "reference": "fc19c3b53dcd00e6584db40669fdd699c4671f97" + "reference": "c0d3cdbdfbf873871167050ab077e49b1ad02ab0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/doctrine2/zipball/fc19c3b53dcd00e6584db40669fdd699c4671f97", - "reference": "fc19c3b53dcd00e6584db40669fdd699c4671f97", + "url": "https://api.github.com/repos/doctrine/doctrine2/zipball/c0d3cdbdfbf873871167050ab077e49b1ad02ab0", + "reference": "c0d3cdbdfbf873871167050ab077e49b1ad02ab0", "shasum": "" }, "require": { @@ -713,17 +713,6 @@ "MIT" ], "authors": [ - { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com", - "homepage": "http://www.jwage.com/", - "role": "Creator" - }, - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com", - "homepage": "http://www.instaclick.com" - }, { "name": "Roman Borschel", "email": "roman@code-factory.org" @@ -731,6 +720,14 @@ { "name": "Benjamin Eberlei", "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" } ], "description": "Object-Relational-Mapper for PHP", @@ -739,7 +736,7 @@ "database", "orm" ], - "time": "2014-07-11 03:05:53" + "time": "2014-09-22 21:58:51" }, { "name": "enko/ics", @@ -1286,17 +1283,17 @@ }, { "name": "sensio/distribution-bundle", - "version": "v3.0.5", + "version": "v3.0.6", "target-dir": "Sensio/Bundle/DistributionBundle", "source": { "type": "git", "url": "https://github.com/sensiolabs/SensioDistributionBundle.git", - "reference": "ad10123f2532f6e311e583cce203ef368eedc469" + "reference": "e20461e4f8e1afd68f36cf90bdccc06f7aa6a6c2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sensiolabs/SensioDistributionBundle/zipball/ad10123f2532f6e311e583cce203ef368eedc469", - "reference": "ad10123f2532f6e311e583cce203ef368eedc469", + "url": "https://api.github.com/repos/sensiolabs/SensioDistributionBundle/zipball/e20461e4f8e1afd68f36cf90bdccc06f7aa6a6c2", + "reference": "e20461e4f8e1afd68f36cf90bdccc06f7aa6a6c2", "shasum": "" }, "require": { @@ -1335,7 +1332,7 @@ "configuration", "distribution" ], - "time": "2014-08-26 13:14:47" + "time": "2014-09-24 14:47:46" }, { "name": "sensio/framework-extra-bundle", @@ -1554,22 +1551,20 @@ }, { "name": "symfony/icu", - "version": "v1.2.2", + "version": "v1.0.1", "target-dir": "Symfony/Component/Icu", "source": { "type": "git", "url": "https://github.com/symfony/Icu.git", - "reference": "d4d85d6055b87f394d941b45ddd3a9173e1e3d2a" + "reference": "fdba214b1e087c149843bde976263c53ac10c975" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Icu/zipball/d4d85d6055b87f394d941b45ddd3a9173e1e3d2a", - "reference": "d4d85d6055b87f394d941b45ddd3a9173e1e3d2a", + "url": "https://api.github.com/repos/symfony/Icu/zipball/fdba214b1e087c149843bde976263c53ac10c975", + "reference": "fdba214b1e087c149843bde976263c53ac10c975", "shasum": "" }, "require": { - "ext-intl": "*", - "lib-icu": ">=4.4", "php": ">=5.3.3", "symfony/intl": "~2.3" }, @@ -1599,7 +1594,7 @@ "icu", "intl" ], - "time": "2014-07-25 09:58:17" + "time": "2013-10-04 09:12:07" }, { "name": "symfony/monolog-bundle", @@ -1940,17 +1935,17 @@ "packages-dev": [ { "name": "sensio/generator-bundle", - "version": "v2.3.5", + "version": "v2.4.0", "target-dir": "Sensio/Bundle/GeneratorBundle", "source": { "type": "git", "url": "https://github.com/sensiolabs/SensioGeneratorBundle.git", - "reference": "8b7a33aa3d22388443b6de0b0cf184122e9f60d2" + "reference": "d5c0b996a46276d50943a80f95a46b59215a0e68" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sensiolabs/SensioGeneratorBundle/zipball/8b7a33aa3d22388443b6de0b0cf184122e9f60d2", - "reference": "8b7a33aa3d22388443b6de0b0cf184122e9f60d2", + "url": "https://api.github.com/repos/sensiolabs/SensioGeneratorBundle/zipball/d5c0b996a46276d50943a80f95a46b59215a0e68", + "reference": "d5c0b996a46276d50943a80f95a46b59215a0e68", "shasum": "" }, "require": { @@ -1980,13 +1975,11 @@ "authors": [ { "name": "Fabien Potencier", - "email": "fabien@symfony.com", - "homepage": "http://fabien.potencier.org", - "role": "Lead Developer" + "email": "fabien@symfony.com" } ], "description": "This bundle generates code for you", - "time": "2014-04-28 14:01:06" + "time": "2014-09-22 14:56:14" } ], "aliases": [], From 30474e80ce036b8514f44d6427e0f1d791a5f8cd Mon Sep 17 00:00:00 2001 From: Tim Schumacher Date: Wed, 24 Sep 2014 23:38:36 +0200 Subject: [PATCH 06/14] Missed the description --- .../Bundle/CalciferBundle/Controller/LocationController.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Hackspace/Bundle/CalciferBundle/Controller/LocationController.php b/src/Hackspace/Bundle/CalciferBundle/Controller/LocationController.php index bdf0945..fc07a8c 100755 --- a/src/Hackspace/Bundle/CalciferBundle/Controller/LocationController.php +++ b/src/Hackspace/Bundle/CalciferBundle/Controller/LocationController.php @@ -174,6 +174,7 @@ class LocationController extends Controller $location->streetnumber = $request->get('streetnumber'); $location->zipcode = $request->get('zipcode'); $location->city = $request->get('city'); + $location->description = $request->get('description'); $latlon = $request->get('geocords'); $latlon = explode(',',$latlon); From 80182644bc13bd1af8064f3f12c370c1193946eb Mon Sep 17 00:00:00 2001 From: Tim Schumacher Date: Thu, 25 Sep 2014 23:18:07 +0200 Subject: [PATCH 07/14] Only use the edit.html.twig template. --- .../Controller/EventController.php | 6 ++-- .../Resources/views/Event/new.html.twig | 34 ------------------- 2 files changed, 3 insertions(+), 37 deletions(-) delete mode 100755 src/Hackspace/Bundle/CalciferBundle/Resources/views/Event/new.html.twig diff --git a/src/Hackspace/Bundle/CalciferBundle/Controller/EventController.php b/src/Hackspace/Bundle/CalciferBundle/Controller/EventController.php index 9792d4c..b999599 100755 --- a/src/Hackspace/Bundle/CalciferBundle/Controller/EventController.php +++ b/src/Hackspace/Bundle/CalciferBundle/Controller/EventController.php @@ -54,7 +54,7 @@ class EventController extends Controller * * @Route("/termine/", name="_create") * @Method("POST") - * @Template("CalciferBundle:Event:new.html.twig") + * @Template("CalciferBundle:Event:edit.html.twig") */ public function createAction(Request $request) { @@ -81,7 +81,7 @@ class EventController extends Controller * * @Route("/termine/neu", name="_new") * @Method("GET") - * @Template() + * @Template("CalciferBundle:Event:edit.html.twig") */ public function newAction() { @@ -314,7 +314,7 @@ class EventController extends Controller * * @Route("/termine/{slug}/kopieren", name="_copy") * @Method("GET") - * @Template("CalciferBundle:Event:new.html.twig") + * @Template("CalciferBundle:Event:edit.html.twig") */ public function copyAction(Request $request, $slug) { /** @var EntityManager $em */ diff --git a/src/Hackspace/Bundle/CalciferBundle/Resources/views/Event/new.html.twig b/src/Hackspace/Bundle/CalciferBundle/Resources/views/Event/new.html.twig deleted file mode 100755 index a004f41..0000000 --- a/src/Hackspace/Bundle/CalciferBundle/Resources/views/Event/new.html.twig +++ /dev/null @@ -1,34 +0,0 @@ -{% extends 'CalciferBundle::layout.html.twig' %} - -{% block css %} - {% stylesheets filter="compass" - "@CalciferBundle/Resources/assets/css/jquery.datetimepicker.scss" - "@CalciferBundle/Resources/assets/css/events.scss" - "@CalciferBundle/Resources/assets/css/leaflet.scss" %} - - {% endstylesheets %} -{% endblock %} - -{% block javascripts %} - {% javascripts - "@CalciferBundle/Resources/assets/js/jquery.datetimepicker.js" - "@CalciferBundle/Resources/assets/js/events.js" - "@CalciferBundle/Resources/assets/js/leaflet.js" %} - - {% endjavascripts %} -{% endblock %} - -{% block body -%} -
-
-

Termin bearbeiten

-
-
- -
-
- {{ include('CalciferBundle:Event:event_form.html.twig',{'entity':entity}) }} -
-
- -{% endblock %} From 0a0fd1e8b034687e6e140490a9efc743b671f83a Mon Sep 17 00:00:00 2001 From: Tim Schumacher Date: Thu, 25 Sep 2014 23:18:45 +0200 Subject: [PATCH 08/14] Add some basic validation. --- .../Controller/EventController.php | 17 +++++++++++------ .../Bundle/CalciferBundle/Entity/BaseEntity.php | 6 +++++- .../Bundle/CalciferBundle/Entity/Event.php | 14 +++++++++++++- .../Resources/views/Event/event_form.html.twig | 17 ++++++++++++++--- 4 files changed, 43 insertions(+), 11 deletions(-) diff --git a/src/Hackspace/Bundle/CalciferBundle/Controller/EventController.php b/src/Hackspace/Bundle/CalciferBundle/Controller/EventController.php index b999599..78bfb9e 100755 --- a/src/Hackspace/Bundle/CalciferBundle/Controller/EventController.php +++ b/src/Hackspace/Bundle/CalciferBundle/Controller/EventController.php @@ -63,7 +63,8 @@ class EventController extends Controller $em = $this->saveEvent($request, $entity); - if ($entity->isValid()) { + $errors = $entity->isValid(); + if ($errors === true) { $em = $this->getDoctrine()->getManager(); $em->persist($entity); $em->flush(); @@ -73,6 +74,7 @@ class EventController extends Controller return array( 'entity' => $entity, + 'errors' => $errors, ); } @@ -171,7 +173,8 @@ class EventController extends Controller $em = $this->saveEvent($request, $entity); - if ($entity->isValid()) { + $errors = $entity->isValid(); + if ($errors === true) { $em = $this->getDoctrine()->getManager(); $em->persist($entity); $em->flush(); @@ -180,7 +183,8 @@ class EventController extends Controller } return array( - 'entity' => $entity, + 'entity' => $entity, + 'errors' => $errors, ); } @@ -199,8 +203,10 @@ class EventController extends Controller $entity->summary = $request->get('summary'); $entity->url = $request->get('url'); $startdate = $request->get('startdate'); - $startdate = new \DateTime($startdate); - $entity->startdate = $startdate; + if (strlen($startdate) > 0) { + $startdate = new \DateTime($startdate); + $entity->startdate = $startdate; + } $entity->slug = $entity->generateSlug($entity->summary,$em); $enddate = $request->get('enddate'); @@ -267,7 +273,6 @@ class EventController extends Controller $entity->addTag($tag_obj); } } - return $em; } return $em; } diff --git a/src/Hackspace/Bundle/CalciferBundle/Entity/BaseEntity.php b/src/Hackspace/Bundle/CalciferBundle/Entity/BaseEntity.php index a33a608..ba972ee 100755 --- a/src/Hackspace/Bundle/CalciferBundle/Entity/BaseEntity.php +++ b/src/Hackspace/Bundle/CalciferBundle/Entity/BaseEntity.php @@ -56,7 +56,11 @@ abstract class BaseEntity { public function __set($name,$value) { if (property_exists($this,$name)) { - $this->$name = $value; + if ($value == '') { + $this->$name = null; + } else { + $this->$name = $value; + } return $this; } else { throw new \Exception("Property {$name} does not Exists"); diff --git a/src/Hackspace/Bundle/CalciferBundle/Entity/Event.php b/src/Hackspace/Bundle/CalciferBundle/Entity/Event.php index 8a3a791..68104d4 100755 --- a/src/Hackspace/Bundle/CalciferBundle/Entity/Event.php +++ b/src/Hackspace/Bundle/CalciferBundle/Entity/Event.php @@ -3,6 +3,7 @@ namespace Hackspace\Bundle\CalciferBundle\Entity; use Doctrine\ORM\Mapping as ORM; +use Symfony\Component\Validator\Constraints\DateTime; /** * Event @@ -102,7 +103,18 @@ class Event extends BaseEntity } public function isValid() { - return true; + $errors = []; + if (!($this->startdate instanceof \DateTime)) { + $errors['startdate'] = 'Bitte gebe ein Startdatum ein.'; + } + if ((!is_null($this->startdate)) && (!is_null($this->enddate)) && ($this->enddate < $this->startdate)) { + $errors['enddate'] = 'Bitte setze ein Enddatum das nach dem Startdatum ist.'; + } + if (strlen($this->summary) == 0) { + $errors['summary'] = 'Bitte gebe eine Zusammenfassung an.'; + } + + return (count($errors) > 0) ? $errors : true; } public function getFormatedDate() { diff --git a/src/Hackspace/Bundle/CalciferBundle/Resources/views/Event/event_form.html.twig b/src/Hackspace/Bundle/CalciferBundle/Resources/views/Event/event_form.html.twig index d2f1e82..39ac995 100755 --- a/src/Hackspace/Bundle/CalciferBundle/Resources/views/Event/event_form.html.twig +++ b/src/Hackspace/Bundle/CalciferBundle/Resources/views/Event/event_form.html.twig @@ -1,6 +1,6 @@
-
+
@@ -11,6 +11,9 @@ value="{{ entity.startdate.format('Y-m-d H:i')|default('') }}" placeholder="{{ "now"|date('Y-m-d H:i') }}" class="form-control"> + {% if(errors|default('0') != 0) %} {% if('startdate' in errors|keys) %} +
{{ errors.startdate }}
+ {% endif %}{% endif %} @@ -19,7 +22,7 @@
-
+
@@ -30,10 +33,14 @@ placeholder="{{ "now"|date('Y-m-d H:i') }}" class="form-control"> + {% if(errors|default('0') != 0) %} {% if('enddate' in errors|keys) %} +
{{ errors.enddate }}
+ {% endif %}{% endif %} +
-
+
@@ -45,6 +52,10 @@ maxlength="255" class="form-control"> + {% if(errors|default('0') != 0) %} {% if('summary' in errors|keys) %} +
{{ errors.summary }}
+ {% endif %}{% endif %} +
From fc44a6cb40411e71c0d2302d6fd8baa1d5f4ec3b Mon Sep 17 00:00:00 2001 From: Tim Schumacher Date: Thu, 25 Sep 2014 23:21:36 +0200 Subject: [PATCH 09/14] Set the enddate for the right entity. Fixes #7 --- .../Bundle/CalciferBundle/Command/GenerateEventsCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Hackspace/Bundle/CalciferBundle/Command/GenerateEventsCommand.php b/src/Hackspace/Bundle/CalciferBundle/Command/GenerateEventsCommand.php index d16fda5..c74573a 100755 --- a/src/Hackspace/Bundle/CalciferBundle/Command/GenerateEventsCommand.php +++ b/src/Hackspace/Bundle/CalciferBundle/Command/GenerateEventsCommand.php @@ -60,7 +60,7 @@ class GenerateEventsCommand extends ContainerAwareCommand /** @var \DateTime $enddate */ $enddate = clone $next_date; $enddate->add($duration); - $entity->enddate = $enddate; + $event->enddate = $enddate; } $event->summary = $entity->summary; $event->description = $entity->description; From fb735cfda8431f91edfa2984d27e0a26f8b469f2 Mon Sep 17 00:00:00 2001 From: andibraeu Date: Sat, 27 Sep 2014 17:49:16 +0200 Subject: [PATCH 10/14] missing endif --- .../Bundle/CalciferBundle/Resources/views/Event/index.html.twig | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Hackspace/Bundle/CalciferBundle/Resources/views/Event/index.html.twig b/src/Hackspace/Bundle/CalciferBundle/Resources/views/Event/index.html.twig index b567157..b159874 100755 --- a/src/Hackspace/Bundle/CalciferBundle/Resources/views/Event/index.html.twig +++ b/src/Hackspace/Bundle/CalciferBundle/Resources/views/Event/index.html.twig @@ -28,6 +28,7 @@ {% if tag|default(false) %} Link zur Kalenderdatei + {% endif %} {% if location|default(false) %} {% if (location.description|length > 0) or location.hasAddress() %}
From c522653d6ff5e9d02e32197f8ad7b17b6cc604eb Mon Sep 17 00:00:00 2001 From: andibraeu Date: Sat, 27 Sep 2014 18:07:51 +0200 Subject: [PATCH 11/14] set uid on ics file, some calenders need it to distinguish events --- .../Bundle/CalciferBundle/Controller/TagController.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Hackspace/Bundle/CalciferBundle/Controller/TagController.php b/src/Hackspace/Bundle/CalciferBundle/Controller/TagController.php index 69ea0bb..1d0c43b 100755 --- a/src/Hackspace/Bundle/CalciferBundle/Controller/TagController.php +++ b/src/Hackspace/Bundle/CalciferBundle/Controller/TagController.php @@ -71,7 +71,7 @@ class TagController extends Controller if ($format == 'ics') { $calendar = new Calendar(); $calendar->setProdId('-//My Company//Cool Calendar App//EN'); - $calendar->setTimeZone(new \DateTimeZone('Europe/Berlin')); + $calendar->setTimeZone(new \DateTimeZone('Europe/Berlin')); foreach ($entities as $entity) { /** @var Event $entity */ @@ -82,6 +82,7 @@ class TagController extends Controller $event->setSummary($entity->summary); $event->setDescription($entity->description); $event->setUrl($entity->url); + $event->setUid($entity->slug); if ($entity->location instanceof Location) { $location = new \Jsvrcek\ICS\Model\Description\Location(); $location->setName($entity->location->name); From 34949950a57bd99674925384affaae835990b654 Mon Sep 17 00:00:00 2001 From: Tim Schumacher Date: Mon, 29 Sep 2014 09:03:42 +0200 Subject: [PATCH 12/14] Rename the title of the location edit page. Fixes #22 --- .../CalciferBundle/Resources/views/Location/edit.html.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Hackspace/Bundle/CalciferBundle/Resources/views/Location/edit.html.twig b/src/Hackspace/Bundle/CalciferBundle/Resources/views/Location/edit.html.twig index f511f12..6eb61de 100644 --- a/src/Hackspace/Bundle/CalciferBundle/Resources/views/Location/edit.html.twig +++ b/src/Hackspace/Bundle/CalciferBundle/Resources/views/Location/edit.html.twig @@ -21,7 +21,7 @@ {% block body -%}
-

Termin bearbeiten

+

Ort bearbeiten

From 9330814449281c51c5c20de01ff5408cc674a1fe Mon Sep 17 00:00:00 2001 From: Tim Schumacher Date: Mon, 29 Sep 2014 09:06:47 +0200 Subject: [PATCH 13/14] Add a description to the location edit icon. Fixes #21 --- .../Bundle/CalciferBundle/Resources/views/Event/index.html.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Hackspace/Bundle/CalciferBundle/Resources/views/Event/index.html.twig b/src/Hackspace/Bundle/CalciferBundle/Resources/views/Event/index.html.twig index b159874..bc86b24 100755 --- a/src/Hackspace/Bundle/CalciferBundle/Resources/views/Event/index.html.twig +++ b/src/Hackspace/Bundle/CalciferBundle/Resources/views/Event/index.html.twig @@ -24,7 +24,7 @@

Termine {% if tag|default(false) %} für Tag „{{ tag.name }}“{% endif %} - {% if location|default(false) %} für Ort „{{ location.name }}“ {% endif %} + {% if location|default(false) %} für Ort „{{ location.name }}“ {% endif %}

{% if tag|default(false) %} Link zur Kalenderdatei From 69289df96e19f1701297b76e91496b5b7610c2d0 Mon Sep 17 00:00:00 2001 From: Tim Schumacher Date: Mon, 29 Sep 2014 13:59:26 +0200 Subject: [PATCH 14/14] Use the right object *grml* Fixes #27 --- .../Bundle/CalciferBundle/Controller/EventController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Hackspace/Bundle/CalciferBundle/Controller/EventController.php b/src/Hackspace/Bundle/CalciferBundle/Controller/EventController.php index 78bfb9e..876fecd 100755 --- a/src/Hackspace/Bundle/CalciferBundle/Controller/EventController.php +++ b/src/Hackspace/Bundle/CalciferBundle/Controller/EventController.php @@ -246,7 +246,7 @@ class EventController extends Controller if (strlen($location_lon) > 0) { $location_obj->lon = $location_lon; } - $location_obj->slug = $location_obj->generateSlug($location->name,$em); + $location_obj->slug = $location_obj->generateSlug($location_obj->name,$em); $em->persist($location_obj); $em->flush(); $entity->setLocation($location_obj);