summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Wagner2011-09-15 15:48:31 +0200
committerSebastian Wagner2011-09-15 15:48:31 +0200
commitf3fbfa9c32f00bab3e1393e680c76f51314d2db9 (patch)
tree468c7dc5653442066277d17af9f2d784dc7f2582
parentsome bug fixes (diff)
downloadpoolctrl-f3fbfa9c32f00bab3e1393e680c76f51314d2db9.tar.gz
poolctrl-f3fbfa9c32f00bab3e1393e680c76f51314d2db9.tar.xz
poolctrl-f3fbfa9c32f00bab3e1393e680c76f51314d2db9.zip
rights implemented
-rwxr-xr-xapplication/views/scripts/event/index.phtml153
1 files changed, 73 insertions, 80 deletions
diff --git a/application/views/scripts/event/index.phtml b/application/views/scripts/event/index.phtml
index e06e793..3c9fc2b 100755
--- a/application/views/scripts/event/index.phtml
+++ b/application/views/scripts/event/index.phtml
@@ -46,13 +46,13 @@ var poolIDtmp;
$('#calendar').fullCalendar("rerenderEvents");
if($.get("/event/checkright/rightShortcut/er")){
$('#eventReportButton').show();
- } else $('#eventReportButton').hide();
+ } else {$('#eventReportButton').hide();}
}
// change view to addEvent
function addEvent() {
if($("#poolselectbox option:selected").val() == 'default') {
- $( "#noPoolSelectedDialog" ).dialog('open');
+ $("#noPoolSelectedDialog").dialog('open');
} else {
self.location="/event/add/";}
}
@@ -65,7 +65,6 @@ var poolIDtmp;
$("#calendar").hide();
}
-
function setOpacity(type, value) {
var events = $('#calendar').fullCalendar( 'clientEvents' , function(event) {
if(event.category == type) {
@@ -98,7 +97,7 @@ var poolIDtmp;
$(document).keydown(function (e) {
//delete selected event by key del(8) OR entf(46)
- if (e.keyCode == 8 || e.keyCode == 46 && selectedEvent.selected == true) {
+ if (e.keyCode == 8 || e.keyCode == 46 && selectedEvent.selected == true, $.get("/event/checkright/rightShortcut/er")) {
// check if the event is an wdhEvent
if(selectedEvent.repeat == 0) {
// dialog for deleting selected event
@@ -223,9 +222,11 @@ var poolIDtmp;
} else {
// this is the dblclick
$(this).qtip("destroy");
- if(event.immediate == 0) {
+ if(event.immediate == 0 && $.get("/event/checkright/rightShortcut/er")) {
self.location = "/event/edit/eventID/" + event.id + "/poolID/" + $("#poolselectbox option:selected").val();
- }
+ } else {
+ $( "#errorRightsDialog" ).dialog('open');
+ }
}
},
@@ -233,7 +234,7 @@ var poolIDtmp;
if($("#poolselectbox option:selected").val() == 'default') {
$( "#noPoolSelectedDialog" ).dialog('open');
- } else {
+ } else if ($.get("/event/checkright/rightShortcut/ec")) {
$(function() {
$( "#eventAddDialog" ).dialog({
autoOpen: false,
@@ -257,13 +258,15 @@ var poolIDtmp;
});
});
$( "#eventAddDialog" ).dialog('open');
- $(this).qtip("destroy");
- }
- $(this).qtip("destroy");
+ } else {
+ $('#calendar').fullCalendar( 'unselect' );
+ $( "#errorRightsDialog" ).dialog('open');
+ }
},
eventResize: function( event, dayDelta, minuteDelta, revertFunc ) {
-
+ $(this).qtip("destroy");
+ if($.get("/event/checkright/rightShortcut/er")) {
$(function() {
$( "#defaultDialog" ).dialog({
autoOpen: false,
@@ -276,56 +279,8 @@ var poolIDtmp;
revertFunc();
},
"OK": function() {
- $(this).dialog("close");
- if (event.category == 'Boot' ) {
- revertFunc();
- // ERROR! initialize eventResizeBootDialog
- $(function() {
- $( "#eventResizeBootDialog" ).dialog({
- autoOpen: false,
- width: 600,
- modal: true,
- title: "ERROR: Try to resize " + event.title,
- buttons: {
- "OK": function() {
- $(this).dialog("close");
- revertFunc();
- }
- },
- open: function () {
- $(".ui-dialog-titlebar-close").hide();
- $(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: "ERROR: Try to resize " + event.title,
- buttons: {
- "OK": function() {
- $(this).dialog("close");
- revertFunc();
- }
- },
- open: function () {
- $(".ui-dialog-titlebar-close").hide();
- $(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 + "/poolID/" + $("#poolselectbox option:selected").val());
+ $(this).dialog("close");
+ $.post("/event/eventresize/evid/" + event.id + "/evend/" + event.end + "/poolID/" + $("#poolselectbox option:selected").val());
}
},
open: function () {
@@ -336,13 +291,17 @@ var poolIDtmp;
});
$( "#defaultDialog" ).dialog('open');
$(this).qtip("destroy");
+ } else {
+ revertFunc();
+ $( "#errorRightsDialog" ).dialog('open');
+ }
},
eventDrop: function( event, dayDelta, minuteDelta, allDay, revertFunc ) {
- //alert(event.start - minuteDelta);
+ //alert(event.start - minuteDelta);
- if(event.repeat == 0 && isDroppable && event.immediate == 0) {
+ if(event.repeat == 0 && isDroppable && event.immediate == 0 && $.get("/event/checkright/rightShortcut/er")) {
$(function() {
$( "#defaultDialog" ).dialog({
autoOpen: false,
@@ -367,7 +326,7 @@ var poolIDtmp;
});
$( "#defaultDialog" ).dialog('open');
$(this).qtip("destroy");
- } else if (isDroppable && event.immediate == 0) {
+ } else if (isDroppable && event.immediate == 0 && $.get("/event/checkright/rightShortcut/er")) {
$(function() {
$( "#eventMoveWdhDialog" ).dialog({
autoOpen: false,
@@ -395,7 +354,7 @@ var poolIDtmp;
});
$( "#eventMoveWdhDialog" ).dialog('open');
$(this).qtip("destroy");
- } else {
+ } else if ($.get("/event/checkright/rightShortcut/er")){
$(function() {
$( "#eventImmediateButtonDialog" ).dialog({
autoOpen: false,
@@ -416,9 +375,18 @@ var poolIDtmp;
$("#eventImmediateButtonDialog").dialog('open');
$(this).qtip("destroy");
revertFunc();
- }
+ } else {
+ revertFunc();
+ $(this).qtip("destroy");
+ }
$(this).qtip("destroy");
},
+
+ eventDragStart: function( event, jsEvent, ui, view ) {
+ if(!$.get("/event/checkright/rightShortcut/er")) {
+ $( "#errorRightsDialog" ).dialog('open');
+ }
+ },
eventDragStop: function(event, jsEvent, ui, view) {
/*
@@ -483,7 +451,7 @@ var poolIDtmp;
$('.fc-header-left').append('<form name="PoolSelectForm"><select id="poolselectbox" name="PoolSelectbox" onclick="setPoolIDtmp()" onChange="fetchPoolEvents();"><option value="default" >Please choose a Pool</option></select></form>');
// Add Button
- $('.fc-header-right').append('<span id="addEvent" class="fc-button fc-state-default fc-state-hover"><span class="fc-button-inner"><span class="fc-button-content">Add Event</span><span class="fc-button-effect"><span></span></span></span></span>');
+ $('.fc-header-right').append('<span id="addEvent" class="fc-button fc-state-default fc-state-hover"><span class="fc-button-inner"><span class="fc-button-content">Add</span><span class="fc-button-effect"><span></span></span></span></span>');
// EventReport Button
$('.fc-header-center').append('<span id="eventReportButton" style=display:none class="fc-button fc-state-default fc-state-hover"><span class="fc-button-inner"><span class="fc-button-content">Report</span><span class="fc-button-effect"><span></span></span></span></span>');
@@ -559,8 +527,36 @@ var poolIDtmp;
}
});
- // initialize noPoolSelectedDialog
- $(function() {
+ //fetch poollist from pbs database
+ $.get("/event/getpoollist/", function(getpoollistresult){
+ $("#poolselectbox").append(getpoollistresult);
+ poolIDtmp = $("#poolselectbox option:selected").val();
+ fetchPoolEvents();
+ });
+
+}
+
+// initialize errorRightsDialog
+ $(function() {
+ $( "#errorRightsDialog" ).dialog({
+ autoOpen: false,
+ width: 600,
+ modal: true,
+ title: "ERROR",
+ buttons: {
+ "OK": function() {
+ $(this).dialog("close");
+ }
+ },
+ open: function () {
+ $(".ui-dialog-titlebar-close").hide();
+ $(this).parents(".ui-dialog:first").find(".ui-dialog-titlebar").addClass("ui-state-error");
+ }
+ });
+ });
+
+// initialize noPoolSelectedDialog
+ $(function() {
$( "#noPoolSelectedDialog" ).dialog({
autoOpen: false,
width: 600,
@@ -572,20 +568,12 @@ var poolIDtmp;
}
},
open: function () {
- $(".ui-dialog-titlebar-close").hide();
+ $(".ui-dialog-titlebar-close").hide();
$(this).parents(".ui-dialog:first").find(".ui-dialog-titlebar").addClass("ui-state-error");
}
});
});
-
- //fetch poollist from pbs database
- $.get("/event/getpoollist/", function(getpoollistresult){
- $("#poolselectbox").append(getpoollistresult);
- poolIDtmp = $("#poolselectbox option:selected").val();
- fetchPoolEvents();
- });
-
-}
+
@@ -638,6 +626,11 @@ selected one?</p>
<p>You canĀ“t change the EndTime of a Shutdown Event!</p>
</div>
+<!-- errorRights -->
+<div id="errorRightsDialog" style="display: none">
+<p>Permission denied!</p>
+</div>
+
<!-- no pool selected -->
<div id="noPoolSelectedDialog" style="display: none">
<p>Please choose a Pool first!</p>
@@ -646,4 +639,4 @@ selected one?</p>
<!-- default -->
<div id="defaultDialog" style="display: none">
<p>Are you sure about this change?</p>
-</div>
+</div> \ No newline at end of file