diff options
Diffstat (limited to 'src/main/resources')
10 files changed, 85 insertions, 6075 deletions
diff --git a/src/main/resources/META-INF/resources/designer/css/dataTables.bootstrap.css b/src/main/resources/META-INF/resources/designer/css/dataTables.bootstrap.css deleted file mode 100644 index c07dac9a6..000000000 --- a/src/main/resources/META-INF/resources/designer/css/dataTables.bootstrap.css +++ /dev/null @@ -1,233 +0,0 @@ -div.dataTables_length label { - float: left; - text-align: left; - font-weight: normal; -} - -div.dataTables_length select { - width: 75px; -} - -div.dataTables_filter label { - float: right; - font-weight: normal; -} - -div.dataTables_filter input { - width: 16em; -} - -div.dataTables_info { - padding-top: 8px; -} - -div.dataTables_paginate { - float: right; - margin: 0; -} - -div.dataTables_paginate ul.pagination { - margin: 2px 0; - white-space: nowrap; -} - -table.dataTable, -table.dataTable td, -table.dataTable th { - -webkit-box-sizing: content-box; - -moz-box-sizing: content-box; - box-sizing: content-box; -} - -table.dataTable { - clear: both; - margin-top: 6px !important; - margin-bottom: 6px !important; - max-width: none !important; -} - -table.dataTable thead .sorting, -table.dataTable thead .sorting_asc, -table.dataTable thead .sorting_desc, -table.dataTable thead .sorting_asc_disabled, -table.dataTable thead .sorting_desc_disabled { - cursor: pointer; -} - -table.dataTable thead .sorting { - background: url('../images/sort_both.png') no-repeat center right; -} - -table.dataTable thead .sorting_asc { - background: url('../images/sort_asc.png') no-repeat center right; -} - -table.dataTable thead .sorting_desc { - background: url('../images/sort_desc.png') no-repeat center right; -} - -table.dataTable thead .sorting_asc_disabled { - background: url('../images/sort_asc_disabled.png') no-repeat center right; -} - -table.dataTable thead .sorting_desc_disabled { - background: url('../images/sort_desc_disabled.png') no-repeat center right; -} - -table.dataTable th:active { - outline: none; -} - -/* Scrolling */ - -div.dataTables_scrollHead table { - margin-bottom: 0 !important; - border-bottom-left-radius: 0; - border-bottom-right-radius: 0; -} - -div.dataTables_scrollHead table thead tr:last-child th:first-child, -div.dataTables_scrollHead table thead tr:last-child td:first-child { - border-bottom-left-radius: 0 !important; - border-bottom-right-radius: 0 !important; -} - -div.dataTables_scrollBody table { - margin-top: 0 !important; - margin-bottom: 0 !important; - border-top: none; -} - -div.dataTables_scrollBody tbody tr:first-child th, -div.dataTables_scrollBody tbody tr:first-child td { - border-top: none; -} - -div.dataTables_scrollFoot table { - margin-top: 0 !important; - border-top: none; -} - -/* - * TableTools styles - */ - -.table tbody tr.active td, -.table tbody tr.active th { - color: white; - background-color: #08C; -} - -.table tbody tr.active:hover td, -.table tbody tr.active:hover th { - background-color: #0075b0 !important; -} - -.table tbody tr.active a { - color: white; -} - -.table-striped tbody tr.active:nth-child(odd) td, -.table-striped tbody tr.active:nth-child(odd) th { - background-color: #017ebc; -} - -table.DTTT_selectable tbody tr { - cursor: pointer; -} - -div.DTTT .btn { - font-size: 12px; - color: #333 !important; -} - -div.DTTT .btn:hover { - text-decoration: none !important; -} - -ul.DTTT_dropdown.dropdown-menu { - z-index: 2003; -} - -ul.DTTT_dropdown.dropdown-menu a { - color: #333 !important; /* needed only when demo_page.css is included */ -} - -ul.DTTT_dropdown.dropdown-menu li { - position: relative; -} - -ul.DTTT_dropdown.dropdown-menu li:hover a { - color: white !important; - background-color: #0088cc; -} - -div.DTTT_collection_background { - z-index: 2002; -} - -/* TableTools information display */ - -div.DTTT_print_info.modal { - height: 150px; - margin-top: -75px; - text-align: center; -} - -div.DTTT_print_info h6 { - margin: 1em; - font-size: 28px; - font-weight: normal; - line-height: 28px; -} - -div.DTTT_print_info p { - font-size: 14px; - line-height: 20px; -} - -/* - * FixedColumns styles - */ - -div.DTFC_LeftHeadWrapper table, -div.DTFC_LeftFootWrapper table, -div.DTFC_RightHeadWrapper table, -div.DTFC_RightFootWrapper table, -table.DTFC_Cloned tr.even { - background-color: white; -} - -div.DTFC_RightHeadWrapper table, -div.DTFC_LeftHeadWrapper table { - margin-bottom: 0 !important; - border-top-right-radius: 0 !important; - border-bottom-left-radius: 0 !important; - border-bottom-right-radius: 0 !important; -} - -div.DTFC_RightHeadWrapper table thead tr:last-child th:first-child, -div.DTFC_RightHeadWrapper table thead tr:last-child td:first-child, -div.DTFC_LeftHeadWrapper table thead tr:last-child th:first-child, -div.DTFC_LeftHeadWrapper table thead tr:last-child td:first-child { - border-bottom-left-radius: 0 !important; - border-bottom-right-radius: 0 !important; -} - -div.DTFC_RightBodyWrapper table, -div.DTFC_LeftBodyWrapper table { - margin-bottom: 0 !important; - border-top: none; -} - -div.DTFC_RightBodyWrapper tbody tr:first-child th, -div.DTFC_RightBodyWrapper tbody tr:first-child td, -div.DTFC_LeftBodyWrapper tbody tr:first-child th, -div.DTFC_LeftBodyWrapper tbody tr:first-child td { - border-top: none; -} - -div.DTFC_RightFootWrapper table, -div.DTFC_LeftFootWrapper table { - border-top: none; -} diff --git a/src/main/resources/META-INF/resources/designer/css/dataTables.fixedColumns.css b/src/main/resources/META-INF/resources/designer/css/dataTables.fixedColumns.css deleted file mode 100644 index ee75c2654..000000000 --- a/src/main/resources/META-INF/resources/designer/css/dataTables.fixedColumns.css +++ /dev/null @@ -1,22 +0,0 @@ -/* Block out what is behind the fixed column's header and footer */ -table.DTFC_Cloned thead, -table.DTFC_Cloned tfoot { - background-color: white; -} - -/* Block out the gap above the scrollbar on the right, when there is a fixed - * right column - */ -div.DTFC_Blocker { - background-color: white; -} - -div.DTFC_LeftWrapper table.dataTable, -div.DTFC_RightWrapper table.dataTable { - margin-bottom: 0; -} - -div.DTFC_LeftWrapper table.dataTable.no-footer, -div.DTFC_RightWrapper table.dataTable.no-footer { - border-bottom: none; -} diff --git a/src/main/resources/META-INF/resources/designer/css/dataTables.tableTools.css b/src/main/resources/META-INF/resources/designer/css/dataTables.tableTools.css deleted file mode 100644 index 844ca421f..000000000 --- a/src/main/resources/META-INF/resources/designer/css/dataTables.tableTools.css +++ /dev/null @@ -1,361 +0,0 @@ -/* - * File: TableTools.css - * Description: Styles for TableTools 2 - * Author: Allan Jardine (www.sprymedia.co.uk) - * Language: Javascript - * License: GPL v2 / 3 point BSD - * Project: DataTables - * - * Copyright 2009-2012 Allan Jardine, all rights reserved. - * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * - * CSS name space: - * DTTT DataTables TableTools - * - * Style sheet provides: - * CONTAINER TableTools container element and styles applying to all components - * BUTTON_STYLES Action specific button styles - * SELECTING Row selection styles - * COLLECTIONS Drop down list (collection) styles - * PRINTING Print display styles - */ - - -/* - * CONTAINER - * TableTools container element and styles applying to all components - */ -div.DTTT_container { - position: relative; - float: right; - margin-bottom: 1em; -} - -@media screen and (max-width: 640px) { - div.DTTT_container { - float: none !important; - text-align: center; - } - - div.DTTT_container:after { - visibility: hidden; - display: block; - content: ""; - clear: both; - height: 0; - } -} - - -button.DTTT_button, -div.DTTT_button, -a.DTTT_button { - position: relative; - display: inline-block; - margin-right: 3px; - padding: 5px 8px; - border: 1px solid #999; - cursor: pointer; - *cursor: hand; - font-size: 0.88em; - color: black !important; - - -webkit-border-radius: 2px; - -moz-border-radius: 2px; - -ms-border-radius: 2px; - -o-border-radius: 2px; - border-radius: 2px; - - -webkit-box-shadow: 1px 1px 3px #ccc; - -moz-box-shadow: 1px 1px 3px #ccc; - -ms-box-shadow: 1px 1px 3px #ccc; - -o-box-shadow: 1px 1px 3px #ccc; - box-shadow: 1px 1px 3px #ccc; - - /* Generated by http://www.colorzilla.com/gradient-editor/ */ - background: #ffffff; /* Old browsers */ - background: -webkit-linear-gradient(top, #ffffff 0%,#f3f3f3 89%,#f9f9f9 100%); /* Chrome10+,Safari5.1+ */ - background: -moz-linear-gradient(top, #ffffff 0%,#f3f3f3 89%,#f9f9f9 100%); /* FF3.6+ */ - background: -ms-linear-gradient(top, #ffffff 0%,#f3f3f3 89%,#f9f9f9 100%); /* IE10+ */ - background: -o-linear-gradient(top, #ffffff 0%,#f3f3f3 89%,#f9f9f9 100%); /* Opera 11.10+ */ - background: linear-gradient(top, #ffffff 0%,#f3f3f3 89%,#f9f9f9 100%); /* W3C */ - filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#f9f9f9',GradientType=0 ); /* IE6-9 */ -} - - -/* Buttons are cunning border-box sizing - we can't just use that for A and DIV due to IE6/7 */ -button.DTTT_button { - height: 30px; - padding: 3px 8px; -} - -.DTTT_button embed { - outline: none; -} - -button.DTTT_button:hover, -div.DTTT_button:hover, -a.DTTT_button:hover { - border: 1px solid #666; - text-decoration: none !important; - - -webkit-box-shadow: 1px 1px 3px #999; - -moz-box-shadow: 1px 1px 3px #999; - -ms-box-shadow: 1px 1px 3px #999; - -o-box-shadow: 1px 1px 3px #999; - box-shadow: 1px 1px 3px #999; - - background: #f3f3f3; /* Old browsers */ - background: -webkit-linear-gradient(top, #f3f3f3 0%,#e2e2e2 89%,#f4f4f4 100%); /* Chrome10+,Safari5.1+ */ - background: -moz-linear-gradient(top, #f3f3f3 0%,#e2e2e2 89%,#f4f4f4 100%); /* FF3.6+ */ - background: -ms-linear-gradient(top, #f3f3f3 0%,#e2e2e2 89%,#f4f4f4 100%); /* IE10+ */ - background: -o-linear-gradient(top, #f3f3f3 0%,#e2e2e2 89%,#f4f4f4 100%); /* Opera 11.10+ */ - background: linear-gradient(top, #f3f3f3 0%,#e2e2e2 89%,#f4f4f4 100%); /* W3C */ - filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f3f3f3', endColorstr='#f4f4f4',GradientType=0 ); /* IE6-9 */ -} - -button.DTTT_button:focus, -div.DTTT_button:focus, -a.DTTT_button:focus { - border: 1px solid #426c9e; - text-shadow: 0 1px 0 #c4def1; - outline: none; - - background-color: #a3d0ef 100%; - background-image: -webkit-linear-gradient(top, #a3d0ef 0%, #79ace9 65%, #a3d0ef 100%); - background-image: -moz-linear-gradient(top, #a3d0ef 0%, #79ace9 65%, #a3d0ef 100%); - background-image: -ms-linear-gradient(top, #a3d0ef 0%, #79ace9 65%, #a3d0ef 100%); - background-image: -o-linear-gradient(top, #a3d0ef 0%, #79ace9 65%, #a3d0ef 100%); - background-image: linear-gradient(top, #a3d0ef 0%, #79ace9 65%, #a3d0ef 100%); - filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,StartColorStr='#a3d0ef', EndColorStr='#a3d0ef'); -} - -button.DTTT_button:active, -div.DTTT_button:active, -a.DTTT_button:active { - -webkit-box-shadow: inset 1px 1px 3px #999999; - -moz-box-shadow: inset 1px 1px 3px #999999; - box-shadow: inset 1px 1px 3px #999999; -} - -button.DTTT_disabled, -div.DTTT_disabled, -a.DTTT_disabled { - color: #999; - border: 1px solid #d0d0d0; - - background: #ffffff; /* Old browsers */ - background: -webkit-linear-gradient(top, #ffffff 0%,#f9f9f9 89%,#fafafa 100%); /* Chrome10+,Safari5.1+ */ - background: -moz-linear-gradient(top, #ffffff 0%,#f9f9f9 89%,#fafafa 100%); /* FF3.6+ */ - background: -ms-linear-gradient(top, #ffffff 0%,#f9f9f9 89%,#fafafa 100%); /* IE10+ */ - background: -o-linear-gradient(top, #ffffff 0%,#f9f9f9 89%,#fafafa 100%); /* Opera 11.10+ */ - background: linear-gradient(top, #ffffff 0%,#f9f9f9 89%,#fafafa 100%); /* W3C */ - filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#fafafa',GradientType=0 ); /* IE6-9 */ -} - - - -/* - * BUTTON_STYLES - * Action specific button styles - * If you want images - comment this back in - -a.DTTT_button_csv, -a.DTTT_button_xls, -a.DTTT_button_copy, -a.DTTT_button_pdf, -a.DTTT_button_print { - padding-right: 0px; -} - -a.DTTT_button_csv span, -a.DTTT_button_xls span, -a.DTTT_button_copy span, -a.DTTT_button_pdf span, -a.DTTT_button_print span { - display: inline-block; - height: 24px; - line-height: 24px; - padding-right: 30px; -} - - -a.DTTT_button_csv span { background: url(../images/csv.png) no-repeat bottom right; } -a.DTTT_button_csv:hover span { background: url(../images/csv_hover.png) no-repeat center right; } - -a.DTTT_button_xls span { background: url(../images/xls.png) no-repeat center right; } -a.DTTT_button_xls:hover span { background: #f0f0f0 url(../images/xls_hover.png) no-repeat center right; } - -a.DTTT_button_copy span { background: url(../images/copy.png) no-repeat center right; } -a.DTTT_button_copy:hover span { background: #f0f0f0 url(../images/copy_hover.png) no-repeat center right; } - -a.DTTT_button_pdf span { background: url(../images/pdf.png) no-repeat center right; } -a.DTTT_button_pdf:hover span { background: #f0f0f0 url(../images/pdf_hover.png) no-repeat center right; } - -a.DTTT_button_print span { background: url(../images/print.png) no-repeat center right; } -a.DTTT_button_print:hover span { background: #f0f0f0 url(../images/print_hover.png) no-repeat center right; } - - */ - -button.DTTT_button_collection span { - padding-right: 17px; - background: url(../images/collection.png) no-repeat center right; -} - -button.DTTT_button_collection:hover span { - padding-right: 17px; - background: #f0f0f0 url(../images/collection_hover.png) no-repeat center right; -} - - -/* - * SELECTING - * Row selection styles - */ -table.DTTT_selectable tbody tr { - cursor: pointer; - *cursor: hand; -} - -table.dataTable tr.DTTT_selected.odd { - background-color: #9FAFD1; -} - -table.dataTable tr.DTTT_selected.odd td.sorting_1 { - background-color: #9FAFD1; -} - -table.dataTable tr.DTTT_selected.odd td.sorting_2 { - background-color: #9FAFD1; -} - -table.dataTable tr.DTTT_selected.odd td.sorting_3 { - background-color: #9FAFD1; -} - - -table.dataTable tr.DTTT_selected.even { - background-color: #B0BED9; -} - -table.dataTable tr.DTTT_selected.even td.sorting_1 { - background-color: #B0BED9; -} - -table.dataTable tr.DTTT_selected.even td.sorting_2 { - background-color: #B0BED9; -} - -table.dataTable tr.DTTT_selected.even td.sorting_3 { - background-color: #B0BED9; -} - - -/* - * COLLECTIONS - * Drop down list (collection) styles - */ - -div.DTTT_collection { - width: 150px; - padding: 8px 8px 4px 8px; - border: 1px solid #ccc; - border: 1px solid rgba( 0, 0, 0, 0.4 ); - background-color: #f3f3f3; - background-color: rgba( 255, 255, 255, 0.3 ); - overflow: hidden; - z-index: 2002; - - -webkit-border-radius: 5px; - -moz-border-radius: 5px; - -ms-border-radius: 5px; - -o-border-radius: 5px; - border-radius: 5px; - - -webkit-box-shadow: 3px 3px 5px rgba(0, 0, 0, 0.3); - -moz-box-shadow: 3px 3px 5px rgba(0, 0, 0, 0.3); - -ms-box-shadow: 3px 3px 5px rgba(0, 0, 0, 0.3); - -o-box-shadow: 3px 3px 5px rgba(0, 0, 0, 0.3); - box-shadow: 3px 3px 5px rgba(0, 0, 0, 0.3); -} - -div.DTTT_collection_background { - background: transparent url(../images/background.png) repeat top left; - z-index: 2001; -} - -div.DTTT_collection button.DTTT_button, -div.DTTT_collection div.DTTT_button, -div.DTTT_collection a.DTTT_button { - position: relative; - left: 0; - right: 0; - - display: block; - float: none; - margin-bottom: 4px; - - -webkit-box-shadow: 1px 1px 3px #999; - -moz-box-shadow: 1px 1px 3px #999; - -ms-box-shadow: 1px 1px 3px #999; - -o-box-shadow: 1px 1px 3px #999; - box-shadow: 1px 1px 3px #999; -} - - -/* - * PRINTING - * Print display styles - */ - -.DTTT_print_info { - position: fixed; - top: 50%; - left: 50%; - width: 400px; - height: 150px; - margin-left: -200px; - margin-top: -75px; - text-align: center; - color: #333; - padding: 10px 30px; - - background: #ffffff; /* Old browsers */ - background: -webkit-linear-gradient(top, #ffffff 0%,#f3f3f3 89%,#f9f9f9 100%); /* Chrome10+,Safari5.1+ */ - background: -moz-linear-gradient(top, #ffffff 0%,#f3f3f3 89%,#f9f9f9 100%); /* FF3.6+ */ - background: -ms-linear-gradient(top, #ffffff 0%,#f3f3f3 89%,#f9f9f9 100%); /* IE10+ */ - background: -o-linear-gradient(top, #ffffff 0%,#f3f3f3 89%,#f9f9f9 100%); /* Opera 11.10+ */ - background: linear-gradient(top, #ffffff 0%,#f3f3f3 89%,#f9f9f9 100%); /* W3C */ - filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#f9f9f9',GradientType=0 ); /* IE6-9 */ - - opacity: 0.95; - - border: 1px solid black; - border: 1px solid rgba(0, 0, 0, 0.5); - - -webkit-border-radius: 6px; - -moz-border-radius: 6px; - -ms-border-radius: 6px; - -o-border-radius: 6px; - border-radius: 6px; - - -webkit-box-shadow: 0 3px 7px rgba(0, 0, 0, 0.5); - -moz-box-shadow: 0 3px 7px rgba(0, 0, 0, 0.5); - -ms-box-shadow: 0 3px 7px rgba(0, 0, 0, 0.5); - -o-box-shadow: 0 3px 7px rgba(0, 0, 0, 0.5); - box-shadow: 0 3px 7px rgba(0, 0, 0, 0.5); -} - -.DTTT_print_info h6 { - font-weight: normal; - font-size: 28px; - line-height: 28px; - margin: 1em; -} - -.DTTT_print_info p { - font-size: 14px; - line-height: 20px; -} - diff --git a/src/main/resources/META-INF/resources/designer/lib/dataTables.bootstrap.js b/src/main/resources/META-INF/resources/designer/lib/dataTables.bootstrap.js deleted file mode 100644 index c2fba6854..000000000 --- a/src/main/resources/META-INF/resources/designer/lib/dataTables.bootstrap.js +++ /dev/null @@ -1,245 +0,0 @@ -/* Set the defaults for DataTables initialisation */ -$.extend(true, $.fn.dataTable.defaults, { - "sDom": "<'row'<'col-sm-6'l><'col-sm-6'f>r>" + "t" + "<'row'<'col-sm-6'i><'col-sm-6'p>>", - "oLanguage": { - "sLengthMenu": "_MENU_ records per page" - } -}); - - -/* Default class modification */ -$.extend($.fn.dataTableExt.oStdClasses, { - "sWrapper": "dataTables_wrapper form-inline", - "sFilterInput": "form-control input-sm", - "sLengthSelect": "form-control input-sm" -}); - -// In 1.10 we use the pagination renderers to draw the Bootstrap paging, -// rather than custom plug-in -if ($.fn.dataTable.Api) { - $.fn.dataTable.defaults.renderer = 'bootstrap'; - $.fn.dataTable.ext.renderer.pageButton.bootstrap = function(settings, host, idx, buttons, page, pages) { - var api = new $.fn.dataTable.Api(settings); - var classes = settings.oClasses; - var lang = settings.oLanguage.oPaginate; - var btnDisplay, btnClass; - - var attach = function(container, buttons) { - var i, ien, node, button; - var clickHandler = function(e) { - e.preventDefault(); - if (e.data.action !== 'ellipsis') { - api.page(e.data.action).draw(false); - } - }; - - for (i = 0, ien = buttons.length; i < ien; i++) { - button = buttons[i]; - - if ($.isArray(button)) { - attach(container, button); - } else { - btnDisplay = ''; - btnClass = ''; - - switch (button) { - case 'ellipsis': - btnDisplay = '…'; - btnClass = 'disabled'; - break; - - case 'first': - btnDisplay = lang.sFirst; - btnClass = button + (page > 0 ? - '' : ' disabled'); - break; - - case 'previous': - btnDisplay = lang.sPrevious; - btnClass = button + (page > 0 ? - '' : ' disabled'); - break; - - case 'next': - btnDisplay = lang.sNext; - btnClass = button + (page < pages - 1 ? - '' : ' disabled'); - break; - - case 'last': - btnDisplay = lang.sLast; - btnClass = button + (page < pages - 1 ? - '' : ' disabled'); - break; - - default: - btnDisplay = button + 1; - btnClass = page === button ? - 'active' : ''; - break; - } - - if (btnDisplay) { - node = $('<li>', { - 'class': classes.sPageButton + ' ' + btnClass, - 'aria-controls': settings.sTableId, - 'tabindex': settings.iTabIndex, - 'id': idx === 0 && typeof button === 'string' ? settings.sTableId + '_' + button : null - }) - .append($('<a>', { - 'href': '#' - }) - .html(btnDisplay) - ) - .appendTo(container); - - settings.oApi._fnBindAction( - node, { - action: button - }, clickHandler - ); - } - } - } - }; - - attach( - $(host).empty().html('<ul class="pagination"/>').children('ul'), - buttons - ); - } -} else { - // Integration for 1.9- - $.fn.dataTable.defaults.sPaginationType = 'bootstrap'; - - /* API method to get paging information */ - $.fn.dataTableExt.oApi.fnPagingInfo = function(oSettings) { - return { - "iStart": oSettings._iDisplayStart, - "iEnd": oSettings.fnDisplayEnd(), - "iLength": oSettings._iDisplayLength, - "iTotal": oSettings.fnRecordsTotal(), - "iFilteredTotal": oSettings.fnRecordsDisplay(), - "iPage": oSettings._iDisplayLength === -1 ? 0 : Math.ceil(oSettings._iDisplayStart / oSettings._iDisplayLength), - "iTotalPages": oSettings._iDisplayLength === -1 ? 0 : Math.ceil(oSettings.fnRecordsDisplay() / oSettings._iDisplayLength) - }; - }; - - /* Bootstrap style pagination control */ - $.extend($.fn.dataTableExt.oPagination, { - "bootstrap": { - "fnInit": function(oSettings, nPaging, fnDraw) { - var oLang = oSettings.oLanguage.oPaginate; - var fnClickHandler = function(e) { - e.preventDefault(); - if (oSettings.oApi._fnPageChange(oSettings, e.data.action)) { - fnDraw(oSettings); - } - }; - - $(nPaging).append( - '<ul class="pagination">' + - '<li class="prev disabled"><a href="#">← ' + oLang.sPrevious + '</a></li>' + - '<li class="next disabled"><a href="#">' + oLang.sNext + ' → </a></li>' + - '</ul>' - ); - var els = $('a', nPaging); - $(els[0]).bind('click.DT', { - action: "previous" - }, fnClickHandler); - $(els[1]).bind('click.DT', { - action: "next" - }, fnClickHandler); - }, - - "fnUpdate": function(oSettings, fnDraw) { - var iListLength = 5; - var oPaging = oSettings.oInstance.fnPagingInfo(); - var an = oSettings.aanFeatures.p; - var i, ien, j, sClass, iStart, iEnd, iHalf = Math.floor(iListLength / 2); - - if (oPaging.iTotalPages < iListLength) { - iStart = 1; - iEnd = oPaging.iTotalPages; - } else if (oPaging.iPage <= iHalf) { - iStart = 1; - iEnd = iListLength; - } else if (oPaging.iPage >= (oPaging.iTotalPages - iHalf)) { - iStart = oPaging.iTotalPages - iListLength + 1; - iEnd = oPaging.iTotalPages; - } else { - iStart = oPaging.iPage - iHalf + 1; - iEnd = iStart + iListLength - 1; - } - - for (i = 0, ien = an.length; i < ien; i++) { - // Remove the middle elements - $('li:gt(0)', an[i]).filter(':not(:last)').remove(); - - // Add the new list items and their event handlers - for (j = iStart; j <= iEnd; j++) { - sClass = (j == oPaging.iPage + 1) ? 'class="active"' : ''; - $('<li ' + sClass + '><a href="#">' + j + '</a></li>') - .insertBefore($('li:last', an[i])[0]) - .bind('click', function(e) { - e.preventDefault(); - oSettings._iDisplayStart = (parseInt($('a', this).text(), 10) - 1) * oPaging.iLength; - fnDraw(oSettings); - }); - } - - // Add / remove disabled classes from the static elements - if (oPaging.iPage === 0) { - $('li:first', an[i]).addClass('disabled'); - } else { - $('li:first', an[i]).removeClass('disabled'); - } - - if (oPaging.iPage === oPaging.iTotalPages - 1 || oPaging.iTotalPages === 0) { - $('li:last', an[i]).addClass('disabled'); - } else { - $('li:last', an[i]).removeClass('disabled'); - } - } - } - } - }); -} - - -/* - * TableTools Bootstrap compatibility - * Required TableTools 2.1+ - */ -if ($.fn.DataTable.TableTools) { - // Set the classes that TableTools uses to something suitable for Bootstrap - $.extend(true, $.fn.DataTable.TableTools.classes, { - "container": "DTTT btn-group", - "buttons": { - "normal": "btn btn-default", - "disabled": "disabled" - }, - "collection": { - "container": "DTTT_dropdown dropdown-menu", - "buttons": { - "normal": "", - "disabled": "disabled" - } - }, - "print": { - "info": "DTTT_print_info modal" - }, - "select": { - "row": "active" - } - }); - - // Have the collection use a bootstrap compatible dropdown - $.extend(true, $.fn.DataTable.TableTools.DEFAULTS.oTags, { - "collection": { - "container": "ul", - "button": "li", - "liner": "a" - } - }); -} diff --git a/src/main/resources/META-INF/resources/designer/lib/dataTables.fixedColumns.js b/src/main/resources/META-INF/resources/designer/lib/dataTables.fixedColumns.js deleted file mode 100644 index 0e0ec2749..000000000 --- a/src/main/resources/META-INF/resources/designer/lib/dataTables.fixedColumns.js +++ /dev/null @@ -1,1413 +0,0 @@ -/*! FixedColumns 3.0.3 - * ©2010-2014 SpryMedia Ltd - datatables.net/license - */ - -/** - * @summary FixedColumns - * @description Freeze columns in place on a scrolling DataTable - * @version 3.0.3 - * @file dataTables.fixedColumns.js - * @author SpryMedia Ltd (www.sprymedia.co.uk) - * @contact www.sprymedia.co.uk/contact - * @copyright Copyright 2010-2014 SpryMedia Ltd. - * - * This source file is free software, available under the following license: - * MIT license - http://datatables.net/license/mit - * - * This source file is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details. - * - * For details please refer to: http://www.datatables.net - */ - - -(function(window, document, undefined) { - - -var factory = function( $, DataTable ) { -"use strict"; - -/** - * When making use of DataTables' x-axis scrolling feature, you may wish to - * fix the left most column in place. This plug-in for DataTables provides - * exactly this option (note for non-scrolling tables, please use the - * FixedHeader plug-in, which can fix headers, footers and columns). Key - * features include: - * - * * Freezes the left or right most columns to the side of the table - * * Option to freeze two or more columns - * * Full integration with DataTables' scrolling options - * * Speed - FixedColumns is fast in its operation - * - * @class - * @constructor - * @global - * @param {object} dt DataTables instance. With DataTables 1.10 this can also - * be a jQuery collection, a jQuery selector, DataTables API instance or - * settings object. - * @param {object} [init={}] Configuration object for FixedColumns. Options are - * defined by {@link FixedColumns.defaults} - * - * @requires jQuery 1.7+ - * @requires DataTables 1.8.0+ - * - * @example - * var table = $('#example').dataTable( { - * "scrollX": "100%" - * } ); - * new $.fn.dataTable.fixedColumns( table ); - */ -var FixedColumns = function ( dt, init ) { - var that = this; - - /* Sanity check - you just know it will happen */ - if ( ! ( this instanceof FixedColumns ) ) - { - alert( "FixedColumns warning: FixedColumns must be initialised with the 'new' keyword." ); - return; - } - - if ( typeof init == 'undefined' ) - { - init = {}; - } - - // Use the DataTables Hungarian notation mapping method, if it exists to - // provide forwards compatibility for camel case variables - var camelToHungarian = $.fn.dataTable.camelToHungarian; - if ( camelToHungarian ) { - camelToHungarian( FixedColumns.defaults, FixedColumns.defaults, true ); - camelToHungarian( FixedColumns.defaults, init ); - } - - // v1.10 allows the settings object to be got form a number of sources - var dtSettings = $.fn.dataTable.Api ? - new $.fn.dataTable.Api( dt ).settings()[0] : - dt.fnSettings(); - - /** - * Settings object which contains customisable information for FixedColumns instance - * @namespace - * @extends FixedColumns.defaults - * @private - */ - this.s = { - /** - * DataTables settings objects - * @type object - * @default Obtained from DataTables instance - */ - "dt": dtSettings, - - /** - * Number of columns in the DataTable - stored for quick access - * @type int - * @default Obtained from DataTables instance - */ - "iTableColumns": dtSettings.aoColumns.length, - - /** - * Original outer widths of the columns as rendered by DataTables - used to calculate - * the FixedColumns grid bounding box - * @type array.<int> - * @default [] - */ - "aiOuterWidths": [], - - /** - * Original inner widths of the columns as rendered by DataTables - used to apply widths - * to the columns - * @type array.<int> - * @default [] - */ - "aiInnerWidths": [] - }; - - - /** - * DOM elements used by the class instance - * @namespace - * @private - * - */ - this.dom = { - /** - * DataTables scrolling element - * @type node - * @default null - */ - "scroller": null, - - /** - * DataTables header table - * @type node - * @default null - */ - "header": null, - - /** - * DataTables body table - * @type node - * @default null - */ - "body": null, - - /** - * DataTables footer table - * @type node - * @default null - */ - "footer": null, - - /** - * Display grid elements - * @namespace - */ - "grid": { - /** - * Grid wrapper. This is the container element for the 3x3 grid - * @type node - * @default null - */ - "wrapper": null, - - /** - * DataTables scrolling element. This element is the DataTables - * component in the display grid (making up the main table - i.e. - * not the fixed columns). - * @type node - * @default null - */ - "dt": null, - - /** - * Left fixed column grid components - * @namespace - */ - "left": { - "wrapper": null, - "head": null, - "body": null, - "foot": null - }, - - /** - * Right fixed column grid components - * @namespace - */ - "right": { - "wrapper": null, - "head": null, - "body": null, - "foot": null - } - }, - - /** - * Cloned table nodes - * @namespace - */ - "clone": { - /** - * Left column cloned table nodes - * @namespace - */ - "left": { - /** - * Cloned header table - * @type node - * @default null - */ - "header": null, - - /** - * Cloned body table - * @type node - * @default null - */ - "body": null, - - /** - * Cloned footer table - * @type node - * @default null - */ - "footer": null - }, - - /** - * Right column cloned table nodes - * @namespace - */ - "right": { - /** - * Cloned header table - * @type node - * @default null - */ - "header": null, - - /** - * Cloned body table - * @type node - * @default null - */ - "body": null, - - /** - * Cloned footer table - * @type node - * @default null - */ - "footer": null - } - } - }; - - /* Attach the instance to the DataTables instance so it can be accessed easily */ - dtSettings._oFixedColumns = this; - - /* Let's do it */ - if ( ! dtSettings._bInitComplete ) - { - dtSettings.oApi._fnCallbackReg( dtSettings, 'aoInitComplete', function () { - that._fnConstruct( init ); - }, 'FixedColumns' ); - } - else - { - this._fnConstruct( init ); - } -}; - - - -FixedColumns.prototype = /** @lends FixedColumns.prototype */{ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Public methods - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - - /** - * Update the fixed columns - including headers and footers. Note that FixedColumns will - * automatically update the display whenever the host DataTable redraws. - * @returns {void} - * @example - * var table = $('#example').dataTable( { - * "scrollX": "100%" - * } ); - * var fc = new $.fn.dataTable.fixedColumns( table ); - * - * // at some later point when the table has been manipulated.... - * fc.fnUpdate(); - */ - "fnUpdate": function () - { - this._fnDraw( true ); - }, - - - /** - * Recalculate the resizes of the 3x3 grid that FixedColumns uses for display of the table. - * This is useful if you update the width of the table container. Note that FixedColumns will - * perform this function automatically when the window.resize event is fired. - * @returns {void} - * @example - * var table = $('#example').dataTable( { - * "scrollX": "100%" - * } ); - * var fc = new $.fn.dataTable.fixedColumns( table ); - * - * // Resize the table container and then have FixedColumns adjust its layout.... - * $('#content').width( 1200 ); - * fc.fnRedrawLayout(); - */ - "fnRedrawLayout": function () - { - this._fnColCalc(); - this._fnGridLayout(); - this.fnUpdate(); - }, - - - /** - * Mark a row such that it's height should be recalculated when using 'semiauto' row - * height matching. This function will have no effect when 'none' or 'auto' row height - * matching is used. - * @param {Node} nTr TR element that should have it's height recalculated - * @returns {void} - * @example - * var table = $('#example').dataTable( { - * "scrollX": "100%" - * } ); - * var fc = new $.fn.dataTable.fixedColumns( table ); - * - * // manipulate the table - mark the row as needing an update then update the table - * // this allows the redraw performed by DataTables fnUpdate to recalculate the row - * // height - * fc.fnRecalculateHeight(); - * table.fnUpdate( $('#example tbody tr:eq(0)')[0], ["insert date", 1, 2, 3 ... ]); - */ - "fnRecalculateHeight": function ( nTr ) - { - delete nTr._DTTC_iHeight; - nTr.style.height = 'auto'; - }, - - - /** - * Set the height of a given row - provides cross browser compatibility - * @param {Node} nTarget TR element that should have it's height recalculated - * @param {int} iHeight Height in pixels to set - * @returns {void} - * @example - * var table = $('#example').dataTable( { - * "scrollX": "100%" - * } ); - * var fc = new $.fn.dataTable.fixedColumns( table ); - * - * // You may want to do this after manipulating a row in the fixed column - * fc.fnSetRowHeight( $('#example tbody tr:eq(0)')[0], 50 ); - */ - "fnSetRowHeight": function ( nTarget, iHeight ) - { - nTarget.style.height = iHeight+"px"; - }, - - - /** - * Get data index information about a row or cell in the table body. - * This function is functionally identical to fnGetPosition in DataTables, - * taking the same parameter (TH, TD or TR node) and returning exactly the - * the same information (data index information). THe difference between - * the two is that this method takes into account the fixed columns in the - * table, so you can pass in nodes from the master table, or the cloned - * tables and get the index position for the data in the main table. - * @param {node} node TR, TH or TD element to get the information about - * @returns {int} If nNode is given as a TR, then a single index is - * returned, or if given as a cell, an array of [row index, column index - * (visible), column index (all)] is given. - */ - "fnGetPosition": function ( node ) - { - var idx; - var inst = this.s.dt.oInstance; - - if ( ! $(node).parents('.DTFC_Cloned').length ) - { - // Not in a cloned table - return inst.fnGetPosition( node ); - } - else - { - // Its in the cloned table, so need to look up position - if ( node.nodeName.toLowerCase() === 'tr' ) { - idx = $(node).index(); - return inst.fnGetPosition( $('tr', this.s.dt.nTBody)[ idx ] ); - } - else - { - var colIdx = $(node).index(); - idx = $(node.parentNode).index(); - var row = inst.fnGetPosition( $('tr', this.s.dt.nTBody)[ idx ] ); - - return [ - row, - colIdx, - inst.oApi._fnVisibleToColumnIndex( this.s.dt, colIdx ) - ]; - } - } - }, - - - - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Private methods (they are of course public in JS, but recommended as private) - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - - /** - * Initialisation for FixedColumns - * @param {Object} oInit User settings for initialisation - * @returns {void} - * @private - */ - "_fnConstruct": function ( oInit ) - { - var i, iLen, iWidth, - that = this; - - /* Sanity checking */ - if ( typeof this.s.dt.oInstance.fnVersionCheck != 'function' || - this.s.dt.oInstance.fnVersionCheck( '1.8.0' ) !== true ) - { - alert( "FixedColumns "+FixedColumns.VERSION+" required DataTables 1.8.0 or later. "+ - "Please upgrade your DataTables installation" ); - return; - } - - if ( this.s.dt.oScroll.sX === "" ) - { - this.s.dt.oInstance.oApi._fnLog( this.s.dt, 1, "FixedColumns is not needed (no "+ - "x-scrolling in DataTables enabled), so no action will be taken. Use 'FixedHeader' for "+ - "column fixing when scrolling is not enabled" ); - return; - } - - /* Apply the settings from the user / defaults */ - this.s = $.extend( true, this.s, FixedColumns.defaults, oInit ); - - /* Set up the DOM as we need it and cache nodes */ - var classes = this.s.dt.oClasses; - this.dom.grid.dt = $(this.s.dt.nTable).parents('div.'+classes.sScrollWrapper)[0]; - this.dom.scroller = $('div.'+classes.sScrollBody, this.dom.grid.dt )[0]; - - /* Set up the DOM that we want for the fixed column layout grid */ - this._fnColCalc(); - this._fnGridSetup(); - - /* Event handlers */ - var mouseController; - - // When the body is scrolled - scroll the left and right columns - $(this.dom.scroller) - .on( 'mouseover.DTFC touchstart.DTFC', function () { - mouseController = 'main'; - } ) - .on( 'scroll.DTFC', function () { - if ( mouseController === 'main' ) { - if ( that.s.iLeftColumns > 0 ) { - that.dom.grid.left.liner.scrollTop = that.dom.scroller.scrollTop; - } - if ( that.s.iRightColumns > 0 ) { - that.dom.grid.right.liner.scrollTop = that.dom.scroller.scrollTop; - } - } - } ); - - var wheelType = 'onwheel' in document.createElement('div') ? - 'wheel.DTFC' : - 'mousewheel.DTFC'; - - if ( that.s.iLeftColumns > 0 ) { - // When scrolling the left column, scroll the body and right column - $(that.dom.grid.left.liner) - .on( 'mouseover.DTFC touchstart.DTFC', function () { - mouseController = 'left'; - } ) - .on( 'scroll.DTFC', function () { - if ( mouseController === 'left' ) { - that.dom.scroller.scrollTop = that.dom.grid.left.liner.scrollTop; - if ( that.s.iRightColumns > 0 ) { - that.dom.grid.right.liner.scrollTop = that.dom.grid.left.liner.scrollTop; - } - } - } ) - .on( wheelType, function(e) { // xxx update the destroy as well - // Pass horizontal scrolling through - var xDelta = e.type === 'wheel' ? - -e.originalEvent.deltaX : - e.originalEvent.wheelDeltaX; - that.dom.scroller.scrollLeft -= xDelta; - } ); - } - - if ( that.s.iRightColumns > 0 ) { - // When scrolling the right column, scroll the body and the left column - $(that.dom.grid.right.liner) - .on( 'mouseover.DTFC touchstart.DTFC', function () { - mouseController = 'right'; - } ) - .on( 'scroll.DTFC', function () { - if ( mouseController === 'right' ) { - that.dom.scroller.scrollTop = that.dom.grid.right.liner.scrollTop; - if ( that.s.iLeftColumns > 0 ) { - that.dom.grid.left.liner.scrollTop = that.dom.grid.right.liner.scrollTop; - } - } - } ) - .on( wheelType, function(e) { - // Pass horizontal scrolling through - var xDelta = e.type === 'wheel' ? - -e.originalEvent.deltaX : - e.originalEvent.wheelDeltaX; - that.dom.scroller.scrollLeft -= xDelta; - } ); - } - - $(window).on( 'resize.DTFC', function () { - that._fnGridLayout.call( that ); - } ); - - var bFirstDraw = true; - var jqTable = $(this.s.dt.nTable); - - jqTable - .on( 'draw.dt.DTFC', function () { - that._fnDraw.call( that, bFirstDraw ); - bFirstDraw = false; - } ) - .on( 'column-sizing.dt.DTFC', function () { - that._fnColCalc(); - that._fnGridLayout( that ); - } ) - .on( 'column-visibility.dt.DTFC', function () { - that._fnColCalc(); - that._fnGridLayout( that ); - that._fnDraw( true ); - } ) - .on( 'destroy.dt.DTFC', function () { - jqTable.off( 'column-sizing.dt.DTFC destroy.dt.DTFC draw.dt.DTFC' ); - - $(that.dom.scroller).off( 'scroll.DTFC mouseover.DTFC' ); - $(window).off( 'resize.DTFC' ); - - $(that.dom.grid.left.liner).off( 'scroll.DTFC mouseover.DTFC '+wheelType ); - $(that.dom.grid.left.wrapper).remove(); - - $(that.dom.grid.right.liner).off( 'scroll.DTFC mouseover.DTFC '+wheelType ); - $(that.dom.grid.right.wrapper).remove(); - } ); - - /* Get things right to start with - note that due to adjusting the columns, there must be - * another redraw of the main table. It doesn't need to be a full redraw however. - */ - this._fnGridLayout(); - this.s.dt.oInstance.fnDraw(false); - }, - - - /** - * Calculate the column widths for the grid layout - * @returns {void} - * @private - */ - "_fnColCalc": function () - { - var that = this; - var iLeftWidth = 0; - var iRightWidth = 0; - - this.s.aiInnerWidths = []; - this.s.aiOuterWidths = []; - - $.each( this.s.dt.aoColumns, function (i, col) { - var th = $(col.nTh); - var border; - - if ( ! th.filter(':visible').length ) { - that.s.aiInnerWidths.push( 0 ); - that.s.aiOuterWidths.push( 0 ); - } - else - { - // Inner width is used to assign widths to cells - // Outer width is used to calculate the container - var iWidth = th.outerWidth(); - - // When working with the left most-cell, need to add on the - // table's border to the outerWidth, since we need to take - // account of it, but it isn't in any cell - if ( that.s.aiOuterWidths.length === 0 ) { - border = $(that.s.dt.nTable).css('border-left-width'); - iWidth += typeof border === 'string' ? 1 : parseInt( border, 10 ); - } - - // Likewise with the final column on the right - if ( that.s.aiOuterWidths.length === that.s.dt.aoColumns.length-1 ) { - border = $(that.s.dt.nTable).css('border-right-width'); - iWidth += typeof border === 'string' ? 1 : parseInt( border, 10 ); - } - - that.s.aiOuterWidths.push( iWidth ); - that.s.aiInnerWidths.push( th.width() ); - - if ( i < that.s.iLeftColumns ) - { - iLeftWidth += iWidth; - } - - if ( that.s.iTableColumns-that.s.iRightColumns <= i ) - { - iRightWidth += iWidth; - } - } - } ); - - this.s.iLeftWidth = iLeftWidth; - this.s.iRightWidth = iRightWidth; - }, - - - /** - * Set up the DOM for the fixed column. The way the layout works is to create a 1x3 grid - * for the left column, the DataTable (for which we just reuse the scrolling element DataTable - * puts into the DOM) and the right column. In each of he two fixed column elements there is a - * grouping wrapper element and then a head, body and footer wrapper. In each of these we then - * place the cloned header, body or footer tables. This effectively gives as 3x3 grid structure. - * @returns {void} - * @private - */ - "_fnGridSetup": function () - { - var that = this; - var oOverflow = this._fnDTOverflow(); - var block; - - this.dom.body = this.s.dt.nTable; - this.dom.header = this.s.dt.nTHead.parentNode; - this.dom.header.parentNode.parentNode.style.position = "relative"; - - var nSWrapper = - $('<div class="DTFC_ScrollWrapper" style="position:relative; clear:both;">'+ - '<div class="DTFC_LeftWrapper" style="position:absolute; top:0; left:0;">'+ - '<div class="DTFC_LeftHeadWrapper" style="position:relative; top:0; left:0; overflow:hidden;"></div>'+ - '<div class="DTFC_LeftBodyWrapper" style="position:relative; top:0; left:0; overflow:hidden;">'+ - '<div class="DTFC_LeftBodyLiner" style="position:relative; top:0; left:0; overflow-y:scroll;"></div>'+ - '</div>'+ - '<div class="DTFC_LeftFootWrapper" style="position:relative; top:0; left:0; overflow:hidden;"></div>'+ - '</div>'+ - '<div class="DTFC_RightWrapper" style="position:absolute; top:0; left:0;">'+ - '<div class="DTFC_RightHeadWrapper" style="position:relative; top:0; left:0;">'+ - '<div class="DTFC_RightHeadBlocker DTFC_Blocker" style="position:absolute; top:0; bottom:0;"></div>'+ - '</div>'+ - '<div class="DTFC_RightBodyWrapper" style="position:relative; top:0; left:0; overflow:hidden;">'+ - '<div class="DTFC_RightBodyLiner" style="position:relative; top:0; left:0; overflow-y:scroll;"></div>'+ - '</div>'+ - '<div class="DTFC_RightFootWrapper" style="position:relative; top:0; left:0;">'+ - '<div class="DTFC_RightFootBlocker DTFC_Blocker" style="position:absolute; top:0; bottom:0;"></div>'+ - '</div>'+ - '</div>'+ - '</div>')[0]; - var nLeft = nSWrapper.childNodes[0]; - var nRight = nSWrapper.childNodes[1]; - - this.dom.grid.dt.parentNode.insertBefore( nSWrapper, this.dom.grid.dt ); - nSWrapper.appendChild( this.dom.grid.dt ); - - this.dom.grid.wrapper = nSWrapper; - - if ( this.s.iLeftColumns > 0 ) - { - this.dom.grid.left.wrapper = nLeft; - this.dom.grid.left.head = nLeft.childNodes[0]; - this.dom.grid.left.body = nLeft.childNodes[1]; - this.dom.grid.left.liner = $('div.DTFC_LeftBodyLiner', nSWrapper)[0]; - - nSWrapper.appendChild( nLeft ); - } - - if ( this.s.iRightColumns > 0 ) - { - this.dom.grid.right.wrapper = nRight; - this.dom.grid.right.head = nRight.childNodes[0]; - this.dom.grid.right.body = nRight.childNodes[1]; - this.dom.grid.right.liner = $('div.DTFC_RightBodyLiner', nSWrapper)[0]; - - block = $('div.DTFC_RightHeadBlocker', nSWrapper)[0]; - block.style.width = oOverflow.bar+"px"; - block.style.right = -oOverflow.bar+"px"; - this.dom.grid.right.headBlock = block; - - block = $('div.DTFC_RightFootBlocker', nSWrapper)[0]; - block.style.width = oOverflow.bar+"px"; - block.style.right = -oOverflow.bar+"px"; - this.dom.grid.right.footBlock = block; - - nSWrapper.appendChild( nRight ); - } - - if ( this.s.dt.nTFoot ) - { - this.dom.footer = this.s.dt.nTFoot.parentNode; - if ( this.s.iLeftColumns > 0 ) - { - this.dom.grid.left.foot = nLeft.childNodes[2]; - } - if ( this.s.iRightColumns > 0 ) - { - this.dom.grid.right.foot = nRight.childNodes[2]; - } - } - }, - - - /** - * Style and position the grid used for the FixedColumns layout - * @returns {void} - * @private - */ - "_fnGridLayout": function () - { - var oGrid = this.dom.grid; - var iWidth = $(oGrid.wrapper).width(); - var iBodyHeight = $(this.s.dt.nTable.parentNode).outerHeight(); - var iFullHeight = $(this.s.dt.nTable.parentNode.parentNode).outerHeight(); - var oOverflow = this._fnDTOverflow(); - var - iLeftWidth = this.s.iLeftWidth, - iRightWidth = this.s.iRightWidth, - iRight; - var scrollbarAdjust = function ( node, width ) { - if ( ! oOverflow.bar ) { - // If there is no scrollbar (Macs) we need to hide the auto scrollbar - node.style.width = (width+20)+"px"; - node.style.paddingRight = "20px"; - node.style.boxSizing = "border-box"; - } - else { - // Otherwise just overflow by the scrollbar - node.style.width = (width+oOverflow.bar)+"px"; - } - }; - - // When x scrolling - don't paint the fixed columns over the x scrollbar - if ( oOverflow.x ) - { - iBodyHeight -= oOverflow.bar; - } - - oGrid.wrapper.style.height = iFullHeight+"px"; - - if ( this.s.iLeftColumns > 0 ) - { - oGrid.left.wrapper.style.width = iLeftWidth+"px"; - oGrid.left.wrapper.style.height = "1px"; - oGrid.left.body.style.height = iBodyHeight+"px"; - if ( oGrid.left.foot ) { - oGrid.left.foot.style.top = (oOverflow.x ? oOverflow.bar : 0)+"px"; // shift footer for scrollbar - } - - scrollbarAdjust( oGrid.left.liner, iLeftWidth ); - oGrid.left.liner.style.height = iBodyHeight+"px"; - } - - if ( this.s.iRightColumns > 0 ) - { - iRight = iWidth - iRightWidth; - if ( oOverflow.y ) - { - iRight -= oOverflow.bar; - } - - oGrid.right.wrapper.style.width = iRightWidth+"px"; - oGrid.right.wrapper.style.left = iRight+"px"; - oGrid.right.wrapper.style.height = "1px"; - oGrid.right.body.style.height = iBodyHeight+"px"; - if ( oGrid.right.foot ) { - oGrid.right.foot.style.top = (oOverflow.x ? oOverflow.bar : 0)+"px"; - } - - scrollbarAdjust( oGrid.right.liner, iRightWidth ); - oGrid.right.liner.style.height = iBodyHeight+"px"; - - oGrid.right.headBlock.style.display = oOverflow.y ? 'block' : 'none'; - oGrid.right.footBlock.style.display = oOverflow.y ? 'block' : 'none'; - } - }, - - - /** - * Get information about the DataTable's scrolling state - specifically if the table is scrolling - * on either the x or y axis, and also the scrollbar width. - * @returns {object} Information about the DataTables scrolling state with the properties: - * 'x', 'y' and 'bar' - * @private - */ - "_fnDTOverflow": function () - { - var nTable = this.s.dt.nTable; - var nTableScrollBody = nTable.parentNode; - var out = { - "x": false, - "y": false, - "bar": this.s.dt.oScroll.iBarWidth - }; - - if ( nTable.offsetWidth > nTableScrollBody.clientWidth ) - { - out.x = true; - } - - if ( nTable.offsetHeight > nTableScrollBody.clientHeight ) - { - out.y = true; - } - - return out; - }, - - - /** - * Clone and position the fixed columns - * @returns {void} - * @param {Boolean} bAll Indicate if the header and footer should be updated as well (true) - * @private - */ - "_fnDraw": function ( bAll ) - { - this._fnGridLayout(); - this._fnCloneLeft( bAll ); - this._fnCloneRight( bAll ); - - /* Draw callback function */ - if ( this.s.fnDrawCallback !== null ) - { - this.s.fnDrawCallback.call( this, this.dom.clone.left, this.dom.clone.right ); - } - - /* Event triggering */ - $(this).trigger( 'draw.dtfc', { - "leftClone": this.dom.clone.left, - "rightClone": this.dom.clone.right - } ); - }, - - - /** - * Clone the right columns - * @returns {void} - * @param {Boolean} bAll Indicate if the header and footer should be updated as well (true) - * @private - */ - "_fnCloneRight": function ( bAll ) - { - if ( this.s.iRightColumns <= 0 ) { - return; - } - - var that = this, - i, jq, - aiColumns = []; - - for ( i=this.s.iTableColumns-this.s.iRightColumns ; i<this.s.iTableColumns ; i++ ) { - if ( this.s.dt.aoColumns[i].bVisible ) { - aiColumns.push( i ); - } - } - - this._fnClone( this.dom.clone.right, this.dom.grid.right, aiColumns, bAll ); - }, - - - /** - * Clone the left columns - * @returns {void} - * @param {Boolean} bAll Indicate if the header and footer should be updated as well (true) - * @private - */ - "_fnCloneLeft": function ( bAll ) - { - if ( this.s.iLeftColumns <= 0 ) { - return; - } - - var that = this, - i, jq, - aiColumns = []; - - for ( i=0 ; i<this.s.iLeftColumns ; i++ ) { - if ( this.s.dt.aoColumns[i].bVisible ) { - aiColumns.push( i ); - } - } - - this._fnClone( this.dom.clone.left, this.dom.grid.left, aiColumns, bAll ); - }, - - - /** - * Make a copy of the layout object for a header or footer element from DataTables. Note that - * this method will clone the nodes in the layout object. - * @returns {Array} Copy of the layout array - * @param {Object} aoOriginal Layout array from DataTables (aoHeader or aoFooter) - * @param {Object} aiColumns Columns to copy - * @private - */ - "_fnCopyLayout": function ( aoOriginal, aiColumns ) - { - var aReturn = []; - var aClones = []; - var aCloned = []; - - for ( var i=0, iLen=aoOriginal.length ; i<iLen ; i++ ) - { - var aRow = []; - aRow.nTr = $(aoOriginal[i].nTr).clone(true, true)[0]; - - for ( var j=0, jLen=this.s.iTableColumns ; j<jLen ; j++ ) - { - if ( $.inArray( j, aiColumns ) === -1 ) - { - continue; - } - - var iCloned = $.inArray( aoOriginal[i][j].cell, aCloned ); - if ( iCloned === -1 ) - { - var nClone = $(aoOriginal[i][j].cell).clone(true, true)[0]; - aClones.push( nClone ); - aCloned.push( aoOriginal[i][j].cell ); - - aRow.push( { - "cell": nClone, - "unique": aoOriginal[i][j].unique - } ); - } - else - { - aRow.push( { - "cell": aClones[ iCloned ], - "unique": aoOriginal[i][j].unique - } ); - } - } - - aReturn.push( aRow ); - } - - return aReturn; - }, - - - /** - * Clone the DataTable nodes and place them in the DOM (sized correctly) - * @returns {void} - * @param {Object} oClone Object containing the header, footer and body cloned DOM elements - * @param {Object} oGrid Grid object containing the display grid elements for the cloned - * column (left or right) - * @param {Array} aiColumns Column indexes which should be operated on from the DataTable - * @param {Boolean} bAll Indicate if the header and footer should be updated as well (true) - * @private - */ - "_fnClone": function ( oClone, oGrid, aiColumns, bAll ) - { - var that = this, - i, iLen, j, jLen, jq, nTarget, iColumn, nClone, iIndex, aoCloneLayout, - jqCloneThead, aoFixedHeader; - - /* - * Header - */ - if ( bAll ) - { - if ( oClone.header !== null ) - { - oClone.header.parentNode.removeChild( oClone.header ); - } - oClone.header = $(this.dom.header).clone(true, true)[0]; - oClone.header.className += " DTFC_Cloned"; - oClone.header.style.width = "100%"; - oGrid.head.appendChild( oClone.header ); - - /* Copy the DataTables layout cache for the header for our floating column */ - aoCloneLayout = this._fnCopyLayout( this.s.dt.aoHeader, aiColumns ); - jqCloneThead = $('>thead', oClone.header); - jqCloneThead.empty(); - - /* Add the created cloned TR elements to the table */ - for ( i=0, iLen=aoCloneLayout.length ; i<iLen ; i++ ) - { - jqCloneThead[0].appendChild( aoCloneLayout[i].nTr ); - } - - /* Use the handy _fnDrawHead function in DataTables to do the rowspan/colspan - * calculations for us - */ - this.s.dt.oApi._fnDrawHead( this.s.dt, aoCloneLayout, true ); - } - else - { - /* To ensure that we copy cell classes exactly, regardless of colspan, multiple rows - * etc, we make a copy of the header from the DataTable again, but don't insert the - * cloned cells, just copy the classes across. To get the matching layout for the - * fixed component, we use the DataTables _fnDetectHeader method, allowing 1:1 mapping - */ - aoCloneLayout = this._fnCopyLayout( this.s.dt.aoHeader, aiColumns ); - aoFixedHeader=[]; - - this.s.dt.oApi._fnDetectHeader( aoFixedHeader, $('>thead', oClone.header)[0] ); - - for ( i=0, iLen=aoCloneLayout.length ; i<iLen ; i++ ) - { - for ( j=0, jLen=aoCloneLayout[i].length ; j<jLen ; j++ ) - { - aoFixedHeader[i][j].cell.className = aoCloneLayout[i][j].cell.className; - - // If jQuery UI theming is used we need to copy those elements as well - $('span.DataTables_sort_icon', aoFixedHeader[i][j].cell).each( function () { - this.className = $('span.DataTables_sort_icon', aoCloneLayout[i][j].cell)[0].className; - } ); - } - } - } - this._fnEqualiseHeights( 'thead', this.dom.header, oClone.header ); - - /* - * Body - */ - if ( this.s.sHeightMatch == 'auto' ) - { - /* Remove any heights which have been applied already and let the browser figure it out */ - $('>tbody>tr', that.dom.body).css('height', 'auto'); - } - - if ( oClone.body !== null ) - { - oClone.body.parentNode.removeChild( oClone.body ); - oClone.body = null; - } - - oClone.body = $(this.dom.body).clone(true)[0]; - oClone.body.className += " DTFC_Cloned"; - oClone.body.style.paddingBottom = this.s.dt.oScroll.iBarWidth+"px"; - oClone.body.style.marginBottom = (this.s.dt.oScroll.iBarWidth*2)+"px"; /* For IE */ - if ( oClone.body.getAttribute('id') !== null ) - { - oClone.body.removeAttribute('id'); - } - - $('>thead>tr', oClone.body).empty(); - $('>tfoot', oClone.body).remove(); - - var nBody = $('tbody', oClone.body)[0]; - $(nBody).empty(); - if ( this.s.dt.aiDisplay.length > 0 ) - { - /* Copy the DataTables' header elements to force the column width in exactly the - * same way that DataTables does it - have the header element, apply the width and - * colapse it down - */ - var nInnerThead = $('>thead>tr', oClone.body)[0]; - for ( iIndex=0 ; iIndex<aiColumns.length ; iIndex++ ) - { - iColumn = aiColumns[iIndex]; - - nClone = $(this.s.dt.aoColumns[iColumn].nTh).clone(true)[0]; - nClone.innerHTML = ""; - - var oStyle = nClone.style; - oStyle.paddingTop = "0"; - oStyle.paddingBottom = "0"; - oStyle.borderTopWidth = "0"; - oStyle.borderBottomWidth = "0"; - oStyle.height = 0; - oStyle.width = that.s.aiInnerWidths[iColumn]+"px"; - - nInnerThead.appendChild( nClone ); - } - - /* Add in the tbody elements, cloning form the master table */ - $('>tbody>tr', that.dom.body).each( function (z) { - var n = this.cloneNode(false); - n.removeAttribute('id'); - var i = that.s.dt.oFeatures.bServerSide===false ? - that.s.dt.aiDisplay[ that.s.dt._iDisplayStart+z ] : z; - var aTds = $(this).children('td, th'); - - for ( iIndex=0 ; iIndex<aiColumns.length ; iIndex++ ) - { - iColumn = aiColumns[iIndex]; - - if ( aTds.length > 0 ) - { - nClone = $( aTds[iColumn] ).clone(true, true)[0]; - n.appendChild( nClone ); - } - } - nBody.appendChild( n ); - } ); - } - else - { - $('>tbody>tr', that.dom.body).each( function (z) { - nClone = this.cloneNode(true); - nClone.className += ' DTFC_NoData'; - $('td', nClone).html(''); - nBody.appendChild( nClone ); - } ); - } - - oClone.body.style.width = "100%"; - oClone.body.style.margin = "0"; - oClone.body.style.padding = "0"; - - if ( bAll ) - { - if ( typeof this.s.dt.oScroller != 'undefined' ) - { - oGrid.liner.appendChild( this.s.dt.oScroller.dom.force.cloneNode(true) ); - } - } - oGrid.liner.appendChild( oClone.body ); - - this._fnEqualiseHeights( 'tbody', that.dom.body, oClone.body ); - - /* - * Footer - */ - if ( this.s.dt.nTFoot !== null ) - { - if ( bAll ) - { - if ( oClone.footer !== null ) - { - oClone.footer.parentNode.removeChild( oClone.footer ); - } - oClone.footer = $(this.dom.footer).clone(true, true)[0]; - oClone.footer.className += " DTFC_Cloned"; - oClone.footer.style.width = "100%"; - oGrid.foot.appendChild( oClone.footer ); - - /* Copy the footer just like we do for the header */ - aoCloneLayout = this._fnCopyLayout( this.s.dt.aoFooter, aiColumns ); - var jqCloneTfoot = $('>tfoot', oClone.footer); - jqCloneTfoot.empty(); - - for ( i=0, iLen=aoCloneLayout.length ; i<iLen ; i++ ) - { - jqCloneTfoot[0].appendChild( aoCloneLayout[i].nTr ); - } - this.s.dt.oApi._fnDrawHead( this.s.dt, aoCloneLayout, true ); - } - else - { - aoCloneLayout = this._fnCopyLayout( this.s.dt.aoFooter, aiColumns ); - var aoCurrFooter=[]; - - this.s.dt.oApi._fnDetectHeader( aoCurrFooter, $('>tfoot', oClone.footer)[0] ); - - for ( i=0, iLen=aoCloneLayout.length ; i<iLen ; i++ ) - { - for ( j=0, jLen=aoCloneLayout[i].length ; j<jLen ; j++ ) - { - aoCurrFooter[i][j].cell.className = aoCloneLayout[i][j].cell.className; - } - } - } - this._fnEqualiseHeights( 'tfoot', this.dom.footer, oClone.footer ); - } - - /* Equalise the column widths between the header footer and body - body get's priority */ - var anUnique = this.s.dt.oApi._fnGetUniqueThs( this.s.dt, $('>thead', oClone.header)[0] ); - $(anUnique).each( function (i) { - iColumn = aiColumns[i]; - this.style.width = that.s.aiInnerWidths[iColumn]+"px"; - } ); - - if ( that.s.dt.nTFoot !== null ) - { - anUnique = this.s.dt.oApi._fnGetUniqueThs( this.s.dt, $('>tfoot', oClone.footer)[0] ); - $(anUnique).each( function (i) { - iColumn = aiColumns[i]; - this.style.width = that.s.aiInnerWidths[iColumn]+"px"; - } ); - } - }, - - - /** - * From a given table node (THEAD etc), get a list of TR direct child elements - * @param {Node} nIn Table element to search for TR elements (THEAD, TBODY or TFOOT element) - * @returns {Array} List of TR elements found - * @private - */ - "_fnGetTrNodes": function ( nIn ) - { - var aOut = []; - for ( var i=0, iLen=nIn.childNodes.length ; i<iLen ; i++ ) - { - if ( nIn.childNodes[i].nodeName.toUpperCase() == "TR" ) - { - aOut.push( nIn.childNodes[i] ); - } - } - return aOut; - }, - - - /** - * Equalise the heights of the rows in a given table node in a cross browser way - * @returns {void} - * @param {String} nodeName Node type - thead, tbody or tfoot - * @param {Node} original Original node to take the heights from - * @param {Node} clone Copy the heights to - * @private - */ - "_fnEqualiseHeights": function ( nodeName, original, clone ) - { - if ( this.s.sHeightMatch == 'none' && nodeName !== 'thead' && nodeName !== 'tfoot' ) - { - return; - } - - var that = this, - i, iLen, iHeight, iHeight2, iHeightOriginal, iHeightClone, - rootOriginal = original.getElementsByTagName(nodeName)[0], - rootClone = clone.getElementsByTagName(nodeName)[0], - jqBoxHack = $('>'+nodeName+'>tr:eq(0)', original).children(':first'), - iBoxHack = jqBoxHack.outerHeight() - jqBoxHack.height(), - anOriginal = this._fnGetTrNodes( rootOriginal ), - anClone = this._fnGetTrNodes( rootClone ), - heights = []; - - for ( i=0, iLen=anClone.length ; i<iLen ; i++ ) - { - iHeightOriginal = anOriginal[i].offsetHeight; - iHeightClone = anClone[i].offsetHeight; - iHeight = iHeightClone > iHeightOriginal ? iHeightClone : iHeightOriginal; - - if ( this.s.sHeightMatch == 'semiauto' ) - { - anOriginal[i]._DTTC_iHeight = iHeight; - } - - heights.push( iHeight ); - } - - for ( i=0, iLen=anClone.length ; i<iLen ; i++ ) - { - anClone[i].style.height = heights[i]+"px"; - anOriginal[i].style.height = heights[i]+"px"; - } - } -}; - - - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Statics - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/** - * FixedColumns default settings for initialisation - * @name FixedColumns.defaults - * @namespace - * @static - */ -FixedColumns.defaults = /** @lends FixedColumns.defaults */{ - /** - * Number of left hand columns to fix in position - * @type int - * @default 1 - * @static - * @example - * var = $('#example').dataTable( { - * "scrollX": "100%" - * } ); - * new $.fn.dataTable.fixedColumns( table, { - * "leftColumns": 2 - * } ); - */ - "iLeftColumns": 1, - - /** - * Number of right hand columns to fix in position - * @type int - * @default 0 - * @static - * @example - * var table = $('#example').dataTable( { - * "scrollX": "100%" - * } ); - * new $.fn.dataTable.fixedColumns( table, { - * "rightColumns": 1 - * } ); - */ - "iRightColumns": 0, - - /** - * Draw callback function which is called when FixedColumns has redrawn the fixed assets - * @type function(object, object):void - * @default null - * @static - * @example - * var table = $('#example').dataTable( { - * "scrollX": "100%" - * } ); - * new $.fn.dataTable.fixedColumns( table, { - * "drawCallback": function () { - * alert( "FixedColumns redraw" ); - * } - * } ); - */ - "fnDrawCallback": null, - - /** - * Height matching algorthim to use. This can be "none" which will result in no height - * matching being applied by FixedColumns (height matching could be forced by CSS in this - * case), "semiauto" whereby the height calculation will be performed once, and the result - * cached to be used again (fnRecalculateHeight can be used to force recalculation), or - * "auto" when height matching is performed on every draw (slowest but must accurate) - * @type string - * @default semiauto - * @static - * @example - * var table = $('#example').dataTable( { - * "scrollX": "100%" - * } ); - * new $.fn.dataTable.fixedColumns( table, { - * "heightMatch": "auto" - * } ); - */ - "sHeightMatch": "semiauto" -}; - - - - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Constants - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/** - * FixedColumns version - * @name FixedColumns.version - * @type String - * @default See code - * @static - */ -FixedColumns.version = "3.0.3"; - - - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Fired events (for documentation) - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - - -/** - * Event fired whenever FixedColumns redraws the fixed columns (i.e. clones the table elements from the main DataTable). This will occur whenever the DataTable that the FixedColumns instance is attached does its own draw. - * @name FixedColumns#draw.dtfc - * @event - * @param {event} e jQuery event object - * @param {object} o Event parameters from FixedColumns - * @param {object} o.leftClone Instance's object dom.clone.left for easy reference. This object contains references to the left fixed clumn column's nodes - * @param {object} o.rightClone Instance's object dom.clone.right for easy reference. This object contains references to the right fixed clumn column's nodes - */ - - -// Make FixedColumns accessible from the DataTables instance -$.fn.dataTable.FixedColumns = FixedColumns; -$.fn.DataTable.FixedColumns = FixedColumns; - - -return FixedColumns; -}; // /factory - - -// Define as an AMD module if possible -if ( typeof define === 'function' && define.amd ) { - define( ['jquery', 'datatables'], factory ); -} -else if ( typeof exports === 'object' ) { - // Node/CommonJS - factory( require('jquery'), require('datatables') ); -} -else if ( jQuery && !jQuery.fn.dataTable.FixedColumns ) { - // Otherwise simply initialise as normal, stopping multiple evaluation - factory( jQuery, jQuery.fn.dataTable ); -} - - -})(window, document); diff --git a/src/main/resources/META-INF/resources/designer/lib/dataTables.searchHighlight.min.js b/src/main/resources/META-INF/resources/designer/lib/dataTables.searchHighlight.min.js deleted file mode 100644 index 37f2bef69..000000000 --- a/src/main/resources/META-INF/resources/designer/lib/dataTables.searchHighlight.min.js +++ /dev/null @@ -1,6 +0,0 @@ -/*! - SearchHighlight for DataTables v1.0.1 - 2014 SpryMedia Ltd - datatables.net/license -*/ -(function(g,d,a){function e(a,c){a.unhighlight();c.rows({filter:"applied"}).data().length&&a.highlight(c.search().split(" "))}a(d).on("init.dt.dth",function(d,c){var b=new a.fn.dataTable.Api(c),f=a(b.table().body());if(a(b.table().node()).hasClass("searchHighlight")||c.oInit.searchHighlight||a.fn.dataTable.defaults.searchHighlight)b.on("draw.dt.dth column-visibility.dt.dth column-reorder.dt.dth",function(){e(f,b)}).on("destroy",function(){b.off("draw.dt.dth column-visibility.dt.dth column-reorder.dt.dth")}), -b.search()&&e(f,b)})})(window,document,jQuery);
\ No newline at end of file diff --git a/src/main/resources/META-INF/resources/designer/lib/dataTables.tableTools.js b/src/main/resources/META-INF/resources/designer/lib/dataTables.tableTools.js deleted file mode 100644 index 4fd3939cf..000000000 --- a/src/main/resources/META-INF/resources/designer/lib/dataTables.tableTools.js +++ /dev/null @@ -1,3215 +0,0 @@ -/*! TableTools 2.2.3 - * 2009-2014 SpryMedia Ltd - datatables.net/license - * - * ZeroClipboard 1.0.4 - * Author: Joseph Huckaby - MIT licensed - */ - -/** - * @summary TableTools - * @description Tools and buttons for DataTables - * @version 2.2.3 - * @file dataTables.tableTools.js - * @author SpryMedia Ltd (www.sprymedia.co.uk) - * @contact www.sprymedia.co.uk/contact - * @copyright Copyright 2009-2014 SpryMedia Ltd. - * - * This source file is free software, available under the following license: - * MIT license - http://datatables.net/license/mit - * - * This source file is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details. - * - * For details please refer to: http://www.datatables.net - */ - - -/* Global scope for TableTools for backwards compatibility. - * Will be removed in 2.3 - */ -var TableTools; - -(function(window, document, undefined) { - - -var factory = function( $, DataTable ) { -"use strict"; - - -//include ZeroClipboard.js -/* ZeroClipboard 1.0.4 - * Author: Joseph Huckaby - */ - -var ZeroClipboard_TableTools = { - - version: "1.0.4-TableTools2", - clients: {}, // registered upload clients on page, indexed by id - moviePath: '', // URL to movie - nextId: 1, // ID of next movie - - $: function(thingy) { - // simple DOM lookup utility function - if (typeof(thingy) == 'string') { - thingy = document.getElementById(thingy); - } - if (!thingy.addClass) { - // extend element with a few useful methods - thingy.hide = function() { this.style.display = 'none'; }; - thingy.show = function() { this.style.display = ''; }; - thingy.addClass = function(name) { this.removeClass(name); this.className += ' ' + name; }; - thingy.removeClass = function(name) { - this.className = this.className.replace( new RegExp("\\s*" + name + "\\s*"), " ").replace(/^\s+/, '').replace(/\s+$/, ''); - }; - thingy.hasClass = function(name) { - return !!this.className.match( new RegExp("\\s*" + name + "\\s*") ); - }; - } - return thingy; - }, - - setMoviePath: function(path) { - // set path to ZeroClipboard.swf - this.moviePath = path; - }, - - dispatch: function(id, eventName, args) { - // receive event from flash movie, send to client - var client = this.clients[id]; - if (client) { - client.receiveEvent(eventName, args); - } - }, - - register: function(id, client) { - // register new client to receive events - this.clients[id] = client; - }, - - getDOMObjectPosition: function(obj) { - // get absolute coordinates for dom element - var info = { - left: 0, - top: 0, - width: obj.width ? obj.width : obj.offsetWidth, - height: obj.height ? obj.height : obj.offsetHeight - }; - - if ( obj.style.width !== "" ) { - info.width = obj.style.width.replace("px",""); - } - - if ( obj.style.height !== "" ) { - info.height = obj.style.height.replace("px",""); - } - - while (obj) { - info.left += obj.offsetLeft; - info.top += obj.offsetTop; - obj = obj.offsetParent; - } - - return info; - }, - - Client: function(elem) { - // constructor for new simple upload client - this.handlers = {}; - - // unique ID - this.id = ZeroClipboard_TableTools.nextId++; - this.movieId = 'ZeroClipboard_TableToolsMovie_' + this.id; - - // register client with singleton to receive flash events - ZeroClipboard_TableTools.register(this.id, this); - - // create movie - if (elem) { - this.glue(elem); - } - } -}; - -ZeroClipboard_TableTools.Client.prototype = { - - id: 0, // unique ID for us - ready: false, // whether movie is ready to receive events or not - movie: null, // reference to movie object - clipText: '', // text to copy to clipboard - fileName: '', // default file save name - action: 'copy', // action to perform - handCursorEnabled: true, // whether to show hand cursor, or default pointer cursor - cssEffects: true, // enable CSS mouse effects on dom container - handlers: null, // user event handlers - sized: false, - - glue: function(elem, title) { - // glue to DOM element - // elem can be ID or actual DOM element object - this.domElement = ZeroClipboard_TableTools.$(elem); - - // float just above object, or zIndex 99 if dom element isn't set - var zIndex = 99; - if (this.domElement.style.zIndex) { - zIndex = parseInt(this.domElement.style.zIndex, 10) + 1; - } - - // find X/Y position of domElement - var box = ZeroClipboard_TableTools.getDOMObjectPosition(this.domElement); - - // create floating DIV above element - this.div = document.createElement('div'); - var style = this.div.style; - style.position = 'absolute'; - style.left = '0px'; - style.top = '0px'; - style.width = (box.width) + 'px'; - style.height = box.height + 'px'; - style.zIndex = zIndex; - - if ( typeof title != "undefined" && title !== "" ) { - this.div.title = title; - } - if ( box.width !== 0 && box.height !== 0 ) { - this.sized = true; - } - - // style.backgroundColor = '#f00'; // debug - if ( this.domElement ) { - this.domElement.appendChild(this.div); - this.div.innerHTML = this.getHTML( box.width, box.height ).replace(/&/g, '&'); - } - }, - - positionElement: function() { - var box = ZeroClipboard_TableTools.getDOMObjectPosition(this.domElement); - var style = this.div.style; - - style.position = 'absolute'; - //style.left = (this.domElement.offsetLeft)+'px'; - //style.top = this.domElement.offsetTop+'px'; - style.width = box.width + 'px'; - style.height = box.height + 'px'; - - if ( box.width !== 0 && box.height !== 0 ) { - this.sized = true; - } else { - return; - } - - var flash = this.div.childNodes[0]; - flash.width = box.width; - flash.height = box.height; - }, - - getHTML: function(width, height) { - // return HTML for movie - var html = ''; - var flashvars = 'id=' + this.id + - '&width=' + width + - '&height=' + height; - - if (navigator.userAgent.match(/MSIE/)) { - // IE gets an OBJECT tag - var protocol = location.href.match(/^https/i) ? 'https://' : 'http://'; - html += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="'+protocol+'download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0" width="'+width+'" height="'+height+'" id="'+this.movieId+'" align="middle"><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="false" /><param name="movie" value="'+ZeroClipboard_TableTools.moviePath+'" /><param name="loop" value="false" /><param name="menu" value="false" /><param name="quality" value="best" /><param name="bgcolor" value="#ffffff" /><param name="flashvars" value="'+flashvars+'"/><param name="wmode" value="transparent"/></object>'; - } - else { - // all other browsers get an EMBED tag - html += '<embed id="'+this.movieId+'" src="'+ZeroClipboard_TableTools.moviePath+'" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="'+width+'" height="'+height+'" name="'+this.movieId+'" align="middle" allowScriptAccess="always" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="'+flashvars+'" wmode="transparent" />'; - } - return html; - }, - - hide: function() { - // temporarily hide floater offscreen - if (this.div) { - this.div.style.left = '-2000px'; - } - }, - - show: function() { - // show ourselves after a call to hide() - this.reposition(); - }, - - destroy: function() { - // destroy control and floater - if (this.domElement && this.div) { - this.hide(); - this.div.innerHTML = ''; - - var body = document.getElementsByTagName('body')[0]; - try { body.removeChild( this.div ); } catch(e) {} - - this.domElement = null; - this.div = null; - } - }, - - reposition: function(elem) { - // reposition our floating div, optionally to new container - // warning: container CANNOT change size, only position - if (elem) { - this.domElement = ZeroClipboard_TableTools.$(elem); - if (!this.domElement) { - this.hide(); - } - } - - if (this.domElement && this.div) { - var box = ZeroClipboard_TableTools.getDOMObjectPosition(this.domElement); - var style = this.div.style; - style.left = '' + box.left + 'px'; - style.top = '' + box.top + 'px'; - } - }, - - clearText: function() { - // clear the text to be copy / saved - this.clipText = ''; - if (this.ready) { - this.movie.clearText(); - } - }, - - appendText: function(newText) { - // append text to that which is to be copied / saved - this.clipText += newText; - if (this.ready) { this.movie.appendText(newText) ;} - }, - - setText: function(newText) { - // set text to be copied to be copied / saved - this.clipText = newText; - if (this.ready) { this.movie.setText(newText) ;} - }, - - setCharSet: function(charSet) { - // set the character set (UTF16LE or UTF8) - this.charSet = charSet; - if (this.ready) { this.movie.setCharSet(charSet) ;} - }, - - setBomInc: function(bomInc) { - // set if the BOM should be included or not - this.incBom = bomInc; - if (this.ready) { this.movie.setBomInc(bomInc) ;} - }, - - setFileName: function(newText) { - // set the file name - this.fileName = newText; - if (this.ready) { - this.movie.setFileName(newText); - } - }, - - setAction: function(newText) { - // set action (save or copy) - this.action = newText; - if (this.ready) { - this.movie.setAction(newText); - } - }, - - addEventListener: function(eventName, func) { - // add user event listener for event - // event types: load, queueStart, fileStart, fileComplete, queueComplete, progress, error, cancel - eventName = eventName.toString().toLowerCase().replace(/^on/, ''); - if (!this.handlers[eventName]) { - this.handlers[eventName] = []; - } - this.handlers[eventName].push(func); - }, - - setHandCursor: function(enabled) { - // enable hand cursor (true), or default arrow cursor (false) - this.handCursorEnabled = enabled; - if (this.ready) { - this.movie.setHandCursor(enabled); - } - }, - - setCSSEffects: function(enabled) { - // enable or disable CSS effects on DOM container - this.cssEffects = !!enabled; - }, - - receiveEvent: function(eventName, args) { - var self; - - // receive event from flash - eventName = eventName.toString().toLowerCase().replace(/^on/, ''); - - // special behavior for certain events - switch (eventName) { - case 'load': - // movie claims it is ready, but in IE this isn't always the case... - // bug fix: Cannot extend EMBED DOM elements in Firefox, must use traditional function - this.movie = document.getElementById(this.movieId); - if (!this.movie) { - self = this; - setTimeout( function() { self.receiveEvent('load', null); }, 1 ); - return; - } - - // firefox on pc needs a "kick" in order to set these in certain cases - if (!this.ready && navigator.userAgent.match(/Firefox/) && navigator.userAgent.match(/Windows/)) { - self = this; - setTimeout( function() { self.receiveEvent('load', null); }, 100 ); - this.ready = true; - return; - } - - this.ready = true; - this.movie.clearText(); - this.movie.appendText( this.clipText ); - this.movie.setFileName( this.fileName ); - this.movie.setAction( this.action ); - this.movie.setCharSet( this.charSet ); - this.movie.setBomInc( this.incBom ); - this.movie.setHandCursor( this.handCursorEnabled ); - break; - - case 'mouseover': - if (this.domElement && this.cssEffects) { - //this.domElement.addClass('hover'); - if (this.recoverActive) { - this.domElement.addClass('active'); - } - } - break; - - case 'mouseout': - if (this.domElement && this.cssEffects) { - this.recoverActive = false; - if (this.domElement.hasClass('active')) { - this.domElement.removeClass('active'); - this.recoverActive = true; - } - //this.domElement.removeClass('hover'); - } - break; - - case 'mousedown': - if (this.domElement && this.cssEffects) { - this.domElement.addClass('active'); - } - break; - - case 'mouseup': - if (this.domElement && this.cssEffects) { - this.domElement.removeClass('active'); - this.recoverActive = false; - } - break; - } // switch eventName - - if (this.handlers[eventName]) { - for (var idx = 0, len = this.handlers[eventName].length; idx < len; idx++) { - var func = this.handlers[eventName][idx]; - - if (typeof(func) == 'function') { - // actual function reference - func(this, args); - } - else if ((typeof(func) == 'object') && (func.length == 2)) { - // PHP style object + method, i.e. [myObject, 'myMethod'] - func[0][ func[1] ](this, args); - } - else if (typeof(func) == 'string') { - // name of function - window[func](this, args); - } - } // foreach event handler defined - } // user defined handler for event - } - -}; - -// For the Flash binding to work, ZeroClipboard_TableTools must be on the global -// object list -window.ZeroClipboard_TableTools = ZeroClipboard_TableTools; -//include TableTools.js -/* TableTools - * 2009-2014 SpryMedia Ltd - datatables.net/license - */ - -/*globals TableTools,ZeroClipboard_TableTools*/ - - -(function($, window, document) { - -/** - * TableTools provides flexible buttons and other tools for a DataTables enhanced table - * @class TableTools - * @constructor - * @param {Object} oDT DataTables instance. When using DataTables 1.10 this can - * also be a jQuery collection, jQuery selector, table node, DataTables API - * instance or DataTables settings object. - * @param {Object} oOpts TableTools options - * @param {String} oOpts.sSwfPath ZeroClipboard SWF path - * @param {String} oOpts.sRowSelect Row selection options - 'none', 'single', 'multi' or 'os' - * @param {Function} oOpts.fnPreRowSelect Callback function just prior to row selection - * @param {Function} oOpts.fnRowSelected Callback function just after row selection - * @param {Function} oOpts.fnRowDeselected Callback function when row is deselected - * @param {Array} oOpts.aButtons List of buttons to be used - */ -TableTools = function( oDT, oOpts ) -{ - /* Santiy check that we are a new instance */ - if ( ! this instanceof TableTools ) - { - alert( "Warning: TableTools must be initialised with the keyword 'new'" ); - } - - // In 1.10 we can use the API to get the settings object from a number of - // sources - var dtSettings = $.fn.dataTable.Api ? - new $.fn.dataTable.Api( oDT ).settings()[0] : - oDT.fnSettings(); - - - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Public class variables - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - - /** - * @namespace Settings object which contains customisable information for TableTools instance - */ - this.s = { - /** - * Store 'this' so the instance can be retrieved from the settings object - * @property that - * @type object - * @default this - */ - "that": this, - - /** - * DataTables settings objects - * @property dt - * @type object - * @default <i>From the oDT init option</i> - */ - "dt": dtSettings, - - /** - * @namespace Print specific information - */ - "print": { - /** - * DataTables draw 'start' point before the printing display was shown - * @property saveStart - * @type int - * @default -1 - */ - "saveStart": -1, - - /** - * DataTables draw 'length' point before the printing display was shown - * @property saveLength - * @type int - * @default -1 - */ - "saveLength": -1, - - /** - * Page scrolling point before the printing display was shown so it can be restored - * @property saveScroll - * @type int - * @default -1 - */ - "saveScroll": -1, - - /** - * Wrapped function to end the print display (to maintain scope) - * @property funcEnd - * @type Function - * @default function () {} - */ - "funcEnd": function () {} - }, - - /** - * A unique ID is assigned to each button in each instance - * @property buttonCounter - * @type int - * @default 0 - */ - "buttonCounter": 0, - - /** - * @namespace Select rows specific information - */ - "select": { - /** - * Select type - can be 'none', 'single' or 'multi' - * @property type - * @type string - * @default "" - */ - "type": "", - - /** - * Array of nodes which are currently selected - * @property selected - * @type array - * @default [] - */ - "selected": [], - - /** - * Function to run before the selection can take place. Will cancel the select if the - * function returns false - * @property preRowSelect - * @type Function - * @default null - */ - "preRowSelect": null, - - /** - * Function to run when a row is selected - * @property postSelected - * @type Function - * @default null - */ - "postSelected": null, - - /** - * Function to run when a row is deselected - * @property postDeselected - * @type Function - * @default null - */ - "postDeselected": null, - - /** - * Indicate if all rows are selected (needed for server-side processing) - * @property all - * @type boolean - * @default false - */ - "all": false, - - /** - * Class name to add to selected TR nodes - * @property selectedClass - * @type String - * @default "" - */ - "selectedClass": "" - }, - - /** - * Store of the user input customisation object - * @property custom - * @type object - * @default {} - */ - "custom": {}, - - /** - * SWF movie path - * @property swfPath - * @type string - * @default "" - */ - "swfPath": "", - - /** - * Default button set - * @property buttonSet - * @type array - * @default [] - */ - "buttonSet": [], - - /** - * When there is more than one TableTools instance for a DataTable, there must be a - * master which controls events (row selection etc) - * @property master - * @type boolean - * @default false - */ - "master": false, - - /** - * Tag names that are used for creating collections and buttons - * @namesapce - */ - "tags": {} - }; - - - /** - * @namespace Common and useful DOM elements for the class instance - */ - this.dom = { - /** - * DIV element that is create and all TableTools buttons (and their children) put into - * @property container - * @type node - * @default null - */ - "container": null, - - /** - * The table node to which TableTools will be applied - * @property table - * @type node - * @default null - */ - "table": null, - - /** - * @namespace Nodes used for the print display - */ - "print": { - /** - * Nodes which have been removed from the display by setting them to display none - * @property hidden - * @type array - * @default [] - */ - "hidden": [], - - /** - * The information display saying telling the user about the print display - * @property message - * @type node - * @default null - */ - "message": null - }, - - /** - * @namespace Nodes used for a collection display. This contains the currently used collection - */ - "collection": { - /** - * The div wrapper containing the buttons in the collection (i.e. the menu) - * @property collection - * @type node - * @default null - */ - "collection": null, - - /** - * Background display to provide focus and capture events - * @property background - * @type node - * @default null - */ - "background": null - } - }; - - /** - * @namespace Name space for the classes that this TableTools instance will use - * @extends TableTools.classes - */ - this.classes = $.extend( true, {}, TableTools.classes ); - if ( this.s.dt.bJUI ) - { - $.extend( true, this.classes, TableTools.classes_themeroller ); - } - - - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Public class methods - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - - /** - * Retreieve the settings object from an instance - * @method fnSettings - * @returns {object} TableTools settings object - */ - this.fnSettings = function () { - return this.s; - }; - - - /* Constructor logic */ - if ( typeof oOpts == 'undefined' ) - { - oOpts = {}; - } - - - TableTools._aInstances.push( this ); - this._fnConstruct( oOpts ); - - return this; -}; - - - -TableTools.prototype = { - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Public methods - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - - /** - * Retreieve the settings object from an instance - * @returns {array} List of TR nodes which are currently selected - * @param {boolean} [filtered=false] Get only selected rows which are - * available given the filtering applied to the table. By default - * this is false - i.e. all rows, regardless of filtering are - selected. - */ - "fnGetSelected": function ( filtered ) - { - var - out = [], - data = this.s.dt.aoData, - displayed = this.s.dt.aiDisplay, - i, iLen; - - if ( filtered ) - { - // Only consider filtered rows - for ( i=0, iLen=displayed.length ; i<iLen ; i++ ) - { - if ( data[ displayed[i] ]._DTTT_selected ) - { - out.push( data[ displayed[i] ].nTr ); - } - } - } - else - { - // Use all rows - for ( i=0, iLen=data.length ; i<iLen ; i++ ) - { - if ( data[i]._DTTT_selected ) - { - out.push( data[i].nTr ); - } - } - } - - return out; - }, - - - /** - * Get the data source objects/arrays from DataTables for the selected rows (same as - * fnGetSelected followed by fnGetData on each row from the table) - * @returns {array} Data from the TR nodes which are currently selected - */ - "fnGetSelectedData": function () - { - var out = []; - var data=this.s.dt.aoData; - var i, iLen; - - for ( i=0, iLen=data.length ; i<iLen ; i++ ) - { - if ( data[i]._DTTT_selected ) - { - out.push( this.s.dt.oInstance.fnGetData(i) ); - } - } - - return out; - }, - - - /** - * Get the indexes of the selected rows - * @returns {array} List of row indexes - * @param {boolean} [filtered=false] Get only selected rows which are - * available given the filtering applied to the table. By default - * this is false - i.e. all rows, regardless of filtering are - selected. - */ - "fnGetSelectedIndexes": function ( filtered ) - { - var - out = [], - data = this.s.dt.aoData, - displayed = this.s.dt.aiDisplay, - i, iLen; - - if ( filtered ) - { - // Only consider filtered rows - for ( i=0, iLen=displayed.length ; i<iLen ; i++ ) - { - if ( data[ displayed[i] ]._DTTT_selected ) - { - out.push( displayed[i] ); - } - } - } - else - { - // Use all rows - for ( i=0, iLen=data.length ; i<iLen ; i++ ) - { - if ( data[i]._DTTT_selected ) - { - out.push( i ); - } - } - } - - return out; - }, - - - /** - * Check to see if a current row is selected or not - * @param {Node} n TR node to check if it is currently selected or not - * @returns {Boolean} true if select, false otherwise - */ - "fnIsSelected": function ( n ) - { - var pos = this.s.dt.oInstance.fnGetPosition( n ); - return (this.s.dt.aoData[pos]._DTTT_selected===true) ? true : false; - }, - - - /** - * Select all rows in the table - * @param {boolean} [filtered=false] Select only rows which are available - * given the filtering applied to the table. By default this is false - - * i.e. all rows, regardless of filtering are selected. - */ - "fnSelectAll": function ( filtered ) - { - this._fnRowSelect( filtered ? - this.s.dt.aiDisplay : - this.s.dt.aoData - ); - }, - - - /** - * Deselect all rows in the table - * @param {boolean} [filtered=false] Deselect only rows which are available - * given the filtering applied to the table. By default this is false - - * i.e. all rows, regardless of filtering are deselected. - */ - "fnSelectNone": function ( filtered ) - { - this._fnRowDeselect( this.fnGetSelectedIndexes(filtered) ); - }, - - - /** - * Select row(s) - * @param {node|object|array} n The row(s) to select. Can be a single DOM - * TR node, an array of TR nodes or a jQuery object. - */ - "fnSelect": function ( n ) - { - if ( this.s.select.type == "single" ) - { - this.fnSelectNone(); - this._fnRowSelect( n ); - } - else - { - this._fnRowSelect( n ); - } - }, - - - /** - * Deselect row(s) - * @param {node|object|array} n The row(s) to deselect. Can be a single DOM - * TR node, an array of TR nodes or a jQuery object. - */ - "fnDeselect": function ( n ) - { - this._fnRowDeselect( n ); - }, - - - /** - * Get the title of the document - useful for file names. The title is retrieved from either - * the configuration object's 'title' parameter, or the HTML document title - * @param {Object} oConfig Button configuration object - * @returns {String} Button title - */ - "fnGetTitle": function( oConfig ) - { - var sTitle = ""; - if ( typeof oConfig.sTitle != 'undefined' && oConfig.sTitle !== "" ) { - sTitle = oConfig.sTitle; - } else { - var anTitle = document.getElementsByTagName('title'); - if ( anTitle.length > 0 ) - { - sTitle = anTitle[0].innerHTML; - } - } - - /* Strip characters which the OS will object to - checking for UTF8 support in the scripting - * engine - */ - if ( "\u00A1".toString().length < 4 ) { - return sTitle.replace(/[^a-zA-Z0-9_\u00A1-\uFFFF\.,\-_ !\(\)]/g, ""); - } else { - return sTitle.replace(/[^a-zA-Z0-9_\.,\-_ !\(\)]/g, ""); - } - }, - - - /** - * Calculate a unity array with the column width by proportion for a set of columns to be - * included for a button. This is particularly useful for PDF creation, where we can use the - * column widths calculated by the browser to size the columns in the PDF. - * @param {Object} oConfig Button configuration object - * @returns {Array} Unity array of column ratios - */ - "fnCalcColRatios": function ( oConfig ) - { - var - aoCols = this.s.dt.aoColumns, - aColumnsInc = this._fnColumnTargets( oConfig.mColumns ), - aColWidths = [], - iWidth = 0, iTotal = 0, i, iLen; - - for ( i=0, iLen=aColumnsInc.length ; i<iLen ; i++ ) - { - if ( aColumnsInc[i] ) - { - iWidth = aoCols[i].nTh.offsetWidth; - iTotal += iWidth; - aColWidths.push( iWidth ); - } - } - - for ( i=0, iLen=aColWidths.length ; i<iLen ; i++ ) - { - aColWidths[i] = aColWidths[i] / iTotal; - } - - return aColWidths.join('\t'); - }, - - - /** - * Get the information contained in a table as a string - * @param {Object} oConfig Button configuration object - * @returns {String} Table data as a string - */ - "fnGetTableData": function ( oConfig ) - { - /* In future this could be used to get data from a plain HTML source as well as DataTables */ - if ( this.s.dt ) - { - return this._fnGetDataTablesData( oConfig ); - } - }, - - - /** - * Pass text to a flash button instance, which will be used on the button's click handler - * @param {Object} clip Flash button object - * @param {String} text Text to set - */ - "fnSetText": function ( clip, text ) - { - this._fnFlashSetText( clip, text ); - }, - - - /** - * Resize the flash elements of the buttons attached to this TableTools instance - this is - * useful for when initialising TableTools when it is hidden (display:none) since sizes can't - * be calculated at that time. - */ - "fnResizeButtons": function () - { - for ( var cli in ZeroClipboard_TableTools.clients ) - { - if ( cli ) - { - var client = ZeroClipboard_TableTools.clients[cli]; - if ( typeof client.domElement != 'undefined' && - client.domElement.parentNode ) - { - client.positionElement(); - } - } - } - }, - - - /** - * Check to see if any of the ZeroClipboard client's attached need to be resized - */ - "fnResizeRequired": function () - { - for ( var cli in ZeroClipboard_TableTools.clients ) - { - if ( cli ) - { - var client = ZeroClipboard_TableTools.clients[cli]; - if ( typeof client.domElement != 'undefined' && - client.domElement.parentNode == this.dom.container && - client.sized === false ) - { - return true; - } - } - } - return false; - }, - - - /** - * Programmatically enable or disable the print view - * @param {boolean} [bView=true] Show the print view if true or not given. If false, then - * terminate the print view and return to normal. - * @param {object} [oConfig={}] Configuration for the print view - * @param {boolean} [oConfig.bShowAll=false] Show all rows in the table if true - * @param {string} [oConfig.sInfo] Information message, displayed as an overlay to the - * user to let them know what the print view is. - * @param {string} [oConfig.sMessage] HTML string to show at the top of the document - will - * be included in the printed document. - */ - "fnPrint": function ( bView, oConfig ) - { - if ( oConfig === undefined ) - { - oConfig = {}; - } - - if ( bView === undefined || bView ) - { - this._fnPrintStart( oConfig ); - } - else - { - this._fnPrintEnd(); - } - }, - - - /** - * Show a message to the end user which is nicely styled - * @param {string} message The HTML string to show to the user - * @param {int} time The duration the message is to be shown on screen for (mS) - */ - "fnInfo": function ( message, time ) { - var info = $('<div/>') - .addClass( this.classes.print.info ) - .html( message ) - .appendTo( 'body' ); - - setTimeout( function() { - info.fadeOut( "normal", function() { - info.remove(); - } ); - }, time ); - }, - - - - /** - * Get the container element of the instance for attaching to the DOM - * @returns {node} DOM node - */ - "fnContainer": function () { - return this.dom.container; - }, - - - - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Private methods (they are of course public in JS, but recommended as private) - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - - /** - * Constructor logic - * @method _fnConstruct - * @param {Object} oOpts Same as TableTools constructor - * @returns void - * @private - */ - "_fnConstruct": function ( oOpts ) - { - var that = this; - - this._fnCustomiseSettings( oOpts ); - - /* Container element */ - this.dom.container = document.createElement( this.s.tags.container ); - this.dom.container.className = this.classes.container; - - /* Row selection config */ - if ( this.s.select.type != 'none' ) - { - this._fnRowSelectConfig(); - } - - /* Buttons */ - this._fnButtonDefinations( this.s.buttonSet, this.dom.container ); - - /* Destructor */ - this.s.dt.aoDestroyCallback.push( { - "sName": "TableTools", - "fn": function () { - $(that.s.dt.nTBody).off( 'click.DTTT_Select', 'tr' ); - $(that.dom.container).empty(); - - // Remove the instance - var idx = $.inArray( that, TableTools._aInstances ); - if ( idx !== -1 ) { - TableTools._aInstances.splice( idx, 1 ); - } - } - } ); - }, - - - /** - * Take the user defined settings and the default settings and combine them. - * @method _fnCustomiseSettings - * @param {Object} oOpts Same as TableTools constructor - * @returns void - * @private - */ - "_fnCustomiseSettings": function ( oOpts ) - { - /* Is this the master control instance or not? */ - if ( typeof this.s.dt._TableToolsInit == 'undefined' ) - { - this.s.master = true; - this.s.dt._TableToolsInit = true; - } - - /* We can use the table node from comparisons to group controls */ - this.dom.table = this.s.dt.nTable; - - /* Clone the defaults and then the user options */ - this.s.custom = $.extend( {}, TableTools.DEFAULTS, oOpts ); - - /* Flash file location */ - this.s.swfPath = this.s.custom.sSwfPath; - if ( typeof ZeroClipboard_TableTools != 'undefined' ) - { - ZeroClipboard_TableTools.moviePath = this.s.swfPath; - } - - /* Table row selecting */ - this.s.select.type = this.s.custom.sRowSelect; - this.s.select.preRowSelect = this.s.custom.fnPreRowSelect; - this.s.select.postSelected = this.s.custom.fnRowSelected; - this.s.select.postDeselected = this.s.custom.fnRowDeselected; - - // Backwards compatibility - allow the user to specify a custom class in the initialiser - if ( this.s.custom.sSelectedClass ) - { - this.classes.select.row = this.s.custom.sSelectedClass; - } - - this.s.tags = this.s.custom.oTags; - - /* Button set */ - this.s.buttonSet = this.s.custom.aButtons; - }, - - - /** - * Take the user input arrays and expand them to be fully defined, and then add them to a given - * DOM element - * @method _fnButtonDefinations - * @param {array} buttonSet Set of user defined buttons - * @param {node} wrapper Node to add the created buttons to - * @returns void - * @private - */ - "_fnButtonDefinations": function ( buttonSet, wrapper ) - { - var buttonDef; - - for ( var i=0, iLen=buttonSet.length ; i<iLen ; i++ ) - { - if ( typeof buttonSet[i] == "string" ) - { - if ( typeof TableTools.BUTTONS[ buttonSet[i] ] == 'undefined' ) - { - alert( "TableTools: Warning - unknown button type: "+buttonSet[i] ); - continue; - } - buttonDef = $.extend( {}, TableTools.BUTTONS[ buttonSet[i] ], true ); - } - else - { - if ( typeof TableTools.BUTTONS[ buttonSet[i].sExtends ] == 'undefined' ) - { - alert( "TableTools: Warning - unknown button type: "+buttonSet[i].sExtends ); - continue; - } - var o = $.extend( {}, TableTools.BUTTONS[ buttonSet[i].sExtends ], true ); - buttonDef = $.extend( o, buttonSet[i], true ); - } - - var button = this._fnCreateButton( - buttonDef, - $(wrapper).hasClass(this.classes.collection.container) - ); - - if ( button ) { - wrapper.appendChild( button ); - } - } - }, - - - /** - * Create and configure a TableTools button - * @method _fnCreateButton - * @param {Object} oConfig Button configuration object - * @returns {Node} Button element - * @private - */ - "_fnCreateButton": function ( oConfig, bCollectionButton ) - { - var nButton = this._fnButtonBase( oConfig, bCollectionButton ); - - if ( oConfig.sAction.match(/flash/) ) - { - if ( ! this._fnHasFlash() ) { - return false; - } - - this._fnFlashConfig( nButton, oConfig ); - } - else if ( oConfig.sAction == "text" ) - { - this._fnTextConfig( nButton, oConfig ); - } - else if ( oConfig.sAction == "div" ) - { - this._fnTextConfig( nButton, oConfig ); - } - else if ( oConfig.sAction == "collection" ) - { - this._fnTextConfig( nButton, oConfig ); - this._fnCollectionConfig( nButton, oConfig ); - } - - if ( this.s.dt.iTabIndex !== -1 ) { - $(nButton) - .attr( 'tabindex', this.s.dt.iTabIndex ) - .attr( 'aria-controls', this.s.dt.sTableId ) - .on( 'keyup.DTTT', function (e) { - // Trigger the click event on return key when focused. - // Note that for Flash buttons this has no effect since we - // can't programmatically trigger the Flash export - if ( e.keyCode === 13 ) { - e.stopPropagation(); - - $(this).trigger( 'click' ); - } - } ) - .on( 'mousedown.DTTT', function (e) { - // On mousedown we want to stop the focus occurring on the - // button, focus is used only for the keyboard navigation. - // But using preventDefault for the flash buttons stops the - // flash action. However, it is not the button that gets - // focused but the flash element for flash buttons, so this - // works - if ( ! oConfig.sAction.match(/flash/) ) { - e.preventDefault(); - } - } ); - } - - return nButton; - }, - - - /** - * Create the DOM needed for the button and apply some base properties. All buttons start here - * @method _fnButtonBase - * @param {o} oConfig Button configuration object - * @returns {Node} DIV element for the button - * @private - */ - "_fnButtonBase": function ( o, bCollectionButton ) - { - var sTag, sLiner, sClass; - - if ( bCollectionButton ) - { - sTag = o.sTag && o.sTag !== "default" ? o.sTag : this.s.tags.collection.button; - sLiner = o.sLinerTag && o.sLinerTag !== "default" ? o.sLiner : this.s.tags.collection.liner; - sClass = this.classes.collection.buttons.normal; - } - else - { - sTag = o.sTag && o.sTag !== "default" ? o.sTag : this.s.tags.button; - sLiner = o.sLinerTag && o.sLinerTag !== "default" ? o.sLiner : this.s.tags.liner; - sClass = this.classes.buttons.normal; - } - - var - nButton = document.createElement( sTag ), - nSpan = document.createElement( sLiner ), - masterS = this._fnGetMasterSettings(); - - nButton.className = sClass+" "+o.sButtonClass; - nButton.setAttribute('id', "ToolTables_"+this.s.dt.sInstance+"_"+masterS.buttonCounter ); - nButton.appendChild( nSpan ); - nSpan.innerHTML = o.sButtonText; - - masterS.buttonCounter++; - - return nButton; - }, - - - /** - * Get the settings object for the master instance. When more than one TableTools instance is - * assigned to a DataTable, only one of them can be the 'master' (for the select rows). As such, - * we will typically want to interact with that master for global properties. - * @method _fnGetMasterSettings - * @returns {Object} TableTools settings object - * @private - */ - "_fnGetMasterSettings": function () - { - if ( this.s.master ) - { - return this.s; - } - else - { - /* Look for the master which has the same DT as this one */ - var instances = TableTools._aInstances; - for ( var i=0, iLen=instances.length ; i<iLen ; i++ ) - { - if ( this.dom.table == instances[i].s.dt.nTable ) - { - return instances[i].s; - } - } - } - }, - - - - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Button collection functions - */ - - /** - * Create a collection button, when activated will present a drop down list of other buttons - * @param {Node} nButton Button to use for the collection activation - * @param {Object} oConfig Button configuration object - * @returns void - * @private - */ - "_fnCollectionConfig": function ( nButton, oConfig ) - { - var nHidden = document.createElement( this.s.tags.collection.container ); - nHidden.style.display = "none"; - nHidden.className = this.classes.collection.container; - oConfig._collection = nHidden; - document.body.appendChild( nHidden ); - - this._fnButtonDefinations( oConfig.aButtons, nHidden ); - }, - - - /** - * Show a button collection - * @param {Node} nButton Button to use for the collection - * @param {Object} oConfig Button configuration object - * @returns void - * @private - */ - "_fnCollectionShow": function ( nButton, oConfig ) - { - var - that = this, - oPos = $(nButton).offset(), - nHidden = oConfig._collection, - iDivX = oPos.left, - iDivY = oPos.top + $(nButton).outerHeight(), - iWinHeight = $(window).height(), iDocHeight = $(document).height(), - iWinWidth = $(window).width(), iDocWidth = $(document).width(); - - nHidden.style.position = "absolute"; - nHidden.style.left = iDivX+"px"; - nHidden.style.top = iDivY+"px"; - nHidden.style.display = "block"; - $(nHidden).css('opacity',0); - - var nBackground = document.createElement('div'); - nBackground.style.position = "absolute"; - nBackground.style.left = "0px"; - nBackground.style.top = "0px"; - nBackground.style.height = ((iWinHeight>iDocHeight)? iWinHeight : iDocHeight) +"px"; - nBackground.style.width = ((iWinWidth>iDocWidth)? iWinWidth : iDocWidth) +"px"; - nBackground.className = this.classes.collection.background; - $(nBackground).css('opacity',0); - - document.body.appendChild( nBackground ); - document.body.appendChild( nHidden ); - - /* Visual corrections to try and keep the collection visible */ - var iDivWidth = $(nHidden).outerWidth(); - var iDivHeight = $(nHidden).outerHeight(); - - if ( iDivX + iDivWidth > iDocWidth ) - { - nHidden.style.left = (iDocWidth-iDivWidth)+"px"; - } - - if ( iDivY + iDivHeight > iDocHeight ) - { - nHidden.style.top = (iDivY-iDivHeight-$(nButton).outerHeight())+"px"; - } - - this.dom.collection.collection = nHidden; - this.dom.collection.background = nBackground; - - /* This results in a very small delay for the end user but it allows the animation to be - * much smoother. If you don't want the animation, then the setTimeout can be removed - */ - setTimeout( function () { - $(nHidden).animate({"opacity": 1}, 500); - $(nBackground).animate({"opacity": 0.25}, 500); - }, 10 ); - - /* Resize the buttons to the Flash contents fit */ - this.fnResizeButtons(); - - /* Event handler to remove the collection display */ - $(nBackground).click( function () { - that._fnCollectionHide.call( that, null, null ); - } ); - }, - - - /** - * Hide a button collection - * @param {Node} nButton Button to use for the collection - * @param {Object} oConfig Button configuration object - * @returns void - * @private - */ - "_fnCollectionHide": function ( nButton, oConfig ) - { - if ( oConfig !== null && oConfig.sExtends == 'collection' ) - { - return; - } - - if ( this.dom.collection.collection !== null ) - { - $(this.dom.collection.collection).animate({"opacity": 0}, 500, function (e) { - this.style.display = "none"; - } ); - - $(this.dom.collection.background).animate({"opacity": 0}, 500, function (e) { - this.parentNode.removeChild( this ); - } ); - - this.dom.collection.collection = null; - this.dom.collection.background = null; - } - }, - - - - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Row selection functions - */ - - /** - * Add event handlers to a table to allow for row selection - * @method _fnRowSelectConfig - * @returns void - * @private - */ - "_fnRowSelectConfig": function () - { - if ( this.s.master ) - { - var - that = this, - i, iLen, - dt = this.s.dt, - aoOpenRows = this.s.dt.aoOpenRows; - - $(dt.nTable).addClass( this.classes.select.table ); - - // When using OS style selection, we want to cancel the shift text - // selection, but only when the shift key is used (so you can - // actually still select text in the table) - if ( this.s.select.type === 'os' ) { - $(dt.nTBody).on( 'mousedown.DTTT_Select', 'tr', function(e) { - if ( e.shiftKey ) { - - $(dt.nTBody) - .css( '-moz-user-select', 'none' ) - .one('selectstart.DTTT_Select', 'tr', function () { - return false; - } ); - } - } ); - - $(dt.nTBody).on( 'mouseup.DTTT_Select', 'tr', function(e) { - $(dt.nTBody).css( '-moz-user-select', '' ); - } ); - } - - // Row selection - $(dt.nTBody).on( 'click.DTTT_Select', this.s.custom.sRowSelector, function(e) { - var row = this.nodeName.toLowerCase() === 'tr' ? - this : - $(this).parents('tr')[0]; - - var select = that.s.select; - var pos = that.s.dt.oInstance.fnGetPosition( row ); - - /* Sub-table must be ignored (odd that the selector won't do this with >) */ - if ( row.parentNode != dt.nTBody ) { - return; - } - - /* Check that we are actually working with a DataTables controlled row */ - if ( dt.oInstance.fnGetData(row) === null ) { - return; - } - - // Shift click, ctrl click and simple click handling to make - // row selection a lot like a file system in desktop OSs - if ( select.type == 'os' ) { - if ( e.ctrlKey || e.metaKey ) { - // Add or remove from the selection - if ( that.fnIsSelected( row ) ) { - that._fnRowDeselect( row, e ); - } - else { - that._fnRowSelect( row, e ); - } - } - else if ( e.shiftKey ) { - // Add a range of rows, from the last selected row to - // this one - var rowIdxs = that.s.dt.aiDisplay.slice(); // visible rows - var idx1 = $.inArray( select.lastRow, rowIdxs ); - var idx2 = $.inArray( pos, rowIdxs ); - - if ( that.fnGetSelected().length === 0 || idx1 === -1 ) { - // select from top to here - slightly odd, but both - // Windows and Mac OS do this - rowIdxs.splice( $.inArray( pos, rowIdxs )+1, rowIdxs.length ); - } - else { - // reverse so we can shift click 'up' as well as down - if ( idx1 > idx2 ) { - var tmp = idx2; - idx2 = idx1; - idx1 = tmp; - } - - rowIdxs.splice( idx2+1, rowIdxs.length ); - rowIdxs.splice( 0, idx1 ); - } - - if ( ! that.fnIsSelected( row ) ) { - // Select range - that._fnRowSelect( rowIdxs, e ); - } - else { - // Deselect range - need to keep the clicked on row selected - rowIdxs.splice( $.inArray( pos, rowIdxs ), 1 ); - that._fnRowDeselect( rowIdxs, e ); - } - } - else { - // No cmd or shift click. Deselect current if selected, - // or select this row only - if ( that.fnIsSelected( row ) && that.fnGetSelected().length === 1 ) { - that._fnRowDeselect( row, e ); - } - else { - that.fnSelectNone(); - that._fnRowSelect( row, e ); - } - } - } - else if ( that.fnIsSelected( row ) ) { - that._fnRowDeselect( row, e ); - } - else if ( select.type == "single" ) { - that.fnSelectNone(); - that._fnRowSelect( row, e ); - } - else if ( select.type == "multi" ) { - that._fnRowSelect( row, e ); - } - - select.lastRow = pos; - } );//.on('selectstart', function () { return false; } ); - - // Bind a listener to the DataTable for when new rows are created. - // This allows rows to be visually selected when they should be and - // deferred rendering is used. - dt.oApi._fnCallbackReg( dt, 'aoRowCreatedCallback', function (tr, data, index) { - if ( dt.aoData[index]._DTTT_selected ) { - $(tr).addClass( that.classes.select.row ); - } - }, 'TableTools-SelectAll' ); - } - }, - - /** - * Select rows - * @param {*} src Rows to select - see _fnSelectData for a description of valid inputs - * @private - */ - "_fnRowSelect": function ( src, e ) - { - var - that = this, - data = this._fnSelectData( src ), - firstTr = data.length===0 ? null : data[0].nTr, - anSelected = [], - i, len; - - // Get all the rows that will be selected - for ( i=0, len=data.length ; i<len ; i++ ) - { - if ( data[i].nTr ) - { - anSelected.push( data[i].nTr ); - } - } - - // User defined pre-selection function - if ( this.s.select.preRowSelect !== null && !this.s.select.preRowSelect.call(this, e, anSelected, true) ) - { - return; - } - - // Mark them as selected - for ( i=0, len=data.length ; i<len ; i++ ) - { - data[i]._DTTT_selected = true; - - if ( data[i].nTr ) - { - $(data[i].nTr).addClass( that.classes.select.row ); - } - } - - // Post-selection function - if ( this.s.select.postSelected !== null ) - { - this.s.select.postSelected.call( this, anSelected ); - } - - TableTools._fnEventDispatch( this, 'select', anSelected, true ); - }, - - /** - * Deselect rows - * @param {*} src Rows to deselect - see _fnSelectData for a description of valid inputs - * @private - */ - "_fnRowDeselect": function ( src, e ) - { - var - that = this, - data = this._fnSelectData( src ), - firstTr = data.length===0 ? null : data[0].nTr, - anDeselectedTrs = [], - i, len; - - // Get all the rows that will be deselected - for ( i=0, len=data.length ; i<len ; i++ ) - { - if ( data[i].nTr ) - { - anDeselectedTrs.push( data[i].nTr ); - } - } - - // User defined pre-selection function - if ( this.s.select.preRowSelect !== null && !this.s.select.preRowSelect.call(this, e, anDeselectedTrs, false) ) - { - return; - } - - // Mark them as deselected - for ( i=0, len=data.length ; i<len ; i++ ) - { - data[i]._DTTT_selected = false; - - if ( data[i].nTr ) - { - $(data[i].nTr).removeClass( that.classes.select.row ); - } - } - - // Post-deselection function - if ( this.s.select.postDeselected !== null ) - { - this.s.select.postDeselected.call( this, anDeselectedTrs ); - } - - TableTools._fnEventDispatch( this, 'select', anDeselectedTrs, false ); - }, - - /** - * Take a data source for row selection and convert it into aoData points for the DT - * @param {*} src Can be a single DOM TR node, an array of TR nodes (including a - * a jQuery object), a single aoData point from DataTables, an array of aoData - * points or an array of aoData indexes - * @returns {array} An array of aoData points - */ - "_fnSelectData": function ( src ) - { - var out = [], pos, i, iLen; - - if ( src.nodeName ) - { - // Single node - pos = this.s.dt.oInstance.fnGetPosition( src ); - out.push( this.s.dt.aoData[pos] ); - } - else if ( typeof src.length !== 'undefined' ) - { - // jQuery object or an array of nodes, or aoData points - for ( i=0, iLen=src.length ; i<iLen ; i++ ) - { - if ( src[i].nodeName ) - { - pos = this.s.dt.oInstance.fnGetPosition( src[i] ); - out.push( this.s.dt.aoData[pos] ); - } - else if ( typeof src[i] === 'number' ) - { - out.push( this.s.dt.aoData[ src[i] ] ); - } - else - { - out.push( src[i] ); - } - } - - return out; - } - else - { - // A single aoData point - out.push( src ); - } - - return out; - }, - - - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Text button functions - */ - - /** - * Configure a text based button for interaction events - * @method _fnTextConfig - * @param {Node} nButton Button element which is being considered - * @param {Object} oConfig Button configuration object - * @returns void - * @private - */ - "_fnTextConfig": function ( nButton, oConfig ) - { - var that = this; - - if ( oConfig.fnInit !== null ) - { - oConfig.fnInit.call( this, nButton, oConfig ); - } - - if ( oConfig.sToolTip !== "" ) - { - nButton.title = oConfig.sToolTip; - } - - $(nButton).hover( function () { - if ( oConfig.fnMouseover !== null ) - { - oConfig.fnMouseover.call( this, nButton, oConfig, null ); - } - }, function () { - if ( oConfig.fnMouseout !== null ) - { - oConfig.fnMouseout.call( this, nButton, oConfig, null ); - } - } ); - - if ( oConfig.fnSelect !== null ) - { - TableTools._fnEventListen( this, 'select', function (n) { - oConfig.fnSelect.call( that, nButton, oConfig, n ); - } ); - } - - $(nButton).click( function (e) { - //e.preventDefault(); - - if ( oConfig.fnClick !== null ) - { - oConfig.fnClick.call( that, nButton, oConfig, null, e ); - } - - /* Provide a complete function to match the behaviour of the flash elements */ - if ( oConfig.fnComplete !== null ) - { - oConfig.fnComplete.call( that, nButton, oConfig, null, null ); - } - - that._fnCollectionHide( nButton, oConfig ); - } ); - }, - - - - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Flash button functions - */ - - /** - * Check if the Flash plug-in is available - * @method _fnHasFlash - * @returns {boolean} `true` if Flash available, `false` otherwise - * @private - */ - "_fnHasFlash": function () - { - try { - var fo = new ActiveXObject('ShockwaveFlash.ShockwaveFlash'); - if (fo) { - return true; - } - } - catch (e) { - if ( - navigator.mimeTypes && - navigator.mimeTypes['application/x-shockwave-flash'] !== undefined && - navigator.mimeTypes['application/x-shockwave-flash'].enabledPlugin - ) { - return true; - } - } - - return false; - }, - - - /** - * Configure a flash based button for interaction events - * @method _fnFlashConfig - * @param {Node} nButton Button element which is being considered - * @param {o} oConfig Button configuration object - * @returns void - * @private - */ - "_fnFlashConfig": function ( nButton, oConfig ) - { - var that = this; - var flash = new ZeroClipboard_TableTools.Client(); - - if ( oConfig.fnInit !== null ) - { - oConfig.fnInit.call( this, nButton, oConfig ); - } - - flash.setHandCursor( true ); - - if ( oConfig.sAction == "flash_save" ) - { - flash.setAction( 'save' ); - flash.setCharSet( (oConfig.sCharSet=="utf16le") ? 'UTF16LE' : 'UTF8' ); - flash.setBomInc( oConfig.bBomInc ); - flash.setFileName( oConfig.sFileName.replace('*', this.fnGetTitle(oConfig)) ); - } - else if ( oConfig.sAction == "flash_pdf" ) - { - flash.setAction( 'pdf' ); - flash.setFileName( oConfig.sFileName.replace('*', this.fnGetTitle(oConfig)) ); - } - else - { - flash.setAction( 'copy' ); - } - - flash.addEventListener('mouseOver', function(client) { - if ( oConfig.fnMouseover !== null ) - { - oConfig.fnMouseover.call( that, nButton, oConfig, flash ); - } - } ); - - flash.addEventListener('mouseOut', function(client) { - if ( oConfig.fnMouseout !== null ) - { - oConfig.fnMouseout.call( that, nButton, oConfig, flash ); - } - } ); - - flash.addEventListener('mouseDown', function(client) { - if ( oConfig.fnClick !== null ) - { - oConfig.fnClick.call( that, nButton, oConfig, flash ); - } - } ); - - flash.addEventListener('complete', function (client, text) { - if ( oConfig.fnComplete !== null ) - { - oConfig.fnComplete.call( that, nButton, oConfig, flash, text ); - } - that._fnCollectionHide( nButton, oConfig ); - } ); - - this._fnFlashGlue( flash, nButton, oConfig.sToolTip ); - }, - - - /** - * Wait until the id is in the DOM before we "glue" the swf. Note that this function will call - * itself (using setTimeout) until it completes successfully - * @method _fnFlashGlue - * @param {Object} clip Zero clipboard object - * @param {Node} node node to glue swf to - * @param {String} text title of the flash movie - * @returns void - * @private - */ - "_fnFlashGlue": function ( flash, node, text ) - { - var that = this; - var id = node.getAttribute('id'); - - if ( document.getElementById(id) ) - { - flash.glue( node, text ); - } - else - { - setTimeout( function () { - that._fnFlashGlue( flash, node, text ); - }, 100 ); - } - }, - - - /** - * Set the text for the flash clip to deal with - * - * This function is required for large information sets. There is a limit on the - * amount of data that can be transferred between Javascript and Flash in a single call, so - * we use this method to build up the text in Flash by sending over chunks. It is estimated - * that the data limit is around 64k, although it is undocumented, and appears to be different - * between different flash versions. We chunk at 8KiB. - * @method _fnFlashSetText - * @param {Object} clip the ZeroClipboard object - * @param {String} sData the data to be set - * @returns void - * @private - */ - "_fnFlashSetText": function ( clip, sData ) - { - var asData = this._fnChunkData( sData, 8192 ); - - clip.clearText(); - for ( var i=0, iLen=asData.length ; i<iLen ; i++ ) - { - clip.appendText( asData[i] ); - } - }, - - - - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Data retrieval functions - */ - - /** - * Convert the mixed columns variable into a boolean array the same size as the columns, which - * indicates which columns we want to include - * @method _fnColumnTargets - * @param {String|Array} mColumns The columns to be included in data retrieval. If a string - * then it can take the value of "visible" or "hidden" (to include all visible or - * hidden columns respectively). Or an array of column indexes - * @returns {Array} A boolean array the length of the columns of the table, which each value - * indicating if the column is to be included or not - * @private - */ - "_fnColumnTargets": function ( mColumns ) - { - var aColumns = []; - var dt = this.s.dt; - var i, iLen; - var columns = dt.aoColumns; - var columnCount = columns.length; - - if ( typeof mColumns == "function" ) - { - var a = mColumns.call( this, dt ); - - for ( i=0, iLen=columnCount ; i<iLen ; i++ ) - { - aColumns.push( $.inArray( i, a ) !== -1 ? true : false ); - } - } - else if ( typeof mColumns == "object" ) - { - for ( i=0, iLen=columnCount ; i<iLen ; i++ ) - { - aColumns.push( false ); - } - - for ( i=0, iLen=mColumns.length ; i<iLen ; i++ ) - { - aColumns[ mColumns[i] ] = true; - } - } - else if ( mColumns == "visible" ) - { - for ( i=0, iLen=columnCount ; i<iLen ; i++ ) - { - aColumns.push( columns[i].bVisible ? true : false ); - } - } - else if ( mColumns == "hidden" ) - { - for ( i=0, iLen=columnCount ; i<iLen ; i++ ) - { - aColumns.push( columns[i].bVisible ? false : true ); - } - } - else if ( mColumns == "sortable" ) - { - for ( i=0, iLen=columnCount ; i<iLen ; i++ ) - { - aColumns.push( columns[i].bSortable ? true : false ); - } - } - else /* all */ - { - for ( i=0, iLen=columnCount ; i<iLen ; i++ ) - { - aColumns.push( true ); - } - } - - return aColumns; - }, - - - /** - * New line character(s) depend on the platforms - * @method method - * @param {Object} oConfig Button configuration object - only interested in oConfig.sNewLine - * @returns {String} Newline character - */ - "_fnNewline": function ( oConfig ) - { - if ( oConfig.sNewLine == "auto" ) - { - return navigator.userAgent.match(/Windows/) ? "\r\n" : "\n"; - } - else - { - return oConfig.sNewLine; - } - }, - - - /** - * Get data from DataTables' internals and format it for output - * @method _fnGetDataTablesData - * @param {Object} oConfig Button configuration object - * @param {String} oConfig.sFieldBoundary Field boundary for the data cells in the string - * @param {String} oConfig.sFieldSeperator Field separator for the data cells - * @param {String} oConfig.sNewline New line options - * @param {Mixed} oConfig.mColumns Which columns should be included in the output - * @param {Boolean} oConfig.bHeader Include the header - * @param {Boolean} oConfig.bFooter Include the footer - * @param {Boolean} oConfig.bSelectedOnly Include only the selected rows in the output - * @returns {String} Concatenated string of data - * @private - */ - "_fnGetDataTablesData": function ( oConfig ) - { - var i, iLen, j, jLen; - var aRow, aData=[], sLoopData='', arr; - var dt = this.s.dt, tr, child; - var regex = new RegExp(oConfig.sFieldBoundary, "g"); /* Do it here for speed */ - var aColumnsInc = this._fnColumnTargets( oConfig.mColumns ); - var bSelectedOnly = (typeof oConfig.bSelectedOnly != 'undefined') ? oConfig.bSelectedOnly : false; - - /* - * Header - */ - if ( oConfig.bHeader ) - { - aRow = []; - - for ( i=0, iLen=dt.aoColumns.length ; i<iLen ; i++ ) - { - if ( aColumnsInc[i] ) - { - sLoopData = dt.aoColumns[i].sTitle.replace(/\n/g," ").replace( /<.*?>/g, "" ).replace(/^\s+|\s+$/g,""); - sLoopData = this._fnHtmlDecode( sLoopData ); - - aRow.push( this._fnBoundData( sLoopData, oConfig.sFieldBoundary, regex ) ); - } - } - - aData.push( aRow.join(oConfig.sFieldSeperator) ); - } - - bSelectedOnly = true; - - /* - * Body - */ - var aDataIndex; - var aSelected = this.fnGetSelectedIndexes(); - bSelectedOnly = this.s.select.type !== "none" && bSelectedOnly && aSelected.length !== 0; - - if ( bSelectedOnly ) { - // Use the selected indexes - aDataIndex = aSelected; - } - else if ( DataTable.Api ) { - // 1.10+ style - aDataIndex = new DataTable.Api( dt ) - .rows( oConfig.oSelectorOpts ) - .indexes() - .flatten() - .toArray(); - } - else { - // 1.9- style - aDataIndex = dt.oInstance - .$('tr', oConfig.oSelectorOpts) - .map( function (id, row) { - return dt.oInstance.fnGetPosition( row ); - } ) - .get(); - } - - for ( j=0, jLen=aDataIndex.length ; j<jLen ; j++ ) - { - tr = dt.aoData[ aDataIndex[j] ].nTr; - aRow = []; - - /* Columns */ - for ( i=0, iLen=dt.aoColumns.length ; i<iLen ; i++ ) - { - if ( aColumnsInc[i] ) - { - /* Convert to strings (with small optimisation) */ - var mTypeData = dt.oApi._fnGetCellData( dt, aDataIndex[j], i, 'display' ); - if ( oConfig.fnCellRender ) - { - sLoopData = oConfig.fnCellRender( mTypeData, i, tr, aDataIndex[j] )+""; - } - else if ( typeof mTypeData == "string" ) - { - /* Strip newlines, replace img tags with alt attr. and finally strip html... */ - sLoopData = mTypeData.replace(/\n/g," "); - sLoopData = - sLoopData.replace(/<img.*?\s+alt\s*=\s*(?:"([^"]+)"|'([^']+)'|([^\s>]+)).*?>/gi, - '$1$2$3'); - sLoopData = sLoopData.replace( /<.*?>/g, "" ); - } - else - { - sLoopData = mTypeData+""; - } - - /* Trim and clean the data */ - sLoopData = sLoopData.replace(/^\s+/, '').replace(/\s+$/, ''); - sLoopData = this._fnHtmlDecode( sLoopData ); - - /* Bound it and add it to the total data */ - aRow.push( this._fnBoundData( sLoopData, oConfig.sFieldBoundary, regex ) ); - } - } - - aData.push( aRow.join(oConfig.sFieldSeperator) ); - - /* Details rows from fnOpen */ - if ( oConfig.bOpenRows ) - { - arr = $.grep(dt.aoOpenRows, function(o) { return o.nParent === tr; }); - - if ( arr.length === 1 ) - { - sLoopData = this._fnBoundData( $('td', arr[0].nTr).html(), oConfig.sFieldBoundary, regex ); - aData.push( sLoopData ); - } - } - } - - /* - * Footer - */ - if ( oConfig.bFooter && dt.nTFoot !== null ) - { - aRow = []; - - for ( i=0, iLen=dt.aoColumns.length ; i<iLen ; i++ ) - { - if ( aColumnsInc[i] && dt.aoColumns[i].nTf !== null ) - { - sLoopData = dt.aoColumns[i].nTf.innerHTML.replace(/\n/g," ").replace( /<.*?>/g, "" ); - sLoopData = this._fnHtmlDecode( sLoopData ); - - aRow.push( this._fnBoundData( sLoopData, oConfig.sFieldBoundary, regex ) ); - } - } - - aData.push( aRow.join(oConfig.sFieldSeperator) ); - } - - var _sLastData = aData.join( this._fnNewline(oConfig) ); - return _sLastData; - }, - - - /** - * Wrap data up with a boundary string - * @method _fnBoundData - * @param {String} sData data to bound - * @param {String} sBoundary bounding char(s) - * @param {RegExp} regex search for the bounding chars - constructed outside for efficiency - * in the loop - * @returns {String} bound data - * @private - */ - "_fnBoundData": function ( sData, sBoundary, regex ) - { - if ( sBoundary === "" ) - { - return sData; - } - else - { - return sBoundary + sData.replace(regex, sBoundary+sBoundary) + sBoundary; - } - }, - - - /** - * Break a string up into an array of smaller strings - * @method _fnChunkData - * @param {String} sData data to be broken up - * @param {Int} iSize chunk size - * @returns {Array} String array of broken up text - * @private - */ - "_fnChunkData": function ( sData, iSize ) - { - var asReturn = []; - var iStrlen = sData.length; - - for ( var i=0 ; i<iStrlen ; i+=iSize ) - { - if ( i+iSize < iStrlen ) - { - asReturn.push( sData.substring( i, i+iSize ) ); - } - else - { - asReturn.push( sData.substring( i, iStrlen ) ); - } - } - - return asReturn; - }, - - - /** - * Decode HTML entities - * @method _fnHtmlDecode - * @param {String} sData encoded string - * @returns {String} decoded string - * @private - */ - "_fnHtmlDecode": function ( sData ) - { - if ( sData.indexOf('&') === -1 ) - { - return sData; - } - - var n = document.createElement('div'); - - return sData.replace( /&([^\s]*?);/g, function( match, match2 ) { - if ( match.substr(1, 1) === '#' ) - { - return String.fromCharCode( Number(match2.substr(1)) ); - } - else - { - n.innerHTML = match; - return n.childNodes[0].nodeValue; - } - } ); - }, - - - - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Printing functions - */ - - /** - * Show print display - * @method _fnPrintStart - * @param {Event} e Event object - * @param {Object} oConfig Button configuration object - * @returns void - * @private - */ - "_fnPrintStart": function ( oConfig ) - { - var that = this; - var oSetDT = this.s.dt; - - /* Parse through the DOM hiding everything that isn't needed for the table */ - this._fnPrintHideNodes( oSetDT.nTable ); - - /* Show the whole table */ - this.s.print.saveStart = oSetDT._iDisplayStart; - this.s.print.saveLength = oSetDT._iDisplayLength; - - if ( oConfig.bShowAll ) - { - oSetDT._iDisplayStart = 0; - oSetDT._iDisplayLength = -1; - if ( oSetDT.oApi._fnCalculateEnd ) { - oSetDT.oApi._fnCalculateEnd( oSetDT ); - } - oSetDT.oApi._fnDraw( oSetDT ); - } - - /* Adjust the display for scrolling which might be done by DataTables */ - if ( oSetDT.oScroll.sX !== "" || oSetDT.oScroll.sY !== "" ) - { - this._fnPrintScrollStart( oSetDT ); - - // If the table redraws while in print view, the DataTables scrolling - // setup would hide the header, so we need to readd it on draw - $(this.s.dt.nTable).bind('draw.DTTT_Print', function () { - that._fnPrintScrollStart( oSetDT ); - } ); - } - - /* Remove the other DataTables feature nodes - but leave the table! and info div */ - var anFeature = oSetDT.aanFeatures; - for ( var cFeature in anFeature ) - { - if ( cFeature != 'i' && cFeature != 't' && cFeature.length == 1 ) - { - for ( var i=0, iLen=anFeature[cFeature].length ; i<iLen ; i++ ) - { - this.dom.print.hidden.push( { - "node": anFeature[cFeature][i], - "display": "block" - } ); - anFeature[cFeature][i].style.display = "none"; - } - } - } - - /* Print class can be used for styling */ - $(document.body).addClass( this.classes.print.body ); - - /* Show information message to let the user know what is happening */ - if ( oConfig.sInfo !== "" ) - { - this.fnInfo( oConfig.sInfo, 3000 ); - } - - /* Add a message at the top of the page */ - if ( oConfig.sMessage ) - { - $('<div/>') - .addClass( this.classes.print.message ) - .html( oConfig.sMessage ) - .prependTo( 'body' ); - } - - /* Cache the scrolling and the jump to the top of the page */ - this.s.print.saveScroll = $(window).scrollTop(); - window.scrollTo( 0, 0 ); - - /* Bind a key event listener to the document for the escape key - - * it is removed in the callback - */ - $(document).bind( "keydown.DTTT", function(e) { - /* Only interested in the escape key */ - if ( e.keyCode == 27 ) - { - e.preventDefault(); - that._fnPrintEnd.call( that, e ); - } - } ); - }, - - - /** - * Printing is finished, resume normal display - * @method _fnPrintEnd - * @param {Event} e Event object - * @returns void - * @private - */ - "_fnPrintEnd": function ( e ) - { - var that = this; - var oSetDT = this.s.dt; - var oSetPrint = this.s.print; - var oDomPrint = this.dom.print; - - /* Show all hidden nodes */ - this._fnPrintShowNodes(); - - /* Restore DataTables' scrolling */ - if ( oSetDT.oScroll.sX !== "" || oSetDT.oScroll.sY !== "" ) - { - $(this.s.dt.nTable).unbind('draw.DTTT_Print'); - - this._fnPrintScrollEnd(); - } - - /* Restore the scroll */ - window.scrollTo( 0, oSetPrint.saveScroll ); - - /* Drop the print message */ - $('div.'+this.classes.print.message).remove(); - - /* Styling class */ - $(document.body).removeClass( 'DTTT_Print' ); - - /* Restore the table length */ - oSetDT._iDisplayStart = oSetPrint.saveStart; - oSetDT._iDisplayLength = oSetPrint.saveLength; - if ( oSetDT.oApi._fnCalculateEnd ) { - oSetDT.oApi._fnCalculateEnd( oSetDT ); - } - oSetDT.oApi._fnDraw( oSetDT ); - - $(document).unbind( "keydown.DTTT" ); - }, - - - /** - * Take account of scrolling in DataTables by showing the full table - * @returns void - * @private - */ - "_fnPrintScrollStart": function () - { - var - oSetDT = this.s.dt, - nScrollHeadInner = oSetDT.nScrollHead.getElementsByTagName('div')[0], - nScrollHeadTable = nScrollHeadInner.getElementsByTagName('table')[0], - nScrollBody = oSetDT.nTable.parentNode, - nTheadSize, nTfootSize; - - /* Copy the header in the thead in the body table, this way we show one single table when - * in print view. Note that this section of code is more or less verbatim from DT 1.7.0 - */ - nTheadSize = oSetDT.nTable.getElementsByTagName('thead'); - if ( nTheadSize.length > 0 ) - { - oSetDT.nTable.removeChild( nTheadSize[0] ); - } - - if ( oSetDT.nTFoot !== null ) - { - nTfootSize = oSetDT.nTable.getElementsByTagName('tfoot'); - if ( nTfootSize.length > 0 ) - { - oSetDT.nTable.removeChild( nTfootSize[0] ); - } - } - - nTheadSize = oSetDT.nTHead.cloneNode(true); - oSetDT.nTable.insertBefore( nTheadSize, oSetDT.nTable.childNodes[0] ); - - if ( oSetDT.nTFoot !== null ) - { - nTfootSize = oSetDT.nTFoot.cloneNode(true); - oSetDT.nTable.insertBefore( nTfootSize, oSetDT.nTable.childNodes[1] ); - } - - /* Now adjust the table's viewport so we can actually see it */ - if ( oSetDT.oScroll.sX !== "" ) - { - oSetDT.nTable.style.width = $(oSetDT.nTable).outerWidth()+"px"; - nScrollBody.style.width = $(oSetDT.nTable).outerWidth()+"px"; - nScrollBody.style.overflow = "visible"; - } - - if ( oSetDT.oScroll.sY !== "" ) - { - nScrollBody.style.height = $(oSetDT.nTable).outerHeight()+"px"; - nScrollBody.style.overflow = "visible"; - } - }, - - - /** - * Take account of scrolling in DataTables by showing the full table. Note that the redraw of - * the DataTable that we do will actually deal with the majority of the hard work here - * @returns void - * @private - */ - "_fnPrintScrollEnd": function () - { - var - oSetDT = this.s.dt, - nScrollBody = oSetDT.nTable.parentNode; - - if ( oSetDT.oScroll.sX !== "" ) - { - nScrollBody.style.width = oSetDT.oApi._fnStringToCss( oSetDT.oScroll.sX ); - nScrollBody.style.overflow = "auto"; - } - - if ( oSetDT.oScroll.sY !== "" ) - { - nScrollBody.style.height = oSetDT.oApi._fnStringToCss( oSetDT.oScroll.sY ); - nScrollBody.style.overflow = "auto"; - } - }, - - - /** - * Resume the display of all TableTools hidden nodes - * @method _fnPrintShowNodes - * @returns void - * @private - */ - "_fnPrintShowNodes": function ( ) - { - var anHidden = this.dom.print.hidden; - - for ( var i=0, iLen=anHidden.length ; i<iLen ; i++ ) - { - anHidden[i].node.style.display = anHidden[i].display; - } - anHidden.splice( 0, anHidden.length ); - }, - - - /** - * Hide nodes which are not needed in order to display the table. Note that this function is - * recursive - * @method _fnPrintHideNodes - * @param {Node} nNode Element which should be showing in a 'print' display - * @returns void - * @private - */ - "_fnPrintHideNodes": function ( nNode ) - { - var anHidden = this.dom.print.hidden; - - var nParent = nNode.parentNode; - var nChildren = nParent.childNodes; - for ( var i=0, iLen=nChildren.length ; i<iLen ; i++ ) - { - if ( nChildren[i] != nNode && nChildren[i].nodeType == 1 ) - { - /* If our node is shown (don't want to show nodes which were previously hidden) */ - var sDisplay = $(nChildren[i]).css("display"); - if ( sDisplay != "none" ) - { - /* Cache the node and it's previous state so we can restore it */ - anHidden.push( { - "node": nChildren[i], - "display": sDisplay - } ); - nChildren[i].style.display = "none"; - } - } - } - - if ( nParent.nodeName.toUpperCase() != "BODY" ) - { - this._fnPrintHideNodes( nParent ); - } - } -}; - - - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Static variables - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/** - * Store of all instances that have been created of TableTools, so one can look up other (when - * there is need of a master) - * @property _aInstances - * @type Array - * @default [] - * @private - */ -TableTools._aInstances = []; - - -/** - * Store of all listeners and their callback functions - * @property _aListeners - * @type Array - * @default [] - */ -TableTools._aListeners = []; - - - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Static methods - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/** - * Get an array of all the master instances - * @method fnGetMasters - * @returns {Array} List of master TableTools instances - * @static - */ -TableTools.fnGetMasters = function () -{ - var a = []; - for ( var i=0, iLen=TableTools._aInstances.length ; i<iLen ; i++ ) - { - if ( TableTools._aInstances[i].s.master ) - { - a.push( TableTools._aInstances[i] ); - } - } - return a; -}; - -/** - * Get the master instance for a table node (or id if a string is given) - * @method fnGetInstance - * @returns {Object} ID of table OR table node, for which we want the TableTools instance - * @static - */ -TableTools.fnGetInstance = function ( node ) -{ - if ( typeof node != 'object' ) - { - node = document.getElementById(node); - } - - for ( var i=0, iLen=TableTools._aInstances.length ; i<iLen ; i++ ) - { - if ( TableTools._aInstances[i].s.master && TableTools._aInstances[i].dom.table == node ) - { - return TableTools._aInstances[i]; - } - } - return null; -}; - - -/** - * Add a listener for a specific event - * @method _fnEventListen - * @param {Object} that Scope of the listening function (i.e. 'this' in the caller) - * @param {String} type Event type - * @param {Function} fn Function - * @returns void - * @private - * @static - */ -TableTools._fnEventListen = function ( that, type, fn ) -{ - TableTools._aListeners.push( { - "that": that, - "type": type, - "fn": fn - } ); -}; - - -/** - * An event has occurred - look up every listener and fire it off. We check that the event we are - * going to fire is attached to the same table (using the table node as reference) before firing - * @method _fnEventDispatch - * @param {Object} that Scope of the listening function (i.e. 'this' in the caller) - * @param {String} type Event type - * @param {Node} node Element that the event occurred on (may be null) - * @param {boolean} [selected] Indicate if the node was selected (true) or deselected (false) - * @returns void - * @private - * @static - */ -TableTools._fnEventDispatch = function ( that, type, node, selected ) -{ - var listeners = TableTools._aListeners; - for ( var i=0, iLen=listeners.length ; i<iLen ; i++ ) - { - if ( that.dom.table == listeners[i].that.dom.table && listeners[i].type == type ) - { - listeners[i].fn( node, selected ); - } - } -}; - - - - - - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Constants - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - - - -TableTools.buttonBase = { - // Button base - "sAction": "text", - "sTag": "default", - "sLinerTag": "default", - "sButtonClass": "DTTT_button_text", - "sButtonText": "Button text", - "sTitle": "", - "sToolTip": "", - - // Common button specific options - "sCharSet": "utf8", - "bBomInc": false, - "sFileName": "*.csv", - "sFieldBoundary": "", - "sFieldSeperator": "\t", - "sNewLine": "auto", - "mColumns": "all", /* "all", "visible", "hidden" or array of column integers */ - "bHeader": true, - "bFooter": true, - "bOpenRows": false, - "bSelectedOnly": false, - "oSelectorOpts": undefined, // See http://datatables.net/docs/DataTables/1.9.4/#$ for full options - - // Callbacks - "fnMouseover": null, - "fnMouseout": null, - "fnClick": null, - "fnSelect": null, - "fnComplete": null, - "fnInit": null, - "fnCellRender": null -}; - - -/** - * @namespace Default button configurations - */ -TableTools.BUTTONS = { - "csv": $.extend( {}, TableTools.buttonBase, { - "sAction": "flash_save", - "sButtonClass": "DTTT_button_csv", - "sButtonText": "CSV", - "sFieldBoundary": '"', - "sFieldSeperator": ",", - "fnClick": function( nButton, oConfig, flash ) { - this.fnSetText( flash, this.fnGetTableData(oConfig) ); - } - } ), - - "xls": $.extend( {}, TableTools.buttonBase, { - "sAction": "flash_save", - "sCharSet": "utf16le", - "bBomInc": true, - "sButtonClass": "DTTT_button_xls", - "sButtonText": "Excel", - "fnClick": function( nButton, oConfig, flash ) { - this.fnSetText( flash, this.fnGetTableData(oConfig) ); - } - } ), - - "copy": $.extend( {}, TableTools.buttonBase, { - "sAction": "flash_copy", - "sButtonClass": "DTTT_button_copy", - "sButtonText": "Copy", - "fnClick": function( nButton, oConfig, flash ) { - this.fnSetText( flash, this.fnGetTableData(oConfig) ); - }, - "fnComplete": function(nButton, oConfig, flash, text) { - var lines = text.split('\n').length; - if (oConfig.bHeader) lines--; - if (this.s.dt.nTFoot !== null && oConfig.bFooter) lines--; - var plural = (lines==1) ? "" : "s"; - this.fnInfo( '<h6>Table copied</h6>'+ - '<p>Copied '+lines+' row'+plural+' to the clipboard.</p>', - 1500 - ); - } - } ), - - "pdf": $.extend( {}, TableTools.buttonBase, { - "sAction": "flash_pdf", - "sNewLine": "\n", - "sFileName": "*.pdf", - "sButtonClass": "DTTT_button_pdf", - "sButtonText": "PDF", - "sPdfOrientation": "portrait", - "sPdfSize": "A4", - "sPdfMessage": "", - "fnClick": function( nButton, oConfig, flash ) { - this.fnSetText( flash, - "title:"+ this.fnGetTitle(oConfig) +"\n"+ - "message:"+ oConfig.sPdfMessage +"\n"+ - "colWidth:"+ this.fnCalcColRatios(oConfig) +"\n"+ - "orientation:"+ oConfig.sPdfOrientation +"\n"+ - "size:"+ oConfig.sPdfSize +"\n"+ - "--/TableToolsOpts--\n" + - this.fnGetTableData(oConfig) - ); - } - } ), - - "print": $.extend( {}, TableTools.buttonBase, { - "sInfo": "<h6>Print view</h6><p>Please use your browser's print function to "+ - "print this table. Press escape when finished.</p>", - "sMessage": null, - "bShowAll": true, - "sToolTip": "View print view", - "sButtonClass": "DTTT_button_print", - "sButtonText": "Print", - "fnClick": function ( nButton, oConfig ) { - this.fnPrint( true, oConfig ); - } - } ), - - "text": $.extend( {}, TableTools.buttonBase ), - - "select": $.extend( {}, TableTools.buttonBase, { - "sButtonText": "Select button", - "fnSelect": function( nButton, oConfig ) { - if ( this.fnGetSelected().length !== 0 ) { - $(nButton).removeClass( this.classes.buttons.disabled ); - } else { - $(nButton).addClass( this.classes.buttons.disabled ); - } - }, - "fnInit": function( nButton, oConfig ) { - $(nButton).addClass( this.classes.buttons.disabled ); - } - } ), - - "select_single": $.extend( {}, TableTools.buttonBase, { - "sButtonText": "Select button", - "fnSelect": function( nButton, oConfig ) { - var iSelected = this.fnGetSelected().length; - if ( iSelected == 1 ) { - $(nButton).removeClass( this.classes.buttons.disabled ); - } else { - $(nButton).addClass( this.classes.buttons.disabled ); - } - }, - "fnInit": function( nButton, oConfig ) { - $(nButton).addClass( this.classes.buttons.disabled ); - } - } ), - - "select_all": $.extend( {}, TableTools.buttonBase, { - "sButtonText": "Select all", - "fnClick": function( nButton, oConfig ) { - this.fnSelectAll(); - }, - "fnSelect": function( nButton, oConfig ) { - if ( this.fnGetSelected().length == this.s.dt.fnRecordsDisplay() ) { - $(nButton).addClass( this.classes.buttons.disabled ); - } else { - $(nButton).removeClass( this.classes.buttons.disabled ); - } - } - } ), - - "select_none": $.extend( {}, TableTools.buttonBase, { - "sButtonText": "Deselect all", - "fnClick": function( nButton, oConfig ) { - this.fnSelectNone(); - }, - "fnSelect": function( nButton, oConfig ) { - if ( this.fnGetSelected().length !== 0 ) { - $(nButton).removeClass( this.classes.buttons.disabled ); - } else { - $(nButton).addClass( this.classes.buttons.disabled ); - } - }, - "fnInit": function( nButton, oConfig ) { - $(nButton).addClass( this.classes.buttons.disabled ); - } - } ), - - "ajax": $.extend( {}, TableTools.buttonBase, { - "sAjaxUrl": "/xhr.php", - "sButtonText": "Ajax button", - "fnClick": function( nButton, oConfig ) { - var sData = this.fnGetTableData(oConfig); - $.ajax( { - "url": oConfig.sAjaxUrl, - "data": [ - { "name": "tableData", "value": sData } - ], - "success": oConfig.fnAjaxComplete, - "dataType": "json", - "type": "POST", - "cache": false, - "error": function () { - alert( "Error detected when sending table data to server" ); - } - } ); - }, - "fnAjaxComplete": function( json ) { - alert( 'Ajax complete' ); - } - } ), - - "div": $.extend( {}, TableTools.buttonBase, { - "sAction": "div", - "sTag": "div", - "sButtonClass": "DTTT_nonbutton", - "sButtonText": "Text button" - } ), - - "collection": $.extend( {}, TableTools.buttonBase, { - "sAction": "collection", - "sButtonClass": "DTTT_button_collection", - "sButtonText": "Collection", - "fnClick": function( nButton, oConfig ) { - this._fnCollectionShow(nButton, oConfig); - } - } ) -}; -/* - * on* callback parameters: - * 1. node - button element - * 2. object - configuration object for this button - * 3. object - ZeroClipboard reference (flash button only) - * 4. string - Returned string from Flash (flash button only - and only on 'complete') - */ - -// Alias to match the other plug-ins styling -TableTools.buttons = TableTools.BUTTONS; - - -/** - * @namespace Classes used by TableTools - allows the styles to be override easily. - * Note that when TableTools initialises it will take a copy of the classes object - * and will use its internal copy for the remainder of its run time. - */ -TableTools.classes = { - "container": "DTTT_container", - "buttons": { - "normal": "DTTT_button", - "disabled": "DTTT_disabled" - }, - "collection": { - "container": "DTTT_collection", - "background": "DTTT_collection_background", - "buttons": { - "normal": "DTTT_button", - "disabled": "DTTT_disabled" - } - }, - "select": { - "table": "DTTT_selectable", - "row": "DTTT_selected selected" - }, - "print": { - "body": "DTTT_Print", - "info": "DTTT_print_info", - "message": "DTTT_PrintMessage" - } -}; - - -/** - * @namespace ThemeRoller classes - built in for compatibility with DataTables' - * bJQueryUI option. - */ -TableTools.classes_themeroller = { - "container": "DTTT_container ui-buttonset ui-buttonset-multi", - "buttons": { - "normal": "DTTT_button ui-button ui-state-default" - }, - "collection": { - "container": "DTTT_collection ui-buttonset ui-buttonset-multi" - } -}; - - -/** - * @namespace TableTools default settings for initialisation - */ -TableTools.DEFAULTS = { - "sSwfPath": "../swf/copy_csv_xls_pdf.swf", - "sRowSelect": "none", - "sRowSelector": "tr", - "sSelectedClass": null, - "fnPreRowSelect": null, - "fnRowSelected": null, - "fnRowDeselected": null, - "aButtons": [ "copy", "csv", "xls", "pdf", "print" ], - "oTags": { - "container": "div", - "button": "a", // We really want to use buttons here, but Firefox and IE ignore the - // click on the Flash element in the button (but not mouse[in|out]). - "liner": "span", - "collection": { - "container": "div", - "button": "a", - "liner": "span" - } - } -}; - -// Alias to match the other plug-ins -TableTools.defaults = TableTools.DEFAULTS; - - -/** - * Name of this class - * @constant CLASS - * @type String - * @default TableTools - */ -TableTools.prototype.CLASS = "TableTools"; - - -/** - * TableTools version - * @constant VERSION - * @type String - * @default See code - */ -TableTools.version = "2.2.3"; - - - -// DataTables 1.10 API -// -// This will be extended in a big way in in TableTools 3 to provide API methods -// such as rows().select() and rows.selected() etc, but for the moment the -// tabletools() method simply returns the instance. - -if ( $.fn.dataTable.Api ) { - $.fn.dataTable.Api.register( 'tabletools()', function () { - var tt = null; - - if ( this.context.length > 0 ) { - tt = TableTools.fnGetInstance( this.context[0].nTable ); - } - - return tt; - } ); -} - - - - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Initialisation - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* - * Register a new feature with DataTables - */ -if ( typeof $.fn.dataTable == "function" && - typeof $.fn.dataTableExt.fnVersionCheck == "function" && - $.fn.dataTableExt.fnVersionCheck('1.9.0') ) -{ - $.fn.dataTableExt.aoFeatures.push( { - "fnInit": function( oDTSettings ) { - var init = oDTSettings.oInit; - var opts = init ? - init.tableTools || init.oTableTools || {} : - {}; - - return new TableTools( oDTSettings.oInstance, opts ).dom.container; - }, - "cFeature": "T", - "sFeature": "TableTools" - } ); -} -else -{ - alert( "Warning: TableTools requires DataTables 1.9.0 or newer - www.datatables.net/download"); -} - -$.fn.DataTable.TableTools = TableTools; - -})(jQuery, window, document); - -/* - * Register a new feature with DataTables - */ -if ( typeof $.fn.dataTable == "function" && - typeof $.fn.dataTableExt.fnVersionCheck == "function" && - $.fn.dataTableExt.fnVersionCheck('1.9.0') ) -{ - $.fn.dataTableExt.aoFeatures.push( { - "fnInit": function( oDTSettings ) { - var oOpts = typeof oDTSettings.oInit.oTableTools != 'undefined' ? - oDTSettings.oInit.oTableTools : {}; - - var oTT = new TableTools( oDTSettings.oInstance, oOpts ); - TableTools._aInstances.push( oTT ); - - return oTT.dom.container; - }, - "cFeature": "T", - "sFeature": "TableTools" - } ); -} -else -{ - alert( "Warning: TableTools 2 requires DataTables 1.9.0 or newer - www.datatables.net/download"); -} - - -$.fn.dataTable.TableTools = TableTools; -$.fn.DataTable.TableTools = TableTools; - - -return TableTools; -}; // /factory - - -// Define as an AMD module if possible -if ( typeof define === 'function' && define.amd ) { - define( ['jquery', 'datatables'], factory ); -} -else if ( typeof exports === 'object' ) { - // Node/CommonJS - factory( require('jquery'), require('datatables') ); -} -else if ( jQuery && !jQuery.fn.dataTable.TableTools ) { - // Otherwise simply initialise as normal, stopping multiple evaluation - factory( jQuery, jQuery.fn.dataTable ); -} - - -})(window, document); - diff --git a/src/main/resources/META-INF/resources/designer/partials/portfolios/clds_modelling.html b/src/main/resources/META-INF/resources/designer/partials/portfolios/clds_modelling.html index aca810c27..d1d481680 100644 --- a/src/main/resources/META-INF/resources/designer/partials/portfolios/clds_modelling.html +++ b/src/main/resources/META-INF/resources/designer/partials/portfolios/clds_modelling.html @@ -240,15 +240,10 @@ width: 14px; </style> <div attribute-test="cldsmodelling" class="container-fluid" ng-controller="ActivityModellingCtrl" style="height: 90vh;margin:0;padding:0;overflow: hidden;"> <div id="utm-splitter" class="k-content" style="height: 90vh;overflow: hidden;"> - <!-- clds: size 0% rather than 30% --> - <!-- div id="UTMdashboard" kendo-splitter - k-panes="[ { collapsible: true, collapsedSize: '0%',size:'30%'},{}]" - k-orientation="orientation" k-rebind="orientation" - ng-class="{hidden:testsetgendashboard}" style="height: 90vh;overflow: hidden;margin-left: 2px;margin-right: 2px;" --> <div attribute-test="cldsmodelling2" id="UTMdashboard" kendo-splitter k-panes="[ { collapsible: true, collapsedSize: '0%',size:'0%'},{}]" k-orientation="orientation" k-rebind="orientation" - ng-class="{hidden:testsetgendashboard}" style="height: 90vh;overflow: hidden;margin-left: 2px;margin-right: 2px;"> + style="height: 90vh;overflow: hidden;margin-left: 2px;margin-right: 2px;"> <div style="display: none;" id="projectExplorer"> <!-- clds: remove project explorer - use display: none --> <!-- div style="width: 30%; height: 90vh;overflow: hidden;" id="projectExplorer" --> diff --git a/src/main/resources/META-INF/resources/designer/partials/portfolios/dashboard.html b/src/main/resources/META-INF/resources/designer/partials/portfolios/dashboard.html index 42713c87e..be11e1dbe 100644 --- a/src/main/resources/META-INF/resources/designer/partials/portfolios/dashboard.html +++ b/src/main/resources/META-INF/resources/designer/partials/portfolios/dashboard.html @@ -23,7 +23,7 @@ <div attribute-test="dashboard" class="container-fluid" style="height: 87vh;"> - <div attribute-test="dashboard" id="UTMdashboard" style="width: 100%;height:87vh;display:inline-flex;" ng-class="{hidden:testsetgendashboard}"> + <div attribute-test="dashboard" id="UTMdashboard" style="width: 100%;height:87vh;display:inline-flex;"> <div style="width: 30%;display:inline;height:87vh;"> <div attribute-test="dashboard" class="panel panel-primary" style="height: 87vh"> diff --git a/src/main/resources/META-INF/resources/designer/scripts/DashboardCtrl.js b/src/main/resources/META-INF/resources/designer/scripts/DashboardCtrl.js index 9a0656a10..d312d0396 100644 --- a/src/main/resources/META-INF/resources/designer/scripts/DashboardCtrl.js +++ b/src/main/resources/META-INF/resources/designer/scripts/DashboardCtrl.js @@ -23,613 +23,123 @@ 'use strict'; - -function DashboardCtrl($scope,$rootScope,$resource, $http, $timeout, $location, $interval, $q, Datafactory) -{ +function DashboardCtrl($scope, $rootScope, $resource, $http, $timeout, + $location, $interval, $q, Datafactory) { console.log("//////////////DashboardCtrl"); $scope.autosaveInterval = 1800000; - $scope.testsetgendashboard = false; $rootScope.isModel = false; $rootScope.isPalette = false; - $rootScope.isTestSet = false; + $rootScope.isTestSet = false; $rootScope.isRequirementCoverage = false; $rootScope.ispropertyExplorer = false; $rootScope.parameters; - $scope.orientation ="horizontal"; + $scope.orientation = "horizontal"; $rootScope.ispropertyExplorer = false; - $rootScope.isActive =true; - $rootScope.models=[]; - $scope.selectedParent={}; - $rootScope.utmModels={}; + $rootScope.isActive = true; + $rootScope.models = []; + $scope.selectedParent = {}; + $rootScope.utmModels = {}; $rootScope.selectedModelName; - $rootScope.dialogName=""; - + $rootScope.dialogName = ""; + + $interval(function() { + console.log("interval"); + /* + * AutosaveProject($scope,$rootScope,$resource, $http, $timeout, + * $location, $interval, $q, Datafactory); + */ + }, $scope.autosaveInterval); + + $rootScope.onSelectActivityModel = function(obj) { + console.log("onSelectActivityModel"); - $interval( function(){ - console.log("interval"); - /*AutosaveProject($scope,$rootScope,$resource, $http, $timeout, $location, $interval, - $q, Datafactory);*/ - }, $scope.autosaveInterval); - - - $rootScope.onSelectActivityModel =function(obj) - { - console.log("onSelectActivityModel"); - $rootScope.isPalette = true; - $rootScope.isTestSet = false; + $rootScope.isTestSet = false; $rootScope.isRequirementCoverage = false; $rootScope.ispropertyExplorer = false; - //document.getElementById('propertyExplorer').classList.remove('visible'); - - //$( "#propertyExplorer" ).prev().css( "display" ,"block"); - $( "#activity_modeler" ).prev().css( "display", "block" ); - $( 'div' ).find('.k-expand-next').click(); - - if(obj == undefined){ - document.getElementById("modeler_name").textContent="Activity Modeler" ; - }else{ - selected_model=obj; - document.getElementById("modeler_name").textContent="Activity Modeler"+" - "+ selected_model ; + // document.getElementById('propertyExplorer').classList.remove('visible'); + + // $( "#propertyExplorer" ).prev().css( "display" ,"block"); + $("#activity_modeler").prev().css("display", "block"); + $('div').find('.k-expand-next').click(); + + if (obj == undefined) { + document.getElementById("modeler_name").textContent = "Activity Modeler"; + } else { + selected_model = obj; + document.getElementById("modeler_name").textContent = "Activity Modeler" + + " - " + selected_model; } - + $rootScope.modelName = selected_model; - - $rootScope.modeltestset = list_model_test_sets[selected_model]; - if(list_model_schema_extensions[selected_model] == null){ - if(list_model_schema_extensions[$rootScope.utmModels.name] != null) { - list_model_schema_extensions[selected_model] = jQuery.extend(true, {}, list_model_schema_extensions[$rootScope.utmModels.name]); - } else { - list_model_schema_extensions[selected_model] = {}; - } - } + + $rootScope.modeltestset = list_model_test_sets[selected_model]; + if (list_model_schema_extensions[selected_model] == null) { + if (list_model_schema_extensions[$rootScope.utmModels.name] != null) { + list_model_schema_extensions[selected_model] = jQuery + .extend( + true, + {}, + list_model_schema_extensions[$rootScope.utmModels.name]); + } else { + list_model_schema_extensions[selected_model] = {}; + } + } $rootScope.initProjectExplorer(); - - visibility_model(); - changecolor(selected_model); - - - }; - $scope.selectActivityTestSet =function() - { - console.log("selectActivityTestSet"); - $rootScope.isPalette = false; - $rootScope.isRequirementCoverage = false; + + visibility_model(); + changecolor(selected_model); + + }; + $scope.selectActivityTestSet = function() { + console.log("selectActivityTestSet"); + $rootScope.isPalette = false; + $rootScope.isRequirementCoverage = false; $rootScope.isTestset = true; - document.getElementById("modeler_name").textContent="UTM Test Set"; - //document.getElementById('propertyExplorer').classList.add('visible'); - //$( "#propertyExplorer" ).prev().css( "display" ,"none"); - $( 'div' ).find('.k-collapse-next').click(); + document.getElementById("modeler_name").textContent = "UTM Test Set"; + // document.getElementById('propertyExplorer').classList.add('visible'); + // $( "#propertyExplorer" ).prev().css( "display" ,"none"); + $('div').find('.k-collapse-next').click(); $rootScope.modeltestset = list_model_test_sets[selected_model]; $rootScope.$apply(); - - }; - $scope.showPalette= function(){ + + }; + $scope.showPalette = function() { console.log("showPalette"); - //alert("showPalette()"); + // alert("showPalette()"); $rootScope.isModel = true; - // $rootScope.isPalette = true; - - }; - - //$scope.initialShow=false; - - if("/testsetgendashboard"==$location.url()) - { - $scope.testsetgendashboard = true; - - - $rootScope.total_users = 0; - $scope.showUserView = true; - $scope.showTestExecution = true; - //$rootScope.total_accounts = 606; - $scope.showAccountView = true; - - $rootScope.total_creation_times = 0; - $rootScope.success_rate_percent = 0;//(((data.data[0].value*1.0)/(data.data[0].value+data.data[1].value))*100).toFixed(); - $rootScope.total_accounts = 0; - $scope.showCreation_timeView = true; - $scope.showSuccess_ratePercent = true; - - - //$scope.generalMessages= "This section will show general messages/alerts."; - $scope.gridHeaderMessages= "TestData Self-Service: Select TestCase and Click on Run button!!!"; - - //Filters' JS - - $scope.dt = new Date(); - $scope.clear = function () { - console.log("clear"); - $scope.dt = null; - }; - - // Disable weekend selection - $scope.disabled = function(date, mode) { - console.log("disabled"); - return ( mode === 'day' && ( date.getDay() === 0 || date.getDay() === 6 ) ); - }; - - $scope.toggleMin = function() { - console.log("toggleMin"); - $scope.minDate = $scope.minDate ? null : new Date(); - }; - $scope.toggleMin(); - - $scope.open2 = function($event) { - console.log("open2"); - $event.preventDefault(); - $event.stopPropagation(); - console.log(' herro: is the value of opened'); - $scope.opened = true; - console.log($scope.opened + ' is the value of opened'); - }; - - $scope.dateOptions = { - formatYear: 'yy', - startingDay: 1 - }; - - $scope.formats = ['dd-MMMM-yyyy', 'yyyy/MM/dd', 'dd.MM.yyyy', 'shortDate']; - $scope.format = $scope.formats[0]; - - $scope.disabled = function(date, mode) - { - console.log("disabled"); - return ( mode === 'day' && ( date.getDay() === -1 || date.getDay() === 7 ) ); - }; - - $scope.maxDate = new Date(); - - - $scope.open = function($event,opened) { - console.log("open"); - $event.preventDefault(); - $event.stopPropagation(); - - $scope[opened] = true; - }; - + // $rootScope.isPalette = true; - $scope.dateOptions = { - 'year-format': "'yy'", - 'starting-day': 1 - }; - - $scope.date = "29-December-2014"; - $scope.date2 = new Date(); - - $scope.printDate = function() - { - console.log("printDate"); - }; - }; - - - - - - $scope.returnObjectArray = function(arrayObj) - { - console.log("returnObjectArray"); - var newArrayObj = []; - - angular.forEach(arrayObj, function(value, key) - { - console.log("arrayObj"); - newArrayObj.push({"data":value}); - }); - - return newArrayObj; - }; - - - $scope.returnTestScenarioTstObjectArray = function(arrayObj) - { - console.log("returnTestScenarioTstObjectArray"); - var newArrayObj = []; - - angular.forEach(arrayObj, function(value, key) - { - console.log("arrayObj"); - if( value.testScenarioInstances !=undefined && value.testScenarioInstances.length !=0){ - var tempLabel = value.testScenarioInstances[0].label.split(":"); - newArrayObj.push({"data":tempLabel[0]}); - } - - }); - - return newArrayObj; - }; - - - - $scope.returnOverRiddenObjectArray = function(arrayObj) - { - console.log("returnOverRiddenObjectArray"); - var newArrayObj = []; - - angular.forEach(arrayObj, function(value, key) - { - console.log("arrayObj"); - newArrayObj.push({"data":value.name}); - }); - - return newArrayObj; - }; - - - - $rootScope.filterRouter = 'partials/DashboardFilters.html'; $scope.isActivePROD = true; $scope.isActiveQC = false; - $rootScope.reload = function(env) - { - console.log("reload"); + $rootScope.reload = function(env) { + console.log("reload"); }; $scope.showTDSSView = true; - - $scope.ReLoadDashboardFromViewResetComboBox = function(type, amount)//('Users','All') ('Accounts','All') ('Creation_times','All') - { - console.log("ReLoadDashboardFromViewResetComboBox"); - }; - - - - ////////////////////////////////// - - $scope.total_tdr_team_selected_model = []; - $scope.total_tdr_users_selected_model = []; - $scope.total_tdr_requests_selected_model = []; - $scope.total_tdr_entities_selected_model = []; - - $scope.reloadTDRDashboard = function(name) - { - console.log("reloadTDRDashboard"); - var url = "/testdata-service/test-data-request/dashboard/counts.json?"; - - $http.get(url+params).success(function(data) - { - console.log("success"); - $scope.total_tdr_team_count = data.result.dashboardCountModel.teams; - $scope.total_tdr_users_count = data.result.dashboardCountModel.users; - $scope.total_tdr_requests_count = data.result.dashboardCountModel.requests; - $scope.total_tdr_entities_count = data.result.dashboardCountModel.entities; - - - if("team"!=name) - { - $scope.total_tdr_team_array = $scope.returnObjectArray(data.result.tdrDashboardModel.teams); - $scope.TDRTeamGridId.api().clear().draw(); - $scope.TDRTeamGridId.fnAddData($scope.total_tdr_team_array); - } - - - if("users"!=name) - { - $scope.total_tdr_users_array = $scope.returnObjectArray(data.result.tdrDashboardModel.users); - $scope.TDRUserGridId.api().clear().draw(); - $scope.TDRUserGridId.fnAddData($scope.total_tdr_users_array); - } - - if("status"!=name) - { - $scope.total_tdr_entities_array = $scope.returnObjectArray(data.result.tdrDashboardModel.entities); - $scope.TDREntitiesGridId.api().clear().draw(); - $scope.TDREntitiesGridId.fnAddData($scope.total_tdr_entities_array); - } - - if("request"!=name) - { - $scope.total_tdr_requests_array = $scope.returnObjectArray(data.result.tdrDashboardModel.requests); - $scope.TDRNumberGridId.api().clear().draw(); - $scope.TDRNumberGridId.fnAddData($scope.total_tdr_requests_array); - } - }); - - }; - - - $scope.loadTDRDashboard = function() - { - console.log("loadTDRDashboard"); - $rootScope.launch('wait'); - - /* api jobs */ - var apiJobUrl = "/utm-service/em/jobs?timezoneOffset=420"; - - $http.get(apiJobUrl).success(function(data) - { - console.log("success"); - $scope.total_test_scenario_count = data.length; - - - $scope.TDRNumberGridId = $('#TDRNumberGridId').dataTable( { - "serverSide": false, - "aoColumns": [ - - { "sTitle": "","mDataProp": null, "sWidth": "20px", "bSortable": false}, - { "sTitle":"Total TestScenarios","mDataProp": "data","bSortable": true} - ], - //"columns": [{"data": "data"}], - "order": [[ 1, "asc" ]], - "bPaginate": false, - "bFilter": false, - "bInfo": false, - "bAutoWidth": false, - "bScrollCollapse": false, - "bLengthChange":false, - "bJQueryUI": true, - "search": {"caseInsensitive": true}, - "scrollY": "200px", - "scrollX": "100%", - "sScrollXInner": "100%", - "fnCreatedRow": function( nRow, aData, iDataIndex ) - { - console.log("fnCreatedRow"); - $(nRow).children("td").css("overflow", "hidden"); - $(nRow).children("td").css("white-space", "nowrap"); - $(nRow).children("td").css("text-overflow", "ellipsis"); - - var found = false; - - angular.forEach($scope.total_tdr_requests_selected_model, function (value) - { - console.log("total_tdr_requests_selected_model"); - if(aData.data==value.id) - { - found=true; - } - }); - - if(found) - { - $('td:eq(0)', nRow).html( '<span class="tdr_checkbox tdr_checkbox_glyphicon_glyphicon_ok glyphicon glyphicon-ok" id="'+aData.data+'"></span>'); - } - else - { - $('td:eq(0)', nRow).html( '<span class="tdr_checkbox tdr_checkbox_glyphicon_glyphicon_unchecked glyphicon glyphicon-unchecked" id="'+aData.data+'"></span>'); - } - - - } - } ); - - $scope.total_tdr_requests_array = $scope.returnOverRiddenObjectArray(data); - - if($scope.total_tdr_requests_array.length > 0) - { - $scope.TDRNumberGridId.fnAddData($scope.total_tdr_requests_array); - } - - - - - - $('#TDRNumberGridId tbody').on( 'click', 'td', function () - { - console.log("click"); - var position = $scope.TDRNumberGridId.fnGetPosition(this); // getting the clicked row position - - if(position[1]==1) - { - - var valueX = this.innerHTML; - - $('.tdr_checkbox').each(function(i, obj) - { - console.log("tdr_checkbox"); - var uncheck = $(obj).hasClass( "glyphicon-unchecked"); - - if(valueX==obj.id && uncheck) - { - $(obj).attr('class','tdr_checkbox tdr_checkbox_glyphicon_glyphicon_ok glyphicon glyphicon-ok'); - } - else if(valueX==obj.id && !uncheck) - { - $(obj).attr('class','tdr_checkbox tdr_checkbox_glyphicon_glyphicon_unchecked glyphicon glyphicon-unchecked'); - } - }); - - - if($('.tdr_checkbox_glyphicon_glyphicon_ok').length <= 0) - { - $scope.total_tdr_requests_selected_model = []; - $scope.total_tdr_requests_selected_model.push({'id':'All'}); - } - else - { - $scope.total_tdr_requests_selected_model = []; - - $('.tdr_checkbox_glyphicon_glyphicon_ok').each(function(i, obj) - { - console.log("tdr_checkbox_glyphicon_glyphicon_ok"); - $scope.total_tdr_requests_selected_model.push({'id':obj.id}); - }); - - } - } - else - { - var valueX = this.innerHTML.substring(this.innerHTML.indexOf("id=\"")+4,this.innerHTML.length-9); - - $('.tdr_checkbox').each(function(i, obj) - { - console.log("tdr_checkbox"); - var uncheck = $(obj).hasClass( "glyphicon-unchecked"); - - if(valueX==obj.id && uncheck) - { - $(obj).attr('class','tdr_checkbox tdr_checkbox_glyphicon_glyphicon_ok glyphicon glyphicon-ok'); - } - else if(valueX==obj.id && !uncheck) - { - $(obj).attr('class','tdr_checkbox tdr_checkbox_glyphicon_glyphicon_unchecked glyphicon glyphicon-unchecked'); - } - - }); - - - if($('.tdr_checkbox_glyphicon_glyphicon_ok').length <= 0) - { - $scope.total_tdr_requests_selected_model = []; - $scope.total_tdr_requests_selected_model.push({'id':'All'}); - } - else - { - $scope.total_tdr_requests_selected_model = []; - $('.tdr_checkbox_glyphicon_glyphicon_ok').each(function(i, obj) - { - console.log("tdr_checkbox_glyphicon_glyphicon_ok"); - $scope.total_tdr_requests_selected_model.push({'id':obj.id}); - }); - } - } - $scope.reloadTDRDashboard('request'); - }); - //$scope.initialShow=true; - $rootScope.$broadcast('dialogs.wait.complete'); - - - }); - - }; - - - - $scope.getCommaSeparatedString = function(json) - { - console.log("getCommaSeparatedString"); - if(json==undefined || json==null) - { - return "All"; - } - - var result = ""; - var found =false; - - for (var dString in json) - { - result += json[dString].id + ","; - found=true; - } - - var res = result.match(/All,/g); - - if(res!=null && result.split(",").length > 1) - { - result = result.replace("All,", ""); - } - - if(!found || result=="") - { - return "All"; - } - - return result.replace(/,(\s+)?$/, ''); - }; - - - /*if("/dashboard"==$location.url()) - { - $scope.loadTDRDashboard(); - }*/ - - - - $scope.reloadTDRDashboardFromReset = function(name) - { - console.log("reloadTDRDashboardFromReset"); - var url = "/testdata-service/test-data-request/dashboard/counts.json?"; - var params = "teams="+$scope.getCommaSeparatedString($scope.total_tdr_team_selected_model); - params = params + "&users="+$scope.getCommaSeparatedString($scope.total_tdr_users_selected_model); - params = params + "&requests="+$scope.getCommaSeparatedString($scope.total_tdr_requests_selected_model); - params = params + "&status="+$scope.getCommaSeparatedString($scope.total_tdr_entities_selected_model); - - $http.get(url+params).success(function(data) - { - console.log("success"); - $scope.total_tdr_team_count = data.result.dashboardCountModel.teams; - $scope.total_tdr_users_count = data.result.dashboardCountModel.users; - $scope.total_tdr_requests_count = data.result.dashboardCountModel.requests; - $scope.total_tdr_entities_count = data.result.dashboardCountModel.entities; - - $scope.total_tdr_team_array = $scope.returnObjectArray(data.result.tdrDashboardModel.teams); - $scope.TDRTeamGridId.api().clear().draw(); - $scope.TDRTeamGridId.fnAddData($scope.total_tdr_team_array); - - $scope.total_tdr_users_array = $scope.returnObjectArray(data.result.tdrDashboardModel.users); - $scope.TDRUserGridId.api().clear().draw(); - $scope.TDRUserGridId.fnAddData($scope.total_tdr_users_array); - - $scope.total_tdr_entities_array = $scope.returnObjectArray(data.result.tdrDashboardModel.entities); - $scope.TDREntitiesGridId.api().clear().draw(); - $scope.TDREntitiesGridId.fnAddData($scope.total_tdr_entities_array); - - $scope.total_tdr_requests_array = $scope.returnObjectArray(data.result.tdrDashboardModel.requests); - $scope.TDRNumberGridId.api().clear().draw(); - $scope.TDRNumberGridId.fnAddData($scope.total_tdr_requests_array); - }); - - }; - - - $scope.ReLoadTDRDashboard = function(name) - { - console.log("ReLoadTDRDashboard"); - if("team"==name) - { - $scope.total_tdr_team_selected_model = []; - } - - if("users"==name) - { - $scope.total_tdr_users_selected_model = []; - } - - if("status"==name) - { - $scope.total_tdr_entities_selected_model = []; - } - - if("request"==name) - { - $scope.total_tdr_requests_selected_model = []; - } - - $scope.reloadTDRDashboardFromReset(name); - - }; - } -function changecolor(selected_model) -{ +function changecolor(selected_model) { console.log("changecolor"); - + var i = 0; - //var modelNames =[]; - - $(".models").each(function(i){ - console.log("each"); - var model_value = $(this).text().trim(); - //modelName.push(model_value); - if(model_value == selected_model || model_value == "") - { - $(this).addClass("selectedcolor"); - } - else - { - $(this).removeClass("selectedcolor"); - - } - - i++; - }); -} + // var modelNames =[]; + $(".models").each(function(i) { + console.log("each"); + var model_value = $(this).text().trim(); + // modelName.push(model_value); + if (model_value == selected_model || model_value == "") { + $(this).addClass("selectedcolor"); + } else { + $(this).removeClass("selectedcolor"); + } + + i++; + }); +} |