Merge branch 'devel' of dev.sourcefabric.org:airtime into devel
This commit is contained in:
commit
d959e4ff11
|
@ -257,8 +257,6 @@ class ShowbuilderController extends Zend_Controller_Action
|
||||||
|
|
||||||
public function builderFeedAction()
|
public function builderFeedAction()
|
||||||
{
|
{
|
||||||
$start = microtime(true);
|
|
||||||
|
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
$current_time = time();
|
$current_time = time();
|
||||||
|
|
||||||
|
@ -279,11 +277,6 @@ class ShowbuilderController extends Zend_Controller_Action
|
||||||
$this->view->schedule = $data["schedule"];
|
$this->view->schedule = $data["schedule"];
|
||||||
$this->view->instances = $data["showInstances"];
|
$this->view->instances = $data["showInstances"];
|
||||||
$this->view->timestamp = $current_time;
|
$this->view->timestamp = $current_time;
|
||||||
|
|
||||||
$end = microtime(true);
|
|
||||||
|
|
||||||
Logging::debug("getting builder feed info took:");
|
|
||||||
Logging::debug(floatval($end) - floatval($start));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function scheduleAddAction()
|
public function scheduleAddAction()
|
||||||
|
|
|
@ -101,7 +101,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
|
||||||
|
|
||||||
|
|
||||||
$spType = new Zend_Form_Element_Radio('sp_type');
|
$spType = new Zend_Form_Element_Radio('sp_type');
|
||||||
$spType->setLabel('Set smart block type:')
|
$spType->setLabel('Set smart playlist type:')
|
||||||
->setDecorators(array('viewHelper'))
|
->setDecorators(array('viewHelper'))
|
||||||
->setMultiOptions(array(
|
->setMultiOptions(array(
|
||||||
'static' => 'Static',
|
'static' => 'Static',
|
||||||
|
|
|
@ -256,59 +256,97 @@ class Application_Model_Schedule
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
global $CC_CONFIG;
|
||||||
$con = Propel::getConnection();
|
$con = Propel::getConnection();
|
||||||
$templateSql = "SELECT DISTINCT
|
|
||||||
|
|
||||||
showt.name AS show_name, showt.color AS show_color,
|
$templateSql = <<<SQL
|
||||||
showt.background_color AS show_background_color, showt.id AS show_id,
|
SELECT DISTINCT sched.starts AS sched_starts,
|
||||||
|
sched.ends AS sched_ends,
|
||||||
|
sched.id AS sched_id,
|
||||||
|
sched.cue_in AS cue_in,
|
||||||
|
sched.cue_out AS cue_out,
|
||||||
|
sched.fade_in AS fade_in,
|
||||||
|
sched.fade_out AS fade_out,
|
||||||
|
sched.playout_status AS playout_status,
|
||||||
|
sched.instance_id AS sched_instance_id,
|
||||||
|
|
||||||
|
%%columns%%
|
||||||
|
FROM (%%join%%)
|
||||||
|
SQL;
|
||||||
|
|
||||||
si.starts AS si_starts, si.ends AS si_ends, si.time_filled AS si_time_filled,
|
$filesColumns = <<<SQL
|
||||||
si.record AS si_record, si.rebroadcast AS si_rebroadcast, si.instance_id AS parent_show,
|
ft.track_title AS file_track_title,
|
||||||
si.id AS si_id, si.last_scheduled AS si_last_scheduled, si.file_id AS si_file_id,
|
ft.artist_name AS file_artist_name,
|
||||||
|
ft.album_title AS file_album_title,
|
||||||
|
ft.length AS file_length,
|
||||||
|
ft.file_exists AS file_exists
|
||||||
|
SQL;
|
||||||
|
$filesJoin = <<<SQL
|
||||||
|
cc_schedule AS sched
|
||||||
|
JOIN cc_files AS ft ON (sched.file_id = ft.id)
|
||||||
|
SQL;
|
||||||
|
|
||||||
sched.starts AS sched_starts, sched.ends AS sched_ends, sched.id AS sched_id,
|
|
||||||
sched.cue_in AS cue_in, sched.cue_out AS cue_out,
|
|
||||||
sched.fade_in AS fade_in, sched.fade_out AS fade_out,
|
|
||||||
sched.playout_status AS playout_status,
|
|
||||||
|
|
||||||
%%columns%%
|
|
||||||
|
|
||||||
FROM
|
|
||||||
((
|
|
||||||
%%join%%
|
|
||||||
|
|
||||||
JOIN cc_show AS showt ON (showt.id = si.show_id)
|
|
||||||
)
|
|
||||||
|
|
||||||
WHERE si.modified_instance = false AND
|
|
||||||
|
|
||||||
((si.starts >= '{$p_start}' AND si.starts < '{$p_end}')
|
|
||||||
OR (si.ends > '{$p_start}' AND si.ends <= '{$p_end}')
|
|
||||||
OR (si.starts <= '{$p_start}' AND si.ends >= '{$p_end}'))";
|
|
||||||
|
|
||||||
if (count($p_shows) > 0) {
|
|
||||||
$templateSql .= " AND show_id IN (".implode(",", $p_shows).")";
|
|
||||||
}
|
|
||||||
|
|
||||||
$filesSql = str_replace("%%columns%%",
|
$filesSql = str_replace("%%columns%%",
|
||||||
"ft.track_title AS file_track_title, ft.artist_name AS file_artist_name,
|
$filesColumns,
|
||||||
ft.album_title AS file_album_title, ft.length AS file_length, ft.file_exists AS file_exists",
|
|
||||||
$templateSql);
|
$templateSql);
|
||||||
$filesSql= str_replace("%%join%%",
|
$filesSql= str_replace("%%join%%",
|
||||||
"cc_schedule AS sched JOIN cc_files AS ft ON (sched.file_id = ft.id)
|
$filesJoin,
|
||||||
RIGHT JOIN cc_show_instances AS si ON (si.id = sched.instance_id))",
|
|
||||||
$filesSql);
|
$filesSql);
|
||||||
|
|
||||||
|
$streamColumns = <<<SQL
|
||||||
|
ws.name AS file_track_title,
|
||||||
|
sub.login AS file_artist_name,
|
||||||
|
ws.description AS file_album_title,
|
||||||
|
ws.length AS file_length,
|
||||||
|
't'::BOOL AS file_exists
|
||||||
|
SQL;
|
||||||
|
$streamJoin = <<<SQL
|
||||||
|
cc_schedule AS sched
|
||||||
|
JOIN cc_webstream AS ws ON (sched.stream_id = ws.id)
|
||||||
|
LEFT JOIN cc_subjs AS sub ON (ws.creator_id = sub.id)
|
||||||
|
SQL;
|
||||||
|
|
||||||
$streamSql = str_replace("%%columns%%",
|
$streamSql = str_replace("%%columns%%",
|
||||||
"ws.name AS file_track_title, sub.login AS file_artist_name,
|
$streamColumns,
|
||||||
ws.description AS file_album_title, ws.length AS file_length, 't'::BOOL AS file_exists",
|
|
||||||
$templateSql);
|
$templateSql);
|
||||||
$streamSql = str_replace("%%join%%",
|
$streamSql = str_replace("%%join%%",
|
||||||
"cc_schedule AS sched JOIN cc_webstream AS ws ON (sched.stream_id = ws.id)
|
$streamJoin,
|
||||||
JOIN cc_show_instances AS si ON (si.id = sched.instance_id))
|
|
||||||
LEFT JOIN cc_subjs AS sub ON (ws.creator_id = sub.id)",
|
|
||||||
$streamSql);
|
$streamSql);
|
||||||
|
|
||||||
$sql = "SELECT * FROM (($filesSql) UNION ($streamSql)) as temp ORDER BY si_starts, sched_starts";
|
|
||||||
|
$showPredicate = "";
|
||||||
|
if (count($p_shows) > 0) {
|
||||||
|
$showPredicate = " AND show_id IN (".implode(",", $p_shows).")";
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = <<<SQL
|
||||||
|
SELECT showt.name AS show_name,
|
||||||
|
showt.color AS show_color,
|
||||||
|
showt.background_color AS show_background_color,
|
||||||
|
showt.id AS show_id,
|
||||||
|
si.starts AS si_starts,
|
||||||
|
si.ends AS si_ends,
|
||||||
|
si.time_filled AS si_time_filled,
|
||||||
|
si.record AS si_record,
|
||||||
|
si.rebroadcast AS si_rebroadcast,
|
||||||
|
si.instance_id AS parent_show,
|
||||||
|
si.id AS si_id,
|
||||||
|
si.last_scheduled AS si_last_scheduled,
|
||||||
|
si.file_id AS si_file_id,
|
||||||
|
*
|
||||||
|
FROM (($filesSql) UNION ($streamSql)) as temp
|
||||||
|
RIGHT JOIN cc_show_instances AS si ON (si.id = sched_instance_id)
|
||||||
|
JOIN cc_show AS showt ON (showt.id = si.show_id)
|
||||||
|
WHERE si.modified_instance = FALSE
|
||||||
|
$showPredicate
|
||||||
|
AND (si.starts >= '{$p_start}'
|
||||||
|
AND si.starts < '{$p_end}')
|
||||||
|
OR (si.ends > '{$p_start}'
|
||||||
|
AND si.ends <= '{$p_end}')
|
||||||
|
OR (si.starts <= '{$p_start}'
|
||||||
|
AND si.ends >= '{$p_end}')
|
||||||
|
ORDER BY si_starts,
|
||||||
|
sched_starts;
|
||||||
|
SQL;
|
||||||
|
|
||||||
$rows = $con->query($sql)->fetchAll(PDO::FETCH_ASSOC);
|
$rows = $con->query($sql)->fetchAll(PDO::FETCH_ASSOC);
|
||||||
return $rows;
|
return $rows;
|
||||||
|
|
|
@ -25,18 +25,8 @@ function setSmartPlaylistEvents() {
|
||||||
form.find('a[id^="modifier_add"]').live('click', function(){
|
form.find('a[id^="modifier_add"]').live('click', function(){
|
||||||
var id = $(this).attr('id'),
|
var id = $(this).attr('id'),
|
||||||
row_index = id.charAt(id.length-1),
|
row_index = id.charAt(id.length-1),
|
||||||
mod_index,
|
|
||||||
criteria_value = $(this).siblings('select[name^="sp_criteria_field"]').val();
|
criteria_value = $(this).siblings('select[name^="sp_criteria_field"]').val();
|
||||||
|
|
||||||
//get index for the new modifier row
|
|
||||||
if ($(this).parent().find('select[name^="sp_criteria_modifier_'+row_index+'_"]').length == 0) {
|
|
||||||
mod_index = 0;
|
|
||||||
} else {
|
|
||||||
var last_mod = $(this).parent().find('select[name^="sp_criteria_modifier_'+row_index+'_"]:last');
|
|
||||||
var last_mod_id = last_mod.attr('id');
|
|
||||||
mod_index = parseInt(last_mod_id.substr(last_mod_id.length-1))+1;
|
|
||||||
}
|
|
||||||
|
|
||||||
//make new modifier row
|
//make new modifier row
|
||||||
var newRow = $(this).parent().clone(),
|
var newRow = $(this).parent().clone(),
|
||||||
newRowCrit = newRow.find('select[name^="sp_criteria_field"]'),
|
newRowCrit = newRow.find('select[name^="sp_criteria_field"]'),
|
||||||
|
@ -53,27 +43,21 @@ function setSmartPlaylistEvents() {
|
||||||
//hide the critieria field select box
|
//hide the critieria field select box
|
||||||
newRowCrit.addClass('sp-invisible');
|
newRowCrit.addClass('sp-invisible');
|
||||||
|
|
||||||
//append modifier index to the new modifier row
|
//keep criteria value the same
|
||||||
newRowCrit.attr('name', 'sp_criteria_field_'+row_index+'_'+mod_index);
|
|
||||||
newRowCrit.attr('id', 'sp_criteria_field_'+row_index+'_'+mod_index);
|
|
||||||
newRowCrit.val(criteria_value);
|
newRowCrit.val(criteria_value);
|
||||||
newRowMod.attr('name', 'sp_criteria_modifier_'+row_index+'_'+mod_index);
|
|
||||||
newRowMod.attr('id', 'sp_criteria_modifier_'+row_index+'_'+mod_index);
|
//reset all other values
|
||||||
newRowMod.val('0');
|
newRowMod.val('0');
|
||||||
newRowVal.attr('name', 'sp_criteria_value_'+row_index+'_'+mod_index);
|
|
||||||
newRowVal.attr('id', 'sp_criteria_value_'+row_index+'_'+mod_index);
|
|
||||||
newRowVal.val('');
|
newRowVal.val('');
|
||||||
newRowExtra.attr('name', 'sp_criteria_extra_'+row_index+'_'+mod_index);
|
|
||||||
newRowExtra.attr('id', 'sp_criteria_extra_'+row_index+'_'+mod_index);
|
|
||||||
newRowExtra.val('');
|
newRowExtra.val('');
|
||||||
disableAndHideExtraField(newRowVal);
|
disableAndHideExtraField(newRowVal);
|
||||||
sizeTextBoxes(newRowVal, 'sp_extra_input_text', 'sp_input_text');
|
sizeTextBoxes(newRowVal, 'sp_extra_input_text', 'sp_input_text');
|
||||||
newRowRemove.attr('id', 'criteria_remove_'+row_index+'_'+mod_index);
|
|
||||||
|
|
||||||
//remove the 'criteria add' button from new modifier row
|
//remove the 'criteria add' button from new modifier row
|
||||||
newRow.find('.criteria_add').remove();
|
newRow.find('.criteria_add').remove();
|
||||||
|
|
||||||
$(this).parent().after(newRow);
|
$(this).parent().after(newRow);
|
||||||
|
reindexElements();
|
||||||
appendAddButton();
|
appendAddButton();
|
||||||
appendModAddButton();
|
appendModAddButton();
|
||||||
removeButtonCheck();
|
removeButtonCheck();
|
||||||
|
|
Loading…
Reference in New Issue