Revision 4541
Added by walbridge about 16 years ago
src/perl/register-dataset.cgi | ||
---|---|---|
122 | 122 |
} |
123 | 123 |
|
124 | 124 |
# replacements for appconfig values using properties |
125 |
my $moderators = $properties->getProperty('ldap.moderators'); # scw TODO: check if this changes to per-skin
|
|
125 |
my $moderators = $properties->getProperty('ldap.moderators'); |
|
126 | 126 |
my $config = $skinProperties->splitToTree(qr/\./, 'registry.config'); |
127 | 127 |
my $templates = $skinProperties->splitToTree(qr/\./, 'registry.templates'); |
128 | 128 |
my $modules = $skinProperties->splitToTree(qr/\./, 'registry.modules'); |
... | ... | |
1804 | 1804 |
$error ="Error in parsing the eml document"; |
1805 | 1805 |
push(@errorMessages, $error); |
1806 | 1806 |
} elsif ($doc=~ /<error/) { |
1807 |
if ( $doc=~ /public/){ |
|
1808 |
$error ="Error in reading the eml document. Please check if you are logged in."; |
|
1809 |
push(@errorMessages, $error); |
|
1810 |
} else { |
|
1807 |
if ( $doc=~ /public/){
|
|
1808 |
$error ="Error in reading the eml document. Please check if you are logged in.";
|
|
1809 |
push(@errorMessages, $error);
|
|
1810 |
} else {
|
|
1811 | 1811 |
$error ="Error in reading the eml document. Please check if you have access to read the document"; |
1812 | 1812 |
push(@errorMessages, $error); |
1813 |
} |
|
1813 |
}
|
|
1814 | 1814 |
} else { |
1815 | 1815 |
$findType = $xmldoc->findnodes('//dataset/identifier'); |
1816 | 1816 |
if ($findType->size() > 0) { |
1817 | 1817 |
# This is a eml beta6 document |
1818 | 1818 |
# Read the documents mentioned in triples also |
1819 |
|
|
1820 |
$findType = $xmldoc->findnodes('//dataset/triple'); |
|
1821 |
if ($findType->size() > 0) { |
|
1822 |
foreach $node ($findType->get_nodelist) { |
|
1823 |
$pushDoc = findValue($node, 'subject'); |
|
1824 |
|
|
1825 |
# If the file is already in @fileArray then do not add it |
|
1826 |
$alreadyInArray = 0; |
|
1827 |
foreach $element (@fileArray) { |
|
1828 |
$tempfile = $tempDir."/".$pushDoc; |
|
1829 |
if ($element eq $pushDoc) { |
|
1830 |
$alreadyInArray = 1; |
|
1831 |
} |
|
1832 |
} |
|
1833 |
|
|
1834 |
if (!$alreadyInArray) { |
|
1835 |
$tempfile = $tempDir."/".$pushDoc; |
|
1836 |
$response = ""; |
|
1837 |
$response = $metacat->read($pushDoc); |
|
1838 |
if (! $response) { |
|
1839 |
# could not read |
|
1840 |
#push(@errorMessages, $response); |
|
1841 |
push(@errorMessages, $metacat->getMessage()); |
|
1842 |
push(@errorMessages, "Failed during reading.\n"); |
|
1843 |
} else { |
|
1844 |
my $xdoc = $response->content(); |
|
1845 |
open (TFILE,">$tempfile") || |
|
1846 |
die ("Cant open xml file... $tempfile\n"); |
|
1847 |
print TFILE $xdoc; |
|
1848 |
close(TFILE); |
|
1849 |
push (@fileArray, $tempfile); |
|
1850 |
} |
|
1851 |
} |
|
1852 |
} |
|
1853 |
} |
|
1854 |
|
|
1855 |
# Read the main document. |
|
1856 |
|
|
1857 |
$tempfile = $tempDir."/".$docid; |
|
1858 |
open (TFILE,">$tempfile") || die ("Cant open xml file...\n"); |
|
1859 |
print TFILE $doc; |
|
1860 |
close(TFILE); |
|
1861 |
|
|
1862 |
# Transforming beta6 to eml 2 |
|
1863 |
my $xslt; |
|
1864 |
my $triplesheet; |
|
1865 |
my $results; |
|
1866 |
my $stylesheet; |
|
1867 |
my $resultsheet; |
|
1868 |
|
|
1869 |
$xslt = XML::LibXSLT->new(); |
|
1870 |
$tempfile = $tempDir."/"."triple_info.xsl"; |
|
1871 |
|
|
1872 |
$triplesheet = $xslt->parse_stylesheet_file($tempfile); |
|
1873 |
|
|
1874 |
$results = $triplesheet->transform($xmldoc, packageDir => "\'$tempDir/\'", packageName => "\'$docid\'"); |
|
1875 |
|
|
1876 |
$tempfile = $tempDir."/"."emlb6toeml2.xsl"; |
|
1877 |
$stylesheet = $xslt->parse_stylesheet_file($tempfile); |
|
1878 |
$resultsheet = $stylesheet->transform($results); |
|
1879 |
|
|
1880 |
#$tempfile = "/usr/local/apache2/htdocs/xml/test.xml";; |
|
1881 |
#open (TFILE,">$tempfile") || die ("Cant open xml file...\n"); |
|
1882 |
#print TFILE $stylesheet->output_string($resultsheet); |
|
1883 |
#close(TFILE); |
|
1884 |
|
|
1885 |
# Delete the files written earlier. |
|
1886 |
unlink @fileArray; |
|
1887 |
|
|
1888 |
return $resultsheet; |
|
1889 |
|
|
1819 |
push(@errorMessages, "EML2 beta6 support deprecated."); |
|
1890 | 1820 |
} |
1891 | 1821 |
} |
1892 | 1822 |
return $xmldoc; |
... | ... | |
1921 | 1851 |
|
1922 | 1852 |
################################################################################ |
1923 | 1853 |
# |
1924 |
# Parse an EML 2.0.0 file and extract the metadata into perl variables for
|
|
1854 |
# Parse an EML 2.x file and extract the metadata into perl variables for
|
|
1925 | 1855 |
# processing and returning to the template processor |
1926 | 1856 |
# |
1927 | 1857 |
################################################################################ |
... | ... | |
3708 | 3638 |
$$templateVars{"uploadname_$upNum"} = param("uploadname_$upNum"); |
3709 | 3639 |
$$templateVars{"uploadtype_$upNum"} = param("uploadtype_$upNum"); |
3710 | 3640 |
$$templateVars{"uploadperm_$upNum"} = param("uploadperm_$upNum"); |
3711 |
|
|
3712 | 3641 |
} |
3713 | 3642 |
} |
3714 | 3643 |
} |
Also available in: Unified diff
Remove EML2 beta6 document conversion support, the files required for conversion have been deprecated from Metacat.