Changes To Cookbook
Not logged in

Changes to "Cookbook" between 2009-12-31 04:13:53 and 2010-01-04 23:21:38

15
16
17
18
19
20
21

22
23
24
25
26
27
28
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29







+







  <li><a href="#wysiwig">Javascript HTML WYSIWYG editor control</a>
    <ul>
      <li><a href="#tinymce">TinyMCE</a></li>
      <li><a href="#markitup">markitup!</a></li>
    </ul>
  </li>
  <li><a href="#ticket-checkin-links">Link tickets to checkins</a></li>
  <li><a href="#th1-usage">Fossil and Th1</a></li>
</ul>

<h2><a name="CGI">Using <cite>Fossil</cite>'s Built-In CGI</a></h2>
<h3>Motivation</h3>
  *  You want to share a repository through your existing web infrastructure.
  *  You want to share more than one repository at the same time.

692
693
694
695
696
697
698


































































































































693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829







+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Now, continuing, on the same View Page add a link to view associated tickets: 

<verbatim>
<a href="/timeline?y=ci&s=$<shortUuid>">associated tickets</a>
</verbatim>

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.

<div>
  <h2><a name="th1-usage">Fossil Th1</a></h2>

  <h3>Purpose of Th1</h3>

  <p>Th1 is used as a <strong>template system</strong> for
  generating HTML header and footer. It is a TCL like
  language. If you know TCL you know TH1.</p>

  <p>It is invoked by opening a &lt;th1&gt; tag. The first time it
  starts an interpreter. The state of this interpreter is valid
  during the page generation.</p>

  <p>For example when you</p>

  <ul compact='compact'>
    <li>
      do in the header &lt;th1&gt; set version beta &lt;/th1&gt;
    </li>
    <li>
      then in the footer &lt;th1&gt;puts "Version set in header
      is $version"&lt;/th1&gt; results in 'Version set in header is
      beta'
    </li>
  </ul>

  <p>Because it is used as a template system it exports some
  details of fossil through</p>

  <ol>
    <li>variables</li>
    <li>functions</li>
  </ol>

  <p>These are defined in
 [590e073746121befe65565ee6d73007c37ade12c|src/th_main.c])</p>

  <h3>Variables</h3>

  <p>These variable are global and available outside &lt;th1&gt;
  tags. They can be referenced either as</p>

  <ul compact='compact'>
    <li>$var. e.g. $title.</li>
    <li>$&lt;var&gt; e.g. $&lt;title&gt;</li>
  </ul>

  <p>The following are defined:</p>

  <ul compact='compact'>
    <li>$base_url. The first part of the url. For example
    <strong>http://localhost:8080</strong></li>
    <li>$current_page. The page requested. For example editing a
    wikipage is done by $baseurl/wikiedit $current_page is
    <strong>wikiedit</strong></li>
    <li>$index_page<strong>.</strong> Mostly the value is
    <strong>/home</strong> setable in Admin/Configuration</li>
    <li>$title. The title of the $current_page</li>
    <li>$login. The name of user if a login has occurred. if you
    use this variable always check if it exists via
    <strong><code>info exists login</code></strong></li>
    <li>$manifest_version. The fossil version</li>
    <li>$manifest_date. The date that fossil version was
    compiled</li>
  </ul>

  <h3>Functions</h3>
  <p>
     These are only avaible between 
  &lt;th1&gt; and &lt;/th1&gt;
  </p>
  <ul compact='compact'>
    <li>combobox name text-list numlines. Generates a select box
    with name="name" and a cgi-parameter of "name"</li>
    <li>enable_output boolean</li>
    <li>linecount string max min. Counts the numer of newlines in
    string but not more then max and not less then min</li>
    <li>hascap string. return true if user has all
    capabilities in string</li>
    <li>htmlize string. excapes all chars in string which have
    special meaning in HTML</li>
    <li>date returns the sqlite value of datetime('now')</li>
    <li>html string output html</li>
    <li>puts string prints the string</li>
    <li>wiki string. The string is in wiki format. translate it to
    HTML</li>
  </ul>
<nowiki>
  <h3>Example from admin/header</h3>
  <pre>
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;<strong>$&lt;project_name&gt;</strong>: <strong>$&lt;title&gt;</strong>&lt;/title&gt;
&lt;link rel="alternate" type="application/rss+xml" title="RSS Feed"
      href="<strong>$baseurl</strong>/timeline.rss"&gt;
&lt;link rel="stylesheet" href="$baseurl/style.css" type="text/css"
      media="screen"&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div class="header"&gt;
  &lt;div class="logo"&gt;
    &lt;img src="<strong>$baseurl</strong>/logo" alt="logo"&gt;
    &lt;br&gt;&lt;nobr&gt;<strong>$&lt;project_name&gt;</strong>&lt;/nobr&gt;
  &lt;/div&gt;
  &lt;div class="title"&gt;<strong>$&lt;title&gt;</strong>&lt;/div&gt;
  &lt;div class="status"&gt;&lt;nobr&gt;<strong>&lt;th1&gt;</strong>
     if {<strong>[info exists login]</strong>} {
       puts "Logged in as <strong>$login</strong>"
     } else {
       puts "Not logged in"
     }
  &lt;/th1&gt;&lt;/nobr&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="mainmenu"&gt;&lt;th1&gt;
html "&lt;a href='<strong>$baseurl$index_page</strong>'&gt;Home&lt;/a&gt; "
if {<strong>[hascap h]</strong>]} {
  html "&lt;a href='$baseurl/dir'&gt;Files&lt;/a&gt; "
}
</pre>

  <h3>Caveats</h3>

  <ul compact='compact'>
    <li>puts "[hello hello]" doesn't work because [ triggers the
    interpeter, use puts "&amp;#91hello hello]'</li>
  </ul>
</nowiki>
</div>