1 |
<?php |
---|
2 |
|
---|
3 |
|
---|
4 |
|
---|
5 |
|
---|
6 |
|
---|
7 |
|
---|
8 |
|
---|
9 |
|
---|
10 |
|
---|
11 |
|
---|
12 |
|
---|
13 |
|
---|
14 |
|
---|
15 |
|
---|
16 |
|
---|
17 |
|
---|
18 |
|
---|
19 |
|
---|
20 |
|
---|
21 |
|
---|
22 |
|
---|
23 |
|
---|
24 |
|
---|
25 |
|
---|
26 |
|
---|
27 |
|
---|
28 |
|
---|
29 |
|
---|
30 |
|
---|
31 |
include_once(dirname(__FILE__)."/../Widget.php"); |
---|
32 |
include_once(dirname(__FILE__)."/../Button.php"); |
---|
33 |
include_once(dirname(__FILE__).'/../Popup.php'); |
---|
34 |
|
---|
35 |
|
---|
36 |
|
---|
37 |
|
---|
38 |
|
---|
39 |
|
---|
40 |
|
---|
41 |
class ExtractSR extends CWCWidget |
---|
42 |
{ |
---|
43 |
var $moButton; |
---|
44 |
var $moPopup; |
---|
45 |
|
---|
46 |
var $mszSharedResource; |
---|
47 |
|
---|
48 |
|
---|
49 |
|
---|
50 |
|
---|
51 |
|
---|
52 |
|
---|
53 |
function ExtractSR() |
---|
54 |
{ |
---|
55 |
$this->mszLanguageResource = str_replace("\\","/",dirname(__FILE__))."/ExtractSR.dbf"; |
---|
56 |
parent::CWCWidget(); |
---|
57 |
|
---|
58 |
$this->moButton = new CWCButton( $this ); |
---|
59 |
|
---|
60 |
$this->moPopup = new CWCPopup( $this ); |
---|
61 |
$this->moPopup->mszLink = $_SESSION['gszCoreWebPath']."/widgets/ExtractSR/ExtractSR.phtml"; |
---|
62 |
|
---|
63 |
|
---|
64 |
$this->szWidgetDescription = <<<EOT |
---|
65 |
The ExtractSRWidget displays a popup dialog box that allows the user |
---|
66 |
download query results as a CSV file. |
---|
67 |
EOT; |
---|
68 |
|
---|
69 |
$this->maAttributes['SHAREDRESOURCE'] = new StringAttribute( 'SHAREDRESOURCE', true ); |
---|
70 |
|
---|
71 |
$this->mnMaturityLevel = MATURITY_BETA; |
---|
72 |
} |
---|
73 |
|
---|
74 |
function InitDefaults() |
---|
75 |
{ |
---|
76 |
parent::InitDefaults(); |
---|
77 |
|
---|
78 |
|
---|
79 |
$this->maParams["TOOLSET"] = ""; |
---|
80 |
$this->moButton->InitDefaults(); |
---|
81 |
$this->moButton->SetOnClick('clickExtractSR'); |
---|
82 |
|
---|
83 |
if (isset($this->maParams['SHAREDRESOURCE'])) |
---|
84 |
$this->mszSharedResource = $this->maParams['SHAREDRESOURCE']; |
---|
85 |
} |
---|
86 |
|
---|
87 |
function GetJavascriptInitFunctions() |
---|
88 |
{ |
---|
89 |
return $this->moButton->GetJavascriptInitFunctions(); |
---|
90 |
} |
---|
91 |
|
---|
92 |
function GetJavascriptVariables() |
---|
93 |
{ |
---|
94 |
return $this->moButton->GetJavascriptVariables(); |
---|
95 |
} |
---|
96 |
|
---|
97 |
function GetJavascriptOnLoadFunctions() |
---|
98 |
{ |
---|
99 |
return $this->moButton->GetJavascriptOnLoadFunctions(); |
---|
100 |
} |
---|
101 |
|
---|
102 |
function GetJavascriptIncludeFunctions() |
---|
103 |
{ |
---|
104 |
return $this->moButton->GetJavascriptIncludeFunctions(); |
---|
105 |
} |
---|
106 |
|
---|
107 |
|
---|
108 |
|
---|
109 |
|
---|
110 |
|
---|
111 |
|
---|
112 |
function GetHTMLHiddenVariables() |
---|
113 |
{ |
---|
114 |
$aReturn = $this->moButton->GetHTMLHiddenVariables(); |
---|
115 |
|
---|
116 |
return $aReturn; |
---|
117 |
} |
---|
118 |
|
---|
119 |
|
---|
120 |
|
---|
121 |
|
---|
122 |
function ParseURL() |
---|
123 |
{ |
---|
124 |
$this->moButton->ParseURL(); |
---|
125 |
|
---|
126 |
return true; |
---|
127 |
} |
---|
128 |
|
---|
129 |
|
---|
130 |
|
---|
131 |
|
---|
132 |
|
---|
133 |
|
---|
134 |
|
---|
135 |
function GetJavascriptFunctions() |
---|
136 |
{ |
---|
137 |
$aReturn = $this->moButton->GetJavascriptFunctions(); |
---|
138 |
$this->moPopup->mszParam = "&srname=".$this->mszSharedResource; |
---|
139 |
|
---|
140 |
$szJsFunctionName = "clickExtractSR"; |
---|
141 |
|
---|
142 |
if (isset($this->maSharedResourceWidgets[$this->mszSharedResource]) && |
---|
143 |
count($this->maSharedResourceWidgets[$this->mszSharedResource]) > 0) |
---|
144 |
{ |
---|
145 |
$szButtonJS = $this->moPopup->DrawPublish(); |
---|
146 |
if (is_array($this->maSharedResourceWidgets[$this->mszSharedResource])) |
---|
147 |
{ |
---|
148 |
$_SESSION['EXTRACTSR_DATA_'.$this->mszSharedResource] = $this->maSharedResourceWidgets[$this->mszSharedResource]; |
---|
149 |
} |
---|
150 |
else |
---|
151 |
{ |
---|
152 |
$_SESSION['EXTRACTSR_DATA_'.$this->mszSharedResource] = $this->maSharedResourceWidgets[$this->mszSharedResource]->maszContents; |
---|
153 |
} |
---|
154 |
} |
---|
155 |
else |
---|
156 |
{ |
---|
157 |
$szButtonJS = 'alert( "no data to extract." ); '; |
---|
158 |
$_SESSION['EXTRACTSR_DATA_'.$this->mszSharedResource] = array(); |
---|
159 |
} |
---|
160 |
$szFunction = <<<EOT |
---|
161 |
/** |
---|
162 |
* {$szJsFunctionName} |
---|
163 |
* popup a ExtractSR dialog |
---|
164 |
*/ |
---|
165 |
function {$szJsFunctionName}() |
---|
166 |
{ |
---|
167 |
{$szButtonJS} |
---|
168 |
return; |
---|
169 |
} |
---|
170 |
EOT; |
---|
171 |
$aReturn[$szJsFunctionName] = $szFunction; |
---|
172 |
|
---|
173 |
return $aReturn; |
---|
174 |
} |
---|
175 |
|
---|
176 |
|
---|
177 |
|
---|
178 |
|
---|
179 |
|
---|
180 |
|
---|
181 |
|
---|
182 |
function DrawPublish() |
---|
183 |
{ |
---|
184 |
if (!$this->mbVisible) |
---|
185 |
return "<!-- ExtractSR widget hidden -->"; |
---|
186 |
|
---|
187 |
$szResult = $this->moButton->DrawPublish(); |
---|
188 |
|
---|
189 |
return $szResult; |
---|
190 |
} |
---|
191 |
} |
---|
192 |
?> |
---|
193 |
|
---|