15 15 <li><a href="#wysiwig">Javascript HTML WYSIWYG editor control</a>
16 16 <ul>
17 17 <li><a href="#tinymce">TinyMCE</a></li>
18 18 <li><a href="#markitup">markitup!</a></li>
19 19 </ul>
20 20 </li>
21 21 <li><a href="#ticket-checkin-links">Link tickets to checkins</a></li>
22 + <li><a href="#th1-usage">Fossil and Th1</a></li>
22 23 </ul>
23 24
24 25 <h2><a name="CGI">Using <cite>Fossil</cite>'s Built-In CGI</a></h2>
25 26 <h3>Motivation</h3>
26 27 * You want to share a repository through your existing web infrastructure.
27 28 * You want to share more than one repository at the same time.
28 29
................................................................................
692 693 Now, continuing, on the same View Page add a link to view associated tickets:
693 694
694 695 <verbatim>
695 696 <a href="/timeline?y=ci&s=$<shortUuid>">associated tickets</a>
696 697 </verbatim>
697 698
698 699 What this does is searches all checkin's for the tickets uuid, thus, you can now see all checkin's that are linked with the given ticket.
700 +
701 +<div>
702 + <h2><a name="th1-usage">Fossil Th1</a></h2>
703 +
704 + <h3>Purpose of Th1</h3>
705 +
706 + <p>Th1 is used as a <strong>template system</strong> for
707 + generating HTML header and footer. It is a TCL like
708 + language. If you know TCL you know TH1.</p>
709 +
710 + <p>It is invoked by opening a <th1> tag. The first time it
711 + starts an interpreter. The state of this interpreter is valid
712 + during the page generation.</p>
713 +
714 + <p>For example when you</p>
715 +
716 + <ul compact='compact'>
717 + <li>
718 + do in the header <th1> set version beta </th1>
719 + </li>
720 + <li>
721 + then in the footer <th1>puts "Version set in header
722 + is $version"</th1> results in 'Version set in header is
723 + beta'
724 + </li>
725 + </ul>
726 +
727 + <p>Because it is used as a template system it exports some
728 + details of fossil through</p>
729 +
730 + <ol>
731 + <li>variables</li>
732 + <li>functions</li>
733 + </ol>
734 +
735 + <p>These are defined in
736 + [590e073746121befe65565ee6d73007c37ade12c|src/th_main.c])</p>
737 +
738 + <h3>Variables</h3>
739 +
740 + <p>These variable are global and available outside <th1>
741 + tags. They can be referenced either as</p>
742 +
743 + <ul compact='compact'>
744 + <li>$var. e.g. $title.</li>
745 + <li>$<var> e.g. $<title></li>
746 + </ul>
747 +
748 + <p>The following are defined:</p>
749 +
750 + <ul compact='compact'>
751 + <li>$base_url. The first part of the url. For example
752 + <strong>http://localhost:8080</strong></li>
753 + <li>$current_page. The page requested. For example editing a
754 + wikipage is done by $baseurl/wikiedit $current_page is
755 + <strong>wikiedit</strong></li>
756 + <li>$index_page<strong>.</strong> Mostly the value is
757 + <strong>/home</strong> setable in Admin/Configuration</li>
758 + <li>$title. The title of the $current_page</li>
759 + <li>$login. The name of user if a login has occurred. if you
760 + use this variable always check if it exists via
761 + <strong><code>info exists login</code></strong></li>
762 + <li>$manifest_version. The fossil version</li>
763 + <li>$manifest_date. The date that fossil version was
764 + compiled</li>
765 + </ul>
766 +
767 + <h3>Functions</h3>
768 + <p>
769 + These are only avaible between
770 + <th1> and </th1>
771 + </p>
772 + <ul compact='compact'>
773 + <li>combobox name text-list numlines. Generates a select box
774 + with name="name" and a cgi-parameter of "name"</li>
775 + <li>enable_output boolean</li>
776 + <li>linecount string max min. Counts the numer of newlines in
777 + string but not more then max and not less then min</li>
778 + <li>hascap string. return true if user has all
779 + capabilities in string</li>
780 + <li>htmlize string. excapes all chars in string which have
781 + special meaning in HTML</li>
782 + <li>date returns the sqlite value of datetime('now')</li>
783 + <li>html string output html</li>
784 + <li>puts string prints the string</li>
785 + <li>wiki string. The string is in wiki format. translate it to
786 + HTML</li>
787 + </ul>
788 +<nowiki>
789 + <h3>Example from admin/header</h3>
790 + <pre>
791 +<html>
792 +<head>
793 +<title><strong>$<project_name></strong>: <strong>$<title></strong></title>
794 +<link rel="alternate" type="application/rss+xml" title="RSS Feed"
795 + href="<strong>$baseurl</strong>/timeline.rss">
796 +<link rel="stylesheet" href="$baseurl/style.css" type="text/css"
797 + media="screen">
798 +</head>
799 +<body>
800 +<div class="header">
801 + <div class="logo">
802 + <img src="<strong>$baseurl</strong>/logo" alt="logo">
803 + <br><nobr><strong>$<project_name></strong></nobr>
804 + </div>
805 + <div class="title"><strong>$<title></strong></div>
806 + <div class="status"><nobr><strong><th1></strong>
807 + if {<strong>[info exists login]</strong>} {
808 + puts "Logged in as <strong>$login</strong>"
809 + } else {
810 + puts "Not logged in"
811 + }
812 + </th1></nobr></div>
813 +</div>
814 +<div class="mainmenu"><th1>
815 +html "<a href='<strong>$baseurl$index_page</strong>'>Home</a> "
816 +if {<strong>[hascap h]</strong>]} {
817 + html "<a href='$baseurl/dir'>Files</a> "
818 +}
819 +</pre>
820 +
821 + <h3>Caveats</h3>
822 +
823 + <ul compact='compact'>
824 + <li>puts "[hello hello]" doesn't work because [ triggers the
825 + interpeter, use puts "&#91hello hello]'</li>
826 + </ul>
827 +</nowiki>
828 +</div>
829 +