Skip to content

Commit

Permalink
Fixed path issues with static
Browse files Browse the repository at this point in the history
  • Loading branch information
Puneet Behl committed Mar 25, 2016
1 parent 5aff29f commit 2ddbcfc
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 7 deletions.
51 changes: 51 additions & 0 deletions grails-app/conf/plugin.groovy
@@ -0,0 +1,51 @@
/*
* Copyright 2016 Stefano Gualdi
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

ckeditor {
config = "/js/myckconfig.js"
skipAllowedItemsCheck = false
defaultFileBrowser = "ofm"
upload {
basedir = "/uploads/"
overwrite = false
link {
browser = true
upload = false
allowed = ['txt']
denied = ['html', 'htm', 'php', 'php2', 'php3', 'php4', 'php5',
'phtml', 'pwml', 'inc', 'asp', 'aspx', 'ascx', 'jsp',
'cfm', 'cfc', 'pl', 'bat', 'exe', 'com', 'dll', 'vbs', 'js', 'reg',
'cgi', 'htaccess', 'asis', 'sh', 'shtml', 'shtm', 'phtm']
}
image {
browser = true
upload = true
allowed = ['jpg', 'gif', 'jpeg', 'png']
denied = []
}
flash {
browser = false
upload = false
allowed = ['swf']
denied = []
}
}
}

grails.resources.pattern = '/**'
grails.resources.uri.prefix = ''


Expand Up @@ -19,6 +19,7 @@ package grails.plugins.ckeditor
import grails.converters.JSON
import grails.plugins.ckeditor.utils.FileUtils
import grails.plugins.ckeditor.utils.ImageUtils
import grails.plugins.ckeditor.utils.MimeUtils
import grails.plugins.ckeditor.utils.PathUtils
import groovy.json.StreamingJsonBuilder

Expand Down Expand Up @@ -90,7 +91,7 @@ class OpenFileManagerConnectorController {
extra_js_async: true
],
icons: [
path: "${resource(dir: 'js/ofm/images/fileicons', plugin: 'ckeditor')}",
path: "${resource(dir: 'js/ofm/images/fileicons')}",
directory: "_Open.png",
default: "default.png"
]
Expand Down Expand Up @@ -329,7 +330,7 @@ class OpenFileManagerConnectorController {
def properties
if (file.isDirectory()) {
path = PathUtils.checkSlashes(path, "L+ R+", true)
preview = g.resource(dir: "js/ofm/images/fileicons", file: "_Open.png", plugin: "ckeditor")
preview = resource(dir: "js/ofm/images/fileicons", file: "_Open.png")
fileType = 'dir'
properties = [
'Date Created': '',
Expand All @@ -344,20 +345,20 @@ class OpenFileManagerConnectorController {
fileType = fileParts.ext?.toString()?.toLowerCase()
fileSize = file.length()

preview = g.resource(dir: "js/ofm/images/fileicons", file: "${fileParts.ext.toLowerCase()}.png", plugin: "ckeditor")
preview = resource(dir: "js/ofm/images/fileicons", file: "${fileParts.ext.toLowerCase()}.png")
if (fileType in CkeditorConfig.OFM_IMAGE_EXTS) {
if (showThumbs) {
def config = grailsApplication.config.ckeditor
if (config?.upload?.baseurl) {
if (config?.upload?.baseurl?.startsWith("http")) {
preview = PathUtils.checkSlashes(config?.upload?.baseurl, "R-") + baseUrl + path
preview = resource(file: PathUtils.checkSlashes(config?.upload?.baseurl, "R-") + baseUrl + path)
}
else {
preview = PathUtils.checkSlashes(config?.upload?.baseurl, "L+ R-") + baseUrl + path
preview = resource(file: PathUtils.checkSlashes(config?.upload?.baseurl, "L+ R-") + baseUrl + path)
}
}
else {
preview = g.resource(file: baseUrl + path)
preview = resource(file: baseUrl + path)
}
}
def imgDim = ImageUtils.calculateImageDimension(file, fileType)
Expand Down
Expand Up @@ -48,7 +48,6 @@ class PathUtils {
typeName = WordUtils.capitalize(typeName)
baseUrl += "/" + typeName
}

return baseUrl
}

Expand Down

0 comments on commit 2ddbcfc

Please sign in to comment.