Instiki
Customizing Instiki

=portabilité[EXTRACT]Back to Tips and Tricks

This site will describe my experiences in how to customize Instiki. It’s getting somewhere, but is far from finished

creating layout-independent Instiki’s

As far as I could figure out, instiki stores it .rhtml and .css files in the instiki installation directory. This means there is only one layout per instiki installation. You can create different webs, using namespaces, but this does not give you different layouts (is this correct?). And finding the common denominator between a site for a motorbike gang and a surf rock band is quite hard to do. So I came up with the following patches, which copy the app/views and public directory to the location where instiki is run from Sepeda Motor Injeksi Irit Harga Terbaik Cuma Honda.

code patches

  • File script/server
    
    Index: server1
    ===================================================================
    RCS file: /Documents and Settings/Bart/My Documents/CVSRepository/Instiki/script/server,v
    retrieving revision 1.1
    diff -u -r1.1 server
    --- server    13 Oct 2005 20:51:32 -0000    1.1
    +++ server    15 Oct 2005 19:54:42 -0000
    @@ -6,12 +6,15 @@
    
     pwd = File.expand_path(File.dirname(__FILE__) + "/..")
    
    +SITE_ROOT = "#{File.expand_path(FileUtils.pwd)}" 
    +
     OPTIONS = {
       # Overridable options
       :port        => 2500,
       :ip          => '0.0.0.0',
       :environment => 'production',
    -  :server_root => File.expand_path(File.dirname(__FILE__) + '/../public/'),
    +  #:server_root => File.expand_path(File.dirname(__FILE__) + '/../public/'),
    +  :server_root => File.expand_path(SITE_ROOT + '/public/'),
       :server_type => WEBrick::SimpleServer,
       :storage     => "#{File.expand_path(FileUtils.pwd)}/storage",
     }
    @@ -62,6 +65,10 @@
       storage_path = "#{OPTIONS[:storage]}/#{OPTIONS[:environment]}/#{OPTIONS[:port]}" 
     end
     FileUtils.mkdir_p(storage_path)
    +puts "Copying #{pwd}/app/views to #{SITE_ROOT}/app/views/" 
    +FileUtils.cp_r("#{pwd}/app", "#{SITE_ROOT}/app")
    +puts "Copying #{pwd}/public to #{SITE_ROOT}/public" 
    +FileUtils.cp_r("#{pwd}/public", "#{SITE_ROOT}/public")
    
     ENV['RAILS_ENV'] = OPTIONS[:environment]
     $instiki_debug_logging = OPTIONS[:verbose]
    
  • File config/environment.rb
    
    Index: environment.rb
    ===================================================================
    RCS file: /Documents and Settings/Bart/My Documents/CVSRepository/Instiki/config/environment.rb,v
    retrieving revision 1.1
    diff -u -r1.1 environment.rb
    --- environment.rb    13 Oct 2005 20:51:32 -0000    1.1
    +++ environment.rb    15 Oct 2005 19:57:32 -0000
    @@ -71,7 +71,9 @@
       end
     end
    
    -ActionController::Base.template_root ||= "#{RAILS_ROOT}/app/views/" 
    +#ActionController::Base.template_root ||= "#{RAILS_ROOT}/app/views/" 
    +ActionController::Base.template_root ||= "#{SITE_ROOT}/app/views/" 
    +puts "environment.rb #{SITE_ROOT}/app/views/" 
     ActionController::Routing::Routes.reload
     Controllers = Dependencies::LoadingModule.root(
       File.join(RAILS_ROOT, 'app', 'controllers'),
    

TODO: Currently, the app/view directory is probably overwritten each time, and hence also the default.rhtml. There should a check to not copy these files if they are already present.

Running instiki

The patches described above currently expects that the instiki is run from the directory in which you want to have the instiki.

[/webdir/myInstiki/]$ instiki --port=####

And you’re all set to create layout-independent Instiki’s!

Important directories/files

Location Purpose Commented version
app/views/layouts/default.rhtml Describes the site’s main page structure To come
public/stylesheets/instiki.css Describes the layout aspects To come

Changing the layout of a single Instiki

Changing the background

Changing the header

Adding an image to a wiki page

Warning: this does not download the image, only shows it.


  • Adding a background picture
    In the default.rhtml, add the background style, for example
    <body style="background-image: url(http://naiznoiz.dyndns.org/PICT0001.JPG)">

    I didn’t find out how to use relative paths yet.

Hey, this is funny, the background changes, because it is not what I wanted ;-). Nice, can be useful.

