Dear all
I want to add "hyperlink" on the Submission "Upload" step.
(hyperlink 001.png, hyperlink 002.png)
I imitate "description" method that I add hyperlink method on the
Submission "Upload" step.
Bitstream.java
UploadStep.java
SubmissionController.java
choose-file.jsp
upload-file-list.jsp
My DB always can not crawl hyperlink information.
How do I need to rewrite the program?
[dspace-source]\dspace-api\src\main\java\org\dspace\content\
Bitstream.java
------------------------------------------------------------------------------------
public String getHyperlink()
{
return getMetadataFirstValue(MetadataSchema.DC_SCHEMA, "hyperlink",
null, Item.ANY);
}
public void setHyperlink(String n) {
System.out.println("setHyperlink2="+n);
setMetadataSingleValue(MetadataSchema.DC_SCHEMA, "hyperlink", null,
null, n);
---------------------------------------------------------------------------------------------
[dspace-source]\dspace-api\src\main\java\org\dspace\submit\step\
UploadStep.java
---------------------------------------------------------------------------------------------
//attempt to get description from attribute first, then direct from a
parameter
String fileDescription = (String) request.getAttribute(param +
"-description");
if(fileDescription==null ||fileDescription.length()==0)
{
fileDescription = request.getParameter("description");
System.out.println("UploadStep description1="+fileDescription);
}
//attempt to get hyperlink from attribute first, then direct from a
parameter
String fileHyperlink = (String) request.getAttribute("hyperlink");
if(fileHyperlink==null ||fileHyperlink.length()==0)
{
fileHyperlink = request.getParameter("hyperlink");
System.out.println("UploadStep hyperlink1="+fileHyperlink);
}
b.setDescription(fileDescription);
b.setHyperlink(fileHyperlink);
// Update to DB
b.update();
---------------------------------------------------------------------------------------------
[dspace-source]\dspace-jspui\src\main\java\org\dspace\app\webui\servlet\
SubmissionController.java
---------------------------------------------------------------------------------------------
protected void doDSPost(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException
{
.
....
......
//to safely store the file in the repository we have to add it as a
bitstream to the appropriate item (or to be specific its bundle). Instead
of rewriting this //code,we should use the same code, that's used for the
"old" file upload (which is not using JS).
SubmissionInfo si = getSubmissionInfo(context, request);
UploadStep us = new UploadStep();
request.setAttribute(fileName + "-path", filePath);
request.setAttribute(fileName + "-inputstream", fileInputStream);
request.setAttribute(fileName + "-description",
request.getParameter("description"));
request.setAttribute(fileName + "-hyperlink",request.getParameter("hyperlink
"));
int uploadResult = us.processUploadFile(context, request, response, si);
.
...
.....
}
public void uploadFiles(Context context, HttpServletRequest request)
throws ServletException
{
..
....
......
//save this file's info to request (for UploadStep class)
request.setAttribute(fileName + "-path", filePath);
request.setAttribute(fileName + "-inputstream", fileInputStream);
request.setAttribute(fileName + "-description",
wrapper.getParameter("description"));
request.setAttribute(fileName +"-hyperlink", wrapper.getParameter("hyperlink
"));
}
---------------------------------------------------------------------------------------------
choose-file.jsp
---------------------------------------------------------------------------------------------
.
..
$('.resumable-list tbody')
.append(
'<tr>' +
'<td class="resumable-file-'+file.uniqueIdentifier+'">Uploading</td>' +
'<td class="resumable-file-name"></td>' +
'<td class="resumable-file-progress text-center"></td>' +
'<td class="resumable-file-description-'+file.uniqueIdentifier+'"><input
class="form-control" type="text" name="description[' + file.fileName + ']"
id="tdescription"></td>' +
'<td class="resumable-file-extlink-'+file.uniqueIdentifier+'"><input
type="checkbox" name="extlink" value="t"/><fmt:message
key="jsp.submit.choose-file.extlink.info" /></td>' +
'<td class="resumable-file-hyperlink-'+file.uniqueIdentifier+'"><input
class="form-control" type="text" name="hyperlink[' + file.fileName + ']"
id="thyperlink" size="60" placeholder="請輸入網址"></td>' +
'</tr>'
);
..
....
.......
---------------------------------------------------------------------------------------------
upload-file-list.jsp
---------------------------------------------------------------------------------------------
.
..
...
<td headers="t8" class="<%= row %>RowOddCol">
<%= (bitstreams[i].getHyperlink() == null || bitstreams[i].getHyperlink
().equals("")
? LocaleSupport.getLocalizedMessage(pageContext,
"jsp.submit.upload-file-list.empty1")
: bitstreams[i].getHyperlink()) %>
<button type="submit" class="btn btn-default pull-right"
name="submit_Hyperlink_<%= bitstreams[i].getID() %>" value="<fmt:message
key="jsp.submit.upload-file-list.button1"/>">
<span class="glyphicon glyphicon-pencil"></span> <fmt:message
key="jsp.submit.upload-file-list.button1"/>
</button>
</td>
..
....
---------------------------------------------------------------------------------------------
Any advice will be surely helpful,
Sincerely yours, Yen-Tang Chen
************************************************************************************************
Yen-Tang Chen
Lib. Information Technology Services Div., NTU Library,
http://www.lib.ntu.edu.tw/en
office: No. 1, Sec 4, Roosevelt Road, Taipei 10617, Taiwan, R.O.C.
TEL:886-2-33662291
************************************************************************************************
--
You received this message because you are subscribed to the Google Groups
"DSpace Technical Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/dspace-tech.
For more options, visit https://groups.google.com/d/optout.