// // Copyright 2000 Perforce Software. All rights reserved. // // This file is part of Perforce - the FAST SCM System. // // // p4wChangesProcessorView -- Generates page of submitted changelists with a form // to generate yet another page of submitted changelists // ------------------------------------- // Includes // #include <stdlib.h> #include <string.h> #include <p4wp4.h> #include "p4wView.h" #include "p4wChangesProcessorView.h" #include "p4wPasswdTestPane.h" #include "p4wMenuPane.h" #include "changeshelper.h" #include "p4wUpdatePane.h" #include "p4wSubmittedChangesPane.h" #include "p4wStrBuf.h" // // ------------------------------------- // Constructors and destructor. // p4wChangesProcessorView::p4wChangesProcessorView( p4wRequest & Request ) : p4wView( Request ), fError( 0 ), fnewServer( 0 ) { // // Determine if this is from file browser or path browser. We need // to do this earlier than in RenderContent because RenderUpdateOK // needs this. if( fRequest.GetCmd() == AC_SUBMITTEDCHANGELISTSFILE ) fIsFromFileBrowser = 1; else fIsFromFileBrowser = 0; // // Set the short and the long versions of the title fShortTitle.Set( "Submitted changelists" ); fFullTitle.Set( "Submitted changelists" ); } p4wChangesProcessorView::~p4wChangesProcessorView() { } // ------------------------------------- // Control item render functions. // void p4wChangesProcessorView::RenderRssHdrLink( p4wHtml *htm ) { StrBuf pathArg; const StrPtr *pat = fRequest.GetStateArg( "pat" ); const StrPtr *is = fRequest.GetStateArg( "is" ); const StrPtr *mx = fRequest.GetDynArg( "mx" ); const StrPtr *u = fRequest.GetDynArg( "u" ); const StrPtr *cl = fRequest.GetDynArg( "cl" ); const StrPtr *all = fRequest.GetDynArg( "al" ); int maxResults = 0; // -c & -u arguments are only supported for servers // with protocol version 12 or above. Issue dummy // cmd to get the server protocol version. if( u || cl ) { const StrPtr *server = fRequest.GetProtocol( "server2" ); if (!server) { p4wPasswdTestPane dummyCmd( *this, fRequest ); fRequest.p4( "info", 0, 0, &dummyCmd ); fRequest.p4Wait(); server = fRequest.GetProtocol( "server2" ); } if( server && server->Atoi() > 11 ) ++fnewServer; } if( mx ) maxResults = mx->Atoi(); // Generate the path argument unless "all" submitted // changelists have been requested if( !all ) pathArg.Set( fRequest.GetPath() ); else pathArg.Set( "//" ); if( !fIsFromFileBrowser || all ) { if( pat ) { if( is && strncmp( pat->Text(), "...", 3 ) ) pathArg << ".../"; pathArg << pat; } else { pathArg << "..."; } } StrBuf feedTitle(pathArg); feedTitle << " - ("; if ( mx ) feedTitle << "Last " << mx->Text(); else feedTitle << "All"; feedTitle << " Changes"; if( u && cl && fnewServer ) feedTitle << " for " << u->Text() << "@" << cl->Text(); if( cl && !u && fnewServer ) feedTitle << " using client '" << cl->Text() << "'"; if( u && !cl && fnewServer ) feedTitle << " for " << u->Text(); feedTitle << ")"; p4wURL urlMaker; p4wStrBuf changeURL; urlMaker.ConstructURL( changeURL, NULL, AC_RSSCHGS, fRequest.GetDynArgs() ); changeURL << RSSEXT; htm->rssHeaderLink( feedTitle.Text(), changeURL.Text() ); } void p4wChangesProcessorView::RenderContent() { // // Issue changes command to get the subset of submitted changes // and options as chosen from options passed in the URL. StrBuf pathArg; const StrPtr *rev1 = fRequest.GetDynArg( "rev1" ); // rev# const StrPtr *rev2 = fRequest.GetDynArg( "rev2" ); // rev# const StrPtr *sr1 = fRequest.GetDynArg( "sr" ); // chg, label, date const StrPtr *sr2 = fRequest.GetDynArg( "sr2" ); // chg, label, date const StrPtr *pat = fRequest.GetStateArg( "pat" ); // file pattern (saved in base!) const StrPtr *is = fRequest.GetStateArg( "is" ); // subfolders (saved in base!) const StrPtr *mx = fRequest.GetDynArg( "mx" ); // max to retrieve const StrPtr *fl = fRequest.GetDynArg( "fl" ); // fl=-i for integrated const StrPtr *u = fRequest.GetDynArg( "u", HE_None ); // user const StrPtr *cl = fRequest.GetDynArg( "cl", HE_None ); // client const StrPtr *srevState = fRequest.GetStateArg( "sr" ); const StrPtr *all = fRequest.GetDynArg( "al" ); // al=y -> only chgs for current path // // -c & -u arguments are only supported for servers // with protocol version 12 or above. Issue dummy // cmd to get the server protocol version. if(( u || cl ) && !fnewServer) { const StrPtr *server = fRequest.GetProtocol( "server2" ); if (!server) { p4wPasswdTestPane dummyCmd( *this, fRequest ); fRequest.p4( "info", 0, 0, &dummyCmd ); fRequest.p4Wait(); server = fRequest.GetProtocol( "server2" ); } if( server && server->Atoi() > 11 ) fnewServer++; } // // Check for flags if( fl ) { if( *fl != "-i" || !SEC_DISALLOW_REVHIST_INTEG || fRequest.isLocalRequest() ) fRequest.p4Arg( fl->Text() ); } if( mx ) { fRequest.p4Arg( "-m" ); fRequest.p4Arg( mx->Text() ); } // // Request submitted changelists only fRequest.p4Arg( "-s" ); fRequest.p4Arg( "submitted" ); if( u && fnewServer ) { fRequest.p4Arg( "-u" ); fRequest.p4Arg( u->Text() ); } if( cl && fnewServer ) { fRequest.p4Arg( "-c" ); fRequest.p4Arg( cl->Text() ); } // // Generate the path argument unless "all" submitted // changelists have been requested if( !all ) pathArg.Set( fRequest.GetPath() ); else pathArg.Set( "//" ); if( !fIsFromFileBrowser || all ) { if( pat ) { if( is && strncmp( pat->Text(), "...", 3 ) ) pathArg << ".../"; pathArg << pat; } else { pathArg << "..."; } } // // If both state and dynamic sr parameters are // set, dynamic gets preference. if( !sr1 && srevState ) sr1 = srevState; if( rev1 ) { pathArg << "#" << rev1; if( rev2) pathArg << "," << rev2; } else if( sr1 ) { pathArg << "@" << sr1; if( sr2 ) pathArg << "," << sr2; } fRequest.p4Arg( "-l" ); if( strcmp( pathArg.Text(), "//..." ) ) { char *p = pathArg.Text(); if (strncmp(p, "////", 4) == 0) p += 2; char *q = strstr( p, " | " ); if (q) *q++ = '\0'; fRequest.p4Arg( p ); while (q) { p = q; *q++ = '/'; *q++ = '/'; if (strncmp(p, "////", 4) == 0) p += 2; q = strstr( p, " | " ); if (q) *q++ = '\0'; fRequest.p4Arg( p ); } } // Run the command. p4wSubmittedChangesPane cmdPane( *this, fRequest, fIsFromFileBrowser ); fRequest.p4( "changes", 0, 0, &cmdPane ); fRequest.p4Wait(); } int p4wChangesProcessorView::RenderUpdateOK() { // // Don't send update pane if we encountered a error if( fError ) return 1; // // Create and send the update pane containing last five changes StrBuf path; path = fRequest.GetPath().Text(); if ( !fIsFromFileBrowser ) { path << "..."; } p4wUpdatePane updatePane( *this, fRequest, path ); updatePane.DrawPane(); return !updatePane.FatalError(); } void p4wChangesProcessorView::RenderMenu() { // // Draw the menu bar p4wMenuPane menuPane( *this, fRequest, "submittedchangelists" ); menuPane.Render( NULL ); }
# | 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/p4wChangesProcessorView.cpp | |||||
#1 | 8914 | Matt Attaway | Initial add of the P4Web source code |