-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathElfinderConnectorGrailsPlugin.groovy
65 lines (49 loc) · 2.37 KB
/
ElfinderConnectorGrailsPlugin.groovy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import grails.plugin.elfinder.command.ElFinderFileCommand
import grails.plugin.elfinder.command.ElFinderMkdirCommand
import grails.plugin.elfinder.command.ElFinderMkfileCommand
import grails.plugin.elfinder.command.ElFinderRenameCommand
import grails.plugin.elfinder.command.ElFinderRmCommand
import grails.plugin.elfinder.command.ElFinderUploadCommand
import grails.plugin.elfinder.command.ElfinderLsCommand
import grails.plugin.elfinder.command.ElfinderOpenCommand
import grails.plugin.elfinder.command.ElfinderParentsCommand
import grails.plugin.elfinder.command.ElfinderTreeCommand
import grails.plugin.elfinder.filemanager.ElfinderLocalFileSystemFileManager
/**
* @author Sudhir Nimavat
*/
class ElfinderConnectorGrailsPlugin {
def version = "0.1"
def grailsVersion = "2.0 > *"
def title = "Elfinder file explorer connector for Grails"
def author = "Sudhir Nimavat"
def authorEmail = "[email protected]"
def description = "Grails connector for elfinder file browser"
def documentation = "http://grails.org/plugin/elfinder-connector"
def scm = [system: 'GitHub', url: 'https://github.com/snimavat/grails-elfinder-connector']
def issueManagement = [ system: "GITHUB", url: "https://github.com/snimavat/grails-elfinder-connector/issues" ]
def license = "APACHE"
def doWithSpring = {
def pluginConfig = application.config.grails.plugin.elfinder
if(!pluginConfig?.rootDir) {
throw new RuntimeException("grails.plugin.elfinder.rootDir is not configured")
}
//configure fileManager
elfinderFileManager(ElfinderLocalFileSystemFileManager) { root = pluginConfig.rootDir }
//configure commands
def configurationClosure = { bean ->
bean.scope = "prototype"
elFinderFileManager = ref("elfinderFileManager")
}
elfinderOpenCommand(ElfinderOpenCommand, configurationClosure)
elfinderParentsCommand(ElfinderParentsCommand, configurationClosure)
elfinderTreeCommand(ElfinderTreeCommand, configurationClosure)
elfinderMkdirCommand(ElFinderMkdirCommand, configurationClosure)
elfinderMkfileCommand(ElFinderMkfileCommand, configurationClosure)
elfinderRenameCommand(ElFinderRenameCommand, configurationClosure)
elfinderRmCommand(ElFinderRmCommand, configurationClosure)
elfinderLsCommand(ElfinderLsCommand, configurationClosure)
elfinderFileCommand(ElFinderFileCommand, configurationClosure)
elfinderUploadCommand(ElFinderUploadCommand, configurationClosure)
}
}