#!/usr/bin/perl

########## Confixx(R) 3.0 Professional ############
####### Copyright SWsoft, Inc. 2004-2005 ##########
#### http://www.sw-soft.com - info@sw-soft.com ####

# last error: 006

sub register_predefined_skins_300 {
	&inst_description("Registering predefined skins"); 
	my $dbh = &inst_db_connection();
	
	my $sth = $dbh->prepare("SELECT * FROM custom_skins");
	$sth->execute;
	unless (0 == $sth->rows) {
	    &inst_finish_skipped("'custom_skins' table is already filled with data.");
	    return 1;
	}
	
	$dbh->do("INSERT INTO custom_skins(id, name, show_name, owner_type, version, path) VALUES (1, 'skin_1', 'Blue Color Scheme', 'preinstalled', 'xp30', '/skins/skin_1')")
	    or die("Error #005 in routine customs_skins_300(): $DBI::errstr\n");
	$dbh->do("INSERT INTO custom_skins(id, name, show_name, owner_type, version, path) VALUES (2, 'skin_2', 'Green Color Scheme', 'preinstalled', 'xp30', '/skins/skin_2')")
	    or die("Error #006 in routine customs_skins_300(): $DBI::errstr\n");
	$dbh->do("INSERT INTO custom_skins(id, name, show_name, owner_type, version, path) VALUES (3, 'skin_3', 'Olivegreen Color Scheme', 'preinstalled', 'xp30', '/skins/skin_3')")
	    or die("Error #007 in routine customs_skins_300(): $DBI::errstr\n");
	$dbh->do("INSERT INTO custom_skins(id, name, show_name, owner_type, version, path) VALUES (4, 'skin_4', 'Red Color Scheme', 'preinstalled', 'xp30', '/skins/skin_4')")
	    or die("Error #008 in routine customs_skins_300(): $DBI::errstr\n");
	$dbh->do("INSERT INTO custom_skins(id, name, show_name, owner_type, version, path) VALUES (5, 'skin_5', 'Silver Color Scheme', 'preinstalled', 'xp30', '/skins/skin_5')")
	    or die("Error #009 in routine customs_skins_300(): $DBI::errstr\n");
		
	$dbh->do("INSERT INTO custom_skins(id, name, show_name, owner_type, version, path) VALUES (6, 'default', 'Confixx 2.0 Grey Color Scheme', 'preinstalled', 'classic20', 'skins/default')")
	    or die("Error #001 in routine customs_skins_300(): $DBI::errstr\n");
	$dbh->do("INSERT INTO custom_skins(id, name, show_name, owner_type, version, path) VALUES (7, 'skinblue', 'Confixx 2.0 Blue Color Scheme', 'preinstalled', 'classic20', 'skins/skinblue')")
	    or die("Error #002 in routine customs_skins_300(): $DBI::errstr\n");
	$dbh->do("INSERT INTO custom_skins(id, name, show_name, owner_type, version, path) VALUES (8, 'skingreen', 'Confixx 2.0 Green Color Scheme', 'preinstalled', 'classic20', 'skins/skingreen')")
	    or die("Error #003 in routine customs_skins_300(): $DBI::errstr\n");
	$dbh->do("INSERT INTO custom_skins(id, name, show_name, owner_type, version, path) VALUES (9, 'skinred', 'Confixx 2.0 Red Color Scheme', 'preinstalled', 'classic20', 'skins/skinred')")
	    or die("Error #004 in routine customs_skins_300(): $DBI::errstr\n");

	&inst_finish_ok();
	return 1;
}

sub upgrade_skins_300 {
	&inst_description("Upgrading skins"); 
	my $dbh = &inst_db_connection();
	
	$dbh->do("DELETE FROM skins")
	    or die("Error #006 in routine customs_skins_300(): $DBI::errstr\n");
	
	&inst_finish_ok();
}

1;
