Output this screen using HTML.
@exception DBException File exception.
17658
public void parseStreamPrintHtml(PrintWriter out, InputStream streamIn)
    {
        XMLParser parser = ((BaseParserScreen)this.getScreenField()).getXMLParser();
        if (parser != null)
        {
            parser.printHtmlData(out, streamIn);
            parser.free();
            parser = null;
        }
        else
        {
            Utility.transferURLStream(null, null, new InputStreamReader(streamIn), out);
        }
    }
677229
public void render() throws IOException, JspException {

        boolean isNewFunctionType = OpenCms.getResourceManager().matchResourceType(
            CmsResourceTypeFunctionConfig.TYPE_NAME,
            m_element.getResource().getTypeId());
        if (isNewFunctionType) {
            CmsFunctionFormatterBean function = getFormatterBean(m_cms);
            if (function != null) {
                CmsUUID jspId = function.getRealJspId();
                if (jspId != null) {
                    CmsJspTagInclude.includeTagAction(
                        m_context,
                        m_cms.getRequestContext().removeSiteRoot(function.getRealJspRootPath()),
                        null,
                        m_cms.getRequestContext().getLocale(),
                        false,
                        m_cms.getRequestContext().getCurrentProject().isOnlineProject(),
                        function.getParameters(),
                        CmsRequestUtil.getAttributeMap(m_request),
                        m_request,
                        m_response);
                } else {
                    m_context.getOut().print(defaultHtml(m_request));
                }
            } else {
                m_context.getOut().print(defaultHtml(m_request));
            }
        } else {
            CmsDynamicFunctionBean.Format format = getFunctionFormat();
            if ((format != null) && m_cms.existsResource(format.getJspStructureId())) {
                try {
                    CmsResource jspResource = m_cms.readResource(format.getJspStructureId());
                    Map<String, String[]> params = new HashMap<>();
                    for (Entry<String, String> paramEntry : format.getParameters().entrySet()) {
                        params.put(paramEntry.getKey(), new String[] {paramEntry.getValue()});
                    }
                    CmsJspTagInclude.includeTagAction(
                        m_context,

                        m_cms.getSitePath(jspResource),
                        null,
                        m_cms.getRequestContext().getLocale(),
                        false,
                        m_cms.getRequestContext().getCurrentProject().isOnlineProject(),
                        params,
                        CmsRequestUtil.getAttributeMap(m_request),
                        m_request,
                        m_response);
                } catch (CmsException e) {
                    LOG.error(e.getLocalizedMessage(), e);
                }
            } else {
                m_context.getOut().print(defaultHtml(m_request));
            }
        }
    }
994801
public void printHtmlMenuStart(PrintWriter out, ResourceBundle reg)
        throws DBException
    {
        this.printHtmlBanner(out, reg);
        this.printHtmlLogo(out, reg);
        this.printHtmlMenubar(out, reg);

        String strHTML = reg.getString("htmlTableStart");
        strHTML = Utility.replaceResources(strHTML, reg, null, null);
        if ((strHTML == null) || (strHTML.length() == 0))
            strHTML = "<table border=\"0\" cellspacing=\"10\" width=\"100%\">\n<tr>";
        out.println(strHTML);

        this.printHtmlNavMenu(out);

        strHTML = reg.getString("htmlContentStart");
        if ((strHTML == null) || (strHTML.length() == 0))
            strHTML = "<td valign=\"top\">";
        out.println(strHTML);
    }
746353
public boolean printData(PrintWriter out, int iPrintOptions)
    {
        this.setLastBreak(this.isBreak());
        if (!this.isLastBreak())
            return false;
        if ((iPrintOptions & HtmlConstants.FOOTING_SCREEN) != HtmlConstants.FOOTING_SCREEN)
            this.setLastBreak(false);     // For footers only

        boolean bInputFound = super.printData(out, iPrintOptions);
        
        return bInputFound;
    }
