// // Copyright 1999 Perforce Software. All rights reserved. // // This file is part of Perforce - the FAST SCM System. // // p4wUserPane: // Displays the user spec either as a form or read-only #include <p4wp4.h> #include "p4wStrBuf.h" #include "p4wHtml.h" #include "p4wPane.h" #include "p4wUserPane.h" p4wUserPane::p4wUserPane( p4wView & ParentView, p4wRequest & Request, int isForm ) : p4wSpecPane( ParentView, Request, isForm ) { } p4wUserPane::~p4wUserPane() { } // ------------------------------------- // Overrides for spec panes. // int p4wUserPane::IgnoreField( const char * field ) { // // See if this is one of the fields to ignore if( !fIsForm && ( strcmp( field, "Password" ) == 0 ) ) return 1; else if( !fIsForm && ( strcmp( field, "Email" ) == 0 ) ) return (SEC_DONT_SHOW_EMAIL_ADDR && !fRequest.isLocalRequest()); else return 0; } int p4wUserPane::CustomField( const char * field, StrDict * varList, int len, SpecElem *se ) { // // Process our custom fields. int retVal; if( fIsForm ) retVal = doCustomForm( field, varList, len ); else retVal = doCustomNotForm( field, varList ); return retVal; } int p4wUserPane::doCustomNotForm( const char * field, StrDict * varList ) { // // Use a mail link for the Email field if( strcmp( field, "Email" ) == 0 ) { StrPtr * val = varList->GetVar( StrRef( field ) ); StrBuf tag; tag << field << ":"; StrBuf link; link << "mailTo:" << p4wStrBuf().EscapeHTML( *val, Unicode() ); p4wHtml htm; // // Display 'Email' with a mailto link. htm.beginTRow(); htm.beginCol( "top" ); htm.text( tag.Text(), "b" ); htm.endCol(); htm.beginCol(); htm.beginLink( link.Text() ); htm.text( p4wStrBuf().EscapeHTML( *val, Unicode() ).Text() ); htm.endLink(); htm.endCol(); htm.endTRow(); fRequest << htm; return 1; } else { return 0; } } int p4wUserPane::doCustomForm( const char * field, StrDict * varList, int maxFieldLen ) { // // Handle the Password field using ***** to mask it if( strcmp( field, "Password" ) == 0 ) { StrPtr * val = varList->GetVar( StrRef ( field ) ); p4wHtml htm; StrBuf fld; fld << field << ":"; // // Display 'Password' with the password field type. if( !fIsOpen ) htm.beginTRow(); FormatFields( htm, fld.Text() ); if( val ) htm.passwdField( field, val->Text(), maxFieldLen ); else htm.passwdField( field, NULL, maxFieldLen ); htm.endCol(); if( !fLeaveOpen ) htm.endTRow(); fRequest << htm; return 1; } else { return 0; } } void p4wUserPane::CustomAppendToTag(StrBuf tagOut, p4wHtml *htm) { int b = 0; if( strcmp( tagOut.Text(), "Reviews:" ) == 0 ) b = 1; else if( strcmp( tagOut.Text(), "JobView:" ) == 0 ) b = 2; if (b) { p4wURL urlMaker; p4wStrBuf userURL; StrBuf user; if( fRequest.GetURL().Length() == 0 ) { user << fRequest.GetUser().Text(); } else { user << fRequest.GetURL().Text(); } urlMaker.ConstructURL( userURL, user.Text(), b == 1 ? AC_RSSUSER : AC_RSSJOBVIEW, fRequest.GetDynArgs() ); userURL << RSSEXT; htm->beginLink( userURL.Text() ); StrBuf icon; urlMaker.ConstructURL( icon, "/rssIcon", AC_ICON, NULL ); htm->icon( icon.Text(), "25", "47", "RSS 2.0", 1, NULL, NULL, "absmiddle" ); htm->endLink(); } } void p4wUserPane::GetAction( StrBuf & actionURL ) { // // Constructs url used for the form ACTION value ConstructAction( AC_USERCMD, NULL, 0, actionURL ); } void p4wUserPane::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/p4wUserPane.cpp | |||||
#1 | 8914 | Matt Attaway | Initial add of the P4Web source code |