如何从DSpace中的反馈页面的修改版本中获得引荐页面(项目)的标题? [英] How can I get the title of the referring page (item) from a modified version of feedback page in DSpace?
问题描述
如何像在jspui中的推荐此商品"中那样,从修改后的反馈页面中获取商品的标题?我也希望生成页面的结果URL,例如 http://example. com/feedback?handle = 123456789/123 .我在上一篇帖子的评论中提出了此要求,但我不知道如何使用HandleManager.我已经使用itemRequestForm的部分代码尝试了很多次,但是我总是会得到空指针错误.
How can I get the title of an item from a modified version of the feedback page just like in the "Recommend this item" in jspui? I'm hoping also to generate the resulting url of the page to be like http://example.com/feedback?handle=123456789/123. I've asked this from a comment in my previous post but I don't know how to use the HandleManager. I've tried many times using part of the code from itemRequestForm but I always get null pointer error.
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
if (!(dso instanceof Item)) {
return;
}
Request request = ObjectModelHelper.getRequest(objectModel);
boolean firstVisit=Boolean.valueOf(request.getParameter("firstVisit"));
Item item = (Item) dso;
我还尝试查看/ViewArtifacts/sitemap.xmap,但现在我无法找出我所缺少的东西.
I also tried to looked in /ViewArtifacts/sitemap.xmap but right now it is beyond me to figure out what I am missing.
推荐答案
您可以在以下位置获得DS-2099的完整补丁:
You can get the complete patch of DS-2099 at:
https://github.com/arvoConsultores/DSpace/commit/3e971d70daaa4762a443c89fb7fa6f9e5b8e630d.patch
(提示:您可以在github的提交中添加".patch"以查看补丁)
(TIP: you can add ".patch" to a commit at github to view the patch)
我认为在这里发布太久了.
I Think its too long to post here.
检查SolicitarCorreccionForm以显示标题和想要的内容,使用其他响应从句柄获取数据,而不是:
Check SolicitarCorreccionForm to show the title and what you want using my other response to get the data from the handle and instead:
feedback.addPara(T_para1.parameterize(parameters.getParameter("handle","unknown")));
您应该这样做:
String handle=parameters.getParameter("handle","unknown");
// context=new Context(); // Context exist in a form:
DSpaceOBject dso = HandleManager.resolveToObject(context,handle);
if (dso instanceof Item){
Item item=((Item)dso);
DCValue[] titles= item.getMetadata("dc", "contributor", "author",null);
feedback.addPara(titles[0].value); // check for nulls or multiple values;
}
要将标题发送到邮件类别,您应该执行以下操作:
to send the title to the mail class you should do:
feedback.addHidden("title").setValue(titles[0].value);
在Aspects/ViewArtifacts/sitemap.xmap中,您应该设置参数:
And at aspects/ViewArtifacts/sitemap.xmap you should set the parameter:
<map:transform type="SolicitarCorreccionForm">
<map:parameter name="title" value="{title}" />
...
获取SendSolicitarCorreccionAction并发送到电子邮件,以将参数添加到邮件中,例如:
Get at SendSolicitarCorreccionAction and send to email, to add the parameters to the mail like:
String title= request.getParameter("title");
email.addArgument(title); // Titulo
...
您想从
<map:match pattern="solicitarCorreccion/**">
想要的东西.
P.D.-我忘了提起添加SolicitarCorreccionForm的导入:
P.D.- I forget to mention to add imports of SolicitarCorreccionForm:
import org.dspace.content.DCValue;
import org.dspace.content.DSpaceObject;
import org.dspace.content.Item;
import org.dspace.handle.HandleManager;
我希望有帮助.
这篇关于如何从DSpace中的反馈页面的修改版本中获得引荐页面(项目)的标题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!