1002080
public void doProcessOutput(BasicServlet servlet, HttpServletRequest req, HttpServletResponse res, PrintWriter outExt, ScreenModel screen) 
        throws ServletException, IOException
    {
        PrintWriter out = outExt;
        if (screen == null)
        {
        	if (out != null)
        		out.println("Error: default screen not available");
        }
        else
        {
            try
            { // create and execute the query
                // if no parameters, just print the form
                String strDatatype = this.getProperty(DBParams.DATATYPE); // Raw data (such as in image from the DB)
                if (strDatatype == null)
                {
                    if (out == null)
                        out = servlet.getOutputStream(res); // Always
                    ((ScreenModel)screen).printReport(out);
                }
                else
                {       // Raw data output
                    ((ScreenModel)screen).getScreenFieldView().sendData(req, res);
                }
                screen.free();
                screen = null;
            }
            catch (DBException ex) {
                if (out != null)
                {
                    out.println("<hr>*** SQLException caught ***<p>");
                    out.println("Message:  " + ex.getMessage() + "<br>");
                    ex.printStackTrace(out);
                }
                ex.printStackTrace();
            }
            catch (java.lang.Exception ex) {
                ex.printStackTrace();
            } finally {
            	if (outExt == null)
            		if (out != null)
            			out.close();
            }
        }
    }
689932
public function render()
    {
        $exception_context = array(
            'type'=> get_called_class(),
            'code'=> $this->getCode() . ' [severity: ' . $this->getSeverity() . ']',
            'message'=>$this->getMessage(),
            'line'=>$this->getLine(),
            'file'=>$this->getFile(),
        );
        $this->webservices->log(
            $this->webservices->getOption('error_log_mask'), $exception_context, Logger::CRITICAL
        );
        $this->webservices->log(
            $this->getTraceAsString(), array(), Logger::CRITICAL
        );
        $this->webservices->getResponse()
            ->addContent('error', $exception_context);
        $this->webservices->display();
    }
1072031
public void printScreenFieldData(ScreenComponent sField, PrintWriter out, int iPrintOptions)
    {
        ((HScreenField)((ScreenField)sField).getScreenFieldView()).printHtmlHeading(out);
        ((HScreenField)((ScreenField)sField).getScreenFieldView()).printDisplayControl(out);
    }
1224698
public void printHtmlNavMenu(PrintWriter out)
        throws DBException
    {
        String strHTML = null, strStart = null, strEnd = null;
        ResourceBundle reg = ((BaseApplication)this.getTask().getApplication()).getResources(HtmlConstants.HTML_RESOURCE, false);

        char ch = HBasePanel.getFirstToUpper(this.getProperty(DBParams.NAVMENUS), ' ');
        if (ch != UserInfoModel.NO_ICONS.charAt(0))
        {
            String strMenu = this.getProperty(DBParams.MENU); // This user's nav menu
            if ((strMenu == null) || (strMenu.length() == 0))
                strMenu = "NavMenu";
            if (ch == UserInfoModel.ICONS_ONLY.charAt(0))  /** Icons only */
            {
                strStart = reg.getString("htmlNavIconsOnlyStart");
                strHTML = reg.getString(strMenu + "IconsOnly");
                if ((strHTML == null) || (strHTML.length() == 0))
                    strHTML = reg.getString("htmlNavMenuIconsOnly");
                strEnd = reg.getString("htmlNavIconsOnlyEnd");
            }
            if ((strHTML == null) || (strHTML.length() == 0))
                strHTML = reg.getString(strMenu);
            if ((strHTML == null) || (strHTML.length() == 0))
                strHTML = reg.getString("htmlNavMenu");
                
            if ((strStart == null) || (strStart.length() == 0))
                strStart = reg.getString("htmlNavStart");
            if ((strEnd == null) || (strEnd.length() == 0))
                strEnd = reg.getString("htmlNavEnd");
        }
        if ((strHTML == null) || (strHTML.length() == 0) || 
            (strStart == null) || (strStart.length() == 0) || 
                (strEnd == null) || (strEnd.length() == 0))
        {
            strStart = Constants.BLANK;
            strHTML = Constants.BLANK;  // "\t<tr valign=top>\n\t<td>";  // Default menu = no table items
            strEnd = Constants.BLANK;
        }
        out.println(strStart);
        out.println(strHTML);
        out.println(strEnd);
    }
117322
public void printHtmlNavMenu(PrintWriter out)
        throws DBException
    {
        if (HHelpScreen.getFirstToUpper(this.getProperty(DBParams.NAVMENUS)) != UserInfoModel.NO_ICONS.charAt(0))
            super.printHtmlNavMenu(out);
        else
        { // Applets frequently turn off menu bars temporarly
            String strHTML = "\t<tr valign=top>\n\t<td>"; // Default menu = no table items
            out.println(strHTML);
        }
    }
612785
public void printAppletHtmlScreen(PrintWriter out, ResourceBundle reg)
        throws DBException
    {
    	reg = ((BaseApplication)this.getTask().getApplication()).getResources("HtmlApplet", false);
    	
        Map<String,Object> propApplet = new Hashtable<String,Object>();

        Task task = this.getTask();
        Map<String,Object> properties = null;
        if (task instanceof ServletTask)
            properties = ((ServletTask)task).getRequestProperties(((ServletTask)task).getServletRequest(), true);
        else
            properties = task.getProperties();
        
        properties = ((AppletHtmlScreen)this.getScreenField()).getAppletProperties(propApplet, properties);

        out.println("<center>");
        
        char DEFAULT = ' ';
        char ch = ScreenFieldViewAdapter.getFirstToUpper(this.getProperty(DBParams.JAVA), DEFAULT);

        if (ch == DEFAULT)
            if (this.getTask() instanceof ServletTask)
        { // Default - 'P'lug-in/'A'pplet depends on browser
            ch = 'P'; // by Default - use plug-in
            HttpServletRequest req = ((ServletTask)this.getTask()).getServletRequest();
            Enumeration<?> e = req.getHeaderNames();
            while (e.hasMoreElements())
            {
                String name = (String)e.nextElement();
                String value = req.getHeader(name);
                if ((name != null) && (name.equalsIgnoreCase("User-Agent")) && (value != null))
                { // This is what I'm looking for... the browser type
                    value = value.toUpperCase();
                    if (value.indexOf("MOZILLA/5") != -1)
                        ch = UserInfoModel.WEBSTART.charAt(0); // Browser 5.x... Use plug-in (yeah!)
                    if (value.indexOf("MOZILLA/4") != -1)
                        ch = UserInfoModel.WEBSTART.charAt(0); // Browser 4.x... must use plug-in
                    if (value.indexOf("MSIE") != -1)
                        ch = UserInfoModel.WEBSTART.charAt(0); // Microsoft... must use plug-in
                    if (value.indexOf("WEBKIT") != -1)
                        ch = UserInfoModel.WEBSTART.charAt(0); // Chrome/Safari... must use plug-in
                    if (value.indexOf("CHROME") != -1)
                        ch = UserInfoModel.WEBSTART.charAt(0); // Chrome... must use plug-in
                    if (value.indexOf("SAFARI") != -1)
                        ch = UserInfoModel.WEBSTART.charAt(0); // Safari... must use plug-in
                    break;
                }
            }
        }

        if (ch != UserInfoModel.PLUG_IN.charAt(0))
        { // Not the plug-in, use jnlp applet tags
        	String strWebStartResourceName = this.getProperty("webStart");
        	if (strWebStartResourceName == null)
        		strWebStartResourceName = "webStart";
            String strApplet = reg.getString(strWebStartResourceName);
            String strJnlpURL = reg.getString(strWebStartResourceName + "Jnlp");
            
            if ((strApplet == null) || (strApplet.length() == 0))
            	strApplet = WEB_START_DEFAULT;
            StringBuilder sb = new StringBuilder(strApplet);
            
            StringBuffer sbParams = new StringBuffer();
            for (Map.Entry<String,Object> entry : properties.entrySet())
            {
                String strKey = (String)entry.getKey();
                Object objValue = entry.getValue();
                String strValue = null;
                if (objValue != null)
                    strValue = objValue.toString();
                if (strValue != null)
//x                    if (strValue.length() > 0)
                        sbParams.append(strKey + ":\"" + strValue + "\",\n");
            }
            if (propApplet.get(HtmlConstants.ARCHIVE) != null)
            	sbParams.append("archive:\"" + propApplet.get(HtmlConstants.ARCHIVE) + "\", \n");
            if (propApplet.get(HtmlConstants.NAME) != null)
                if (sbParams.indexOf("name:") == -1)
                	sbParams.append("name:\"" + propApplet.get(HtmlConstants.NAME) + "\", \n");
            if (propApplet.get(HtmlConstants.ID) != null)
            	sbParams.append("id:\"" + propApplet.get(HtmlConstants.ID) + "\", \n");
            if (sbParams.indexOf("hash:") == -1)
            	sbParams.append("hash:location.hash,\n");
            if (sbParams.indexOf("draggable:") == -1)
            	sbParams.append("draggable:true,");
            Utility.replace(sb, "{other}", sbParams.toString());

            strJnlpURL = Utility.encodeXML(this.getJnlpURL(strJnlpURL, propApplet, properties));
            Utility.replace(sb, "{jnlpURL}", strJnlpURL);

            Utility.replaceResources(sb, reg, propApplet, null);

            out.println(sb.toString());
        }
        else
        {
            out.println("<OBJECT classid=\"clsid:8AD9C840-044E-11D1-B3E9-00805F499D93\"");
            out.println(" width=\"" + propApplet.get(HtmlConstants.WIDTH) + "\"");
            out.println(" height=\"" + propApplet.get(HtmlConstants.HEIGHT) + "\"");
            if (propApplet.get(HtmlConstants.NAME) != null)
                out.println(" name=\"" + propApplet.get(HtmlConstants.NAME) + "\"");
            out.println(" codebase=\"http://java.sun.com/update/1.5.0/jinstall-1_6_0-windows-i586.cab#Version=1,6,0,0\">");
            if (propApplet.get(HtmlConstants.ARCHIVE) != null)
                out.println("<param name=\"ARCHIVE\" value=\"" + propApplet.get(HtmlConstants.ARCHIVE) + "\">");
            out.println("<param name=\"CODE\" value=\"" + propApplet.get(DBParams.APPLET) +  "\">");
            out.println("<param name=\"CODEBASE\" value=\"" + propApplet.get(HtmlConstants.CODEBASE) + "\">");
            
            for (Map.Entry<String,Object> entry : properties.entrySet())
            {
                String strKey = (String)entry.getKey();
                Object objValue = entry.getValue();
                String strValue = null;
                if (objValue != null)
                    strValue = objValue.toString();
                if (strValue != null)
                    if (strValue.length() > 0)
                        out.println("<param name=\"" + strKey + "\" value=\"" + strValue + "\">");
            }
    
            out.println("<param name=\"type\" value=\"application/x-java-applet;version=1.6.0\">");
            out.println("<COMMENT>");
            out.println("<EMBED type=\"application/x-java-applet;version=1.6\"");

            if (propApplet.get(HtmlConstants.ARCHIVE) != null)
                out.println(" java_ARCHIVE=\"" + propApplet.get(HtmlConstants.ARCHIVE) + "\"");
            out.println(" java_CODE=\"" + propApplet.get(DBParams.APPLET) + "\"");
            out.println(" width=\"" + propApplet.get(HtmlConstants.WIDTH) + "\"");
            out.println(" height=\"" + propApplet.get(HtmlConstants.HEIGHT) + "\"");
            if (propApplet.get(HtmlConstants.NAME) != null)
                out.println(" name=\"" + propApplet.get(HtmlConstants.NAME) + "\"");
            out.println(" java_CODEBASE=\"" + propApplet.get(HtmlConstants.CODEBASE) + "\"");
            
            for (Map.Entry<String,Object> entry : properties.entrySet())
            {
                String strKey = (String)entry.getKey();
                Object objValue = entry.getValue();
                String strValue = null;
                if (objValue != null)
                    strValue = objValue.toString();
                if (strValue != null)
                    if (strValue.length() > 0)
                        out.println(" " + strKey + " =\"" + strValue + "\"");
            }
    
            out.println(" pluginspage=\"http://java.sun.com/javase/downloads/ea.jsp\"><NOEMBED></COMMENT>");
            out.println(" alt=\"Your browser understands the &lt;APPLET&gt; tag but is not running the applet, for some reason.\"");
            out.println(" Your browser is completely ignoring the &lt;APPLET&gt; tag!");
            out.println("</NOEMBED></EMBED>");
            out.println("</OBJECT>");
        }
        out.println("</center>");
    }
