diff --git a/controllers/reports.py b/controllers/reports.py index 9cb06201049e4ca16f96ce597df9356511e261ab..45fa3fe7797f73ec271586df9f597612b0f55f95 100644 --- a/controllers/reports.py +++ b/controllers/reports.py @@ -63,7 +63,8 @@ def report_4(): cfg['data'] = [] for row in db().select(db.harvesters.ALL): cfg['data'].append([row.controller, - row.host, + '<a href="http://www.web2py.com">%s</a>' % row.host, +# row.host, row.collections, row.ratio]) diff --git a/static/plugin_dbui/src/grid/mixin/ExportLatex.js b/static/plugin_dbui/src/grid/mixin/ExportLatex.js index 8c7e5fd0a0507f4345221e0a3bde9d52b1c757ac..ef07a5e5bf3edbb05519a9f40806463d9a8f5dfe 100644 --- a/static/plugin_dbui/src/grid/mixin/ExportLatex.js +++ b/static/plugin_dbui/src/grid/mixin/ExportLatex.js @@ -9,6 +9,41 @@ Ext.define('App.grid.mixin.ExportLatex', { extend: 'App.grid.mixin.ExportBase', + // + // Convert the dom Element corresponding to a grid cell into a string. + // When the cell contains an hyper link, it is encoded as using the + // latex command href. + // + // @param {Ext.dom.Element} + // + // @return {String} + // + domToLaTeX: function(domEl) { + + "use strict"; + var htmlEl = domEl.dom, + href, + li, + value; + + // is the cell contains an hyper link + li = htmlEl.getElementsByTagName("A"); + + // standard string + // shrink empty string to avoid latex processing failure + if (li.length === 0) { + value = htmlEl.textContent.trim(); + + // render the hyper link using latex command href + } else { + href = li.item(0).getAttribute("href"); + value = htmlEl.textContent; + value = "\\href{" + href +"}{" + value +"}"; + } + + return value; + }, + /** * Convert the Ext.grid.View content into a string. * The information are encoded using LaTeX standard. @@ -73,7 +108,7 @@ Ext.define('App.grid.mixin.ExportLatex', { div = trEl.down(".x-grid-group-title"); if (div) { - cmd = '\\multicolumn{' + nColumns + '}{l}{' + div.dom.textContent + '} \\\\'; + cmd = '\\multicolumn{' + nColumns + '}{l}{' + me.domToLaTeX(div) + '} \\\\'; latex.push(cmd); latex.push('\\hline'); } @@ -86,10 +121,7 @@ Ext.define('App.grid.mixin.ExportLatex', { // process the tdEls Ext.dom.CompositeElement for (j = 0; j < tdEls.getCount(); j += 1) { - - // shrink empty string to avoid latex processing failure - tdEl = tdEls.item(j).dom.textContent.trim(); - cells.push(tdEl); + cells.push(me.domToLaTeX(tdEls.item(j))); } row = cells.join(' & ') + ' \\\\'; diff --git a/static/plugin_dbui/src/grid/plugin/Export.js b/static/plugin_dbui/src/grid/plugin/Export.js index 77d1b90b2ea5abdab633d18bb8f3a33372b802fe..a2bb415997869c5b1331ec93a4a5e4e6e3d0ca08 100644 --- a/static/plugin_dbui/src/grid/plugin/Export.js +++ b/static/plugin_dbui/src/grid/plugin/Export.js @@ -29,6 +29,7 @@ Ext.define('App.grid.plugin.Export', { '\\documentclass[a4paper]{article}', '\\usepackage[utf8]{inputenc}', '\\usepackage[T1]{fontenc}', + '\\usepackage{hyperref}', '\\usepackage{longtable}' ],