7th_handle / src /messagehub.js
Adoption's picture
feat: implement sermon message processing and RAG pipeline with Streamlit dashboard and data ingestion tools
0004cda
Raw
History Blame Contribute Delete
5.74 kB
var messageFilterTimer;
var lastFilterText;
var lastFormatBtn = null;
var lastFormat = null;
function downloadTemplate(id)
{
window.location = "/download.template?Id=" + id;
}
function downloadMessage(eid)
{
window.location = "/download.message?eid=" + eid;
}
function setListFormat(format)
{
var x = document.getElementsByName("format");
if (x.length == 0)
{
return;
}
var elem;
if (format != null && lastFormat != null && format != lastFormat)
{
elem = document.getElementById("tabIcon" + lastFormat);
changeTabCellClass(elem, "tabIconOn", "tabIconOff");
elem = document.getElementById("tabCaption" + lastFormat);
changeTabCellClass(elem, "tabCaptionOn", "tabCaptionOff");
}
if (format != null && format != lastFormat)
{
elem = document.getElementById("tabIcon" + format);
changeTabCellClass(elem, "tabIconOff", "tabIconOn");
elem = document.getElementById("tabCaption" + format);
changeTabCellClass(elem, "tabCaptionOff", "tabCaptionOn");
lastFormat = format;
}
x[0].value = format;
loadMessageListRecords();
}
function changeTabCellClass(element, oldClass, newClass)
{
if (hasStyleClass(element, oldClass))
{
delStyleClass(element, oldClass);
}
if (! hasStyleClass(element, newClass))
{
addStyleClass(element, newClass);
}
}
function loadMainContainer(uri)
{
var container = getContainer("mainContainer");
loadContainer(uri, container, onLoadContainer);
}
function onKeyupMessageFilter(textField)
{
if (textField.value == lastFilterText)
{
return;
}
lastFilterText = textField.value;
if (messageFilterTimer != null)
{
clearTimeout(messageFilterTimer);
}
messageFilterTimer = setTimeout("gotoPage(1)", 500);
}
function clearMessageFilter(textField)
{
if (textField.value == "")
{
return;
}
textField.value = lastFilterText = "";
if (messageFilterTimer != null)
{
clearTimeout(messageFilterTimer);
}
textField.focus();
gotoPage(1);
}
function onSortMessages(columnIndex)
{
var field = document.getElementsByName("sortColumn")[0];
var oldIndex = field.value;
field.value = columnIndex;
field = document.getElementsByName("sortDirection")[0];
if (oldIndex != columnIndex)
{
field.value = 1;
}
else
{
field.value = (field.value < 0) ? 1 : -1;
}
gotoPage(1);
}
function gotoPage(pageNumber)
{
var field = document.getElementsByName("page")[0];
field.value = pageNumber;
loadMessageListRecords(true);
}
function selectTranslation(tableRow, id, languageId)
{
var format = document.getElementsByName("format")[0].value;
selectRecord(tableRow, id);
loadArtifacts(id, languageId, format);
}
function clickLanguageButton(languageCode)
{
window.location = languageCode + getShowEnglishQuery(true);
}
function loadMessageList(languageId)
{
var container = document.getElementById("mainContainer");
loadContainer("/translated_messages.do?languageId=" + languageId + getShowEnglishQuery(false), container, onLoadContainer, false);
}
function loadMessageListContent(languageId)
{
var container = document.getElementById("leftContent");
loadContainer("/message_list.do?languageId=" + languageId + getShowEnglishQuery(false), container, onLoadContainer, true);
}
function loadMessageListRecords()
{
var form = document.getElementById("messageListForm");
var container = document.getElementById("messageListRecords");
var field = document.getElementsByName("show_en")[0];
field.value = getShowEnglishValue();
submitForm(form, container, onLoadContainer, true)
}
function loadArtifacts(tmId, languageId, format)
{
var container = document.getElementById("messageRecordDetails");
loadContainer("message_artifacts.do?tmId=" + tmId + "&languageId=" + languageId + "&format=" + format + getShowEnglishQuery(false), container, null, true);
}
// function playWmbMp3(eid)
// {
// var url = "/play_message.do?eid=" + eid;
// openPopup(url, "playMessage", 500, 250)
// }
// function loadMessagePlayer(file, id, autostart)
// {
// var so1 = new SWFObject("/include/mediaplayer.swf", "flvplayer", "450", "100", "9", "#ffffff");
// so1.addParam('allowscriptaccess', 'always');
// so1.addParam("wmode", "opaque");
// so1.addVariable("height", "100");
// so1.addVariable("width", "450");
// so1.addVariable("volume", "100");
// so1.addVariable("backcolor", "0x000000");
// so1.addVariable("frontcolor", "0xCCCCCC");
// so1.addVariable("lightcolor", "0x990000");
// so1.addVariable("screencolor", "000000");
// so1.addVariable("bufferlength", "5");
// so1.addVariable("autostart", autostart == null ? "false" : autostart);
// so1.addVariable("file", file);
// so1.addVariable("id", id);
// so1.write("messagePlayer");
// }
function getShowEnglishQuery(isFirstParam)
{
var value = getShowEnglishValue();
if (value == "")
{
return "";
}
return (isFirstParam ? "?" : "&") + "show_en=" + value;
}
function getShowEnglishValue()
{
var qs = new Querystring();
return qs.get("show_en", "");
}