From 11b535109c9a1854981c37e37e7d4c0cb93c3839 Mon Sep 17 00:00:00 2001 From: Kostas Stamatis Date: Mon, 21 Oct 2013 14:19:32 +0300 Subject: [PATCH 1/3] change input mapping in data loaders --- ...dspace-addon-submissionlookup-services.xml | 52 +++++++++---------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/dspace-api/src/main/resources/spring/spring-dspace-addon-submissionlookup-services.xml b/dspace-api/src/main/resources/spring/spring-dspace-addon-submissionlookup-services.xml index 9b0e98067e..c49793b612 100644 --- a/dspace-api/src/main/resources/spring/spring-dspace-addon-submissionlookup-services.xml +++ b/dspace-api/src/main/resources/spring/spring-dspace-addon-submissionlookup-services.xml @@ -420,13 +420,13 @@ - - - - - - - + + + + + + + @@ -435,13 +435,13 @@ - - - - - - - + + + + + + + @@ -452,13 +452,13 @@ - - - - - - - + + + + + + + @@ -466,11 +466,11 @@ - - - - - + + + + + From 3d3c6d265398360162cf222f1098aff564bbc701 Mon Sep 17 00:00:00 2001 From: Kostas Stamatis Date: Mon, 21 Oct 2013 14:27:20 +0300 Subject: [PATCH 2/3] message properties changes --- .../src/main/resources/Messages.properties | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/dspace-api/src/main/resources/Messages.properties b/dspace-api/src/main/resources/Messages.properties index fb90eaf48a..ed889d95c6 100644 --- a/dspace-api/src/main/resources/Messages.properties +++ b/dspace-api/src/main/resources/Messages.properties @@ -1684,7 +1684,7 @@ jsp.submit.start-lookup-submission.tabs.search = Search Form jsp.submit.start-lookup-submission.tabs.result = Results jsp.submit.start-lookup-submission.identifiers = Search for identifier -jsp.submit.start-lookup-submission.identifiers.hints = Insert publication identifiers - usually insert one identifier get accurate results, by the way is preferrable the DOI. +jsp.submit.start-lookup-submission.identifiers.hints = Fill in publication identifiers (DOI is preferable) and then press "Search". A list of all matching publications will be shown to you to select in order to proceed with the submission process. jsp.submit.start-lookup-submission.identifier-doi = DOI (Digital Object Identifier) jsp.submit.start-lookup-submission.identifier-doi.hint = e.g. 10.1392/dironix jsp.submit.start-lookup-submission.identifier-pubmed = PubMed ID @@ -1693,7 +1693,7 @@ jsp.submit.start-lookup-submission.identifier-arxiv = arXiv ID jsp.submit.start-lookup-submission.identifier-arxiv.hint = e.g. arXiv:1302.1497 jsp.submit.start-lookup-submission.search = Free search -jsp.submit.start-lookup-submission.search.hints = Insert base info about publication: either title or the couple author / year is required.
If you known an unique identifier about publication like DOI, Pubmed, arXiv you can switch on the identifier search mode. +jsp.submit.start-lookup-submission.search.hints = Insert base info about publication: either title or author/year is required.
If you know any unique identifier about publication like DOI, Pubmed, or arXiv you can switch on the identifier search mode. jsp.submit.start-lookup-submission.search.title = Title jsp.submit.start-lookup-submission.search.year = Year jsp.submit.start-lookup-submission.search.authors = Authors/Publishers @@ -1701,29 +1701,29 @@ jsp.submit.start-lookup-submission.identifier.lookup = Search jsp.submit.start-lookup-submission.search-go = Search jsp.submit.start-lookup-submission.exit = Exit jsp.submit.start-lookup-submission.search-loading.title = Loading... -jsp.submit.start-lookup-submission.search-loading.hint = Quering the external service to retrieve the publication if you desire. Waiting the complete request, if you close this windows the request abort. -jsp.submit.edit-metadata.affiliation.select = Multiple possible matches, please select +jsp.submit.start-lookup-submission.search-loading.hint = Quering the external service to retrieve the requested publications. Please, wait for the request to complete. if you close this window, the request will be aborted. +jsp.submit.edit-metadata.affiliation.select = Multiple possible matches, please select one to proceed! jsp.submit.edit-metadata.affiliation.other = Other jsp.submit.start-lookup-submission.no-collection = No collection selected jsp.submit.start-lookup-submission.no-collection-warn.title = Warning, no collection -jsp.submit.start-lookup-submission.no-collection-warn.hint = The collection of the pubblication is required. +jsp.submit.start-lookup-submission.no-collection-warn.hint = The collection of the publication is required. jsp.submit.start-lookup-submission.manual-submission = Default mode Submission jsp.submit.start-lookup-submission.button.manual-submission = Manual submission jsp.submit.start-lookup-submission.select.collection.label = Select collections: jsp.submit.start-lookup-submission.select.collection.defaultoption = Select... jsp.submit.start-lookup-submission.noresult = No results available! -jsp.submit.start-lookup-submission.js.errormessage = Sorry, an error is occurred. Try again. If this message will show again please, contact administrators and continue to insert the submission manually. Thank you. +jsp.submit.start-lookup-submission.js.errormessage = Sorry, an error occurred. Try again. If this message shows again, please, contact administrators and continue to insert the submission manually. Thank you! jsp.submit.start-lookup-submission.js.detailsbuttonmessage = See details jsp.submit.start-lookup-submission.js.filldataandstartbuttonmessage = Fill data and start submission jsp.submit.start-lookup-submission.js.titlepopupmessage = Publication details jsp.submit.start-lookup-submission.no-collection.dialog.return = I understand jsp.submit.start-lookup-submission.byfile = Upload a file -jsp.submit.start-lookup-submission.byfile.hints = Choose a file to upload, if you want select one publication from the set filled into the file check out the preview mode otherwise choose an owner collection, in the last case all publications will be imported but the first will be open in submission. Check you MyDSpace for others. -jsp.submit.start-lookup-submission.byfile.chooseprovider = Select data provider +jsp.submit.start-lookup-submission.byfile.hints = Select a file to upload and its type from the drop-down menu. If "Preview Mode" is enabled, the list of the publications in the file will be shown to you to select the one for submission. If it is disabled, all publications will be imported in your MyDSpace page as "Unfinished Submissions" while the first one will go through the submission process. +jsp.submit.start-lookup-submission.byfile.chooseprovider = Select data type jsp.submit.start-lookup-submission.byfile.file = File -jsp.submit.start-lookup-submission.byfile.filepreview = Check this if you want the preview mode +jsp.submit.start-lookup-submission.byfile.filepreview = Preview mode jsp.submit.start-lookup-submission.byfile.filecollection = Collection #Versioning From 0553239760139d0d0523b2602b1c639bb9e9a117 Mon Sep 17 00:00:00 2001 From: Panagiotis Koutsourakis Date: Mon, 21 Oct 2013 17:26:29 +0300 Subject: [PATCH 3/3] Changed the handling of temp files Added code that creates a temp directory, and creates unique filenames using the File.createTempFile in that directory. If the temp directory cannot be created for any reason, it tries to use the system defined temporary directory (usually "/tmp" in unix and "C:\\WINNT\\TEMP" in windows). --- .../json/SubmissionLookupJSONRequest.java | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/dspace-jspui/src/main/java/org/dspace/app/webui/json/SubmissionLookupJSONRequest.java b/dspace-jspui/src/main/java/org/dspace/app/webui/json/SubmissionLookupJSONRequest.java index 0712c8d7f5..047e990df7 100644 --- a/dspace-jspui/src/main/java/org/dspace/app/webui/json/SubmissionLookupJSONRequest.java +++ b/dspace-jspui/src/main/java/org/dspace/app/webui/json/SubmissionLookupJSONRequest.java @@ -182,6 +182,7 @@ public class SubmissionLookupJSONRequest extends JSONRequest { // Parse the request List iter; + String filename = null; try { iter = upload.parseRequest(req); for(FileItem item : iter) { @@ -210,8 +211,25 @@ public class SubmissionLookupJSONRequest extends JSONRequest { MultipleSubmissionLookupDataLoader dataLoader = (MultipleSubmissionLookupDataLoader) transformationEngine .getDataLoader(); - File file = new File("test"); - file.createNewFile(); + //Create a subdirectory in the dspace.dir in order to + //write temporary files. Normally we should have + //permission to write there. + File tmp_dir = new File(ConfigurationManager.getProperty("dspace.dir") + File.separator + ".submission_lookup_tmp"); + if (!tmp_dir.exists()) { + //If we could not create the directory, we set the + //File object to null to force File.createTempFile + //below to write in the system defined temporary + //dir. This could pose a security risk, so someone + //with better understanding of security should + //check it. + if (!tmp_dir.mkdir()) { + tmp_dir = null; + } + } + + //Create a temporary file with a unique filename in + //the specified directory + File file = File.createTempFile("submission_lookup", "_tmp", tmp_dir); FileOutputStream out = new FileOutputStream(file); Utils.bufferedCopy(io, out); dataLoader.setFile(file.getAbsolutePath(), valueMap.get("provider_loader")); @@ -227,6 +245,8 @@ public class SubmissionLookupJSONRequest extends JSONRequest { } catch (MalformedSourceException e1) { e1.printStackTrace(); } + + file.delete(); } subDTO.setItems(result); service.storeDTOs(req, suuid, subDTO);