1 |
<?php |
---|
2 |
/** |
---|
3 |
* KeyMapDHTMLMode Widget class |
---|
4 |
* |
---|
5 |
* @project CWC2 |
---|
6 |
* @revision $Id: |
---|
7 |
* @purpose KeyMapDHTML Mode setter class. Allows the user to set the |
---|
8 |
* the current mode of the KeyMapDHTML |
---|
9 |
* |
---|
10 |
* @author DM Solutions Group (sfournier@dmsolutions.ca) |
---|
11 |
* @copyright |
---|
12 |
* <b>Copyright (c) 2002, DM Solutions Group Inc.</b> |
---|
13 |
* Permission is hereby granted, free of charge, to any person obtaining a |
---|
14 |
* copy of this software and associated documentation files (the "Software"), |
---|
15 |
* to deal in the Software without restriction, including without limitation |
---|
16 |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
---|
17 |
* and/or sell copies of the Software, and to permit persons to whom the |
---|
18 |
* Software is furnished to do so, subject to the following conditions: |
---|
19 |
* |
---|
20 |
* The above copyright notice and this permission notice shall be included |
---|
21 |
* in all copies or substantial portions of the Software. |
---|
22 |
* |
---|
23 |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
---|
24 |
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
---|
25 |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
---|
26 |
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
---|
27 |
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
---|
28 |
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
---|
29 |
* DEALINGS IN THE SOFTWARE. |
---|
30 |
*/ |
---|
31 |
|
---|
32 |
include_once(dirname(__FILE__)."/../Widget.php"); |
---|
33 |
include_once(dirname(__FILE__)."/../Button.php"); |
---|
34 |
|
---|
35 |
/** |
---|
36 |
* KeyMapDHTMLMode |
---|
37 |
* |
---|
38 |
* @desc A widget to remove the last KeyMapDHTML mode added to the new one. |
---|
39 |
*/ |
---|
40 |
class KeyMapDHTMLMode extends CWCWidget |
---|
41 |
{ |
---|
42 |
/* the button that is the interface for this widget */ |
---|
43 |
var $moButton; |
---|
44 |
|
---|
45 |
/* the mode to set the manager to */ |
---|
46 |
var $mszCmd = "ZOOM"; |
---|
47 |
|
---|
48 |
/** |
---|
49 |
* construct a new KeyMapDHTML Removal Tool widget |
---|
50 |
*/ |
---|
51 |
function KeyMapDHTMLMode() |
---|
52 |
{ |
---|
53 |
// invoke constructor of parent |
---|
54 |
parent::CWCWidget(); |
---|
55 |
|
---|
56 |
// set the description for this widget |
---|
57 |
$this->szWidgetDescription = <<<EOT |
---|
58 |
The KeyMapDHTMLMode widget allows the user to set the current mode |
---|
59 |
of the KeyMapDHTML. |
---|
60 |
EOT; |
---|
61 |
$this->moButton = new CWCButton( $this ); |
---|
62 |
$this->maAttributes['MODE'] = new StringAttribute( 'MODE', false ); |
---|
63 |
$this->mnMaturityLevel = MATURITY_BETA; |
---|
64 |
} |
---|
65 |
|
---|
66 |
/** |
---|
67 |
* initialize the widget. |
---|
68 |
*/ |
---|
69 |
function InitDefaults() |
---|
70 |
{ |
---|
71 |
parent::InitDefaults(); |
---|
72 |
|
---|
73 |
$this->moButton->InitDefaults(); |
---|
74 |
|
---|
75 |
if (isset($this->maParams['MODE'])) |
---|
76 |
{ |
---|
77 |
if (strcasecmp($this->maParams['MODE'], 'zoom') == 0) |
---|
78 |
{ |
---|
79 |
$this->mszCmd = "ZOOM"; |
---|
80 |
} |
---|
81 |
elseif (strcasecmp($this->maParams['MODE'], 'recenter') == 0) |
---|
82 |
{ |
---|
83 |
$this->mszCmd = "RECENTER"; |
---|
84 |
} |
---|
85 |
} |
---|
86 |
$this->moButton->SetOnClick('CWCKeyMapDHTMLModeSet', $this->mszCmd); |
---|
87 |
} |
---|
88 |
|
---|
89 |
function ParseURL() |
---|
90 |
{ |
---|
91 |
return $this->moButton->ParseURL(); |
---|
92 |
} |
---|
93 |
|
---|
94 |
function GetJavascriptFunctions() |
---|
95 |
{ |
---|
96 |
$aReturn = array(); |
---|
97 |
|
---|
98 |
$szName = 'CWCKeyMapDHTMLModeSet'; |
---|
99 |
$szFunction = <<<EOT |
---|
100 |
function {$szName}( oButton, xValues ) |
---|
101 |
{ |
---|
102 |
{$this->mszHTMLForm}.KEYMAP_DHTML_MODE.value = xValues; |
---|
103 |
{$this->mszHTMLForm}.KEYMAP_NAV_ALLOW_RECTANGLE.value=1; |
---|
104 |
} |
---|
105 |
EOT; |
---|
106 |
$aReturn[$szName] = $szFunction; |
---|
107 |
|
---|
108 |
return $aReturn; |
---|
109 |
} |
---|
110 |
|
---|
111 |
function GetJavascriptIncludeFunctions() |
---|
112 |
{ |
---|
113 |
return $this->moButton->GetJavascriptIncludeFunctions(); |
---|
114 |
} |
---|
115 |
|
---|
116 |
function GetJavascriptVariables() |
---|
117 |
{ |
---|
118 |
if ($this->mbVisible) |
---|
119 |
return $this->moButton->GetJavascriptVariables(); |
---|
120 |
else |
---|
121 |
return array(); |
---|
122 |
} |
---|
123 |
|
---|
124 |
function GetJavascriptInitFunctions() |
---|
125 |
{ |
---|
126 |
if ($this->mbVisible) |
---|
127 |
return $this->moButton->GetJavascriptInitFunctions(); |
---|
128 |
else |
---|
129 |
return array(); |
---|
130 |
} |
---|
131 |
|
---|
132 |
function GetJavascriptOnLoadFunctions() |
---|
133 |
{ |
---|
134 |
if ($this->mbVisible) |
---|
135 |
$aReturn = $this->moButton->GetJavascriptOnLoadFunctions(); |
---|
136 |
else |
---|
137 |
$aReturn = array(); |
---|
138 |
|
---|
139 |
return $aReturn; |
---|
140 |
} |
---|
141 |
|
---|
142 |
function GetHTMLHiddenVariables() |
---|
143 |
{ |
---|
144 |
$aReturn = $this->moButton->GetHTMLHiddenVariables(); |
---|
145 |
|
---|
146 |
$szMode = "ZOOM"; |
---|
147 |
if ($this->isVarSet("KEYMAP_DHTML_MODE")) |
---|
148 |
$szMode = $this->getVar("KEYMAP_DHTML_MODE"); |
---|
149 |
|
---|
150 |
$szVariable = "KEYMAP_DHTML_MODE"; |
---|
151 |
$szValue = " <INPUT TYPE=HIDDEN NAME=$szVariable VALUE=\"$szMode\">"; |
---|
152 |
$aReturn[$szVariable] = $szValue; |
---|
153 |
|
---|
154 |
$szVariable = "KEYMAP_NAV_ALLOW_RECTANGLE"; |
---|
155 |
$szValue = " <INPUT TYPE=HIDDEN NAME=$szVariable VALUE=\"1\">\n"; |
---|
156 |
$aReturn[$szVariable] = $szValue; |
---|
157 |
|
---|
158 |
return $aReturn; |
---|
159 |
} |
---|
160 |
|
---|
161 |
/** |
---|
162 |
* draw this widg5et on the page |
---|
163 |
*/ |
---|
164 |
function DrawPublish() |
---|
165 |
{ |
---|
166 |
if (isset($this->maSharedResourceWidgets["CWCJSAPI"])) |
---|
167 |
$bCWCJSAPI = 1; |
---|
168 |
else |
---|
169 |
$bCWCJSAPI = 0; |
---|
170 |
|
---|
171 |
if (!$this->mbVisible) |
---|
172 |
return "<!-- KeyMapDHTMLMode hidden -->"; |
---|
173 |
|
---|
174 |
$szReturn = $this->moButton->DrawPublish(); |
---|
175 |
|
---|
176 |
return $szReturn; |
---|
177 |
} |
---|
178 |
} |
---|
179 |
?> |
---|