| |
174 |
174 |
it into a directory structure similar to the CDN structure to |
| |
175 |
175 |
allow installation of multiple versions. When the local |
| |
176 |
176 |
structure is available, it will be used by initialize_widget. |
| |
177 |
177 |
|
| |
178 |
178 |
Notice, that for this automated download, the "unzip" program |
| |
179 |
179 |
must be installed and $::acs::rootdir/packages/www must be |
| |
180 |
180 |
writable by the web server. |
| |
181 |
181 |
|
| |
182 |
182 |
} { |
| |
183 |
183 |
# |
| |
184 |
184 |
# If no version or ck editor package are specified, use the |
| |
185 |
185 |
# namespaced variables as default. |
| |
186 |
186 |
# |
| |
187 |
187 |
if {$version eq ""} { |
| |
188 |
188 |
set version ${::richtext::ckeditor4::version} |
| |
189 |
189 |
} |
| |
190 |
190 |
if {$ck_package eq ""} { |
| |
191 |
191 |
set ck_package ${::richtext::ckeditor4::ck_package} |
| |
192 |
192 |
} |
| |
193 |
193 |
|
| |
194 |
|
set download_url http://download.cksource.com/CKEditor/CKEditor/CKEditor%20${version}/ckeditor_${version}_${package}.zip |
| |
|
194 |
set download_url http://download.cksource.com/CKEditor/CKEditor/CKEditor%20${version}/ckeditor_${version}_${cp_package}.zip |
| |
195 |
195 |
set resources $::acs::rootdir/packages/richtext-ckeditor4/www/resources |
| |
196 |
196 |
|
| |
197 |
197 |
# |
| |
198 |
198 |
# Do we have unzip installed? |
| |
199 |
199 |
# |
| |
200 |
200 |
set unzip [::util::which unzip] |
| |
201 |
201 |
if {$unzip eq ""} { |
| |
202 |
202 |
error "can't install CKeditor locally; no unzip program found on PATH" |
| |
203 |
203 |
} |
| |
204 |
204 |
|
| |
205 |
205 |
# |
| |
206 |
206 |
# Do we have a writable output directory under resources? |
| |
207 |
207 |
# |
| |
208 |
208 |
if {![file isdirectory $resources/$version]} { |
| |
209 |
209 |
file mkdir $resources/$version |
| |
210 |
210 |
} |
| |
211 |
211 |
if {![file writable $resources/$version]} { |
| |
212 |
212 |
error "directory $resources/$version is not writable" |
| |
213 |
213 |
} |
| |
214 |
214 |
|
| |
215 |
215 |
# |
| |
216 |
216 |
# So far, everything is fine, download the editor package |
| |
217 |
217 |
# |
| |
218 |
218 |
set result [util::http::get -url $download_url -spool] |
| |
219 |
219 |
#ns_log notice "GOT $result" |
| |
220 |
220 |
if {[dict get $result status] == 200} { |
| |
221 |
221 |
# |
| |
222 |
222 |
# The Download was successful, unzip it and let the |
| |
223 |
223 |
# directory structure look similar as on the CDN. |
| |
224 |
224 |
# |
| |
225 |
225 |
set fn [dict get $result file] |
| |
226 |
226 |
set output [exec $unzip -o $fn -d $resources/$version] |
| |
227 |
|
file rename $resources/$version/ckeditor $resources/$version/$package |
| |
|
227 |
file rename $resources/$version/ckeditor $resources/$version/$ck_package |
| |
228 |
228 |
} else { |
| |
229 |
229 |
error "download of $download_url failed, HTTP status: [dict get $result status]" |
| |
230 |
230 |
} |
| |
231 |
231 |
} |
| |
232 |
232 |
|
| |
233 |
233 |
} |
| |
234 |
234 |
|
| |
235 |
235 |
# Local variables: |
| |
236 |
236 |
# mode: tcl |
| |
237 |
237 |
# tcl-indent-level: 4 |
| |
238 |
238 |
# indent-tabs-mode: nil |
| |
239 |
239 |
# End: |