Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 2
- Log:
Initial import of Instiki 0.11.0 sources from a downloaded Tarball.
Instiki is a Ruby On Rails based Wiki clone.
- Author:
- adh
- Date:
- Sat Jul 22 14:54:51 +0100 2006
- Size:
- 3284 Bytes
1 | require 'application' |
2 | |
3 | class AdminController < ApplicationController |
4 | |
5 | layout 'default' |
6 | |
7 | def create_system |
8 | if @wiki.setup? |
9 | flash[:error] = |
10 | "Wiki has already been created in '#{@wiki.storage_path}'. " + |
11 | "Shut down Instiki and delete this directory if you want to recreate it from scratch." + |
12 | "\n\n" + |
13 | "(WARNING: this will destroy content of your current wiki)." |
14 | redirect_home(@wiki.webs.keys.first) |
15 | elsif @params['web_name'] |
16 | # form submitted -> create a wiki |
17 | @wiki.setup(@params['password'], @params['web_name'], @params['web_address']) |
18 | flash[:info] = "Your new wiki '#{@params['web_name']}' is created!\n" + |
19 | "Please edit its home page and press Submit when finished." |
20 | redirect_to :web => @params['web_address'], :controller => 'wiki', :action => 'new', |
21 | :id => 'HomePage' |
22 | else |
23 | # no form submitted -> go to template |
24 | end |
25 | end |
26 | |
27 | def create_web |
28 | if @params['address'] |
29 | # form submitted |
30 | if @wiki.authenticate(@params['system_password']) |
31 | begin |
32 | @wiki.create_web(@params['name'], @params['address']) |
33 | flash[:info] = "New web '#{@params['name']}' successfully created." |
34 | redirect_to :web => @params['address'], :controller => 'wiki', :action => 'new', |
35 | :id => 'HomePage' |
36 | rescue Instiki::ValidationError => e |
37 | @error = e.message |
38 | # and re-render the form again |
39 | end |
40 | else |
41 | redirect_to :controller => 'wiki', :action => 'index' |
42 | end |
43 | else |
44 | # no form submitted -> render template |
45 | end |
46 | end |
47 | |
48 | def edit_web |
49 | system_password = @params['system_password'] |
50 | if system_password |
51 | # form submitted |
52 | if wiki.authenticate(system_password) |
53 | begin |
54 | wiki.edit_web( |
55 | @web.address, @params['address'], @params['name'], |
56 | @params['markup'].intern, |
57 | @params['color'], @params['additional_style'], |
58 | @params['safe_mode'] ? true : false, |
59 | @params['password'].empty? ? nil : @params['password'], |
60 | @params['published'] ? true : false, |
61 | @params['brackets_only'] ? true : false, |
62 | @params['count_pages'] ? true : false, |
63 | @params['allow_uploads'] ? true : false, |
64 | @params['max_upload_size'] |
65 | ) |
66 | flash[:info] = "Web '#{@params['address']}' was successfully updated" |
67 | redirect_home(@params['address']) |
68 | rescue Instiki::ValidationError => e |
69 | logger.warn e.message |
70 | @error = e.message |
71 | # and re-render the same template again |
72 | end |
73 | else |
74 | @error = password_error(system_password) |
75 | # and re-render the same template again |
76 | end |
77 | else |
78 | # no form submitted - go to template |
79 | end |
80 | end |
81 | |
82 | def remove_orphaned_pages |
83 | if wiki.authenticate(@params['system_password_orphaned']) |
84 | wiki.remove_orphaned_pages(@web_name) |
85 | flash[:info] = 'Orphaned pages removed' |
86 | redirect_to :controller => 'wiki', :web => @web_name, :action => 'list' |
87 | else |
88 | flash[:error] = password_error(@params['system_password_orphaned']) |
89 | redirect_to :controller => 'admin', :web => @web_name, :action => 'edit_web' |
90 | end |
91 | end |
92 | |
93 | end |