Friday, June 21, 2013

Pagelet Wizard Custom Tags

Pagelet Wizard custom transformations can use special tags documented here to insert images, message catalog entries, or to format numbers and dates. This is great when trying to format currencies or ensure multilingual compliance. The problem with "Post-Transformation Processing," as it is called in PeopleBooks, is that it requires the transformation results to be valid XML. Question: How do you get Pagelet Wizard to generate valid XML when the Xalan processor used by PeopleTools sees HTML tags and automatically generates HTML? Answer: use the <xsl:output> XSL tag. Here is a sample template that produces valid XML:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xhtml="http://www.w3.org/1999/xhtml"
    xmlns="http://www.w3.org/1999/xhtml" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    exclude-result-prefixes="xhtml xsl">

    <xsl:output method="xml" version="1.0" encoding="UTF-8"
        doctype-public="-//W3C//DTD XHTML 1.1//EN" doctype-system="http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"
        indent="yes" />

    <xsl:template match="/">
        <!-- your XSL goes here -->
    </xsl:template>
    
  <!-- identity transform templates -->
  <xsl:template match="*">
    <xsl:apply-templates/>
  </xsl:template>

  <!-- delete unmatched text -->
  <xsl:template match="@*|text()|comment()|processing-instruction()">
  </xsl:template>
  
</xsl:stylesheet>

22 comments:

jb said...

Jim, does any PeopleTools release support HTML5? We are wanting to introduce drag and drop functionality into a calendar page to move work order links from one day to another.
If so, do you have any example of using this functionality in PeopleCode or jscript?

Jim Marion said...

@JB, HTML 5 is more about the browser than the application. The real question is, "Does your organization's chosen browser support HTML 5?" IE 10, Firefox, and Chrome all support this type of thing. IE 8 doesn't. IE 9 supports some of it.

If your browser supports the new HTML 5 drag and drop, you can build a calendar that uses it.

Note: You don't need HTML 5 for drag and drop. The jQuery UI library has draggable and droppable interactions. PeopleTools 8.53 includes jQuery UI, but you can use it with any web based version of PeopleTools. In our PeopleSoft systems, we have been using Drag and drop for nearly a decade. PeopleTools 8.50 added drag/drop support to pagelets on homepages, but that had nothing to do with the HTML specification or browser support. It was just a developer writing JavaScript to make it happen.

Tom Mannanchery said...

Hi Jim,

I just had a general question about the Pagelet Wizard. What do you think are the possible risks when functional users (non-developers) create pagelets using the Pagelet Wizard? Is it really safe to give Pagelet Wizard access to functional users?

I know this is a very open ended question; just wanted to get your views.

Thanks,
Tom

Jim Marion said...

@Tom, it is a good question, and probably not one that I am qualified to fully answer. All I can tell you is what I have considered myself in regards to this question. In my opinion navigation collection, pivot grid, and query based pagelets are safe when using delivered display formats EXCEPT custom. Query seems safe, except for the button at the bottom that says, "Customize." The problem with the customize option is that it gives a user the opportunity to inject malicious JavaScript that can either run on a homepage or in a Workcenter. The HTML data type seems pretty safe as well, as long as you don't have the view source button enabled. I have used the Integration Broker data type to execute remote web services and transform the results to HTML. This seems like it could be a potential risk. The URL data type allows a user to inject HTML and JavaScript from a remote site. This seems like a risk. Just FYI, you can disable data types and display formats.

Personally, I think Pagelet Wizard is one of the most powerful development tools in PeopleSoft. I also think that it is critical that key subject matter experts have access to create pagelets in Pagelet Wizard. As far as making it available to everyone? I'm not sure that is safe.

Tom Mannanchery said...

Thanks Jim. :) This really helps with the direction we want to take regarding this.

Daria Kempka said...

Not sure if this is the right place to ask - but is it possible to edit the html for form fields and labels in application designer? Thanks in advance.

Venkata Naga Tetali said...

Hi Jim

Facing an issue BI Publisher report. Tried posting in Oracle forums with no luck.

I have an RTF template where i have three levels of grouping and i want to reset the page number based on the lower group i.e. inner group.

We can use @section only at the higher grouping level. How can we acheive this. Please let me know.

