// Copyright 1999 (c) by Perforce Software, Inc. All rights reserved. // // p4wChangesPane: // The changes pane. // ------------------------------------- // Includes // #include <p4wp4.h> #include "p4wStrBuf.h" #include "p4wHtml.h" #include "p4wPane.h" #include "p4wChangesPane.h" // ------------------------------------- // Constructors and destructor. // p4wChangesPane::p4wChangesPane(p4wView & ParentView, p4wRequest & Request, int onlyMyChanges) : p4wPane(ParentView, Request), fOnlyMyChanges(onlyMyChanges), fRowCtr(1) { } p4wChangesPane::~p4wChangesPane() { } // ------------------------------------- // Render functions. // void p4wChangesPane::Begin() { p4wHtml suffix; p4wHtml prefix; p4wHtml htm; p4wURL urlMaker; StrBuf clearIcon; StrBuf grayIcon; StrBuf newBase; StrBuf userURL; // // Construct whitespace spacer & line underneathe title urlMaker.ConstructURL( clearIcon, "/clearpixelIcon", AC_ICON, NULL ); urlMaker.ConstructURL( grayIcon, "/grayPixelIcon", AC_ICON, NULL ); // // Build the user URL fRequest.UseNewBase( newBase, NULL, "path", NULL ); newBase << fRequest.GetUser(); urlMaker.ConstructURL( userURL, newBase.Text(), AC_USERVIEW, NULL, fRequest.GetUnicode() ); jb = fRequest.GetDynArg( "jb" ); // // Begin the pane. htm.comment( "BEGIN CHANGES PANE" ); if (fRequest.GetScreenChunks() & SCRN_TITLE) { // Output the title htm.beginTRow(); htm.beginCol(); htm.beginSpan( "title" ); if (fRequest.GetCmd() == AC_FIXPENDING) { htm << "Add Job "; if (jb) htm << p4wStrBuf().EscapeHTML(*jb, Unicode()); htm << " to Pending Changelist:"; } else htm << "Pending Changelists:"; htm.endSpan(); htm.endCol(); htm.endTRow(); // // Generate line underneath the title htm.beginTRow(); htm.beginCol( "top" ); htm.icon( clearIcon.Text(), "2", "100%", "", 1, "0", "0" ); htm.icon( grayIcon.Text(), "1", "100%", "", 1, "0", "0" ); htm.endCol(); htm.endTRow(); // // Start the table htm.beginTRow(); htm.beginCol(); htm.icon( clearIcon.Text(), "20", "0", "", 1 ); htm.endCol(); htm.endTRow(); } htm.beginTRow(); htm.beginCol(); htm.beginTable( "0", "100%", "0", "1", "#7F7F7F" ); htm.beginTRow( NULL, NULL, "#FFFFFF" ); htm.beginCol(); htm.beginTable( "0", "100%", "0", "0", "#FFFFFF" ); // // Generate table headings. Generate spacers between columns // just in case the Description field is so large that it // crowds the other fields. htm.beginTRow( NULL, NULL, "#EEEEEE" ); htm.beginColHead(); htm.icon( clearIcon.Text(), "18", "5", "", 1 ); htm.endColHead(); htm.beginColHead( NULL, "left" ); htm << "Changelist"; htm.endColHead(); htm.beginColHead( NULL, NULL, NULL, NULL, "#EEEEEE" ); htm.icon( clearIcon.Text(), "0", "12", "", 1 ); htm.endColHead(); htm.beginColHead( NULL, "left" ); htm << "Date"; htm.endColHead(); htm.beginColHead( NULL, NULL, NULL, NULL, "#EEEEEE" ); htm.icon( clearIcon.Text(), "0", "12", "", 1 ); htm.endColHead(); htm.beginColHead( NULL, "left" ); htm << "User"; htm.endColHead(); htm.beginColHead( NULL, NULL, NULL, NULL, "#EEEEEE" ); htm.icon( clearIcon.Text(), "0", "12", "", 1 ); htm.endColHead(); htm.beginColHead( NULL, "left" ); htm << "Description"; htm.endColHead(); htm.endTRow(); htm.beginTRow(); htm.beginCol( "top", NULL, "12", NULL, NULL, NULL, "5" ); htm.icon( grayIcon.Text(), "1", "100%", "", 1, "0", "0" ); htm.endCol(); htm.endTRow(); // // Set up the list of changes and output the default change htm.beginTRow( "top", 0, 0, "list_row" ); htm.beginCol(); htm.endCol(); fRequest << htm; htm.Clear(); // // Changelist (default) prefix.beginCol(); suffix.endCol(); if( !fRequest.GetBrowseMode() ) { StrBufDict cmdArgs; if (fRequest.GetCmd() == AC_FIXPENDING) cmdArgs.SetVar( "jb", jb ); OutputHREF( prefix.Text(), NULL, AC_CHANGEPENDINGEDIT, &cmdArgs, "Default", suffix.Text() ); } else { fRequest << prefix; fRequest << "Default"; fRequest << suffix; } htm.beginCol(); htm.icon( clearIcon.Text(), "0", "12", "", 1 ); htm.endCol(); // // Date htm.beginCol(); htm << "--"; htm.endCol(); htm.beginCol(); htm.icon( clearIcon.Text(), "0", "12", "", 1 ); htm.endCol(); // // User htm.beginCol(); htm.beginLink( userURL.Text() ); htm.text( p4wStrBuf().EscapeHTML( fRequest.GetUser(), Unicode() ).Text() ); htm.endLink(); htm.endCol(); htm.beginCol(); htm.icon( clearIcon.Text(), "0", "12", "", 1 ); htm.endCol(); // // Description htm.beginCol(); htm << "--"; htm.endCol(); // // Vertical space between rows htm.beginTRow( 0, 0, 0, "b" ); htm.beginCol( 0, 0, "100%" ); htm.icon( clearIcon.Text(), "3", "1", "", 1 ); htm.endCol(); htm.endTRow(); fRequest << htm; } void p4wChangesPane::Render(StrDict * varList) { // Get the user/client/changeno information. const char * user = varList->GetVar("user")->Text(); const char * client = varList->GetVar("client")->Text(); StrPtr *changeNo = varList->GetVar("change"); // Ignore changes that are not on this client. if( strcmp(client, fRequest.GetClient().Text() ) ) { if( fOnlyMyChanges ) return; } // // Determine which URL to build. If browse-only use a describe url; // otherwise use the changeEdit url AllCommands cmd; if( !fRequest.GetBrowseMode() ) cmd = AC_CHANGEPENDINGEDIT; else cmd = AC_DESCRIBE; // // Output this change // unless the page content limit in bytes has been exceeded. if( PageLimitExceeded() ) return; p4wHtml htm(1); p4wURL urlMaker; StrBuf newBase; StrBuf clearIcon; StrBuf userURL; StrBuf clientURL; StrBuf changeURL; // // Construct the vertical spacing icon urlMaker.ConstructURL( clearIcon, "/clearpixelIcon", AC_ICON, NULL ); // // Build the user URL fRequest.UseNewBase( newBase, NULL, "path", NULL ); newBase << fRequest.GetUser(); urlMaker.ConstructURL( userURL, newBase.Text(), AC_USERVIEW, NULL, fRequest.GetUnicode() ); // // Build the client URL fRequest.UseNewBase( newBase, NULL, "path", NULL ); newBase << client; urlMaker.ConstructURL( clientURL, newBase.Text(), AC_CLIENTVIEW, NULL, fRequest.GetUnicode() ); // // Build the changelist URL fRequest.UseNewBase( newBase, NULL, "path", NULL ); if( cmd == AC_DESCRIBE ) { newBase << changeNo; urlMaker.ConstructURL( changeURL, newBase.Text(), cmd, NULL, fRequest.GetUnicode() ); } else { StrBufDict cmdArgs; cmdArgs.SetVar( "arg", changeNo ); if (fRequest.GetCmd() == AC_FIXPENDING) cmdArgs.SetVar( "jb", jb ); urlMaker.ConstructURL( changeURL, newBase.Text(), cmd, &cmdArgs, fRequest.GetUnicode() ); } htm.beginTRow( "top", 0, 0, (fRowCtr & 0x01) ? "list_row alt_row" : "list_row" ); htm.beginCol(); htm.endCol(); // // Changelist htm.beginCol(); htm.beginLink( changeURL.Text() ); htm.text( p4wStrBuf().EscapeHTML( *changeNo, Unicode() ).Text() ); htm.endLink(); htm.endCol(); htm.beginCol(); htm.icon( clearIcon.Text(), "0", "12", "", 1 ); htm.endCol(); // // Date htm.beginCol(); htm.beginNobreak(); htm.text( p4wStrBuf().Expand(StrRef("%time@*Y/*m/*d% "), *varList, Unicode() ).Text() ); htm.endNobreak(); htm.endCol(); htm.beginCol(); htm.icon( clearIcon.Text(), "0", "12", "", 1 ); htm.endCol(); // // User htm.beginCol(); htm.beginLink( userURL.Text() ); htm.text( p4wStrBuf().EscapeHTML( StrRef(user), Unicode() ).Text() ); htm.endLink(); htm.endCol(); htm.beginCol(); htm.icon( clearIcon.Text(), "0", "12", "", 1 ); htm.endCol(); // // Description htm.beginCol(); htm.text( p4wStrBuf().Expand(StrRef("%desc% "), *varList, Unicode() ).Text() ); htm.endCol(); htm.endTRow(); // // Vertical space between rows htm.beginTRow( 0, 0, 0, (fRowCtr++ & 0x01) ? "alt_row b" : "b" ); htm.beginCol( 0, 0, "100%" ); htm.icon( clearIcon.Text(), "3", "1", "", 1 ); htm.endCol(); htm.endTRow(); fRequest << htm; } void p4wChangesPane::End() { // // End the "Changes" list. p4wHtml htm; // // End the pane. htm.endTable(); htm.endCol(); htm.endTRow(); htm.endTable(); htm.endCol(); htm.endTRow(); htm.comment( "END CHANGES PANE" ); fRequest << htm; } void p4wChangesPane::RenderError(char *data, int escapeHTML) { RenderErrorTbl( data, escapeHTML ); }
# | 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/p4wChangesPane.cpp | |||||
#1 | 8914 | Matt Attaway | Initial add of the P4Web source code |