Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/BrunoSpy/epeires2
Browse files Browse the repository at this point in the history
  • Loading branch information
BrunoSpy committed May 28, 2016
2 parents b81da86 + 81f0291 commit d409603
Show file tree
Hide file tree
Showing 18 changed files with 110 additions and 76 deletions.
14 changes: 14 additions & 0 deletions module/Administration/view/administration/home/index.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,26 @@ $commit = shell_exec("git log -n 1 --pretty=format:'%s (%ci)' --abbrev-commit");

$tag = shell_exec("git describe --exact-match --tags");

$hostname = getenv('COMPUTERNAME') ? getenv('COMPUTERNAME') : shell_exec('uname -n');

$hasTag = ! (substr($tag, 0, strlen("fatal")) === "fatal" || substr($tag, 0, strlen("warning")) === "warning" || empty($tag));
?>
<div class="container-fluid">
<div class="row">
<div class="col-sm-12">
<p></p>
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Serveur</h3>
</div>

<div class="panel-body">
<p>
Nom d'hôte : <em><?php echo $hostname; ?></em>
</p>
</div>
</div>

<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Version</h3>
Expand Down
2 changes: 2 additions & 0 deletions module/Administration/view/administration/mil/form.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ echo $this->formHidden($this->form->get('compactmode'));

echo $this->formHidden($this->form->get('timeline'));

echo $this->formHidden($this->form->get('timelineconfirmed'));

echo $this->formSelect($this->form->get('readroles')->setAttributes(array('class' => 'unvisible')));
?>

Expand Down
4 changes: 2 additions & 2 deletions module/Administration/view/administration/models/form.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ if($this->form->has('custom_fields')){
}
$countalarms++;
echo '<tr>';
echo '<td data-toggle="tooltip" data-title="Déclenchement du mémo x minutes après le début de l\'évènement">'.(strlen($deltabegin) > 0 ? $deltabegin : "0").' min</td>';
echo '<td data-toggle="tooltip" data-title="Déclenchement du mémo x minutes après la fin de l\'évènement">'.(strlen($deltaend) > 0 ? $deltaend : "0").' min</td>';
echo '<td data-toggle="tooltip" title="Déclenchement du mémo x minutes après le début de l\'évènement">'.(strlen($deltabegin) > 0 ? $deltabegin : "0").' min</td>';
echo '<td data-toggle="tooltip" title="Déclenchement du mémo x minutes après la fin de l\'évènement">'.(strlen($deltaend) > 0 ? $deltaend : "0").' min</td>';
echo '<td>'.$this->eventName($alarm).'</td>';
echo '<td><a href="#" class="delete-alarm" data-id="'.$alarm->getId().'"><span class="glyphicon glyphicon-trash"></span></a></td>';
echo '</tr>';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ echo $this->formHidden($this->form->get('organisation'));

echo $this->formHidden($this->form->get('impact'));

echo $this->formHidden($this->form->get('programmed'));
echo $this->formHidden($this->form->get('programmed')->setAttribute('value', false));

echo $this->formHidden($this->form->get('listable')->setAttribute('value', false));

Expand Down
3 changes: 2 additions & 1 deletion module/Application/public/assets/css/application.css
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,8 @@ body {

#calendar input {
margin-bottom: 0px;
width: 82px;
width: 86px;
padding-bottom: 0px;
}

#Event blockquote, #updates blockquote {
Expand Down
2 changes: 0 additions & 2 deletions module/Application/public/assets/css/timeline.css
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,12 @@
.Time_obj.roundhour {
text-align: center;
color: #0000FF;
font-family: Calibri;
font-size: 16px;
}

