[29852] | 1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
| 2 | <xsl:stylesheet version="1.0"
|
---|
| 3 | xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
---|
| 4 | xmlns:java="http://xml.apache.org/xslt/java"
|
---|
| 5 | xmlns:util="xalan://org.greenstone.gsdl3.util.XSLTUtil"
|
---|
| 6 | xmlns:gslib="http://www.greenstone.org/skinning"
|
---|
| 7 | extension-element-prefixes="java util"
|
---|
| 8 | exclude-result-prefixes="java util">
|
---|
| 9 |
|
---|
| 10 | <!-- set page title -->
|
---|
| 11 | <xsl:variable name="title">Deposit Item</xsl:variable>
|
---|
| 12 |
|
---|
| 13 | <!-- the page content -->
|
---|
| 14 | <xsl:template name="wizardPage">
|
---|
| 15 | <div id="progressBar">Please wait...</div>
|
---|
| 16 | <script type="text/javascript">
|
---|
| 17 | <xsl:text disable-output-escaping="yes">
|
---|
| 18 | {
|
---|
| 19 | $(window).load(function()
|
---|
| 20 | {
|
---|
| 21 | $("#progressBar").html($("#progressBar").html() + "<br/>Moving file into collection...");
|
---|
| 22 | var url = gs.xsltParams.library_name + "?a=de&sa=depositFile&ro=1&c=" + gs.cgiParams.c + "&fileToAdd=" + gs.deSavedMetadata["md___ex.Filename"];
|
---|
| 23 | $.ajax(url).success(function(response)
|
---|
| 24 | {
|
---|
| 25 | $("#progressBar").html($("#progressBar").html() + "<br/>Importing collection...");
|
---|
| 26 | var xml;
|
---|
| 27 | try
|
---|
| 28 | {
|
---|
| 29 | xml = $.parseXML(response.replace(/&/g, "&amp;"));
|
---|
| 30 | }
|
---|
| 31 | catch(e)
|
---|
| 32 | {
|
---|
| 33 | console.log("ERROR: " + e);
|
---|
| 34 | $("#progressBar").html($("#progressBar").html() + "<br/>There was an error on the server.");
|
---|
| 35 | return;
|
---|
| 36 | }
|
---|
| 37 |
|
---|
| 38 | if(!($(xml).find("error").length))
|
---|
| 39 | {
|
---|
| 40 | var pid = $(xml).find("status").attr("pid");
|
---|
| 41 | gs.functions.startCheckLoop(pid, "ImportCollection", function()
|
---|
| 42 | {
|
---|
| 43 | $("#progressBar").html($("#progressBar").html() + "<br/>Building collection...");
|
---|
| 44 | gs.functions.buildCollections([gs.cgiParams.c], function()
|
---|
| 45 | {
|
---|
| 46 | $("#progressBar").html($("#progressBar").html() + "<br/>Collection built...");
|
---|
| 47 | $("#progressBar").html($("#progressBar").html() + "<br/>Reloading Greenstone...");
|
---|
| 48 | $.ajax(gs.xsltParams.library_name + "?a=s&sa=c").success(function()
|
---|
| 49 | {
|
---|
| 50 | $("#progressBar").html($("#progressBar").html() + "<br/>Done!");
|
---|
| 51 | })
|
---|
| 52 | .error(function()
|
---|
| 53 | {
|
---|
| 54 | $("#progressBar").html($("#progressBar").html() + "<br/>Reload failed, please restart Greenstone manually.");
|
---|
| 55 | });
|
---|
| 56 | });
|
---|
| 57 | });
|
---|
| 58 | }
|
---|
| 59 | else
|
---|
| 60 | {
|
---|
| 61 | $("#progressBar").html($("#progressBar").html() + "<br/>There was an error depositing your file:");
|
---|
| 62 | $(xml).find("error").each(function()
|
---|
| 63 | {
|
---|
| 64 | $("#progressBar").html($("#progressBar").html() + "<br/>" + $(this).text());
|
---|
| 65 | });
|
---|
| 66 | }
|
---|
| 67 | });
|
---|
| 68 | });
|
---|
| 69 | }
|
---|
| 70 | </xsl:text>
|
---|
| 71 | </script>
|
---|
| 72 | </xsl:template>
|
---|
| 73 | </xsl:stylesheet>
|
---|
| 74 |
|
---|