summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Wagner2011-09-10 13:26:08 +0200
committerSebastian Wagner2011-09-10 13:26:08 +0200
commit2f6a33ec013eaf3b90df872f187d8f3d8724aff7 (patch)
tree00e120735b4f2025560a166a34c9ccbf22c2fe76
parentfix (diff)
downloadpoolctrl-2f6a33ec013eaf3b90df872f187d8f3d8724aff7.tar.gz
poolctrl-2f6a33ec013eaf3b90df872f187d8f3d8724aff7.tar.xz
poolctrl-2f6a33ec013eaf3b90df872f187d8f3d8724aff7.zip
add dialogs, eventTitle not unique
-rw-r--r--application/views/scripts/event/index.phtml236
-rw-r--r--setup/poolctrl.sql2
2 files changed, 168 insertions, 70 deletions
diff --git a/application/views/scripts/event/index.phtml b/application/views/scripts/event/index.phtml
index cea191e..cc5d899 100644
--- a/application/views/scripts/event/index.phtml
+++ b/application/views/scripts/event/index.phtml
@@ -29,32 +29,6 @@ var selectedEvent = null; // keydown variable
eventColor.color = event.borderColor;
event.borderColor = 'black';
$('#calendar').fullCalendar("rerenderEvents");
-
- // dialog for deleting wdhEvents
- $(function() {
- $( "#deleteWdhEventDialog" ).dialog({
- autoOpen: false,
- width: 600,
- modal: true,
- title: 'Delete ' + selectedEvent.title,
- buttons: {
- "Cancel": function() {
- $(this).dialog("close");
- },
- "Delete just this Event": function() {
- $(this).dialog("close");
- $("form:eq(1)").submit();
- },
- "Delete all Events": function() {
- $(this).dialog("close");
- $("form:eq(2)").submit();
- }
- },
- open: function () {
- //$(this).parents(".ui-dialog:first").find(".ui-dialog-titlebar").addClass("ui-state-error");
- }
- });
- });
}
// change view to addEvent
@@ -98,13 +72,57 @@ var selectedEvent = null; // keydown variable
$(document).keydown(function (e) {
if (e.keyCode == 8 || e.keyCode == 46 && selectedEvent.selected == true) {
if(selectedEvent.repeat == 0) {
- if (confirm("Are you sure to delete " + selectedEvent.title + " ?")) {
- self.location="/event/delete/eventID/" + selectedEvent.id;
- $('#calendar').fullCalendar( 'removeEvents', selectedEvent.id );
- $('#calendar').fullCalendar( 'rerenderEvents' );
- }
- }else $( "#deleteWdhEventDialog" ).dialog('open'); {
- }
+ // dialog for deleting selected event
+ $(function() {
+ $( "#eventDeleteDialog" ).dialog({
+ autoOpen: false,
+ width: 600,
+ modal: true,
+ title: "Delete " + selectedEvent.title,
+ buttons: {
+ "Cancel": function() {
+ $(this).dialog("close");
+ },
+ "OK": function() {
+ $(this).dialog("close");
+ self.location="/event/delete/eventID/" + selectedEvent.id;
+ $('#calendar').fullCalendar( 'removeEvents', selectedEvent.id );
+ $('#calendar').fullCalendar( 'rerenderEvents' );
+ }
+ },
+ open: function () {
+ //$(this).parents(".ui-dialog:first").find(".ui-dialog-titlebar").addClass("ui-state-error");
+ }
+ });
+ });
+ $( "#eventDeleteDialog" ).dialog('open');
+
+ // dialog for deleting delected wdhEvent
+ }else {
+ $(function() {
+ $( "#eventDeleteWdhDialog" ).dialog({
+ autoOpen: false,
+ width: 600,
+ modal: true,
+ title: 'Delete ' + selectedEvent.title,
+ buttons: {
+ "Cancel": function() {
+ $(this).dialog("close");
+ },
+ "Delete just this Event": function() {
+ $(this).dialog("close");
+ self.location="/event/delete/eventID/" + selectedEvent.id;
+ },
+ "Delete all Events": function() {
+ $(this).dialog("close");
+ }
+ },
+ open: function () {
+ //$(this).parents(".ui-dialog:first").find(".ui-dialog-titlebar").addClass("ui-state-error");
+ }
+ });
+ });
+ $( "#eventDeleteWdhDialog" ).dialog('open');}
}
});
@@ -166,26 +184,103 @@ var selectedEvent = null; // keydown variable
select: function( startDate, endDate, allDay, jsEvent, view ) {
- if (!confirm("Are you sure to add an Event from " + startDate + " to " + endDate + " ?")) {
- $('#calendar').fullCalendar( 'unselect' );
- }else {
- self.location="/event/add/evstart/" + startDate + "/evend/" + endDate;
- }
+ $(function() {
+ $( "#eventAddDialog" ).dialog({
+ autoOpen: false,
+ width: 600,
+ modal: true,
+ title: "Add Event from " + startDate + " to " + endDate,
+ buttons: {
+ "Cancel": function() {
+ $(this).dialog("close");
+ $('#calendar').fullCalendar( 'unselect' );
+ },
+ "OK": function() {
+ $(this).dialog("close");
+ self.location="/event/add/evstart/" + startDate + "/evend/" + endDate;
+ }
+ },
+ open: function () {
+ //$(this).parents(".ui-dialog:first").find(".ui-dialog-titlebar").addClass("ui-state-error");
+ }
+ });
+ });
+ $( "#eventAddDialog" ).dialog('open');
},
eventResize: function( event, dayDelta, minuteDelta, revertFunc ) {
-
- if (minuteDelta > 0) { length = 'longer';
- }else{ length = 'shorter'; }
-
- if (!confirm( event.title + " is now " + minuteDelta + " minutes " + length + ".\n\n" + "Are you sure about this change?")) {
- revertFunc();
- }else{
- if (event.category == 'Boot' ) {revertFunc(); alert("You can´t change the EndTime of a BootEvent!");}
- else if (event.category == 'Shutdown' ) {revertFunc(); alert("You can´t change the EndTime of a ShutdownEvent!");}
- else $.post("/event/eventresize/evid/" + event.id + "/evend/" + event.end);
- }
+ if (minuteDelta > 0) { length = 'longer';
+ }else{ length = 'shorter'; }
+
+ $(function() {
+ $( "#defaultDialog" ).dialog({
+ autoOpen: false,
+ width: 600,
+ modal: true,
+ title: event.title + " is now " + minuteDelta + " minutes " + length,
+ buttons: {
+ "Cancel": function() {
+ $(this).dialog("close");
+ revertFunc();
+ },
+ "OK": function() {
+ $(this).dialog("close");
+ if (event.category == 'Boot' ) {
+ revertFunc();
+ // ERROR! initialize eventResizeBootDialog
+ $(function() {
+ $( "#eventResizeBootDialog" ).dialog({
+ autoOpen: false,
+ width: 600,
+ modal: true,
+ title: "Try to resize " + event.title + " !",
+ buttons: {
+ "OK": function() {
+ $(this).dialog("close");
+ revertFunc();
+ }
+ },
+ open: function () {
+ $(this).parents(".ui-dialog:first").find(".ui-dialog-titlebar").addClass("ui-state-error");
+ }
+ });
+ });
+ $( "#eventResizeBootDialog" ).dialog('open');
+ }
+ else if (event.category == 'Shutdown' ) {
+ revertFunc();
+ // ERROR initialize eventResizeShutdownDialog
+ $(function() {
+ $( "#eventResizeShutdownDialog" ).dialog({
+ autoOpen: false,
+ width: 600,
+ modal: true,
+ title: "Try to resize " + event.title + " !",
+ buttons: {
+ "OK": function() {
+ $(this).dialog("close");
+ revertFunc();
+ }
+ },
+ open: function () {
+ $(this).parents(".ui-dialog:first").find(".ui-dialog-titlebar").addClass("ui-state-error");
+ }
+ });
+ });
+ $( "#eventResizeShutdownDialog" ).dialog('open');
+
+ }
+ // the event is no boot- or shutdown-Event, apply the changes
+ else $.post("/event/eventresize/evid/" + event.id + "/evend/" + event.end);
+ }
+ },
+ open: function () {
+ //$(this).parents(".ui-dialog:first").find(".ui-dialog-titlebar").addClass("ui-state-error");
+ }
+ });
+ });
+ $( "#defaultDialog" ).dialog('open');
},
eventDrop: function( event, dayDelta, minuteDelta, allDay, revertFunc ) {
@@ -199,10 +294,11 @@ var selectedEvent = null; // keydown variable
buttons: {
"Cancel": function() {
$(this).dialog("close");
+ revertFunc();
},
"OK": function() {
$(this).dialog("close");
- $("form:eq(1)").submit();
+ $.post("/event/eventmove/evid/" + event.id + "/evstart/" + event.start + "/evend/" + event.end);
}
},
open: function () {
@@ -210,13 +306,7 @@ var selectedEvent = null; // keydown variable
}
});
});
- //$( "#defaultDialog" ).dialog('open');
- if (!confirm(event.title + " was moved to " + event.start + "\n\n" + "Are you sure about this change?")) {
- revertFunc();
- }else{
- $.post("/event/eventmove/evid/" + event.id + "/evstart/" + event.start + "/evend/" + event.end);
- }
-
+ $( "#defaultDialog" ).dialog('open');
},
@@ -310,34 +400,42 @@ var selectedEvent = null; // keydown variable
</script>
-<!-- DIALOG WINDOWS -->
+<!-- DIALOG WINDOWS -->
<!-- delete wdhEvent -->
-<div id="deleteWdhEventDialog" style="display:none">
- <p>Do you want to delete any event occurring this event or just the selected?</p>
+<div id="eventDeleteWdhDialog" style="display: none">
+<p>This is a Wdh-Event!</p>
+<p>Do you want to delete any event occurring this event or just the
+selected?</p>
+</div>
+
+<!-- eventDelete -->
+<div id="eventDeleteDialog" style="display: none">
+<p>Are you sure to delete this Event?</p>
</div>
-<!-- eventSelect -->
-<div id="eventSelectDialog" style="display:none">
- <p>Are you sure to add this Event?</p>
+<!-- eventAdd -->
+<div id="eventAddDialog" style="display: none">
+<p>Are you sure to add this Event?</p>
</div>
<!-- eventResize boot -->
-<div id="eventResizeBootDialog" style="display:none">
- <p>You can´t change the EndTime of a Boot Event!</p>
+<div id="eventResizeBootDialog" style="display: none">
+<p>You can´t change the EndTime of a Boot Event!</p>
</div>
<!-- eventResize shutdown -->
-<div id="eventResizeShutdownDialog" style="display:none">
- <p>You can´t change the EndTime of a Shutdown Event!</p>
+<div id="eventResizeShutdownDialog" style="display: none">
+<p>You can´t change the EndTime of a Shutdown Event!</p>
</div>
<!-- default -->
-<div id="defaultDialog" style="display:none">
- <p>Are you sure about this change?</p>
+<div id="defaultDialog" style="display: none">
+<p>Are you sure about this change?</p>
</div>
+
<br />
<br />
<div class='listelement'><?php
diff --git a/setup/poolctrl.sql b/setup/poolctrl.sql
index 199f692..a11b4b4 100644
--- a/setup/poolctrl.sql
+++ b/setup/poolctrl.sql
@@ -6,7 +6,7 @@ SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
CREATE TABLE IF NOT EXISTS `poolctrl_event` (
`eventID` int(11) NOT NULL AUTO_INCREMENT,
- `title` varchar(30) COLLATE utf8_unicode_ci NOT NULL UNIQUE,
+ `title` varchar(30) COLLATE utf8_unicode_ci NOT NULL,
`start` timestamp COLLATE utf8_unicode_ci NOT NULL DEFAULT CURRENT_TIMESTAMP(),
`end` timestamp COLLATE utf8_unicode_ci NULL,
`participants` int(4) DEFAULT NULL,