// // Copyright 2000 Perforce Software. All rights reserved. // // This file is part of Perforce - the FAST SCM System. // // // p4wUnlockPane: // Generates a form to specify options for the unlock command #include <p4wp4.h> #include "p4wStrBuf.h" #include "p4wUnlockPane.h" p4wUnlockPane::p4wUnlockPane( p4wView & ParentView, p4wRequest & Request ) : p4wRunPane( ParentView, Request ), fState(gettingchanges), fSeenBegin(0), fGotOneFile(0) { } p4wUnlockPane::~p4wUnlockPane() { } // ------------------------------------- // Render functions. // void p4wUnlockPane::Begin() { if( fSeenBegin ) { return; } // // Fetch and build the ACTION value. StrBuf actionURL; GetAction( actionURL ); // // Begin the pane. DoComment( "BEGIN UNLOCK PANE" ); BeginForm( "Command:", actionURL ); // // Start the Files portion. BeginFiles( fRequest.GetPath(), 1 ); BeginFilesChange( "Unlock files in changelist" ); fSeenBegin = 1; } void p4wUnlockPane::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; DoOption( varList->GetVar( "change" )->Text() ); } else if( fState == gettingfiles ) { // // Only show files that are opened and locked. if( varList->GetVar( "ourLock" ) == NULL ) return; if( !fGotOneFile ) { // // If we are at the // directory, the // Files in subdirectory/this level only // choices are either redundant or useless, // so replace them with one choice for // all opened files. if( fRequest.GetPath() == "//" ) { DoRadio( 1, 0, "Files", "in", "All locked files", 0, 0, "Filesin" ); DoHidden( 0, "dirVal", "and subdirectories" ); } else { FilesIn( 0, 0, fRequest.GetPath().Text(), NULL, 1 ); } 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 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 ); } } void p4wUnlockPane::End() { if( FatalError() || fState == gettingfiles ) { // // End the changelist select box if( fState == gettingchanges ) EndSelect(); // // End the Files list if( fGotOneFile ) { EndFiles(); // // Pathbrowser at the top directory level: show // option "All files" instead of files in current // directory and files in subdirectory since there // cannot be any files in the current directory at // the top level. } else if( fRequest.GetPath() == "//" ) { DoRadio( 1, 1, "Files", "in", "All files in //...", 0, 0, "Filesin" ); 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 { FilesIn( 0, 1, fRequest.GetPath().Text(), NULL, 1 ); } // // Unlock button BeginButtons(); DoHidden( 0, "formActions", "unlock" ); DoHidden( 0, "formActions", "redisplay" ); DoButton( "unlock", "Unlock" ); EndButtons(); // // End the pane. EndForm(); DoComment( "END UNLOCK PANE" ); fState = done; } else if( fState == gettingchanges ) { // // End the changelist select box EndSelect(); // // Generate the Files portion. fState = gettingfiles; } } void p4wUnlockPane::GetAction( StrBuf & actionURL ) { // // Constructs url used for the form ACTION value ConstructAction( AC_UNLOCKPROCESSOR, NULL, 1, actionURL ); } void p4wUnlockPane::HandleError( Error *err ) { // // Override this because we want to ignore most fstat errors DoHandleError( err, 1 ); } void p4wUnlockPane::RenderError( char *data, int escapeHTML ) { if( fState == gettingchanges ) EndSelect(); 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/p4wUnlockPane.cpp | |||||
#1 | 8914 | Matt Attaway | Initial add of the P4Web source code |