Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bring back calendar download as XML #5639

Merged
merged 3 commits into from
May 15, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.logging.log4j.util.Strings;
matthias-ronge marked this conversation as resolved.
Show resolved Hide resolved
import org.kitodo.production.helper.XMLUtils;
import org.kitodo.production.model.bibliography.course.metadata.CountableMetadata;
import org.kitodo.production.model.bibliography.course.metadata.RecoveredMetadata;
Expand Down Expand Up @@ -861,7 +862,9 @@ private Element issueToXml(Document xml, Set<Pair<Integer, String>> afterDeclara
blockNode.setAttribute(ATTRIBUTE_VARIANT, Integer.toString(index + 1));
}
Element issueNode = xml.createElement(ELEMENT_APPEARED);
issueNode.setAttribute(ATTRIBUTE_ISSUE_HEADING, issue.getHeading());
if (!Strings.isBlank(issue.getHeading())) {
issueNode.setAttribute(ATTRIBUTE_ISSUE_HEADING, issue.getHeading());
}
issueNode.setAttribute(ATTRIBUTE_DATE, issue.getDate().toString());
addMetadataToIssue(xml, issue, issueNode);
Pair<Integer, String> afterDeclaration = Pair.of(index, issue.getHeading());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import java.util.Set;
import java.util.TreeSet;

import org.apache.logging.log4j.util.Strings;
matthias-ronge marked this conversation as resolved.
Show resolved Hide resolved
import org.kitodo.production.helper.DateUtils;

/**
Expand Down Expand Up @@ -100,7 +101,7 @@ private static String titleToString(Block block, boolean subsequentBlock) {
appendDate(result, block.getLastAppearance());
result.append(" regelmäßig ");

result.append(iterateOverIssues(block, result));
iterateOverIssues(block, result);
return result.toString();
}

Expand All @@ -124,8 +125,10 @@ private static String iterateOverIssues(Block block, StringBuilder result) {
}
}
}
result.append(" als ");
result.append(issue.getHeading());
if (!Strings.isBlank(issue.getHeading())) {
result.append(" als ");
result.append(issue.getHeading());
}
if (issueIndex < currentIssuesSize - 2) {
result.append(", ");
}
Expand Down
4 changes: 1 addition & 3 deletions Kitodo/src/main/webapp/pages/calendarEdit.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,9 @@
<p:commandButton value="#{msgs.fileDownload}"
icon="fa fa-download fa-lg"
iconPos="right"
type="button"
ajax="false"
rendered="false"
onclick="setConfirmUnload(false);"
styleClass="secondary">
<!-- TODO disabled for now, because method is never called -->
<p:fileDownload value="#{CalendarForm.download()}"/>
</p:commandButton>

Expand Down