Can someone tweak this js for me?

Associate
Joined
27 Nov 2003
Posts
2,481
Location
Loughborough
Long story short, we have a html based dashboard that shows information down the side of the work area. This particular part has an expander on that I don't want in there and I haven't got the foggiest idea which part to remove.

Can anyone highlight the relevant code/take it off so it just displays without requiring you to click the + ? Thanks (I hope) :)

Code:
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1" %>
<%@ page import="com.aibuild.ui.uiserver.*" %>
<%@ page import="com.aibuild.util.*" %>
<%@ page import="java.util.*" %>
<%// Create and hook up the objects we need...
DashboardPartServer thisDashboard = new DashboardPartServer(pageContext);
ContextInformation context = thisDashboard.getContext();
/////////////////////////////////////////////////////////////////////%>
<%
    String ordref = context.getParameter("ordref");
    if (StringUtil.isEmpty(ordref))
    {
        thisDashboard.hidePart();
        return;
    }
    String product = context.getParameter("product");
    if (StringUtil.isEmpty(product))
    {
        thisDashboard.hidePart();
        return;
    }
    String customer = context.getParameter("customer");
    if (StringUtil.isEmpty(customer))
    {
        thisDashboard.hidePart();
        return;
    }
 customer = customer.replaceAll("&","&amp;");
    String priority = context.getParameter("priority");
    //String titleStr = "Sales Promotions for order "+ordref;
    String titleStr = "<font color='ff0000'><strong>Promotion Available</strong></font>";

    Promotions promotions = (Promotions)context.getService("promotions");
    ArrayList<Promotion> PromotionList = promotions.getPromotionsByOrder(product, ordref, customer, priority);
    
    StringBuffer strHTML = new StringBuffer();

/*
                     for (int i = 0; i < PromotionList.size();i++)
    {
        //strHTML.append("<b>Promotion No.").append(i+1).append("</b><br/>\n");
        Promotion promotion = PromotionList.get(i);
        //if (!StringUtil.isEmpty(promotion.pCode))
        //    strHTML.append("PCode:").append(promotion.pCode).append("<br/>\n");
        // The promotion.text is HTML and may contain images etc, so you might not want to show it.
        //if (!StringUtil.isEmpty(promotion.text))
        //    strHTML.append(promotion.text).append("<br/>\n");
        //if (!StringUtil.isEmpty(promotion.customerText))
        //    strHTML.append(promotion.customerText).append("<br/>\n");
        //if (!StringUtil.isEmpty(promotion.description))
        //    strHTML.append(promotion.description).append("<br/>\n");
        if (!StringUtil.isEmpty(promotion.smallText))
            strHTML.append(promotion.smallText).append("<br/>\n");
    }
    
*/
                    for (int i = 0; i < PromotionList.size();i++)
    {
    Promotion promotion = PromotionList.get(i);

    Expander exp = thisDashboard.getExpander();
                     // A fixed section always appears before the expandable bit
                     // exp.addFixedSection(promotion.customerText);
                     StringBuffer promStr = new StringBuffer();
                     promStr.append(promotion.smallText).append("<br/>\n");
                     //promStr.append("<font color='red' >").append(promotion.smallText).append("</font><br/>\n");

                     //promStr.append("<font color='red' >").append(promotion.customerText).append("</font><br/>\n");
                     //promStr.append("PCode:").append(promotion.pCode).append("<br/>\n");

                    if (!StringUtil.isEmpty(promotion.text))
                    promStr.append(promotion.text).append("<br/>\n");
                    //if (!StringUtil.isEmpty(promotion.customerText))
                   //  strHTML.append(promotion.customerText).append("<br/>\n");
                   //if (!StringUtil.isEmpty(promotion.description))
                   //  promStr.append(promotion.description).append("<br/>\n");
                   //if (!StringUtil.isEmpty(promotion.smallText))
                   //promStr.append(promotion.smallText).append("<br/>\n");

                   exp.addSection(promStr.toString());
                   strHTML.append(exp.render());

    }

    thisDashboard.renderPart(titleStr, strHTML.toString());
%>
 
That's not javascript, it looks like some kind of Java-based templating system that runs on the server and spits our raw HTML.

Probably worth looking at the Expander class definition because it's not obvious from that snippet how it works. Alternatively, do away with the Expander entirely and append the contents directly to strHTML.
 
Back
Top Bottom