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

root/Chameleon/trunk/Chameleon/XMLThemeLegend/XMLThemeLegendInfo.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: XMLThemeLegendInfo.phtml,v 1.3 2004/12/03 03:31:57 pspencer Exp $
7  * @purpose     This is the layer information for the XMLThemeLegend widget
8  * @author      Sacha Fournier (sfournierdmsolutions.ca)
9  * @copyright
10  * <b>Copyright (c) 2002, 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
32  //set the language resource file
33
34 $szLanguageResource = str_replace("\\","/",dirname(__FILE__))."/XMLThemeLegend.dbf";
35
36 // include the supporting php code
37 define("LOAD_MAPSESSION", "1");
38 include_once("../session.inc.php");
39 include_once(COMMON."/phpwms/dbf.php");
40 include_once("../CWC2ButtonCache.php");
41
42 $oLayer = false;
43 $szTitle = "No Layer";
44
45 $szThemeName = "";
46 $szThemeAbstract = "";
47 $aGroups = array();
48 $aGroupsAbstracts = array();
49 $aGroupsLayers = array();
50
51 if(isset($http_form_vars["theme"]))
52 {
53     $szThemeName = $http_form_vars["theme"];
54
55     if (isset($http_form_vars["theme_abstract"]) && $http_form_vars["theme_abstract"] != "")
56     {
57         $szThemeAbstract = $http_form_vars["theme_abstract"];
58     }
59     else
60         $szThemeAbstract = $oMLT->get( "6", "No abstract available." );
61 }
62
63 if(isset($http_form_vars["groups"]) && $http_form_vars["groups"] != "")
64 {
65     $aGroups = explode( "|", $http_form_vars["groups"] );
66 }
67
68 if (isset($http_form_vars["groups_abstracts"]) && $http_form_vars["groups_abstracts"] != "")
69 {
70     $aGroupsAbstracts = explode( "|", $http_form_vars["groups_abstracts"] );
71 }
72
73 if (isset($http_form_vars["groups_layers"]))
74 {
75     $aAllLayers = explode( "|", $http_form_vars["groups_layers"] );
76     foreach($aAllLayers as $szLayer)
77     {
78         $aLayers = explode( ";", $szLayer );
79         array_push($aGroupsLayers, $aLayers );
80     }
81 }
82
83 for($i=0; $i<count($aGroups); $i++)
84 {
85     if (!isset($aGroupsAbstracts[$i]) || $aGroupsAbstracts[$i] == "")
86     {
87         $aGroupsAbstracts[$i] = $oMLT->get( "6", "No abstract available." );
88     }
89
90     if (!isset($aGroupsLayers[$i]))
91         $aGroupsLayers[$i] = array();
92 }
93 ?>
94 <html>
95 <head>
96 <title>Layer Information</title>
97 <link href="<?php echo $szCSSFile; ?>" rel="stylesheet" type="text/css">
98 </head>
99 <script language="JavaScript" src="<?php echo $_SESSION['gszCoreWebPath']; ?>/widgets/js/cwc_dhtml.js" type="text/javascript"></script>
100 <script language="JavaScript" src="<?php echo $_SESSION['gszCoreWebPath']; ?>/widgets/js/cwc_button.js" type="text/javascript"></script>
101 <script language="JavaScript"  type="text/javascript">
102 function removeSpinner()
103 {
104     if (document.layers)
105         document.layers[0].visibility = "hide";
106     else
107     if (document.all)
108         document.all.spinner.style.visibility = "hidden";
109     else
110     {
111         objEle = document.getElementById("spinner");
112         objEle.style.visibility = "hidden";
113     }
114 }
115
116 function CloseWindow()
117 {
118     window.close();
119 }
120 </script>
121 <body class="page" onLoad="self.focus();removeSpinner()">
122 <div id=spinner style="position:absolute;left:45%;top:40%;"><layer left=50 top=100><img src=<?php echo trim($oCommonMLT->get("Spinner", "../images/spinner_notext.gif")); ?>></layer></div>
123   <table border="0" cellpadding="1" cellspacing="10">
124     <tr>
125       <td class="layoutTable">
126         <table class="titleArea" width="100%" border="0" cellpadding="4" cellspacing="0">
127           <tr>
128             <td>&nbsp;<span class="title"><?php echo ($szThemeName != "") ? $oMLT->get( "7", "Theme Information") : $oMLT->get( "8", "Group Information" ); ?></span></td>
129           </tr>
130          </table>
131          <table class="contentArea" width="100%" border="0" cellpadding="4" cellspacing="0">
132            <tr>
133              <td>
134 <?php
135 if ($szThemeName != "")
136 {
137 ?>
138 <dl>
139 <dt><h1><?php echo $szThemeName ?></h1></dt>
140 <dd><strong>Abstract:</strong</dd>
141 <dd><?php echo $szThemeAbstract?></dd>
142 <?php
143 }
144 for($i=0; $i<count($aGroups); $i++)
145 {
146     if ($aGroups[$i] != "")
147     {
148 ?>
149   <dl>
150     <dt><h2><?php echo $aGroups[$i] ?></h2></dt>
151     <dd><strong>Abstract:</strong</dd>
152     <dd><?php echo $aGroupsAbstracts[$i] ?></dd>
153     <dl>
154 <?php
155         for($j=0; $j<count($aGroupsLayers[$i]); $j++)
156         {
157             $szLayerName = $aGroupsLayers[$i][$j];
158             $oLayer = GetLayerByName($oMapSession->oMap, $szLayerName);
159             $szTitle = $szLayerName; //$oLayer->getMetadata( "WMS_TITLE" );
160 ?>
161         <dt><h3><?php echo $szTitle ?></h3></dt>
162         <dd>
163 <?php
164             if ($oLayer !== false)
165             {
166                 $http_form_vars['common'] = COMMON;
167                 $szLang = strtoupper($_SESSION['gszCurrentLanguage']);
168                 include(COMMON."/phpwms/layerinfo_body.phtml");
169             }
170             else
171                 echo "<span class='text'>".trim($oMLT->get("3", "Layer missing from context."))."</span>";
172 ?>
173         </dd>
174 <?php
175         }
176 ?>
177     </dl>
178 <?php
179     }
180 ?>
181   </dl>
182 <?php
183 }
184 ?>
185 <?php
186 if ($szThemeName != "")
187 {
188 ?>
189 </dl>
190 <?php
191 }
192 ?>
193              </td>
194            </tr>
195          </table>
196        </td>
197      </tr>
198    </table>
199    <table border="0" cellpadding="1" cellspacing="10">
200     <tr>
201       <td align="right">
202         <table border="0" cellspacing="0" cellpadding="0">
203           <tr>
204             <td><?php echo makeButton( 'CloseWindow', '', 'XMLThemeLegend', "images/icon_cancel.png", trim($oCommonMLT->get("Cancel", "Cancel")), trim($oCommonMLT->get("CancelTip", "Close Dialog")), array('width'=>75) ); ?></a></td>
205           </tr>
206         </table>
207       </td>
208     </tr>
209   </table>
210 </body>
211 </html>
212 <?php
213 function GetLayerByWMSName( $poMap, $szWMSName )
214 {
215     for ($i=0;$i<$poMap->numlayers;$i++)
216     {
217         $oLayer = $poMap->getLayer( $i );
218         $szName = $oLayer->getmetadata( "WMS_NAME" );
219         if (strcasecmp(trim($szName), $szWMSName) == 0)
220         {
221             return $oLayer;
222         }
223     }
224     return false;
225 }
226 /**
227  * GetLayerByName
228  *
229  * Return a layer if it's wms_name or layer name corresponds to the
230  * szTestName passed as argument
231  */
232 function GetLayerByName( $poMap, $szTestName )
233 {
234     for ($i=0;$i<$poMap->numlayers;$i++)
235     {
236         $oLayer = $poMap->getLayer( $i );
237        
238         $szName = $oLayer->getmetadata( "WMS_NAME" );
239         //handle non-wms layers
240         if ($szName == "")
241         {
242             $szName = $oLayer->name;
243         }
244        
245         if (strcasecmp(trim($szName), $szTestName) == 0)
246         {
247             return $oLayer;
248         }
249     }
250     return false;
251 }
252
253 ?>
Note: See TracBrowser for help on using the browser.