Changeset 10890 for trunk/gsdl/perllib/plugins/ConvertToPlug.pm
- Timestamp:
- 2005-11-14T14:26:10+13:00 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/perllib/plugins/ConvertToPlug.pm
r10609 r10890 61 61 'reqd' => "yes", 62 62 'list' => $convert_to_list, 63 'deft' => " html" },63 'deft' => "auto" }, 64 64 { 'name' => "title_sub", 65 65 'desc' => "{HTMLPlug.title_sub}", … … 88 88 'args' => $arguments }; 89 89 90 sub findType91 {92 my ($inputargs) = @_;93 my $convert_to_type = "html";94 my $windows_scripting = "false";95 for(my $intCounter = 0; $intCounter < scalar(@{$inputargs}) ; $intCounter++)96 {97 if($inputargs->[$intCounter] eq "-convert_to")98 {99 if($inputargs->[$intCounter+1] eq "auto" || $inputargs->[$intCounter+1] =~ /pagedimg.*/i || $inputargs->[$intCounter+1] eq "text" || $inputargs->[$intCounter+1] eq "html")100 {101 $convert_to_type = $inputargs->[$intCounter+1];102 }103 }104 if ($inputargs->[$intCounter] eq "-windows_scripting")105 {106 $windows_scripting = "true";107 }108 }109 return ($convert_to_type,$windows_scripting);110 }111 90 112 91 sub load_secondary_plugins … … 127 106 # call its constructor with extra options that we've worked out! 128 107 my $arglist = $input_args->{$plugin_class}; 129 my $secondary_plugin = new $plugin_class([],$arglist, $hashArgOptLists); 108 # my $secondary_plugin = new $plugin_class([],$arglist, $hashArgOptLists); 109 # secondary plugins don';t need to know their calling plugin's options 110 my $secondary_plugin = new $plugin_class([],$arglist); 130 111 $secondary_plugins->{$plugin_class} = $secondary_plugin; 131 112 } … … 138 119 push(@$pluginlist, $class); 139 120 my $classPluginName = (defined $pluginlist->[0]) ? $pluginlist->[0] : $class; 140 my ($strConvertTo,$blnWindowsScripting) = findType($inputargs);141 142 121 if(defined $arguments){ push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});} 143 122 if(defined $options) { push(@{$hashArgOptLists->{"OptList"}},$options)}; … … 145 124 my $self = (defined $hashArgOptLists)? new BasPlug($pluginlist,$inputargs,$hashArgOptLists): new BasPlug($pluginlist,$inputargs); 146 125 147 126 my $convert_to_type = $self->{'convert_to'}; 127 if (!defined $convert_to_type || $convert_to_type eq "") { 128 $convert_to_type = "auto"; 129 } 130 my $windows_scripting = $self->{'windows_scripting'}; 148 131 if ($classPluginName eq "PDFPlug") { 149 if ($ strConvertToeq "text" &&132 if ($convert_to_type eq "text" && 150 133 $ENV{'GSDLOS'} =~ /^windows$/i) { 151 134 print STDERR "Windows does not support pdf to text. PDFs will be converted to HTML instead\n"; 152 $ strConvertTo= "html";135 $convert_to_type = "html"; 153 136 } 154 137 } elsif ($classPluginName eq "WordPlug") { 155 if ( $blnWindowsScripting eq "true" && $ENV{'GSDLOS'} =~ /^windows$/i && $strConvertTo=~ /^(html|auto)$/) {138 if (defined $self->{'windows_scripting'} && $ENV{'GSDLOS'} =~ /^windows$/i && $convert_to_type =~ /^(html|auto)$/) { 156 139 # we use structured HTML, not normal html 157 $ strConvertTo= "structuredhtml";140 $convert_to_type = "structuredhtml"; 158 141 } 159 142 } elsif ($classPluginName eq "PPTPlug") { 160 if ( $blnWindowsScripting eq "true" && $ENV{'GSDLOS'} =~ /^windows$/i && $strConvertToeq "auto") {143 if (defined $self->{'windows_scripting'} && $ENV{'GSDLOS'} =~ /^windows$/i && $convert_to_type eq "auto") { 161 144 # we use paged img 162 $ strConvertTo= "pagedimg_jpg";145 $convert_to_type = "pagedimg_jpg"; 163 146 } 164 147 } elsif ($classPluginName eq "PSPlug") { 165 if ($ strConvertToeq "auto") {148 if ($convert_to_type eq "auto") { 166 149 # we use text 167 $ strConvertTo= "text";150 $convert_to_type = "text"; 168 151 } 169 152 } 170 153 171 if ($ strConvertToeq "auto") {154 if ($convert_to_type eq "auto") { 172 155 # choose html for now - should choose a format based on doc type 173 $ strConvertTo= "html";174 } 175 176 if ($ strConvertToeq "html") {156 $convert_to_type = "html"; 157 } 158 159 if ($convert_to_type eq "html") { 177 160 $self->{'convert_to'} = "HTML"; 178 161 $self->{'convert_to_ext'} = "html"; 179 } elsif ($ strConvertToeq "text") {162 } elsif ($convert_to_type eq "text") { 180 163 $self->{'convert_to'} = "TEXT"; 181 164 $self->{'convert_to_ext'} = "txt"; 182 } elsif ($ strConvertToeq "structuredhtml") {165 } elsif ($convert_to_type eq "structuredhtml") { 183 166 $self->{'convert_to'} = "StructuredHTML"; 184 167 $self->{'convert_to_ext'} = "html"; 185 } elsif ($ strConvertTo=~ /^pagedimg/) {168 } elsif ($convert_to_type =~ /^pagedimg/) { 186 169 $self->{'convert_to'} = "PagedImg"; 187 my ($convert_to_ext) = $ strConvertTo=~ /pagedimg\_(jpg|gif|png)/i;170 my ($convert_to_ext) = $convert_to_type =~ /pagedimg\_(jpg|gif|png)/i; 188 171 $convert_to_ext = 'jpg' unless defined $convert_to_ext; 189 172 $self->{'convert_to_ext'} = $convert_to_ext;
Note:
See TracChangeset
for help on using the changeset viewer.