summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjörn Geiger2011-10-24 09:36:43 +0200
committerBjörn Geiger2011-10-24 09:36:43 +0200
commitc7607c890e7dd70fc172d2055682d89410d4f080 (patch)
tree78cbba85ddd4ebca8dd570abc307fb109c6e040c
parentWorker.java (diff)
parentminor (diff)
downloadpoolctrl-c7607c890e7dd70fc172d2055682d89410d4f080.tar.gz
poolctrl-c7607c890e7dd70fc172d2055682d89410d4f080.tar.xz
poolctrl-c7607c890e7dd70fc172d2055682d89410d4f080.zip
Merge branch 'master' of git.openslx.org:lsfks/projekte/poolctrl
-rwxr-xr-xapplication/controllers/EventController.php230
-rwxr-xr-xapplication/models/EventMapper.php14
-rw-r--r--application/views/scripts/event/checkoverlapdrop.phtml (renamed from application/views/scripts/event/checkoverlapevents.phtml)24
-rw-r--r--application/views/scripts/event/checkoverlapresize.phtml42
-rw-r--r--application/views/scripts/event/checkoverlapselect.phtml13
-rwxr-xr-xapplication/views/scripts/event/index.phtml213
-rwxr-xr-xpublic/media/css/fullcalendar.css22
7 files changed, 486 insertions, 72 deletions
diff --git a/application/controllers/EventController.php b/application/controllers/EventController.php
index 4055e93..f7711ed 100755
--- a/application/controllers/EventController.php
+++ b/application/controllers/EventController.php
@@ -659,7 +659,7 @@ class EventController extends Zend_Controller_Action
$this->view->poollist = $poollist;
}
- public function checkoverlapeventsAction() {
+ public function checkoverlapdropAction() {
if(!$this->acl->checkRight('eo')) {
$this->_redirect('/');
}
@@ -667,12 +667,13 @@ class EventController extends Zend_Controller_Action
$eventID = $this->getRequest()->getParam('eventID');
$date = intval(strtotime(substr($this->getRequest()->getParam('date'), 0, 24)));
-
+ $poolID = $this->getRequest()->getParam('poolID');
$events['withrepeat'] = $this->eventMapper->getDraggingEvents($eventID);
$events['withoutrepeat'] = $this->eventMapper->getDraggingEvent($eventID);
$others = $this->eventMapper->getNotDraggingEvents($eventID);
+ $allEvents = $this->eventMapper->fetchAllasArray($poolID);
// Calculate time shift
$diff=0;
@@ -683,38 +684,158 @@ class EventController extends Zend_Controller_Action
// Check for overlap with repeat
$overlapswithrepeat = array();
+ $cfeventswithrepeat = array();
+
foreach($events['withrepeat'] as $e) {
$enewstart = strtotime($e['start']) + $diff;
$enewend = strtotime($e['end']) + $diff;
-
+ $cfv = true;
+
+ // overlap events
foreach($others as $o) {
if($enewstart <= strtotime($o['start']) && $enewend >= strtotime($o['start'])
- || $enewstart >= strtotime($o['start']) && $enewstart <= strtotime($o['end']))
+ || $enewstart >= strtotime($o['start']) && $enewstart <= strtotime($o['end'])) {
$overlapswithrepeat[] = $o;
+ $cfv = false;
+ }
+ }
+ // conflict free events with repeat
+ if($cfv) {
+ $cfeventswithrepeat[] = $e;
}
}
// Check for overlap without repeat
$overlapswithoutrepeat = array();
+ $cfeventswithoutrepeat = array();
+ $cfv = true;
+
foreach($events['withoutrepeat'] as $e) {
$enewstart = strtotime($e['start']) + $diff;
$enewend = strtotime($e['end']) + $diff;
- foreach($others as $o) {
- if($enewstart <= strtotime($o['start']) && $enewend >= strtotime($o['start'])
- || $enewstart >= strtotime($o['start']) && $enewstart <= strtotime($o['end']))
+ // overlap events
+ foreach($allEvents as $o) {
+ if($enewstart <= strtotime($o['start']) && $enewend >= strtotime($o['start']) && $o['eventID'] != $eventID
+ || $enewstart >= strtotime($o['start']) && $enewstart <= strtotime($o['end']) && $o['eventID'] != $eventID) {
$overlapswithoutrepeat[] = $o;
+ $cfv = false;
+ }
+ }
+ // conflict free events without repeat
+ if($cfv) {
+ $cfeventswithoutrepeat[] = $e;
}
}
$this->view->events = $events;
$this->view->others = $others;
$this->view->overlapswithrepeat = $overlapswithrepeat;
+ $this->view->cfeventswithrepeat = $cfeventswithrepeat;
$this->view->overlapswithoutrepeat = $overlapswithoutrepeat;
-
+ $this->view->cfeventswithoutrepeat = $cfeventswithoutrepeat;
+
}
+
+ public function checkoverlapselectAction() {
+ if(!$this->acl->checkRight('eo')) {
+ $this->_redirect('/');
+ }
+ $this->_helper->layout->disableLayout();
+
+ $poolID = $this->getRequest()->getParam('poolID');
+ $startDate = intval(strtotime(substr($this->getRequest()->getParam('startDate'), 0, 24)));
+ $endDate = intval(strtotime(substr($this->getRequest()->getParam('endDate'), 0, 24)));
+
+ $allEvents = $this->eventMapper->fetchAllasArray($poolID);
+
+ $overlaps = array();
+ foreach($allEvents as $e) {
+ if($startDate <= strtotime($e['start']) && $endDate >= strtotime($e['start'])
+ || $startDate >= strtotime($e['start']) && $startDate <= strtotime($e['end']))
+ $overlaps[] = $e;
+ }
+
+ $this->view->overlaps = $overlaps;
+ }
+
+ public function checkoverlapresizeAction() {
+ if(!$this->acl->checkRight('eo')) {
+ $this->_redirect('/');
+ }
+ $this->_helper->layout->disableLayout();
+
+ $poolID = $this->getRequest()->getParam('poolID');
+
+ $eventID = $this->getRequest()->getParam('eventID');
+ $minuteDelta = intval($this->getRequest()->getParam('minuteDelta')*60);
+ $dayDelta = intval($this->getRequest()->getParam('dayDelta')*24*60*60);
+ $diffDelta = intval($minuteDelta + $dayDelta);
+
+ $events['withrepeat'] = $this->eventMapper->getDraggingEvents($eventID);
+ $events['withoutrepeat'] = $this->eventMapper->getDraggingEvent($eventID);
+
+ $others = $this->eventMapper->getNotDraggingEvents($eventID);
+ $allEvents = $this->eventMapper->fetchAllasArray($poolID);
+
+ // Check for overlap with repeat
+ $overlapswithrepeat = array();
+ $cfeventswithrepeat = array();
+
+ foreach($events['withrepeat'] as $e) {
+
+ $enewstart = strtotime($e['start']);
+ $enewend = strtotime($e['end']) + $diffDelta;
+ $cfv = true;
+
+ // overlap events
+ foreach($allEvents as $o) {
+ if($enewstart <= strtotime($o['start']) && $enewend >= strtotime($o['start']) && $o['eventID'] != $e['eventID'] && $o['eventID'] != $eventID
+ || $enewstart >= strtotime($o['start']) && $enewstart <= strtotime($o['end']) && $o['eventID'] != $e['eventID'] && $o['eventID'] != $eventID) {
+ $overlapswithrepeat[] = $o;
+ $cfv = false;
+ }
+ }
+ // conflict free events with repeat
+ if($cfv) {
+ $cfeventswithrepeat[] = $e;
+ }
+ }
+
+ // Check for overlap without repeat
+ $overlapswithoutrepeat = array();
+ $cfeventswithoutrepeat = array();
+
+ foreach($events['withoutrepeat'] as $e) {
+
+ $enewstart = strtotime($e['start']);
+ $enewend = strtotime($e['end']) + $diffDelta;
+ $cfv = true;
+
+ // overlap events
+ foreach($allEvents as $o) {
+ if($enewstart <= strtotime($o['start']) && $enewend >= strtotime($o['start']) && $o['eventID'] != $eventID
+ || $enewstart >= strtotime($o['start']) && $enewstart <= strtotime($o['end']) && $o['eventID'] != $eventID) {
+ $overlapswithoutrepeat[] = $o;
+ $cfv = false;
+ }
+ }
+ // conflict free events without repeat
+ if($cfv) {
+ $cfeventswithoutrepeat[] = $e;
+ }
+ }
+
+ $this->view->events = $events;
+ $this->view->others = $others;
+ $this->view->overlapswithrepeat = $overlapswithrepeat;
+ $this->view->cfeventswithrepeat = $cfeventswithrepeat;
+ $this->view->overlapswithoutrepeat = $overlapswithoutrepeat;
+ $this->view->cfeventswithoutrepeat = $cfeventswithoutrepeat;
+
+ }
public function eventmoveAction() {
if(!$this->acl->checkRight('eo')) {
@@ -734,7 +855,8 @@ class EventController extends Zend_Controller_Action
if ($evid!="null") {
$this->eventMapper->find($evid,$event); //locate the event in the DB
$this->eventMapper->find($evid,$oldEvent);
- $event->setRepeat(0);
+ //es beleibt ein repeatEvent! ob alle verschoben werden oder nur das selektierte wird über den kalender abgefragt
+ //$event->setRepeat(0);
$event->setRepeattype(null);
$event->setRepeatend(null);
$event->setRepeatdate(null);
@@ -884,6 +1006,91 @@ class EventController extends Zend_Controller_Action
return;
}
}
+
+ public function eventmovecfAction() {
+ if(!$this->acl->checkRight('eo')) {
+ $this->_redirect('/');
+ }
+ $this->_helper->layout->disableLayout();
+ $this->_helper->viewRenderer->setNoRender();
+
+ $cfevents = $this->getRequest()->getParam('cfevents');
+ $evmindelta = $this->getRequest()->getParam('evmindelta');
+ $evdaydelta = $this->getRequest()->getParam('evdaydelta');
+ $poolID = $this->getRequest()->getParam('poolID');
+
+ $eventsArray = (array) $cfevents;
+
+ //$event = new Application_Model_Event($cfevents);
+
+ var_dump($eventsArray);
+
+ //print_r($cfevents['eventID']);
+
+ /*if ($cfevents!=null) {
+
+ $events = $this->eventMapper->findBy(array("eventID" => $cfevents['eventID']));
+ if ($events[0]->getPbs_membershipID() != $this->userIDsNamespace['membershipID']) {
+ if (!$this->acl->checkRight('edo')) {
+ $this->_redirect('/');
+ }
+ }
+ try {
+ foreach($events as $event) {
+ //1min = 60sec, 1d = 86400sec
+ $oldStartTime = date('H:i', strtotime($event->getStart()));
+ $oldStartDate = date('d.m.Y', strtotime($event->getStart()));
+ $evstartTime = intval(strtotime($event->getStart())) + intval($evmindelta*60) + intval($evdaydelta*86400);
+ $newStartTime = date('H:i', $evstartTime);
+ $newStartDate = date('d.m.Y', $evstartTime);
+ $eventStart = date('Y-m-d H:i:s', $evstartTime);
+ $event->setStart($eventStart);
+ if($event->getEnd()) {
+ $oldEndTime = date('H:i', strtotime($event->getEnd()));
+ $oldEndDate = date('d.m.Y', strtotime($event->getEnd()));
+ $evendTime = intval(strtotime($event->getEnd())) + intval($evmindelta*60) + intval($evdaydelta*86400);
+ $newEndTime = date('H:i', $evendTime);
+ $newEndDate = date('d.m.Y', $evendTime);
+ $eventEnd = date('Y-m-d H:i:s', $evendTime);
+ $event->setEnd($eventEnd);
+ }
+ $event->setPbs_poolID($poolID);
+ $result = $this->eventcategoryMapper->findBy(array('title' => 'Shutdown'));
+ $shutdownCategory = $result[0];
+ if($event->getCategory() != $shutdownCategory->getID()) {
+ if($event->getPbs_filterID()) {
+ if($event->getRepeat()) {
+ $repeattypeMapper = new Application_Model_RepeattypeMapper();
+ $repeattype = new Application_Model_Repeattype();
+ $repeattypeMapper->find($event->getRepeattype(), $repeattype);
+ if($repeattype == "Once a week") {
+ $oldStartDate = date("N", strototime($oldStartDate));
+ $oldEndDate = '';
+ $newStartDate = date("N", strototime($newStartDate));
+ $newEndDate = '';
+ }
+ }
+ $filterentriesQuerie = "filterid=" . $event->getPbs_filterID() . "&oldvalue1=" . strtotime($oldStartDate) . "&oldvalue2=" . strtotime($oldEndDate) . "&value1=" . strtotime($newStartDate) . "&value2=" . strtotime($newEndDate);
+ $filterApiResult = PostToHost($this->pbs2host, $this->config['pbs2']['changefilterentry'] . $this->userIDsNamespace['apikey'], 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'poolctrl', $filterentriesQuerie);
+ unset($filterApiResult);
+ $filterentriesQuerie = "filterid=" . $event->getPbs_filterID() . "&oldvalue1=" . $oldStartTime . "&oldvalue2=" . $oldEndTime . "&value1=" . $newStartTime . "&value2=" . $newEndTime;
+ $filterApiResult = PostToHost($this->pbs2host, $this->config['pbs2']['changefilterentry'] . $this->userIDsNamespace['apikey'], 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'poolctrl', $filterentriesQuerie);
+ unset($filterApiResult);
+ }
+ }
+ $this->eventMapper->save($event); //save the event with the new data
+ }
+ } catch (Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ return;
+ }
+ $this->_redirect('/event/');
+ } else {
+ $this->_redirect('/event/');
+ return;
+ }*/
+ }
public function eventresizeAction() {
if(!$this->acl->checkRight('eo')) {
@@ -902,7 +1109,7 @@ class EventController extends Zend_Controller_Action
if ($evid!=null) {
$this->eventMapper->find($evid,$event); //locate the event in the DB
$this->eventMapper->find($evid,$oldEvent);
- $event->setRepeat(0);
+ //$event->setRepeat(0);
$event->setRepeattype(null);
$event->setRepeatend(null);
$event->setRepeatdate(null);
@@ -983,6 +1190,7 @@ class EventController extends Zend_Controller_Action
}
try {
foreach($events as $event) {
+ if($event->getRunning() == 0) {
$eventEnd = date('Y-m-d H:i:s', intval(strtotime($event->getEnd())) + intval($evmindelta*60));
$event->setEnd($eventEnd);
$event->setPbs_poolID($poolID);
@@ -997,6 +1205,7 @@ class EventController extends Zend_Controller_Action
}
$this->eventMapper->save($event); //save the event with the new data
}
+ }
} catch (Zend_Exception $e) {
echo "Caught exception: " . get_class($e) . "<br/>";
echo "Message: " . $e->getMessage() . "<br/>";
@@ -1052,6 +1261,7 @@ class EventController extends Zend_Controller_Action
'repeat' => $event->getRepeat(),
'opacity' => 1,
'immediate' => $event->getImmediate(),
+ 'running' => $event->getRunning(),
)
);
}
diff --git a/application/models/EventMapper.php b/application/models/EventMapper.php
index 0ac7485..fff14fb 100755
--- a/application/models/EventMapper.php
+++ b/application/models/EventMapper.php
@@ -183,6 +183,20 @@ class Application_Model_EventMapper
$vv2 = $v2->toArray();
return array_diff_assoc($vv1,$vv2);
}
+
+ public function fetchAllasArray($poolID) {
+
+ $db = Zend_Db_Table::getDefaultAdapter();
+ $select = $this->getDbTable()->select()
+ ->setIntegrityCheck(false)
+ ->from(array('pce' => 'poolctrl_event'))
+ ->where('pce.pbs_poolID = ?', $poolID);
+
+ $stmt = $db->query($select);
+ $result = $stmt->fetchAll();
+
+ return $result;
+ }
public function getCategoryBarCount($poolID) {
diff --git a/application/views/scripts/event/checkoverlapevents.phtml b/application/views/scripts/event/checkoverlapdrop.phtml
index 6558e19..279e798 100644
--- a/application/views/scripts/event/checkoverlapevents.phtml
+++ b/application/views/scripts/event/checkoverlapdrop.phtml
@@ -1,10 +1,21 @@
<?php
-// Output
-//print_r($this->overlaps);
-//$overlaps[] = array();
-
+$output['cfevents'] = $this->cfeventswithrepeat;
+// conflict free plot with repeat
+$output['cfplotwithrepeat'] = '<ul id="cfplot">';
+ foreach($this->cfeventswithrepeat as $c){
+ $output['cfplotwithrepeat'] .= '<li>' . 'EventID: ' . $c['eventID'] . ', Title: ' . $c['title'] . ', Start: ' . $c['start'] . ', End: ' . $c['end'] . '</li>';
+ }
+$output['cfplotwithrepeat'] .= '</ul>';
+// conflict free plot without repeat
+$output['cfplotwithoutrepeat'] = '<ul id="cfplot">';
+ foreach($this->cfeventswithoutrepeat as $c){
+ $output['cfplotwithoutrepeat'] .= '<li>' . 'EventID: ' . $c['eventID'] . ', Title: ' . $c['title'] . ', Start: ' . $c['start'] . ', End: ' . $c['end'] . '</li>';
+ }
+$output['cfplotwithoutrepeat'] .= '</ul>';
+
+// conflict plot with repeat
if(count($this->overlapswithrepeat) == 0) {
$output['withrepeat'] = -1;
}
@@ -14,10 +25,9 @@ else {
$output['withrepeat'] .= '<li>' . 'EventID: ' . $o['eventID'] . ', Title: ' . $o['title'] . ', Start: ' . $o['start'] . ', End: ' . $o['end'] . '</li>';
}
$output['withrepeat'] .= '</ul>';
- // Echo contents of output, e.g. required values, such as title, date, etc.
- //echo json_encode($this->overlaps);
}
+// conflict plot without repeat
if(count($this->overlapswithoutrepeat) == 0) {
$output['withoutrepeat'] = -1;
}
@@ -27,8 +37,6 @@ else {
$output['withoutrepeat'] .= '<li>' . 'EventID: ' . $o['eventID'] . ', Title: ' . $o['title'] . ', Start: ' . $o['start'] . ', End: ' . $o['end'] . '</li>';
}
$output['withoutrepeat'] .= '</ul>';
- // Echo contents of output, e.g. required values, such as title, date, etc.
- //echo json_encode($this->overlaps);
}
echo json_encode($output);
?> \ No newline at end of file
diff --git a/application/views/scripts/event/checkoverlapresize.phtml b/application/views/scripts/event/checkoverlapresize.phtml
new file mode 100644
index 0000000..85a1a1c
--- /dev/null
+++ b/application/views/scripts/event/checkoverlapresize.phtml
@@ -0,0 +1,42 @@
+<?php
+$output['cfevents'] = $this->cfeventswithrepeat;
+
+// conflict free plot with repeat
+$output['cfplotwithrepeat'] = '<ul id="cfplot">';
+ foreach($this->cfeventswithrepeat as $c){
+ $output['cfplotwithrepeat'] .= '<li>' . 'EventID: ' . $c['eventID'] . ', Title: ' . $c['title'] . ', Start: ' . $c['start'] . ', End: ' . $c['end'] . '</li>';
+ }
+$output['cfplotwithrepeat'] .= '</ul>';
+
+// conflict free plot without repeat
+$output['cfplotwithoutrepeat'] = '<ul id="cfplot">';
+ foreach($this->cfeventswithoutrepeat as $c){
+ $output['cfplotwithoutrepeat'] .= '<li>' . 'EventID: ' . $c['eventID'] . ', Title: ' . $c['title'] . ', Start: ' . $c['start'] . ', End: ' . $c['end'] . '</li>';
+ }
+$output['cfplotwithoutrepeat'] .= '</ul>';
+
+// conflict plot with repeat
+if(count($this->overlapswithrepeat) == 0) {
+ $output['withrepeat'] = -1;
+}
+else {
+ $output['withrepeat'] = '<ul id="conflictEvents">';
+ foreach($this->overlapswithrepeat as $o){
+ $output['withrepeat'] .= '<li>' . 'EventID: ' . $o['eventID'] . ', Title: ' . $o['title'] . ', Start: ' . $o['start'] . ', End: ' . $o['end'] . '</li>';
+ }
+ $output['withrepeat'] .= '</ul>';
+}
+
+// conflict plot without repeat
+if(count($this->overlapswithoutrepeat) == 0) {
+ $output['withoutrepeat'] = -1;
+}
+else {
+ $output['withoutrepeat'] = '<ul id="conflictEvents">';
+ foreach($this->overlapswithoutrepeat as $o){
+ $output['withoutrepeat'] .= '<li>' . 'EventID: ' . $o['eventID'] . ', Title: ' . $o['title'] . ', Start: ' . $o['start'] . ', End: ' . $o['end'] . '</li>';
+ }
+ $output['withoutrepeat'] .= '</ul>';
+}
+echo json_encode($output);
+?> \ No newline at end of file
diff --git a/application/views/scripts/event/checkoverlapselect.phtml b/application/views/scripts/event/checkoverlapselect.phtml
new file mode 100644
index 0000000..fa87193
--- /dev/null
+++ b/application/views/scripts/event/checkoverlapselect.phtml
@@ -0,0 +1,13 @@
+<?php
+if(count($this->overlaps) == 0) {
+ $output = -1;
+}
+else {
+ $output = '<ul id="conflictEvents">';
+ foreach($this->overlaps as $o){
+ $output .= '<li>' . 'EventID: ' . $o['eventID'] . ', Title: ' . $o['title'] . ', Start: ' . $o['start'] . ', End: ' . $o['end'] . '</li>';
+ }
+ $output .= '</ul>';
+}
+echo json_encode($output);
+?> \ No newline at end of file
diff --git a/application/views/scripts/event/index.phtml b/application/views/scripts/event/index.phtml
index f2c8a4b..c5c7c38 100755
--- a/application/views/scripts/event/index.phtml
+++ b/application/views/scripts/event/index.phtml
@@ -135,7 +135,7 @@ var dayClick = false;
$( "#eventDeleteDialog" ).dialog('open');
// dialog for deleting selected wdhEvent
- }else {
+ } else {
$(function() {
$( "#eventDeleteWdhDialog" ).dialog({
autoOpen: false,
@@ -207,9 +207,10 @@ var dayClick = false;
allDay : false,
slotMinutes: 15,
defaultEventMinutes: 10,
-
+
+ /*
dayClick: function( date, allDay, jsEvent, view ) {
- /*
+
selectedDate = date;
dayClick = true;
$('#calendar').fullCalendar( 'unselect' );
@@ -247,9 +248,9 @@ var dayClick = false;
$( "#errorRightsDialog" ).dialog('open');
}
else $('#calendar').fullCalendar( 'unselect' );
- */
+
//self.location="/event/add/evstart/" + date + "/poolID/" + $("#poolselectbox option:selected").val();
- },
+ },*/
eventMouseover: function( event, jsEvent, view ) {
evClick = true;
@@ -304,6 +305,34 @@ var dayClick = false;
},
select: function( startDate, endDate, allDay, jsEvent, view ) {
+
+ //initialize eventNotDroppableDialog Dialog
+ $(function() {
+ $( "#eventNotDroppableDialog" ).dialog({
+ autoOpen: false,
+ width: 820,
+ modal: true,
+ title: 'Adding of an Event at this position is not possible!',
+ buttons: {
+ "OK": function() {
+ $(this).dialog("close");
+ $('#calendar').fullCalendar( 'unselect' );
+ }
+ },
+ open: function () {
+ $("#accordion").accordion({clearStyle: true, collapsible: true, active: false, autoHeight: true });
+ $(".ui-dialog-titlebar-close").hide();
+ $(this).parents(".ui-dialog:first").find(".ui-dialog-titlebar").addClass("ui-state-error");
+ }
+ });
+ });
+
+ $.get("/event/checkoverlapselect/poolID/" + $("#poolselectbox option:selected").val() + "/startDate/" + startDate + "/endDate/" + endDate, function(data){
+
+ // get conflicts-HTML Element
+ var cell = document.getElementById("conflicts");
+ // get conflicts
+ var returndata = jQuery.parseJSON(data);
if($("#poolselectbox option:selected").val() == 'default') {
$( "#noPoolSelectedDialog" ).dialog('open');
@@ -319,9 +348,16 @@ var dayClick = false;
$(this).dialog("close");
$('#calendar').fullCalendar( 'unselect' );
},
- "OK": function() {
+ "OK": function() {
+ if(returndata == -1) {
$(this).dialog("close");
self.location="/event/add/evstart/" + startDate + "/evend/" + endDate + "/poolID/" + $("#poolselectbox option:selected").val();
+ } else {
+ $(this).dialog("close");
+ cell.removeChild(cell.firstChild);
+ $("#conflicts").append(returndata);
+ $( "#eventNotDroppableDialog" ).dialog('open');
+ }
}
},
open: function () {
@@ -337,11 +373,46 @@ var dayClick = false;
} else
evClick = true;
$('#calendar').fullCalendar( 'unselect' );
+ });
},
eventResize: function( event, dayDelta, minuteDelta, revertFunc ) {
-
- $(this).qtip("destroy");
+
+ $.get("/event/checkoverlapresize/eventID/" + event.id + "/minuteDelta/" + minuteDelta + "/dayDelta/" + dayDelta + "/poolID/" + $("#poolselectbox option:selected").val(), function(data){
+
+ // get conflicts-HTML Element
+ var cell = document.getElementById("conflicts");
+ var cfcell = document.getElementById("cfevents");
+ // get conflicts
+ var returndata = jQuery.parseJSON(data);
+ // get conflict free events
+ var cfevents = returndata.cfevents;
+
+ //initialize eventNotDroppableDialog Dialog
+ $(function() {
+ $( "#eventNotDroppableDialog" ).dialog({
+ autoOpen: false,
+ width: 820,
+ modal: true,
+ title: 'Resizing of ' + event.title + ' is not possible!',
+ buttons: {
+ "Resolve Conflicts": function() {
+ $(this).dialog("close");
+ self.location="/event/eventmovecf/evmindelta/" + minuteDelta + "/evdaydelta/" + dayDelta + "/poolID/" + $("#poolselectbox option:selected").val() + "/cfevents/" + cfevents;
+ },
+ "OK": function() {
+ $(this).dialog("close");
+ revertFunc();
+ }
+ },
+ open: function () {
+ $("#accordion").accordion({clearStyle: true, collapsible: true, active: false, autoHeight: true });
+ $(".ui-dialog-titlebar-close").hide();
+ $(this).parents(".ui-dialog:first").find(".ui-dialog-titlebar").addClass("ui-state-error");
+ }
+ });
+ });
+
if($.get("/event/checkright/rightShortcut/er")) {
if(event.repeat == 0) {
$(function() {
@@ -355,10 +426,17 @@ var dayClick = false;
$(this).dialog("close");
revertFunc();
},
- "OK": function() {
- $(this).dialog("close");
- $.post("/event/eventresize/evid/" + event.id + "/evend/" + event.end + "/poolID/" + $("#poolselectbox option:selected").val());
- }
+ "OK": function() {
+ if(returndata.withoutrepeat == -1) {
+ $(this).dialog("close");
+ $.post("/event/eventresize/evid/" + event.id + "/evend/" + event.end + "/poolID/" + $("#poolselectbox option:selected").val());
+ } else {
+ $(this).dialog("close");
+ cell.removeChild(cell.firstChild);
+ $("#conflicts").append(returndata.withoutrepeat);
+ $( "#eventNotDroppableDialog" ).dialog('open');
+ }
+ }
},
open: function () {
$(".ui-dialog-titlebar-close").hide();
@@ -367,7 +445,6 @@ var dayClick = false;
});
});
$( "#defaultDialog" ).dialog('open');
- $(this).qtip("destroy");
} else if (event.repeat == 1) {
$(function() {
$( "#eventResizeWdhDialog" ).dialog({
@@ -381,13 +458,31 @@ var dayClick = false;
revertFunc();
},
"Resize just this Event": function() {
+ if(returndata.withoutrepeat == -1) {
$(this).dialog("close");
$.post("/event/eventresize/evid/" + event.id + "/evend/" + event.end + "/poolID/" + $("#poolselectbox option:selected").val());
- event.repeat = 0;
+ //event.repeat = 0;
+ } else {
+ $(this).dialog("close");
+ cell.removeChild(cell.firstChild);
+ cfcell.removeChild(cfcell.firstChild);
+ $("#cfevents").append(returndata.cfplotwithoutrepeat);
+ $("#conflicts").append(returndata.withoutrepeat);
+ $( "#eventNotDroppableDialog" ).dialog('open');
+ }
},
- "Resize all Events": function() {
+ "Resize all Events": function() {
+ if(returndata.withrepeat == -1) {
$(this).dialog("close");
- self.location="/event/eventresizeall/eventTitle/" + event.title + "/evmindelta/" + minuteDelta + "/poolID/" + $("#poolselectbox option:selected").val();
+ self.location="/event/eventresizeall/eventTitle/" + event.title + "/evmindelta/" + minuteDelta + "/poolID/" + $("#poolselectbox option:selected").val();
+ } else {
+ $(this).dialog("close");
+ cell.removeChild(cell.firstChild);
+ cfcell.removeChild(cfcell.firstChild);
+ $("#cfevents").append(returndata.cfplotwithrepeat);
+ $("#conflicts").append(returndata.withrepeat);
+ $( "#eventNotDroppableDialog" ).dialog('open');
+ }
}
},
open: function () {
@@ -403,10 +498,22 @@ var dayClick = false;
revertFunc();
$( "#errorRightsDialog" ).dialog('open');
}
+ });
+ $(this).qtip("destroy");
},
eventDrop: function( event, dayDelta, minuteDelta, allDay, revertFunc ) {
+ $.get("/event/checkoverlapdrop/poolID/" + $("#poolselectbox option:selected").val() + "/eventID/" + event.id + "/date/" + event.start, function(data){
+
+ // get conflicts-HTML Element
+ var cell = document.getElementById("conflicts");
+ var cfcell = document.getElementById("cfevents");
+ // get conflicts
+ var returndata = jQuery.parseJSON(data);
+ // get conflict free events with repeat
+ var cfevents = returndata.cfevents;
+
//initialize eventNotDroppableDialog Dialog
$(function() {
$( "#eventNotDroppableDialog" ).dialog({
@@ -415,25 +522,23 @@ var dayClick = false;
modal: true,
title: 'Dropping of ' + event.title + ' is not possible!',
buttons: {
+ "Resolve Conflicts": function() {
+ $(this).dialog("close");
+ $.post("/event/eventmovecf/evmindelta/" + minuteDelta + "/evdaydelta/" + dayDelta + "/poolID/" + $("#poolselectbox option:selected").val() + "/cfevents/" + cfevents);
+ },
"OK": function() {
$(this).dialog("close");
revertFunc();
}
},
open: function () {
- $("#accordion").accordion({clearStyle: true, collapsible: true, active: 1, autoHeight: true });
+ $("#accordion").accordion({clearStyle: true, collapsible: true, active: false, autoHeight: true });
$(".ui-dialog-titlebar-close").hide();
$(this).parents(".ui-dialog:first").find(".ui-dialog-titlebar").addClass("ui-state-error");
}
});
});
- $.get("/event/checkoverlapevents/eventID/" + event.id + "/date/" + event.start, function(data){
- // delete old conflicts
- var cell = document.getElementById("conflicts");
-
- var returndata = jQuery.parseJSON(data);
-
if(event.repeat == 0 && event.immediate == 0 && $.get("/event/checkright/rightShortcut/er")) {
$(function() {
$( "#defaultDialog" ).dialog({
@@ -481,23 +586,27 @@ var dayClick = false;
if(returndata.withoutrepeat == -1) {
$(this).dialog("close");
$.post("/event/eventmove/evid/" + event.id + "/evstart/" + event.start + "/evend/" + event.end);
- event.repeat = 0;
+ //event.repeat = 0;
} else {
$(this).dialog("close");
cell.removeChild(cell.firstChild);
+ cfcell.removeChild(cfcell.firstChild);
+ $("#cfevents").append(returndata.cfplotwithoutrepeat);
$("#conflicts").append(returndata.withoutrepeat);
- $( "#eventNotDroppableDialog" ).dialog('open');
+ $( "#eventNotDroppableDialog" ).dialog('open');
}
},
"Move all Events": function() {
- if(returndata.witrepeat == -1) {
+ if(returndata.withrepeat == -1) {
$(this).dialog("close");
self.location="/event/eventmoveall/eventTitle/" + event.title + "/evmindelta/" + minuteDelta + "/evdaydelta/" + dayDelta + "/poolID/" + $("#poolselectbox option:selected").val();
} else {
$(this).dialog("close");
cell.removeChild(cell.firstChild);
+ cfcell.removeChild(cfcell.firstChild);
+ $("#cfevents").append(returndata.cfplotwithrepeat);
$("#conflicts").append(returndata.withrepeat);
- $( "#eventNotDroppableDialog" ).dialog('open');
+ $( "#eventNotDroppableDialog" ).dialog('open');
}
}
},
@@ -540,24 +649,29 @@ var dayClick = false;
$( "#errorRightsDialog" ).dialog('open');
}
},
-
- eventDragStop: function(event, jsEvent, ui, view, date) {
- /*
- overlapevents = $.get("/event/checkoverlapevents/eventID/" + event.id + "/date/" + date, function(checkoverlapeventsresult){
- $("#conflicts").append(checkoverlapeventsresult);});
- if(overlapevents != '<p>no overlapping events</p>') {
- isDroppable = false;
- } else {
- isDroppable = true;
- overlapevents = null;
- }
- */
- },
eventRender: function(event, element, view) {
-
-
- // disable resizing if the event is a boot- or shutdown-event
+
+ // add running icons and handle editing of events
+ if(event.running == 0) {
+ // event will take place soon
+ element.addClass("fc-event-time-0");
+ //$('.fc-event-time').css('background','url(/media/img/down.png) top right no-repeat');
+ } else if(event.running == 1) {
+ // event is running
+ element.addClass("fc-event-time-1");
+ event.editable = false;
+ } else if(event.running == 2) {
+ // event successfully
+ element.addClass("fc-event-time-2");
+ event.editable = false;
+ } else if(event.running == 3) {
+ // event failed
+ element.addClass("fc-event-time-3");
+ event.editable = false;
+ }
+
+ // disable resizing if the event is a boot- or shutdown-event
if(event.category == 'Boot' || event.category == 'Shutdown') {
element.resizable(false); // calendar resizing
element.resizable("destroy"); // jqeury resizing
@@ -586,16 +700,6 @@ var dayClick = false;
element.find('.fc-event-title').append("<br/> Type: " + event.category + "<br/> Note: " + event.note + "<br/> Participants: " + event.participants);
}
},
-
- viewDisplay: function(view) {
-
- if (view.name == 'agendaWeek')
- {
- }
- if (view.name == 'agendaDay')
- {
- }
- }
});
@@ -861,6 +965,9 @@ selected one?</p>
<h3><a href="#">Show conflicts</a></h3>
<div id="conflicts">
</div>
+ <h3><a href="#">Show conflict-free Events</a></h3>
+ <div id="cfevents">
+ </div>
</div>
</div>
diff --git a/public/media/css/fullcalendar.css b/public/media/css/fullcalendar.css
index 8188bbf..ac2feee 100755
--- a/public/media/css/fullcalendar.css
+++ b/public/media/css/fullcalendar.css
@@ -294,12 +294,32 @@ a.fc-event {
border-width: 2px;
overflow: hidden;
}
-
+
.fc-event-time,
.fc-event-title {
padding: 0 1px;
}
+.fc-event-time-0 {
+ padding: 0 1px;
+ background: url(/media/img/down.png) top right no-repeat;
+ }
+
+.fc-event-time-1 {
+ padding: 0 1px;
+ background: url(/media/img/play.gif) top right no-repeat;
+ }
+
+.fc-event-time-2 {
+ padding: 0 1px;
+ background: url(/media/img/default.png) top right no-repeat;
+ }
+
+.fc-event-time-3 {
+ padding: 0 1px;
+ background: url(/media/img/delete.png) top right no-repeat;
+ }
+
.fc .ui-resizable-handle { /*** TODO: don't use ui-resizable anymore, change class ***/
display: block;
position: absolute;