// Copyright 2000 Perforce Software. All rights reserved. // // This file is part of Perforce - the FAST SCM System. // // p4wLabelPane: // Displays output of the label command or displays a form to edit // a label spec. #include <p4wp4.h> #include "p4wStrBuf.h" #include "p4wHtml.h" #include "p4wPane.h" #include "p4wLabelPane.h" p4wLabelPane::p4wLabelPane( p4wView & ParentView, p4wRequest & Request, int isForm ) : p4wSpecPane( ParentView, Request, isForm ) { } p4wLabelPane::~p4wLabelPane() { } int p4wLabelPane::IgnoreField( const char * field ) { // // No fields are ignored return 0; } int p4wLabelPane::CustomField( const char * field, StrDict * varList, int len, SpecElem *se ) { // // No custom fields if this isn't a form (unless this is the // description field) 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 of the label edit form if( !strcmp( field, "Label" ) ) { if( !fIsOpen ) htm.beginTRow(); FormatFields( htm, "Label:" ); if( fRequest.GetCmd() == AC_CREATELABEL || fRequest.GetCmd() == AC_CREATELABELTMP ) { htm.textField( "Label", NULL, len ); htm.endCol(); } else { char * val = varList->GetVar(StrRef((field)))->Text(); htm.text( p4wStrBuf().EscapeHTML( StrRef(val), Unicode() ).Text() ); htm.hiddenField( "Label", p4wStrBuf().EscapeHTML( StrRef(val), Unicode() ).Text() ); htm.endCol(); } if( !fLeaveOpen ) htm.endTRow(); fRequest << htm; return 1; } else if( !strcmp( field, "Options" ) ) { int locked = 0; if( *varList->GetVar( StrRef( field ) ) == "locked" ) ++locked; if( !fIsOpen ) htm.beginTRow(); FormatFields( htm, "Options:", NULL, "top" ); htm.checkbox( "Options", "locked", locked, 0, "locked" ); htm.label( "locked", "locked" ); htm.endCol(); if( !fLeaveOpen ) htm.endTRow(); fRequest << htm; return 1; } else if( !strcmp( field, "View" ) ) { if( !fIsOpen ) htm.beginTRow(); FormatFields( htm, "View:", "top", "top" ); // // Generate choice of using current path as view // only if this is a create and user is not in // workspace mode, (since workspace path cannot be used in // a label view). if( fRequest.GetCmd() == AC_CREATELABEL && fRequest.GetViewMode() != VM_WORKSPACE ) { // // Original url does not have the path. Use the // path browser's return url as the path. StrBuf path; path.Set( fRequest.GetReturnURL( AC_PATHBROWSER ) ); path << "..."; htm.radio( "ViewOpt", "in", 1, 0, "ViewOptin" ); htm.label( path.Text(), "ViewOptin" ); htm.hiddenField( "dirVal", path.Text() ); htm.linebreak(); htm.radio( "ViewOpt", "selected", 0, 0, "ViewOptselected" ); htm.label( "As specified below:", "ViewOptselected" ); htm.linebreak(); } else { htm.hiddenField( "ViewOpt", "selected" ); } htm.beginTextbox( "View", 6, fTextALen ); const StrPtr *p; for( int i = 0; ( p = varList->GetVar( StrRef( "View" ), i ) ) != NULL; i++ ) htm.text( p4wStrBuf().EscapeHTML( *p, Unicode() ).Text() ); htm.endTextbox(); htm.endCol(); if( !fLeaveOpen ) htm.endTRow(); fRequest << htm; return 1; } return 0; } void p4wLabelPane::GetAction( StrBuf & actionURL ) { // // Constructs url used for the form ACTION value int usePath = ( fRequest.GetCmd() == AC_EDITLABEL ? 1 : 0 ); StrBuf lacVal; lacVal << (int)fRequest.GetCmd(); StrBufDict args; if( fRequest.GetCmd() == AC_CREATELABELTMP ) { args.SetVar( "lac", lacVal.Text() ); ConstructAction( AC_LABELCMD, &args, usePath, actionURL ); } else { ConstructAction( AC_LABELCMD, NULL, usePath, actionURL ); } } void p4wLabelPane::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/p4wLabelPane.cpp | |||||
#1 | 8914 | Matt Attaway | Initial add of the P4Web source code |