Solution
Use the Attachments Common Components with customized JSP clients associated to that object type.
Prerequisite knowledge
To achieve this objective, you need to have an understanding of the following:
Basic development involving HTML forms, JSP, and JSP custom tags
The wizard is using the Windchill Client Architecture wizard framework
The user is familiar with the actions framework
Solution Elements
Element
Type
Description
attachments.tld
Java tag definition
Defines any common component tags you will need to use the attachments common components.
Runtime location:
codebase\WEB-INF\tlds\ attachments.tld
AttachmentsValidation Helper.class
Java file
Supporting methods for validating various attachments related actions.
Runtime location:
codebase\WEB-INF\lib\ wncWeb.jar
AbstractAttachments SubFormProcessor.class
Java file
General form processing delegate that provides shared attachments functionality to the primary and secondary form processors.
Runtime location:
codebase\WEB-INF\lib\ wncWeb.jar
PrimayAttachment SubFormProcessor.class
Java file
Form processing delegate that attaches primary attachments to the object.
Runtime location:
codebase\WEB-INF\lib\ wncWeb.jar
SecondaryAttachments SubFormProcessor.class
Java file
Form processing delegate that attaches secondary attachments to the object.
Runtime location:
codebase\WEB-INF\lib\ wncWeb.jar
AttachmentsDataUtility Helper.class
Java file
Supporting methods for displaying attachments data in a data utility.
Runtime location:
codebase\WEB-INF\lib\ wncWeb.jar
Procedures
Adding primary content to a wizard
To add primary attachment support to a wizard of an object that implements the FormatContentHolder interface you will need to add the applet tag to the main wizard jsp and the primary attachment tag to a wizard step.
On the main wizard jsp (which defines the <jca:wizard tag and the wizard steps) add the following tag definition and fileSelectionAndUploadApplet tag. The tag will render a tiny invisible applet which is used for file browsing and file uploading.
<%@taglib prefix="attachments"
uri="http://www.ptc.com/windchill/taglib/attachments" %>

<attachments:fileSelectionAndUploadApplet/>v
On the wizard step you will need to add the same taglib definition above (but not the applet tag) and the following tag. This tag will render the actual primary attachment input components such as the file chooser or the url inputs.
<attachments:primaryAttachment/>
Adding secondary attachments to a wizard
To add secondary attachment support to a wizard of an object that implements the ContentHolder interface you will need to add the applet tag to the main wizard jsp and the attachments wizard step.
On the main wizard jsp (which defines the <jca:wizard tag and the wizard steps) add the following tag definition and fileSelectionAndUploadApplet tag. The tag will render a tiny applet which is used for file browsing and file uploading.
<%@taglib prefix="attachments"
uri="http://www.ptc.com/windchill/taglib/attachments" %>

<attachments:fileSelectionAndUploadApplet/>
Inside your wizard definition (inside the <jca:wizard tags) add the following wizard step in the order that you would like it to appear.
<jca:wizardStep action="attachments_step" type="attachments" />
* 
Attachments are not supported in Change Task wizards.
Adding primary attachments to an info page
On your info page jsp you will need to add the following inside the describePropertyPanel tags to get the primary attachment info and download icon included in the info page attributes.
<jca:describeProperty id="primaryAttachmentProperties" label="${primaryLabel}"/>
To get it on the additional attributes info page add this to your object's attributes.jsp
<jsp:include
page="/netmarkets/jsp/attachments/attachments_table.jsp"
flush="true">

<jsp:param name="role" value="PRIMARY" />

</jsp:include>
Adding secondary attachments to an info page
On your object's attributes.jsp add the following to get the secondary attachments to show up under the more attributes sub navigation of the info page.
<jsp:include
page="/netmarkets/jsp/attachments/attachments_table.jsp"
flush="true">
<jsp:param name="role" value="SECONDARY" />
</jsp:include>
Adding Primary attachment actions to an object
In the action model xml file that defines the action model with the menufor attribute for your object type add the following actions. This will provide download or url redirect actions depending on if the object has a primary file or url.
<action name="download_primary_attachment"
type="attachments"/>

<action name="redirect_primary_attachment"
type="attachments"/>

<action name="checkout_and_download" type="wip"/>

<action name="replace_content" type="wip"/>
¿Fue esto útil?