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) {
sb.append(translator.translate("Directory"));
}
else {
if (type.equals(TYPE_FILE)) {
sb.append(translator.translate("UnknownFile"));
}
else {
sb.append(type.toUpperCase());
sb.append(" ").append(translator.translate(TYPE_FILE));
}
}
sb.append("</td><td>");
if(canContainerVersion) {
if (canVersion)
sb.append(versions.getRevisionNr());
sb.append("</td><td>");
}
// last modified
long lastModified = child.getLastModified();
if (lastModified != VFSConstants.UNDEFINED)
sb.append(DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, translator.getLocale()).format(new Date(lastModified)));
else
sb.append("-");
sb.append("</td><td>");
//locked
if(metaInfo != null) {
if(metaInfo.isLocked()) {
Identity lockedBy = identityMap.get(metaInfo.getLockedBy());
if(lockedBy == null) {
lockedBy = metaInfo.getLockedByIdentity();
if(lockedBy != null) {
identityMap.put(lockedBy.getKey(), lockedBy);
}
}
sb.append("<span class=\"b_small_icon b_briefcase_locked_file_icon\" ext:qtip=\"");
if(lockedBy != null) {
String firstName = lockedBy.getUser().getProperty(UserConstants.FIRSTNAME, translator.getLocale());
String lastName = lockedBy.getUser().getProperty(UserConstants.LASTNAME, translator.getLocale());
String date = "";
if(metaInfo.getLockedDate() != null) {
date = fc.getDateTimeFormat().format(metaInfo.getLockedDate());
}
sb.append(translator.translate("Locked", new String[]{firstName, lastName, date}));
}
sb.append("\"> </span>");
}
}
sb.append("</td><td class=\"b_last_child\">");
// Info link
if (canWrite) {
String nameLowerCase = name.toLowerCase();
if (!lockedForUser &&
(nameLowerCase.endsWith(".html") || nameLowerCase.endsWith(".htm") || nameLowerCase.endsWith(".txt")
|| nameLowerCase.endsWith(".css"))) {
sb.append("<a href=\"");
ubu.buildURI(sb, new String[] { PARAM_CONTENTEDITID }, new String[] { Integer.toString(pos) }, 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());
}
sb.append(" ext:qtip=\"").append(StringEscapeUtils.escapeHtml(translator.translate("editor")));
sb.append("\" class=\"b_small_icon b_briefcase_edit_file_icon\"></a>");
}
boolean canMetaData = MetaInfoHelper.canMetaInfo(child);
if(canMetaData) {
if(lockedForUser) {
// Metadata link disabled...
sb.append("<span ext:qtip=\"")
.append(StringEscapeUtils.escapeHtml(translator.translate("edit")))
.append("\" class=\" b_small_icon b_briefcase_edit_meta_dis_icon\"> </span>");
} else {
// Metadata edit link... also handles rename for non-OlatRelPathImpls
sb.append("<a href=\"");
ubu.buildURI(sb, new String[] { PARAM_EDTID }, new String[] { Integer.toString(pos) }, 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());
}
sb.append(" ext:qtip=\"")
.append(StringEscapeUtils.escapeHtml(translator.translate("mf.edit")))
.append("\" class=\" b_small_icon b_briefcase_edit_meta_icon\"></a>");
}
}
if(canVersion) {
//Versions link
if(lockedForUser) {
sb.append("<span ext:qtip=\"")
.append(StringEscapeUtils.escapeHtml(translator.translate("versions")))
.append("\" class=\" b_small_icon b_briefcase_versions_dis_icon\"> </span>");
} else {
sb.append("<a href=\"");
ubu.buildURI(sb, new String[] { PARAM_VERID }, new String[] { Integer.toString(pos) }, 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());
}
sb.append(" ext:qtip=\"")
.append(StringEscapeUtils.escapeHtml(translator.translate("versions")))
.append("\" class=\" b_small_icon b_briefcase_versions_icon\"></a>");
}