// // Copyright 2000 Perforce Software. All rights reserved. // // This file is part of Perforce - the FAST SCM System. // // p4wDeletePane: // Construct a form used to generate a delete command #include <p4wp4.h> #include "p4wStrBuf.h" #include "p4wDeletePane.h" p4wDeletePane::p4wDeletePane( p4wView & ParentView, p4wRequest & Request, int isFileBrowser ) : p4wRunPane( ParentView, Request ), fIsFileBrowser(isFileBrowser), fState(gettingchanges), fSeenBegin(0), fGotOneChange(0), fGotOneFile(0) { } p4wDeletePane::~p4wDeletePane() { } // ------------------------------------- // Render functions. // void p4wDeletePane::Begin() { if( fSeenBegin ) return; // // Fetch and build the ACTION value. StrBuf actionURL; GetAction( actionURL ); // // Begin the pane and start the form DoComment( "BEGIN DELETE PANE" ); BeginForm( "Open for Delete:", actionURL ); fSeenBegin = 1; } void p4wDeletePane::Render( StrDict * varList ) { if( fState == gettingchanges ) { // Get the user/client information. Ignore changes that are // not by this user/client. StrPtr *noCase = fRequest.GetProtocol( "nocase" ); StrPtr *owner = varList->GetVar( "user" ); const char * client = varList->GetVar( "client" )->Text(); int notOwner = 0; if( ( noCase && owner->CCompare( fRequest.GetUser() ) ) || ( !noCase && owner->XCompare( fRequest.GetUser() ) ) ) notOwner = 1; if( notOwner || strcmp( client, fRequest.GetClient().Text() ) ) return; if( !fGotOneChange ) { // // Start the Options segment BeginOptions(); BeginOptionChange( "Put opened files in changelist" ); fGotOneChange = 1; } DoOption( varList->GetVar( "change" )->Text() ); } else if( fState == gettingfiles ) { // // Skip files already opened UNLESS user specifically chose this file. // Also skip files deleted at head revision unless we have it. if( !fIsFileBrowser ) { StrPtr * action = varList->GetVar( "action" ); StrPtr * haveRev = varList->GetVar( "haveRev" ); StrPtr * headAction = varList->GetVar( "headAction" ); if( action != NULL ) return; if( !haveRev && ( *headAction == "delete" || *headAction == "move/delete" ) ) return; } if( !fGotOneFile && !fIsFileBrowser ) { FilesIn( 0, 0, fRequest.GetPath().Text(), NULL ); BeginSelected( 1, FilesUnchecked() ); fGotOneFile = 1; } StrPtr *depotFile = varList->GetVar( "depotFile" ); StrPtr *clientFile = varList->GetVar( "clientFile" ); // // If clientFile isn't available use depotFile instead if( !clientFile ) clientFile = depotFile; if( !fIsFileBrowser ) { // // If page content limit in bytes has been exceeded, don't // generate this entry if( PageLimitExceeded() ) return; // // Display depotFile in form, but send clientFile // in command for performance reasons. DoFile( !FilesUnchecked(), clientFile, depotFile ); } else { DoListItem( depotFile->Text() ); DoHidden( 1, "File", depotFile->Text() ); } } } void p4wDeletePane::End() { switch( fState ) { case gettingchanges: { // // End the Option select box if( fGotOneChange ) EndSelect(); // // Generate the Files portion. BeginFiles( fRequest.GetPath() ); fState = gettingfiles; if( FatalError() ) { // // End the pane. BeginButtons(); DoHidden( 0, "formActions", "delete" ); DoHidden( 0, "formActions", "redisplay" ); DoButton( "delete", "Open for delete" ); EndButtons(); EndForm(); DoComment( "END DELETE PANE" ); fState = done; } } break; case gettingfiles: { // // End the Files list if we had one. Other // choices have already been rendered. if( fGotOneFile ) { EndFiles(); // // Pathbrowser at the top directory level has only // one choice: all files in view, so hard-code it. } else if( !fIsFileBrowser && fRequest.GetPath() == "//" ) { DoListItem( "All files in //..." ); DoHidden( 0, "Files", "in" ); DoHidden( 0, "dirVal", "and subdirectories" ); // // Pathbrowser not at top directory: show options // of Files in this path and files in this path and // subdirectories } else if( !fIsFileBrowser ) { FilesIn( 0, 1, fRequest.GetPath().Text(), NULL ); } // // End the pane. BeginButtons(); DoHidden( 0, "formActions", "delete" ); DoHidden( 0, "formActions", "redisplay" ); DoButton( "delete", "Open for delete" ); EndButtons(); EndForm(); DoComment( "END DELETE PANE" ); fState = done; } default: break; } } void p4wDeletePane::GetAction( StrBuf & actionURL ) { // // Constructs url used for the form ACTION value ConstructAction( AC_DELETEPROCESSOR, NULL, 1, actionURL ); } void p4wDeletePane::HandleError( Error *err ) { // // Override this because we want to ignore most fstat errors when invoked // from the path browser. If this was invoked from the file browser, output // the error and set the File variable in case user submits the form anyway. if( !fIsFileBrowser ) { DoHandleError( err, 1 ); } else { DoHandleError( err, 0 ); fGotOneFile = 1; DoHidden( 1, "File", fRequest.GetPath().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/Panes/p4wDeletePane.cpp | |||||
#1 | 8914 | Matt Attaway | Initial add of the P4Web source code |