From 6bb377bf1638c5e147080e1ed1cb1c6c9b1dd655 Mon Sep 17 00:00:00 2001 From: ankurjuneja Date: Thu, 4 Apr 2024 16:31:01 -0700 Subject: [PATCH 1/2] remove unused script --- LDK/resources/web/LDK/Printer.js | 265 ------------------------------- 1 file changed, 265 deletions(-) delete mode 100644 LDK/resources/web/LDK/Printer.js diff --git a/LDK/resources/web/LDK/Printer.js b/LDK/resources/web/LDK/Printer.js deleted file mode 100644 index 445c7d52..00000000 --- a/LDK/resources/web/LDK/Printer.js +++ /dev/null @@ -1,265 +0,0 @@ -/** - * Adapted from: https://github.com/loiane/extjs4-ux-gridprinter - * - * @class Ext.ux.grid.Printer - * @author Ed Spencer (edward@domine.co.uk) - * Helper class to easily print the contents of a grid. Will open a new window with a table where the first row - * contains the headings from your column model, and with a row for each item in your grid's store. When formatted - * with appropriate CSS it should look very similar to a default grid. If renderers are specified in your column - * model, they will be used in creating the table. Override headerTpl and bodyTpl to change how the markup is generated - * - * Usage: - * - * 1 - Add Ext.Require Before the Grid code - * Ext.require([ - * 'Ext.ux.grid.GridPrinter', - * ]); - * - * 2 - Declare the Grid - * var grid = Ext.create('Ext.grid.Panel', { - * columns: //some column model, - * store : //some store - * }); - * - * 3 - Print! - * Ext.ux.grid.Printer.mainTitle = 'Your Title here'; //optional - * Ext.ux.grid.Printer.print(grid); - * - * Original url: http://edspencer.net/2009/07/printing-grids-with-ext-js.html - * - * Modified by Loiane Groner (me@loiane.com) - September 2011 - Ported to Ext JS 4 - * http://loianegroner.com (English) - * http://loiane.com (Portuguese) - * - * Modified by Bruno Sales - August 2012 - * - * Modified by Paulo Goncalves - March 2012 - * - * Modified by Beto Lima - March 2012 - * - * Modified by Beto Lima - April 2012 - * - * Modified by Paulo Goncalves - May 2012 - * - * Modified by Nielsen Teixeira - 2012-05-02 - * - * Modified by Joshua Bradley - 2012-06-01 - * - * Modified by Loiane Groner - 2012-09-08 - * - * Modified by Loiane Groner - 2012-09-24 - * - */ - -(function(Ext){ - -Ext.define("Ext.ux.grid.Printer", { - - requires: 'Ext.XTemplate', - - statics: { - /** - * Prints the passed grid. Reflects on the grid's column model to build a table, and fills it using the store - * @param {Ext.grid.Panel} grid The grid to print - */ - print: function(grid) { - //We generate an XTemplate here by using 2 intermediary XTemplates - one to create the header, - //the other to create the body (see the escaped {} below) - var columns = []; - //account for grouped columns - Ext.each(grid.columns, function(c) { - if(c.items.length > 0) { - columns = columns.concat(c.items.items); - } else { - columns.push(c); - } - }); - - //build a usable array of store data for the XTemplate - var data = []; - grid.store.data.each(function(item, row) { - var convertedData = {}; - - //apply renderers from column model - for (var key in item.data) { - var value = item.data[key]; - - Ext.each(columns, function(column, col) { - if (column && column.dataIndex == key) { - /* - * TODO: add the meta to template - */ - var meta = {item: '', tdAttr: '', style: ''}; - value = column.renderer ? column.renderer.call(grid, value, meta, item, row, col, grid.store, grid.view) : value; - convertedData[Ext.String.createVarName(column.text)] = value; - } else if (column && column.xtype === 'rownumberer'){ - convertedData['Row'] = row; - } - }, this); - } - - data.push(convertedData); - }); - - //remove columns that do not contains dataIndex or dataIndex is empty. for example: columns filter or columns button - var clearColumns = []; - Ext.each(columns, function (column) { - if ((column) && (!Ext.isEmpty(column.dataIndex) && !column.hidden)) { - clearColumns.push(column); - } else if (column && column.xtype === 'rownumberer'){ - column.text = 'Row'; - clearColumns.push(column); - } - }); - columns = clearColumns; - - //get Styles file relative location, if not supplied - if (this.stylesheetPath === null) { - var scriptPath = Ext.Loader.getPath('Ext.ux.grid.Printer'); - this.stylesheetPath = scriptPath.substring(0, scriptPath.indexOf('Printer.js')) + 'gridPrinterCss/print.css'; - } - - //use the headerTpl and bodyTpl markups to create the main XTemplate below - var headings = Ext.create('Ext.XTemplate', this.headerTpl).apply(columns); - var body = Ext.create('Ext.XTemplate', this.bodyTpl).apply(columns); - var pluginsBody = '', - pluginsBodyMarkup = []; - - //add relevant plugins - Ext.each(grid.plugins, function(p) { - if (p.ptype == 'rowexpander') { - pluginsBody += p.rowBodyTpl.join(''); - } - }); - - if (pluginsBody != '') { - pluginsBodyMarkup = [ - '', - pluginsBody, - '' - ]; - } - - //Here because inline styles using CSS, the browser did not show the correct formatting of the data the first time that loaded - var htmlMarkup = [ - '', - '', - '', - '', - '', - '' + grid.title + '', - '', - '', - '', - '

' + this.mainTitle + '

', - '', - '', - headings, - '', - '', - '', - body, - '', - pluginsBodyMarkup.join(''), - '', - '
', - '', - '' - ]; - - var html = Ext.create('Ext.XTemplate', htmlMarkup).apply(data); - - //open up a new printing window, write to it, print it and close - var win = window.open('', 'printgrid'); - - //document must be open and closed - win.document.open(); - win.document.write(html); - win.document.close(); - - if (this.printAutomatically){ - win.print(); - } - - //Another way to set the closing of the main - if (this.closeAutomaticallyAfterPrint){ - if(Ext.isIE){ - window.close(); - } else { - win.close(); - } - } - }, - - /** - * @property stylesheetPath - * @type String - * The path at which the print stylesheet can be found (defaults to 'ux/grid/gridPrinterCss/print.css') - */ - stylesheetPath: null, - - /** - * @property printAutomatically - * @type Boolean - * True to open the print dialog automatically and close the window after printing. False to simply open the print version - * of the grid (defaults to false) - */ - printAutomatically: false, - - /** - * @property closeAutomaticallyAfterPrint - * @type Boolean - * True to close the window automatically after printing. - * (defaults to false) - */ - closeAutomaticallyAfterPrint: false, - - /** - * @property mainTitle - * @type String - * Title to be used on top of the table - * (defaults to empty) - */ - mainTitle: '', - - /** - * Text show on print link - * @type String - */ - printLinkText: 'Print', - - /** - * Text show on close link - * @type String - */ - closeLinkText: 'Close', - - /** - * @property headerTpl - * @type {Object/Array} values - * The markup used to create the headings row. By default this just uses elements, override to provide your own - */ - headerTpl: [ - '', - '{text}', - '' - ], - - /** - * @property bodyTpl - * @type {Object/Array} values - * The XTemplate used to create each row. This is used inside the 'print' function to build another XTemplate, to which the data - * are then applied (see the escaped dataIndex attribute here - this ends up as "{dataIndex}") - */ - bodyTpl: [ - '', - '\{{[Ext.String.createVarName(values.text)]}\}', - '' - ] - } -}); - -})(Ext4); \ No newline at end of file From 80da6e463915c08f598d64a3dadf8500c1da554a Mon Sep 17 00:00:00 2001 From: ankurjuneja Date: Fri, 5 Apr 2024 10:00:41 -0700 Subject: [PATCH 2/2] code review feedback --- LDK/resources/web/LDK/printer.css | 97 ------------------------------- 1 file changed, 97 deletions(-) delete mode 100644 LDK/resources/web/LDK/printer.css diff --git a/LDK/resources/web/LDK/printer.css b/LDK/resources/web/LDK/printer.css deleted file mode 100644 index fee47b67..00000000 --- a/LDK/resources/web/LDK/printer.css +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Print and Close icons from Silk icon set 1.3 - * _________________________________________ - * Mark James - * http://www.famfamfam.com/lab/icons/silk/ - */ - -html.x-ux-grid-printer,.x-ux-grid-printer div,.x-ux-grid-printer dl,.x-ux-grid-printer dt,.x-ux-grid-printer dd, -.x-ux-grid-printer ul,.x-ux-grid-printer ol,.x-ux-grid-printer li,.x-ux-grid-printer h1,.x-ux-grid-printer h2, -.x-ux-grid-printer h3,.x-ux-grid-printer h4,.x-ux-grid-printer h5,.x-ux-grid-printer h6,.x-ux-grid-printer pre,.x-ux-grid-printer form, -.x-ux-grid-printer fieldset,.x-ux-grid-printer input,.x-ux-grid-printer p,.x-ux-grid-printer blockquote,.x-ux-grid-printer th,.x-ux-grid-printer td -{ - margin: 0; - padding: 0; -} - -html.x-ux-grid-printer, .x-ux-grid-printer img,.x-ux-grid-printer body { - border: 0; -} - -.x-ux-grid-printer address,.x-ux-grid-printer caption,.x-ux-grid-printer cite,.x-ux-grid-printer code,.x-ux-grid-printer dfn,.x-ux-grid-printer em,.x-ux-grid-printer strong,.x-ux-grid-printer th,.x-ux-grid-printer var { - font-style: normal; - font-weight: normal; -} - -.x-ux-grid-printer ol,.x-ux-grid-printer ul { - list-style: none; -} - -.x-ux-grid-printer caption,.x-ux-grid-printer th { - text-align: left; -} - -.x-ux-grid-printer h1,.x-ux-grid-printer h2,.x-ux-grid-printer h3,.x-ux-grid-printer h4,.x-ux-grid-printer h5,.x-ux-grid-printer h6 { - font-size: 100%; -} - -.x-ux-grid-printer q:before,.x-ux-grid-printer q:after { - content: ''; -} - -.x-ux-grid-printer .x-ux-grid-printer-links { - padding: 0 0 20px 0; -} - -.x-ux-grid-printer a.x-ux-grid-printer-linkprint { - padding: 0 0 0 18px; - margin: 0 5px; - background: url(images/printer.png) no-repeat bottom left !important; -} - -.x-ux-grid-printer a.x-ux-grid-printer-linkclose { - padding: 0 0 0 18px; - margin: 0 5px; - background: url(images/cross.png) no-repeat bottom left !important; -} - -.x-ux-grid-printer table { - width: 100%; - text-align: left; - font-size: 11px; - font-family: arial; - border-collapse: collapse; -} - -.x-ux-grid-printer table th { - font-weight: bold; - padding: 4px 3px 4px 5px; - border: 1px solid #d0d0d0; - border-left-color: #eee; - background-color: #ededed; -} - -.x-ux-grid-printer table tr.odd { - background-color: #ffffff; -} - -.x-ux-grid-printer table tr.even { - background-color: #f9f9f9; -} - -.x-ux-grid-printer table td { - padding: 4px 3px 4px 5px; - border-style: none solid solid; - border-width: 1px; - border-color: #ededed; -} - -@media print { - .x-ux-grid-printer body { - margin: 0; - padding: 0; - } - .x-ux-grid-printer div.x-ux-grid-printer-noprint { - display: none; - } -} \ No newline at end of file