D 2014-06-20T05:52:50.173 L Cookbook P 6308f5ff25d7b92729134898cf2d04d4fa6a8533 W 74491
fossil server
and/or fossil ui
commands, of course, but this is really only adequate for ad-hoc repository sharing. Consider, for example, sharing ten repositories. Using the built-in server would require you to open ten ports in your firewall to permit access. Any serious sharing will require something more robust and permanent, and solutions for doing so are described below.
fossil server/ui
is more than adequate. For more robust solutions, however, the use of (x)inetd or CGI support is indicated.
Setting up fossil for CGI support is simple. (Setting up your web server for CGI support may or may not be simple, but it is out of scope of this recipe. Consult your web server/service provider's documentation for this.)
#! /usr/bin/env fossil
repository: /full/path/to/repository/file.fsl
3. Ensure that the script file so generated is set executable for the CGI user account.
4. Ensure that every directory in the path leading to the repository is browseable (chmod +x) to the CGI user account.
5. Ensure that the repository file is readable and writable to the CGI user account.
The following shell script can be run from within the directory containing the Fossil repositories to be shared (and, of course, altered for your setup) to set some of the constraints above up automatically:
1 #!/usr/bin/perl -w 2 my $CGI_BIN = '/Library/WebServer/CGI-Executables'; 3 my @files = `grep -l repository: $CGI_BIN/* `; 4 print <<EOM; 5 Content-Type: text/html 6 7 Fossils for this server 8 <ul> 9 EOM 10 11 for (@files) { 12 s{.*/}{}; 13 next if /~$/; 14 print "<li><a href='$_'>$_</a></li>\n"; 15 } 16 print "</ul>\n";
While it is far from a perfect set of instructions, here are some quick notes that should help windows users along the way.
#! fossil.exe repository: c:/wamp/www/dev/accounts.fossilI suppose you could put fossil.exe somewhere more specific and set the path to it as well, but since you are probably using the same executable for cmdline and cgi it kind of just makes sense to put it somewhere more accessible.
fossil server
is likely more than adequate or the use of (x)inetd may be indicated. If, however, there is already an existing web infrastructure in place, CGI still may be preferred if only for consistency and maintainability of the system as a whole.
/* General settings for the entire page */ body { margin: 0ex 1ex; padding: 0px; background-color: white; font-family: "sans serif"; } /* Make the links in the footer less ugly... */ a { color: #000f6a; } a:link { color: #000f6a; } a:visited { color: #000f6a; } a:hover { background-color: #e3e3e3; } hr { height: 3px; border-top: none; /*1px dashed #005;*/ border-bottom: 1px dashed #005; border-left: none; border-right: none; } /* The project logo in the upper left-hand corner of each page */ div.logo { display: table-cell; text-align: center; vertical-align: bottom; color: #000f6a; } /* The page title centered at the top of each page */ div.title { display: table-cell; font-size: 2em; font-weight: bold; text-align: center; color: #000f6a; vertical-align: bottom; width: 100%; } /* The login status message in the top right-hand corner */ div.status { display: table-cell; text-align: right; vertical-align: bottom; color: #000f6a; font-size: 0.8em; } /* The header across the top of the page */ div.header { display: table; width: 100%; text-align: center; } /* The main menu bar that appears at the top of the page beneath ** the header */ div.mainmenu { padding: 2px 5px 2px 5px; font-size: 0.9em; text-align: center; letter-spacing: 1px; background-color: #e3e3e3; color: #000f6a; border: 1px inset black; } /* The submenu bar that *sometimes* appears below the main menu */ div.submenu { padding: 2px 5px 2px 5px; font-size: 0.9em; text-align: center; background-color: #e3e3e3; color: #000f6a; } div.mainmenu a, div.mainmenu a:visited, div.submenu a, div.submenu a:visited { padding: 2px 10px 2px 10px; color: #000f6a; background-color: #e3e3e3; text-decoration: none; } div.mainmenu a:hover, div.submenu a:hover { color: #e3e3e3; background-color: #000f6a; } /* All page content from the bottom of the menu or submenu down to ** the footer */ div.content { padding: 0ex 1ex 0ex 2ex; } /* Some pages have section dividers */ div.section { margin-bottom: 0px; margin-top: 1em; padding: 1px 1px 1px 1px; font-size: 1.2em; font-weight: bold; background-color: #e3e3e3; color: #000f6a; } /* The "Date" that occurs on the left hand side of timelines */ div.divider { background-color: #e3e3e3; color: #000f6a; border: 1px #bbbbff solid; font-size: 1em; font-weight: normal; padding: .25em; margin: .2em 0 .2em 0; float: left; clear: left; } /* The footer at the very bottom of the page */ div.footer { font-size: 0.8em; padding: 2px 5px 2px 5px; text-align: center; letter-spacing: 1px; background-color: #e3e3e3; color: #000f6a; border: 1px inset black; } /* Make the links in the footer less ugly... */ div.footer a { color: #000f6a; } div.footer a:link { color: #000f6a; } div.footer a:visited { color: #000f6a; } div.footer a:hover { background-color: #000f6a; color: #e3e3e3; } /* verbatim blocks */ pre.verbatim { background-color: #f5f5f5; padding: 0.5em; } /* The label/value pairs on (for example) the vinfo page */ table.label-value th { vertical-align: top; text-align: right; padding: 0.2ex 2ex; } /* For marking important UI elements which shouldn't be lightly dismissed. I mainly use it to mark "not yet implemented" parts of a page. Whether or not to have a 'border' attribute set is arguable. */ .achtung { color: #ff0000; background: #ffff00; border: 1px solid #ff0000; } table.fossil_db_generic_query_view { border-spacing: 0px; border: 1px solid black; } table.fossil_db_generic_query_view td { padding: 2px 1em 2px 1em; } table.fossil_db_generic_query_view tr { } table.fossil_db_generic_query_view tr.even { background: #ffffff; } table.fossil_db_generic_query_view tr.odd { background: #e5e5e5; } table.fossil_db_generic_query_view tr.header { background: #558195; font-size: 1.5em; color: #ffffff; }
Header
<html> <head> <th1> set highlighterpath "$baseurl/doc/tip/www/SyntaxHighlighter" set jquerypath "$baseurl/doc/tip/www/SyntaxHighlighter/jquery-1.5.min.js" </th1> <title>$<project_name>: $<title></title> <link rel="alternate" type="application/rss+xml" title="RSS Feed" href="$baseurl/timeline.rss"> <link rel="stylesheet" href="$baseurl/style.css" type="text/css" media="screen"> <link rel="stylesheet" href="$highlighterpath/styles/shCoreDefault.css" type="text/css" media="screen" /> <script language="javascript" src="$jquerypath"></script> </head> . . .
Footer With version 3.x of SyntaxHighlighter it is possible to load the language specific scripts on demand. The footer template uses this feature to identify the programming language of the sourcefile by looking at the extension of the file and then adds the appropriate brush to the <pre> element. SyntaxHighlighter will then load only the brush needed to highlight the current page.
<div class="footer"> Fossil version $manifest_version $manifest_date </div> <script language="javascript" src="$highlighterpath/scripts/shCore.js"></script> <script language="javascript" src="$highlighterpath/scripts/shAutoloader.js"></script> <script language="javascript"> function path() { var args = arguments, result = []; for(var i = 0; i < args.length; i++) result.push(args[i].replace('@', '$highlighterpath/scripts/')); return result }; // Do the highlighting only on artifact pages if (document.getElementsByTagName("title")[0].innerHTML.indexOf("Artifact") != -1) { // try to find out the file type by looking at the file names extension var file = document.getElementsByTagName("blockquote")[0].getElementsByTagName("a")[0].innerHTML; var extPos = file.lastIndexOf("."); var extension = ""; if (extPos != -1) extension = file.substring(extPos + 1); // set a default for extensions not recognized var brush = "brush: text"; // check the extension to select the brush for highlighting if (extension == "cs") brush = "brush: c-sharp"; else if (extension == "vb") brush = "brush: vb"; else if (extension == "xml" || extension == "xsd" || extension == "xslt" || extension == "aml" || extension == "shfbproj" || extension == "csproj") brush = "brush: xml"; else if (extension == "cmd" || extension == "sh") brush = "brush: shell"; else if (extension == "sql") brush = "brush: sql"; else if (extension == "c" || extension == "cpp" || extension == "cxx" || extension == "cc" || extension == "h" || extension == "hpp") brush = "brush: cpp"; else if (extension == "js") brush = "brush: javascript"; else if (extension == "css") brush = "brush: css"; else if (extension == "php") brush = "brush: php"; else if (extension == "pl") brush = "brush: perl"; else if (extension == "java") brush = "brush: java"; else if (extension == "ruby" || extension == "rb" ) brush = "brush: ruby"; else if (extension == "py") brush = "brush: python"; // disable the highlighter toolbar brush = brush + "; toolbar: false;"; // Add the brush to the pre element which contains the source file $("pre:last").addClass(brush); // initialize SyntaxHighlighter's autoloader SyntaxHighlighter.autoloader.apply(null, path( 'applescript @shBrushAppleScript.js', 'actionscript3 as3 @shBrushAS3.js', 'bash shell @shBrushBash.js', 'coldfusion cf @shBrushColdFusion.js', 'cpp c @shBrushCpp.js', 'c# c-sharp csharp @shBrushCSharp.js', 'css @shBrushCss.js', 'delphi pascal @shBrushDelphi.js', 'diff patch pas @shBrushDiff.js', 'erl erlang @shBrushErlang.js', 'groovy @shBrushGroovy.js', 'java @shBrushJava.js', 'jfx javafx @shBrushJavaFX.js', 'js jscript javascript @shBrushJScript.js', 'perl pl @shBrushPerl.js', 'php @shBrushPhp.js', 'text plain @shBrushPlain.js', 'py python @shBrushPython.js', 'ruby rails ror rb @shBrushRuby.js', 'sass scss @shBrushSass.js', 'scala @shBrushScala.js', 'sql @shBrushSql.js', 'vb vbnet @shBrushVb.js', 'xml xhtml xslt html @shBrushXml.js' )); // and finally highlight it SyntaxHighlighter.all() } </script> </body></html>
Source: TinyMCE
mkdir tiny mkdir tiny/javascript fossil new tinymce.fsl fossil ui tinymce.fsl {configure the project) download tinymce unzip in tiny/javascript cd tiny fossil open ../tinymce.fsl fossil add javascript fossil commit -m "added timymce to the project" fossil uiSelect admin/headers add after the </link>
<th1> if { "tktnew" eq $current_page || "tktedit" eq $current_page || "wikiedit" eq $current_page || "wikiappend" eq $current_page } { html "\n" html " \n" } </th1>and save.
Under firefox with the extension locallink you can install javascript libraries locally.
It seems that it is also possible with IE7 because that allows local access. For chrome there is an extension locallink But I couldn't get it to work.
The advantage of this is that your repository doesn't contains the javascript library. And for each project you only have to adjust the header
C: mkdir js download tinymce unzip in c:\js install locallink in firefox follow instructions on pagestart fossil ui Select admin/headers add after the </link>
<th1> if { [ string first $current_page "tktnew tktedit wikiedit wikiappend" ] } { html "\n" html " \n" } </th1>and save.
Source: Markitup
mkdir markitup mkdir markitup/javascript fossil new markitup.fsl fossil ui markitup.fsl {configure the project) download markitup and jquery unzip in markitup/javascript, cd latest, mv * .., rmdir latest copy jquery-....js to javascript/jquery.js cd markitup fossil open ../markitup.fsl fossil add javascript fossil commit -m "added markitup an jquery to the project" fossil uiselect admin/headers add after the put
<link rel="stylesheet" type="text/css" href="/doc/tip/javascript/markitup/skins/markitup/style.css" /> <link rel="stylesheet" type="text/css" href="/doc/tip/javascript/markitup/sets/default/style.css" /> <script type="text/javascript" src="/doc/tip/javascript/jquery.js"> </script> <script type="text/javascript" src="/doc/tip/javascript/markitup/jquery.markitup.js"> </script>and save select admin/footer add above the first line
<script type='text/javascript'> var m = document.getElementsByTagName('textarea') var l = m.length var nvar mySettings = { nameSpace: "html", // Useful to prevent multi-instances CSS conflict onShiftEnter: {keepDefault:false, replaceWith:'<br />\n'}, onCtrlEnter: {keepDefault:false, openWith:'\n<p>', closeWith:'</p>\n'}, onTab: {keepDefault:false, openWith:' '}, markupSet: [ {name:'Heading 1', key:'1', openWith:'<h1(!( class="[![Class]!]")!)>', closeWith:'</h1>', placeHolder:'Your title here...' }, {name:'Heading 2', key:'2', openWith:'<h2(!( class="[![Class]!]")!)>', closeWith:'</h2>', placeHolder:'Your title here...' }, {name:'Heading 3', key:'3', openWith:'<h3(!( class="[![Class]!]")!)>', closeWith:'</h3>', placeHolder:'Your title here...' }, {name:'Heading 4', key:'4', openWith:'<h4(!( class="[![Class]!]")!)>', closeWith:'</h4>', placeHolder:'Your title here...' }, {name:'Heading 5', key:'5', openWith:'<h5(!( class="[![Class]!]")!)>', closeWith:'</h5>', placeHolder:'Your title here...' }, {name:'Heading 6', key:'6', openWith:'<h6(!( class="[![Class]!]")!)>', closeWith:'</h6>', placeHolder:'Your title here...' }, {name:'Paragraph', openWith:'<p(!( class="[![Class]!]")!)>', closeWith:'</p>' }, {separator:'---------------' }, {name:'Bold', key:'B', openWith:'<strong>', closeWith:'</strong>' }, {name:'Italic', key:'I', openWith:'<em>', closeWith:'</em>' }, {name:'Stroke through', key:'S', openWith:'<del>', closeWith:'</del>' }, {separator:'---------------' }, {name:'Ul', openWith:'<ul>\n', closeWith:'</ul>\n' }, {name:'Ol', openWith:'<ol>\n', closeWith:'</ol>\n' }, {name:'Li', openWith:'<li>', closeWith:'</li>' }, {separator:'---------------' }, {name:'Picture', key:'P', replaceWith:'<img src="[![Source:!:http://]!]" alt="[![Alternative text]!]" />' }, {name:'Link', key:'L', openWith:'<a href="[![Link:!:http://]!]"(!( title="[![Title]!]")!)>', closeWith:'</a>', placeHolder:'Your text to link...' }, {separator:'---------------' }, {name:'Clean', replaceWith:function(h) { return h.selection.replace(/<(.*?)>/g, "") } }, {name:'Preview', call:'preview', className:'preview' } ] } for(var i=0 ;i < l;i++){ n = m[i].name if( 'comment' == n || 'cmappnd' == n || "w" == n){ m[i].id = n $(function() { $("#" + n).markItUp(mySettings); }); } } </script>
Th1 is used as a template system for generating HTML header and footer. It is a TCL like language. If you know TCL you know TH1.
It is invoked by opening a <th1> tag. The first time it starts an interpreter. The state of this interpreter is valid during the page generation.
For example when you
Because it is used as a template system it exports some details of fossil through
These are defined in [590e073746121befe65565ee6d73007c37ade12c|src/th_main.c])
These variable are global and available outside <th1> tags. They can be referenced either as
The following are defined:
info exists login
These are only avaible between <th1> and </th1>
<html> <head> <title>$<project_name>: $<title></title> <link rel="alternate" type="application/rss+xml" title="RSS Feed" href="$baseurl/timeline.rss"> <link rel="stylesheet" href="$baseurl/style.css" type="text/css" media="screen"> </head> <body> <div class="header"> <div class="logo"> <img src="$baseurl/logo" alt="logo"> <br><nobr>$<project_name></nobr> </div> <div class="title">$<title></div> <div class="status"><nobr><th1> if {[info exists login]} { puts "Logged in as $login" } else { puts "Not logged in" } </th1></nobr></div> </div> <div class="mainmenu"><th1> html "<a href='$baseurl$index_page'>Home</a> " if {[hascap h]]} { html "<a href='$baseurl/dir'>Files</a> " }
Some file formats are actually zip archives containing text files. For example Microsoft Office 2007 and newer use docx, xlsx and pptx extensions to store what is merely xml files zipped into a file.
When edits are made to such files a versioning system is not efficient because diffing is no more appropriate
The idea is to version the decompressed folder. A script will toggle Compressed/Uncompressed state
This script is intended to work under MS Windows. It requires zip.exe and unzip.exe that you can find for example in gnuwin32 ([http://getgnuwin32.sf.net]).
You have three variables to set. Running this script will
In this way you can work on a docx document, run the script, insert the uncompressed folder into fossil and run the script again to get your document back in editable state.
Important: Use the --dotfiles option to the add command to include rels/.rels file.
1 :: toggle docx state (compressed / uncompressed)