|
static final String | REPOSITORY_JSP = "/WEB-INF/elephant/admin/repository.jsp" |
|
◆ RepositoryBean()
org.turro.elephant.impl.repository.RepositoryBean.RepositoryBean |
( |
| ) |
|
◆ convertToValidName()
String org.turro.elephant.impl.repository.RepositoryBean.convertToValidName |
( |
String |
fileName | ) |
|
Definition at line 148 of file RepositoryBean.java.
149 return fileName.replaceAll(
"[^a-zA-Z0-9\\-\\_\\.]",
"_");
◆ createFolder()
void org.turro.elephant.impl.repository.RepositoryBean.createFolder |
( |
String |
folder | ) |
|
◆ deleteFile()
void org.turro.elephant.impl.repository.RepositoryBean.deleteFile |
( |
String |
file | ) |
|
Definition at line 99 of file RepositoryBean.java.
100 File f =
new File(getRealPath(file));
102 org.amic.util.file.FileUtil.deleteFile(f);
◆ getConstructor()
IConstructor org.turro.elephant.impl.repository.RepositoryBean.getConstructor |
( |
| ) |
|
◆ getContext()
String org.turro.elephant.impl.repository.RepositoryBean.getContext |
( |
| ) |
|
◆ getFiles()
String [] org.turro.elephant.impl.repository.RepositoryBean.getFiles |
( |
| ) |
|
Definition at line 111 of file RepositoryBean.java.
112 if(!constructor.
isInRole(roleList)) {
113 htmlFiles =
new String[0];
115 if(htmlFiles ==
null) {
116 File f =
new File(getRealPath(
null));
117 File[] children = f.listFiles();
118 TreeSet
set =
new TreeSet();
120 if(subFolder !=
null && subFolder.length() > 0) {
121 folderLink = ElephantContext.getRootWebPath() +
"/xprepository?context=" + context;
124 "<a class='folder' href='" + folderLink +
"'>..</a>" +
127 for(
int i = 0; children !=
null && i < children.length; i++) {
128 folderLink = ElephantContext.getRootWebPath() +
"/xprepository?context=" + context +
"&subfolder=" + children[i].getName();
131 (
isSelectable() ?
"<input type='checkbox' name='check' value ='" + children[i].getName() +
"'/>" :
"") +
132 (children[i].isDirectory() ?
133 "<a class='folder' href='" + folderLink +
"'>" :
134 "<a repository=\"" +
getImageUrl(children[i].getName()) +
"\" class='file'>") +
135 children[i].getName() +
139 htmlFiles = (String[])
set.toArray(
new String[0]);
String getImageUrl(String file)
boolean isInRole(String role)
◆ getImageUrl()
String org.turro.elephant.impl.repository.RepositoryBean.getImageUrl |
( |
String |
file | ) |
|
Definition at line 200 of file RepositoryBean.java.
201 String folderPath =
"repository(" +
202 (subFolder ==
null || subFolder.length() == 0 ?
"" :
"/" + subFolder);
203 return folderPath +
"/" + file +
")";
◆ getRealFolder()
String org.turro.elephant.impl.repository.RepositoryBean.getRealFolder |
( |
| ) |
|
◆ getSubFolder()
String org.turro.elephant.impl.repository.RepositoryBean.getSubFolder |
( |
| ) |
|
◆ isSelectable()
boolean org.turro.elephant.impl.repository.RepositoryBean.isSelectable |
( |
| ) |
|
◆ setConstructor()
void org.turro.elephant.impl.repository.RepositoryBean.setConstructor |
( |
IConstructor |
constructor | ) |
throws Exception |
Definition at line 164 of file RepositoryBean.java.
165 this.constructor = constructor;
166 if(ServletFileUpload.isMultipartContent(constructor.
getRequest()) && constructor.
isInRole(roleUpload)) {
167 FileItemFactory factory =
new DiskFileItemFactory();
168 ServletFileUpload upload =
new ServletFileUpload(factory);
169 List items = upload.parseRequest(constructor.
getRequest());
170 Iterator iter = items.iterator();
171 while (iter.hasNext()) {
172 FileItem item = (FileItem) iter.next();
173 if(!item.isFormField()) {
174 String onlyName = item.getName();
175 if(onlyName !=
null && onlyName.length() > 0) {
176 int p = onlyName.lastIndexOf(
'/');
177 if(p == -1) p = onlyName.lastIndexOf(
'\\');
179 if(realName.matches(validUploads)) {
180 File uploadedFile =
new File(realName);
181 item.write(uploadedFile);
188 String[] check = constructor.
getRequest().getParameterValues(
"check");
190 for(
int i = 0; i < check.length; i++) {
String convertToValidName(String fileName)
void createFolder(String folder)
void deleteFile(String file)
HttpServletRequest getRequest()
String getParameter(String param)
◆ setContext()
void org.turro.elephant.impl.repository.RepositoryBean.setContext |
( |
String |
context | ) |
|
◆ setRoleCreateDir()
void org.turro.elephant.impl.repository.RepositoryBean.setRoleCreateDir |
( |
String |
value | ) |
|
◆ setRoleDelete()
void org.turro.elephant.impl.repository.RepositoryBean.setRoleDelete |
( |
String |
value | ) |
|
◆ setRoleList()
void org.turro.elephant.impl.repository.RepositoryBean.setRoleList |
( |
String |
value | ) |
|
◆ setRoleUpload()
void org.turro.elephant.impl.repository.RepositoryBean.setRoleUpload |
( |
String |
value | ) |
|
◆ setRootPath()
void org.turro.elephant.impl.repository.RepositoryBean.setRootPath |
( |
String |
value | ) |
|
◆ setSelectable()
void org.turro.elephant.impl.repository.RepositoryBean.setSelectable |
( |
boolean |
selectable | ) |
|
◆ setSubFolder()
void org.turro.elephant.impl.repository.RepositoryBean.setSubFolder |
( |
String |
subFolder | ) |
|
◆ setValidUploads()
void org.turro.elephant.impl.repository.RepositoryBean.setValidUploads |
( |
String |
value | ) |
|
Definition at line 79 of file RepositoryBean.java.
80 String sep =
"", values[] = value.split(
" *, *");
82 for(
int i = 0; i < values.length; i++) {
83 if(values[i].equals(
"images")) {
84 validUploads += sep + VALID_IMAGES;
87 else if(values[i].equals(
"html")) {
88 validUploads += sep + VALID_HTML;
91 if(values[i].equals(
"documents")) {
92 validUploads += sep + VALID_DOCUMENTS;
96 validUploads = VALID_PATTERN.replaceAll(
"#", validUploads);
◆ REPOSITORY_JSP
final String org.turro.elephant.impl.repository.RepositoryBean.REPOSITORY_JSP = "/WEB-INF/elephant/admin/repository.jsp" |
|
static |
The documentation for this class was generated from the following file: