示例#1
0
void InitParamsServlet::service(servlet::HttpServletRequest& req, servlet::HttpServletResponse& resp)
{
	std::ostream &out=resp.getOutputStream();
	renderHeader(out);
	testInitParams(req,resp);
	renderFooter(out);
}
示例#2
0
QString reports::ReportTable::renderHTML(QWidget* widget,
    const QByteArray& encoding, const QString& title, bool includeCSS)
{

  m_encoding = encoding;

  //this render the HEAD tag and sets the correct css file
  QString html = renderHeader(title, includeCSS);

  try {
    //this method is implemented by each concrete class
    html += renderBody();
  } catch (const MyMoneyException &e) {
    kDebug(2) << "reports::ReportTable::renderHTML(): ERROR " << e.what();

    QString error = i18n("There was an error creating your report: \"%1\".\nPlease report this error to the developer's list: [email protected]", e.what());

    KMessageBox::error(widget, error, i18n("Critical Error"));

    html += "<h1>" + i18n("Unable to generate report") + "</h1><p>" + error + "</p>";
  }

  //this renders a common footer
  html += renderFooter();

  return html;
}
示例#3
0
void FileUploadServlet::service(servlet::HttpServletRequest& req, servlet::HttpServletResponse& resp)
{
	std::ostream &out=resp.getOutputStream();
	servlet::UploadedFile* file=req.getUploadedFile("theFile");
	renderHeader(out);
	if(!req.getParameter("moo").empty())
	    out<<"Something was submitted: "<<req.getParameter("moo")<<std::endl;
	if(!file)
	    renderForm(req, out);
	else
	    renderFile(out, file);
	renderFooter(out);
}
示例#4
0
void AttributesServlet::service(servlet::HttpServletRequest& req, servlet::HttpServletResponse& resp)
{
	std::ostream &out = resp.getOutputStream();
	renderHeader(out);
	out<<"<PRE>";
	out<<"\nRequest URI:  "<<req.getRequestURI();
	out<<"\nRequest URL:  "<<req.getRequestURL();
	out<<"\nContext Path: "<<req.getContextPath();
	out<<"\nServletPath:  "<<req.getServletPath();
	out<<"\nQuery String: "<<req.getQueryString();
	out<<"\nPath info:    "<<req.getPathInfo();
	out<<"\nLocal Address:"<<req.getLocalAddr();
	out<<"\nRemote Address:"<<req.getRemoteAddr();
	out<<"\nLocal Name   :"<<req.getLocalName();
	out<<"\nRemote Host  :"<<req.getRemoteHost();
	out<<"\nServlet Name :"<<getServletName();
	out<<"\nPathInfo Translated: "<<req.getPathTranslated();
	out<<"\nMIME type (text): "<<getServletContext().getMimeType("tests/attributes/attributes.cpp");
	out<<"\nMIME type (html): "<<getServletContext().getMimeType("tests/multiple/multiple.csp");
	out<<"\n</PRE>";
	renderFooter(out);
}
示例#5
0
void ChatUserInterface::render() const
{
   // If there is an underlying menu or other UI screen, render and dim it.
   //
   // We will skip rendering if the editor is a parent UI because of a couple
   // of difficult-to-solve issues:
   //  1. Fullscreen mode in editor usually has a different aspect ratio when
   //     compared to the rest of the game (incl. the chat UI)
   //  2. The editor may have other sub-UIs opened (like QuickMenuUIs) that
   //     may not handle the UIManager stack appropriately (likely a bug) and
   //     will cause stack overflows
   if((mRenderUnderlyingUI && getUIManager()->hasPrevUI()) &&
         !getUIManager()->cameFrom<EditorUserInterface>())
   {
      getUIManager()->renderPrevUI(this);  // ...render it...
      dimUnderlyingUI();
   }

   // Render header
   renderHeader();

   // And footer
   S32 vertFooterPos = DisplayManager::getScreenInfo()->getGameCanvasHeight() - vertMargin - VERT_FOOTER_SIZE;
   RenderUtils::drawCenteredString_fixed(vertFooterPos + VERT_FOOTER_SIZE - 2, VERT_FOOTER_SIZE - 2, Colors::green, "Type your message | ENTER to send | ESC exits");

   renderChatters(horizMargin, vertFooterPos - CHAT_FONT_MARGIN * 2);

   // Render incoming chat msgs
   //mGL->glColor(Colors::white);

   U32 y = vertMargin + 60;

   static const S32 chatAreaHeight = DisplayManager::getScreenInfo()->getGameCanvasHeight() - 2 * vertMargin -   // Screen area less margins
                     VERT_FOOTER_SIZE -                                                     // Instructions at the bottom
                     CHAT_NAMELIST_SIZE - CHAT_FONT_MARGIN * 2  -                           // Names of those in chatroom
                     MENU_TITLE_SIZE - TITLE_SUBTITLE_GAP - MENU_SUBTITLE_SIZE -            // Title/subtitle display
                     CHAT_FONT_SIZE - CHAT_FONT_MARGIN -                                    // Chat composition
                     CHAT_FONT_SIZE;                                                        // Not sure... just need a little more space??

   static const S32 MessageDisplayCount = chatAreaHeight / (CHAT_FONT_SIZE + CHAT_FONT_MARGIN);

   renderMessages(y, MessageDisplayCount);
   renderMessageComposition(vertFooterPos - 45 + CHAT_FONT_SIZE);

   // Give user notice that there is no connection to master, and thus chatting is ineffectual
   MasterServerConnection *masterConn = getGame()->getConnectionToMaster();
   if(!(masterConn && masterConn->getConnectionState() == NetConnection::Connected))
   {
      static const S32 fontsize = 20;
      static const S32 fontgap = 5;
      static const S32 margin = 20;

      static const char* line1 = "Not connected to Master Server";
      static const char* line2 = "Your chat messages cannot be relayed";

      static const S32 CORNER_INSET = 15;
      S32 yPos1 = 200;
      S32 yPos2 = yPos1 + (2 * (fontsize + fontgap + margin));

      S32 width = RenderUtils::getStringWidth(fontsize, line2);

      S32 canvasWidth = DisplayManager::getScreenInfo()->getGameCanvasWidth();
      S32 xPos1 = (canvasWidth - width) / 2 - margin;
      S32 xPos2 = xPos1 + width + (2 * margin);

      RenderUtils::drawFilledFancyBox(xPos1, yPos1, xPos2, yPos2, CORNER_INSET, Colors::red40, 1.0, Colors::red);

      yPos1 += margin + fontsize;
      RenderUtils::drawCenteredString_fixed(yPos1, fontsize, Colors::white, line1);
      RenderUtils::drawCenteredString_fixed(yPos1 + fontsize + fontgap, fontsize, Colors::white, line2);
   }
}