Skip to content

Commit 50a4acb

Browse files
committed
File Extension
Support to generate file list with details from 1 or more directories
1 parent 2d4df96 commit 50a4acb

File tree

14 files changed

+1034
-56
lines changed

14 files changed

+1034
-56
lines changed

module/MOD-INF/controller.js

Lines changed: 26 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,50 @@
11
/*
2-
3-
Copyright 2010, Google Inc.
4-
All rights reserved.
5-
6-
Redistribution and use in source and binary forms, with or without
7-
modification, are permitted provided that the following conditions are
8-
met:
9-
10-
* Redistributions of source code must retain the above copyright
11-
notice, this list of conditions and the following disclaimer.
12-
* Redistributions in binary form must reproduce the above
13-
copyright notice, this list of conditions and the following disclaimer
14-
in the documentation and/or other materials provided with the
15-
distribution.
16-
* Neither the name of Google Inc. nor the names of its
17-
contributors may be used to endorse or promote products derived from
18-
this software without specific prior written permission.
19-
20-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21-
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22-
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23-
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24-
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25-
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26-
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27-
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28-
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29-
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30-
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31-
2+
* Controller for Files extension.
3+
*
4+
* This is run in the Butterfly (ie Refine) server context using the Rhino
5+
* Javascript interpreter.
326
*/
337

348
var html = "text/html";
359
var encoding = "UTF-8";
10+
var version = "0.1";
11+
12+
// Register our Javascript (and CSS) files to get loaded
3613
var ClientSideResourceManager = Packages.com.google.refine.ClientSideResourceManager;
3714

3815
/*
3916
* Function invoked to initialize the extension.
4017
*/
4118
function init() {
42-
// Script files to inject into /project page
19+
20+
// Register importer and exporter
21+
var IM = Packages.com.google.refine.importing.ImportingManager;
22+
23+
IM.registerController(
24+
module,
25+
"files-importing-controller",
26+
new Packages.org.openrefine.extensions.files.importer.FilesImportingController()
27+
);
28+
29+
// Script files to inject into /index page
4330
ClientSideResourceManager.addPaths(
44-
"project/scripts",
31+
"index/scripts",
4532
module,
4633
[
47-
"scripts/project-injection.js"
34+
"scripts/index/files-importing-controller.js",
35+
"scripts/index/import-from-local-dir.js"
4836
]
4937
);
5038

51-
// Style files to inject into /project page
39+
40+
// Style files to inject into /index page
5241
ClientSideResourceManager.addPaths(
53-
"project/styles",
42+
"index/styles",
5443
module,
5544
[
56-
"styles/project-injection.css"
45+
"styles/files-importing-controller.less"
5746
]
5847
);
5948

60-
// Here you can register all sorts of server-side components following the extension points listed in:
61-
// https://openrefine.org/docs/technical-reference/writing-extensions#server-side-ajax-commands
62-
}
63-
6449

50+
}

module/MOD-INF/module.properties

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name = openrefine-sample-extension
2-
description = OpenRefine Sample Extension - place your description here
1+
name = files
2+
description = Generate media dataset from filesystem
33
templating.macros = macros.vm
4-
requires = core
4+
requires = core

module/langs/translation-en.json

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"files-import/menu-localdirectory": "Files from local directory",
3+
"files-import/directory": "Local directory",
4+
"files-import/enter-dir": "Enter the path to the directory from which to load file details.",
5+
"files-import/empty-dir": "Empty directory path",
6+
"files-import/scanning": "Scanning for files",
7+
"files-parsing/project-default-name": "fileList",
8+
"files-import/warning-dir-path": "You must specify a path to the directory to be imported.",
9+
"files-import/preparing": "Preparing…",
10+
"files-import/creating": "Creating project…",
11+
"files-import/import-by-directory": "Enter one or more Wikimedia Commons categories from which you want to retrieve files:",
12+
"files-import/remove-directory": "Remove this directory",
13+
"files-import/add": "Add another category",
14+
"files-import/next": "Next",
15+
"files-import/add-dir": "Add directory",
16+
"files-import/retrieving": "Retrieving files from directories…",
17+
"files-parsing/start-over": "« Start Over",
18+
"files-parsing/conf-pars": "Configure Parsing Options",
19+
"files-parsing/proj-name": "Project name",
20+
"files-parsing/create-proj": "Create Project »",
21+
"files-source/alert-retrieve": "No Category selected",
22+
"files-parsing/option": "Options:",
23+
"files-parsing/discard-next": "Discard initial",
24+
"files-parsing/discard": "row(s) of data",
25+
"files-parsing/limit-next": "Load at most",
26+
"files-parsing/limit": "row(s) of data",
27+
"files-parsing/filetext-column": "Include a column with file text",
28+
"files-parsing/preview-button": "Update preview",
29+
"files-parsing/disable-auto-preview": "Disable auto preview",
30+
"files-parsing/updating-preview": "Updating preview…"
31+
}

0 commit comments

Comments
 (0)