| 7 | | // get the width and heigth of the window |
|---|
| 8 | | var wh=$(window).height(); |
|---|
| 9 | | var ww=$(window).width(); |
|---|
| 10 | | |
|---|
| 11 | | if (ww<minPageWidth){ |
|---|
| 12 | | ww=minPageWidth; |
|---|
| 13 | | |
|---|
| 14 | | window.innerWidth=ww; |
|---|
| 15 | | } |
|---|
| 16 | | |
|---|
| 17 | | if (wh<minPageHeight){ |
|---|
| 18 | | wh=minPageHeight; |
|---|
| 19 | | |
|---|
| 20 | | window.innerHeight=wh; |
|---|
| 21 | | } |
|---|
| 22 | | |
|---|
| 23 | | var lpw=$("#LeftPanel").width(); |
|---|
| 24 | | var lph=$("#LeftPanel").height(); |
|---|
| 25 | | var mct=$("#MapContainer").position().top; |
|---|
| 26 | | |
|---|
| 27 | | var horizExtraSpace = 60; |
|---|
| 28 | | var vertExtraSpace = 50; |
|---|
| 29 | | var mapPadding = 5; |
|---|
| 30 | | |
|---|
| 31 | | //set the width of the map container |
|---|
| 32 | | $("#MapContainer").width(ww-(lpw+horizExtraSpace)); |
|---|
| 33 | | $("#MapContainer>div").width(ww-(lpw+horizExtraSpace)-2*mapPadding); |
|---|
| 34 | | |
|---|
| 35 | | var imgH=$("#MapContainer div").height(); |
|---|
| 36 | | var imgW=$("#MapContainer div").width(); |
|---|
| 37 | | var imgPH=$("#MapContainer div").parent().height(); |
|---|
| 38 | | var imgPW=$("#MapContainer div").parent().width(); |
|---|
| 39 | | if (imgH<imgPH) $("#MapContainer div").height(imgPH); |
|---|
| 40 | | if (imgW<imgPW) $("#MapContainer div").height(imgPW); |
|---|
| 41 | | // gets the padding of the left panel |
|---|
| 42 | | var paddingLP=$("#LeftPanel").css("paddingTop"); |
|---|
| 43 | | // the returned string is sliced, the last two chars are discarded |
|---|
| 44 | | // because the string returned has the format numberpx (for example "100px") |
|---|
| 45 | | padLP=paddingLP.slice(0,paddingLP.length-2); |
|---|
| 46 | | |
|---|
| 47 | | //the distance from the top of the page is returned by offset().top |
|---|
| 48 | | var topLP=$("#LeftPanel").offset().top; |
|---|
| 49 | | var newLPh; |
|---|
| 50 | | |
|---|
| 51 | | //set the height of the map container |
|---|
| 52 | | $("#MapContainer").height(wh-(mct+vertExtraSpace)); |
|---|
| 53 | | $("#MapContainer>div").height(wh-(mct+vertExtraSpace-2*mapPadding)); |
|---|
| 54 | | |
|---|
| 55 | | $("#LeftPanel").height(wh-padLP-topLP); |
|---|
| 56 | | newLPh=wh-padLP-topLP; |
|---|
| 57 | | |
|---|
| 58 | | var tableTop=$("#divTable").parent().offset().top; |
|---|
| 59 | | |
|---|
| 60 | | var dT=$("#divTable"); |
|---|
| 61 | | |
|---|
| 62 | | $(dT).parent().height(newLPh-tableTop); |
|---|
| 63 | | $(dT).width($(dT).parent().parent().width()-10).parent().width($(dT).parent().parent().width()-10); |
|---|
| 64 | | $('.subOpScrollPane').width($(dT).width()-35).parent().width($(dT).width()-30); |
|---|
| 65 | | $(".tableHeader").width($(dT).width()); |
|---|
| 66 | | |
|---|
| 67 | | $('.scrollablePane').jScrollPane(); |
|---|
| 68 | | |
|---|
| | 7 | // get the width and heigth of the window |
|---|
| | 8 | var wh = $(window).height(); |
|---|
| | 9 | var ww = $(window).width(); |
|---|
| | 10 | |
|---|
| | 11 | if (ww < minPageWidth) { |
|---|
| | 12 | ww = minPageWidth; |
|---|
| | 13 | |
|---|
| | 14 | window.innerWidth = ww; |
|---|
| | 15 | } |
|---|
| | 16 | |
|---|
| | 17 | if (wh < minPageHeight) { |
|---|
| | 18 | wh = minPageHeight; |
|---|
| | 19 | |
|---|
| | 20 | window.innerHeight = wh; |
|---|
| | 21 | } |
|---|
| | 22 | |
|---|
| | 23 | var lpw = $("#LeftPanel").width(); |
|---|
| | 24 | var lph = $("#LeftPanel").height(); |
|---|
| | 25 | var mct = $("#MapContainer").position().top; |
|---|
| | 26 | |
|---|
| | 27 | var horizExtraSpace = 60; |
|---|
| | 28 | var vertExtraSpace = 50; |
|---|
| | 29 | var mapPadding = 5; |
|---|
| | 30 | |
|---|
| | 31 | //set the width of the map container |
|---|
| | 32 | $("#MapContainer").width(ww - (lpw + horizExtraSpace)); |
|---|
| | 33 | $("#MapContainer>div").width(ww - (lpw + horizExtraSpace) - 2 * mapPadding); |
|---|
| | 34 | |
|---|
| | 35 | var imgH = $("#MapContainer div").height(); |
|---|
| | 36 | var imgW = $("#MapContainer div").width(); |
|---|
| | 37 | var imgPH = $("#MapContainer div").parent().height(); |
|---|
| | 38 | var imgPW = $("#MapContainer div").parent().width(); |
|---|
| | 39 | if (imgH < imgPH) |
|---|
| | 40 | $("#MapContainer div").height(imgPH); |
|---|
| | 41 | if (imgW < imgPW) |
|---|
| | 42 | $("#MapContainer div").height(imgPW); |
|---|
| | 43 | // gets the padding of the left panel |
|---|
| | 44 | var paddingLP = $("#LeftPanel").css("paddingTop"); |
|---|
| | 45 | // the returned string is sliced, the last two chars are discarded |
|---|
| | 46 | // because the string returned has the format numberpx (for example "100px") |
|---|
| | 47 | padLP = paddingLP.slice(0, paddingLP.length - 2); |
|---|
| | 48 | |
|---|
| | 49 | //the distance from the top of the page is returned by offset().top |
|---|
| | 50 | var topLP = $("#LeftPanel").offset().top; |
|---|
| | 51 | var newLPh; |
|---|
| | 52 | |
|---|
| | 53 | //set the height of the map container |
|---|
| | 54 | $("#MapContainer").height(wh - (mct + vertExtraSpace)); |
|---|
| | 55 | $("#MapContainer>div").height(wh - (mct + vertExtraSpace - 2 * mapPadding)); |
|---|
| | 56 | |
|---|
| | 57 | $("#LeftPanel").height(wh - padLP - topLP); |
|---|
| | 58 | newLPh = wh - padLP - topLP; |
|---|
| | 59 | |
|---|
| | 60 | var tableTop = $("#divTable").parent().offset().top; |
|---|
| | 61 | |
|---|
| | 62 | var dT = $("#divTable"); |
|---|
| | 63 | |
|---|
| | 64 | $(dT).parent().height(newLPh - tableTop); |
|---|
| | 65 | $(dT).width($(dT).parent().parent().width() - 10).parent().width($(dT).parent().parent().width() - 10); |
|---|
| | 66 | $('.subOpScrollPane').width($(dT).width() - 35).parent().width($(dT).width() - 30); |
|---|
| | 67 | $(".tableHeader").width($(dT).width()); |
|---|
| | 68 | |
|---|
| | 69 | $('.scrollablePane').jScrollPane(); |
|---|
| | 70 | |
|---|
| 79 | | //create a scrollable pane for the log view |
|---|
| 80 | | $('.scrollablePane').jScrollPane(); |
|---|
| 81 | | $("#categSel, #filesSel").addClass("subOpScrollPane"); |
|---|
| 82 | | //create a scrollable pane for the category select and files select |
|---|
| 83 | | $(".subOpScrollPane").jScrollPane(); |
|---|
| 84 | | |
|---|
| 85 | | |
|---|
| 86 | | |
|---|
| 87 | | //sets the dimensions of the page elements according to window size |
|---|
| 88 | | setDimensions(); |
|---|
| 89 | | |
|---|
| 90 | | var dT=$("#divTable"); |
|---|
| 91 | | //adjust the size of the log view the first time the page is loaded |
|---|
| 92 | | $(dT).parent().height($(dT).parent().height()+120); |
|---|
| 93 | | |
|---|
| 94 | | addMapNameClickEvent(); |
|---|
| 95 | | addEventsToTableRows(); |
|---|
| 96 | | addEventsToSubAccCheckBoxes(); |
|---|
| 97 | | addHoverEvents(); |
|---|
| 98 | | // Code for wrapping the text inside the log view |
|---|
| 99 | | addWrapTextEvent(); |
|---|
| 100 | | |
|---|
| 101 | | |
|---|
| 102 | | //code attached to the button that hides the LeftPanel |
|---|
| 103 | | $("#hideCtrlLeftPanel").toggle( function(){ |
|---|
| 104 | | var jqCtrlPanel=this; |
|---|
| 105 | | $("#LeftPanel").animate({ |
|---|
| 106 | | width: "0px", |
|---|
| 107 | | paddingLeft:"9px" |
|---|
| 108 | | }, |
|---|
| 109 | | { duration: "slow", |
|---|
| 110 | | easing: "easein", |
|---|
| 111 | | complete: function(){ |
|---|
| 112 | | |
|---|
| 113 | | $("#hideCtrlLeftPanel img").attr("src","images/showControl.gif"); |
|---|
| 114 | | setDimensions(); |
|---|
| 115 | | $(this).children().filter(":not(#hideCtrlLeftPanel)").hide(); |
|---|
| 116 | | } |
|---|
| 117 | | } ); |
|---|
| 118 | | }, |
|---|
| 119 | | function(){ |
|---|
| 120 | | $("#LeftPanel").children().show().end().animate({ |
|---|
| 121 | | width: "290px", |
|---|
| 122 | | paddingLeft:"12px" |
|---|
| 123 | | }, |
|---|
| 124 | | { duration: "slow", |
|---|
| 125 | | easing: "easein", |
|---|
| 126 | | complete: function(){ |
|---|
| 127 | | |
|---|
| 128 | | $("#hideCtrlLeftPanel img").attr("src","images/hideControl.gif"); |
|---|
| 129 | | setDimensions(); |
|---|
| 130 | | } |
|---|
| 131 | | }); |
|---|
| 132 | | }); |
|---|
| 133 | | |
|---|
| 134 | | // Allow resizing of the Left Panel |
|---|
| 135 | | // when the resizing is finished setDimensions is called in order to adjust |
|---|
| 136 | | // the dimensions of the elements in the page |
|---|
| 137 | | |
|---|
| 138 | | $("#LeftPanel").resizable({ |
|---|
| 139 | | handles:{ e:"#resizeHandle"}, |
|---|
| 140 | | minWidth:290, |
|---|
| 141 | | maxWidth:600, |
|---|
| 142 | | stop:function(e,ui){ |
|---|
| 143 | | setDimensions(); |
|---|
| 144 | | } |
|---|
| 145 | | }); |
|---|
| 146 | | |
|---|
| 147 | | |
|---|
| 148 | | |
|---|
| 149 | | // code for styling the <input type="file"/> element |
|---|
| 150 | | $("input[type=file]").stylefile({ |
|---|
| 151 | | image: "images/browse.gif", |
|---|
| 152 | | imageheight : 20, |
|---|
| 153 | | imagewidth : 78, |
|---|
| 154 | | width : 200 |
|---|
| 155 | | }); |
|---|
| 156 | | |
|---|
| 157 | | //Recalculate dimensions when the window gets resized |
|---|
| 158 | | $(window).resize(function(){ |
|---|
| 159 | | setDimensions(); |
|---|
| 160 | | }); |
|---|
| 161 | | |
|---|
| 162 | | |
|---|
| 163 | | //the accordion behaviour (the outermost accordion) |
|---|
| 164 | | // Each part of an accordion contains a head and a body |
|---|
| 165 | | // when the head is clicked the body is shown or hidden |
|---|
| 166 | | // the size of the log view is recomputed taking into account the size of the current visible part of the accordion |
|---|
| 167 | | // divTable is the id of the div element containing the log View |
|---|
| 168 | | // the parrent of the divTable element (in the DOM tree) is a div with the class jScrollPaneContainer. This div contains the custom scrollbars and is created by calling jScrollPane() |
|---|
| 169 | | $('#Options .accordionHead:first').addClass("selected"); |
|---|
| 170 | | $('#Options .accordionBody').not(":first").hide(); |
|---|
| 171 | | |
|---|
| 172 | | $('#Options .accordionHead').click(function(){ |
|---|
| 173 | | var lph=$("#LeftPanel").height(); |
|---|
| 174 | | var dT=$("#divTable"); |
|---|
| 175 | | var tableTop=$("#divTable").parent().offset().top; |
|---|
| 176 | | var curPanelHeight=$(this).next().height(); |
|---|
| 177 | | var newTableHeight=0; |
|---|
| 178 | | if ($(this).is(":not(.selected)")){ |
|---|
| 179 | | var openedPanel=$('#Options .accordionHead').filter(".selected"); |
|---|
| 180 | | |
|---|
| 181 | | var oph=0; |
|---|
| 182 | | if (openedPanel.length>0) |
|---|
| 183 | | { |
|---|
| 184 | | $(openedPanel) |
|---|
| 185 | | .removeClass("selected") |
|---|
| 186 | | .next() |
|---|
| 187 | | .slideUp("slow"); |
|---|
| 188 | | oph= $(openedPanel).next().height(); |
|---|
| 189 | | } |
|---|
| 190 | | |
|---|
| 191 | | newTableHeight = lph - tableTop + oph - curPanelHeight; |
|---|
| 192 | | |
|---|
| 193 | | $(this).addClass("selected"); |
|---|
| 194 | | setScrollPane($(this).next()); |
|---|
| 195 | | |
|---|
| 196 | | |
|---|
| 197 | | } |
|---|
| 198 | | else{ |
|---|
| 199 | | |
|---|
| 200 | | newTableHeight = lph - tableTop + curPanelHeight; |
|---|
| 201 | | |
|---|
| 202 | | $('#Options .accordionHead').filter(".selected").removeClass("selected").next().slideUp("slow"); |
|---|
| 203 | | |
|---|
| 204 | | } |
|---|
| 205 | | |
|---|
| 206 | | $(dT).parent().height(newTableHeight); |
|---|
| 207 | | $(dT).width($(dT).parent().parent().width()-10); |
|---|
| 208 | | $(dT).parent().width($(dT).parent().parent().width()-10); |
|---|
| 209 | | $(".tableHeader").width($(dT).width()); |
|---|
| 210 | | |
|---|
| 211 | | |
|---|
| 212 | | $('.scrollablePane').jScrollPane(); |
|---|
| 213 | | }); |
|---|
| 214 | | |
|---|
| 215 | | // code for the subAccordion (the inner accordion) |
|---|
| 216 | | $('#subOptions .subAccordionHead:first').addClass("selected"); |
|---|
| 217 | | $('#subOptions .subAccordionBody').not(":first").hide(); |
|---|
| 218 | | $('#subOptions .subAccordionHead').click(function(){ |
|---|
| 219 | | if ($(this).is(":not(.selected)")){ |
|---|
| 220 | | $('#subOptions .subAccordionHead').filter(".selected").removeClass("selected").next().hide(); |
|---|
| 221 | | $(this).addClass("selected"); |
|---|
| 222 | | $(this).next().fadeIn("slow"); |
|---|
| 223 | | |
|---|
| 224 | | } |
|---|
| 225 | | }); |
|---|
| 226 | | |
|---|
| 227 | | |
|---|
| 228 | | |
|---|
| 229 | | |
|---|
| 230 | | |
|---|
| 231 | | }); |
|---|
| 232 | | |
|---|
| | 81 | //create a scrollable pane for the log view |
|---|
| | 82 | $('.scrollablePane').jScrollPane(); |
|---|
| | 83 | $("#categSel, #filesSel").addClass("subOpScrollPane"); |
|---|
| | 84 | //create a scrollable pane for the category select and files select |
|---|
| | 85 | $(".subOpScrollPane").jScrollPane(); |
|---|
| | 86 | |
|---|
| | 87 | |
|---|
| | 88 | |
|---|
| | 89 | //sets the dimensions of the page elements according to window size |
|---|
| | 90 | setDimensions(); |
|---|
| | 91 | |
|---|
| | 92 | var dT = $("#divTable"); |
|---|
| | 93 | //adjust the size of the log view the first time the page is loaded |
|---|
| | 94 | $(dT).parent().height($(dT).parent().height() + 120); |
|---|
| | 95 | |
|---|
| | 96 | addMapNameClickEvent(); |
|---|
| | 97 | addEventsToTableRows(); |
|---|
| | 98 | addEventsToSubAccCheckBoxes(); |
|---|
| | 99 | addHoverEvents(); |
|---|
| | 100 | // Code for wrapping the text inside the log view |
|---|
| | 101 | addWrapTextEvent(); |
|---|
| | 102 | |
|---|
| | 103 | |
|---|
| | 104 | //code attached to the button that hides the LeftPanel |
|---|
| | 105 | $("#hideCtrlLeftPanel").toggle(function(){ |
|---|
| | 106 | var jqCtrlPanel = this; |
|---|
| | 107 | $("#LeftPanel").animate({ |
|---|
| | 108 | width: "0px", |
|---|
| | 109 | paddingLeft: "9px" |
|---|
| | 110 | }, { |
|---|
| | 111 | duration: "slow", |
|---|
| | 112 | easing: "easein", |
|---|
| | 113 | complete: function(){ |
|---|
| | 114 | |
|---|
| | 115 | $("#hideCtrlLeftPanel img").attr("src", "images/showControl.gif"); |
|---|
| | 116 | setDimensions(); |
|---|
| | 117 | $(this).children().filter(":not(#hideCtrlLeftPanel)").hide(); |
|---|
| | 118 | } |
|---|
| | 119 | }); |
|---|
| | 120 | }, function(){ |
|---|
| | 121 | $("#LeftPanel").children().show().end().animate({ |
|---|
| | 122 | width: "290px", |
|---|
| | 123 | paddingLeft: "12px" |
|---|
| | 124 | }, { |
|---|
| | 125 | duration: "slow", |
|---|
| | 126 | easing: "easein", |
|---|
| | 127 | complete: function(){ |
|---|
| | 128 | |
|---|
| | 129 | $("#hideCtrlLeftPanel img").attr("src", "images/hideControl.gif"); |
|---|
| | 130 | setDimensions(); |
|---|
| | 131 | } |
|---|
| | 132 | }); |
|---|
| | 133 | }); |
|---|
| | 134 | |
|---|
| | 135 | // Allow resizing of the Left Panel |
|---|
| | 136 | // when the resizing is finished setDimensions is called in order to adjust |
|---|
| | 137 | // the dimensions of the elements in the page |
|---|
| | 138 | |
|---|
| | 139 | $("#LeftPanel").resizable({ |
|---|
| | 140 | handles: { |
|---|
| | 141 | e: "#resizeHandle" |
|---|
| | 142 | }, |
|---|
| | 143 | minWidth: 290, |
|---|
| | 144 | maxWidth: 600, |
|---|
| | 145 | stop: function(e, ui){ |
|---|
| | 146 | setDimensions(); |
|---|
| | 147 | } |
|---|
| | 148 | }); |
|---|
| | 149 | |
|---|
| | 150 | |
|---|
| | 151 | |
|---|
| | 152 | // code for styling the <input type="file"/> element |
|---|
| | 153 | $("input[type=file]").stylefile({ |
|---|
| | 154 | image: "images/browse.gif", |
|---|
| | 155 | imageheight: 20, |
|---|
| | 156 | imagewidth: 78, |
|---|
| | 157 | width: 200 |
|---|
| | 158 | }); |
|---|
| | 159 | |
|---|
| | 160 | //Recalculate dimensions when the window gets resized |
|---|
| | 161 | $(window).resize(function(){ |
|---|
| | 162 | setDimensions(); |
|---|
| | 163 | }); |
|---|
| | 164 | |
|---|
| | 165 | |
|---|
| | 166 | //the accordion behaviour (the outermost accordion) |
|---|
| | 167 | // Each part of an accordion contains a head and a body |
|---|
| | 168 | // when the head is clicked the body is shown or hidden |
|---|
| | 169 | // the size of the log view is recomputed taking into account the size of the current visible part of the accordion |
|---|
| | 170 | // divTable is the id of the div element containing the log View |
|---|
| | 171 | // the parrent of the divTable element (in the DOM tree) is a div with the class jScrollPaneContainer. This div contains the custom scrollbars and is created by calling jScrollPane() |
|---|
| | 172 | $('#Options .accordionHead:first').addClass("selected"); |
|---|
| | 173 | $('#Options .accordionBody').not(":first").hide(); |
|---|
| | 174 | |
|---|
| | 175 | $('#Options .accordionHead').click(function(){ |
|---|
| | 176 | var lph = $("#LeftPanel").height(); |
|---|
| | 177 | var dT = $("#divTable"); |
|---|
| | 178 | var tableTop = $("#divTable").parent().offset().top; |
|---|
| | 179 | var curPanelHeight = $(this).next().height(); |
|---|
| | 180 | var newTableHeight = 0; |
|---|
| | 181 | if ($(this).is(":not(.selected)")) { |
|---|
| | 182 | var openedPanel = $('#Options .accordionHead').filter(".selected"); |
|---|
| | 183 | |
|---|
| | 184 | var oph = 0; |
|---|
| | 185 | if (openedPanel.length > 0) { |
|---|
| | 186 | $(openedPanel).removeClass("selected").next().slideUp("slow"); |
|---|
| | 187 | oph = $(openedPanel).next().height(); |
|---|
| | 188 | } |
|---|
| | 189 | |
|---|
| | 190 | newTableHeight = lph - tableTop + oph - curPanelHeight; |
|---|
| | 191 | |
|---|
| | 192 | $(this).addClass("selected"); |
|---|
| | 193 | setScrollPane($(this).next()); |
|---|
| | 194 | |
|---|
| | 195 | |
|---|
| | 196 | } |
|---|
| | 197 | else { |
|---|
| | 198 | |
|---|
| | 199 | newTableHeight = lph - tableTop + curPanelHeight; |
|---|
| | 200 | |
|---|
| | 201 | $('#Options .accordionHead').filter(".selected").removeClass("selected").next().slideUp("slow"); |
|---|
| | 202 | |
|---|
| | 203 | } |
|---|
| | 204 | |
|---|
| | 205 | $(dT).parent().height(newTableHeight); |
|---|
| | 206 | $(dT).width($(dT).parent().parent().width() - 10); |
|---|
| | 207 | $(dT).parent().width($(dT).parent().parent().width() - 10); |
|---|
| | 208 | $(".tableHeader").width($(dT).width()); |
|---|
| | 209 | |
|---|
| | 210 | |
|---|
| | 211 | $('.scrollablePane').jScrollPane(); |
|---|
| | 212 | }); |
|---|
| | 213 | |
|---|
| | 214 | // code for the subAccordion (the inner accordion) |
|---|
| | 215 | $('#subOptions .subAccordionHead:first').addClass("selected"); |
|---|
| | 216 | $('#subOptions .subAccordionBody').not(":first").hide(); |
|---|
| | 217 | $('#subOptions .subAccordionHead').click(function(){ |
|---|
| | 218 | if ($(this).is(":not(.selected)")) { |
|---|
| | 219 | $('#subOptions .subAccordionHead').filter(".selected").removeClass("selected").next().hide(); |
|---|
| | 220 | $(this).addClass("selected"); |
|---|
| | 221 | $(this).next().fadeIn("slow"); |
|---|
| | 222 | |
|---|
| | 223 | } |
|---|
| | 224 | }); |
|---|
| | 225 | |
|---|
| | 226 | |
|---|
| | 227 | |
|---|
| | 228 | |
|---|
| | 229 | |
|---|
| | 230 | }); |
|---|
| | 231 | |
|---|