911821
public static void print(Exception ex, String strDebugType)
    {
        Debug.print(ex, strDebugType, DBConstants.DEBUG_INFO);
    }
1182615
public void displayError(DBException ex)
    {
        int iWarningLevel = DBConstants.WARNING_MESSAGE;
        String strMessage = DBConstants.BLANK;
        if (ex instanceof DatabaseException)
        {
            iWarningLevel = ((DatabaseException)ex).getWarningLevel();
            strMessage = ((DatabaseException)ex).getMessage(this.getTask());
        }
        else
            strMessage = ex.getMessage();
        this.displayError(strMessage, iWarningLevel);
    }
488310
public function display()
    {
        if ($this->content instanceof Exception) {

            $error = $this->content;
            $layout = $error->getCode();

            if (! $this->getTemplate()->findPath('errors'.DS.$layout.'.php')) {
                $layout = 'default';
            }

            $this->content = $this->getTemplate()->loadTemplate('errors'.DS.$layout, array('error' => $error))->render();

            $settings = $this->getService('com:settings.setting');

            if ($settings->debug) {

                $traces = array();
                $traces[] = '<h4>Exception '.get_class($error).' with message "'.$error->getMessage().'"</h4>';
                $traces[] = $error->getFile().':'.$error->getLine();

                foreach ($error->getTrace() as $trace) {
                    $str = '';

                    if (isset($trace['file'])) {
                        $str = $trace['file'].':';
                    }

                    if (isset($trace['line'])) {
                        $str .= $trace['line'];
                    }

                    if (empty($str)) {
                        continue;
                    }

                    $traces[] = $str;
                }

                $this->content .= '<pre>'.implode('<br />', $traces).'</pre>';
            }
        }

        $this->output = $this->getTemplate()->loadTemplate($this->getLayout(), array('output' => $this->content))->render();

        return $this->output;
    }
567291
private void writeTop() throws IOException {
        // setup output HTML file
        File outputFile = new File(outputDirectory, createFilename(currentPageNumber));
        writer = new BufferedWriter(new OutputStreamWriter(
                new FileOutputStream(outputFile, false), Charset.forName(encoding)));

        // write header
        Map<String,Object> map = new HashMap<String,Object>();
        map.put("pageTitle", pageTitle);
        if(pageHeader != null && pageHeader.length() > 0) {
            map.put("header", "<h1>" + pageHeader + "</h1>");
        } else {
            map.put("header","");
        }
        if(pageDescription != null && pageDescription.length() > 0) {
            map.put("description", "<p>" + pageDescription + "</p>");
        } else {
            map.put("description", "");
        }

        String template = Template.readResourceAsStream("com/btaz/util/templates/html-table-header.ftl");
        String output = Template.transform(template, map);
        writer.write(output);
    }
738962
public boolean printData(PrintWriter out, int iHtmlAttributes)
    {
        boolean bFieldsFound = false;
        String strXmlFilename = this.getProperty(DBParams.XML);                // Html page
        if (strXmlFilename == null)
            strXmlFilename = this.getProperty(DBParams.TEMPLATE);
        if (DBConstants.BLANK.equals(strXmlFilename))
            strXmlFilename = DBConstants.DEFAULT_HELP_FILE;
        if (strXmlFilename != null)
        {
            if ((strXmlFilename.indexOf(':') == -1) && (strXmlFilename.charAt(0) != '/'))
            {
            	if (strXmlFilename.indexOf('/') == -1)
            		strXmlFilename = DBConstants.DEFAULT_HELP_FILE.substring(0, DBConstants.DEFAULT_HELP_FILE.lastIndexOf('/') + 1) + strXmlFilename;
                String strLanguage = ((BaseApplication)this.getTask().getApplication()).getLanguage(false);
                if ((strLanguage == null) || (strLanguage.equalsIgnoreCase("en")))
                    strLanguage = Constants.BLANK;
                if (strLanguage.length() > 0)
                    strLanguage += "/";
                strXmlFilename = strLanguage + strXmlFilename;  // DBConstants.kxxx;
            }
            boolean bHTML = false;
            if ((strXmlFilename.endsWith(".html"))
                || (strXmlFilename.endsWith(".htm")))
                    bHTML = true;
            if (bHTML)
                out.println(Utility.startTag(XMLTags.HTML));
            InputStream streamIn = this.getTask().getInputStream(strXmlFilename);
            if (streamIn != null)
            	Utility.transferURLStream(null, null, new InputStreamReader(streamIn), out);
            else
            	out.println("File not found: " + strXmlFilename + "<br/>");
            if (bHTML)
                out.println(Utility.endTag(XMLTags.HTML));
        }
        else
            return super.printData(out, HtmlConstants.HTML_DISPLAY);     // DO print screen
        return bFieldsFound;
    }
