public Document(final Properties dprop) throws MissedPropertyException,
InvalidPropertyException, MultiplyDefinedException {
super(dprop); // Throws one of the above exception if not valid
- myfile = new File(null, dprop.format, dprop.date); // The path is initialized below
+ myfile = new File(dprop.getLocalPath(), dprop.format, dprop.date); // The path is initialized below
type = dprop.type;
step = dprop.step.getNumber();
name = dprop.name;
encoding.append(scope.getReference()).append("_").append(
tostring.format(number));
} else { // title and (temporarily) asis
- encoding.append("_").append(tostring.format(number)).append(
+ encoding.append(tostring.format(number)).append("_").append(
aDoc.getFile().getName());
}
return encoding.toString();
*/
private String getEncodedRootName(final Document aDoc, final Study scope) {
FileNaming scheme = getProjectSettings().getFileNamingScheme();
-
+ String res;
if (scheme == FileNaming.encoded) {
- return scope.getReference();
+ res = scope.getReference();
+ }else if (scheme == FileNaming.asis) {
+ res = aDoc.getFile().getName();
} else {
- return aDoc.getTitle();
+ res = aDoc.getTitle();
}
+ return res;
}
/**
// Creation of the document
Document.Properties dprop = new Document.Properties();
+ dprop.setLocalPath(upfile.getPath());
Publication addoc;
if (reference.length() == 0) { // Importation of a foreign document
// Versioning of the document
Document.Properties dprop = new Document.Properties();
+ dprop.setLocalPath(upfile.getPath());
Publication current = step.getDocument(docIndex);
Publication next;
Document.Properties dprop = new Document.Properties();
// NOTE: Process only the first attached file for each document
FileDTO file = doc.getFiles().get(0);
+ dprop.setLocalPath(file.getPath());
// Get document title as the file name
java.io.File upfile = new java.io.File(file.getPath());
/**
* Injected project service.
*/
- private ProjectSettingsService _projectSettingsService;
+ private ProjectSettingsService _projectSettings;
/**
* Injected project element service.
* @return Project settings service
*/
private ProjectSettingsService getProjectSettings() {
- return _projectSettingsService;
+ return _projectSettings;
}
/**
*/
public void setProjectSettings(
final ProjectSettingsService projectSettingsService) {
- _projectSettingsService = projectSettingsService;
+ _projectSettings = projectSettingsService;
}
/**
pageEncoding="ISO-8859-1"
%>
<%@taglib prefix="s" uri="/struts-tags"%>
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
-<html>
-
- <head>
- <link href=<s:url value="/skin/default.css"/> rel="stylesheet" type="text/css">
- <script language="JavaScript">
-
+<script language="JavaScript">
function enableUpload () {
-// ------------------------
upform.doIt.disabled = false;
}
- </script>
- </head>
- <body>
-
+</script>
<!-- Updload dialog
=============================================================================================================================
-->
- <div id=article-box>
- <div id=section><s:text name="title.%{nextAction}"/></div>
- <div id=article-body class=text>
- <form name="upform" enctype="multipart/form-data" action="upload" method="post">
- <table>
- <tr height=10><td></td></tr>
- <s:hidden name="nextAction" value="%{nextAction}" />
- <s:hidden name="index" value="%{index}" />
- <s:file name="upload" key="field.upload" onchange="enableUpload()" />
- <tr height=10><td></td></tr>
- <tr>
- <td></td>
- <td align=right>
- <s:submit theme="simple" name="cancel" key="button.cancel"/>
- <s:submit theme="simple" name="doIt" key="button.upload" disabled="true"/>
- </td>
- </tr>
- </table>
- </form>
- </div>
- </div>
- </body>
-</html>
\ No newline at end of file
+<div id=article-box>
+ <div id=section><s:text name="title.%{nextAction}"/></div>
+ <div id=article-body class=text>
+ <form name="upform" enctype="multipart/form-data" action="upload" method="post">
+ <table>
+ <tr height=10><td></td></tr>
+ <s:hidden name="nextAction" value="%{nextAction}" />
+ <s:hidden name="index" value="%{index}" />
+ <s:file name="upload" key="field.upload" onchange="enableUpload()" />
+ <tr height=10><td></td></tr>
+ <tr>
+ <td></td>
+ <td align=right>
+ <s:submit theme="simple" name="cancel" key="button.cancel"/>
+ <s:submit theme="simple" name="doIt" key="button.upload" disabled="true"/>
+ </td>
+ </tr>
+ </table>
+ </form>
+ </div>
+</div>