dbQuery("update Events set Name = '".dbEscape($_REQUEST['eventName'])."' where Id = '".dbEscape($_REQUEST['id'])."'");
}
else
{
$response['result']='Error';
$response['message']='No new event name supplied';
}
break;
}
case"eventdetail":
{
dbQuery("update Events set Cause = '".dbEscape($_REQUEST['newEvent']['Cause'])."', Notes = '".dbEscape($_REQUEST['newEvent']['Notes'])."' where Id = '".dbEscape($_REQUEST['id'])."'");
$refreshEvent=true;
$refreshParent=true;
break;
}
case"archive":
case"unarchive":
{
$archiveVal=($_REQUEST['action']=="archive")?1:0;
dbQuery("update Events set Archived = ".$archiveVal." where Id = '".dbEscape($_REQUEST['id'])."'");
$refreshEvent=true;
break;
}
case"delete":
{
deleteEvent(dbEscape($_REQUEST['id']));
break;
}
default:
{
$response['result']='Error';
break;
}
}
}
if(canView('Events'))
{
$response['result']='Ok';
switch($_REQUEST['action'])
{
case"video":
{
if(empty($_REQUEST['videoFormat']))
{
$response['result']='Error';
$response['message']="Video Generation Failure, no format given";
}
elseif(empty($_REQUEST['rate']))
{
$response['result']='Error';
$response['message']="Video Generation Failure, no rate given";
}
elseif(empty($_REQUEST['scale']))
{
$response['result']='Error';
$response['message']="Video Generation Failure, no scale given";
}
else
{
$sql="select E.*,M.Name as MonitorName,M.DefaultRate,M.DefaultScale from Events as E inner join Monitors as M on E.MonitorId = M.Id where E.Id = ".dbEscape($_REQUEST['id']).monitorLimitSql();