.Time_obj.halfhour {
text-align: center;
color: #0000FF;
font-family: Calibri;
font-size: 12px;
width: 20px;
}
Expand Down
106 changes: 57 additions & 49 deletions module/Application/public/assets/js/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -686,45 +686,47 @@ var form = function(url, tabid){

if(root_value > 0) {
$.when(
$.post(url+'events/subform?part=subcategories&id='+$(this).val() + (tabid === 'timeline' ? '&onlytimeline=true' : '&tabid='+tabid),
$.post(url+'events/subform?part=subcategories&id='+root_value + (tabid === 'timeline' ? '&onlytimeline=true' : '&tabid='+tabid),
function(data){
$('#subcategories').prop('disabled',false);
$("#subcategories").html(data);

$.post(
url+'events/subform?part=custom_fields&id='+root_value,
function(data){
$("#custom_fields").html(data);
$("#custom_fields input, #custom_fields select").on("invalid", function(event){
$("#description-title a").trigger('click');
$(this).parents('.form-group').addClass('has-error');
});
$('#event').trigger('change');
}
);
$("#cat-title").addClass('valid');
$("#hours-title a").removeClass("disabled");
$("#description-title a").removeClass("disabled");
$("#files-title a").removeClass("disabled");
$("#memos-title a").removeClass("disabled");
$('#actions-title a').removeClass("disabled");
}),
//récupération des modèles
$.post(
url+'events/subform?part=predefined_events&id='+$(this).val(),
function(data){
$("#predefined_events").html(data);
$.material.checkbox();
})
).then(function(){
if($("#subcategories option").length <= 1 && $("#predefined_events table").length === 0){
$("#description-title a").trigger('click');
} else {
if(cat_parent_id >= 0){
$("#subcategories").val(cat_id);
$("#subcategories").trigger('change');
}
}
if(cat_parent_id >= 0){
$("#subcategories").val(cat_id);
$("#subcategories").trigger('change');
} else {
$.when(//récupération des modèles
$.post(
url+'events/subform?part=predefined_events&id='+root_value,
function(data){
$("#predefined_events").html(data);
$.material.checkbox();
}
),
$.post(
url+'events/subform?part=custom_fields&id='+root_value,
function(data){
$("#custom_fields").html(data);
$("#custom_fields input, #custom_fields select").on("invalid", function(event){
$("#description-title a").trigger('click');
$(this).parents('.form-group').addClass('has-error');
});
$('#event').trigger('change');
}
)
).then(function(){
if($("#subcategories option").length <= 1 && $("#predefined_events table").length === 0){
$("#description-title a").trigger('click');
}
});
}
cat_parent_id = -1;
cat_id = -1;
});
Expand All @@ -749,27 +751,33 @@ var form = function(url, tabid){
if (subcat_value > 0) {
rebootTabs();
$("input[name='category']").val(subcat_value);
$.post(url + 'events/subform?part=custom_fields&id=' + subcat_value,
function(data) {
$("#custom_fields").html(data);
$("#event input, #event select").on("invalid", function(event){
$("#description-title a").trigger('click');
});
//force recalcule des conditions en fonction des champs chargés
$("#event").trigger('change');
$.material.checkbox();
}
);
$.post(
url + 'events/subform?part=predefined_events&id=' + $(this).val(),
function(data){
$("#predefined_events").html(data);
//don't open model panel if there is no model
if($('#predefined_events div').length == 0) {
$("#description-title a").trigger('click');
}
}
);
$.when(
$.post(url + 'events/subform?part=custom_fields&id=' + subcat_value,
function(data) {
$("#custom_fields").html(data);
$("#event input, #event select").on("invalid", function(event){
$("#description-title a").trigger('click');
});
//force recalcule des conditions en fonction des champs chargés
$("#event").trigger('change');
$.material.checkbox();
}
),
$.post(
url + 'events/subform?part=predefined_events&id=' + $(this).val(),
function(data){
$("#predefined_events").html(data);
//don't open model panel if there is no model
if($('#predefined_events div').length == 0) {
$("#description-title a").trigger('click');
}
}
)
).then(function(){
if($("#predefined_events table").length === 0){
$("#description-title a").trigger('click');
}
});
} else {
//réinit en fonction de la cat racine
$("#root_categories").trigger('change');
Expand Down
6 changes: 3 additions & 3 deletions module/Application/public/assets/js/headerbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ var headerbar = function (url) {
setInterval(function () {
$.getJSON(url + '/getIPO', function (data) {
$.each(data, function (key, value) {
if ($('.header #iponame').length > 0) { //ipo = span
$('.header #iponame').text(value);
if ($('#navbar-first-collapse #iponame').length > 0) { //ipo = span
$('#navbar-first-collapse #iponame').text(value);
} else {
//ipo = select
$('.header select[name=nameipo] option[value=' + key + ']').prop('selected', true);
$('#navbar-first-collapse select[name=nameipo] option[value=' + key + ']').prop('selected', true);
}
});
});
Expand Down
5 changes: 3 additions & 2 deletions module/Application/public/assets/js/jquery.ui.timeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
*
* @memberOf $
*/
version: "0.9.6",
version: "0.9.7",
/**
* List of events
* Some properties are added during drawing:
Expand Down Expand Up @@ -1788,7 +1788,8 @@
lien.addClass('rightlink');
event.outside = 2;
} else { // sinon on le met à gauche
x1 -= txt_wid - 5;
x1 -= txt_wid + 8;
console.log(x1);
var x1lien = x1 + txt_wid - 18*3 - 20; //le lien part de la fin du txt pas du début
lien.css({'left': x1lien + 'px', 'width': x0 - x1lien + 'px'});
elmt_txt.css({'left': x1 + 'px'});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ protected function processFormMessages($messages, &$json = null)
if (is_array($mvalue)) {
foreach ($mvalue as $nkey => $nvalue) { // les fieldsets sont un niveau en dessous
if ($json) {
if(is_array($nvalue)) {
$nvalue = json_encode($nvalue);
}
$json['error'][] = "Champ " . addslashes($mkey) . " incorrect : " . addslashes($nvalue);
} else {
$this->flashMessenger()->addErrorMessage("Champ " . addslashes($mkey) . " incorrect : " . addslashes($nvalue));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,7 @@ public function switchantennaAction()
$frequency = $em->getRepository('Application\Entity\Frequency')->find($freqid);
}
if ($categories) {
$em->persist($event);
$cat = $categories[0];
$antennafieldvalue = new CustomFieldValue();
$antennafieldvalue->setCustomField($cat->getAntennaField());
Expand All @@ -403,8 +404,6 @@ public function switchantennaAction()
$em->persist($freqvalue);
}
$event->setCategory($categories[0]);
$em->persist($antennafieldvalue);
$em->persist($statusvalue);
// création des evts fils pour le passage en secours
if ($frequency && $frequency->hasAntenna($antenna)) {
// une seule fréquence impactée
Expand Down Expand Up @@ -476,7 +475,6 @@ public function switchantennaAction()
// ajout des fichiers
foreach ($antenna->getModel()->getFiles() as $file) {
$file->addEvent($event);
$em->persist($file);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions module/Application/src/Application/Entity/AbstractEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ abstract class AbstractEvent
protected $category;

/**
* @ORM\OneToMany(targetEntity="CustomFieldValue", mappedBy="event", cascade={"remove"})
* @ORM\OneToMany(targetEntity="CustomFieldValue", mappedBy="event", cascade={"persist", "remove"})
*/
protected $custom_fields_values;

Expand All @@ -116,7 +116,7 @@ abstract class AbstractEvent
protected $zonefilters;

/**
* @ORM\ManyToMany(targetEntity="File", mappedBy="events")
* @ORM\ManyToMany(targetEntity="File", mappedBy="events", cascade={"persist"})
*/
protected $files;

Expand Down
7 changes: 6 additions & 1 deletion module/Application/src/Application/Entity/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ class Event extends AbstractEvent
*/
protected $scheduled = false;

/**
* @ORM\OneToMany(targetEntity="IPO\Entity\Element", mappedBy="event", cascade={"remove"})
*/
protected $elements;

/**
* @ORM\Column(type="boolean")
*/
Expand Down Expand Up @@ -421,4 +426,4 @@ public function getArrayCopy()
$object_vars['author'] = ($this->author ? $this->author->getId() : null);
return $object_vars;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ public function getEvents($userauth, $day = null, $lastmodified = null, $orderby
$qb->andWhere($qb->expr()
->orX($qb->expr()
->neq('c.timelineconfirmed', true), $qb->expr()
->neq('e.scheduled', true), $qb->expr()
->andX($qb->expr()
->eq('c.timelineconfirmed', true), $qb->expr()
->in('e.status', array(2,3,4)), $qb->expr()
Expand Down Expand Up @@ -654,10 +655,7 @@ public function addChangeFrequencyCovEvent(Frequency $frequency, $cov, $freqstat
$causefield->setCustomField($cat->getCauseField());
$causefield->setEvent($event);
$causefield->setValue($cause);
$em->persist($frequencyfieldvalue);
$em->persist($statusfield);
$em->persist($covfield);
$em->persist($causefield);
$event->addCustomFieldValue($causefield);
$em->persist($event);
try {
$em->flush();
Expand Down Expand Up @@ -798,6 +796,11 @@ private function doAddMilEvent(\Application\Entity\MilCategory $cat, \Applicatio
$this->getEntityManager()->persist($alarm);
}
}
//ajout des fichiers
foreach($model->getFiles() as $file) {
$file->addEvent($event);
$this->getEntityManager()->persist($file);
}
$event->updateAlarms();
}

Expand Down
2 changes: 1 addition & 1 deletion module/Application/view/application/events/index.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ $this->headLink()->prependStylesheet($this->basePath() . '/assets/css/form.css')
?>

<?php if($this->isGranted('events.create') || $this->isGranted('events.write')):?>
<div id="create-evt" data-toggle="modal" class="modal fade in" data-spy="affix" data-offset-top="80">
<div id="create-evt" data-toggle="modal" data-backdrop="static" class="modal fade in" data-spy="affix" data-offset-top="80">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="loading"></div>
Expand Down
7 changes: 4 additions & 3 deletions module/Core/src/Core/View/Helper/NavBarTop.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,14 @@ class="navbar-toggle collapsed"
$html .= '<ul class="nav navbar-nav navbar-left">';
$html .= $this->view->userMenu($color);
$html .= '</ul>';

/* Non utilisé pour l'instant
if($auth->getIdentity() && !$zoneform) {
$html .= '<p class="navbar-text navbar-left visible-lg-block">';
$html .= '<span class="glyphicon glyphicon-road" aria-hidden="true"></span><b> Organisation : </b>' . $auth->getIdentity()->getOrganisation()->getName();
$html .= '</p>';
}
if($zoneform) {
$form = $zoneform;
$form->setAttributes(array('action' => $this->view->url('application', array('controller'=>'events', 'action'=>'savezone')),
Expand All @@ -75,7 +76,7 @@ class="navbar-toggle collapsed"
$html .= '</div>';
$html .= $this->view->form()->closeTag();
}

*/
if ($auth->getIdentity() && $auth->getIdentity()->getZone()) {
$html .= '<p class="navbar-text navbar-left"><span class="glyphicon glyphicon-eye-open" aria-hidden="true"></span> <b>Chef de salle : </b></p>';
$html .= $this->view->opsup();
Expand Down
2 changes: 1 addition & 1 deletion module/Core/src/Core/View/Helper/UserMenu.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function __invoke($color)
if ($router->match($request) && $router->match($request)->getMatchedRouteName() == 'administration') {
$html .= "<li><a href=\"" . $urlHelper('application') . "\">Interface OPE</a></li>";
} else {
if ($this->auth->isGranted('admin.centre') || $this->auth->isGranted('admin.users') || $this->auth->isGranted('admin.categories') || $this->auth->isGranted('admin.models') || $this->auth->isGranted('admin.radio')) {
if ($this->auth->isGranted('admin.access') || $this->auth->isGranted('admin.centre') || $this->auth->isGranted('admin.users') || $this->auth->isGranted('admin.categories') || $this->auth->isGranted('admin.models') || $this->auth->isGranted('admin.radio')) {
$html .= "<li><a href=\"" . $urlHelper('administration', array(
'controller' => 'home',
'action' => 'index'
Expand Down
Loading

0 comments on commit d409603

Please sign in to comment.