| 70 | | |
|---|
| 71 | | fileTitles[idFile]=($(xmlDoc).find('title:first').text()); |
|---|
| 72 | | var x=$("div.CB[fileid='"+idFile+"']"); |
|---|
| 73 | | $(x).text($(x).text() +" "+fileTitles[idFile]) |
|---|
| 74 | | $(xmlDoc).find('item') |
|---|
| 75 | | .each(function() { |
|---|
| 76 | | jqItem = $(this); |
|---|
| 77 | | |
|---|
| 78 | | var jqTitle = jqItem.find('title'); |
|---|
| 79 | | if (jqTitle.length) { |
|---|
| 80 | | |
|---|
| 81 | | |
|---|
| 82 | | var html='<tr class="" fileid='+idFile+'>'; |
|---|
| 83 | | |
|---|
| 84 | | var jqDate = jqItem.find('pubDate'); |
|---|
| 85 | | if (jqDate.length) { |
|---|
| 86 | | var theTimeInMiliSec=getDateFromFormat($(jqDate).text(),"yyyy-MM-ddThh:mm:ssZ"); |
|---|
| 87 | | html += '<td class="date" timeInMilisec="'+theTimeInMiliSec+'" latitude="'+jqItem.find('lat').text()+'" longitude="'+jqItem.find('long').text()+'">' |
|---|
| 88 | | |
|---|
| 89 | | html += formatDate(new Date(theTimeInMiliSec),"HH:mm"); |
|---|
| 90 | | } |
|---|
| 91 | | else{ |
|---|
| 92 | | html += '<td class="date" timeInMilisec="">error'; |
|---|
| 93 | | } |
|---|
| 94 | | html += '</td>'; |
|---|
| 95 | | |
|---|
| 96 | | var jqCategory = jqItem.find('category'); |
|---|
| 97 | | // if (jqCategory.length) { |
|---|
| 98 | | |
|---|
| 99 | | for (i=0;i<categories.length;i++){ |
|---|
| 100 | | if (categories[i]==$(jqCategory).text()) break; |
|---|
| 101 | | } |
|---|
| 102 | | if (i == categories.length) { |
|---|
| 103 | | categories.push($(jqCategory).text()); |
|---|
| 104 | | var newCateg='<div class="CB checkBoxChecked" categId="'+i+'">'+$(jqCategory).text(); |
|---|
| 105 | | |
|---|
| 106 | | newCateg+=' </div>'; |
|---|
| 107 | | $("#categSel").append(newCateg); |
|---|
| 108 | | |
|---|
| 109 | | } |
|---|
| 110 | | |
|---|
| 111 | | |
|---|
| 112 | | html += '<td class="category" categId="'+i+'">'; |
|---|
| 113 | | html += '<div>'+$(jqCategory).text()+' </div></td>'; |
|---|
| 114 | | //}else { |
|---|
| 115 | | |
|---|
| 116 | | //} |
|---|
| 117 | | |
|---|
| 118 | | html += '<td class="title"><div>'+$(jqTitle).text()+'</div></td>'; |
|---|
| 119 | | html+='</tr>'; |
|---|
| 120 | | |
|---|
| 121 | | $("#loadedData tbody").append(html); |
|---|
| 122 | | checkForSelectedCategories(); |
|---|
| 123 | | $('.scrollablePane').jScrollPane(); |
|---|
| 124 | | addEventsToTableRows(); |
|---|
| 125 | | addEventsToSubAccCheckBoxes(); |
|---|
| 126 | | } |
|---|
| 127 | | }); |
|---|
| 128 | | |
|---|
| 129 | | } |
|---|
| 130 | | |
|---|
| 131 | | $(document).ready(function(){ |
|---|
| 132 | | $("#mypath").val(""); |
|---|
| 133 | | $("input[value='Load']").click(function(){ |
|---|
| 134 | | var str=$("#realFile").val(); |
|---|
| 135 | | |
|---|
| 136 | | /* |
|---|
| 137 | | * The location of the xml file must be |
|---|
| 138 | | * in a subdirectory of the current directory |
|---|
| 139 | | * |
|---|
| 140 | | */ |
|---|
| 141 | | if (str.length>0) |
|---|
| 142 | | { |
|---|
| 143 | | var str1=str.split("/"); |
|---|
| 144 | | var str2=str.split("\\"); |
|---|
| 145 | | if (str1.length>str2.length) |
|---|
| 146 | | { |
|---|
| 147 | | str=str1[str1.length-2]+"/"+str1[str1.length-1]; |
|---|
| 148 | | } |
|---|
| 149 | | else { |
|---|
| 150 | | str=str2[str2.length-2]+"/"+str2[str2.length-1]; |
|---|
| 151 | | } |
|---|
| 152 | | |
|---|
| 153 | | for (i=0;i<files.length;i++){ |
|---|
| 154 | | if (files[i]==str) break; |
|---|
| 155 | | } |
|---|
| 156 | | idFile=i; |
|---|
| 157 | | if (i == files.length) { |
|---|
| 158 | | files.push(str); |
|---|
| 159 | | var newFile='<div class="CB checkBoxChecked" fileid="'+idFile+'">'+str+'</div>'; |
|---|
| 160 | | $("#filesSel").append(newFile)//.jScrollPane(); |
|---|
| 161 | | addEventsToSubAccCheckBoxes() |
|---|
| 162 | | |
|---|
| 163 | | loadXML(str); |
|---|
| 164 | | } |
|---|
| 165 | | else {alert("This file has already been loaded.")} |
|---|
| 166 | | } |
|---|
| 167 | | |
|---|
| 168 | | }); |
|---|
| 169 | | }); |
|---|
| | 65 | |
|---|
| | 66 | fileTitles[idFile] = ($(xmlDoc).find('title:first').text()); |
|---|
| | 67 | var x = $("div.CB[fileid='" + idFile + "']"); |
|---|
| | 68 | $(x).text($(x).text() + " " + fileTitles[idFile]) |
|---|
| | 69 | $(xmlDoc).find('item').each(function(){ |
|---|
| | 70 | jqItem = $(this); |
|---|
| | 71 | |
|---|
| | 72 | var jqTitle = jqItem.find('title'); |
|---|
| | 73 | if (jqTitle.length) { |
|---|
| | 74 | |
|---|
| | 75 | |
|---|
| | 76 | var html = '<tr class="" fileid=' + idFile + '>'; |
|---|
| | 77 | |
|---|
| | 78 | var jqDate = jqItem.find('pubDate'); |
|---|
| | 79 | if (jqDate.length) { |
|---|
| | 80 | var theTimeInMiliSec = getDateFromFormat($(jqDate).text(), "yyyy-MM-ddThh:mm:ssZ"); |
|---|
| | 81 | html += '<td class="date" timeInMilisec="' + theTimeInMiliSec + '" latitude="' + jqItem.find('lat').text() + '" longitude="' + jqItem.find('long').text() + '">' |
|---|
| | 82 | |
|---|
| | 83 | html += formatDate(new Date(theTimeInMiliSec), "HH:mm"); |
|---|
| | 84 | } |
|---|
| | 85 | else { |
|---|
| | 86 | html += '<td class="date" timeInMilisec="">error'; |
|---|
| | 87 | } |
|---|
| | 88 | html += '</td>'; |
|---|
| | 89 | |
|---|
| | 90 | var jqCategory = jqItem.find('category'); |
|---|
| | 91 | // if (jqCategory.length) { |
|---|
| | 92 | |
|---|
| | 93 | for (i = 0; i < categories.length; i++) { |
|---|
| | 94 | if (categories[i] == $(jqCategory).text()) |
|---|
| | 95 | break; |
|---|
| | 96 | } |
|---|
| | 97 | if (i == categories.length) { |
|---|
| | 98 | categories.push($(jqCategory).text()); |
|---|
| | 99 | var newCateg = '<div class="CB checkBoxChecked" categId="' + i + '">' + $(jqCategory).text(); |
|---|
| | 100 | |
|---|
| | 101 | newCateg += ' </div>'; |
|---|
| | 102 | $("#categSel").append(newCateg); |
|---|
| | 103 | |
|---|
| | 104 | } |
|---|
| | 105 | |
|---|
| | 106 | |
|---|
| | 107 | html += '<td class="category" categId="' + i + '">'; |
|---|
| | 108 | html += '<div>' + $(jqCategory).text() + ' </div></td>'; |
|---|
| | 109 | //}else { |
|---|
| | 110 | |
|---|
| | 111 | //} |
|---|
| | 112 | |
|---|
| | 113 | html += '<td class="title"><div>' + $(jqTitle).text() + '</div></td>'; |
|---|
| | 114 | html += '</tr>'; |
|---|
| | 115 | |
|---|
| | 116 | $("#loadedData tbody").append(html); |
|---|
| | 117 | checkForSelectedCategories(); |
|---|
| | 118 | $('.scrollablePane').jScrollPane(); |
|---|
| | 119 | addEventsToTableRows(); |
|---|
| | 120 | addEventsToSubAccCheckBoxes(); |
|---|
| | 121 | } |
|---|
| | 122 | }); |
|---|
| | 123 | |
|---|
| | 124 | } |
|---|
| | 125 | |
|---|
| | 126 | $(document).ready(function(){ |
|---|
| | 127 | $("#mypath").val(""); |
|---|
| | 128 | $("input[value='Load']").click(function(){ |
|---|
| | 129 | var str = $("#realFile").val(); |
|---|
| | 130 | |
|---|
| | 131 | /* |
|---|
| | 132 | * The location of the xml file must be |
|---|
| | 133 | * in a subdirectory of the current directory |
|---|
| | 134 | * |
|---|
| | 135 | */ |
|---|
| | 136 | if (str.length > 0) { |
|---|
| | 137 | var str1 = str.split("/"); |
|---|
| | 138 | var str2 = str.split("\\"); |
|---|
| | 139 | if (str1.length > str2.length) { |
|---|
| | 140 | str = str1[str1.length - 2] + "/" + str1[str1.length - 1]; |
|---|
| | 141 | } |
|---|
| | 142 | else { |
|---|
| | 143 | str = str2[str2.length - 2] + "/" + str2[str2.length - 1]; |
|---|
| | 144 | } |
|---|
| | 145 | |
|---|
| | 146 | for (i = 0; i < files.length; i++) { |
|---|
| | 147 | if (files[i] == str) |
|---|
| | 148 | break; |
|---|
| | 149 | } |
|---|
| | 150 | idFile = i; |
|---|
| | 151 | if (i == files.length) { |
|---|
| | 152 | files.push(str); |
|---|
| | 153 | var newFile = '<div class="CB checkBoxChecked" fileid="' + idFile + '">' + str + '</div>'; |
|---|
| | 154 | $("#filesSel").append(newFile)//.jScrollPane(); |
|---|
| | 155 | addEventsToSubAccCheckBoxes() |
|---|
| | 156 | |
|---|
| | 157 | loadXML(str); |
|---|
| | 158 | } |
|---|
| | 159 | else { |
|---|
| | 160 | alert("This file has already been loaded.") |
|---|
| | 161 | } |
|---|
| | 162 | } |
|---|
| | 163 | |
|---|
| | 164 | }); |
|---|
| | 165 | }); |
|---|
| 189 | | |
|---|
| 190 | | function addEventsToTableRows() { |
|---|
| 191 | | |
|---|
| 192 | | // the first row (the one with the special class) is discarded |
|---|
| 193 | | // this row only servers formatting purposes |
|---|
| 194 | | |
|---|
| 195 | | $("#loadedData tr").unbind().filter(":not(.special)").hover( |
|---|
| 196 | | function () { |
|---|
| 197 | | $(this).addClass("hoverTR"); |
|---|
| 198 | | }, |
|---|
| 199 | | function () { |
|---|
| 200 | | $(this).removeClass("hoverTR"); |
|---|
| 201 | | } |
|---|
| 202 | | ) |
|---|
| 203 | | |
|---|
| 204 | | // when a row is doubleclicked it becomes selected and the time is displayed in the |
|---|
| 205 | | // DOM element with the id timeDisplay(it is an input of type text) |
|---|
| 206 | | $("#loadedData tr").filter(":not(.special)").dblclick( |
|---|
| 207 | | function(){ |
|---|
| 208 | | //store the current row |
|---|
| 209 | | var jqCurTableRow = $(this); |
|---|
| 210 | | //get the previously selected element and remove its added backgorund color and foreground color |
|---|
| 211 | | $(".selectedTR").removeClass("selectedTR").css({"backgroundColor":"","color":""}); |
|---|
| 212 | | var theTimeInMiliSec=0; |
|---|
| 213 | | // get the time in miliseconds from the timeInMilisec attribute of the td having the date class |
|---|
| 214 | | // each row in the logView (the table with the id loadedData) has three tds |
|---|
| 215 | | // the first td (the one with the class date) has three additional attributes |
|---|
| 216 | | // timeInMilisec, longitude, latitude |
|---|
| 217 | | theTimeInMiliSec=$(this).children().filter("td.date").attr("timeInMilisec"); |
|---|
| 218 | | // if the attribute was set the create a time string according with timeDisplayFormatString |
|---|
| 219 | | // and display it in the time display |
|---|
| 220 | | // else display "error" |
|---|
| 221 | | if (theTimeInMiliSec != ""){ |
|---|
| 222 | | var timeToDisp= formatDate(new Date(+theTimeInMiliSec),timeDisplayFormatString); |
|---|
| 223 | | $("#timeDisplay").val(timeToDisp); |
|---|
| 224 | | } |
|---|
| 225 | | else $("#timeDisplay").val("error"); |
|---|
| 226 | | |
|---|
| 227 | | //give a background color and a foreground color to denote that the current row has been selected |
|---|
| 228 | | $(this).addClass("selectedTR").css({"backgroundColor":"#284649","color":"#66BAB0"}); |
|---|
| 229 | | // return false to prevent event bubbling |
|---|
| 230 | | return false; |
|---|
| 231 | | } |
|---|
| 232 | | ); |
|---|
| 233 | | |
|---|
| | 189 | |
|---|
| | 190 | function addEventsToTableRows(){ |
|---|
| | 191 | |
|---|
| | 192 | // the first row (the one with the special class) is discarded |
|---|
| | 193 | // this row only servers formatting purposes |
|---|
| | 194 | |
|---|
| | 195 | $("#loadedData tr").unbind().filter(":not(.special)").hover(function(){ |
|---|
| | 196 | $(this).addClass("hoverTR"); |
|---|
| | 197 | }, function(){ |
|---|
| | 198 | $(this).removeClass("hoverTR"); |
|---|
| | 199 | }) |
|---|
| | 200 | |
|---|
| | 201 | // when a row is doubleclicked it becomes selected and the time is displayed in the |
|---|
| | 202 | // DOM element with the id timeDisplay(it is an input of type text) |
|---|
| | 203 | $("#loadedData tr").filter(":not(.special)").dblclick(function(){ |
|---|
| | 204 | //store the current row |
|---|
| | 205 | var jqCurTableRow = $(this); |
|---|
| | 206 | //get the previously selected element and remove its added backgorund color and foreground color |
|---|
| | 207 | $(".selectedTR").removeClass("selectedTR").css({ |
|---|
| | 208 | "backgroundColor": "", |
|---|
| | 209 | "color": "" |
|---|
| | 210 | }); |
|---|
| | 211 | var theTimeInMiliSec = 0; |
|---|
| | 212 | // get the time in miliseconds from the timeInMilisec attribute of the td having the date class |
|---|
| | 213 | // each row in the logView (the table with the id loadedData) has three tds |
|---|
| | 214 | // the first td (the one with the class date) has three additional attributes |
|---|
| | 215 | // timeInMilisec, longitude, latitude |
|---|
| | 216 | theTimeInMiliSec = $(this).children().filter("td.date").attr("timeInMilisec"); |
|---|
| | 217 | // if the attribute was set the create a time string according with timeDisplayFormatString |
|---|
| | 218 | // and display it in the time display |
|---|
| | 219 | // else display "error" |
|---|
| | 220 | if (theTimeInMiliSec != "") { |
|---|
| | 221 | var timeToDisp = formatDate(new Date(+theTimeInMiliSec), timeDisplayFormatString); |
|---|
| | 222 | $("#timeDisplay").val(timeToDisp); |
|---|
| | 223 | } |
|---|
| | 224 | else |
|---|
| | 225 | $("#timeDisplay").val("error"); |
|---|
| | 226 | |
|---|
| | 227 | //give a background color and a foreground color to denote that the current row has been selected |
|---|
| | 228 | $(this).addClass("selectedTR").css({ |
|---|
| | 229 | "backgroundColor": "#284649", |
|---|
| | 230 | "color": "#66BAB0" |
|---|
| | 231 | }); |
|---|
| | 232 | // return false to prevent event bubbling |
|---|
| | 233 | return false; |
|---|
| | 234 | }); |
|---|
| | 235 | |
|---|
| 240 | | // unbinds all events that were previously bound (to avoid bounding an event more than once) |
|---|
| 241 | | $(".CB").unbind(); |
|---|
| 242 | | // changes the appearance of the checkbox when mouse is over (highlights it) |
|---|
| 243 | | $(".CB").hover( |
|---|
| 244 | | function () { |
|---|
| 245 | | $(this).addClass("hoverAccH"); |
|---|
| 246 | | }, |
|---|
| 247 | | function () { |
|---|
| 248 | | $(this).removeClass("hoverAccH"); |
|---|
| 249 | | } |
|---|
| 250 | | ); |
|---|
| 251 | | |
|---|
| 252 | | //code for the ShowAll checkbox from the category select |
|---|
| 253 | | // initially it is checked |
|---|
| 254 | | |
|---|
| 255 | | // Toggle between two function calls every other click. |
|---|
| 256 | | // Whenever a matched element is clicked, the first specified function is fired, when clicked again, the second is fired. All subsequent clicks continue to rotate through the two functions. |
|---|
| 257 | | $("#categShowAll").toggle( |
|---|
| 258 | | function () { |
|---|
| 259 | | //unchecks it by removing the checkBoxChecked and adding checkBoxUnChecked |
|---|
| 260 | | $(this).removeClass("checkBoxChecked"); |
|---|
| 261 | | $(this).addClass("checkBoxUnChecked"); |
|---|
| 262 | | |
|---|
| 263 | | // unchecks all the other checkboxes from the category select part of the subAccordion |
|---|
| 264 | | $("#categSel .CB").removeClass("checkBoxChecked").addClass("checkBoxUnChecked"); |
|---|
| 265 | | |
|---|
| 266 | | //hides all row from the table with the id loadedData (the log view) |
|---|
| 267 | | // we discard the first row of the table (the one with the class special) |
|---|
| 268 | | // this first row is only for formatting purposes |
|---|
| 269 | | $("#loadedData tr").filter(":not(.special)").hide(); |
|---|
| 270 | | |
|---|
| 271 | | }, |
|---|
| 272 | | function () { |
|---|
| 273 | | //checks it by removing the checkBoxUnChecked and adding checkBoxChecked |
|---|
| 274 | | $(this).removeClass("checkBoxUnChecked"); |
|---|
| 275 | | $(this).addClass("checkBoxChecked"); |
|---|
| 276 | | |
|---|
| 277 | | // checks all the other checkboxes from the category select part of the subAccordion |
|---|
| 278 | | $("#categSel .CB").removeClass("checkBoxUnChecked").addClass("checkBoxChecked"); |
|---|
| 279 | | |
|---|
| 280 | | // shows the table rows from the log view that have a file id among the file ids selected for viewing |
|---|
| 281 | | // A file id selected for viewing is one for which a checkbox from files select is checked(selected) |
|---|
| 282 | | $("#filesSel .CB").each(function(index){ |
|---|
| 283 | | var fId = $(this).attr("fileid"); |
|---|
| 284 | | if ($(this).is(".checkBoxChecked")) { |
|---|
| 285 | | $("#loadedData td.category").filter(function(){return ($(this).parent().attr("fileid")==fId);}).parent().show(); |
|---|
| 286 | | } |
|---|
| 287 | | }); |
|---|
| 288 | | |
|---|
| 289 | | //calls jScrollPane to adjust scrollbar size |
|---|
| 290 | | $('.scrollablePane').jScrollPane(); |
|---|
| 291 | | } |
|---|
| 292 | | |
|---|
| 293 | | ); |
|---|
| 294 | | |
|---|
| 295 | | $("#filesShowAll").toggle( |
|---|
| 296 | | function () { |
|---|
| 297 | | //checks it by removing the checkBoxChecked and adding checkBoxUnChecked |
|---|
| 298 | | $(this).removeClass("checkBoxChecked"); |
|---|
| 299 | | $(this).addClass("checkBoxUnChecked"); |
|---|
| 300 | | |
|---|
| 301 | | // unchecks all the other checkboxes from the files select part of the subAccordion |
|---|
| 302 | | $("#filesSel .CB").removeClass("checkBoxChecked").addClass("checkBoxUnChecked"); |
|---|
| 303 | | $("#loadedData tr").filter(":not(.special)").hide(); |
|---|
| 304 | | |
|---|
| 305 | | }, |
|---|
| 306 | | function () { |
|---|
| 307 | | //checks it by removing the checkBoxUnChecked and adding checkBoxChecked |
|---|
| 308 | | $(this).removeClass("checkBoxUnChecked"); |
|---|
| 309 | | $(this).addClass("checkBoxChecked"); |
|---|
| 310 | | // checks all the other checkboxes from the category select part of the subAccordion |
|---|
| 311 | | $("#filesSel .CB").removeClass("checkBoxUnChecked").addClass("checkBoxChecked"); |
|---|
| 312 | | |
|---|
| 313 | | //shows all table rows |
|---|
| 314 | | $("#loadedData tr").show(); |
|---|
| 315 | | //filter out the rows that should not be shown (contain categories that are not selected to be displayed) |
|---|
| 316 | | checkForSelectedCategories(); |
|---|
| 317 | | //call jScrollPane to adjust scrollbar size |
|---|
| 318 | | $('.scrollablePane').jScrollPane(); |
|---|
| 319 | | } |
|---|
| 320 | | |
|---|
| 321 | | ); |
|---|
| 322 | | |
|---|
| 323 | | $("#categSel .CB").click( |
|---|
| 324 | | function () { |
|---|
| 325 | | |
|---|
| 326 | | if ($(this).is(".checkBoxChecked")) |
|---|
| 327 | | { |
|---|
| 328 | | $(this).removeClass("checkBoxChecked"); |
|---|
| 329 | | $(this).addClass("checkBoxUnChecked"); |
|---|
| 330 | | // store the category id of the checkbox that has been clicked (this checkbox) |
|---|
| 331 | | var clickedCat=$(this).attr("categid"); |
|---|
| 332 | | |
|---|
| 333 | | //hide only those rows that have category id equal with the category id of the clicked |
|---|
| 334 | | // checkbox and valid file id (selected to be displayed) |
|---|
| 335 | | $("#filesSel .CB").each(function(index){ |
|---|
| 336 | | var fId = $(this).attr("fileid"); |
|---|
| 337 | | if ($(this).is(".checkBoxChecked")) { |
|---|
| 338 | | $("#loadedData td.category").filter(function(){return (($(this).attr("categid")==clickedCat)&&($(this).parent().attr("fileid")==fId));}).parent().filter(":not(.special)").hide(); |
|---|
| 339 | | } |
|---|
| 340 | | }); |
|---|
| 341 | | |
|---|
| 342 | | } |
|---|
| 343 | | else{ |
|---|
| 344 | | $(this).removeClass("checkBoxUnChecked"); |
|---|
| 345 | | $(this).addClass("checkBoxChecked"); |
|---|
| 346 | | var clickedCat=$(this).attr("categid"); |
|---|
| 347 | | |
|---|
| 348 | | //show only those rows that have category id equal with the category id of the clicked |
|---|
| 349 | | // checkbox and valid file id (selected to be displayed) |
|---|
| 350 | | |
|---|
| 351 | | $("#filesSel .CB").each(function(index){ |
|---|
| 352 | | var fId = $(this).attr("fileid"); |
|---|
| 353 | | if ($(this).is(".checkBoxChecked")) { |
|---|
| 354 | | $("#loadedData td.category").filter(function(){return (($(this).attr("categid")==clickedCat)&&($(this).parent().attr("fileid")==fId));}).parent().show(); |
|---|
| 355 | | } |
|---|
| 356 | | }); |
|---|
| 357 | | } |
|---|
| 358 | | //call jScrollPane to adjust scrollbar size |
|---|
| 359 | | $('.scrollablePane').jScrollPane(); |
|---|
| 360 | | }); |
|---|
| 361 | | |
|---|
| 362 | | $("#filesSel .CB").click( |
|---|
| 363 | | function (){ |
|---|
| 364 | | if ($(this).is(".checkBoxChecked")) { |
|---|
| 365 | | $(this).removeClass("checkBoxChecked"); |
|---|
| 366 | | $(this).addClass("checkBoxUnChecked"); |
|---|
| 367 | | |
|---|
| 368 | | // store the file id of the checkbox that has been clicked (this checkbox) |
|---|
| 369 | | var clickedFile=$(this).attr("fileid"); |
|---|
| 370 | | |
|---|
| 371 | | //hide only those rows that have the file id equal with the file id of the clicked |
|---|
| 372 | | // checkbox and valid category id (selected to be displayed) |
|---|
| 373 | | |
|---|
| 374 | | $("#categSel .CB").each(function(index){ |
|---|
| 375 | | var catId = $(this).attr("categid"); |
|---|
| 376 | | if ($(this).is(".checkBoxChecked")) { |
|---|
| 377 | | $("#loadedData td.category").filter(function(){return (($(this).attr("categid")==catId)&&($(this).parent().attr("fileid")==clickedFile));}).parent().filter(":not(.special)").hide(); |
|---|
| 378 | | } |
|---|
| 379 | | }); |
|---|
| 380 | | } |
|---|
| 381 | | else { |
|---|
| 382 | | $(this).removeClass("checkBoxUnChecked"); |
|---|
| 383 | | $(this).addClass("checkBoxChecked"); |
|---|
| 384 | | |
|---|
| 385 | | // store the file id of the checkbox that has been clicked (this checkbox) |
|---|
| 386 | | var clickedFile=$(this).attr("fileid"); |
|---|
| 387 | | |
|---|
| 388 | | //show only those rows that have the file id equal with the file id of the clicked |
|---|
| 389 | | // checkbox and valid category id (selected to be displayed) |
|---|
| 390 | | |
|---|
| 391 | | $("#categSel .CB").each(function(index){ |
|---|
| 392 | | var catId = $(this).attr("categid"); |
|---|
| 393 | | if ($(this).is(".checkBoxChecked")) { |
|---|
| 394 | | $("#loadedData td.category").filter(function(){return (($(this).attr("categid")==catId)&&($(this).parent().attr("fileid")==clickedFile));}).parent().show(); |
|---|
| 395 | | } |
|---|
| 396 | | }); |
|---|
| 397 | | } |
|---|
| 398 | | $('.scrollablePane').jScrollPane(); |
|---|
| 399 | | }); |
|---|
| 400 | | |
|---|
| 401 | | } |
|---|
| 402 | | |
|---|
| | 242 | // unbinds all events that were previously bound (to avoid bounding an event more than once) |
|---|
| | 243 | $(".CB").unbind(); |
|---|
| | 244 | // changes the appearance of the checkbox when mouse is over (highlights it) |
|---|
| | 245 | $(".CB").hover(function(){ |
|---|
| | 246 | $(this).addClass("hoverAccH"); |
|---|
| | 247 | }, function(){ |
|---|
| | 248 | $(this).removeClass("hoverAccH"); |
|---|
| | 249 | }); |
|---|
| | 250 | |
|---|
| | 251 | //code for the ShowAll checkbox from the category select |
|---|
| | 252 | // initially it is checked |
|---|
| | 253 | |
|---|
| | 254 | // Toggle between two function calls every other click. |
|---|
| | 255 | // Whenever a matched element is clicked, the first specified function is fired, when clicked again, the second is fired. All subsequent clicks continue to rotate through the two functions. |
|---|
| | 256 | $("#categShowAll").toggle(function(){ |
|---|
| | 257 | //unchecks it by removing the checkBoxChecked and adding checkBoxUnChecked |
|---|
| | 258 | $(this).removeClass("checkBoxChecked"); |
|---|
| | 259 | $(this).addClass("checkBoxUnChecked"); |
|---|
| | 260 | |
|---|
| | 261 | // unchecks all the other checkboxes from the category select part of the subAccordion |
|---|
| | 262 | $("#categSel .CB").removeClass("checkBoxChecked").addClass("checkBoxUnChecked"); |
|---|
| | 263 | |
|---|
| | 264 | //hides all row from the table with the id loadedData (the log view) |
|---|
| | 265 | // we discard the first row of the table (the one with the class special) |
|---|
| | 266 | // this first row is only for formatting purposes |
|---|
| | 267 | $("#loadedData tr").filter(":not(.special)").hide(); |
|---|
| | 268 | |
|---|
| | 269 | }, function(){ |
|---|
| | 270 | //checks it by removing the checkBoxUnChecked and adding checkBoxChecked |
|---|
| | 271 | $(this).removeClass("checkBoxUnChecked"); |
|---|
| | 272 | $(this).addClass("checkBoxChecked"); |
|---|
| | 273 | |
|---|
| | 274 | // checks all the other checkboxes from the category select part of the subAccordion |
|---|
| | 275 | $("#categSel .CB").removeClass("checkBoxUnChecked").addClass("checkBoxChecked"); |
|---|
| | 276 | |
|---|
| | 277 | // shows the table rows from the log view that have a file id among the file ids selected for viewing |
|---|
| | 278 | // A file id selected for viewing is one for which a checkbox from files select is checked(selected) |
|---|
| | 279 | $("#filesSel .CB").each(function(index){ |
|---|
| | 280 | var fId = $(this).attr("fileid"); |
|---|
| | 281 | if ($(this).is(".checkBoxChecked")) { |
|---|
| | 282 | $("#loadedData td.category").filter(function(){ |
|---|
| | 283 | return ($(this).parent().attr("fileid") == fId); |
|---|
| | 284 | }).parent().show(); |
|---|
| | 285 | } |
|---|
| | 286 | }); |
|---|
| | 287 | |
|---|
| | 288 | //calls jScrollPane to adjust scrollbar size |
|---|
| | 289 | $('.scrollablePane').jScrollPane(); |
|---|
| | 290 | }); |
|---|
| | 291 | |
|---|
| | 292 | $("#filesShowAll").toggle(function(){ |
|---|
| | 293 | //checks it by removing the checkBoxChecked and adding checkBoxUnChecked |
|---|
| | 294 | $(this).removeClass("checkBoxChecked"); |
|---|
| | 295 | $(this).addClass("checkBoxUnChecked"); |
|---|
| | 296 | |
|---|
| | 297 | // unchecks all the other checkboxes from the files select part of the subAccordion |
|---|
| | 298 | $("#filesSel .CB").removeClass("checkBoxChecked").addClass("checkBoxUnChecked"); |
|---|
| | 299 | $("#loadedData tr").filter(":not(.special)").hide(); |
|---|
| | 300 | |
|---|
| | 301 | }, function(){ |
|---|
| | 302 | //checks it by removing the checkBoxUnChecked and adding checkBoxChecked |
|---|
| | 303 | $(this).removeClass("checkBoxUnChecked"); |
|---|
| | 304 | $(this).addClass("checkBoxChecked"); |
|---|
| | 305 | // checks all the other checkboxes from the category select part of the subAccordion |
|---|
| | 306 | $("#filesSel .CB").removeClass("checkBoxUnChecked").addClass("checkBoxChecked"); |
|---|
| | 307 | |
|---|
| | 308 | //shows all table rows |
|---|
| | 309 | $("#loadedData tr").show(); |
|---|
| | 310 | //filter out the rows that should not be shown (contain categories that are not selected to be displayed) |
|---|
| | 311 | checkForSelectedCategories(); |
|---|
| | 312 | //call jScrollPane to adjust scrollbar size |
|---|
| | 313 | $('.scrollablePane').jScrollPane(); |
|---|
| | 314 | }); |
|---|
| | 315 | |
|---|
| | 316 | $("#categSel .CB").click(function(){ |
|---|
| | 317 | |
|---|
| | 318 | if ($(this).is(".checkBoxChecked")) { |
|---|
| | 319 | $(this).removeClass("checkBoxChecked"); |
|---|
| | 320 | $(this).addClass("checkBoxUnChecked"); |
|---|
| | 321 | // store the category id of the checkbox that has been clicked (this checkbox) |
|---|
| | 322 | var clickedCat = $(this).attr("categid"); |
|---|
| | 323 | |
|---|
| | 324 | //hide only those rows that have category id equal with the category id of the clicked |
|---|
| | 325 | // checkbox and valid file id (selected to be displayed) |
|---|
| | 326 | $("#filesSel .CB").each(function(index){ |
|---|
| | 327 | var fId = $(this).attr("fileid"); |
|---|
| | 328 | if ($(this).is(".checkBoxChecked")) { |
|---|
| | 329 | $("#loadedData td.category").filter(function(){ |
|---|
| | 330 | return (($(this).attr("categid") == clickedCat) && ($(this).parent().attr("fileid") == fId)); |
|---|
| | 331 | }).parent().filter(":not(.special)").hide(); |
|---|
| | 332 | } |
|---|
| | 333 | }); |
|---|
| | 334 | |
|---|
| | 335 | } |
|---|
| | 336 | else { |
|---|
| | 337 | $(this).removeClass("checkBoxUnChecked"); |
|---|
| | 338 | $(this).addClass("checkBoxChecked"); |
|---|
| | 339 | var clickedCat = $(this).attr("categid"); |
|---|
| | 340 | |
|---|
| | 341 | //show only those rows that have category id equal with the category id of the clicked |
|---|
| | 342 | // checkbox and valid file id (selected to be displayed) |
|---|
| | 343 | |
|---|
| | 344 | $("#filesSel .CB").each(function(index){ |
|---|
| | 345 | var fId = $(this).attr("fileid"); |
|---|
| | 346 | if ($(this).is(".checkBoxChecked")) { |
|---|
| | 347 | $("#loadedData td.category").filter(function(){ |
|---|
| | 348 | return (($(this).attr("categid") == clickedCat) && ($(this).parent().attr("fileid") == fId)); |
|---|
| | 349 | }).parent().show(); |
|---|
| | 350 | } |
|---|
| | 351 | }); |
|---|
| | 352 | } |
|---|
| | 353 | //call jScrollPane to adjust scrollbar size |
|---|
| | 354 | $('.scrollablePane').jScrollPane(); |
|---|
| | 355 | }); |
|---|
| | 356 | |
|---|
| | 357 | $("#filesSel .CB").click(function(){ |
|---|
| | 358 | if ($(this).is(".checkBoxChecked")) { |
|---|
| | 359 | $(this).removeClass("checkBoxChecked"); |
|---|
| | 360 | $(this).addClass("checkBoxUnChecked"); |
|---|
| | 361 | |
|---|
| | 362 | // store the file id of the checkbox that has been clicked (this checkbox) |
|---|
| | 363 | var clickedFile = $(this).attr("fileid"); |
|---|
| | 364 | |
|---|
| | 365 | //hide only those rows that have the file id equal with the file id of the clicked |
|---|
| | 366 | // checkbox and valid category id (selected to be displayed) |
|---|
| | 367 | |
|---|
| | 368 | $("#categSel .CB").each(function(index){ |
|---|
| | 369 | var catId = $(this).attr("categid"); |
|---|
| | 370 | if ($(this).is(".checkBoxChecked")) { |
|---|
| | 371 | $("#loadedData td.category").filter(function(){ |
|---|
| | 372 | return (($(this).attr("categid") == catId) && ($(this).parent().attr("fileid") == clickedFile)); |
|---|
| | 373 | }).parent().filter(":not(.special)").hide(); |
|---|
| | 374 | } |
|---|
| | 375 | }); |
|---|
| | 376 | } |
|---|
| | 377 | else { |
|---|
| | 378 | $(this).removeClass("checkBoxUnChecked"); |
|---|
| | 379 | $(this).addClass("checkBoxChecked"); |
|---|
| | 380 | |
|---|
| | 381 | // store the file id of the checkbox that has been clicked (this checkbox) |
|---|
| | 382 | var clickedFile = $(this).attr("fileid"); |
|---|
| | 383 | |
|---|
| | 384 | //show only those rows that have the file id equal with the file id of the clicked |
|---|
| | 385 | // checkbox and valid category id (selected to be displayed) |
|---|
| | 386 | |
|---|
| | 387 | $("#categSel .CB").each(function(index){ |
|---|
| | 388 | var catId = $(this).attr("categid"); |
|---|
| | 389 | if ($(this).is(".checkBoxChecked")) { |
|---|
| | 390 | $("#loadedData td.category").filter(function(){ |
|---|
| | 391 | return (($(this).attr("categid") == catId) && ($(this).parent().attr("fileid") == clickedFile)); |
|---|
| | 392 | }).parent().show(); |
|---|
| | 393 | } |
|---|
| | 394 | }); |
|---|
| | 395 | } |
|---|
| | 396 | $('.scrollablePane').jScrollPane(); |
|---|
| | 397 | }); |
|---|
| | 398 | |
|---|
| | 399 | } |
|---|
| | 400 | |
|---|