MyFaces Trinidad
  1. MyFaces Trinidad
  2. TRINIDAD-951

Printable output mode produces javascript errors

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.2.2-core
    • Fix Version/s: 1.0.8-core, 1.2.8-core
    • Component/s: None
    • Labels:
      None
    • Environment:
      Jdk 1.6, Jetty 6.1.5, Facelets 1.1.13, MyFaces JSF 1.2.2, Trinidad 1.2.2

      Description

      A page rendered with trinidad-config.xml output-mode set to printable contains javascript errors. The example below (widgetList.xhtml) contains a couple of command buttons and a table. When the command button 'Printable Page' is clicked it sets the requestScope.outputMode to 'printable' and this is used to drive the output-mode setting in trinidad-config.xml. Looking at the generated html, it looks like there is no reference to the usual javascript file required by Trinidad (DebugCommon1_2_2.js or Common1_2_2.js).

      trinidad-config.xml:
      ===============
      <?xml version="1.0"?>
      <trinidad-config xmlns="http://myfaces.apache.org/trinidad/config">
      <!--
      Enable this setting to cause Trinidad to generate debug output.
      <debug-output>true</debug-output>
      -->
      <skin-family>tn</skin-family>
      <output-mode>#

      {requestScope.outputMode}</output-mode>
      </trinidad-config>


      Test file: widgetList.xhtml:
      ====================
      <!DOCTYPE html
      PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
      <tr:document id="testForm" title="test form"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:tr="http://myfaces.apache.org/trinidad">
      <tr:panelBorderLayout>
      <tr:form id="widgetListForm">
      <tr:panelGroupLayout layout="vertical">
      <tr:commandButton text="Create New Widget"
      action="dialog:widgetDialog"
      useWindow="true" partialSubmit="true"
      windowHeight="300" windowWidth="400"
      id="createWidgetCommand">
      <tr:setActionListener from="#{widgetListBean.newWidgetBean}"
      to="#{pageFlowScope.widgetBean}" />
      <tr:setActionListener from="#{'create'}"
      to="#{pageFlowScope.widgetBean.operation}" />
      </tr:commandButton>

      <tr:commandButton text="Refresh Page" id="refreshCommand">
      </tr:commandButton>

      <tr:commandButton text="Printable Page" id="printablePageCommand">
      <tr:setActionListener from="#{'printable'}"
      to="#{requestScope.outputMode}

      " />
      </tr:commandButton>

      <tr:table id="widgetTable" var="widgetBean"
      value="#

      {widgetListBean.widgetList}

      " rowBandingInterval="1"
      partialTriggers="refreshCommand createWidgetCommand widgetTable:editWidgetCommand widgetTable:deleteWidgetCommand">
      <tr:column>
      <f:facet name="header">
      <tr:outputText value="Widget Name" />
      </f:facet>
      <tr:outputText value="#

      {widgetBean.name}

      " />
      </tr:column>
      <tr:column>
      <f:facet name="header">
      <tr:outputText value="Actions" />
      </f:facet>
      <tr:panelGroupLayout layout="horizontal">
      <tr:commandLink action="dialog:widgetDialog"
      useWindow="true" partialSubmit="true"
      windowHeight="300" windowWidth="400"
      id="editWidgetCommand"
      shortDesc="Edit the widget.">
      <tr:image source="/skins/tn/images/ico_edit.gif" />
      <tr:setActionListener from="#

      {'edit'}

      "
      to="#

      {widgetBean.operation}" />
      <tr:setActionListener from="#{widgetBean}"
      to="#{pageFlowScope.widgetBean}" />
      </tr:commandLink>
      <tr:commandLink action="dialog:widgetDialog"
      useWindow="true" partialSubmit="true"
      windowHeight="300" windowWidth="400"
      id="deleteWidgetCommand"
      shortDesc="Delete the widget."
      returnListener="#{widgetListBean.processReturn}">
      <tr:image source="/skins/tn/images/ico_delete.gif" />
      <tr:setActionListener from="#{'delete'}"
      to="#{widgetBean.operation}

      " />
      <tr:setActionListener from="#

      {widgetBean}

      "
      to="#

      {pageFlowScope.widgetBean}

      " />
      </tr:commandLink>
      </tr:panelGroupLayout>
      </tr:column>
      </tr:table>

      </tr:panelGroupLayout>
      </tr:form>

      </tr:panelBorderLayout>
      </tr:document>

        Activity

        Hide
        Cristi Toth added a comment -

        I fixed some renderers using statement similar to this:

        if (supportsScripting(rc))

        { ....... old code rendering scripts ...... }

        this is because in output mode printable scripting is disabled
        so no need for rendering scripts or on event handlers

        they usually generated js erros because the js dependencies were not found

        Show
        Cristi Toth added a comment - I fixed some renderers using statement similar to this: if (supportsScripting(rc)) { ....... old code rendering scripts ...... } this is because in output mode printable scripting is disabled so no need for rendering scripts or on event handlers they usually generated js erros because the js dependencies were not found
        Hide
        Cristi Toth added a comment -

        btw, thanks to Harald Kuhn for most of the bits of code

        Show
        Cristi Toth added a comment - btw, thanks to Harald Kuhn for most of the bits of code

          People

          • Assignee:
            Cristi Toth
            Reporter:
            Joe Rossi
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development