Changeset 12844 for trunk/gsdl/perllib/plugins/GAPlug.pm
- Timestamp:
- 2006-09-25T14:17:10+12:00 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/perllib/plugins/GAPlug.pm
r12169 r12844 70 70 $self->{'metadata_value'} = ""; 71 71 $self->{'content'} = ""; 72 73 # # Currently used to store information for previous values controls. In 74 # # the next contract I'll move to using information directly from Lucene. 75 # $self->{'sqlfh'} = 0; 72 76 73 77 return bless $self, $class; … … 128 132 elsif ($element eq "Metadata") { 129 133 $self->{'doc_obj'}->add_utf8_metadata($self->{'section'}, $self->{'metadata_name'},$self->{'metadata_value'}); 134 # Ensure this value is added to the allvalues database in gseditor. 135 # Note that the database constraints prevent multiple occurances of the 136 # same key-value pair. 137 # We write these out to a file, so they can all be commited in one 138 # transaction 139 #if (!$self->{'sqlfh'}) 140 # { 141 # my $sql_file = $ENV{'GSDLHOME'} . "/collect/lld/tmp/gseditor.sql"; 142 # # If the file doesn't already exist, open it and begin a transaction 143 # my $sql_fh; 144 # if (!-e $sql_file) 145 # { 146 # open($sql_fh, ">" . $sql_file); 147 # print $sql_fh "BEGIN TRANSACTION;\n"; 148 # } 149 # else 150 # { 151 # open($sql_fh, ">>" . $sql_file); 152 # } 153 # print STDERR "Opened SQL log\n"; 154 # $self->{'sqlfh'} = $sql_fh; 155 # } 156 157 #my $mvalue = $self->{'metadata_value'}; 158 #$mvalue =~ s/\'/\'\'/g; 159 #$mvalue =~ s/_claimantsep_/ \& /g; 160 161 #my $fh = $self->{'sqlfh'}; 162 #if ($fh) 163 # { 164 # print $fh "INSERT INTO allvalues (mkey, mvalue) VALUES ('" . $self->{'metadata_name'} . "', '" . $mvalue . "');\n"; 165 # } 166 167 # Clean Up 130 168 $self->{'metadata_name'} = ""; 131 169 $self->{'metadata_value'} = ""; … … 135 173 $self->{'content'} = ""; 136 174 } 137 138 175 $self->{'element'} = ""; 139 176 } … … 161 198 sub close_document { 162 199 my $self = shift(@_); 163 200 164 201 # add the associated files 165 202 my $assoc_files = … … 170 207 171 208 my $assoc_filepath=shift (@$assoc_filepath_list); 172 if (defined ($assoc_filepath)) { 173 # make absolute rather than relative... 174 $self->{'filename'} =~ m@^(.*[\\/]archives)@; 175 $assoc_filepath = "$1/$assoc_filepath/"; 176 } else { 209 210 #rint STDERR "Filename is: " . $self->{'filename'} . "\n"; 211 #rint STDERR "Initially my assoc_filepath is: $assoc_filepath\n"; 212 #rint STDERR "Custom archive dir is: " . $self->{'base_dir'} . "\n"; 213 # Correct the assoc filepath if one is defined 214 if (defined ($assoc_filepath)) 215 { 216 # Check whether the assoc_filepath already includes the base dir 217 if (index($assoc_filepath, $self->{'base_dir'}) == -1) 218 { 219 # And if not, append it so as to make this absolute 220 $assoc_filepath = &util::filename_cat($self->{'base_dir'}, $assoc_filepath); 221 } 222 } 223 else 224 { 177 225 $assoc_filepath = $self->{'filename'}; 178 226 $assoc_filepath =~ s/[^\\\/]*$//; 179 } 227 } 228 #rint STDERR "Goned and made it absolute: $assoc_filepath\n"; 180 229 181 230 foreach my $assoc_file_info (@$assoc_files) { 182 231 my ($assoc_file, $mime_type, $dir) = split (":", $assoc_file_info); 232 #rint STDERR "assoc_file: $assoc_file\n"; 233 #rint STDERR "mime_type: $mime_type\n"; 234 #rint STDERR "dir: $dir\n"; 183 235 my $real_dir = &util::filename_cat($assoc_filepath, $assoc_file), 184 236 my $assoc_dir = (defined $dir && $dir ne "") 185 237 ? &util::filename_cat($dir, $assoc_file) : $assoc_file; 186 238 $self->{'doc_obj'}->associate_file($real_dir, $assoc_dir, $mime_type); 239 #rint STDERR "According to me the real assoc_filepath is: $real_dir\n"; 187 240 } 188 241 $self->{'doc_obj'}->delete_metadata($self->{'doc_obj'}->get_top_section(), "gsdlassocfile");
Note:
See TracChangeset
for help on using the changeset viewer.