% Back page for Unified Process Methodology
%
% Copyright (c) 2009 Stephane GALLAND <galland@arakhne.org>
% 
% This program is free library; you can redistribute it and/or modify
% it under the terms of the GNU Lesser General Public License as
% published by the Free Software Foundation; either version 3 of the
% License, or any later version.
%
% This library is distributed in the hope that it will be useful, but
% WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
% Lesser General Public License for more details.
%
% You should have received a copy of the GNU Lesser General Public
% License along with this library; see the file COPYING.  If not,
% write to the Free Software Foundation, Inc., 59 Temple Place - Suite
% 330, Boston, MA 02111-1307, USA.
%
% Creation date: 2009-10-22
% Modifications:
%   2009-10-30  Rename \setbacklayout to \setbackcover.
%               Add \makebackcover.
%

\global\edef\upm@package@bp@ver{2009/10/30}

\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesPackage{upmethodology-backpage}[\upm@package@bp@ver]

\RequirePackage{upmethodology-p-common}

%-----
% Locales
\def\upm@back@lang@english{
  \gdef\upm@lang@@{\message{**** upmethodology-backpage is using English language ****}}%
}
\def\upm@back@lang@french{
  \gdef\upm@lang@@{\message{**** upmethodology-backpage is using French language ****}}%
}
%----------------------------------------
% OPTIONS
%----------------------------------------
\DeclareOption{french}{%
  \upm@back@lang@french
}
\DeclareOption{francais}{%
  \upm@back@lang@french
}
\DeclareOption{english}{%
  \upm@back@lang@english
}
\ExecuteOptions{english}
\ProcessOptions
\upm@lang@@

\RequirePackage{upmethodology-extension}

%----
% Set the back page layout as the classic layout theme
%\setbackcover{layout_name}
\newcommand{\setbackcover}[1]{%
	\ifthenelse{\equal{#1}{none}}{%
		\global\let\makebackcover\relax%
	}{%
		\errmessage{invalid back layout theme: #1}%
	}%
}
\newcommand{\setbacklayout}[1]{\errmessage{\string\setbacklayout\ is deprecated. Use \string\setbackcover}}

\setbackcover{none}

\AtEndDocument{
	\Ifdefined{backpage}{
		\gdef\makebackcover{
			\ifupmarticleformat\clearpage%
			\else
				\cleardoublepage%
				\if@twoside\thispagestyle{empty}\mbox{}\clearpage\fi
			\fi
			\thispagestyle{empty}\Get{backpage}
		}
	}
}

\endinput