Custom report name in openerp - report

When I print my report, it display the name of the report like this
for selection of one record
"Delivery Slip-OUT_00057.pdf"
for selection of two record
"Delivery Slip-OUT_00057-OUT_00056.pdf"
SO for me, it is enough to show only
"Delivery Slip.pdf"
In both the cases, without editing in the base class
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<report
id="stock.report_picking_list_out"
model="stock.picking.out"
name="stock.picking.list.out"
string="Delivery Slip"
rml="XXXXX_stock_ext/report/delivery_slip.rml"
/>
</data>

Related

Marklogic xdmp:node-insert-child adds empty xmlns

When I run the following code, I end up with an empty xmlns in the node that was added:
declare namespace myns = "http://hello.com/myns";
xdmp:node-insert-child(
fn:doc($file)/myns:results,
<event ts="{fn:current-dateTime()}">Removed</event>)
Result:
<?xml version="1.0" encoding="UTF-8"?>
<results xmlns="http://hello.com/myns">
<event ts="2018-09-21T15:23:23">Created</event>
<event ts="2018-09-21T15:23:28" xmlns="">Removed</event>
</results>
This causes a log of issues, any idea why this happens?
This is because the Created event is already in the http://hello.com/myns namespace. But the Removed event is not in any namespace, so that's why you're seeing xmlns="" in the XML, which designates it a no-namespace element.
If you want them all in the same namespace, you can prefix the event you are inserting or add a default namespace declaration:
<myns:event ts="...">
<event xmlns="http://hello.com/myns" ts="...">

AEM Workflow - set values in a custom dialog from with data gathered in previous process step

My overall goal is: launch a process step that runs a java class that gathers a list, then in the next workflow step this list needs to be displayed inside a custom dialog.
This is what i have so far:
Java Class that uses the metadata put and saves the list into the metadata
The custom dialog made that uses a textarea which is where this list needs to be displayed
Another Java class that retrieves gets the list from the metadata
The issue i have now is: how can i get the list from the metadata to show in my custom dialog?
I been searching for ages and seems like no one has ever done it before
Please note: this answer was tested and developed on AEM 6.3
Here is a simple granite UI widget to display ALL of the key/value pair in the current workflow MetaDataMap (including ones set in previous workflow steps)
First, let's create the workflow dialog:
create a component under apps: /apps/so-wf-test/wf-components/wf-metadata
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
componentGroup=".hidden"
jcr:primaryType="cq:Component"
jcr:title="A dummy component needed for the dialog"
sling:resourceSuperType="foundation/components/parbase"/>
Create the dialog: /apps/so-wf-test/wf-components/wf-metadata/cq:dialog
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
jcr:primaryType="nt:unstructured"
jcr:title="Display all workflow metadata"
sling:resourceType="cq/gui/components/authoring/dialog">
<content
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/container">
<layout
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/layouts/fixedcolumns"/>
<items jcr:primaryType="nt:unstructured">
<columns
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/container">
<items jcr:primaryType="nt:unstructured">
<metadataList
jcr:primaryType="nt:unstructured"
sling:resourceType="/apps/so-wf-test/wf-granite-widgets/wf-metadata-list"/>
</items>
</columns>
</items>
</content>
</jcr:root>
note that above dialog includes a custom granite widget to display the metdata list: <metadataList jcr:primaryType="nt:unstructured" sling:resourceType="/apps/so-wf-test/wf-granite-widgets/wf-metadata-list"/>
Now The granite widget JSP
create sling folder: /apps/so-wf-test/wf-granite-widgets/wf-metadata-list
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
jcr:primaryType="sling:Folder"/>
Inside create wf-metadata-list.jsp:
This can be done via Use API or sling models with HTL Or via a servlet. I went with JSP for fast solution for the purposes of this answer.
<%#include file="/libs/granite/ui/global.jsp"%><%
%><%#page import="com.adobe.granite.workflow.WorkflowSession,
com.adobe.granite.workflow.exec.WorkItem,
com.adobe.granite.workflow.exec.WorkflowData,
com.adobe.granite.workflow.metadata.MetaDataMap,
org.slf4j.Logger,
org.slf4j.LoggerFactory"%>
<%
// get a logger
Logger logger = LoggerFactory.getLogger(this.getClass());
// when a workflow dialog is requested, the workitem id is passed as an attribute "item"
String workitemId = request.getParameter("item");
// get workflow session
WorkflowSession wfSession = resourceResolver.adaptTo(WorkflowSession.class);
// get the current workitem
WorkItem workitem = wfSession.getWorkItem(workitemId);
// get workflow data
WorkflowData workflowData = workitem.getWorkflowData();
// get metadata map
MetaDataMap metaDataMap = workflowData.getMetaDataMap();
%>
<h1>MetaDataMap Values:</h1>
<ul>
<%
// Iterate over metaDataMap and print all key/val pairs to a list item
for (Object entry : metaDataMap.keySet())
{
Object objVal = metaDataMap.get(entry);
String val = objVal == null ? "" : objVal.toString();
%>
<li><h3><%=entry%>: <%=val%></h3></li>
<%
}
%>
</ul>
** Now just wire the dialog into your dialog workflow step **
using the path /apps/so-wf-test/dialogs/wf-dialog/cq:dialog"
Once the workflow reaches the dialog step, you'll see the list of metadata items.
Example:
I have created a working example that has the simple steps
step 1: add "someKey"="SOME VALUE" to MetaDataMap
step 2: get "someKey" and print it
step 3: dialog step pointing to dialog above
Here is a sceenshot of the dialog:
Here is a package you can download and install
https://drive.google.com/file/d/0B-_At1NXpw0EOFNaUVdYcGVHNnM/view?usp=sharing&resourcekey=0-a_8b0SoC25dxwTTCHw2vRg

