Class: TDiary::TDiaryFormPlugin

Inherits:
TDiaryAuthorOnlyBase show all
Defined in:
lib/tdiary/author_only_base.rb

Overview

class TDiaryFormPlugin

show edit diary form after calling form plugin.

Constant Summary

Constants inherited from TDiaryBase

TDiary::TDiaryBase::DIRTY_COMMENT, TDiary::TDiaryBase::DIRTY_DIARY, TDiary::TDiaryBase::DIRTY_NONE, TDiary::TDiaryBase::DIRTY_REFERER

Instance Attribute Summary

Attributes inherited from TDiaryBase

#cgi, #conf, #cookies, #date, #diaries, #ignore_parser_cache, #rhtml

Instance Method Summary collapse

Methods inherited from TDiaryAuthorOnlyBase

#csrf_protection_get_is_okay

Methods inherited from TDiaryBase

#[], #calendar, #eval_rhtml, #last_modified

Methods included from ViewHelper

#base_url, #bot?

Constructor Details

#initialize(cgi, rhtm, conf) ⇒ TDiaryFormPlugin

Returns a new instance of TDiaryFormPlugin.



98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# File 'lib/tdiary/author_only_base.rb', line 98

def initialize( cgi, rhtm, conf )
	super

	if @cgi.valid?( 'date' ) then
		if @cgi.params['date'][0].kind_of?( String ) then
			date = @cgi.params['date'][0]
		else
			date = @cgi.params['date'][0].read
		end
		@date = Time::local( *date.scan( /(\d{4})(\d\d)(\d\d)/ )[0] )
	else
		@date = Time::now + (@conf.hour_offset * 3600).to_i
		@diary = @io.diary_factory( @date, '', '', @conf.style )
	end

	@io.transaction( @date ) do |diaries|
		@diaries = diaries
		@diary = self[@date]
		if @diary then
			@conf.style = @diary.style
		else
			@diary =  @io.diary_factory( @date, '', '', @conf.style )
		end
		DIRTY_NONE
	end
end