gustafn
committed
on 23 Oct 24
added inline documentation for API browser
openacs-4/.../edit-this-page/tcl/etp-procs.tcl (+6 -4)
259 259         if {$package_id eq ""} {
260 260             set package_id [ad_conn package_id]
261 261         }
262 262         if {![string is integer -strict $package_id]} {
263 263            ad_log Warning "package_id <$package_id> is not an integer"
264 264            #
265 265            # This might happen, when no package_id could be determined
266 266            # via [ad_conn package_id]
267 267            #
268 268            ns_returnnotfound
269 269            ad_script_abort
270 270         }
271 271         set name [etp::get_name]
272 272         set content_type [etp::get_content_type $name]
273 273
274 274         upvar pa pa
275 275
276 276         if { [catch {
277 277             if {[ad_conn -get revision_id] eq ""} {
278 278                 # asking for the live published revision
279                   set code "etp::get_pa $package_id $name $content_type"
280                   array set pa [util_memoize $code $max_age]
  279                 array set pa [util_memoize \
  280                                   [list etp::get_pa $package_id $name $content_type] \
  281                                   $max_age]
281 282             } else {
282 283                 # an admin is browsing other revisions - do not use caching.
283 284                 array set pa [etp::get_pa [ad_conn package_id] $name $content_type]
284 285             }
285 286         } errmsg] } {
286               ns_log warning "Error from etp::get_pa was:\n$errmsg"
  287             ns_log warning "etp::get_pa revision_id '[ad_conn -get revision_id]'" \
  288                 "package_id '[ad_conn package_id]' raised exception:" $errmsg
287 289
288 290             # Page not found.  Redirect admins to setup page;
289 291             # otherwise report 404 error.
290 292             if { $name eq "index" &&
291 293                  [permission::permission_p -object_id [ad_conn package_id] -privilege admin] } {
292 294                 # set up the new content section
293 295                 ad_returnredirect "etp-setup-2"
294 296             } else {
295 297                 ns_returnnotfound
296 298             }
297 299             # we're done responding to this request, so do no
298 300             # further processing on this page
299 301             ad_script_abort
300 302         }
301 303
302 304     }
303 305
304 306
305 307     ad_proc -private get_pa { package_id name {content_type ""} } {
306 308         @author Luke Pond