NCCOOS Trac Projects: Top | Web | Platforms | Processing | Viz | Sprints | Sandbox | (Wind)

root/Chameleon/trunk/Chameleon/PrintProduction/production_download.phtml

Revision 13 (checked in by jcleary, 17 years ago)

Latest Chameleon code checkout from previous repository

Line 
1 <?php
2 /**
3  * cwc2 application
4  *
5  * @project     cwc2
6  * @revision    $Id:
7  * @purpose     This page downloads the produced map.
8  * @author      William A. Bronsema, C.E.T. (bronsema@dmsolutions.ca)
9  * @copyright
10  * <b>Copyright (c) 2001, DM Solutions Group Inc.</b>
11  * Permission is hereby granted, free of charge, to any person obtaining a
12  * copy of this software and associated documentation files (the "Software"),
13  * to deal in the Software without restriction, including without limitation
14  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
15  * and/or sell copies of the Software, and to permit persons to whom the
16  * Software is furnished to do so, subject to the following conditions:
17  *
18  * The above copyright notice and this permission notice shall be included
19  * in all copies or substantial portions of the Software.
20  *
21  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
24  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
27  * DEALINGS IN THE SOFTWARE.
28  */
29
30 /*****************************************************************************
31  * $Log: production_download.phtml,v $
32  * Revision 1.7  2004/12/03 03:31:55  pspencer
33  * bug MT 866: modify script tags to input type='text/javascript'
34  *
35  * Revision 1.6  2004/12/01 16:28:34  pspencer
36  * bug 797: modified to work with new download architecture
37  *
38  * Revision 1.5  2004/11/16 15:23:40  pspencer
39  * bug MT 377: renamed PrintWidget to PrintProduction
40  *
41  * Revision 1.4  2004/11/12 14:43:28  yassefa
42  * Do not display the close button if inside a frame.
43  *
44  * Revision 1.3  2004/04/28 13:43:14  pspencer
45  * fix file path related issues
46  *
47  * Revision 1.2  2004/04/25 04:20:39  pspencer
48  * fixed file references
49  *
50  * Revision 1.1  2004/04/23 16:51:59  pspencer
51  * moved production_download.phtml to PrintProduction/production_download.phtml
52  *
53  * Revision 1.15  2004/04/23 13:29:05  sfournier
54  * Make sure language file are located in the same directory of the widget and make sure to load them correctly
55  *
56  * Revision 1.14  2004/04/21 11:11:51  wbronsema
57  * corrected language path to point to widget directory instead of language directory
58  *
59  * Revision 1.13  2004/01/22 18:41:49  pspencer
60  * major overhaul of buttons, consolidating all previous TextButton and NavTools into a single Button architecture.
61  *
62  * Revision 1.12  2003/10/27 20:46:19  sfournier
63  * Overwrite main branch with 1.1 stuff
64  *
65  * Revision 1.8.2.2  2003/06/11 20:29:17  sacha
66  * Make some cleaning
67  *
68  * Revision 1.8.2.1  2003/05/27 17:40:59  sacha
69  * added support for skinning
70  *
71  * Revision 1.8  2003/04/23 17:30:00  pspencer
72  * use sharedresource wait image from session if possible.
73  *
74  * Revision 1.7  2003/04/16 18:51:09  sacha
75  * Fixed few bugs related to the rendering preview of a map
76  *
77  * Revision 1.6  2003/04/08 20:09:58  sacha
78  * Fixed few bug related to print
79  *
80  * Revision 1.5  2003/04/08 19:08:27  sacha
81  * Added error report to production dialog and also fixed a bug about PDF format. Only offer the choice if available
82  *
83  * Revision 1.4  2003/03/14 23:17:10  fredrock
84  * modified the popup with css to make it skinnable
85  *
86  * Revision 1.3  2003/02/21 15:25:16  sacha
87  *  'Added more language file and fixed some language bugs'
88  *
89  * Revision 1.2  2003/01/15 16:07:55  fredrock
90  * added buttonizer buttons.
91  *
92  * Revision 1.1  2003/01/03 18:51:01  bronsema
93  * Moved the download file capabiltiy to the production page.
94  *
95  *****************************************************************************/
96 if (isset($_GET['bDownload']) && $_GET['bDownload'] == '1')
97 {
98     $bFileOnly = true;
99     include_once( "./preview.php" );
100     $_SESSION['DOWNLOADFILE'] =  $_SESSION['gszTmpWebPath']."/".basename($szDownloadURL);
101     $_SESSION['DOWNLOADFILE_SAVEAS'] = $gsz_dl_name;
102     if (stristr($_SESSION['DOWNLOADFILE'], 'http://') == false )
103         $_SESSION['DOWNLOADFILE'] = 'http://'.$_SERVER['HTTP_HOST'].'/'.$_SESSION['DOWNLOADFILE'];
104     session_write_close();
105     header("Location: ".$_SESSION['gszCoreWebPath']."widgets/download.phtml?".SID);
106     exit();
107 }
108
109 //set the language resource file
110 $szLanguageResource = str_replace("\\","/",dirname(__FILE__))."/Production.dbf";
111
112
113 // set flag to only produce file
114 $bFileOnly = true;
115
116 // include the preview.php file to produce the map
117 include_once("../CWC2ButtonCache.php");
118
119 // define flag if necessary
120 if ( !defined( "LOAD_MAPSESSION" ) )
121 {
122     define("LOAD_MAPSESSION", 1);
123 }
124
125 // include session info
126 include("../session.inc.php");
127
128 /* ============================================================================
129  * Build an array with the HTTP GET or POST parameters.
130  * ========================================================================= */
131 $http_form_vars = sizeof( $_POST ) > 0 ? $_POST :
132                                     ( sizeof($_GET) > 0 ? $_GET : array("") );
133
134 //check for session wait image
135 if (isset($_SESSION["WAITIMAGE"]))
136     $waitImage = $_SESSION["WAITIMAGE"];
137 else
138     $waitImage = $_SESSION['gszCoreWebPath']."/skins/default/images/spinner.gif";
139
140 if (isset($_SESSION["WAITIMAGEWIDTH"]))
141     $waitImageWidth = $_SESSION["WAITIMAGEWIDTH"];
142 else
143     $waitImageWidth = 216;
144
145 if (isset($_SESSION["WAITIMAGEHEIGHT"]))
146     $waitImageHeight = $_SESSION["WAITIMAGEHEIGHT"];
147 else
148     $waitImageHeight = 50;
149 ?>
150 <html>
151 <head>
152 <title>Preview</title>
153 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
154 <script language="JavaScript" src="<?php echo $_SESSION['gszCoreWebPath']; ?>/widgets/js/cwc_dhtml.js" type="text/javascript"></script>
155 <script language="JavaScript" src="<?php echo $_SESSION['gszCoreWebPath']; ?>/widgets/js/cwc_button.js" type="text/javascript"></script>
156 <script language="javascript" type="text/javascript">
157 function doneLoading()
158 {
159     // hide processing images
160     document.forms.main.loadingImage.src = "<?php echo $_SESSION['gszCoreWebPath']."/skins/default/images/a_pixel.gif"; ?>";
161     <?php if (isset($_GET['bDownload']) && $_GET['bDownload'] == '1') { ?>
162     CloseWindow();
163     <?php } else { ?>
164     document.location = "production_download.phtml?bDownload=1&<?php echo SID?>";
165     <?php } ?>
166 }
167
168 function CloseWindow()
169 {
170     window.close();
171 }
172 </script>
173 <link href="<?php echo $szCSSFile; ?>" rel="stylesheet" type="text/css">
174 </head>
175 <body class="page" onLoad="javascript:doneLoading()">
176 <?php
177 // display error if any
178 if (isset($_SESSION['gErrorManager']))
179 {
180     $j = $_SESSION['gErrorManager']->nErrorCount;
181
182     if ($j > 0)
183     {
184         for ($i=0; $i<$j; $i++)
185         {
186             $oError = $_SESSION['gErrorManager']->popLastError();
187             echo "<li class='listItem'><font color=red>".$oError->szMessage.
188              "</font></li>\n";
189         }
190         echo "<script language='JavaScript' type='text/javascript'>bError = true;</script>";
191     }
192 }
193 ?>
194 <form name="main">
195 <table width="100%" border=0 cellpadding=0 cellspacing=0>
196   <tr>
197     <td><img name="loadingImage" src="<?php echo $waitImage; ?>" width="<?php echo $waitImageWidth; ?>" height="<?php echo $waitImageHeight; ?>"></td>
198   </tr>
199 </table>
200 <!--
201 <table border=0 cellpadding=0 cellspacing=0>
202   <tr>
203     <td><img name="mainImage" src="<?php echo "./preview.php?".SID."&selImageFormat=".$http_form_vars["selImageFormat"] ?>" border=0></td>
204   </tr>
205 </table>
206 -->
207     <table border=0 cellpadding=0 cellspacing=0>
208         <tr>
209             <td><span class="label"><?php echo trim($oMLT->get("26", "The download should start automatically in a few seconds,<br>otherwise click <a href=\"javascript:doneLoading()\">here</a> to download the file manually.")); ?></span></td>
210         </tr>
211         <tr>
212             <td>&nbsp;</td>
213         </tr>
214         <tr>
215             <?php if (isset($http_form_vars["insideframe"])) echo "<!--"; ?>
216             <td align=right><?php echo makeButton( 'CloseWindow', '', 'PrintProduction', "images/icon_close.png", trim($oCommonMLT->get("Close", "Close")), trim($oCommonMLT->get("CancelTip", "Close Dialog")), array( 'width' => 75 ) ); ?></td>
217             <?php if (isset($http_form_vars["insideframe"])) echo "-->"; ?>
218         </tr>
219     </table>
220 <input type=hidden name=sid value="<?php echo $http_form_vars["sid"] ?>">
221 </form>
222 </body>
223 </html>
Note: See TracBrowser for help on using the browser.