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>

31 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

Kevin Weaver said...

Jim,

I am pretty new to pagelet wizard, however I have been really digging in lately and I have created a couple of query based pagelets and added the documented tags to format the currency. What I have done is used the pagelet wizard configuration to create my hyperlinks and then pressed the customized link and modified the xlst to insert my custom tags. My question is, Is this post intended for writing the entire xlst from scratch or is there a way to perform a second xlst to deliver the custom tags to the xml for post processing?

Thanks!

Kevin

Jim Marion said...

@Kevin, this post is for starting from "scratch." If you customize a delivered XSL, just make sure it has the xsl:output tag. That is really all I'm highlighting here.

Kevin Weaver said...

Thanks Jim,

I was working on a Blog post on using the Pagelet Wizard for Related Content, I know it is not traditional use for Pagelet Wizard, but I wanted to to utilize the way it can take query output and format it into HTML. Take a look at my posting and let me know what you think.

Thanks

http://pskcw.blogspot.com/2014/05/using-pagelet-wizard-in-related-content.html

Jim Marion said...

@Kevin, Nice! I was thinking about the same thing, but in a different context. I wanted to pass query parameters in the pagelet wizard URL.

Kevin Weaver said...

Hey Jim,

I think I have my next Collaborate Presentation. I took my Pagelet Wizard for Related Content posting and modified the JavaScript to open links defined within Pagelet Wizard in a jQuery ColorBox over the TargetContent Frame. The results are just stunning. Check it out when you get a chance.

Using Related Content and jQuery lightbox to turn any PeopleSoft Transaction into a Dashboard.

Thanks,

Kevin

Jim Marion said...

@Kevin, Something went wrong with your link. Here is a new one Using Related Content and jQuery lightbox to turn any PeopleSoft Transaction into a Dashboard.. I think you should give a presentation on creating Pagelet Wizard Data Types and Display Formats. You can use your two blog posts as examples.

JCook said...

Hi Jim,

Thanks for this. I have an issue. I am using jQuery JavaScript Library v1.7.2 for a Thickbox iframe. It works great on some pages, but not on others. After debugging I noticed that on the pages that did not work, the thickbox JqThickboxJs was loading before the jQuery library JqCopyJs. On the pages that worked jQuery library JqCopyJs was loading first.

Any thoughts on why two pages would act differently?

Jim Marion said...

@JCook, since PeopleSoft does not use jQuery, I assume your organization added the tags, etc to load jQuery and plugins. What method are you using to load jQuery and plugins? Are they loaded on homepages through Pagelets? Are you injecting them through createElement? Did you add them to the header? The way you add jQuery and plugins to a page determines how they are loaded. If you use pagelets, then jQuery loads according to the pagelet load order and then the plugin load order. Even though you may be using script tags, Pagelets are loaded asynchronously after the the homepage loads, so there is no guarantee that the scripts will load synchronously using the standard script tag behavior.

One way to ensure your scripts load properly is to use something like $script.js. I like this library because it is small enough to embed. Since many pagelets may require the same JavaScript libraries, check for their existence before loading them. For example, if(!window.jQuery) or if(!window.jQuery.fn.zClip) or if(!window.jQuery.ui)...

JCook said...

Jim,

Thanks for your Quick response. I am loading the jQuery library on MYRECORD.MYHTMLAREA.RowInit

Listed below is sample code:

&url = %Response.GetJavaScriptURL(HTML.JQUERY_LIB);

&copyurl = GenerateScriptContentURL(%Portal, %Node, Record.WEBLIB_MYJSL, Field.ISCRIPT1, "FieldFormula", "IScript_JqCopyJs");

MYRECORD.MYHTMLAREA.Value = GetHTMLText(HTML.MYJS_LIB, &url, &copyurl);