Revision 3 (by ahitrov@rambler.ru, 2010/03/24 15:19:32) The CORE
package Contenido::Document;

# ----------------------------------------------------------------------------
# ����� ��������
# ----------------------------------------------------------------------------

use strict;
use warnings;
use locale;

use base 'Contenido::Object';

use Utils;
use Contenido::Globals;
use Data::Dumper;

sub class_name {
	return '��������';
}

sub class_description {
	return '�������� �� ���������';
}

# ���� ���������� ������� 
sub class_table {
	return 'SQL::DocumentTable';
}

# ----------------------------------------------------------------------------
# �����������. ������� ����� ������ ��� ������ � ����������� � ����� ����
#  ������ PostgreSQL.
#
# ������ �������������:
#  Contenido::Document->new()
#  Contenido::Document->new($keeper)
#  Contenido::Document->new($keeper, $id)
#
# ���������� ���� �������� ��������, ���� ��� ����������, ���� ����.
# ----------------------------------------------------------------------------
sub new {
	my ($proto, $keeper, $id) = @_;
	my $class = ref($proto) || $proto;
	my $self;

	if (defined($id) && ($id>0) && defined($keeper)) {
		$self=$keeper->get_document_by_id($id, class=>$class);
	} else {
		$self = {};
		bless($self, $class);
		$self->init();
		$self->class($class);
		$self->keeper($keeper)    if (ref $keeper);
	}
	return $self;
}

# ���������� ������� ������ (������)...
# ��� ����� ��� ���������� ��� ;)) 
# �������� ������� ��� �� �������� � ������ ��� ��� ���� 
sub section {
	shift @{[shift->sections()]};
}


####
# ��������� ����� ��� ����������� �����, �� ������� ����� ������.
# ���������������� � ����������, ���������� ������ �������� �����.
##################################################################
sub search_fields {
	return ('name');
}

####
# ��������� ����� ��� �������� ����� � ���������� ������ �������,
# ��������� � ������ ���������� ������ ������-�-������ �� ����
# field ��������� ������ class � id ������� ���������
#
# ������:
#	{
#		name	=> '�������� �����',
#		class	=> 'project::Class',
#		filter	=> 'filter_name'
#		field	=> 'table_field'
#	}
#
##################################################################
sub table_links {
	return undef;
}


####
# ��������� ������������ Jevix
##################################################################
sub jevix_conf
{
	my $jevix_conf = {
		isHTML		=> 1,		# �������� � ������ ����������� (� ������ �������� ������ �������� �������)
		lineBreaks	=> 0,		# ����������� �������� ����� <br />
		paragraphs	=> 0,		# ��������� ��������� <p>
		dashes		=> 1,		# ����
		dots		=> 1,		# ����������
		edgeSpaces	=> 1,		# ������� ���������� ������� � ������ � ����� ������
		tagSpaces	=> 1,		# ������� ������� ����� ������ (</td>  <td>)
		multiSpaces	=> 1,		# ���������� ������������� ������� � ���������
		redundantSpaces	=> 1,		# ������� ������� ���, ��� �� �� ������ ����
		compositeWords	=> 0,		# ��������� ��������� ����� � ��� <nobr>
		compositeWordsLength => 10,	# ������������ ����� ���������� �����, ������������ � ��� <nobr>
		nbsp		=> 0,		# ����������� ����������� �������
		quotes		=> 1,		# �������� �������
		qaType		=> 0,		# ��� ������� ������� (��. ��������� ����������� ���������� �� http://jevix.ru/)
		qbType		=> 1,		# ��� ��������� �������
		misc		=> 1,		# ������ ������ (&copy, ����� � ������)
		codeMode	=> 2,		# ������ ��������� ����. �������� (0: ANSI <...>, 1: HTML-��� <&#133;>, 2: HTML-�������� <&hellip;>)
		tagsDenyAll	=> 0,		# �� ��������� ��������� ��� ����
		tagsDeny	=> 'script',	# ������ �����ݣ���� �����
		tagsAllow	=> '',		# ������ �����ۣ���� ����� (��������� ��, ����� ���������� ������ ����)
		tagCloseSingle	=> 0,		# ��������� ��������� ����, ����� ��� �� �������
		tagNamesToLower	=> 0,		# ��������� ����� ����� � ������� ��������
		tagNamesToUpper	=> 0,		# ��������� ����� ����� � �������� ��������
		tagAttributesToLower => 0,	# ��������� ����� ��������� ����� � ������� ��������
		tagAttributesToUpper => 0,	# ��������� ����� ��������� ����� � �������� ��������
		tagQuoteValues	=> 0,		# �������� � ������� �������� ��������� �����
		tagUnQuoteValues => 0,		# ������� ������� ������ �������� ��������� �����
		simpleXSS	=> 1,		# �������� ��������� XSS-���� � ���� ���������
		checkHTML	=> 0,		# ��������� ����������� HTML
		logErrors	=> 0		# ����� ������ ������
	};
	return $jevix_conf;
}


1;