// // Copyright 2001 Perforce Software. All rights reserved. // // This file is part of Perforce - the FAST SCM System. // // p4wJobCmdPane: // Generates a result pane containing the result of the job -i // command. The expected flow of control has 2 states. The first // state is getting the result of an optional p4 jobs -e command // used to determine if the job exists. The 2nd state generates the // the result of the job -i command. #include <p4wp4.h> #include "p4wStrBuf.h" #include "p4wHtml.h" #include "p4wPane.h" #include "p4wJobCmdPane.h" p4wJobCmdPane::p4wJobCmdPane( p4wView & ParentView, p4wRequest & Request, const char *jobName ) : p4wPane( ParentView, Request ), fSeenBegin(0), fJobExists(0) { // // Job name is the value of field 101 on the job edit form if( jobName ) fJobName.Set( jobName ); fState = getJobs; } p4wJobCmdPane::~p4wJobCmdPane() { } void p4wJobCmdPane::Begin() { // // Only process Begin() once if( fSeenBegin ) return; fSeenBegin = 1; // // Draw the results header p4wHtml htm; p4wStrBuf title; p4wStrBuf cmd; p4wURL urlMaker; StrBuf grayIcon; // // Used to generate a line underneath the title urlMaker.ConstructURL( grayIcon, "/grayPixelIcon", AC_ICON, NULL ); cmd << "Job " << fRequest.GetURL(); title << cmd << " Status:"; htm.comment( "BEGIN STATUS PANE" ); htm.beginTRow(); htm.beginCol(); htm.beginSpan( "title" ); if( fRequest.GetURL().Length() ) htm << "Edit Job Status:"; else htm << "Create Job Status:"; htm.endSpan(); htm.endCol(); htm.endTRow(); htm.beginTRow(); htm.beginCol( "top" ); htm.icon( grayIcon.Text(), "1", "100%", "", 1, "0", "0" ); htm.endCol(); htm.endTRow(); htm.beginTRow(); htm.beginCol(); htm.beginDList(); htm.dListTag(); htm.text( "Command:", "b" ); htm.dListVal(); htm.text( p4wStrBuf().EscapeHTML( cmd, Unicode() ).Text() ); htm.dListTag(); htm.text( "Result:", "b" ); fRequest << htm; } void p4wJobCmdPane::RenderInfo( char *data, char level ) { // // Output the result of the job -i command p4wHtml htm; htm.dListVal(); htm.text( p4wStrBuf().EscapeHTML( StrRef( data ), Unicode() ).Text() ); fRequest << htm; } void p4wJobCmdPane::Render( StrDict *vars ) { // // This is called only if the jobs -e jobname // command successfully found jobs with that // jobname. We use this to determine if the job // name entered on the form matches an existing job. // // Case-insensitive server? If this jobs -e command // returned a match, we've found that the job exists. StrPtr *noCase = fRequest.GetProtocol( "nocase" ); if( noCase ) { fJobExists = 1; return; } // // Jobs -e jobname is case-insensitive. If we // have a case-sensitive server, we need to compare // the returned jobname with the jobname in the form and // do an exact match to determine if the job is // indeed the same. StrPtr *s = vars->GetVar( StrRef( "specdef" ) ); SpecElem *se; if( s != NULL ) { Error e; fJobSpec.Decode( s, &e ); } for( int j = 0; j < fJobSpec.Count(); j++ ) { se = fJobSpec.Get( j ); if( se->code == 101 ) { if( !fJobName.XCompare( *vars->GetVar( se->tag ) ) ) fJobExists = 1; break; } } } void p4wJobCmdPane::RenderError( char *data, int escapeHTML ) { // // Ignore errors from the first state ( jobs -e command ) if( fState == getJobs ) return; RenderErrorList( data, escapeHTML ); } void p4wJobCmdPane::End() { // // Handle state transitions p4wHtml htm; if( FatalError() || fState == getForm ) { htm.endDList(); htm.endCol(); htm.endTRow(); htm.comment( "END STATUS PANE" ); fRequest << htm; } else { fState = getForm; return; } }
# | 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/p4wJobCmdPane.cpp | |||||
#1 | 8914 | Matt Attaway | Initial add of the P4Web source code |