CC-3803 : Don't allow editing of a current Record show
This commit is contained in:
parent
438bc93133
commit
428b13f3d7
3 changed files with 37 additions and 51 deletions
|
@ -272,47 +272,25 @@ class ScheduleController extends Zend_Controller_Action
|
|||
}
|
||||
|
||||
if ($showStartLocalDT->getTimestamp() <= $epochNow &&
|
||||
$epochNow < $showEndLocalDT->getTimestamp() &&
|
||||
($isAdminOrPM || $isDJ)) {
|
||||
$epochNow < $showEndLocalDT->getTimestamp() && $isAdminOrPM) {
|
||||
|
||||
if ($instance->isRecorded()) {
|
||||
if($isAdminOrPM){
|
||||
$menu["cancel_recorded"] = array("name"=> "Cancel Current Show", "icon" => "delete");
|
||||
}
|
||||
} else {
|
||||
if($instance->isRepeating()){
|
||||
/*$menu["edit"] = array("name"=> "Edit", "icon" => "edit", "items" => array());
|
||||
$menu["edit"]["items"]["instance"] = array("name"=> "Edit Show Instance", "icon" => "edit", "url" => "/Schedule/populate-show-instance-form");
|
||||
$menu["edit"]["items"]["all"] = array("name"=> "Edit Show", "icon" => "edit", "url" => "/Schedule/populate-show-form");*/
|
||||
$menu["edit"] = array("name"=> "Edit Show", "icon" => "edit", "_type"=>"all", "url" => "/Schedule/populate-show-form");
|
||||
}else{
|
||||
if($instance->isRebroadcast()){
|
||||
$menu["edit"] = array("name"=> "Edit Show", "icon" => "edit", "_type"=>"rebroadcast", "url" => "/Schedule/populate-show-form");
|
||||
}else{
|
||||
else {
|
||||
|
||||
if (!$instance->isRebroadcast()) {
|
||||
$menu["edit"] = array("name"=> "Edit Show", "icon" => "edit", "_type"=>"all", "url" => "/Schedule/populate-show-form");
|
||||
}
|
||||
}
|
||||
if($isAdminOrPM){
|
||||
|
||||
$menu["cancel"] = array("name"=> "Cancel Current Show", "icon" => "delete");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($epochNow < $showStartLocalDT->getTimestamp()) {
|
||||
|
||||
if ($isAdminOrPM || $isDJ) {
|
||||
|
||||
if($instance->isRepeating()){
|
||||
/*$menu["edit"] = array("name"=> "Edit", "icon" => "edit", "items" => array());
|
||||
$menu["edit"]["items"]["instance"] = array("name"=> "Edit Show Instance", "icon" => "edit", "url" => "/Schedule/populate-show-instance-form");
|
||||
$menu["edit"]["items"]["all"] = array("name"=> "Edit Show", "icon" => "edit", "url" => "/Schedule/populate-show-form");*/
|
||||
if (!$instance->isRebroadcast() && $isAdminOrPM) {
|
||||
$menu["edit"] = array("name"=> "Edit Show", "icon" => "edit", "_type"=>"all", "url" => "/Schedule/populate-show-form");
|
||||
}else{
|
||||
if($instance->isRebroadcast()){
|
||||
$menu["edit"] = array("name"=> "Edit Show", "icon" => "edit", "_type"=>"rebroadcast", "url" => "/Schedule/populate-show-form");
|
||||
}else{
|
||||
$menu["edit"] = array("name"=> "Edit Show", "icon" => "edit", "_type"=>"all", "url" => "/Schedule/populate-show-form");
|
||||
}
|
||||
}
|
||||
|
||||
if ($instance->getShow()->isRepeating() && $isAdminOrPM) {
|
||||
|
@ -324,12 +302,11 @@ class ScheduleController extends Zend_Controller_Action
|
|||
|
||||
$menu["del"]["items"]["following"] = array("name"=> "Delete This Instance and All Following", "icon" => "delete", "url" => "/schedule/cancel-show");
|
||||
}
|
||||
else if($isAdminOrPM){
|
||||
//window["scheduleRefetchEvents"]'
|
||||
else if ($isAdminOrPM){
|
||||
|
||||
$menu["del"] = array("name"=> "Delete", "icon" => "delete", "url" => "/schedule/delete-show");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->view->items = $menu;
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ class Application_Form_AddShowLiveStream extends Zend_Form_SubForm
|
|||
->setDecorators(array('ViewHelper'));
|
||||
$this->addElement($cb_airtime_auth);
|
||||
|
||||
$description2 = "Specify custom authentication which will work for only for this show.";
|
||||
$description2 = "Specify custom authentication which will work only for this show.";
|
||||
$cb_custom_auth = new Zend_Form_Element_Checkbox("cb_custom_auth");
|
||||
$cb_custom_auth ->setLabel("Use Custom Authentication:")
|
||||
->setDescription($description2)
|
||||
|
|
|
@ -1484,32 +1484,34 @@ class Application_Model_Show {
|
|||
Application_Model_Preference::SetShowsPopulatedUntil($end_timestamp);
|
||||
}
|
||||
|
||||
$sql = "SELECT starts, ends, record, rebroadcast, instance_id, show_id, name,
|
||||
color, background_color, file_id, cc_show_instances.id AS instance_id,
|
||||
created, last_scheduled, time_filled
|
||||
FROM cc_show_instances
|
||||
LEFT JOIN cc_show ON cc_show.id = cc_show_instances.show_id
|
||||
WHERE cc_show_instances.modified_instance = FALSE";
|
||||
$sql = "SELECT si1.starts AS starts, si1.ends AS ends, si1.record AS record, si1.rebroadcast AS rebroadcast, si2.starts AS parent_starts,
|
||||
si1.instance_id AS record_id, si1.show_id AS show_id, show.name AS name,
|
||||
show.color AS color, show.background_color AS background_color, si1.file_id AS file_id, si1.id AS instance_id,
|
||||
si1.created AS created, si1.last_scheduled AS last_scheduled, si1.time_filled AS time_filled
|
||||
FROM cc_show_instances AS si1
|
||||
LEFT JOIN cc_show_instances AS si2 ON si1.instance_id = si2.id
|
||||
LEFT JOIN cc_show AS show ON show.id = si1.show_id
|
||||
WHERE si1.modified_instance = FALSE";
|
||||
|
||||
//only want shows that are starting at the time or later.
|
||||
$start_string = $start_timestamp->format("Y-m-d H:i:s");
|
||||
$end_string = $end_timestamp->format("Y-m-d H:i:s");
|
||||
if ($onlyRecord) {
|
||||
|
||||
$sql = $sql." AND (starts >= '{$start_string}' AND starts < timestamp '{$end_string}')";
|
||||
$sql = $sql." AND (record = 1)";
|
||||
$sql = $sql." AND (si1.starts >= '{$start_string}' AND si1.starts < timestamp '{$end_string}')";
|
||||
$sql = $sql." AND (si1.record = 1)";
|
||||
}
|
||||
else {
|
||||
|
||||
$sql = $sql." AND ((starts >= '{$start_string}' AND starts < '{$end_string}')
|
||||
OR (ends > '{$start_string}' AND ends <= '{$end_string}')
|
||||
OR (starts <= '{$start_string}' AND ends >= '{$end_string}'))";
|
||||
$sql = $sql." AND ((si1.starts >= '{$start_string}' AND si1.starts < '{$end_string}')
|
||||
OR (si1.ends > '{$start_string}' AND si1.ends <= '{$end_string}')
|
||||
OR (si1.starts <= '{$start_string}' AND si1.ends >= '{$end_string}'))";
|
||||
}
|
||||
|
||||
|
||||
if (isset($excludeInstance)) {
|
||||
foreach($excludeInstance as $instance) {
|
||||
$sql_exclude[] = "cc_show_instances.id != {$instance}";
|
||||
$sql_exclude[] = "si1.id != {$instance}";
|
||||
}
|
||||
|
||||
$exclude = join(" OR ", $sql_exclude);
|
||||
|
@ -1517,8 +1519,8 @@ class Application_Model_Show {
|
|||
$sql = $sql." AND ({$exclude})";
|
||||
}
|
||||
|
||||
//Logging::log("getShows");
|
||||
//Logging::log($sql);
|
||||
Logging::debug("getShows");
|
||||
Logging::debug($sql);
|
||||
$result = $con->query($sql)->fetchAll();
|
||||
return $result;
|
||||
}
|
||||
|
@ -1594,13 +1596,20 @@ class Application_Model_Show {
|
|||
$options["percent"] = Application_Model_Show::getPercentScheduled($show["starts"], $show["ends"], $show["time_filled"]);
|
||||
}
|
||||
|
||||
if (isset($show["parent_starts"])) {
|
||||
$parentStartsDT = new DateTime($show["parent_starts"], new DateTimeZone("UTC"));
|
||||
$parentStartsEpoch = intval($parentStartsDT->format("U"));
|
||||
}
|
||||
$startsDT = new DateTime($show["starts"], new DateTimeZone("UTC"));
|
||||
$endsDT = new DateTime($show["ends"], new DateTimeZone("UTC"));
|
||||
|
||||
$startsEpoch = intval($startsDT->format("U"));
|
||||
$endsEpoch = intval($endsDT->format("U"));
|
||||
|
||||
if ($p_editable && $show["record"] && $nowEpoch < $endsEpoch) {
|
||||
if ($p_editable && $show["record"] && $nowEpoch > $startsEpoch) {
|
||||
$options["editable"] = false;
|
||||
}
|
||||
else if ($p_editable && $show["rebroadcast"] && $nowEpoch > $parentStartsEpoch) {
|
||||
$options["editable"] = false;
|
||||
}
|
||||
else if ($p_editable && $nowEpoch < $endsEpoch) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue