-- sql/defaults.sql
--
-- The data that distributes with portal.
--
-- Ian Baker <ibaker@arsdigita.com>
-- $Id: defaults.sql,v 1.1 2002/07/09 17:35:10 rmello Exp $
--

-- populate the portal_content_types table.
insert
    into portal_mime_types (name, pretty_name, sort_key)
    values ('text/html', 'HTML', 1);

insert
    into portal_mime_types (name, pretty_name, sort_key)
    values ('text/plain', 'Plain Text', 2);

insert
    into portal_mime_types (name, pretty_name, sort_key)
    values ('application/x-ats', 'ATS Template Ref', 3);

-- populate the portal_data_types table.
--
-- the difference between tcl_proc and tcl_raw is that
-- it's possible to pass parameters to a procedure, so
-- element attributes can be sent to it.

insert
    into portal_data_types (name, pretty_name, sort_key)
    values ('tcl_proc', 'Tcl Procedure', 1);

insert
    into portal_data_types (name, pretty_name, sort_key)
    values ('tcl_raw', 'Raw Tcl', 2);

insert
    into portal_data_types (name, pretty_name, sort_key)
    values ('plsql', 'Oracle PL/SQL Procedure', 4);

insert
    into portal_data_types (name, pretty_name, sort_key)
    values ('adp', 'AOLserver ADP', 3);

insert
    into portal_data_types (name, pretty_name, sort_key, secure_p)
    values ('raw', 'Raw Data', 5, 't');

insert
    into portal_data_types (name, pretty_name, sort_key)
    values ('url', 'URL', 6);



-- Insert some default templates.

create function inline_0 ()
returns integer as '
declare
	template_id	integer;
begin

-- two-column template, without a header.
	template_id := portal_template__new (
		null,
		'' 2-Column'',
		''A simple 2-column layout'',
		''layout'',
		''templates/simple2'',
		''templates/components/simple2'');

-- the supported regions for that template.
	perform portal_template__add_region (template_id, ''1'', ''f'');
	perform portal_template__add_region (template_id, ''2'', ''f'');

-- same as above, only, three columns.
	template_id := portal_template__new (
	        null,
		''Simple 3-Column'',
		''A simple 3-column layout'',
		''layout'',
		''templates/simple3'',
		''templates/components/simple3'');

	perform portal_template__add_region (template_id, ''1'', ''f'');
	perform portal_template__add_region (template_id, ''2'', ''f'');
	perform portal_template__add_region (template_id, ''3'', ''f'');

-- three columns with a header.
	template_id := portal_template__new (
	        null,
		''3-column w/ Header'',
		''A 3-column layout with a header area.'',
		''layout'',
		''templates/header3'',
		''templates/components/header3'');

	perform portal_template__add_region (template_id, ''1'', ''f'');
	perform portal_template__add_region (template_id, ''2'', ''f'');
	perform portal_template__add_region (template_id, ''3'', ''f'');
	perform portal_template__add_region (template_id, ''i1'',''t'');

-- Now, some element themes.

	template_id := portal_template__new (
	        null,
		''Simple table-based thing'',
		''A test template.  Pretty crappy overall'',
		''theme'',
		''templates/simple-element'',
		''templates/components/simple-element'');

	perform portal_template__add_type (template_id, ''text/html'');
	perform portal_template__add_type (template_id, ''text/plain'');
	perform portal_template__add_type (template_id, ''application/x-ats'');

	return 0;
end;
' language 'plpgsql';

select inline_0 ();

drop function inline_0 ();


-- create a test datasource.
create function inline_1 ()
returns integer as '
declare
	datasource_id	integer;
begin
	datasource_id := portal_datasource__new (
	        null,
		''raw'',
		''application/x-ats'',
		null,
		''Portal Connector'',
		''Connects the current portal with others at the same level on the site-map.'',
		null,
		''/packages/portal/www/datasources/connector/connector'',
		null
	);

	return 0;
end;
' language 'plpgsql';

select inline_1 ();

drop function inline_1 ();
