From 2b351233e7baa73c81f928c657792bdc6b41918a Mon Sep 17 00:00:00 2001 From: David Huynh Date: Sun, 28 Aug 2011 22:43:45 +0000 Subject: [PATCH] Added a dialog box for custom tabular exporting. No back-end implementation yet. git-svn-id: http://google-refine.googlecode.com/svn/trunk@2223 7d457c2a-affb-35e4-300a-418c747d4874 --- .../webapp/modules/core/MOD-INF/controller.js | 23 +- main/webapp/modules/core/project.vt | 1 + .../custom-tabular-exporter-dialog.html | 143 ++++++++++ .../dialogs/custom-tabular-exporter-dialog.js | 263 ++++++++++++++++++ .../core/scripts/index/create-project-ui.js | 59 ---- .../fixed-width-parser-ui.js | 18 +- .../parser-interfaces/line-based-parser-ui.js | 6 +- .../separator-based-parser-ui.js | 22 +- .../modules/core/scripts/project/exporters.js | 6 +- .../modules/core/scripts/util/encoding.js | 79 ++++++ .../scripts/util/select-encoding-dialog.html | 22 ++ .../modules/core/scripts/util/string.js | 14 +- .../custom-tabular-exporter-dialog.less | 66 +++++ .../core/styles/index/create-project-ui.less | 12 - .../modules/core/styles/util/encoding.less | 46 +++ 15 files changed, 666 insertions(+), 114 deletions(-) create mode 100644 main/webapp/modules/core/scripts/dialogs/custom-tabular-exporter-dialog.html create mode 100644 main/webapp/modules/core/scripts/dialogs/custom-tabular-exporter-dialog.js create mode 100644 main/webapp/modules/core/scripts/util/encoding.js create mode 100644 main/webapp/modules/core/scripts/util/select-encoding-dialog.html create mode 100644 main/webapp/modules/core/styles/dialogs/custom-tabular-exporter-dialog.less create mode 100644 main/webapp/modules/core/styles/util/encoding.less diff --git a/main/webapp/modules/core/MOD-INF/controller.js b/main/webapp/modules/core/MOD-INF/controller.js index a2fa1beff..3d0a62bd7 100644 --- a/main/webapp/modules/core/MOD-INF/controller.js +++ b/main/webapp/modules/core/MOD-INF/controller.js @@ -39,10 +39,15 @@ var bundle = false; var templatedFiles = { // Requests with last path segments mentioned here // will get served from .vt files with the same names - "import" : true, - "index" : true, - "preferences" : true, - "project" : true + "index" : { + outputEncodings: true + }, + "preferences" : { + outputEncodings: false + }, + "project" : { + outputEncodings: true + } }; function registerCommands() { @@ -293,6 +298,7 @@ function init() { "scripts/util/menu.js", "scripts/util/dialog.js", "scripts/util/dom.js", + "scripts/util/encoding.js", "scripts/index.js", "scripts/index/create-project-ui.js", @@ -323,6 +329,7 @@ function init() { "styles/common.less", "styles/pure.css", "styles/util/dialog.less", + "styles/util/encoding.less", "styles/index.less", "styles/index/create-project-ui.less", @@ -363,6 +370,7 @@ function init() { "scripts/util/dialog.js", "scripts/util/dom.js", "scripts/util/custom-suggest.js", + "scripts/util/encoding.js", "scripts/widgets/histogram-widget.js", "scripts/widgets/slider-widget.js", @@ -398,7 +406,8 @@ function init() { "scripts/dialogs/clustering-dialog.js", "scripts/dialogs/scatterplot-dialog.js", "scripts/dialogs/templating-exporter-dialog.js", - "scripts/dialogs/column-reordering-dialog.js" + "scripts/dialogs/column-reordering-dialog.js", + "scripts/dialogs/custom-tabular-exporter-dialog.js" ] ); @@ -417,6 +426,7 @@ function init() { "styles/util/menu.less", "styles/util/dialog.less", "styles/util/custom-suggest.less", + "styles/util/encoding.less", "styles/project.less", "styles/project/sidebar.less", @@ -432,6 +442,7 @@ function init() { "styles/dialogs/clustering-dialog.less", "styles/dialogs/scatterplot-dialog.less", "styles/dialogs/column-reordering-dialog.less", + "styles/dialogs/custom-tabular-exporter-dialog.less", "styles/reconciliation/recon-dialog.less", "styles/reconciliation/standard-service-panel.less" @@ -558,7 +569,7 @@ function process(path, request, response) { context.scriptInjection = scriptInjection.join("\n"); } - if (path == "/index") { + if (templatedFiles[lastSegment].outputEncodings) { var encodings = []; var sortedCharsetMap = Packages.java.nio.charset.Charset.availableCharsets(); diff --git a/main/webapp/modules/core/project.vt b/main/webapp/modules/core/project.vt index 36626cf96..20bc1e451 100644 --- a/main/webapp/modules/core/project.vt +++ b/main/webapp/modules/core/project.vt @@ -40,6 +40,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. $scriptInjection $styleInjection +