From a8007fa9234ff2cf5d26955295f1c4c4a38c2884 Mon Sep 17 00:00:00 2001 From: Jason Stephenson Date: Fri, 8 Aug 2014 09:59:37 -0400 Subject: [PATCH] Update templates for new abstraction method. Signed-off-by: Jason Stephenson --- templates/includes/LookupVersionResponse.inc | 6 +-- templates/includes/ResponseHeader.inc | 12 ++++++ templates/includes/data.inc | 6 +++ templates/includes/problem.inc | 14 +++++++ templates/problem.tt | 44 -------------------- templates/response.tt | 23 ++++------ 6 files changed, 44 insertions(+), 61 deletions(-) create mode 100644 templates/includes/ResponseHeader.inc create mode 100644 templates/includes/data.inc create mode 100644 templates/includes/problem.inc delete mode 100644 templates/problem.tt diff --git a/templates/includes/LookupVersionResponse.inc b/templates/includes/LookupVersionResponse.inc index 7e9e888..676e8ad 100644 --- a/templates/includes/LookupVersionResponse.inc +++ b/templates/includes/LookupVersionResponse.inc @@ -1,5 +1,5 @@ -[% FOREACH version IN versions %] +[% FOREACH version IN data.versions -%] -[% version %] +[%- version -%] -[% END %] +[% END -%] diff --git a/templates/includes/ResponseHeader.inc b/templates/includes/ResponseHeader.inc new file mode 100644 index 0000000..78f69ea --- /dev/null +++ b/templates/includes/ResponseHeader.inc @@ -0,0 +1,12 @@ + + + +[% header.FromAgencyId.AgencyId %] + + + + +[% header.ToAgencyId.AgencyId %] + + + diff --git a/templates/includes/data.inc b/templates/includes/data.inc new file mode 100644 index 0000000..1c05de3 --- /dev/null +++ b/templates/includes/data.inc @@ -0,0 +1,6 @@ +<[% type %]> +[% + myfile = "includes/$type" _ ".inc"; + INCLUDE $myfile +-%] + diff --git a/templates/includes/problem.inc b/templates/includes/problem.inc new file mode 100644 index 0000000..8dd0dc6 --- /dev/null +++ b/templates/includes/problem.inc @@ -0,0 +1,14 @@ + + +[% problem.ProblemType %] + + +[% problem.ProblemDetail %] + + +[% problem.ProblemElement %] + + +[% problem.ProblemValue %] + + diff --git a/templates/problem.tt b/templates/problem.tt deleted file mode 100644 index 1dd2fea..0000000 --- a/templates/problem.tt +++ /dev/null @@ -1,44 +0,0 @@ -[%# INCLUDE 'includes/header.inc' %] - <[% messagetype %]> - [% IF processingerror %] - - - [% FOREACH errormessage IN processingerrortype.keys %] - - - [% SWITCH errormessage %] - [% CASE 'BadBarcode' %] - We could not find an item with that barcode - [% CASE 'NotIssued' %] - The item is not on loan - [% CASE 'RESERVED' %] - The item is on hold for another borrower - [% CASE 'RENEW_ISSUE' %] - This item is already on loan to this borrower - [% CASE 'NO_HOLD' %] - There is no hold on this item - [% CASE 'NO_HOLD_BORROWER' %] - We can not place a hold, we have no borrower information - [% CASE 'Wrongbranch' %] - We are trying to check this item in at the wrong branch - [% CASE 'BORROWER_NOT_FOUND' %] - We can not place a request, we have no borrower information - [% CASE 'ITEM_NOT_FOUND' %] - We can not place a request, we have no item information - [% CASE 'ITEMNOTSAMEBRANCH' %] - Circulation rules stop this borrower from checking out this item, the borrower and item are not from the same branch - [% END %] - - - - [% END %] - [% END %] - - [% processingerrorelement | xml %] - [% barcode | xml %] - - - [% error_detail | xml %] - - - diff --git a/templates/response.tt b/templates/response.tt index 0c77300..d400d4e 100644 --- a/templates/response.tt +++ b/templates/response.tt @@ -1,14 +1,9 @@ - <[% messagetype %]> - - - [% fromagency | trim%] - - - [% toagency | trim %] - - - [% myfile = "includes/$messagetype" _ ".inc" %] - [% INCLUDE $myfile %] - - - +[% IF header; + INCLUDE "includes/ResponseHeader.inc"; + END; + IF data; + INCLUDE "includes/data.inc"; + ELSIF problem; + INCLUDE "includes/problem.inc"; + END; +-%] -- 2.43.2