-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added ability to read files from dotCMS, not only from the harddisk.
- Loading branch information
1 parent
325b19f
commit 9cc90e2
Showing
11 changed files
with
272 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<tool> | ||
<key>excel</key> | ||
<scope>application</scope> | ||
<scope>request</scope> | ||
<class>nl.isaac.dotcms.excelreader.viewtool.ExcelReaderTool</class> | ||
</tool> | ||
|
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package nl.isaac.dotcms.excelreader.shared; | ||
|
||
import javax.servlet.http.HttpServletRequest; | ||
|
||
import com.dotmarketing.util.WebKeys; | ||
|
||
public class RequestUtil { | ||
public static boolean isLiveMode(HttpServletRequest request) { | ||
return !(isEditMode(request) || isPreviewMode(request)); | ||
} | ||
|
||
public static boolean isEditMode(HttpServletRequest request) { | ||
Object EDIT_MODE_SESSION = request.getSession().getAttribute(com.dotmarketing.util.WebKeys.EDIT_MODE_SESSION); | ||
if(EDIT_MODE_SESSION != null) { | ||
return Boolean.valueOf(EDIT_MODE_SESSION.toString()); | ||
} | ||
return false; | ||
} | ||
|
||
public static boolean isPreviewMode(HttpServletRequest request) { | ||
Object PREVIEW_MODE_SESSION = request.getSession().getAttribute(com.dotmarketing.util.WebKeys.PREVIEW_MODE_SESSION); | ||
if(PREVIEW_MODE_SESSION != null) { | ||
return Boolean.valueOf(PREVIEW_MODE_SESSION.toString()); | ||
} | ||
return false; | ||
} | ||
|
||
public static Integer getLanguage(HttpServletRequest request) { | ||
return (Integer)request.getSession().getAttribute(WebKeys.HTMLPAGE_LANGUAGE); | ||
} | ||
|
||
public static Integer getSelectedLanguage(HttpServletRequest request) { | ||
return (Integer)request.getSession().getAttribute(WebKeys.LANGUAGE); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
src/nl/isaac/dotcms/excelreader/util/ExcelReaderDotCMSFileKey.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package nl.isaac.dotcms.excelreader.util; | ||
|
||
import com.dotmarketing.beans.Host; | ||
|
||
public class ExcelReaderDotCMSFileKey extends ExcelReaderFileKey { | ||
private final Host host; | ||
private final boolean live; | ||
|
||
public ExcelReaderDotCMSFileKey(String path, Host host, boolean live) { | ||
super(path); | ||
this.host = host; | ||
this.live = live; | ||
} | ||
|
||
public Host getHost() { | ||
return host; | ||
} | ||
|
||
public boolean isLive() { | ||
return live; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object obj) { | ||
if (obj instanceof ExcelReaderDotCMSFileKey) { | ||
ExcelReaderDotCMSFileKey key = (ExcelReaderDotCMSFileKey)obj; | ||
return super.equals(key) && | ||
key.getHost().getHostname().equals(getHost().getHostname()) && | ||
(key.isLive() == isLive()); | ||
} | ||
return false; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return super.toString() + "_" + getHost().getHostname() + "_" + isLive(); | ||
} | ||
|
||
} |
32 changes: 32 additions & 0 deletions
32
src/nl/isaac/dotcms/excelreader/util/ExcelReaderFileKey.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package nl.isaac.dotcms.excelreader.util; | ||
|
||
public class ExcelReaderFileKey { | ||
private final String path; | ||
|
||
public ExcelReaderFileKey(String path) { | ||
this.path = path; | ||
} | ||
|
||
public String getPath() { | ||
return path; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object obj) { | ||
if (obj instanceof ExcelReaderFileKey) { | ||
return ((ExcelReaderFileKey)obj).getPath().equals(getPath()); | ||
} | ||
return false; | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return getPath().hashCode(); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return getPath(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.