Skip to content

Commit

Permalink
url parameter in json is ready
Browse files Browse the repository at this point in the history
  • Loading branch information
opakdil authored and opakdil committed Nov 1, 2011
1 parent 6011719 commit 3bf4ce4
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 25 deletions.
2 changes: 1 addition & 1 deletion elfinder-servlet/pom.xml
Expand Up @@ -3,7 +3,6 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.elfinder</groupId>
<artifactId>elfinder-servlet</artifactId>
<packaging>war</packaging>
<version>1.0.2-SNAPSHOT</version>
<description>Java backend for "elFinder".</description>
<build>
Expand Down Expand Up @@ -137,4 +136,5 @@
<version>1.4</version>
</dependency>
</dependencies>
<packaging>war</packaging>
</project>
Expand Up @@ -13,7 +13,7 @@
import org.elfinder.servlets.config.AbstractConnectorConfig;

/**
* @author Özkan Pakdil
* @author Özkan Pakdil
* @date 29 aug. 2011
* @version $Id$
* @license BSD
Expand Down
Expand Up @@ -35,8 +35,15 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response)
private void processRequest(HttpServletRequest request, HttpServletResponse response) throws IOException {
int width = (!StringUtils.isEmpty(request.getParameter("w"))) ? Integer.valueOf(request.getParameter("w")) : 150;
String path = request.getParameter("p");
Boolean real = request.getParameter("r") != null;
BufferedImage b = null;

if (real) {
b = ImageIO.read(new File(ElfinderConnectorServlet.HOME_SHARED_DOCS + path));
ImageIO.write(b, "png", response.getOutputStream());
return;
}

BufferedImage image = ImageIO.read(new File(ElfinderConnectorServlet.HOME_SHARED_DOCS + path));

ResampleOp rop = new ResampleOp(DimensionConstrain.createMaxDimension(width, -1));
Expand Down
Expand Up @@ -491,30 +491,12 @@ protected Map<String, Object> _info(File path) {
info.put("write", isDir ? config._isAllowedExistingDir(path, FileActionEnum.WRITE) : config._isAllowedExistingFile(path, FileActionEnum.WRITE));
info.put("rm", isDir ? config._isAllowedExistingDir(path, FileActionEnum.DELETE) : config._isAllowedExistingFile(path, FileActionEnum.WRITE));

if(mimeType.contains("image"))
info.put("tmb", isDir ? "" : encodeFileNameForOutput(_path2url(path)));

// if ($type == 'link') {
// if (false == ($lpath = $this->_readlink($path))) {
// $info['mime'] = 'symlink-broken';
// return $info;
// }
// if (is_dir($lpath)) {
// $info['mime'] = 'directory';
// } else {
// $info['parent'] = $this->_hash(dirname($lpath));
// $info['mime'] = $this->_mimetype($lpath);
// }
// $info['link'] = $this->_hash($lpath);
// $info['linkTo'] = ($this->_options['rootAlias'] ? $this->_options['rootAlias'] : basename($this->_options['root'])).substr($lpath, strlen($this->_options['root']));
// $info['read'] = $this->_isAllowed($lpath, 'read');
// $info['write'] = $this->_isAllowed($lpath, 'write');
// $info['rm'] = $this->_isAllowed($lpath, 'rm');
// } else {
// $lpath = '';
// }
if(mimeType.contains("image")){
info.put("tmb", encodeFileNameForOutput(_path2url(path)));
info.put("url", encodeFileNameForOutput(_path2url(path)) + "&r=1") ;
}

if (!isDir) {
if (!isDir && !mimeType.contains("image")) {
if (config.isFileUrlEnabled() && true == (Boolean) info.get("read")) {
info.put("url", encodeFileNameForOutput(_path2url(path)));
}
Expand Down
4 changes: 4 additions & 0 deletions elfinder-servlet/src/main/webapp/WEB-INF/web.xml
Expand Up @@ -15,6 +15,10 @@
<param-name>THUMBNAIL</param-name>
<param-value>/servlet/thumbnailer?p=</param-value>
</context-param>
<context-param>
<param-name>REALOBJECTURL</param-name>
<param-value>/servlet/thumbnailer?p=</param-value>
</context-param>
<context-param>
<param-name>SHARED_DOCS</param-name>
<param-value>Shared docsüğişçö</param-value>
Expand Down

0 comments on commit 3bf4ce4

Please sign in to comment.