1var csrflistHash = $("#csrflistHash").val(); 2 3app.controller( 4 "adminNewsViewAllListServicesCtrl", 5 function ($scope, $http, toastr) { 6 $scope.newsViewAllListInit = function () { 7 $scope.activeNewsCount = 0; 8 $scope.activeExaminationsCount = 0; 9 $scope.activeCircularsCount = 0; 10 $scope.newsListArray = { 11 newsAndCircular: [], 12 importantNotices: [], 13 }; 14 $scope.getCategory = []; 15 $scope.getAllNewArray = []; 16 $scope.getAllnewsCategory(); 17 $scope.getAllCountsService(); 18 $scope.getAllNews(); 19 $scope.getAllnewsListService(); 20 $scope.inputSearchValue = ""; 21 $scope.categoryName = "All News"; 22 $scope.seperator = "^%^"; 23 }; 24 25 $scope.getAllCountsService = function () { 26 var transform = function (data) { 27 return $.param(data); 28 } 29 $http.post(window.site_url + 'FrontEndAPI/getAllCounts', { 30 31 }, { 32 headers: { 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' }, 33 transformRequest: transform 34 }).then(function (response) { 35 if (response.data.status.status != "1") { 36 $scope.activeNewsCount = response.data.data.activeNewsCount; 37 $scope.activeResultsCount = response.data.data.activeExaminationCount; 38 $scope.activeNoticesCount = response.data.data.activeCircularsCount; 39 } else { 40 toastr.error(response.data.status.message); 41 } 42 }) 43 } 44 45 $scope.changeHomeNewCategory = function (category) { 46 if (category == "") { 47 $scope.getAllnewsListService(); 48 } else { 49 let category_id = category; 50 let newsArrary = $scope.getAllNewArray; 51 52 let newCategoryArray = []; 53 $scope.newsListArray.newsAndCircular = []; 54 $scope.newsListArray.importantNotices = []; 55 56 newCategoryArray = newsArrary.filter( 57 (data) => data.tncl_nws_category_id === category_id 58 ); 59 60 $scope.numberOfNews = newCategoryArray.length; 61 newCategoryArray.map((news) => { 62 let newsObj = {}; 63 let linkInfo = []; 64 65 newsObj.nws_id = news.nws_id; 66 newsObj.nws_title = news.nws_title; 67 newsObj.tnbt_name = news.tnbt_name; 68 newsObj.tncm_category_name_shortcode = 69 news.tncm_category_name_shortcode; 70 newsObj.nws_created_date = news.nws_created_date; 71 newsObj.nws_new_flag = news.nws_new_flag === "1" ? true : false; 72 newsObj.isShowNews = true; 73 74 if (news.nws_target === "new") { 75 newsObj.nws_target = "_blank"; 76 } else if (news.nws_target === "same") { 77 newsObj.nws_target = "_self"; 78 } 79 80 if (news.nws_link) { 81 linkInfo = news.nws_link.split($scope.seperator); 82 newsObj.nws_link = { 83 actualLink: linkInfo[0], 84 linkOrPath: linkInfo[1], 85 }; 86 } else { 87 newsObj.isShowNews = true; 88 } 89 90 if (newsObj.isShowNews) { 91 if (news.nws_type === "News & Circulars") { 92 $scope.newsListArray.newsAndCircular.push(newsObj); 93 } else if (news.nws_type === "Important Notices") { 94 $scope.newsListArray.importantNotices.push(newsObj); 95 } 96 } 97 }); 98 } 99 }; 100 101 $scope.changeCategory = function (category) { 102 if (document.getElementById("All News")) { 103 document.getElementById("All News").classList.remove("active"); 104 } 105 if (document.getElementById(category.tncm_category_name)) { 106 document 107 .getElementById(category.tncm_category_name) 108 .classList.add("active"); 109 } 110 if (document.getElementById($scope.categoryName)) { 111 document.getElementById($scope.categoryName).classList.remove("active"); 112 } 113 114 $scope.categoryName = category.tncm_category_name; 115 let category_id = category.tncl_nws_category_id; 116 let newsArrary = $scope.getAllNewArray; 117 118 let newCategoryArray = []; 119 $scope.newsListArray.newsAndCircular = []; 120 $scope.newsListArray.importantNotices = []; 121 122 newCategoryArray = newsArrary.filter( 123 (data) => data.tncl_nws_category_id === category_id 124 ); 125 126 $scope.numberOfNews = newCategoryArray.length; 127 newCategoryArray.map((news) => { 128 let newsObj = {}; 129 let linkInfo = []; 130 131 newsObj.nws_id = news.nws_id; 132 newsObj.nws_title = news.nws_title; 133 newsObj.tnbt_name = news.tnbt_name; 134 newsObj.tncm_category_name_shortcode = 135 news.tncm_category_name_shortcode; 136 newsObj.nws_created_date = news.nws_created_date; 137 newsObj.nws_new_flag = news.nws_new_flag === "1" ? true : false;
138 newsObj.isShowNews = true; 139 140 if (news.nws_target === "new") { 141 newsObj.nws_target = "_blank"; 142 } else if (news.nws_target === "same") { 143 newsObj.nws_target = "_self"; 144 } 145 146 if (news.nws_link) { 147 linkInfo = news.nws_link.split($scope.seperator); 148 newsObj.nws_link = { 149 actualLink: linkInfo[0], 150 linkOrPath: linkInfo[1], 151 }; 152 } else { 153 newsObj.isShowNews = true; 154 } 155 156 if (newsObj.isShowNews) { 157 if (news.nws_type === "News & Circulars") { 158 $scope.newsListArray.newsAndCircular.push(newsObj); 159 } else if (news.nws_type === "Important Notices") { 160 $scope.newsListArray.importantNotices.push(newsObj); 161 } 162 } 163 }); 164 }; 165 // get category of news 166 167 $scope.getAllnewsCategory = function () { 168 var transform = function (data) { 169 return $.param(data); 170 }; 171 $http 172 .post( 173 window.site_url + "FrontEndAPI/getAllNewsCategory", 174 { 175 inputSearchValue: $scope.inputSearchValue, 176 }, 177 { 178 headers: { 179 "Content-Type": 180 "application/x-www-form-urlencoded; charset=UTF-8", 181 }, 182 transformRequest: transform, 183 } 184 ) 185 .then(function (response) { 186 if (response.data.status.status == "201") { 187 $scope.getCategory = response.data.data; 188 } else { 189 toastr.error(response.data.status.message); 190 } 191 }); 192 }; 193 194 $scope.getAllNews = function () { 195 var transform = function (data) { 196 return $.param(data); 197 }; 198 $http 199 .post( 200 window.site_url + "FrontEndAPI/getAllNews", 201 { 202 inputSearchValue: $scope.inputSearchValue, 203 }, 204 { 205 headers: { 206 "Content-Type": 207 "application/x-www-form-urlencoded; charset=UTF-8", 208 }, 209 transformRequest: transform, 210 } 211 ) 212 .then(function (response) { 213 if (response.data.status.status == "201") { 214 $scope.getAllNewArray = response.data.data; 215 } else { 216 toastr.error(response.data.status.message); 217 } 218 }); 219 }; 220 221 // get all news and filter them according to news and circular/important notices 222 $scope.getAllnewsListService = function () { 223 if (document.getElementById("All News")) { 224 document.getElementById("All News").classList.add("active"); 225 } 226 if (document.getElementById($scope.categoryName)) { 227 document.getElementById($scope.categoryName).classList.remove("active"); 228 } 229 $scope.categoryName = "All News"; 230 var transform = function (data) { 231 return $.param(data); 232 }; 233 $http 234 .post( 235 window.site_url + "FrontEndAPI/getNewsListForWebsite", 236 { 237 inputSearchValue: $scope.inputSearchValue, 238 }, 239 { 240 headers: { 241 "Content-Type": 242 "application/x-www-form-urlencoded; charset=UTF-8", 243 }, 244 transformRequest: transform, 245 } 246 ) 247 .then(function (response) { 248 if (response.data.status.status == "201") { 249 $scope.numberOfNews = response.data.data.length; 250 251 $scope.newsListArray.newsAndCircular = []; 252 $scope.newsListArray.importantNotices = []; 253 254 response.data.data.map((news) => { 255 let newsObj = {}; 256 let linkInfo = []; 257 258 newsObj.nws_id = news.nws_id; 259 newsObj.newsCategory = news.newsCategory; 260 newsObj.nws_created_date = news.nws_created_date; 261 newsObj.tnbt_name = news.tnbt_name; 262 newsObj.nws_title = news.nws_title; 263 newsObj.nws_new_flag = news.nws_new_flag === "1" ? true : false; 264 newsObj.isShowNews = true; 265 266 if (news.nws_target === "new") { 267 newsObj.nws_target = "_blank"; 268 } else if (news.nws_target === "same") { 269 newsObj.nws_target = "_self"; 270 } 271 272 if (news.nws_link) { 273 linkInfo = news.nws_link.split($scope.seperator); 274 newsObj.nws_link = { 275 actualLink: linkInfo[0], 276 linkOrPath: linkInfo[1], 277 }; 278 } else { 279 newsObj.isShowNews = true; 280 } 281 282 if (newsObj.isShowNews) { 283 if (news.nws_type === "News & Circulars") { 284 $scope.newsListArray.newsAndCircular.push(newsObj); 285 } else if (news.nws_type === "Important Notices") { 286 $scope.newsListArray.importantNotices.push(newsObj); 287 } 288 } 289 }); 290 } else { 291 toastr.error(response.data.status.message); 292 } 293 }); 294 }; 295 } 296);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.