gustafn
committed
on 18 Jan 17
- make boolean tests in .adp files more uniform
openacs-4/.../www/apm/version-i18n.tcl (+6 -6)
1 1 ad_page_contract {
2       A form to help semi-automate the conversion of tcl and adp files from using literal
  2     A form to help semi-automate the conversion of Tcl and adp files from using literal
3 3     text strings to using the message catalog.
4 4
5 5     @author Peter Marklund (peter@collaboraid.biz)
6 6     @creation-date 8 October 2002
7 7     @cvs-id $Id$ 
8 8 } {
9 9     version_id:naturalnum,notnull   
10 10     {pre_select_files_p:boolean "1"}
11 11     {show_status_p:boolean "0"}
12 12     {only_text_p:boolean "0"}
13 13     {file_type adp}
14 14 }
15 15
16 16 db_1row package_version_info {
17 17     select pretty_name, version_name
18 18     from apm_package_version_info
19 19     where version_id = :version_id
20 20 }
21 21
22   set page_title "Message catalog lookups for adp and tcl files of $pretty_name $version_name"
  22 set page_title "Message catalog lookups for adp and Tcl files of $pretty_name $version_name"
23 23 set context_bar [ad_context_bar $page_title]
24 24
25 25 set file_option_list [list]
26 26 set adp_preselect_list [list]
27 27 set package_key [apm_package_key_from_version_id $version_id]
28 28 foreach file [lsort [ad_find_all_files [acs_package_root_dir $package_key]]] {  
29 29
30 30     set file_regexp ".${file_type}\$"
31 31    
32 32     if { [regexp $file_regexp $file match] } {
33 33         set relative_path [ad_make_relative_path $file]
34 34
35 35         # Get statistics on number of message tags
36 36         if { $show_status_p || $only_text_p } {
37 37
38 38             set file_id [open $file r]
39 39             set file_contents [read $file_id]
40 40
41 41             set number_of_message_tags [llength [lang::util::get_temporary_tags_indices $file_contents]]
42 42
 
134 134     set status_filter [subst {<a href="[ns_quotehtml $href]">Hide I18N status of files</a>}]
135 135 } else {
136 136     set href [export_vars -base version-i18n -override {{show_status_p 1}} {version_id file_type pre_select_files_p only_text_p}]
137 137     set status_filter [subst {<a href="[ns_quotehtml $href]">Show I18N status of files</a>}]
138 138 }
139 139
140 140 switch -- $file_type {
141 141     adp {
142 142         if { $only_text_p } {
143 143             set href [export_vars -base version-i18n-override {{only_text_p 0}} {pre_select_files_p version_id file_type show_status_p}]
144 144             set text_only_filter [subst {<a href="[ns_quotehtml $href]">all adp files</a> | only adp files with translatable text}]
145 145         } else {
146 146             set href [export_vars -base version-i18n -override {{only_text_p 1}} {pre_select_files_p version_id file_type show_status_p}]
147 147             set text_only_filter [subst {<b>all adp files</b> | <a href="[ns_quotehtml $href]">only apd files with translatable text</a>}]
148 148         }
149 149
150 150         set href1 [export_vars -base version-i18n -override {{file_type tcl}} {version_id pre_select_files_p show_status_p only_text_p}]
151 151         set href2 [export_vars -base version-i18n -override {{file_type sql}} {version_id pre_select_files_p show_status_p only_text_p}]
152 152         set file_type_filter [subst {
153 153             <b>Show adp files</b>: $text_only_filter |
154               <a href="[ns_quotehtml $href1]">Show tcl files</a> |
  154             <a href="[ns_quotehtml $href1]">Show Tcl files</a> |
155 155             <a href="[ns_quotehtml $href2]">Show sql files</a>
156 156         }]
157 157     }
158 158     tcl {
159 159         set href1 [export_vars -base version-i18n -override {{file_type adp}} {version_id pre_select_files_p show_status_p only_text_p}]
160 160         set href2 [export_vars -base version-i18n -override {{file_type sql}} {version_id pre_select_files_p show_status_p only_text_p}]
161 161         set file_type_filter [subst {
162 162             <a href="[ns_quotehtml $href1]">Show adp files</a> |
163               <b>Show tcl files</b> |
  163             <b>Show Tcl files</b> |
164 164             <a href="[ns_quotehtml $href2]">Show sql files</a>
165 165         }]
166 166     }
167 167     sql {
168 168         set href1 [export_vars -base version-i18n -override {{file_type adp}} {version_id pre_select_files_p show_status_p only_text_p}]
169 169         set href2 [export_vars -base version-i18n -override {{file_type tcl}} {version_id pre_select_files_p show_status_p only_text_p}]
170 170         
171 171         set file_type_filter [subst {
172 172             <a href="[ns_quotehtml $href1]">Show adp files</a> |
173               <a href="[ns_quotehtml $href2]">Show tcl files</a> |
  173             <a href="[ns_quotehtml $href2]">Show Tcl files</a> |
174 174             <b>Show sql files</b>
175 175         }]
176 176     }
177 177 }
178 178
179 179 ad_return_template
180 180
181 181 # Local variables:
182 182 #    mode: tcl
183 183 #    tcl-indent-level: 4
184 184 #    indent-tabs-mode: nil
185 185 # End: