// Copyright 2000 Perforce Software. All rights reserved. // // This file is part of Perforce - the FAST SCM System. // // p4wBranchPane: // Displays a branch spec which is either read-only or is a form #include <p4wp4.h> #include "p4wStrBuf.h" #include "p4wHtml.h" #include "p4wPane.h" #include "p4wBranchPane.h" char *opts[] = { "Only allow owner to change branch spec <I>(locked)</I>", "Use indirect integration history to find base <I>(indirect)</I>" }; p4wBranchPane::p4wBranchPane( p4wView & ParentView, p4wRequest & Request, int isForm ) : p4wSpecPane( ParentView, Request, isForm ) { } p4wBranchPane::~p4wBranchPane() { } int p4wBranchPane::IgnoreField( const char * field ) { // // No fields are ignored return 0; } int p4wBranchPane::CustomField( const char * field, StrDict * varList, int len, SpecElem *se ) { // // Only the form has custom fields (except for Description) p4wHtml htm; if( !fIsForm && strcmp( field, "Description" ) ) { return 0; } else if( !fIsForm ) { char * dval = varList->GetVar(StrRef((field)))->Text(); htm.beginTRow(); htm.beginCol( "top" ); htm.text( "Description", "b" ); htm.endCol(); htm.beginCol(); htm.beginUnformatted( "normal" ); htm.text( p4wStrBuf().EscapeHTML( StrRef(dval), Unicode() ).Text() ); htm.endUnformatted(); htm.endCol(); htm.endTRow(); fRequest << htm; return 1; } // // Handle custom fields in the branch edit form if( !strcmp( field, "Branch" ) ) { if( !fIsOpen ) htm.beginTRow(); FormatFields( htm, "Branch:" ); if( fRequest.GetCmd() == AC_CREATEBRANCH ) { htm.textField( "Branch", NULL, len ); htm.endCol(); } else { char * val = varList->GetVar(StrRef((field)))->Text(); htm.text( p4wStrBuf().EscapeHTML( StrRef(val), Unicode() ).Text() ); htm.hiddenField( "Branch", p4wStrBuf().EscapeHTML( StrRef(val), Unicode() ).Text() ); htm.endCol(); } if( !fLeaveOpen ) htm.endTRow(); fRequest << htm; return 1; } else if( !strcmp( field, "Options" ) ) { // // Check the protocol level to see if "indirect" is // supported (2002.2+ until 2004.2) int iSupp = 0; const StrPtr *srv = fRequest.GetProtocol( "server2" ); if( srv && ( srv->Atoi() > 13 ) && ( srv->Atoi() < 18 ) ) ++iSupp; // // Get option values int locked = 0; int indirect = 0; StrPtr *v = varList->GetVar( "Options" ); StrBuf val; val.Set( v ); char *optVect[2]; int wc = StrOps::Words( val, v->Text(), optVect, 2 ); for( int opt = 0; opt < wc; opt++ ) { if( !strcmp( optVect[opt], "locked" ) ) ++locked; else if( !strcmp( optVect[opt], "indirect" ) ) ++indirect; } // // Output the Options checkbox(es). if( !fIsOpen ) htm.beginTRow(); FormatFields( htm, "Options:", NULL, "top" ); htm.checkbox( "Options", "locked", locked, 0, "locked" ); htm.label( opts[0], "locked" ); htm.endCol(); if( !fLeaveOpen || iSupp ) htm.endTRow(); // 2002.2 server // has the indirect option: don't present this // if running with an older server. if( !iSupp ) { fRequest << htm; return 1; } htm.beginTRow(); htm.beginCol(); htm.endCol(); htm.beginCol( "top", NULL, "3" ); htm.checkbox( "Options", "indirect", indirect, 0, "indirect" ); htm.label( opts[1], "indirect" ); htm.endCol(); if( !fLeaveOpen ) htm.endTRow(); fRequest << htm; return 1; } return 0; } void p4wBranchPane::GetAction( StrBuf & actionURL ) { // // Constructs url used for the form ACTION value. int usePath = ( AC_EDITBRANCH ? 1 : 0 ); ConstructAction( AC_BRANCHCMD, NULL, usePath, actionURL ); } void p4wBranchPane::RenderInfo( char *data, char level ) { if (!fRequest.bQuiet()) printf("%s\n", data); }
# | 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/p4wBranchPane.cpp | |||||
#1 | 8914 | Matt Attaway | Initial add of the P4Web source code |