[1349] | 1 | function toggleEmployeesVisibility() |
---|
| 2 | { |
---|
| 3 | if ($('#employeesVisibility').attr('checked')) |
---|
| 4 | $('div.employees').show(); |
---|
| 5 | else |
---|
| 6 | $('div.employees').hide(); |
---|
| 7 | } |
---|
| 8 | |
---|
| 9 | function toggleHighlightSupervisor() |
---|
| 10 | { |
---|
| 11 | if ($('#highlightSupervisor').attr('checked')) |
---|
| 12 | $('p.supervisor').css('font-weight', 'bold'); |
---|
| 13 | else |
---|
| 14 | $('p.supervisor').css('font-weight', 'normal'); |
---|
| 15 | } |
---|
| 16 | |
---|
| 17 | function toggleOrgchartPathVisibility() |
---|
| 18 | { |
---|
| 19 | if ($('#orgchartPathVisibility').attr('checked')) |
---|
| 20 | { |
---|
| 21 | $('span.orgchartPath').css('visibility', 'visible').show(); |
---|
| 22 | } |
---|
| 23 | else |
---|
| 24 | { |
---|
| 25 | if ($('#orgchartPathIndentation').attr('checked')) |
---|
| 26 | $('span.orgchartPath').show().css('visibility', 'hidden'); |
---|
| 27 | else |
---|
| 28 | $('span.orgchartPath').hide(); |
---|
| 29 | } |
---|
| 30 | } |
---|
| 31 | |
---|
| 32 | function toggleOrgchartPathIndentation() |
---|
| 33 | { |
---|
| 34 | if ($('#orgchartPathIndentation').attr('checked')) |
---|
| 35 | { |
---|
| 36 | $('div.employees').each(function() |
---|
| 37 | { |
---|
| 38 | $(this).css('margin-left', (0 + $($(this).parent().children('h1').children().get(0)).width()) + 'px'); |
---|
| 39 | } |
---|
| 40 | ); |
---|
| 41 | if (!$('#orgchartPathVisibility').attr('checked')) |
---|
| 42 | $('span.orgchartPath').show().css('visibility', 'hidden'); |
---|
| 43 | } |
---|
| 44 | else |
---|
| 45 | { |
---|
| 46 | $('div.employees').css('margin-left', '0px'); |
---|
| 47 | if (!$('#orgchartPathVisibility').attr('checked')) |
---|
| 48 | $('span.orgchartPath').css('visibility', 'visible').hide(); |
---|
| 49 | else |
---|
| 50 | $('span.orgchartPath').css('visibility', 'visible'); |
---|
| 51 | } |
---|
| 52 | } |
---|
| 53 | |
---|
| 54 | function printAction() |
---|
| 55 | { |
---|
| 56 | window.print(); |
---|
| 57 | } |
---|
| 58 | |
---|
| 59 | function bindEvents() |
---|
| 60 | { |
---|
| 61 | $('#employeesVisibility').click(toggleEmployeesVisibility); |
---|
| 62 | $('#highlightSupervisor').click(toggleHighlightSupervisor); |
---|
| 63 | $('#orgchartPathVisibility').click(toggleOrgchartPathVisibility); |
---|
| 64 | $('#orgchartPathIndentation').click(toggleOrgchartPathIndentation); |
---|
| 65 | $('#printButton').click(printAction); |
---|
| 66 | } |
---|
| 67 | |
---|
| 68 | function initialSetup() |
---|
| 69 | { |
---|
| 70 | toggleEmployeesVisibility(); |
---|
| 71 | toggleHighlightSupervisor(); |
---|
| 72 | toggleOrgchartPathVisibility(); |
---|
| 73 | toggleOrgchartPathIndentation(); |
---|
| 74 | } |
---|
| 75 | |
---|
| 76 | function pageLoad() |
---|
| 77 | { |
---|
| 78 | bindEvents(); |
---|
| 79 | initialSetup(); |
---|
| 80 | } |
---|
| 81 | |
---|
| 82 | $(window).load(pageLoad); |
---|