Collection of themes/skins for the Fossil SCM

⌈⌋ ⎇ branch:  Fossil Skins Extra


Artifact [e2914854f4]

Artifact e2914854f4ab538cb8a46b07017e8dbe21a39c2a:

  • File features/file_link.th1 — part of check-in [0499e95f66] at 2021-10-14 11:14:32 on branch trunk — Generate link meta for file pages (complements fx_meta), could still be shortened; maybe should include info/CHKIN pages too (user: mario size: 1721)

# output <link> for "file" pages
proc file_link {} {
    upvar 1 current_page current_page
    set name [getParameter name]
    set ci [getParameter ci]%
    set top [globalState top]
    set sql_byname  {
       SELECT uuid         FROM blob LEFT JOIN mlink ON blob.rid=mlink.fid         LEFT JOIN filename ON mlink.fnid=filename.fnid
        WHERE name = $name        ORDER BY rid DESC LIMIT 1
    }
    set sql_bynameci {
       SELECT uuid FROM blob
        WHERE rid IN (
              SELECT fid
                FROM blob LEFT JOIN mlink ON mid=blob.rid
                LEFT JOIN filename on mlink.fnid=filename.fnid
               WHERE uuid LIKE $ci AND name = $name
               ORDER BY rid DESC
        )
    }
    html "<!-- FL($current_page,name=$name,ci=$ci) -->\n"
    if {[regexp  "^doc/(tip|trunk)/.+" $current_page]} {
        # doc/tip/file.txt
        set sql $sql_byname
    } elseif {"$current_page" eq "finfo"} {
        if {"$ci" ne "%"} {
            # finfo?name=file.txt&ci=1234f
            set sql $sql_bynameci
        } else {
            # finfo?name=file.txt
            set sql "$sql_byname"
            #ci LIMIT 1"
        }
    } elseif {[regexp  "^doc/\\w+/.+" $current_page]} {
        if {"$ci" ne "%"} {
            # doc/1234f/file.txt
            set sql $sql_bynameci
        } else {
            # /info/1234f  # should assert that it refers to a file blob?
            set name "$name%"
            set sql {SELECT uuid FROM blob where uuid LIKE $name}
        }
    } else { html "<!--nomatch-->" }
    if {[info exists sql]} {
        html "<!-- = $sql -->"
        query $sql {
            html "<link rel='alternative vcs raw' href='$top/raw/$uuid'>"
        }
    }
}