// // Copyright 2003 Perforce Software. All rights reserved. // // This file is part of Perforce - the FAST SCM System. // // p4wAnnFilelogPane: // Saves filelog for specified file for later use by annotate #include <p4wp4.h> #include "p4wStrBuf.h" #include "p4wHtml.h" #include "p4wPane.h" #include "p4wAnnFilelogPane.h" p4wAnnFilelogPane::p4wAnnFilelogPane( p4wView & ParentView, p4wRequest & Request, StrBuf *fl, int *cwid, int *uwid, p4wHtml *phtm ) : p4wPane( ParentView, Request ), fSeenData(0), fRowCtr(0), fExtended(0) { fFileLog = fl; *fFileLog << "\n"; fChgWidth = cwid; *fChgWidth = 0; fUsrWidth = uwid; *fUsrWidth = 0; fhtm = phtm; } p4wAnnFilelogPane::~p4wAnnFilelogPane() { } void p4wAnnFilelogPane::Begin() { fhtm->comment( "BEGIN ANNOTATE POPUPS" ); } void p4wAnnFilelogPane::Render( StrDict * varList ) { // // Render may be called more than once if this is an extended // filelog. The first time the depotPath matches the // url's file path. Subsequent calls will require sending a // new base since the path may be different from the BASE path. StrBuf changeBase; const StrPtr *depotPath = varList->GetVar( "depotFile" ); if( !fSeenData ) { fSeenData = 1; changeBase.Set( fRequest.GetURL() ); } else { fRequest.UseNewBase( changeBase, NULL, "path", depotPath->Text() ); fExtended++; } // // Save these filelog entries for each revision const StrPtr *thx = fRequest.GetStateArg( "thx" ); StrBuf descText; // // Parse the filelog entry int i, j; p4wURL urlMaker; StrBuf url; StrBuf newBase; StrBuf zero; zero.Set("0"); StrPtr *val; for( i = 0; ( val = varList->GetVar( StrRef("rev"), i ) ) != NULL; i++) { // // Begin popup filelog entry StrBuf id; id << "menu_" << varList->GetVar( StrRef("change"), i ); fhtm->beginDiv(id.Text(), "ttip", "display:none"); if (fExtended) *fhtm << depotPath->Text(); *fhtm << "<b>"; // // Rev Number *fFileLog << val << "\t"; urlMaker.ConstructURL( url, changeBase.Text(), AC_BROWSEFILE, NULL, fRequest.GetUnicode() ); url << "&sr=" << varList->GetVar( StrRef("change"), i ); fhtm->beginLink(url.Text()); *fhtm << "#" << val; fhtm->endLink(); if (fExtended) *fhtm << "<br>"; else *fhtm << " "; // // Changelist Number StrPtr *changeNo = varList->GetVar( StrRef("change"), i ); if (!changeNo->Atoi()) { changeNo = &zero; *fhtm << "Change: Default"; } else { fRequest.UseNewBase( newBase, NULL, "path", NULL ); newBase << changeNo; urlMaker.ConstructURL( url, newBase.Text(), AC_DESCRIBE, NULL, fRequest.GetUnicode() ); *fhtm << "Change: "; fhtm->beginLink(url.Text()); *fhtm << changeNo; fhtm->endLink(); } *fhtm << " "; *fFileLog << changeNo << "\t"; if (*fChgWidth < changeNo->Length()) *fChgWidth = changeNo->Length(); // // Date *fhtm << "on " << p4wStrBuf().ExpandList( StrRef("%time@*Y/*m/*d *H:*M%"), *varList, i, Unicode() ).Text() << " "; // // User descText.Clear(); descText << p4wStrBuf().ExpandList( StrRef("%user%"), *varList, i, Unicode() ).Text(); *fFileLog << descText << "\t"; if (*fUsrWidth < descText.Length()) *fUsrWidth = descText.Length(); fRequest.UseNewBase( newBase, NULL, "path", NULL ); newBase << descText; urlMaker.ConstructURL( url, newBase.Text(), AC_USERVIEW, NULL, fRequest.GetUnicode() ); *fhtm << "by "; fhtm->beginLink(url.Text()); *fhtm << descText; fhtm->endLink(); *fhtm << " "; // // Type StrPtr *type = varList->GetVar( StrRef("type"), i ); *fhtm << "(" << type->Text() << ") "; // // Action StrPtr *action = varList->GetVar( StrRef("action"), i ); if (*action != "edit") *fFileLog << action; *fFileLog << "\t"; *fhtm << "'" << action << "'"; // // Description *fhtm << "</b>"; fhtm->linebreak(); descText.Clear(); descText << p4wStrBuf().ExpandList(StrRef("%desc%"), *varList, i, Unicode(), 1 ); *fhtm << descText; #if 0 // Branch/merge info for( j = 0; (val = varList->GetVar(StrRef("erev"), i, j)) != NULL; j++ ) { const StrPtr *erevPath = varList->GetVar(StrRef("file"), i, j); // htm.linebreak(); // htm << p4wStrBuf().ExpandArray( StrRef("%how% "), // *varList, i, j, Unicode() ); } #endif *fFileLog << "\n"; fRowCtr++; fhtm->endDiv(); *fhtm << crlf; } } void p4wAnnFilelogPane::End() { fhtm->comment( "END ANNOTATE POPUPS" ); } void p4wAnnFilelogPane::RenderError( char *data, int escapeHTML ) { 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/p4wAnnFilelogPane.cpp | |||||
#1 | 8914 | Matt Attaway | Initial add of the P4Web source code |