// // Copyright 1999 Perforce Software. All rights reserved. // // This file is part of Perforce - the FAST SCM System. // // p4wRSSUserPane: // Generates the RSS feed for the User's Reviews #include <p4wp4.h> #include "p4wStrBuf.h" #include "p4wHtml.h" #include "p4wPane.h" #include "p4wRSSUserPane.h" #include "p4wRSSView.h" p4wRSSUserPane::p4wRSSUserPane( p4wView & ParentView, p4wRequest & Request ) : p4wPane( ParentView, Request ), fSeenBegin(0), fGotSpec(0), fSeenData(0) { } p4wRSSUserPane::~p4wRSSUserPane() { } void p4wRSSUserPane::Begin() { } void p4wRSSUserPane::Render( StrDict * varList ) { maxResults = 0; int i; for( i = 0; i < fSpec->Count(); i++ ) { // Get our spec element. SpecElem *se = fSpec->Get( i ); const char *val = NULL; // Ignore all fields except Username and Reviews // List values are stored in <varname>0, <varname>1, etc. if( !se->IsList() && ( varList->GetVar( se->tag.Text() ) == NULL) ) continue; if (!StrPtr::CCompare( se->tag.Text(), "User")) // generate feed title { feedTitle << "Reviews for "; if( fRequest.GetURL().Length() == 0 ) { feedTitle << fRequest.GetUser().Text(); } else { feedTitle << fRequest.GetURL().Text(); } continue; } if (StrPtr::CCompare( se->tag.Text(), "Reviews")) continue; // Get the value of this field. if( varList->GetVar( se->tag.Text() ) != NULL ) val = varList->GetVar( se->tag.Text() )->Text(); if( se->IsList() ) { const StrPtr * p; if( varList->GetVar( se->tag, 0 ) == NULL ) continue; int d; for( d = 0; ( p = varList->GetVar( se->tag, d ) ) != NULL; d++ ) { maxResults++; } if (!maxResults) break; // no Reviews // // Request approx 60 chages total if (maxResults < 11) maxResults = 60/maxResults; else maxResults = 5; for( d = 0; ( p = varList->GetVar( se->tag, d ) ) != NULL; d++ ) { if (d) pathArg << " | "; pathArg << p; } } } } void p4wRSSUserPane::End() { } // Use the maxresults and pathArg gotten from the user spec // to generate the XML for the RSS feed. void p4wRSSUserPane::Finish() { if (!maxResults) // there are no Reviews { fRequest << " "; return; } // Run the changes command. ChangesHelper * ch; ch = new ChangesHelper( fRequest.GetClientApi(), pathArg, maxResults ); StrBuf mxBuf; mxBuf << StrNum(maxResults); StrPtr *mx = &mxBuf;; p4wRSSView rssPane( fRequest ); rssPane.RenderWithChgsHelper(ch, &pathArg, mx, 0, 0, feedTitle); delete ch; }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#2 | 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. |
||
#1 | 8914 | Matt Attaway | Initial add of the P4Web source code |