# daily_theme.rb $Revision$ # # Copyright (c) 2005 SHIBATA Hiroshi # Distributed under the GPL # def css_tag if @mode =~ /conf$/ then css = "#{theme_url}/conf.css" elsif @conf.options.include?('daily_theme.list') if @conf.options['daily_theme.list'].size > 0 theme_list = @conf.options['daily_theme.list'].split(/\n/) index = Time.now.yday % theme_list.size theme_name = theme_list[index].strip css = "#{theme_url}/#{theme_name}/#{theme_name}.css" else css = @css end else css = @css end title = CGI::escapeHTML( File::basename( css, '.css' ) ) <<-CSS CSS end add_conf_proc( 'daily_theme', @daily_theme_label, 'theme' ) do daily_theme_conf_proc end def daily_theme_conf_proc if @mode == 'saveconf' then if @cgi.params['daily_theme.list'] && @cgi.params['daily_theme.list'][0] @conf['daily_theme.list'] = @cgi.params['daily_theme.list'][0] else @conf['daily_theme.list'] = nil end end # initialize Theme list @conf['daily_theme.list'] = "default" unless @conf['daily_theme.list'] result = <<-HTML

#{@daily_theme_label}

#{@daily_theme_label_desc}

HTML end