Sha256: 386a8a9c0dfe5a81c428eb13c0706c94e82aa08577b62626ad5ca7d79be57165

Contents?: true

Size: 1011 Bytes

Versions: 1

Compression:

Stored size: 1011 Bytes

Contents

require 'lib/media_wiki_html.rb'
require 'model/page.rb'
require 'model/menu.rb'


class Wiki<HTTPController
  layout :main

  def initialize(*s)
    super
    @i=WikiModel::Instance.new(@app)
  end

  def index(req)
    @req=req
    page=@i.getPage(path)

    data=page.content
    if data.nil? or data.length==0
      log "data is nil - redirect "
      redirect_to(url(:action=>:edit)+"/"+path)
    else
      @wikihtml=appswarm_wiki_to_html(data,url(:action=>:index))
    end
    @topic=path

    @menu=Menu.new(self)
  end

  def edit(req)
    @req=req
    page=@i.getPage(path)
    @topic=path
    @error=""
    @wiki=page.content
    @menu=Menu.new(self)
  end

  def save(req)
    @req=req
    p=req.args["topic"]
    if p!="" and req.args["content"]!=""
      page=@i.getPage(p)
      pp req.args["content"]
      page.content=req.args["content"]
    end
    redirect_to(url(:action=>:index)+"/"+p)
  end

  def path
    path=@req.path.to_s
    path=nil if path.length==0
    path||="Home"
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
appswarm-0.0.1 apps/wiki/controllers/wiki.rb