versions = versionable.getVersions();
}
}
boolean canVersion = versions != null && !versions.getRevisions().isEmpty();
VFSLeaf leaf = null;
if (child instanceof VFSLeaf) {
leaf = (VFSLeaf)child;
}
boolean isContainer = (leaf == null); // if not a leaf, it must be a container...
MetaInfo metaInfo = null;
if(child instanceof OlatRelPathImpl) {
metaInfo = MetaInfoFactory.createMetaInfoFor((OlatRelPathImpl)child);
}
boolean lockedForUser = MetaInfoHelper.isLocked(metaInfo, fc.getIdentityEnvironnement());
String name = child.getName();
String pathAndName = currentContainerPath;
if (pathAndName.length() > 0 && !pathAndName.endsWith("/"))
pathAndName = pathAndName + "/";
pathAndName = pathAndName + name;
String type = FolderHelper.extractFileType(child.getName(), translator.getLocale());
// tr begin, set alternating bgcolor
sb.append("<tr");
bgFlag = !bgFlag;
if (bgFlag) { sb.append(" class=\"b_table_odd\""); }
sb.append("><td class=\"b_first_child\">");
// add checkbox for actions if user can write or delete to this directory
if (canWrite || canDelete) {
sb.append("<input type=\"checkbox\" class=\"b_checkbox\" name=\"");
sb.append(FileSelection.FORM_ID);
sb.append("\" value=\"");
sb.append(StringEscapeUtils.escapeHtml(name));
sb.append("\" />");
}
// browse link pre
sb.append("<a href=\"");
if (isContainer) { // for directories... normal module URIs
ubu.buildURI(sb, null, null, pathAndName, iframePostEnabled ? AJAXFlags.MODE_TOBGIFRAME : AJAXFlags.MODE_NORMAL);
sb.append("\"");
if (iframePostEnabled) { // add ajax iframe target
StringOutput so = new StringOutput();
ubu.appendTarget(so);
sb.append(so.toString());
}
} else { // for files, add PARAM_SERV command
ubu.buildURI(sb, new String[] { PARAM_SERV }, new String[] { "x" }, pathAndName, AJAXFlags.MODE_NORMAL);
sb.append("\" target=\"_blank\"");
}
// icon css
sb.append(" class=\"b_with_small_icon_left ");
if (isContainer) sb.append(CSSHelper.CSS_CLASS_FILETYPE_FOLDER);
else sb.append(CSSHelper.createFiletypeIconCssClassFor(name));
sb.append("\"");
// file metadata
if (metaInfo != null) {
sb.append(" ext:qtip=\"<div class='b_ext_tooltip_wrapper b_briefcase_meta'>");
if (StringHelper.containsNonWhitespace(metaInfo.getTitle())) {
sb.append("<h5>").append(Formatter.escapeDoubleQuotes(metaInfo.getTitle())).append("</h5>");
}
if (StringHelper.containsNonWhitespace(metaInfo.getComment())) {
sb.append(Formatter.escapeDoubleQuotes(metaInfo.getComment()));
}
String author = metaInfo.getAuthor();
if (StringHelper.containsNonWhitespace(author)) {
sb.append("<p>").append(Formatter.escapeDoubleQuotes(translator.translate("mf.author")));
sb.append(": ").append(Formatter.escapeDoubleQuotes(author)).append("</p>");
}
sb.append("</div>\"");
}
sb.append(">");
// name
if (isAbstract) sb.append("<i>");
sb.append(name);
if (isAbstract) sb.append("</i>");
sb.append("</a></td><td>");
// filesize
if (!isContainer) {
// append filesize
sb.append(StringHelper.formatMemory(leaf.getSize()));
}
sb.append("</td><td>");
// type
if (isContainer) {