Thanks.
Ravi.

Jim Marion said...

@Ravi, I have no experience with BI/XML Publisher.

Unknown said...

Hi Jim:

I bought both of your books, and I must say they are well written and very information. Thanks for all you do for the community.

I had a question about post processing tags and how it is used. I am have a pagelet created in 9 languages but when I switch to each to a different language, I get still getting ENG and when I make the other language default, (i.e. ESP) I now get esp for all the other language including Eng. How would I be able to use the template you provided? Could you provide a simple sample of how it would work with a phase like (Welcome - Welcome Friend) to Spanish (Bienvenido - Bienvenido Amigo)?


Thanks,
David

Jim Marion said...

@David, thank you, I am glad you enjoyed the books. Credit for the "well written" part goes to my wife who worked very hard editing these books.

For the languages issue, is this in reference to the PSMSGTEXT custom tag?

David PS said...

Thanks so much for your response, Jim. Your wife sure did a great job with the edits. Regarding your question, yes I am referring to the PSMSGTEXT custom tag and how this is used. I created a CSS/HTML pagelet in 8 languages using the pagelet wizard but I cannot get the languages to load based on the language. I reached out to Oracle support and they said they no longer support language transalations for multi language pagelets (Doc ID 1394973.1). Any guidance as to how I can accomplish the pagelet change per language selection will be greatly appreciated.

Thanks again,
David

Jim Marion said...

@David, it is true that Pagelet Wizard's HTML editor no longer supports languages, but message catalog always has, and I would suspect always will (that is the point of the message catalog). I will forward this to development because I believe this is a misunderstanding.

Jim Marion said...

@David, I just chatted with development. In your MyOracle support case, have the rep contact me through e-mail. The rep will be able to find my address. I will connect him/her with the appropriate development staff to resolve this.

David PS said...

Jim, Thanks for your prompt response. I reached out to the Oracle Support analysis already to reach out to you as requested. I assumed you confirmed what was told to me, which we have found quite strange that Oracle would do that. In the meantime, is there another approach you could recommend to resolve this issue?

Thanks,
David

Jim Marion said...

@David, I confirmed exactly the opposite, that PSMSGTEXT should work.

Tom Mannanchery said...

Hi Jim,

I have a question regarding PS Query pagelets created using Pagelet Wizard. Is there a way to always have this pagelet reload/refresh, without using a Custom XSLT? Is there any content reference attribute that can be used?

I am asking this because we have a similar pagelet that sometimes reloads and sometimes doesn't and we are not able to correctly identify in what case it does and doesn't.

Thanks,
Tom

Jim Marion said...

@Tom, good question. By reload, do you mean on a time interval or are you just trying to keep it from caching between homepage visits? I assume you already looked at the CREF attributes of the pagelet that behaves according to your requirements?

Tom Mannanchery said...

Hi Jim,

Thanks a lot for the response.

It is the second one - dont want it to cache between homepage visits.

I am trying to find some place for pagelet attributes and I came across this (http://docs.oracle.com/cd/E38689_01/pt853pbr0/eng/pt/tprt/task_UsingAttributestoEnhancePagelets-717aa0.html) but it didnt help.

Thanks,
Tom

David PS said...

Hi Jim:
I went down the path of trying to using jquery to switch load the correct language section within my HTML, rather than using the XSL transform method with the custom meta tags which just does not seem to work for me.
My issue now is that when I select a language from my language selection pagelet, my custom HTML pagelet loads/switches to the right language but then the Portal Homepage reloads/refreshes and I the default ENG language displays again. Do you know how I can prevent this pagelet from reloading/refreshing? I tried the PSCACHECONTROL attribute already but that did not work.

Thanks, Jim!

David

Jim Marion said...

@David, no, I don't have any recommendations in that regard. After using the pagelet, %Language should have the correct language. If it doesn't, then I would file a bug for this as well.

Tom Mannanchery said...

Hi Jim,

I also tried the attribute PORTAL_NOBROWSERCACHE (value = Y) but no luck. Any other tricks you might know? :)

Thanks,
Tom

Jim Marion said...

@Tom, the easiest one to administer is in Pagelet Wizard step 6. There are other CREF attributes. You might be able to find them by querying PSPRSMATTRVAL