// // Copyright 2001 Perforce Software. All rights reserved. // // This file is part of Perforce - the FAST SCM System. // // p4wLogoutView: // Issues a command and passes result to a result pane (LogoutPane). // Command is either generated directly from the url, or in the // case of spec forms, it is generated with only the -i flag.. #include <stdlib.h> #include <string.h> #include <p4wp4.h> #include "p4wMenuPane.h" #include "p4wLogoutView.h" #include "p4wLogoutPane.h" p4wLogoutView::p4wLogoutView(p4wRequest & Request, int bAuthHeader) : p4wRunView(Request) { fAuthHeader = bAuthHeader; // // Set the command, command flags and args (if any). // Also set flags specifying whether this is a form, // and whether form data was found. const StrPtr *flags = fRequest.GetCmdFlag(); const StrPtr *args = fRequest.GetCmdArg(); if( flags ) fFlags.Put()->Set( *flags ); if( args ) fArgs.Set( *args ); // // Set the short and the long versions of the title fShortTitle.Set( "Command Result" ); fFullTitle << "logout"; for( int i = 0; i < fFlags.Count(); i++ ) fFullTitle << " " << fFlags.Get( i ); // // If the path component of the url is not // empty, use it in the title. If this is a form, // GetURL() gives the argument to the command; // otherwise use GetPath() since the argument is // the path or file. if( fRequest.GetURL().Length() ) fFullTitle << " " << fRequest.GetPath(); if( fArgs.Length() ) fFullTitle << " " << fArgs; fFullTitle << " Result"; } p4wLogoutView::~p4wLogoutView() { } // ------------------------------------- // Render this entire html page // void p4wLogoutView::Render() { // // Build up the page and render it p4wHtml htm; const char *charset = NULL; if( fRequest.GetUnicode() ) charset = "utf-8"; if (fAuthHeader) htm.authHeader(); else htm.httpHeader(200); htm.contentType( "text/html", 1, charset ); htm.beginHeader( charset ); StrBuf title; title << "P4Web - Logout Result"; htm.title( title.Text() ); htm.styleSheet(&fRequest); // htm.base( p4wStrBuf().NormalizeBase( fRequest.GetBase(), // fRequest.GetUnicode() ).Text() ); htm.endHeader( fRequest.GetHTTPPort().Text(), fRequest.IsHTTPS() ); htm.beginBody( "#ffffff", NULL, NULL, "0", "0", "0", "0", "onLoad", "document.execCommand('ClearAuthenticationCache')" ); // // Write out the header & start of body fRequest << htm; // // Prepare to generate the content StartContent(); // // Render the content of the page RenderContent(); // // Spit out any lingering p4 errors RenderFinalErrors(); // // Include a link to retry entering user & password. // The link is the originally entered url with the // "pw" flag set to indicate a password failure occurred. htm.Clear(); htm.beginTRow(); htm.beginCol(); StrBuf url; StrBufDict args; args.SetVar( "pw", "" ); fRequest.ConstructSafeURL( url, fRequest.GetURL().Text(), AC_ABOUT, &args ); htm.text( "Click [" ); htm.beginLink( url.Text() ); htm.text( "here" ); htm.endLink(); htm.text( "] to login again to port " ); htm << fRequest.GetPort().Text() << "."; htm.endCol(); htm.endTRow(); fRequest << htm; htm.Clear(); // // Generate the copyright message // htm.beginTRow(); htm.beginCol(); htm << " "; htm.endCol(); htm.endTRow(); htm.beginTRow(); htm.beginCol(); htm << "<hr>"; if (fRequest.GetJavascriptMode() == 2) { htm << "<script language=javascript>" << crlf; htm << "</script>" << crlf; htm << "<noscript>" << crlf; htm << "<p><b><font color=\"#FF0000\" size=+1>"; htm << "WARNING! Javascript is disabled and you must finish logging out:<p>"; htm << "</font><font color=\"#FF0000\">"; htm << "Either close Internet Explorer or click "; htm << "<a href=\"/?ac=169&pw\">here</a>"; htm << " and enter an invalid password.</font></b>"; htm << "<p><hr>"; htm << "</noscript>" << crlf; } htm.endCol(); htm.endTRow(); htm.beginTRow(); htm.beginCol(); htm.beginSpan( "copyright" ); htm << "Copyright 2008 Perforce Software. All rights reserved."; htm.endSpan(); htm.endCol(); htm.endTRow(); htm.endTable(); htm.endCol(); htm.beginCol( NULL, NULL, NULL, NULL, NULL, "10" ); htm << " "; htm.endCol(); htm.endTRow(); htm.endTable(); htm.endCol(); htm.endTRow(); htm.endTable(); fRequest << htm; // // End the page htm.Clear(); htm.endBody(); fRequest << htm; } void p4wLogoutView::StartContent() { // // Start the tables which will show the content // p4wHtml htm; p4wURL urlMaker; StrBuf clearIcon; htm.endTable(); htm.endCol(); htm.endTRow(); htm.endTable(); htm.beginTable( "0", "100%", "0", "1" ); htm.beginTRow(); htm.beginTRow(); htm.beginCol(); htm.beginTable( "0", "100%", "0", "0" ); htm.beginTRow(); htm.beginCol( NULL, NULL, NULL, NULL, NULL, "10" ); htm.endCol(); htm.beginCol(); htm.beginTable( "0", "100%", "0", "0" ); htm.beginTRow(); htm.beginCol(); htm.endCol(); htm.endTRow(); fRequest << htm; } void p4wLogoutView::RenderContent() { // // Generate and send the command. // // Generate the title and set the arguments. DoCmdArgAndTitle(); // // Make the request. p4wLogoutPane LogoutPane( *this, fRequest, title.Text() ); fRequest.p4( "logout", 0, 0, &LogoutPane ); fRequest.p4Wait(); } void p4wLogoutView::DoCmdArgAndTitle() { // // Generate the title and argument list for commands // that are not simple spec forms needing only the -i // option. // title.Set( "logout" ); title << " "; // // Command-line flags for( int i = 0; i < fFlags.Count(); i++ ) ArgAndTitle( fFlags.Get( i )->Text() ); // // Non-empty URL signals that path is part of // the command. if( fRequest.GetURL().Length() ) ArgAndTitle( fRequest.GetPath().Text() ); // // Append command arguments if( fArgs.Length() ) ArgAndTitle( fArgs.Text() ); }
# | 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/Views/p4wLogoutView.cpp | |||||
#2 | 10416 | Lester Cheung | Using HTTPS for favicon when option -ss (HTTPS mode) is used. | ||
#1 | 8914 | Matt Attaway | Initial add of the P4Web source code |