Motor Injeksi Honda Kata Cinta Kata Mutiara Kata Bijak Daun Sirih

Kevin Lawver: Editing the .rhtml files is a good start, but if you look in public/stylesheets, you’ll find the CSS files for the wiki, which provide a LOT of room to play. It’s also extremely easy to add new views for pages by defining them in the model. I’ll probably post an updated version of my S5 + Instiki hackery in the next week or so. The same model can be used to do all sorts of fun stuff.

Kevin Lawver (again): If you put your images in public/images, the url would be /images/IMGNAME.gif (or whatever).

Jonathan Entner: Talk being cheap, allow me to suggest some things. First, put the /public and /apps/views copies in the /storage folder, thus all data for a particular wiki is in one place, and it supports the—storage option as well. Second, why not make the copy once, when the wiki is created? I don’t know well enough how the creation process works, but I’d imagine those copies could be added to it, thus only doing it once, and allowing the user to customize each wiki instantiation.

Instiki + S5 hack

Eduardo Tongson: Based on Kevin Lawver’s idea here are diffs to hack in S5 to Instiki. Tested on Instiki 0.11.pl1 and S5 1.1 both latest as of 20070802.
Put ui/default/ files from S5 to Instiki’s public/s5 directory.


app/controllers/wiki_controller.rb
--- app.old/controllers/wiki_controller.rb      2007-02-28 04:32:34.000000000 +0800
+++ app/controllers/wiki_controller.rb  2007-09-02 10:31:56.000000000 +0800
@@ -8,7 +8,7 @@ class WikiController < ApplicationContro
   caches_action :show, :published, :authors, :recently_revised, :list
   cache_sweeper :revision_sweeper

-  layout 'default', :except => [:rss_feed, :rss_with_content, :rss_with_headlines, :tex,  :export_tex, :export_html]
+  layout 'default', :except => [:rss_feed, :rss_with_content, :rss_with_headlines, :tex,  :export_tex, :export_html, :slides
]

   def index
     if @web_name
@@ -189,6 +189,10 @@ class WikiController < ApplicationContro
     send_file "#{file_path}.pdf" 
   end

+  def slides
+    @renderer = PageRenderer.new(@page.revisions.last)
+  end
+
   def print
     if @page.nil?
       redirect_home


--- app.old/views/wiki/page.rhtml       2006-03-19 07:54:54.000000000 +0800
+++ app/views/wiki/page.rhtml   2007-09-02 10:31:56.000000000 +0800
@@ -37,6 +37,10 @@
     <%= link_to('Print',
             { :web => @web.address, :action => 'print', :id => @page.name },
             { :accesskey => 'p', :name => 'view_print' }) %>
+    |
+    <%= link_to('Slides', 
+            { :web => @web.address, :action => 'slides', :id => @page.name },
+            { :accesskey => 's', :name => 'view_slides' })%>
   <% if defined? RedClothForTex and RedClothForTex.available? and @web.markup == :textile %>
     | 
     <%= link_to 'TeX', {:web => @web.address, :action => 'tex', :id => @page.name}, 


--- app.old/views/wiki/slides.rhtml     1970-01-01 08:00:00.000000000 +0800
+++ app/views/wiki/slides.rhtml 2007-09-02 10:31:56.000000000 +0800
@@ -0,0 +1,44 @@
+<% @title = @page.plain_name %>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
+    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+<head>
+<title><%= @title %></title>
+<meta name="generator" content="S5" />
+<meta name="version" content="S5 1.1" />
+<meta name="presdate" content="20050728" />
+<meta name="author" content="Instiki" />
+<meta name="company" content="Instiki.ORG" />
+<meta name="defaultView" content="slideshow" />
+<meta name="controlVis" content="hidden" />
+<link rel="stylesheet" href="/s5/slides.css" type="text/css" media="projection" id="slideProj" />
+<link rel="stylesheet" href="/s5/outline.css" type="text/css" media="screen" id="outlineStyle" />
+<link rel="stylesheet" href="/s5/print.css" type="text/css" media="print" id="slidePrint" />
+<link rel="stylesheet" href="/s5/opera.css" type="text/css" media="projection" id="operaFix" />
+<script src="/s5/slides.js" type="text/javascript"></script>
+</head>
+<body>
+
+<div class="layout">
+<div id="controls"></div>
+<div id="currentSlide"></div>
+<div id="header"></div>
+<div id="footer">
+<h1><%= @title %></h1>
+<h2>by <%= @page.author.name %></h2>
+</div>
+</div>
+
+<div class="presentation">
+
+<div class="slide">
+<h1><%= @title %></h1>
+</div>
+
+<%= @renderer.display_content_for_export %>
+
+</div>
+</body>
+</html>


