a working show instance select.
This commit is contained in:
parent
ab8cf60fe3
commit
0c379ef840
3 changed files with 75 additions and 13 deletions
|
@ -857,7 +857,7 @@ class Application_Service_HistoryService
|
||||||
try {
|
try {
|
||||||
$form = $this->makeHistoryItemForm(null);
|
$form = $this->makeHistoryItemForm(null);
|
||||||
$history_id = $form->getElement("his_item_id");
|
$history_id = $form->getElement("his_item_id");
|
||||||
$instanceId = $data["instance_id"];
|
$instanceId = isset($data["instance_id"]) ? $data["instance_id"] : null;
|
||||||
$json = array();
|
$json = array();
|
||||||
|
|
||||||
if ($form->isValid($data) && $this->validateHistoryItem($instanceId, $form)) {
|
if ($form->isValid($data) && $this->validateHistoryItem($instanceId, $form)) {
|
||||||
|
@ -883,7 +883,7 @@ class Application_Service_HistoryService
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$id = $data["his_item_id"];
|
$id = $data["his_item_id"];
|
||||||
$instanceId = $data["instance_id"];
|
$instanceId = isset($data["instance_id"]) ? $data["instance_id"] : null;
|
||||||
$form = $this->makeHistoryItemForm($id);
|
$form = $this->makeHistoryItemForm($id);
|
||||||
$history_id = $form->getElement("his_item_id");
|
$history_id = $form->getElement("his_item_id");
|
||||||
$history_id->setRequired(true);
|
$history_id->setRequired(true);
|
||||||
|
|
|
@ -604,7 +604,9 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
id = data[0].value,
|
id = data[0].value,
|
||||||
createUrl = baseUrl+"Playouthistory/create-list-item/format/json",
|
createUrl = baseUrl+"Playouthistory/create-list-item/format/json",
|
||||||
updateUrl = baseUrl+"Playouthistory/update-list-item/format/json",
|
updateUrl = baseUrl+"Playouthistory/update-list-item/format/json",
|
||||||
url;
|
url,
|
||||||
|
$select = $hisDialogEl.find("#his_instance_select"),
|
||||||
|
instance;
|
||||||
|
|
||||||
url = (id === "") ? createUrl : updateUrl;
|
url = (id === "") ? createUrl : updateUrl;
|
||||||
|
|
||||||
|
@ -614,6 +616,16 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
value: fnServerData.instance
|
value: fnServerData.instance
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
else if ($select.length > 0) {
|
||||||
|
instance = $select.val();
|
||||||
|
|
||||||
|
if (instance > 0) {
|
||||||
|
data.push({
|
||||||
|
name: "instance_id",
|
||||||
|
value: instance
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$.post(url, data, function(json) {
|
$.post(url, data, function(json) {
|
||||||
|
|
||||||
|
@ -645,6 +657,46 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('body').on("click", "#his_instance_retrieve", function(e) {
|
||||||
|
var startPicker = $hisDialogEl.find('#his_item_starts_datetimepicker').data('datetimepicker'),
|
||||||
|
endPicker = $hisDialogEl.find('#his_item_ends_datetimepicker').data('datetimepicker'),
|
||||||
|
url = baseUrl+"playouthistory/show-history-feed",
|
||||||
|
startDate = startPicker.getLocalDate(),
|
||||||
|
endDate = endPicker.getLocalDate(),
|
||||||
|
getEpochSeconds = AIRTIME.utilities.fnGetSecondsEpoch,
|
||||||
|
data;
|
||||||
|
|
||||||
|
data = {
|
||||||
|
start: getEpochSeconds(startDate),
|
||||||
|
end: getEpochSeconds(endDate),
|
||||||
|
format: "json"
|
||||||
|
};
|
||||||
|
|
||||||
|
$.get(url, data, function(json) {
|
||||||
|
var i,
|
||||||
|
$select = $('<select/>', {
|
||||||
|
id: 'his_instance_select'
|
||||||
|
}),
|
||||||
|
$option,
|
||||||
|
show;
|
||||||
|
|
||||||
|
if (json.length > 0) {
|
||||||
|
|
||||||
|
for (i = 0; i < json.length; i++) {
|
||||||
|
show = json[i];
|
||||||
|
|
||||||
|
$option = $('<option/>')
|
||||||
|
.text(show.name)
|
||||||
|
.attr('value', show.instance_id);
|
||||||
|
|
||||||
|
$select.append($option);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$hisDialogEl.find("#his_instance_select").replaceWith($select);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
$historyContentDiv.find("#his_submit").click(function(ev){
|
$historyContentDiv.find("#his_submit").click(function(ev){
|
||||||
var fn,
|
var fn,
|
||||||
oRange;
|
oRange;
|
||||||
|
@ -658,7 +710,9 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
if (inShowsTab) {
|
if (inShowsTab) {
|
||||||
showSummaryList();
|
showSummaryList();
|
||||||
}
|
}
|
||||||
redrawTables();
|
else {
|
||||||
|
redrawTables();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$historyContentDiv.on("click", ".his-select-page", selectCurrentPage);
|
$historyContentDiv.on("click", ".his-select-page", selectCurrentPage);
|
||||||
|
|
|
@ -35,6 +35,22 @@ var AIRTIME = (function(AIRTIME){
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
mod.fnGetSecondsEpoch = function(oDate) {
|
||||||
|
var iTime,
|
||||||
|
iServerOffset,
|
||||||
|
iClientOffset;
|
||||||
|
|
||||||
|
iTime = oDate.getTime(); //value is in millisec.
|
||||||
|
iTime = Math.round(iTime / 1000);
|
||||||
|
iServerOffset = serverTimezoneOffset;
|
||||||
|
iClientOffset = oDate.getTimezoneOffset() * -60;//function returns minutes
|
||||||
|
|
||||||
|
//adjust for the fact the the Date object is in client time.
|
||||||
|
iTime = iTime + iClientOffset + iServerOffset;
|
||||||
|
|
||||||
|
return iTime;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get the schedule range start in unix timestamp form (in seconds).
|
* Get the schedule range start in unix timestamp form (in seconds).
|
||||||
* defaults to NOW if nothing is selected.
|
* defaults to NOW if nothing is selected.
|
||||||
|
@ -69,15 +85,7 @@ var AIRTIME = (function(AIRTIME){
|
||||||
//0 based month in js.
|
//0 based month in js.
|
||||||
oDate = new Date(date[0], date[1]-1, date[2], time[0], time[1]);
|
oDate = new Date(date[0], date[1]-1, date[2], time[0], time[1]);
|
||||||
|
|
||||||
iTime = oDate.getTime(); //value is in millisec.
|
return mod.fnGetSecondsEpoch(oDate);
|
||||||
iTime = Math.round(iTime / 1000);
|
|
||||||
iServerOffset = serverTimezoneOffset;
|
|
||||||
iClientOffset = oDate.getTimezoneOffset() * -60;//function returns minutes
|
|
||||||
|
|
||||||
//adjust for the fact the the Date object is in client time.
|
|
||||||
iTime = iTime + iClientOffset + iServerOffset;
|
|
||||||
|
|
||||||
return iTime;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue