// Copyright 2003 Perforce Software. All rights reserved. // // This file is part of Perforce - the FAST SCM System. // // p4wAboutPane: // Generates a page with p4web version, browser version and server info #include <p4wp4.h> #include "p4wStrBuf.h" #include "p4wHtml.h" #include "p4wPane.h" #include "p4wAboutPane.h" #include "p4wThread.h" // for OPTSFLAGS define #include "p4wCustomVer.h" // for appending a custom version string p4wAboutPane::p4wAboutPane( p4wView & ParentView, p4wRequest & Request ) : p4wPane( ParentView, Request ) { } p4wAboutPane::~p4wAboutPane() { } void p4wAboutPane::Begin() { // // Start the information page by starting the page, and // generating the p4web & browser version p4wHtml htm; p4wURL urlMaker; StrBuf grayIcon; StrBuf clearIcon; urlMaker.ConstructURL( grayIcon, "/grayPixelIcon", AC_ICON, NULL ); urlMaker.ConstructURL( clearIcon, "/clearpixelIcon", AC_ICON, NULL ); htm.comment( "BEGIN ABOUT CONTENT" ); // // Generate the title htm.beginTRow(); htm.beginCol(); htm.beginSpan( "title" ); htm << "Information:"; htm.endSpan(); htm.endCol(); htm.endTRow(); htm.beginTRow(); htm.beginCol( "top" ); htm.icon( grayIcon.Text(), "1", "100%", "", 1, "0", "0" ); htm.endCol(); htm.endTRow(); htm.beginTRow(); htm.beginCol(); htm.beginTable( "0", "100%", "8", "1" ); htm.beginTRow( NULL, NULL, "#FFFFFF" ); htm.beginCol(); htm.beginTable( "0", NULL, "2", "0", "#FFFFFF" ); // // Application information htm.beginTRow(); htm.beginCol( "top", NULL, "3" ); htm.text( "Application:", "b" ); htm.endCol(); htm.endTRow(); // // P4Web version htm.beginTRow(); htm.beginCol(); htm.icon( clearIcon.Text(), "0", "12", "", 1 ); htm.endCol(); htm.beginCol( "top" ); htm.text( "P4Web version:" ); htm.endCol(); htm.beginCol(); htm << "P4Web/" << ID_REL << "/" << ID_OS << "/" << ID_PATCH ; #ifdef POSTPENDVER htm << "/" << POSTPENDVER; #ifdef LASTP4CHANGE htm << LASTP4CHANGE; #endif #endif htm.endCol(); htm.endTRow(); // // P4Web mode htm.beginTRow(); htm.beginCol(); htm.icon( clearIcon.Text(), "0", "12", "", 1 ); htm.endCol(); htm.beginCol( "top" ); htm.text( "P4Web mode:" ); htm.endCol(); htm.beginCol(); if (fRequest.GetBrowseMode()) htm << "Viewer (disabled sync/edit/add/delete etc.); "; else htm << "Standard (enabled sync/edit/add/delete etc.); "; Options *opts = fRequest.GetOpts(); if ( (*opts)[ 'M' ] ) htm << "multi user"; else htm << "single user"; if (fRequest.IsNTService()) htm << "; Windows service"; htm.endCol(); htm.endTRow(); // // Browser version htm.beginTRow(); htm.beginCol(); htm.icon( clearIcon.Text(), "0", "12", "", 1 ); htm.endCol(); htm.beginCol( "top" ); htm.text( "Browser version:" ); htm.endCol(); htm.beginCol(); htm.text( p4wStrBuf().EscapeHTML( fRequest.GetUserAgent(), Unicode() ).Text() ); htm.endCol(); htm.endTRow(); // // Vertical space htm.beginTRow(); htm.beginCol(); htm.icon( clearIcon.Text(), "5", "0", "", 1 ); htm.endCol(); htm.endTRow(); // // Server information htm.beginTRow(); htm.beginCol( "top", NULL, "3" ); htm.text( "Server:", "b" ); htm.endCol(); htm.endTRow(); fRequest << htm; } void p4wAboutPane::RenderInfo( char *data, char level ) { StrBuf heading; StrBuf value; StrBuf clearIcon; p4wHtml htm; p4wURL urlMaker; // // Generate the Server Info table data urlMaker.ConstructURL( clearIcon, "/clearpixelIcon", AC_ICON, NULL ); char *c = strchr( data, ':' ); heading.Set( data, c - data + 1 ); value.Set( c + 1, strlen( c + 1 ) ); htm.beginTRow(); htm.beginCol(); htm.icon( clearIcon.Text(), "0", "12", "", 1 ); htm.endCol(); htm.beginCol( "top" ); htm.text( heading.Text() ); htm.endCol(); htm.beginCol(); htm.text( value.Text() ); htm.endCol(); htm.endTRow(); fRequest << htm; } void p4wAboutPane::Render( StrDict *varList ) { StrBuf clearIcon; p4wHtml htm; p4wURL urlMaker; // // Generate the Server Info table data urlMaker.ConstructURL( clearIcon, "/clearpixelIcon", AC_ICON, NULL ); // User name StrPtr *user = varList->GetVar( "userName" ); if (user) { htm.beginTRow(); htm.beginCol(); htm.icon( clearIcon.Text(), "0", "12", "", 1 ); htm.endCol(); htm.beginCol( "top" ); htm.text( "User name:" ); htm.endCol(); htm.beginCol(); htm.text( p4wStrBuf().EscapeHTML(*user, Unicode()).Text() ); htm.endCol(); htm.endTRow(); } // // Client name StrPtr *client = varList->GetVar( "clientName" ); if (client) { htm.beginTRow(); htm.beginCol(); htm.icon( clearIcon.Text(), "0", "12", "", 1 ); htm.endCol(); htm.beginCol( "top" ); htm.text( "Client name:" ); htm.endCol(); htm.beginCol(); htm.text( p4wStrBuf().EscapeHTML(*client, Unicode()).Text() ); htm.endCol(); htm.endTRow(); } // // Client host StrPtr * clientHost = varList->GetVar( "clientHost" ); if (clientHost) { htm.beginTRow(); htm.beginCol(); htm.icon( clearIcon.Text(), "0", "12", "", 1 ); htm.endCol(); htm.beginCol( "top" ); htm.text( "Client host:" ); htm.endCol(); htm.beginCol(); htm.text( p4wStrBuf().EscapeHTML(*clientHost, Unicode()).Text() ); htm.endCol(); htm.endTRow(); } // // Client root StrPtr * clientRoot = varList->GetVar( "clientRoot" ); if( clientRoot ) { htm.beginTRow(); htm.beginCol(); htm.icon( clearIcon.Text(), "0", "12", "", 1 ); htm.endCol(); htm.beginCol( "top" ); htm.text( "Client root:" ); htm.endCol(); htm.beginCol(); htm.text( p4wStrBuf().EscapeHTML(*clientRoot, Unicode()).Text() ); htm.endCol(); htm.endTRow(); } // // Client address StrPtr *clientAddress = varList->GetVar( "clientAddress" ); if (clientAddress) { htm.beginTRow(); htm.beginCol(); htm.icon( clearIcon.Text(), "0", "12", "", 1 ); htm.endCol(); htm.beginCol( "top" ); htm.text( "Client address:" ); htm.endCol(); htm.beginCol(); htm.text( p4wStrBuf().EscapeHTML(*clientAddress, Unicode()).Text() ); htm.endCol(); htm.endTRow(); } // // Server address StrPtr *serverAddress = varList->GetVar( "serverAddress" ); if (serverAddress) { htm.beginTRow(); htm.beginCol(); htm.icon( clearIcon.Text(), "0", "12", "", 1 ); htm.endCol(); htm.beginCol( "top" ); htm.text( "Server address:" ); htm.endCol(); htm.beginCol(); htm.text( p4wStrBuf().EscapeHTML(*serverAddress, Unicode()).Text() ); htm.endCol(); htm.endTRow(); } // // Server root StrPtr *serverRoot = varList->GetVar( "serverRoot" ); if (serverRoot) { htm.beginTRow(); htm.beginCol(); htm.icon( clearIcon.Text(), "0", "12", "", 1 ); htm.endCol(); htm.beginCol( "top" ); htm.text( "Server root:" ); htm.endCol(); htm.beginCol(); htm.text( p4wStrBuf().EscapeHTML(*serverRoot, Unicode()).Text() ); htm.endCol(); htm.endTRow(); } // // Server date StrPtr *serverDate = varList->GetVar( "serverDate" ); if (serverDate) { htm.beginTRow(); htm.beginCol(); htm.icon( clearIcon.Text(), "0", "12", "", 1 ); htm.endCol(); htm.beginCol( "top" ); htm.text( "Server date:" ); htm.endCol(); htm.beginCol(); htm.text( p4wStrBuf().EscapeHTML(*serverDate, Unicode()).Text() ); htm.endCol(); htm.endTRow(); } // // Server uptime StrPtr *serverUptime = varList->GetVar( "serverUptime" ); if (serverUptime) { htm.beginTRow(); htm.beginCol(); htm.icon( clearIcon.Text(), "0", "12", "", 1 ); htm.endCol(); htm.beginCol( "top" ); htm.text( "Server uptime:" ); htm.endCol(); htm.beginCol(); htm.text( p4wStrBuf().EscapeHTML(*serverUptime, Unicode()).Text() ); htm.endCol(); htm.endTRow(); } // // Server version StrPtr *serverVersion = varList->GetVar( "serverVersion" ); if (serverVersion) { htm.beginTRow(); htm.beginCol(); htm.icon( clearIcon.Text(), "0", "12", "", 1 ); htm.endCol(); htm.beginCol( "top" ); htm.text( "Server version:" ); htm.endCol(); htm.beginCol(); htm.text( p4wStrBuf().EscapeHTML(*serverVersion, Unicode()).Text() ); htm.endCol(); htm.endTRow(); } // // Authorization server StrPtr *authServer = varList->GetVar( "authServer" ); if (authServer) { htm.beginTRow(); htm.beginCol(); htm.icon( clearIcon.Text(), "0", "12", "", 1 ); htm.endCol(); htm.beginCol( "top" ); htm.text( "Authorization server:" ); htm.endCol(); htm.beginCol(); htm.text( p4wStrBuf().EscapeHTML(*authServer, Unicode()).Text() ); htm.endCol(); htm.endTRow(); } // // Server license StrPtr *serverLicense = varList->GetVar( "serverLicense" ); if (serverLicense) { htm.beginTRow(); htm.beginCol(); htm.icon( clearIcon.Text(), "0", "12", "", 1 ); htm.endCol(); htm.beginCol( "top" ); htm.text( "Server license:" ); htm.endCol(); htm.beginCol(); htm.text( p4wStrBuf().EscapeHTML(*serverLicense, Unicode()).Text() ); htm.endCol(); htm.endTRow(); } // // Proxy Info StrPtr *proxyVersion = varList->GetVar( "proxyVersion" ); if (proxyVersion) { htm.beginTRow(); htm.beginCol(); htm.icon( clearIcon.Text(), "0", "12", "", 1 ); htm.endCol(); htm.beginCol( "top" ); htm.text( "Proxy version:" ); htm.endCol(); htm.beginCol(); htm.text( p4wStrBuf().EscapeHTML(*proxyVersion, Unicode()).Text() ); htm.endCol(); htm.endTRow(); } // // Broker Info StrPtr *brokerAddress = varList->GetVar( "brokerAddress" ); if (brokerAddress) { htm.beginTRow(); htm.beginCol(); htm.icon( clearIcon.Text(), "0", "12", "", 1 ); htm.endCol(); htm.beginCol( "top" ); htm.text( "Broker address:" ); htm.endCol(); htm.beginCol(); htm.text( p4wStrBuf().EscapeHTML(*brokerAddress, Unicode()).Text() ); htm.endCol(); htm.endTRow(); } StrPtr *brokerVersion = varList->GetVar( "brokerVersion" ); if (brokerVersion) { htm.beginTRow(); htm.beginCol(); htm.icon( clearIcon.Text(), "0", "12", "", 1 ); htm.endCol(); htm.beginCol( "top" ); htm.text( "Broker version:" ); htm.endCol(); htm.beginCol(); htm.text( p4wStrBuf().EscapeHTML(*brokerVersion, Unicode()).Text() ); htm.endCol(); htm.endTRow(); } fRequest << htm; } void p4wAboutPane::End() { // // Print startup flags & company info and end the page p4wHtml htm; p4wURL urlMaker; StrBuf clearIcon; StrBuf link; urlMaker.ConstructURL( clearIcon, "/clearpixelIcon", AC_ICON, NULL ); // // Vertical space htm.beginTRow(); htm.beginCol(); htm.icon( clearIcon.Text(), "5", "0", "", 1 ); htm.endCol(); htm.endTRow(); if (fRequest.isLocalRequest() || SEC_SHOW_STARTUP_FLAGS ) { // // Startup information htm.beginTRow(); htm.beginCol( "top", NULL, "3" ); htm.text( "Startup Flags:", "b" ); htm.endCol(); htm.endTRow(); // // Startup Flags char *p; StrPtr *s; char buf[] = "-- "; Options *opts = fRequest.GetOpts(); for (p = OPTSFLAGS; *++p; ) { if( *p == ':' ) continue; if(s = (*opts)[ *p ] ) { htm.beginTRow(); htm.beginCol(); htm.icon( clearIcon.Text(), "0", "12", "", 1 ); htm.endCol(); htm.beginCol( "top" ); buf[1] = *p; htm.text( buf ); if (*p == 'J') { htm.Append(s->Text(), 1); } else if (strcmp(s->Text(), "true")) { if (*p == 'P') htm << "********"; else htm << s; } htm.endCol(); htm.beginCol(); switch(*p) { case 'p': htm.text( "Perforce server port number" ); break; case 'c': htm.text( "Perforce client" ); break; case 'd': htm << "Default file filter "; htm << fRequest.GetFileFilter()->Text(); break; case 'u': htm.text( "Perforce user" ); break; case 'w': htm.text( "P4Web port number" ); break; case 'v': htm.text( "Debug modes" ); break; case 'b': htm.text( "Run as browse-only 'Viewer' without authentication" ); break; case 'B': htm.text( "Run as browse-only 'Viewer' using authentication" ); break; case 'l': htm.text( "Restrict to local host" ); break; case 'M': htm.text( "Multiuser" ); break; case 'm': htm.text( "Custom MIME type map file" ); break; case 'g': htm.text( "Allow only users in this group (-M only)" ); break; case 'L': htm.text( "Log http requests to this file" ); break; case 'H': htm.text( "Host name for client use" ); break; case 'C': htm.text( "Character set" ); break; case 'f': htm.text( "Customization file" ); break; case 'T': htm.text( "Show only the indicated tabs" ); break; case 'U': htm.text( "User to switch to after dropping root privileges" ); break; case 'J': htm << "\""; htm.text( s->Text()+1 ); htm << "\""; break; case 'r': htm << "Only allow clients whose roots begin with "; htm << fRequest.GetMasterRoot()->Text(); break; case 's': { char sec_flags[] = SEC_FLAGS; char *q = s->Text(); while (*q) { if (!strchr(sec_flags, *q)) { char buf2[2] = { *q++, '\0' }; htm << "<font color=\"#FF0000\">" << buf2; htm << " = ignored - invalid flag" << "</font><br>"; continue; } switch(*q++) { case 'a': htm << "a = Don't allow switching clients"; break; case 'B': htm << "B = Allow unowned clients"; break; case 'C': htm << "C = Allow all clients"; break; case 'D': htm << "D = Allow creating clients"; break; case 'E': htm << "E = Allow editing client's Root/Altroots/Owner"; break; case 'F': htm << "F = Show startup flags"; break; case 'G': htm << "G = Allow clients with empty Host field"; break; case 'h': htm << "h = Don't allow displaying integration/branching history"; break; case 'i': htm << "i = Don't allow integ"; break; case 'L': htm << "L = Allow creating/changing symlinks"; break; case 'N': htm << "N = Allow clients with null root"; break; case 'P': htm << "P = Allow clients with .. in their root"; break; case 'q': htm << "q = Link directly to file from Path Browser page"; break; case 'r': htm << "r = Don't allow running raw p4 commands"; break; case 's': htm << "s = Use https"; break; case 'w': htm << "w = Don't show Workspace links"; break; case 'x': htm << "x = Don't show users' email addresses"; break; default: { char buf2[2] = { *(q-1), '\0' }; htm << buf2 << " = "; link << p4wStrBuf().EscapeHTML( StrRef("mailTo:support@perforce.com"), Unicode() ); htm.beginLink( link.Text() ); htm.text( p4wStrBuf().EscapeHTML( StrRef("contact support@perforce.com"), Unicode() ).Text() ); htm.endLink(); break; } } if (*q) htm << "<br>"; } break; } default: link << p4wStrBuf().EscapeHTML( StrRef("mailTo:support@perforce.com"), Unicode() ); htm.beginLink( link.Text() ); htm.text( p4wStrBuf().EscapeHTML( StrRef("contact support@perforce.com"), Unicode() ).Text() ); htm.endLink(); break; } htm.endCol(); htm.endTRow(); } } } // // Vertical space htm.beginTRow(); htm.beginCol(); htm.icon( clearIcon.Text(), "5", "0", "", 1 ); htm.endCol(); htm.endTRow(); // // Company information htm.beginTRow(); htm.beginCol( "top", NULL, "3" ); htm.text( "Company:", "b" ); htm.endCol(); htm.endTRow(); // // Perforce website htm.beginTRow(); htm.beginCol(); htm.icon( clearIcon.Text(), "0", "12", "", 1 ); htm.endCol(); htm.beginCol( "top" ); htm.text( "Company web site:" ); htm.endCol(); htm.beginCol(); htm.beginLink( "http://www.perforce.com" ); htm.text( "Perforce" ); htm.endLink(); htm.endCol(); htm.endTRow(); // // Email link << p4wStrBuf().EscapeHTML( StrRef("mailTo:support@perforce.com"), Unicode() ); htm.beginTRow(); htm.beginCol(); htm.icon( clearIcon.Text(), "0", "12", "", 1 ); htm.endCol(); htm.beginCol( "top" ); htm.text( "Email:" ); htm.endCol(); htm.beginCol(); htm.beginLink( link.Text() ); htm.text( p4wStrBuf().EscapeHTML( StrRef("support@perforce.com"), Unicode() ).Text() ); htm.endLink(); htm.endCol(); htm.endTRow(); // // End the tables htm.endTable(); htm.endCol(); htm.endTRow(); htm.endTable(); htm.endCol(); htm.endTRow(); htm.comment( "END ABOUT CONTENT" ); fRequest << htm; }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 12234 | Matt Attaway |
Rejigger P4Web project in preparation for official sunsetting The bin directory contains the last official builds of P4Web from the Perforce download site. P4Web is soon to be completely sunsetted; these builds are here for folks who don't want to build their own. To better handle the archived builds the source code has been moved into a separate src directory. |
||
//guest/perforce_software/p4web/Panes/p4wAboutPane.cpp | |||||
#1 | 8914 | Matt Attaway | Initial add of the P4Web source code |