Skip to content

Commit

Permalink
Last UI fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Nathan McMinn committed Nov 16, 2015
1 parent bd07140 commit ed2ab32
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ protected void executeImpl(Action action, NodeRef actionedUponNodeRef)

Boolean inplace = Boolean.valueOf(String.valueOf(action.getParameterValue(PARAM_INPLACE)));
Integer archiveLevel = Integer.valueOf(String.valueOf(action.getParameterValue(PARAM_ARCHIVE_LEVEL)));
String providedName = String.valueOf(action.getParameterValue(PARAM_DESTINATION_NAME));

// get an output file for the new PDF (temp file)
File out = getTempFile(actionedUponNodeRef);
Expand All @@ -122,7 +123,7 @@ protected void executeImpl(Action action, NodeRef actionedUponNodeRef)
ex.printStackTrace();
}

NodeRef destinationNode = createDestinationNode(String.valueOf(ns.getProperty(actionedUponNodeRef, ContentModel.PROP_NAME)),
NodeRef destinationNode = createDestinationNode(getFilename(providedName, actionedUponNodeRef),
(NodeRef)action.getParameterValue(PARAM_DESTINATION_FOLDER), actionedUponNodeRef, inplace);
ContentWriter writer = serviceRegistry.getContentService().getWriter(destinationNode, ContentModel.PROP_CONTENT, true);
writer.setEncoding(cs.getReader(actionedUponNodeRef, ContentModel.PROP_CONTENT).getEncoding());
Expand Down Expand Up @@ -157,6 +158,26 @@ private DocumentFormat getDocumentFormat(int level) {
return format;
}

private String getFilename(String providedName, NodeRef targetNodeRef)
{
NodeService ns = serviceRegistry.getNodeService();

String fileName = null;
if(providedName != null)
{
fileName = String.valueOf(providedName);
if(!fileName.endsWith(FILE_EXTENSION))
{
fileName = fileName + FILE_EXTENSION;
}
}
else
{
fileName = String.valueOf(ns.getProperty(targetNodeRef, ContentModel.PROP_NAME));
}
return fileName;
}

/**
* @param actionedUponNodeRef
* @return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ control parameters in the form config by hiding the div {field.name}-control
<#if form.mode == "view">
<!#-- this control should not be used in view mode -->
<#else>
<input id="${fieldHtmlId}-hidden" type="hidden" name="${field.name}" value="true" />
<input id="${fieldHtmlId}-hidden" type="hidden" name="${field.name}" value="false" />
<input id="${fieldHtmlId}-tohide" type="hidden" name="-" value="${hideProperties}" />
<input class="formsCheckBox" id="${fieldHtmlId}" type="checkbox" tabindex="0" name="-"
value="true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ PDFArchive.Util = {};

for(index in controls)
{
var control = new YAHOO.util.Dom.get((htmlIdPrefix + "_" + controls[index] + "-cntrl"));
var control = new YAHOO.util.Dom.get((htmlIdPrefix + "_" + controls[index]));
var container = control.parentElement;
if(value)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<appearance>
<field id="inplace">
<control template="/org/alfresco/pdfarchival/components/form/controls/hidingCheckbox.ftl">
<control-param name="hideProperties">assoc_destination-folder,prop_destination-name</control-param>
<control-param name="hideProperties">assoc_destination-folder-cntrl,prop_destination-name</control-param>
</control>
</field>
</appearance>
Expand Down

0 comments on commit ed2ab32

Please sign in to comment.