Index: openacs-4/packages/acs-admin/www/apm/file-add.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/apm/Attic/file-add.tcl,v diff -u -N -r1.4 -r1.5 --- openacs-4/packages/acs-admin/www/apm/file-add.tcl 10 Sep 2002 22:21:59 -0000 1.4 +++ openacs-4/packages/acs-admin/www/apm/file-add.tcl 19 Dec 2002 16:06:59 -0000 1.5 @@ -1,106 +1,105 @@ -ad_page_contract { - Allows the user to add files to a package. - @param version_id The identifier for the package. - @author Jon Salz (jsalz@arsdigita.com) - @creation-date 17 April 2000 +ad_page_contract { + Allows the user to add files to a package. + @param version_id The identifier for the package. + @author Jon Salz (jsalz@arsdigita.com) + @creation-date 17 April 2000 @cvs-id $Id$ -} { - {version_id:integer} - {verbose:integer 0} -} - -apm_version_info $version_id - -doc_body_append "[apm_header -form "method=post action=\"file-add-2\"" [list "version-view?version_id=$version_id" "$pretty_name $version_name"] [list "version-files?version_id=$version_id" "Files"] "Add Files"] - -[export_form_vars version_id] - -
- -" - -doc_body_flush - -# Obtain a list of all files registered to the package already. -array set registered_files [list] -foreach file [db_list apm_file_paths { - select path from apm_package_files where version_id = :version_id -}] { - set registered_files($file) 1 -} - -db_release_unused_handles - -# processed_files is a list of sublists, each of which contains -# the path of a file and its file type. -set processed_files [list] -set counter 0 -set registered 0 - -foreach file [lsort [ad_find_all_files -check_file_func apm_include_file_p [acs_package_root_dir $package_key]]] { - set relative_path [ad_make_relative_path $file] - - # Now kill "packages" and the package_key from the path. - set components [split $relative_path "/"] - set relative_path [join [lrange $components 2 [llength $components]] "/"] - - if { [info exists registered_files($relative_path)] } { - incr registered - if { $verbose } { - doc_body_append "\n" - } - } else { - set type [apm_guess_file_type $package_key $relative_path] - set db_type [apm_guess_db_type $package_key $relative_path] - doc_body_append "\n" - lappend processed_files [list $relative_path $type $db_type] - } - incr counter -} - -db_release_unused_handles -# Transport the list of files to the next page. -doc_body_append [export_form_vars processed_files] - -if { $counter == 0 } { - doc_body_append "
$relative_path (already registered to this package)
 $relative_path: [apm_pretty_name_for_file_type $type]" - if { ![empty_string_p $db_type] } { - doc_body_append " ([apm_pretty_name_for_db_type $db_type])" - } - doc_body_append "
There are no files in the packages/$package_key directory.
" -} elseif { [llength $processed_files] > 0 } { - doc_body_append " - -
-\[ check all | -uncheck all \] -
- -
- -" -} else { - doc_body_append "
There are no additional files to add to the package." -} - -if { $registered < 1 } { - doc_body_append "

No registered files exist" -} else { - if { $verbose } { - doc_body_append "

$registered registered files hide them" - } else { - doc_body_append "

$registered registered files hidden display them" - } -} - -doc_body_append "

\n[ad_footer]\n" - +} { + {version_id:integer} + {verbose:integer 0} +} + +apm_version_info $version_id + +doc_body_append "[apm_header -form "method=post action=\"file-add-2\"" [list "version-view?version_id=$version_id" "$pretty_name $version_name"] [list "version-files?version_id=$version_id" "Files"] "Add Files"] + +[export_form_vars version_id] + +
+ +" + +doc_body_flush + +# Obtain a list of all files registered to the package already. +array set registered_files [list] +foreach file [db_list apm_file_paths { + select path from apm_package_files where version_id = :version_id +}] { + set registered_files($file) 1 +} + +db_release_unused_handles + +# processed_files is a list of sublists, each of which contains +# the path of a file and its file type. +set processed_files [list] +set counter 0 +set registered 0 + +foreach file [lsort [ad_find_all_files -check_file_func apm_include_file_p [acs_package_root_dir $package_key]]] { + set relative_path [ad_make_relative_path $file] + + # Now kill "packages" and the package_key from the path. + set components [split $relative_path "/"] + set relative_path [join [lrange $components 2 [llength $components]] "/"] + + if { [info exists registered_files($relative_path)] } { + incr registered + if { $verbose } { + doc_body_append "\n" + } + } else { + set type [apm_guess_file_type $package_key $relative_path] + set db_type [apm_guess_db_type $package_key $relative_path] + doc_body_append "\n" + lappend processed_files [list $relative_path $type $db_type] + } + incr counter +} + +db_release_unused_handles +# Transport the list of files to the next page. +doc_body_append [export_form_vars processed_files] + +if { $counter == 0 } { + doc_body_append "
$relative_path (already registered to this package)
 $relative_path: [apm_pretty_name_for_file_type $type]" + if { ![empty_string_p $db_type] } { + doc_body_append " ([apm_pretty_name_for_db_type $db_type])" + } + doc_body_append "
There are no files in the packages/$package_key directory.
" +} elseif { [llength $processed_files] > 0 } { + doc_body_append " + +
+\[ check all | +uncheck all \] +
+ +
+ +" +} else { + doc_body_append "
There are no additional files to add to the package." +} + +if { $registered < 1 } { + doc_body_append "

No registered files exist" +} else { + if { $verbose } { + doc_body_append "

$registered registered files hide them" + } else { + doc_body_append "

$registered registered files hidden display them" + } +} + +doc_body_append "

\n[ad_footer]\n"