snimavat / grails-elfinder-connector Goto Github PK
View Code? Open in Web Editor NEWElfinder file browser connector for grails
Elfinder file browser connector for grails
I want to define the grails.plugin.elfinder.rootDir path in an external config file.
I have developed my Grails application, and I've installed the elfinder plugin and the connector.
I've used the following in Config.groovy:
def ENV_NAME = "PROPERTIES_PATH"
if(!grails.config.location || !(grails.config.location instanceof List)) {
grails.config.location = []
}
if(System.getenv(ENV_NAME)) {
println "Including configuration file specified in environment: " + System.getenv(ENV_NAME);
grails.config.location << "file:" + System.getenv(ENV_NAME)
println(grails.config.location)
} else if(System.getProperty(ENV_NAME)) {
println "Including configuration file specified on command line: " + System.getProperty(ENV_NAME);
grails.config.location << "file:" + System.getProperty(ENV_NAME)
println(grails.config.location)
} else {
println "No external configuration file defined."
}
And I've created the file appName-config.groovy, in which I have the following:
grails.plugin.elfinder.rootDir = "/home/francesco/docm_patients_doc/{patientcf}/"
At application startup, Ive the following exception:
grails.plugin.elfinder.rootDir is not configured
the # numbers generated by the plugin i.e. on main folder it's allway "index#elf_v1_cm9vdA" as you drill down the tree # number changes i.e. "index#elf_v1_U3VibWlzc2lvbg". when I exit the page and come back to it the # number remain the same where I left it "index#elf_v1_U3VibWlzc2lvbg" which is cool until the folder is deleted or rename by someone else. example when folder is deleted the error:
ERROR| ERROR elfinderdemo.ExtDocSubmissionController - Error encountered while executing command elfinderParentsCommand
Message: \src\Main\CUEL-3\CUEL-JKCZ-1346\Submission
(Submission folder was deleted)
Also I am generating dynamic path string
def createPath = 'src/Main/'+ getRecord.name+'/'+ getRecord.filetype
elfinderFileManager.root = createPath
this works well but if I don't click the main folder every time before exit it throws the same error.
so before I exit any elfinder page I should make the # number to #elf_v1_cm9vdA to avoid error.
any chance I could make the plugin to stop remembering # number at exit? meaning make the # number #elf_v1_cm9vdA every time I revisit the page?
Installed this plugin in my Grails 2.3.11 app. When I view the page with elFinder, I get a JS error saying "TypeError: $(...).elfinder is not a function"
Here are other errors I get:
"Uncaught SyntaxError: Unexpected token <" index.gsp: 1
"Resource interpreted as Stylesheet but transferred with MIME type text/html: "https://studio-42.github.io/elFinder/". index:21
Here is my index.gsp from my code editor:
<!DOCTYPE html>
<html>
<head>
<meta name="layout" content="main"/>
<title>File manager</title>
<link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.21/themes/smoothness/jquery-ui.css"/>
<link rel="stylesheet" type="text/css" href="http://elfinder.org/demo/css/elfinder.min.css"/>
</head>
<body>
<div id="elfinder"></div>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.21/jquery-ui.min.js"></script>
<script type="text/javascript" src="http://elfinder.org/demo/js/elfinder.min.js"></script>
<script type="text/javascript">
$().ready(function() {
var elf = $('#elfinder').elfinder({
url: '${g.createLink(controller: 'elfinderConnector')}'
}).elfinder('instance');
});
</script>
</body>
</html>
And here it is in when viewed with Chrome Developer Tools:
<!DOCTYPE html>
<!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"> <![endif]-->
<!--[if IE 7 ]> <html lang="en" class="no-js ie7"> <![endif]-->
<!--[if IE 8 ]> <html lang="en" class="no-js ie8"> <![endif]-->
<!--[if IE 9 ]> <html lang="en" class="no-js ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html lang="en" class="no-js"><!--<![endif]-->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>File manager</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" href="/testapp/static/images/favicon.ico" type="image/x-icon">
<link rel="apple-touch-icon" href="/testapp/static/images/apple-touch-icon.png">
<link rel="apple-touch-icon" sizes="114x114" href="/testapp/static/images/apple-touch-icon-retina.png">
<link rel="stylesheet" href="/testapp/static/css/main.css" type="text/css">
<link rel="stylesheet" href="/testapp/static/css/mobile.css" type="text/css">
<meta name="layout" content="main"/>
<link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.21/themes/smoothness/jquery-ui.css"/>
<link rel="stylesheet" type="text/css" href="http://elfinder.org/demo/css/elfinder.min.css"/>
</head>
<body>
<div id="grailsLogo" role="banner"><a href="http://grails.org"><img
src="/testapp/static/images/grails_logo.png" alt="Grails"/></a></div>
<div id="elfinder"></div>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.21/jquery-ui.min.js"></script>
<script type="text/javascript" src="http://elfinder.org/demo/js/elfinder.min.js"></script>
<script type="text/javascript">
$().ready(function() {
var elf = $('#elfinder').elfinder({
url: '/testapp/elfinderConnector/index'
}).elfinder('instance');
});
</script>
<div class="footer" role="contentinfo"></div>
<div id="spinner" class="spinner" style="display:none;">Loading…</div>
</body>
</html>
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.