'.$string.'>');
+ $this->filesystem->appendToFile($this->rootlog.'cron.log', $string."\n");
+ }
+ private function writeln($string) {
+ $this->output->writeln($string);
+ $this->filesystem->appendToFile($this->rootlog.'cron.log', $string."\n");
+ }
+}
diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/CalendarController.php b/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/CalendarController.php
index 7675ac3f..eec48530 100644
--- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/CalendarController.php
+++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/CalendarController.php
@@ -5,6 +5,7 @@ namespace Cadoles\PortalBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
+use Symfony\Component\Form\FormError;
use Doctrine\Common\Collections\ArrayCollection;
use Ramsey\Uuid\Uuid;
@@ -146,6 +147,9 @@ class CalendarController extends Controller
$form = $this->entityForm($entity,$access);
$form->handleRequest($request);
+ // Sur erreur
+ $this->getErrorForm(null,$form,$request,$entity,"submit");
+
if ($form->isValid()) {
@@ -189,6 +193,9 @@ class CalendarController extends Controller
$form = $this->entityForm($entity,$access);
$form->handleRequest($request);
+ // Sur erreur
+ $this->getErrorForm(null,$form,$request,$entity,"update");
+
if ($form->isValid()) {
$em = $this->getDoctrine()->getManager();
$em->persist($entity);
@@ -323,4 +330,32 @@ class CalendarController extends Controller
]);
}
+
+ protected function getErrorForm($id,$form,$request,$data,$mode) {
+ if ($form->get('submit')->isClicked()&&$mode=="delete") {
+ }
+
+ if ($form->get('submit')->isClicked() && ($mode=="submit" || $mode=="update")) {
+ // Si type de calendrier ICS alors url obligatoire
+ if (is_null($data->getUrl()) && $data->getType()==1) {
+ $form->addError(new FormError('URL obligatoire'));
+ }
+ }
+
+
+
+ if ($form->get('submit')->isClicked() && !$form->isValid()) {
+ $this->get('session')->getFlashBag()->clear();
+ $validator = $this->get('validator');
+ $errors = $validator->validate($data);
+ foreach( $errors as $error ) {
+ $request->getSession()->getFlashBag()->add("error", $error->getMessage());
+ }
+
+ $errors = $form->getErrors();
+ foreach( $errors as $error ) {
+ $request->getSession()->getFlashBag()->add("error", $error->getMessage());
+ }
+ }
+ }
}
diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Entity/Calendarevent.php b/src/ninegate-1.0/src/Cadoles/PortalBundle/Entity/Calendarevent.php
index 30ec3d97..5baa9730 100644
--- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Entity/Calendarevent.php
+++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Entity/Calendarevent.php
@@ -10,7 +10,7 @@ use Symfony\Component\Validator\Constraints as Assert;
* Calendar
*
* @ORM\Entity
- * @ORM\Table(name="calendarevent")
+ * @ORM\Table(name="calendarevent",indexes={@ORM\Index(name="uid", columns={"uid"})})
* @ORM\Entity(repositoryClass="Cadoles\PortalBundle\Repository\CalendareventRepository")
* @ORM\HasLifecycleCallbacks
*/
diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Form/CalendarType.php b/src/ninegate-1.0/src/Cadoles/PortalBundle/Form/CalendarType.php
index 60e855ee..85f29c7e 100644
--- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Form/CalendarType.php
+++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Form/CalendarType.php
@@ -40,6 +40,11 @@ class CalendarType extends AbstractType
"iCalendar (ICS)" => '1',
],
"disabled" => ($options["mode"]=="delete"?true:false),
+ ])
+
+ ->add('url', TextType::class, [
+ 'label' => "URL",
+ 'required' => false,
]);
if($options["access"]=="config") {
diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Calendar/edit.html.twig b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Calendar/edit.html.twig
index ad1f1b87..d6799a1f 100644
--- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Calendar/edit.html.twig
+++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Calendar/edit.html.twig
@@ -53,6 +53,10 @@
{{ form_row(form.name) }}
{{ form_row(form.type) }}
{{ form_row(form.color) }}
+
+
+ {{ form_row(form.url) }}
+
{% if form.roles is defined %}
@@ -68,4 +72,21 @@
{% endblock %}
{% block localjavascript %}
+ $(document).ready(function() {
+ showhide();
+ });
+
+
+ $( "#calendar_type" ).on('change', function() {
+ showhide();
+ });
+
+
+ function showhide() {
+ console.log($("#calendar_type").val());
+ if($("#calendar_type").val()==1)
+ $("#url").show();
+ else
+ $("#url").hide();
+ }
{% endblock %}
diff --git a/tmpl/ninegate-template.yml b/tmpl/ninegate-template.yml
index 62af480f..edb7fd91 100644
--- a/tmpl/ninegate-template.yml
+++ b/tmpl/ninegate-template.yml
@@ -32,7 +32,7 @@ parameters:
ldap_port: %%ldap_port
%if %%getVar("activer_admin_passfile", 'non') == "oui"
ldap_user: cn=admin,o=gouv,c=fr
- ldap_password: %%pwdreader("",%%ldap_admin_passfile)
+ ldap_password: %%pwdreader("",%%ldap_admin_passfile)
%else
ldap_user: cn=reader,o=gouv,c=fr
ldap_password: %%pwdreader("",%%ldap_reader_passfile)