--- default/iepngfix.htc        2005-08-02 22:43:59.000000000 +0800
+++ s5/iepngfix.htc     2007-09-02 10:28:51.000000000 +0800
@@ -7,7 +7,7 @@
 // Free usage permitted as long as this notice remains intact.

 // This must be a path to a blank image. That's all the configuration you need here.
-var blankImg = 'ui/default/blank.gif';
+var blankImg = '/s5/blank.gif';

 var f = 'DXImageTransform.Microsoft.AlphaImageLoader';

@@ -39,4 +39,4 @@ function doFix() {
 doFix();

 </script>
-</public:component>
\ No newline at end of file
+</public:component>


--- default/pretty.css  2005-06-12 07:21:31.000000000 +0800
+++ s5/pretty.css       2007-09-02 10:28:51.000000000 +0800
@@ -1,6 +1,6 @@
 /* Following are the presentation styles -- edit away! */

-body {background: #FFF url(bodybg.gif) -16px 0 no-repeat; color: #000; font-size: 2em;}
+body {background: #FFF url(/s5/bodybg.gif) -16px 0 no-repeat; color: #000; font-size: 2em;}
 :link, :visited {text-decoration: none; color: #00C;}
 #controls :active {color: #88A !important;}
 #controls :focus {outline: 1px dotted #227;}
@@ -31,7 +31,7 @@ sup {font-size: smaller; line-height: 1p

 div#header, div#footer {background: #005; color: #AAB;
   font-family: Verdana, Helvetica, sans-serif;}
-div#header {background: #005 url(bodybg.gif) -16px 0 no-repeat;
+div#header {background: #005 url(/s5/bodybg.gif) -16px 0 no-repeat;
   line-height: 1px;}
 div#footer {font-size: 0.5em; font-weight: bold; padding: 1em 0;}
 #footer h1, #footer h2 {display: block; padding: 0 1em;}
@@ -83,4 +83,4 @@ img.incremental {visibility: hidden;}
 /* diagnostics

 li:after {content: " [" attr(class) "]"; color: #F88;}
- */
\ No newline at end of file
+ */


--- default/slides.css  2004-11-16 00:43:15.000000000 +0800
+++ s5/slides.css       2007-09-02 10:28:51.000000000 +0800
@@ -1,3 +1,3 @@
-@import url(s5-core.css); /* required to make the slide show run at all */
-@import url(framing.css); /* sets basic placement and size of slide components */
-@import url(pretty.css);  /* stuff that makes the slides look better than blah */
\ No newline at end of file
+@import url(/s5/s5-core.css); /* required to make the slide show run at all */
+@import url(/s5/framing.css); /* sets basic placement and size of slide components */
+@import url(/s5/pretty.css);  /* stuff that makes the slides look better than blah */

waptrickwaptrickwapdamObat Herbalwapdaykata mutiarakata mutiara cintakata mutiara inggriskata mutiara sahabattv online indonesiasctv onlinercti onlinetrans 7 onlinemnc tv onlinemanfaat internetObat Herbalpengertian internetmanfaat madu4shared.comberhenti merokokcara berhenti merokokMenghilangkan Bekas Jerawatmenghindari bekas jerawatCara Menghilangkan Bekas JerawatCar Detailing TipsUK Electronic Storebekas lukabau mulutmerawat rambutmengecilkan perutsakit perutmanfaat teh hijaumenghilangkan komedo  menghilangkan jerawatmenghilangkan ketombekomputer bekasObat Herbalforfait b and you rio b and you portabilité calcul IMC rio orange