From 9b13adbf9353af60069b041387f560c0dab01a71 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Mon, 23 Jan 2012 16:49:29 -0500 Subject: [PATCH] kpac : config experiments Signed-off-by: Bill Erickson --- Open-ILS/examples/kpac.pl | 50 ++++++++++++++++++++++++++++++++++++++++++++++ Open-ILS/examples/kpac.xml | 36 +++++++++++++++++++++++++++++++++ 2 files changed, 86 insertions(+) create mode 100755 Open-ILS/examples/kpac.pl create mode 100644 Open-ILS/examples/kpac.xml diff --git a/Open-ILS/examples/kpac.pl b/Open-ILS/examples/kpac.pl new file mode 100755 index 0000000000..ad8cfdca23 --- /dev/null +++ b/Open-ILS/examples/kpac.pl @@ -0,0 +1,50 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use XML::Simple; +use Data::Dumper; + +my $doc = XMLin( + 'kpac.xml', + KeyAttr => ['id'], + ForceArray => ['layout', 'page', 'cell'], + NormaliseSpace => 2 +); + +#print Dumper($doc); + +sub render_page { + my $id = shift; + my $page = $doc->{pages}->{page}->{$id}; + my $ncols = $page->{columns}; + my $idx = 0; + + print $page->{name} . "\n"; + print '-'x20 . "\n"; + for my $cell (@{$page->{cell}}) { + if ($idx++ == $ncols) { print "\n\n"; $idx = 1; } + + if ($cell->{type} eq 'topic') { + my $topic_page = $doc->{pages}->{page}->{$cell->{content}}; + print $topic_page->{name} . " : " . $topic_page->{img} . " | "; + + } elsif ($cell->{type} eq 'search') { + print $cell->{name} . " : " . $cell->{img} . " : " . $cell->{content} . " | "; + + } elsif ($cell->{type} eq 'link') { + print $cell->{name} . " : " . $cell->{img} . " : " . $cell->{content} . " | " ; + } + } +} + + +for my $layout (@{$doc->{layout}}) { + render_page($layout->{page}); + print "\n" . '-'x50 . "\n"; +} + +print "\n\n\n"; + +render_page(10); + + diff --git a/Open-ILS/examples/kpac.xml b/Open-ILS/examples/kpac.xml new file mode 100644 index 0000000000..b370e51ba4 --- /dev/null +++ b/Open-ILS/examples/kpac.xml @@ -0,0 +1,36 @@ + + + + 10 + 11 + 12 + + + + 11 + 10 + 12 + + + su:mammal audience(j) + su:reptile audience(j) + su:fish audience(j) + su:invertebrate audience(j) + su:yeti audience(j) + su:monsters audience(j) + su:aliens audience(j) + http://wikipedia.org/animals + + + 92 + onions and such audience(j) + + + su:igneous rock audience(j) + su:sedimentary rock audience(j) + su:metamorphic rock audience(j) + + + + + -- 2.11.0