📄 cmsexplorer.java
字号:
int startat = 0;
int stopat = resources.size();
int selectedPage = 1;
int numberOfPages = 0;
int maxEntrys = getSettings().getUserSettings().getExplorerFileEntries();
if (!(galleryView || showVfsLinks)) {
selectedPage = getSettings().getExplorerPage();
if (stopat > maxEntrys) {
// we have to split
numberOfPages = (stopat / maxEntrys) + 1;
if (selectedPage > numberOfPages) {
// the user has changed the folder and then selected a page for the old folder
selectedPage = 1;
}
startat = (selectedPage - 1) * maxEntrys;
if ((startat + maxEntrys) < stopat) {
stopat = startat + maxEntrys;
}
}
}
// set the right project
CmsProject project;
try {
if (!listView) {
project = getCms().readProject(getSettings().getProject());
} else {
project = getCms().readProject(getSettings().getExplorerProjectId());
}
} catch (CmsException ex) {
project = getCms().getRequestContext().currentProject();
}
// read the list of project resource to select which resource is "inside" or "outside"
List projectResources;
try {
projectResources = getCms().readProjectResources(project);
} catch (CmsException e) {
// use an empty list (all resources are "outside")
if (LOG.isInfoEnabled()) {
LOG.info(e);
}
projectResources = new ArrayList();
}
for (int i = startat; i < stopat; i++) {
CmsResource res = (CmsResource)resources.get(i);
CmsLock lock = null;
String path = getCms().getSitePath(res);
try {
lock = getCms().getLock(res);
} catch (CmsException e) {
lock = CmsLock.getNullLock();
LOG.error(e);
}
content.append("top.aF(");
// position 1: name
content.append("\"");
content.append(res.getName());
content.append("\",");
// position 2: path
if (showVfsLinks || galleryView || listView) {
content.append("\"");
content.append(path);
content.append("\",");
} else {
//is taken from top.setDirectory
content.append("\"\",");
}
// position 3: title
if (showTitle) {
String title = "";
try {
title = getCms().readPropertyObject(
getCms().getSitePath(res),
CmsPropertyDefinition.PROPERTY_TITLE,
false).getValue();
} catch (CmsException e) {
getCms().getRequestContext().saveSiteRoot();
try {
getCms().getRequestContext().setSiteRoot("/");
title = getCms().readPropertyObject(
res.getRootPath(),
CmsPropertyDefinition.PROPERTY_TITLE,
false).getValue();
} catch (Exception e1) {
// should usually never happen
if (LOG.isInfoEnabled()) {
LOG.info(e);
}
} finally {
getCms().getRequestContext().restoreSiteRoot();
}
}
content.append("\"");
if (title != null) {
content.append(CmsEncoder.escapeWBlanks(title, CmsEncoder.ENCODING_UTF_8));
}
content.append("\",");
} else {
content.append("\"\",");
}
// position 4: type
content.append(res.getTypeId());
content.append(",");
// position 5: link count
if (res.getSiblingCount() > 1) {
// links are present
if (res.isLabeled()) {
// there is at least one link in a marked site
content.append("2");
} else {
// common links are present
content.append("1");
}
} else {
// no links to the resource are in the VFS
content.append("0");
}
content.append(",");
// position 6: size
content.append(res.getLength());
content.append(",");
// position 7: state
content.append(res.getState());
content.append(",");
// position 8: layoutstyle
int layoutstyle = CmsExplorer.LAYOUTSTYLE_INRANGE;
if (res.getDateReleased() > getCms().getRequestContext().getRequestTime()) {
layoutstyle = CmsExplorer.LAYOUTSTYLE_BEFORERELEASE;
} else if ((res.getDateExpired() < getCms().getRequestContext().getRequestTime())) {
layoutstyle = CmsExplorer.LAYOUTSTYLE_AFTEREXPIRE;
}
content.append(layoutstyle);
content.append(',');
// position 9: project
int projectId = res.getProjectLastModified();
if (!lock.isNullLock()
&& lock.getType() != CmsLock.TYPE_INHERITED
&& lock.getType() != CmsLock.TYPE_SHARED_INHERITED) {
// use lock project ID only if lock is not inherited
projectId = lock.getProjectId();
}
content.append(projectId);
content.append(",");
// position 10: date of last modification
if (showDateLastModified) {
content.append("\"");
content.append(getMessages().getDateTime(res.getDateLastModified()));
content.append("\",");
} else {
content.append("\"\",");
}
// position 11: user who last modified the resource
if (showUserWhoLastModified) {
content.append("\"");
try {
content.append(getCms().readUser(res.getUserLastModified()).getName());
} catch (CmsException e) {
content.append(res.getUserLastModified().toString());
}
content.append("\",");
} else {
content.append("\"\",");
}
// position 12: date of creation
if (showDateCreated) {
content.append("\"");
content.append(getMessages().getDateTime(res.getDateCreated()));
content.append("\",");
} else {
content.append("\"\",");
}
// position 13 : user who created the resource
if (showUserWhoCreated) {
content.append("\"");
try {
content.append(getCms().readUser(res.getUserCreated()).getName());
} catch (CmsException e) {
content.append(res.getUserCreated().toString());
}
content.append("\",");
} else {
content.append("\"\",");
}
// position 14: date of release
if (showDateReleased) {
content.append("\"");
long release = res.getDateReleased();
if (release != CmsResource.DATE_RELEASED_DEFAULT) {
content.append(getMessages().getDateTime(release));
} else {
content.append(CmsTouch.DEFAULT_DATE_STRING);
}
content.append("\",");
} else {
content.append("\"\",");
}
// position 15: date of expiration
if (showDateExpired) {
content.append("\"");
long expire = res.getDateExpired();
if (expire != CmsResource.DATE_EXPIRED_DEFAULT) {
content.append(getMessages().getDateTime(expire));
} else {
content.append(CmsTouch.DEFAULT_DATE_STRING);
}
content.append("\",");
} else {
content.append("\"\",");
}
// position 16: permissions
if (showPermissions) {
content.append("\"");
try {
content.append(getCms().getPermissions(getCms().getSitePath(res)).getPermissionString());
} catch (CmsException e) {
getCms().getRequestContext().saveSiteRoot();
try {
getCms().getRequestContext().setSiteRoot("/");
content.append(getCms().getPermissions(res.getRootPath()).getPermissionString());
} catch (Exception e1) {
content.append(CmsStringUtil.escapeJavaScript(e1.getMessage()));
} finally {
getCms().getRequestContext().restoreSiteRoot();
}
}
content.append("\",");
} else {
content.append("\"\",");
}
// position 17: locked by
if (lock.isNullLock()) {
content.append("\"\",");
} else {
content.append("\"");
try {
content.append(getCms().readUser(lock.getUserId()).getName());
} catch (CmsException e) {
content.append(CmsStringUtil.escapeJavaScript(e.getMessage()));
}
content.append("\",");
}
// position 18: type of lock
content.append(lock.getType());
content.append(",");
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -