<commit_before>############################################################################
# Copyright 2009,2010 <NAME>                                  #
#                                                                          #
# This file is part of dudle.                                              #
#                                                                          #
# Dudle is free software: you can redistribute it and/or modify it under   #
# the terms of the GNU Affero General Public License as published by       #
# the Free Software Foundation, either version 3 of the License, or        #
# (at your option) any later version.                                      #
#                                                                          #
# Dudle is distributed in the hope that it will be useful, but WITHOUT ANY #
# WARRANTY; without even the implied warranty of MERCHANTABILITY or        #
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public     #
# License for more details.                                                #
#                                                                          #
# You should have received a copy of the GNU Affero General Public License #
# along with dudle.  If not, see <http://www.gnu.org/licenses/>.           #
############################################################################

$KCODE = "u"
require "yaml"
require "cgi"

$cgi = CGI.new

require 'gettext'
require 'gettext/cgi'
include GetText
GetText.cgi=$cgi
GetText.output_charset = 'utf-8'
require "locale"

if File.exists?("data.yaml") && !File.stat("data.yaml").directory?
	$is_poll = true
	GetText.bindtextdomain("dudle", :path => Dir.pwd + "/../locale/")
else
	$is_poll = false
	GetText.bindtextdomain("dudle", :path => Dir.pwd + "/locale/")
end

$:.push("..")
require "date_locale"

require "html"
require "poll"
require "config"
require "charset"

class Dudle
	attr_reader :html, :table, :urlsuffix, :css, :user_css, :title, :tab
	def is_poll?
		$is_poll
	end
	def tabs_to_html(active_tab)
		ret = "<div id='tabs'><ul id='tablist'>"
		@tabs.each{|tab,file|
			case file
			when _(active_tab)
				ret += "<li id='active_tab' class='active_tab' >&nbsp;#{tab}&nbsp;</li> "
			when ""
				ret += "<li class='separator_tab'></li>"
			else
				ret += "<li class='nonactive_tab' ><a href='#{@html.relative_dir}#{file}'>&nbsp;#{tab}&nbsp;</a></li> "
			end
		}
		ret += "</ul></div>"
		ret
	end

	def inittabs
		@tabs = []
		@tabs << [_("Home"),@basedir]
		if is_poll?
			@tabs << ["",""]
			@tabs << [_("Poll"),"."]
			@tabs << [_("History"),"history.cgi"]
			@tabs << ["",""]
			@configtabs = [
				[_("Edit Columns"),"edit_columns.cgi"],
				[_("Invite Participants"),"invite_participants.cgi"],
				[_("Access Control"),"access_control.cgi"],
				[_("Overview"),"overview.cgi"]
			]
			@tabs += @configtabs
			@tabs << [_("Delete Poll"),"delete_poll.cgi"]
			@tabs << ["",""]
		else
			@tabs << [_("Examples"),"example.cgi"]
			@tabs << [_("About"),"about.cgi"]
		end
		@tabs << [_("Customize"),"customize.cgi"]
		@tabtitle = @tabs.collect{|title,file| title if file == @tab}.compact[0]
	end
	def revision
		@requested_revision || VCS.revno
	end
	def breadcrumbs
		if defined?(BREADCRUMBS)
			crumbs = BREADCRUMBS
		else
			crumbs = []
		end
		crumbs << "<a href='#{@basedir}'>" + _("Dudle Home") + "</a>"
		if is_poll?
			if @tab == "."
				crumbs << @title
			else
				crumbs << "<a href='.'>#{@title}</a>"
				crumbs << @tabtitle
			end
		else
			if @tab != "."
				crumbs << @tabtitle
			end
		end
		"<div id=breadcrumbs><ul><li class='breadcrumb'>#{crumbs.join("</li><li class='breadcrumb'>")}</li></ul></div>"
	end

	def initialize(params = {:revision => nil, :title => nil, :hide_lang_chooser => nil, :relative_dir => ""})
		@requested_revision = params[:revision]
		@hide_lang_chooser = params[:hide_lang_chooser]
		@cgi = $cgi
		@tab = File.basename($0)<commit_msg>bugfix for validation<commit_after>############################################################################
# Copyright 2009,2010 <NAME>                                  #
#                                                                          #
# This file is part of dudle.                                              #
#                                                                          #
# Dudle is free software: you can redistribute it and/or modify it under   #
# the terms of the GNU Affero General Public License as published by       #
# the Free Software Foundation, either version 3 of the License, or        #
# (at your option) any later version.                                      #
#                                                                          #
# Dudle is distributed in the hope that it will be useful, but WITHOUT ANY #
# WARRANTY; without even the implied warranty of MERCHANTABILITY or        #
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public     #
# License for more details.                                                #
#                                                                          #
# You should have received a copy of the GNU Affero General Public License #
# along with dudle.  If not, see <http://www.gnu.org/licenses/>.           #
############################################################################

$KCODE = "u"
require "yaml"
require "cgi"

$cgi = CGI.new

require 'gettext'
require 'gettext/cgi'
include GetText
GetText.cgi=$cgi
GetText.output_charset = 'utf-8'
require "locale"

if File.exists?("data.yaml") && !File.stat("data.yaml").directory?
	$is_poll = true
	GetText.bindtextdomain("dudle", :path => Dir.pwd + "/../locale/")
else
	$is_poll = false
	GetText.bindtextdomain("dudle", :path => Dir.pwd + "/locale/")
end

$:.push("..")
require "date_locale"

require "html"
require "poll"
require "config"
require "charset"

class Dudle
	attr_reader :html, :table, :urlsuffix, :css, :user_css, :title, :tab
	def is_poll?
		$is_poll
	end
	def tabs_to_html(active_tab)
		ret = "<div id='tabs'><ul id='tablist'>"
		@tabs.each{|tab,file|
			case file
			when _(active_tab)
				ret += "<li id='active_tab' class='active_tab' >&nbsp;#{tab}&nbsp;</li> "
			when ""
				ret += "<li class='separator_tab'></li>"
			else
				ret += "<li class='nonactive_tab' ><a href='#{@html.relative_dir}#{file}'>&nbsp;#{tab}&nbsp;</a></li> "
			end
		}
		ret += "</ul></div>"
		ret
	end

	def inittabs
		@tabs = []
		@tabs << [_("Home"),@basedir]
		if is_poll?
			@tabs << ["",""]
			@tabs << [_("Poll"),"."]
			@tabs << [_("History"),"history.cgi"]
			@tabs << ["",""]
			@configtabs = [
				[_("Edit Columns"),"edit_columns.cgi"],
				[_("Invite Participants"),"invite_participants.cgi"],
				[_("Access Control"),"access_control.cgi"],
				[_("Overview"),"overview.cgi"]
			]
			@tabs += @configtabs
			@tabs << [_("Delete Poll"),"delete_poll.cgi"]
			@tabs << ["",""]
		else
			@tabs << [_("Examples"),"example.cgi"]
			@tabs << [_("About"),"about.cgi"]
		end
		@tabs << [_("Customize"),"customize.cgi"]
		@tabtitle = @tabs.collect{|title,file| title if file == @tab}.compact[0]
	end
	def revision
		@requested_revision || VCS.revno
	end
	def breadcrumbs
		if defined?(BREADCRUMBS)
			crumbs = BREADCRUMBS
		else
			crumbs = []
		end
		crumbs << "<a href='#{@basedir}'>" + _("Dudle Home") + "</a>"
		if is_poll?
			if @tab == "."
				crumbs << @title
			else
				crumbs << "<a href='.'>#{@title}</a>"
				crumbs << @tabtitle
			end
		else
			if @tab != "."
				crumbs << @tabtitle
			end
		end
		"<div id='breadcrumbs'><ul><li class='breadcrumb'>#{crumbs.join("</li><li class='breadcrumb'>")}</li></ul></div>"
	end

	def initialize(params = {:revision => nil, :title => nil, :hide_lang_chooser => nil, :relative_dir => ""})
		@requested_revision = params[:revision]
		@hide_lang_chooser = params[:hide_lang_chooser]
		@cgi = $cgi
		@tab = File.basename($0)
{'fraction_non_alphanumeric': 0.19695817490494297, 'fraction_numerical': 0.003041825095057034, 'mean_word_length': 2.417496751840624, 'pattern_counts': {'":': 0, '<': 115, '<?xml version=': 0, '>': 67, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 34, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3881197', 'n_tokens_mistral': 2719, 'n_tokens_neox': 2429, 'n_words': 611}