%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% HTML specfic commands
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newcommand{\cmisgraphics}[3]
{
\HCode{<div><img src="images/#1.png" alt="#3"/></div>}
}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% CMIS title sections
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newcommand{\oasistitle}[1]
{
\begin{spacing}{2}
\HCode{<div style="color: \#552681; font-size: 24pt;">}
\textbf{#1}
\HCode{</div>}
\end{spacing}
}

\newcommand{\oasisstagelabel}[1]
{
\begin{spacing}{2}
\HCode{<div style="color: \#552681; font-size: 18pt;">}
\textbf{#1}
\HCode{</div>}
\end{spacing}
}

\newcommand{\oasisdate}[1]
{
\begin{spacing}{2}
\HCode{<div style="color: \#552681;  font-size: 18pt;">}
\textbf{#1}
\HCode{</div>}
\end{spacing}
}

\newcommand{\oasisnoticelabel}[1]
{
\begin{spacing}{2}
\HCode{<div style="color: \#552681;  font-size: 18pt;">}
\textbf{#1}
\HCode{</div>}
\end{spacing}
}

\newcommand{\oasisspecificationuris}[1]
{
\HCode{<div style="color: \#552681; font-size: 12pt;">}
\textbf{#1}
\HCode{</div>}
}

\newenvironment{oasistitlesection}[1]
{
\HCode{<div style="color: \#552681;  font-size: 10pt;">}
\textbf{#1:}
\HCode{</div>}
\HCode{<div style="margin-left: 20px;">}
}
{
\HCode{</div>}
}



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% CMIS type attributes
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% new environment: CMIS type attribute
\newenvironment{cmisattribute}[2]
{
\HCode{<div style="width: 200px; float: left;">}\texttt{\textbf{#1}}\HCode{</div>}
\HCode{<span>}#2\HCode{</span>}\\
\begin{tabular}{p{20px}p{200px}}
&}
{\\
\end{tabular}\\
\vspace{0.05in}
}

% new command: CMIS type attribute value
\newcommand{\cmisattributevalue}[2]
{
\texttt{\textbf{#1}}\\
\indent
Value: #2\\
}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% CMIS properties
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% new environment: CMIS propery
\newenvironment{cmisproperty}[2]
{
\vspace{0.05in}
\begin{tabular}{p{20px}p{200px}p{200px}}
\multicolumn{2}{p{20px}}{\textbf{\texttt{#1}}} & #2\vspace{0.05in}\\
}
{
\end{tabular}\\
\vspace{0.05in}\\
}

% new command: CMIS property detail
\newcommand{\cmispropertydetail}[2]{& #1: & #2\\}

% new command: CMIS property comment
\newcommand{\cmispropertycomment}[1]{\\&\multicolumn{2}{p{20px}}{#1}\\}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% CMIS allowable actions
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% new environment: CMIS allowable action
\newenvironment{cmisallowableaction}[1]
{
\textbf{#1}
\vspace{0.05in}\\
\begin{tabular}{p{0.1in}p{1in}p{4.8in}}
}
{
\end{tabular}\\
\vspace{0.05in}\\
}

% new command: CMIS allowable action detail
\newcommand{\cmisallowableactiondetail}[2]{& #1: & #2\\}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% CMIS version properties
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% new environment: CMIS version property
\newenvironment{cmisversionproperty}[2]
{
\begin{tabular}{p{3in}l}
\texttt{\textbf{#1}} & #2\\
\end{tabular}\\\
\begin{tabular}{p{0.3in}p{5.7in}}
&}
{\\
\end{tabular}\\
\vspace{0.05in}
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% CMIS general description
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% new environment: CMIS description
\newenvironment{cmisdescription}[1]
{
\begin{tabular}{p{20px}p{600px}}
\multicolumn{2}{l}{\textbf{#1:}}\\
&\setlength{\topsep}{0in}\setlength{\parsep}{0in}\setlength{\partopsep}{0in}   }
{\\
\end{tabular}\\
\vspace{0.05in}
}


\newenvironment{cmisexample}[1]
{
\HCode{<div style="padding: 5px; background-color: \#E6E6E6;">}
\textbf{Example:}\\
Request: \texttt{#1-request.log}\\
Response: \texttt{#1-response.log}
\HCode{</div>}
\vspace{0.2in}
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% CMIS services
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newcommand{\cmisserviceref}[1]{\ref{dm:service:#1}~\nameref{dm:service:#1}}

\newcommand{\cmisservicelink}[1]{\texttt{\textmd{\nameref{dm:service:#1}}}}

\newcommand{\cmisexceptionlink}[1]{\texttt{\hyperref[dm:exception:#1]{#1}}}

\newenvironment{cmisservice}[1]
{
\subsubsection{#1}
\label{dm:service:#1}
}
{}

\newenvironment{cmisservicedescription}[1]
{\noindent\textbf{#1:}}{\vspace{0.05in}}

\newenvironment{cmisserviceinputs}
{
\paragraph{Inputs}
}
{}

\newenvironment{cmisservicerequired}
{
\textbf{Required:}
\HCode{<ul>}
}
{
\HCode{</ul>}
}

\newenvironment{cmisserviceoptional}
{
\textbf{Optional:}
\HCode{<ul>}
}
{
\HCode{</ul>}
}

\newenvironment{cmisserviceoutputs}
{
\paragraph{Outputs}
\HCode{<ul>}
}
{
\HCode{</ul>}
}

\newenvironment{cmisserviceexpections}
{
\paragraph{Exceptions Thrown \& Conditions}
}
{}

\newenvironment{cmisserviceinout}[2]
{
\HCode{<li>}
\textbf{#1 \texttt{#2}:}
}
{
\HCode{</li>}
}

\newcommand{\cmisserviceinoutnone}{\HCode{<li>}None.\HCode{</li>}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% CMIS AtomPub
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% new envirnoment cmisatompubmedia
\newenvironment{cmisatompubmedia}
{
\begin{tabular}{p{1.5in}p{4.7in}}
}
{
\end{tabular}\hfill\\\\
}

\newcommand{\cmisatompubxml}[2]{\lstinputlisting[language=XML,title=#1]{atompub/#2}}

\newcommand{\cmisatompubhttp}[2]{\lstinputlisting[language=CMISAtomPubHTTP,title=#1]{atompub/#2}}


% new envirnoments cmisatompublink
\newenvironment{cmisatompublink}[1]
{
\texttt{\textbf{#1}}
\begin{itemize}
}
{
\end{itemize}
\vspace{0.05in}
}


% new envirnoments cmisatompubitems
\newenvironment{cmisatompubitems}[1]
{
#1:
\begin{itemize*}
\setlength{\leftskip}{0.3in}
}
{
\end{itemize*}
}

% new envirnoments cmisatompubdescs
\newenvironment{cmisatompubdescs}[1]
{
#1:
\begin{description}
\setlength{\leftskip}{0.3in}
}
{
\end{description}
}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% CMIS Browser Binding
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newcommand{\cmisbrowserGET}[5]
{
\ifthenelse{\isempty{#2}}{}{\subsubsection{Selector "#2"}}

\begin{tabular}{p{200px}p{200px}}
	\ifthenelse{\equal{#2}{lastResult}}{}{\textbf{Service:} & \cmisservicelink{#1}\\[0.05in]}
	\textbf{HTTP method:} & GET\\[0.05in]
	\textbf{Argument} \texttt{cmisselector}: & \texttt{#2}\\[0.05in]
	\textbf{Arguments:} & #3\\[0.05in]
	\textbf{Response:} & #4\\[0.05in]
	\textbf{Schema Element:} & \path{#5}\\[0.05in]
	\textbf{Success HTTP\newline status code:} & 200 OK
\end{tabular}
}

\newcommand{\cmisbrowserPOST}[6]
{
\subsubsection{Action "#2"}

\begin{tabular}{p{200px}p{200px}}
	\textbf{Service:} & \cmisservicelink{#1}\\[0.05in]
	\textbf{HTTP method:} & POST\\[0.05in]
	\textbf{Control} \texttt{cmisaction}: & \texttt{#2}\\[0.05in]
	\textbf{Relevant\newline CMIS Controls:} & #3\\[0.05in]
	\textbf{Response:} & #4\\[0.05in]
	\textbf{Schema Element:} & \path{#5}\\[0.05in]
	\textbf{Success HTTP\newline status code:} & #6
\end{tabular}
}

\newcommand{\cmisbrowsercontrol}[2]
{
\begin{tabular}{p{200px}p{200px}}
	\textbf{Control name:} & \texttt{#1}\\
	\textbf{Control value:} & #2
\end{tabular}
}

\newcommand{\cmisjsonhttp}[2]{\lstinputlisting[language=CMISJSONHTTP,title=#1]{browser/#2}}