219966
public void processInputData(PrintWriter out)
        throws DBException
    {
        String strMoveValue = this.getProperty(DBParams.COMMAND);      // Display record
        if (strMoveValue == null)
            strMoveValue = Constants.BLANK;

        String strError = this.getTask().getLastError(0);
        if ((strError != null) && (strError.length() > 0))
            strError = strError + " on " + strMoveValue;
        if ((strError != null) && (strError.length() > 0))
        {
            out.println(Utility.startTag(XMLTags.STATUS_TEXT));
            out.println(Utility.startTag(XMLTags.TEXT) + "Error: " + strError + Utility.endTag(XMLTags.TEXT));
            out.println(Utility.startTag(XMLTags.ERROR) + "error" + Utility.endTag(XMLTags.ERROR));
            Record record = ((BasePanel)this.getScreenField()).getMainRecord();
            if (record != null)
                record.setEditMode(Constants.EDIT_NONE);    // Make sure this isn't updated on screen free
            out.println(Utility.endTag(XMLTags.STATUS_TEXT));
        }
        else
        {
            String strMessage = this.getTask().getStatusText(DBConstants.INFORMATION_MESSAGE);
            if (strMessage != null)
                if (strMoveValue.length() > 0)
                    if ((strMessage.length() > 0) && (!(this.getScreenField() instanceof BaseGridScreen))) // TODO localize
                    {
                        out.println(Utility.startTag(XMLTags.STATUS_TEXT));
                        out.println(Utility.startTag(XMLTags.TEXT) + strMessage + Utility.endTag(XMLTags.TEXT));
                        out.println(Utility.startTag(XMLTags.ERROR) + "information" + Utility.endTag(XMLTags.ERROR));
                        out.println(Utility.endTag(XMLTags.STATUS_TEXT));
                    }
        }
    }
581943
public void printHtmlTrailer(PrintWriter out, ResourceBundle reg)
        throws DBException
    {
        char chMenubar = HBasePanel.getFirstToUpper(this.getProperty(DBParams.TRAILERS), 'H');
        if (chMenubar == 'H') if (((BasePanel)this.getScreenField()).isMainMenu())
            chMenubar = 'Y';
        if (chMenubar == 'Y')
        {
            String strNav = reg.getString("htmlTrailer");
            strNav = Utility.replaceResources(strNav, reg, null, null);
            String strScreen = ((BasePanel)this.getScreenField()).getScreenURL();
            strScreen = Utility.encodeXML(strScreen);
            strNav = Utility.replace(strNav, HtmlConstants.URL_TAG, strScreen);
            this.writeHtmlString(strNav, out);
        }
    }