Can I create a Razor view that renders Rss in asp.net mvc 3?

I know that to generate rss I can use built-in classes like SyndicationFeed and Rss20FeedFormatter. Also I know that it can be done with custom classes and aspx view.
But if I want to create custom feed objects and custom view, can I do this using razor?
Here is my view:
<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<h2>#Model.Title</h2>
<div><b>Description:</b> #Model.Description</div>
<div><b>Language:</b> #Model.Language</div>
Subscribe to this Feed
#foreach (var item in Model.Items)
{
<h3>
Title: #item.Title
</h3>
<div>
<img width="75" height="75" src="#Url.Action("GetImage", "Store", new { productId = item.ProductId })"/>
</div>
<div><b>Description:</b> #item.Description</div>
<div><b>Creator:</b> #item.Creator</div>
<div><b>Date published</b> #item.Published</div>
<div>
place order on Ozon
</div>
#Html.ActionLink("go to item", "ItemInformation", "Store", new {itemId = item.ItemId}, new {#class = "averageLink"})
}
</channel>
</rss>
Other questions:
1) I don't know how exactly to implement "subscription" link: what value to assign to the #Model.Url?
2) It generates html, mabby instead I need to serialize my feed objects into xml document and return it with a custom XmlResult : ActionResult?
Edit 1: Mabby I somehow can use built-in classes and custom feed model together?
Edit 2: The reason I don't want to use the existing classes is because I need to use Html.ActionLink() and Url.Action() helpers. If I serialize feed object into xml how would I use these helper methods?
Thanks for help in advance!
Your view code is producing html, not the xml that is needed for an rss feed (you are including elements like div and h3 that are part of html).
To produce a view that outputs RSS, the layout of the view should replicate the RSS standard.
For example:
#model MyProject.Models.RssModel
#{ Layout = null }
<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title>#model.FeedTitle</title>
<description>#model.FeedDescription</description>
<link>#model.FeedLink</link>
<lastBuildDate>#model.LastBuildDate</lastBuildDate>
<pubDate>#model.PubDate</pubDate>
<ttl>#model.Ttl</ttl>
#foreach (var item in Model.Items)
{
<item>
<title>#item.Title</title>
<description>#item.Description</description>
<link>#item.Url</link>
<guid>#item.Id</guid>
<pubDate>#item.PublicationDate</pubDate>
</item>
}
</channel>
</rss>
However, you may want to consider a different approach: returning a result from your Controller Action that will generate the RSS directly. You can see examples of this approach in this blog post or described in this answer.

ASP.NET XML Control DocumentContent Property

I am using ASP.NET XML control and on Page Load event I am updating its DocumentContent property but the problem is data isn't being shown. The control is empty on page load.
xmlDIMenuSource.DocumentContent = "<Menu><Parent ID="1" Name="Order" SortOrder="1"><Child ID="21" Name="Create an Order" URL="../Order/OrderCapturingv4.aspx?Action=new" SortOrder="1" /><Child ID="32" Name="Import a Style" URL="../Order/OrderCapturingv4.aspx?Action=import" SortOrder="2" /></Menu>";
Use valid XML. Plus, if this is VB.Net, you do not need the semi-colon at the end of the expression. Try this...
xmlDIMenuSource.DocumentContent = "<?xml version="1.0" encoding="utf-8" ?><Menu><Parent ID="1" Name="Order" SortOrder="1"><Child ID="21" Name="Create an Order" URL="../Order/OrderCapturingv4.aspx?Action=new" SortOrder="1" /><Child ID="32" Name="Import a Style" URL="../Order/OrderCapturingv4.aspx?Action=import" SortOrder="2" /></Parent></Menu>"

Problem with setting the xml dataprovider for combo box

I am trying to get the drop down list of combobox by using a php file. That php file returns an xml string which has been used as data provider for combobox.
I followed this thread too but in vain.
Details
I have set the creationComplete attribute of mx:Application to init(). In the init() function i have sent the following HTTPService
<mx:HTTPService id="interfaces" url="interfaces.php" resultFormat="e4x" method="POST">
</mx:HTTPService>
Combo Box:
Update:
The xml should look like
<?xml version=\"1.0\" encoding=\"utf-8\"?>
<ifaces>
<iface>
<option>eth0</option>
</iface>
<iface>
<option>eth1</option>
</iface>
</ifaces>
but if i execute interfaces.php in browser the only things that gets display is
eth0eth1
whereas i am echoing the string that contains whole xml data. Shouldn't whole xml type of string display? :(
The problem is that ifaces is the root element of your XML, so interfaces.lastResult == ifaces. So the XMLList you want is interfaces.lastResult.iface.
This is a whole main class that works for me:
`<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical"
initialize="{interfaces.send();}">
<mx:HTTPService id="interfaces" url="interfaces.xml" resultFormat="e4x" method="POST">
</mx:HTTPService>
<mx:ComboBox dataProvider="{interfaces.lastResult.iface}" labelField="option"/>
</mx:Application>`

Resources