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

root/Chameleon/trunk/Chameleon/ExtractContext/ExtractContext.widget.php

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

Latest Chameleon code checkout from previous repository

Line 
1 <?php
2 /**
3  * ExtractContext Widget class
4  *
5  * @project     CWC2
6  * @revision    $Id: ExtractContext.widget.php,v 1.6 2004/10/14 18:19:13 pspencer Exp $
7  * @purpose     ExtractContext widget class
8  * @author      DM Solutions Group (spencer@dmsolutions.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 include_once(dirname(__FILE__)."/../Widget.php");
32 include_once( COMMON."wrapper/map_navigator.php" );
33 include_once(dirname(__FILE__)."/../Popup.php");
34 include_once(dirname(__FILE__)."/../Button.php");
35
36 /**
37  * ExtractContext
38  *
39  * Extract widget class
40  */
41 class ExtractContext extends CWCWidget
42 {
43     var $moPopup;          // Popup object\
44     var $moButton;
45
46     /**
47      * ExtractContextWidget
48      *
49      * Constctor method for the ExtractContext widget.
50      */
51     function ExtractContext()
52     {
53         $this->mszLanguageResource = str_replace("\\","/",dirname(__FILE__))."/ExtractContext.dbf";
54
55         // invoke constructor of parent
56         parent::CWCWidget();
57
58         $this->moPopup = new CWCPopup( $this );
59         $this->moButton = new CWCButton( $this );
60        
61         // set the description for this widget
62         $this->szWidgetDescription = <<<EOT
63 The ExtractContext widget passes the current context to a web-based extraction
64 service.
65 EOT;
66
67         $this->maAttributes["EXTRACTURL"] = new StringAttribute( "EXTRACTURL", true );       
68     }
69
70     function InitDefaults()
71     {
72         parent::InitDefaults();
73         //this widget should never belong to a toolset
74         $this->maParams["TOOLSET"] = "";
75         $this->moPopup->InitDefaults();
76         $this->moButton->InitDefaults();
77         $this->moButton->SetOnClick('clickExtractContext');
78         $this->mnMaturityLevel = MATURITY_BETA;
79     }
80
81     function ParseURL()
82     {
83         return $this->moButton->ParseURL();
84     }
85
86
87     /**
88      * GetJavascriptFunctions
89      *
90      * Build and return the array of functions needed in the
91      * widget.
92      */
93     function GetJavascriptFunctions()
94     {
95         $aReturn = $this->moButton->GetJavascriptFunctions();
96
97         $this->moPopup->mszLink = $_SESSION['gszCoreWebPath']."/widgets/ExtractContext/ExtractContext.phtml";
98         $this->moPopup->mszParam = "&EXTRACTURL=".urlencode($this->maParams["EXTRACTURL"]);
99         $szPopup = $this->moPopup->DrawPublish();
100
101         $szJsFunctionName = "clickExtractContext";
102         $szFunction = "function $szJsFunctionName()\n" .
103          "{\n".
104           $szPopup."\n".
105         "return;\n" .
106         "}\n";
107         $aReturn[$szJsFunctionName] = $szFunction;
108
109         return $aReturn;
110     }
111
112     function GetJavascriptOnLoadFunctions()
113     {
114         return $this->moButton->GetJavascriptOnLoadFunctions();
115     }
116    
117     function GetJavascriptIncludeFunctions()
118     {
119         return $this->moButton->GetJavascriptIncludeFunctions();
120     }
121
122     function GetJavascriptInitFunctions()
123     {
124         return $this->moButton->GetJavascriptInitFunctions();
125     }
126    
127     function GetHTMLHiddenVariables()
128     {
129         return $this->moButton->GetHTMLHiddenVariables();
130     }
131
132
133     /**
134      * DrawPublish
135      *
136      * Return the HTML code to display the link to the legend popup
137      */
138     function DrawPublish()
139     {
140         if (!$this->mbVisible)
141             return "<!-- ExtractContext widget hidden -->";
142
143         $szReturn = $this->moButton->DrawPublish();
144
145         return $szReturn;
146     }
147 }
148 ?>
Note: See TracBrowser for help on using the browser.