//Set Javascript Security Levels var ArticlesSecurityView = true; var ArticlesSecurityEdit = false; var ArticlesSecurityAdmin = false; loadArticles(1); loadArticles(0); function loadArticles(priority) { $("#widget-elements-table-"+priority).html(""); var loading = document.createElement("div"); loading.id = "ul-elements-loading"; $("#widget-elements").append(loading); $("#ul-elements-loading").html("
LOADING DATA...
"); var data = {}; data['sf'] = 'articlessummary'; data['DomainID'] = "14"; data['Priority'] = priority; $.ajax({ url: '/data/home/', type: 'get', data: data, dataType: 'json', success: function(data) { if ( data.message != "" ) { alertMsg(data.message); } else { $("#ul-elements-loading").remove(); setWidget(data,priority); } }, error: function (jqXHR, textStatus, errorThrown) { alertMsg(jqXHR.responseText); $("#ul-elements-loading").remove(); } }); } function setWidget(data,priority) { var master_table_body_0 = document.createElement("tbody"); master_table_body_0.id = "master_table_body_"+priority; $("#widget-elements-table-"+priority).append(master_table_body_0); var article_height = 200; if ( data.count == 1 ) article_height = 400; else if ( data.count == 2 ) article_height = 300; for ( var t=0; t < data.articles.length; t++ ) { var master_table_body_row = document.createElement("tr"); master_table_body_row.id = "master_table_body_rowsr"+priority+"_"+t; var borderLine = "border:0px; "; if ( t > 0 ) borderLine = ""; var byline = "
" + "Posted: " + unWrapDate(data.articles[t].FullDate) + " by " + data.articles[t].AuthorName + "
" + "
Print Article
"; if ( data.articles[t].NoByline == 1 ) byline = ""; var title = ""; if ( data.articles[t].Title != "" ) { if ( data.articles[t].TitleURL != "" ) title = "

" + data.articles[t].Title + "

"; else title = "

" + data.articles[t].Title + "

"; } else { title = "

"; } $("#master_table_body_"+priority).append(master_table_body_row); if ( data.articles[t].ShowFullArticle == 1 ) { $("#master_table_body_rowsr"+priority+"_"+t).html( " " + "
" + title + byline + "
" + data.articles[t].ArticleText + "
" + "
" + " Read Full Article..." + "" ); } else { $("#master_table_body_rowsr"+priority+"_"+t).html( " " + "
" + title + byline + "
" + data.articles[t].ArticleText + "
" + "
" + "" ); } } } function printArticle(articleID) { var data = {}; data['sf'] = 'article'; data['ArticleID'] = articleID; $.ajax({ url: '/data/home/', type: 'get', data: data, dataType: 'json', success: function(data) { if ( data.message != "" ) alertMsg(data.message); else { window.open( "/article/" + data.article.Year + "/" + data.article.Month + "/" + data.article.Day + "/" + data.article.ArticleID + "/" + data.article.Title, "Print Article", "" ); } }, error: function (jqXHR, textStatus, errorThrown) { alertMsg(jqXHR.responseText); } }); } function viewArticle(articleID) { $("#ArticleID").html(""); if ( articleID == "" ) { return; } var data = {}; data['sf'] = 'article'; data['ArticleID'] = articleID; $.ajax({ url: '/data/home/', type: 'get', data: data, dataType: 'json', success: function(data) { if ( data.message != "" ) alertMsg(data.message); else { $("#ArticleID").html(data.article.ArticleID); $("#ArticleTitle").html(data.article.Title); $("#ArticleByline").html("Posted: " + unWrapDate(data.article.FullDate) + " by " + data.article.AuthorName); $("#ArticleViewer").html(data.article.ArticleText); $("#ModalArticleView").modal(); } }, error: function (jqXHR, textStatus, errorThrown) { alertMsg(jqXHR.responseText); } }); } function printThisArticle() { if ( $("#ArticleID").html() != "" ) { printArticle($("#ArticleID").html()); } }