p4wJobsView.cpp #1

  • //
  • main/
  • guest/
  • perforce_software/
  • p4web/
  • main/
  • src/
  • Views/
  • p4wJobsView.cpp
  • View
  • Commits
  • Open Download .zip Download (3 KB)
//
// Copyright 2001 Perforce Software.  All rights reserved.
//
// This file is part of Perforce - the FAST SCM System.
//

//
// p4wJobsView -- Generates page of jobs with a form
//	to generate the page with various options.


#include <stdlib.h>
#include <string.h>

#include <p4wp4.h>

#include "p4wView.h"
#include "p4wJobsView.h"

#include "p4wMenuPane.h"
#include "changeshelper.h"
#include "p4wUpdatePane.h"
#include "p4wJobsPane.h"
#include "p4wStrBuf.h"


p4wJobsView::p4wJobsView( p4wRequest & Request )
	: p4wView( Request ), fError(0)
{
	//
	// Set the short and the long versions of the title
	
	const StrPtr *ft   = fRequest.GetDynArg( "ft" );
	if (ft)
	{
		fShortTitle.Set( "Jobs (" );
		fShortTitle << ft->Text() << ")";
		fFullTitle.Set( "Jobs (" );
		fFullTitle << ft->Text() << ")";
	}
	else
	{
		fShortTitle.Set( "Jobs" );
		fFullTitle.Set( "Jobs" );
	}
}

p4wJobsView::~p4wJobsView()
{
}

void p4wJobsView::RenderContent()
{
	//
	// Issue jobs command to get the subset of jobs
	// chosen from options passed in the URL.

	const StrPtr *mx = fRequest.GetDynArg( "mx" );
	const StrPtr *ft = fRequest.GetDynArg( "ft" );
	const StrPtr *jasc = fRequest.GetDynArg( "jasc" );
	const StrPtr *jfp = fRequest.GetDynArg( "jfp" );
	const StrPtr *jin = fRequest.GetDynArg( "jin" );
	if (jin && SEC_DISALLOW_REVHIST_INTEG && !fRequest.isLocalRequest())
		jin = NULL;
	
	//
	// Max number of jobs on the page
	
	if( mx && mx->Length() ) {
		fRequest.p4Arg( "-m" );
		fRequest.p4Arg( mx->Text() );
	}

	//
	// Use a job filter
	
	if( ft && ft->Length() ) {
		fRequest.p4Arg( "-e" );
		fRequest.p4Arg( ft->Text() );
	}
	
	//
	// Jobs displayed in ascending or descending order
	
	if( !jasc )
		fRequest.p4Arg( "-r" );
		
	//
	// Show jobs including integrations
	
	if( jin )
		fRequest.p4Arg( "-i" );
		
	//
	// Show jobs fixed in path
	
	if( jfp || jin ) {
		AllCommands rt = fRequest.GetLastReturnType();
		StrBuf path;
		path.Set( fRequest.GetPath().Text() );
		if( rt == AC_PATHBROWSER )
			path << "...";
			
		fRequest.p4Arg( path.Text() );
	}
	
	p4wJobsPane cmdPane( *this, fRequest );
	fRequest.p4( "jobs", 0, 0, &cmdPane );
	fRequest.p4Wait();
}

void p4wJobsView::RenderMenu()
{
	p4wMenuPane menuPane( *this, fRequest, "job" );
	menuPane.Render( NULL );
}

void p4wJobsView::RenderRssHdrLink( p4wHtml *htm )
{
	const StrPtr *mx = fRequest.GetDynArg( "mx" );
	const StrPtr *ft = fRequest.GetDynArg( "ft" );

	StrBuf feedTitle;
	feedTitle << "Jobs - ";
	if (ft)
		feedTitle << "(" << ft->Text() << ") - ";
	
	if ( mx )
		feedTitle << "Last " << mx->Text();
	else
		feedTitle << "All";

	p4wStrBuf jobURL;
	p4wJobsPane jobsPane( *this, fRequest );
	jobsPane.ConstructLocationURL( &jobURL );

	htm->rssHeaderLink( feedTitle.Text(), jobURL.Text() );
}
# 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/Views/p4wJobsView.cpp
#1 8914 Matt Attaway Initial add of the P4Web source code