# $Id: ext_member.rb,v 1.12 2004/04/22 14:47:49 eto Exp $
# Copyright (C) 2003-2004 Kouichirou Eto, All rights reserved.
# This is free software with ABSOLUTELY NO WARRANTY.
# You can redistribute it and/or modify it under the terms of the GNU GPL2.

require 'qwik/ext_wikidb'

module Qwik
  class Plugin
    def sitelog_add(line)
      user = @req.user
      @site.log.add(user, line)
    end
#    add_update_method(sitelog_add)
  end

  class Site
    def log()
      @sitelog = SiteLog.new(@config, self) if @sitelog.nil?
      @sitelog
    end
  end

  class SiteLog
    def initialize(config, site)
      @config = config
      @site = site
      @key = "SiteLog"
    end

    def add(user, line)
      page = @site[@key]
      page = @site.create(@key) if page.nil?
      page.wikidb.add(user, line)
    end
  end
end
