X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=installer%2Fhtml-template-to-template-toolkit.pl;h=e99b19530eea4915084ff11129fb3cffbf217628;hb=72f91afd9c7871b706d553cfbadf23d4f6db7e02;hp=8ae13f677b1395c3c7a47d87a3ff1e6eb743f3d1;hpb=160bb77967b2d8056281bad4bf39b3e0dfbc8ec5;p=koha_gimpoz diff --git a/installer/html-template-to-template-toolkit.pl b/installer/html-template-to-template-toolkit.pl index 8ae13f677b..e99b19530e 100755 --- a/installer/html-template-to-template-toolkit.pl +++ b/installer/html-template-to-template-toolkit.pl @@ -27,8 +27,13 @@ EOH my $tmpl_in_dir = 'koha-tmpl'; my $tmpl_out_dir = 'koha-tt'; -# variables NOT to scope, in other words, variables that need to remain global (case sensitive) -my @globals = ("themelang"); +# template toolkit variables NOT to scope, in other words, variables that need to remain global (case sensitive) +my @globals = ("themelang","JacketImages","OPACAmazonCoverImages","GoogleJackets","BakerTaylorEnabled", +"SyndeticsEnabled", "OpacRenewalAllowed", "item_level_itypes","noItemTypeImages", +"virtualshelves", "RequestOnOpac", "COinSinOPACResults", "OPACXSLTResultsDisplay", +"OPACItemsResultsDisplay", "LibraryThingForLibrariesID", "opacuserlogin", "TagsEnabled", +"TagsShowOnList", "TagsInputOnList","loggedinusername","AllowOnShelfHolds","opacbookbag", +"OPACAmazonEnabled", "SyndeticsCoverImages","using_https"); # Arguments: my $KOHA_ROOT; @@ -78,6 +83,9 @@ foreach my $file (@template_files) { my $for_loop_found = 0; for my $input_tmpl(<$ITMPL>){ + my @parts = split "<", $input_tmpl; + for( my $i=0; $i<=$#parts; ++$i ){ + my $input_tmpl = $i ? "<" . $parts[$i] : $parts[$i]; # add < sign back in to every part except the first $for_loop_found = 0; # handle poorly names variable such as f1!, f1+, f1-, f1| and mod @@ -85,7 +93,7 @@ foreach my $file (@template_files) { $input_tmpl =~ s/"(\w+)\+"/"$1plus"/ig; $input_tmpl =~ s/"(\w+)\-"/"$1minus"/ig; $input_tmpl =~ s/"(\w+)!"/"$1exclamation"/ig; - $input_tmpl =~ s/"(\w+),(\w+)"/"$1comma$2"/ig; + $input_tmpl =~ s/"(\w+),(\w+)"/"$1comma$2"/ig; #caused a problem in patron search $input_tmpl =~ s/NAME="mod"/NAME="modname"/ig; # handle 'naked' TMPL_VAR "parameter" by turning them into what they should be, TMPL_VAR NAME="parameter" $input_tmpl =~ s/TMPL_VAR\s+"(\w+)"/TMPL_VAR NAME="$1"/ig; @@ -161,8 +169,9 @@ foreach my $file (@template_files) { # misc 'patches' $input_tmpl =~ s/\seq\s/ == /ig; - $input_tmpl =~ s/HTML/html/ig; - $input_tmpl =~ s/URL/url/ig; + $input_tmpl =~ s/HTML/html/g; + $input_tmpl =~ s/URL/url/g; + $input_tmpl =~ s/dhtmlcalendar_dateformat/DHTMLcalendar_dateformat/ig; $input_tmpl =~ s/\w*\.__first__/loop.first/ig; $input_tmpl =~ s/\w*\.__last__/loop.last/ig; $input_tmpl =~ s/\w*\.__odd__/loop.odd/ig; @@ -170,10 +179,11 @@ foreach my $file (@template_files) { $input_tmpl =~ s/\w*\.__counter__/loop.count/ig; #loop.count gives the range (0..max) whereas loop.index gives the range (1..max+1), __counter__ is unknown # hack to get around lack of javascript filter - $input_tmpl =~ s/\|JS/|replace("'", "\\'") |replace('"', '\\"') |replace('\\n', '\\\\n') |replace('\\r', '\\\\r')/ig; + $input_tmpl =~ s/\|\s*JS/|replace("'", "\\'") |replace('"', '\\"') |replace('\\n', '\\\\n') |replace('\\r', '\\\\r')/ig; # Write out.. - print $OTT $input_tmpl; + print $OTT $input_tmpl; + } } close $ITMPL; close $OTT;