richtext::ckeditor4::download (private)
richtext::ckeditor4::download [ -ck_package ck_package ] \ [ -version version ]
Defined in packages/richtext-ckeditor4/tcl/richtext-procs.tcl
Download the CKeditor package in the specified version and put it into a directory structure similar to the CDN structure to allow installation of multiple versions. When the local structure is available, it will be used by initialize_widget. Notice, that for this automated download, the "unzip" program must be installed and $::acs::rootdir/packages/www must be writable by the web server.
- Switches:
- -ck_package (optional)
- -version (optional)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
Source code: # # If no ck_package is specified, use the namespaced variable # as default. # if {$ck_package eq ""} { set ck_package ${::richtext::ckeditor4::ck_package} } set resource_info [::richtext::ckeditor4::resource_info -ck_package $ck_package -version $version] set version [dict get $resource_info configuredVersion] set downloadFromCDNnjs 0 if {$downloadFromCDNnjs} { # # If you really want to use this, you should also clear # "downloadURLs" in resource_info to avoid the version # check on the tar file in # :util::resources::is_installed_locally. For this # piecewise download the tar file does not exist. # set install_dir_name [acs_package_root_dir richtext-ckeditor4]/www/resources/$version/standard set download_prefix https://cdnjs.cloudflare.com/ajax/libs/ckeditor/$version/ file mkdir $install_dir_name set r [ns_http run https://api.cdnjs.com/libraries/ckeditor/$version] set d [::util::json2dict [dict get $r body]] foreach fn [dict get $d files] { if {[string match *.min.* $fn]} continue if {[regexp {plugins/([^/]+)/} $fn . pluginName]} { if {$pluginName ni [dict get $resource_info plugins]} { continue } } set result [::util::resources::download_helper -url $download_prefix/$fn] #ns_log notice "... returned status code [dict get $result status]" set spool_fn [dict get $result file] set subdir [ad_file dirname $install_dir_name/$fn] if {![ad_file isdirectory $subdir]} { file mkdir $subdir } #ns_log notice "mv $spool_fn $install_dir_name/$fn" file rename -force -- $spool_fn $install_dir_name/$fn } return } ::util::resources::download -resource_info $resource_info set resourceDir [dict get $resource_info resourceDir] # # Do we have unzip installed? # set unzip [::util::which unzip] if {$unzip eq ""} { error "can't install CKeditor locally; no unzip program found on PATH" } # # Do we have a writable output directory under resourceDir? # if {![file isdirectory $resourceDir/$version]} { file mkdir $resourceDir/$version } if {![file writable $resourceDir/$version]} { error "directory $resourceDir/$version is not writable" } # # So far, everything is fine, unpack the editor package. # foreach url [dict get $resource_info downloadURLs] { set fn [file tail $url] util::unzip -overwrite -source $resourceDir/$version/$fn -destination $resourceDir/$version file rename -- $resourceDir/$version/ckeditor $resourceDir/$version/$ck_package }XQL Not present: Generic, PostgreSQL, Oracle